Thread (22 messages) 22 messages, 6 authors, 2023-02-08

Re: [PATCH v3 04/12] gpiolib: remove gpio_set_debounce

From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Date: 2023-02-07 21:32:16
Also in: linux-acpi, linux-arch, linux-devicetree, linux-doc, linux-gpio, linux-m68k, linux-media, linux-omap, linux-samsung-soc, linux-sh, linux-wireless, linuxppc-dev, lkml, netdev

On Tue, Feb 07, 2023 at 04:29:44PM +0200, Andy Shevchenko wrote:
quoted hunk ↗ jump to hunk
@@ -1010,14 +1009,21 @@ static int ads7846_setup_pendown(struct spi_device *spi,
 		}
 
 		ts->gpio_pendown = pdata->gpio_pendown;
-
-		if (pdata->gpio_pendown_debounce)
-			gpio_set_debounce(pdata->gpio_pendown,
-					  pdata->gpio_pendown_debounce);
Can we please change only this to:

			gpiod_set_debounce(gpio_to_desc(pdata->gpio_pendown),
					   pdata->gpio_pendown_debounce);

and not change anything else (i.e. drop the changes below)?
 	} else {
-		dev_err(&spi->dev, "no get_pendown_state nor gpio_pendown?\n");
-		return -EINVAL;
+		struct gpio_desc *desc;
+
+		desc = devm_gpiod_get(&spi->dev, "pendown", GPIOD_IN);
+		if (IS_ERR(desc)) {
+			dev_err(&spi->dev, "no get_pendown_state nor gpio_pendown?\n");
+			return PTR_ERR(desc);
+		}
+		gpiod_set_consumer_name(desc, "ads7846_pendown");
+
+		ts->gpio_pendown = desc_to_gpio(desc);
 	}
+	if (pdata->gpio_pendown_debounce)
+		gpiod_set_debounce(gpio_to_desc(ts->gpio_pendown),
+				   pdata->gpio_pendown_debounce);
 
 	return 0;
Thanks.

-- 
Dmitry
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help