Loading drivers/thermal/thermal_core.c +27 −8 Original line number Diff line number Diff line Loading @@ -49,6 +49,8 @@ MODULE_AUTHOR("Zhang Rui"); MODULE_DESCRIPTION("Generic thermal management sysfs support"); MODULE_LICENSE("GPL v2"); #define THERMAL_MAX_ACTIVE 16 static DEFINE_IDR(thermal_tz_idr); static DEFINE_IDR(thermal_cdev_idr); static DEFINE_MUTEX(thermal_idr_lock); Loading @@ -64,6 +66,8 @@ static atomic_t in_suspend; static struct thermal_governor *def_governor; static struct workqueue_struct *thermal_passive_wq; static struct thermal_governor *__find_governor(const char *name) { struct thermal_governor *pos; Loading Loading @@ -392,14 +396,15 @@ static void bind_tz(struct thermal_zone_device *tz) mutex_unlock(&thermal_list_lock); } static void thermal_zone_device_set_polling(struct thermal_zone_device *tz, static void thermal_zone_device_set_polling(struct workqueue_struct *queue, struct thermal_zone_device *tz, int delay) { if (delay > 1000) mod_delayed_work(system_freezable_wq, &tz->poll_queue, mod_delayed_work(queue, &tz->poll_queue, round_jiffies(msecs_to_jiffies(delay))); else if (delay) mod_delayed_work(system_freezable_wq, &tz->poll_queue, mod_delayed_work(queue, &tz->poll_queue, msecs_to_jiffies(delay)); else cancel_delayed_work(&tz->poll_queue); Loading @@ -410,11 +415,13 @@ static void monitor_thermal_zone(struct thermal_zone_device *tz) mutex_lock(&tz->lock); if (tz->passive) thermal_zone_device_set_polling(tz, tz->passive_delay); thermal_zone_device_set_polling(thermal_passive_wq, tz, tz->passive_delay); else if (tz->polling_delay) thermal_zone_device_set_polling(tz, tz->polling_delay); thermal_zone_device_set_polling(system_freezable_wq, tz, tz->polling_delay); else thermal_zone_device_set_polling(tz, 0); thermal_zone_device_set_polling(NULL, tz, 0); mutex_unlock(&tz->lock); } Loading Loading @@ -2069,7 +2076,7 @@ void thermal_zone_device_unregister(struct thermal_zone_device *tz) mutex_unlock(&thermal_list_lock); thermal_zone_device_set_polling(tz, 0); thermal_zone_device_set_polling(NULL, tz, 0); if (tz->type[0]) device_remove_file(&tz->device, &dev_attr_type); Loading Loading @@ -2329,9 +2336,18 @@ static int __init thermal_init(void) { int result; thermal_passive_wq = alloc_workqueue("thermal_passive_wq", WQ_HIGHPRI | WQ_UNBOUND | WQ_FREEZABLE, THERMAL_MAX_ACTIVE); if (!thermal_passive_wq) { result = -ENOMEM; goto init_exit; } result = thermal_register_governors(); if (result) goto init_exit; goto destroy_wq; result = class_register(&thermal_class); if (result) Loading @@ -2352,6 +2368,8 @@ static int __init thermal_init(void) class_unregister(&thermal_class); unregister_governors: thermal_unregister_governors(); destroy_wq: destroy_workqueue(thermal_passive_wq); init_exit: idr_destroy(&thermal_tz_idr); idr_destroy(&thermal_cdev_idr); Loading @@ -2365,6 +2383,7 @@ static void __exit thermal_exit(void) { unregister_pm_notifier(&thermal_pm_nb); of_thermal_destroy_zones(); destroy_workqueue(thermal_passive_wq); genetlink_exit(); class_unregister(&thermal_class); thermal_unregister_governors(); Loading Loading
drivers/thermal/thermal_core.c +27 −8 Original line number Diff line number Diff line Loading @@ -49,6 +49,8 @@ MODULE_AUTHOR("Zhang Rui"); MODULE_DESCRIPTION("Generic thermal management sysfs support"); MODULE_LICENSE("GPL v2"); #define THERMAL_MAX_ACTIVE 16 static DEFINE_IDR(thermal_tz_idr); static DEFINE_IDR(thermal_cdev_idr); static DEFINE_MUTEX(thermal_idr_lock); Loading @@ -64,6 +66,8 @@ static atomic_t in_suspend; static struct thermal_governor *def_governor; static struct workqueue_struct *thermal_passive_wq; static struct thermal_governor *__find_governor(const char *name) { struct thermal_governor *pos; Loading Loading @@ -392,14 +396,15 @@ static void bind_tz(struct thermal_zone_device *tz) mutex_unlock(&thermal_list_lock); } static void thermal_zone_device_set_polling(struct thermal_zone_device *tz, static void thermal_zone_device_set_polling(struct workqueue_struct *queue, struct thermal_zone_device *tz, int delay) { if (delay > 1000) mod_delayed_work(system_freezable_wq, &tz->poll_queue, mod_delayed_work(queue, &tz->poll_queue, round_jiffies(msecs_to_jiffies(delay))); else if (delay) mod_delayed_work(system_freezable_wq, &tz->poll_queue, mod_delayed_work(queue, &tz->poll_queue, msecs_to_jiffies(delay)); else cancel_delayed_work(&tz->poll_queue); Loading @@ -410,11 +415,13 @@ static void monitor_thermal_zone(struct thermal_zone_device *tz) mutex_lock(&tz->lock); if (tz->passive) thermal_zone_device_set_polling(tz, tz->passive_delay); thermal_zone_device_set_polling(thermal_passive_wq, tz, tz->passive_delay); else if (tz->polling_delay) thermal_zone_device_set_polling(tz, tz->polling_delay); thermal_zone_device_set_polling(system_freezable_wq, tz, tz->polling_delay); else thermal_zone_device_set_polling(tz, 0); thermal_zone_device_set_polling(NULL, tz, 0); mutex_unlock(&tz->lock); } Loading Loading @@ -2069,7 +2076,7 @@ void thermal_zone_device_unregister(struct thermal_zone_device *tz) mutex_unlock(&thermal_list_lock); thermal_zone_device_set_polling(tz, 0); thermal_zone_device_set_polling(NULL, tz, 0); if (tz->type[0]) device_remove_file(&tz->device, &dev_attr_type); Loading Loading @@ -2329,9 +2336,18 @@ static int __init thermal_init(void) { int result; thermal_passive_wq = alloc_workqueue("thermal_passive_wq", WQ_HIGHPRI | WQ_UNBOUND | WQ_FREEZABLE, THERMAL_MAX_ACTIVE); if (!thermal_passive_wq) { result = -ENOMEM; goto init_exit; } result = thermal_register_governors(); if (result) goto init_exit; goto destroy_wq; result = class_register(&thermal_class); if (result) Loading @@ -2352,6 +2368,8 @@ static int __init thermal_init(void) class_unregister(&thermal_class); unregister_governors: thermal_unregister_governors(); destroy_wq: destroy_workqueue(thermal_passive_wq); init_exit: idr_destroy(&thermal_tz_idr); idr_destroy(&thermal_cdev_idr); Loading @@ -2365,6 +2383,7 @@ static void __exit thermal_exit(void) { unregister_pm_notifier(&thermal_pm_nb); of_thermal_destroy_zones(); destroy_workqueue(thermal_passive_wq); genetlink_exit(); class_unregister(&thermal_class); thermal_unregister_governors(); Loading