Message ID | 20210602112253.70200-1-heikki.krogerus@linux.intel.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 7f7d0afe1d479990b712ecb494257dcd706a8016 |
Headers | show |
Series | Revert "usb: typec: mux: Remove requirement for the "orientation-switch" device property" | expand |
Hi, > -----Original Message----- > From: Heikki Krogerus <heikki.krogerus@linux.intel.com> > Sent: Wednesday, June 2, 2021 7:23 PM > To: Greg Kroah-Hartman <gregkh@linuxfoundation.org> > Cc: Jun Li <jun.li@nxp.com>; linux-usb@vger.kernel.org > Subject: [PATCH] Revert "usb: typec: mux: Remove requirement for the > "orientation-switch" device property" > > This reverts commit acad3e9c7250c5fd20d9778a163f2adc95de38f5. > > The device property that can be used to identify the device class/type of > the remote port parent when device graph is used is always needed after all. > Without it there is no real way to know is the requested connection actually > described in the device graph or not. > > If the connection is described in the device graph but the device instance > is still missing for what ever reason, the code defers probe for now. > > Adding a comment to the code to explain this. > > Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Reviewed-by: Li Jun <jun.li@nxp.com> > --- > Hi, > > I'm sorry about this again. I hope the comments help prevent me from doing > the same thing again. > > thanks, > --- > drivers/usb/typec/mux.c | 16 ++++++++++++++++ > 1 file changed, 16 insertions(+) > > diff --git a/drivers/usb/typec/mux.c b/drivers/usb/typec/mux.c index > 603f3e698cc0b..664fb3513f480 100644 > --- a/drivers/usb/typec/mux.c > +++ b/drivers/usb/typec/mux.c > @@ -30,6 +30,22 @@ static void *typec_switch_match(struct fwnode_handle > *fwnode, const char *id, { > struct device *dev; > > + /* > + * Device graph (OF graph) does not give any means to identify the > + * device type or the device class of the remote port parent that @fwnode > + * represents, so in order to identify the type or the class of @fwnode > + * an additional device property is needed. With typec switches the > + * property is named "orientation-switch" (@id). The value of the device > + * property is ignored. > + */ > + if (id && !fwnode_property_present(fwnode, id)) > + return NULL; > + > + /* > + * At this point we are sure that @fwnode is a typec switch in all > + * cases. If the switch hasn't yet been registered for some reason, the > + * function "defers probe" for now. > + */ > dev = class_find_device(&typec_mux_class, NULL, fwnode, > switch_fwnode_match); > > -- > 2.30.2
diff --git a/drivers/usb/typec/mux.c b/drivers/usb/typec/mux.c index 603f3e698cc0b..664fb3513f480 100644 --- a/drivers/usb/typec/mux.c +++ b/drivers/usb/typec/mux.c @@ -30,6 +30,22 @@ static void *typec_switch_match(struct fwnode_handle *fwnode, const char *id, { struct device *dev; + /* + * Device graph (OF graph) does not give any means to identify the + * device type or the device class of the remote port parent that @fwnode + * represents, so in order to identify the type or the class of @fwnode + * an additional device property is needed. With typec switches the + * property is named "orientation-switch" (@id). The value of the device + * property is ignored. + */ + if (id && !fwnode_property_present(fwnode, id)) + return NULL; + + /* + * At this point we are sure that @fwnode is a typec switch in all + * cases. If the switch hasn't yet been registered for some reason, the + * function "defers probe" for now. + */ dev = class_find_device(&typec_mux_class, NULL, fwnode, switch_fwnode_match);
This reverts commit acad3e9c7250c5fd20d9778a163f2adc95de38f5. The device property that can be used to identify the device class/type of the remote port parent when device graph is used is always needed after all. Without it there is no real way to know is the requested connection actually described in the device graph or not. If the connection is described in the device graph but the device instance is still missing for what ever reason, the code defers probe for now. Adding a comment to the code to explain this. Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> --- Hi, I'm sorry about this again. I hope the comments help prevent me from doing the same thing again. thanks, --- drivers/usb/typec/mux.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)