Commit e32825c4 authored by Krzysztof Kozlowski's avatar Krzysztof Kozlowski Committed by Dmitry Torokhov

Input: pixcir_i2c_ts - simplify with dev_err_probe()

Common pattern of handling deferred probe can be simplified with
dev_err_probe().  Less code and also it prints the error value.
Signed-off-by: default avatarKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
Reviewed-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20230625162817.100397-16-krzysztof.kozlowski@linaro.orgSigned-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent 10ba628e
...@@ -515,41 +515,27 @@ static int pixcir_i2c_ts_probe(struct i2c_client *client) ...@@ -515,41 +515,27 @@ static int pixcir_i2c_ts_probe(struct i2c_client *client)
input_set_drvdata(input, tsdata); input_set_drvdata(input, tsdata);
tsdata->gpio_attb = devm_gpiod_get(dev, "attb", GPIOD_IN); tsdata->gpio_attb = devm_gpiod_get(dev, "attb", GPIOD_IN);
if (IS_ERR(tsdata->gpio_attb)) { if (IS_ERR(tsdata->gpio_attb))
error = PTR_ERR(tsdata->gpio_attb); return dev_err_probe(dev, PTR_ERR(tsdata->gpio_attb),
if (error != -EPROBE_DEFER) "Failed to request ATTB gpio\n");
dev_err(dev, "Failed to request ATTB gpio: %d\n",
error);
return error;
}
tsdata->gpio_reset = devm_gpiod_get_optional(dev, "reset", tsdata->gpio_reset = devm_gpiod_get_optional(dev, "reset",
GPIOD_OUT_LOW); GPIOD_OUT_LOW);
if (IS_ERR(tsdata->gpio_reset)) { if (IS_ERR(tsdata->gpio_reset))
error = PTR_ERR(tsdata->gpio_reset); return dev_err_probe(dev, PTR_ERR(tsdata->gpio_reset),
if (error != -EPROBE_DEFER) "Failed to request RESET gpio\n");
dev_err(dev, "Failed to request RESET gpio: %d\n",
error);
return error;
}
tsdata->gpio_wake = devm_gpiod_get_optional(dev, "wake", tsdata->gpio_wake = devm_gpiod_get_optional(dev, "wake",
GPIOD_OUT_HIGH); GPIOD_OUT_HIGH);
if (IS_ERR(tsdata->gpio_wake)) { if (IS_ERR(tsdata->gpio_wake))
error = PTR_ERR(tsdata->gpio_wake); return dev_err_probe(dev, PTR_ERR(tsdata->gpio_wake),
if (error != -EPROBE_DEFER) "Failed to get wake gpio\n");
dev_err(dev, "Failed to get wake gpio: %d\n", error);
return error;
}
tsdata->gpio_enable = devm_gpiod_get_optional(dev, "enable", tsdata->gpio_enable = devm_gpiod_get_optional(dev, "enable",
GPIOD_OUT_HIGH); GPIOD_OUT_HIGH);
if (IS_ERR(tsdata->gpio_enable)) { if (IS_ERR(tsdata->gpio_enable))
error = PTR_ERR(tsdata->gpio_enable); return dev_err_probe(dev, PTR_ERR(tsdata->gpio_enable),
if (error != -EPROBE_DEFER) "Failed to get enable gpio\n");
dev_err(dev, "Failed to get enable gpio: %d\n", error);
return error;
}
if (tsdata->gpio_enable) if (tsdata->gpio_enable)
msleep(100); msleep(100);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment