[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241030142833.v2.2.Ie0d37646f18461234777d88b4c3e21faed92ed4f@changeid>
Date: Wed, 30 Oct 2024 14:28:33 -0700
From: Abhishek Pandit-Subedi <abhishekpandit@...omium.org>
To: heikki.krogerus@...ux.intel.com,
tzungbi@...nel.org,
linux-usb@...r.kernel.org,
chrome-platform@...ts.linux.dev
Cc: dmitry.baryshkov@...aro.org,
jthies@...gle.com,
akuchynski@...gle.com,
pmalani@...omium.org,
Abhishek Pandit-Subedi <abhishekpandit@...omium.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
linux-kernel@...r.kernel.org
Subject: [PATCH v2 2/7] usb: typec: Only use SVID for matching altmodes
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>
---
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
Powered by blists - more mailing lists