Skip to content

Commit cd46729

Browse files
committed
Input: raydium_i2c_ts - do not ignore EPROBE_DEFER from gpiod_get_optional
We should not be ignoring -EPROBE_DEFER reported by devm_gpiod_get_optional(), but report it as any other error to the upper layers. While we are at it simplify check for the presence of reset GPIO and instead of using IS_ERR_OR_NULL just use boolean. Also do not return -ENOMEM from suspend handler when the device in bootloader mode as that does not make sense and switch to -EBUSY instead. Reported-by: Guenter Roeck <groeck@chromium.org> Reviewed-by: Guenter Roeck <groeck@chromium.org> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
1 parent 48a2b78 commit cd46729

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

‎drivers/input/touchscreen/raydium_i2c_ts.c‎

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -930,7 +930,7 @@ static int raydium_i2c_power_on(struct raydium_data *ts)
930930
{
931931
int error;
932932

933-
if (IS_ERR_OR_NULL(ts->reset_gpio))
933+
if (!ts->reset_gpio)
934934
return 0;
935935

936936
gpiod_set_value_cansleep(ts->reset_gpio, 1);
@@ -967,7 +967,7 @@ static void raydium_i2c_power_off(void *_data)
967967
{
968968
struct raydium_data *ts = _data;
969969

970-
if (!IS_ERR_OR_NULL(ts->reset_gpio)) {
970+
if (ts->reset_gpio) {
971971
gpiod_set_value_cansleep(ts->reset_gpio, 1);
972972
regulator_disable(ts->vccio);
973973
regulator_disable(ts->avdd);
@@ -1018,11 +1018,10 @@ static int raydium_i2c_probe(struct i2c_client *client,
10181018
GPIOD_OUT_LOW);
10191019
if (IS_ERR(ts->reset_gpio)) {
10201020
error = PTR_ERR(ts->reset_gpio);
1021-
if (error != -EPROBE_DEFER) {
1021+
if (error != -EPROBE_DEFER)
10221022
dev_err(&client->dev,
10231023
"failed to get reset gpio: %d\n", error);
1024-
return error;
1025-
}
1024+
return error;
10261025
}
10271026

10281027
error = raydium_i2c_power_on(ts);
@@ -1138,7 +1137,7 @@ static int __maybe_unused raydium_i2c_suspend(struct device *dev)
11381137

11391138
/* Sleep is not available in BLDR recovery mode */
11401139
if (ts->boot_mode != RAYDIUM_TS_MAIN)
1141-
return -ENOMEM;
1140+
return -EBUSY;
11421141

11431142
disable_irq(client->irq);
11441143

0 commit comments

Comments
 (0)