From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Linux PM <linux-pm@vger.kernel.org>
Cc: Linux ACPI <linux-acpi@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>,
Zhang Rui <rui.zhang@intel.com>,
Daniel Lezcano <daniel.lezcano@linaro.org>
Subject: [PATCH v2 2/4] thermal: intel: int340x: Rename variable in int340x_thermal_zone_add()
Date: Mon, 30 Jan 2023 19:43:32 +0100 [thread overview]
Message-ID: <10219014.nUPlyArG6x@kreacher> (raw)
In-Reply-To: <2133431.irdbgypaU6@kreacher>
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Rename local variables int34x_thermal_zone in int340x_thermal_zone_add()
and int340x_thermal_zone_remove() to int34x_zone which allows a number
of code lines to be shorter and easier to read and adjust some white
space for consistency.
No intentional functional impact.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
v1 -> v2: Rebase
---
drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c | 67 +++++------
1 file changed, 33 insertions(+), 34 deletions(-)
Index: linux-pm/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c
===================================================================
--- linux-pm.orig/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c
+++ linux-pm/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c
@@ -113,7 +113,7 @@ static struct thermal_zone_params int340
struct int34x_thermal_zone *int340x_thermal_zone_add(struct acpi_device *adev,
int (*get_temp) (struct thermal_zone_device *, int *))
{
- struct int34x_thermal_zone *int34x_thermal_zone;
+ struct int34x_thermal_zone *int34x_zone;
struct thermal_trip *zone_trips;
unsigned long long trip_cnt = 0;
unsigned long long hyst;
@@ -121,25 +121,25 @@ struct int34x_thermal_zone *int340x_ther
acpi_status status;
int i, ret;
- int34x_thermal_zone = kzalloc(sizeof(*int34x_thermal_zone), GFP_KERNEL);
- if (!int34x_thermal_zone)
+ int34x_zone = kzalloc(sizeof(*int34x_zone), GFP_KERNEL);
+ if (!int34x_zone)
return ERR_PTR(-ENOMEM);
- int34x_thermal_zone->adev = adev;
+ int34x_zone->adev = adev;
- int34x_thermal_zone->ops = kmemdup(&int340x_thermal_zone_ops,
- sizeof(int340x_thermal_zone_ops), GFP_KERNEL);
- if (!int34x_thermal_zone->ops) {
+ int34x_zone->ops = kmemdup(&int340x_thermal_zone_ops,
+ sizeof(int340x_thermal_zone_ops), GFP_KERNEL);
+ if (!int34x_zone->ops) {
ret = -ENOMEM;
goto err_ops_alloc;
}
if (get_temp)
- int34x_thermal_zone->ops->get_temp = get_temp;
+ int34x_zone->ops->get_temp = get_temp;
status = acpi_evaluate_integer(adev->handle, "PATC", NULL, &trip_cnt);
if (ACPI_SUCCESS(status)) {
- int34x_thermal_zone->aux_trip_nr = trip_cnt;
+ int34x_zone->aux_trip_nr = trip_cnt;
trip_mask = BIT(trip_cnt) - 1;
}
@@ -166,48 +166,47 @@ struct int34x_thermal_zone *int340x_ther
for (i = 0; i < trip_cnt; ++i)
zone_trips[i].hysteresis = hyst;
- int34x_thermal_zone->trips = zone_trips;
+ int34x_zone->trips = zone_trips;
- int34x_thermal_zone->lpat_table = acpi_lpat_get_conversion_table(adev->handle);
+ int34x_zone->lpat_table = acpi_lpat_get_conversion_table(adev->handle);
- int34x_thermal_zone->zone = thermal_zone_device_register_with_trips(
- acpi_device_bid(adev),
- zone_trips, trip_cnt,
- trip_mask, int34x_thermal_zone,
- int34x_thermal_zone->ops,
- &int340x_thermal_params,
- 0, 0);
- if (IS_ERR(int34x_thermal_zone->zone)) {
- ret = PTR_ERR(int34x_thermal_zone->zone);
+ int34x_zone->zone = thermal_zone_device_register_with_trips(
+ acpi_device_bid(adev),
+ zone_trips, trip_cnt,
+ trip_mask, int34x_zone,
+ int34x_zone->ops,
+ &int340x_thermal_params,
+ 0, 0);
+ if (IS_ERR(int34x_zone->zone)) {
+ ret = PTR_ERR(int34x_zone->zone);
goto err_thermal_zone;
}
- ret = thermal_zone_device_enable(int34x_thermal_zone->zone);
+ ret = thermal_zone_device_enable(int34x_zone->zone);
if (ret)
goto err_enable;
- return int34x_thermal_zone;
+ return int34x_zone;
err_enable:
- thermal_zone_device_unregister(int34x_thermal_zone->zone);
+ thermal_zone_device_unregister(int34x_zone->zone);
err_thermal_zone:
- kfree(int34x_thermal_zone->trips);
- acpi_lpat_free_conversion_table(int34x_thermal_zone->lpat_table);
+ kfree(int34x_zone->trips);
+ acpi_lpat_free_conversion_table(int34x_zone->lpat_table);
err_trips_alloc:
- kfree(int34x_thermal_zone->ops);
+ kfree(int34x_zone->ops);
err_ops_alloc:
- kfree(int34x_thermal_zone);
+ kfree(int34x_zone);
return ERR_PTR(ret);
}
EXPORT_SYMBOL_GPL(int340x_thermal_zone_add);
-void int340x_thermal_zone_remove(struct int34x_thermal_zone
- *int34x_thermal_zone)
+void int340x_thermal_zone_remove(struct int34x_thermal_zone *int34x_zone)
{
- thermal_zone_device_unregister(int34x_thermal_zone->zone);
- acpi_lpat_free_conversion_table(int34x_thermal_zone->lpat_table);
- kfree(int34x_thermal_zone->trips);
- kfree(int34x_thermal_zone->ops);
- kfree(int34x_thermal_zone);
+ thermal_zone_device_unregister(int34x_zone->zone);
+ acpi_lpat_free_conversion_table(int34x_zone->lpat_table);
+ kfree(int34x_zone->trips);
+ kfree(int34x_zone->ops);
+ kfree(int34x_zone);
}
EXPORT_SYMBOL_GPL(int340x_thermal_zone_remove);
next prev parent reply other threads:[~2023-01-30 18:48 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-30 18:37 [PATCH v2 0/4] thermal: intel: int340x: Assorted cleanups Rafael J. Wysocki
2023-01-30 18:42 ` [PATCH v2 1/4] thermal: intel: int340x: Assorted minor cleanups Rafael J. Wysocki
2023-01-31 15:36 ` Daniel Lezcano
2023-01-30 18:43 ` Rafael J. Wysocki [this message]
2023-01-30 18:45 ` [PATCH v2 3/4] thermal: intel: int340x: Drop pointless cast to unsigned long Rafael J. Wysocki
2023-01-31 15:38 ` Daniel Lezcano
2023-01-30 18:47 ` [PATCH v2 4/4] thermal: intel: int340x: Improve int340x_thermal_set_trip_temp() Rafael J. Wysocki
2023-01-31 15:39 ` Daniel Lezcano
2023-02-01 9:09 ` [PATCH v2 0/4] thermal: intel: int340x: Assorted cleanups Zhang, Rui
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=10219014.nUPlyArG6x@kreacher \
--to=rjw@rjwysocki.net \
--cc=daniel.lezcano@linaro.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rui.zhang@intel.com \
--cc=srinivas.pandruvada@linux.intel.com \
/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