linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 158/182] leds: pca9532: use gpiochip data pointer
@ 2015-12-09 13:46 Linus Walleij
  2015-12-09 14:29 ` Jacek Anaszewski
  0 siblings, 1 reply; 3+ messages in thread
From: Linus Walleij @ 2015-12-09 13:46 UTC (permalink / raw)
  To: linux-gpio, Johan Hovold, Alexandre Courbot, Michael Welling,
	Markus Pargmann, Riku Voipio, Richard Purdie, Jacek Anaszewski
  Cc: Linus Walleij, linux-leds

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: Riku Voipio <riku.voipio@iki.fi>
Cc: Richard Purdie <rpurdie@rpsys.net>
Cc: Jacek Anaszewski <j.anaszewski@samsung.com>
Cc: linux-leds@vger.kernel.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
LEDS people: please ACK this so I can merge it in the GPIO tree.
---
 drivers/leds/leds-pca9532.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/leds/leds-pca9532.c b/drivers/leds/leds-pca9532.c
index a975b32ee8c8..1b228adfd1a7 100644
--- a/drivers/leds/leds-pca9532.c
+++ b/drivers/leds/leds-pca9532.c
@@ -245,7 +245,7 @@ static void pca9532_led_work(struct work_struct *work)
 #ifdef CONFIG_LEDS_PCA9532_GPIO
 static int pca9532_gpio_request_pin(struct gpio_chip *gc, unsigned offset)
 {
-	struct pca9532_data *data = container_of(gc, struct pca9532_data, gpio);
+	struct pca9532_data *data = gpiochip_get_data(gc);
 	struct pca9532_led *led = &data->leds[offset];
 
 	if (led->type == PCA9532_TYPE_GPIO)
@@ -256,7 +256,7 @@ static int pca9532_gpio_request_pin(struct gpio_chip *gc, unsigned offset)
 
 static void pca9532_gpio_set_value(struct gpio_chip *gc, unsigned offset, int val)
 {
-	struct pca9532_data *data = container_of(gc, struct pca9532_data, gpio);
+	struct pca9532_data *data = gpiochip_get_data(gc);
 	struct pca9532_led *led = &data->leds[offset];
 
 	if (val)
@@ -269,7 +269,7 @@ static void pca9532_gpio_set_value(struct gpio_chip *gc, unsigned offset, int va
 
 static int pca9532_gpio_get_value(struct gpio_chip *gc, unsigned offset)
 {
-	struct pca9532_data *data = container_of(gc, struct pca9532_data, gpio);
+	struct pca9532_data *data = gpiochip_get_data(gc);
 	unsigned char reg;
 
 	reg = i2c_smbus_read_byte_data(data->client, PCA9532_REG_INPUT(offset));
@@ -416,7 +416,7 @@ static int pca9532_configure(struct i2c_client *client,
 		data->gpio.parent = &client->dev;
 		data->gpio.owner = THIS_MODULE;
 
-		err = gpiochip_add(&data->gpio);
+		err = gpiochip_add_data(&data->gpio, data);
 		if (err) {
 			/* Use data->gpio.dev as a flag for freeing gpiochip */
 			data->gpio.parent = NULL;
-- 
2.4.3

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 158/182] leds: pca9532: use gpiochip data pointer
  2015-12-09 13:46 [PATCH 158/182] leds: pca9532: use gpiochip data pointer Linus Walleij
@ 2015-12-09 14:29 ` Jacek Anaszewski
  2015-12-11 18:39   ` Linus Walleij
  0 siblings, 1 reply; 3+ messages in thread
From: Jacek Anaszewski @ 2015-12-09 14:29 UTC (permalink / raw)
  To: Linus Walleij
  Cc: linux-gpio, Johan Hovold, Alexandre Courbot, Michael Welling,
	Markus Pargmann, Riku Voipio, Richard Purdie, linux-leds

On 12/09/2015 02:46 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: Riku Voipio <riku.voipio@iki.fi>
> Cc: Richard Purdie <rpurdie@rpsys.net>
> Cc: Jacek Anaszewski <j.anaszewski@samsung.com>
> Cc: linux-leds@vger.kernel.org
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
> LEDS people: please ACK this so I can merge it in the GPIO tree.
> ---
>   drivers/leds/leds-pca9532.c | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/leds/leds-pca9532.c b/drivers/leds/leds-pca9532.c
> index a975b32ee8c8..1b228adfd1a7 100644
> --- a/drivers/leds/leds-pca9532.c
> +++ b/drivers/leds/leds-pca9532.c
> @@ -245,7 +245,7 @@ static void pca9532_led_work(struct work_struct *work)
>   #ifdef CONFIG_LEDS_PCA9532_GPIO
>   static int pca9532_gpio_request_pin(struct gpio_chip *gc, unsigned offset)
>   {
> -	struct pca9532_data *data = container_of(gc, struct pca9532_data, gpio);
> +	struct pca9532_data *data = gpiochip_get_data(gc);
>   	struct pca9532_led *led = &data->leds[offset];
>
>   	if (led->type == PCA9532_TYPE_GPIO)
> @@ -256,7 +256,7 @@ static int pca9532_gpio_request_pin(struct gpio_chip *gc, unsigned offset)
>
>   static void pca9532_gpio_set_value(struct gpio_chip *gc, unsigned offset, int val)
>   {
> -	struct pca9532_data *data = container_of(gc, struct pca9532_data, gpio);
> +	struct pca9532_data *data = gpiochip_get_data(gc);
>   	struct pca9532_led *led = &data->leds[offset];
>
>   	if (val)
> @@ -269,7 +269,7 @@ static void pca9532_gpio_set_value(struct gpio_chip *gc, unsigned offset, int va
>
>   static int pca9532_gpio_get_value(struct gpio_chip *gc, unsigned offset)
>   {
> -	struct pca9532_data *data = container_of(gc, struct pca9532_data, gpio);
> +	struct pca9532_data *data = gpiochip_get_data(gc);
>   	unsigned char reg;
>
>   	reg = i2c_smbus_read_byte_data(data->client, PCA9532_REG_INPUT(offset));
> @@ -416,7 +416,7 @@ static int pca9532_configure(struct i2c_client *client,
>   		data->gpio.parent = &client->dev;
>   		data->gpio.owner = THIS_MODULE;
>
> -		err = gpiochip_add(&data->gpio);
> +		err = gpiochip_add_data(&data->gpio, data);
>   		if (err) {
>   			/* Use data->gpio.dev as a flag for freeing gpiochip */
>   			data->gpio.parent = NULL;
>

This applies only with 3-way merge due to work queue removal related
changes that already sit on LED git. Nothing clever can be done to fix
that since those changes depend on LED core changes and this patch
depends on GPIO changes. We'll need to add relevant remarks in the pull
requests.

Acked-by: Jacek Anaszewski <j.anaszewski@samsung.com>

-- 
Best Regards,
Jacek Anaszewski

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 158/182] leds: pca9532: use gpiochip data pointer
  2015-12-09 14:29 ` Jacek Anaszewski
@ 2015-12-11 18:39   ` Linus Walleij
  0 siblings, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2015-12-11 18:39 UTC (permalink / raw)
  To: Jacek Anaszewski, linux-next@vger.kernel.org
  Cc: linux-gpio@vger.kernel.org, Johan Hovold, Alexandre Courbot,
	Michael Welling, Markus Pargmann, Riku Voipio, Richard Purdie,
	linux-leds@vger.kernel.org

On Wed, Dec 9, 2015 at 3:29 PM, Jacek Anaszewski
<j.anaszewski@samsung.com> wrote:

> This applies only with 3-way merge due to work queue removal related
> changes that already sit on LED git. Nothing clever can be done to fix
> that since those changes depend on LED core changes and this patch
> depends on GPIO changes. We'll need to add relevant remarks in the pull
> requests.

OK we will notice it in linux-next first I guess, so CC:in that list.
I plan to merge this into the GPIO tree next week.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-12-11 18:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-09 13:46 [PATCH 158/182] leds: pca9532: use gpiochip data pointer Linus Walleij
2015-12-09 14:29 ` Jacek Anaszewski
2015-12-11 18:39   ` Linus Walleij

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).