linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzk@kernel.org>
To: Linus Walleij <linus.walleij@linaro.org>,
	Bartosz Golaszewski <bgolaszewski@baylibre.com>,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Hans de Goede <hdegoede@redhat.com>,
	Bastien Nocera <hadess@hadess.net>,
	Sangwon Jee <jeesw@melfas.com>,
	Eugen Hristev <eugen.hristev@microchip.com>,
	Andy Shevchenko <andy.shevchenko@gmail.com>,
	linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-input@vger.kernel.org, platform-driver-x86@vger.kernel.org,
	clang-built-linux@googlegroups.com
Cc: Krzysztof Kozlowski <krzk@kernel.org>
Subject: [PATCH v3 27/27] Input: bu21029_ts - Use local 'client->dev' variable in probe()
Date: Thu, 27 Aug 2020 20:58:29 +0200	[thread overview]
Message-ID: <20200827185829.30096-28-krzk@kernel.org> (raw)
In-Reply-To: <20200827185829.30096-1-krzk@kernel.org>

'dev' is shorter and simpler than '&client->dev' and in few cases it
allows to skip line wrapping. Probe function uses '&client->dev' a lot,
so this improves readability slightly.

Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>

---

Changes since v2:
1. New patch
---
 drivers/input/touchscreen/bu21029_ts.c | 37 +++++++++++---------------
 1 file changed, 16 insertions(+), 21 deletions(-)

diff --git a/drivers/input/touchscreen/bu21029_ts.c b/drivers/input/touchscreen/bu21029_ts.c
index 96c178b606dc..78e256254764 100644
--- a/drivers/input/touchscreen/bu21029_ts.c
+++ b/drivers/input/touchscreen/bu21029_ts.c
@@ -334,6 +334,7 @@ static void bu21029_stop_chip(struct input_dev *dev)
 static int bu21029_probe(struct i2c_client *client,
 			 const struct i2c_device_id *id)
 {
+	struct device *dev = &client->dev;
 	struct bu21029_ts_data *bu21029;
 	struct input_dev *in_dev;
 	int error;
@@ -342,37 +343,33 @@ static int bu21029_probe(struct i2c_client *client,
 				     I2C_FUNC_SMBUS_WRITE_BYTE |
 				     I2C_FUNC_SMBUS_WRITE_BYTE_DATA |
 				     I2C_FUNC_SMBUS_READ_I2C_BLOCK)) {
-		dev_err(&client->dev,
-			"i2c functionality support is not sufficient\n");
+		dev_err(dev, "i2c functionality support is not sufficient\n");
 		return -EIO;
 	}
 
-	bu21029 = devm_kzalloc(&client->dev, sizeof(*bu21029), GFP_KERNEL);
+	bu21029 = devm_kzalloc(dev, sizeof(*bu21029), GFP_KERNEL);
 	if (!bu21029)
 		return -ENOMEM;
 
-	error = device_property_read_u32(&client->dev, "rohm,x-plate-ohms",
-					 &bu21029->x_plate_ohms);
+	error = device_property_read_u32(dev, "rohm,x-plate-ohms", &bu21029->x_plate_ohms);
 	if (error) {
-		dev_err(&client->dev,
-			"invalid 'x-plate-ohms' supplied: %d\n", error);
+		dev_err(dev, "invalid 'x-plate-ohms' supplied: %d\n", error);
 		return error;
 	}
 
-	bu21029->vdd = devm_regulator_get(&client->dev, "vdd");
+	bu21029->vdd = devm_regulator_get(dev, "vdd");
 	if (IS_ERR(bu21029->vdd))
