public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] i2c: tiny-usb: check usb base class before assuming the interface on device is for this driver
@ 2023-07-27 16:22 Harry Geyer
  2023-07-27 17:13 ` Andi Shyti
  2023-08-02 20:02 ` Andi Shyti
  0 siblings, 2 replies; 10+ messages in thread
From: Harry Geyer @ 2023-07-27 16:22 UTC (permalink / raw)
  To: Till Harbaum, Andi Shyti, linux-i2c, linux-kernel; +Cc: harry.geyer

Patch allows usb devices with multiple interfaces to use this driver without
this driver assuming all interfaces are i2c-tiny-usb.

Signed-off-by: Harry Geyer <harry.geyer@devtank.co.uk>
---
 drivers/i2c/busses/i2c-tiny-usb.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/i2c/busses/i2c-tiny-usb.c b/drivers/i2c/busses/i2c-tiny-usb.c
index d1fa9ff5aeab..1bffe36c40ad 100644
--- a/drivers/i2c/busses/i2c-tiny-usb.c
+++ b/drivers/i2c/busses/i2c-tiny-usb.c
@@ -222,6 +222,10 @@ static int i2c_tiny_usb_probe(struct usb_interface *interface,
 	int retval = -ENOMEM;
 	u16 version;
 
+	if (interface->intf_assoc &&
+	    interface->intf_assoc->bFunctionClass != USB_CLASS_VENDOR_SPEC)
+		return -ENODEV;
+
 	dev_dbg(&interface->dev, "probing usb device\n");
 
 	/* allocate memory for our device state and initialize it */
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread
* [PATCH] i2c: tiny-usb: check usb base class before assuming the interface on device is for this driver
@ 2023-07-27  8:33 Harry Geyer
  2023-07-27 11:30 ` Andi Shyti
  0 siblings, 1 reply; 10+ messages in thread
From: Harry Geyer @ 2023-07-27  8:33 UTC (permalink / raw)
  To: Till Harbaum, Andi Shyti, linux-i2c, linux-kernel; +Cc: harry.geyer

Patch allows usb devices with multiple interfaces to use this driver without
this driver assuming all interfaces are i2c-tiny-usb.

Signed-off-by: Harry Geyer <harry.geyer@devtank.co.uk>
---
 drivers/i2c/busses/i2c-tiny-usb.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/i2c/busses/i2c-tiny-usb.c b/drivers/i2c/busses/i2c-tiny-usb.c
index d1fa9ff5aeab..d6578e8908ac 100644
--- a/drivers/i2c/busses/i2c-tiny-usb.c
+++ b/drivers/i2c/busses/i2c-tiny-usb.c
@@ -222,6 +222,9 @@ static int i2c_tiny_usb_probe(struct usb_interface *interface,
 	int retval = -ENOMEM;
 	u16 version;
 
+	if (interface->intf_assoc && interface->intf_assoc->bFunctionClass != USB_CLASS_VENDOR_SPEC)
+		return -ENODEV;
+
 	dev_dbg(&interface->dev, "probing usb device\n");
 
 	/* allocate memory for our device state and initialize it */
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread
* [PATCH] i2c: tiny-usb: check usb base class before assuming the interface on device is for this driver
@ 2023-07-19 11:38 Harry Geyer
  2023-07-26 16:08 ` Andi Shyti
  0 siblings, 1 reply; 10+ messages in thread
From: Harry Geyer @ 2023-07-19 11:38 UTC (permalink / raw)
  To: Till Harbaum, Andi Shyti, linux-i2c, linux-kernel; +Cc: harry.geyer

Patch allows usb devices with multiple interfaces to use this driver without
this driver assuming all interfaces are i2c-tiny-usb.

Signed-off-by: Harry Geyer <harry.geyer@devtank.co.uk>
---
 drivers/i2c/busses/i2c-tiny-usb.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/i2c/busses/i2c-tiny-usb.c b/drivers/i2c/busses/i2c-tiny-usb.c
index d1fa9ff5aeab..fc194c65e50e 100644
--- a/drivers/i2c/busses/i2c-tiny-usb.c
+++ b/drivers/i2c/busses/i2c-tiny-usb.c
@@ -222,6 +222,11 @@ static int i2c_tiny_usb_probe(struct usb_interface *interface,
 	int retval = -ENOMEM;
 	u16 version;
 
+	if (interface->intf_assoc &&
+		interface->intf_assoc->bFunctionClass != USB_CLASS_VENDOR_SPEC) {
+		return -ENODEV;
+	}
+
 	dev_dbg(&interface->dev, "probing usb device\n");
 
 	/* allocate memory for our device state and initialize it */
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2023-08-14 13:18 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-27 16:22 [PATCH] i2c: tiny-usb: check usb base class before assuming the interface on device is for this driver Harry Geyer
2023-07-27 17:13 ` Andi Shyti
2023-08-02 20:02 ` Andi Shyti
2023-08-14 13:17   ` Wolfram Sang
  -- strict thread matches above, loose matches on Subject: below --
2023-07-27  8:33 Harry Geyer
2023-07-27 11:30 ` Andi Shyti
2023-07-27 13:54   ` Harry Geyer
2023-07-27 16:00     ` Andi Shyti
2023-07-19 11:38 Harry Geyer
2023-07-26 16:08 ` Andi Shyti

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox