From: Arnd Bergmann <arnd@kernel.org>
To: linux-gpio@vger.kernel.org
Cc: Arnd Bergmann <arnd@arndb.de>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Bartosz Golaszewski <bartosz.golaszewski@linaro.org>,
Christophe Leroy <christophe.leroy@csgroup.eu>,
Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Linus Walleij <linus.walleij@linaro.org>,
linux-kernel@vger.kernel.org
Subject: [PATCH 4/8] gpiolib: remove gpio_set_debounce
Date: Thu, 26 Jan 2023 14:27:57 +0100 [thread overview]
Message-ID: <20230126132801.2042371-5-arnd@kernel.org> (raw)
In-Reply-To: <20230126132801.2042371-1-arnd@kernel.org>
From: Arnd Bergmann <arnd@arndb.de>
gpio_set_debounce() only has a single user, which is trivially
converted to gpiod_set_debounce().
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
Documentation/driver-api/gpio/legacy.rst | 2 --
drivers/input/touchscreen/ads7846.c | 24 +++++++++++++-----------
include/linux/gpio.h | 22 ----------------------
3 files changed, 13 insertions(+), 35 deletions(-)
diff --git a/Documentation/driver-api/gpio/legacy.rst b/Documentation/driver-api/gpio/legacy.rst
index a0559d93efd1..e0306e78e34b 100644
--- a/Documentation/driver-api/gpio/legacy.rst
+++ b/Documentation/driver-api/gpio/legacy.rst
@@ -238,8 +238,6 @@ setup or driver probe/teardown code, so this is an easy constraint.)::
## gpio_free_array()
gpio_free()
- gpio_set_debounce()
-
Claiming and Releasing GPIOs
diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
index 4c3dd01902d0..354da71ff037 100644
--- a/drivers/input/touchscreen/ads7846.c
+++ b/drivers/input/touchscreen/ads7846.c
@@ -27,6 +27,7 @@
#include <linux/of.h>
#include <linux/of_gpio.h>
#include <linux/of_device.h>
+#include <linux/gpio/consumer.h>
#include <linux/gpio.h>
#include <linux/spi/spi.h>
#include <linux/spi/ads7846.h>
@@ -139,7 +140,7 @@ struct ads7846 {
int (*filter)(void *data, int data_idx, int *val);
void *filter_data;
int (*get_pendown_state)(void);
- int gpio_pendown;
+ struct gpio_desc *gpio_pendown;
void (*wait_for_sync)(void);
};
@@ -222,7 +223,7 @@ static int get_pendown_state(struct ads7846 *ts)
if (ts->get_pendown_state)
return ts->get_pendown_state();
- return !gpio_get_value(ts->gpio_pendown);
+ return !gpiod_get_value(ts->gpio_pendown);
}
static void ads7846_report_pen_up(struct ads7846 *ts)
@@ -1005,7 +1006,6 @@ static int ads7846_setup_pendown(struct spi_device *spi,
if (pdata->get_pendown_state) {
ts->get_pendown_state = pdata->get_pendown_state;
} else if (gpio_is_valid(pdata->gpio_pendown)) {
-
err = devm_gpio_request_one(&spi->dev, pdata->gpio_pendown,
GPIOF_IN, "ads7846_pendown");
if (err) {
@@ -1015,15 +1015,17 @@ static int ads7846_setup_pendown(struct spi_device *spi,
return err;
}
- ts->gpio_pendown = pdata->gpio_pendown;
-
- if (pdata->gpio_pendown_debounce)
- gpio_set_debounce(pdata->gpio_pendown,
- pdata->gpio_pendown_debounce);
+ ts->gpio_pendown = gpio_to_desc(pdata->gpio_pendown);
} else {
- dev_err(&spi->dev, "no get_pendown_state nor gpio_pendown?\n");
- return -EINVAL;
+ ts->gpio_pendown = gpiod_get(&spi->dev, "pendown-gpio", GPIOD_IN);
+ if (IS_ERR(ts->gpio_pendown)) {
+ dev_err(&spi->dev, "no get_pendown_state nor gpio_pendown?\n");
+ return PTR_ERR(ts->gpio_pendown);
+ }
}
+ if (pdata->gpio_pendown_debounce)
+ gpiod_set_debounce(ts->gpio_pendown,
+ pdata->gpio_pendown_debounce);
return 0;
}
@@ -1192,7 +1194,7 @@ static const struct ads7846_platform_data *ads7846_probe_dt(struct device *dev)
pdata->wakeup = of_property_read_bool(node, "wakeup-source") ||
of_property_read_bool(node, "linux,wakeup");
- pdata->gpio_pendown = of_get_named_gpio(dev->of_node, "pendown-gpio", 0);
+ pdata->gpio_pendown = -1;
return pdata;
}
diff --git a/include/linux/gpio.h b/include/linux/gpio.h
index e273a3287d8e..da7a5ae68e47 100644
--- a/include/linux/gpio.h
+++ b/include/linux/gpio.h
@@ -100,11 +100,6 @@ static inline int gpio_direction_output(unsigned gpio, int value)
return gpiod_direction_output_raw(gpio_to_desc(gpio), value);
}
-static inline int gpio_set_debounce(unsigned gpio, unsigned debounce)
-{
- return gpiod_set_debounce(gpio_to_desc(gpio), debounce);
-}
-
static inline int gpio_get_value_cansleep(unsigned gpio)
{
return gpiod_get_raw_value_cansleep(gpio_to_desc(gpio));
@@ -123,11 +118,6 @@ static inline void gpio_set_value(unsigned gpio, int value)
return gpiod_set_raw_value(gpio_to_desc(gpio), value);
}
-static inline int gpio_cansleep(unsigned gpio)
-{
- return gpiod_cansleep(gpio_to_desc(gpio));
-}
-
static inline int gpio_to_irq(unsigned gpio)
{
return gpiod_to_irq(gpio_to_desc(gpio));
@@ -215,11 +205,6 @@ static inline int gpio_direction_output(unsigned gpio, int value)
return -ENOSYS;
}
-static inline int gpio_set_debounce(unsigned gpio, unsigned debounce)
-{
- return -ENOSYS;
-}
-
static inline int gpio_get_value(unsigned gpio)
{
/* GPIO can never have been requested or set as {in,out}put */
@@ -233,13 +218,6 @@ static inline void gpio_set_value(unsigned gpio, int value)
WARN_ON(1);
}
-static inline int gpio_cansleep(unsigned gpio)
-{
- /* GPIO can never have been requested or set as {in,out}put */
- WARN_ON(1);
- return 0;
-}
-
static inline int gpio_get_value_cansleep(unsigned gpio)
{
/* GPIO can never have been requested or set as {in,out}put */
--
2.39.0
next prev parent reply other threads:[~2023-01-26 13:28 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-26 13:27 [PATCH 0/8] gpiolib cleanups Arnd Bergmann
2023-01-26 13:27 ` [PATCH 1/8] gpiolib: remove empty asm/gpio.h files Arnd Bergmann
2023-01-27 9:41 ` Bartosz Golaszewski
2023-01-27 13:04 ` Linus Walleij
2023-01-26 13:27 ` [PATCH 2/8] gpiolib: coldfire: remove custom asm/gpio.h Arnd Bergmann
2023-01-27 9:41 ` Bartosz Golaszewski
2023-01-27 13:05 ` Linus Walleij
2023-01-26 13:27 ` [PATCH 3/8] gpiolib: remove asm-generic/gpio.h Arnd Bergmann
2023-01-26 13:46 ` Andy Shevchenko
2023-01-26 15:43 ` Arnd Bergmann
2023-01-27 13:07 ` Linus Walleij
2023-01-27 13:14 ` Arnd Bergmann
2023-01-26 13:27 ` Arnd Bergmann [this message]
2023-01-26 13:50 ` [PATCH 4/8] gpiolib: remove gpio_set_debounce Andy Shevchenko
2023-01-26 15:30 ` Arnd Bergmann
2023-01-27 13:09 ` Linus Walleij
2023-01-26 13:27 ` [PATCH 5/8] gpiolib: remove legacy gpio_export Arnd Bergmann
2023-01-26 14:00 ` Andy Shevchenko
2023-01-26 16:02 ` Arnd Bergmann
2023-01-27 13:09 ` Linus Walleij
2023-01-26 13:27 ` [PATCH 6/8] gpiolib: split linux/gpio/driver.h out of linux/gpio.h Arnd Bergmann
2023-01-26 14:04 ` Andy Shevchenko
2023-01-26 14:51 ` Arnd Bergmann
2023-01-27 13:15 ` Linus Walleij
2023-01-26 13:28 ` [PATCH 7/8] gpiolib: split of_mm_gpio_chip out of linux/of_gpio.h Arnd Bergmann
2023-01-26 14:08 ` Andy Shevchenko
2023-01-26 14:54 ` Arnd Bergmann
2023-01-27 13:17 ` Linus Walleij
2023-01-26 13:28 ` [PATCH 8/8] gpiolib: move of_gpio_flags into gpiolib-of.c Arnd Bergmann
2023-01-26 14:09 ` Andy Shevchenko
2023-01-26 14:47 ` Arnd Bergmann
2023-01-27 8:53 ` Andy Shevchenko
2023-01-27 9:43 ` Bartosz Golaszewski
2023-01-27 9:46 ` Arnd Bergmann
2023-01-27 9:48 ` Andy Shevchenko
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=20230126132801.2042371-5-arnd@kernel.org \
--to=arnd@kernel.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=arnd@arndb.de \
--cc=bartosz.golaszewski@linaro.org \
--cc=christophe.leroy@csgroup.eu \
--cc=dmitry.torokhov@gmail.com \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.