Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1562000 > unrolled thread

[PATCH 00/33] Input: Automated coccinelle cleanup

Started byGuenter Roeck <linux@roeck-us.net>
First post2017-01-18 18:50 +0100
Last post2017-01-19 10:20 +0100
Articles 20 on this page of 54 — 4 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 00/33] Input: Automated coccinelle cleanup Guenter Roeck <linux@roeck-us.net> - 2017-01-18 18:50 +0100
    [PATCH 02/33] Input: bcm-keypad - Drop unnecessary call to platform_set_drvdata and other changes Guenter Roeck <linux@roeck-us.net> - 2017-01-18 18:50 +0100
    [PATCH 29/33] Input: melfas_mip4 - Use devm_add_action_or_reset and other changes Guenter Roeck <linux@roeck-us.net> - 2017-01-18 18:50 +0100
      Re: [PATCH 29/33] Input: melfas_mip4 - Use devm_add_action_or_reset  and other changes Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2017-01-18 20:30 +0100
    [PATCH 04/33] Input: cros_ec_keyb - Drop unnecessary call to dev_set_drvdata and other changes Guenter Roeck <linux@roeck-us.net> - 2017-01-18 18:50 +0100
      Re: [PATCH 04/33] Input: cros_ec_keyb - Drop unnecessary call to  dev_set_drvdata and other changes Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2017-01-18 19:40 +0100
    [PATCH 23/33] Input: xilinx_ps2 - Use 'dev' instead of dereferencing it and other changes Guenter Roeck <linux@roeck-us.net> - 2017-01-18 19:00 +0100
      Re: [PATCH 23/33] Input: xilinx_ps2 - Use 'dev' instead of  dereferencing it and other changes Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2017-01-18 20:30 +0100
    [PATCH 12/33] Input: axp20x-pek - Use devm_add_action_or_reset and other changes Guenter Roeck <linux@roeck-us.net> - 2017-01-18 19:00 +0100
    [PATCH 20/33] Input: elan_i2c_core - Use 'dev' instead of dereferencing it and other changes Guenter Roeck <linux@roeck-us.net> - 2017-01-18 19:00 +0100
    [PATCH 22/33] Input: at32psif - Drop unnecessary error messages and other changes Guenter Roeck <linux@roeck-us.net> - 2017-01-18 19:00 +0100
      Re: [PATCH 22/33] Input: at32psif - Drop unnecessary error messages  and other changes Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2017-01-18 20:20 +0100
    [PATCH 10/33] Input: twl4030_keypad - Drop unnecessary call to platform_set_drvdata and other changes Guenter Roeck <linux@roeck-us.net> - 2017-01-18 19:00 +0100
      Re: [PATCH 10/33] Input: twl4030_keypad - Drop unnecessary call to  platform_set_drvdata and other changes Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2017-01-18 20:50 +0100
    [PATCH 14/33] Input: gpio_decoder - Drop unnecessary call to platform_set_drvdata and other changes Guenter Roeck <linux@roeck-us.net> - 2017-01-18 19:00 +0100
      Re: [PATCH 14/33] Input: gpio_decoder - Drop unnecessary call to  platform_set_drvdata and other changes Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2017-01-18 20:50 +0100
    [PATCH 15/33] Input: kxtj9 - Drop unnecessary error messages and other changes Guenter Roeck <linux@roeck-us.net> - 2017-01-18 19:00 +0100
    [PATCH 27/33] Input: eeti_ts - Drop unnecessary error messages and other changes Guenter Roeck <linux@roeck-us.net> - 2017-01-18 19:00 +0100
      Re: [PATCH 27/33] Input: eeti_ts - Drop unnecessary error messages  and other changes Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2017-01-18 20:30 +0100
    [PATCH 08/33] Input: spear-keyboard - Drop unnecessary error messages and other changes Guenter Roeck <linux@roeck-us.net> - 2017-01-18 19:00 +0100
      Re: [PATCH 08/33] Input: spear-keyboard - Drop unnecessary error  messages and other changes Viresh Kumar <viresh.kumar@linaro.org> - 2017-01-19 05:00 +0100
    [PATCH 19/33] Input: tps65218-pwrbutton - Drop unnecessary call to platform_set_drvdata and other changes Guenter Roeck <linux@roeck-us.net> - 2017-01-18 19:00 +0100
      Re: [PATCH 19/33] Input: tps65218-pwrbutton - Drop unnecessary call  to platform_set_drvdata and other changes Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2017-01-18 20:50 +0100
    [PATCH 07/33] Input: sh_keysc - Drop unnecessary error messages and other changes Guenter Roeck <linux@roeck-us.net> - 2017-01-18 19:00 +0100
    [PATCH 28/33] Input: egalax_ts - Drop unnecessary call to i2c_set_clientdata and other changes Guenter Roeck <linux@roeck-us.net> - 2017-01-18 19:00 +0100
      Re: [PATCH 28/33] Input: egalax_ts - Drop unnecessary call to  i2c_set_clientdata and other changes Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2017-01-18 20:40 +0100
        Re: [PATCH 28/33] Input: egalax_ts - Drop unnecessary call to  i2c_set_clientdata and other changes Guenter Roeck <linux@roeck-us.net> - 2017-01-18 21:40 +0100
    [PATCH 11/33] Input: ab8500-ponkey - Drop unnecessary call to platform_set_drvdata and other changes Guenter Roeck <linux@roeck-us.net> - 2017-01-18 19:00 +0100
      Re: [PATCH 11/33] Input: ab8500-ponkey - Drop unnecessary call to  platform_set_drvdata and other changes Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2017-01-18 20:50 +0100
    [PATCH 17/33] Input: retu-pwrbutton - Simplify error return and other changes Guenter Roeck <linux@roeck-us.net> - 2017-01-18 19:00 +0100
    [PATCH 13/33] Input: bfin_rotary - Use 'dev' instead of dereferencing it and other changes Guenter Roeck <linux@roeck-us.net> - 2017-01-18 19:00 +0100
      Re: [PATCH 13/33] Input: bfin_rotary - Use 'dev' instead of  dereferencing it and other changes Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2017-01-18 20:50 +0100
        Re: [PATCH 13/33] Input: bfin_rotary - Use 'dev' instead of  dereferencing it and other changes Guenter Roeck <linux@roeck-us.net> - 2017-01-18 21:40 +0100
          Re: [PATCH 13/33] Input: bfin_rotary - Use 'dev' instead of  dereferencing it and other changes Joe Perches <joe@perches.com> - 2017-01-19 06:10 +0100
            Re: [PATCH 13/33] Input: bfin_rotary - Use 'dev' instead of  dereferencing it and other changes Guenter Roeck <linux@roeck-us.net> - 2017-01-19 09:30 +0100
    [PATCH 25/33] Input: atmel-wm97xx - Drop unnecessary error messages and other changes Guenter Roeck <linux@roeck-us.net> - 2017-01-18 19:00 +0100
      Re: [PATCH 25/33] Input: atmel-wm97xx - Drop unnecessary error  messages and other changes Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2017-01-18 20:30 +0100
    [PATCH 09/33] Input: sun4i-lradc-keys - Drop unnecessary call to platform_set_drvdata and other changes Guenter Roeck <linux@roeck-us.net> - 2017-01-18 19:00 +0100
    [PATCH 16/33] Input: mma8450 - Drop unnecessary call to i2c_set_clientdata and other changes Guenter Roeck <linux@roeck-us.net> - 2017-01-18 19:00 +0100
      Re: [PATCH 16/33] Input: mma8450 - Drop unnecessary call to  i2c_set_clientdata and other changes Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2017-01-18 20:50 +0100
    [PATCH 18/33] Input: soc_button_array - Use 'dev' instead of dereferencing it and other changes Guenter Roeck <linux@roeck-us.net> - 2017-01-18 19:00 +0100
      Re: [PATCH 18/33] Input: soc_button_array - Use 'dev' instead of  dereferencing it and other changes Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2017-01-18 20:50 +0100
    [PATCH 26/33] Input: atmel_mxt_ts - Drop unnecessary error messages and other changes Guenter Roeck <linux@roeck-us.net> - 2017-01-18 19:00 +0100
    [PATCH 24/33] Input: ar1021_i2c - Drop unnecessary call to i2c_set_clientdata and other changes Guenter Roeck <linux@roeck-us.net> - 2017-01-18 19:00 +0100
      Re: [PATCH 24/33] Input: ar1021_i2c - Drop unnecessary call to  i2c_set_clientdata and other changes Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2017-01-18 20:30 +0100
    [PATCH 32/33] Input: sis_i2c - Drop unnecessary call to i2c_set_clientdata and other changes Guenter Roeck <linux@roeck-us.net> - 2017-01-18 21:40 +0100
      Re: [PATCH 32/33] Input: sis_i2c - Drop unnecessary call to  i2c_set_clientdata and other changes Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2017-01-18 23:30 +0100
    [PATCH 33/33] Input: sx8654 - Drop unnecessary call to i2c_set_clientdata and other changes Guenter Roeck <linux@roeck-us.net> - 2017-01-18 21:40 +0100
    [PATCH 31/33] Input: rohm_bu21023 - Use 'dev' instead of dereferencing it and other changes Guenter Roeck <linux@roeck-us.net> - 2017-01-18 21:40 +0100
    [PATCH 30/33] Input: raydium_i2c_ts - Simplify error return and other changes Guenter Roeck <linux@roeck-us.net> - 2017-01-18 21:40 +0100
    Re: [PATCH 00/33] Input: Automated coccinelle cleanup Joe Perches <joe@perches.com> - 2017-01-19 02:50 +0100
      Re: [PATCH 00/33] Input: Automated coccinelle cleanup Guenter Roeck <linux@roeck-us.net> - 2017-01-19 06:10 +0100
        Re: [PATCH 00/33] Input: Automated coccinelle cleanup Joe Perches <joe@perches.com> - 2017-01-19 06:10 +0100
          Re: [PATCH 00/33] Input: Automated coccinelle cleanup Guenter Roeck <linux@roeck-us.net> - 2017-01-19 10:20 +0100

