Re: [PATCH 4.19.y-cip 04/23] usb: roles: Find the muxes by also matching against the device node

Marian-Cristian Rotariu
2020-02-19T19:04:23Z

> -----Original Message-----
> From: Pavel Machek <pavel@denx.de>
> Sent: 19 February 2020 07:51
> To: Marian-Cristian Rotariu <marian-cristian.rotariu.rb@bp.renesas.com>
> Cc: cip-dev@lists.cip-project.org
> Subject: Re: [cip-dev] [PATCH 4.19.y-cip 04/23] usb: roles: Find the muxes by
> also matching against the device node
>
> Hi!
>
> > @@ -84,7 +85,12 @@ enum usb_role usb_role_switch_get_role(struct
> > usb_role_switch *sw) }
> EXPORT_SYMBOL_GPL(usb_role_switch_get_role);
> >
> > -static int __switch_match(struct device *dev, const void *name)
> > +static int switch_fwnode_match(struct device *dev, const void
> > +*fwnode) {
> > + return dev_fwnode(dev) == fwnode;
> > +}
> > +
> > +static int switch_name_match(struct device *dev, const void *name)
> > {
> > return !strcmp((const char *)name, dev_name(dev)); }
>
> This renames __switch_match -> switch_name_match. That is welcome
> cleanup for mainline, but not quite neccessary change here. As the function
> is static and local to the file, we can live with that, but I hope you have not
> had to do extra effort to backport it :-).

Unfortunately, this patch is necessary for the following patches as it introduces
the necessary fwnode. Generally, yes, I had to find the minimum set of changes,
not to modify too much the USB core code. I opted for complete backport
of the upstream patches, not to chop them off and also not to add much code on
top of them (only some minor checkpatch fixes). I think it is better not to increase
the delta between linux-cip and upstream too much.

But, looking retrospectively, this might not be the best strategy.

>
> Best regards,
>
> Pavel
> --
> (english) http://www.livejournal.com/~pavelmachek
> (cesky, pictures)
> http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html