2023-07-27 16:31:14

by Harry Geyer

[permalink] [raw]
Subject: [PATCH] i2c: tiny-usb: check usb base class before assuming the interface on device is for this driver

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 <[email protected]>
---
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



2023-07-27 17:24:34

by Andi Shyti

[permalink] [raw]
Subject: Re: [PATCH] i2c: tiny-usb: check usb base class before assuming the interface on device is for this driver

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 <[email protected]>
> ---
> 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 <[email protected]>

Andi

2023-08-02 20:24:35

by Andi Shyti

[permalink] [raw]
Subject: Re: [PATCH] i2c: tiny-usb: check usb base class before assuming the interface on device is for this driver

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


2023-08-14 13:38:59

by Wolfram Sang

[permalink] [raw]
Subject: Re: [PATCH] i2c: tiny-usb: check usb base class before assuming the interface on device is for this driver


> 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!


Attachments:
(No filename) (418.00 B)
signature.asc (849.00 B)
Download all attachments