Page 2 of 3 — ← Prev page 1 [2] 3  Next page →


#1562410 — Re: [PATCH 08/33] Input: spear-keyboard - Drop unnecessary error messages and other changes

FromViresh Kumar <viresh.kumar@linaro.org>
Date2017-01-19 05:00 +0100
SubjectRe: [PATCH 08/33] Input: spear-keyboard - Drop unnecessary error messages and other changes
Message-ID<t1c3g-4Dh-11@gated-at.bofh.it>
In reply to#1562016
On Wed, Jan 18, 2017 at 11:16 PM, Guenter Roeck <linux@roeck-us.net> wrote:
> Error messages after memory allocation failures are unnecessary and
> can be dropped.
>
> This conversion was done automatically with coccinelle using the
> following semantic patches. The semantic patches and the scripts
> used to generate this commit log are available at
> https://github.com/groeck/coccinelle-patches
>
> - Drop unnecessary braces around conditional return statements
> - Drop error message after devm_kzalloc() failure
>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> ---
>  drivers/input/keyboard/spear-keyboard.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)

Acked-by: Viresh Kumar <viresh.kumar@linaro.org>

[toc] | [prev] | [next] | [standalone]


#1562017 — [PATCH 19/33] Input: tps65218-pwrbutton - Drop unnecessary call to platform_set_drvdata and other changes

FromGuenter Roeck <linux@roeck-us.net>
Date2017-01-18 19:00 +0100
Subject[PATCH 19/33] Input: tps65218-pwrbutton - Drop unnecessary call to platform_set_drvdata and other changes
Message-ID<t12GD-76Z-33@gated-at.bofh.it>
In reply to#1562000
There is no call to platform_get_drvdata() or dev_get_drvdata().
Drop the unnecessary call to platform_set_drvdata().
Other relevant changes:
  Use existing variable 'dev' instead of dereferencing it several times

This conversion was done automatically with coccinelle using the
following semantic patches. The semantic patches and the scripts
used to generate this commit log are available at
https://github.com/groeck/coccinelle-patches

- Replace 'goto l; ... l: return e;' with 'return e;'
- Drop platform_set_drvdata()
- Use local variable 'struct device *dev' consistently

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
 drivers/input/misc/tps65218-pwrbutton.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/input/misc/tps65218-pwrbutton.c b/drivers/input/misc/tps65218-pwrbutton.c
index cc74a41bdb0d..33f48a622fc6 100644
--- a/drivers/input/misc/tps65218-pwrbutton.c
+++ b/drivers/input/misc/tps65218-pwrbutton.c
@@ -70,7 +70,7 @@ static irqreturn_t tps6521x_pb_irq(int irq, void *_pwr)
 	error = regmap_read(pwr->regmap, tps_data->reg_status, &reg);
 	if (error) {
 		dev_err(pwr->dev, "can't read register: %d\n", error);
-		goto out;
+		return IRQ_HANDLED;
 	}
 
 	if (reg & tps_data->pb_mask) {
@@ -82,7 +82,6 @@ static irqreturn_t tps6521x_pb_irq(int irq, void *_pwr)
 
 	input_sync(pwr->idev);
 
-out:
 	return IRQ_HANDLED;
 }
 
@@ -95,7 +94,7 @@ static int tps6521x_pb_probe(struct platform_device *pdev)
 	int error;
 	int irq;
 
-	match = of_match_node(of_tps6521x_pb_match, pdev->dev.of_node);
+	match = of_match_node(of_tps6521x_pb_match, dev->of_node);
 	if (!match)
 		return -ENXIO;
 
@@ -118,10 +117,9 @@ static int tps6521x_pb_probe(struct platform_device *pdev)
 
 	input_set_capability(idev, EV_KEY, KEY_POWER);
 
-	pwr->regmap = dev_get_regmap(pdev->dev.parent, NULL);
+	pwr->regmap = dev_get_regmap(dev->parent, NULL);
 	pwr->dev = dev;
 	pwr->idev = idev;
-	platform_set_drvdata(pdev, pwr);
 	device_init_wakeup(dev, true);
 
 	irq = platform_get_irq(pdev, 0);
@@ -136,8 +134,7 @@ static int tps6521x_pb_probe(struct platform_device *pdev)
 						IRQF_ONESHOT,
 					  pwr->data->name, pwr);
 	if (error) {
-		dev_err(dev, "failed to request IRQ #%d: %d\n",
-			irq, error);
+		dev_err(dev, "failed to request IRQ #%d: %d\n", irq, error);
 		return error;
 	}
 
-- 
2.7.4

[toc] | [prev] | [next] | [standalone]


#1562118 — Re: [PATCH 19/33] Input: tps65218-pwrbutton - Drop unnecessary call to platform_set_drvdata and other changes

FromDmitry Torokhov <dmitry.torokhov@gmail.com>
Date2017-01-18 20:50 +0100
SubjectRe: [PATCH 19/33] Input: tps65218-pwrbutton - Drop unnecessary call to platform_set_drvdata and other changes
Message-ID<t14p5-8e2-29@gated-at.bofh.it>
In reply to#1562017
On Wed, Jan 18, 2017 at 09:46:40AM -0800, Guenter Roeck wrote:
> There is no call to platform_get_drvdata() or dev_get_drvdata().
> Drop the unnecessary call to platform_set_drvdata().
> Other relevant changes:
>   Use existing variable 'dev' instead of dereferencing it several times
> 
> This conversion was done automatically with coccinelle using the
> following semantic patches. The semantic patches and the scripts
> used to generate this commit log are available at
> https://github.com/groeck/coccinelle-patches
> 
> - Replace 'goto l; ... l: return e;' with 'return e;'
> - Drop platform_set_drvdata()
> - Use local variable 'struct device *dev' consistently
> 
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> ---
>  drivers/input/misc/tps65218-pwrbutton.c | 11 ++++-------
>  1 file changed, 4 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/input/misc/tps65218-pwrbutton.c b/drivers/input/misc/tps65218-pwrbutton.c
> index cc74a41bdb0d..33f48a622fc6 100644
> --- a/drivers/input/misc/tps65218-pwrbutton.c
> +++ b/drivers/input/misc/tps65218-pwrbutton.c
> @@ -70,7 +70,7 @@ static irqreturn_t tps6521x_pb_irq(int irq, void *_pwr)
>  	error = regmap_read(pwr->regmap, tps_data->reg_status, &reg);
>  	if (error) {
>  		dev_err(pwr->dev, "can't read register: %d\n", error);
> -		goto out;
> +		return IRQ_HANDLED;
>  	}
>  
>  	if (reg & tps_data->pb_mask) {
> @@ -82,7 +82,6 @@ static irqreturn_t tps6521x_pb_irq(int irq, void *_pwr)
>  
>  	input_sync(pwr->idev);
>  
> -out:
>  	return IRQ_HANDLED;
>  }

Applied except for the above chunks, thank you.

>  
> @@ -95,7 +94,7 @@ static int tps6521x_pb_probe(struct platform_device *pdev)
>  	int error;
>  	int irq;
>  
> -	match = of_match_node(of_tps6521x_pb_match, pdev->dev.of_node);
> +	match = of_match_node(of_tps6521x_pb_match, dev->of_node);
>  	if (!match)
>  		return -ENXIO;
>  
> @@ -118,10 +117,9 @@ static int tps6521x_pb_probe(struct platform_device *pdev)
>  
>  	input_set_capability(idev, EV_KEY, KEY_POWER);
>  
> -	pwr->regmap = dev_get_regmap(pdev->dev.parent, NULL);
> +	pwr->regmap = dev_get_regmap(dev->parent, NULL);
>  	pwr->dev = dev;
>  	pwr->idev = idev;
> -	platform_set_drvdata(pdev, pwr);
>  	device_init_wakeup(dev, true);
>  
>  	irq = platform_get_irq(pdev, 0);
> @@ -136,8 +134,7 @@ static int tps6521x_pb_probe(struct platform_device *pdev)
>  						IRQF_ONESHOT,
>  					  pwr->data->name, pwr);
>  	if (error) {
> -		dev_err(dev, "failed to request IRQ #%d: %d\n",
> -			irq, error);
> +		dev_err(dev, "failed to request IRQ #%d: %d\n", irq, error);
>  		return error;
>  	}
>  
> -- 
> 2.7.4
> 

-- 
Dmitry

[toc] | [prev] | [next] | [standalone]


#1562018 — [PATCH 07/33] Input: sh_keysc - Drop unnecessary error messages and other changes

FromGuenter Roeck <linux@roeck-us.net>
Date2017-01-18 19:00 +0100
Subject[PATCH 07/33] Input: sh_keysc - Drop unnecessary error messages and other changes
Message-ID<t12GC-76Z-31@gated-at.bofh.it>
In reply to#1562000
Error messages after memory allocation failures are unnecessary and
can be dropped.

This conversion was done automatically with coccinelle using the
following semantic patches. The semantic patches and the scripts
used to generate this commit log are available at
https://github.com/groeck/coccinelle-patches

- Drop unnecessary braces around conditional return statements
- Drop error message after devm_kzalloc() failure
- Replace 'goto l; ... l: return e;' with 'return e;'
- Replace 'val = e; return val;' with 'return e;'

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
 drivers/input/keyboard/sh_keysc.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/drivers/input/keyboard/sh_keysc.c b/drivers/input/keyboard/sh_keysc.c
index 7abf03b4cc9c..63ea707df193 100644
--- a/drivers/input/keyboard/sh_keysc.c
+++ b/drivers/input/keyboard/sh_keysc.c
@@ -172,29 +172,25 @@ static int sh_keysc_probe(struct platform_device *pdev)
 
 	if (!dev_get_platdata(&pdev->dev)) {
 		dev_err(&pdev->dev, "no platform data defined\n");
-		error = -EINVAL;
-		goto err0;
+		return -EINVAL;
 	}
 
 	error = -ENXIO;
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	if (res == NULL) {
 		dev_err(&pdev->dev, "failed to get I/O memory\n");
-		goto err0;
+		return error;
 	}
 
 	irq = platform_get_irq(pdev, 0);
 	if (irq < 0) {
 		dev_err(&pdev->dev, "failed to get irq\n");
-		goto err0;
+		return error;
 	}
 
 	priv = kzalloc(sizeof(*priv), GFP_KERNEL);
-	if (priv == NULL) {
-		dev_err(&pdev->dev, "failed to allocate driver data\n");
-		error = -ENOMEM;
-		goto err0;
-	}
+	if (priv == NULL)
+		return -ENOMEM;
 
 	platform_set_drvdata(pdev, priv);
 	memcpy(&priv->pdata, dev_get_platdata(&pdev->dev), sizeof(priv->pdata));
@@ -266,7 +262,6 @@ static int sh_keysc_probe(struct platform_device *pdev)
 	iounmap(priv->iomem_base);
  err1:
 	kfree(priv);
- err0:
 	return error;
 }
 
-- 
2.7.4

[toc] | [prev] | [next] | [standalone]


#1562019 — [PATCH 28/33] Input: egalax_ts - Drop unnecessary call to i2c_set_clientdata and other changes

FromGuenter Roeck <linux@roeck-us.net>
Date2017-01-18 19:00 +0100
Subject[PATCH 28/33] Input: egalax_ts - Drop unnecessary call to i2c_set_clientdata and other changes
Message-ID<t12GD-76Z-35@gated-at.bofh.it>
In reply to#1562000
There is no call to i2c_get_clientdata() or dev_get_drvdata().
Drop the unnecessary call to i2c_set_clientdata().
Other relevant changes:
  Simplify error return
  Drop error messages after memory allocation failures

This conversion was done automatically with coccinelle using the
following semantic patches. The semantic patches and the scripts
used to generate this commit log are available at
https://github.com/groeck/coccinelle-patches

- Drop unused variables
- Drop unnecessary braces around conditional return statements
- Drop error message after devm_kzalloc() failure
- Replace 'if (e) return e; return 0;' with 'return e;'
- Drop i2c_set_clientdata()

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
 drivers/input/touchscreen/egalax_ts.c | 21 ++++-----------------
 1 file changed, 4 insertions(+), 17 deletions(-)

diff --git a/drivers/input/touchscreen/egalax_ts.c b/drivers/input/touchscreen/egalax_ts.c
index 1afc08b08155..05ba1a6dc7fc 100644
--- a/drivers/input/touchscreen/egalax_ts.c
+++ b/drivers/input/touchscreen/egalax_ts.c
@@ -82,10 +82,9 @@ static irqreturn_t egalax_ts_interrupt(int irq, void *dev_id)
 	if (ret < 0)
 		return IRQ_HANDLED;
 
-	if (buf[0] != REPORT_MODE_MTTOUCH) {
+	if (buf[0] != REPORT_MODE_MTTOUCH)
 		/* ignore mouse events and vendor events */
 		return IRQ_HANDLED;
-	}
 
 	state = buf[1];
 	x = (buf[3] << 8) | buf[2];
