* [PATCH 1/3] media: flexcop-usb: clean up endpoint sanity checks
2022-06-09 14:26 [PATCH 0/3] media: flexcop-usb: probe cleanups Johan Hovold
@ 2022-06-09 14:26 ` Johan Hovold
2022-06-09 14:26 ` [PATCH 2/3] media: flexcop-usb: clean up URB initialisation Johan Hovold
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Johan Hovold @ 2022-06-09 14:26 UTC (permalink / raw)
To: Mauro Carvalho Chehab, Hans Verkuil
Cc: linux-media, linux-kernel, Johan Hovold
Add a temporary variable to make the endpoint sanity checks a bit more
readable.
While at it, fix a typo in the usb_set_interface() comment.
Signed-off-by: Johan Hovold <johan@kernel.org>
---
drivers/media/usb/b2c2/flexcop-usb.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/drivers/media/usb/b2c2/flexcop-usb.c b/drivers/media/usb/b2c2/flexcop-usb.c
index e012b21c4fd7..31dd37d8236c 100644
--- a/drivers/media/usb/b2c2/flexcop-usb.c
+++ b/drivers/media/usb/b2c2/flexcop-usb.c
@@ -501,17 +501,21 @@ static int flexcop_usb_transfer_init(struct flexcop_usb *fc_usb)
static int flexcop_usb_init(struct flexcop_usb *fc_usb)
{
- /* use the alternate setting with the larges buffer */
- int ret = usb_set_interface(fc_usb->udev, 0, 1);
+ struct usb_host_interface *alt;
+ int ret;
+ /* use the alternate setting with the largest buffer */
+ ret = usb_set_interface(fc_usb->udev, 0, 1);
if (ret) {
err("set interface failed.");
return ret;
}
- if (fc_usb->uintf->cur_altsetting->desc.bNumEndpoints < 1)
+ alt = fc_usb->uintf->cur_altsetting;
+
+ if (alt->desc.bNumEndpoints < 1)
return -ENODEV;
- if (!usb_endpoint_is_isoc_in(&fc_usb->uintf->cur_altsetting->endpoint[0].desc))
+ if (!usb_endpoint_is_isoc_in(&alt->endpoint[0].desc))
return -ENODEV;
switch (fc_usb->udev->speed) {
--
2.35.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/3] media: flexcop-usb: clean up URB initialisation
2022-06-09 14:26 [PATCH 0/3] media: flexcop-usb: probe cleanups Johan Hovold
2022-06-09 14:26 ` [PATCH 1/3] media: flexcop-usb: clean up endpoint sanity checks Johan Hovold
@ 2022-06-09 14:26 ` Johan Hovold
2022-06-09 14:26 ` [PATCH 3/3] media: flexcop-usb: use usb_endpoint_maxp() Johan Hovold
2022-07-11 9:50 ` [PATCH 0/3] media: flexcop-usb: probe cleanups Johan Hovold
3 siblings, 0 replies; 6+ messages in thread
From: Johan Hovold @ 2022-06-09 14:26 UTC (permalink / raw)
To: Mauro Carvalho Chehab, Hans Verkuil
Cc: linux-media, linux-kernel, Johan Hovold
Clean up URB initialisation somewhat by introducing a temporary variable
and separating declaration and non-trivial initialisation.
Signed-off-by: Johan Hovold <johan@kernel.org>
---
drivers/media/usb/b2c2/flexcop-usb.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/media/usb/b2c2/flexcop-usb.c b/drivers/media/usb/b2c2/flexcop-usb.c
index 31dd37d8236c..7102b346db05 100644
--- a/drivers/media/usb/b2c2/flexcop-usb.c
+++ b/drivers/media/usb/b2c2/flexcop-usb.c
@@ -425,12 +425,14 @@ static void flexcop_usb_transfer_exit(struct flexcop_usb *fc_usb)
static int flexcop_usb_transfer_init(struct flexcop_usb *fc_usb)
{
- u16 frame_size = le16_to_cpu(
- fc_usb->uintf->cur_altsetting->endpoint[0].desc.wMaxPacketSize);
- int bufsize = B2C2_USB_NUM_ISO_URB * B2C2_USB_FRAMES_PER_ISO *
- frame_size, i, j, ret;
+ struct usb_host_interface *alt = fc_usb->uintf->cur_altsetting;
+ u16 frame_size;
+ int bufsize, i, j, ret;
int buffer_offset = 0;
+ frame_size = le16_to_cpu(alt->endpoint[0].desc.wMaxPacketSize);
+ bufsize = B2C2_USB_NUM_ISO_URB * B2C2_USB_FRAMES_PER_ISO * frame_size;
+
deb_ts("creating %d iso-urbs with %d frames each of %d bytes size = %d.\n",
B2C2_USB_NUM_ISO_URB,
B2C2_USB_FRAMES_PER_ISO, frame_size, bufsize);
--
2.35.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/3] media: flexcop-usb: use usb_endpoint_maxp()
2022-06-09 14:26 [PATCH 0/3] media: flexcop-usb: probe cleanups Johan Hovold
2022-06-09 14:26 ` [PATCH 1/3] media: flexcop-usb: clean up endpoint sanity checks Johan Hovold
2022-06-09 14:26 ` [PATCH 2/3] media: flexcop-usb: clean up URB initialisation Johan Hovold
@ 2022-06-09 14:26 ` Johan Hovold
2022-07-11 9:50 ` [PATCH 0/3] media: flexcop-usb: probe cleanups Johan Hovold
3 siblings, 0 replies; 6+ messages in thread
From: Johan Hovold @ 2022-06-09 14:26 UTC (permalink / raw)
To: Mauro Carvalho Chehab, Hans Verkuil
Cc: linux-media, linux-kernel, Johan Hovold
Use the usb_endpoint_maxp() helper instead of open coding.
Signed-off-by: Johan Hovold <johan@kernel.org>
---
drivers/media/usb/b2c2/flexcop-usb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/usb/b2c2/flexcop-usb.c b/drivers/media/usb/b2c2/flexcop-usb.c
index 7102b346db05..790787f0eba8 100644
--- a/drivers/media/usb/b2c2/flexcop-usb.c
+++ b/drivers/media/usb/b2c2/flexcop-usb.c
@@ -430,7 +430,7 @@ static int flexcop_usb_transfer_init(struct flexcop_usb *fc_usb)
int bufsize, i, j, ret;
int buffer_offset = 0;
- frame_size = le16_to_cpu(alt->endpoint[0].desc.wMaxPacketSize);
+ frame_size = usb_endpoint_maxp(&alt->endpoint[0].desc);
bufsize = B2C2_USB_NUM_ISO_URB * B2C2_USB_FRAMES_PER_ISO * frame_size;
deb_ts("creating %d iso-urbs with %d frames each of %d bytes size = %d.\n",
--
2.35.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 0/3] media: flexcop-usb: probe cleanups
2022-06-09 14:26 [PATCH 0/3] media: flexcop-usb: probe cleanups Johan Hovold
` (2 preceding siblings ...)
2022-06-09 14:26 ` [PATCH 3/3] media: flexcop-usb: use usb_endpoint_maxp() Johan Hovold
@ 2022-07-11 9:50 ` Johan Hovold
2022-07-25 11:23 ` Johan Hovold
3 siblings, 1 reply; 6+ messages in thread
From: Johan Hovold @ 2022-07-11 9:50 UTC (permalink / raw)
To: Mauro Carvalho Chehab, Hans Verkuil; +Cc: linux-media, linux-kernel
On Thu, Jun 09, 2022 at 04:26:02PM +0200, Johan Hovold wrote:
> This series cleans up the probe helper functions a bit to make the code
> more readable.
>
> Note that these apply on top of the fix posted here:
>
> https://lore.kernel.org/all/20220609135341.19941-1-johan@kernel.org/
> Johan Hovold (3):
> media: flexcop-usb: clean up endpoint sanity checks
> media: flexcop-usb: clean up URB initialisation
> media: flexcop-usb: use usb_endpoint_maxp()
I haven't received any notification about this series being added to any
tree and the status is still set to "NEW" in the patch tracker so
sending a reminder.
> drivers/media/usb/b2c2/flexcop-usb.c | 22 ++++++++++++++--------
> 1 file changed, 14 insertions(+), 8 deletions(-)
Johan
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 0/3] media: flexcop-usb: probe cleanups
2022-07-11 9:50 ` [PATCH 0/3] media: flexcop-usb: probe cleanups Johan Hovold
@ 2022-07-25 11:23 ` Johan Hovold
0 siblings, 0 replies; 6+ messages in thread
From: Johan Hovold @ 2022-07-25 11:23 UTC (permalink / raw)
To: Mauro Carvalho Chehab, Hans Verkuil; +Cc: linux-media, linux-kernel
On Mon, Jul 11, 2022 at 11:50:20AM +0200, Johan Hovold wrote:
> On Thu, Jun 09, 2022 at 04:26:02PM +0200, Johan Hovold wrote:
> > This series cleans up the probe helper functions a bit to make the code
> > more readable.
> >
> > Note that these apply on top of the fix posted here:
> >
> > https://lore.kernel.org/all/20220609135341.19941-1-johan@kernel.org/
>
> > Johan Hovold (3):
> > media: flexcop-usb: clean up endpoint sanity checks
> > media: flexcop-usb: clean up URB initialisation
> > media: flexcop-usb: use usb_endpoint_maxp()
>
> I haven't received any notification about this series being added to any
> tree and the status is still set to "NEW" in the patch tracker so
> sending a reminder.
Another two weeks without a reply so sending another reminder.
Any chance of getting these (and the separate fix) into 5.20?
> > drivers/media/usb/b2c2/flexcop-usb.c | 22 ++++++++++++++--------
> > 1 file changed, 14 insertions(+), 8 deletions(-)
Johan
^ permalink raw reply [flat|nested] 6+ messages in thread