linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] media: uvcvideo: Use dev->intf for printk
@ 2025-07-25 11:01 Ricardo Ribalda
  2025-07-25 11:01 ` [PATCH 1/2] media: uvcvideo: Use intf instead of udev for printks Ricardo Ribalda
  2025-07-25 11:01 ` [PATCH 2/2] media: uvcvideo: Do not re-reference dev->udev Ricardo Ribalda
  0 siblings, 2 replies; 6+ messages in thread
From: Ricardo Ribalda @ 2025-07-25 11:01 UTC (permalink / raw)
  To: Laurent Pinchart, Hans de Goede, Mauro Carvalho Chehab
  Cc: linux-media, linux-kernel, Ricardo Ribalda

We have been using the usb device for printk in the driver, this makes
it difficult to distinguish the logging from this driver from other
interface drivers associated to the same usb device.

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
Ricardo Ribalda (2):
      media: uvcvideo: Use intf instead of udev for printks
      media: uvcvideo: Do not re-reference dev->udev

 drivers/media/usb/uvc/uvc_ctrl.c   | 10 +++++-----
 drivers/media/usb/uvc/uvc_driver.c | 22 +++++++++++-----------
 drivers/media/usb/uvc/uvc_entity.c |  4 ++--
 drivers/media/usb/uvc/uvc_status.c |  4 ++--
 drivers/media/usb/uvc/uvc_video.c  |  6 +++---
 drivers/media/usb/uvc/uvcvideo.h   |  4 ++--
 6 files changed, 25 insertions(+), 25 deletions(-)
---
base-commit: d968e50b5c26642754492dea23cbd3592bde62d8
change-id: 20250725-uvc-nousbdev-e3833066d850

Best regards,
-- 
Ricardo Ribalda <ribalda@chromium.org>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/2] media: uvcvideo: Use intf instead of udev for printks
  2025-07-25 11:01 [PATCH 0/2] media: uvcvideo: Use dev->intf for printk Ricardo Ribalda
