linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/9] Use GPIO data pointer in MFD
@ 2016-03-30  8:48 Linus Walleij
  2016-03-30  8:48 ` [PATCH 1/9] mfd: asic3: Use gpiochip data pointer Linus Walleij
                   ` (8 more replies)
  0 siblings, 9 replies; 20+ messages in thread
From: Linus Walleij @ 2016-03-30  8:48 UTC (permalink / raw)
  To: Samuel Ortiz, Lee Jones, linux-kernel; +Cc: Linus Walleij

I first planned to merge these patches through the GPIO tree
with ACKs, but I chickened out because I was too worried
about cross-tree conflicts.

Oops they were left sitting out there on a branch, not good.

It's better if you apply them to the MFD tree Lee, if you're
still OK with them (they have your ACKs already).

Thanks.

Linus Walleij (9):
  mfd: asic3: Use gpiochip data pointer
  mfd: dm355evm_msp: Switch to gpiochip_add_data()
  mfd: htc-egpio: Use gpiochip data pointer
  mfd: htc-i2cpld: Use gpiochip data pointer
  mfd: sm501: Use gpiochip data pointer
  mfd: tc6393xb: Use gpiochip data pointer
  mfd: tps65010: Use gpiochip data pointer
  mfd: ucb1x00: Use gpiochip data pointer
  mfd: vexpress-sysreg: Switch to gpiochip_add_data()

 drivers/mfd/asic3.c           | 10 +++++-----
 drivers/mfd/dm355evm_msp.c    |  2 +-
 drivers/mfd/htc-egpio.c       | 10 +++++-----
 drivers/mfd/htc-i2cpld.c      | 15 +++++----------
 drivers/mfd/sm501.c           | 15 +++++----------
 drivers/mfd/tc6393xb.c        | 14 +++++++-------
 drivers/mfd/tps65010.c        |  8 ++++----
 drivers/mfd/ucb1x00-core.c    | 14 +++++++-------
 drivers/mfd/vexpress-sysreg.c |  2 +-
 9 files changed, 40 insertions(+), 50 deletions(-)

-- 
2.4.3

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

* [PATCH 1/9] mfd: asic3: Use gpiochip data pointer
  2016-03-30  8:48 [PATCH 0/9] Use GPIO data pointer in MFD Linus Walleij
@ 2016-03-30  8:48 ` Linus Walleij
  2016-04-11 11:47   ` Lee Jones
  2016-03-30  8:48 ` [PATCH 2/9] mfd: dm355evm_msp: Switch to gpiochip_add_data() Linus Walleij
                   ` (7 subsequent siblings)
  8 siblings, 1 reply; 20+ messages in thread
From: Linus Walleij @ 2016-03-30  8:48 UTC (permalink / raw)
  To: Samuel Ortiz, Lee Jones, linux-kernel; +Cc: Linus Walleij, Paul Parsons

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: Paul Parsons <lost.distance@yahoo.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/mfd/asic3.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/mfd/asic3.c b/drivers/mfd/asic3.c
index 4dca6bc61f5b..0413c8159551 100644
--- a/drivers/mfd/asic3.c
+++ b/drivers/mfd/asic3.c
@@ -446,7 +446,7 @@ static int asic3_gpio_direction(struct gpio_chip *chip,
 	unsigned long flags;
 	struct asic3 *asic;
 
-	asic = container_of(chip, struct asic3, gpio);
+	asic = gpiochip_get_data(chip);
 	gpio_base = ASIC3_GPIO_TO_BASE(offset);
 
 	if (gpio_base > ASIC3_GPIO_D_BASE) {
@@ -492,7 +492,7 @@ static int asic3_gpio_get(struct gpio_chip *chip,
 	u32 mask = ASIC3_GPIO_TO_MASK(offset);
 	struct asic3 *asic;
 
-	asic = container_of(chip, struct asic3, gpio);
+	asic = gpiochip_get_data(chip);
 	gpio_base = ASIC3_GPIO_TO_BASE(offset);
 
 	if (gpio_base > ASIC3_GPIO_D_BASE) {
@@ -513,7 +513,7 @@ static void asic3_gpio_set(struct gpio_chip *chip,
 	unsigned long flags;
 	struct asic3 *asic;
 
-	asic = container_of(chip, struct asic3, gpio);
+	asic = gpiochip_get_data(chip);
 	gpio_base = ASIC3_GPIO_TO_BASE(offset);
 
 	if (gpio_base > ASIC3_GPIO_D_BASE) {
@@ -540,7 +540,7 @@ static void asic3_gpio_set(struct gpio_chip *chip,
 
 static int asic3_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
 {
-	struct asic3 *asic = container_of(chip, struct asic3, gpio);
+	struct asic3 *asic = gpiochip_get_data(chip);
 
 	return asic->irq_base + offset;
 }
@@ -595,7 +595,7 @@ static __init int asic3_gpio_probe(struct platform_device *pdev,
 				     alt_reg[i]);
 	}
 
-	return gpiochip_add(&asic->gpio);
+	return gpiochip_add_data(&asic->gpio, asic);
 }
 
 static int asic3_gpio_remove(struct platform_device *pdev)
-- 
2.4.3

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

* [PATCH 2/9] mfd: dm355evm_msp: Switch to gpiochip_add_data()
  2016-03-30  8:48 [PATCH 0/9] Use GPIO data pointer in MFD Linus Walleij
  2016-03-30  8:48 ` [PATCH 1/9] mfd: asic3: Use gpiochip data pointer Linus Walleij
@ 2016-03-30  8:48 ` Linus Walleij
  2016-04-11 11:48   ` Lee Jones
  2016-03-30  8:48 ` [PATCH 3/9] mfd: htc-egpio: Use gpiochip data pointer Linus Walleij
                   ` (6 subsequent siblings)
  8 siblings, 1 reply; 20+ messages in thread
From: Linus Walleij @ 2016-03-30  8:48 UTC (permalink / raw)
  To: Samuel Ortiz, Lee Jones, linux-kernel; +Cc: Linus Walleij

We're planning to remove the gpiochip_add() function to swith
to gpiochip_add_data() with NULL for data argument.

Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/mfd/dm355evm_msp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mfd/dm355evm_msp.c b/drivers/mfd/dm355evm_msp.c
index ec4438ed2faf..d7d59f8d9d06 100644
--- a/drivers/mfd/dm355evm_msp.c
+++ b/drivers/mfd/dm355evm_msp.c
@@ -260,7 +260,7 @@ static int add_children(struct i2c_client *client)
 
 	/* GPIO-ish stuff */
 	dm355evm_msp_gpio.parent = &client->dev;
-	status = gpiochip_add(&dm355evm_msp_gpio);
+	status = gpiochip_add_data(&dm355evm_msp_gpio, NULL);
 	if (status < 0)
 		return status;
 
-- 
2.4.3

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

* [PATCH 3/9] mfd: htc-egpio: Use gpiochip data pointer
  2016-03-30  8:48 [PATCH 0/9] Use GPIO data pointer in MFD Linus Walleij
  2016-03-30  8:48 ` [PATCH 1/9] mfd: asic3: Use gpiochip data pointer Linus Walleij
  2016-03-30  8:48 ` [PATCH 2/9] mfd: dm355evm_msp: Switch to gpiochip_add_data() Linus Walleij
@ 2016-03-30  8:48 ` Linus Walleij
  2016-04-11 11:48   ` Lee Jones
  2016-03-30  8:48 ` [PATCH 4/9] mfd: htc-i2cpld: " Linus Walleij
                   ` (5 subsequent siblings)
  8 siblings, 1 reply; 20+ messages in thread
From: Linus Walleij @ 2016-03-30  8:48 UTC (permalink / raw)
  To: Samuel Ortiz, Lee Jones, linux-kernel; +Cc: 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().

Acked-by: Lee Jones <lee.jones@linaro.org>
Acked-by: Philipp Zabel <philipp.zabel@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/mfd/htc-egpio.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/mfd/htc-egpio.c b/drivers/mfd/htc-egpio.c
index c636b5f83cfb..513cfc5c8fb6 100644
--- a/drivers/mfd/htc-egpio.c
+++ b/drivers/mfd/htc-egpio.c
@@ -155,7 +155,7 @@ static int egpio_get(struct gpio_chip *chip, unsigned offset)
 
 	pr_debug("egpio_get_value(%d)\n", chip->base + offset);
 
-	egpio = container_of(chip, struct egpio_chip, chip);
+	egpio = gpiochip_get_data(chip);
 	ei    = dev_get_drvdata(egpio->dev);
 	bit   = egpio_bit(ei, offset);
 	reg   = egpio->reg_start + egpio_pos(ei, offset);
@@ -170,7 +170,7 @@ static int egpio_direction_input(struct gpio_chip *chip, unsigned offset)
 {
 	struct egpio_chip *egpio;
 
-	egpio = container_of(chip, struct egpio_chip, chip);
+	egpio = gpiochip_get_data(chip);
 	return test_bit(offset, &egpio->is_out) ? -EINVAL : 0;
 }
 
@@ -192,7 +192,7 @@ static void egpio_set(struct gpio_chip *chip, unsigned offset, int value)
 	pr_debug("egpio_set(%s, %d(%d), %d)\n",
 			chip->label, offset, offset+chip->base, value);
 
-	egpio = container_of(chip, struct egpio_chip, chip);
+	egpio = gpiochip_get_data(chip);
 	ei    = dev_get_drvdata(egpio->dev);
 	bit   = egpio_bit(ei, offset);
 	pos   = egpio_pos(ei, offset);
@@ -216,7 +216,7 @@ static int egpio_direction_output(struct gpio_chip *chip,
 {
 	struct egpio_chip *egpio;
 
-	egpio = container_of(chip, struct egpio_chip, chip);
+	egpio = gpiochip_get_data(chip);
 	if (test_bit(offset, &egpio->is_out)) {
 		egpio_set(chip, offset, value);
 		return 0;
@@ -330,7 +330,7 @@ static int __init egpio_probe(struct platform_device *pdev)
 		chip->base            = pdata->chip[i].gpio_base;
 		chip->ngpio           = pdata->chip[i].num_gpios;
 
-		gpiochip_add(chip);
+		gpiochip_add_data(chip, &ei->chip[i]);
 	}
 
 	/* Set initial pin values */
-- 
2.4.3

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

* [PATCH 4/9] mfd: htc-i2cpld: Use gpiochip data pointer
  2016-03-30  8:48 [PATCH 0/9] Use GPIO data pointer in MFD Linus Walleij
                   ` (2 preceding siblings ...)
  2016-03-30  8:48 ` [PATCH 3/9] mfd: htc-egpio: Use gpiochip data pointer Linus Walleij
@ 2016-03-30  8:48 ` Linus Walleij
  2016-04-11 11:48   ` Lee Jones
  2016-03-30  8:48 ` [PATCH 5/9] mfd: sm501: " Linus Walleij
                   ` (4 subsequent siblings)
  8 siblings, 1 reply; 20+ messages in thread
From: Linus Walleij @ 2016-03-30  8:48 UTC (permalink / raw)
  To: Samuel Ortiz, Lee Jones, linux-kernel; +Cc: 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().

Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/mfd/htc-i2cpld.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/drivers/mfd/htc-i2cpld.c b/drivers/mfd/htc-i2cpld.c
index bd6b96d07ab8..3f9eee5f8fb9 100644
--- a/drivers/mfd/htc-i2cpld.c
+++ b/drivers/mfd/htc-i2cpld.c
@@ -227,8 +227,7 @@ static irqreturn_t htcpld_handler(int irq, void *dev)
 static void htcpld_chip_set(struct gpio_chip *chip, unsigned offset, int val)
 {
 	struct i2c_client *client;
-	struct htcpld_chip *chip_data =
-		container_of(chip, struct htcpld_chip, chip_out);
+	struct htcpld_chip *chip_data = gpiochip_get_data(chip);
 	unsigned long flags;
 
 	client = chip_data->client;
@@ -257,14 +256,12 @@ static void htcpld_chip_set_ni(struct work_struct *work)
 
 static int htcpld_chip_get(struct gpio_chip *chip, unsigned offset)
 {
-	struct htcpld_chip *chip_data;
+	struct htcpld_chip *chip_data = gpiochip_get_data(chip);
 	u8 cache;
 
 	if (!strncmp(chip->label, "htcpld-out", 10)) {
-		chip_data = container_of(chip, struct htcpld_chip, chip_out);
 		cache = chip_data->cache_out;
 	} else if (!strncmp(chip->label, "htcpld-in", 9)) {
-		chip_data = container_of(chip, struct htcpld_chip, chip_in);
 		cache = chip_data->cache_in;
 	} else
 		return -EINVAL;
@@ -291,9 +288,7 @@ static int htcpld_direction_input(struct gpio_chip *chip,
 
 static int htcpld_chip_to_irq(struct gpio_chip *chip, unsigned offset)
 {
-	struct htcpld_chip *chip_data;
-
-	chip_data = container_of(chip, struct htcpld_chip, chip_in);
+	struct htcpld_chip *chip_data = gpiochip_get_data(chip);
 
 	if (offset < chip_data->nirqs)
 		return chip_data->irq_start + offset;
@@ -451,14 +446,14 @@ static int htcpld_register_chip_gpio(
 	gpio_chip->ngpio           = plat_chip_data->num_gpios;
 
 	/* Add the GPIO chips */
-	ret = gpiochip_add(&(chip->chip_out));
+	ret = gpiochip_add_data(&(chip->chip_out), chip);
 	if (ret) {
 		dev_warn(dev, "Unable to register output GPIOs for 0x%x: %d\n",
 			 plat_chip_data->addr, ret);
 		return ret;
 	}
 
-	ret = gpiochip_add(&(chip->chip_in));
+	ret = gpiochip_add_data(&(chip->chip_in), chip);
 	if (ret) {
 		dev_warn(dev, "Unable to register input GPIOs for 0x%x: %d\n",
 			 plat_chip_data->addr, ret);
-- 
2.4.3

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

* [PATCH 5/9] mfd: sm501: Use gpiochip data pointer
  2016-03-30  8:48 [PATCH 0/9] Use GPIO data pointer in MFD Linus Walleij
                   ` (3 preceding siblings ...)
  2016-03-30  8:48 ` [PATCH 4/9] mfd: htc-i2cpld: " Linus Walleij
@ 2016-03-30  8:48 ` Linus Walleij
  2016-04-11 11:48   ` Lee Jones
  2016-03-30  8:48 ` [PATCH 6/9] mfd: tc6393xb: " Linus Walleij
                   ` (3 subsequent siblings)
  8 siblings, 1 reply; 20+ messages in thread
From: Linus Walleij @ 2016-03-30  8:48 UTC (permalink / raw)
  To: Samuel Ortiz, Lee Jones, linux-kernel; +Cc: Linus Walleij, Ben Dooks

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: Ben Dooks <ben@fluff.org.uk>
Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/mfd/sm501.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/drivers/mfd/sm501.c b/drivers/mfd/sm501.c
index c646784c5a7d..65cd0d2a822a 100644
--- a/drivers/mfd/sm501.c
+++ b/drivers/mfd/sm501.c
@@ -879,11 +879,6 @@ static int sm501_register_display(struct sm501_devdata *sm,
 
 #ifdef CONFIG_MFD_SM501_GPIO
 
-static inline struct sm501_gpio_chip *to_sm501_gpio(struct gpio_chip *gc)
-{
-	return container_of(gc, struct sm501_gpio_chip, gpio);
-}
-
 static inline struct sm501_devdata *sm501_gpio_to_dev(struct sm501_gpio *gpio)
 {
 	return container_of(gpio, struct sm501_devdata, gpio);
@@ -892,7 +887,7 @@ static inline struct sm501_devdata *sm501_gpio_to_dev(struct sm501_gpio *gpio)
 static int sm501_gpio_get(struct gpio_chip *chip, unsigned offset)
 
 {
-	struct sm501_gpio_chip *smgpio = to_sm501_gpio(chip);
+	struct sm501_gpio_chip *smgpio = gpiochip_get_data(chip);
 	unsigned long result;
 
 	result = smc501_readl(smgpio->regbase + SM501_GPIO_DATA_LOW);
@@ -923,7 +918,7 @@ static void sm501_gpio_ensure_gpio(struct sm501_gpio_chip *smchip,
 static void sm501_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
 
 {
-	struct sm501_gpio_chip *smchip = to_sm501_gpio(chip);
+	struct sm501_gpio_chip *smchip = gpiochip_get_data(chip);
 	struct sm501_gpio *smgpio = smchip->ourgpio;
 	unsigned long bit = 1 << offset;
 	void __iomem *regs = smchip->regbase;
@@ -948,7 +943,7 @@ static void sm501_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
 
 static int sm501_gpio_input(struct gpio_chip *chip, unsigned offset)
 {
-	struct sm501_gpio_chip *smchip = to_sm501_gpio(chip);
+	struct sm501_gpio_chip *smchip = gpiochip_get_data(chip);
 	struct sm501_gpio *smgpio = smchip->ourgpio;
 	void __iomem *regs = smchip->regbase;
 	unsigned long bit = 1 << offset;
@@ -974,7 +969,7 @@ static int sm501_gpio_input(struct gpio_chip *chip, unsigned offset)
 static int sm501_gpio_output(struct gpio_chip *chip,
 			     unsigned offset, int value)
 {
-	struct sm501_gpio_chip *smchip = to_sm501_gpio(chip);
+	struct sm501_gpio_chip *smchip = gpiochip_get_data(chip);
 	struct sm501_gpio *smgpio = smchip->ourgpio;
 	unsigned long bit = 1 << offset;
 	void __iomem *regs = smchip->regbase;
@@ -1039,7 +1034,7 @@ static int sm501_gpio_register_chip(struct sm501_devdata *sm,
 	gchip->base   = base;
 	chip->ourgpio = gpio;
 
-	return gpiochip_add(gchip);
+	return gpiochip_add_data(gchip, chip);
 }
 
 static int sm501_register_gpio(struct sm501_devdata *sm)
-- 
2.4.3

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

* [PATCH 6/9] mfd: tc6393xb: Use gpiochip data pointer
  2016-03-30  8:48 [PATCH 0/9] Use GPIO data pointer in MFD Linus Walleij
                   ` (4 preceding siblings ...)
  2016-03-30  8:48 ` [PATCH 5/9] mfd: sm501: " Linus Walleij
@ 2016-03-30  8:48 ` Linus Walleij
  2016-03-31 10:15   ` Dmitry Eremin-Solenikov
  2016-04-11 11:49   ` Lee Jones
  2016-03-30  8:48 ` [PATCH 7/9] mfd: tps65010: " Linus Walleij
                   ` (2 subsequent siblings)
  8 siblings, 2 replies; 20+ messages in thread
From: Linus Walleij @ 2016-03-30  8:48 UTC (permalink / raw)
  To: Samuel Ortiz, Lee Jones, linux-kernel; +Cc: Linus Walleij, Dmitry Baryshkov

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: Dmitry Baryshkov <dbaryshkov@gmail.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/mfd/tc6393xb.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/mfd/tc6393xb.c b/drivers/mfd/tc6393xb.c
index 1ecbfa40d1b3..d42d322ac7ca 100644
--- a/drivers/mfd/tc6393xb.c
+++ b/drivers/mfd/tc6393xb.c
@@ -24,7 +24,7 @@
 #include <linux/mfd/core.h>
 #include <linux/mfd/tmio.h>
 #include <linux/mfd/tc6393xb.h>
-#include <linux/gpio.h>
+#include <linux/gpio/driver.h>
 #include <linux/slab.h>
 
 #define SCR_REVID	0x08		/* b Revision ID	*/
@@ -434,7 +434,7 @@ static struct mfd_cell tc6393xb_cells[] = {
 static int tc6393xb_gpio_get(struct gpio_chip *chip,
 		unsigned offset)
 {
-	struct tc6393xb *tc6393xb = container_of(chip, struct tc6393xb, gpio);
+	struct tc6393xb *tc6393xb = gpiochip_get_data(chip);
 
 	/* XXX: does dsr also represent inputs? */
 	return !!(tmio_ioread8(tc6393xb->scr + SCR_GPO_DSR(offset / 8))
@@ -444,7 +444,7 @@ static int tc6393xb_gpio_get(struct gpio_chip *chip,
 static void __tc6393xb_gpio_set(struct gpio_chip *chip,
 		unsigned offset, int value)
 {
-	struct tc6393xb *tc6393xb = container_of(chip, struct tc6393xb, gpio);
+	struct tc6393xb *tc6393xb = gpiochip_get_data(chip);
 	u8  dsr;
 
 	dsr = tmio_ioread8(tc6393xb->scr + SCR_GPO_DSR(offset / 8));
@@ -459,7 +459,7 @@ static void __tc6393xb_gpio_set(struct gpio_chip *chip,
 static void tc6393xb_gpio_set(struct gpio_chip *chip,
 		unsigned offset, int value)
 {
-	struct tc6393xb *tc6393xb = container_of(chip, struct tc6393xb, gpio);
+	struct tc6393xb *tc6393xb = gpiochip_get_data(chip);
 	unsigned long flags;
 
 	spin_lock_irqsave(&tc6393xb->lock, flags);
@@ -472,7 +472,7 @@ static void tc6393xb_gpio_set(struct gpio_chip *chip,
 static int tc6393xb_gpio_direction_input(struct gpio_chip *chip,
 			unsigned offset)
 {
-	struct tc6393xb *tc6393xb = container_of(chip, struct tc6393xb, gpio);
+	struct tc6393xb *tc6393xb = gpiochip_get_data(chip);
 	unsigned long flags;
 	u8 doecr;
 
@@ -490,7 +490,7 @@ static int tc6393xb_gpio_direction_input(struct gpio_chip *chip,
 static int tc6393xb_gpio_direction_output(struct gpio_chip *chip,
 			unsigned offset, int value)
 {
-	struct tc6393xb *tc6393xb = container_of(chip, struct tc6393xb, gpio);
+	struct tc6393xb *tc6393xb = gpiochip_get_data(chip);
 	unsigned long flags;
 	u8 doecr;
 
@@ -517,7 +517,7 @@ static int tc6393xb_register_gpio(struct tc6393xb *tc6393xb, int gpio_base)
 	tc6393xb->gpio.direction_input = tc6393xb_gpio_direction_input;
 	tc6393xb->gpio.direction_output = tc6393xb_gpio_direction_output;
 
-	return gpiochip_add(&tc6393xb->gpio);
+	return gpiochip_add_data(&tc6393xb->gpio, tc6393xb);
 }
 
 /*--------------------------------------------------------------------------*/
-- 
2.4.3

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

* [PATCH 7/9] mfd: tps65010: Use gpiochip data pointer
  2016-03-30  8:48 [PATCH 0/9] Use GPIO data pointer in MFD Linus Walleij
                   ` (5 preceding siblings ...)
  2016-03-30  8:48 ` [PATCH 6/9] mfd: tc6393xb: " Linus Walleij
@ 2016-03-30  8:48 ` Linus Walleij
  2016-04-11 11:48   ` Lee Jones
  2016-03-30  8:48 ` [PATCH 8/9] mfd: ucb1x00: " Linus Walleij
  2016-03-30  8:48 ` [PATCH 9/9] mfd: vexpress-sysreg: Switch to gpiochip_add_data() Linus Walleij
  8 siblings, 1 reply; 20+ messages in thread
From: Linus Walleij @ 2016-03-30  8:48 UTC (permalink / raw)
  To: Samuel Ortiz, Lee Jones, linux-kernel; +Cc: 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().

Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/mfd/tps65010.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/mfd/tps65010.c b/drivers/mfd/tps65010.c
index 495e4518fc29..d829a6131f09 100644
--- a/drivers/mfd/tps65010.c
+++ b/drivers/mfd/tps65010.c
@@ -34,7 +34,7 @@
 
 #include <linux/i2c/tps65010.h>
 
-#include <linux/gpio.h>
+#include <linux/gpio/driver.h>
 
 
 /*-------------------------------------------------------------------------*/
@@ -477,7 +477,7 @@ tps65010_output(struct gpio_chip *chip, unsigned offset, int value)
 	if (offset < 4) {
 		struct tps65010		*tps;
 
-		tps = container_of(chip, struct tps65010, chip);
+		tps = gpiochip_get_data(chip);
 		if (!(tps->outmask & (1 << offset)))
 			return -EINVAL;
 		tps65010_set_gpio_out_value(offset + 1, value);
@@ -494,7 +494,7 @@ static int tps65010_gpio_get(struct gpio_chip *chip, unsigned offset)
 	int			value;
 	struct tps65010		*tps;
 
-	tps = container_of(chip, struct tps65010, chip);
+	tps = gpiochip_get_data(chip);
 
 	if (offset < 4) {
 		value = i2c_smbus_read_byte_data(tps->client, TPS_DEFGPIO);
@@ -651,7 +651,7 @@ static int tps65010_probe(struct i2c_client *client,
 		tps->chip.ngpio = 7;
 		tps->chip.can_sleep = 1;
 
-		status = gpiochip_add(&tps->chip);
+		status = gpiochip_add_data(&tps->chip, tps);
 		if (status < 0)
 			dev_err(&client->dev, "can't add gpiochip, err %d\n",
 					status);
-- 
2.4.3

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

* [PATCH 8/9] mfd: ucb1x00: Use gpiochip data pointer
  2016-03-30  8:48 [PATCH 0/9] Use GPIO data pointer in MFD Linus Walleij
                   ` (6 preceding siblings ...)
  2016-03-30  8:48 ` [PATCH 7/9] mfd: tps65010: " Linus Walleij
@ 2016-03-30  8:48 ` Linus Walleij
  2016-04-11 11:49   ` Lee Jones
  2016-03-30  8:48 ` [PATCH 9/9] mfd: vexpress-sysreg: Switch to gpiochip_add_data() Linus Walleij
  8 siblings, 1 reply; 20+ messages in thread
From: Linus Walleij @ 2016-03-30  8:48 UTC (permalink / raw)
  To: Samuel Ortiz, Lee Jones, linux-kernel; +Cc: 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().

Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/mfd/ucb1x00-core.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/mfd/ucb1x00-core.c b/drivers/mfd/ucb1x00-core.c
index bcafe1ecd71c..9ab9ec47ea75 100644
--- a/drivers/mfd/ucb1x00-core.c
+++ b/drivers/mfd/ucb1x00-core.c
@@ -28,7 +28,7 @@
 #include <linux/mutex.h>
 #include <linux/mfd/ucb1x00.h>
 #include <linux/pm.h>
-#include <linux/gpio.h>
+#include <linux/gpio/driver.h>
 
 static DEFINE_MUTEX(ucb1x00_mutex);
 static LIST_HEAD(ucb1x00_drivers);
@@ -109,7 +109,7 @@ unsigned int ucb1x00_io_read(struct ucb1x00 *ucb)
 
 static void ucb1x00_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
 {
-	struct ucb1x00 *ucb = container_of(chip, struct ucb1x00, gpio);
+	struct ucb1x00 *ucb = gpiochip_get_data(chip);
 	unsigned long flags;
 
 	spin_lock_irqsave(&ucb->io_lock, flags);
@@ -126,7 +126,7 @@ static void ucb1x00_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
 
 static int ucb1x00_gpio_get(struct gpio_chip *chip, unsigned offset)
 {
-	struct ucb1x00 *ucb = container_of(chip, struct ucb1x00, gpio);
+	struct ucb1x00 *ucb = gpiochip_get_data(chip);
 	unsigned val;
 
 	ucb1x00_enable(ucb);
@@ -138,7 +138,7 @@ static int ucb1x00_gpio_get(struct gpio_chip *chip, unsigned offset)
 
 static int ucb1x00_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
 {
-	struct ucb1x00 *ucb = container_of(chip, struct ucb1x00, gpio);
+	struct ucb1x00 *ucb = gpiochip_get_data(chip);
 	unsigned long flags;
 
 	spin_lock_irqsave(&ucb->io_lock, flags);
@@ -154,7 +154,7 @@ static int ucb1x00_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
 static int ucb1x00_gpio_direction_output(struct gpio_chip *chip, unsigned offset
 		, int value)
 {
-	struct ucb1x00 *ucb = container_of(chip, struct ucb1x00, gpio);
+	struct ucb1x00 *ucb = gpiochip_get_data(chip);
 	unsigned long flags;
 	unsigned old, mask = 1 << offset;
 
@@ -181,7 +181,7 @@ static int ucb1x00_gpio_direction_output(struct gpio_chip *chip, unsigned offset
 
 static int ucb1x00_to_irq(struct gpio_chip *chip, unsigned offset)
 {
-	struct ucb1x00 *ucb = container_of(chip, struct ucb1x00, gpio);
+	struct ucb1x00 *ucb = gpiochip_get_data(chip);
 
 	return ucb->irq_base > 0 ? ucb->irq_base + offset : -ENXIO;
 }
@@ -579,7 +579,7 @@ static int ucb1x00_probe(struct mcp *mcp)
 		ucb->gpio.direction_input = ucb1x00_gpio_direction_input;
 		ucb->gpio.direction_output = ucb1x00_gpio_direction_output;
 		ucb->gpio.to_irq = ucb1x00_to_irq;
-		ret = gpiochip_add(&ucb->gpio);
+		ret = gpiochip_add_data(&ucb->gpio, ucb);
 		if (ret)
 			goto err_gpio_add;
 	} else
-- 
2.4.3

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

* [PATCH 9/9] mfd: vexpress-sysreg: Switch to gpiochip_add_data()
  2016-03-30  8:48 [PATCH 0/9] Use GPIO data pointer in MFD Linus Walleij
                   ` (7 preceding siblings ...)
  2016-03-30  8:48 ` [PATCH 8/9] mfd: ucb1x00: " Linus Walleij
@ 2016-03-30  8:48 ` Linus Walleij
  2016-04-11 11:49   ` Lee Jones
  8 siblings, 1 reply; 20+ messages in thread
From: Linus Walleij @ 2016-03-30  8:48 UTC (permalink / raw)
  To: Samuel Ortiz, Lee Jones, linux-kernel; +Cc: Linus Walleij

We're planning to remove the gpiochip_add() function to swith
to gpiochip_add_data() with NULL for data argument.

Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/mfd/vexpress-sysreg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mfd/vexpress-sysreg.c b/drivers/mfd/vexpress-sysreg.c
index 855c0204f09a..201a3ea2a9d3 100644
--- a/drivers/mfd/vexpress-sysreg.c
+++ b/drivers/mfd/vexpress-sysreg.c
@@ -202,7 +202,7 @@ static int vexpress_sysreg_probe(struct platform_device *pdev)
 	bgpio_init(mmc_gpio_chip, &pdev->dev, 0x4, base + SYS_MCI,
 			NULL, NULL, NULL, NULL, 0);
 	mmc_gpio_chip->ngpio = 2;
-	gpiochip_add(mmc_gpio_chip);
+	gpiochip_add_data(mmc_gpio_chip, NULL);
 
 	return mfd_add_devices(&pdev->dev, PLATFORM_DEVID_AUTO,
 			vexpress_sysreg_cells,
-- 
2.4.3

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

* Re: [PATCH 6/9] mfd: tc6393xb: Use gpiochip data pointer
  2016-03-30  8:48 ` [PATCH 6/9] mfd: tc6393xb: " Linus Walleij
@ 2016-03-31 10:15   ` Dmitry Eremin-Solenikov
  2016-04-11 11:49   ` Lee Jones
  1 sibling, 0 replies; 20+ messages in thread
From: Dmitry Eremin-Solenikov @ 2016-03-31 10:15 UTC (permalink / raw)
  To: Linus Walleij; +Cc: Samuel Ortiz, Lee Jones, kernel list

2016-03-30 11:48 GMT+03:00 Linus Walleij <linus.walleij@linaro.org>:
> 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().

Looks good.
Acked-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>

>
> Cc: Dmitry Baryshkov <dbaryshkov@gmail.com>
> Acked-by: Lee Jones <lee.jones@linaro.org>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

-- 
With best wishes
Dmitry

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

* Re: [PATCH 1/9] mfd: asic3: Use gpiochip data pointer
  2016-03-30  8:48 ` [PATCH 1/9] mfd: asic3: Use gpiochip data pointer Linus Walleij
@ 2016-04-11 11:47   ` Lee Jones
  0 siblings, 0 replies; 20+ messages in thread
From: Lee Jones @ 2016-04-11 11:47 UTC (permalink / raw)
  To: Linus Walleij; +Cc: Samuel Ortiz, linux-kernel, Paul Parsons

On Wed, 30 Mar 2016, 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: Paul Parsons <lost.distance@yahoo.com>
> Acked-by: Lee Jones <lee.jones@linaro.org>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
>  drivers/mfd/asic3.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)

Applied, thanks.

> diff --git a/drivers/mfd/asic3.c b/drivers/mfd/asic3.c
> index 4dca6bc61f5b..0413c8159551 100644
> --- a/drivers/mfd/asic3.c
> +++ b/drivers/mfd/asic3.c
> @@ -446,7 +446,7 @@ static int asic3_gpio_direction(struct gpio_chip *chip,
>  	unsigned long flags;
>  	struct asic3 *asic;
>  
> -	asic = container_of(chip, struct asic3, gpio);
> +	asic = gpiochip_get_data(chip);
>  	gpio_base = ASIC3_GPIO_TO_BASE(offset);
>  
>  	if (gpio_base > ASIC3_GPIO_D_BASE) {
> @@ -492,7 +492,7 @@ static int asic3_gpio_get(struct gpio_chip *chip,
>  	u32 mask = ASIC3_GPIO_TO_MASK(offset);
>  	struct asic3 *asic;
>  
> -	asic = container_of(chip, struct asic3, gpio);
> +	asic = gpiochip_get_data(chip);
>  	gpio_base = ASIC3_GPIO_TO_BASE(offset);
>  
>  	if (gpio_base > ASIC3_GPIO_D_BASE) {
> @@ -513,7 +513,7 @@ static void asic3_gpio_set(struct gpio_chip *chip,
>  	unsigned long flags;
>  	struct asic3 *asic;
>  
> -	asic = container_of(chip, struct asic3, gpio);
> +	asic = gpiochip_get_data(chip);
>  	gpio_base = ASIC3_GPIO_TO_BASE(offset);
>  
>  	if (gpio_base > ASIC3_GPIO_D_BASE) {
> @@ -540,7 +540,7 @@ static void asic3_gpio_set(struct gpio_chip *chip,
>  
>  static int asic3_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
>  {
> -	struct asic3 *asic = container_of(chip, struct asic3, gpio);
> +	struct asic3 *asic = gpiochip_get_data(chip);
>  
>  	return asic->irq_base + offset;
>  }
> @@ -595,7 +595,7 @@ static __init int asic3_gpio_probe(struct platform_device *pdev,
>  				     alt_reg[i]);
>  	}
>  
> -	return gpiochip_add(&asic->gpio);
> +	return gpiochip_add_data(&asic->gpio, asic);
>  }
>  
>  static int asic3_gpio_remove(struct platform_device *pdev)

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH 2/9] mfd: dm355evm_msp: Switch to gpiochip_add_data()
  2016-03-30  8:48 ` [PATCH 2/9] mfd: dm355evm_msp: Switch to gpiochip_add_data() Linus Walleij
@ 2016-04-11 11:48   ` Lee Jones
  0 siblings, 0 replies; 20+ messages in thread
From: Lee Jones @ 2016-04-11 11:48 UTC (permalink / raw)
  To: Linus Walleij; +Cc: Samuel Ortiz, linux-kernel

On Wed, 30 Mar 2016, Linus Walleij wrote:

> We're planning to remove the gpiochip_add() function to swith
> to gpiochip_add_data() with NULL for data argument.
> 
> Acked-by: Lee Jones <lee.jones@linaro.org>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
>  drivers/mfd/dm355evm_msp.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied, thanks.

> diff --git a/drivers/mfd/dm355evm_msp.c b/drivers/mfd/dm355evm_msp.c
> index ec4438ed2faf..d7d59f8d9d06 100644
> --- a/drivers/mfd/dm355evm_msp.c
> +++ b/drivers/mfd/dm355evm_msp.c
> @@ -260,7 +260,7 @@ static int add_children(struct i2c_client *client)
>  
>  	/* GPIO-ish stuff */
>  	dm355evm_msp_gpio.parent = &client->dev;
> -	status = gpiochip_add(&dm355evm_msp_gpio);
> +	status = gpiochip_add_data(&dm355evm_msp_gpio, NULL);
>  	if (status < 0)
>  		return status;
>  

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH 3/9] mfd: htc-egpio: Use gpiochip data pointer
  2016-03-30  8:48 ` [PATCH 3/9] mfd: htc-egpio: Use gpiochip data pointer Linus Walleij
@ 2016-04-11 11:48   ` Lee Jones
  0 siblings, 0 replies; 20+ messages in thread
From: Lee Jones @ 2016-04-11 11:48 UTC (permalink / raw)
  To: Linus Walleij; +Cc: Samuel Ortiz, linux-kernel

On Wed, 30 Mar 2016, 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().
> 
> Acked-by: Lee Jones <lee.jones@linaro.org>
> Acked-by: Philipp Zabel <philipp.zabel@gmail.com>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
>  drivers/mfd/htc-egpio.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)

Applied, thanks.

> diff --git a/drivers/mfd/htc-egpio.c b/drivers/mfd/htc-egpio.c
> index c636b5f83cfb..513cfc5c8fb6 100644
> --- a/drivers/mfd/htc-egpio.c
> +++ b/drivers/mfd/htc-egpio.c
> @@ -155,7 +155,7 @@ static int egpio_get(struct gpio_chip *chip, unsigned offset)
>  
>  	pr_debug("egpio_get_value(%d)\n", chip->base + offset);
>  
> -	egpio = container_of(chip, struct egpio_chip, chip);
> +	egpio = gpiochip_get_data(chip);
>  	ei    = dev_get_drvdata(egpio->dev);
>  	bit   = egpio_bit(ei, offset);
>  	reg   = egpio->reg_start + egpio_pos(ei, offset);
> @@ -170,7 +170,7 @@ static int egpio_direction_input(struct gpio_chip *chip, unsigned offset)
>  {
>  	struct egpio_chip *egpio;
>  
> -	egpio = container_of(chip, struct egpio_chip, chip);
> +	egpio = gpiochip_get_data(chip);
>  	return test_bit(offset, &egpio->is_out) ? -EINVAL : 0;
>  }
>  
> @@ -192,7 +192,7 @@ static void egpio_set(struct gpio_chip *chip, unsigned offset, int value)
>  	pr_debug("egpio_set(%s, %d(%d), %d)\n",
>  			chip->label, offset, offset+chip->base, value);
>  
> -	egpio = container_of(chip, struct egpio_chip, chip);
> +	egpio = gpiochip_get_data(chip);
>  	ei    = dev_get_drvdata(egpio->dev);
>  	bit   = egpio_bit(ei, offset);
>  	pos   = egpio_pos(ei, offset);
> @@ -216,7 +216,7 @@ static int egpio_direction_output(struct gpio_chip *chip,
>  {
>  	struct egpio_chip *egpio;
>  
> -	egpio = container_of(chip, struct egpio_chip, chip);
> +	egpio = gpiochip_get_data(chip);
>  	if (test_bit(offset, &egpio->is_out)) {
>  		egpio_set(chip, offset, value);
>  		return 0;
> @@ -330,7 +330,7 @@ static int __init egpio_probe(struct platform_device *pdev)
>  		chip->base            = pdata->chip[i].gpio_base;
>  		chip->ngpio           = pdata->chip[i].num_gpios;
>  
> -		gpiochip_add(chip);
> +		gpiochip_add_data(chip, &ei->chip[i]);
>  	}
>  
>  	/* Set initial pin values */

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH 4/9] mfd: htc-i2cpld: Use gpiochip data pointer
  2016-03-30  8:48 ` [PATCH 4/9] mfd: htc-i2cpld: " Linus Walleij
@ 2016-04-11 11:48   ` Lee Jones
  0 siblings, 0 replies; 20+ messages in thread
From: Lee Jones @ 2016-04-11 11:48 UTC (permalink / raw)
  To: Linus Walleij; +Cc: Samuel Ortiz, linux-kernel

On Wed, 30 Mar 2016, 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().
> 
> Acked-by: Lee Jones <lee.jones@linaro.org>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
>  drivers/mfd/htc-i2cpld.c | 15 +++++----------
>  1 file changed, 5 insertions(+), 10 deletions(-)

Applied, thanks.

> diff --git a/drivers/mfd/htc-i2cpld.c b/drivers/mfd/htc-i2cpld.c
> index bd6b96d07ab8..3f9eee5f8fb9 100644
> --- a/drivers/mfd/htc-i2cpld.c
> +++ b/drivers/mfd/htc-i2cpld.c
> @@ -227,8 +227,7 @@ static irqreturn_t htcpld_handler(int irq, void *dev)
>  static void htcpld_chip_set(struct gpio_chip *chip, unsigned offset, int val)
>  {
>  	struct i2c_client *client;
> -	struct htcpld_chip *chip_data =
> -		container_of(chip, struct htcpld_chip, chip_out);
> +	struct htcpld_chip *chip_data = gpiochip_get_data(chip);
>  	unsigned long flags;
>  
>  	client = chip_data->client;
> @@ -257,14 +256,12 @@ static void htcpld_chip_set_ni(struct work_struct *work)
>  
>  static int htcpld_chip_get(struct gpio_chip *chip, unsigned offset)
>  {
> -	struct htcpld_chip *chip_data;
> +	struct htcpld_chip *chip_data = gpiochip_get_data(chip);
>  	u8 cache;
>  
>  	if (!strncmp(chip->label, "htcpld-out", 10)) {
> -		chip_data = container_of(chip, struct htcpld_chip, chip_out);
>  		cache = chip_data->cache_out;
>  	} else if (!strncmp(chip->label, "htcpld-in", 9)) {
> -		chip_data = container_of(chip, struct htcpld_chip, chip_in);
>  		cache = chip_data->cache_in;
>  	} else
>  		return -EINVAL;
> @@ -291,9 +288,7 @@ static int htcpld_direction_input(struct gpio_chip *chip,
>  
>  static int htcpld_chip_to_irq(struct gpio_chip *chip, unsigned offset)
>  {
> -	struct htcpld_chip *chip_data;
> -
> -	chip_data = container_of(chip, struct htcpld_chip, chip_in);
> +	struct htcpld_chip *chip_data = gpiochip_get_data(chip);
>  
>  	if (offset < chip_data->nirqs)
>  		return chip_data->irq_start + offset;
> @@ -451,14 +446,14 @@ static int htcpld_register_chip_gpio(
>  	gpio_chip->ngpio           = plat_chip_data->num_gpios;
>  
>  	/* Add the GPIO chips */
> -	ret = gpiochip_add(&(chip->chip_out));
> +	ret = gpiochip_add_data(&(chip->chip_out), chip);
>  	if (ret) {
>  		dev_warn(dev, "Unable to register output GPIOs for 0x%x: %d\n",
>  			 plat_chip_data->addr, ret);
>  		return ret;
>  	}
>  
> -	ret = gpiochip_add(&(chip->chip_in));
> +	ret = gpiochip_add_data(&(chip->chip_in), chip);
>  	if (ret) {
>  		dev_warn(dev, "Unable to register input GPIOs for 0x%x: %d\n",
>  			 plat_chip_data->addr, ret);

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH 5/9] mfd: sm501: Use gpiochip data pointer
  2016-03-30  8:48 ` [PATCH 5/9] mfd: sm501: " Linus Walleij
@ 2016-04-11 11:48   ` Lee Jones
  0 siblings, 0 replies; 20+ messages in thread
From: Lee Jones @ 2016-04-11 11:48 UTC (permalink / raw)
  To: Linus Walleij; +Cc: Samuel Ortiz, linux-kernel, Ben Dooks

On Wed, 30 Mar 2016, 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: Ben Dooks <ben@fluff.org.uk>
> Acked-by: Lee Jones <lee.jones@linaro.org>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
>  drivers/mfd/sm501.c | 15 +++++----------
>  1 file changed, 5 insertions(+), 10 deletions(-)

Applied, thanks.

> diff --git a/drivers/mfd/sm501.c b/drivers/mfd/sm501.c
> index c646784c5a7d..65cd0d2a822a 100644
> --- a/drivers/mfd/sm501.c
> +++ b/drivers/mfd/sm501.c
> @@ -879,11 +879,6 @@ static int sm501_register_display(struct sm501_devdata *sm,
>  
>  #ifdef CONFIG_MFD_SM501_GPIO
>  
> -static inline struct sm501_gpio_chip *to_sm501_gpio(struct gpio_chip *gc)
> -{
> -	return container_of(gc, struct sm501_gpio_chip, gpio);
> -}
> -
>  static inline struct sm501_devdata *sm501_gpio_to_dev(struct sm501_gpio *gpio)
>  {
>  	return container_of(gpio, struct sm501_devdata, gpio);
> @@ -892,7 +887,7 @@ static inline struct sm501_devdata *sm501_gpio_to_dev(struct sm501_gpio *gpio)
>  static int sm501_gpio_get(struct gpio_chip *chip, unsigned offset)
>  
>  {
> -	struct sm501_gpio_chip *smgpio = to_sm501_gpio(chip);
> +	struct sm501_gpio_chip *smgpio = gpiochip_get_data(chip);
>  	unsigned long result;
>  
>  	result = smc501_readl(smgpio->regbase + SM501_GPIO_DATA_LOW);
> @@ -923,7 +918,7 @@ static void sm501_gpio_ensure_gpio(struct sm501_gpio_chip *smchip,
>  static void sm501_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
>  
>  {
> -	struct sm501_gpio_chip *smchip = to_sm501_gpio(chip);
> +	struct sm501_gpio_chip *smchip = gpiochip_get_data(chip);
>  	struct sm501_gpio *smgpio = smchip->ourgpio;
>  	unsigned long bit = 1 << offset;
>  	void __iomem *regs = smchip->regbase;
> @@ -948,7 +943,7 @@ static void sm501_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
>  
>  static int sm501_gpio_input(struct gpio_chip *chip, unsigned offset)
>  {
> -	struct sm501_gpio_chip *smchip = to_sm501_gpio(chip);
> +	struct sm501_gpio_chip *smchip = gpiochip_get_data(chip);
>  	struct sm501_gpio *smgpio = smchip->ourgpio;
>  	void __iomem *regs = smchip->regbase;
>  	unsigned long bit = 1 << offset;
> @@ -974,7 +969,7 @@ static int sm501_gpio_input(struct gpio_chip *chip, unsigned offset)
>  static int sm501_gpio_output(struct gpio_chip *chip,
>  			     unsigned offset, int value)
>  {
> -	struct sm501_gpio_chip *smchip = to_sm501_gpio(chip);
> +	struct sm501_gpio_chip *smchip = gpiochip_get_data(chip);
>  	struct sm501_gpio *smgpio = smchip->ourgpio;
>  	unsigned long bit = 1 << offset;
>  	void __iomem *regs = smchip->regbase;
> @@ -1039,7 +1034,7 @@ static int sm501_gpio_register_chip(struct sm501_devdata *sm,
>  	gchip->base   = base;
>  	chip->ourgpio = gpio;
>  
> -	return gpiochip_add(gchip);
> +	return gpiochip_add_data(gchip, chip);
>  }
>  
>  static int sm501_register_gpio(struct sm501_devdata *sm)

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH 7/9] mfd: tps65010: Use gpiochip data pointer
  2016-03-30  8:48 ` [PATCH 7/9] mfd: tps65010: " Linus Walleij
@ 2016-04-11 11:48   ` Lee Jones
  0 siblings, 0 replies; 20+ messages in thread
From: Lee Jones @ 2016-04-11 11:48 UTC (permalink / raw)
  To: Linus Walleij; +Cc: Samuel Ortiz, linux-kernel

On Wed, 30 Mar 2016, 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().
> 
> Acked-by: Lee Jones <lee.jones@linaro.org>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
>  drivers/mfd/tps65010.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)

Applied, thanks.

> diff --git a/drivers/mfd/tps65010.c b/drivers/mfd/tps65010.c
> index 495e4518fc29..d829a6131f09 100644
> --- a/drivers/mfd/tps65010.c
> +++ b/drivers/mfd/tps65010.c
> @@ -34,7 +34,7 @@
>  
>  #include <linux/i2c/tps65010.h>
>  
> -#include <linux/gpio.h>
> +#include <linux/gpio/driver.h>
>  
>  
>  /*-------------------------------------------------------------------------*/
> @@ -477,7 +477,7 @@ tps65010_output(struct gpio_chip *chip, unsigned offset, int value)
>  	if (offset < 4) {
>  		struct tps65010		*tps;
>  
> -		tps = container_of(chip, struct tps65010, chip);
> +		tps = gpiochip_get_data(chip);
>  		if (!(tps->outmask & (1 << offset)))
>  			return -EINVAL;
>  		tps65010_set_gpio_out_value(offset + 1, value);
> @@ -494,7 +494,7 @@ static int tps65010_gpio_get(struct gpio_chip *chip, unsigned offset)
>  	int			value;
>  	struct tps65010		*tps;
>  
> -	tps = container_of(chip, struct tps65010, chip);
> +	tps = gpiochip_get_data(chip);
>  
>  	if (offset < 4) {
>  		value = i2c_smbus_read_byte_data(tps->client, TPS_DEFGPIO);
> @@ -651,7 +651,7 @@ static int tps65010_probe(struct i2c_client *client,
>  		tps->chip.ngpio = 7;
>  		tps->chip.can_sleep = 1;
>  
> -		status = gpiochip_add(&tps->chip);
> +		status = gpiochip_add_data(&tps->chip, tps);
>  		if (status < 0)
>  			dev_err(&client->dev, "can't add gpiochip, err %d\n",
>  					status);

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH 8/9] mfd: ucb1x00: Use gpiochip data pointer
  2016-03-30  8:48 ` [PATCH 8/9] mfd: ucb1x00: " Linus Walleij
@ 2016-04-11 11:49   ` Lee Jones
  0 siblings, 0 replies; 20+ messages in thread
From: Lee Jones @ 2016-04-11 11:49 UTC (permalink / raw)
  To: Linus Walleij; +Cc: Samuel Ortiz, linux-kernel

On Wed, 30 Mar 2016, 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().
> 
> Acked-by: Lee Jones <lee.jones@linaro.org>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
>  drivers/mfd/ucb1x00-core.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)

Applied, thanks.

> diff --git a/drivers/mfd/ucb1x00-core.c b/drivers/mfd/ucb1x00-core.c
> index bcafe1ecd71c..9ab9ec47ea75 100644
> --- a/drivers/mfd/ucb1x00-core.c
> +++ b/drivers/mfd/ucb1x00-core.c
> @@ -28,7 +28,7 @@
>  #include <linux/mutex.h>
>  #include <linux/mfd/ucb1x00.h>
>  #include <linux/pm.h>
> -#include <linux/gpio.h>
> +#include <linux/gpio/driver.h>
>  
>  static DEFINE_MUTEX(ucb1x00_mutex);
>  static LIST_HEAD(ucb1x00_drivers);
> @@ -109,7 +109,7 @@ unsigned int ucb1x00_io_read(struct ucb1x00 *ucb)
>  
>  static void ucb1x00_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
>  {
> -	struct ucb1x00 *ucb = container_of(chip, struct ucb1x00, gpio);
> +	struct ucb1x00 *ucb = gpiochip_get_data(chip);
>  	unsigned long flags;
>  
>  	spin_lock_irqsave(&ucb->io_lock, flags);
> @@ -126,7 +126,7 @@ static void ucb1x00_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
>  
>  static int ucb1x00_gpio_get(struct gpio_chip *chip, unsigned offset)
>  {
> -	struct ucb1x00 *ucb = container_of(chip, struct ucb1x00, gpio);
> +	struct ucb1x00 *ucb = gpiochip_get_data(chip);
>  	unsigned val;
>  
>  	ucb1x00_enable(ucb);
> @@ -138,7 +138,7 @@ static int ucb1x00_gpio_get(struct gpio_chip *chip, unsigned offset)
>  
>  static int ucb1x00_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
>  {
> -	struct ucb1x00 *ucb = container_of(chip, struct ucb1x00, gpio);
> +	struct ucb1x00 *ucb = gpiochip_get_data(chip);
>  	unsigned long flags;
>  
>  	spin_lock_irqsave(&ucb->io_lock, flags);
> @@ -154,7 +154,7 @@ static int ucb1x00_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
>  static int ucb1x00_gpio_direction_output(struct gpio_chip *chip, unsigned offset
>  		, int value)
>  {
> -	struct ucb1x00 *ucb = container_of(chip, struct ucb1x00, gpio);
> +	struct ucb1x00 *ucb = gpiochip_get_data(chip);
>  	unsigned long flags;
>  	unsigned old, mask = 1 << offset;
>  
> @@ -181,7 +181,7 @@ static int ucb1x00_gpio_direction_output(struct gpio_chip *chip, unsigned offset
>  
>  static int ucb1x00_to_irq(struct gpio_chip *chip, unsigned offset)
>  {
> -	struct ucb1x00 *ucb = container_of(chip, struct ucb1x00, gpio);
> +	struct ucb1x00 *ucb = gpiochip_get_data(chip);
>  
>  	return ucb->irq_base > 0 ? ucb->irq_base + offset : -ENXIO;
>  }
> @@ -579,7 +579,7 @@ static int ucb1x00_probe(struct mcp *mcp)
>  		ucb->gpio.direction_input = ucb1x00_gpio_direction_input;
>  		ucb->gpio.direction_output = ucb1x00_gpio_direction_output;
>  		ucb->gpio.to_irq = ucb1x00_to_irq;
> -		ret = gpiochip_add(&ucb->gpio);
> +		ret = gpiochip_add_data(&ucb->gpio, ucb);
>  		if (ret)
>  			goto err_gpio_add;
>  	} else

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH 9/9] mfd: vexpress-sysreg: Switch to gpiochip_add_data()
  2016-03-30  8:48 ` [PATCH 9/9] mfd: vexpress-sysreg: Switch to gpiochip_add_data() Linus Walleij
@ 2016-04-11 11:49   ` Lee Jones
  0 siblings, 0 replies; 20+ messages in thread
From: Lee Jones @ 2016-04-11 11:49 UTC (permalink / raw)
  To: Linus Walleij; +Cc: Samuel Ortiz, linux-kernel

On Wed, 30 Mar 2016, Linus Walleij wrote:

> We're planning to remove the gpiochip_add() function to swith
> to gpiochip_add_data() with NULL for data argument.
> 
> Acked-by: Lee Jones <lee.jones@linaro.org>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
>  drivers/mfd/vexpress-sysreg.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied, thanks.

> diff --git a/drivers/mfd/vexpress-sysreg.c b/drivers/mfd/vexpress-sysreg.c
> index 855c0204f09a..201a3ea2a9d3 100644
> --- a/drivers/mfd/vexpress-sysreg.c
> +++ b/drivers/mfd/vexpress-sysreg.c
> @@ -202,7 +202,7 @@ static int vexpress_sysreg_probe(struct platform_device *pdev)
>  	bgpio_init(mmc_gpio_chip, &pdev->dev, 0x4, base + SYS_MCI,
>  			NULL, NULL, NULL, NULL, 0);
>  	mmc_gpio_chip->ngpio = 2;
> -	gpiochip_add(mmc_gpio_chip);
> +	gpiochip_add_data(mmc_gpio_chip, NULL);
>  
>  	return mfd_add_devices(&pdev->dev, PLATFORM_DEVID_AUTO,
>  			vexpress_sysreg_cells,

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH 6/9] mfd: tc6393xb: Use gpiochip data pointer
  2016-03-30  8:48 ` [PATCH 6/9] mfd: tc6393xb: " Linus Walleij
  2016-03-31 10:15   ` Dmitry Eremin-Solenikov
@ 2016-04-11 11:49   ` Lee Jones
  1 sibling, 0 replies; 20+ messages in thread
From: Lee Jones @ 2016-04-11 11:49 UTC (permalink / raw)
  To: Linus Walleij; +Cc: Samuel Ortiz, linux-kernel, Dmitry Baryshkov

On Wed, 30 Mar 2016, 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: Dmitry Baryshkov <dbaryshkov@gmail.com>
> Acked-by: Lee Jones <lee.jones@linaro.org>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
>  drivers/mfd/tc6393xb.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)

Applied, thanks.

> diff --git a/drivers/mfd/tc6393xb.c b/drivers/mfd/tc6393xb.c
> index 1ecbfa40d1b3..d42d322ac7ca 100644
> --- a/drivers/mfd/tc6393xb.c
> +++ b/drivers/mfd/tc6393xb.c
> @@ -24,7 +24,7 @@
>  #include <linux/mfd/core.h>
>  #include <linux/mfd/tmio.h>
>  #include <linux/mfd/tc6393xb.h>
> -#include <linux/gpio.h>
> +#include <linux/gpio/driver.h>
>  #include <linux/slab.h>
>  
>  #define SCR_REVID	0x08		/* b Revision ID	*/
> @@ -434,7 +434,7 @@ static struct mfd_cell tc6393xb_cells[] = {
>  static int tc6393xb_gpio_get(struct gpio_chip *chip,
>  		unsigned offset)
>  {
> -	struct tc6393xb *tc6393xb = container_of(chip, struct tc6393xb, gpio);
> +	struct tc6393xb *tc6393xb = gpiochip_get_data(chip);
>  
>  	/* XXX: does dsr also represent inputs? */
>  	return !!(tmio_ioread8(tc6393xb->scr + SCR_GPO_DSR(offset / 8))
> @@ -444,7 +444,7 @@ static int tc6393xb_gpio_get(struct gpio_chip *chip,
>  static void __tc6393xb_gpio_set(struct gpio_chip *chip,
>  		unsigned offset, int value)
>  {
> -	struct tc6393xb *tc6393xb = container_of(chip, struct tc6393xb, gpio);
> +	struct tc6393xb *tc6393xb = gpiochip_get_data(chip);
>  	u8  dsr;
>  
>  	dsr = tmio_ioread8(tc6393xb->scr + SCR_GPO_DSR(offset / 8));
> @@ -459,7 +459,7 @@ static void __tc6393xb_gpio_set(struct gpio_chip *chip,
>  static void tc6393xb_gpio_set(struct gpio_chip *chip,
>  		unsigned offset, int value)
>  {
> -	struct tc6393xb *tc6393xb = container_of(chip, struct tc6393xb, gpio);
> +	struct tc6393xb *tc6393xb = gpiochip_get_data(chip);
>  	unsigned long flags;
>  
>  	spin_lock_irqsave(&tc6393xb->lock, flags);
> @@ -472,7 +472,7 @@ static void tc6393xb_gpio_set(struct gpio_chip *chip,
>  static int tc6393xb_gpio_direction_input(struct gpio_chip *chip,
>  			unsigned offset)
>  {
> -	struct tc6393xb *tc6393xb = container_of(chip, struct tc6393xb, gpio);
> +	struct tc6393xb *tc6393xb = gpiochip_get_data(chip);
>  	unsigned long flags;
>  	u8 doecr;
>  
> @@ -490,7 +490,7 @@ static int tc6393xb_gpio_direction_input(struct gpio_chip *chip,
>  static int tc6393xb_gpio_direction_output(struct gpio_chip *chip,
>  			unsigned offset, int value)
>  {
> -	struct tc6393xb *tc6393xb = container_of(chip, struct tc6393xb, gpio);
> +	struct tc6393xb *tc6393xb = gpiochip_get_data(chip);
>  	unsigned long flags;
>  	u8 doecr;
>  
> @@ -517,7 +517,7 @@ static int tc6393xb_register_gpio(struct tc6393xb *tc6393xb, int gpio_base)
>  	tc6393xb->gpio.direction_input = tc6393xb_gpio_direction_input;
>  	tc6393xb->gpio.direction_output = tc6393xb_gpio_direction_output;
>  
> -	return gpiochip_add(&tc6393xb->gpio);
> +	return gpiochip_add_data(&tc6393xb->gpio, tc6393xb);
>  }
>  
>  /*--------------------------------------------------------------------------*/

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

end of thread, other threads:[~2016-04-11 11:49 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-30  8:48 [PATCH 0/9] Use GPIO data pointer in MFD Linus Walleij
2016-03-30  8:48 ` [PATCH 1/9] mfd: asic3: Use gpiochip data pointer Linus Walleij
2016-04-11 11:47   ` Lee Jones
2016-03-30  8:48 ` [PATCH 2/9] mfd: dm355evm_msp: Switch to gpiochip_add_data() Linus Walleij
2016-04-11 11:48   ` Lee Jones
2016-03-30  8:48 ` [PATCH 3/9] mfd: htc-egpio: Use gpiochip data pointer Linus Walleij
2016-04-11 11:48   ` Lee Jones
2016-03-30  8:48 ` [PATCH 4/9] mfd: htc-i2cpld: " Linus Walleij
2016-04-11 11:48   ` Lee Jones
2016-03-30  8:48 ` [PATCH 5/9] mfd: sm501: " Linus Walleij
2016-04-11 11:48   ` Lee Jones
2016-03-30  8:48 ` [PATCH 6/9] mfd: tc6393xb: " Linus Walleij
2016-03-31 10:15   ` Dmitry Eremin-Solenikov
2016-04-11 11:49   ` Lee Jones
2016-03-30  8:48 ` [PATCH 7/9] mfd: tps65010: " Linus Walleij
2016-04-11 11:48   ` Lee Jones
2016-03-30  8:48 ` [PATCH 8/9] mfd: ucb1x00: " Linus Walleij
2016-04-11 11:49   ` Lee Jones
2016-03-30  8:48 ` [PATCH 9/9] mfd: vexpress-sysreg: Switch to gpiochip_add_data() Linus Walleij
2016-04-11 11:49   ` Lee Jones

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