Input: bu21013_ts - simplify with dev_err_probe()
authorKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Sun, 25 Jun 2023 16:27:59 +0000 (18:27 +0200)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Fri, 7 Jul 2023 23:54:27 +0000 (16:54 -0700)
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 <krzysztof.kozlowski@linaro.org>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20230625162817.100397-7-krzysztof.kozlowski@linaro.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
drivers/input/touchscreen/bu21013_ts.c

index 85332cfaa29dc92718a90c812ff30e8368e79da2..f811677a59f7a844aee29b291872aed1a499d643 100644 (file)
@@ -495,12 +495,10 @@ static int bu21013_probe(struct i2c_client *client)
 
        /* Named "CS" on the chip, DT binding is "reset" */
        ts->cs_gpiod = devm_gpiod_get(&client->dev, "reset", GPIOD_OUT_HIGH);
-       error = PTR_ERR_OR_ZERO(ts->cs_gpiod);
-       if (error) {
-               if (error != -EPROBE_DEFER)
-                       dev_err(&client->dev, "failed to get CS GPIO\n");
-               return error;
-       }
+       if (IS_ERR(ts->cs_gpiod))
+               return dev_err_probe(&client->dev, PTR_ERR(ts->cs_gpiod),
+                                    "failed to get CS GPIO\n");
+
        gpiod_set_consumer_name(ts->cs_gpiod, "BU21013 CS");
 
        error = devm_add_action_or_reset(&client->dev,
@@ -515,11 +513,8 @@ static int bu21013_probe(struct i2c_client *client)
        ts->int_gpiod = devm_gpiod_get_optional(&client->dev,
                                                "touch", GPIOD_IN);
        error = PTR_ERR_OR_ZERO(ts->int_gpiod);
-       if (error) {
-               if (error != -EPROBE_DEFER)
-                       dev_err(&client->dev, "failed to get INT GPIO\n");
-               return error;
-       }
+       if (error)
+               return dev_err_probe(&client->dev, error, "failed to get INT GPIO\n");
 
        if (ts->int_gpiod)
                gpiod_set_consumer_name(ts->int_gpiod, "BU21013 INT");