Skip to content

Commit 5cdbca8

Browse files
ribaldaHans Verkuil
authored andcommitted
media: uvcvideo: Use intf instead of udev for printks
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>
1 parent 3e412a7 commit 5cdbca8

6 files changed

Lines changed: 24 additions & 24 deletions

File tree

drivers/media/usb/uvc/uvc_ctrl.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1619,7 +1619,7 @@ static int __uvc_query_v4l2_ctrl(struct uvc_video_chain *chain,
16191619
}
16201620

16211621
if (ret == -EIO) {
1622-
dev_warn_ratelimited(&chain->dev->udev->dev,
1622+
dev_warn_ratelimited(&chain->dev->intf->dev,
16231623
"UVC non compliance: Error %d querying master control %x (%s)\n",
16241624
ret, master_map->id,
16251625
uvc_map_get_name(master_map));
@@ -1643,7 +1643,7 @@ static int __uvc_query_v4l2_ctrl(struct uvc_video_chain *chain,
16431643

16441644
ret = __uvc_queryctrl_boundaries(chain, ctrl, mapping, v4l2_ctrl);
16451645
if (ret && !mapping->disabled) {
1646-
dev_warn(&chain->dev->udev->dev,
1646+
dev_warn(&chain->dev->intf->dev,
16471647
"UVC non compliance: permanently disabling control %x (%s), due to error %d\n",
16481648
mapping->id, uvc_map_get_name(mapping), ret);
16491649
mapping->disabled = true;
@@ -1858,7 +1858,7 @@ static int uvc_ctrl_set_handle(struct uvc_control *ctrl, struct uvc_fh *handle)
18581858
lockdep_assert_held(&handle->chain->ctrl_mutex);
18591859

18601860
if (ctrl->handle) {
1861-
dev_warn_ratelimited(&handle->stream->dev->udev->dev,
1861+
dev_warn_ratelimited(&handle->stream->dev->intf->dev,
18621862
"UVC non compliance: Setting an async control with a pending operation.");
18631863

18641864
if (ctrl->handle == handle)
@@ -1956,7 +1956,7 @@ static void uvc_ctrl_status_event_work(struct work_struct *work)
19561956
w->urb->interval = dev->int_ep->desc.bInterval;
19571957
ret = usb_submit_urb(w->urb, GFP_KERNEL);
19581958
if (ret < 0)
1959-
dev_err(&dev->udev->dev,
1959+
dev_err(&dev->intf->dev,
19601960
"Failed to resubmit status URB (%d).\n", ret);
19611961
}
19621962

@@ -2895,7 +2895,7 @@ int uvc_ctrl_restore_values(struct uvc_device *dev)
28952895
if (!ctrl->initialized || !ctrl->modified ||
28962896
(ctrl->info.flags & UVC_CTRL_FLAG_RESTORE) == 0)
28972897
continue;
2898-
dev_dbg(&dev->udev->dev,
2898+
dev_dbg(&dev->intf->dev,
28992899
"restoring control %pUl/%u/%u\n",
29002900
ctrl->info.entity, ctrl->info.index,
29012901
ctrl->info.selector);

drivers/media/usb/uvc/uvc_driver.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1864,7 +1864,7 @@ static int uvc_scan_device(struct uvc_device *dev)
18641864
uvc_scan_fallback(dev);
18651865

18661866
if (list_empty(&dev->chains)) {
1867-
dev_info(&dev->udev->dev, "No valid video chain found.\n");
1867+
dev_info(&dev->intf->dev, "No valid video chain found.\n");
18681868
return -ENODEV;
18691869
}
18701870

@@ -2088,7 +2088,7 @@ static int uvc_register_terms(struct uvc_device *dev,
20882088

20892089
stream = uvc_stream_by_id(dev, term->id);
20902090
if (stream == NULL) {
2091-
dev_info(&dev->udev->dev,
2091+
dev_info(&dev->intf->dev,
20922092
"No streaming interface found for terminal %u.",
20932093
term->id);
20942094
continue;
@@ -2124,7 +2124,7 @@ static int uvc_register_chains(struct uvc_device *dev)
21242124
#ifdef CONFIG_MEDIA_CONTROLLER
21252125
ret = uvc_mc_register_entities(chain);
21262126
if (ret < 0)
2127-
dev_info(&dev->udev->dev,
2127+
dev_info(&dev->intf->dev,
21282128
"Failed to register entities (%d).\n", ret);
21292129
#endif
21302130
}
@@ -2225,23 +2225,23 @@ static int uvc_probe(struct usb_interface *intf,
22252225
if (ret < 0)
22262226
goto error;
22272227

2228-
dev_info(&dev->udev->dev, "Found UVC %u.%02x device %s (%04x:%04x)\n",
2228+
dev_info(&dev->intf->dev, "Found UVC %u.%02x device %s (%04x:%04x)\n",
22292229
dev->uvc_version >> 8, dev->uvc_version & 0xff,
22302230
udev->product ? udev->product : "<unnamed>",
22312231
le16_to_cpu(udev->descriptor.idVendor),
22322232
le16_to_cpu(udev->descriptor.idProduct));
22332233

22342234
if (dev->quirks != dev->info->quirks) {
2235-
dev_info(&dev->udev->dev,
2235+
dev_info(&dev->intf->dev,
22362236
"Forcing device quirks to 0x%x by module parameter for testing purpose.\n",
22372237
dev->quirks);
2238-
dev_info(&dev->udev->dev,
2238+
dev_info(&dev->intf->dev,
22392239
"Please report required quirks to the linux-media mailing list.\n");
22402240
}
22412241

22422242
if (dev->info->uvc_version) {
22432243
dev->uvc_version = dev->info->uvc_version;
2244-
dev_info(&dev->udev->dev, "Forcing UVC version to %u.%02x\n",
2244+
dev_info(&dev->intf->dev, "Forcing UVC version to %u.%02x\n",
22452245
dev->uvc_version >> 8, dev->uvc_version & 0xff);
22462246
}
22472247

@@ -2277,21 +2277,21 @@ static int uvc_probe(struct usb_interface *intf,
22772277
/* Initialize the interrupt URB. */
22782278
ret = uvc_status_init(dev);
22792279
if (ret < 0) {
2280-
dev_info(&dev->udev->dev,
2280+
dev_info(&dev->intf->dev,
22812281
"Unable to initialize the status endpoint (%d), status interrupt will not be supported.\n",
22822282
ret);
22832283
}
22842284

22852285
ret = uvc_gpio_init_irq(dev);
22862286
if (ret < 0) {
2287-
dev_err(&dev->udev->dev,
2287+
dev_err(&dev->intf->dev,
22882288
"Unable to request privacy GPIO IRQ (%d)\n", ret);
22892289
goto error;
22902290
}
22912291

22922292
ret = uvc_meta_init(dev);
22932293
if (ret < 0) {
2294-
dev_err(&dev->udev->dev,
2294+
dev_err(&dev->intf->dev,
22952295
"Error initializing the metadata formats (%d)\n", ret);
22962296
goto error;
22972297
}

drivers/media/usb/uvc/uvc_entity.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ int uvc_mc_register_entities(struct uvc_video_chain *chain)
140140
list_for_each_entry(entity, &chain->entities, chain) {
141141
ret = uvc_mc_init_entity(chain, entity);
142142
if (ret < 0) {
143-
dev_info(&chain->dev->udev->dev,
143+
dev_info(&chain->dev->intf->dev,
144144
"Failed to initialize entity for entity %u\n",
145145
entity->id);
146146
return ret;
@@ -150,7 +150,7 @@ int uvc_mc_register_entities(struct uvc_video_chain *chain)
150150
list_for_each_entry(entity, &chain->entities, chain) {
151151
ret = uvc_mc_create_links(chain, entity);
152152
if (ret < 0) {
153-
dev_info(&chain->dev->udev->dev,
153+
dev_info(&chain->dev->intf->dev,
154154
"Failed to create links for entity %u\n",
155155
entity->id);
156156
return ret;

drivers/media/usb/uvc/uvc_status.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ static void uvc_status_complete(struct urb *urb)
216216
return;
217217

218218
default:
219-
dev_warn(&dev->udev->dev,
219+
dev_warn(&dev->intf->dev,
220220
"Non-zero status (%d) in status completion handler.\n",
221221
urb->status);
222222
return;
@@ -248,7 +248,7 @@ static void uvc_status_complete(struct urb *urb)
248248
urb->interval = dev->int_ep->desc.bInterval;
249249
ret = usb_submit_urb(urb, GFP_ATOMIC);
250250
if (ret < 0)
251-
dev_err(&dev->udev->dev,
251+
dev_err(&dev->intf->dev,
252252
"Failed to resubmit status URB (%d).\n", ret);
253253
}
254254

drivers/media/usb/uvc/uvc_video.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,14 @@ int uvc_query_ctrl(struct uvc_device *dev, u8 query, u8 unit,
9595
*/
9696
if (ret > 0 && query != UVC_GET_INFO) {
9797
memset(data + ret, 0, size - ret);
98-
dev_warn_once(&dev->udev->dev,
98+
dev_warn_once(&dev->intf->dev,
9999
"UVC non compliance: %s control %u on unit %u returned %d bytes when we expected %u.\n",
100100
uvc_query_name(query), cs, unit, ret, size);
101101
return 0;
102102
}
103103

104104
if (ret != -EPIPE) {
105-
dev_err(&dev->udev->dev,
105+
dev_err(&dev->intf->dev,
106106
"Failed to query (%s) UVC control %u on unit %u: %d (exp. %u).\n",
107107
uvc_query_name(query), cs, unit, ret, size);
108108
return ret < 0 ? ret : -EPIPE;
@@ -119,7 +119,7 @@ int uvc_query_ctrl(struct uvc_device *dev, u8 query, u8 unit,
119119
*(u8 *)data = tmp;
120120

121121
if (ret != 1) {
122-
dev_err_ratelimited(&dev->udev->dev,
122+
dev_err_ratelimited(&dev->intf->dev,
123123
"Failed to query (%s) UVC error code control %u on unit %u: %d (exp. 1).\n",
124124
uvc_query_name(query), cs, unit, ret);
125125
return ret < 0 ? ret : -EPIPE;

drivers/media/usb/uvc/uvcvideo.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -665,7 +665,7 @@ extern unsigned int uvc_hw_timestamps_param;
665665
#define uvc_dbg(_dev, flag, fmt, ...) \
666666
do { \
667667
if (uvc_dbg_param & UVC_DBG_##flag) \
668-
dev_printk(KERN_DEBUG, &(_dev)->udev->dev, fmt, \
668+
dev_printk(KERN_DEBUG, &(_dev)->intf->dev, fmt, \
669669
##__VA_ARGS__); \
670670
} while (0)
671671

@@ -678,7 +678,7 @@ do { \
678678
#define uvc_warn_once(_dev, warn, fmt, ...) \
679679
do { \
680680
if (!test_and_set_bit(warn, &(_dev)->warnings)) \
681-
dev_info(&(_dev)->udev->dev, fmt, ##__VA_ARGS__); \
681+
dev_info(&(_dev)->intf->dev, fmt, ##__VA_ARGS__); \
682682
} while (0)
683683

684684
/* --------------------------------------------------------------------------

0 commit comments

Comments
 (0)