[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZyOQmEBubO1WG8a1@kuha.fi.intel.com>
Date: Thu, 31 Oct 2024 16:13:44 +0200
From: Heikki Krogerus <heikki.krogerus@...ux.intel.com>
To: Abhishek Pandit-Subedi <abhishekpandit@...omium.org>
Cc: tzungbi@...nel.org, linux-usb@...r.kernel.org,
chrome-platform@...ts.linux.dev, dmitry.baryshkov@...aro.org,
jthies@...gle.com, akuchynski@...gle.com, pmalani@...omium.org,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 2/7] usb: typec: Only use SVID for matching altmodes
On Wed, Oct 30, 2024 at 02:28:33PM -0700, Abhishek Pandit-Subedi wrote:
> Mode in struct typec_altmode is used to indicate the index of the
> altmode on a port, partner or plug. When searching for altmodes, it
> doesn't make sense to use the mode as a criteria since it could be any
> value depending on the enumeration order of the driver.
>
> Signed-off-by: Abhishek Pandit-Subedi <abhishekpandit@...omium.org>
Reviewed-by: Heikki Krogerus <heikki.krogerus@...ux.intel.com>
> ---
>
> Changes in v2:
> - Update altmode_match to ignore mode entirely
> - Also apply the same behavior to typec_match
>
> drivers/usb/typec/bus.c | 3 +--
> drivers/usb/typec/class.c | 2 +-
> 2 files changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/usb/typec/bus.c b/drivers/usb/typec/bus.c
> index aa879253d3b8..a5cb4bbb877d 100644
> --- a/drivers/usb/typec/bus.c
> +++ b/drivers/usb/typec/bus.c
> @@ -454,8 +454,7 @@ static int typec_match(struct device *dev, const struct device_driver *driver)
> const struct typec_device_id *id;
>
> for (id = drv->id_table; id->svid; id++)
> - if (id->svid == altmode->svid &&
> - (id->mode == TYPEC_ANY_MODE || id->mode == altmode->mode))
> + if (id->svid == altmode->svid)
> return 1;
> return 0;
> }
> diff --git a/drivers/usb/typec/class.c b/drivers/usb/typec/class.c
> index bd41abceb050..85494b9f7502 100644
> --- a/drivers/usb/typec/class.c
> +++ b/drivers/usb/typec/class.c
> @@ -237,7 +237,7 @@ static int altmode_match(struct device *dev, void *data)
> if (!is_typec_altmode(dev))
> return 0;
>
> - return ((adev->svid == id->svid) && (adev->mode == id->mode));
> + return (adev->svid == id->svid);
> }
>
> static void typec_altmode_set_partner(struct altmode *altmode)
> --
> 2.47.0.163.g1226f6d8fa-goog
--
heikki
Powered by blists - more mailing lists