RFC PATCH add set_value locking

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 26 Mar 2005 13:26:03 +1100, Grant Coady <grant_nospam at dodo.com.au> wrote:

>On Sat, 26 Mar 2005 12:02:58 +1100, Grant Coady <grant_nospam at dodo.com.au> wrote:
>
>>Greetings,
>>
>>This patch adds locking around set operations that access 
>>data->something and go out to the chip.
>>
>Lucky last: it87

it87 needs a small fixup, oops.  This applies over previous patch 
in this series.  Again, this time inline, enough for today  :o)

Sign-off-by: Grant Coady <gcoady at gmail.com>


--- linux-2.6.12-rc1-mm3x/drivers/i2c/chips/it87.c~	2005-03-26 13:20:03.000000000 +1100
+++ linux-2.6.12-rc1-mm3x/drivers/i2c/chips/it87.c	2005-03-26 13:43:30.000000000 +1100
@@ -442,8 +442,10 @@
 	    data->sensor |= 1 << nr;
 	else if (val == 2)
 	    data->sensor |= 8 << nr;
-	else if (val != 0)
+	else if (val != 0) {
+		up(&data->update_lock);
 		return -EINVAL;
+	}
 	it87_write_value(client, IT87_REG_TEMP_ENABLE, data->sensor);
 	up(&data->update_lock);
 	return count;
@@ -583,11 +585,11 @@
 	struct it87_data *data = i2c_get_clientdata(client);
 	int val = simple_strtol(buf, NULL, 10);
 
-	down(&data->update_lock);
-
 	if (val < 0 || val > 255)
 		return -EINVAL;
 
+	down(&data->update_lock);
+
 	data->manual_pwm_ctl[nr] = val;
 	if (data->fan_main_ctrl & (1 << nr))
 		it87_write_value(client, IT87_REG_PWM(nr),



[Index of Archives]     [Linux Kernel]     [Linux Hardware Monitoring]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux