Skip to content

Commit 1ad8cdd

Browse files
committed
ACPI: button: Use local pointer to platform device dev field in probe
To avoid dereferencing pdev to get to the target platform device's dev field in multiple places in acpi_button_probe(), use a local pointer to that field. No intentional functional impact. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Link: https://patch.msgid.link/2049596.PYKUYFuaPT@rafael.j.wysocki
1 parent d9fa7b9 commit 1ad8cdd

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

drivers/acpi/button.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -541,6 +541,7 @@ static int acpi_lid_input_open(struct input_dev *input)
541541

542542
static int acpi_button_probe(struct platform_device *pdev)
543543
{
544+
struct device *dev = &pdev->dev;
544545
acpi_notify_handler handler;
545546
struct acpi_device *device;
546547
struct acpi_button *button;
@@ -550,7 +551,7 @@ static int acpi_button_probe(struct platform_device *pdev)
550551
const char *hid;
551552
int error = 0;
552553

553-
device = ACPI_COMPANION(&pdev->dev);
554+
device = ACPI_COMPANION(dev);
554555
if (!device)
555556
return -ENODEV;
556557

@@ -565,7 +566,7 @@ static int acpi_button_probe(struct platform_device *pdev)
565566

566567
platform_set_drvdata(pdev, button);
567568

568-
button->dev = &pdev->dev;
569+
button->dev = dev;
569570
button->adev = device;
570571
button->input = input = input_allocate_device();
571572
if (!input) {
@@ -615,7 +616,7 @@ static int acpi_button_probe(struct platform_device *pdev)
615616
input->phys = button->phys;
616617
input->id.bustype = BUS_HOST;
617618
input->id.product = button->type;
618-
input->dev.parent = &pdev->dev;
619+
input->dev.parent = dev;
619620

620621
switch (button->type) {
621622
case ACPI_BUTTON_TYPE_POWER:

0 commit comments

Comments
 (0)