RFC PATCH add set_value locking

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

 



Greetings,

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

One more: adm1021

as separate files from: 
  http://scatter.mine.nu/lmsensors/lock-on-set/

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


--- linux-2.6.12-rc1-mm3/drivers/i2c/chips/adm1021.c	2005-03-26 07:26:41.000000000 +1100
+++ linux-2.6.12-rc1-mm3x/drivers/i2c/chips/adm1021.c	2005-03-26 12:55:27.000000000 +1100
@@ -165,8 +165,10 @@
 	struct adm1021_data *data = i2c_get_clientdata(client);	\
 	int temp = simple_strtoul(buf, NULL, 10);		\
 								\
+	down(&data->update_lock);				\
 	data->value = TEMP_TO_REG(temp);			\
 	adm1021_write_value(client, reg, data->value);		\
+	up(&data->update_lock);					\
 	return count;						\
 }
 set(temp_max, ADM1021_REG_TOS_W);



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

  Powered by Linux