* [PATCH 069/182] gpio: tps65910: use gpiochip data pointer
@ 2015-12-09 13:24 Linus Walleij
2015-12-09 16:25 ` Rhyland Klein
2015-12-22 5:56 ` Laxman Dewangan
0 siblings, 2 replies; 3+ messages in thread
From: Linus Walleij @ 2015-12-09 13:24 UTC (permalink / raw)
To: linux-gpio, Johan Hovold, Alexandre Courbot, Michael Welling,
Markus Pargmann
Cc: Linus Walleij, Rhyland Klein, Laxman Dewangan
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: Rhyland Klein <rklein@nvidia.com>
Cc: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
drivers/gpio/gpio-tps65910.c | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)
diff --git a/drivers/gpio/gpio-tps65910.c b/drivers/gpio/gpio-tps65910.c
index 83894c0387fb..e81eee7627a3 100644
--- a/drivers/gpio/gpio-tps65910.c
+++ b/drivers/gpio/gpio-tps65910.c
@@ -27,14 +27,9 @@ struct tps65910_gpio {
struct tps65910 *tps65910;
};
-static inline struct tps65910_gpio *to_tps65910_gpio(struct gpio_chip *chip)
-{
- return container_of(chip, struct tps65910_gpio, gpio_chip);
-}
-
static int tps65910_gpio_get(struct gpio_chip *gc, unsigned offset)
{
- struct tps65910_gpio *tps65910_gpio = to_tps65910_gpio(gc);
+ struct tps65910_gpio *tps65910_gpio = gpiochip_get_data(gc);
struct tps65910 *tps65910 = tps65910_gpio->tps65910;
unsigned int val;
@@ -49,7 +44,7 @@ static int tps65910_gpio_get(struct gpio_chip *gc, unsigned offset)
static void tps65910_gpio_set(struct gpio_chip *gc, unsigned offset,
int value)
{
- struct tps65910_gpio *tps65910_gpio = to_tps65910_gpio(gc);
+ struct tps65910_gpio *tps65910_gpio = gpiochip_get_data(gc);
struct tps65910 *tps65910 = tps65910_gpio->tps65910;
if (value)
@@ -63,7 +58,7 @@ static void tps65910_gpio_set(struct gpio_chip *gc, unsigned offset,
static int tps65910_gpio_output(struct gpio_chip *gc, unsigned offset,
int value)
{
- struct tps65910_gpio *tps65910_gpio = to_tps65910_gpio(gc);
+ struct tps65910_gpio *tps65910_gpio = gpiochip_get_data(gc);
struct tps65910 *tps65910 = tps65910_gpio->tps65910;
/* Set the initial value */
@@ -75,7 +70,7 @@ static int tps65910_gpio_output(struct gpio_chip *gc, unsigned offset,
static int tps65910_gpio_input(struct gpio_chip *gc, unsigned offset)
{
- struct tps65910_gpio *tps65910_gpio = to_tps65910_gpio(gc);
+ struct tps65910_gpio *tps65910_gpio = gpiochip_get_data(gc);
struct tps65910 *tps65910 = tps65910_gpio->tps65910;
return tps65910_reg_clear_bits(tps65910, TPS65910_GPIO0 + offset,
@@ -175,7 +170,7 @@ static int tps65910_gpio_probe(struct platform_device *pdev)
}
skip_init:
- ret = gpiochip_add(&tps65910_gpio->gpio_chip);
+ ret = gpiochip_add_data(&tps65910_gpio->gpio_chip, tps65910_gpio);
if (ret < 0) {
dev_err(&pdev->dev, "Could not register gpiochip, %d\n", ret);
return ret;
--
2.4.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 069/182] gpio: tps65910: use gpiochip data pointer
2015-12-09 13:24 [PATCH 069/182] gpio: tps65910: use gpiochip data pointer Linus Walleij
@ 2015-12-09 16:25 ` Rhyland Klein
2015-12-22 5:56 ` Laxman Dewangan
1 sibling, 0 replies; 3+ messages in thread
From: Rhyland Klein @ 2015-12-09 16:25 UTC (permalink / raw)
To: Linus Walleij, linux-gpio, Johan Hovold, Alexandre Courbot,
Michael Welling, Markus Pargmann
Cc: Laxman Dewangan
On 12/9/2015 8:24 AM, 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: Rhyland Klein <rklein@nvidia.com>
> Cc: Laxman Dewangan <ldewangan@nvidia.com>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
> drivers/gpio/gpio-tps65910.c | 15 +++++----------
> 1 file changed, 5 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/gpio/gpio-tps65910.c b/drivers/gpio/gpio-tps65910.c
> index 83894c0387fb..e81eee7627a3 100644
> --- a/drivers/gpio/gpio-tps65910.c
> +++ b/drivers/gpio/gpio-tps65910.c
> @@ -27,14 +27,9 @@ struct tps65910_gpio {
> struct tps65910 *tps65910;
> };
>
> -static inline struct tps65910_gpio *to_tps65910_gpio(struct gpio_chip *chip)
> -{
> - return container_of(chip, struct tps65910_gpio, gpio_chip);
> -}
> -
> static int tps65910_gpio_get(struct gpio_chip *gc, unsigned offset)
> {
> - struct tps65910_gpio *tps65910_gpio = to_tps65910_gpio(gc);
> + struct tps65910_gpio *tps65910_gpio = gpiochip_get_data(gc);
> struct tps65910 *tps65910 = tps65910_gpio->tps65910;
> unsigned int val;
>
> @@ -49,7 +44,7 @@ static int tps65910_gpio_get(struct gpio_chip *gc, unsigned offset)
> static void tps65910_gpio_set(struct gpio_chip *gc, unsigned offset,
> int value)
> {
> - struct tps65910_gpio *tps65910_gpio = to_tps65910_gpio(gc);
> + struct tps65910_gpio *tps65910_gpio = gpiochip_get_data(gc);
> struct tps65910 *tps65910 = tps65910_gpio->tps65910;
>
> if (value)
> @@ -63,7 +58,7 @@ static void tps65910_gpio_set(struct gpio_chip *gc, unsigned offset,
> static int tps65910_gpio_output(struct gpio_chip *gc, unsigned offset,
> int value)
> {
> - struct tps65910_gpio *tps65910_gpio = to_tps65910_gpio(gc);
> + struct tps65910_gpio *tps65910_gpio = gpiochip_get_data(gc);
> struct tps65910 *tps65910 = tps65910_gpio->tps65910;
>
> /* Set the initial value */
> @@ -75,7 +70,7 @@ static int tps65910_gpio_output(struct gpio_chip *gc, unsigned offset,
>
> static int tps65910_gpio_input(struct gpio_chip *gc, unsigned offset)
> {
> - struct tps65910_gpio *tps65910_gpio = to_tps65910_gpio(gc);
> + struct tps65910_gpio *tps65910_gpio = gpiochip_get_data(gc);
> struct tps65910 *tps65910 = tps65910_gpio->tps65910;
>
> return tps65910_reg_clear_bits(tps65910, TPS65910_GPIO0 + offset,
> @@ -175,7 +170,7 @@ static int tps65910_gpio_probe(struct platform_device *pdev)
> }
>
> skip_init:
> - ret = gpiochip_add(&tps65910_gpio->gpio_chip);
> + ret = gpiochip_add_data(&tps65910_gpio->gpio_chip, tps65910_gpio);
> if (ret < 0) {
> dev_err(&pdev->dev, "Could not register gpiochip, %d\n", ret);
> return ret;
>
Acked-By: Rhyland Klein <rklein@nvidia.com>
--
nvpublic
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 069/182] gpio: tps65910: use gpiochip data pointer
2015-12-09 13:24 [PATCH 069/182] gpio: tps65910: use gpiochip data pointer Linus Walleij
2015-12-09 16:25 ` Rhyland Klein
@ 2015-12-22 5:56 ` Laxman Dewangan
1 sibling, 0 replies; 3+ messages in thread
From: Laxman Dewangan @ 2015-12-22 5:56 UTC (permalink / raw)
To: Linus Walleij, linux-gpio, Johan Hovold, Alexandre Courbot,
Michael Welling, Markus Pargmann
Cc: Rhyland Klein
On Wednesday 09 December 2015 06:54 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: Rhyland Klein <rklein@nvidia.com>
> Cc: Laxman Dewangan <ldewangan@nvidia.com>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
>
Acked-by: Laxman Dewangan <ldewangan@nvidia.com>
-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain
confidential information. Any unauthorized review, use, disclosure or distribution
is prohibited. If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-12-22 6:06 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:24 [PATCH 069/182] gpio: tps65910: use gpiochip data pointer Linus Walleij
2015-12-09 16:25 ` Rhyland Klein
2015-12-22 5:56 ` Laxman Dewangan
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).