From: grinberg@compulab.co.il (Igor Grinberg)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 09/10] gpio: pxa: move gpio properties into child node
Date: Mon, 28 Jan 2013 13:27:35 +0200 [thread overview]
Message-ID: <510660A7.5000806@compulab.co.il> (raw)
In-Reply-To: <1358929554-32265-10-git-send-email-haojian.zhuang@linaro.org>
On 01/23/13 10:25, Haojian Zhuang wrote:
> Move gpio properties into child node. So pinctrl driver could binds to
> each gpio chip with gpio range.
>
> Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
> ---
> drivers/gpio/gpio-pxa.c | 33 ++++++++-------------------------
> 1 file changed, 8 insertions(+), 25 deletions(-)
>
> diff --git a/drivers/gpio/gpio-pxa.c b/drivers/gpio/gpio-pxa.c
> index 21cf8fd..528f742 100644
> --- a/drivers/gpio/gpio-pxa.c
> +++ b/drivers/gpio/gpio-pxa.c
> @@ -63,10 +63,6 @@
>
> int pxa_last_gpio;
>
> -#ifdef CONFIG_OF
> -static struct device_node *pxa_gpio_of_node;
> -#endif
> -
> struct pxa_gpio_chip {
> struct gpio_chip chip;
> void __iomem *regbase;
> @@ -404,9 +400,9 @@ static const struct irq_domain_ops pxa_irq_domain_ops = {
>
> static int pxa_gpio_probe_dt(struct platform_device *pdev)
> {
> - int ret, nr_banks;
> + int ret;
> struct pxa_gpio_platform_data *pdata;
> - struct device_node *prev, *next, *np = pdev->dev.of_node;
> + struct device_node *np = pdev->dev.of_node;
> const struct of_device_id *of_id =
> of_match_device(pxa_gpio_dt_ids, &pdev->dev);
>
> @@ -432,25 +428,7 @@ static int pxa_gpio_probe_dt(struct platform_device *pdev)
> /* set the platform data */
> pdev->dev.platform_data = pdata;
>
> - next = of_get_next_child(np, NULL);
> - prev = next;
> - if (!next) {
> - dev_err(&pdev->dev, "Failed to find child gpio node\n");
> - ret = -EINVAL;
> - goto err;
> - }
> - for (nr_banks = 1; ; nr_banks++) {
> - next = of_get_next_child(np, prev);
> - if (!next)
> - break;
> - prev = next;
> - }
> - of_node_put(prev);
> -
> return 0;
> -err:
> - iounmap(gpio_reg_base);
> - return ret;
> }
> #else
> #define pxa_gpio_probe_dt(pdev) (-1)
> @@ -460,6 +438,7 @@ static int pxa_init_gpio_chip(struct platform_device *pdev, int gpio_end,
> int (*set_wake)(unsigned int, unsigned int))
> {
> int i, gpio, nbanks = gpio_to_bank(gpio_end) + 1;
> + struct device_node *next, *np = pdev->dev.of_node;
The above introduces:
drivers/gpio/gpio-pxa.c:453: warning: unused variable 'np'
drivers/gpio/gpio-pxa.c:453: warning: unused variable 'next'
for the !CONFIG_OF case (after the below is fixed).
> struct pxa_gpio_chip *chips;
>
> chips = devm_kzalloc(&pdev->dev, nbanks * sizeof(*chips), GFP_KERNEL);
> @@ -468,6 +447,7 @@ static int pxa_init_gpio_chip(struct platform_device *pdev, int gpio_end,
> return -ENOMEM;
> }
>
> + next = of_get_next_child(np, NULL);
This does not compile for the !CONFIG_OF case, so at least,
you should #ifdef the above line or probably the better solution would be
to stub out the of_get_next_child() in the OF code (probably include/linux/of.h).
> for (i = 0, gpio = 0; i < nbanks; i++, gpio += 32) {
> struct gpio_chip *gc = &chips[i].chip;
>
> @@ -495,7 +475,10 @@ static int pxa_init_gpio_chip(struct platform_device *pdev, int gpio_end,
> gc->set = pxa_gpio_set;
> gc->to_irq = pxa_gpio_to_irq;
> #ifdef CONFIG_OF_GPIO
> - gc->of_node = pxa_gpio_of_node;
> + gc->of_node = next;
> + next = of_get_next_child(np, next);
> + of_node_put(gc->of_node);
> +
> gc->of_xlate = pxa_gpio_of_xlate;
> gc->of_gpio_n_cells = 2;
> #endif
>
--
Regards,
Igor.
next prev parent reply other threads:[~2013-01-28 11:27 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-23 8:25 [PATCH 00/10] rework gpio pxa driver for pinctrl Haojian Zhuang
2013-01-23 8:25 ` [PATCH 01/10] gpio: pxa: set initcall level to module init Haojian Zhuang
2013-01-25 9:51 ` Linus Walleij
2013-01-25 21:01 ` Robert Jarzmik
2013-01-28 4:26 ` Haojian Zhuang
2013-01-28 10:27 ` Linus Walleij
2013-01-23 8:25 ` [PATCH 02/10] gpio: pxa: identify ed mask reg with platform data Haojian Zhuang
2013-01-25 9:54 ` Linus Walleij
2013-01-25 9:57 ` Linus Walleij
2013-01-25 10:00 ` Haojian Zhuang
2013-01-29 17:33 ` Olof Johansson
2013-01-23 8:25 ` [PATCH 03/10] gpio: pxa: avoid to use global irq base Haojian Zhuang
2013-01-28 11:07 ` Igor Grinberg
2013-01-29 16:13 ` Haojian Zhuang
2013-01-23 8:25 ` [PATCH 04/10] gpio: pxa: use platform data for gpio inverted Haojian Zhuang
2013-01-25 9:59 ` Linus Walleij
2013-01-23 8:25 ` [PATCH 05/10] gpio: pxa: remove gpio_type Haojian Zhuang
2013-01-25 10:01 ` Linus Walleij
2013-01-28 11:29 ` Igor Grinberg
2013-01-31 20:54 ` Linus Walleij
2013-01-23 8:25 ` [PATCH 06/10] gpio: pxa: define nr gpios in platform data Haojian Zhuang
2013-01-28 8:02 ` Igor Grinberg
2013-01-23 8:25 ` [PATCH 07/10] gpio: pxa: clean code for compatible name Haojian Zhuang
2013-01-23 8:25 ` [PATCH 08/10] gpio: pxa: remove arch related macro Haojian Zhuang
2013-01-23 8:25 ` [PATCH 09/10] gpio: pxa: move gpio properties into child node Haojian Zhuang
2013-01-28 11:27 ` Igor Grinberg [this message]
2013-01-23 8:25 ` [PATCH 10/10] gpio: pxa: bind to pinctrl by request Haojian Zhuang
2013-01-23 12:27 ` [PATCH 00/10] rework gpio pxa driver for pinctrl Linus Walleij
[not found] ` <20130123131503.GJ2239@intel.com>
2013-01-25 9:49 ` Linus Walleij
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=510660A7.5000806@compulab.co.il \
--to=grinberg@compulab.co.il \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.