[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <VI1PR04MB45581A938E8BC3FA50960A7589650@VI1PR04MB4558.eurprd04.prod.outlook.com>
Date: Tue, 12 Feb 2019 10:41:28 +0000
From: Jun Li <jun.li@....com>
To: Heikki Krogerus <heikki.krogerus@...ux.intel.com>
CC: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Andy Shevchenko <andy.shevchenko@...il.com>,
Chen Yu <chenyu56@...wei.com>,
Hans de Goede <hdegoede@...hat.com>,
"linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH v2 6/9] usb: roles: Find the muxes by also matching
against the device node
Hi
> -----Original Message-----
> From: Heikki Krogerus <heikki.krogerus@...ux.intel.com>
> Sent: 2019年2月12日 16:51
> To: Jun Li <jun.li@....com>
> Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>; Andy Shevchenko
> <andy.shevchenko@...il.com>; Chen Yu <chenyu56@...wei.com>; Hans de
> Goede <hdegoede@...hat.com>; linux-usb@...r.kernel.org;
> linux-kernel@...r.kernel.org
> Subject: Re: [PATCH v2 6/9] usb: roles: Find the muxes by also matching against the
> device node
>
> Hi,
>
> On Tue, Feb 12, 2019 at 06:03:42AM +0000, Jun Li wrote:
> > > > return dev_fwnode(dev->parent) == fwnode;
> > >
> > > That's actually not the case. struct usb_role_switch_desc has a
> > > member for fwnode, and that's what we use with the actual mux
> > > device. Check
> > > usb_role_switch_register():
> > >
> > > ...
> > > sw->dev.fwnode = desc->fwnode;
> > > ...
> > >
> > > Sorry for not realizing it before.
> >
> > So desc->fwnode should be initialized before do usb_role_switch_register()?
> > But seems usb_role_switch_desc is a read-only object so can't be set at runtime.
>
> It can. Even though usb_role_switch_register() takes read-only parameter, nothing's
> preventing you from passing data even from the stack (the content of the descriptor
> is copied in any case).
>
> Expecting the descriptor to be read-only just means it can be read-only, but it does
> not have to be.
Understood, thanks.
> @@ -32,6 +32,7 @@ typedef enum usb_role (*usb_role_switch_get_t)(struct
> device *dev);
> * usb_role_switch_register() before registering the switch.
> */
> struct usb_role_switch_desc {
> + struct fwnode_handle *fwnode;
You may add some description for this new member
/**
* struct usb_role_switch_desc - USB Role Switch Descriptor
* @ fwnode
>
> > usb_controller_node {
> > ...
> > usb-role-switch;
> >
> > port {
> > sw_provider_node: endpoint {
> > remote-endpoint = <&sw_consumer_node>;
> > };
> > };
> > };
> >
> > typec_node {
> > ...
> > port {
> > sw_consumer_node: endpoint {
> > remote-endpoint = <&sw_provider_node>;
> > };
> > };
> > };
>
> That looks roughly correct to me.
>
>
> thanks,
>
> --
> heikki
Powered by blists - more mailing lists