RE: [PATCH] Revert "usb: typec: mux: Remove requirement for the "orientation-switch" device property"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,
> -----Original Message-----
> From: Heikki Krogerus <heikki.krogerus@xxxxxxxxxxxxxxx>
> Sent: Wednesday, June 2, 2021 7:23 PM
> To: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
> Cc: Jun Li <jun.li@xxxxxxx>; linux-usb@xxxxxxxxxxxxxxx
> 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@xxxxxxxxxxxxxxx>

Reviewed-by: Li Jun <jun.li@xxxxxxx>

> ---
> 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





[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux