RFC PATCH driver pcf8574 not quite right

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

 



Greetings,

pcf8574 tried to write an untested value to the chip, one 
way to 'fix' this is simply force the value to byte range.

Who knows proper fix please?

Cheers,
Grant.

--- linux-2.6.12-rc1-mm3/drivers/i2c/chips/pcf8574.c	2005-03-23 06:34:26.000000000 +1100
+++ linux-2.6.12-rc1-mm3x/drivers/i2c/chips/pcf8574.c	2005-03-27 12:31:05.000000000 +1000
@@ -97,8 +97,12 @@
 {
 	struct i2c_client *client = to_i2c_client(dev);
 	struct pcf8574_data *data = i2c_get_clientdata(client);
-	data->write = simple_strtoul(buf, NULL, 10);
+	unsigned long val = simple_strtoul(buf, NULL, 10) & 0xff;
+
+	down(&data->update_lock);
+	data->write = val;
 	i2c_smbus_write_byte(client, data->write);
+	up(&data->update_lock);
 	return count;
 }
 



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

  Powered by Linux