@@ -155,13 +154,8 @@ static int egalax_wake_up_device(struct i2c_client *client)
 static int egalax_firmware_version(struct i2c_client *client)
 {
 	static const u8 cmd[MAX_I2C_DATA_LEN] = { 0x03, 0x03, 0xa, 0x01, 0x41 };
-	int ret;
-
-	ret = i2c_master_send(client, cmd, MAX_I2C_DATA_LEN);
-	if (ret < 0)
-		return ret;
 
-	return 0;
+	return i2c_master_send(client, cmd, MAX_I2C_DATA_LEN);
 }
 
 static int egalax_ts_probe(struct i2c_client *client,
@@ -172,10 +166,8 @@ static int egalax_ts_probe(struct i2c_client *client,
 	int error;
 
 	ts = devm_kzalloc(&client->dev, sizeof(struct egalax_ts), GFP_KERNEL);
-	if (!ts) {
-		dev_err(&client->dev, "Failed to allocate memory\n");
+	if (!ts)
 		return -ENOMEM;
-	}
 
 	input_dev = devm_input_allocate_device(&client->dev);
 	if (!input_dev) {
@@ -225,12 +217,7 @@ static int egalax_ts_probe(struct i2c_client *client,
 		return error;
 	}
 
-	error = input_register_device(ts->input_dev);
-	if (error)
-		return error;
-
-	i2c_set_clientdata(client, ts);
-	return 0;
+	return input_register_device(ts->input_dev);
 }
 
 static const struct i2c_device_id egalax_ts_id[] = {
-- 
2.7.4

[toc] | [prev] | [next] | [standalone]


#1562110 — Re: [PATCH 28/33] Input: egalax_ts - Drop unnecessary call to i2c_set_clientdata and other changes

FromDmitry Torokhov <dmitry.torokhov@gmail.com>
Date2017-01-18 20:40 +0100
SubjectRe: [PATCH 28/33] Input: egalax_ts - Drop unnecessary call to i2c_set_clientdata and other changes
Message-ID<t14fn-8aj-11@gated-at.bofh.it>
In reply to#1562019
On Wed, Jan 18, 2017 at 09:46:49AM -0800, Guenter Roeck wrote:
> There is no call to i2c_get_clientdata() or dev_get_drvdata().
> Drop the unnecessary call to i2c_set_clientdata().
> Other relevant changes:
>   Simplify error return
>   Drop error messages after memory allocation failures
> 
> This conversion was done automatically with coccinelle using the
> following semantic patches. The semantic patches and the scripts
> used to generate this commit log are available at
> https://github.com/groeck/coccinelle-patches
> 
> - Drop unused variables
> - Drop unnecessary braces around conditional return statements
> - Drop error message after devm_kzalloc() failure
> - Replace 'if (e) return e; return 0;' with 'return e;'
> - Drop i2c_set_clientdata()
> 
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> ---
>  drivers/input/touchscreen/egalax_ts.c | 21 ++++-----------------
>  1 file changed, 4 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/input/touchscreen/egalax_ts.c b/drivers/input/touchscreen/egalax_ts.c
> index 1afc08b08155..05ba1a6dc7fc 100644
> --- a/drivers/input/touchscreen/egalax_ts.c
> +++ b/drivers/input/touchscreen/egalax_ts.c
> @@ -82,10 +82,9 @@ static irqreturn_t egalax_ts_interrupt(int irq, void *dev_id)
>  	if (ret < 0)
>  		return IRQ_HANDLED;
>  
> -	if (buf[0] != REPORT_MODE_MTTOUCH) {
> +	if (buf[0] != REPORT_MODE_MTTOUCH)
>  		/* ignore mouse events and vendor events */
>  		return IRQ_HANDLED;
> -	}

These are not unnecessary braces, as there are more than 1 line. I.e.
comments are counted along statements, at least by myself. Also, if
there is a single statement spanning several lines I also prefer to have
braces around it.

>  
>  	state = buf[1];
>  	x = (buf[3] << 8) | buf[2];
> @@ -155,13 +154,8 @@ static int egalax_wake_up_device(struct i2c_client *client)
>  static int egalax_firmware_version(struct i2c_client *client)
>  {
>  	static const u8 cmd[MAX_I2C_DATA_LEN] = { 0x03, 0x03, 0xa, 0x01, 0x41 };
> -	int ret;
> -
> -	ret = i2c_master_send(client, cmd, MAX_I2C_DATA_LEN);
> -	if (ret < 0)
> -		return ret;
>  
> -	return 0;
> +	return i2c_master_send(client, cmd, MAX_I2C_DATA_LEN);

This is not an equivalent transformation, as now callers need to check
for negative return value instead of non-zero. i2c_master_send() returns
number of bytes written on success.

>  }
>  
>  static int egalax_ts_probe(struct i2c_client *client,
> @@ -172,10 +166,8 @@ static int egalax_ts_probe(struct i2c_client *client,
>  	int error;
>  
>  	ts = devm_kzalloc(&client->dev, sizeof(struct egalax_ts), GFP_KERNEL);
> -	if (!ts) {
> -		dev_err(&client->dev, "Failed to allocate memory\n");
> +	if (!ts)
>  		return -ENOMEM;
> -	}
>  
>  	input_dev = devm_input_allocate_device(&client->dev);
>  	if (!input_dev) {
> @@ -225,12 +217,7 @@ static int egalax_ts_probe(struct i2c_client *client,
>  		return error;
>  	}
>  
> -	error = input_register_device(ts->input_dev);
> -	if (error)
> -		return error;
> -
> -	i2c_set_clientdata(client, ts);
> -	return 0;
> +	return input_register_device(ts->input_dev);
>  }
>  
>  static const struct i2c_device_id egalax_ts_id[] = {
> -- 
> 2.7.4
> 

Thanks.

-- 
Dmitry

[toc] | [prev] | [next] | [standalone]


#1562146 — Re: [PATCH 28/33] Input: egalax_ts - Drop unnecessary call to i2c_set_clientdata and other changes

FromGuenter Roeck <linux@roeck-us.net>
Date2017-01-18 21:40 +0100
SubjectRe: [PATCH 28/33] Input: egalax_ts - Drop unnecessary call to i2c_set_clientdata and other changes
Message-ID<t15bs-o6-25@gated-at.bofh.it>
In reply to#1562110
On Wed, Jan 18, 2017 at 11:31:54AM -0800, Dmitry Torokhov wrote:
> On Wed, Jan 18, 2017 at 09:46:49AM -0800, Guenter Roeck wrote:
> > There is no call to i2c_get_clientdata() or dev_get_drvdata().
> > Drop the unnecessary call to i2c_set_clientdata().
> > Other relevant changes:
> >   Simplify error return
> >   Drop error messages after memory allocation failures
> > 
> > This conversion was done automatically with coccinelle using the
> > following semantic patches. The semantic patches and the scripts
> > used to generate this commit log are available at
> > https://github.com/groeck/coccinelle-patches
> > 
> > - Drop unused variables
> > - Drop unnecessary braces around conditional return statements
> > - Drop error message after devm_kzalloc() failure
> > - Replace 'if (e) return e; return 0;' with 'return e;'
> > - Drop i2c_set_clientdata()
> > 
> > Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> > ---
> >  drivers/input/touchscreen/egalax_ts.c | 21 ++++-----------------
> >  1 file changed, 4 insertions(+), 17 deletions(-)
> > 
> > diff --git a/drivers/input/touchscreen/egalax_ts.c b/drivers/input/touchscreen/egalax_ts.c
> > index 1afc08b08155..05ba1a6dc7fc 100644
> > --- a/drivers/input/touchscreen/egalax_ts.c
> > +++ b/drivers/input/touchscreen/egalax_ts.c
> > @@ -82,10 +82,9 @@ static irqreturn_t egalax_ts_interrupt(int irq, void *dev_id)
> >  	if (ret < 0)
> >  		return IRQ_HANDLED;
> >  
> > -	if (buf[0] != REPORT_MODE_MTTOUCH) {
> > +	if (buf[0] != REPORT_MODE_MTTOUCH)
> >  		/* ignore mouse events and vendor events */
> >  		return IRQ_HANDLED;
> > -	}
> 
> These are not unnecessary braces, as there are more than 1 line. I.e.
> comments are counted along statements, at least by myself. Also, if
> there is a single statement spanning several lines I also prefer to have
> braces around it.
> 
Makes sense, and agreed. I'll have to figure out how to tell coccinelle about
situations like this.

> >  
> >  	state = buf[1];
> >  	x = (buf[3] << 8) | buf[2];
> > @@ -155,13 +154,8 @@ static int egalax_wake_up_device(struct i2c_client *client)
> >  static int egalax_firmware_version(struct i2c_client *client)
> >  {
> >  	static const u8 cmd[MAX_I2C_DATA_LEN] = { 0x03, 0x03, 0xa, 0x01, 0x41 };
> > -	int ret;
> > -
> > -	ret = i2c_master_send(client, cmd, MAX_I2C_DATA_LEN);
> > -	if (ret < 0)
> > -		return ret;
> >  
> > -	return 0;
> > +	return i2c_master_send(client, cmd, MAX_I2C_DATA_LEN);
> 
> This is not an equivalent transformation, as now callers need to check
> for negative return value instead of non-zero. i2c_master_send() returns
> number of bytes written on success.
> 

Oops, yes. Excellent point. I am way too agressive here. Thanks for pointing
this out.

Thanks,
Guenter

[toc] | [prev] | [next] | [standalone]


#1562020 — [PATCH 11/33] Input: ab8500-ponkey - Drop unnecessary call to platform_set_drvdata and other changes

FromGuenter Roeck <linux@roeck-us.net>
Date2017-01-18 19:00 +0100
Subject[PATCH 11/33] Input: ab8500-ponkey - Drop unnecessary call to platform_set_drvdata and other changes
Message-ID<t12GD-76Z-41@gated-at.bofh.it>
In reply to#1562000
There is no call to platform_get_drvdata() or dev_get_drvdata().
Drop the unnecessary call to platform_set_drvdata().

This conversion was done automatically with coccinelle using the
following semantic patches. The semantic patches and the scripts
used to generate this commit log are available at
https://github.com/groeck/coccinelle-patches

- Drop platform_set_drvdata()

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
 drivers/input/misc/ab8500-ponkey.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/input/misc/ab8500-ponkey.c b/drivers/input/misc/ab8500-ponkey.c
index 4f5ef5bb535b..a33ed5710b15 100644
--- a/drivers/input/misc/ab8500-ponkey.c
+++ b/drivers/input/misc/ab8500-ponkey.c
@@ -109,7 +109,6 @@ static int ab8500_ponkey_probe(struct platform_device *pdev)
 		return error;
 	}
 
-	platform_set_drvdata(pdev, ponkey);
 	return 0;
 }
 
-- 
2.7.4

[toc] | [prev] | [next] | [standalone]


#1562113 — Re: [PATCH 11/33] Input: ab8500-ponkey - Drop unnecessary call to platform_set_drvdata and other changes

FromDmitry Torokhov <dmitry.torokhov@gmail.com>
Date2017-01-18 20:50 +0100
SubjectRe: [PATCH 11/33] Input: ab8500-ponkey - Drop unnecessary call to platform_set_drvdata and other changes
Message-ID<t14p4-8e2-7@gated-at.bofh.it>
In reply to#1562020
On Wed, Jan 18, 2017 at 09:46:32AM -0800, Guenter Roeck wrote:
> There is no call to platform_get_drvdata() or dev_get_drvdata().
> Drop the unnecessary call to platform_set_drvdata().
> 
> This conversion was done automatically with coccinelle using the
> following semantic patches. The semantic patches and the scripts
> used to generate this commit log are available at
> https://github.com/groeck/coccinelle-patches
> 
> - Drop platform_set_drvdata()
> 
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>

Applied, thank you.

> ---
>  drivers/input/misc/ab8500-ponkey.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/input/misc/ab8500-ponkey.c b/drivers/input/misc/ab8500-ponkey.c
> index 4f5ef5bb535b..a33ed5710b15 100644
> --- a/drivers/input/misc/ab8500-ponkey.c
> +++ b/drivers/input/misc/ab8500-ponkey.c
> @@ -109,7 +109,6 @@ static int ab8500_ponkey_probe(struct platform_device *pdev)
>  		return error;
>  	}
>  
> -	platform_set_drvdata(pdev, ponkey);
>  	return 0;
>  }
>  
> -- 
> 2.7.4
> 

-- 
Dmitry

[toc] | [prev] | [next] | [standalone]


#1562021 — [PATCH 17/33] Input: retu-pwrbutton - Simplify error return and other changes

FromGuenter Roeck <linux@roeck-us.net>
Date2017-01-18 19:00 +0100
Subject[PATCH 17/33] Input: retu-pwrbutton - Simplify error return and other changes
Message-ID<t12GD-76Z-39@gated-at.bofh.it>
In reply to#1562000
Simplify error return if the code returns anyway.
Other relevant changes:
  Drop empty remove function

This conversion was done automatically with coccinelle using the
following semantic patches. The semantic patches and the scripts
used to generate this commit log are available at
https://github.com/groeck/coccinelle-patches

- Drop empty remove function
- Replace 'if (e) return e; return 0;' with 'return e;'

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
 drivers/input/misc/retu-pwrbutton.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/input/misc/retu-pwrbutton.c b/drivers/input/misc/retu-pwrbutton.c
index 30b459b6b344..97d39a965a65 100644
--- a/drivers/input/misc/retu-pwrbutton.c
+++ b/drivers/input/misc/retu-pwrbutton.c
@@ -69,21 +69,11 @@ static int retu_pwrbutton_probe(struct platform_device *pdev)
 	if (error)
 		return error;
 
-	error = input_register_device(idev);
-	if (error)
-		return error;
-
-	return 0;
-}
-
-static int retu_pwrbutton_remove(struct platform_device *pdev)
-{
-	return 0;
+	return input_register_device(idev);
 }
 
 static struct platform_driver retu_pwrbutton_driver = {
 	.probe		= retu_pwrbutton_probe,
-	.remove		= retu_pwrbutton_remove,
 	.driver		= {
 		.name	= "retu-pwrbutton",
 	},
-- 
2.7.4

[toc] | [prev] | [next] | [standalone]


#1562022 — [PATCH 13/33] Input: bfin_rotary - Use 'dev' instead of dereferencing it and other changes

FromGuenter Roeck <linux@roeck-us.net>
Date2017-01-18 19:00 +0100
Subject[PATCH 13/33] Input: bfin_rotary - Use 'dev' instead of dereferencing it and other changes
Message-ID<t12GD-76Z-53@gated-at.bofh.it>
In reply to#1562000
Use local variable 'dev' instead of dereferencing it several times.
Other relevant changes:
  Replace devm_add_action() with devm_add_action_or_reset()

This conversion was done automatically with coccinelle using the
following semantic patches. The semantic patches and the scripts
used to generate this commit log are available at
https://github.com/groeck/coccinelle-patches

- Replace devm_add_action() followed by failure action with
  devm_add_action_or_reset()
- Drop unnecessary braces around conditional return statements
- Use local variable 'struct device *dev' consistently

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
 drivers/input/misc/bfin_rotary.c | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/drivers/input/misc/bfin_rotary.c b/drivers/input/misc/bfin_rotary.c
index a0fc18fdfc0c..9f5790c6e06b 100644
--- a/drivers/input/misc/bfin_rotary.c
+++ b/drivers/input/misc/bfin_rotary.c
@@ -141,25 +141,23 @@ static int bfin_rotary_probe(struct platform_device *pdev)
 
 	/* Basic validation */
 	if ((pdata->rotary_up_key && !pdata->rotary_down_key) ||
-	    (!pdata->rotary_up_key && pdata->rotary_down_key)) {
+	    (!pdata->rotary_up_key && pdata->rotary_down_key))
 		return -EINVAL;
-	}
 
 	if (pdata->pin_list) {
 		error = peripheral_request_list(pdata->pin_list,
-						dev_name(&pdev->dev));
+						dev_name(dev));
 		if (error) {
 			dev_err(dev, "requesting peripherals failed: %d\n",
 				error);
 			return error;
 		}
 
-		error = devm_add_action(dev, bfin_rotary_free_action,
-					pdata->pin_list);
+		error = devm_add_action_or_reset(dev, bfin_rotary_free_action,
+						 pdata->pin_list);
 		if (error) {
 			dev_err(dev, "setting cleanup action failed: %d\n",
 				error);
-			peripheral_free_list(pdata->pin_list);
 			return error;
 		}
 	}
@@ -189,7 +187,7 @@ static int bfin_rotary_probe(struct platform_device *pdev)
 
 	input->name = pdev->name;
 	input->phys = "bfin-rotary/input0";
-	input->dev.parent = &pdev->dev;
+	input->dev.parent = dev;
 
 	input_set_drvdata(input, rotary);
 
@@ -224,8 +222,8 @@ static int bfin_rotary_probe(struct platform_device *pdev)
 		return -ENOENT;
 	}
 
