diff mbox

[1/2] Input: gpio-beeper: use helper variable to access device info

Message ID 20171129110736.GB24064@lenoch (mailing list archive)
State New, archived
Headers show

Commit Message

Ladislav Michl Nov. 29, 2017, 11:07 a.m. UTC
Using explicit struct device variable makes code a bit more readable.

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
---
 Note: and it become more usefull one patch later

 drivers/input/misc/gpio-beeper.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
diff mbox

Patch

diff --git a/drivers/input/misc/gpio-beeper.c b/drivers/input/misc/gpio-beeper.c
index 16272fffeb7e..409c85da71c3 100644
--- a/drivers/input/misc/gpio-beeper.c
+++ b/drivers/input/misc/gpio-beeper.c
@@ -64,18 +64,19 @@  static void gpio_beeper_close(struct input_dev *input)
 
 static int gpio_beeper_probe(struct platform_device *pdev)
 {
+	struct device *dev = &pdev->dev;
 	struct gpio_beeper *beep;
 	struct input_dev *input;
 
-	beep = devm_kzalloc(&pdev->dev, sizeof(*beep), GFP_KERNEL);
+	beep = devm_kzalloc(dev, sizeof(*beep), GFP_KERNEL);
 	if (!beep)
 		return -ENOMEM;
 
-	beep->desc = devm_gpiod_get(&pdev->dev, NULL, GPIOD_OUT_LOW);
+	beep->desc = devm_gpiod_get(dev, NULL, GPIOD_OUT_LOW);
 	if (IS_ERR(beep->desc))
 		return PTR_ERR(beep->desc);
 
-	input = devm_input_allocate_device(&pdev->dev);
+	input = devm_input_allocate_device(dev);
 	if (!input)
 		return -ENOMEM;