Message ID | 20230727162255.21551-1-harry.geyer@devtank.co.uk |
---|---|
State | Superseded |
Headers | show |
Series | i2c: tiny-usb: check usb base class before assuming the interface on device is for this driver | expand |
Hi Harry, On Thu, Jul 27, 2023 at 05:22:55PM +0100, Harry Geyer wrote: > 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; > + Thanks for resending it! Reviewed-by: Andi Shyti <andi.shyti@kernel.org> Andi
Hi On Thu, 27 Jul 2023 17:22:55 +0100, Harry Geyer wrote: > Patch allows usb devices with multiple interfaces to use this driver without > this driver assuming all interfaces are i2c-tiny-usb. > > Applied to i2c/andi-for-current on https://git.kernel.org/pub/scm/linux/kernel/git/andi.shyti/linux.git Please note that this patch may still undergo further evaluation and the final decision will be made in collaboration with Wolfram. Thank you, Andi Patches applied =============== [1/1] i2c: tiny-usb: check usb base class before assuming the interface on device is for this driver commit: c6607c0c7118ab96dcbc57df67fe316e871666a1
> Please note that this patch may still undergo further evaluation > and the final decision will be made in collaboration with > Wolfram. I chose to apply it to for-next. I don't know how many clones are out there and if they all have the same FunctionClass. So, I'd like to give this some testing in -next and during the next release cycle. Applied to for-next, thanks! Thanks for backing me up, Andi!
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 */
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(+)