public inbox for linux-arm-kernel@lists.infradead.org 
 help / color / mirror / Atom feed
From: grant.likely@secretlab•ca (Grant Likely)
To: linux-arm-kernel@lists•infradead.org
Subject: [PATCH v5 01/12] gpio: pxa: identify ed mask reg with platform data
Date: Sat, 02 Mar 2013 09:52:12 +0000	[thread overview]
Message-ID: <20130302095212.1150C3E219B@localhost> (raw)
In-Reply-To: <1361764181-26647-2-git-send-email-haojian.zhuang@linaro.org>

On Mon, 25 Feb 2013 11:49:30 +0800, Haojian Zhuang <haojian.zhuang@linaro•org> wrote:
> Avoid to judge whether edge mask register exists by CPU. Use platform
> data to identify it instead. The gpio edge mask register exists in MMP
> series SoC.
> 
> Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro•org>

Hi Haojian,

I don't think patches like this are a good idea. The driver already
knows the difference between different types of chips. Adding /more/
platform data is making life worse, not better. The diffstat is evidence
of that:

>  10 files changed, 65 insertions(+), 1 deletion(-)

If you're looking to get rid of the pxa_gpio_nums() function, then a
much better way to do it is to use a platform_device_id table and
differentiate the type by the name. You can attach data to that table
with the parameters for each chip. For example:

struct pxa_gpio_id_data pxa_gpio_id_data[] = {
	{ .count = 84, type = PXA25X_GPIO, },
	{ .count = 89, type = PXA26X_GPIO, },
	{ .count = 127, type = MMP_GPIO, },
};

static const struct platform_device_id pxa_gpio_id_table[] = {
	{ "pxa25x-gpio", (unsigned long) &pxa_gpio_id_data[0], },
	{ "pxa65x-gpio", (unsigned long) &pxa_gpio_id_data[1], },
	{ "mmp-gpio", (unsigned long) &pxa_gpio_id_data[2], },
};

static struct platform_driver pxa_gpio_driver = {
	.probe = pxa_gpio_probe,
	.driver = {
		.name = "pxa-gpio",
		.of_match_table = of_match_ptr(pxa_gpio_dt_ids),
	},
	.id_table = pxa_gpio_id_table,
};

And that same data table can be used in the of_match_table too.

g.

  reply	other threads:[~2013-03-02  9:52 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-25  3:49 [PATCH v5 00/12] enhance DT support on gpio pxa Haojian Zhuang
2013-02-25  3:49 ` [PATCH v5 01/12] gpio: pxa: identify ed mask reg with platform data Haojian Zhuang
2013-03-02  9:52   ` Grant Likely [this message]
2013-03-04  0:52     ` Haojian Zhuang
2013-02-25  3:49 ` [PATCH v5 02/12] gpio: pxa: clean code with same variable name Haojian Zhuang
2013-02-25  3:49 ` [PATCH v5 03/12] gpio: pxa: rename function name Haojian Zhuang
2013-02-25  3:49 ` [PATCH v5 04/12] gpio: pxa: use platform data for gpio inverted Haojian Zhuang
2013-02-25  3:49 ` [PATCH v5 05/12] gpio: pxa: remove gpio_type Haojian Zhuang
2013-02-25  3:49 ` [PATCH v5 06/12] gpio: pxa: define nr gpios in platform data Haojian Zhuang
2013-02-25  3:49 ` [PATCH v5 07/12] gpio: pxa: add irq base " Haojian Zhuang
2013-02-25  3:49 ` [PATCH v5 08/12] document: devicetree: add properties in mrvl gpio Haojian Zhuang
2013-02-25  3:49 ` [PATCH v5 09/12] gpio: pxa: remove arch related macro Haojian Zhuang
2013-02-25  3:49 ` [PATCH v5 10/12] gpio: pxa: move gpio properties into child node Haojian Zhuang
2013-02-25  3:49 ` [PATCH v5 11/12] gpio: pxa: bind to pinctrl by request Haojian Zhuang
2013-02-25  3:49 ` [PATCH v5 12/12] ARM: dts: support pinmux in pxa910 Haojian Zhuang
2013-03-01  0:52   ` Linus Walleij
2013-03-01  0:49 ` [PATCH v5 00/12] enhance DT support on gpio pxa Linus Walleij
2013-03-04  0:57   ` Haojian Zhuang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130302095212.1150C3E219B@localhost \
    --to=grant.likely@secretlab$(echo .)ca \
    --cc=linux-arm-kernel@lists$(echo .)infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox