public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] i2c: i2c-mux: Fix channel parent node assignment
@ 2017-05-30  8:13 Jacopo Mondi
  2017-05-30  8:31 ` Geert Uytterhoeven
  0 siblings, 1 reply; 4+ messages in thread
From: Jacopo Mondi @ 2017-05-30  8:13 UTC (permalink / raw)
  To: peda, laurent.pinchart, wsa; +Cc: linux-i2c, linux-renesas-soc

I2c-mux channels are created with the mux parent device as their own
parent, while they should be siblings of the mux itself.
Fix this.

Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

---

Hello,
   while inspecting child nodes of an i2c adapter it has been noted that
child devices of an i2c-mux are listed as children of the i2c adapter itself,
and not of the i2c-mux.

The hierarchy of devices looked like

-- i2c-04
--- eeprom@57
--- video_receiver@70
--- video_receiver@34
--- gmsl-deserializer@0		<-- MUX
--- gmsl-deserializer@0/i2c@0	<-- MUX CHANNEL

It now looks like

-- i2c-04
--- eeprom@57
--- video_receiver@70
--- video_receiver@34
--- gmsl-deserializer@0
---- gmsl-deserializer@0/i2c@0

 drivers/i2c/i2c-mux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i2c/i2c-mux.c b/drivers/i2c/i2c-mux.c
index 83768e8..37b7804 100644
--- a/drivers/i2c/i2c-mux.c
+++ b/drivers/i2c/i2c-mux.c
@@ -324,7 +324,7 @@ int i2c_mux_add_adapter(struct i2c_mux_core *muxc,
 	priv->adap.owner = THIS_MODULE;
 	priv->adap.algo = &priv->algo;
 	priv->adap.algo_data = priv;
-	priv->adap.dev.parent = &parent->dev;
+	priv->adap.dev.parent = muxc->dev;
 	priv->adap.retries = parent->retries;
 	priv->adap.timeout = parent->timeout;
 	priv->adap.quirks = parent->quirks;
--
2.7.4

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

* Re: [PATCH] i2c: i2c-mux: Fix channel parent node assignment
  2017-05-30  8:13 [PATCH] i2c: i2c-mux: Fix channel parent node assignment Jacopo Mondi
@ 2017-05-30  8:31 ` Geert Uytterhoeven
  2017-05-30  8:38   ` jmondi
  0 siblings, 1 reply; 4+ messages in thread
From: Geert Uytterhoeven @ 2017-05-30  8:31 UTC (permalink / raw)
  To: Jacopo Mondi
  Cc: Peter Rosin, Laurent Pinchart, Wolfram Sang, Linux I2C,
	Linux-Renesas

Hi Jacopo,

On Tue, May 30, 2017 at 10:13 AM, Jacopo Mondi
<jacopo+renesas@jmondi.org> wrote:
> I2c-mux channels are created with the mux parent device as their own
> parent, while they should be siblings of the mux itself.

Isn't it the other way around? Cfr. the example and the patch.

> Fix this.
>
> Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
> Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
>
> ---
>
> Hello,
>    while inspecting child nodes of an i2c adapter it has been noted that
> child devices of an i2c-mux are listed as children of the i2c adapter itself,
> and not of the i2c-mux.
>
> The hierarchy of devices looked like
>
> -- i2c-04
> --- eeprom@57
> --- video_receiver@70
> --- video_receiver@34
> --- gmsl-deserializer@0         <-- MUX
> --- gmsl-deserializer@0/i2c@0   <-- MUX CHANNEL

= sibling of mux

>
> It now looks like
>
> -- i2c-04
> --- eeprom@57
> --- video_receiver@70
> --- video_receiver@34
> --- gmsl-deserializer@0
> ---- gmsl-deserializer@0/i2c@0

= child of mux

>
>  drivers/i2c/i2c-mux.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/i2c/i2c-mux.c b/drivers/i2c/i2c-mux.c
> index 83768e8..37b7804 100644
> --- a/drivers/i2c/i2c-mux.c
> +++ b/drivers/i2c/i2c-mux.c
> @@ -324,7 +324,7 @@ int i2c_mux_add_adapter(struct i2c_mux_core *muxc,
>         priv->adap.owner = THIS_MODULE;
>         priv->adap.algo = &priv->algo;
>         priv->adap.algo_data = priv;
> -       priv->adap.dev.parent = &parent->dev;

= sibling of mux

> +       priv->adap.dev.parent = muxc->dev;

= child of mux

>         priv->adap.retries = parent->retries;
>         priv->adap.timeout = parent->timeout;
>         priv->adap.quirks = parent->quirks;

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH] i2c: i2c-mux: Fix channel parent node assignment
  2017-05-30  8:31 ` Geert Uytterhoeven
