From: Guenter Roeck <linux@roeck-us.net>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
Guenter Roeck <linux@roeck-us.net>, Dan Murphy <dmurphy@ti.com>,
Jingkui Wang <jkwang@google.com>,
John Stultz <john.stultz@linaro.org>,
Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
Subject: [PATCH 05/13] Input: misc - Use local variables consistently
Date: Sat, 21 Jan 2017 10:45:57 -0800 [thread overview]
Message-ID: <1485024365-3368-6-git-send-email-linux@roeck-us.net> (raw)
In-Reply-To: <1485024365-3368-1-git-send-email-linux@roeck-us.net>
If a function declares a variable to access a structure element,
use it conssistently.
The conversion was done automatically with coccinelle using
the following semantic patch.
// Catch function parameters.
// Handle those first to trigger reformatting.
@@
identifier d;
identifier fn;
identifier svar;
identifier elem;
type T;
identifier i;
expression e;
identifier fn;
expression list es;
@@
fn(...) {
...
T d = &svar->elem;
<... when != d = e;
- fn(&svar->elem, es)
+ fn(d, es)
...> }
// Now address non-functions and multiple transformations in function
// parameters.
@@
identifier d;
identifier fn;
identifier svar;
identifier elem;
type T;
identifier i;
expression e;
@@
fn(...) {
...
T d = &svar->elem;
<... when != d = e;
(
- &svar->elem
+ d
|
- svar->elem.i
+ d->i
)
...> }
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
drivers/input/misc/drv260x.c | 2 +-
drivers/input/misc/gpio_tilt_polled.c | 2 +-
drivers/input/misc/hisi_powerkey.c | 9 ++++-----
3 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/drivers/input/misc/drv260x.c b/drivers/input/misc/drv260x.c
index 0a2b865b1000..fb089d36c0d6 100644
--- a/drivers/input/misc/drv260x.c
+++ b/drivers/input/misc/drv260x.c
@@ -538,7 +538,7 @@ static int drv260x_probe(struct i2c_client *client,
haptics->input_dev = devm_input_allocate_device(dev);
if (!haptics->input_dev) {
- dev_err(&client->dev, "Failed to allocate input device\n");
+ dev_err(dev, "Failed to allocate input device\n");
return -ENOMEM;
}
diff --git a/drivers/input/misc/gpio_tilt_polled.c b/drivers/input/misc/gpio_tilt_polled.c
index f103b99d1852..6e217a45e39a 100644
--- a/drivers/input/misc/gpio_tilt_polled.c
+++ b/drivers/input/misc/gpio_tilt_polled.c
@@ -138,7 +138,7 @@ static int gpio_tilt_polled_probe(struct platform_device *pdev)
input->name = pdev->name;
input->phys = DRV_NAME"/input0";
- input->dev.parent = &pdev->dev;
+ input->dev.parent = dev;
input->id.bustype = BUS_HOST;
input->id.vendor = 0x0001;
diff --git a/drivers/input/misc/hisi_powerkey.c b/drivers/input/misc/hisi_powerkey.c
index 675539c529ce..c4c42124a059 100644
--- a/drivers/input/misc/hisi_powerkey.c
+++ b/drivers/input/misc/hisi_powerkey.c
@@ -75,9 +75,9 @@ static int hi65xx_powerkey_probe(struct platform_device *pdev)
struct input_dev *input;
int irq, i, error;
- input = devm_input_allocate_device(&pdev->dev);
+ input = devm_input_allocate_device(dev);
if (!input) {
- dev_err(&pdev->dev, "failed to allocate input device\n");
+ dev_err(dev, "failed to allocate input device\n");
return -ENOMEM;
}
@@ -111,12 +111,11 @@ static int hi65xx_powerkey_probe(struct platform_device *pdev)
error = input_register_device(input);
if (error) {
- dev_err(&pdev->dev, "failed to register input device: %d\n",
- error);
+ dev_err(dev, "failed to register input device: %d\n", error);
return error;
}
- device_init_wakeup(&pdev->dev, 1);
+ device_init_wakeup(dev, 1);
return 0;
}
--
2.7.4
next prev parent reply other threads:[~2017-01-21 18:47 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-21 18:45 [PATCH 00/13] Input: Automated coccinelle cleanup (take 2) Guenter Roeck
2017-01-21 18:45 ` [PATCH 01/13] Input: keyboard - Drop calls to platform_set_drvdata and i2c_set_clientdata Guenter Roeck
2017-01-21 18:45 ` [PATCH 02/13] Input: misc " Guenter Roeck
2017-01-21 18:45 ` [PATCH 03/13] Input: touchscreen " Guenter Roeck
2017-01-21 18:45 ` [PATCH 04/13] Input: keyboard - Use local variables consistently Guenter Roeck
2017-01-26 10:31 ` Linus Walleij
2017-01-26 14:28 ` Guenter Roeck
2017-01-26 18:59 ` Dmitry Torokhov
2017-01-21 18:45 ` Guenter Roeck [this message]
2017-01-21 18:45 ` [PATCH 06/13] Input: mouse " Guenter Roeck
2017-01-21 18:45 ` [PATCH 07/13] Input: rmi4 - " Guenter Roeck
2017-01-21 18:46 ` [PATCH 08/13] Input: touchscreen " Guenter Roeck
2017-01-21 18:46 ` [PATCH 09/13] Input: keyboard - drop unnecessary calls to device_init_wakeup Guenter Roeck
2017-01-21 18:46 ` [PATCH 10/13] Input: misc " Guenter Roeck
2017-01-21 18:46 ` [PATCH 11/13] Input: touchscreen " Guenter Roeck
2017-01-21 18:46 ` [PATCH 12/13] Input: serio " Guenter Roeck
2017-01-21 18:46 ` [PATCH 13/13] Input: misc - drop empty remove functions Guenter Roeck
2017-01-22 8:31 ` [PATCH 00/13] Input: Automated coccinelle cleanup (take 2) Dmitry Torokhov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1485024365-3368-6-git-send-email-linux@roeck-us.net \
--to=linux@roeck-us.net \
--cc=dmitry.torokhov@gmail.com \
--cc=dmurphy@ti.com \
--cc=jkwang@google.com \
--cc=john.stultz@linaro.org \
--cc=jorge.ramirez-ortiz@linaro.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).