[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4f5ecd246c0d9afbd61bf15e48fc160736451fae.camel@fi.rohmeurope.com>
Date: Fri, 11 Dec 2020 12:42:02 +0000
From: "Vaittinen, Matti" <Matti.Vaittinen@...rohmeurope.com>
To: "lgirdwood@...il.com" <lgirdwood@...il.com>,
"marek.vasut+renesas@...il.com" <marek.vasut+renesas@...il.com>,
"yoshihiro.shimoda.uh@...esas.com" <yoshihiro.shimoda.uh@...esas.com>,
"broonie@...nel.org" <broonie@...nel.org>,
"bgolaszewski@...libre.com" <bgolaszewski@...libre.com>,
"lee.jones@...aro.org" <lee.jones@...aro.org>,
"linus.walleij@...aro.org" <linus.walleij@...aro.org>
CC: linux-power <linux-power@...rohmeurope.com>,
"linux-gpio@...r.kernel.org" <linux-gpio@...r.kernel.org>,
"khiem.nguyen.xt@...esas.com" <khiem.nguyen.xt@...esas.com>,
"linux-renesas-soc@...r.kernel.org"
<linux-renesas-soc@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 06/10] gpio: bd9571mwv: rid of using struct bd9571mwv
On Fri, 2020-12-11 at 20:27 +0900, Yoshihiro Shimoda wrote:
> To simplify this driver, use dev_get_regmap() and
> rid of using struct bd9571mwv.
>
> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@...esas.com>
FWIW:
Reviewed-By: Matti Vaittinen <matti.vaittinen@...rohmeurope.com>
> ---
> drivers/gpio/gpio-bd9571mwv.c | 19 +++++++++----------
> 1 file changed, 9 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/gpio/gpio-bd9571mwv.c b/drivers/gpio/gpio-
> bd9571mwv.c
> index abb622c..0e5395f 100644
> --- a/drivers/gpio/gpio-bd9571mwv.c
> +++ b/drivers/gpio/gpio-bd9571mwv.c
> @@ -16,8 +16,8 @@
> #include <linux/mfd/bd9571mwv.h>
>
> struct bd9571mwv_gpio {
> + struct regmap *regmap;
> struct gpio_chip chip;
> - struct bd9571mwv *bd;
> };
>
> static int bd9571mwv_gpio_get_direction(struct gpio_chip *chip,
> @@ -26,7 +26,7 @@ static int bd9571mwv_gpio_get_direction(struct
> gpio_chip *chip,
> struct bd9571mwv_gpio *gpio = gpiochip_get_data(chip);
> int ret, val;
>
> - ret = regmap_read(gpio->bd->regmap, BD9571MWV_GPIO_DIR, &val);
> + ret = regmap_read(gpio->regmap, BD9571MWV_GPIO_DIR, &val);
> if (ret < 0)
> return ret;
> if (val & BIT(offset))
> @@ -40,8 +40,7 @@ static int bd9571mwv_gpio_direction_input(struct
> gpio_chip *chip,
> {
> struct bd9571mwv_gpio *gpio = gpiochip_get_data(chip);
>
> - regmap_update_bits(gpio->bd->regmap, BD9571MWV_GPIO_DIR,
> - BIT(offset), 0);
> + regmap_update_bits(gpio->regmap, BD9571MWV_GPIO_DIR,
> BIT(offset), 0);
>
> return 0;
> }
> @@ -52,9 +51,9 @@ static int bd9571mwv_gpio_direction_output(struct
> gpio_chip *chip,
> struct bd9571mwv_gpio *gpio = gpiochip_get_data(chip);
>
> /* Set the initial value */
> - regmap_update_bits(gpio->bd->regmap, BD9571MWV_GPIO_OUT,
> + regmap_update_bits(gpio->regmap, BD9571MWV_GPIO_OUT,
> BIT(offset), value ? BIT(offset) : 0);
> - regmap_update_bits(gpio->bd->regmap, BD9571MWV_GPIO_DIR,
> + regmap_update_bits(gpio->regmap, BD9571MWV_GPIO_DIR,
> BIT(offset), BIT(offset));
>
> return 0;
> @@ -65,7 +64,7 @@ static int bd9571mwv_gpio_get(struct gpio_chip
> *chip, unsigned int offset)
> struct bd9571mwv_gpio *gpio = gpiochip_get_data(chip);
> int ret, val;
>
> - ret = regmap_read(gpio->bd->regmap, BD9571MWV_GPIO_IN, &val);
> + ret = regmap_read(gpio->regmap, BD9571MWV_GPIO_IN, &val);
> if (ret < 0)
> return ret;
>
> @@ -77,7 +76,7 @@ static void bd9571mwv_gpio_set(struct gpio_chip
> *chip, unsigned int offset,
> {
> struct bd9571mwv_gpio *gpio = gpiochip_get_data(chip);
>
> - regmap_update_bits(gpio->bd->regmap, BD9571MWV_GPIO_OUT,
> + regmap_update_bits(gpio->regmap, BD9571MWV_GPIO_OUT,
> BIT(offset), value ? BIT(offset) : 0);
> }
>
> @@ -105,9 +104,9 @@ static int bd9571mwv_gpio_probe(struct
> platform_device *pdev)
>
> platform_set_drvdata(pdev, gpio);
>
> - gpio->bd = dev_get_drvdata(pdev->dev.parent);
> + gpio->regmap = dev_get_regmap(pdev->dev.parent, NULL);
> gpio->chip = template_chip;
> - gpio->chip.parent = gpio->bd->dev;
> + gpio->chip.parent = pdev->dev.parent;
>
> ret = devm_gpiochip_add_data(&pdev->dev, &gpio->chip, gpio);
> if (ret < 0) {
Powered by blists - more mailing lists