@ 2025-07-25 11:01 ` Ricardo Ribalda
  2025-07-25 11:25   ` Laurent Pinchart
  2025-07-25 11:01 ` [PATCH 2/2] media: uvcvideo: Do not re-reference dev->udev Ricardo Ribalda
  1 sibling, 1 reply; 6+ messages in thread
From: Ricardo Ribalda @ 2025-07-25 11:01 UTC (permalink / raw)
  To: Laurent Pinchart, Hans de Goede, Mauro Carvalho Chehab
  Cc: linux-media, linux-kernel, Ricardo Ribalda

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>
---
 drivers/media/usb/uvc/uvc_ctrl.c   | 10 +++++-----
 drivers/media/usb/uvc/uvc_driver.c | 20 ++++++++++----------
 drivers/media/usb/uvc/uvc_entity.c |  4 ++--
 drivers/media/usb/uvc/uvc_status.c |  4 ++--
 drivers/media/usb/uvc/uvc_video.c  |  6 +++---
 drivers/media/usb/uvc/uvcvideo.h   |  4 ++--
 6 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/drivers/media/usb/uvc/uvc_ctrl.c b/drivers/media/usb/uvc/uvc_ctrl.c
index efe609d7087752cb2ef516eef0fce12acd13e747..669caec2a3c448b8b2b7e03cd2a03a840aba3e92 100644
--- a/drivers/media/usb/uvc/uvc_ctrl.c
+++ b/drivers/media/usb/uvc/uvc_ctrl.c
@@ -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);
diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c
index 775bede0d93d9b3e5391914aa395326d3de6a3b1..d09d1286da0f61d5953125df23ed92555585e8f2 100644
--- a/drivers/media/usb/uvc/uvc_driver.c
+++ b/drivers/media/usb/uvc/uvc_driver.c
@@ -1868,7 +1868,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;
 	}
 
@@ -2092,7 +2092,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;
@@ -2128,7 +2128,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
 	}
@@ -2229,23 +2229,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);
 	}
 
@@ -2281,21 +2281,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;
 	}
diff --git a/drivers/media/usb/uvc/uvc_entity.c b/drivers/media/usb/uvc/uvc_entity.c
index cc68dd24eb42dce5b2846ca52a8dfa499c8aed96..3823ac9c8045b3ad8530372fd38983aaafbd775d 100644
--- a/drivers/media/usb/uvc/uvc_entity.c
+++ b/drivers/media/usb/uvc/uvc_entity.c
@@ -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;
diff --git a/drivers/media/usb/uvc/uvc_status.c b/drivers/media/usb/uvc/uvc_status.c
index ee01dce4b7834b05aab95379191c305cf8cec7f7..d3a3c4125c1fb6c8a5f2ee20bf4f0a9227fe2e46 100644
--- a/drivers/media/usb/uvc/uvc_status.c
+++ b/drivers/media/usb/uvc/uvc_status.c
@@ -215,7 +215,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;
@@ -247,7 +247,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);
 }
 
diff --git a/drivers/media/usb/uvc/uvc_video.c b/drivers/media/usb/uvc/uvc_video.c
index 2e377e7b9e81599aca19b800a171cc16a09c1e8a..f044666947a8c59e5bc6b444bb4e01f54df33c80 100644
--- a/drivers/media/usb/uvc/uvc_video.c
+++ b/drivers/media/usb/uvc/uvc_video.c
@@ -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;
diff --git a/drivers/media/usb/uvc/uvcvideo.h b/drivers/media/usb/uvc/uvcvideo.h
index 757254fc4fe930ae61c9d0425f04d4cd074a617e..8507de9ae633c9374b6427c890401a6a09ccb819 100644
--- a/drivers/media/usb/uvc/uvcvideo.h
+++ b/drivers/media/usb/uvc/uvcvideo.h
@@ -667,7 +667,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)
 
@@ -680,7 +680,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)
 
 /* --------------------------------------------------------------------------

-- 
2.50.1.470.g6ba607880d-goog


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] media: uvcvideo: Do not re-reference dev->udev
  2025-07-25 11:01 [PATCH 0/2] media: uvcvideo: Use dev->intf for printk Ricardo Ribalda
  2025-07-25 11:01 ` [PATCH 1/2] media: uvcvideo: Use intf instead of udev for printks Ricardo Ribalda
@ 2025-07-25 11:01 ` Ricardo Ribalda
  2025-07-25 11:26   ` Laurent Pinchart
  1 sibling, 1 reply; 6+ messages in thread
From: Ricardo Ribalda @ 2025-07-25 11:01 UTC (permalink / raw)
  To: Laurent Pinchart, Hans de Goede, Mauro Carvalho Chehab
  Cc: linux-media, linux-kernel, Ricardo Ribalda

dev->udev is already referenced by the variable udev. Let's use it.

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
 drivers/media/usb/uvc/uvc_driver.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c
