From 589dadf299bc8dab27589ecd62024c96a3812505 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sat, 1 Nov 2014 08:09:44 -0300 Subject: [media] cx231xx: get rid of driver-defined printk macros It currently does just like what pr_foo() macros do. So, replace them. A deeper cleanup is needed, as there are lots of debug macros printed with pr_info. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/cx231xx/cx231xx-video.c | 52 +++++++++++++++---------------- 1 file changed, 26 insertions(+), 26 deletions(-) (limited to 'drivers/media/usb/cx231xx/cx231xx-video.c') diff --git a/drivers/media/usb/cx231xx/cx231xx-video.c b/drivers/media/usb/cx231xx/cx231xx-video.c index 3b3ada6562ca..bda5597b5eff 100644 --- a/drivers/media/usb/cx231xx/cx231xx-video.c +++ b/drivers/media/usb/cx231xx/cx231xx-video.c @@ -22,6 +22,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include "cx231xx.h" #include #include #include @@ -41,7 +42,6 @@ #include "dvb_frontend.h" -#include "cx231xx.h" #include "cx231xx-vbi.h" #define CX231XX_VERSION "0.0.2" @@ -737,7 +737,7 @@ buffer_prepare(struct videobuf_queue *vq, struct videobuf_buffer *vb, if (!dev->video_mode.bulk_ctl.num_bufs) urb_init = 1; } - /*cx231xx_info("urb_init=%d dev->video_mode.max_pkt_size=%d\n", + /*pr_info("urb_init=%d dev->video_mode.max_pkt_size=%d\n", urb_init, dev->video_mode.max_pkt_size);*/ if (urb_init) { dev->mode_tv = 0; @@ -809,7 +809,7 @@ void video_mux(struct cx231xx *dev, int index) cx231xx_set_audio_input(dev, dev->ctl_ainput); - cx231xx_info("video_mux : %d\n", index); + pr_info("video_mux : %d\n", index); /* do mode control overrides if required */ cx231xx_do_mode_ctrl_overrides(dev); @@ -861,7 +861,7 @@ static void res_free(struct cx231xx_fh *fh) static int check_dev(struct cx231xx *dev) { if (dev->state & DEV_DISCONNECTED) { - cx231xx_errdev("v4l2 ioctl: device not present\n"); + pr_err("v4l2 ioctl: device not present\n"); return -ENODEV; } return 0; @@ -953,12 +953,12 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, return -EINVAL; if (videobuf_queue_is_busy(&fh->vb_vidq)) { - cx231xx_errdev("%s queue busy\n", __func__); + pr_err("%s queue busy\n", __func__); return -EBUSY; } if (dev->stream_on && !fh->stream_on) { - cx231xx_errdev("%s device in use by another fh\n", __func__); + pr_err("%s device in use by another fh\n", __func__); return -EBUSY; } @@ -1176,9 +1176,9 @@ int cx231xx_s_frequency(struct file *file, void *priv, int rc; u32 if_frequency = 5400000; - cx231xx_info("Enter vidioc_s_frequency()f->frequency=%d;f->type=%d\n", + pr_info("Enter vidioc_s_frequency()f->frequency=%d;f->type=%d\n", f->frequency, f->type); - /*cx231xx_info("f->type: 1-radio 2-analogTV 3-digitalTV\n");*/ + /*pr_info("f->type: 1-radio 2-analogTV 3-digitalTV\n");*/ rc = check_dev(dev); if (rc < 0) @@ -1213,13 +1213,13 @@ int cx231xx_s_frequency(struct file *file, void *priv, else if (dev->norm & V4L2_STD_SECAM_LC) if_frequency = 1250000; /*1.25MHz */ - cx231xx_info("if_frequency is set to %d\n", if_frequency); + pr_info("if_frequency is set to %d\n", if_frequency); cx231xx_set_Colibri_For_LowIF(dev, if_frequency, 1, 1); update_HH_register_after_set_DIF(dev); } - cx231xx_info("Set New FREQUENCY to %d\n", f->frequency); + pr_info("Set New FREQUENCY to %d\n", f->frequency); return rc; } @@ -1523,7 +1523,7 @@ static int vidioc_s_fmt_vbi_cap(struct file *file, void *priv, struct cx231xx *dev = fh->dev; if (dev->vbi_stream_on && !fh->stream_on) { - cx231xx_errdev("%s device in use by another fh\n", __func__); + pr_err("%s device in use by another fh\n", __func__); return -EBUSY; } return vidioc_try_fmt_vbi_cap(file, priv, f); @@ -1642,7 +1642,7 @@ static int cx231xx_v4l2_open(struct file *filp) #if 0 errCode = cx231xx_set_mode(dev, CX231XX_ANALOG_MODE); if (errCode < 0) { - cx231xx_errdev + pr_err ("Device locked on digital mode. Can't open analog\n"); return -EBUSY; } @@ -1650,7 +1650,7 @@ static int cx231xx_v4l2_open(struct file *filp) fh = kzalloc(sizeof(struct cx231xx_fh), GFP_KERNEL); if (!fh) { - cx231xx_errdev("cx231xx-video.c: Out of memory?!\n"); + pr_err("cx231xx-video.c: Out of memory?!\n"); return -ENOMEM; } if (mutex_lock_interruptible(&dev->lock)) { @@ -1736,7 +1736,7 @@ void cx231xx_release_analog_resources(struct cx231xx *dev) dev->radio_dev = NULL; } if (dev->vbi_dev) { - cx231xx_info("V4L2 device %s deregistered\n", + pr_info("V4L2 device %s deregistered\n", video_device_node_name(dev->vbi_dev)); if (video_is_registered(dev->vbi_dev)) video_unregister_device(dev->vbi_dev); @@ -1745,7 +1745,7 @@ void cx231xx_release_analog_resources(struct cx231xx *dev) dev->vbi_dev = NULL; } if (dev->vdev) { - cx231xx_info("V4L2 device %s deregistered\n", + pr_info("V4L2 device %s deregistered\n", video_device_node_name(dev->vdev)); if (dev->board.has_417) @@ -2080,7 +2080,7 @@ int cx231xx_register_analog_devices(struct cx231xx *dev) { int ret; - cx231xx_info("%s: v4l2 driver version %s\n", + pr_info("%s: v4l2 driver version %s\n", dev->name, CX231XX_VERSION); /* set default norm */ @@ -2119,7 +2119,7 @@ int cx231xx_register_analog_devices(struct cx231xx *dev) /* allocate and fill video video_device struct */ dev->vdev = cx231xx_vdev_init(dev, &cx231xx_video_template, "video"); if (!dev->vdev) { - cx231xx_errdev("cannot allocate video_device.\n"); + pr_err("cannot allocate video_device.\n"); return -ENODEV; } @@ -2128,12 +2128,12 @@ int cx231xx_register_analog_devices(struct cx231xx *dev) ret = video_register_device(dev->vdev, VFL_TYPE_GRABBER, video_nr[dev->devno]); if (ret) { - cx231xx_errdev("unable to register video device (error=%i).\n", + pr_err("unable to register video device (error=%i).\n", ret); return ret; } - cx231xx_info("%s/0: registered device %s [v4l2]\n", + pr_info("%s/0: registered device %s [v4l2]\n", dev->name, video_device_node_name(dev->vdev)); /* Initialize VBI template */ @@ -2144,7 +2144,7 @@ int cx231xx_register_analog_devices(struct cx231xx *dev) dev->vbi_dev = cx231xx_vdev_init(dev, &cx231xx_vbi_template, "vbi"); if (!dev->vbi_dev) { - cx231xx_errdev("cannot allocate video_device.\n"); + pr_err("cannot allocate video_device.\n"); return -ENODEV; } dev->vbi_dev->ctrl_handler = &dev->ctrl_handler; @@ -2152,32 +2152,32 @@ int cx231xx_register_analog_devices(struct cx231xx *dev) ret = video_register_device(dev->vbi_dev, VFL_TYPE_VBI, vbi_nr[dev->devno]); if (ret < 0) { - cx231xx_errdev("unable to register vbi device\n"); + pr_err("unable to register vbi device\n"); return ret; } - cx231xx_info("%s/0: registered device %s\n", + pr_info("%s/0: registered device %s\n", dev->name, video_device_node_name(dev->vbi_dev)); if (cx231xx_boards[dev->model].radio.type == CX231XX_RADIO) { dev->radio_dev = cx231xx_vdev_init(dev, &cx231xx_radio_template, "radio"); if (!dev->radio_dev) { - cx231xx_errdev("cannot allocate video_device.\n"); + pr_err("cannot allocate video_device.\n"); return -ENODEV; } dev->radio_dev->ctrl_handler = &dev->radio_ctrl_handler; ret = video_register_device(dev->radio_dev, VFL_TYPE_RADIO, radio_nr[dev->devno]); if (ret < 0) { - cx231xx_errdev("can't register radio device\n"); + pr_err("can't register radio device\n"); return ret; } - cx231xx_info("Registered radio device as %s\n", + pr_info("Registered radio device as %s\n", video_device_node_name(dev->radio_dev)); } - cx231xx_info("V4L2 device registered as %s and %s\n", + pr_info("V4L2 device registered as %s and %s\n", video_device_node_name(dev->vdev), video_device_node_name(dev->vbi_dev)); -- cgit v1.2.1 From ed0e3729c9d790d17688083f070da3674088ea9c Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sat, 1 Nov 2014 08:59:03 -0300 Subject: [media] cx231xx: Cleanup printk at the driver There are lots of debug printks printed with pr_info. Also, the printk's data are not too coherent: - there are duplicated driver name at the print format; - function name format string differs from function to function; - long strings broken into multiple lines; - some printks just produce ugly reports, being almost useless as-is. Do a cleanup on that. Still, there are much to be done in order to do a better printk job on this driver, but, at least it will now be a way less verbose, if debug printks are disabled, and some logs might actually be useful. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/cx231xx/cx231xx-video.c | 41 +++++++++++++------------------ 1 file changed, 17 insertions(+), 24 deletions(-) (limited to 'drivers/media/usb/cx231xx/cx231xx-video.c') diff --git a/drivers/media/usb/cx231xx/cx231xx-video.c b/drivers/media/usb/cx231xx/cx231xx-video.c index bda5597b5eff..4d1d750ab38d 100644 --- a/drivers/media/usb/cx231xx/cx231xx-video.c +++ b/drivers/media/usb/cx231xx/cx231xx-video.c @@ -737,7 +737,7 @@ buffer_prepare(struct videobuf_queue *vq, struct videobuf_buffer *vb, if (!dev->video_mode.bulk_ctl.num_bufs) urb_init = 1; } - /*pr_info("urb_init=%d dev->video_mode.max_pkt_size=%d\n", + /*pr_debug("urb_init=%d dev->video_mode.max_pkt_size=%d\n", urb_init, dev->video_mode.max_pkt_size);*/ if (urb_init) { dev->mode_tv = 0; @@ -809,7 +809,7 @@ void video_mux(struct cx231xx *dev, int index) cx231xx_set_audio_input(dev, dev->ctl_ainput); - pr_info("video_mux : %d\n", index); + pr_debug("video_mux : %d\n", index); /* do mode control overrides if required */ cx231xx_do_mode_ctrl_overrides(dev); @@ -953,12 +953,12 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, return -EINVAL; if (videobuf_queue_is_busy(&fh->vb_vidq)) { - pr_err("%s queue busy\n", __func__); + pr_err("%s: queue busy\n", __func__); return -EBUSY; } if (dev->stream_on && !fh->stream_on) { - pr_err("%s device in use by another fh\n", __func__); + pr_err("%s: device in use by another fh\n", __func__); return -EBUSY; } @@ -1176,9 +1176,8 @@ int cx231xx_s_frequency(struct file *file, void *priv, int rc; u32 if_frequency = 5400000; - pr_info("Enter vidioc_s_frequency()f->frequency=%d;f->type=%d\n", + pr_debug("Enter vidioc_s_frequency()f->frequency=%d;f->type=%d\n", f->frequency, f->type); - /*pr_info("f->type: 1-radio 2-analogTV 3-digitalTV\n");*/ rc = check_dev(dev); if (rc < 0) @@ -1213,13 +1212,13 @@ int cx231xx_s_frequency(struct file *file, void *priv, else if (dev->norm & V4L2_STD_SECAM_LC) if_frequency = 1250000; /*1.25MHz */ - pr_info("if_frequency is set to %d\n", if_frequency); + pr_debug("if_frequency is set to %d\n", if_frequency); cx231xx_set_Colibri_For_LowIF(dev, if_frequency, 1, 1); update_HH_register_after_set_DIF(dev); } - pr_info("Set New FREQUENCY to %d\n", f->frequency); + pr_debug("Set New FREQUENCY to %d\n", f->frequency); return rc; } @@ -1642,8 +1641,7 @@ static int cx231xx_v4l2_open(struct file *filp) #if 0 errCode = cx231xx_set_mode(dev, CX231XX_ANALOG_MODE); if (errCode < 0) { - pr_err - ("Device locked on digital mode. Can't open analog\n"); + pr_err("Device locked on digital mode. Can't open analog\n"); return -EBUSY; } #endif @@ -1737,7 +1735,7 @@ void cx231xx_release_analog_resources(struct cx231xx *dev) } if (dev->vbi_dev) { pr_info("V4L2 device %s deregistered\n", - video_device_node_name(dev->vbi_dev)); + video_device_node_name(dev->vbi_dev)); if (video_is_registered(dev->vbi_dev)) video_unregister_device(dev->vbi_dev); else @@ -1746,7 +1744,7 @@ void cx231xx_release_analog_resources(struct cx231xx *dev) } if (dev->vdev) { pr_info("V4L2 device %s deregistered\n", - video_device_node_name(dev->vdev)); + video_device_node_name(dev->vdev)); if (dev->board.has_417) cx231xx_417_unregister(dev); @@ -2080,8 +2078,7 @@ int cx231xx_register_analog_devices(struct cx231xx *dev) { int ret; - pr_info("%s: v4l2 driver version %s\n", - dev->name, CX231XX_VERSION); + pr_info("v4l2 driver version %s\n", CX231XX_VERSION); /* set default norm */ dev->norm = V4L2_STD_PAL; @@ -2129,12 +2126,12 @@ int cx231xx_register_analog_devices(struct cx231xx *dev) video_nr[dev->devno]); if (ret) { pr_err("unable to register video device (error=%i).\n", - ret); + ret); return ret; } - pr_info("%s/0: registered device %s [v4l2]\n", - dev->name, video_device_node_name(dev->vdev)); + pr_info("Registered video device %s [v4l2]\n", + video_device_node_name(dev->vdev)); /* Initialize VBI template */ cx231xx_vbi_template = cx231xx_video_template; @@ -2156,8 +2153,8 @@ int cx231xx_register_analog_devices(struct cx231xx *dev) return ret; } - pr_info("%s/0: registered device %s\n", - dev->name, video_device_node_name(dev->vbi_dev)); + pr_info("Registered VBI device %s\n", + video_device_node_name(dev->vbi_dev)); if (cx231xx_boards[dev->model].radio.type == CX231XX_RADIO) { dev->radio_dev = cx231xx_vdev_init(dev, &cx231xx_radio_template, @@ -2174,12 +2171,8 @@ int cx231xx_register_analog_devices(struct cx231xx *dev) return ret; } pr_info("Registered radio device as %s\n", - video_device_node_name(dev->radio_dev)); + video_device_node_name(dev->radio_dev)); } - pr_info("V4L2 device registered as %s and %s\n", - video_device_node_name(dev->vdev), - video_device_node_name(dev->vbi_dev)); - return 0; } -- cgit v1.2.1 From b7085c08647598aafbf8f6223ebcdd413745449c Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sun, 2 Nov 2014 07:21:44 -0300 Subject: [media] cx231xx: convert from pr_foo to dev_foo Replace all pr_foo occurrences by dev_foo, as this is the recommended way for drivers. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/cx231xx/cx231xx-video.c | 62 +++++++++++++++++-------------- 1 file changed, 34 insertions(+), 28 deletions(-) (limited to 'drivers/media/usb/cx231xx/cx231xx-video.c') diff --git a/drivers/media/usb/cx231xx/cx231xx-video.c b/drivers/media/usb/cx231xx/cx231xx-video.c index 4d1d750ab38d..5ea8124f5d20 100644 --- a/drivers/media/usb/cx231xx/cx231xx-video.c +++ b/drivers/media/usb/cx231xx/cx231xx-video.c @@ -28,7 +28,6 @@ #include #include #include -#include #include #include #include @@ -737,8 +736,9 @@ buffer_prepare(struct videobuf_queue *vq, struct videobuf_buffer *vb, if (!dev->video_mode.bulk_ctl.num_bufs) urb_init = 1; } - /*pr_debug("urb_init=%d dev->video_mode.max_pkt_size=%d\n", - urb_init, dev->video_mode.max_pkt_size);*/ + dev_dbg(&dev->udev->dev, + "urb_init=%d dev->video_mode.max_pkt_size=%d\n", + urb_init, dev->video_mode.max_pkt_size); if (urb_init) { dev->mode_tv = 0; if (dev->USE_ISO) @@ -809,7 +809,7 @@ void video_mux(struct cx231xx *dev, int index) cx231xx_set_audio_input(dev, dev->ctl_ainput); - pr_debug("video_mux : %d\n", index); + dev_dbg(&dev->udev->dev, "video_mux : %d\n", index); /* do mode control overrides if required */ cx231xx_do_mode_ctrl_overrides(dev); @@ -861,7 +861,7 @@ static void res_free(struct cx231xx_fh *fh) static int check_dev(struct cx231xx *dev) { if (dev->state & DEV_DISCONNECTED) { - pr_err("v4l2 ioctl: device not present\n"); + dev_err(&dev->udev->dev, "v4l2 ioctl: device not present\n"); return -ENODEV; } return 0; @@ -953,12 +953,13 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, return -EINVAL; if (videobuf_queue_is_busy(&fh->vb_vidq)) { - pr_err("%s: queue busy\n", __func__); + dev_err(&dev->udev->dev, "%s: queue busy\n", __func__); return -EBUSY; } if (dev->stream_on && !fh->stream_on) { - pr_err("%s: device in use by another fh\n", __func__); + dev_err(&dev->udev->dev, + "%s: device in use by another fh\n", __func__); return -EBUSY; } @@ -1176,8 +1177,9 @@ int cx231xx_s_frequency(struct file *file, void *priv, int rc; u32 if_frequency = 5400000; - pr_debug("Enter vidioc_s_frequency()f->frequency=%d;f->type=%d\n", - f->frequency, f->type); + dev_dbg(&dev->udev->dev, + "Enter vidioc_s_frequency()f->frequency=%d;f->type=%d\n", + f->frequency, f->type); rc = check_dev(dev); if (rc < 0) @@ -1212,13 +1214,14 @@ int cx231xx_s_frequency(struct file *file, void *priv, else if (dev->norm & V4L2_STD_SECAM_LC) if_frequency = 1250000; /*1.25MHz */ - pr_debug("if_frequency is set to %d\n", if_frequency); + dev_dbg(&dev->udev->dev, + "if_frequency is set to %d\n", if_frequency); cx231xx_set_Colibri_For_LowIF(dev, if_frequency, 1, 1); update_HH_register_after_set_DIF(dev); } - pr_debug("Set New FREQUENCY to %d\n", f->frequency); + dev_dbg(&dev->udev->dev, "Set New FREQUENCY to %d\n", f->frequency); return rc; } @@ -1522,7 +1525,8 @@ static int vidioc_s_fmt_vbi_cap(struct file *file, void *priv, struct cx231xx *dev = fh->dev; if (dev->vbi_stream_on && !fh->stream_on) { - pr_err("%s device in use by another fh\n", __func__); + dev_err(&dev->udev->dev, + "%s device in use by another fh\n", __func__); return -EBUSY; } return vidioc_try_fmt_vbi_cap(file, priv, f); @@ -1641,16 +1645,15 @@ static int cx231xx_v4l2_open(struct file *filp) #if 0 errCode = cx231xx_set_mode(dev, CX231XX_ANALOG_MODE); if (errCode < 0) { - pr_err("Device locked on digital mode. Can't open analog\n"); + dev_err(&dev->udev->dev, + "Device locked on digital mode. Can't open analog\n"); return -EBUSY; } #endif fh = kzalloc(sizeof(struct cx231xx_fh), GFP_KERNEL); - if (!fh) { - pr_err("cx231xx-video.c: Out of memory?!\n"); + if (!fh) return -ENOMEM; - } if (mutex_lock_interruptible(&dev->lock)) { kfree(fh); return -ERESTARTSYS; @@ -1734,7 +1737,7 @@ void cx231xx_release_analog_resources(struct cx231xx *dev) dev->radio_dev = NULL; } if (dev->vbi_dev) { - pr_info("V4L2 device %s deregistered\n", + dev_info(&dev->udev->dev, "V4L2 device %s deregistered\n", video_device_node_name(dev->vbi_dev)); if (video_is_registered(dev->vbi_dev)) video_unregister_device(dev->vbi_dev); @@ -1743,7 +1746,7 @@ void cx231xx_release_analog_resources(struct cx231xx *dev) dev->vbi_dev = NULL; } if (dev->vdev) { - pr_info("V4L2 device %s deregistered\n", + dev_info(&dev->udev->dev, "V4L2 device %s deregistered\n", video_device_node_name(dev->vdev)); if (dev->board.has_417) @@ -2078,7 +2081,7 @@ int cx231xx_register_analog_devices(struct cx231xx *dev) { int ret; - pr_info("v4l2 driver version %s\n", CX231XX_VERSION); + dev_info(&dev->udev->dev, "v4l2 driver version %s\n", CX231XX_VERSION); /* set default norm */ dev->norm = V4L2_STD_PAL; @@ -2116,7 +2119,7 @@ int cx231xx_register_analog_devices(struct cx231xx *dev) /* allocate and fill video video_device struct */ dev->vdev = cx231xx_vdev_init(dev, &cx231xx_video_template, "video"); if (!dev->vdev) { - pr_err("cannot allocate video_device.\n"); + dev_err(&dev->udev->dev, "cannot allocate video_device.\n"); return -ENODEV; } @@ -2125,12 +2128,13 @@ int cx231xx_register_analog_devices(struct cx231xx *dev) ret = video_register_device(dev->vdev, VFL_TYPE_GRABBER, video_nr[dev->devno]); if (ret) { - pr_err("unable to register video device (error=%i).\n", + dev_err(&dev->udev->dev, + "unable to register video device (error=%i).\n", ret); return ret; } - pr_info("Registered video device %s [v4l2]\n", + dev_info(&dev->udev->dev, "Registered video device %s [v4l2]\n", video_device_node_name(dev->vdev)); /* Initialize VBI template */ @@ -2141,7 +2145,7 @@ int cx231xx_register_analog_devices(struct cx231xx *dev) dev->vbi_dev = cx231xx_vdev_init(dev, &cx231xx_vbi_template, "vbi"); if (!dev->vbi_dev) { - pr_err("cannot allocate video_device.\n"); + dev_err(&dev->udev->dev, "cannot allocate video_device.\n"); return -ENODEV; } dev->vbi_dev->ctrl_handler = &dev->ctrl_handler; @@ -2149,28 +2153,30 @@ int cx231xx_register_analog_devices(struct cx231xx *dev) ret = video_register_device(dev->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"); return ret; } - pr_info("Registered VBI device %s\n", + dev_info(&dev->udev->dev, "Registered VBI device %s\n", video_device_node_name(dev->vbi_dev)); if (cx231xx_boards[dev->model].radio.type == CX231XX_RADIO) { dev->radio_dev = cx231xx_vdev_init(dev, &cx231xx_radio_template, "radio"); if (!dev->radio_dev) { - pr_err("cannot allocate video_device.\n"); + dev_err(&dev->udev->dev, + "cannot allocate video_device.\n"); return -ENODEV; } dev->radio_dev->ctrl_handler = &dev->radio_ctrl_handler; ret = video_register_device(dev->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"); return ret; } - pr_info("Registered radio device as %s\n", + dev_info(&dev->udev->dev, "Registered radio device as %s\n", video_device_node_name(dev->radio_dev)); } -- cgit v1.2.1 From 3d28cf3ee6e7f8f1d43aaf42a79fe39ddd6350bf Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sun, 2 Nov 2014 08:35:46 -0300 Subject: [media] cx231xx: too much changes. Bump version number The I2C mux changes are significant. Bump version number. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/cx231xx/cx231xx-video.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/media/usb/cx231xx/cx231xx-video.c') diff --git a/drivers/media/usb/cx231xx/cx231xx-video.c b/drivers/media/usb/cx231xx/cx231xx-video.c index 5ea8124f5d20..c5b5e9541669 100644 --- a/drivers/media/usb/cx231xx/cx231xx-video.c +++ b/drivers/media/usb/cx231xx/cx231xx-video.c @@ -43,7 +43,7 @@ #include "cx231xx-vbi.h" -#define CX231XX_VERSION "0.0.2" +#define CX231XX_VERSION "0.0.3" #define DRIVER_AUTHOR "Srinivasa Deevi " #define DRIVER_DESC "Conexant cx231xx based USB video device driver" -- cgit v1.2.1 From 336fea922936c114f68b8c0bcbff5fcfac3507d9 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 3 Nov 2014 06:07:38 -0300 Subject: [media] cx231xx: Improve the log message Unfortunately, on devices that have multiple interfaces, udev->dev points to the parent device (usb) instead of the cx231xx specific one. Due to that the logs don't look too nice, as they'll print messages as if they were produced by USB core: usb-1-2: New device Conexant Corporation Polaris AV Capturb @ 480 Mbps (1554:5010) with 7 interfaces Instead of using the name of the parent device, let's use the name of the first cx231xx interface for all cx231xx sub-modules. With this path, the logs will be nicer: cx231xx 1-2:1.1: New device Conexant Corporation Polaris AV Capturb @ 480 Mbps (1554:5010) with 7 interfaces Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/cx231xx/cx231xx-video.c | 44 +++++++++++++++---------------- 1 file changed, 22 insertions(+), 22 deletions(-) (limited to 'drivers/media/usb/cx231xx/cx231xx-video.c') diff --git a/drivers/media/usb/cx231xx/cx231xx-video.c b/drivers/media/usb/cx231xx/cx231xx-video.c index c5b5e9541669..4c5bba2e89f4 100644 --- a/drivers/media/usb/cx231xx/cx231xx-video.c +++ b/drivers/media/usb/cx231xx/cx231xx-video.c @@ -736,7 +736,7 @@ buffer_prepare(struct videobuf_queue *vq, struct videobuf_buffer *vb, if (!dev->video_mode.bulk_ctl.num_bufs) urb_init = 1; } - dev_dbg(&dev->udev->dev, + dev_dbg(dev->dev, "urb_init=%d dev->video_mode.max_pkt_size=%d\n", urb_init, dev->video_mode.max_pkt_size); if (urb_init) { @@ -809,7 +809,7 @@ void video_mux(struct cx231xx *dev, int index) cx231xx_set_audio_input(dev, dev->ctl_ainput); - dev_dbg(&dev->udev->dev, "video_mux : %d\n", index); + dev_dbg(dev->dev, "video_mux : %d\n", index); /* do mode control overrides if required */ cx231xx_do_mode_ctrl_overrides(dev); @@ -861,7 +861,7 @@ static void res_free(struct cx231xx_fh *fh) static int check_dev(struct cx231xx *dev) { if (dev->state & DEV_DISCONNECTED) { - dev_err(&dev->udev->dev, "v4l2 ioctl: device not present\n"); + dev_err(dev->dev, "v4l2 ioctl: device not present\n"); return -ENODEV; } return 0; @@ -953,12 +953,12 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, return -EINVAL; if (videobuf_queue_is_busy(&fh->vb_vidq)) { - dev_err(&dev->udev->dev, "%s: queue busy\n", __func__); + dev_err(dev->dev, "%s: queue busy\n", __func__); return -EBUSY; } if (dev->stream_on && !fh->stream_on) { - dev_err(&dev->udev->dev, + dev_err(dev->dev, "%s: device in use by another fh\n", __func__); return -EBUSY; } @@ -1177,7 +1177,7 @@ int cx231xx_s_frequency(struct file *file, void *priv, int rc; u32 if_frequency = 5400000; - dev_dbg(&dev->udev->dev, + dev_dbg(dev->dev, "Enter vidioc_s_frequency()f->frequency=%d;f->type=%d\n", f->frequency, f->type); @@ -1214,14 +1214,14 @@ int cx231xx_s_frequency(struct file *file, void *priv, else if (dev->norm & V4L2_STD_SECAM_LC) if_frequency = 1250000; /*1.25MHz */ - dev_dbg(&dev->udev->dev, + dev_dbg(dev->dev, "if_frequency is set to %d\n", if_frequency); cx231xx_set_Colibri_For_LowIF(dev, if_frequency, 1, 1); update_HH_register_after_set_DIF(dev); } - dev_dbg(&dev->udev->dev, "Set New FREQUENCY to %d\n", f->frequency); + dev_dbg(dev->dev, "Set New FREQUENCY to %d\n", f->frequency); return rc; } @@ -1525,7 +1525,7 @@ static int vidioc_s_fmt_vbi_cap(struct file *file, void *priv, struct cx231xx *dev = fh->dev; if (dev->vbi_stream_on && !fh->stream_on) { - dev_err(&dev->udev->dev, + dev_err(dev->dev, "%s device in use by another fh\n", __func__); return -EBUSY; } @@ -1645,7 +1645,7 @@ static int cx231xx_v4l2_open(struct file *filp) #if 0 errCode = cx231xx_set_mode(dev, CX231XX_ANALOG_MODE); if (errCode < 0) { - dev_err(&dev->udev->dev, + dev_err(dev->dev, "Device locked on digital mode. Can't open analog\n"); return -EBUSY; } @@ -1737,7 +1737,7 @@ void cx231xx_release_analog_resources(struct cx231xx *dev) dev->radio_dev = NULL; } if (dev->vbi_dev) { - dev_info(&dev->udev->dev, "V4L2 device %s deregistered\n", + dev_info(dev->dev, "V4L2 device %s deregistered\n", video_device_node_name(dev->vbi_dev)); if (video_is_registered(dev->vbi_dev)) video_unregister_device(dev->vbi_dev); @@ -1746,7 +1746,7 @@ void cx231xx_release_analog_resources(struct cx231xx *dev) dev->vbi_dev = NULL; } if (dev->vdev) { - dev_info(&dev->udev->dev, "V4L2 device %s deregistered\n", + dev_info(dev->dev, "V4L2 device %s deregistered\n", video_device_node_name(dev->vdev)); if (dev->board.has_417) @@ -2081,7 +2081,7 @@ int cx231xx_register_analog_devices(struct cx231xx *dev) { int ret; - dev_info(&dev->udev->dev, "v4l2 driver version %s\n", CX231XX_VERSION); + dev_info(dev->dev, "v4l2 driver version %s\n", CX231XX_VERSION); /* set default norm */ dev->norm = V4L2_STD_PAL; @@ -2119,7 +2119,7 @@ int cx231xx_register_analog_devices(struct cx231xx *dev) /* allocate and fill video video_device struct */ dev->vdev = cx231xx_vdev_init(dev, &cx231xx_video_template, "video"); if (!dev->vdev) { - dev_err(&dev->udev->dev, "cannot allocate video_device.\n"); + dev_err(dev->dev, "cannot allocate video_device.\n"); return -ENODEV; } @@ -2128,13 +2128,13 @@ int cx231xx_register_analog_devices(struct cx231xx *dev) ret = video_register_device(dev->vdev, VFL_TYPE_GRABBER, video_nr[dev->devno]); if (ret) { - dev_err(&dev->udev->dev, + dev_err(dev->dev, "unable to register video device (error=%i).\n", ret); return ret; } - dev_info(&dev->udev->dev, "Registered video device %s [v4l2]\n", + dev_info(dev->dev, "Registered video device %s [v4l2]\n", video_device_node_name(dev->vdev)); /* Initialize VBI template */ @@ -2145,7 +2145,7 @@ int cx231xx_register_analog_devices(struct cx231xx *dev) dev->vbi_dev = cx231xx_vdev_init(dev, &cx231xx_vbi_template, "vbi"); if (!dev->vbi_dev) { - dev_err(&dev->udev->dev, "cannot allocate video_device.\n"); + dev_err(dev->dev, "cannot allocate video_device.\n"); return -ENODEV; } dev->vbi_dev->ctrl_handler = &dev->ctrl_handler; @@ -2153,18 +2153,18 @@ int cx231xx_register_analog_devices(struct cx231xx *dev) ret = video_register_device(dev->vbi_dev, VFL_TYPE_VBI, vbi_nr[dev->devno]); if (ret < 0) { - dev_err(&dev->udev->dev, "unable to register vbi device\n"); + dev_err(dev->dev, "unable to register vbi device\n"); return ret; } - dev_info(&dev->udev->dev, "Registered VBI device %s\n", + dev_info(dev->dev, "Registered VBI device %s\n", video_device_node_name(dev->vbi_dev)); if (cx231xx_boards[dev->model].radio.type == CX231XX_RADIO) { dev->radio_dev = cx231xx_vdev_init(dev, &cx231xx_radio_template, "radio"); if (!dev->radio_dev) { - dev_err(&dev->udev->dev, + dev_err(dev->dev, "cannot allocate video_device.\n"); return -ENODEV; } @@ -2172,11 +2172,11 @@ int cx231xx_register_analog_devices(struct cx231xx *dev) ret = video_register_device(dev->radio_dev, VFL_TYPE_RADIO, radio_nr[dev->devno]); if (ret < 0) { - dev_err(&dev->udev->dev, + dev_err(dev->dev, "can't register radio device\n"); return ret; } - dev_info(&dev->udev->dev, "Registered radio device as %s\n", + dev_info(dev->dev, "Registered radio device as %s\n", video_device_node_name(dev->radio_dev)); } -- cgit v1.2.1 From 18cb5ec38f427f4552b4435ce2021f6fb21743f4 Mon Sep 17 00:00:00 2001 From: Boris BREZILLON Date: Mon, 10 Nov 2014 14:28:32 -0300 Subject: [media] usb: Make use of media_bus_format enum In order to have subsytem agnostic media bus format definitions we've moved media bus definition to include/uapi/linux/media-bus-format.h and prefixed enum values with MEDIA_BUS_FMT instead of V4L2_MBUS_FMT. Reference new definitions in all usb drivers. Signed-off-by: Boris Brezillon Acked-by: Hans Verkuil Acked-by: Sakari Ailus Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/cx231xx/cx231xx-video.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/media/usb/cx231xx/cx231xx-video.c') diff --git a/drivers/media/usb/cx231xx/cx231xx-video.c b/drivers/media/usb/cx231xx/cx231xx-video.c index 4c5bba2e89f4..53ca12c1ff69 100644 --- a/drivers/media/usb/cx231xx/cx231xx-video.c +++ b/drivers/media/usb/cx231xx/cx231xx-video.c @@ -968,7 +968,7 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, dev->height = f->fmt.pix.height; dev->format = fmt; - v4l2_fill_mbus_format(&mbus_fmt, &f->fmt.pix, V4L2_MBUS_FMT_FIXED); + v4l2_fill_mbus_format(&mbus_fmt, &f->fmt.pix, MEDIA_BUS_FMT_FIXED); call_all(dev, video, s_mbus_fmt, &mbus_fmt); v4l2_fill_pix_format(&f->fmt.pix, &mbus_fmt); @@ -1013,7 +1013,7 @@ static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id norm) resolution (since a standard change effects things like the number of lines in VACT, etc) */ memset(&mbus_fmt, 0, sizeof(mbus_fmt)); - mbus_fmt.code = V4L2_MBUS_FMT_FIXED; + mbus_fmt.code = MEDIA_BUS_FMT_FIXED; mbus_fmt.width = dev->width; mbus_fmt.height = dev->height; call_all(dev, video, s_mbus_fmt, &mbus_fmt); -- cgit v1.2.1