diff options
Diffstat (limited to 'drivers/i2c/i2c-core.c')
-rw-r--r-- | drivers/i2c/i2c-core.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index 29d3f045a2bf..75ba8608383e 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c | |||
@@ -254,10 +254,12 @@ static int i2c_device_probe(struct device *dev) | |||
254 | client->flags & I2C_CLIENT_WAKE); | 254 | client->flags & I2C_CLIENT_WAKE); |
255 | dev_dbg(dev, "probe\n"); | 255 | dev_dbg(dev, "probe\n"); |
256 | 256 | ||
257 | acpi_dev_pm_attach(&client->dev, true); | ||
257 | status = driver->probe(client, i2c_match_id(driver->id_table, client)); | 258 | status = driver->probe(client, i2c_match_id(driver->id_table, client)); |
258 | if (status) { | 259 | if (status) { |
259 | client->driver = NULL; | 260 | client->driver = NULL; |
260 | i2c_set_clientdata(client, NULL); | 261 | i2c_set_clientdata(client, NULL); |
262 | acpi_dev_pm_detach(&client->dev, true); | ||
261 | } | 263 | } |
262 | return status; | 264 | return status; |
263 | } | 265 | } |
@@ -283,6 +285,7 @@ static int i2c_device_remove(struct device *dev) | |||
283 | client->driver = NULL; | 285 | client->driver = NULL; |
284 | i2c_set_clientdata(client, NULL); | 286 | i2c_set_clientdata(client, NULL); |
285 | } | 287 | } |
288 | acpi_dev_pm_detach(&client->dev, true); | ||
286 | return status; | 289 | return status; |
287 | } | 290 | } |
288 | 291 | ||
@@ -1111,8 +1114,10 @@ static acpi_status acpi_i2c_add_device(acpi_handle handle, u32 level, | |||
1111 | if (ret < 0 || !info.addr) | 1114 | if (ret < 0 || !info.addr) |
1112 | return AE_OK; | 1115 | return AE_OK; |
1113 | 1116 | ||
1117 | adev->power.flags.ignore_parent = true; | ||
1114 | strlcpy(info.type, dev_name(&adev->dev), sizeof(info.type)); | 1118 | strlcpy(info.type, dev_name(&adev->dev), sizeof(info.type)); |
1115 | if (!i2c_new_device(adapter, &info)) { | 1119 | if (!i2c_new_device(adapter, &info)) { |
1120 | adev->power.flags.ignore_parent = false; | ||
1116 | dev_err(&adapter->dev, | 1121 | dev_err(&adapter->dev, |
1117 | "failed to add I2C device %s from ACPI\n", | 1122 | "failed to add I2C device %s from ACPI\n", |
1118 | dev_name(&adev->dev)); | 1123 | dev_name(&adev->dev)); |
@@ -1134,6 +1139,9 @@ static void acpi_i2c_register_devices(struct i2c_adapter *adap) | |||
1134 | acpi_handle handle; | 1139 | acpi_handle handle; |
1135 | acpi_status status; | 1140 | acpi_status status; |
1136 | 1141 | ||
1142 | if (!adap->dev.parent) | ||
1143 | return; | ||
1144 | |||
1137 | handle = ACPI_HANDLE(adap->dev.parent); | 1145 | handle = ACPI_HANDLE(adap->dev.parent); |
1138 | if (!handle) | 1146 | if (!handle) |
1139 | return; | 1147 | return; |