linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Linus Walleij <linus.walleij@linaro.org>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>, linux-input@vger.kernel.org
Cc: Nikita Travkin <nikita@trvn.ru>,
	Michael Srba <Michael.Srba@seznam.cz>,
	Linus Walleij <linus.walleij@linaro.org>
Subject: [PATCH 1/5] Input: zinitix - Helper dev variable in probe()
Date: Sun, 10 Apr 2022 14:00:55 +0200	[thread overview]
Message-ID: <20220410120059.2583849-1-linus.walleij@linaro.org> (raw)

Create a helper variable struct device *dev in probe() to
make the code more compact and easier to read.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/input/touchscreen/zinitix.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/drivers/input/touchscreen/zinitix.c b/drivers/input/touchscreen/zinitix.c
index 8bd03278ad9a..cd13075ae3ab 100644
--- a/drivers/input/touchscreen/zinitix.c
+++ b/drivers/input/touchscreen/zinitix.c
@@ -503,15 +503,16 @@ static int zinitix_init_input_dev(struct bt541_ts_data *bt541)
 static int zinitix_ts_probe(struct i2c_client *client)
 {
 	struct bt541_ts_data *bt541;
+	struct device *dev = &client->dev;
 	int error;
 
 	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
-		dev_err(&client->dev,
+		dev_err(dev,
 			"Failed to assert adapter's support for plain I2C.\n");
 		return -ENXIO;
 	}
 
-	bt541 = devm_kzalloc(&client->dev, sizeof(*bt541), GFP_KERNEL);
+	bt541 = devm_kzalloc(dev, sizeof(*bt541), GFP_KERNEL);
 	if (!bt541)
 		return -ENOMEM;
 
@@ -520,28 +521,28 @@ static int zinitix_ts_probe(struct i2c_client *client)
 
 	error = zinitix_init_regulators(bt541);
 	if (error) {
-		dev_err(&client->dev,
+		dev_err(dev,
 			"Failed to initialize regulators: %d\n", error);
 		return error;
 	}
 
-	error = devm_request_threaded_irq(&client->dev, client->irq,
+	error = devm_request_threaded_irq(dev, client->irq,
 					  NULL, zinitix_ts_irq_handler,
 					  IRQF_ONESHOT | IRQF_NO_AUTOEN,
 					  client->name, bt541);
 	if (error) {
-		dev_err(&client->dev, "Failed to request IRQ: %d\n", error);
+		dev_err(dev, "Failed to request IRQ: %d\n", error);
 		return error;
 	}
 
 	error = zinitix_init_input_dev(bt541);
 	if (error) {
-		dev_err(&client->dev,
+		dev_err(dev,
 			"Failed to initialize input device: %d\n", error);
 		return error;
 	}
 
-	error = device_property_read_u32(&client->dev, "zinitix,mode",
+	error = device_property_read_u32(dev, "zinitix,mode",
 					 &bt541->zinitix_mode);
 	if (error < 0) {
 		/* fall back to mode 2 */
@@ -553,7 +554,7 @@ static int zinitix_ts_probe(struct i2c_client *client)
 		 * If there are devices that don't support mode 2, support
 		 * for other modes (0, 1) will be needed.
 		 */
-		dev_err(&client->dev,
+		dev_err(dev,
 			"Malformed zinitix,mode property, must be 2 (supplied: %d)\n",
 			bt541->zinitix_mode);
 		return -EINVAL;
-- 
2.35.1


             reply	other threads:[~2022-04-10 12:03 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-10 12:00 Linus Walleij [this message]
2022-04-10 12:00 ` [PATCH 2/5] Input: zinitix - Add dev variable in state Linus Walleij
2022-05-27  5:37   ` Dmitry Torokhov
2022-05-27 13:31     ` Linus Walleij
2022-04-10 12:00 ` [PATCH 3/5] Input: zinitix - Rename defines ZINITIX_* Linus Walleij
2022-05-27  5:48   ` Dmitry Torokhov
2022-04-10 12:00 ` [PATCH 4/5] Input: zinitix - Read and cache device version numbers Linus Walleij
2022-05-27  5:47   ` Dmitry Torokhov
2022-04-10 12:00 ` [PATCH 5/5] Input: zinitix - Support calibration Linus Walleij
2022-05-27  5:48   ` Dmitry Torokhov
2022-05-24 12:08 ` [PATCH 1/5] Input: zinitix - Helper dev variable in probe() Linus Walleij
2022-05-27  5:36 ` Dmitry Torokhov
2022-05-27 13:30   ` Linus Walleij

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=20220410120059.2583849-1-linus.walleij@linaro.org \
    --to=linus.walleij@linaro.org \
    --cc=Michael.Srba@seznam.cz \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=nikita@trvn.ru \
    /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).