From patchwork Fri May 16 13:33:46 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 4193281 Return-Path: X-Original-To: patchwork-davinci@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 1044ABFF02 for ; Fri, 16 May 2014 13:59:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2CF9620270 for ; Fri, 16 May 2014 13:59:47 +0000 (UTC) Received: from devils.ext.ti.com (devils.ext.ti.com [198.47.26.153]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 20F6B2026F for ; Fri, 16 May 2014 13:59:46 +0000 (UTC) Received: from dflxv15.itg.ti.com ([128.247.5.124]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id s4GDwoVH003451; Fri, 16 May 2014 08:58:50 -0500 Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id s4GDwnbM031473; Fri, 16 May 2014 08:58:49 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DFLE72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.3.174.1; Fri, 16 May 2014 08:58:48 -0500 Received: from linux.omap.com (dlelxs01.itg.ti.com [157.170.227.31]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id s4GDwnEq015706; Fri, 16 May 2014 08:58:49 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id 08E4B80637; Fri, 16 May 2014 08:58:49 -0500 (CDT) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dflxv17.itg.ti.com (dflxv17.itg.ti.com [128.247.5.93]) by linux.omap.com (Postfix) with ESMTP id A6AD780646 for ; Fri, 16 May 2014 08:42:25 -0500 (CDT) Received: from neches.ext.ti.com (neches.ext.ti.com [192.91.81.29]) by dflxv17.itg.ti.com (8.14.3/8.13.8) with ESMTP id s4GDgP06014885 for ; Fri, 16 May 2014 08:42:25 -0500 Received: from mail6.bemta7.messagelabs.com (mail6.bemta7.messagelabs.com [216.82.255.55]) by neches.ext.ti.com (8.13.7/8.13.7) with ESMTP id s4GDgPdb009404 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 16 May 2014 08:42:25 -0500 Received: from [216.82.253.147:55435] by server-12.bemta-7.messagelabs.com id DB/A2-01335-1C516735; Fri, 16 May 2014 13:42:25 +0000 X-Env-Sender: prabhakar.csengg@gmail.com X-Msg-Ref: server-3.tower-165.messagelabs.com!1400247744!12962806!1 X-Originating-IP: [209.85.220.49] X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG, ML_RADAR_SPEW_LINKS_14,spamassassin: X-StarScan-Received: X-StarScan-Version: 6.11.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 6841 invoked from network); 16 May 2014 13:42:24 -0000 Received: from mail-pa0-f49.google.com (HELO mail-pa0-f49.google.com) (209.85.220.49) by server-3.tower-165.messagelabs.com with RC4-SHA encrypted SMTP; 16 May 2014 13:42:24 -0000 Received: by mail-pa0-f49.google.com with SMTP id lj1so2551936pab.8 for ; Fri, 16 May 2014 06:42:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=lcDJNv6e7MJo7/7pl8cRYZFZlsy1qAqeFIDKP4KK/6M=; b=bsWjCwLwHzFvNgqJBk9+M0Dkvl3gvhdCY3dFof/V6achZv8s7fWfhWBjhleg2hVuT+ qTWt8/UKkyyrNc+gIXQNcYddj/2ilpOuzyo8f1Ldh/9nrFLxhEFqaxoYsNvaMd6QSmG3 8s833SDzyKdrmwYv8uN0MLc5bj/T9e5YgvY6FMevqIWWmdQNx9Z6d26SRgfEEYUfZr4h X1Xj1hoRpTsMnIz1mNFxdIk5nIxxYd1SQT9PsKoU5C5mxlaOyENvXRkrHH5Kp0T4LLl6 7nYqZPe2C/tkzOCIymHXTOmhVM41joAtqQZSnvdsQQkWzKsMhIIxGS7xeg3UTcA26RRs Wt8Q== X-Received: by 10.68.197.99 with SMTP id it3mr20740567pbc.37.1400247743911; Fri, 16 May 2014 06:42:23 -0700 (PDT) Received: from localhost.localdomain ([27.107.45.22]) by mx.google.com with ESMTPSA id cj1sm34699547pac.40.2014.05.16.06.42.19 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 16 May 2014 06:42:22 -0700 (PDT) From: "Lad, Prabhakar" To: LMML , Hans Verkuil Subject: [PATCH v5 40/49] media: davinci: vpif_capture: initialize the video device in single place Date: Fri, 16 May 2014 19:03:46 +0530 Message-ID: <1400247235-31434-43-git-send-email-prabhakar.csengg@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1400247235-31434-1-git-send-email-prabhakar.csengg@gmail.com> References: <1400247235-31434-1-git-send-email-prabhakar.csengg@gmail.com> CC: DLOS , LKML X-BeenThere: davinci-linux-open-source@linux.davincidsp.com X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: Errors-To: davinci-linux-open-source-bounces@linux.davincidsp.com X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: "Lad, Prabhakar" 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 --- drivers/media/platform/davinci/vpif_capture.c | 30 ++++++++++--------------- 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/drivers/media/platform/davinci/vpif_capture.c b/drivers/media/platform/davinci/vpif_capture.c index b898779..d452eaf 100644 --- a/drivers/media/platform/davinci/vpif_capture.c +++ b/drivers/media/platform/davinci/vpif_capture.c @@ -65,6 +65,8 @@ static struct vpif_config_params config_params = { .channel_bufsize[1] = 720 * 576 * 2, }; +#define VPIF_DRIVER_NAME "vpif_capture" + /* global variables */ static struct vpif_device vpif_obj = { {NULL} }; static struct device *vpif_dev; @@ -1114,7 +1116,7 @@ static int vpif_querycap(struct file *file, void *priv, cap->device_caps = V4L2_CAP_VIDEO_CAPTURE | 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)); @@ -1349,14 +1351,6 @@ static struct v4l2_file_operations vpif_fops = { .poll = vb2_fop_poll }; -/* vpif video template */ -static struct video_device vpif_video_template = { - .name = "vpif", - .fops = &vpif_fops, - .minor = -1, - .ioctl_ops = &vpif_ioctl_ops, -}; - /** * initialize_vpif() - Initialize vpif data structures * @@ -1476,7 +1470,14 @@ static int vpif_probe_complete(void) INIT_LIST_HEAD(&common->dma_queue); + /* 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_RX; vdev->queue = q; vdev->lock = &common->lock; set_bit(V4L2_FL_USE_FH_PRIO, &vdev->flags); @@ -1549,7 +1550,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_Capture", + IRQF_SHARED, VPIF_DRIVER_NAME, (void *)(&vpif_obj.dev[res_idx]-> channel_id)); if (err) { @@ -1573,13 +1574,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; - snprintf(vfd->name, sizeof(vfd->name), - "VPIF_Capture_DRIVER_V%s", - VPIF_CAPTURE_VERSION); /* Set video_dev to the video device */ ch->video_dev = vfd; } @@ -1754,7 +1748,7 @@ static const struct dev_pm_ops vpif_dev_pm_ops = { static __refdata struct platform_driver vpif_driver = { .driver = { - .name = "vpif_capture", + .name = VPIF_DRIVER_NAME, .owner = THIS_MODULE, .pm = vpif_pm_ops, },