aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2008-05-11 14:37:06 -0400
committerJean Delvare <khali@hyperion.delvare>2008-05-11 14:37:06 -0400
commit60b129d7bfa3e20450816983bd52c49bb0bc1c21 (patch)
tree20a49a8b11a4e8cf9386a84956d6660960323f26 /drivers
parentb11a9d8392a698f01337232aa8c5d5603519943f (diff)
i2c: Match dummy devices by type
As the old driver_name/type matching scheme is going away soon, change the dummy device mechanism to use the new matching scheme. This has the downside that dummy i2c clients can no longer choose their name, they'll all appear as "dummy" in sysfs and in log messages. I don't think it is a problem in practice though, as there is little reason to use these i2c clients to log messages. Signed-off-by: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/i2c/i2c-core.c14
-rw-r--r--drivers/rtc/rtc-s35390a.c2
2 files changed, 9 insertions, 7 deletions
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index 26384daccb9..c99ebeadb55 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)
327EXPORT_SYMBOL_GPL(i2c_unregister_device); 327EXPORT_SYMBOL_GPL(i2c_unregister_device);
328 328
329 329
330static const struct i2c_device_id dummy_id[] = {
331 { "dummy", 0 },
332 { },
333};
334
330static int dummy_probe(struct i2c_client *client, 335static 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 */
366struct i2c_client * 371struct i2c_client *
367i2c_new_dummy(struct i2c_adapter *adapter, u16 address, const char *type) 372i2c_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}
378EXPORT_SYMBOL_GPL(i2c_new_dummy); 380EXPORT_SYMBOL_GPL(i2c_new_dummy);
diff --git a/drivers/rtc/rtc-s35390a.c b/drivers/rtc/rtc-s35390a.c
index 29f47bacfc7..a6fa1f2f2ca 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);