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 v4 2/6] gpio: re-add of_node_to_gpiochip function
Date: Fri, 25 May 2012 18:01:27 -0600	[thread overview]
Message-ID: <20120526000127.A53903E0D27@localhost> (raw)
In-Reply-To: <1337952980-14621-2-git-send-email-b29396@freescale.com>

On Fri, 25 May 2012 21:36:16 +0800, Dong Aisheng <b29396@freescale.com> wrote:
> From: Dong Aisheng <dong.aisheng@linaro.org>
> 
> Signed-off-by: Dong Aisheng <dong.aisheng@linaro.org>

Nack.  Several problems here.  First and foremost there isn't any
description of *why* this change is needed or when it was removed.
Any patch beyond the most trivial change needs to have a commit
message the describes it.

Second, of_node_to_gpiochip() is no longer a valid API because gpiolib
now allows multiple gpiochips to use the same device tree node.  See
commit 3d0f7cf0f "gpio: Adjust of_xlate API to support multiple GPIO
chips" to see a description of why this was changed.

g.

> ---
>  drivers/gpio/gpiolib-of.c |   11 +++++++++++
>  include/linux/of_gpio.h   |    5 +++++
>  2 files changed, 16 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c
> index 8389d4a..b8010a9 100644
> --- a/drivers/gpio/gpiolib-of.c
> +++ b/drivers/gpio/gpiolib-of.c
> @@ -234,3 +234,14 @@ void of_gpiochip_remove(struct gpio_chip *chip)
>  	if (chip->of_node)
>  		of_node_put(chip->of_node);
>  }
> +
> +/* Private function for resolving node pointer to gpio_chip */
> +static int of_gpiochip_is_match(struct gpio_chip *chip, void *data)
> +{
> +	return chip->of_node == data;
> +}
> +
> +struct gpio_chip *of_node_to_gpiochip(struct device_node *np)
> +{
> +	return gpiochip_find(np, of_gpiochip_is_match);
> +}
> diff --git a/include/linux/of_gpio.h b/include/linux/of_gpio.h
> index c454f57..880783b 100644
> --- a/include/linux/of_gpio.h
> +++ b/include/linux/of_gpio.h
> @@ -61,6 +61,7 @@ extern void of_gpiochip_remove(struct gpio_chip *gc);
>  extern int of_gpio_simple_xlate(struct gpio_chip *gc,
>  				const struct of_phandle_args *gpiospec,
>  				u32 *flags);
> +extern struct gpio_chip *of_node_to_gpiochip(struct device_node *np);
>  
>  #else /* CONFIG_OF_GPIO */
>  
> @@ -84,6 +85,10 @@ static inline int of_gpio_simple_xlate(struct gpio_chip *gc,
>  	return -ENOSYS;
>  }
>  
> +static struct gpio_chip *of_node_to_gpiochip(struct device_node *np)
> +{
> +	return NULL;
> +}
>  static inline void of_gpiochip_add(struct gpio_chip *gc) { }
>  static inline void of_gpiochip_remove(struct gpio_chip *gc) { }
>  
> -- 
> 1.7.0.4
> 
> 

-- 
Grant Likely, B.Sc, P.Eng.
Secret Lab Technologies, Ltd.

  reply	other threads:[~2012-05-26  0:01 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-25 13:36 [PATCH v4 1/6] gpio: fix a typo of comment message Dong Aisheng
2012-05-25 13:36 ` [PATCH v4 2/6] gpio: re-add of_node_to_gpiochip function Dong Aisheng
2012-05-26  0:01   ` Grant Likely [this message]
2012-05-26 16:15     ` Dong Aisheng
2012-05-25 13:36 ` [PATCH v4 3/6] of: release node fix for of_parse_phandle_with_args Dong Aisheng
2012-05-26  0:09   ` Grant Likely
2012-05-25 13:36 ` [PATCH v4 4/6] gpio: introduce lock mechanism for gpiochip_find Dong Aisheng
2012-05-26  0:25   ` Grant Likely
2012-05-26 16:17     ` Dong Aisheng
2012-05-30  4:10     ` Dong Aisheng
2012-05-30  6:33       ` Grant Likely
2012-05-25 13:36 ` [PATCH v4 5/6] of: add of_parse_phandle_with_args_ext function Dong Aisheng
2012-05-25 16:50   ` Stephen Warren
2012-05-25 13:36 ` [PATCH v4 6/6] pinctrl: add pinctrl gpio binding support Dong Aisheng
2012-05-25 17:03   ` Stephen Warren
2012-05-26 16:52     ` Dong Aisheng
2012-05-27 15:39       ` Stephen Warren
2012-05-30  3:01         ` Dong Aisheng
2012-05-30  3:52           ` Stephen Warren
2012-05-30  6:35     ` Grant Likely
2012-05-26  0:29   ` Grant Likely
2012-05-26 16:58     ` Dong Aisheng
2012-05-30  6:46       ` Grant Likely
2012-05-30  7:29         ` Dong Aisheng
2012-05-25 23:57 ` [PATCH v4 1/6] gpio: fix a typo of comment message Grant Likely

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=20120526000127.A53903E0D27@localhost \
    --to=grant.likely@secretlab.ca \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox