From: "Rafael J. Wysocki" <rafael@kernel.org>
To: Linux ACPI <linux-acpi@vger.kernel.org>
Cc: Linux PM <linux-pm@vger.kernel.org>, Armin Wolf <w_armin@gmx.de>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Subject: [PATCH v2 4/5] ACPI: fan: Add local variable dev to acpi_fan_probe()
Date: Wed, 25 Nov 2026 15:09:34 +0100 [thread overview]
Message-ID: <8764237.T7Z3S40VBb@rafael.j.wysocki> (raw)
In-Reply-To: <2859850.mvXUDI8C0e@rafael.j.wysocki>
From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
In acpi_fan_probe(), use a new local variable called "dev" to store
a pointer to the dev field in the platform device object passed to it
and use that variable wherever the pointer held by it is needed.
While at it, adjust a leftover message printing statement that printed
a message relative to the fan device's ACPI companion by mistake and
remove a redundant error message after a memory allocation failure,
also printed relative to the fan device's ACPI companion.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Armin Wolf <W_Armin@gmx.de>
---
v1 -> v2:
* Add R-by from Armin (thanks!)
---
drivers/acpi/fan_core.c | 28 +++++++++++++---------------
1 file changed, 13 insertions(+), 15 deletions(-)
diff --git a/drivers/acpi/fan_core.c b/drivers/acpi/fan_core.c
index d000bf0ef58c..f1efa0db9958 100644
--- a/drivers/acpi/fan_core.c
+++ b/drivers/acpi/fan_core.c
@@ -462,20 +462,19 @@ static void acpi_fan_notify_handler(acpi_handle handle, u32 event, void *context
static int acpi_fan_probe(struct platform_device *pdev)
{
+ struct device *dev = &pdev->dev;
+ struct acpi_device *device = ACPI_COMPANION(dev);
int result = 0;
struct thermal_cooling_device *cdev;
struct acpi_fan *fan;
- struct acpi_device *device = ACPI_COMPANION(&pdev->dev);
char *name;
if (!device)
return -ENODEV;
- fan = devm_kzalloc_obj(&pdev->dev, *fan);
- if (!fan) {
- dev_err(&device->dev, "No memory for fan\n");
+ fan = devm_kzalloc_obj(dev, *fan);
+ if (!fan)
return -ENOMEM;
- }
fan->adev = device;
platform_set_drvdata(pdev, fan);
@@ -492,30 +491,29 @@ static int acpi_fan_probe(struct platform_device *pdev)
if (result)
return result;
- result = acpi_fan_get_fps(fan, &pdev->dev, device);
+ result = acpi_fan_get_fps(fan, dev, device);
if (result)
return result;
}
if (fan->has_fst) {
- result = acpi_fan_dsm_init(fan, &pdev->dev);
+ result = acpi_fan_dsm_init(fan, dev);
if (result)
return result;
- result = devm_acpi_fan_create_hwmon(&pdev->dev);
+ result = devm_acpi_fan_create_hwmon(dev);
if (result)
return result;
- result = devm_acpi_install_notify_handler(&pdev->dev,
- ACPI_DEVICE_NOTIFY,
+ result = devm_acpi_install_notify_handler(dev, ACPI_DEVICE_NOTIFY,
acpi_fan_notify_handler,
- &pdev->dev);
+ dev);
if (result)
return result;
result = acpi_fan_dsm_start(fan);
if (result) {
- dev_err(&pdev->dev, "Failed to start Microsoft fan extensions\n");
+ dev_err(dev, "Failed to start Microsoft fan extensions\n");
return result;
}
@@ -527,7 +525,7 @@ static int acpi_fan_probe(struct platform_device *pdev)
if (!fan->acpi4) {
result = acpi_device_update_power(device, NULL);
if (result) {
- dev_err(&device->dev, "Failed to set initial power state\n");
+ dev_err(dev, "Failed to set initial power state\n");
goto err_end;
}
}
@@ -537,13 +535,13 @@ static int acpi_fan_probe(struct platform_device *pdev)
else
name = acpi_device_bid(device);
- cdev = thermal_cooling_device_create(&pdev->dev, name, fan, &fan_cooling_ops);
+ cdev = thermal_cooling_device_create(dev, name, fan, &fan_cooling_ops);
if (IS_ERR(cdev)) {
result = PTR_ERR(cdev);
goto err_end;
}
- dev_dbg(&pdev->dev, "registered as cooling_device%d\n", cdev->id);
+ dev_dbg(dev, "registered as cooling_device%d\n", cdev->id);
fan->cdev = cdev;
--
2.51.0
next parent reply other threads:[~2026-11-25 14:11 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <2859850.mvXUDI8C0e@rafael.j.wysocki>
2026-11-25 14:09 ` Rafael J. Wysocki [this message]
2026-11-25 14:10 ` [PATCH v2 5/5] ACPI: fan: Use acpi_handle_debug/err() for diagnostic messages Rafael J. Wysocki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8764237.T7Z3S40VBb@rafael.j.wysocki \
--to=rafael@kernel.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=w_armin@gmx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox