2023-08-30 19:30:47

by Rafael J. Wysocki

[permalink] [raw]
Subject: [PATCH v1 0/4] thermal: Eliminate thermal_zone_device_register()

Hi Everyone,

After recently merged changes in the ACPI thermal and Intel DTS IOSF thermal
drivers, the only callers of thermal_zone_device_register() are the ones
using it for registering thermal zones without any trip points. They all
pass zeros as 4 (out of 8) function arguments, so retaining the full
thermal_zone_device_register() just for this purpose seems a bit excessive.

For this reason, the series adds a thermal_zone_device_register()
replacement tailored to this specific use case and called
thermal_tripless_zone_device_register() [2/4] and makes all of the
existing callers of the former use the replacement [3/4]. This allows
thermal_zone_device_register() to be dropped [4/4].

The first patch is just a clean up making function headers in thermal.h
a bit more consistent.

This series it not intended to make any functional impact, but if the
changes are fine with everyone, I would like to introduce them during the
ongoing merge window to prevent the obsolete interface from lingering.

The series applies to the linux-next branch in linux-pm.git.

Thanks!





2023-08-30 21:57:52

by Rafael J. Wysocki

[permalink] [raw]
Subject: [PATCH v1 4/4] thermal: core: Drop thermal_zone_device_register()

From: Rafael J. Wysocki <[email protected]>

There are no more users of thermal_zone_device_register(), so drop it
from the core.

Note that thermal_zone_device_register_with_trips() may be renamed to
thermal_zone_device_register() in the future, but only after a grace
period allowing all of the possible work in progress that may be using
the latter to adjust.

Signed-off-by: Rafael J. Wysocki <[email protected]>
---
drivers/thermal/thermal_core.c | 11 -----------
include/linux/thermal.h | 17 -----------------
2 files changed, 28 deletions(-)

Index: linux-pm/drivers/thermal/thermal_core.c
===================================================================
--- linux-pm.orig/drivers/thermal/thermal_core.c
+++ linux-pm/drivers/thermal/thermal_core.c
@@ -1389,17 +1389,6 @@ free_tz:
}
EXPORT_SYMBOL_GPL(thermal_zone_device_register_with_trips);

-struct thermal_zone_device *thermal_zone_device_register(const char *type, int ntrips, int mask,
- void *devdata, struct thermal_zone_device_ops *ops,
- const struct thermal_zone_params *tzp, int passive_delay,
- int polling_delay)
-{
- return thermal_zone_device_register_with_trips(type, NULL, ntrips, mask,
- devdata, ops, tzp,
- passive_delay, polling_delay);
-}
-EXPORT_SYMBOL_GPL(thermal_zone_device_register);
-
struct thermal_zone_device *thermal_tripless_zone_device_register(
const char *type,
void *devdata,
Index: linux-pm/include/linux/thermal.h
===================================================================
--- linux-pm.orig/include/linux/thermal.h
+++ linux-pm/include/linux/thermal.h
@@ -300,14 +300,6 @@ int thermal_acpi_critical_trip_temp(stru
#endif

#ifdef CONFIG_THERMAL
-struct thermal_zone_device *thermal_zone_device_register(
- const char *type,
- int num_trips, int mask,
- void *devdata,
- struct thermal_zone_device_ops *ops,
- const struct thermal_zone_params *tzp,
- int passive_delay, int polling_delay);
-
struct thermal_zone_device *thermal_zone_device_register_with_trips(
const char *type,
struct thermal_trip *trips,
@@ -364,15 +356,6 @@ int thermal_zone_device_enable(struct th
int thermal_zone_device_disable(struct thermal_zone_device *tz);
void thermal_zone_device_critical(struct thermal_zone_device *tz);
#else
-static inline struct thermal_zone_device *thermal_zone_device_register(
- const char *type,
- int num_trips, int mask,
- void *devdata,
- struct thermal_zone_device_ops *ops,
- const struct thermal_zone_params *tzp,
- int passive_delay, int polling_delay)
-{ return ERR_PTR(-ENODEV); }
-
static inline struct thermal_zone_device *thermal_zone_device_register_with_trips(
const char *type,
struct thermal_trip *trips,




2023-08-30 22:07:54

by Rafael J. Wysocki

[permalink] [raw]
Subject: [PATCH v1 1/4] thermal: core: Clean up headers of thermal zone registration functions

From: Rafael J. Wysocki <[email protected]>

For consistency, add a missing thermal_zone_device_register_with_trips()
stub for the CONFIG_THERMAL unset case, specify argument names in all of
the thermal zone registration and unregistration function headers and
make all of them use white space consistently.

No intentional functional impact.

Signed-off-by: Rafael J. Wysocki <[email protected]>
---
include/linux/thermal.h | 53 +++++++++++++++++++++++++++++++++---------------
1 file changed, 37 insertions(+), 16 deletions(-)

Index: linux-pm/include/linux/thermal.h
===================================================================
--- linux-pm.orig/include/linux/thermal.h
+++ linux-pm/include/linux/thermal.h
@@ -300,16 +300,24 @@ int thermal_acpi_critical_trip_temp(stru
#endif

#ifdef CONFIG_THERMAL
-struct thermal_zone_device *thermal_zone_device_register(const char *, int, int,
- void *, struct thermal_zone_device_ops *,
- const struct thermal_zone_params *, int, int);
-
-void thermal_zone_device_unregister(struct thermal_zone_device *);
-
-struct thermal_zone_device *
-thermal_zone_device_register_with_trips(const char *, struct thermal_trip *, int, int,
- void *, struct thermal_zone_device_ops *,
- const struct thermal_zone_params *, int, int);
+struct thermal_zone_device *thermal_zone_device_register(
+ const char *type,
+ int num_trips, int mask,
+ void *devdata,
+ struct thermal_zone_device_ops *ops,
+ const struct thermal_zone_params *tzp,
+ int passive_delay, int polling_delay);
+
+struct thermal_zone_device *thermal_zone_device_register_with_trips(
+ const char *type,
+ struct thermal_trip *trips,
+ int num_trips, int mask,
+ void *devdata,
+ struct thermal_zone_device_ops *ops,
+ const struct thermal_zone_params *tzp,
+ int passive_delay, int polling_delay);
+
+void thermal_zone_device_unregister(struct thermal_zone_device *tz);

void *thermal_zone_device_priv(struct thermal_zone_device *tzd);
const char *thermal_zone_device_type(struct thermal_zone_device *tzd);
@@ -351,14 +359,27 @@ int thermal_zone_device_disable(struct t
void thermal_zone_device_critical(struct thermal_zone_device *tz);
#else
static inline struct thermal_zone_device *thermal_zone_device_register(
- const char *type, int trips, int mask, void *devdata,
- struct thermal_zone_device_ops *ops,
- const struct thermal_zone_params *tzp,
- int passive_delay, int polling_delay)
+ const char *type,
+ int num_trips, int mask,
+ void *devdata,
+ struct thermal_zone_device_ops *ops,
+ const struct thermal_zone_params *tzp,
+ int passive_delay, int polling_delay)
+{ return ERR_PTR(-ENODEV); }
+
+static inline struct thermal_zone_device *thermal_zone_device_register_with_trips(
+ const char *type,
+ struct thermal_trip *trips,
+ int num_trips, int mask,
+ void *devdata,
+ struct thermal_zone_device_ops *ops,
+ const struct thermal_zone_params *tzp,
+ int passive_delay, int polling_delay);
{ return ERR_PTR(-ENODEV); }
-static inline void thermal_zone_device_unregister(
- struct thermal_zone_device *tz)
+
+static inline void thermal_zone_device_unregister(struct thermal_zone_device *tz)
{ }
+
static inline struct thermal_cooling_device *
thermal_cooling_device_register(const char *type, void *devdata,
const struct thermal_cooling_device_ops *ops)