Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

mfd: lm3533: Move to new GPIO descriptor-based APIs

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

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20240605191458.2536819-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Lee Jones <lee@kernel.org>

authored by

Andy Shevchenko and committed by
Lee Jones
d7636117 13c151a9

+9 -20
+7 -17
drivers/mfd/lm3533-core.c
··· 11 11 #include <linux/init.h> 12 12 #include <linux/kernel.h> 13 13 #include <linux/err.h> 14 - #include <linux/gpio.h> 14 + #include <linux/gpio/consumer.h> 15 15 #include <linux/i2c.h> 16 16 #include <linux/mfd/core.h> 17 17 #include <linux/regmap.h> ··· 225 225 226 226 static void lm3533_enable(struct lm3533 *lm3533) 227 227 { 228 - if (gpio_is_valid(lm3533->gpio_hwen)) 229 - gpio_set_value(lm3533->gpio_hwen, 1); 228 + gpiod_set_value(lm3533->hwen, 1); 230 229 } 231 230 232 231 static void lm3533_disable(struct lm3533 *lm3533) 233 232 { 234 - if (gpio_is_valid(lm3533->gpio_hwen)) 235 - gpio_set_value(lm3533->gpio_hwen, 0); 233 + gpiod_set_value(lm3533->hwen, 0); 236 234 } 237 235 238 236 enum lm3533_attribute_type { ··· 481 483 return -EINVAL; 482 484 } 483 485 484 - lm3533->gpio_hwen = pdata->gpio_hwen; 485 - 486 - if (gpio_is_valid(lm3533->gpio_hwen)) { 487 - ret = devm_gpio_request_one(lm3533->dev, lm3533->gpio_hwen, 488 - GPIOF_OUT_INIT_LOW, "lm3533-hwen"); 489 - if (ret < 0) { 490 - dev_err(lm3533->dev, 491 - "failed to request HWEN GPIO %d\n", 492 - lm3533->gpio_hwen); 493 - return ret; 494 - } 495 - } 486 + lm3533->hwen = devm_gpiod_get(lm3533->dev, NULL, GPIOD_OUT_LOW); 487 + if (IS_ERR(lm3533->hwen)) 488 + return dev_err_probe(lm3533->dev, PTR_ERR(lm3533->hwen), "failed to request HWEN GPIO\n"); 489 + gpiod_set_consumer_name(lm3533->hwen, "lm3533-hwen"); 496 490 497 491 lm3533_enable(lm3533); 498 492
+2 -3
include/linux/mfd/lm3533.h
··· 16 16 DEVICE_ATTR(_name, S_IRUGO | S_IWUSR , show_##_name, store_##_name) 17 17 18 18 struct device; 19 + struct gpio_desc; 19 20 struct regmap; 20 21 21 22 struct lm3533 { ··· 24 23 25 24 struct regmap *regmap; 26 25 27 - int gpio_hwen; 26 + struct gpio_desc *hwen; 28 27 int irq; 29 28 30 29 unsigned have_als:1; ··· 70 69 }; 71 70 72 71 struct lm3533_platform_data { 73 - int gpio_hwen; 74 - 75 72 enum lm3533_boost_ovp boost_ovp; 76 73 enum lm3533_boost_freq boost_freq; 77 74