public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/1] mfd: lm3533: Move to new GPIO descriptor-based APIs
@ 2024-06-05 19:14 Andy Shevchenko
  2024-06-13 15:53 ` Lee Jones
  2024-06-20  9:11 ` (subset) " Lee Jones
  0 siblings, 2 replies; 3+ messages in thread
From: Andy Shevchenko @ 2024-06-05 19:14 UTC (permalink / raw)
  To: Lee Jones, Andy Shevchenko, linux-kernel; +Cc: Johan Hovold

Legacy GPIO APIs are subject to remove. Convert the driver to new APIs.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
v2: left platform data in place (Johan), and rebased this patch
 drivers/mfd/lm3533-core.c  | 24 +++++++-----------------
 include/linux/mfd/lm3533.h |  5 ++---
 2 files changed, 9 insertions(+), 20 deletions(-)

diff --git a/drivers/mfd/lm3533-core.c b/drivers/mfd/lm3533-core.c
index c1219e608c5f..0a2409d00b2e 100644
--- a/drivers/mfd/lm3533-core.c
+++ b/drivers/mfd/lm3533-core.c
@@ -11,7 +11,7 @@
 #include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/err.h>
-#include <linux/gpio.h>
+#include <linux/gpio/consumer.h>
 #include <linux/i2c.h>
 #include <linux/mfd/core.h>
 #include <linux/regmap.h>
@@ -225,14 +225,12 @@ static int lm3533_set_lvled_config(struct lm3533 *lm3533, u8 lvled, u8 led)
 
 static void lm3533_enable(struct lm3533 *lm3533)
 {
-	if (gpio_is_valid(lm3533->gpio_hwen))
-		gpio_set_value(lm3533->gpio_hwen, 1);
+	gpiod_set_value(lm3533->hwen, 1);
 }
 
 static void lm3533_disable(struct lm3533 *lm3533)
 {
-	if (gpio_is_valid(lm3533->gpio_hwen))
-		gpio_set_value(lm3533->gpio_hwen, 0);
+	gpiod_set_value(lm3533->hwen, 0);
 }
 
 enum lm3533_attribute_type {
@@ -483,18 +481,10 @@ static int lm3533_device_init(struct lm3533 *lm3533)
 		return -EINVAL;
 	}
 
-	lm3533->gpio_hwen = pdata->gpio_hwen;
-
-	if (gpio_is_valid(lm3533->gpio_hwen)) {
-		ret = devm_gpio_request_one(lm3533->dev, lm3533->gpio_hwen,
-					GPIOF_OUT_INIT_LOW, "lm3533-hwen");
-		if (ret < 0) {
-			dev_err(lm3533->dev,
-				"failed to request HWEN GPIO %d\n",
-				lm3533->gpio_hwen);
-			return ret;
-		}
-	}
+	lm3533->hwen = devm_gpiod_get(lm3533->dev, NULL, GPIOD_OUT_LOW);
+	if (IS_ERR(lm3533->hwen))
+		return dev_err_probe(lm3533->dev, PTR_ERR(lm3533->hwen), "failed to request HWEN GPIO\n");
+	gpiod_set_consumer_name(lm3533->hwen, "lm3533-hwen");
 
 	lm3533_enable(lm3533);
 
