]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
media: si470x-usb: refactor endpoint lookup
authorJohan Hovold <johan@kernel.org>
Mon, 30 Mar 2026 10:11:36 +0000 (12:11 +0200)
committerHans Verkuil <hverkuil+cisco@kernel.org>
Tue, 5 May 2026 14:57:02 +0000 (16:57 +0200)
Use the common USB helper for looking up interrupt-in endpoints instead
of open coding.

Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
drivers/media/radio/si470x/radio-si470x-usb.c

index 318b5f6d4202110121afabd77f4cb49b9e3d520d..869b1e7e34b97cb7425b1a7cc4ab8746213a56ec 100644 (file)
@@ -565,8 +565,7 @@ static int si470x_usb_driver_probe(struct usb_interface *intf,
 {
        struct si470x_device *radio;
        struct usb_host_interface *iface_desc;
-       struct usb_endpoint_descriptor *endpoint;
-       int i, int_end_size, retval;
+       int int_end_size, retval;
        unsigned char version_warning = 0;
 
        /* private data allocation and initialization */
@@ -595,12 +594,8 @@ static int si470x_usb_driver_probe(struct usb_interface *intf,
        iface_desc = intf->cur_altsetting;
 
        /* Set up interrupt endpoint information. */
-       for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) {
-               endpoint = &iface_desc->endpoint[i].desc;
-               if (usb_endpoint_is_int_in(endpoint))
-                       radio->int_in_endpoint = endpoint;
-       }
-       if (!radio->int_in_endpoint) {
+       retval = usb_find_int_in_endpoint(iface_desc, &radio->int_in_endpoint);
+       if (retval) {
                dev_info(&intf->dev, "could not find interrupt in endpoint\n");
                retval = -EIO;
                goto err_usbbuf;