Commit 69df0954 authored by Ricardo Ribalda's avatar Ricardo Ribalda Committed by Mauro Carvalho Chehab

media: uvcvideo: Use dev_ printk aliases

Replace all the uses of printk() and uvc_printk() with its
equivalent dev_ alias macros.

Modify uvc_warn_once() macro to use dev_info instead printk().

They are more standard across the kernel tree and provide
more context about the error.
Suggested-by: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarRicardo Ribalda <ribalda@chromium.org>
Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent 6f6a87eb
...@@ -1329,8 +1329,8 @@ static void uvc_ctrl_status_event_work(struct work_struct *work) ...@@ -1329,8 +1329,8 @@ static void uvc_ctrl_status_event_work(struct work_struct *work)
w->urb->interval = dev->int_ep->desc.bInterval; w->urb->interval = dev->int_ep->desc.bInterval;
ret = usb_submit_urb(w->urb, GFP_KERNEL); ret = usb_submit_urb(w->urb, GFP_KERNEL);
if (ret < 0) if (ret < 0)
uvc_printk(KERN_ERR, "Failed to resubmit status URB (%d).\n", dev_err(&dev->udev->dev,
ret); "Failed to resubmit status URB (%d).\n", ret);
} }
bool uvc_ctrl_status_event_async(struct urb *urb, struct uvc_video_chain *chain, bool uvc_ctrl_status_event_async(struct urb *urb, struct uvc_video_chain *chain,
...@@ -2010,10 +2010,10 @@ int uvc_ctrl_restore_values(struct uvc_device *dev) ...@@ -2010,10 +2010,10 @@ int uvc_ctrl_restore_values(struct uvc_device *dev)
if (!ctrl->initialized || !ctrl->modified || if (!ctrl->initialized || !ctrl->modified ||
(ctrl->info.flags & UVC_CTRL_FLAG_RESTORE) == 0) (ctrl->info.flags & UVC_CTRL_FLAG_RESTORE) == 0)
continue; continue;
dev_info(&dev->udev->dev,
printk(KERN_INFO "restoring control %pUl/%u/%u\n", "restoring control %pUl/%u/%u\n",
ctrl->info.entity, ctrl->info.index, ctrl->info.entity, ctrl->info.index,
ctrl->info.selector); ctrl->info.selector);
ctrl->dirty = 1; ctrl->dirty = 1;
} }
......
...@@ -535,8 +535,8 @@ static int uvc_parse_format(struct uvc_device *dev, ...@@ -535,8 +535,8 @@ static int uvc_parse_format(struct uvc_device *dev,
sizeof(format->name)); sizeof(format->name));
format->fcc = fmtdesc->fcc; format->fcc = fmtdesc->fcc;
} else { } else {
uvc_printk(KERN_INFO, "Unknown video format %pUl\n", dev_info(&streaming->intf->dev,
&buffer[5]); "Unknown video format %pUl\n", &buffer[5]);
snprintf(format->name, sizeof(format->name), "%pUl\n", snprintf(format->name, sizeof(format->name), "%pUl\n",
&buffer[5]); &buffer[5]);
format->fcc = 0; format->fcc = 0;
...@@ -2056,7 +2056,7 @@ static int uvc_scan_device(struct uvc_device *dev) ...@@ -2056,7 +2056,7 @@ static int uvc_scan_device(struct uvc_device *dev)
uvc_scan_fallback(dev); uvc_scan_fallback(dev);
if (list_empty(&dev->chains)) { if (list_empty(&dev->chains)) {
uvc_printk(KERN_INFO, "No valid video chain found.\n"); dev_info(&dev->udev->dev, "No valid video chain found.\n");
return -1; return -1;
} }
...@@ -2215,8 +2215,9 @@ int uvc_register_video_device(struct uvc_device *dev, ...@@ -2215,8 +2215,9 @@ int uvc_register_video_device(struct uvc_device *dev,
ret = video_register_device(vdev, VFL_TYPE_VIDEO, -1); ret = video_register_device(vdev, VFL_TYPE_VIDEO, -1);
if (ret < 0) { if (ret < 0) {
uvc_printk(KERN_ERR, "Failed to register %s device (%d).\n", dev_err(&stream->intf->dev,
v4l2_type_names[type], ret); "Failed to register %s device (%d).\n",
v4l2_type_names[type], ret);
return ret; return ret;
} }
...@@ -2232,8 +2233,8 @@ static int uvc_register_video(struct uvc_device *dev, ...@@ -2232,8 +2233,8 @@ static int uvc_register_video(struct uvc_device *dev,
/* Initialize the streaming interface with default parameters. */ /* Initialize the streaming interface with default parameters. */
ret = uvc_video_init(stream); ret = uvc_video_init(stream);
if (ret < 0) { if (ret < 0) {
uvc_printk(KERN_ERR, "Failed to initialize the device (%d).\n", dev_err(&stream->intf->dev,
ret); "Failed to initialize the device (%d).\n", ret);
return ret; return ret;
} }
...@@ -2267,8 +2268,9 @@ static int uvc_register_terms(struct uvc_device *dev, ...@@ -2267,8 +2268,9 @@ static int uvc_register_terms(struct uvc_device *dev,
stream = uvc_stream_by_id(dev, term->id); stream = uvc_stream_by_id(dev, term->id);
if (stream == NULL) { if (stream == NULL) {
uvc_printk(KERN_INFO, "No streaming interface found " dev_info(&dev->udev->dev,
"for terminal %u.", term->id); "No streaming interface found for terminal %u.",
term->id);
continue; continue;
} }
...@@ -2301,8 +2303,8 @@ static int uvc_register_chains(struct uvc_device *dev) ...@@ -2301,8 +2303,8 @@ static int uvc_register_chains(struct uvc_device *dev)
#ifdef CONFIG_MEDIA_CONTROLLER #ifdef CONFIG_MEDIA_CONTROLLER
ret = uvc_mc_register_entities(chain); ret = uvc_mc_register_entities(chain);
if (ret < 0) if (ret < 0)
uvc_printk(KERN_INFO, dev_info(&dev->udev->dev,
"Failed to register entities (%d).\n", ret); "Failed to register entities (%d).\n", ret);
#endif #endif
} }
...@@ -2405,23 +2407,24 @@ static int uvc_probe(struct usb_interface *intf, ...@@ -2405,23 +2407,24 @@ static int uvc_probe(struct usb_interface *intf,
goto error; goto error;
} }
uvc_printk(KERN_INFO, "Found UVC %u.%02x device %s (%04x:%04x)\n", dev_info(&dev->udev->dev, "Found UVC %u.%02x device %s (%04x:%04x)\n",
dev->uvc_version >> 8, dev->uvc_version & 0xff, dev->uvc_version >> 8, dev->uvc_version & 0xff,
udev->product ? udev->product : "<unnamed>", udev->product ? udev->product : "<unnamed>",
le16_to_cpu(udev->descriptor.idVendor), le16_to_cpu(udev->descriptor.idVendor),
le16_to_cpu(udev->descriptor.idProduct)); le16_to_cpu(udev->descriptor.idProduct));
if (dev->quirks != dev->info->quirks) { if (dev->quirks != dev->info->quirks) {
uvc_printk(KERN_INFO, "Forcing device quirks to 0x%x by module " dev_info(&dev->udev->dev,
"parameter for testing purpose.\n", dev->quirks); "Forcing device quirks to 0x%x by module parameter for testing purpose.\n",
uvc_printk(KERN_INFO, "Please report required quirks to the " dev->quirks);
"linux-uvc-devel mailing list.\n"); dev_info(&dev->udev->dev,
"Please report required quirks to the linux-uvc-devel mailing list.\n");
} }
if (dev->info->uvc_version) { if (dev->info->uvc_version) {
dev->uvc_version = dev->info->uvc_version; dev->uvc_version = dev->info->uvc_version;
uvc_printk(KERN_INFO, "Forcing UVC version to %u.%02x\n", dev_info(&dev->udev->dev, "Forcing UVC version to %u.%02x\n",
dev->uvc_version >> 8, dev->uvc_version & 0xff); dev->uvc_version >> 8, dev->uvc_version & 0xff);
} }
/* Register the V4L2 device. */ /* Register the V4L2 device. */
...@@ -2450,9 +2453,9 @@ static int uvc_probe(struct usb_interface *intf, ...@@ -2450,9 +2453,9 @@ static int uvc_probe(struct usb_interface *intf,
/* Initialize the interrupt URB. */ /* Initialize the interrupt URB. */
if ((ret = uvc_status_init(dev)) < 0) { if ((ret = uvc_status_init(dev)) < 0) {
uvc_printk(KERN_INFO, "Unable to initialize the status " dev_info(&dev->udev->dev,
"endpoint (%d), status interrupt will not be " "Unable to initialize the status endpoint (%d), status interrupt will not be supported.\n",
"supported.\n", ret); ret);
} }
ret = uvc_gpio_init_irq(dev); ret = uvc_gpio_init_irq(dev);
...@@ -3170,7 +3173,6 @@ static int __init uvc_init(void) ...@@ -3170,7 +3173,6 @@ static int __init uvc_init(void)
return ret; return ret;
} }
printk(KERN_INFO DRIVER_DESC " (" DRIVER_VERSION ")\n");
return 0; return 0;
} }
......
...@@ -140,8 +140,9 @@ int uvc_mc_register_entities(struct uvc_video_chain *chain) ...@@ -140,8 +140,9 @@ int uvc_mc_register_entities(struct uvc_video_chain *chain)
list_for_each_entry(entity, &chain->entities, chain) { list_for_each_entry(entity, &chain->entities, chain) {
ret = uvc_mc_init_entity(chain, entity); ret = uvc_mc_init_entity(chain, entity);
if (ret < 0) { if (ret < 0) {
uvc_printk(KERN_INFO, "Failed to initialize entity for " dev_info(&chain->dev->udev->dev,
"entity %u\n", entity->id); "Failed to initialize entity for entity %u\n",
entity->id);
return ret; return ret;
} }
} }
...@@ -149,8 +150,9 @@ int uvc_mc_register_entities(struct uvc_video_chain *chain) ...@@ -149,8 +150,9 @@ int uvc_mc_register_entities(struct uvc_video_chain *chain)
list_for_each_entry(entity, &chain->entities, chain) { list_for_each_entry(entity, &chain->entities, chain) {
ret = uvc_mc_create_links(chain, entity); ret = uvc_mc_create_links(chain, entity);
if (ret < 0) { if (ret < 0) {
uvc_printk(KERN_INFO, "Failed to create links for " dev_info(&chain->dev->udev->dev,
"entity %u\n", entity->id); "Failed to create links for entity %u\n",
entity->id);
return ret; return ret;
} }
} }
......
...@@ -209,8 +209,9 @@ static void uvc_status_complete(struct urb *urb) ...@@ -209,8 +209,9 @@ static void uvc_status_complete(struct urb *urb)
return; return;
default: default:
uvc_printk(KERN_WARNING, "Non-zero status (%d) in status " dev_warn(&dev->udev->dev,
"completion handler.\n", urb->status); "Non-zero status (%d) in status completion handler.\n",
urb->status);
return; return;
} }
...@@ -244,10 +245,10 @@ static void uvc_status_complete(struct urb *urb) ...@@ -244,10 +245,10 @@ static void uvc_status_complete(struct urb *urb)
/* Resubmit the URB. */ /* Resubmit the URB. */
urb->interval = dev->int_ep->desc.bInterval; urb->interval = dev->int_ep->desc.bInterval;
if ((ret = usb_submit_urb(urb, GFP_ATOMIC)) < 0) { ret = usb_submit_urb(urb, GFP_ATOMIC);
uvc_printk(KERN_ERR, "Failed to resubmit status URB (%d).\n", if (ret < 0)
ret); dev_err(&dev->udev->dev,
} "Failed to resubmit status URB (%d).\n", ret);
} }
int uvc_status_init(struct uvc_device *dev) int uvc_status_init(struct uvc_device *dev)
......
...@@ -76,9 +76,9 @@ int uvc_query_ctrl(struct uvc_device *dev, u8 query, u8 unit, ...@@ -76,9 +76,9 @@ int uvc_query_ctrl(struct uvc_device *dev, u8 query, u8 unit,
if (likely(ret == size)) if (likely(ret == size))
return 0; return 0;
uvc_printk(KERN_ERR, dev_err(&dev->udev->dev,
"Failed to query (%s) UVC control %u on unit %u: %d (exp. %u).\n", "Failed to query (%s) UVC control %u on unit %u: %d (exp. %u).\n",
uvc_query_name(query), cs, unit, ret, size); uvc_query_name(query), cs, unit, ret, size);
if (ret != -EPIPE) if (ret != -EPIPE)
return ret; return ret;
...@@ -254,9 +254,9 @@ static int uvc_get_video_ctrl(struct uvc_streaming *stream, ...@@ -254,9 +254,9 @@ static int uvc_get_video_ctrl(struct uvc_streaming *stream,
ret = -EIO; ret = -EIO;
goto out; goto out;
} else if (ret != size) { } else if (ret != size) {
uvc_printk(KERN_ERR, "Failed to query (%u) UVC %s control : " dev_err(&stream->intf->dev,
"%d (exp. %u).\n", query, probe ? "probe" : "commit", "Failed to query (%u) UVC %s control : %d (exp. %u).\n",
ret, size); query, probe ? "probe" : "commit", ret, size);
ret = -EIO; ret = -EIO;
goto out; goto out;
} }
...@@ -334,9 +334,9 @@ static int uvc_set_video_ctrl(struct uvc_streaming *stream, ...@@ -334,9 +334,9 @@ static int uvc_set_video_ctrl(struct uvc_streaming *stream,
probe ? UVC_VS_PROBE_CONTROL : UVC_VS_COMMIT_CONTROL, data, probe ? UVC_VS_PROBE_CONTROL : UVC_VS_COMMIT_CONTROL, data,
size, uvc_timeout_param); size, uvc_timeout_param);
if (ret != size) { if (ret != size) {
uvc_printk(KERN_ERR, "Failed to set UVC %s control : " dev_err(&stream->intf->dev,
"%d (exp. %u).\n", probe ? "probe" : "commit", "Failed to set UVC %s control : %d (exp. %u).\n",
ret, size); probe ? "probe" : "commit", ret, size);
ret = -EIO; ret = -EIO;
} }
...@@ -1120,8 +1120,8 @@ static void uvc_video_copy_data_work(struct work_struct *work) ...@@ -1120,8 +1120,8 @@ static void uvc_video_copy_data_work(struct work_struct *work)
ret = usb_submit_urb(uvc_urb->urb, GFP_KERNEL); ret = usb_submit_urb(uvc_urb->urb, GFP_KERNEL);
if (ret < 0) if (ret < 0)
uvc_printk(KERN_ERR, "Failed to resubmit video URB (%d).\n", dev_err(&uvc_urb->stream->intf->dev,
ret); "Failed to resubmit video URB (%d).\n", ret);
} }
static void uvc_video_decode_data(struct uvc_urb *uvc_urb, static void uvc_video_decode_data(struct uvc_urb *uvc_urb,
...@@ -1507,8 +1507,9 @@ static void uvc_video_complete(struct urb *urb) ...@@ -1507,8 +1507,9 @@ static void uvc_video_complete(struct urb *urb)
break; break;
default: default:
uvc_printk(KERN_WARNING, "Non-zero status (%d) in video " dev_warn(&stream->intf->dev,
"completion handler.\n", urb->status); "Non-zero status (%d) in video completion handler.\n",
urb->status);
fallthrough; fallthrough;
case -ENOENT: /* usb_poison_urb() called. */ case -ENOENT: /* usb_poison_urb() called. */
if (stream->frozen) if (stream->frozen)
...@@ -1545,9 +1546,8 @@ static void uvc_video_complete(struct urb *urb) ...@@ -1545,9 +1546,8 @@ static void uvc_video_complete(struct urb *urb)
if (!uvc_urb->async_operations) { if (!uvc_urb->async_operations) {
ret = usb_submit_urb(uvc_urb->urb, GFP_ATOMIC); ret = usb_submit_urb(uvc_urb->urb, GFP_ATOMIC);
if (ret < 0) if (ret < 0)
uvc_printk(KERN_ERR, dev_err(&stream->intf->dev,
"Failed to resubmit video URB (%d).\n", "Failed to resubmit video URB (%d).\n", ret);
ret);
return; return;
} }
...@@ -1893,8 +1893,9 @@ static int uvc_video_start_transfer(struct uvc_streaming *stream, ...@@ -1893,8 +1893,9 @@ static int uvc_video_start_transfer(struct uvc_streaming *stream,
for_each_uvc_urb(uvc_urb, stream) { for_each_uvc_urb(uvc_urb, stream) {
ret = usb_submit_urb(uvc_urb->urb, gfp_flags); ret = usb_submit_urb(uvc_urb->urb, gfp_flags);
if (ret < 0) { if (ret < 0) {
uvc_printk(KERN_ERR, "Failed to submit URB %u (%d).\n", dev_err(&stream->intf->dev,
uvc_urb_index(uvc_urb), ret); "Failed to submit URB %u (%d).\n",
uvc_urb_index(uvc_urb), ret);
uvc_video_stop_transfer(stream, 1); uvc_video_stop_transfer(stream, 1);
return ret; return ret;
} }
...@@ -1989,7 +1990,8 @@ int uvc_video_init(struct uvc_streaming *stream) ...@@ -1989,7 +1990,8 @@ int uvc_video_init(struct uvc_streaming *stream)
int ret; int ret;
if (stream->nformats == 0) { if (stream->nformats == 0) {
uvc_printk(KERN_INFO, "No supported video formats found.\n"); dev_info(&stream->intf->dev,
"No supported video formats found.\n");
return -EINVAL; return -EINVAL;
} }
...@@ -2029,8 +2031,8 @@ int uvc_video_init(struct uvc_streaming *stream) ...@@ -2029,8 +2031,8 @@ int uvc_video_init(struct uvc_streaming *stream)
} }
if (format->nframes == 0) { if (format->nframes == 0) {
uvc_printk(KERN_INFO, "No frame descriptor found for the " dev_info(&stream->intf->dev,
"default format.\n"); "No frame descriptor found for the default format.\n");
return -EINVAL; return -EINVAL;
} }
...@@ -2064,8 +2066,8 @@ int uvc_video_init(struct uvc_streaming *stream) ...@@ -2064,8 +2066,8 @@ int uvc_video_init(struct uvc_streaming *stream)
if (stream->intf->num_altsetting == 1) if (stream->intf->num_altsetting == 1)
stream->decode = uvc_video_encode_bulk; stream->decode = uvc_video_encode_bulk;
else { else {
uvc_printk(KERN_INFO, "Isochronous endpoints are not " dev_info(&stream->intf->dev,
"supported for video output devices.\n"); "Isochronous endpoints are not supported for video output devices.\n");
return -EINVAL; return -EINVAL;
} }
} }
......
...@@ -752,20 +752,17 @@ extern unsigned int uvc_trace_param; ...@@ -752,20 +752,17 @@ extern unsigned int uvc_trace_param;
extern unsigned int uvc_timeout_param; extern unsigned int uvc_timeout_param;
extern unsigned int uvc_hw_timestamps_param; extern unsigned int uvc_hw_timestamps_param;
#define uvc_trace(flag, msg...) \ #define uvc_trace(flag, fmt, ...) \
do { \ do { \
if (uvc_trace_param & flag) \ if (uvc_trace_param & flag) \
printk(KERN_DEBUG "uvcvideo: " msg); \ printk(KERN_DEBUG "uvcvideo: " fmt, ##__VA_ARGS__); \
} while (0) } while (0)
#define uvc_warn_once(dev, warn, msg...) \ #define uvc_warn_once(_dev, warn, fmt, ...) \
do { \ do { \
if (!test_and_set_bit(warn, &dev->warnings)) \ if (!test_and_set_bit(warn, &(_dev)->warnings)) \
printk(KERN_INFO "uvcvideo: " msg); \ dev_info(&(_dev)->udev->dev, fmt, ##__VA_ARGS__); \
} while (0) } while (0)
#define uvc_printk(level, msg...) \
printk(level "uvcvideo: " msg)
/* -------------------------------------------------------------------------- /* --------------------------------------------------------------------------
* Internal functions. * Internal functions.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment