Skip to content

Commit 072e35c

Browse files
dlezcanorafaeljw
authored andcommitted
thermal/core: Add thermal_zone_device structure 'type' accessor
The thermal zone device structure is exposed via the exported thermal.h header. This structure should stay private the thermal core code. In order to encapsulate the structure, let's add an accessor to get the 'type' of the thermal zone. Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent dec07d3 commit 072e35c

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

drivers/thermal/thermal_core.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1383,6 +1383,12 @@ void *thermal_zone_device_priv(struct thermal_zone_device *tzd)
13831383
}
13841384
EXPORT_SYMBOL_GPL(thermal_zone_device_priv);
13851385

1386+
const char *thermal_zone_device_type(struct thermal_zone_device *tzd)
1387+
{
1388+
return tzd->type;
1389+
}
1390+
EXPORT_SYMBOL_GPL(thermal_zone_device_type);
1391+
13861392
/**
13871393
* thermal_zone_device_unregister - removes the registered thermal zone device
13881394
* @tz: the thermal zone device to remove

include/linux/thermal.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,7 @@ thermal_zone_device_register_with_trips(const char *, struct thermal_trip *, int
366366
struct thermal_zone_params *, int, int);
367367

368368
void *thermal_zone_device_priv(struct thermal_zone_device *tzd);
369+
const char *thermal_zone_device_type(struct thermal_zone_device *tzd);
369370

370371
int thermal_zone_bind_cooling_device(struct thermal_zone_device *, int,
371372
struct thermal_cooling_device *,
@@ -443,6 +444,11 @@ static inline void *thermal_zone_device_priv(struct thermal_zone_device *tz)
443444
return NULL;
444445
}
445446

447+
static inline const char *thermal_zone_device_type(struct thermal_zone_device *tzd)
448+
{
449+
return NULL;
450+
}
451+
446452
static inline int thermal_zone_device_enable(struct thermal_zone_device *tz)
447453
{ return -ENODEV; }
448454

0 commit comments

Comments
 (0)