Skip to content

Commit d332db8

Browse files
committed
thermal: core: Add function for registering tripless thermal zones
Multiple callers of thermal_zone_device_register() don't pass any trips to it and they might use a shortened argument list for that, so add a special function with fewer arguments for this purpose. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 9ffa7b9 commit d332db8

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

drivers/thermal/thermal_core.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1400,6 +1400,17 @@ struct thermal_zone_device *thermal_zone_device_register(const char *type, int n
14001400
}
14011401
EXPORT_SYMBOL_GPL(thermal_zone_device_register);
14021402

1403+
struct thermal_zone_device *thermal_tripless_zone_device_register(
1404+
const char *type,
1405+
void *devdata,
1406+
struct thermal_zone_device_ops *ops,
1407+
const struct thermal_zone_params *tzp)
1408+
{
1409+
return thermal_zone_device_register_with_trips(type, NULL, 0, 0, devdata,
1410+
ops, tzp, 0, 0);
1411+
}
1412+
EXPORT_SYMBOL_GPL(thermal_tripless_zone_device_register);
1413+
14031414
void *thermal_zone_device_priv(struct thermal_zone_device *tzd)
14041415
{
14051416
return tzd->devdata;

include/linux/thermal.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,12 @@ struct thermal_zone_device *thermal_zone_device_register_with_trips(
317317
const struct thermal_zone_params *tzp,
318318
int passive_delay, int polling_delay);
319319

320+
struct thermal_zone_device *thermal_tripless_zone_device_register(
321+
const char *type,
322+
void *devdata,
323+
struct thermal_zone_device_ops *ops,
324+
const struct thermal_zone_params *tzp);
325+
320326
void thermal_zone_device_unregister(struct thermal_zone_device *tz);
321327

322328
void *thermal_zone_device_priv(struct thermal_zone_device *tzd);
@@ -377,6 +383,13 @@ static inline struct thermal_zone_device *thermal_zone_device_register_with_trip
377383
int passive_delay, int polling_delay)
378384
{ return ERR_PTR(-ENODEV); }
379385

386+
static inline struct thermal_zone_device *thermal_tripless_zone_device_register(
387+
const char *type,
388+
void *devdata,
389+
struct thermal_zone_device_ops *ops,
390+
const struct thermal_zone_params *tzp)
391+
{ return ERR_PTR(-ENODEV); }
392+
380393
static inline void thermal_zone_device_unregister(struct thermal_zone_device *tz)
381394
{ }
382395

0 commit comments

Comments
 (0)