From 76c4c2be190fc5f9750975bb1b3caf98712da4c1 Mon Sep 17 00:00:00 2001 From: "Lad, Prabhakar" Date: Fri, 16 May 2014 10:33:22 -0300 Subject: [PATCH] [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 Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/davinci/vpif_display.c | 29 +++++++------------ 1 file 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 = { .channel_bufsize[1] = 720 * 576 * 2, }; +#define VPIF_DRIVER_NAME "vpif_display" /* Is set to 1 in case of SDTV formats, 2 in case of HDTV formats. */ static int ycmux_mode; @@ -652,7 +653,7 @@ static int vpif_querycap(struct file *file, void *priv, cap->device_caps = V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_STREAMING; cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS; - snprintf(cap->driver, sizeof(cap->driver), "%s", dev_name(vpif_dev)); + strlcpy(cap->driver, VPIF_DRIVER_NAME, sizeof(cap->driver)); snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s", dev_name(vpif_dev)); strlcpy(cap->card, config->card_name, sizeof(cap->card)); @@ -1116,12 +1117,6 @@ static const struct v4l2_file_operations vpif_fops = { .poll = vb2_fop_poll }; -static struct video_device vpif_video_template = { - .name = "vpif", - .fops = &vpif_fops, - .ioctl_ops = &vpif_ioctl_ops, -}; - /*Configure the channels, buffer sizei, request irq */ static int initialize_vpif(void) { @@ -1273,7 +1268,14 @@ static int vpif_probe_complete(void) vpif_dbg(1, debug, "channel=%x,channel->video_dev=%x\n", (int)ch, (int)&ch->video_dev); + /* Initialize the video_device structure */ vdev = ch->video_dev; + strlcpy(vdev->name, VPIF_DRIVER_NAME, sizeof(vdev->name)); + vdev->release = video_device_release; + vdev->fops = &vpif_fops; + vdev->ioctl_ops = &vpif_ioctl_ops; + vdev->v4l2_dev = &vpif_obj.v4l2_dev; + vdev->vfl_dir = VFL_DIR_TX; vdev->queue = q; vdev->lock = &common->lock; set_bit(V4L2_FL_USE_FH_PRIO, &vdev->flags); @@ -1334,7 +1336,7 @@ static __init int vpif_probe(struct platform_device *pdev) while ((res = platform_get_resource(pdev, IORESOURCE_IRQ, res_idx))) { err = devm_request_irq(&pdev->dev, res->start, vpif_channel_isr, - IRQF_SHARED, "VPIF_Display", + IRQF_SHARED, VPIF_DRIVER_NAME, (void *)(&vpif_obj.dev[res_idx]-> channel_id)); if (err) { @@ -1360,15 +1362,6 @@ static __init int vpif_probe(struct platform_device *pdev) goto vpif_unregister; } - /* Initialize field of video device */ - *vfd = vpif_video_template; - vfd->v4l2_dev = &vpif_obj.v4l2_dev; - vfd->release = video_device_release; - vfd->vfl_dir = VFL_DIR_TX; - snprintf(vfd->name, sizeof(vfd->name), - "VPIF_Display_DRIVER_V%s", - VPIF_DISPLAY_VERSION); - /* Set video_dev to the video device */ ch->video_dev = vfd; } @@ -1533,7 +1526,7 @@ static const struct dev_pm_ops vpif_pm = { static __refdata struct platform_driver vpif_driver = { .driver = { - .name = "vpif_display", + .name = VPIF_DRIVER_NAME, .owner = THIS_MODULE, .pm = vpif_pm_ops, }, -- 2.34.1