Skip to contentSkip to conversation

Input: ilitek_ts_i2c: Use gpiod_set_value_cansleep()

PATCH In review Matthijs Kooijman 2 participants 2 messages May 15, 2024

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

PATCH 1/1 Input: ilitek_ts_i2c: Use gpiod_set_value_cansleep()

Use gpiod_set_value_cansleep in the ilitek_reset function (called only from ilitek_ts_i2c_probe and ilitek_resume).

Without this change, the driver may print a warning if the reset pin is connected to a GPIO chip which can sleep (e.g. a GPIO expander):

WARNING: CPU: 1 PID: 578 at gpiod_set_value+0x5c/0xd0

This commit is modeled after commit 7c977019c53ed (leds: lp55xx: Use gpiod_set_value_cansleep(), 2023-09-18)

---
 drivers/input/touchscreen/ilitek_ts_i2c.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/input/touchscreen/ilitek_ts_i2c.c +2 -2
index fc4e39b6651a4..236c332de6cdc 100644
@@ -391,9 +391,9 @@ static const struct ilitek_protocol_map ptl_func_map[] = {
 static void ilitek_reset(struct ilitek_ts_data *ts, int delay)
 {
 	if (ts->reset_gpio) {
-		gpiod_set_value(ts->reset_gpio, 1);
+		gpiod_set_value_cansleep(ts->reset_gpio, 1);
 		mdelay(10);
-		gpiod_set_value(ts->reset_gpio, 0);
+		gpiod_set_value_cansleep(ts->reset_gpio, 0);
 		mdelay(delay);
 	}
 }
Signature · 1 line
2.40.1
maintainer
#1 lore raw

Hi Matthijs,

Quoted 21 lines · Matthijs Kooijman

Use gpiod_set_value_cansleep in the ilitek_reset function (called only from ilitek_ts_i2c_probe and ilitek_resume).

Without this change, the driver may print a warning if the reset pin is connected to a GPIO chip which can sleep (e.g. a GPIO expander):

WARNING: CPU: 1 PID: 578 at gpiod_set_value+0x5c/0xd0

This commit is modeled after commit 7c977019c53ed (leds: lp55xx: Use gpiod_set_value_cansleep(), 2023-09-18)

---
 drivers/input/touchscreen/ilitek_ts_i2c.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/input/touchscreen/ilitek_ts_i2c.c +0 -0
index fc4e39b6651a4..236c332de6cdc 100644

drivers/input/touchscreen/ilitek_ts_i2c.c static const struct ilitek_protocol_map ptl_func_map[] = { · line 397

Quoted 9 lines
drivers/input/touchscreen/ilitek_ts_i2c.c +2 -2
@@ -391,9 +391,9 @@ static const struct ilitek_protocol_map ptl_func_map[] = {
 static void ilitek_reset(struct ilitek_ts_data *ts, int delay)
 {
 	if (ts->reset_gpio) {
-		gpiod_set_value(ts->reset_gpio, 1);
+		gpiod_set_value_cansleep(ts->reset_gpio, 1);
 		mdelay(10);
-		gpiod_set_value(ts->reset_gpio, 0);
+		gpiod_set_value_cansleep(ts->reset_gpio, 0);
 		mdelay(delay);

While we are changing GPIO to the sleeping variant we should also change these mdelays to usleep_range() and msleep() respectively.

Thanks.

Signature · 1 line
Dmitry