From patchwork Fri May 16 13:33:22 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 4192451 Return-Path: X-Original-To: patchwork-davinci@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 987369F1C0 for ; Fri, 16 May 2014 13:46:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AFFA620270 for ; Fri, 16 May 2014 13:46:17 +0000 (UTC) Received: from comal.ext.ti.com (comal.ext.ti.com [198.47.26.152]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CABD12026F for ; Fri, 16 May 2014 13:46:12 +0000 (UTC) Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id s4GDkBP5030163 for ; Fri, 16 May 2014 08:46:11 -0500 Received: from DLEE70.ent.ti.com (dlemailx.itg.ti.com [157.170.170.113]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id s4GDkB9d017563 for ; Fri, 16 May 2014 08:46:11 -0500 Received: from dflp33.itg.ti.com (10.64.6.16) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.3.174.1; Fri, 16 May 2014 08:46:11 -0500 Received: from linux.omap.com (dlelxs01.itg.ti.com [157.170.227.31]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id s4GDkBIX013713 for ; Fri, 16 May 2014 08:46:11 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id A8B8380626 for ; Fri, 16 May 2014 08:46:11 -0500 (CDT) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dlelxv84.itg.ti.com (dlelxv84.itg.ti.com [172.17.0.246]) by linux.omap.com (Postfix) with ESMTP id 52EEA80628 for ; Fri, 16 May 2014 08:40:21 -0500 (CDT) Received: from white.ext.ti.com (white.ext.ti.com [192.94.93.38]) by dlelxv84.itg.ti.com (8.14.3/8.13.8) with ESMTP id s4GDeLcR010528 for ; Fri, 16 May 2014 08:40:21 -0500 Received: from mail6.bemta12.messagelabs.com (mail6.bemta12.messagelabs.com [216.82.250.247]) by white.ext.ti.com (8.13.7/8.13.7) with ESMTP id s4GDeKOW021783 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 16 May 2014 08:40:21 -0500 Received: from [216.82.250.83:17754] by server-11.bemta-12.messagelabs.com id CA/E1-02193-44516735; Fri, 16 May 2014 13:40:20 +0000 X-Env-Sender: prabhakar.csengg@gmail.com X-Msg-Ref: server-3.tower-120.messagelabs.com!1400247619!4578932!1 X-Originating-IP: [209.85.220.45] 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 14549 invoked from network); 16 May 2014 13:40:20 -0000 Received: from mail-pa0-f45.google.com (HELO mail-pa0-f45.google.com) (209.85.220.45) by server-3.tower-120.messagelabs.com with RC4-SHA encrypted SMTP; 16 May 2014 13:40:20 -0000 Received: by mail-pa0-f45.google.com with SMTP id ey11so2576684pad.18 for ; Fri, 16 May 2014 06:40:18 -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=yIpnXbWw9Dl01VzLgfpq5Nu6Lu57egaKz4LEd/1YoII=; b=H6yYyHWdeahYW8W3CUlgI32XSQYLqSWXMN7gqYPf92aY1DSOmUmJwzyX2iE16i3smY sJ0MvB52fiT3+VgKYx1AnqrBOrnopMLz1BiiFG4dou+O0NvzWPWh4MxSF/Y7YYx8nvCP FBOMMSpyhe4pPnDvn1Cf/m0Nml1E7mjus/pq5VUpkCtM406HzU4hYCw+1VLeGANJ51tG xg3Lj+Q+G+v6E9dhL/LfszarqGmNM2aagIfaSRcw0Bt4ngCxwc9zhxrIzDnBWHdpCyZm Cd5PX/bedZRxMh7bp0/6CcptK0Bli7qwsIWOfIPqWgjmb2sBXMgngvPUpp6xqtSOXOLA pdcg== X-Received: by 10.68.162.34 with SMTP id xx2mr21119125pbb.120.1400247618876; Fri, 16 May 2014 06:40:18 -0700 (PDT) Received: from localhost.localdomain ([27.107.45.22]) by mx.google.com with ESMTPSA id cj1sm34699547pac.40.2014.05.16.06.40.09 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 16 May 2014 06:40:16 -0700 (PDT) From: "Lad, Prabhakar" To: LMML , Hans Verkuil Subject: [PATCH v5 17/49] media: davinci: vpif_display: initialize the video device in single place Date: Fri, 16 May 2014 19:03:22 +0530 Message-ID: <1400247235-31434-19-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+patchwork-davinci=patchwork.kernel.org@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_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 aa487a6..1e0a162 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, },