Skip to content

Commit 56f534d

Browse files
andy-shevBartosz Golaszewski
authored andcommitted
gpio: stmpe: Utilise temporary variable for struct device
We have a temporary variable to keep a pointer to struct device. Utilise it where it makes sense. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20240902133148.2569486-4-andriy.shevchenko@linux.intel.com Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
1 parent c028e1c commit 56f534d

1 file changed

Lines changed: 9 additions & 10 deletions

File tree

drivers/gpio/gpio-stmpe.c

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -464,17 +464,17 @@ static void stmpe_gpio_disable(void *stmpe)
464464
static int stmpe_gpio_probe(struct platform_device *pdev)
465465
{
466466
struct device *dev = &pdev->dev;
467-
struct stmpe *stmpe = dev_get_drvdata(pdev->dev.parent);
468-
struct device_node *np = pdev->dev.of_node;
467+
struct stmpe *stmpe = dev_get_drvdata(dev->parent);
468+
struct device_node *np = dev->of_node;
469469
struct stmpe_gpio *stmpe_gpio;
470470
int ret, irq;
471471

472472
if (stmpe->num_gpios > MAX_GPIOS) {
473-
dev_err(&pdev->dev, "Need to increase maximum GPIO number\n");
473+
dev_err(dev, "Need to increase maximum GPIO number\n");
474474
return -EINVAL;
475475
}
476476

477-
stmpe_gpio = devm_kzalloc(&pdev->dev, sizeof(*stmpe_gpio), GFP_KERNEL);
477+
stmpe_gpio = devm_kzalloc(dev, sizeof(*stmpe_gpio), GFP_KERNEL);
478478
if (!stmpe_gpio)
479479
return -ENOMEM;
480480

@@ -483,7 +483,7 @@ static int stmpe_gpio_probe(struct platform_device *pdev)
483483
stmpe_gpio->stmpe = stmpe;
484484
stmpe_gpio->chip = template_chip;
485485
stmpe_gpio->chip.ngpio = stmpe->num_gpios;
486-
stmpe_gpio->chip.parent = &pdev->dev;
486+
stmpe_gpio->chip.parent = dev;
487487
stmpe_gpio->chip.base = -1;
488488

489489
if (IS_ENABLED(CONFIG_DEBUG_FS))
@@ -496,17 +496,16 @@ static int stmpe_gpio_probe(struct platform_device *pdev)
496496
if (ret)
497497
return ret;
498498

499-
ret = devm_add_action_or_reset(&pdev->dev, stmpe_gpio_disable, stmpe);
499+
ret = devm_add_action_or_reset(dev, stmpe_gpio_disable, stmpe);
500500
if (ret)
501501
return ret;
502502

503503
irq = platform_get_irq(pdev, 0);
504504
if (irq > 0) {
505505
struct gpio_irq_chip *girq;
506506

507-
ret = devm_request_threaded_irq(&pdev->dev, irq, NULL,
508-
stmpe_gpio_irq, IRQF_ONESHOT,
509-
"stmpe-gpio", stmpe_gpio);
507+
ret = devm_request_threaded_irq(dev, irq, NULL, stmpe_gpio_irq,
508+
IRQF_ONESHOT, "stmpe-gpio", stmpe_gpio);
510509
if (ret)
511510
return dev_err_probe(dev, ret, "unable to register IRQ handler\n");
512511

@@ -522,7 +521,7 @@ static int stmpe_gpio_probe(struct platform_device *pdev)
522521
girq->init_valid_mask = stmpe_init_irq_valid_mask;
523522
}
524523

525-
return devm_gpiochip_add_data(&pdev->dev, &stmpe_gpio->chip, stmpe_gpio);
524+
return devm_gpiochip_add_data(dev, &stmpe_gpio->chip, stmpe_gpio);
526525
}
527526

528527
static struct platform_driver stmpe_gpio_driver = {

0 commit comments

Comments
 (0)