Skip to content

Commit

Permalink
Input: remove dev_err() usage after platform_get_irq()
Browse files Browse the repository at this point in the history
We don't need dev_err() messages when platform_get_irq() fails now that
platform_get_irq() prints an error message itself when something goes
wrong. Let's remove these prints with a simple semantic patch.

// <smpl>
@@
expression ret;
struct platform_device *E;
@@

ret =
(
platform_get_irq(E, ...)
|
platform_get_irq_byname(E, ...)
);

if ( \( ret < 0 \| ret <= 0 \) )
{
(
-if (ret != -EPROBE_DEFER)
-{ ...
-dev_err(...);
-... }
|
...
-dev_err(...);
)
...
}
// </smpl>

While we're here, remove braces on if statements that only have one
statement (manually).

Signed-off-by: Stephen Boyd <swboyd@chromium.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
  • Loading branch information
Stephen Boyd authored and Dmitry Torokhov committed Aug 14, 2019
1 parent f5d4c64 commit 0bec8b7
Show file tree
Hide file tree
Showing 37 changed files with 44 additions and 142 deletions.
4 changes: 1 addition & 3 deletions drivers/input/keyboard/bcm-keypad.c
Original file line number Diff line number Diff line change
Expand Up @@ -413,10 +413,8 @@ static int bcm_kp_probe(struct platform_device *pdev)
bcm_kp_stop(kp);

kp->irq = platform_get_irq(pdev, 0);
if (kp->irq < 0) {
dev_err(&pdev->dev, "no IRQ specified\n");
if (kp->irq < 0)
return -EINVAL;
}

error = devm_request_threaded_irq(&pdev->dev, kp->irq,
NULL, bcm_kp_isr_thread,
Expand Down
1 change: 0 additions & 1 deletion drivers/input/keyboard/davinci_keyscan.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,6 @@ static int __init davinci_ks_probe(struct platform_device *pdev)

davinci_ks->irq = platform_get_irq(pdev, 0);
if (davinci_ks->irq < 0) {
dev_err(dev, "no key scan irq\n");
error = davinci_ks->irq;
goto fail2;
}
Expand Down
4 changes: 1 addition & 3 deletions drivers/input/keyboard/imx_keypad.c
Original file line number Diff line number Diff line change
Expand Up @@ -430,10 +430,8 @@ static int imx_keypad_probe(struct platform_device *pdev)
}

irq = platform_get_irq(pdev, 0);
if (irq < 0) {
dev_err(&pdev->dev, "no irq defined in platform data\n");
if (irq < 0)
return irq;
}

input_dev = devm_input_allocate_device(&pdev->dev);
if (!input_dev) {
Expand Down
4 changes: 1 addition & 3 deletions drivers/input/keyboard/lpc32xx-keys.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,8 @@ static int lpc32xx_kscan_probe(struct platform_device *pdev)
}

irq = platform_get_irq(pdev, 0);
if (irq < 0) {
dev_err(&pdev->dev, "failed to get platform irq\n");
if (irq < 0)
return -EINVAL;
}

kscandat = devm_kzalloc(&pdev->dev, sizeof(*kscandat),
GFP_KERNEL);
Expand Down
4 changes: 1 addition & 3 deletions drivers/input/keyboard/nomadik-ske-keypad.c
Original file line number Diff line number Diff line change
Expand Up @@ -235,10 +235,8 @@ static int __init ske_keypad_probe(struct platform_device *pdev)
}

irq = platform_get_irq(pdev, 0);
if (irq < 0) {
dev_err(&pdev->dev, "failed to get keypad irq\n");
if (irq < 0)
return -EINVAL;
}

res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res) {
Expand Down
4 changes: 1 addition & 3 deletions drivers/input/keyboard/nspire-keypad.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,8 @@ static int nspire_keypad_probe(struct platform_device *pdev)
int error;

irq = platform_get_irq(pdev, 0);
if (irq < 0) {
dev_err(&pdev->dev, "failed to get keypad irq\n");
if (irq < 0)
return -EINVAL;
}

keypad = devm_kzalloc(&pdev->dev, sizeof(struct nspire_keypad),
GFP_KERNEL);
Expand Down
4 changes: 1 addition & 3 deletions drivers/input/keyboard/opencores-kbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,8 @@ static int opencores_kbd_probe(struct platform_device *pdev)
}

irq = platform_get_irq(pdev, 0);
if (irq < 0) {
dev_err(&pdev->dev, "missing board IRQ resource\n");
if (irq < 0)
return -EINVAL;
}

