From: Bjorn Andersson <andersson@kernel.org>
To: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
chrome-platform@lists.linux.dev, linux-usb@vger.kernel.org,
linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1 1/2] usb: typec: mux: Clean up mux_fwnode_match()
Date: Wed, 24 May 2023 20:25:30 -0700 [thread overview]
Message-ID: <20230525032530.u5jecuucmdrsuroo@ripper> (raw)
In-Reply-To: <20230524122901.53659-2-heikki.krogerus@linux.intel.com>
On Wed, May 24, 2023 at 03:29:00PM +0300, Heikki Krogerus wrote:
> Removing the "svid" and "accessory" device property checks.
> Those properties are not supported on any platform.
>
> Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> Link: https://lore.kernel.org/lkml/20230522215348.uoyboow26n2o3tel@ripper/
> Cc: Bjorn Andersson <andersson@kernel.org>
> ---
> drivers/usb/typec/mux.c | 55 ++++++-----------------------------------
> 1 file changed, 7 insertions(+), 48 deletions(-)
>
> diff --git a/drivers/usb/typec/mux.c b/drivers/usb/typec/mux.c
> index d9eaf9a0b0bfd..089c2fd478318 100644
> --- a/drivers/usb/typec/mux.c
> +++ b/drivers/usb/typec/mux.c
> @@ -265,60 +265,19 @@ static int mux_fwnode_match(struct device *dev, const void *fwnode)
> static void *typec_mux_match(const struct fwnode_handle *fwnode,
> const char *id, void *data)
> {
> - const struct typec_altmode_desc *desc = data;
> struct device *dev;
> - bool match;
> - int nval;
> - u16 *val;
> - int ret;
> - int i;
>
> /*
> - * Check has the identifier already been "consumed". If it
> - * has, no need to do any extra connection identification.
> + * 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
s/switches/muxes/
> + * property is named "orientation-switch" (@id). The value of the device
s/orientation-switch/mode-switch/
With that:
Reviewed-by: Bjorn Andersson <andersson@kernel.org>
Tested-by: Bjorn Andersson <andersson@kernel.org>
Thank you,
Bjorn
> + * property is ignored.
> */
> - match = !id;
> - if (match)
> - goto find_mux;
> -
> - if (!desc) {
> - /*
> - * Accessory Mode muxes & muxes which explicitly specify
> - * the required identifier can avoid SVID matching.
> - */
> - match = fwnode_property_present(fwnode, "accessory") ||
> - fwnode_property_present(fwnode, id);
> - if (match)
> - goto find_mux;
> - return NULL;
> - }
> -
> - /* Alternate Mode muxes */
> - nval = fwnode_property_count_u16(fwnode, "svid");
> - if (nval <= 0)
> + if (id && !fwnode_property_present(fwnode, id))
> return NULL;
>
> - val = kcalloc(nval, sizeof(*val), GFP_KERNEL);
> - if (!val)
> - return ERR_PTR(-ENOMEM);
> -
> - ret = fwnode_property_read_u16_array(fwnode, "svid", val, nval);
> - if (ret < 0) {
> - kfree(val);
> - return ERR_PTR(ret);
> - }
> -
> - for (i = 0; i < nval; i++) {
> - match = val[i] == desc->svid;
> - if (match) {
> - kfree(val);
> - goto find_mux;
> - }
> - }
> - kfree(val);
> - return NULL;
> -
> -find_mux:
> dev = class_find_device(&typec_mux_class, NULL, fwnode,
> mux_fwnode_match);
>
> --
> 2.39.2
>
next prev parent reply other threads:[~2023-05-25 3:21 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-24 12:28 [PATCH v1 0/2] usb: typec: mux: Remove the "svid" device property checks Heikki Krogerus
2023-05-24 12:29 ` [PATCH v1 1/2] usb: typec: mux: Clean up mux_fwnode_match() Heikki Krogerus
2023-05-25 3:25 ` Bjorn Andersson [this message]
2023-05-24 12:29 ` [PATCH v1 2/2] usb: typec: mux: Remove alt mode parameters from the API Heikki Krogerus
2023-05-24 17:42 ` Prashant Malani
2023-05-25 3:26 ` Bjorn Andersson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230525032530.u5jecuucmdrsuroo@ripper \
--to=andersson@kernel.org \
--cc=chrome-platform@lists.linux.dev \
--cc=gregkh@linuxfoundation.org \
--cc=heikki.krogerus@linux.intel.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).