From mboxrd@z Thu Jan 1 00:00:00 1970 From: Guenter Roeck Subject: Re: [PATCH v3 1/2] i2c: mux: create symlink to actual mux device Date: Thu, 13 Nov 2014 19:55:45 -0800 Message-ID: <54657D41.5010006@roeck-us.net> References: <1415885996-14770-1-git-send-email-wsa@the-dreams.de> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1415885996-14770-1-git-send-email-wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org> Sender: linux-i2c-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Wolfram Sang , linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org Cc: Jean Delvare , Martin Belanger , Rodolfo Giometti , Michael Lawnick , Jeroen De Wachter , Gerlando Falauto List-Id: linux-i2c@vger.kernel.org On 11/13/2014 05:39 AM, Wolfram Sang wrote: > The current implementation creates muxed i2c- busses as immediate > children of their i2c- parent bus. In case of multiple muxes on one > bus, it is impossible to determine which muxed bus comes from which mux. > > It could be argued that the parent device should be changed from the > parent adapter to the mux device. This has pros and cons. To improve the > topology, simply add a "muxed_device" symlink pointing to the actual > muxing device, so we can distinguish muxed busses. Doing it this way, we > don't break the ABI. > > Signed-off-by: Wolfram Sang > Cc: Jean Delvare > Cc: Guenter Roeck > Cc: Martin Belanger > Cc: Rodolfo Giometti > Cc: Michael Lawnick > Cc: Jeroen De Wachter > Cc: Gerlando Falauto This version works for me and passes testing with our application code. Tested-by: Guenter Roeck > --- > drivers/i2c/i2c-mux.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/drivers/i2c/i2c-mux.c b/drivers/i2c/i2c-mux.c > index 2d0847b6be62..f246a9f7dd22 100644 > --- a/drivers/i2c/i2c-mux.c > +++ b/drivers/i2c/i2c-mux.c > @@ -183,6 +183,9 @@ struct i2c_adapter *i2c_add_mux_adapter(struct i2c_adapter *parent, > return NULL; > } > > + WARN(sysfs_create_link(&priv->adap.dev.kobj, &mux_dev->kobj, "mux_device"), > + "can't create symlink to mux device\n"); > + > dev_info(&parent->dev, "Added multiplexed i2c bus %d\n", > i2c_adapter_id(&priv->adap)); > > @@ -194,6 +197,7 @@ void i2c_del_mux_adapter(struct i2c_adapter *adap) > { > struct i2c_mux_priv *priv = adap->algo_data; > > + sysfs_remove_link(&priv->adap.dev.kobj, "mux_device"); > i2c_del_adapter(adap); > kfree(priv); > } >