opencores_kbd = devm_kzalloc(&pdev->dev, sizeof(*opencores_kbd),
GFP_KERNEL);
Expand Down
8 changes: 2 additions & 6 deletions drivers/input/keyboard/pmic8xxx-keypad.c
Original file line number Diff line number Diff line change
Expand Up @@ -544,16 +544,12 @@ static int pmic8xxx_kp_probe(struct platform_device *pdev)
}

kp->key_sense_irq = platform_get_irq(pdev, 0);
if (kp->key_sense_irq < 0) {
dev_err(&pdev->dev, "unable to get keypad sense irq\n");
if (kp->key_sense_irq < 0)
return kp->key_sense_irq;
}

kp->key_stuck_irq = platform_get_irq(pdev, 1);
if (kp->key_stuck_irq < 0) {
dev_err(&pdev->dev, "unable to get keypad stuck irq\n");
if (kp->key_stuck_irq < 0)
return kp->key_stuck_irq;
}

kp->input->name = "PMIC8XXX keypad";
kp->input->phys = "pmic8xxx_keypad/input0";
Expand Down
4 changes: 1 addition & 3 deletions drivers/input/keyboard/pxa27x_keypad.c
Original file line number Diff line number Diff line change
Expand Up @@ -727,10 +727,8 @@ static int pxa27x_keypad_probe(struct platform_device *pdev)
return -EINVAL;

irq = platform_get_irq(pdev, 0);
if (irq < 0) {
dev_err(&pdev->dev, "failed to get keypad irq\n");
if (irq < 0)
return -ENXIO;
}

res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (res == NULL) {
Expand Down
4 changes: 1 addition & 3 deletions drivers/input/keyboard/pxa930_rotary.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,8 @@ static int pxa930_rotary_probe(struct platform_device *pdev)
int err;

irq = platform_get_irq(pdev, 0);
if (irq < 0) {
dev_err(&pdev->dev, "no irq for rotary controller\n");
if (irq < 0)
return -ENXIO;
}

res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res) {
Expand Down
4 changes: 1 addition & 3 deletions drivers/input/keyboard/sh_keysc.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,8 @@ static int sh_keysc_probe(struct platform_device *pdev)
}

irq = platform_get_irq(pdev, 0);
if (irq < 0) {
dev_err(&pdev->dev, "failed to get irq\n");
if (irq < 0)
goto err0;
}

