From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
linux-kernel@vger.kernel.org
Cc: Lee Jones <lee@kernel.org>, Linus Walleij <linus.walleij@linaro.org>
Subject: [PATCH v1 2/2] mfd: lm3533: Move to new GPIO descriptor-based APIs
Date: Wed, 8 May 2024 13:46:49 +0300 [thread overview]
Message-ID: <20240508104848.846580-3-andriy.shevchenko@linux.intel.com> (raw)
In-Reply-To: <20240508104848.846580-1-andriy.shevchenko@linux.intel.com>
Legacy GPIO APIs are subject to remove. Convert the driver to new APIs.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/mfd/lm3533-core.c | 26 +++++++-------------------
include/linux/mfd/lm3533.h | 3 ++-
2 files changed, 9 insertions(+), 20 deletions(-)
diff --git a/drivers/mfd/lm3533-core.c b/drivers/mfd/lm3533-core.c
index 515a6c3b3244..e135142a158d 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>
@@ -22,8 +22,6 @@
#include <linux/mfd/lm3533.h>
struct lm3533_platform_data {
- int gpio_hwen;
-
enum lm3533_boost_ovp boost_ovp;
enum lm3533_boost_freq boost_freq;
@@ -239,14 +237,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 {
@@ -496,18 +492,10 @@ static int lm3533_device_init(struct lm3533 *lm3533)
if (!pdata)
return -ENOMEM;
- 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 ce42f0737768..d30c70c2a5f6 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;
--
2.43.0.rc1.1336.g36b5255a03ac
next prev parent reply other threads:[~2024-05-08 10:48 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-08 10:46 [PATCH v1 0/2] mfd: lm3533: Get rid of legacy GPIO APIs Andy Shevchenko
2024-05-08 10:46 ` [PATCH v1 1/2] mfd: lm3533: Hide legacy platform data in the driver Andy Shevchenko
2024-05-27 13:03 ` Linus Walleij
2024-05-31 15:00 ` Lee Jones
2024-05-31 15:08 ` Andy Shevchenko
2024-05-31 15:54 ` Lee Jones
2024-05-31 16:40 ` Andy Shevchenko
2024-05-31 16:58 ` Lee Jones
2024-05-31 17:09 ` Andy Shevchenko
2024-06-05 12:40 ` Johan Hovold
2024-05-08 10:46 ` Andy Shevchenko [this message]
2024-05-27 13:05 ` [PATCH v1 2/2] mfd: lm3533: Move to new GPIO descriptor-based APIs Linus Walleij
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=20240508104848.846580-3-andriy.shevchenko@linux.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=lee@kernel.org \
--cc=linus.walleij@linaro.org \
--cc=linux-kernel@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox