Re: [PATCH 172/182] staging: vme: use gpiochip data pointer

2016-02-07 Thread Greg Kroah-Hartman
On Wed, Dec 09, 2015 at 02:50:05PM +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: Greg Kroah-Hartman 
> Cc: Martyn Welch 
> Cc: Manohar Vanga 
> Cc: de...@driverdev.osuosl.org
> Signed-off-by: Linus Walleij 
> ---
> Greg, please ACK this so I can take this through the GPIO tree.

Acked-by: Greg Kroah-Hartman 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 172/182] staging: vme: use gpiochip data pointer

2015-12-14 Thread Linus Walleij
On Fri, Dec 11, 2015 at 7:58 AM, Martyn Welch  wrote:
> On 09/12/15 13:50, 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: Greg Kroah-Hartman 
>> Cc: Martyn Welch 
>> Cc: Manohar Vanga 
>> Cc: de...@driverdev.osuosl.org
>> Signed-off-by: Linus Walleij 
>
>
> Signed-of-by: Martyn Welch 

Signed-off is for the delivery path so I assume you meant
Acked-by and I added that.

Yours,
Linus Walleij
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 172/182] staging: vme: use gpiochip data pointer

2015-12-14 Thread Martyn Welch



On 14/12/15 14:14, Linus Walleij wrote:

On Fri, Dec 11, 2015 at 7:58 AM, Martyn Welch  wrote:

On 09/12/15 13:50, 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: Greg Kroah-Hartman 
Cc: Martyn Welch 
Cc: Manohar Vanga 
Cc: de...@driverdev.osuosl.org
Signed-off-by: Linus Walleij 


Signed-of-by: Martyn Welch 

Signed-off is for the delivery path so I assume you meant
Acked-by and I added that.


Yeah, no problem.

Martyn

Yours,
Linus Walleij


___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 172/182] staging: vme: use gpiochip data pointer

2015-12-10 Thread Martyn Welch



On 09/12/15 13:50, 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: Greg Kroah-Hartman 
Cc: Martyn Welch 
Cc: Manohar Vanga 
Cc: de...@driverdev.osuosl.org
Signed-off-by: Linus Walleij 


Signed-of-by: Martyn Welch 


---
Greg, please ACK this so I can take this through the GPIO tree.
---
  drivers/staging/vme/devices/vme_pio2_gpio.c | 17 ++---
  1 file changed, 6 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/vme/devices/vme_pio2_gpio.c 
b/drivers/staging/vme/devices/vme_pio2_gpio.c
index 77901b345a71..a2b740ab7ffe 100644
--- a/drivers/staging/vme/devices/vme_pio2_gpio.c
+++ b/drivers/staging/vme/devices/vme_pio2_gpio.c
@@ -17,7 +17,7 @@
  #include 
  #include 
  #include 
-#include 
+#include 
  #include 
  #include 
  
@@ -25,16 +25,11 @@
  
  static const char driver_name[] = "pio2_gpio";
  
-static struct pio2_card *gpio_to_pio2_card(struct gpio_chip *chip)

-{
-   return container_of(chip, struct pio2_card, gc);
-}
-
  static int pio2_gpio_get(struct gpio_chip *chip, unsigned int offset)
  {
u8 reg;
int retval;
-   struct pio2_card *card = gpio_to_pio2_card(chip);
+   struct pio2_card *card = gpiochip_get_data(chip);
  
  	if ((card->bank[PIO2_CHANNEL_BANK[offset]].config == OUTPUT) |

(card->bank[PIO2_CHANNEL_BANK[offset]].config == NOFIT)) {
@@ -72,7 +67,7 @@ static void pio2_gpio_set(struct gpio_chip *chip, unsigned 
int offset,
  {
u8 reg;
int retval;
-   struct pio2_card *card = gpio_to_pio2_card(chip);
+   struct pio2_card *card = gpiochip_get_data(chip);
  
  	if ((card->bank[PIO2_CHANNEL_BANK[offset]].config == INPUT) |

(card->bank[PIO2_CHANNEL_BANK[offset]].config == NOFIT)) {
@@ -102,7 +97,7 @@ static void pio2_gpio_set(struct gpio_chip *chip, unsigned 
int offset,
  static int pio2_gpio_dir_in(struct gpio_chip *chip, unsigned offset)
  {
int data;
-   struct pio2_card *card = gpio_to_pio2_card(chip);
+   struct pio2_card *card = gpiochip_get_data(chip);
  
  	if ((card->bank[PIO2_CHANNEL_BANK[offset]].config == OUTPUT) |

(card->bank[PIO2_CHANNEL_BANK[offset]].config == NOFIT)) {
@@ -121,7 +116,7 @@ static int pio2_gpio_dir_in(struct gpio_chip *chip, 
unsigned offset)
  static int pio2_gpio_dir_out(struct gpio_chip *chip, unsigned offset, int 
value)
  {
int data;
-   struct pio2_card *card = gpio_to_pio2_card(chip);
+   struct pio2_card *card = gpiochip_get_data(chip);
  
  	if ((card->bank[PIO2_CHANNEL_BANK[offset]].config == INPUT) |

(card->bank[PIO2_CHANNEL_BANK[offset]].config == NOFIT)) {
@@ -207,7 +202,7 @@ int pio2_gpio_init(struct pio2_card *card)
card->gc.set = pio2_gpio_set;
  
  	/* This function adds a memory mapped GPIO chip */

-   retval = gpiochip_add(&(card->gc));
+   retval = gpiochip_add_data(&(card->gc), card);
if (retval) {
dev_err(>vdev->dev, "Unable to register GPIO\n");
kfree(card->gc.label);


___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 172/182] staging: vme: use gpiochip data pointer

2015-12-09 Thread Linus Walleij
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: Greg Kroah-Hartman 
Cc: Martyn Welch 
Cc: Manohar Vanga 
Cc: de...@driverdev.osuosl.org
Signed-off-by: Linus Walleij 
---
Greg, please ACK this so I can take this through the GPIO tree.
---
 drivers/staging/vme/devices/vme_pio2_gpio.c | 17 ++---
 1 file changed, 6 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/vme/devices/vme_pio2_gpio.c 
b/drivers/staging/vme/devices/vme_pio2_gpio.c
index 77901b345a71..a2b740ab7ffe 100644
--- a/drivers/staging/vme/devices/vme_pio2_gpio.c
+++ b/drivers/staging/vme/devices/vme_pio2_gpio.c
@@ -17,7 +17,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 
@@ -25,16 +25,11 @@
 
 static const char driver_name[] = "pio2_gpio";
 
-static struct pio2_card *gpio_to_pio2_card(struct gpio_chip *chip)
-{
-   return container_of(chip, struct pio2_card, gc);
-}
-
 static int pio2_gpio_get(struct gpio_chip *chip, unsigned int offset)
 {
u8 reg;
int retval;
-   struct pio2_card *card = gpio_to_pio2_card(chip);
+   struct pio2_card *card = gpiochip_get_data(chip);
 
if ((card->bank[PIO2_CHANNEL_BANK[offset]].config == OUTPUT) |
(card->bank[PIO2_CHANNEL_BANK[offset]].config == NOFIT)) {
@@ -72,7 +67,7 @@ static void pio2_gpio_set(struct gpio_chip *chip, unsigned 
int offset,
 {
u8 reg;
int retval;
-   struct pio2_card *card = gpio_to_pio2_card(chip);
+   struct pio2_card *card = gpiochip_get_data(chip);
 
if ((card->bank[PIO2_CHANNEL_BANK[offset]].config == INPUT) |
(card->bank[PIO2_CHANNEL_BANK[offset]].config == NOFIT)) {
@@ -102,7 +97,7 @@ static void pio2_gpio_set(struct gpio_chip *chip, unsigned 
int offset,
 static int pio2_gpio_dir_in(struct gpio_chip *chip, unsigned offset)
 {
int data;
-   struct pio2_card *card = gpio_to_pio2_card(chip);
+   struct pio2_card *card = gpiochip_get_data(chip);
 
if ((card->bank[PIO2_CHANNEL_BANK[offset]].config == OUTPUT) |
(card->bank[PIO2_CHANNEL_BANK[offset]].config == NOFIT)) {
@@ -121,7 +116,7 @@ static int pio2_gpio_dir_in(struct gpio_chip *chip, 
unsigned offset)
 static int pio2_gpio_dir_out(struct gpio_chip *chip, unsigned offset, int 
value)
 {
int data;
-   struct pio2_card *card = gpio_to_pio2_card(chip);
+   struct pio2_card *card = gpiochip_get_data(chip);
 
if ((card->bank[PIO2_CHANNEL_BANK[offset]].config == INPUT) |
(card->bank[PIO2_CHANNEL_BANK[offset]].config == NOFIT)) {
@@ -207,7 +202,7 @@ int pio2_gpio_init(struct pio2_card *card)
card->gc.set = pio2_gpio_set;
 
/* This function adds a memory mapped GPIO chip */
-   retval = gpiochip_add(&(card->gc));
+   retval = gpiochip_add_data(&(card->gc), card);
if (retval) {
dev_err(>vdev->dev, "Unable to register GPIO\n");
kfree(card->gc.label);
-- 
2.4.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel