diff options
Diffstat (limited to 'drivers/i2c/i2c-core.c')
-rw-r--r-- | drivers/i2c/i2c-core.c | 14 |
1 files changed, 8 insertions, 6 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); |