diff mbox

[156/182] input: adp5589-keys: use gpiochip data pointer

Message ID 1449668710-5785-1-git-send-email-linus.walleij@linaro.org
State New
Headers show

Commit Message

Linus Walleij Dec. 9, 2015, 1:45 p.m. UTC
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>
---
Dmitry: please ACK this so I can take it through the GPIO tree.
---
 drivers/input/keyboard/adp5589-keys.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Comments

Hennerich, Michael Dec. 9, 2015, 1:43 p.m. UTC | #1
On 12/09/2015 02:45 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.
> ---
>   drivers/input/keyboard/adp5589-keys.c | 10 +++++-----
>   1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/input/keyboard/adp5589-keys.c b/drivers/input/keyboard/adp5589-keys.c
> index 4d446d5085aa..0b72345cf7b6 100644
> --- a/drivers/input/keyboard/adp5589-keys.c
> +++ b/drivers/input/keyboard/adp5589-keys.c
> @@ -387,7 +387,7 @@ static int adp5589_write(struct i2c_client *client, u8 reg, u8 val)
>   #ifdef CONFIG_GPIOLIB
>   static int adp5589_gpio_get_value(struct gpio_chip *chip, unsigned off)
>   {
> -	struct adp5589_kpad *kpad = container_of(chip, struct adp5589_kpad, gc);
> +	struct adp5589_kpad *kpad = gpiochip_get_data(chip);
>   	unsigned int bank = kpad->var->bank(kpad->gpiomap[off]);
>   	unsigned int bit = kpad->var->bit(kpad->gpiomap[off]);
>
> @@ -399,7 +399,7 @@ static int adp5589_gpio_get_value(struct gpio_chip *chip, unsigned off)
>   static void adp5589_gpio_set_value(struct gpio_chip *chip,
>   				   unsigned off, int val)
>   {
> -	struct adp5589_kpad *kpad = container_of(chip, struct adp5589_kpad, gc);
> +	struct adp5589_kpad *kpad = gpiochip_get_data(chip);
>   	unsigned int bank = kpad->var->bank(kpad->gpiomap[off]);
>   	unsigned int bit = kpad->var->bit(kpad->gpiomap[off]);
>
> @@ -418,7 +418,7 @@ static void adp5589_gpio_set_value(struct gpio_chip *chip,
>
>   static int adp5589_gpio_direction_input(struct gpio_chip *chip, unsigned off)
>   {
> -	struct adp5589_kpad *kpad = container_of(chip, struct adp5589_kpad, gc);
> +	struct adp5589_kpad *kpad = gpiochip_get_data(chip);
>   	unsigned int bank = kpad->var->bank(kpad->gpiomap[off]);
>   	unsigned int bit = kpad->var->bit(kpad->gpiomap[off]);
>   	int ret;
> @@ -438,7 +438,7 @@ static int adp5589_gpio_direction_input(struct gpio_chip *chip, unsigned off)
>   static int adp5589_gpio_direction_output(struct gpio_chip *chip,
>   					 unsigned off, int val)
>   {
> -	struct adp5589_kpad *kpad = container_of(chip, struct adp5589_kpad, gc);
> +	struct adp5589_kpad *kpad = gpiochip_get_data(chip);
>   	unsigned int bank = kpad->var->bank(kpad->gpiomap[off]);
>   	unsigned int bit = kpad->var->bit(kpad->gpiomap[off]);
>   	int ret;
> @@ -525,7 +525,7 @@ static int adp5589_gpio_add(struct adp5589_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;
>
Hennerich, Michael Dec. 9, 2015, 1:43 p.m. UTC | #2
On 12/09/2015 02:45 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.
> ---
>   drivers/input/keyboard/adp5589-keys.c | 10 +++++-----
>   1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/input/keyboard/adp5589-keys.c b/drivers/input/keyboard/adp5589-keys.c
> index 4d446d5085aa..0b72345cf7b6 100644
> --- a/drivers/input/keyboard/adp5589-keys.c
> +++ b/drivers/input/keyboard/adp5589-keys.c
> @@ -387,7 +387,7 @@ static int adp5589_write(struct i2c_client *client, u8 reg, u8 val)
>   #ifdef CONFIG_GPIOLIB
>   static int adp5589_gpio_get_value(struct gpio_chip *chip, unsigned off)
>   {
> -	struct adp5589_kpad *kpad = container_of(chip, struct adp5589_kpad, gc);
> +	struct adp5589_kpad *kpad = gpiochip_get_data(chip);
>   	unsigned int bank = kpad->var->bank(kpad->gpiomap[off]);
>   	unsigned int bit = kpad->var->bit(kpad->gpiomap[off]);
>
> @@ -399,7 +399,7 @@ static int adp5589_gpio_get_value(struct gpio_chip *chip, unsigned off)
>   static void adp5589_gpio_set_value(struct gpio_chip *chip,
>   				   unsigned off, int val)
>   {
> -	struct adp5589_kpad *kpad = container_of(chip, struct adp5589_kpad, gc);
> +	struct adp5589_kpad *kpad = gpiochip_get_data(chip);
>   	unsigned int bank = kpad->var->bank(kpad->gpiomap[off]);
>   	unsigned int bit = kpad->var->bit(kpad->gpiomap[off]);
>
> @@ -418,7 +418,7 @@ static void adp5589_gpio_set_value(struct gpio_chip *chip,
>
>   static int adp5589_gpio_direction_input(struct gpio_chip *chip, unsigned off)
>   {
> -	struct adp5589_kpad *kpad = container_of(chip, struct adp5589_kpad, gc);
> +	struct adp5589_kpad *kpad = gpiochip_get_data(chip);
>   	unsigned int bank = kpad->var->bank(kpad->gpiomap[off]);
>   	unsigned int bit = kpad->var->bit(kpad->gpiomap[off]);
>   	int ret;
> @@ -438,7 +438,7 @@ static int adp5589_gpio_direction_input(struct gpio_chip *chip, unsigned off)
>   static int adp5589_gpio_direction_output(struct gpio_chip *chip,
>   					 unsigned off, int val)
>   {
> -	struct adp5589_kpad *kpad = container_of(chip, struct adp5589_kpad, gc);
> +	struct adp5589_kpad *kpad = gpiochip_get_data(chip);
>   	unsigned int bank = kpad->var->bank(kpad->gpiomap[off]);
>   	unsigned int bit = kpad->var->bit(kpad->gpiomap[off]);
>   	int ret;
> @@ -525,7 +525,7 @@ static int adp5589_gpio_add(struct adp5589_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;
>
Michael Welling Dec. 9, 2015, 11:47 p.m. UTC | #3
On Wed, Dec 09, 2015 at 02:45:10PM +0100, Linus Walleij wrote:
> @@ -525,7 +525,7 @@ static int adp5589_gpio_add(struct adp5589_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);

Another dev_err referencing gpiochip_add instead of gpiochip_add_data.

>  		return error;
> -- 
> 2.4.3
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Linus Walleij Dec. 13, 2015, 9 p.m. UTC | #4
On Thu, Dec 10, 2015 at 12:47 AM, Michael Welling <mwelling@ieee.org> wrote:
> On Wed, Dec 09, 2015 at 02:45:10PM +0100, Linus Walleij wrote:
>> @@ -525,7 +525,7 @@ static int adp5589_gpio_add(struct adp5589_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);
>
> Another dev_err referencing gpiochip_add instead of gpiochip_add_data.

I just went in and edited the commit. No other change so not resending,
OK?

First I thought this textstring thing was minor but now I'm fixing it up,
why not.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Dmitry Torokhov Dec. 16, 2015, 10:07 p.m. UTC | #5
On Wed, Dec 09, 2015 at 02:45:10PM +0100, 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>
> ---
> Dmitry: please ACK this so I can take it through the GPIO tree.

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

> ---
>  drivers/input/keyboard/adp5589-keys.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/input/keyboard/adp5589-keys.c b/drivers/input/keyboard/adp5589-keys.c
> index 4d446d5085aa..0b72345cf7b6 100644
> --- a/drivers/input/keyboard/adp5589-keys.c
> +++ b/drivers/input/keyboard/adp5589-keys.c
> @@ -387,7 +387,7 @@ static int adp5589_write(struct i2c_client *client, u8 reg, u8 val)
>  #ifdef CONFIG_GPIOLIB
>  static int adp5589_gpio_get_value(struct gpio_chip *chip, unsigned off)
>  {
> -	struct adp5589_kpad *kpad = container_of(chip, struct adp5589_kpad, gc);
> +	struct adp5589_kpad *kpad = gpiochip_get_data(chip);
>  	unsigned int bank = kpad->var->bank(kpad->gpiomap[off]);
>  	unsigned int bit = kpad->var->bit(kpad->gpiomap[off]);
>  
> @@ -399,7 +399,7 @@ static int adp5589_gpio_get_value(struct gpio_chip *chip, unsigned off)
>  static void adp5589_gpio_set_value(struct gpio_chip *chip,
>  				   unsigned off, int val)
>  {
> -	struct adp5589_kpad *kpad = container_of(chip, struct adp5589_kpad, gc);
> +	struct adp5589_kpad *kpad = gpiochip_get_data(chip);
>  	unsigned int bank = kpad->var->bank(kpad->gpiomap[off]);
>  	unsigned int bit = kpad->var->bit(kpad->gpiomap[off]);
>  
> @@ -418,7 +418,7 @@ static void adp5589_gpio_set_value(struct gpio_chip *chip,
>  
>  static int adp5589_gpio_direction_input(struct gpio_chip *chip, unsigned off)
>  {
> -	struct adp5589_kpad *kpad = container_of(chip, struct adp5589_kpad, gc);
> +	struct adp5589_kpad *kpad = gpiochip_get_data(chip);
>  	unsigned int bank = kpad->var->bank(kpad->gpiomap[off]);
>  	unsigned int bit = kpad->var->bit(kpad->gpiomap[off]);
>  	int ret;
> @@ -438,7 +438,7 @@ static int adp5589_gpio_direction_input(struct gpio_chip *chip, unsigned off)
>  static int adp5589_gpio_direction_output(struct gpio_chip *chip,
>  					 unsigned off, int val)
>  {
> -	struct adp5589_kpad *kpad = container_of(chip, struct adp5589_kpad, gc);
> +	struct adp5589_kpad *kpad = gpiochip_get_data(chip);
>  	unsigned int bank = kpad->var->bank(kpad->gpiomap[off]);
>  	unsigned int bit = kpad->var->bit(kpad->gpiomap[off]);
>  	int ret;
> @@ -525,7 +525,7 @@ static int adp5589_gpio_add(struct adp5589_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;
> -- 
> 2.4.3
>
diff mbox

Patch

diff --git a/drivers/input/keyboard/adp5589-keys.c b/drivers/input/keyboard/adp5589-keys.c
index 4d446d5085aa..0b72345cf7b6 100644
--- a/drivers/input/keyboard/adp5589-keys.c
+++ b/drivers/input/keyboard/adp5589-keys.c
@@ -387,7 +387,7 @@  static int adp5589_write(struct i2c_client *client, u8 reg, u8 val)
 #ifdef CONFIG_GPIOLIB
 static int adp5589_gpio_get_value(struct gpio_chip *chip, unsigned off)
 {
-	struct adp5589_kpad *kpad = container_of(chip, struct adp5589_kpad, gc);
+	struct adp5589_kpad *kpad = gpiochip_get_data(chip);
 	unsigned int bank = kpad->var->bank(kpad->gpiomap[off]);
 	unsigned int bit = kpad->var->bit(kpad->gpiomap[off]);
 
@@ -399,7 +399,7 @@  static int adp5589_gpio_get_value(struct gpio_chip *chip, unsigned off)
 static void adp5589_gpio_set_value(struct gpio_chip *chip,
 				   unsigned off, int val)
 {
-	struct adp5589_kpad *kpad = container_of(chip, struct adp5589_kpad, gc);
+	struct adp5589_kpad *kpad = gpiochip_get_data(chip);
 	unsigned int bank = kpad->var->bank(kpad->gpiomap[off]);
 	unsigned int bit = kpad->var->bit(kpad->gpiomap[off]);
 
@@ -418,7 +418,7 @@  static void adp5589_gpio_set_value(struct gpio_chip *chip,
 
 static int adp5589_gpio_direction_input(struct gpio_chip *chip, unsigned off)
 {
-	struct adp5589_kpad *kpad = container_of(chip, struct adp5589_kpad, gc);
+	struct adp5589_kpad *kpad = gpiochip_get_data(chip);
 	unsigned int bank = kpad->var->bank(kpad->gpiomap[off]);
 	unsigned int bit = kpad->var->bit(kpad->gpiomap[off]);
 	int ret;
@@ -438,7 +438,7 @@  static int adp5589_gpio_direction_input(struct gpio_chip *chip, unsigned off)
 static int adp5589_gpio_direction_output(struct gpio_chip *chip,
 					 unsigned off, int val)
 {
-	struct adp5589_kpad *kpad = container_of(chip, struct adp5589_kpad, gc);
+	struct adp5589_kpad *kpad = gpiochip_get_data(chip);
 	unsigned int bank = kpad->var->bank(kpad->gpiomap[off]);
 	unsigned int bit = kpad->var->bit(kpad->gpiomap[off]);
 	int ret;
@@ -525,7 +525,7 @@  static int adp5589_gpio_add(struct adp5589_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;