Message ID | 20200826181706.11098-14-krzk@kernel.org (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | [01/24] Input: bcm-keypad - Simplify with dev_err_probe() | expand |
On Wed, Aug 26, 2020 at 9:21 PM Krzysztof Kozlowski <krzk@kernel.org> wrote: > > Common pattern of handling deferred probe can be simplified with > dev_err_probe(). Less code and also it prints the error value. Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> > Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> > --- > drivers/input/touchscreen/ektf2127.c | 8 ++------ > 1 file changed, 2 insertions(+), 6 deletions(-) > > diff --git a/drivers/input/touchscreen/ektf2127.c b/drivers/input/touchscreen/ektf2127.c > index eadd389cf81f..cd41483cfae5 100644 > --- a/drivers/input/touchscreen/ektf2127.c > +++ b/drivers/input/touchscreen/ektf2127.c > @@ -237,12 +237,8 @@ static int ektf2127_probe(struct i2c_client *client, > > /* This requests the gpio *and* turns on the touchscreen controller */ > ts->power_gpios = devm_gpiod_get(dev, "power", GPIOD_OUT_HIGH); > - if (IS_ERR(ts->power_gpios)) { > - error = PTR_ERR(ts->power_gpios); > - if (error != -EPROBE_DEFER) > - dev_err(dev, "Error getting power gpio: %d\n", error); > - return error; > - } > + if (IS_ERR(ts->power_gpios)) > + return dev_err_probe(dev, PTR_ERR(ts->power_gpios), "Error getting power gpio\n"); > > input = devm_input_allocate_device(dev); > if (!input) > -- > 2.17.1 >
diff --git a/drivers/input/touchscreen/ektf2127.c b/drivers/input/touchscreen/ektf2127.c index eadd389cf81f..cd41483cfae5 100644 --- a/drivers/input/touchscreen/ektf2127.c +++ b/drivers/input/touchscreen/ektf2127.c @@ -237,12 +237,8 @@ static int ektf2127_probe(struct i2c_client *client, /* This requests the gpio *and* turns on the touchscreen controller */ ts->power_gpios = devm_gpiod_get(dev, "power", GPIOD_OUT_HIGH); - if (IS_ERR(ts->power_gpios)) { - error = PTR_ERR(ts->power_gpios); - if (error != -EPROBE_DEFER) - dev_err(dev, "Error getting power gpio: %d\n", error); - return error; - } + if (IS_ERR(ts->power_gpios)) + return dev_err_probe(dev, PTR_ERR(ts->power_gpios), "Error getting power gpio\n"); input = devm_input_allocate_device(dev); if (!input)
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: Krzysztof Kozlowski <krzk@kernel.org> --- drivers/input/touchscreen/ektf2127.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)