@ 2017-05-30  8:38   ` jmondi
  2017-05-30  8:46     ` Geert Uytterhoeven
  0 siblings, 1 reply; 4+ messages in thread
From: jmondi @ 2017-05-30  8:38 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Jacopo Mondi, Peter Rosin, Laurent Pinchart, Wolfram Sang,
	Linux I2C, Linux-Renesas

Hi Geert,

On Tue, May 30, 2017 at 10:31:21AM +0200, Geert Uytterhoeven wrote:
> Hi Jacopo,
>
> On Tue, May 30, 2017 at 10:13 AM, Jacopo Mondi
> <jacopo+renesas@jmondi.org> wrote:
> > I2c-mux channels are created with the mux parent device as their own
> > parent, while they should be siblings of the mux itself.
>
> Isn't it the other way around? Cfr. the example and the patch.

Yeah, I actually didn't know the exact meaning of "siblings" then.

So:
I2c-mux channels are created as mux siblings while they should be
children of the mux itself. Fix it.

Any better? ;)

Thanks
   j
>
> > Fix this.
> >
> > Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
> > Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> >
> > ---
> >
> > Hello,
> >    while inspecting child nodes of an i2c adapter it has been noted that
> > child devices of an i2c-mux are listed as children of the i2c adapter itself,
> > and not of the i2c-mux.
> >
> > The hierarchy of devices looked like
> >
> > -- i2c-04
> > --- eeprom@57
> > --- video_receiver@70
> > --- video_receiver@34
> > --- gmsl-deserializer@0         <-- MUX
> > --- gmsl-deserializer@0/i2c@0   <-- MUX CHANNEL
>
> = sibling of mux
>
> >
> > It now looks like
> >
> > -- i2c-04
> > --- eeprom@57
> > --- video_receiver@70
> > --- video_receiver@34
> > --- gmsl-deserializer@0
> > ---- gmsl-deserializer@0/i2c@0
>
> = child of mux
>
> >
> >  drivers/i2c/i2c-mux.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/i2c/i2c-mux.c b/drivers/i2c/i2c-mux.c
> > index 83768e8..37b7804 100644
> > --- a/drivers/i2c/i2c-mux.c
> > +++ b/drivers/i2c/i2c-mux.c
> > @@ -324,7 +324,7 @@ int i2c_mux_add_adapter(struct i2c_mux_core *muxc,
> >         priv->adap.owner = THIS_MODULE;
> >         priv->adap.algo = &priv->algo;
> >         priv->adap.algo_data = priv;
> > -       priv->adap.dev.parent = &parent->dev;
>
> = sibling of mux
>
> > +       priv->adap.dev.parent = muxc->dev;
>
> = child of mux
>
> >         priv->adap.retries = parent->retries;
> >         priv->adap.timeout = parent->timeout;
> >         priv->adap.quirks = parent->quirks;
>
> Gr{oetje,eeting}s,
>
>                         Geert
>
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
>
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
>                                 -- Linus Torvalds

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

* Re: [PATCH] i2c: i2c-mux: Fix channel parent node assignment
  2017-05-30  8:38   ` jmondi
@ 2017-05-30  8:46     ` Geert Uytterhoeven
  0 siblings, 0 replies; 4+ messages in thread
From: Geert Uytterhoeven @ 2017-05-30  8:46 UTC (permalink / raw)
  To: jmondi
  Cc: Jacopo Mondi, Peter Rosin, Laurent Pinchart, Wolfram Sang,
	Linux I2C, Linux-Renesas

Hi Jacopo,

On Tue, May 30, 2017 at 10:38 AM, jmondi <jacopo@jmondi.org> wrote:
> On Tue, May 30, 2017 at 10:31:21AM +0200, Geert Uytterhoeven wrote:
>> On Tue, May 30, 2017 at 10:13 AM, Jacopo Mondi
>> <jacopo+renesas@jmondi.org> wrote:
>> > I2c-mux channels are created with the mux parent device as their own
>> > parent, while they should be siblings of the mux itself.
>>
>> Isn't it the other way around? Cfr. the example and the patch.
>
> Yeah, I actually didn't know the exact meaning of "siblings" then.
>
> So:
> I2c-mux channels are created as mux siblings while they should be
> children of the mux itself. Fix it.
>
> Any better? ;)

Perfect!

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

end of thread, other threads:[~2017-05-30  8:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-30  8:13 [PATCH] i2c: i2c-mux: Fix channel parent node assignment Jacopo Mondi
2017-05-30  8:31 ` Geert Uytterhoeven
2017-05-30  8:38   ` jmondi
2017-05-30  8:46     ` Geert Uytterhoeven

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox