]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
media: uvcvideo: Use intf instead of udev for printks
authorRicardo Ribalda <ribalda@chromium.org>
Fri, 25 Jul 2025 11:01:29 +0000 (11:01 +0000)
committerHans Verkuil <hverkuil+cisco@kernel.org>
Sat, 13 Sep 2025 16:35:00 +0000 (18:35 +0200)
The UVC driver is a usb_interface driver. Use the correct device for
printks to avoid confusions with other interface drivers associated to
the same usb device.

With this change:
uvcvideo 3-6:1.0: Found UVC 1.10 device USB2.0 WebCam (1234:abcd)

Without this change:
usb 3-6: Found UVC 1.10 device USB2.0 WebCam (1234:abcd)

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans de Goede <hansg@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
drivers/media/usb/uvc/uvc_ctrl.c
drivers/media/usb/uvc/uvc_driver.c
drivers/media/usb/uvc/uvc_entity.c
drivers/media/usb/uvc/uvc_status.c
drivers/media/usb/uvc/uvc_video.c
drivers/media/usb/uvc/uvcvideo.h

index 55bbbef399d45e7b42f2d43b4557eb9ca5dab0d0..535f729086e5274a5632de05cf046312c62794fd 100644 (file)
@@ -1619,7 +1619,7 @@ static int __uvc_query_v4l2_ctrl(struct uvc_video_chain *chain,
                }
 
                if (ret == -EIO) {
-                       dev_warn_ratelimited(&chain->dev->udev->dev,
+                       dev_warn_ratelimited(&chain->dev->intf->dev,
                                             "UVC non compliance: Error %d querying master control %x (%s)\n",
                                             ret, master_map->id,
                                             uvc_map_get_name(master_map));
@@ -1643,7 +1643,7 @@ static int __uvc_query_v4l2_ctrl(struct uvc_video_chain *chain,
 
        ret = __uvc_queryctrl_boundaries(chain, ctrl, mapping, v4l2_ctrl);
        if (ret && !mapping->disabled) {
-               dev_warn(&chain->dev->udev->dev,
+               dev_warn(&chain->dev->intf->dev,
                         "UVC non compliance: permanently disabling control %x (%s), due to error %d\n",
                         mapping->id, uvc_map_get_name(mapping), ret);
                mapping->disabled = true;
@@ -1858,7 +1858,7 @@ static int uvc_ctrl_set_handle(struct uvc_control *ctrl, struct uvc_fh *handle)
        lockdep_assert_held(&handle->chain->ctrl_mutex);
 
        if (ctrl->handle) {
-               dev_warn_ratelimited(&handle->stream->dev->udev->dev,
+               dev_warn_ratelimited(&handle->stream->dev->intf->dev,
                                     "UVC non compliance: Setting an async control with a pending operation.");
 
                if (ctrl->handle == handle)
@@ -1956,7 +1956,7 @@ static void uvc_ctrl_status_event_work(struct work_struct *work)
        w->urb->interval = dev->int_ep->desc.bInterval;
        ret = usb_submit_urb(w->urb, GFP_KERNEL);
        if (ret < 0)
-               dev_err(&dev->udev->dev,
+               dev_err(&dev->intf->dev,
                        "Failed to resubmit status URB (%d).\n", ret);
 }
 
@@ -2895,7 +2895,7 @@ int uvc_ctrl_restore_values(struct uvc_device *dev)
                        if (!ctrl->initialized || !ctrl->modified ||
                            (ctrl->info.flags & UVC_CTRL_FLAG_RESTORE) == 0)
                                continue;
-                       dev_dbg(&dev->udev->dev,
+                       dev_dbg(&dev->intf->dev,
                                "restoring control %pUl/%u/%u\n",
                                ctrl->info.entity, ctrl->info.index,
                                ctrl->info.selector);
index 505e85a6b4d99666f3a4a9441dd1ca72e13228e0..9c86587bec569020c88e14c32805c23bf35b6479 100644 (file)
@@ -1864,7 +1864,7 @@ static int uvc_scan_device(struct uvc_device *dev)
                uvc_scan_fallback(dev);
 
        if (list_empty(&dev->chains)) {
-               dev_info(&dev->udev->dev, "No valid video chain found.\n");
+               dev_info(&dev->intf->dev, "No valid video chain found.\n");
                return -ENODEV;
        }
 
@@ -2088,7 +2088,7 @@ static int uvc_register_terms(struct uvc_device *dev,
 
                stream = uvc_stream_by_id(dev, term->id);
                if (stream == NULL) {
-                       dev_info(&dev->udev->dev,
+                       dev_info(&dev->intf->dev,
                                 "No streaming interface found for terminal %u.",
                                 term->id);
                        continue;
@@ -2124,7 +2124,7 @@ static int uvc_register_chains(struct uvc_device *dev)
 #ifdef CONFIG_MEDIA_CONTROLLER
                ret = uvc_mc_register_entities(chain);
                if (ret < 0)
-                       dev_info(&dev->udev->dev,
+                       dev_info(&dev->intf->dev,
                                 "Failed to register entities (%d).\n", ret);
 #endif
        }
@@ -2225,23 +2225,23 @@ static int uvc_probe(struct usb_interface *intf,
        if (ret < 0)
                goto error;
 
-       dev_info(&dev->udev->dev, "Found UVC %u.%02x device %s (%04x:%04x)\n",
+       dev_info(&dev->intf->dev, "Found UVC %u.%02x device %s (%04x:%04x)\n",
                 dev->uvc_version >> 8, dev->uvc_version & 0xff,
                 udev->product ? udev->product : "<unnamed>",
                 le16_to_cpu(udev->descriptor.idVendor),
                 le16_to_cpu(udev->descriptor.idProduct));
 
        if (dev->quirks != dev->info->quirks) {
-               dev_info(&dev->udev->dev,
+               dev_info(&dev->intf->dev,
                         "Forcing device quirks to 0x%x by module parameter for testing purpose.\n",
                         dev->quirks);
-               dev_info(&dev->udev->dev,
+               dev_info(&dev->intf->dev,
                         "Please report required quirks to the linux-media mailing list.\n");
        }
 
        if (dev->info->uvc_version) {
                dev->uvc_version = dev->info->uvc_version;
-               dev_info(&dev->udev->dev, "Forcing UVC version to %u.%02x\n",
+               dev_info(&dev->intf->dev, "Forcing UVC version to %u.%02x\n",
                         dev->uvc_version >> 8, dev->uvc_version & 0xff);
        }
 
@@ -2277,21 +2277,21 @@ static int uvc_probe(struct usb_interface *intf,
        /* Initialize the interrupt URB. */
        ret = uvc_status_init(dev);
        if (ret < 0) {
-               dev_info(&dev->udev->dev,
+               dev_info(&dev->intf->dev,
                         "Unable to initialize the status endpoint (%d), status interrupt will not be supported.\n",
                         ret);
        }
 
        ret = uvc_gpio_init_irq(dev);
        if (ret < 0) {
-               dev_err(&dev->udev->dev,
+               dev_err(&dev->intf->dev,
                        "Unable to request privacy GPIO IRQ (%d)\n", ret);
                goto error;
        }
 
        ret = uvc_meta_init(dev);
        if (ret < 0) {
-               dev_err(&dev->udev->dev,
+               dev_err(&dev->intf->dev,
                        "Error initializing the metadata formats (%d)\n", ret);
                goto error;
        }
index cc68dd24eb42dce5b2846ca52a8dfa499c8aed96..3823ac9c8045b3ad8530372fd38983aaafbd775d 100644 (file)
@@ -140,7 +140,7 @@ int uvc_mc_register_entities(struct uvc_video_chain *chain)
        list_for_each_entry(entity, &chain->entities, chain) {
                ret = uvc_mc_init_entity(chain, entity);
                if (ret < 0) {
-                       dev_info(&chain->dev->udev->dev,
+                       dev_info(&chain->dev->intf->dev,
                                 "Failed to initialize entity for entity %u\n",
                                 entity->id);
                        return ret;
@@ -150,7 +150,7 @@ int uvc_mc_register_entities(struct uvc_video_chain *chain)
        list_for_each_entry(entity, &chain->entities, chain) {
                ret = uvc_mc_create_links(chain, entity);
                if (ret < 0) {
-                       dev_info(&chain->dev->udev->dev,
+                       dev_info(&chain->dev->intf->dev,
                                 "Failed to create links for entity %u\n",
                                 entity->id);
                        return ret;
index 3c29c0bb3f7cabadfbb9cd8e6780cd3a82a0dfcf..231cfee8e7c2c412570e1c4a4c5845d8ffd3bd96 100644 (file)
@@ -216,7 +216,7 @@ static void uvc_status_complete(struct urb *urb)
                return;
 
        default:
-               dev_warn(&dev->udev->dev,
+               dev_warn(&dev->intf->dev,
                         "Non-zero status (%d) in status completion handler.\n",
                         urb->status);
                return;
@@ -248,7 +248,7 @@ static void uvc_status_complete(struct urb *urb)
        urb->interval = dev->int_ep->desc.bInterval;
        ret = usb_submit_urb(urb, GFP_ATOMIC);
        if (ret < 0)
-               dev_err(&dev->udev->dev,
+               dev_err(&dev->intf->dev,
                        "Failed to resubmit status URB (%d).\n", ret);
 }
 
index 541136702d74d1e910ed3902aa37bfab73190137..572ecd5d11d1f26293e57c7da0482e8670984464 100644 (file)
@@ -95,14 +95,14 @@ int uvc_query_ctrl(struct uvc_device *dev, u8 query, u8 unit,
         */
        if (ret > 0 && query != UVC_GET_INFO) {
                memset(data + ret, 0, size - ret);
-               dev_warn_once(&dev->udev->dev,
+               dev_warn_once(&dev->intf->dev,
                              "UVC non compliance: %s control %u on unit %u returned %d bytes when we expected %u.\n",
                              uvc_query_name(query), cs, unit, ret, size);
                return 0;
        }
 
        if (ret != -EPIPE) {
-               dev_err(&dev->udev->dev,
+               dev_err(&dev->intf->dev,
                        "Failed to query (%s) UVC control %u on unit %u: %d (exp. %u).\n",
                        uvc_query_name(query), cs, unit, ret, size);
                return ret < 0 ? ret : -EPIPE;
@@ -119,7 +119,7 @@ int uvc_query_ctrl(struct uvc_device *dev, u8 query, u8 unit,
        *(u8 *)data = tmp;
 
        if (ret != 1) {
-               dev_err_ratelimited(&dev->udev->dev,
+               dev_err_ratelimited(&dev->intf->dev,
                                    "Failed to query (%s) UVC error code control %u on unit %u: %d (exp. 1).\n",
                                    uvc_query_name(query), cs, unit, ret);
                return ret < 0 ? ret : -EPIPE;
index 8f2667aadc65576bc8617f270a57bdb15f15548d..8a9a3e5ae3c065f1b9ff55871ac44b0b4a0cce7e 100644 (file)
@@ -665,7 +665,7 @@ extern unsigned int uvc_hw_timestamps_param;
 #define uvc_dbg(_dev, flag, fmt, ...)                                  \
 do {                                                                   \
        if (uvc_dbg_param & UVC_DBG_##flag)                             \
-               dev_printk(KERN_DEBUG, &(_dev)->udev->dev, fmt,         \
+               dev_printk(KERN_DEBUG, &(_dev)->intf->dev, fmt,         \
                           ##__VA_ARGS__);                              \
 } while (0)
 
@@ -678,7 +678,7 @@ do {                                                                        \
 #define uvc_warn_once(_dev, warn, fmt, ...)                            \
 do {                                                                   \
        if (!test_and_set_bit(warn, &(_dev)->warnings))                 \
-               dev_info(&(_dev)->udev->dev, fmt, ##__VA_ARGS__);       \
+               dev_info(&(_dev)->intf->dev, fmt, ##__VA_ARGS__);       \
 } while (0)
 
 /* --------------------------------------------------------------------------