Commit 96c4d0de authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Corey Minyard

ipmi_si: Utilize temporary variable to hold device pointer

Introduce a temporary variable to hold a device pointer.
It can be utilized in the ->probe() and save a bit of LOCs.
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Message-Id: <20210402174334.13466-4-andriy.shevchenko@linux.intel.com>
Signed-off-by: default avatarCorey Minyard <cminyard@mvista.com>
parent ea63a26e
...@@ -311,6 +311,7 @@ static int find_slave_address(struct si_sm_io *io, int slave_addr) ...@@ -311,6 +311,7 @@ static int find_slave_address(struct si_sm_io *io, int slave_addr)
static int acpi_ipmi_probe(struct platform_device *pdev) static int acpi_ipmi_probe(struct platform_device *pdev)
{ {
struct device *dev = &pdev->dev;
struct si_sm_io io; struct si_sm_io io;
acpi_handle handle; acpi_handle handle;
acpi_status status; acpi_status status;
...@@ -320,21 +321,20 @@ static int acpi_ipmi_probe(struct platform_device *pdev) ...@@ -320,21 +321,20 @@ static int acpi_ipmi_probe(struct platform_device *pdev)
if (!si_tryacpi) if (!si_tryacpi)
return -ENODEV; return -ENODEV;
handle = ACPI_HANDLE(&pdev->dev); handle = ACPI_HANDLE(dev);
if (!handle) if (!handle)
return -ENODEV; return -ENODEV;
memset(&io, 0, sizeof(io)); memset(&io, 0, sizeof(io));
io.addr_source = SI_ACPI; io.addr_source = SI_ACPI;
dev_info(&pdev->dev, "probing via ACPI\n"); dev_info(dev, "probing via ACPI\n");
io.addr_info.acpi_info.acpi_handle = handle; io.addr_info.acpi_info.acpi_handle = handle;
/* _IFT tells us the interface type: KCS, BT, etc */ /* _IFT tells us the interface type: KCS, BT, etc */
status = acpi_evaluate_integer(handle, "_IFT", NULL, &tmp); status = acpi_evaluate_integer(handle, "_IFT", NULL, &tmp);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
dev_err(&pdev->dev, dev_err(dev, "Could not find ACPI IPMI interface type\n");
"Could not find ACPI IPMI interface type\n");
return -EINVAL; return -EINVAL;
} }
...@@ -351,10 +351,11 @@ static int acpi_ipmi_probe(struct platform_device *pdev) ...@@ -351,10 +351,11 @@ static int acpi_ipmi_probe(struct platform_device *pdev)
case 4: /* SSIF, just ignore */ case 4: /* SSIF, just ignore */
return -ENODEV; return -ENODEV;
default: default:
dev_info(&pdev->dev, "unknown IPMI type %lld\n", tmp); dev_info(dev, "unknown IPMI type %lld\n", tmp);
return -EINVAL; return -EINVAL;
} }
io.dev = dev;
io.regsize = DEFAULT_REGSIZE; io.regsize = DEFAULT_REGSIZE;
io.regshift = 0; io.regshift = 0;
...@@ -378,9 +379,7 @@ static int acpi_ipmi_probe(struct platform_device *pdev) ...@@ -378,9 +379,7 @@ static int acpi_ipmi_probe(struct platform_device *pdev)
io.slave_addr = find_slave_address(&io, io.slave_addr); io.slave_addr = find_slave_address(&io, io.slave_addr);
io.dev = &pdev->dev; dev_info(dev, "%pR regsize %d spacing %d irq %d\n",
dev_info(io.dev, "%pR regsize %d spacing %d irq %d\n",
res, io.regsize, io.regspacing, io.irq); res, io.regsize, io.regspacing, io.irq);
request_module("acpi_ipmi"); request_module("acpi_ipmi");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment