media: flexcop-usb: probe cleanups
cover media: flexcop-usb: probe cleanups
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/[email protected]/
Johan
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()
drivers/media/usb/b2c2/flexcop-usb.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-)
Signature · 1 line
2.35.1
PATCH 1/3 media: flexcop-usb: clean up endpoint sanity checks
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.
--- drivers/media/usb/b2c2/flexcop-usb.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/media/usb/b2c2/flexcop-usb.c +8 -4
@@ -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) {
Signature · 1 line
2.35.1
PATCH 2/3 media: flexcop-usb: clean up URB initialisation
In reply to Johan HovoldClean up URB initialisation somewhat by introducing a temporary variable and separating declaration and non-trivial initialisation.
--- drivers/media/usb/b2c2/flexcop-usb.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/media/usb/b2c2/flexcop-usb.c +6 -4
@@ -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);
Signature · 1 line
2.35.1
PATCH 3/3 media: flexcop-usb: use usb_endpoint_maxp()
In reply to Johan HovoldUse the usb_endpoint_maxp() helper instead of open coding.
--- drivers/media/usb/b2c2/flexcop-usb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/usb/b2c2/flexcop-usb.c +1 -1
@@ -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",
Signature · 1 line
2.35.1
Quoted 11 lines · Johan Hovold
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/[email protected]/Johan Hovold (3):
media: flexcop-usb: clean up endpoint sanity checks
media: flexcop-usb: clean up URB initialisation
media: flexcop-usb: useusb_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.
Quoted 2 lines
drivers/media/usb/b2c2/flexcop-usb.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-)
Johan
Quoted 8 lines · Johan Hovold
Quoted 6 lines · Johan Hovold
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/[email protected]/
Quoted 8 lines
Quoted 4 lines
Johan Hovold (3):
media: flexcop-usb: clean up endpoint sanity checks
media: flexcop-usb: clean up URB initialisation
media: flexcop-usb: useusb_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?
Quoted 2 lines
Quoted 2 lines
drivers/media/usb/b2c2/flexcop-usb.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-)
Johan