diff --git a/include/linux/mfd/lm3533.h b/include/linux/mfd/lm3533.h
index 77092f6363ad..69059a7a2ce5 100644
--- a/include/linux/mfd/lm3533.h
+++ b/include/linux/mfd/lm3533.h
@@ -16,6 +16,7 @@
 	DEVICE_ATTR(_name, S_IRUGO | S_IWUSR , show_##_name, store_##_name)
 
 struct device;
+struct gpio_desc;
 struct regmap;
 
 struct lm3533 {
@@ -23,7 +24,7 @@ struct lm3533 {
 
 	struct regmap *regmap;
 
-	int gpio_hwen;
+	struct gpio_desc *hwen;
 	int irq;
 
 	unsigned have_als:1;
@@ -69,8 +70,6 @@ enum lm3533_boost_ovp {
 };
 
 struct lm3533_platform_data {
-	int gpio_hwen;
-
 	enum lm3533_boost_ovp boost_ovp;
 	enum lm3533_boost_freq boost_freq;
 
-- 
2.43.0.rc1.1336.g36b5255a03ac


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

* Re: [PATCH v2 1/1] mfd: lm3533: Move to new GPIO descriptor-based APIs
  2024-06-05 19:14 [PATCH v2 1/1] mfd: lm3533: Move to new GPIO descriptor-based APIs Andy Shevchenko
@ 2024-06-13 15:53 ` Lee Jones
  2024-06-20  9:11 ` (subset) " Lee Jones
  1 sibling, 0 replies; 3+ messages in thread
From: Lee Jones @ 2024-06-13 15:53 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: linux-kernel, Johan Hovold

On Wed, 05 Jun 2024, Andy Shevchenko wrote:

> Legacy GPIO APIs are subject to remove. Convert the driver to new APIs.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> v2: left platform data in place (Johan), and rebased this patch
>  drivers/mfd/lm3533-core.c  | 24 +++++++-----------------
>  include/linux/mfd/lm3533.h |  5 ++---
>  2 files changed, 9 insertions(+), 20 deletions(-)

It would be nice to get Johan's RB on this.

> diff --git a/drivers/mfd/lm3533-core.c b/drivers/mfd/lm3533-core.c
> index c1219e608c5f..0a2409d00b2e 100644
> --- a/drivers/mfd/lm3533-core.c
> +++ b/drivers/mfd/lm3533-core.c
> @@ -11,7 +11,7 @@
>  #include <linux/init.h>
>  #include <linux/kernel.h>
>  #include <linux/err.h>
> -#include <linux/gpio.h>
> +#include <linux/gpio/consumer.h>
>  #include <linux/i2c.h>
>  #include <linux/mfd/core.h>
>  #include <linux/regmap.h>
> @@ -225,14 +225,12 @@ static int lm3533_set_lvled_config(struct lm3533 *lm3533, u8 lvled, u8 led)
>  
>  static void lm3533_enable(struct lm3533 *lm3533)
>  {
> -	if (gpio_is_valid(lm3533->gpio_hwen))
> -		gpio_set_value(lm3533->gpio_hwen, 1);
> +	gpiod_set_value(lm3533->hwen, 1);
>  }
>  
>  static void lm3533_disable(struct lm3533 *lm3533)
>  {
> -	if (gpio_is_valid(lm3533->gpio_hwen))
> -		gpio_set_value(lm3533->gpio_hwen, 0);
> +	gpiod_set_value(lm3533->hwen, 0);
>  }
>  
>  enum lm3533_attribute_type {
> @@ -483,18 +481,10 @@ static int lm3533_device_init(struct lm3533 *lm3533)
>  		return -EINVAL;
>  	}
>  
> -	lm3533->gpio_hwen = pdata->gpio_hwen;
> -
> -	if (gpio_is_valid(lm3533->gpio_hwen)) {
> -		ret = devm_gpio_request_one(lm3533->dev, lm3533->gpio_hwen,
> -					GPIOF_OUT_INIT_LOW, "lm3533-hwen");
> -		if (ret < 0) {
> -			dev_err(lm3533->dev,
> -				"failed to request HWEN GPIO %d\n",
> -				lm3533->gpio_hwen);
> -			return ret;
> -		}
> -	}
> +	lm3533->hwen = devm_gpiod_get(lm3533->dev, NULL, GPIOD_OUT_LOW);
> +	if (IS_ERR(lm3533->hwen))
> +		return dev_err_probe(lm3533->dev, PTR_ERR(lm3533->hwen), "failed to request HWEN GPIO\n");
> +	gpiod_set_consumer_name(lm3533->hwen, "lm3533-hwen");
>  
>  	lm3533_enable(lm3533);
>  
> diff --git a/include/linux/mfd/lm3533.h b/include/linux/mfd/lm3533.h
> index 77092f6363ad..69059a7a2ce5 100644
> --- a/include/linux/mfd/lm3533.h
> +++ b/include/linux/mfd/lm3533.h
> @@ -16,6 +16,7 @@
>  	DEVICE_ATTR(_name, S_IRUGO | S_IWUSR , show_##_name, store_##_name)
>  
>  struct device;
> +struct gpio_desc;
>  struct regmap;
>  
>  struct lm3533 {
> @@ -23,7 +24,7 @@ struct lm3533 {
>  
>  	struct regmap *regmap;
>  
> -	int gpio_hwen;
> +	struct gpio_desc *hwen;
>  	int irq;
>  
>  	unsigned have_als:1;
> @@ -69,8 +70,6 @@ enum lm3533_boost_ovp {
>  };
>  
>  struct lm3533_platform_data {
> -	int gpio_hwen;
> -
>  	enum lm3533_boost_ovp boost_ovp;
>  	enum lm3533_boost_freq boost_freq;
>  
> -- 
> 2.43.0.rc1.1336.g36b5255a03ac
> 

-- 
Lee Jones [李琼斯]

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

* Re: (subset) [PATCH v2 1/1] mfd: lm3533: Move to new GPIO descriptor-based APIs
  2024-06-05 19:14 [PATCH v2 1/1] mfd: lm3533: Move to new GPIO descriptor-based APIs Andy Shevchenko
  2024-06-13 15:53 ` Lee Jones
@ 2024-06-20  9:11 ` Lee Jones
  1 sibling, 0 replies; 3+ messages in thread
From: Lee Jones @ 2024-06-20  9:11 UTC (permalink / raw)
  To: linux-kernel, Andy Shevchenko; +Cc: Johan Hovold

On Wed, 05 Jun 2024 22:14:16 +0300, Andy Shevchenko wrote:
> Legacy GPIO APIs are subject to remove. Convert the driver to new APIs.
> 
> 

Applied, thanks!

[1/1] mfd: lm3533: Move to new GPIO descriptor-based APIs
      commit: 8dc7c29f608649f3d9eca826e9d4fe4b8a32c472

--
Lee Jones [李琼斯]


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

end of thread, other threads:[~2024-06-20  9:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-05 19:14 [PATCH v2 1/1] mfd: lm3533: Move to new GPIO descriptor-based APIs Andy Shevchenko
2024-06-13 15:53 ` Lee Jones
2024-06-20  9:11 ` (subset) " Lee Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox