[PATCH 2/2] i2c: i2c-tiny-usb: Add parameter for optional user-defined devices.

From: Alexander Holler
Date: Tue Nov 13 2012 - 13:06:37 EST


Now there is an example about how to use this functionality.

Cc: Jean Delvare <khali@xxxxxxxxxxxx>
Cc: Till Harbaum <till@xxxxxxxxxxx>
Signed-off-by: Alexander Holler <holler@xxxxxxxxxxxxx>
---
Documentation/i2c/instantiating-devices | 2 ++
drivers/i2c/busses/i2c-tiny-usb.c | 4 ++++
2 files changed, 6 insertions(+)

diff --git a/Documentation/i2c/instantiating-devices b/Documentation/i2c/instantiating-devices
index 1dbfdf3..783a79f 100644
--- a/Documentation/i2c/instantiating-devices
+++ b/Documentation/i2c/instantiating-devices
@@ -246,3 +246,5 @@ modprobe my_i2c_bus devices=ds1307@0x68,pcf8563@0x51
or even at the kernel command line with

my_i2c_bus.devices=ds1307@0x68,pcf8563@0x51
+
+See the i2c-tiny-usb driver for an exmaple.
diff --git a/drivers/i2c/busses/i2c-tiny-usb.c b/drivers/i2c/busses/i2c-tiny-usb.c
index 0510636..9fd03c6 100644
--- a/drivers/i2c/busses/i2c-tiny-usb.c
+++ b/drivers/i2c/busses/i2c-tiny-usb.c
@@ -40,6 +40,8 @@ module_param(delay, ushort, 0);
MODULE_PARM_DESC(delay, "bit delay in microseconds "
"(default is 10us for 100kHz max)");

+MODULE_PARAM_I2C_OPTIONAL_DEVICES(opt_devices);
+
static int usb_read(struct i2c_adapter *adapter, int cmd,
int value, int index, void *data, int len);

@@ -236,6 +238,8 @@ static int i2c_tiny_usb_probe(struct usb_interface *interface,
/* inform user about successful attachment to i2c layer */
dev_info(&dev->adapter.dev, "connected i2c-tiny-usb device\n");

+ i2c_add_optional_devices(&dev->adapter, opt_devices);
+
return 0;

error:
--
1.7.11.7

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/