Skip to content

Commit 51cf3b0

Browse files
author
Wolfram Sang
committed
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 <[email protected]> Tested-by: Guenter Roeck <[email protected]>
1 parent 4470c72 commit 51cf3b0

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

drivers/i2c/i2c-mux.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,9 @@ struct i2c_adapter *i2c_add_mux_adapter(struct i2c_adapter *parent,
183183
return NULL;
184184
}
185185

186+
WARN(sysfs_create_link(&priv->adap.dev.kobj, &mux_dev->kobj, "mux_device"),
187+
"can't create symlink to mux device\n");
188+
186189
dev_info(&parent->dev, "Added multiplexed i2c bus %d\n",
187190
i2c_adapter_id(&priv->adap));
188191

@@ -194,6 +197,7 @@ void i2c_del_mux_adapter(struct i2c_adapter *adap)
194197
{
195198
struct i2c_mux_priv *priv = adap->algo_data;
196199

200+
sysfs_remove_link(&priv->adap.dev.kobj, "mux_device");
197201
i2c_del_adapter(adap);
198202
kfree(priv);
199203
}

0 commit comments

Comments
 (0)