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

hwmon: (corsair-psu) Rely on subsystem locking

Attribute access is now serialized in the hardware monitoring core,
so locking in the driver code is no longer necessary. Drop it.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>

+1 -10
+1 -10
drivers/hwmon/npcm750-pwm-fan.c
··· 4 4 #include <linux/clk.h> 5 5 #include <linux/device.h> 6 6 #include <linux/hwmon.h> 7 - #include <linux/hwmon-sysfs.h> 8 7 #include <linux/interrupt.h> 9 8 #include <linux/kernel.h> 10 9 #include <linux/module.h> ··· 197 198 int pwm_modules; 198 199 struct clk *pwm_clk; 199 200 struct clk *fan_clk; 200 - struct mutex pwm_lock[NPCM7XX_PWM_MAX_MODULES]; 201 201 spinlock_t fan_lock[NPCM7XX_FAN_MAX_MODULE]; 202 202 int fan_irq[NPCM7XX_FAN_MAX_MODULE]; 203 203 bool pwm_present[NPCM7XX_PWM_MAX_CHN_NUM]; ··· 219 221 /* 220 222 * Config PWM Comparator register for setting duty cycle 221 223 */ 222 - mutex_lock(&data->pwm_lock[module]); 223 224 224 225 /* write new CMR value */ 225 226 iowrite32(val, NPCM7XX_PWM_REG_CMRx(data->pwm_base, module, pwm_ch)); ··· 242 245 env_bit = NPCM7XX_PWM_CTRL_CH3_INV_BIT; 243 246 break; 244 247 default: 245 - mutex_unlock(&data->pwm_lock[module]); 246 248 return -ENODEV; 247 249 } 248 250 ··· 256 260 } 257 261 258 262 iowrite32(tmp_buf, NPCM7XX_PWM_REG_CR(data->pwm_base, module)); 259 - mutex_unlock(&data->pwm_lock[module]); 260 - 261 263 return 0; 262 264 } 263 265 ··· 926 932 struct resource *res; 927 933 struct device *hwmon; 928 934 char name[20]; 929 - int ret, cnt; 930 935 u32 output_freq; 936 + int ret; 931 937 u32 i; 932 938 933 939 np = dev->of_node; ··· 978 984 979 985 output_freq = npcm7xx_pwm_init(data); 980 986 npcm7xx_fan_init(data); 981 - 982 - for (cnt = 0; cnt < data->pwm_modules; cnt++) 983 - mutex_init(&data->pwm_lock[cnt]); 984 987 985 988 for (i = 0; i < NPCM7XX_FAN_MAX_MODULE; i++) { 986 989 spin_lock_init(&data->fan_lock[i]);