diff options
author | Mauro Carvalho Chehab | 2016-10-20 08:42:03 -0200 |
---|---|---|
committer | Mauro Carvalho Chehab | 2016-11-18 10:08:15 -0200 |
commit | ce8591ff023ef8e04750c2cc2882523619a80b58 (patch) | |
tree | a513137f48890cd4ef0e51966666b4398d2bb747 /drivers/media/usb/em28xx/em28xx-video.c | |
parent | 39ad799a85e2afb2eeb0295cabe81e183b011b95 (diff) |
[media] em28xx: convert it from pr_foo() to dev_foo()
Instead of using pr_foo(), use dev_foo(), with provides a
better output. As this device is a multi-interface one,
we'll set the device name to show the chipset and the driver
used.
While here, get rid of printk continuation messages.
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/media/usb/em28xx/em28xx-video.c')
-rw-r--r-- | drivers/media/usb/em28xx/em28xx-video.c | 127 |
1 files changed, 76 insertions, 51 deletions
diff --git a/drivers/media/usb/em28xx/em28xx-video.c b/drivers/media/usb/em28xx/em28xx-video.c index 8b5e13bbfb07..2d282ed9aac0 100644 --- a/drivers/media/usb/em28xx/em28xx-video.c +++ b/drivers/media/usb/em28xx/em28xx-video.c @@ -64,15 +64,17 @@ static int alt; module_param(alt, int, 0644); MODULE_PARM_DESC(alt, "alternate setting to use for video endpoint"); -#define em28xx_videodbg(fmt, arg...) do {\ - if (video_debug) \ - printk(KERN_DEBUG pr_fmt("video: %s: " fmt), \ - __func__, ##arg); } while (0) +#define em28xx_videodbg(fmt, arg...) do { \ + if (video_debug) \ + dev_printk(KERN_DEBUG, &dev->udev->dev, \ + "video: %s: " fmt, __func__, ## arg); \ +} while (0) #define em28xx_isocdbg(fmt, arg...) do {\ if (isoc_debug) \ - printk(KERN_DEBUG pr_fmt("isoc: %s: " fmt), \ - __func__, ##arg); } while (0) + dev_printk(KERN_DEBUG, &dev->udev->dev, \ + "isoc: %s: " fmt, __func__, ## arg); \ +} while (0) MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_DESCRIPTION(DRIVER_DESC " - v4l2 interface"); @@ -411,8 +413,9 @@ set_alt: dev->alt, dev->max_pkt_size); errCode = usb_set_interface(dev->udev, dev->ifnum, dev->alt); if (errCode < 0) { - pr_err("cannot change alternate number to %d (error=%i)\n", - dev->alt, errCode); + dev_err(&dev->udev->dev, + "cannot change alternate number to %d (error=%i)\n", + dev->alt, errCode); return errCode; } return 0; @@ -923,10 +926,11 @@ static int em28xx_enable_analog_tuner(struct em28xx *dev) ret = media_entity_setup_link(link, flags); if (ret) { - pr_err("Couldn't change link %s->%s to %s. Error %d\n", - source->name, sink->name, - flags ? "enabled" : "disabled", - ret); + dev_err(&dev->udev->dev, + "Couldn't change link %s->%s to %s. Error %d\n", + source->name, sink->name, + flags ? "enabled" : "disabled", + ret); return ret; } else em28xx_videodbg("link %s->%s was %s\n", @@ -954,14 +958,16 @@ static void em28xx_v4l2_create_entities(struct em28xx *dev) v4l2->video_pad.flags = MEDIA_PAD_FL_SINK; ret = media_entity_pads_init(&v4l2->vdev.entity, 1, &v4l2->video_pad); if (ret < 0) - pr_err("failed to initialize video media entity!\n"); + dev_err(&dev->udev->dev, + "failed to initialize video media entity!\n"); if (em28xx_vbi_supported(dev)) { v4l2->vbi_pad.flags = MEDIA_PAD_FL_SINK; ret = media_entity_pads_init(&v4l2->vbi_dev.entity, 1, &v4l2->vbi_pad); if (ret < 0) - pr_err("failed to initialize vbi media entity!\n"); + dev_err(&dev->udev->dev, + "failed to initialize vbi media entity!\n"); } /* Webcams don't have input connectors */ @@ -994,11 +1000,13 @@ static void em28xx_v4l2_create_entities(struct em28xx *dev) ret = media_entity_pads_init(ent, 1, &dev->input_pad[i]); if (ret < 0) - pr_err("failed to initialize input pad[%d]!\n", i); + dev_err(&dev->udev->dev, + "failed to initialize input pad[%d]!\n", i); ret = media_device_register_entity(dev->media_dev, ent); if (ret < 0) - pr_err("failed to register input entity %d!\n", i); + dev_err(&dev->udev->dev, + "failed to register input entity %d!\n", i); } #endif } @@ -2045,7 +2053,8 @@ static int em28xx_v4l2_open(struct file *filp) ret = v4l2_fh_open(filp); if (ret) { - pr_err("%s: v4l2_fh_open() returned error %d\n", + dev_err(&dev->udev->dev, + "%s: v4l2_fh_open() returned error %d\n", __func__, ret); mutex_unlock(&dev->lock); return ret; @@ -2100,7 +2109,7 @@ static int em28xx_v4l2_fini(struct em28xx *dev) if (v4l2 == NULL) return 0; - pr_info("Closing video extension\n"); + dev_info(&dev->udev->dev, "Closing video extension\n"); mutex_lock(&dev->lock); @@ -2111,17 +2120,17 @@ static int em28xx_v4l2_fini(struct em28xx *dev) em28xx_v4l2_media_release(dev); if (video_is_registered(&v4l2->radio_dev)) { - pr_info("V4L2 device %s deregistered\n", + dev_info(&dev->udev->dev, "V4L2 device %s deregistered\n", video_device_node_name(&v4l2->radio_dev)); video_unregister_device(&v4l2->radio_dev); } if (video_is_registered(&v4l2->vbi_dev)) { - pr_info("V4L2 device %s deregistered\n", + dev_info(&dev->udev->dev, "V4L2 device %s deregistered\n", video_device_node_name(&v4l2->vbi_dev)); video_unregister_device(&v4l2->vbi_dev); } if (video_is_registered(&v4l2->vdev)) { - pr_info("V4L2 device %s deregistered\n", + dev_info(&dev->udev->dev, "V4L2 device %s deregistered\n", video_device_node_name(&v4l2->vdev)); video_unregister_device(&v4l2->vdev); } @@ -2151,7 +2160,7 @@ static int em28xx_v4l2_suspend(struct em28xx *dev) if (!dev->has_video) return 0; - pr_info("Suspending video extension\n"); + dev_info(&dev->udev->dev, "Suspending video extension\n"); em28xx_stop_urbs(dev); return 0; } @@ -2164,7 +2173,7 @@ static int em28xx_v4l2_resume(struct em28xx *dev) if (!dev->has_video) return 0; - pr_info("Resuming video extension\n"); + dev_info(&dev->udev->dev, "Resuming video extension\n"); /* what do we do here */ return 0; } @@ -2201,8 +2210,9 @@ static int em28xx_v4l2_close(struct file *filp) em28xx_videodbg("setting alternate 0\n"); errCode = usb_set_interface(dev->udev, 0, 0); if (errCode < 0) { - pr_err("cannot change alternate number to 0 (error=%i)\n", - errCode); + dev_err(&dev->udev->dev, + "cannot change alternate number to 0 (error=%i)\n", + errCode); } } @@ -2335,7 +2345,7 @@ static void em28xx_vdev_init(struct em28xx *dev, vfd->tvnorms = 0; snprintf(vfd->name, sizeof(vfd->name), "%s %s", - dev->name, type_name); + dev_name(&dev->udev->dev), type_name); video_set_drvdata(vfd, dev); } @@ -2419,7 +2429,7 @@ static int em28xx_v4l2_init(struct em28xx *dev) return 0; } - pr_info("Registering V4L2 extension\n"); + dev_info(&dev->udev->dev, "Registering V4L2 extension\n"); mutex_lock(&dev->lock); @@ -2437,7 +2447,8 @@ static int em28xx_v4l2_init(struct em28xx *dev) #endif ret = v4l2_device_register(&dev->udev->dev, &v4l2->v4l2_dev); if (ret < 0) { - pr_err("Call to v4l2_device_register() failed!\n"); + dev_err(&dev->udev->dev, + "Call to v4l2_device_register() failed!\n"); goto err; } @@ -2521,8 +2532,9 @@ static int em28xx_v4l2_init(struct em28xx *dev) /* Configure audio */ ret = em28xx_audio_setup(dev); if (ret < 0) { - pr_err("%s: Error while setting audio - error [%d]!\n", - __func__, ret); + dev_err(&dev->udev->dev, + "%s: Error while setting audio - error [%d]!\n", + __func__, ret); goto unregister_dev; } if (dev->audio_mode.ac97 != EM28XX_NO_AC97) { @@ -2549,16 +2561,18 @@ static int em28xx_v4l2_init(struct em28xx *dev) /* Send a reset to other chips via gpio */ ret = em28xx_write_reg(dev, EM2820_R08_GPIO_CTRL, 0xf7); if (ret < 0) { - pr_err("%s: em28xx_write_reg - msp34xx(1) failed! error [%d]\n", - __func__, ret); + dev_err(&dev->udev->dev, + "%s: em28xx_write_reg - msp34xx(1) failed! error [%d]\n", + __func__, ret); goto unregister_dev; } msleep(3); ret = em28xx_write_reg(dev, EM2820_R08_GPIO_CTRL, 0xff); if (ret < 0) { - pr_err("%s: em28xx_write_reg - msp34xx(2) failed! error [%d]\n", - __func__, ret); + dev_err(&dev->udev->dev, + "%s: em28xx_write_reg - msp34xx(2) failed! error [%d]\n", + __func__, ret); goto unregister_dev; } msleep(3); @@ -2659,7 +2673,8 @@ static int em28xx_v4l2_init(struct em28xx *dev) ret = video_register_device(&v4l2->vdev, VFL_TYPE_GRABBER, video_nr[dev->devno]); if (ret) { - pr_err("unable to register video device (error=%i).\n", ret); + dev_err(&dev->udev->dev, + "unable to register video device (error=%i).\n", ret); goto unregister_dev; } @@ -2688,7 +2703,8 @@ static int em28xx_v4l2_init(struct em28xx *dev) ret = video_register_device(&v4l2->vbi_dev, VFL_TYPE_VBI, vbi_nr[dev->devno]); if (ret < 0) { - pr_err("unable to register vbi device\n"); + dev_err(&dev->udev->dev, + "unable to register vbi device\n"); goto unregister_dev; } } @@ -2699,11 +2715,13 @@ static int em28xx_v4l2_init(struct em28xx *dev) ret = video_register_device(&v4l2->radio_dev, VFL_TYPE_RADIO, radio_nr[dev->devno]); if (ret < 0) { - pr_err("can't register radio device\n"); + dev_err(&dev->udev->dev, + "can't register radio device\n"); goto unregister_dev; } - pr_info("Registered radio device as %s\n", - video_device_node_name(&v4l2->radio_dev)); + dev_info(&dev->udev->dev, + "Registered radio device as %s\n", + video_device_node_name(&v4l2->radio_dev)); } /* Init entities at the Media Controller */ @@ -2712,18 +2730,21 @@ static int em28xx_v4l2_init(struct em28xx *dev) #ifdef CONFIG_MEDIA_CONTROLLER ret = v4l2_mc_create_media_graph(dev->media_dev); if (ret) { - pr_err("failed to create media graph\n"); + dev_err(&dev->udev->dev, + "failed to create media graph\n"); em28xx_v4l2_media_release(dev); goto unregister_dev; } #endif - pr_info("V4L2 video device registered as %s\n", - video_device_node_name(&v4l2->vdev)); + dev_info(&dev->udev->dev, + "V4L2 video device registered as %s\n", + video_device_node_name(&v4l2->vdev)); if (video_is_registered(&v4l2->vbi_dev)) - pr_info("V4L2 VBI device registered as %s\n", - video_device_node_name(&v4l2->vbi_dev)); + dev_info(&dev->udev->dev, + "V4L2 VBI device registered as %s\n", + video_device_node_name(&v4l2->vbi_dev)); /* Save some power by putting tuner to sleep */ v4l2_device_call_all(&v4l2->v4l2_dev, 0, core, s_power, 0); @@ -2731,7 +2752,8 @@ static int em28xx_v4l2_init(struct em28xx *dev) /* initialize videobuf2 stuff */ em28xx_vb2_setup(dev); - pr_info("V4L2 extension successfully initialized\n"); + dev_info(&dev->udev->dev, + "V4L2 extension successfully initialized\n"); kref_get(&dev->ref); @@ -2740,18 +2762,21 @@ static int em28xx_v4l2_init(struct em28xx *dev) unregister_dev: if (video_is_registered(&v4l2->radio_dev)) { - pr_info("V4L2 device %s deregistered\n", - video_device_node_name(&v4l2->radio_dev)); + dev_info(&dev->udev->dev, + "V4L2 device %s deregistered\n", + video_device_node_name(&v4l2->radio_dev)); video_unregister_device(&v4l2->radio_dev); } if (video_is_registered(&v4l2->vbi_dev)) { - pr_info("V4L2 device %s deregistered\n", - video_device_node_name(&v4l2->vbi_dev)); + dev_info(&dev->udev->dev, + "V4L2 device %s deregistered\n", + video_device_node_name(&v4l2->vbi_dev)); video_unregister_device(&v4l2->vbi_dev); } if (video_is_registered(&v4l2->vdev)) { - pr_info("V4L2 device %s deregistered\n", - video_device_node_name(&v4l2->vdev)); + dev_info(&dev->udev->dev, + "V4L2 device %s deregistered\n", + video_device_node_name(&v4l2->vdev)); video_unregister_device(&v4l2->vdev); } |