diff mbox series

[v5,3/4] usb: typec: mux: add "compatible" property for switch match

Message ID 1604403610-16577-3-git-send-email-jun.li@nxp.com
State Superseded
Headers show
Series [v5,1/4] dt-bindings: usb: add documentation for typec switch simple driver | expand

Commit Message

Jun Li Nov. 3, 2020, 11:40 a.m. UTC
For those need a dedicated typec switch simple solution driver,
use compatible property for matching.

Signed-off-by: Li Jun <jun.li@nxp.com>
---
No changes for v5
New patch for v4

 drivers/usb/typec/mux.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

Heikki Krogerus Nov. 10, 2020, 10:51 a.m. UTC | #1
On Tue, Nov 03, 2020 at 07:40:09PM +0800, Li Jun wrote:
> For those need a dedicated typec switch simple solution driver,

> use compatible property for matching.

> 

> Signed-off-by: Li Jun <jun.li@nxp.com>


Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>


> ---

> No changes for v5

> New patch for v4

> 

>  drivers/usb/typec/mux.c | 7 ++++---

>  1 file changed, 4 insertions(+), 3 deletions(-)

> 

> diff --git a/drivers/usb/typec/mux.c b/drivers/usb/typec/mux.c

> index 52ad277..3da17d1 100644

> --- a/drivers/usb/typec/mux.c

> +++ b/drivers/usb/typec/mux.c

> @@ -39,7 +39,8 @@ static void *typec_switch_match(struct device_connection *con, int ep,

>  {

>  	struct device *dev;

>  

> -	if (con->id && !fwnode_property_present(con->fwnode, con->id))

> +	if (con->id && !fwnode_is_compatible(con->fwnode, con->id) &&

> +		       !fwnode_property_present(con->fwnode, con->id))

>  		return NULL;

>  

>  	dev = class_find_device(&typec_mux_class, NULL, con->fwnode,

> @@ -61,8 +62,8 @@ struct typec_switch *fwnode_typec_switch_get(struct fwnode_handle *fwnode)

>  {

>  	struct typec_switch *sw;

>  

> -	sw = fwnode_connection_find_match(fwnode, "orientation-switch", NULL,

> -					  typec_switch_match);

> +	sw = fwnode_connection_find_match(fwnode, "typec-orientation-switch",

> +					  NULL, typec_switch_match);

>  	if (!IS_ERR_OR_NULL(sw))

>  		WARN_ON(!try_module_get(sw->dev.parent->driver->owner));

>  

> -- 

> 2.7.4


thanks,

-- 
heikki
diff mbox series

Patch

diff --git a/drivers/usb/typec/mux.c b/drivers/usb/typec/mux.c
index 52ad277..3da17d1 100644
--- a/drivers/usb/typec/mux.c
+++ b/drivers/usb/typec/mux.c
@@ -39,7 +39,8 @@  static void *typec_switch_match(struct device_connection *con, int ep,
 {
 	struct device *dev;
 
-	if (con->id && !fwnode_property_present(con->fwnode, con->id))
+	if (con->id && !fwnode_is_compatible(con->fwnode, con->id) &&
+		       !fwnode_property_present(con->fwnode, con->id))
 		return NULL;
 
 	dev = class_find_device(&typec_mux_class, NULL, con->fwnode,
@@ -61,8 +62,8 @@  struct typec_switch *fwnode_typec_switch_get(struct fwnode_handle *fwnode)
 {
 	struct typec_switch *sw;
 
-	sw = fwnode_connection_find_match(fwnode, "orientation-switch", NULL,
-					  typec_switch_match);
+	sw = fwnode_connection_find_match(fwnode, "typec-orientation-switch",
+					  NULL, typec_switch_match);
 	if (!IS_ERR_OR_NULL(sw))
 		WARN_ON(!try_module_get(sw->dev.parent->driver->owner));