* [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
* Re: [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, 0 replies; 10+ messages in thread
From: Andi Shyti @ 2023-07-26 16:08 UTC (permalink / raw)
To: Harry Geyer; +Cc: Till Harbaum, linux-i2c, linux-kernel
Hi Harry,
it's OK, just few little adjustments...
On Wed, Jul 19, 2023 at 12:38:38PM +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>
Please add:
Fixes: e8c76eed2ecd ("i2c: New i2c-tiny-usb bus driver")
Cc: Till Harbaum <till@harbaum.org>
Cc: <stable@vger.kernel.org> # v2.6.22+
> ---
> 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) {
please fix the indentation here ('interface' and 'interface'
should go on the same line)
> + return -ENODEV;
> + }
please drop the brackets.
Andi
> +
> dev_dbg(&interface->dev, "probing usb device\n");
>
> /* allocate memory for our device state and initialize it */
> --
> 2.34.1
>
^ permalink raw reply [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
* Re: [PATCH] i2c: tiny-usb: check usb base class before assuming the interface on device is for this driver
2023-07-27 8:33 [PATCH] i2c: tiny-usb: check usb base class before assuming the interface on device is for this driver Harry Geyer
@ 2023-07-27 11:30 ` Andi Shyti
2023-07-27 13:54 ` Harry Geyer
0 siblings, 1 reply; 10+ messages in thread
From: Andi Shyti @ 2023-07-27 11:30 UTC (permalink / raw)
To: Harry Geyer; +Cc: Till Harbaum, linux-i2c, linux-kernel
Hi Harry,
On Thu, Jul 27, 2023 at 09:33:54AM +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 | 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)
I'm sorry, I meant the same column, my bad here!
Would you please be so kind to resend it as
if (interface->intf_assoc &&
interface->intf_assoc->bFunctionClass != USB_CLASS_VENDOR_SPEC)
It's a nitpick, though.
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.
If you resend it, you can add my r-b.
Thank you and again, sorry,
Andi
PS Next time, please add a changelog and a versioning to
following patches.
> + 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 [flat|nested] 10+ messages in thread
* Re: [PATCH] i2c: tiny-usb: check usb base class before assuming the interface on device is for this driver
2023-07-27 11:30 ` Andi Shyti
@ 2023-07-27 13:54 ` Harry Geyer
2023-07-27 16:00 ` Andi Shyti
0 siblings, 1 reply; 10+ messages in thread
From: Harry Geyer @ 2023-07-27 13:54 UTC (permalink / raw)
To: Andi Shyti; +Cc: Till Harbaum, linux-i2c, linux-kernel
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.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] i2c: tiny-usb: check usb base class before assuming the interface on device is for this driver
2023-07-27 13:54 ` Harry Geyer
@ 2023-07-27 16:00 ` Andi Shyti
0 siblings, 0 replies; 10+ messages in thread
From: Andi Shyti @ 2023-07-27 16:00 UTC (permalink / raw)
To: Harry Geyer; +Cc: Till Harbaum, linux-i2c, linux-kernel
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 :)
^ permalink raw reply [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 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
* Re: [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
1 sibling, 0 replies; 10+ messages in thread
From: Andi Shyti @ 2023-07-27 17:13 UTC (permalink / raw)
To: Harry Geyer; +Cc: Till Harbaum, linux-i2c, linux-kernel
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
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [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
2023-08-14 13:17 ` Wolfram Sang
1 sibling, 1 reply; 10+ messages in thread
From: Andi Shyti @ 2023-08-02 20:02 UTC (permalink / raw)
To: Till Harbaum, linux-i2c, linux-kernel, Harry Geyer
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
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] i2c: tiny-usb: check usb base class before assuming the interface on device is for this driver
2023-08-02 20:02 ` Andi Shyti
@ 2023-08-14 13:17 ` Wolfram Sang
0 siblings, 0 replies; 10+ messages in thread
From: Wolfram Sang @ 2023-08-14 13:17 UTC (permalink / raw)
To: Andi Shyti; +Cc: Till Harbaum, linux-i2c, linux-kernel, Harry Geyer
[-- Attachment #1: Type: text/plain, Size: 407 bytes --]
> 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!
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [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 8:33 [PATCH] i2c: tiny-usb: check usb base class before assuming the interface on device is for this driver Harry Geyer
2023-07-27 11:30 ` Andi Shyti
2023-07-27 13:54 ` Harry Geyer
2023-07-27 16:00 ` Andi Shyti
-- strict thread matches above, loose matches on Subject: below --
2023-07-27 16:22 Harry Geyer
2023-07-27 17:13 ` Andi Shyti
2023-08-02 20:02 ` Andi Shyti
2023-08-14 13:17 ` Wolfram Sang
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