Input: bcm-keypad - Simplify with dev_err_probe()
Subsystems (9)
PATCH 1/24 Input: bcm-keypad - 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.
--- drivers/input/keyboard/bcm-keypad.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/input/keyboard/bcm-keypad.c +3 -5
@@ -379,11 +379,9 @@ static int bcm_kp_probe(struct platform_device *pdev) kp->clk =devm_clk_get (&pdev->dev,"peri_clk" );if (IS_ERR (kp->clk)) { error =PTR_ERR (kp->clk); -if (error != -ENOENT ) { -if (error != -EPROBE_DEFER ) -dev_err (&pdev->dev,"Failed to get clock\n" ); -return error; - } +if (error != -ENOENT ) +return dev_err_probe (&pdev->dev, error,"Failed to get clock\n" ); +dev_dbg (&pdev->dev,"No clock specified. Assuming it's enabled\n" ); kp->clk =NULL ;
Signature · 1 line
2.17.1
PATCH 2/24 Input: gpio_keys - 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.
--- drivers/input/keyboard/gpio_keys.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/input/keyboard/gpio_keys.c +1 -4
@@ -505,10 +505,7 @@ static int gpio_keys_setup_key(struct platform_device *pdev,*/ bdata->gpiod =NULL ; }else { -if (error != -EPROBE_DEFER ) -dev_err (dev,"failed to get gpio: %d\n" , - error); -return error; +return dev_err_probe (dev, error,"failed to get gpio\n" ); } } }else if (gpio_is_valid (button->gpio)) {
Signature · 1 line
2.17.1
PATCH 3/24 Input: gpio_keys_polled - Simplify with dev_err_probe()
In reply to Krzysztof KozlowskiCommon pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and also it prints the error value.
--- drivers/input/keyboard/gpio_keys_polled.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/input/keyboard/gpio_keys_polled.c +2 -6
@@ -299,13 +299,9 @@ static int gpio_keys_polled_probe(struct platform_device *pdev)NULL ,GPIOD_IN , button->desc);if (IS_ERR (bdata->gpiod)) { - error =PTR_ERR (bdata->gpiod); -if (error != -EPROBE_DEFER ) -dev_err (dev, -"failed to get gpio: %d\n" , - error);fwnode_handle_put (child); -return error; +return dev_err_probe (dev,PTR_ERR (bdata->gpiod), +"failed to get gpio\n" ); } }else if (gpio_is_valid (button->gpio)) {/*
Signature · 1 line
2.17.1
PATCH 4/24 Input: gpio-vibra - Simplify with dev_err_probe()
In reply to Krzysztof KozlowskiCommon pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and also it prints the error value.
--- drivers/input/misc/gpio-vibra.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-)
drivers/input/misc/gpio-vibra.c +4 -12
@@ -114,21 +114,13 @@ static int gpio_vibrator_probe(struct platform_device *pdev) vibrator->vcc =devm_regulator_get (&pdev->dev,"vcc" ); err =PTR_ERR_OR_ZERO (vibrator->vcc); -if (err) { -if (err != -EPROBE_DEFER ) -dev_err (&pdev->dev,"Failed to request regulator: %d\n" , - err); -return err; - } +if (err) +return dev_err_probe (&pdev->dev, err,"Failed to request regulator\n" ); vibrator->gpio =devm_gpiod_get (&pdev->dev,"enable" ,GPIOD_OUT_LOW ); err =PTR_ERR_OR_ZERO (vibrator->gpio); -if (err) { -if (err != -EPROBE_DEFER ) -dev_err (&pdev->dev,"Failed to request main gpio: %d\n" , - err); -return err; - } +if (err) +return dev_err_probe (&pdev->dev, err,"Failed to request main gpio\n" );INIT_WORK (&vibrator->play_work, gpio_vibrator_play_work);
Signature · 1 line
2.17.1
PATCH 5/24 Input: pwm-beeper - Simplify with dev_err_probe()
In reply to Krzysztof KozlowskiCommon pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and also it prints the error value.
--- drivers/input/misc/pwm-beeper.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-)
drivers/input/misc/pwm-beeper.c +5 -14
@@ -132,13 +132,8 @@ static int pwm_beeper_probe(struct platform_device *pdev)return -ENOMEM ; beeper->pwm =devm_pwm_get (dev,NULL ); -if (IS_ERR (beeper->pwm)) { - error =PTR_ERR (beeper->pwm); -if (error != -EPROBE_DEFER ) -dev_err (dev,"Failed to request PWM device: %d\n" , - error); -return error; - } +if (IS_ERR (beeper->pwm)) +return dev_err_probe (dev,PTR_ERR (beeper->pwm),"Failed to request PWM device\n" );/* Sync up PWM state and ensure it is off. */ pwm_init_state (beeper->pwm, &state);
@@ -151,13 +146,9 @@ static int pwm_beeper_probe(struct platform_device *pdev) } beeper->amplifier =devm_regulator_get (dev,"amp" ); -if (IS_ERR (beeper->amplifier)) { - error =PTR_ERR (beeper->amplifier); -if (error != -EPROBE_DEFER ) -dev_err (dev,"Failed to get 'amp' regulator: %d\n" , - error); -return error; - } +if (IS_ERR (beeper->amplifier)) +return dev_err_probe (dev,PTR_ERR (beeper->amplifier), +"Failed to get 'amp' regulator\n" );INIT_WORK (&beeper->work, pwm_beeper_work);
Signature · 1 line
2.17.1
PATCH 6/24 Input: pwm-vibra - Simplify with dev_err_probe()
In reply to Krzysztof KozlowskiCommon pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and also it prints the error value.
--- drivers/input/misc/pwm-vibra.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-)
drivers/input/misc/pwm-vibra.c +4 -12
@@ -135,21 +135,13 @@ static int pwm_vibrator_probe(struct platform_device *pdev) vibrator->vcc =devm_regulator_get (&pdev->dev,"vcc" ); err =PTR_ERR_OR_ZERO (vibrator->vcc); -if (err) { -if (err != -EPROBE_DEFER ) -dev_err (&pdev->dev,"Failed to request regulator: %d" , - err); -return err; - } +if (err) +return dev_err_probe (&pdev->dev, err,"Failed to request regulator\n" ); vibrator->pwm =devm_pwm_get (&pdev->dev,"enable" ); err =PTR_ERR_OR_ZERO (vibrator->pwm); -if (err) { -if (err != -EPROBE_DEFER ) -dev_err (&pdev->dev,"Failed to request main pwm: %d" , - err); -return err; - } +if (err) +return dev_err_probe (&pdev->dev, err,"Failed to request main pwm\n" );INIT_WORK (&vibrator->play_work, pwm_vibrator_play_work);
Signature · 1 line
2.17.1
PATCH 7/24 Input: rotary_encoder - Simplify with dev_err_probe()
In reply to Krzysztof KozlowskiCommon pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and also it prints the error value.
--- drivers/input/misc/rotary_encoder.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/input/misc/rotary_encoder.c +2 -6
@@ -236,12 +236,8 @@ static int rotary_encoder_probe(struct platform_device *pdev)device_property_read_bool (dev,"rotary-encoder,relative-axis" ); encoder->gpios =devm_gpiod_get_array (dev,NULL ,GPIOD_IN ); -if (IS_ERR (encoder->gpios)) { - err =PTR_ERR (encoder->gpios); -if (err != -EPROBE_DEFER ) -dev_err (dev,"unable to get gpios: %d\n" , err); -return err; - } +if (IS_ERR (encoder->gpios)) +return dev_err_probe (dev,PTR_ERR (encoder->gpios),"unable to get gpios\n" );if (encoder->gpios->ndescs <2 ) {dev_err (dev,"not enough gpios found\n" );return -EINVAL ;
Signature · 1 line
2.17.1
PATCH 8/24 Input: elan_i2c - Simplify with dev_err_probe()
In reply to Krzysztof KozlowskiCommon pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and also it prints the error value.
--- drivers/input/mouse/elan_i2c_core.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/input/mouse/elan_i2c_core.c +2 -7
@@ -1229,13 +1229,8 @@ static int elan_probe(struct i2c_client *client,mutex_init (&data->sysfs_mutex); data->vcc =devm_regulator_get (dev,"vcc" ); -if (IS_ERR (data->vcc)) { - error =PTR_ERR (data->vcc); -if (error != -EPROBE_DEFER ) -dev_err (dev,"Failed to get 'vcc' regulator: %d\n" , - error); -return error; - } +if (IS_ERR (data->vcc)) +return dev_err_probe (dev,PTR_ERR (data->vcc),"Failed to get 'vcc' regulator\n" ); error =regulator_enable (data->vcc);if (error) {
Signature · 1 line
2.17.1
PATCH 9/24 Input: bu21013_ts - Simplify with dev_err_probe()
In reply to Krzysztof KozlowskiCommon pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and also it prints the error value.
--- drivers/input/touchscreen/bu21013_ts.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-)
drivers/input/touchscreen/bu21013_ts.c +5 -10
@@ -497,11 +497,9 @@ 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 (error) +return dev_err_probe (&client->dev, error,"failed to get CS GPIO\n" ); +gpiod_set_consumer_name (ts->cs_gpiod,"BU21013 CS" ); error = devm_add_action_or_reset(&client->dev,
@@ -516,11 +514,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" );
Signature · 1 line
2.17.1
PATCH 10/24 Input: bu21029_ts - Simplify with dev_err_probe()
In reply to Krzysztof KozlowskiCommon pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and also it prints the error value.
--- drivers/input/touchscreen/bu21029_ts.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-)
drivers/input/touchscreen/bu21029_ts.c +6 -14
@@ -360,23 +360,15 @@ static int bu21029_probe(struct i2c_client *client, } bu21029->vdd =devm_regulator_get (&client->dev,"vdd" ); -if (IS_ERR (bu21029->vdd)) { - error =PTR_ERR (bu21029->vdd); -if (error != -EPROBE_DEFER ) -dev_err (&client->dev, -"failed to acquire 'vdd' supply: %d\n" , error); -return error; - } +if (IS_ERR (bu21029->vdd)) +return dev_err_probe (&client->dev,PTR_ERR (bu21029->vdd), +"failed to acquire 'vdd' supply\n" ); bu21029->reset_gpios =devm_gpiod_get_optional (&client->dev,"reset" ,GPIOD_OUT_HIGH ); -if (IS_ERR (bu21029->reset_gpios)) { - error =PTR_ERR (bu21029->reset_gpios); -if (error != -EPROBE_DEFER ) -dev_err (&client->dev, -"failed to acquire 'reset' gpio: %d\n" , error); -return error; - } +if (IS_ERR (bu21029->reset_gpios)) +return dev_err_probe (&client->dev,PTR_ERR (bu21029->reset_gpios), +"failed to acquire 'reset' gpio\n" ); in_dev =devm_input_allocate_device (&client->dev);if (!in_dev) {
Signature · 1 line
2.17.1
PATCH 11/24 Input: chipone_icn8318 - Simplify with dev_err_probe()
In reply to Krzysztof KozlowskiCommon pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and also it prints the error value.
--- drivers/input/touchscreen/chipone_icn8318.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/input/touchscreen/chipone_icn8318.c +2 -6
@@ -194,12 +194,8 @@ static int icn8318_probe(struct i2c_client *client,return -ENOMEM ; data->wake_gpio =devm_gpiod_get (dev,"wake" ,GPIOD_OUT_LOW ); -if (IS_ERR (data->wake_gpio)) { - error =PTR_ERR (data->wake_gpio); -if (error != -EPROBE_DEFER ) -dev_err (dev,"Error getting wake gpio: %d\n" , error); -return error; - } +if (IS_ERR (data->wake_gpio)) +return dev_err_probe (dev,PTR_ERR (data->wake_gpio),"Error getting wake gpio\n" ); input =devm_input_allocate_device (dev);if (!input)
Signature · 1 line
2.17.1
PATCH 12/24 Input: cy8ctma140 - Simplify with dev_err_probe()
In reply to Krzysztof KozlowskiCommon pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and also it prints the error value.
--- drivers/input/touchscreen/cy8ctma140.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/input/touchscreen/cy8ctma140.c +2 -6
@@ -259,12 +259,8 @@ static int cy8ctma140_probe(struct i2c_client *client, ts->regulators[1 ].supply ="vdd" ; error =devm_regulator_bulk_get (dev,ARRAY_SIZE (ts->regulators), ts->regulators); -if (error) { -if (error != -EPROBE_DEFER ) -dev_err (dev,"Failed to get regulators %d\n" , - error); -return error; - } +if (error) +return dev_err_probe (dev, error,"Failed to get regulators\n" ); error =cy8ctma140_power_up (ts);if (error)
Signature · 1 line
2.17.1
PATCH 13/24 Input: edf-ft5x06 - Simplify with dev_err_probe()
In reply to Krzysztof KozlowskiCommon pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and also it prints the error value.
--- drivers/input/touchscreen/edt-ft5x06.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
drivers/input/touchscreen/edt-ft5x06.c +3 -7
@@ -1098,13 +1098,9 @@ static int edt_ft5x06_ts_probe(struct i2c_client *client, tsdata->max_support_points = chip_data->max_support_points; tsdata->vcc =devm_regulator_get (&client->dev,"vcc" ); -if (IS_ERR (tsdata->vcc)) { - error =PTR_ERR (tsdata->vcc); -if (error != -EPROBE_DEFER ) -dev_err (&client->dev, -"failed to request regulator: %d\n" , error); -return error; - } +if (IS_ERR (tsdata->vcc)) +return dev_err_probe (&client->dev,PTR_ERR (tsdata->vcc), +"failed to request regulator\n" ); error =regulator_enable (tsdata->vcc);if (error <0 ) {
Signature · 1 line
2.17.1
PATCH 14/24 Input: ektf2127 - Simplify with dev_err_probe()
In reply to Krzysztof KozlowskiCommon pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and also it prints the error value.
--- drivers/input/touchscreen/ektf2127.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/input/touchscreen/ektf2127.c +2 -6
@@ -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)
Signature · 1 line
2.17.1
PATCH 15/24 Input: elants_i2c - Simplify with dev_err_probe()
In reply to Krzysztof KozlowskiCommon pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and also it prints the error value.
--- drivers/input/touchscreen/elants_i2c.c | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-)
drivers/input/touchscreen/elants_i2c.c +6 -16
@@ -1245,24 +1245,14 @@ static int elants_i2c_probe(struct i2c_client *client,i2c_set_clientdata (client, ts); ts->vcc33 =devm_regulator_get (&client->dev,"vcc33" ); -if (IS_ERR (ts->vcc33)) { - error =PTR_ERR (ts->vcc33); -if (error != -EPROBE_DEFER ) -dev_err (&client->dev, -"Failed to get 'vcc33' regulator: %d\n" , - error); -return error; - } +if (IS_ERR (ts->vcc33)) +return dev_err_probe (&client->dev,PTR_ERR (ts->vcc33), +"Failed to get 'vcc33' regulator\n" ); ts->vccio =devm_regulator_get (&client->dev,"vccio" ); -if (IS_ERR (ts->vccio)) { - error =PTR_ERR (ts->vccio); -if (error != -EPROBE_DEFER ) -dev_err (&client->dev, -"Failed to get 'vccio' regulator: %d\n" , - error); -return error; - } +if (IS_ERR (ts->vccio)) +return dev_err_probe (&client->dev,PTR_ERR (ts->vccio), +"Failed to get 'vccio' regulator\n" ); ts->reset_gpio =devm_gpiod_get (&client->dev,"reset" ,GPIOD_OUT_LOW );if (IS_ERR (ts->reset_gpio)) {
Signature · 1 line
2.17.1
PATCH 16/24 Input: goodix - Simplify with dev_err_probe()
In reply to Krzysztof KozlowskiCommon pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and also it prints the error value.
--- drivers/input/touchscreen/goodix.c | 40 ++++++++---------------------- 1 file changed, 11 insertions(+), 29 deletions(-)
drivers/input/touchscreen/goodix.c +11 -29
@@ -864,7 +864,6 @@ static int goodix_add_acpi_gpio_mappings(struct goodix_ts_data *ts)*/ static int goodix_get_gpio_config (struct goodix_ts_data *ts) { -int error;struct device *dev;struct gpio_desc *gpiod;bool added_acpi_mappings = false;
@@ -874,33 +873,20 @@ static int goodix_get_gpio_config(struct goodix_ts_data *ts) dev = &ts->client->dev; ts->avdd28 =devm_regulator_get (dev,"AVDD28" ); -if (IS_ERR (ts->avdd28)) { - error =PTR_ERR (ts->avdd28); -if (error != -EPROBE_DEFER ) -dev_err (dev, -"Failed to get AVDD28 regulator: %d\n" , error); -return error; - } +if (IS_ERR (ts->avdd28)) +return dev_err_probe (dev,PTR_ERR (ts->avdd28),"Failed to get AVDD28 regulator\n" ); ts->vddio =devm_regulator_get (dev,"VDDIO" ); -if (IS_ERR (ts->vddio)) { - error =PTR_ERR (ts->vddio); -if (error != -EPROBE_DEFER ) -dev_err (dev, -"Failed to get VDDIO regulator: %d\n" , error); -return error; - } +if (IS_ERR (ts->vddio)) +return dev_err_probe (dev,PTR_ERR (ts->vddio),"Failed to get VDDIO regulator\n" ); retry_get_irq_gpio:/* Get the interrupt GPIO pin number */ gpiod =devm_gpiod_get_optional (dev,GOODIX_GPIO_INT_NAME ,GPIOD_IN ); -if (IS_ERR (gpiod)) { - error =PTR_ERR (gpiod); -if (error != -EPROBE_DEFER ) -dev_dbg (dev,"Failed to get %s GPIO: %d\n" , -GOODIX_GPIO_INT_NAME , error); -return error; - } +if (IS_ERR (gpiod)) +return dev_err_probe (dev,PTR_ERR (gpiod),"Failed to get %s GPIO\n" , +GOODIX_GPIO_INT_NAME ); +if (!gpiod &&has_acpi_companion (dev) && !added_acpi_mappings) { added_acpi_mappings = true;if (goodix_add_acpi_gpio_mappings (ts) ==0 )
@@ -911,13 +897,9 @@ static int goodix_get_gpio_config(struct goodix_ts_data *ts)/* Get the reset line GPIO pin number */ gpiod =devm_gpiod_get_optional (dev,GOODIX_GPIO_RST_NAME ,GPIOD_IN ); -if (IS_ERR (gpiod)) { - error =PTR_ERR (gpiod); -if (error != -EPROBE_DEFER ) -dev_dbg (dev,"Failed to get %s GPIO: %d\n" , -GOODIX_GPIO_RST_NAME , error); -return error; - } +if (IS_ERR (gpiod)) +return dev_err_probe (dev,PTR_ERR (gpiod),"Failed to get %s GPIO\n" , +GOODIX_GPIO_RST_NAME ); ts->gpiod_rst = gpiod;
Signature · 1 line
2.17.1
PATCH 17/24 Input: melfas_mip4 - Simplify with dev_err_probe()
In reply to Krzysztof KozlowskiCommon pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and also it prints the error value.
--- drivers/input/touchscreen/melfas_mip4.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/input/touchscreen/melfas_mip4.c +2 -7
@@ -1451,13 +1451,8 @@ static int mip4_probe(struct i2c_client *client, const struct i2c_device_id *id) ts->gpio_ce =devm_gpiod_get_optional (&client->dev,"ce" ,GPIOD_OUT_LOW ); -if (IS_ERR (ts->gpio_ce)) { - error =PTR_ERR (ts->gpio_ce); -if (error !=EPROBE_DEFER ) -dev_err (&client->dev, -"Failed to get gpio: %d\n" , error); -return error; - } +if (IS_ERR (ts->gpio_ce)) +return dev_err_probe (&client->dev,PTR_ERR (ts->gpio_ce),"Failed to get gpio\n" ); error =mip4_power_on (ts);if (error)
Signature · 1 line
2.17.1
PATCH 18/24 Input: pixcir_i2c_ts - Simplify with dev_err_probe()
In reply to Krzysztof KozlowskiCommon pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and also it prints the error value.
--- drivers/input/touchscreen/pixcir_i2c_ts.c | 38 +++++++---------------- 1 file changed, 12 insertions(+), 26 deletions(-)
drivers/input/touchscreen/pixcir_i2c_ts.c +12 -26
@@ -515,41 +515,27 @@ static int pixcir_i2c_ts_probe(struct i2c_client *client,input_set_drvdata (input, tsdata); tsdata->gpio_attb =devm_gpiod_get (dev,"attb" ,GPIOD_IN ); -if (IS_ERR (tsdata->gpio_attb)) { - error =PTR_ERR (tsdata->gpio_attb); -if (error != -EPROBE_DEFER ) -dev_err (dev,"Failed to request ATTB gpio: %d\n" , - error); -return error; - } +if (IS_ERR (tsdata->gpio_attb)) +return dev_err_probe (dev,PTR_ERR (tsdata->gpio_attb), +"Failed to request ATTB gpio\n" ); tsdata->gpio_reset =devm_gpiod_get_optional (dev,"reset" ,GPIOD_OUT_LOW ); -if (IS_ERR (tsdata->gpio_reset)) { - error =PTR_ERR (tsdata->gpio_reset); -if (error != -EPROBE_DEFER ) -dev_err (dev,"Failed to request RESET gpio: %d\n" , - error); -return error; - } +if (IS_ERR (tsdata->gpio_reset)) +return dev_err_probe (dev,PTR_ERR (tsdata->gpio_reset), +"Failed to request RESET gpio\n" ); tsdata->gpio_wake =devm_gpiod_get_optional (dev,"wake" ,GPIOD_OUT_HIGH ); -if (IS_ERR (tsdata->gpio_wake)) { - error =PTR_ERR (tsdata->gpio_wake); -if (error != -EPROBE_DEFER ) -dev_err (dev,"Failed to get wake gpio: %d\n" , error); -return error; - } +if (IS_ERR (tsdata->gpio_wake)) +return dev_err_probe (dev,PTR_ERR (tsdata->gpio_wake), +"Failed to get wake gpio\n" ); tsdata->gpio_enable =devm_gpiod_get_optional (dev,"enable" ,GPIOD_OUT_HIGH ); -if (IS_ERR (tsdata->gpio_enable)) { - error =PTR_ERR (tsdata->gpio_enable); -if (error != -EPROBE_DEFER ) -dev_err (dev,"Failed to get enable gpio: %d\n" , error); -return error; - } +if (IS_ERR (tsdata->gpio_enable)) +return dev_err_probe (dev,PTR_ERR (tsdata->gpio_enable), +"Failed to get enable gpio\n" );if (tsdata->gpio_enable)msleep (100 );
Signature · 1 line
2.17.1
PATCH 19/24 Input: raydium_i2c_ts - Simplify with dev_err_probe()
In reply to Krzysztof KozlowskiCommon pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and also it prints the error value.
--- drivers/input/touchscreen/raydium_i2c_ts.c | 30 +++++++--------------- 1 file changed, 9 insertions(+), 21 deletions(-)
drivers/input/touchscreen/raydium_i2c_ts.c +9 -21
@@ -1015,32 +1015,20 @@ static int raydium_i2c_probe(struct i2c_client *client,i2c_set_clientdata (client, ts); ts->avdd =devm_regulator_get (&client->dev,"avdd" ); -if (IS_ERR (ts->avdd)) { - error =PTR_ERR (ts->avdd); -if (error != -EPROBE_DEFER ) -dev_err (&client->dev, -"Failed to get 'avdd' regulator: %d\n" , error); -return error; - } +if (IS_ERR (ts->avdd)) +return dev_err_probe (&client->dev,PTR_ERR (ts->avdd), +"Failed to get 'avdd' regulator\n" ); ts->vccio =devm_regulator_get (&client->dev,"vccio" ); -if (IS_ERR (ts->vccio)) { - error =PTR_ERR (ts->vccio); -if (error != -EPROBE_DEFER ) -dev_err (&client->dev, -"Failed to get 'vccio' regulator: %d\n" , error); -return error; - } +if (IS_ERR (ts->vccio)) +return dev_err_probe (&client->dev,PTR_ERR (ts->vccio), +"Failed to get 'vccio' regulator\n" ); ts->reset_gpio =devm_gpiod_get_optional (&client->dev,"reset" ,GPIOD_OUT_LOW ); -if (IS_ERR (ts->reset_gpio)) { - error =PTR_ERR (ts->reset_gpio); -if (error != -EPROBE_DEFER ) -dev_err (&client->dev, -"failed to get reset gpio: %d\n" , error); -return error; - } +if (IS_ERR (ts->reset_gpio)) +return dev_err_probe (&client->dev,PTR_ERR (ts->reset_gpio), +"Failed to get reset gpio\n" ); error =raydium_i2c_power_on (ts);if (error)
Signature · 1 line
2.17.1
PATCH 20/24 Input: resistive-adc-touch - Simplify with dev_err_probe()
In reply to Krzysztof KozlowskiCommon pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and also it prints the error value.
--- drivers/input/touchscreen/resistive-adc-touch.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/input/touchscreen/resistive-adc-touch.c +2 -6
@@ -108,12 +108,8 @@ static int grts_probe(struct platform_device *pdev)/* get the channels from IIO device */ st->iio_chans =devm_iio_channel_get_all (dev); -if (IS_ERR (st->iio_chans)) { - error =PTR_ERR (st->iio_chans); -if (error != -EPROBE_DEFER ) -dev_err (dev,"can't get iio channels.\n" ); -return error; - } +if (IS_ERR (st->iio_chans)) +return dev_err_probe (dev,PTR_ERR (st->iio_chans),"can't get iio channels\n" ); chan = &st->iio_chans[0 ]; st->pressure = false;
Signature · 1 line
2.17.1
PATCH 21/24 Input: silead - Simplify with dev_err_probe()
In reply to Krzysztof KozlowskiCommon pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and also it prints the error value.
--- drivers/input/touchscreen/silead.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/input/touchscreen/silead.c +3 -5
@@ -512,11 +512,9 @@ static int silead_ts_probe(struct i2c_client *client,/* Power GPIO pin */ data->gpio_power =devm_gpiod_get_optional (dev,"power" ,GPIOD_OUT_LOW ); -if (IS_ERR (data->gpio_power)) { -if (PTR_ERR (data->gpio_power) != -EPROBE_DEFER ) -dev_err (dev,"Shutdown GPIO request failed\n" ); -return PTR_ERR (data->gpio_power); - } +if (IS_ERR (data->gpio_power)) +return dev_err_probe (dev,PTR_ERR (data->gpio_power), +"Shutdown GPIO request failed\n" ); error =silead_ts_setup (client);if (error)
Signature · 1 line
2.17.1
PATCH 22/24 Input: sis_i2c - Simplify with dev_err_probe()
In reply to Krzysztof KozlowskiCommon pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and also it prints the error value.
--- drivers/input/touchscreen/sis_i2c.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-)
drivers/input/touchscreen/sis_i2c.c +6 -14
@@ -311,23 +311,15 @@ static int sis_ts_probe(struct i2c_client *client, ts->attn_gpio =devm_gpiod_get_optional (&client->dev,"attn" ,GPIOD_IN ); -if (IS_ERR (ts->attn_gpio)) { - error =PTR_ERR (ts->attn_gpio); -if (error != -EPROBE_DEFER ) -dev_err (&client->dev, -"Failed to get attention GPIO: %d\n" , error); -return error; - } +if (IS_ERR (ts->attn_gpio)) +return dev_err_probe (&client->dev,PTR_ERR (ts->attn_gpio), +"Failed to get attention GPIO\n" ); ts->reset_gpio =devm_gpiod_get_optional (&client->dev,"reset" ,GPIOD_OUT_LOW ); -if (IS_ERR (ts->reset_gpio)) { - error =PTR_ERR (ts->reset_gpio); -if (error != -EPROBE_DEFER ) -dev_err (&client->dev, -"Failed to get reset GPIO: %d\n" , error); -return error; - } +if (IS_ERR (ts->reset_gpio)) +return dev_err_probe (&client->dev,PTR_ERR (ts->reset_gpio), +"Failed to get reset GPIO\n" );sis_ts_reset (ts);
Signature · 1 line
2.17.1
PATCH 23/24 Input: surface3_spi - Simplify with dev_err_probe()
In reply to Krzysztof KozlowskiCommon pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and also it prints the error value.
--- drivers/input/touchscreen/surface3_spi.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-)
drivers/input/touchscreen/surface3_spi.c +3 -10
@@ -223,7 +223,6 @@ static void surface3_spi_power(struct surface3_ts_data *data, bool on)*/ static int surface3_spi_get_gpio_config (struct surface3_ts_data *data) { -int error;struct device *dev;struct gpio_desc *gpiod;int i;
@@ -233,15 +232,9 @@ static int surface3_spi_get_gpio_config(struct surface3_ts_data *data)/* Get the reset lines GPIO pin number */ for (i =0 ; i <2 ; i++) { gpiod =devm_gpiod_get_index (dev,NULL , i,GPIOD_OUT_LOW ); -if (IS_ERR (gpiod)) { - error =PTR_ERR (gpiod); -if (error != -EPROBE_DEFER ) -dev_err (dev, -"Failed to get power GPIO %d: %d\n" , - i, - error); -return error; - } +if (IS_ERR (gpiod)) +return dev_err_probe (dev,PTR_ERR (gpiod), +"Failed to get power GPIO %d\n" , i); data->gpiod_rst[i] = gpiod; }
Signature · 1 line
2.17.1
PATCH 24/24 Input: sx8643 - Simplify with dev_err_probe()
In reply to Krzysztof KozlowskiCommon pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and also it prints the error value.
--- drivers/input/touchscreen/sx8654.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
drivers/input/touchscreen/sx8654.c +3 -7
@@ -323,13 +323,9 @@ static int sx8654_probe(struct i2c_client *client, sx8654->gpio_reset =devm_gpiod_get_optional (&client->dev,"reset" ,GPIOD_OUT_HIGH ); -if (IS_ERR (sx8654->gpio_reset)) { - error =PTR_ERR (sx8654->gpio_reset); -if (error != -EPROBE_DEFER ) -dev_err (&client->dev,"unable to get reset-gpio: %d\n" , - error); -return error; - } +if (IS_ERR (sx8654->gpio_reset)) +return dev_err_probe (&client->dev,PTR_ERR (sx8654->gpio_reset), +"unable to get reset-gpio\n" );dev_dbg (&client->dev,"got GPIO reset pin\n" ); sx8654->data =device_get_match_data (&client->dev);
Signature · 1 line
2.17.1
Quoted 8 lines · Krzysztof Kozlowski
Common pattern of handling deferred probe can be simplified with
dev_err_probe(). Less code and also it prints the error value.+++
b/drivers/input/keyboard/bcm-keypad.cdrivers/input/keyboard/bcm-keypad.c +0
-0@@ -379,11 +379,9 @@ static int bcm_kp_probe(struct platform_device *pdev) kp->clk =devm_clk_get (&pdev->dev,"peri_clk" );if (IS_ERR (kp->clk)) { error =PTR_ERR (kp->clk);
drivers/input/keyboard/bcm-keypad.c static int bcm_kp_probe(struct platform_device *pdev) · line 386
Quoted 10 lines
drivers/input/keyboard/bcm-keypad.c +3
-5-if (error != -ENOENT ) { -if (error != -EPROBE_DEFER ) -dev_err (&pdev->dev,"Failed to get clock\n" ); -return error; - } +if (error != -ENOENT ) +return dev_err_probe (&pdev->dev, error,"Failed to get clock\n" ); +dev_dbg (&pdev->dev,"No clock specified. Assuming it's enabled\n" );
Shouldn't be this rather switch to devm_clk_get_optional() + dev_err_probe?
Quoted 1 line
drivers/input/keyboard/bcm-keypad.c +0
-0kp->clk =NULL ;
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH 02/24] Input: gpio_keys - Simplify with dev_err_probe()
In reply to Krzysztof Kozlowskidrivers/input/keyboard/gpio_keys.c static int gpio_keys_setup_key(struct platform_device *pdev, · line 506
Quoted 8 lines · Krzysztof Kozlowski
Common pattern of handling deferred probe can be simplified with
dev_err_probe(). Less code and also it prints the error value.drivers/input/keyboard/gpio_keys.c +0
-0@@ -505,10 +505,7 @@ static int gpio_keys_setup_key(struct platform_device *pdev,*/ bdata->gpiod =NULL ;
gpiod_get_optional()?
Do not see much context though (but please double check your series for these kind of things).
Quoted 9 lines
drivers/input/keyboard/gpio_keys.c +1
-4}else { -if (error != -EPROBE_DEFER ) -dev_err (dev,"failed to get gpio: %d\n" , - error); -return error; +return dev_err_probe (dev, error,"failed to get gpio\n" ); } } }else if (gpio_is_valid (button->gpio)) {
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 13 lines · Andy Shevchenko
Quoted 12 lines · Krzysztof Kozlowski
Common pattern of handling deferred probe can be simplified with
dev_err_probe(). Less code and also it prints the error value.+++
b/drivers/input/keyboard/bcm-keypad.cdrivers/input/keyboard/bcm-keypad.c +0
-4@@ -379,11 +379,9 @@ static int bcm_kp_probe(struct platform_device *pdev) kp->clk =devm_clk_get (&pdev->dev,"peri_clk" );if (IS_ERR (kp->clk)) { error =PTR_ERR (kp->clk); -if (error != -ENOENT ) { -if (error != -EPROBE_DEFER ) -dev_err (&pdev->dev,"Failed to get clock\n" ); -return error;
Quoted 8 lines
drivers/input/keyboard/bcm-keypad.c static int bcm_kp_probe(struct platform_device *pdev) · line 386
Quoted 6 lines
drivers/input/keyboard/bcm-keypad.c +3
-1- } +if (error != -ENOENT ) +return dev_err_probe (&pdev->dev, error,"Failed to get clock\n" ); +dev_dbg (&pdev->dev,"No clock specified. Assuming it's enabled\n" );Shouldn't be this rather switch to
devm_clk_get_optional()+dev_err_probe?
Indeed, it could be simplified even more. I'll send v2.
Best regards,
Krzysztof
Re: [PATCH 02/24] Input: gpio_keys - Simplify with dev_err_probe()
In reply to Andy ShevchenkoQuoted 4 lines · Andy Shevchenko
Quoted 2 lines · Krzysztof Kozlowski
Common pattern of handling deferred probe can be simplified with
dev_err_probe(). Less code and also it prints the error value.
Quoted 9 lines
drivers/input/keyboard/gpio_keys.c static int gpio_keys_setup_key(struct platform_device *pdev, · line 506
Quoted 5 lines
drivers/input/keyboard/gpio_keys.c +0
-0@@ -505,10 +505,7 @@ static int gpio_keys_setup_key(struct platform_device *pdev,*/ bdata->gpiod =NULL ;
gpiod_get_optional()?
Do not see much context though (but please double check your series for these kind of things).
It would fit except it is devm_fwnode_gpiod_get() which does not have optional yet.
I can add it although the scope of the patch grows from simple defer-path-simplification.
Thanks for the feedback.
Best regards,
Krzysztof
Re: [PATCH 02/24] Input: gpio_keys - Simplify with dev_err_probe()
Quoted 15 lines · Krzysztof Kozlowski
Quoted 4 lines · Andy Shevchenko
Quoted 2 lines · Krzysztof Kozlowski
Common pattern of handling deferred probe can be simplified with
dev_err_probe(). Less code and also it prints the error value.Quoted 9 lines
drivers/input/keyboard/gpio_keys.c static int gpio_keys_setup_key(struct platform_device *pdev, · line 506
Quoted 5 lines
drivers/input/keyboard/gpio_keys.c +0
-0@@ -505,10 +505,7 @@ static int gpio_keys_setup_key(struct platform_device *pdev,*/ bdata->gpiod =NULL ;
gpiod_get_optional()?
Do not see much context though (but please double check your series for these kind of things).
Quoted 5 lines
It would fit except it is
devm_fwnode_gpiod_get()which does not have optional yet.I can add it although the scope of the patch grows from simple defer-path-simplification.
No need. My comment only about existing API per individual cases. SO, here it's fine then.
Quoted 1 line
Thanks for the feedback.
You're welcome!
Signature · 2 lines
With Best Regards, Andy Shevchenko
Hi,
As someone who has added the if (error != -EPROBE_DEFER) dev_err() pattern in way too many places myself, I'm quite happy to see this new (I presume?) helper and this nice cleanup series.
The entire series looks good to me, and you can add my:
To the entire series.
Regards,
Hans
Quoted 28 lines · Krzysztof Kozlowski
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 <[email protected]>--- drivers/input/keyboard/bcm-keypad.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)drivers/input/keyboard/bcm-keypad.c +3
-5@@ -379,11 +379,9 @@ static int bcm_kp_probe(struct platform_device *pdev) kp->clk =devm_clk_get (&pdev->dev,"peri_clk" );if (IS_ERR (kp->clk)) { error =PTR_ERR (kp->clk); -if (error != -ENOENT ) { -if (error != -EPROBE_DEFER ) -dev_err (&pdev->dev,"Failed to get clock\n" ); -return error; - } +if (error != -ENOENT ) +return dev_err_probe (&pdev->dev, error,"Failed to get clock\n" ); +dev_dbg (&pdev->dev,"No clock specified. Assuming it's enabled\n" ); kp->clk =NULL ;
Re: [PATCH 02/24] Input: gpio_keys - Simplify with dev_err_probe()
In reply to Andy ShevchenkoQuoted 16 lines · Andy Shevchenko
Quoted 15 lines · Krzysztof Kozlowski
Quoted 13 lines · Andy Shevchenko
drivers/input/keyboard/gpio_keys.c static int gpio_keys_setup_key(struct platform_device *pdev, · line 506
Quoted 8 lines · Krzysztof Kozlowski
Common pattern of handling deferred probe can be simplified with
dev_err_probe(). Less code and also it prints the error value.drivers/input/keyboard/gpio_keys.c +0
-0@@ -505,10 +505,7 @@ static int gpio_keys_setup_key(struct platform_device *pdev,*/ bdata->gpiod =NULL ;
gpiod_get_optional()?
Do not see much context though (but please double check your series for these kind of things).
Quoted 8 lines
Quoted 5 lines
It would fit except it is
devm_fwnode_gpiod_get()which does not have optional yet.I can add it although the scope of the patch grows from simple defer-path-simplification.
No need. My comment only about existing API per individual cases. SO, here it's fine then.
I checked the others and I didn't see such pattern anymore.
Best regards,
Krzysztof
Re: [PATCH 04/24] Input: gpio-vibra - Simplify with dev_err_probe()
In reply to Krzysztof KozlowskiQuoted 6 lines · Krzysztof Kozlowski
Common pattern of handling deferred probe can be simplified with
dev_err_probe(). Less code and also it prints the error value.vibrator->vcc = devm_regulator_get(&pdev->dev, "vcc"); err = PTR_ERR_OR_ZERO(vibrator->vcc);
drivers/input/misc/gpio-vibra.c static int gpio_vibrator_probe(struct platform_device *pdev) · line 118
Quoted 8 lines
drivers/input/misc/gpio-vibra.c +2
-6-if (err) { -if (err != -EPROBE_DEFER ) -dev_err (&pdev->dev,"Failed to request regulator: %d\n" , - err); -return err; - } +if (err) +return dev_err_probe (&pdev->dev, err,"Failed to request regulator\n" );
Can it be rather
if (IS_ERR())
return dev_err_probe(dev, PTR_ERR());
w/o err be involved?
drivers/input/misc/gpio-vibra.c static int gpio_vibrator_probe(struct platform_device *pdev) · line 123
Quoted 10 lines
vibrator->gpio = devm_gpiod_get(&pdev->dev, "enable", GPIOD_OUT_LOW); err = PTR_ERR_OR_ZERO(vibrator->gpio);drivers/input/misc/gpio-vibra.c +2
-6-if (err) { -if (err != -EPROBE_DEFER ) -dev_err (&pdev->dev,"Failed to request main gpio: %d\n" , - err); -return err; - } +if (err) +return dev_err_probe (&pdev->dev, err,"Failed to request main gpio\n" );
Ditto.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH 03/24] Input: gpio_keys_polled - Simplify with dev_err_probe()
In reply to Krzysztof KozlowskiQuoted 4 lines · Krzysztof Kozlowski
Common pattern of handling deferred probe can be simplified with
dev_err_probe(). Less code and also it prints the error value.
Quoted 28 lines
Signed-off-by Krzysztof Kozlowski <[email protected]>--- drivers/input/keyboard/gpio_keys_polled.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)drivers/input/keyboard/gpio_keys_polled.c +2
-7@@ -299,13 +299,9 @@ static int gpio_keys_polled_probe(struct platform_device *pdev)NULL ,GPIOD_IN , button->desc);if (IS_ERR (bdata->gpiod)) { - error =PTR_ERR (bdata->gpiod); -if (error != -EPROBE_DEFER ) -dev_err (dev, -"failed to get gpio: %d\n" , - error);fwnode_handle_put (child); -return error; +return dev_err_probe (dev,PTR_ERR (bdata->gpiod), +"failed to get gpio\n" ); } }else if (gpio_is_valid (button->gpio)) {/* -- 2.17.1
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH 06/24] Input: pwm-vibra - Simplify with dev_err_probe()
In reply to Krzysztof Kozlowskidrivers/input/misc/pwm-vibra.c static int pwm_vibrator_probe(struct platform_device *pdev) · line 139
Quoted 7 lines · Krzysztof Kozlowski
Common pattern of handling deferred probe can be simplified with
dev_err_probe(). Less code and also it prints the error value.err = PTR_ERR_OR_ZERO(vibrator->vcc);drivers/input/misc/pwm-vibra.c +2
-0+if (err) +return dev_err_probe (&pdev->dev, err,"Failed to request regulator\n" );
Same comment, no need to have additional PTR_ERR_OZR_ZERO().
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH 05/24] Input: pwm-beeper - Simplify with dev_err_probe()
In reply to Krzysztof KozlowskiQuoted 4 lines · Krzysztof Kozlowski
Common pattern of handling deferred probe can be simplified with
dev_err_probe(). Less code and also it prints the error value.
Quoted 45 lines
Signed-off-by Krzysztof Kozlowski <[email protected]>--- drivers/input/misc/pwm-beeper.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-)drivers/input/misc/pwm-beeper.c +5
-15@@ -132,13 +132,8 @@ static int pwm_beeper_probe(struct platform_device *pdev)return -ENOMEM ; beeper->pwm =devm_pwm_get (dev,NULL ); -if (IS_ERR (beeper->pwm)) { - error =PTR_ERR (beeper->pwm); -if (error != -EPROBE_DEFER ) -dev_err (dev,"Failed to request PWM device: %d\n" , - error); -return error; - } +if (IS_ERR (beeper->pwm)) +return dev_err_probe (dev,PTR_ERR (beeper->pwm),"Failed to request PWM device\n" );/* Sync up PWM state and ensure it is off. */ pwm_init_state (beeper->pwm, &state);@@ -151,13 +146,9 @@ static int pwm_beeper_probe(struct platform_device *pdev) } beeper->amplifier =devm_regulator_get (dev,"amp" ); -if (IS_ERR (beeper->amplifier)) { - error =PTR_ERR (beeper->amplifier); -if (error != -EPROBE_DEFER ) -dev_err (dev,"Failed to get 'amp' regulator: %d\n" , - error); -return error; - } +if (IS_ERR (beeper->amplifier)) +return dev_err_probe (dev,PTR_ERR (beeper->amplifier), +"Failed to get 'amp' regulator\n" );INIT_WORK (&beeper->work, pwm_beeper_work); --2.17.1
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH 07/24] Input: rotary_encoder - Simplify with dev_err_probe()
In reply to Krzysztof KozlowskiQuoted 3 lines · Krzysztof Kozlowski
Common pattern of handling deferred probe can be simplified with
dev_err_probe(). Less code and also it prints the error value.
Quoted 27 lines
Signed-off-by Krzysztof Kozlowski <[email protected]>--- drivers/input/misc/rotary_encoder.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)drivers/input/misc/rotary_encoder.c +2
-7@@ -236,12 +236,8 @@ static int rotary_encoder_probe(struct platform_device *pdev)device_property_read_bool (dev,"rotary-encoder,relative-axis" ); encoder->gpios =devm_gpiod_get_array (dev,NULL ,GPIOD_IN ); -if (IS_ERR (encoder->gpios)) { - err =PTR_ERR (encoder->gpios); -if (err != -EPROBE_DEFER ) -dev_err (dev,"unable to get gpios: %d\n" , err); -return err; - } +if (IS_ERR (encoder->gpios)) +return dev_err_probe (dev,PTR_ERR (encoder->gpios),"unable to get gpios\n" );if (encoder->gpios->ndescs <2 ) {dev_err (dev,"not enough gpios found\n" );return -EINVAL ; --2.17.1
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH 08/24] Input: elan_i2c - Simplify with dev_err_probe()
In reply to Krzysztof KozlowskiQuoted 3 lines · Krzysztof Kozlowski
Common pattern of handling deferred probe can be simplified with
dev_err_probe(). Less code and also it prints the error value.
Quoted 28 lines
Signed-off-by Krzysztof Kozlowski <[email protected]>--- drivers/input/mouse/elan_i2c_core.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)drivers/input/mouse/elan_i2c_core.c +2
-8@@ -1229,13 +1229,8 @@ static int elan_probe(struct i2c_client *client,mutex_init (&data->sysfs_mutex); data->vcc =devm_regulator_get (dev,"vcc" ); -if (IS_ERR (data->vcc)) { - error =PTR_ERR (data->vcc); -if (error != -EPROBE_DEFER ) -dev_err (dev,"Failed to get 'vcc' regulator: %d\n" , - error); -return error; - } +if (IS_ERR (data->vcc)) +return dev_err_probe (dev,PTR_ERR (data->vcc),"Failed to get 'vcc' regulator\n" ); error =regulator_enable (data->vcc);if (error) { --2.17.1
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH 09/24] Input: bu21013_ts - Simplify with dev_err_probe()
In reply to Krzysztof Kozlowskidrivers/input/touchscreen/bu21013_ts.c static int bu21013_probe(struct i2c_client *client, · line 502
Quoted 10 lines · Krzysztof Kozlowski
Common pattern of handling deferred probe can be simplified with
dev_err_probe(). Less code and also it prints the error value.ts->cs_gpiod = devm_gpiod_get(&client->dev, "reset", GPIOD_OUT_HIGH); error = PTR_ERR_OR_ZERO(ts->cs_gpiod);drivers/input/touchscreen/bu21013_ts.c +3
-0+if (error) +return dev_err_probe (&client->dev, error,"failed to get CS GPIO\n" ); +
if (IS_ERR())
return ... PTR_ERR()...
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH 10/24] Input: bu21029_ts - Simplify with dev_err_probe()
In reply to Krzysztof KozlowskiQuoted 3 lines · Krzysztof Kozlowski
Common pattern of handling deferred probe can be simplified with
dev_err_probe(). Less code and also it prints the error value.
Quoted 42 lines
Signed-off-by Krzysztof Kozlowski <[email protected]>--- drivers/input/touchscreen/bu21029_ts.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-)drivers/input/touchscreen/bu21029_ts.c +6
-15@@ -360,23 +360,15 @@ static int bu21029_probe(struct i2c_client *client, } bu21029->vdd =devm_regulator_get (&client->dev,"vdd" ); -if (IS_ERR (bu21029->vdd)) { - error =PTR_ERR (bu21029->vdd); -if (error != -EPROBE_DEFER ) -dev_err (&client->dev, -"failed to acquire 'vdd' supply: %d\n" , error); -return error; - } +if (IS_ERR (bu21029->vdd)) +return dev_err_probe (&client->dev,PTR_ERR (bu21029->vdd), +"failed to acquire 'vdd' supply\n" ); bu21029->reset_gpios =devm_gpiod_get_optional (&client->dev,"reset" ,GPIOD_OUT_HIGH ); -if (IS_ERR (bu21029->reset_gpios)) { - error =PTR_ERR (bu21029->reset_gpios); -if (error != -EPROBE_DEFER ) -dev_err (&client->dev, -"failed to acquire 'reset' gpio: %d\n" , error); -return error; - } +if (IS_ERR (bu21029->reset_gpios)) +return dev_err_probe (&client->dev,PTR_ERR (bu21029->reset_gpios), +"failed to acquire 'reset' gpio\n" ); in_dev =devm_input_allocate_device (&client->dev);if (!in_dev) { --2.17.1
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH 11/24] Input: chipone_icn8318 - Simplify with dev_err_probe()
In reply to Krzysztof KozlowskiQuoted 3 lines · Krzysztof Kozlowski
Common pattern of handling deferred probe can be simplified with
dev_err_probe(). Less code and also it prints the error value.
Quoted 27 lines
Signed-off-by Krzysztof Kozlowski <[email protected]>--- drivers/input/touchscreen/chipone_icn8318.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)drivers/input/touchscreen/chipone_icn8318.c +2
-7@@ -194,12 +194,8 @@ static int icn8318_probe(struct i2c_client *client,return -ENOMEM ; data->wake_gpio =devm_gpiod_get (dev,"wake" ,GPIOD_OUT_LOW ); -if (IS_ERR (data->wake_gpio)) { - error =PTR_ERR (data->wake_gpio); -if (error != -EPROBE_DEFER ) -dev_err (dev,"Error getting wake gpio: %d\n" , error); -return error; - } +if (IS_ERR (data->wake_gpio)) +return dev_err_probe (dev,PTR_ERR (data->wake_gpio),"Error getting wake gpio\n" ); input =devm_input_allocate_device (dev);if (!input) --2.17.1
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH 12/24] Input: cy8ctma140 - Simplify with dev_err_probe()
In reply to Krzysztof KozlowskiQuoted 3 lines · Krzysztof Kozlowski
Common pattern of handling deferred probe can be simplified with
dev_err_probe(). Less code and also it prints the error value.
Quoted 27 lines
Signed-off-by Krzysztof Kozlowski <[email protected]>--- drivers/input/touchscreen/cy8ctma140.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)drivers/input/touchscreen/cy8ctma140.c +2
-7@@ -259,12 +259,8 @@ static int cy8ctma140_probe(struct i2c_client *client, ts->regulators[1 ].supply ="vdd" ; error =devm_regulator_bulk_get (dev,ARRAY_SIZE (ts->regulators), ts->regulators); -if (error) { -if (error != -EPROBE_DEFER ) -dev_err (dev,"Failed to get regulators %d\n" , - error); -return error; - } +if (error) +return dev_err_probe (dev, error,"Failed to get regulators\n" ); error =cy8ctma140_power_up (ts);if (error) --2.17.1
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH 13/24] Input: edf-ft5x06 - Simplify with dev_err_probe()
In reply to Krzysztof KozlowskiQuoted 3 lines · Krzysztof Kozlowski
Common pattern of handling deferred probe can be simplified with
dev_err_probe(). Less code and also it prints the error value.
Quoted 29 lines
Signed-off-by Krzysztof Kozlowski <[email protected]>--- drivers/input/touchscreen/edt-ft5x06.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)drivers/input/touchscreen/edt-ft5x06.c +3
-8@@ -1098,13 +1098,9 @@ static int edt_ft5x06_ts_probe(struct i2c_client *client, tsdata->max_support_points = chip_data->max_support_points; tsdata->vcc =devm_regulator_get (&client->dev,"vcc" ); -if (IS_ERR (tsdata->vcc)) { - error =PTR_ERR (tsdata->vcc); -if (error != -EPROBE_DEFER ) -dev_err (&client->dev, -"failed to request regulator: %d\n" , error); -return error; - } +if (IS_ERR (tsdata->vcc)) +return dev_err_probe (&client->dev,PTR_ERR (tsdata->vcc), +"failed to request regulator\n" ); error =regulator_enable (tsdata->vcc);if (error <0 ) { --2.17.1
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH 14/24] Input: ektf2127 - Simplify with dev_err_probe()
In reply to Krzysztof KozlowskiQuoted 3 lines · Krzysztof Kozlowski
Common pattern of handling deferred probe can be simplified with
dev_err_probe(). Less code and also it prints the error value.
Quoted 27 lines
Signed-off-by Krzysztof Kozlowski <[email protected]>--- drivers/input/touchscreen/ektf2127.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)drivers/input/touchscreen/ektf2127.c +2
-7@@ -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
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH 15/24] Input: elants_i2c - Simplify with dev_err_probe()
In reply to Krzysztof KozlowskiQuoted 3 lines · Krzysztof Kozlowski
Common pattern of handling deferred probe can be simplified with
dev_err_probe(). Less code and also it prints the error value.
Quoted 43 lines
Signed-off-by Krzysztof Kozlowski <[email protected]>--- drivers/input/touchscreen/elants_i2c.c | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-)drivers/input/touchscreen/elants_i2c.c +6
-17@@ -1245,24 +1245,14 @@ static int elants_i2c_probe(struct i2c_client *client,i2c_set_clientdata (client, ts); ts->vcc33 =devm_regulator_get (&client->dev,"vcc33" ); -if (IS_ERR (ts->vcc33)) { - error =PTR_ERR (ts->vcc33); -if (error != -EPROBE_DEFER ) -dev_err (&client->dev, -"Failed to get 'vcc33' regulator: %d\n" , - error); -return error; - } +if (IS_ERR (ts->vcc33)) +return dev_err_probe (&client->dev,PTR_ERR (ts->vcc33), +"Failed to get 'vcc33' regulator\n" ); ts->vccio =devm_regulator_get (&client->dev,"vccio" ); -if (IS_ERR (ts->vccio)) { - error =PTR_ERR (ts->vccio); -if (error != -EPROBE_DEFER ) -dev_err (&client->dev, -"Failed to get 'vccio' regulator: %d\n" , - error); -return error; - } +if (IS_ERR (ts->vccio)) +return dev_err_probe (&client->dev,PTR_ERR (ts->vccio), +"Failed to get 'vccio' regulator\n" ); ts->reset_gpio =devm_gpiod_get (&client->dev,"reset" ,GPIOD_OUT_LOW );if (IS_ERR (ts->reset_gpio)) { --2.17.1
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH 16/24] Input: goodix - Simplify with dev_err_probe()
In reply to Krzysztof KozlowskiQuoted 3 lines · Krzysztof Kozlowski
Common pattern of handling deferred probe can be simplified with
dev_err_probe(). Less code and also it prints the error value.
Quoted 79 lines
Signed-off-by Krzysztof Kozlowski <[email protected]>--- drivers/input/touchscreen/goodix.c | 40 ++++++++---------------------- 1 file changed, 11 insertions(+), 29 deletions(-)drivers/input/touchscreen/goodix.c +11
-30@@ -864,7 +864,6 @@ static int goodix_add_acpi_gpio_mappings(struct goodix_ts_data *ts)*/ static int goodix_get_gpio_config (struct goodix_ts_data *ts) { -int error;struct device *dev;struct gpio_desc *gpiod;bool added_acpi_mappings = false;@@ -874,33 +873,20 @@ static int goodix_get_gpio_config(struct goodix_ts_data *ts) dev = &ts->client->dev; ts->avdd28 =devm_regulator_get (dev,"AVDD28" ); -if (IS_ERR (ts->avdd28)) { - error =PTR_ERR (ts->avdd28); -if (error != -EPROBE_DEFER ) -dev_err (dev, -"Failed to get AVDD28 regulator: %d\n" , error); -return error; - } +if (IS_ERR (ts->avdd28)) +return dev_err_probe (dev,PTR_ERR (ts->avdd28),"Failed to get AVDD28 regulator\n" ); ts->vddio =devm_regulator_get (dev,"VDDIO" ); -if (IS_ERR (ts->vddio)) { - error =PTR_ERR (ts->vddio); -if (error != -EPROBE_DEFER ) -dev_err (dev, -"Failed to get VDDIO regulator: %d\n" , error); -return error; - } +if (IS_ERR (ts->vddio)) +return dev_err_probe (dev,PTR_ERR (ts->vddio),"Failed to get VDDIO regulator\n" ); retry_get_irq_gpio:/* Get the interrupt GPIO pin number */ gpiod =devm_gpiod_get_optional (dev,GOODIX_GPIO_INT_NAME ,GPIOD_IN ); -if (IS_ERR (gpiod)) { - error =PTR_ERR (gpiod); -if (error != -EPROBE_DEFER ) -dev_dbg (dev,"Failed to get %s GPIO: %d\n" , -GOODIX_GPIO_INT_NAME , error); -return error; - } +if (IS_ERR (gpiod)) +return dev_err_probe (dev,PTR_ERR (gpiod),"Failed to get %s GPIO\n" , +GOODIX_GPIO_INT_NAME ); +if (!gpiod &&has_acpi_companion (dev) && !added_acpi_mappings) { added_acpi_mappings = true;if (goodix_add_acpi_gpio_mappings (ts) ==0 )@@ -911,13 +897,9 @@ static int goodix_get_gpio_config(struct goodix_ts_data *ts)/* Get the reset line GPIO pin number */ gpiod =devm_gpiod_get_optional (dev,GOODIX_GPIO_RST_NAME ,GPIOD_IN ); -if (IS_ERR (gpiod)) { - error =PTR_ERR (gpiod); -if (error != -EPROBE_DEFER ) -dev_dbg (dev,"Failed to get %s GPIO: %d\n" , -GOODIX_GPIO_RST_NAME , error); -return error; - } +if (IS_ERR (gpiod)) +return dev_err_probe (dev,PTR_ERR (gpiod),"Failed to get %s GPIO\n" , +GOODIX_GPIO_RST_NAME ); ts->gpiod_rst = gpiod; --2.17.1
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH 17/24] Input: melfas_mip4 - Simplify with dev_err_probe()
In reply to Krzysztof KozlowskiQuoted 3 lines · Krzysztof Kozlowski
Common pattern of handling deferred probe can be simplified with
dev_err_probe(). Less code and also it prints the error value.
Quoted 28 lines
Signed-off-by Krzysztof Kozlowski <[email protected]>--- drivers/input/touchscreen/melfas_mip4.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)drivers/input/touchscreen/melfas_mip4.c +2
-8@@ -1451,13 +1451,8 @@ static int mip4_probe(struct i2c_client *client, const struct i2c_device_id *id) ts->gpio_ce =devm_gpiod_get_optional (&client->dev,"ce" ,GPIOD_OUT_LOW ); -if (IS_ERR (ts->gpio_ce)) { - error =PTR_ERR (ts->gpio_ce); -if (error !=EPROBE_DEFER ) -dev_err (&client->dev, -"Failed to get gpio: %d\n" , error); -return error; - } +if (IS_ERR (ts->gpio_ce)) +return dev_err_probe (&client->dev,PTR_ERR (ts->gpio_ce),"Failed to get gpio\n" ); error =mip4_power_on (ts);if (error) --2.17.1
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH 18/24] Input: pixcir_i2c_ts - Simplify with dev_err_probe()
In reply to Krzysztof KozlowskiQuoted 3 lines · Krzysztof Kozlowski
Common pattern of handling deferred probe can be simplified with
dev_err_probe(). Less code and also it prints the error value.
Quoted 66 lines
Signed-off-by Krzysztof Kozlowski <[email protected]>--- drivers/input/touchscreen/pixcir_i2c_ts.c | 38 +++++++---------------- 1 file changed, 12 insertions(+), 26 deletions(-)drivers/input/touchscreen/pixcir_i2c_ts.c +12
-27@@ -515,41 +515,27 @@ static int pixcir_i2c_ts_probe(struct i2c_client *client,input_set_drvdata (input, tsdata); tsdata->gpio_attb =devm_gpiod_get (dev,"attb" ,GPIOD_IN ); -if (IS_ERR (tsdata->gpio_attb)) { - error =PTR_ERR (tsdata->gpio_attb); -if (error != -EPROBE_DEFER ) -dev_err (dev,"Failed to request ATTB gpio: %d\n" , - error); -return error; - } +if (IS_ERR (tsdata->gpio_attb)) +return dev_err_probe (dev,PTR_ERR (tsdata->gpio_attb), +"Failed to request ATTB gpio\n" ); tsdata->gpio_reset =devm_gpiod_get_optional (dev,"reset" ,GPIOD_OUT_LOW ); -if (IS_ERR (tsdata->gpio_reset)) { - error =PTR_ERR (tsdata->gpio_reset); -if (error != -EPROBE_DEFER ) -dev_err (dev,"Failed to request RESET gpio: %d\n" , - error); -return error; - } +if (IS_ERR (tsdata->gpio_reset)) +return dev_err_probe (dev,PTR_ERR (tsdata->gpio_reset), +"Failed to request RESET gpio\n" ); tsdata->gpio_wake =devm_gpiod_get_optional (dev,"wake" ,GPIOD_OUT_HIGH ); -if (IS_ERR (tsdata->gpio_wake)) { - error =PTR_ERR (tsdata->gpio_wake); -if (error != -EPROBE_DEFER ) -dev_err (dev,"Failed to get wake gpio: %d\n" , error); -return error; - } +if (IS_ERR (tsdata->gpio_wake)) +return dev_err_probe (dev,PTR_ERR (tsdata->gpio_wake), +"Failed to get wake gpio\n" ); tsdata->gpio_enable =devm_gpiod_get_optional (dev,"enable" ,GPIOD_OUT_HIGH ); -if (IS_ERR (tsdata->gpio_enable)) { - error =PTR_ERR (tsdata->gpio_enable); -if (error != -EPROBE_DEFER ) -dev_err (dev,"Failed to get enable gpio: %d\n" , error); -return error; - } +if (IS_ERR (tsdata->gpio_enable)) +return dev_err_probe (dev,PTR_ERR (tsdata->gpio_enable), +"Failed to get enable gpio\n" );if (tsdata->gpio_enable)msleep (100 ); --2.17.1
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH 19/24] Input: raydium_i2c_ts - Simplify with dev_err_probe()
In reply to Krzysztof KozlowskiQuoted 3 lines · Krzysztof Kozlowski
Common pattern of handling deferred probe can be simplified with
dev_err_probe(). Less code and also it prints the error value.
Quoted 54 lines
Signed-off-by Krzysztof Kozlowski <[email protected]>--- drivers/input/touchscreen/raydium_i2c_ts.c | 30 +++++++--------------- 1 file changed, 9 insertions(+), 21 deletions(-)drivers/input/touchscreen/raydium_i2c_ts.c +9
-22@@ -1015,32 +1015,20 @@ static int raydium_i2c_probe(struct i2c_client *client,i2c_set_clientdata (client, ts); ts->avdd =devm_regulator_get (&client->dev,"avdd" ); -if (IS_ERR (ts->avdd)) { - error =PTR_ERR (ts->avdd); -if (error != -EPROBE_DEFER ) -dev_err (&client->dev, -"Failed to get 'avdd' regulator: %d\n" , error); -return error; - } +if (IS_ERR (ts->avdd)) +return dev_err_probe (&client->dev,PTR_ERR (ts->avdd), +"Failed to get 'avdd' regulator\n" ); ts->vccio =devm_regulator_get (&client->dev,"vccio" ); -if (IS_ERR (ts->vccio)) { - error =PTR_ERR (ts->vccio); -if (error != -EPROBE_DEFER ) -dev_err (&client->dev, -"Failed to get 'vccio' regulator: %d\n" , error); -return error; - } +if (IS_ERR (ts->vccio)) +return dev_err_probe (&client->dev,PTR_ERR (ts->vccio), +"Failed to get 'vccio' regulator\n" ); ts->reset_gpio =devm_gpiod_get_optional (&client->dev,"reset" ,GPIOD_OUT_LOW ); -if (IS_ERR (ts->reset_gpio)) { - error =PTR_ERR (ts->reset_gpio); -if (error != -EPROBE_DEFER ) -dev_err (&client->dev, -"failed to get reset gpio: %d\n" , error); -return error; - } +if (IS_ERR (ts->reset_gpio)) +return dev_err_probe (&client->dev,PTR_ERR (ts->reset_gpio), +"Failed to get reset gpio\n" ); error =raydium_i2c_power_on (ts);if (error) --2.17.1
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH 20/24] Input: resistive-adc-touch - Simplify with dev_err_probe()
In reply to Krzysztof KozlowskiQuoted 3 lines · Krzysztof Kozlowski
Common pattern of handling deferred probe can be simplified with
dev_err_probe(). Less code and also it prints the error value.
Quoted 27 lines
Signed-off-by Krzysztof Kozlowski <[email protected]>--- drivers/input/touchscreen/resistive-adc-touch.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)drivers/input/touchscreen/resistive-adc-touch.c +2
-7@@ -108,12 +108,8 @@ static int grts_probe(struct platform_device *pdev)/* get the channels from IIO device */ st->iio_chans =devm_iio_channel_get_all (dev); -if (IS_ERR (st->iio_chans)) { - error =PTR_ERR (st->iio_chans); -if (error != -EPROBE_DEFER ) -dev_err (dev,"can't get iio channels.\n" ); -return error; - } +if (IS_ERR (st->iio_chans)) +return dev_err_probe (dev,PTR_ERR (st->iio_chans),"can't get iio channels\n" ); chan = &st->iio_chans[0 ]; st->pressure = false; --2.17.1
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH 21/24] Input: silead - Simplify with dev_err_probe()
In reply to Krzysztof KozlowskiQuoted 3 lines · Krzysztof Kozlowski
Common pattern of handling deferred probe can be simplified with
dev_err_probe(). Less code and also it prints the error value.
Quoted 27 lines
Signed-off-by Krzysztof Kozlowski <[email protected]>--- drivers/input/touchscreen/silead.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)drivers/input/touchscreen/silead.c +3
-6@@ -512,11 +512,9 @@ static int silead_ts_probe(struct i2c_client *client,/* Power GPIO pin */ data->gpio_power =devm_gpiod_get_optional (dev,"power" ,GPIOD_OUT_LOW ); -if (IS_ERR (data->gpio_power)) { -if (PTR_ERR (data->gpio_power) != -EPROBE_DEFER ) -dev_err (dev,"Shutdown GPIO request failed\n" ); -return PTR_ERR (data->gpio_power); - } +if (IS_ERR (data->gpio_power)) +return dev_err_probe (dev,PTR_ERR (data->gpio_power), +"Shutdown GPIO request failed\n" ); error =silead_ts_setup (client);if (error) --2.17.1
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH 22/24] Input: sis_i2c - Simplify with dev_err_probe()
In reply to Krzysztof KozlowskiQuoted 3 lines · Krzysztof Kozlowski
Common pattern of handling deferred probe can be simplified with
dev_err_probe(). Less code and also it prints the error value.
Quoted 42 lines
Signed-off-by Krzysztof Kozlowski <[email protected]>--- drivers/input/touchscreen/sis_i2c.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-)drivers/input/touchscreen/sis_i2c.c +6
-15@@ -311,23 +311,15 @@ static int sis_ts_probe(struct i2c_client *client, ts->attn_gpio =devm_gpiod_get_optional (&client->dev,"attn" ,GPIOD_IN ); -if (IS_ERR (ts->attn_gpio)) { - error =PTR_ERR (ts->attn_gpio); -if (error != -EPROBE_DEFER ) -dev_err (&client->dev, -"Failed to get attention GPIO: %d\n" , error); -return error; - } +if (IS_ERR (ts->attn_gpio)) +return dev_err_probe (&client->dev,PTR_ERR (ts->attn_gpio), +"Failed to get attention GPIO\n" ); ts->reset_gpio =devm_gpiod_get_optional (&client->dev,"reset" ,GPIOD_OUT_LOW ); -if (IS_ERR (ts->reset_gpio)) { - error =PTR_ERR (ts->reset_gpio); -if (error != -EPROBE_DEFER ) -dev_err (&client->dev, -"Failed to get reset GPIO: %d\n" , error); -return error; - } +if (IS_ERR (ts->reset_gpio)) +return dev_err_probe (&client->dev,PTR_ERR (ts->reset_gpio), +"Failed to get reset GPIO\n" );sis_ts_reset (ts); --2.17.1
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH 23/24] Input: surface3_spi - Simplify with dev_err_probe()
In reply to Krzysztof KozlowskiQuoted 3 lines · Krzysztof Kozlowski
Common pattern of handling deferred probe can be simplified with
dev_err_probe(). Less code and also it prints the error value.
Quoted 39 lines
Signed-off-by Krzysztof Kozlowski <[email protected]>--- drivers/input/touchscreen/surface3_spi.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-)drivers/input/touchscreen/surface3_spi.c +3
-11@@ -223,7 +223,6 @@ static void surface3_spi_power(struct surface3_ts_data *data, bool on)*/ static int surface3_spi_get_gpio_config (struct surface3_ts_data *data) { -int error;struct device *dev;struct gpio_desc *gpiod;int i;@@ -233,15 +232,9 @@ static int surface3_spi_get_gpio_config(struct surface3_ts_data *data)/* Get the reset lines GPIO pin number */ for (i =0 ; i <2 ; i++) { gpiod =devm_gpiod_get_index (dev,NULL , i,GPIOD_OUT_LOW ); -if (IS_ERR (gpiod)) { - error =PTR_ERR (gpiod); -if (error != -EPROBE_DEFER ) -dev_err (dev, -"Failed to get power GPIO %d: %d\n" , - i, - error); -return error; - } +if (IS_ERR (gpiod)) +return dev_err_probe (dev,PTR_ERR (gpiod), +"Failed to get power GPIO %d\n" , i); data->gpiod_rst[i] = gpiod; } --2.17.1
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH 24/24] Input: sx8643 - Simplify with dev_err_probe()
In reply to Krzysztof KozlowskiQuoted 3 lines · Krzysztof Kozlowski
Common pattern of handling deferred probe can be simplified with
dev_err_probe(). Less code and also it prints the error value.
Just in case if you want to save more LOCs, you may in some drivers introduce temporary variable for device pointer, like
struct device *dev = &client->dev;
Quoted 29 lines
Signed-off-by Krzysztof Kozlowski <[email protected]>--- drivers/input/touchscreen/sx8654.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)drivers/input/touchscreen/sx8654.c +3
-8@@ -323,13 +323,9 @@ static int sx8654_probe(struct i2c_client *client, sx8654->gpio_reset =devm_gpiod_get_optional (&client->dev,"reset" ,GPIOD_OUT_HIGH ); -if (IS_ERR (sx8654->gpio_reset)) { - error =PTR_ERR (sx8654->gpio_reset); -if (error != -EPROBE_DEFER ) -dev_err (&client->dev,"unable to get reset-gpio: %d\n" , - error); -return error; - } +if (IS_ERR (sx8654->gpio_reset)) +return dev_err_probe (&client->dev,PTR_ERR (sx8654->gpio_reset), +"unable to get reset-gpio\n" );dev_dbg (&client->dev,"got GPIO reset pin\n" ); sx8654->data =device_get_match_data (&client->dev); --2.17.1
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH 04/24] Input: gpio-vibra - Simplify with dev_err_probe()
In reply to Andy ShevchenkoQuoted 16 lines · Andy Shevchenko
Quoted 6 lines · Krzysztof Kozlowski
Common pattern of handling deferred probe can be simplified with
dev_err_probe(). Less code and also it prints the error value.vibrator->vcc = devm_regulator_get(&pdev->dev, "vcc"); err = PTR_ERR_OR_ZERO(vibrator->vcc);drivers/input/misc/gpio-vibra.c static int gpio_vibrator_probe(struct platform_device *pdev) · line 118
Quoted 8 lines
drivers/input/misc/gpio-vibra.c +2
-6-if (err) { -if (err != -EPROBE_DEFER ) -dev_err (&pdev->dev,"Failed to request regulator: %d\n" , - err); -return err; - } +if (err) +return dev_err_probe (&pdev->dev, err,"Failed to request regulator\n" );
Quoted 4 lines
Can it be rather
if (IS_ERR())return dev_err_probe(dev, PTR_ERR());w/o err be involved?
Good point.
Best regards,
Krzysztof
Re: [PATCH 06/24] Input: pwm-vibra - Simplify with dev_err_probe()
In reply to Andy ShevchenkoQuoted 10 lines · Andy Shevchenko
drivers/input/misc/pwm-vibra.c static int pwm_vibrator_probe(struct platform_device *pdev) · line 139
Quoted 7 lines · Krzysztof Kozlowski
Common pattern of handling deferred probe can be simplified with
dev_err_probe(). Less code and also it prints the error value.err = PTR_ERR_OR_ZERO(vibrator->vcc);drivers/input/misc/pwm-vibra.c +2
-0+if (err) +return dev_err_probe (&pdev->dev, err,"Failed to request regulator\n" );Same comment, no need to have additional
PTR_ERR_OZR_ZERO().
Yes.
Best regards,
Krzysztof
Re: [PATCH 09/24] Input: bu21013_ts - Simplify with dev_err_probe()
In reply to Andy ShevchenkoQuoted 8 lines · Andy Shevchenko
Quoted 6 lines · Krzysztof Kozlowski
Common pattern of handling deferred probe can be simplified with
dev_err_probe(). Less code and also it prints the error value.ts->cs_gpiod = devm_gpiod_get(&client->dev, "reset", GPIOD_OUT_HIGH); error = PTR_ERR_OR_ZERO(ts->cs_gpiod);
Quoted 6 lines
drivers/input/touchscreen/bu21013_ts.c static int bu21013_probe(struct i2c_client *client, · line 502
Quoted 3 lines
drivers/input/touchscreen/bu21013_ts.c +3
-0+if (error) +return dev_err_probe (&client->dev, error,"failed to get CS GPIO\n" ); +if (
IS_ERR())
return ...PTR_ERR()...
Indeed.
Best regards,
Krzysztof
Re: [PATCH 12/24] Input: cy8ctma140 - Simplify with dev_err_probe()
In reply to Krzysztof KozlowskiQuoted 4 lines · Krzysztof Kozlowski
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 <[email protected]>
Yours,
Linus Walleij