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.

gpiolib: legacy: Make sure we kill gpio_request_one() first

Make sure we kill gpio_request_one() first by converting it to
use legacy APIs that will be alive a bit longer. In particular,
this also shows the code we will use in another function to make
it die independently.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20251112093608.1481030-2-andriy.shevchenko@linux.intel.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

authored by

Andy Shevchenko and committed by
Bartosz Golaszewski
61e1fd2a 82e71fe4

+4 -14
+4 -14
drivers/gpio/gpiolib-legacy.c
··· 34 34 */ 35 35 int gpio_request_one(unsigned gpio, unsigned long flags, const char *label) 36 36 { 37 - struct gpio_desc *desc; 38 37 int err; 39 38 40 - /* Compatibility: assume unavailable "valid" GPIOs will appear later */ 41 - desc = gpio_to_desc(gpio); 42 - if (!desc) 43 - return -EPROBE_DEFER; 44 - 45 - err = gpiod_request(desc, label); 39 + err = gpio_request(gpio, label); 46 40 if (err) 47 41 return err; 48 42 49 43 if (flags & GPIOF_IN) 50 - err = gpiod_direction_input(desc); 44 + err = gpio_direction_input(gpio); 51 45 else 52 - err = gpiod_direction_output_raw(desc, !!(flags & GPIOF_OUT_INIT_HIGH)); 46 + err = gpio_direction_output(gpio, !!(flags & GPIOF_OUT_INIT_HIGH)); 53 47 54 48 if (err) 55 - goto free_gpio; 49 + gpio_free(gpio); 56 50 57 - return 0; 58 - 59 - free_gpio: 60 - gpiod_free(desc); 61 51 return err; 62 52 } 63 53 EXPORT_SYMBOL_GPL(gpio_request_one);