linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Michael Hennerich <michael.hennerich@analog.com>
Cc: Linus Walleij <linus.walleij@linaro.org>,
	linux-gpio@vger.kernel.org, Johan Hovold <johan@kernel.org>,
	Alexandre Courbot <acourbot@nvidia.com>,
	Michael Welling <mwelling@ieee.org>,
	Markus Pargmann <mpa@pengutronix.de>
Subject: Re: [PATCH 155/182] input: adp5588-keys: use gpiochip data pointer
Date: Wed, 16 Dec 2015 14:07:32 -0800	[thread overview]
Message-ID: <20151216220732.GB10962@dtor-ws> (raw)
In-Reply-To: <56682FD8.8080003@analog.com>

On Wed, Dec 09, 2015 at 02:42:48PM +0100, Michael Hennerich wrote:
> On 12/09/2015 02:44 PM, Linus Walleij wrote:
> >This makes the driver use the data pointer added to the gpio_chip
> >to store a pointer to the state container instead of relying on
> >container_of().
> >
> >Cc: Michael Hennerich <michael.hennerich@analog.com>
> >Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> >Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> 
> Acked-by: Michael Hennerich <michael.hennerich@analog.com>
> 
> >---
> >Dmitry: please ACK this so I can take it through the GPIO tree.

In case you decided to continue with this approach:

Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

> >---
> >  drivers/input/keyboard/adp5588-keys.c | 10 +++++-----
> >  1 file changed, 5 insertions(+), 5 deletions(-)
> >
> >diff --git a/drivers/input/keyboard/adp5588-keys.c b/drivers/input/keyboard/adp5588-keys.c
> >index 21a62d0fa764..53fe9a3fb620 100644
> >--- a/drivers/input/keyboard/adp5588-keys.c
> >+++ b/drivers/input/keyboard/adp5588-keys.c
> >@@ -73,7 +73,7 @@ static int adp5588_write(struct i2c_client *client, u8 reg, u8 val)
> >  #ifdef CONFIG_GPIOLIB
> >  static int adp5588_gpio_get_value(struct gpio_chip *chip, unsigned off)
> >  {
> >-	struct adp5588_kpad *kpad = container_of(chip, struct adp5588_kpad, gc);
> >+	struct adp5588_kpad *kpad = gpiochip_get_data(chip);
> >  	unsigned int bank = ADP5588_BANK(kpad->gpiomap[off]);
> >  	unsigned int bit = ADP5588_BIT(kpad->gpiomap[off]);
> >  	int val;
> >@@ -93,7 +93,7 @@ static int adp5588_gpio_get_value(struct gpio_chip *chip, unsigned off)
> >  static void adp5588_gpio_set_value(struct gpio_chip *chip,
> >  				   unsigned off, int val)
> >  {
> >-	struct adp5588_kpad *kpad = container_of(chip, struct adp5588_kpad, gc);
> >+	struct adp5588_kpad *kpad = gpiochip_get_data(chip);
> >  	unsigned int bank = ADP5588_BANK(kpad->gpiomap[off]);
> >  	unsigned int bit = ADP5588_BIT(kpad->gpiomap[off]);
> >
> >@@ -112,7 +112,7 @@ static void adp5588_gpio_set_value(struct gpio_chip *chip,
> >
> >  static int adp5588_gpio_direction_input(struct gpio_chip *chip, unsigned off)
> >  {
> >-	struct adp5588_kpad *kpad = container_of(chip, struct adp5588_kpad, gc);
> >+	struct adp5588_kpad *kpad = gpiochip_get_data(chip);
> >  	unsigned int bank = ADP5588_BANK(kpad->gpiomap[off]);
> >  	unsigned int bit = ADP5588_BIT(kpad->gpiomap[off]);
> >  	int ret;
> >@@ -130,7 +130,7 @@ static int adp5588_gpio_direction_input(struct gpio_chip *chip, unsigned off)
> >  static int adp5588_gpio_direction_output(struct gpio_chip *chip,
> >  					 unsigned off, int val)
> >  {
> >-	struct adp5588_kpad *kpad = container_of(chip, struct adp5588_kpad, gc);
> >+	struct adp5588_kpad *kpad = gpiochip_get_data(chip);
> >  	unsigned int bank = ADP5588_BANK(kpad->gpiomap[off]);
> >  	unsigned int bit = ADP5588_BIT(kpad->gpiomap[off]);
> >  	int ret;
> >@@ -210,7 +210,7 @@ static int adp5588_gpio_add(struct adp5588_kpad *kpad)
> >
> >  	mutex_init(&kpad->gpio_lock);
> >
> >-	error = gpiochip_add(&kpad->gc);
> >+	error = gpiochip_add_data(&kpad->gc, kpad);
> >  	if (error) {
> >  		dev_err(dev, "gpiochip_add failed, err: %d\n", error);
> >  		return error;
> >
> 
> 
> -- 
> Greetings,
> Michael
> 
> --
> Analog Devices GmbH      Wilhelm-Wagenfeld-Str. 6      80807 Muenchen
> Sitz der Gesellschaft: Muenchen; Registergericht: Muenchen HRB 40368;
> Geschaeftsfuehrer:Dr.Carsten Suckrow, Thomas Wessel, William A. Martin,
> Margaret Seif

-- 
Dmitry

      reply	other threads:[~2015-12-16 22:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-09 13:44 [PATCH 155/182] input: adp5588-keys: use gpiochip data pointer Linus Walleij
2015-12-09 13:42 ` Michael Hennerich
2015-12-16 22:07   ` Dmitry Torokhov [this message]

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=20151216220732.GB10962@dtor-ws \
    --to=dmitry.torokhov@gmail.com \
    --cc=acourbot@nvidia.com \
    --cc=johan@kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=michael.hennerich@analog.com \
    --cc=mpa@pengutronix.de \
    --cc=mwelling@ieee.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;
as well as URLs for NNTP newsgroup(s).