Commit e1053963 authored by Dmitry Torokhov's avatar Dmitry Torokhov Committed by Darren Hart (VMware)

platform/x86: silead_dmi - do not treat all devices as i2c_clients

I2C bus has both i2c clients and adapter devices, so we must be careful in
notifier code and verify that we are actually dealing with an i2c client
before using it as such.

Fixes: cef9dd85 ("platform/x86: add support for devices with Silead...")
Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
Reviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
[andy: simplified silead_ts_dmi_add_props() change]
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
parent f3582361
......@@ -96,9 +96,9 @@ static const struct dmi_system_id silead_ts_dmi_table[] = {
{ },
};
static void silead_ts_dmi_add_props(struct device *dev)
static void silead_ts_dmi_add_props(struct i2c_client *client)
{
struct i2c_client *client = to_i2c_client(dev);
struct device *dev = &client->dev;
const struct dmi_system_id *dmi_id;
const struct silead_ts_dmi_data *ts_data;
int error;
......@@ -120,10 +120,13 @@ static int silead_ts_dmi_notifier_call(struct notifier_block *nb,
unsigned long action, void *data)
{
struct device *dev = data;
struct i2c_client *client;
switch (action) {
case BUS_NOTIFY_ADD_DEVICE:
silead_ts_dmi_add_props(dev);
client = i2c_verify_client(dev);
if (client)
silead_ts_dmi_add_props(client);
break;
default:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment