Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp652593rwe; Fri, 26 Aug 2022 11:36:15 -0700 (PDT) X-Google-Smtp-Source: AA6agR4R/4r27m98CFzdYTIvJpbDlnzVln1CXNUXN1jcV+OuuTxyvDfNbKK4h4fFPWcGEv0wpmre X-Received: by 2002:a17:90b:4a0e:b0:1fb:5583:57a5 with SMTP id kk14-20020a17090b4a0e00b001fb558357a5mr5611004pjb.124.1661538975656; Fri, 26 Aug 2022 11:36:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661538975; cv=none; d=google.com; s=arc-20160816; b=YoeLc0gdibDlYI1iFu5Eewo4aznifAAPdvxFjzH9Sw9B4vnKx5yWkGTEKnJf2o0FDy 3EeB9IA+b078XQZGTAQYUDukDjF+QX3Ka+dIYG9cB2d3yK8jHgsOEM8x/kEG42zEmFEo p5mWH9ud5Omylz+N8JM7Uj498oiqtRXDNXBw9xv4cSpSkO1P4Q1LdVXJfASRcKUuy9LJ I4yTPCwEsTC72huQ7WMTPzGO9ACdONxRls0QndN0Ie2/toQC5/ScukEX0qf984YNvm8w x2NVc12IqDp27ib80lrtvILgWvhmixfbp4OWF+SYmkAJ+DxiRz23okgTx+CEnm3NkTBi eCTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=4o3mcOJ3LXjZa5Hp4EJXM7u0pr41x6gcWEkiEDyC0Lk=; b=s/QlotEgaep7yRpEEkk/mrukzaav8f5/4zPPtl7qgBD9ItdrQStp9/nkCdM59Op2DG VTRAZc0vR4n7nkc8Yk8J4moMrvIMaFI+kdcA1QfubA7Q6QiZhAN1byx45hVFszJHPrv3 bVYUWBiCcf6YHCyg7/ibWCN6O6dm8k8O0wgHF60xSicKMHgTFC+Sns1FHKnwIkkmL09d 1zodX/ygRpKJHCNypsA9KlW4qJbncymLviwFxIvU+KTuHEFlGGmdQxRbQYWr3C/icBuL GyvXs40g6KEKMnDaL+b2bPRBeo0P4FFtDtdpFpPeP9FC5FeGJ7aA4H3UEKFqSB9MKHQK WWhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b="Tc77NU/j"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y23-20020a056a00181700b0053674902ba3si2490899pfa.16.2022.08.26.11.36.03; Fri, 26 Aug 2022 11:36:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b="Tc77NU/j"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237625AbiHZSeH (ORCPT + 99 others); Fri, 26 Aug 2022 14:34:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229704AbiHZSde (ORCPT ); Fri, 26 Aug 2022 14:33:34 -0400 Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::229]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B23BE3C30; Fri, 26 Aug 2022 11:33:21 -0700 (PDT) Received: (Authenticated sender: paul.kocialkowski@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 15366FF806; Fri, 26 Aug 2022 18:33:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1661538800; 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=4o3mcOJ3LXjZa5Hp4EJXM7u0pr41x6gcWEkiEDyC0Lk=; b=Tc77NU/jeX85h8eSEYFhfaV9iZThofyAq21eus+B4vfYp3/JAMHdlpGA+Z5uW/2spY3ZKs gJkMnvcNL/4RAdHLVduBmlxJC8/1fl7UA9H/CWrfpkQZ2HcjSJWDcGfU93Omh10/3nTog3 BE9hl97CiBXlK6nzXc6Wd9HlkPMda29BpRurD+UwQ9E+fIOsaLF2KKwYiXlODDX4u2lo4p xKBh8INOCAG0OnjS5ks9jzydELX11GsT5W5WfDUuNG+EggTltUXCXHEzN51CQUgwlyz7vd YUerCF6HX4PRwxmR4i8FPKgPhyfUFMmoSrnD9YTfEPuZPkDNCS23AUShCcpl9A== 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 v6 11/43] media: sun6i-csi: Register the media device after creation Date: Fri, 26 Aug 2022 20:32:08 +0200 Message-Id: <20220826183240.604834-12-paul.kocialkowski@bootlin.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220826183240.604834-1-paul.kocialkowski@bootlin.com> References: <20220826183240.604834-1-paul.kocialkowski@bootlin.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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; -- 2.37.1