All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
To: marek.vasut+renesas@gmail.com, lee.jones@linaro.org,
	matti.vaittinen@fi.rohmeurope.com, lgirdwood@gmail.com,
	broonie@kernel.org, linus.walleij@linaro.org,
	bgolaszewski@baylibre.com
Cc: khiem.nguyen.xt@renesas.com, linux-power@fi.rohmeurope.com,
	linux-gpio@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Subject: [PATCH v2 06/10] gpio: bd9571mwv: rid of using struct bd9571mwv
Date: Fri, 11 Dec 2020 20:27:36 +0900	[thread overview]
Message-ID: <1607686060-17448-7-git-send-email-yoshihiro.shimoda.uh@renesas.com> (raw)
In-Reply-To: <1607686060-17448-1-git-send-email-yoshihiro.shimoda.uh@renesas.com>

To simplify this driver, use dev_get_regmap() and
rid of using struct bd9571mwv.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.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) {
-- 
2.7.4


  parent reply	other threads:[~2020-12-11 11:30 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-11 11:27 [PATCH v2 00/10] treewide: bd9571mwv: Add support for BD9574MWF Yoshihiro Shimoda
2020-12-11 11:27 ` [PATCH v2 01/10] dt-bindings: mfd: bd9571mwv: Document BD9574MWF Yoshihiro Shimoda
2020-12-11 11:27 ` [PATCH v2 02/10] mfd: rohm-generic: Add BD9571 and BD9574 Yoshihiro Shimoda
2020-12-11 11:36   ` Vaittinen, Matti
2020-12-11 11:27 ` [PATCH v2 03/10] regulator: bd9571mwv: rid of using struct bd9571mwv Yoshihiro Shimoda
2020-12-11 12:00   ` Vaittinen, Matti
2020-12-15 16:02     ` Geert Uytterhoeven
2020-12-15 16:13       ` Geert Uytterhoeven
2020-12-16  2:13         ` Yoshihiro Shimoda
2020-12-16  6:00           ` Vaittinen, Matti
2020-12-16  6:29             ` Yoshihiro Shimoda
2020-12-16  6:55               ` Vaittinen, Matti
2020-12-11 11:27 ` [PATCH v2 04/10] regulator: bd9571mwv: Add BD9574MWF support Yoshihiro Shimoda
2020-12-11 12:34   ` Vaittinen, Matti
2020-12-14  4:57     ` Yoshihiro Shimoda
2020-12-14  7:12       ` Vaittinen, Matti
2020-12-14  8:22         ` Yoshihiro Shimoda
2020-12-11 11:27 ` [PATCH v2 05/10] gpio: bd9571mwv: Use the SPDX license identifier Yoshihiro Shimoda
2020-12-15 16:08   ` Geert Uytterhoeven
2020-12-11 11:27 ` Yoshihiro Shimoda [this message]
2020-12-11 12:42   ` [PATCH v2 06/10] gpio: bd9571mwv: rid of using struct bd9571mwv Vaittinen, Matti
2020-12-11 11:27 ` [PATCH v2 07/10] gpio: bd9571mwv: Add BD9574MWF support Yoshihiro Shimoda
2020-12-11 12:55   ` Vaittinen, Matti
2020-12-14  5:11     ` Yoshihiro Shimoda
2020-12-11 11:27 ` [PATCH v2 08/10] mfd: bd9571mwv: Use the SPDX license identifier Yoshihiro Shimoda
2020-12-14 12:12   ` Yoshihiro Shimoda
2020-12-11 11:27 ` [PATCH v2 09/10] mfd: bd9571mwv: Make the driver more generic Yoshihiro Shimoda
2020-12-11 13:29   ` Vaittinen, Matti
2020-12-14  6:21     ` Yoshihiro Shimoda
2020-12-11 11:27 ` [PATCH v2 10/10] mfd: bd9571mwv: Add support for BD9574MWF Yoshihiro Shimoda

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1607686060-17448-7-git-send-email-yoshihiro.shimoda.uh@renesas.com \
    --to=yoshihiro.shimoda.uh@renesas.com \
    --cc=bgolaszewski@baylibre.com \
    --cc=broonie@kernel.org \
    --cc=khiem.nguyen.xt@renesas.com \
    --cc=lee.jones@linaro.org \
    --cc=lgirdwood@gmail.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-power@fi.rohmeurope.com \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=marek.vasut+renesas@gmail.com \
    --cc=matti.vaittinen@fi.rohmeurope.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.