diff options
author | Wolfram Sang <wsa@the-dreams.de> | 2014-11-13 08:39:55 -0500 |
---|---|---|
committer | Wolfram Sang <wsa@the-dreams.de> | 2014-11-18 10:08:41 -0500 |
commit | 51cf3b0e2a72bb08cd280be6c0ead4e08ed50a2c (patch) | |
tree | 31f48cf560a4b887a9a2a549fe0cc681a91908cf /drivers/i2c | |
parent | 4470c725ba7b86481c31466640ab487f927de6b7 (diff) |
i2c: mux: create symlink to actual mux device
The current implementation creates muxed i2c-<n> busses as immediate
children of their i2c-<n> 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 "mux_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 <wsa@the-dreams.de>
Tested-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/i2c')
-rw-r--r-- | drivers/i2c/i2c-mux.c | 4 |
1 files changed, 4 insertions, 0 deletions
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, | |||
183 | return NULL; | 183 | return NULL; |
184 | } | 184 | } |
185 | 185 | ||
186 | WARN(sysfs_create_link(&priv->adap.dev.kobj, &mux_dev->kobj, "mux_device"), | ||
187 | "can't create symlink to mux device\n"); | ||
188 | |||
186 | dev_info(&parent->dev, "Added multiplexed i2c bus %d\n", | 189 | dev_info(&parent->dev, "Added multiplexed i2c bus %d\n", |
187 | i2c_adapter_id(&priv->adap)); | 190 | i2c_adapter_id(&priv->adap)); |
188 | 191 | ||
@@ -194,6 +197,7 @@ void i2c_del_mux_adapter(struct i2c_adapter *adap) | |||
194 | { | 197 | { |
195 | struct i2c_mux_priv *priv = adap->algo_data; | 198 | struct i2c_mux_priv *priv = adap->algo_data; |
196 | 199 | ||
200 | sysfs_remove_link(&priv->adap.dev.kobj, "mux_device"); | ||
197 | i2c_del_adapter(adap); | 201 | i2c_del_adapter(adap); |
198 | kfree(priv); | 202 | kfree(priv); |
199 | } | 203 | } |