-		return dev_err_probe(&client->dev, PTR_ERR(bu21029->vdd),
+		return dev_err_probe(dev, PTR_ERR(bu21029->vdd),
 				     "failed to acquire 'vdd' supply\n");
 
-	bu21029->reset_gpios = devm_gpiod_get_optional(&client->dev,
-						       "reset", GPIOD_OUT_HIGH);
+	bu21029->reset_gpios = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
 	if (IS_ERR(bu21029->reset_gpios))
-		return dev_err_probe(&client->dev, PTR_ERR(bu21029->reset_gpios),
+		return dev_err_probe(dev, PTR_ERR(bu21029->reset_gpios),
 				     "failed to acquire 'reset' gpio\n");
 
-	in_dev = devm_input_allocate_device(&client->dev);
+	in_dev = devm_input_allocate_device(dev);
 	if (!in_dev) {
-		dev_err(&client->dev, "unable to allocate input device\n");
+		dev_err(dev, "unable to allocate input device\n");
 		return -ENOMEM;
 	}
 
@@ -394,19 +391,17 @@ static int bu21029_probe(struct i2c_client *client,
 	input_set_drvdata(in_dev, bu21029);
 
 	irq_set_status_flags(client->irq, IRQ_NOAUTOEN);
-	error = devm_request_threaded_irq(&client->dev, client->irq,
-					  NULL, bu21029_touch_soft_irq,
-					  IRQF_ONESHOT, DRIVER_NAME, bu21029);
+	error = devm_request_threaded_irq(dev, client->irq, NULL,
+					  bu21029_touch_soft_irq, IRQF_ONESHOT,
+					  DRIVER_NAME, bu21029);
 	if (error) {
-		dev_err(&client->dev,
-			"unable to request touch irq: %d\n", error);
+		dev_err(dev, "unable to request touch irq: %d\n", error);
 		return error;
 	}
 
 	error = input_register_device(in_dev);
 	if (error) {
-		dev_err(&client->dev,
-			"unable to register input device: %d\n", error);
+		dev_err(dev, "unable to register input device: %d\n", error);
 		return error;
 	}
 
-- 
2.17.1


  parent reply	other threads:[~2020-08-27 19:00 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-27 18:58 [PATCH v3 01/27] Input: Simplify with dev_err_probe() Krzysztof Kozlowski
2020-08-27 18:58 ` [PATCH v3 01/27] Input: gpio_keys_polled - " Krzysztof Kozlowski
2020-08-27 18:58 ` [PATCH v3 02/27] Input: gpio-vibra " Krzysztof Kozlowski
2020-08-27 19:36   ` Andy Shevchenko
2020-08-27 18:58 ` [PATCH v3 03/27] Input: pwm-beeper " Krzysztof Kozlowski
2020-08-27 18:58 ` [PATCH v3 04/27] Input: pwm-vibra " Krzysztof Kozlowski
2020-08-27 19:39   ` Andy Shevchenko
2020-08-27 18:58 ` [PATCH v3 05/27] Input: rotary_encoder " Krzysztof Kozlowski
2020-08-27 18:58 ` [PATCH v3 06/27] Input: elan_i2c " Krzysztof Kozlowski
2020-08-27 18:58 ` [PATCH v3 07/27] Input: bu21013_ts " Krzysztof Kozlowski
2020-08-27 19:39   ` Andy Shevchenko
2020-08-28 14:29   ` Linus Walleij
2020-08-27 18:58 ` [PATCH v3 08/27] Input: bu21029_ts " Krzysztof Kozlowski
2020-08-27 18:58 ` [PATCH v3 09/27] Input: chipone_icn8318 " Krzysztof Kozlowski
2020-08-27 18:58 ` [PATCH v3 10/27] Input: cy8ctma140 " Krzysztof Kozlowski
2020-08-27 18:58 ` [PATCH v3 11/27] Input: edf-ft5x06 " Krzysztof Kozlowski
2020-08-27 18:58 ` [PATCH v3 12/27] Input: ektf2127 " Krzysztof Kozlowski
2020-08-27 18:58 ` [PATCH v3 13/27] Input: elants_i2c " Krzysztof Kozlowski
2020-08-27 18:58 ` [PATCH v3 14/27] Input: goodix " Krzysztof Kozlowski
2020-08-27 18:58 ` [PATCH v3 15/27] Input: melfas_mip4 " Krzysztof Kozlowski
2020-08-27 18:58 ` [PATCH v3 16/27] Input: pixcir_i2c_ts " Krzysztof Kozlowski
2020-08-27 18:58 ` [PATCH v3 17/27] Input: raydium_i2c_ts " Krzysztof Kozlowski
2020-08-27 18:58 ` [PATCH v3 18/27] Input: resistive-adc-touch " Krzysztof Kozlowski
2020-08-27 18:58 ` [PATCH v3 19/27] Input: silead " Krzysztof Kozlowski
2020-08-27 18:58 ` [PATCH v3 20/27] Input: sis_i2c " Krzysztof Kozlowski
2020-08-27 18:58 ` [PATCH v3 21/27] Input: surface3_spi " Krzysztof Kozlowski
2020-08-27 18:58 ` [PATCH v3 22/27] Input: sx8643 " Krzysztof Kozlowski
2020-08-27 18:58 ` [PATCH v3 23/27] Input: bcm-keypad " Krzysztof Kozlowski
2020-08-27 18:58 ` [PATCH v3 24/27] gpio: Add devm_fwnode_gpiod_get_optional() helpers Krzysztof Kozlowski
2020-08-28 14:31   ` Linus Walleij
2020-08-28 14:45     ` Krzysztof Kozlowski
2020-08-28 14:56       ` Andy Shevchenko
2020-08-27 18:58 ` [PATCH v3 25/27] Input: gpio_keys - Simplify with dev_err_probe() Krzysztof Kozlowski
2020-08-27 18:58 ` [PATCH v3 26/27] Input: bu21013_ts - Use local 'client->dev' variable in probe() Krzysztof Kozlowski
2020-08-27 19:43   ` Andy Shevchenko
2020-08-27 19:47   ` [PATCH v3.1] " Krzysztof Kozlowski
2020-08-28 14:32   ` [PATCH v3 26/27] " Linus Walleij
2020-08-27 18:58 ` Krzysztof Kozlowski [this message]
2020-08-27 19:44   ` [PATCH v3 27/27] Input: bu21029_ts " Andy Shevchenko
2020-10-02 16:23 ` [PATCH v3 01/27] Input: Simplify with dev_err_probe() Krzysztof Kozlowski
2021-09-16 19:40   ` Krzysztof Kozlowski

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=20200827185829.30096-28-krzk@kernel.org \
    --to=krzk@kernel.org \
    --cc=andy.shevchenko@gmail.com \
    --cc=bgolaszewski@baylibre.com \
    --cc=clang-built-linux@googlegroups.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=eugen.hristev@microchip.com \
    --cc=hadess@hadess.net \
    --cc=hdegoede@redhat.com \
    --cc=jeesw@melfas.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=platform-driver-x86@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).