diff mbox series

i2c: tiny-usb: check usb base class before assuming the interface on device is for this driver

Message ID 20230727083354.4903-1-harry.geyer@devtank.co.uk
State New
Headers show
Series i2c: tiny-usb: check usb base class before assuming the interface on device is for this driver | expand

Commit Message

Harry Geyer July 27, 2023, 8:33 a.m. UTC
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(+)

Comments

Harry Geyer July 27, 2023, 1:54 p.m. UTC | #1
Hi Andi,

On 27/07/2023 12:30, Andi Shyti wrote:
> On the other hand, checkpatch is OK with lines up to 100
> characters and this one looks like it's withing that length. So,
> up to your personal preference.
I am happy to resend the patch.
> If you resend it, you can add my r-b.
Not sure what you mean, I am sorry. Please, can you explain what you 
want me to do.

Thank you,

Harry.
Andi Shyti July 27, 2023, 4 p.m. UTC | #2
On Thu, Jul 27, 2023 at 02:54:42PM +0100, Harry Geyer wrote:
> Hi Andi,
> 
> On 27/07/2023 12:30, Andi Shyti wrote:
> > On the other hand, checkpatch is OK with lines up to 100
> > characters and this one looks like it's withing that length. So,
> > up to your personal preference.
> I am happy to resend the patch.

Thanks!

> > If you resend it, you can add my r-b.
> Not sure what you mean, I am sorry. Please, can you explain what you want me
> to do.

I was meaning that you could add my Reviewed-by:... you can
also ignore it, I can r-b it later.

Thanks,
Andi

PS r-b = Reviewed-by, if this was the reason of confusion :)
diff mbox series

Patch

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 */