From patchwork Wed May 25 19:05:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Kocialkowski X-Patchwork-Id: 12861633 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 38292C433EF for ; Wed, 25 May 2022 19:16:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=vJj/uOK8IYBODyYnFkTYeYFI3g4ABAD5ySfglpJGdTk=; b=mzNDtVGKU6uKzR s1LVGsU6JC2L5ceYRKUXK9FIJfqfu+dofvoEz4le1SWTgDxuT9p+cX1/1Fhcccgu96zzf8P3hjMv1 KTqSCmO4OUp4TxE7ifecVV5RRHGpmvIyVlsgxqQV6HunPtMCLKzaedev1gAuesh+1M7o8+13hHXy8 zW3uQEwy2S0pjkMC9jPLGZniAOIaupDdxMyjHUhsqvh0GRJRap1S0JvEO0sEyRZuEKVtWtZ+URTqx 89A/Nhv3Vztep8BSNAAaOA0yrXrY0g7chXHY6VCOcoBWn+bklGGhyMviLJlMiDtjFCxm4s4DCdfMM Xvl+FmaDrnUQvxNeorSQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ntwTe-00CHeR-Nw; Wed, 25 May 2022 19:15:27 +0000 Received: from relay5-d.mail.gandi.net ([217.70.183.197]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ntwLA-00CE8A-Iq for linux-arm-kernel@lists.infradead.org; Wed, 25 May 2022 19:06:44 +0000 Received: (Authenticated sender: paul.kocialkowski@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id D4D581C000E; Wed, 25 May 2022 19:06:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1653505599; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oIhItMaoCnkWqyhSFVbn20u15vvXwqMOPRlHHrZFzpg=; b=XsX/QCgIDhf08pk19d9ePgx3zHC/H0iVkrvSXuA9UGqCgJgIdRlog5d8L3atrKsbyFZe0q 435c2KkTNB7KAKng5i1Xd6qFl2RT6hQm4BGPe2apDPIrDdOEcQpsjGe9bKSFFUn/BGOqPv LSmE1e0CTi/34JixY+dGqayyxz62zobp7F8vrZ8jjsT5m1Ya9K5/FCblUxx2tDeTbmlbQp gHCZc/nasRF/k2RPpI6ntEynXvwg21aLLROSUIlyxzYOYuFA2aAzdz8jZPX6uExbqPeWrR Hi+P9X54siuoKn6xUongss87Qhhp4s/tBBGzn8jcNow5nftg1dc6gEmCZaJ/Nw== From: Paul Kocialkowski To: linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev Cc: Yong Deng , Paul Kocialkowski , Mauro Carvalho Chehab , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Laurent Pinchart , Maxime Ripard , Thomas Petazzoni Subject: [PATCH v5 11/44] media: sun6i-csi: Register the media device after creation Date: Wed, 25 May 2022 21:05:44 +0200 Message-Id: <20220525190617.696344-12-paul.kocialkowski@bootlin.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220525190617.696344-1-paul.kocialkowski@bootlin.com> References: <20220525190617.696344-1-paul.kocialkowski@bootlin.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220525_120640_894494_87E2146E X-CRM114-Status: GOOD ( 14.07 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org There is no particular need to register the media device in the subdev notify complete callback. Register it in the v4l2 code instead where it's more in-context. Signed-off-by: Paul Kocialkowski Acked-by: Jernej Skrabec --- drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c b/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c index a55347b7a6d6..e3d60b647cb2 100644 --- a/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c +++ b/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c @@ -638,7 +638,7 @@ static int sun6i_subdev_notify_complete(struct v4l2_async_notifier *notifier) if (ret < 0) return ret; - return media_device_register(&v4l2->media_dev); + return 0; } static const struct v4l2_async_notifier_operations sun6i_csi_async_ops = { @@ -685,6 +685,12 @@ static int sun6i_csi_v4l2_setup(struct sun6i_csi_device *csi_dev) media_device_init(media_dev); + ret = media_device_register(media_dev); + if (ret) { + dev_err(dev, "failed to register media device: %d\n", ret); + goto error_media; + } + /* V4L2 Control Handler */ ret = v4l2_ctrl_handler_init(&v4l2->ctrl_handler, 0); @@ -744,6 +750,7 @@ static int sun6i_csi_v4l2_setup(struct sun6i_csi_device *csi_dev) v4l2_ctrl_handler_free(&v4l2->ctrl_handler); error_media: + media_device_unregister(media_dev); media_device_cleanup(media_dev); return ret;