diff options
| -rw-r--r-- | drivers/i2c/i2c-core.c | 14 | ||||
| -rw-r--r-- | drivers/rtc/rtc-s35390a.c | 2 | ||||
| -rw-r--r-- | include/linux/i2c.h | 2 |
3 files changed, 10 insertions, 8 deletions
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index 26384daccb96..c99ebeadb558 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c | |||
| @@ -327,6 +327,11 @@ void i2c_unregister_device(struct i2c_client *client) | |||
| 327 | EXPORT_SYMBOL_GPL(i2c_unregister_device); | 327 | EXPORT_SYMBOL_GPL(i2c_unregister_device); |
| 328 | 328 | ||
| 329 | 329 | ||
| 330 | static const struct i2c_device_id dummy_id[] = { | ||
| 331 | { "dummy", 0 }, | ||
| 332 | { }, | ||
| 333 | }; | ||
| 334 | |||
| 330 | static int dummy_probe(struct i2c_client *client, | 335 | static int dummy_probe(struct i2c_client *client, |
| 331 | const struct i2c_device_id *id) | 336 | const struct i2c_device_id *id) |
| 332 | { | 337 | { |
| @@ -342,13 +347,13 @@ static struct i2c_driver dummy_driver = { | |||
| 342 | .driver.name = "dummy", | 347 | .driver.name = "dummy", |
| 343 | .probe = dummy_probe, | 348 | .probe = dummy_probe, |
| 344 | .remove = dummy_remove, | 349 | .remove = dummy_remove, |
| 350 | .id_table = dummy_id, | ||
| 345 | }; | 351 | }; |
| 346 | 352 | ||
| 347 | /** | 353 | /** |
| 348 | * i2c_new_dummy - return a new i2c device bound to a dummy driver | 354 | * i2c_new_dummy - return a new i2c device bound to a dummy driver |
| 349 | * @adapter: the adapter managing the device | 355 | * @adapter: the adapter managing the device |
| 350 | * @address: seven bit address to be used | 356 | * @address: seven bit address to be used |
| 351 | * @type: optional label used for i2c_client.name | ||
| 352 | * Context: can sleep | 357 | * Context: can sleep |
| 353 | * | 358 | * |
| 354 | * This returns an I2C client bound to the "dummy" driver, intended for use | 359 | * This returns an I2C client bound to the "dummy" driver, intended for use |
| @@ -364,15 +369,12 @@ static struct i2c_driver dummy_driver = { | |||
| 364 | * i2c_unregister_device(); or NULL to indicate an error. | 369 | * i2c_unregister_device(); or NULL to indicate an error. |
| 365 | */ | 370 | */ |
| 366 | struct i2c_client * | 371 | struct i2c_client * |
| 367 | i2c_new_dummy(struct i2c_adapter *adapter, u16 address, const char *type) | 372 | i2c_new_dummy(struct i2c_adapter *adapter, u16 address) |
| 368 | { | 373 | { |
| 369 | struct i2c_board_info info = { | 374 | struct i2c_board_info info = { |
| 370 | .driver_name = "dummy", | 375 | I2C_BOARD_INFO("dummy", address), |
| 371 | .addr = address, | ||
| 372 | }; | 376 | }; |
| 373 | 377 | ||
| 374 | if (type) | ||
| 375 | strlcpy(info.type, type, sizeof info.type); | ||
| 376 | return i2c_new_device(adapter, &info); | 378 | return i2c_new_device(adapter, &info); |
| 377 | } | 379 | } |
| 378 | EXPORT_SYMBOL_GPL(i2c_new_dummy); | 380 | EXPORT_SYMBOL_GPL(i2c_new_dummy); |
diff --git a/drivers/rtc/rtc-s35390a.c b/drivers/rtc/rtc-s35390a.c index 29f47bacfc77..a6fa1f2f2ca6 100644 --- a/drivers/rtc/rtc-s35390a.c +++ b/drivers/rtc/rtc-s35390a.c | |||
| @@ -227,7 +227,7 @@ static int s35390a_probe(struct i2c_client *client, | |||
| 227 | /* This chip uses multiple addresses, use dummy devices for them */ | 227 | /* This chip uses multiple addresses, use dummy devices for them */ |
| 228 | for (i = 1; i < 8; ++i) { | 228 | for (i = 1; i < 8; ++i) { |
| 229 | s35390a->client[i] = i2c_new_dummy(client->adapter, | 229 | s35390a->client[i] = i2c_new_dummy(client->adapter, |
| 230 | client->addr + i, "rtc-s35390a"); | 230 | client->addr + i); |
| 231 | if (!s35390a->client[i]) { | 231 | if (!s35390a->client[i]) { |
| 232 | dev_err(&client->dev, "Address %02x unavailable\n", | 232 | dev_err(&client->dev, "Address %02x unavailable\n", |
| 233 | client->addr + i); | 233 | client->addr + i); |
diff --git a/include/linux/i2c.h b/include/linux/i2c.h index cb63da5c2139..6716ec808c5e 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h | |||
| @@ -262,7 +262,7 @@ i2c_new_probed_device(struct i2c_adapter *adap, | |||
| 262 | * client handles for the extra addresses. | 262 | * client handles for the extra addresses. |
| 263 | */ | 263 | */ |
| 264 | extern struct i2c_client * | 264 | extern struct i2c_client * |
| 265 | i2c_new_dummy(struct i2c_adapter *adap, u16 address, const char *type); | 265 | i2c_new_dummy(struct i2c_adapter *adap, u16 address); |
| 266 | 266 | ||
| 267 | extern void i2c_unregister_device(struct i2c_client *); | 267 | extern void i2c_unregister_device(struct i2c_client *); |
| 268 | 268 | ||
