linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 1/2] i2c: mux: create symlink to actual mux device
@ 2014-11-13 13:39 Wolfram Sang
       [not found] ` <1415885996-14770-1-git-send-email-wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
  0 siblings, 1 reply; 9+ messages in thread
From: Wolfram Sang @ 2014-11-13 13:39 UTC (permalink / raw)
  To: linux-i2c-u79uwXL29TY76Z2rM5mHXA
  Cc: Wolfram Sang, Jean Delvare, Guenter Roeck, Martin Belanger,
	Rodolfo Giometti, Michael Lawnick, Jeroen De Wachter,
	Gerlando Falauto

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 "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 <wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
Cc: Jean Delvare <jdelvare-l3A5Bk7waGM@public.gmane.org>
Cc: Guenter Roeck <linux-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>
Cc: Martin Belanger <martin.belanger-Ir6+u9MVKBtBDgjK7y7TUQ@public.gmane.org>
Cc: Rodolfo Giometti <giometti-AVVDYK/kqiJWk0Htik3J/w@public.gmane.org>
Cc: Michael Lawnick <ml.lawnick-Mmb7MZpHnFY@public.gmane.org>
Cc: Jeroen De Wachter <jeroen.de.wachter-CNXmb7IdZIWZIoH1IeqzKA@public.gmane.org>
Cc: Gerlando Falauto <gerlando.falauto-SkAbAL50j+5BDgjK7y7TUQ@public.gmane.org>
---
 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);
 }
-- 
2.1.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2014-12-01 17:26 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-13 13:39 [PATCH v3 1/2] i2c: mux: create symlink to actual mux device Wolfram Sang
     [not found] ` <1415885996-14770-1-git-send-email-wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
2014-11-13 13:39   ` [PATCH v3 2/2] i2c: mux: create "channel-n" symlinks for child segments in the " Wolfram Sang
     [not found]     ` <1415885996-14770-2-git-send-email-wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
2014-11-18 15:12       ` Wolfram Sang
2014-11-29 23:29         ` Danielle Costantino
     [not found]           ` <CAAVjN7etzqy7tum5yboVErhWZ=VhKy9c6UG5xMMTihgjG9ZDqg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-12-01 17:26             ` Wolfram Sang
2014-11-14  3:55   ` [PATCH v3 1/2] i2c: mux: create symlink to actual " Guenter Roeck
     [not found]     ` <54657D41.5010006-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>
2014-11-14 10:01       ` Jeroen De Wachter
     [not found]         ` <468558661.38819776.1415959307717.JavaMail.root-CNXmb7IdZIWZIoH1IeqzKA@public.gmane.org>
2014-11-14 11:32           ` Wolfram Sang
2014-11-18 15:11   ` Wolfram Sang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).