aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/platform/davinci/vpif_display.c
diff options
context:
space:
mode:
authorLad, Prabhakar <prabhakar.csengg@gmail.com>2014-05-16 09:33:22 -0400
committerMauro Carvalho Chehab <m.chehab@samsung.com>2014-05-23 18:12:07 -0400
commit76c4c2be190fc5f9750975bb1b3caf98712da4c1 (patch)
treea04e9f66ab5a1352eb9bf7073b4edab1ae9eb65d /drivers/media/platform/davinci/vpif_display.c
parent2f5851b5a87e96065d623cfe89137b3abdcfe643 (diff)
[media] media: davinci: vpif_display: initialize the video device in single place
this patch moves the initalization of video device to a single place and uses macro to define the driver name and use it appropraitely in required places. Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'drivers/media/platform/davinci/vpif_display.c')
-rw-r--r--drivers/media/platform/davinci/vpif_display.c29
1 files changed, 11 insertions, 18 deletions
diff --git a/drivers/media/platform/davinci/vpif_display.c b/drivers/media/platform/davinci/vpif_display.c
index aa487a682e12..1e0a1627b668 100644
--- a/drivers/media/platform/davinci/vpif_display.c
+++ b/drivers/media/platform/davinci/vpif_display.c
@@ -62,6 +62,7 @@ static struct vpif_config_params config_params = {
62 .channel_bufsize[1] = 720 * 576 * 2, 62 .channel_bufsize[1] = 720 * 576 * 2,
63}; 63};
64 64
65#define VPIF_DRIVER_NAME "vpif_display"
65 66
66/* Is set to 1 in case of SDTV formats, 2 in case of HDTV formats. */ 67/* Is set to 1 in case of SDTV formats, 2 in case of HDTV formats. */
67static int ycmux_mode; 68static int ycmux_mode;
@@ -652,7 +653,7 @@ static int vpif_querycap(struct file *file, void *priv,
652 653
653 cap->device_caps = V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_STREAMING; 654 cap->device_caps = V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_STREAMING;
654 cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS; 655 cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS;
655 snprintf(cap->driver, sizeof(cap->driver), "%s", dev_name(vpif_dev)); 656 strlcpy(cap->driver, VPIF_DRIVER_NAME, sizeof(cap->driver));
656 snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s", 657 snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s",
657 dev_name(vpif_dev)); 658 dev_name(vpif_dev));
658 strlcpy(cap->card, config->card_name, sizeof(cap->card)); 659 strlcpy(cap->card, config->card_name, sizeof(cap->card));
@@ -1116,12 +1117,6 @@ static const struct v4l2_file_operations vpif_fops = {
1116 .poll = vb2_fop_poll 1117 .poll = vb2_fop_poll
1117}; 1118};
1118 1119
1119static struct video_device vpif_video_template = {
1120 .name = "vpif",
1121 .fops = &vpif_fops,
1122 .ioctl_ops = &vpif_ioctl_ops,
1123};
1124
1125/*Configure the channels, buffer sizei, request irq */ 1120/*Configure the channels, buffer sizei, request irq */
1126static int initialize_vpif(void) 1121static int initialize_vpif(void)
1127{ 1122{
@@ -1273,7 +1268,14 @@ static int vpif_probe_complete(void)
1273 vpif_dbg(1, debug, "channel=%x,channel->video_dev=%x\n", 1268 vpif_dbg(1, debug, "channel=%x,channel->video_dev=%x\n",
1274 (int)ch, (int)&ch->video_dev); 1269 (int)ch, (int)&ch->video_dev);
1275 1270
1271 /* Initialize the video_device structure */
1276 vdev = ch->video_dev; 1272 vdev = ch->video_dev;
1273 strlcpy(vdev->name, VPIF_DRIVER_NAME, sizeof(vdev->name));
1274 vdev->release = video_device_release;
1275 vdev->fops = &vpif_fops;
1276 vdev->ioctl_ops = &vpif_ioctl_ops;
1277 vdev->v4l2_dev = &vpif_obj.v4l2_dev;
1278 vdev->vfl_dir = VFL_DIR_TX;
1277 vdev->queue = q; 1279 vdev->queue = q;
1278 vdev->lock = &common->lock; 1280 vdev->lock = &common->lock;
1279 set_bit(V4L2_FL_USE_FH_PRIO, &vdev->flags); 1281 set_bit(V4L2_FL_USE_FH_PRIO, &vdev->flags);
@@ -1334,7 +1336,7 @@ static __init int vpif_probe(struct platform_device *pdev)
1334 1336
1335 while ((res = platform_get_resource(pdev, IORESOURCE_IRQ, res_idx))) { 1337 while ((res = platform_get_resource(pdev, IORESOURCE_IRQ, res_idx))) {
1336 err = devm_request_irq(&pdev->dev, res->start, vpif_channel_isr, 1338 err = devm_request_irq(&pdev->dev, res->start, vpif_channel_isr,
1337 IRQF_SHARED, "VPIF_Display", 1339 IRQF_SHARED, VPIF_DRIVER_NAME,
1338 (void *)(&vpif_obj.dev[res_idx]-> 1340 (void *)(&vpif_obj.dev[res_idx]->
1339 channel_id)); 1341 channel_id));
1340 if (err) { 1342 if (err) {
@@ -1360,15 +1362,6 @@ static __init int vpif_probe(struct platform_device *pdev)
1360 goto vpif_unregister; 1362 goto vpif_unregister;
1361 } 1363 }
1362 1364
1363 /* Initialize field of video device */
1364 *vfd = vpif_video_template;
1365 vfd->v4l2_dev = &vpif_obj.v4l2_dev;
1366 vfd->release = video_device_release;
1367 vfd->vfl_dir = VFL_DIR_TX;
1368 snprintf(vfd->name, sizeof(vfd->name),
1369 "VPIF_Display_DRIVER_V%s",
1370 VPIF_DISPLAY_VERSION);
1371
1372 /* Set video_dev to the video device */ 1365 /* Set video_dev to the video device */
1373 ch->video_dev = vfd; 1366 ch->video_dev = vfd;
1374 } 1367 }
@@ -1533,7 +1526,7 @@ static const struct dev_pm_ops vpif_pm = {
1533 1526
1534static __refdata struct platform_driver vpif_driver = { 1527static __refdata struct platform_driver vpif_driver = {
1535 .driver = { 1528 .driver = {
1536 .name = "vpif_display", 1529 .name = VPIF_DRIVER_NAME,
1537 .owner = THIS_MODULE, 1530 .owner = THIS_MODULE,
1538 .pm = vpif_pm_ops, 1531 .pm = vpif_pm_ops,
1539 }, 1532 },