index d09d1286da0f61d5953125df23ed92555585e8f2..209cedeff59e8be2e96ce79c3d395a5a85a336c6 100644
--- a/drivers/media/usb/uvc/uvc_driver.c
+++ b/drivers/media/usb/uvc/uvc_driver.c
@@ -882,7 +882,7 @@ static int uvc_parse_vendor_control(struct uvc_device *dev,
 	unsigned int n, p;
 	int handled = 0;
 
-	switch (le16_to_cpu(dev->udev->descriptor.idVendor)) {
+	switch (le16_to_cpu(udev->descriptor.idVendor)) {
 	case 0x046d:		/* Logitech */
 		if (buffer[1] != 0x41 || buffer[2] != 0x01)
 			break;

-- 
2.50.1.470.g6ba607880d-goog


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] media: uvcvideo: Use intf instead of udev for printks
  2025-07-25 11:01 ` [PATCH 1/2] media: uvcvideo: Use intf instead of udev for printks Ricardo Ribalda
@ 2025-07-25 11:25   ` Laurent Pinchart
  0 siblings, 0 replies; 6+ messages in thread
From: Laurent Pinchart @ 2025-07-25 11:25 UTC (permalink / raw)
  To: Ricardo Ribalda
  Cc: Hans de Goede, Mauro Carvalho Chehab, linux-media, linux-kernel

Hi Ricardo,

On Fri, Jul 25, 2025 at 11:01:29AM +0000, Ricardo Ribalda wrote:
> 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.

Good idea.

> 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>

> ---
>  drivers/media/usb/uvc/uvc_ctrl.c   | 10 +++++-----
>  drivers/media/usb/uvc/uvc_driver.c | 20 ++++++++++----------
>  drivers/media/usb/uvc/uvc_entity.c |  4 ++--
>  drivers/media/usb/uvc/uvc_status.c |  4 ++--
>  drivers/media/usb/uvc/uvc_video.c  |  6 +++---
>  drivers/media/usb/uvc/uvcvideo.h   |  4 ++--
>  6 files changed, 24 insertions(+), 24 deletions(-)
> 
> diff --git a/drivers/media/usb/uvc/uvc_ctrl.c b/drivers/media/usb/uvc/uvc_ctrl.c
> index efe609d7087752cb2ef516eef0fce12acd13e747..669caec2a3c448b8b2b7e03cd2a03a840aba3e92 100644
> --- a/drivers/media/usb/uvc/uvc_ctrl.c
> +++ b/drivers/media/usb/uvc/uvc_ctrl.c
> @@ -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);
> diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c
> index 775bede0d93d9b3e5391914aa395326d3de6a3b1..d09d1286da0f61d5953125df23ed92555585e8f2 100644
> --- a/drivers/media/usb/uvc/uvc_driver.c
> +++ b/drivers/media/usb/uvc/uvc_driver.c
> @@ -1868,7 +1868,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;
>  	}
>  
> @@ -2092,7 +2092,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;
> @@ -2128,7 +2128,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
>  	}
> @@ -2229,23 +2229,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);
>  	}
>  
> @@ -2281,21 +2281,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;
>  	}
> diff --git a/drivers/media/usb/uvc/uvc_entity.c b/drivers/media/usb/uvc/uvc_entity.c
> index cc68dd24eb42dce5b2846ca52a8dfa499c8aed96..3823ac9c8045b3ad8530372fd38983aaafbd775d 100644
> --- a/drivers/media/usb/uvc/uvc_entity.c
> +++ b/drivers/media/usb/uvc/uvc_entity.c
> @@ -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;
> diff --git a/drivers/media/usb/uvc/uvc_status.c b/drivers/media/usb/uvc/uvc_status.c
> index ee01dce4b7834b05aab95379191c305cf8cec7f7..d3a3c4125c1fb6c8a5f2ee20bf4f0a9227fe2e46 100644
> --- a/drivers/media/usb/uvc/uvc_status.c
> +++ b/drivers/media/usb/uvc/uvc_status.c
> @@ -215,7 +215,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;
> @@ -247,7 +247,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);
>  }
>  
> diff --git a/drivers/media/usb/uvc/uvc_video.c b/drivers/media/usb/uvc/uvc_video.c
> index 2e377e7b9e81599aca19b800a171cc16a09c1e8a..f044666947a8c59e5bc6b444bb4e01f54df33c80 100644
> --- a/drivers/media/usb/uvc/uvc_video.c
> +++ b/drivers/media/usb/uvc/uvc_video.c
> @@ -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;
> diff --git a/drivers/media/usb/uvc/uvcvideo.h b/drivers/media/usb/uvc/uvcvideo.h
> index 757254fc4fe930ae61c9d0425f04d4cd074a617e..8507de9ae633c9374b6427c890401a6a09ccb819 100644
> --- a/drivers/media/usb/uvc/uvcvideo.h
> +++ b/drivers/media/usb/uvc/uvcvideo.h
> @@ -667,7 +667,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)
>  
> @@ -680,7 +680,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)
>  
>  /* --------------------------------------------------------------------------

-- 
Regards,

Laurent Pinchart

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] media: uvcvideo: Do not re-reference dev->udev
  2025-07-25 11:01 ` [PATCH 2/2] media: uvcvideo: Do not re-reference dev->udev Ricardo Ribalda
@ 2025-07-25 11:26   ` Laurent Pinchart
  2025-07-25 13:01     ` Ricardo Ribalda
  0 siblings, 1 reply; 6+ messages in thread
From: Laurent Pinchart @ 2025-07-25 11:26 UTC (permalink / raw)
  To: Ricardo Ribalda
  Cc: Hans de Goede, Mauro Carvalho Chehab, linux-media, linux-kernel

On Fri, Jul 25, 2025 at 11:01:30AM +0000, Ricardo Ribalda wrote:
> dev->udev is already referenced by the variable udev. Let's use it.

The variable is used in a single location. I would probably have dropped
it instead, but I don't have a strong preference. If you prefer it this
way,

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Please let me know if you will send a patch to drop the variable
instead, or if I should merge this one.

> Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
> ---
>  drivers/media/usb/uvc/uvc_driver.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c
> index d09d1286da0f61d5953125df23ed92555585e8f2..209cedeff59e8be2e96ce79c3d395a5a85a336c6 100644
> --- a/drivers/media/usb/uvc/uvc_driver.c
> +++ b/drivers/media/usb/uvc/uvc_driver.c
> @@ -882,7 +882,7 @@ static int uvc_parse_vendor_control(struct uvc_device *dev,
>  	unsigned int n, p;
>  	int handled = 0;
>  
> -	switch (le16_to_cpu(dev->udev->descriptor.idVendor)) {
> +	switch (le16_to_cpu(udev->descriptor.idVendor)) {
>  	case 0x046d:		/* Logitech */
>  		if (buffer[1] != 0x41 || buffer[2] != 0x01)
>  			break;

