Re: [PATCH 2/8] usb: typec: Rationalize the API for the muxes

From: Heikki Krogerus
Date: Mon Jan 28 2019 - 10:28:37 EST


On Mon, Jan 28, 2019 at 11:50:31AM +0200, Andy Shevchenko wrote:
> On Fri, Jan 25, 2019 at 3:18 PM Heikki Krogerus
> <heikki.krogerus@xxxxxxxxxxxxxxx> wrote:
> >
> > We can replace the second parameter that is passed to the
> > typec_mux_get() function with alt mode description
> > structure, and simply pass NULL with accessory modes.
> >
> > With accessory modes there is no need for additional
> > identification (in practice the accessory mode can only be
> > Audio Accessory if muxing is needed), only with alternate
> > modes we need to identify the exact alternate mode.
>
> > +struct typec_mux *typec_mux_get(struct device *dev,
> > + const struct typec_altmode_desc *desc)
> > {
> > struct typec_mux *mux;
> >
> > mutex_lock(&mux_lock);
> > - mux = device_connection_find_match(dev, name, NULL, typec_mux_match);
> > + mux = device_connection_find_match(dev, "typec-mux", (void *)desc,
> > + typec_mux_match);
>
> Not related to this series, but shouldn't
> device_connection_find_match() be improved to avoid dropping const
> qualifier?

I'll see if we can do that already.

thanks,

--
heikki