diff mbox series

[3/3] usb: typec: mux: Use the "compatible" property instead of a boolean property

Message ID 20190327164339.31205-4-heikki.krogerus@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series device property: fwnode_is_compatible() helper | expand

Commit Message

Heikki Krogerus March 27, 2019, 4:43 p.m. UTC
Instead of searching for a boolean property, matching
against the "compatible" property.

Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
---
 drivers/usb/typec/mux.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

Comments

Jun Li July 15, 2019, 10:17 a.m. UTC | #1
Hi Heikki,

Heikki Krogerus <heikki.krogerus@linux.intel.com> 于2019年3月28日周四 上午12:45写道:
>
> Instead of searching for a boolean property, matching
> against the "compatible" property.
>
> Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> ---
>  drivers/usb/typec/mux.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/usb/typec/mux.c b/drivers/usb/typec/mux.c
> index 2ce54f3fc79c..9462b90f1c09 100644
> --- a/drivers/usb/typec/mux.c
> +++ b/drivers/usb/typec/mux.c
> @@ -32,11 +32,7 @@ static void *typec_switch_match(struct device_connection *con, int ep,
>                 return ERR_PTR(-EPROBE_DEFER);
>         }
>
> -       /*
> -        * With OF graph the mux node must have a boolean device property named
> -        * "orientation-switch".
> -        */
> -       if (con->id && !fwnode_property_present(con->fwnode, con->id))
> +       if (con->id && !fwnode_is_compatible(con->fwnode, con->id))

This is still the right approach for orientation switch match, right?

Li Jun
>                 return NULL;
>
>         list_for_each_entry(sw, &switch_list, entry)
> @@ -148,7 +144,7 @@ static void *typec_mux_match(struct device_connection *con, int ep, void *data)
>
>         /* Accessory Mode muxes */
>         if (!desc) {
> -               match = fwnode_property_present(con->fwnode, "accessory");
> +               match = fwnode_is_compatible(con->fwnode, "accessory");
>                 if (match)
>                         goto find_mux;
>                 return NULL;
> --
> 2.20.1
>
diff mbox series

Patch

diff --git a/drivers/usb/typec/mux.c b/drivers/usb/typec/mux.c
index 2ce54f3fc79c..9462b90f1c09 100644
--- a/drivers/usb/typec/mux.c
+++ b/drivers/usb/typec/mux.c
@@ -32,11 +32,7 @@  static void *typec_switch_match(struct device_connection *con, int ep,
 		return ERR_PTR(-EPROBE_DEFER);
 	}
 
-	/*
-	 * With OF graph the mux node must have a boolean device property named
-	 * "orientation-switch".
-	 */
-	if (con->id && !fwnode_property_present(con->fwnode, con->id))
+	if (con->id && !fwnode_is_compatible(con->fwnode, con->id))
 		return NULL;
 
 	list_for_each_entry(sw, &switch_list, entry)
@@ -148,7 +144,7 @@  static void *typec_mux_match(struct device_connection *con, int ep, void *data)
 
 	/* Accessory Mode muxes */
 	if (!desc) {
-		match = fwnode_property_present(con->fwnode, "accessory");
+		match = fwnode_is_compatible(con->fwnode, "accessory");
 		if (match)
 			goto find_mux;
 		return NULL;