From patchwork Sat Mar 7 16:12:09 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prabhakar X-Patchwork-Id: 28544 X-Patchwork-Delegate: hverkuil@xs4all.nl Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.72) (envelope-from ) id 1YUHLI-0002LW-RN; Sat, 07 Mar 2015 17:12:44 +0100 X-tubIT-Incoming-IP: 209.132.180.67 Received: from vger.kernel.org ([209.132.180.67]) by mail.tu-berlin.de (exim-4.72/mailfrontend-5) with esmtp id 1YUHLG-0001YK-8G; Sat, 07 Mar 2015 17:12:44 +0100 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752591AbbCGQM1 (ORCPT + 1 other); Sat, 7 Mar 2015 11:12:27 -0500 Received: from mail-wi0-f173.google.com ([209.85.212.173]:37500 "EHLO mail-wi0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750809AbbCGQM0 (ORCPT ); Sat, 7 Mar 2015 11:12:26 -0500 Received: by wibhm9 with SMTP id hm9so10194707wib.2; Sat, 07 Mar 2015 08:12:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=F/MnVjUa47YqDj5bQ6iY+hXwgqvX4KgU+eLtXa1RkAo=; b=t7zO5mxP14ycIsmmajNJv/wPz9Hl0ip6TgLA2QEO77qerjpjs+tUitSkmEl12czGC1 X32gwcxwm1I5FlUHrCxx2z9qGpgUwkszccIcO7ZN6qfQxFD/q2TgXg+4NcyhUUE4wawZ yoa8+5XF/FVr+8u+lFx6+jj4jzGBjjPlylgTmly77LmgbXAECq5ukzvkcb0oT96dcsAZ tQszMHgy3U02Zj2XG25njW/KeWpJvLBu5AsBXW5IHpairhpGGC3U+By06W/MgvbW4nrn cDRiWZ5nYqIUGGv7MVh+ECfytCP6o+6/Lx6toKOWfmb+ohABsaJYOookyNpSd89lGxya kCIw== X-Received: by 10.180.102.199 with SMTP id fq7mr42828066wib.89.1425744744968; Sat, 07 Mar 2015 08:12:24 -0800 (PST) Received: from tango-charlie.Home (0545247b.skybroadband.com. [5.69.36.123]) by mx.google.com with ESMTPSA id cf12sm19923446wjb.10.2015.03.07.08.12.23 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 07 Mar 2015 08:12:23 -0800 (PST) From: Lad Prabhakar To: LMML , Hans Verkuil Cc: LKML , "Lad, Prabhakar" Subject: [PATCH] media: am437x-vpfe: embed video_device struct in vpfe_device Date: Sat, 7 Mar 2015 16:12:09 +0000 Message-Id: <1425744729-29379-1-git-send-email-prabhakar.csengg@gmail.com> X-Mailer: git-send-email 2.1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-PMX-Version: 6.0.0.2142326, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2015.3.7.160319 X-PMX-Spam: Gauge=IIIIIIIII, Probability=9%, Report=' FORGED_FROM_GMAIL 0.1, MULTIPLE_RCPTS 0.1, HTML_00_01 0.05, HTML_00_10 0.05, BODY_SIZE_3000_3999 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, DKIM_SIGNATURE 0, URI_ENDS_IN_HTML 0, __ANY_URI 0, __CP_MEDIA_BODY 0, __CP_URI_IN_BODY 0, __FRAUD_BODY_WEBMAIL 0, __FRAUD_WEBMAIL 0, __FRAUD_WEBMAIL_FROM 0, __FROM_GMAIL 0, __HAS_FROM 0, __HAS_MSGID 0, __HAS_X_MAILER 0, __HAS_X_MAILING_LIST 0, __MIME_TEXT_ONLY 0, __MULTIPLE_RCPTS_CC_X2 0, __PHISH_SPEAR_STRUCTURE_1 0, __SANE_MSGID 0, __TO_MALFORMED_2 0, __URI_NO_WWW 0, __URI_NS , __YOUTUBE_RCVD 0' From: "Lad, Prabhakar" Embed video_device struct (video_dev) in vpfe_device and Unregister path doesn't need to free the video_device structure, hence, change the video_device.release callback point to video_device_release_empty. Signed-off-by: Lad, Prabhakar --- drivers/media/platform/am437x/am437x-vpfe.c | 21 ++++++--------------- drivers/media/platform/am437x/am437x-vpfe.h | 2 +- 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/drivers/media/platform/am437x/am437x-vpfe.c b/drivers/media/platform/am437x/am437x-vpfe.c index 8e056eb..a30cc2f 100644 --- a/drivers/media/platform/am437x/am437x-vpfe.c +++ b/drivers/media/platform/am437x/am437x-vpfe.c @@ -2316,7 +2316,7 @@ vpfe_async_bound(struct v4l2_async_notifier *notifier, return -EINVAL; } - vpfe->video_dev->tvnorms |= sdinfo->inputs[0].std; + vpfe->video_dev.tvnorms |= sdinfo->inputs[0].std; /* setup the supported formats & indexes */ for (j = 0, i = 0; ; ++j) { @@ -2389,9 +2389,9 @@ static int vpfe_probe_complete(struct vpfe_device *vpfe) INIT_LIST_HEAD(&vpfe->dma_queue); - vdev = vpfe->video_dev; + vdev = &vpfe->video_dev; strlcpy(vdev->name, VPFE_MODULE_NAME, sizeof(vdev->name)); - vdev->release = video_device_release; + vdev->release = video_device_release_empty; vdev->fops = &vpfe_fops; vdev->ioctl_ops = &vpfe_ioctl_ops; vdev->v4l2_dev = &vpfe->v4l2_dev; @@ -2399,7 +2399,7 @@ static int vpfe_probe_complete(struct vpfe_device *vpfe) vdev->queue = q; vdev->lock = &vpfe->lock; video_set_drvdata(vdev, vpfe); - err = video_register_device(vpfe->video_dev, VFL_TYPE_GRABBER, -1); + err = video_register_device(&vpfe->video_dev, VFL_TYPE_GRABBER, -1); if (err) { vpfe_err(vpfe, "Unable to register video device.\n"); @@ -2564,17 +2564,11 @@ static int vpfe_probe(struct platform_device *pdev) return -EINVAL; } - vpfe->video_dev = video_device_alloc(); - if (!vpfe->video_dev) { - dev_err(&pdev->dev, "Unable to allocate video device\n"); - return -ENOMEM; - } - ret = v4l2_device_register(&pdev->dev, &vpfe->v4l2_dev); if (ret) { vpfe_err(vpfe, "Unable to register v4l2 device.\n"); - goto probe_out_video_release; + return ret; } /* set the driver data in platform device */ @@ -2612,9 +2606,6 @@ static int vpfe_probe(struct platform_device *pdev) probe_out_v4l2_unregister: v4l2_device_unregister(&vpfe->v4l2_dev); -probe_out_video_release: - if (!video_is_registered(vpfe->video_dev)) - video_device_release(vpfe->video_dev); return ret; } @@ -2631,7 +2622,7 @@ static int vpfe_remove(struct platform_device *pdev) v4l2_async_notifier_unregister(&vpfe->notifier); v4l2_device_unregister(&vpfe->v4l2_dev); - video_unregister_device(vpfe->video_dev); + video_unregister_device(&vpfe->video_dev); return 0; } diff --git a/drivers/media/platform/am437x/am437x-vpfe.h b/drivers/media/platform/am437x/am437x-vpfe.h index 956fb9e..5bfb356 100644 --- a/drivers/media/platform/am437x/am437x-vpfe.h +++ b/drivers/media/platform/am437x/am437x-vpfe.h @@ -222,7 +222,7 @@ struct vpfe_ccdc { struct vpfe_device { /* V4l2 specific parameters */ /* Identifies video device for this channel */ - struct video_device *video_dev; + struct video_device video_dev; /* sub devices */ struct v4l2_subdev **sd; /* vpfe cfg */