This patch adds new API thermal_zone_of_get_sensor_id() to provide the feature of getting sensor ID from DT thermal zone's node. It's useful for thermal driver to register the specific thermal zone devices from DT in a common way.
Showing the changes to include/linux (1 of 2 files). Show all
Unified · Split
| @@ -364,6 +364,9 @@ struct thermal_trip { · 363 unmodified lines | |||
| 364 | 364 | ||
| 365 | /* Function declarations */ | 365 | /* Function declarations */ |
| 366 | #ifdef CONFIG_THERMAL_OF | 366 | #ifdef CONFIG_THERMAL_OF |
| 367 | int thermal_zone_of_get_sensor_id(struct device_node *tz_np, | ||
| 368 | struct device_node *sensor_np, | ||
| 369 | u32 *id); | ||
| 367 | struct thermal_zone_device * | 370 | struct thermal_zone_device * |
| 368 | thermal_zone_of_sensor_register(struct device *dev, int id, void *data, | 371 | thermal_zone_of_sensor_register(struct device *dev, int id, void *data, |
| 369 | const struct thermal_zone_of_device_ops *ops); | 372 | const struct thermal_zone_of_device_ops *ops); |
| @@ -375,6 +378,13 @@ struct thermal_zone_device *devm_thermal_zone_of_sensor_register( · 5 unmodified lines | |||
| 375 | void devm_thermal_zone_of_sensor_unregister(struct device *dev, | 378 | void devm_thermal_zone_of_sensor_unregister(struct device *dev, |
| 376 | struct thermal_zone_device *tz); | 379 | struct thermal_zone_device *tz); |
| 377 | #else | 380 | #else |
| 381 | |||
| 382 | static int thermal_zone_of_get_sensor_id(struct device_node *tz_np, | ||
| 383 | struct device_node *sensor_np, | ||
| 384 | u32 *id) | ||
| 385 | { | ||
| 386 | return -ENOENT; | ||
| 387 | } | ||
| 378 | static inline struct thermal_zone_device * | 388 | static inline struct thermal_zone_device * |
| 379 | thermal_zone_of_sensor_register(struct device *dev, int id, void *data, | 389 | thermal_zone_of_sensor_register(struct device *dev, int id, void *data, |
| 380 | const struct thermal_zone_of_device_ops *ops) | 390 | const struct thermal_zone_of_device_ops *ops) |