Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

thermal: core: Clean up thermal_list_lock locking

Once thermal_list_lock has been acquired in
__thermal_cooling_device_register(), it is not necessary to drop it
and take it again until all of the thermal zones have been updated,
so change the code accordingly.

No expected functional impact.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

+2 -6
+2 -6
drivers/thermal/thermal_core.c
··· 826 826 const struct thermal_zone_params *tzp; 827 827 struct thermal_zone_device *pos = NULL; 828 828 829 - mutex_lock(&thermal_list_lock); 830 - 831 829 list_for_each_entry(pos, &thermal_tz_list, node) { 832 830 if (!pos->tzp && !pos->ops->bind) 833 831 continue; ··· 852 854 tzp->tbp[i].weight); 853 855 } 854 856 } 855 - 856 - mutex_unlock(&thermal_list_lock); 857 857 } 858 858 859 859 /** ··· 929 933 930 934 /* Add 'this' new cdev to the global cdev list */ 931 935 mutex_lock(&thermal_list_lock); 936 + 932 937 list_add(&cdev->node, &thermal_cdev_list); 933 - mutex_unlock(&thermal_list_lock); 934 938 935 939 /* Update binding information for 'this' new cdev */ 936 940 bind_cdev(cdev); 937 941 938 - mutex_lock(&thermal_list_lock); 939 942 list_for_each_entry(pos, &thermal_tz_list, node) 940 943 if (atomic_cmpxchg(&pos->need_update, 1, 0)) 941 944 thermal_zone_device_update(pos, 942 945 THERMAL_EVENT_UNSPECIFIED); 946 + 943 947 mutex_unlock(&thermal_list_lock); 944 948 945 949 return cdev;