Skip to contentSkip to conversation

input: touchscreen: ads7846: Use managed variant to get pendown GPIO

PATCH New Markus Koch 1 participant 1 message Dec 23, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 input: touchscreen: ads7846: Use managed variant to get pendown GPIO

Removing and re-probing the driver failed with an error to request the pendown GPIO because it is never released in the remove function.

This patch replaces the original gpiod_get function call with the managed devm_gpiod_get variant, which automatically releases the GPIO when the module is unloaded.

---
Tested on an IMX53-based platform.

---
 drivers/input/touchscreen/ads7846.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/touchscreen/ads7846.c +1 -1
index 607f18af7010..212dafa0bba2 100644
@@ -1011,7 +1011,7 @@ static int ads7846_setup_pendown(struct spi_device *spi,
 	if (pdata->get_pendown_state) {
 		ts->get_pendown_state = pdata->get_pendown_state;
 	} else {
-		ts->gpio_pendown = gpiod_get(&spi->dev, "pendown", GPIOD_IN);
+		ts->gpio_pendown = devm_gpiod_get(&spi->dev, "pendown", GPIOD_IN);
 		if (IS_ERR(ts->gpio_pendown)) {
 			dev_err(&spi->dev, "failed to request pendown GPIO\n");
 			return PTR_ERR(ts->gpio_pendown);
Signature · 1 line
2.47.1