-- 
Regards,

Laurent Pinchart

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] media: uvcvideo: Do not re-reference dev->udev
  2025-07-25 11:26   ` Laurent Pinchart
@ 2025-07-25 13:01     ` Ricardo Ribalda
  0 siblings, 0 replies; 6+ messages in thread
From: Ricardo Ribalda @ 2025-07-25 13:01 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Hans de Goede, Mauro Carvalho Chehab, linux-media, linux-kernel

Hi Laurent

On Fri, 25 Jul 2025 at 13:27, Laurent Pinchart
<laurent.pinchart@ideasonboard.com> wrote:
>
> On Fri, Jul 25, 2025 at 11:01:30AM +0000, Ricardo Ribalda wrote:
> > dev->udev is already referenced by the variable udev. Let's use it.
>
> The variable is used in a single location. I would probably have dropped
> it instead, but I don't have a strong preference. If you prefer it this
> way,
>

I believe that it is used twice.

Anything works for me. Feel free to change it the way you prefer
when/if you merge it, or land it as is.

> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
>
> Please let me know if you will send a patch to drop the variable
> instead, or if I should merge this one.
>
> > Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
> > ---
> >  drivers/media/usb/uvc/uvc_driver.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c
> > index d09d1286da0f61d5953125df23ed92555585e8f2..209cedeff59e8be2e96ce79c3d395a5a85a336c6 100644
> > --- a/drivers/media/usb/uvc/uvc_driver.c
> > +++ b/drivers/media/usb/uvc/uvc_driver.c
> > @@ -882,7 +882,7 @@ static int uvc_parse_vendor_control(struct uvc_device *dev,
> >       unsigned int n, p;
> >       int handled = 0;
> >
> > -     switch (le16_to_cpu(dev->udev->descriptor.idVendor)) {
> > +     switch (le16_to_cpu(udev->descriptor.idVendor)) {
> >       case 0x046d:            /* Logitech */
> >               if (buffer[1] != 0x41 || buffer[2] != 0x01)
> >                       break;
>
> --
> Regards,
>
> Laurent Pinchart



-- 
Ricardo Ribalda

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-07-25 13:01 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-25 11:01 [PATCH 0/2] media: uvcvideo: Use dev->intf for printk Ricardo Ribalda
2025-07-25 11:01 ` [PATCH 1/2] media: uvcvideo: Use intf instead of udev for printks Ricardo Ribalda
2025-07-25 11:25   ` Laurent Pinchart
2025-07-25 11:01 ` [PATCH 2/2] media: uvcvideo: Do not re-reference dev->udev Ricardo Ribalda
2025-07-25 11:26   ` Laurent Pinchart
2025-07-25 13:01     ` Ricardo Ribalda

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).