X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fi2c%2Fchips%2Feeprom.c;fp=drivers%2Fi2c%2Fchips%2Feeprom.c;h=41116b7947f6469b18678f1982e0d47ec8547b75;hb=64ba3f394c830ec48a1c31b53dcae312c56f1604;hp=13c108269a6da9227f669b472b4b3e6e5ca9e4ec;hpb=be1e6109ac94a859551f8e1774eb9a8469fe055c;p=linux-2.6.git diff --git a/drivers/i2c/chips/eeprom.c b/drivers/i2c/chips/eeprom.c index 13c108269..41116b794 100644 --- a/drivers/i2c/chips/eeprom.c +++ b/drivers/i2c/chips/eeprom.c @@ -33,7 +33,6 @@ #include #include #include -#include /* Addresses to scan */ static unsigned short normal_i2c[] = { 0x50, 0x51, 0x52, 0x53, 0x54, @@ -55,7 +54,7 @@ enum eeprom_nature { /* Each client has this additional data */ struct eeprom_data { struct i2c_client client; - struct mutex update_lock; + struct semaphore update_lock; u8 valid; /* bitfield, bit!=0 if slice is valid */ unsigned long last_updated[8]; /* In jiffies, 8 slices */ u8 data[EEPROM_SIZE]; /* Register values */ @@ -82,7 +81,7 @@ static void eeprom_update_client(struct i2c_client *client, u8 slice) struct eeprom_data *data = i2c_get_clientdata(client); int i, j; - mutex_lock(&data->update_lock); + down(&data->update_lock); if (!(data->valid & (1 << slice)) || time_after(jiffies, data->last_updated[slice] + 300 * HZ)) { @@ -108,7 +107,7 @@ static void eeprom_update_client(struct i2c_client *client, u8 slice) data->valid |= (1 << slice); } exit: - mutex_unlock(&data->update_lock); + up(&data->update_lock); } static ssize_t eeprom_read(struct kobject *kobj, char *buf, loff_t off, size_t count) @@ -188,7 +187,7 @@ static int eeprom_detect(struct i2c_adapter *adapter, int address, int kind) /* Fill in the remaining client fields */ strlcpy(new_client->name, "eeprom", I2C_NAME_SIZE); data->valid = 0; - mutex_init(&data->update_lock); + init_MUTEX(&data->update_lock); data->nature = UNKNOWN; /* Tell the I2C layer a new client has arrived */