-	error = devm_request_irq(dev, rotary->irq, bfin_rotary_isr,
-				 0, dev_name(dev), rotary);
+	error = devm_request_irq(dev, rotary->irq, bfin_rotary_isr, 0,
+				 dev_name(dev), rotary);
 	if (error) {
 		dev_err(dev, "unable to claim irq %d; error %d\n",
 			rotary->irq, error);
@@ -239,7 +237,7 @@ static int bfin_rotary_probe(struct platform_device *pdev)
 	}
 
 	platform_set_drvdata(pdev, rotary);
-	device_init_wakeup(&pdev->dev, 1);
+	device_init_wakeup(dev, 1);
 
 	return 0;
 }
-- 
2.7.4

[toc] | [prev] | [next] | [standalone]


#1562111 — Re: [PATCH 13/33] Input: bfin_rotary - Use 'dev' instead of dereferencing it and other changes

FromDmitry Torokhov <dmitry.torokhov@gmail.com>
Date2017-01-18 20:50 +0100
SubjectRe: [PATCH 13/33] Input: bfin_rotary - Use 'dev' instead of dereferencing it and other changes
Message-ID<t14p3-8e2-1@gated-at.bofh.it>
In reply to#1562022
On Wed, Jan 18, 2017 at 09:46:34AM -0800, Guenter Roeck wrote:
> Use local variable 'dev' instead of dereferencing it several times.
> Other relevant changes:
>   Replace devm_add_action() with devm_add_action_or_reset()
> 
> This conversion was done automatically with coccinelle using the
> following semantic patches. The semantic patches and the scripts
> used to generate this commit log are available at
> https://github.com/groeck/coccinelle-patches
> 
> - Replace devm_add_action() followed by failure action with
>   devm_add_action_or_reset()
> - Drop unnecessary braces around conditional return statements
> - Use local variable 'struct device *dev' consistently
> 
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> ---
>  drivers/input/misc/bfin_rotary.c | 18 ++++++++----------
>  1 file changed, 8 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/input/misc/bfin_rotary.c b/drivers/input/misc/bfin_rotary.c
> index a0fc18fdfc0c..9f5790c6e06b 100644
> --- a/drivers/input/misc/bfin_rotary.c
> +++ b/drivers/input/misc/bfin_rotary.c
> @@ -141,25 +141,23 @@ static int bfin_rotary_probe(struct platform_device *pdev)
>  
>  	/* Basic validation */
>  	if ((pdata->rotary_up_key && !pdata->rotary_down_key) ||
> -	    (!pdata->rotary_up_key && pdata->rotary_down_key)) {
> +	    (!pdata->rotary_up_key && pdata->rotary_down_key))
>  		return -EINVAL;
> -	}

This is complex "if" statement, would prefer keep the braces.

>  
>  	if (pdata->pin_list) {
>  		error = peripheral_request_list(pdata->pin_list,
> -						dev_name(&pdev->dev));
> +						dev_name(dev));
>  		if (error) {
>  			dev_err(dev, "requesting peripherals failed: %d\n",
>  				error);
>  			return error;
>  		}
>  
> -		error = devm_add_action(dev, bfin_rotary_free_action,
> -					pdata->pin_list);
> +		error = devm_add_action_or_reset(dev, bfin_rotary_free_action,
> +						 pdata->pin_list);
>  		if (error) {
>  			dev_err(dev, "setting cleanup action failed: %d\n",
>  				error);
> -			peripheral_free_list(pdata->pin_list);
>  			return error;
>  		}
>  	}
> @@ -189,7 +187,7 @@ static int bfin_rotary_probe(struct platform_device *pdev)
>  
>  	input->name = pdev->name;
>  	input->phys = "bfin-rotary/input0";
> -	input->dev.parent = &pdev->dev;
> +	input->dev.parent = dev;
>  
>  	input_set_drvdata(input, rotary);
>  
> @@ -224,8 +222,8 @@ static int bfin_rotary_probe(struct platform_device *pdev)
>  		return -ENOENT;
>  	}
>  
> -	error = devm_request_irq(dev, rotary->irq, bfin_rotary_isr,
> -				 0, dev_name(dev), rotary);
> +	error = devm_request_irq(dev, rotary->irq, bfin_rotary_isr, 0,
> +				 dev_name(dev), rotary);

Do not see point of this change.

>  	if (error) {
>  		dev_err(dev, "unable to claim irq %d; error %d\n",
>  			rotary->irq, error);
> @@ -239,7 +237,7 @@ static int bfin_rotary_probe(struct platform_device *pdev)
>  	}
>  
>  	platform_set_drvdata(pdev, rotary);
> -	device_init_wakeup(&pdev->dev, 1);
> +	device_init_wakeup(dev, 1);
>  
>  	return 0;
>  }
> -- 
> 2.7.4
> 

Dropped the above 2 chunks and applied.

-- 
Dmitry

[toc] | [prev] | [next] | [standalone]


#1562156 — Re: [PATCH 13/33] Input: bfin_rotary - Use 'dev' instead of dereferencing it and other changes

