lkml.org 
[lkml]   [2021]   [Mar]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v1 03/10] ipmi_si: Utilize temporary variable to hold device pointer
Date
By one of the previous clean up change we got a temporary variable to hold
a device pointer. It can be utilized in other calls in the ->probe() and
save a bit of LOCs.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/char/ipmi/ipmi_si_platform.c | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/drivers/char/ipmi/ipmi_si_platform.c b/drivers/char/ipmi/ipmi_si_platform.c
index 009563073d30..954c297b459b 100644
--- a/drivers/char/ipmi/ipmi_si_platform.c
+++ b/drivers/char/ipmi/ipmi_si_platform.c
@@ -309,6 +309,7 @@ static int find_slave_address(struct si_sm_io *io, int slave_addr)

static int acpi_ipmi_probe(struct platform_device *pdev)
{
+ struct device *dev = &pdev->dev;
struct si_sm_io io;
acpi_handle handle;
acpi_status status;
@@ -318,21 +319,20 @@ static int acpi_ipmi_probe(struct platform_device *pdev)
if (!si_tryacpi)
return -ENODEV;

- handle = ACPI_HANDLE(&pdev->dev);
+ handle = ACPI_HANDLE(dev);
if (!handle)
return -ENODEV;

memset(&io, 0, sizeof(io));
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;

/* _IFT tells us the interface type: KCS, BT, etc */
status = acpi_evaluate_integer(handle, "_IFT", NULL, &tmp);
if (ACPI_FAILURE(status)) {
- dev_err(&pdev->dev,
- "Could not find ACPI IPMI interface type\n");
+ dev_err(dev, "Could not find ACPI IPMI interface type\n");
return -EINVAL;
}

@@ -349,10 +349,11 @@ static int acpi_ipmi_probe(struct platform_device *pdev)
case 4: /* SSIF, just ignore */
return -ENODEV;
default:
- dev_info(&pdev->dev, "unknown IPMI type %lld\n", tmp);
+ dev_info(dev, "unknown IPMI type %lld\n", tmp);
return -EINVAL;
}

+ io.dev = dev;
io.regsize = DEFAULT_REGSIZE;
io.regshift = 0;

@@ -376,9 +377,7 @@ static int acpi_ipmi_probe(struct platform_device *pdev)

io.slave_addr = find_slave_address(&io, io.slave_addr);

- io.dev = &pdev->dev;
-
- dev_info(io.dev, "%pR regsize %d spacing %d irq %d\n",
+ dev_info(dev, "%pR regsize %d spacing %d irq %d\n",
res, io.regsize, io.regspacing, io.irq);

request_module("acpi_ipmi");
--
2.30.2
\
 
 \ /
  Last update: 2021-03-30 20:18    [W:0.935 / U:0.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site