Message ID | 1415885996-14770-2-git-send-email-wsa@the-dreams.de |
---|---|
State | Accepted |
Headers | show |
On Thu, Nov 13, 2014 at 02:39:56PM +0100, Wolfram Sang wrote: > From: Gerlando Falauto <gerlando.falauto@keymile.com> > > This makes the topology clearer. For instance, by adding a pca9547 > device with address 0x70 to bus i2c-0, you get: > > /sys/class/i2c-dev/i2c-0/device/0-0070/channel-0 -> i2c-1 > ... > /sys/class/i2c-dev/i2c-0/device/0-0070/channel-7 -> i2c-8 > > Signed-off-by: Gerlando Falauto <gerlando.falauto@keymile.com> > [wsa: simplified sysfs-usage and fixed format string usage] > Signed-off-by: Wolfram Sang <wsa@the-dreams.de> > Cc: Jean Delvare <jdelvare@suse.de> > Cc: Guenter Roeck <linux@roeck-us.net> > Cc: Martin Belanger <martin.belanger@cyaninc.com> > Cc: Rodolfo Giometti <giometti@enneenne.com> > Cc: Michael Lawnick <ml.lawnick@gmx.de> > Cc: Jeroen De Wachter <jeroen.de.wachter@telenet.be> Applied to for-next, thanks!
I know this has already been applied but I wanted to comment that on embedded systems this patch increases the probe time of mux devices. Otherwise the patch works and provides much needed parent device information without breaking the api. On Tue, Nov 18, 2014 at 7:12 AM, Wolfram Sang <wsa@the-dreams.de> wrote: > On Thu, Nov 13, 2014 at 02:39:56PM +0100, Wolfram Sang wrote: >> From: Gerlando Falauto <gerlando.falauto@keymile.com> >> >> This makes the topology clearer. For instance, by adding a pca9547 >> device with address 0x70 to bus i2c-0, you get: >> >> /sys/class/i2c-dev/i2c-0/device/0-0070/channel-0 -> i2c-1 >> ... >> /sys/class/i2c-dev/i2c-0/device/0-0070/channel-7 -> i2c-8 >> >> Signed-off-by: Gerlando Falauto <gerlando.falauto@keymile.com> >> [wsa: simplified sysfs-usage and fixed format string usage] >> Signed-off-by: Wolfram Sang <wsa@the-dreams.de> >> Cc: Jean Delvare <jdelvare@suse.de> >> Cc: Guenter Roeck <linux@roeck-us.net> >> Cc: Martin Belanger <martin.belanger@cyaninc.com> >> Cc: Rodolfo Giometti <giometti@enneenne.com> >> Cc: Michael Lawnick <ml.lawnick@gmx.de> >> Cc: Jeroen De Wachter <jeroen.de.wachter@telenet.be> > > Applied to for-next, thanks! >
On Sat, Nov 29, 2014 at 03:29:46PM -0800, Danielle Costantino wrote: > I know this has already been applied but I wanted to comment that on > embedded systems this patch increases the probe time of mux devices. In what magnitude is the delay? And in what setup? How did you measure? I have doubts. This patch just adds a symlink to the sysfs filesystem. sysfs is not needed for probing. > Otherwise the patch works and provides much needed parent device > information without breaking the api. Any news on lsi2c, by the way?
diff --git a/drivers/i2c/i2c-mux.c b/drivers/i2c/i2c-mux.c index f246a9f7dd22..593f7ca9adc7 100644 --- a/drivers/i2c/i2c-mux.c +++ b/drivers/i2c/i2c-mux.c @@ -110,6 +110,7 @@ struct i2c_adapter *i2c_add_mux_adapter(struct i2c_adapter *parent, void *, u32)) { struct i2c_mux_priv *priv; + char symlink_name[20]; int ret; priv = kzalloc(sizeof(struct i2c_mux_priv), GFP_KERNEL); @@ -186,6 +187,9 @@ struct i2c_adapter *i2c_add_mux_adapter(struct i2c_adapter *parent, WARN(sysfs_create_link(&priv->adap.dev.kobj, &mux_dev->kobj, "mux_device"), "can't create symlink to mux device\n"); + snprintf(symlink_name, sizeof(symlink_name), "channel-%u", chan_id); + WARN(sysfs_create_link(&mux_dev->kobj, &priv->adap.dev.kobj, symlink_name), + "can't create symlink for channel %u\n", chan_id); dev_info(&parent->dev, "Added multiplexed i2c bus %d\n", i2c_adapter_id(&priv->adap)); @@ -196,6 +200,10 @@ EXPORT_SYMBOL_GPL(i2c_add_mux_adapter); void i2c_del_mux_adapter(struct i2c_adapter *adap) { struct i2c_mux_priv *priv = adap->algo_data; + char symlink_name[20]; + + snprintf(symlink_name, sizeof(symlink_name), "channel-%u", priv->chan_id); + sysfs_remove_link(&adap->dev.parent->kobj, symlink_name); sysfs_remove_link(&priv->adap.dev.kobj, "mux_device"); i2c_del_adapter(adap);