* [RFC] i2c: mux: add mux device to the adapter name
@ 2014-11-03 21:00 Wolfram Sang
[not found] ` <1415048456-13456-1-git-send-email-wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: Wolfram Sang @ 2014-11-03 21:00 UTC (permalink / raw)
To: linux-i2c-u79uwXL29TY76Z2rM5mHXA
Cc: Wolfram Sang, Jean Delvare, Guenter Roeck, Martin Belanger,
Rodolfo Giometti, Michael Lawnick, Jeroen De Wachter
If there are multiple muxes on one bus, then specifying the channel only
is not sufficient for a distinguishable name. We need the actual device,
too.
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>
---
This is probably the least "ABI" breaking solution? RFC for now...
drivers/i2c/i2c-mux.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/i2c/i2c-mux.c b/drivers/i2c/i2c-mux.c
index 5b482ea32faf..26aa84902ada 100644
--- a/drivers/i2c/i2c-mux.c
+++ b/drivers/i2c/i2c-mux.c
@@ -134,7 +134,8 @@ struct i2c_adapter *i2c_add_mux_adapter(struct i2c_adapter *parent,
/* Now fill out new adapter structure */
snprintf(priv->adap.name, sizeof(priv->adap.name),
- "i2c-%d-mux (chan_id %d)", i2c_adapter_id(parent), chan_id);
+ "i2c-%d-mux (chan_id %d) (mux_device %s)",
+ i2c_adapter_id(parent), chan_id, dev_name(mux_dev));
priv->adap.owner = THIS_MODULE;
priv->adap.algo = &priv->algo;
priv->adap.algo_data = priv;
--
2.1.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [RFC] i2c: mux: add mux device to the adapter name
[not found] ` <1415048456-13456-1-git-send-email-wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
@ 2014-11-05 18:38 ` Guenter Roeck
[not found] ` <20141105183834.GB22304-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: Guenter Roeck @ 2014-11-05 18:38 UTC (permalink / raw)
To: Wolfram Sang
Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA, Jean Delvare, Martin Belanger,
Rodolfo Giometti, Michael Lawnick, Jeroen De Wachter
On Mon, Nov 03, 2014 at 10:00:56PM +0100, Wolfram Sang wrote:
> If there are multiple muxes on one bus, then specifying the channel only
> is not sufficient for a distinguishable name. We need the actual device,
> too.
>
> 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>
> ---
>
> This is probably the least "ABI" breaking solution? RFC for now...
>
> drivers/i2c/i2c-mux.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/i2c/i2c-mux.c b/drivers/i2c/i2c-mux.c
> index 5b482ea32faf..26aa84902ada 100644
> --- a/drivers/i2c/i2c-mux.c
> +++ b/drivers/i2c/i2c-mux.c
> @@ -134,7 +134,8 @@ struct i2c_adapter *i2c_add_mux_adapter(struct i2c_adapter *parent,
>
> /* Now fill out new adapter structure */
> snprintf(priv->adap.name, sizeof(priv->adap.name),
> - "i2c-%d-mux (chan_id %d)", i2c_adapter_id(parent), chan_id);
> + "i2c-%d-mux (chan_id %d) (mux_device %s)",
> + i2c_adapter_id(parent), chan_id, dev_name(mux_dev));
This yields pretty long names, longer than the maximum supported length,
if the mux is not an i2c adapter (eg i2c-mux-pinctrl).
i2c-17-mux (chan_id 5) (mux_device i2c-mux-pinctrl)
has 52 characters, and the maximum name length is 48.
Maybe just use "mux" instead of "mux_adapter" ?
The result still fails for me because the application code doesn't expect
to see "(mux...)", but I guess there will always be some problem :-(.
I still need to figure out what causes the failure with the other patch.
Guenter
> priv->adap.owner = THIS_MODULE;
> priv->adap.algo = &priv->algo;
> priv->adap.algo_data = priv;
> --
> 2.1.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RFC] i2c: mux: add mux device to the adapter name
[not found] ` <20141105183834.GB22304-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>
@ 2014-11-07 11:52 ` Wolfram Sang
0 siblings, 0 replies; 3+ messages in thread
From: Wolfram Sang @ 2014-11-07 11:52 UTC (permalink / raw)
To: Guenter Roeck
Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA, Jean Delvare, Martin Belanger,
Rodolfo Giometti, Michael Lawnick, Jeroen De Wachter
[-- Attachment #1: Type: text/plain, Size: 2536 bytes --]
On Wed, Nov 05, 2014 at 10:38:34AM -0800, Guenter Roeck wrote:
> On Mon, Nov 03, 2014 at 10:00:56PM +0100, Wolfram Sang wrote:
> > If there are multiple muxes on one bus, then specifying the channel only
> > is not sufficient for a distinguishable name. We need the actual device,
> > too.
> >
> > 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>
> > ---
> >
> > This is probably the least "ABI" breaking solution? RFC for now...
> >
> > drivers/i2c/i2c-mux.c | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/i2c/i2c-mux.c b/drivers/i2c/i2c-mux.c
> > index 5b482ea32faf..26aa84902ada 100644
> > --- a/drivers/i2c/i2c-mux.c
> > +++ b/drivers/i2c/i2c-mux.c
> > @@ -134,7 +134,8 @@ struct i2c_adapter *i2c_add_mux_adapter(struct i2c_adapter *parent,
> >
> > /* Now fill out new adapter structure */
> > snprintf(priv->adap.name, sizeof(priv->adap.name),
> > - "i2c-%d-mux (chan_id %d)", i2c_adapter_id(parent), chan_id);
> > + "i2c-%d-mux (chan_id %d) (mux_device %s)",
> > + i2c_adapter_id(parent), chan_id, dev_name(mux_dev));
>
> This yields pretty long names, longer than the maximum supported length,
> if the mux is not an i2c adapter (eg i2c-mux-pinctrl).
>
> i2c-17-mux (chan_id 5) (mux_device i2c-mux-pinctrl)
>
> has 52 characters, and the maximum name length is 48.
> Maybe just use "mux" instead of "mux_adapter" ?
Argh, right. With that length limit, it doesn't make sense to use %s, at
all. For DT the name comes from the node name and that could be even
longer, so shortening to "mux" wouldn't help much.
> The result still fails for me because the application code doesn't expect
> to see "(mux...)", but I guess there will always be some problem :-(.
Yes, because it is ABI breakage. Honestly, with that size limit as
another obstacle, I think we should leave the 'name' file as it is and
use proper topology.
> I still need to figure out what causes the failure with the other patch.
Yes, please. Thanks for doing that!
Wolfram
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-11-07 11:52 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-03 21:00 [RFC] i2c: mux: add mux device to the adapter name Wolfram Sang
[not found] ` <1415048456-13456-1-git-send-email-wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
2014-11-05 18:38 ` Guenter Roeck
[not found] ` <20141105183834.GB22304-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>
2014-11-07 11:52 ` 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).