Skip to content

Commit 80784cb

Browse files
peda-rgregkh
authored andcommitted
mfd: 88pm860x-i2c: switch to i2c_lock_bus(..., I2C_LOCK_SEGMENT)
[ Upstream commit 8c8f74f ] Locking the root adapter for __i2c_transfer will deadlock if the device sits behind a mux-locked I2C mux. Switch to the finer-grained i2c_lock_bus with the I2C_LOCK_SEGMENT flag. If the device does not sit behind a mux-locked mux, the two locking variants are equivalent. Signed-off-by: Peter Rosin <peda@axentia.se> Acked-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Wolfram Sang <wsa@the-dreams.de> Signed-off-by: Sasha Levin <alexander.levin@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 4101e59 commit 80784cb

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

drivers/mfd/88pm860x-i2c.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,14 +146,14 @@ int pm860x_page_reg_write(struct i2c_client *i2c, int reg,
146146
unsigned char zero;
147147
int ret;
148148

149-
i2c_lock_adapter(i2c->adapter);
149+
i2c_lock_bus(i2c->adapter, I2C_LOCK_SEGMENT);
150150
read_device(i2c, 0xFA, 0, &zero);
151151
read_device(i2c, 0xFB, 0, &zero);
152152
read_device(i2c, 0xFF, 0, &zero);
153153
ret = write_device(i2c, reg, 1, &data);
154154
read_device(i2c, 0xFE, 0, &zero);
155155
read_device(i2c, 0xFC, 0, &zero);
156-
i2c_unlock_adapter(i2c->adapter);
156+
i2c_unlock_bus(i2c->adapter, I2C_LOCK_SEGMENT);
157157
return ret;
158158
}
159159
EXPORT_SYMBOL(pm860x_page_reg_write);
@@ -164,14 +164,14 @@ int pm860x_page_bulk_read(struct i2c_client *i2c, int reg,
164164
unsigned char zero = 0;
165165
int ret;
166166

167-
i2c_lock_adapter(i2c->adapter);
167+
i2c_lock_bus(i2c->adapter, I2C_LOCK_SEGMENT);
168168
read_device(i2c, 0xfa, 0, &zero);
169169
read_device(i2c, 0xfb, 0, &zero);
170170
read_device(i2c, 0xff, 0, &zero);
171171
ret = read_device(i2c, reg, count, buf);
172172
read_device(i2c, 0xFE, 0, &zero);
173173
read_device(i2c, 0xFC, 0, &zero);
174-
i2c_unlock_adapter(i2c->adapter);
174+
i2c_unlock_bus(i2c->adapter, I2C_LOCK_SEGMENT);
175175
return ret;
176176
}
177177
EXPORT_SYMBOL(pm860x_page_bulk_read);

0 commit comments

Comments
 (0)