priv = kzalloc(sizeof(*priv), GFP_KERNEL);
if (priv == NULL) {
Expand Down
4 changes: 1 addition & 3 deletions drivers/input/keyboard/snvs_pwrkey.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,8 @@ static int imx_snvs_pwrkey_probe(struct platform_device *pdev)
pdata->wakeup = of_property_read_bool(np, "wakeup-source");

pdata->irq = platform_get_irq(pdev, 0);
if (pdata->irq < 0) {
dev_err(&pdev->dev, "no irq defined in platform data\n");
if (pdata->irq < 0)
return -EINVAL;
}

regmap_update_bits(pdata->snvs, SNVS_LPCR_REG, SNVS_LPCR_DEP_EN, SNVS_LPCR_DEP_EN);

Expand Down
4 changes: 1 addition & 3 deletions drivers/input/keyboard/spear-keyboard.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,8 @@ static int spear_kbd_probe(struct platform_device *pdev)
int error;

irq = platform_get_irq(pdev, 0);
if (irq < 0) {
dev_err(&pdev->dev, "not able to get irq for the device\n");
if (irq < 0)
return irq;
}

kbd = devm_kzalloc(&pdev->dev, sizeof(*kbd), GFP_KERNEL);
if (!kbd) {
Expand Down
4 changes: 1 addition & 3 deletions drivers/input/keyboard/st-keyscan.c
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,8 @@ static int keyscan_probe(struct platform_device *pdev)
keyscan_stop(keypad_data);

keypad_data->irq = platform_get_irq(pdev, 0);
if (keypad_data->irq < 0) {
dev_err(&pdev->dev, "no IRQ specified\n");
if (keypad_data->irq < 0)
return -EINVAL;
}

error = devm_request_irq(&pdev->dev, keypad_data->irq, keyscan_isr, 0,
pdev->name, keypad_data);
Expand Down
4 changes: 1 addition & 3 deletions drivers/input/keyboard/tegra-kbc.c
Original file line number Diff line number Diff line change
Expand Up @@ -631,10 +631,8 @@ static int tegra_kbc_probe(struct platform_device *pdev)
return -EINVAL;

kbc->irq = platform_get_irq(pdev, 0);
if (kbc->irq < 0) {
dev_err(&pdev->dev, "failed to get keyboard IRQ\n");
if (kbc->irq < 0)
return -ENXIO;
}

kbc->idev = devm_input_allocate_device(&pdev->dev);
if (!kbc->idev) {
Expand Down
1 change: 0 additions & 1 deletion drivers/input/misc/88pm80x_onkey.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ static int pm80x_onkey_probe(struct platform_device *pdev)

info->irq = platform_get_irq(pdev, 0);
if (info->irq < 0) {
dev_err(&pdev->dev, "No IRQ resource!\n");
err = -EINVAL;
goto out;
}
Expand Down
4 changes: 1 addition & 3 deletions drivers/input/misc/88pm860x_onkey.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,8 @@ static int pm860x_onkey_probe(struct platform_device *pdev)
int irq, ret;

irq = platform_get_irq(pdev, 0);
if (irq < 0) {
dev_err(&pdev->dev, "No IRQ resource!\n");
if (irq < 0)
return -EINVAL;
}

info = devm_kzalloc(&pdev->dev, sizeof(struct pm860x_onkey_info),
GFP_KERNEL);
Expand Down
8 changes: 2 additions & 6 deletions drivers/input/misc/ab8500-ponkey.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,12 @@ static int ab8500_ponkey_probe(struct platform_device *pdev)
int error;

irq_dbf = platform_get_irq_byname(pdev, "ONKEY_DBF");
if (irq_dbf < 0) {
dev_err(&pdev->dev, "No IRQ for ONKEY_DBF, error=%d\n", irq_dbf);
if (irq_dbf < 0)
return irq_dbf;
}

irq_dbr = platform_get_irq_byname(pdev, "ONKEY_DBR");
if (irq_dbr < 0) {
dev_err(&pdev->dev, "No IRQ for ONKEY_DBR, error=%d\n", irq_dbr);
if (irq_dbr < 0)
return irq_dbr;
}

ponkey = devm_kzalloc(&pdev->dev, sizeof(struct ab8500_ponkey),
GFP_KERNEL);
Expand Down
10 changes: 2 additions & 8 deletions drivers/input/misc/axp20x-pek.c
Original file line number Diff line number Diff line change
Expand Up @@ -229,20 +229,14 @@ static int axp20x_pek_probe_input_device(struct axp20x_pek *axp20x_pek,
int error;

axp20x_pek->irq_dbr = platform_get_irq_byname(pdev, "PEK_DBR");
if (axp20x_pek->irq_dbr < 0) {
dev_err(&pdev->dev, "No IRQ for PEK_DBR, error=%d\n",
axp20x_pek->irq_dbr);
if (axp20x_pek->irq_dbr < 0)
return axp20x_pek->irq_dbr;
}
axp20x_pek->irq_dbr = regmap_irq_get_virq(axp20x->regmap_irqc,
axp20x_pek->irq_dbr);

axp20x_pek->irq_dbf = platform_get_irq_byname(pdev, "PEK_DBF");
if (axp20x_pek->irq_dbf < 0) {
dev_err(&pdev->dev, "No IRQ for PEK_DBF, error=%d\n",
axp20x_pek->irq_dbf);
if (axp20x_pek->irq_dbf < 0)
return axp20x_pek->irq_dbf;
}
axp20x_pek->irq_dbf = regmap_irq_get_virq(axp20x->regmap_irqc,
axp20x_pek->irq_dbf);

Expand Down
5 changes: 1 addition & 4 deletions drivers/input/misc/da9055_onkey.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,8 @@ static int da9055_onkey_probe(struct platform_device *pdev)
int irq, err;

irq = platform_get_irq_byname(pdev, "ONKEY");
if (irq < 0) {
dev_err(&pdev->dev,
"Failed to get an IRQ for input device, %d\n", irq);
if (irq < 0)
return -EINVAL;
}

onkey = devm_kzalloc(&pdev->dev, sizeof(*onkey), GFP_KERNEL);
if (!onkey) {
Expand Down
7 changes: 2 additions & 5 deletions drivers/input/misc/da9063_onkey.c
Original file line number Diff line number Diff line change
Expand Up @@ -248,11 +248,8 @@ static int da9063_onkey_probe(struct platform_device *pdev)
}

irq = platform_get_irq_byname(pdev, "ONKEY");
if (irq < 0) {
error = irq;
dev_err(&pdev->dev, "Failed to get platform IRQ: %d\n", error);
return error;
}
if (irq < 0)
return irq;

error = devm_request_threaded_irq(&pdev->dev, irq,
NULL, da9063_onkey_irq_handler,
Expand Down
10 changes: 2 additions & 8 deletions drivers/input/misc/e3x0-button.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,18 +65,12 @@ static int e3x0_button_probe(struct platform_device *pdev)
int error;

irq_press = platform_get_irq_byname(pdev, "press");
if (irq_press < 0) {
dev_err(&pdev->dev, "No IRQ for 'press', error=%d\n",
irq_press);
if (irq_press < 0)
return irq_press;
}

irq_release = platform_get_irq_byname(pdev, "release");
if (irq_release < 0) {
dev_err(&pdev->dev, "No IRQ for 'release', error=%d\n",
irq_release);
if (irq_release < 0)
return irq_release;
}

input = devm_input_allocate_device(&pdev->dev);
if (!input)
Expand Down
8 changes: 2 additions & 6 deletions drivers/input/misc/hisi_powerkey.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,8 @@ static int hi65xx_powerkey_probe(struct platform_device *pdev)
for (i = 0; i < ARRAY_SIZE(hi65xx_irq_info); i++) {

irq = platform_get_irq_byname(pdev, hi65xx_irq_info[i].name);
if (irq < 0) {
error = irq;
dev_err(dev, "couldn't get irq %s: %d\n",
hi65xx_irq_info[i].name, error);
return error;
}
if (irq < 0)
return irq;

error = devm_request_any_context_irq(dev, irq,
hi65xx_irq_info[i].handler,
Expand Down
8 changes: 2 additions & 6 deletions drivers/input/misc/max8925_onkey.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,12 @@ static int max8925_onkey_probe(struct platform_device *pdev)
int irq[2], error;

irq[0] = platform_get_irq(pdev, 0);
if (irq[0] < 0) {
dev_err(&pdev->dev, "No IRQ resource!\n");
if (irq[0] < 0)
return -EINVAL;
}

irq[1] = platform_get_irq(pdev, 1);
if (irq[1] < 0) {
dev_err(&pdev->dev, "No IRQ resource!\n");
if (irq[1] < 0)
return -EINVAL;
}

info = devm_kzalloc(&pdev->dev, sizeof(struct max8925_onkey_info),
GFP_KERNEL);
Expand Down
4 changes: 1 addition & 3 deletions drivers/input/misc/pm8941-pwrkey.c
Original file line number Diff line number Diff line change
Expand Up @@ -205,10 +205,8 @@ static int pm8941_pwrkey_probe(struct platform_device *pdev)
return error;

pwrkey->irq = platform_get_irq(pdev, 0);
if (pwrkey->irq < 0) {
dev_err(&pdev->dev, "failed to get irq\n");
if (pwrkey->irq < 0)
return pwrkey->irq;
}

error = regmap_read(pwrkey->regmap, pwrkey->baseaddr + PON_REV2,
&pwrkey->revision);
Expand Down
8 changes: 2 additions & 6 deletions drivers/input/misc/rk805-pwrkey.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,12 @@ static int rk805_pwrkey_probe(struct platform_device *pdev)
input_set_capability(pwr, EV_KEY, KEY_POWER);

fall_irq = platform_get_irq(pdev, 0);
if (fall_irq < 0) {
dev_err(&pdev->dev, "Can't get fall irq: %d\n", fall_irq);
if (fall_irq < 0)
return fall_irq;
}

rise_irq = platform_get_irq(pdev, 1);
if (rise_irq < 0) {
dev_err(&pdev->dev, "Can't get rise irq: %d\n", rise_irq);
if (rise_irq < 0)
return rise_irq;
}

err = devm_request_any_context_irq(&pwr->dev, fall_irq,
pwrkey_fall_irq,
Expand Down
10 changes: 2 additions & 8 deletions drivers/input/misc/stpmic1_onkey.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,18 +61,12 @@ static int stpmic1_onkey_probe(struct platform_device *pdev)
return -ENOMEM;

onkey->irq_falling = platform_get_irq_byname(pdev, "onkey-falling");
if (onkey->irq_falling < 0) {
dev_err(dev, "failed: request IRQ onkey-falling %d\n",
onkey->irq_falling);
if (onkey->irq_falling < 0)
return onkey->irq_falling;
}

onkey->irq_rising = platform_get_irq_byname(pdev, "onkey-rising");
if (onkey->irq_rising < 0) {
dev_err(dev, "failed: request IRQ onkey-rising %d\n",
onkey->irq_rising);
if (onkey->irq_rising < 0)
return onkey->irq_rising;
}

if (!device_property_read_u32(dev, "power-off-time-sec", &val)) {
if (val > 0 && val <= 16) {
Expand Down
4 changes: 1 addition & 3 deletions drivers/input/misc/tps65218-pwrbutton.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,8 @@ static int tps6521x_pb_probe(struct platform_device *pdev)
device_init_wakeup(dev, true);

irq = platform_get_irq(pdev, 0);
if (irq < 0) {
dev_err(dev, "No IRQ resource!\n");
if (irq < 0)
return -EINVAL;
}

error = devm_request_threaded_irq(dev, irq, NULL, tps6521x_pb_irq,
IRQF_TRIGGER_RISING |
Expand Down
Loading

0 comments on commit 0bec8b7

Please sign in to comment.