linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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>
Subject: [PATCH 07/13] Input: rmi4 - Use local variables consistently
Date: Sat, 21 Jan 2017 10:45:59 -0800	[thread overview]
Message-ID: <1485024365-3368-8-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/rmi4/rmi_bus.c    | 4 ++--
 drivers/input/rmi4/rmi_driver.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/input/rmi4/rmi_bus.c b/drivers/input/rmi4/rmi_bus.c
index 1c40d94ca506..f754e09ac7a7 100644
--- a/drivers/input/rmi4/rmi_bus.c
+++ b/drivers/input/rmi4/rmi_bus.c
@@ -261,10 +261,10 @@ int __rmi_register_function_handler(struct rmi_function_handler *handler,
 	driver->probe = rmi_function_probe;
 	driver->remove = rmi_function_remove;
 
-	error = driver_register(&handler->driver);
+	error = driver_register(driver);
 	if (error) {
 		pr_err("driver_register() failed for %s, error: %d\n",
-			handler->driver.name, error);
+			driver->name, error);
 		return error;
 	}
 
diff --git a/drivers/input/rmi4/rmi_driver.c b/drivers/input/rmi4/rmi_driver.c
index 11447ab1055c..47e75021ee79 100644
--- a/drivers/input/rmi4/rmi_driver.c
+++ b/drivers/input/rmi4/rmi_driver.c
@@ -836,7 +836,7 @@ static int rmi_create_function(struct rmi_device *rmi_dev,
 			       void *ctx, const struct pdt_entry *pdt)
 {
 	struct device *dev = &rmi_dev->dev;
-	struct rmi_driver_data *data = dev_get_drvdata(&rmi_dev->dev);
+	struct rmi_driver_data *data = dev_get_drvdata(dev);
 	int *current_irq_count = ctx;
 	struct rmi_function *fn;
 	int i;
@@ -1040,7 +1040,7 @@ int rmi_probe_interrupts(struct rmi_driver_data *data)
 	}
 
 	if (data->bootloader_mode)
-		dev_warn(&rmi_dev->dev, "Device in bootloader mode.\n");
+		dev_warn(dev, "Device in bootloader mode.\n");
 
 	data->irq_count = irq_count;
 	data->num_of_irq_regs = (data->irq_count + 7) / 8;
-- 
2.7.4


  parent reply	other threads:[~2017-01-21 18:48 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 ` [PATCH 05/13] Input: misc " Guenter Roeck
2017-01-21 18:45 ` [PATCH 06/13] Input: mouse " Guenter Roeck
2017-01-21 18:45 ` Guenter Roeck [this message]
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-8-git-send-email-linux@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=dmitry.torokhov@gmail.com \
    --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).