mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 11:41:38 -04:00
Merge branch 'i2c-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging
* 'i2c-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging: at24: Use timeout also for read i2c: Fix userspace_device list corruption MAINTAINERS: Add missing i2c files i2c/tsl2550: Fix lux value in extended mode
This commit is contained in:
commit
af5fdf8064
4 changed files with 60 additions and 33 deletions
|
|
@ -257,6 +257,7 @@ static DEVICE_ATTR(operating_mode, S_IWUSR | S_IRUGO,
|
|||
|
||||
static ssize_t __tsl2550_show_lux(struct i2c_client *client, char *buf)
|
||||
{
|
||||
struct tsl2550_data *data = i2c_get_clientdata(client);
|
||||
u8 ch0, ch1;
|
||||
int ret;
|
||||
|
||||
|
|
@ -274,6 +275,8 @@ static ssize_t __tsl2550_show_lux(struct i2c_client *client, char *buf)
|
|||
ret = tsl2550_calculate_lux(ch0, ch1);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
if (data->operating_mode == 1)
|
||||
ret *= 5;
|
||||
|
||||
return sprintf(buf, "%d\n", ret);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -762,6 +762,7 @@ int i2c_del_adapter(struct i2c_adapter *adap)
|
|||
{
|
||||
int res = 0;
|
||||
struct i2c_adapter *found;
|
||||
struct i2c_client *client, *next;
|
||||
|
||||
/* First make sure that this adapter was ever added */
|
||||
mutex_lock(&core_lock);
|
||||
|
|
@ -781,6 +782,16 @@ int i2c_del_adapter(struct i2c_adapter *adap)
|
|||
if (res)
|
||||
return res;
|
||||
|
||||
/* Remove devices instantiated from sysfs */
|
||||
list_for_each_entry_safe(client, next, &userspace_devices, detected) {
|
||||
if (client->adapter == adap) {
|
||||
dev_dbg(&adap->dev, "Removing %s at 0x%x\n",
|
||||
client->name, client->addr);
|
||||
list_del(&client->detected);
|
||||
i2c_unregister_device(client);
|
||||
}
|
||||
}
|
||||
|
||||
/* Detach any active clients. This can't fail, thus we do not
|
||||
checking the returned value. */
|
||||
res = device_for_each_child(&adap->dev, NULL, __unregister_client);
|
||||
|
|
|
|||
Loading…
Reference in a new issue