Re: [PATCH 4/8] usb: typec: mux: Find the muxes by also matching against the device node

From: Andy Shevchenko
Date: Mon Jan 28 2019 - 11:55:31 EST


On Mon, Jan 28, 2019 at 5:46 PM Heikki Krogerus
<heikki.krogerus@xxxxxxxxxxxxxxx> wrote:
> On Mon, Jan 28, 2019 at 11:53:54AM +0200, Andy Shevchenko wrote:
> > On Fri, Jan 25, 2019 at 3:17 PM Heikki Krogerus
> > <heikki.krogerus@xxxxxxxxxxxxxxx> wrote:

> > > + bool match = !con->id;
> >
> > I don't see how this assignment is used.
>
> That definitely deserves a comment at least.
>
> This series adds support for the "device graph" to the device
> connection API, but it is also possible to describe connections with
> normal references (fwnode_property_get_reference_args()). With normal
> references we don't need to do any extra identification like we do
> with device graph.
>
> The idea is to supply the connection id only if it has not been
> "consumed" already (device graph case). If it has been "consumed", we
> know there is no need for any extra connection identification (normal
> references), and we can jump straight to the next stage -> find the
> mux..
>

> > > + if (!con->fwnode) {
> > > + list_for_each_entry(mux, &mux_list, entry)
> > > + if (!strcmp(con->endpoint[ep], dev_name(mux->dev)))
> > > + return mux;
> > > + return ERR_PTR(-EPROBE_DEFER);
> > > + }
> > > +
> > > + if (match)
> > > + goto find_mux;
>
> ..here.
>
> I'll change this so that the match variable is introduced without
> setting default value. Instead, how about this:
>
> /*
> * Check has the identifier already been "consumed". If it
> * has, no need to do any extra connection identification.
> */
> match = !con->id;
> if (match)
> goto find_mux;

Cool, thanks!


--
With Best Regards,
Andy Shevchenko