FromGuenter Roeck <linux@roeck-us.net>
Date2017-01-18 21:40 +0100
SubjectRe: [PATCH 13/33] Input: bfin_rotary - Use 'dev' instead of dereferencing it and other changes
Message-ID<t15bs-o6-47@gated-at.bofh.it>
In reply to#1562111
On Wed, Jan 18, 2017 at 11:39:52AM -0800, Dmitry Torokhov wrote:
> On Wed, Jan 18, 2017 at 09:46:34AM -0800, Guenter Roeck wrote:
> > Use local variable 'dev' instead of dereferencing it several times.
> > Other relevant changes:
> >   Replace devm_add_action() with devm_add_action_or_reset()
> > 
> > This conversion was done automatically with coccinelle using the
> > following semantic patches. The semantic patches and the scripts
> > used to generate this commit log are available at
> > https://github.com/groeck/coccinelle-patches
> > 
> > - Replace devm_add_action() followed by failure action with
> >   devm_add_action_or_reset()
> > - Drop unnecessary braces around conditional return statements
> > - Use local variable 'struct device *dev' consistently
> > 
> > Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> > ---
> >  drivers/input/misc/bfin_rotary.c | 18 ++++++++----------
> >  1 file changed, 8 insertions(+), 10 deletions(-)
> > 
> > diff --git a/drivers/input/misc/bfin_rotary.c b/drivers/input/misc/bfin_rotary.c
> > index a0fc18fdfc0c..9f5790c6e06b 100644
> > --- a/drivers/input/misc/bfin_rotary.c
> > +++ b/drivers/input/misc/bfin_rotary.c
> > @@ -141,25 +141,23 @@ static int bfin_rotary_probe(struct platform_device *pdev)
> >  
> >  	/* Basic validation */
> >  	if ((pdata->rotary_up_key && !pdata->rotary_down_key) ||
> > -	    (!pdata->rotary_up_key && pdata->rotary_down_key)) {
> > +	    (!pdata->rotary_up_key && pdata->rotary_down_key))
> >  		return -EINVAL;
> > -	}
> 
> This is complex "if" statement, would prefer keep the braces.
> 
Agreed.

> >  
> >  	if (pdata->pin_list) {
> >  		error = peripheral_request_list(pdata->pin_list,
> > -						dev_name(&pdev->dev));
> > +						dev_name(dev));
> >  		if (error) {
> >  			dev_err(dev, "requesting peripherals failed: %d\n",
> >  				error);
> >  			return error;
> >  		}
> >  
> > -		error = devm_add_action(dev, bfin_rotary_free_action,
> > -					pdata->pin_list);
> > +		error = devm_add_action_or_reset(dev, bfin_rotary_free_action,
> > +						 pdata->pin_list);
> >  		if (error) {
> >  			dev_err(dev, "setting cleanup action failed: %d\n",
> >  				error);
> > -			peripheral_free_list(pdata->pin_list);
> >  			return error;
> >  		}
> >  	}
> > @@ -189,7 +187,7 @@ static int bfin_rotary_probe(struct platform_device *pdev)
> >  
> >  	input->name = pdev->name;
> >  	input->phys = "bfin-rotary/input0";
> > -	input->dev.parent = &pdev->dev;
> > +	input->dev.parent = dev;
> >  
> >  	input_set_drvdata(input, rotary);
> >  
> > @@ -224,8 +222,8 @@ static int bfin_rotary_probe(struct platform_device *pdev)
> >  		return -ENOENT;
> >  	}
> >  
> > -	error = devm_request_irq(dev, rotary->irq, bfin_rotary_isr,
> > -				 0, dev_name(dev), rotary);
> > +	error = devm_request_irq(dev, rotary->irq, bfin_rotary_isr, 0,
> > +				 dev_name(dev), rotary);
> 
> Do not see point of this change.
> 
Me fighting with coccinelle ;-). Diffficult to tell it to avoid non-changes
like this. I need to figure out to tell it to ...

> >  	if (error) {
> >  		dev_err(dev, "unable to claim irq %d; error %d\n",
> >  			rotary->irq, error);
> > @@ -239,7 +237,7 @@ static int bfin_rotary_probe(struct platform_device *pdev)
> >  	}
> >  
> >  	platform_set_drvdata(pdev, rotary);
> > -	device_init_wakeup(&pdev->dev, 1);
> > +	device_init_wakeup(dev, 1);

... only reformat a line when it is actually doing something on that line,
not on the entire function.

Thanks,
Guenter

[toc] | [prev] | [next] | [standalone]


#1562420 — Re: [PATCH 13/33] Input: bfin_rotary - Use 'dev' instead of dereferencing it and other changes

FromJoe Perches <joe@perches.com>
Date2017-01-19 06:10 +0100
SubjectRe: [PATCH 13/33] Input: bfin_rotary - Use 'dev' instead of dereferencing it and other changes
Message-ID<t1d8Z-5va-3@gated-at.bofh.it>
In reply to#1562156
On Wed, 2017-01-18 at 12:35 -0800, Guenter Roeck wrote:
> On Wed, Jan 18, 2017 at 11:39:52AM -0800, Dmitry Torokhov wrote:
> > On Wed, Jan 18, 2017 at 09:46:34AM -0800, Guenter Roeck wrote:
[]
> > > diff --git a/drivers/input/misc/bfin_rotary.c b/drivers/input/misc/bfin_rotary.c
[]
> > > @@ -141,25 +141,23 @@ static int bfin_rotary_probe(struct platform_device *pdev)
> > >  
> > >  	/* Basic validation */
> > >  	if ((pdata->rotary_up_key && !pdata->rotary_down_key) ||
> > > -	    (!pdata->rotary_up_key && pdata->rotary_down_key)) {
> > > +	    (!pdata->rotary_up_key && pdata->rotary_down_key))

maybe just use ^ 

	if (!pdata->rotary_up_key ^ !pdata->rotary_down_key)

[toc] | [prev] | [next] | [standalone]


#1562465 — Re: [PATCH 13/33] Input: bfin_rotary - Use 'dev' instead of dereferencing it and other changes

FromGuenter Roeck <linux@roeck-us.net>
Date2017-01-19 09:30 +0100
SubjectRe: [PATCH 13/33] Input: bfin_rotary - Use 'dev' instead of dereferencing it and other changes
Message-ID<t1ggy-7x5-9@gated-at.bofh.it>
In reply to#1562420
On 01/18/2017 08:58 PM, Joe Perches wrote:
> On Wed, 2017-01-18 at 12:35 -0800, Guenter Roeck wrote:
>> On Wed, Jan 18, 2017 at 11:39:52AM -0800, Dmitry Torokhov wrote:
>>> On Wed, Jan 18, 2017 at 09:46:34AM -0800, Guenter Roeck wrote:
> []
>>>> diff --git a/drivers/input/misc/bfin_rotary.c b/drivers/input/misc/bfin_rotary.c
> []
>>>> @@ -141,25 +141,23 @@ static int bfin_rotary_probe(struct platform_device *pdev)
>>>>
>>>>  	/* Basic validation */
>>>>  	if ((pdata->rotary_up_key && !pdata->rotary_down_key) ||
>>>> -	    (!pdata->rotary_up_key && pdata->rotary_down_key)) {
>>>> +	    (!pdata->rotary_up_key && pdata->rotary_down_key))
>
> maybe just use ^
>
> 	if (!pdata->rotary_up_key ^ !pdata->rotary_down_key)
>
Interesting use case for a coccinelle rule.

To address the coccinelle related problem, I modified the rule to only apply
if the expression is in one line, and if the return statement is in the next
line. That works pretty well.

Guenter

[toc] | [prev] | [next] | [standalone]


#1562023 — [PATCH 25/33] Input: atmel-wm97xx - Drop unnecessary error messages and other changes

FromGuenter Roeck <linux@roeck-us.net>
Date2017-01-18 19:00 +0100
Subject[PATCH 25/33] Input: atmel-wm97xx - Drop unnecessary error messages and other changes
Message-ID<t12GD-76Z-55@gated-at.bofh.it>
In reply to#1562000
Error messages after memory allocation failures are unnecessary and
can be dropped.

This conversion was done automatically with coccinelle using the
following semantic patches. The semantic patches and the scripts
used to generate this commit log are available at
https://github.com/groeck/coccinelle-patches

- Drop unnecessary braces around conditional return statements
- Drop error message after devm_kzalloc() failure

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
 drivers/input/touchscreen/atmel-wm97xx.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/input/touchscreen/atmel-wm97xx.c b/drivers/input/touchscreen/atmel-wm97xx.c
index 7ec0421c0dd8..8cf0b2be2df4 100644
--- a/drivers/input/touchscreen/atmel-wm97xx.c
+++ b/drivers/input/touchscreen/atmel-wm97xx.c
@@ -339,10 +339,8 @@ static int __init atmel_wm97xx_probe(struct platform_device *pdev)
 	int ret;
 
 	atmel_wm97xx = kzalloc(sizeof(struct atmel_wm97xx), GFP_KERNEL);
-	if (!atmel_wm97xx) {
-		dev_dbg(&pdev->dev, "out of memory\n");
+	if (!atmel_wm97xx)
 		return -ENOMEM;
-	}
 
 	atmel_wm97xx->wm	= wm;
 	atmel_wm97xx->regs	= (void *)ATMEL_WM97XX_AC97C_IOMEM;
-- 
2.7.4

[toc] | [prev] | [next] | [standalone]


#1562094 — Re: [PATCH 25/33] Input: atmel-wm97xx - Drop unnecessary error messages and other changes

FromDmitry Torokhov <dmitry.torokhov@gmail.com>
Date2017-01-18 20:30 +0100
SubjectRe: [PATCH 25/33] Input: atmel-wm97xx - Drop unnecessary error messages and other changes
Message-ID<t145H-86O-3@gated-at.bofh.it>
In reply to#1562023
On Wed, Jan 18, 2017 at 09:46:46AM -0800, Guenter Roeck wrote:
> Error messages after memory allocation failures are unnecessary and
> can be dropped.
> 
> This conversion was done automatically with coccinelle using the
> following semantic patches. The semantic patches and the scripts
> used to generate this commit log are available at
> https://github.com/groeck/coccinelle-patches
> 
> - Drop unnecessary braces around conditional return statements
> - Drop error message after devm_kzalloc() failure

OK since it was emitted as dev_dbg() anyway, applied.

> 
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> ---
>  drivers/input/touchscreen/atmel-wm97xx.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/input/touchscreen/atmel-wm97xx.c b/drivers/input/touchscreen/atmel-wm97xx.c
> index 7ec0421c0dd8..8cf0b2be2df4 100644
> --- a/drivers/input/touchscreen/atmel-wm97xx.c
> +++ b/drivers/input/touchscreen/atmel-wm97xx.c
> @@ -339,10 +339,8 @@ static int __init atmel_wm97xx_probe(struct platform_device *pdev)
>  	int ret;
>  
>  	atmel_wm97xx = kzalloc(sizeof(struct atmel_wm97xx), GFP_KERNEL);
> -	if (!atmel_wm97xx) {
> -		dev_dbg(&pdev->dev, "out of memory\n");
> +	if (!atmel_wm97xx)
>  		return -ENOMEM;
> -	}
>  
>  	atmel_wm97xx->wm	= wm;
>  	atmel_wm97xx->regs	= (void *)ATMEL_WM97XX_AC97C_IOMEM;
> -- 
> 2.7.4
> 

-- 
Dmitry

[toc] | [prev] | [next] | [standalone]


#1562024 — [PATCH 09/33] Input: sun4i-lradc-keys - Drop unnecessary call to platform_set_drvdata and other changes

FromGuenter Roeck <linux@roeck-us.net>
Date2017-01-18 19:00 +0100
Subject[PATCH 09/33] Input: sun4i-lradc-keys - Drop unnecessary call to platform_set_drvdata and other changes
Message-ID<t12GD-76Z-47@gated-at.bofh.it>
In reply to#1562000
There is no call to platform_get_drvdata() or dev_get_drvdata().
Drop the unnecessary call to platform_set_drvdata().
Other relevant changes:
  Simplify error return

This conversion was done automatically with coccinelle using the
following semantic patches. The semantic patches and the scripts
used to generate this commit log are available at
https://github.com/groeck/coccinelle-patches

- Replace 'if (e) return e; return 0;' with 'return e;'
- Drop platform_set_drvdata()

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
 drivers/input/keyboard/sun4i-lradc-keys.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/input/keyboard/sun4i-lradc-keys.c b/drivers/input/keyboard/sun4i-lradc-keys.c
index cc8f7ddcee53..c153d956778c 100644
--- a/drivers/input/keyboard/sun4i-lradc-keys.c
+++ b/drivers/input/keyboard/sun4i-lradc-keys.c
@@ -257,12 +257,7 @@ static int sun4i_lradc_probe(struct platform_device *pdev)
 	if (error)
 		return error;
 
-	error = input_register_device(lradc->input);
-	if (error)
-		return error;
-
-	platform_set_drvdata(pdev, lradc);
-	return 0;
+	return input_register_device(lradc->input);
 }
 
 static const struct of_device_id sun4i_lradc_of_match[] = {
-- 
2.7.4

[toc] | [prev] | [next] | [standalone]


#1562025 — [PATCH 16/33] Input: mma8450 - Drop unnecessary call to i2c_set_clientdata and other changes

FromGuenter Roeck <linux@roeck-us.net>
Date2017-01-18 19:00 +0100
Subject[PATCH 16/33] Input: mma8450 - Drop unnecessary call to i2c_set_clientdata and other changes
Message-ID<t12GD-76Z-57@gated-at.bofh.it>
In reply to#1562000
There is no call to i2c_get_clientdata() or dev_get_drvdata().
Drop the unnecessary call to i2c_set_clientdata().

This conversion was done automatically with coccinelle using the
following semantic patches. The semantic patches and the scripts
used to generate this commit log are available at
https://github.com/groeck/coccinelle-patches

- Drop i2c_set_clientdata()

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
 drivers/input/misc/mma8450.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/input/misc/mma8450.c b/drivers/input/misc/mma8450.c
index 19c73574458e..b60cdea73826 100644
--- a/drivers/input/misc/mma8450.c
+++ b/drivers/input/misc/mma8450.c
@@ -205,8 +205,6 @@ static int mma8450_probe(struct i2c_client *c,
 		return err;
 	}
 
-	i2c_set_clientdata(c, m);
-
 	return 0;
 }
 
-- 
2.7.4

[toc] | [prev] | [next] | [standalone]


#1562116 — Re: [PATCH 16/33] Input: mma8450 - Drop unnecessary call to i2c_set_clientdata and other changes

FromDmitry Torokhov <dmitry.torokhov@gmail.com>
Date2017-01-18 20:50 +0100
SubjectRe: [PATCH 16/33] Input: mma8450 - Drop unnecessary call to i2c_set_clientdata and other changes
Message-ID<t14p4-8e2-15@gated-at.bofh.it>
In reply to#1562025
On Wed, Jan 18, 2017 at 09:46:37AM -0800, Guenter Roeck wrote:
> There is no call to i2c_get_clientdata() or dev_get_drvdata().
> Drop the unnecessary call to i2c_set_clientdata().
> 
> This conversion was done automatically with coccinelle using the
> following semantic patches. The semantic patches and the scripts
> used to generate this commit log are available at
> https://github.com/groeck/coccinelle-patches
> 
> - Drop i2c_set_clientdata()
> 
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>

Applied, thank you.

> ---
>  drivers/input/misc/mma8450.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/input/misc/mma8450.c b/drivers/input/misc/mma8450.c
> index 19c73574458e..b60cdea73826 100644
> --- a/drivers/input/misc/mma8450.c
> +++ b/drivers/input/misc/mma8450.c
> @@ -205,8 +205,6 @@ static int mma8450_probe(struct i2c_client *c,
>  		return err;
>  	}
>  
> -	i2c_set_clientdata(c, m);
> -
>  	return 0;
>  }
>  
> -- 
> 2.7.4
> 

-- 
Dmitry

[toc] | [prev] | [next] | [standalone]


Page 2 of 3 — ← Prev page 1 [2] 3  Next page →

Back to top | Article view | linux.kernel


csiph-web