aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c/i2c-core.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-05-11 20:09:24 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-05-11 20:09:24 -0400
commit57014123512633ab0c38a4fea4140bf156f6a3a0 (patch)
treea46e864f9c508d8228e79928519742af6a42b7e4 /drivers/i2c/i2c-core.c
parentc3921ab71507b108d51a0f1ee960f80cd668a93d (diff)
parentae429083efe996ca2c569c44fd6fea440676dc33 (diff)
Merge branch 'i2c-for-linus' of git://jdelvare.pck.nerim.net/jdelvare-2.6
* 'i2c-for-linus' of git://jdelvare.pck.nerim.net/jdelvare-2.6: i2c: Convert some more new-style drivers to use module aliasing i2c: Match dummy devices by type i2c-sibyte: Mark i2c_sibyte_add_bus() as static i2c-sibyte: Correct a comment about frequency i2c: Improve the functionality documentation i2c: Improve smbus-protocol documentation i2c-piix4: Blacklist two mainboards i2c-piix4: Increase the intitial delay for the ServerWorks CSB5 i2c-mpc: Compare to NO_IRQ instead of zero
Diffstat (limited to 'drivers/i2c/i2c-core.c')
-rw-r--r--drivers/i2c/i2c-core.c14
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)
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);