From patchwork Tue May 16 09:55:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sakari Ailus X-Patchwork-Id: 13242867 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ED592C7EE24 for ; Tue, 16 May 2023 09:56:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232255AbjEPJ4b (ORCPT ); Tue, 16 May 2023 05:56:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232228AbjEPJ42 (ORCPT ); Tue, 16 May 2023 05:56:28 -0400 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 40FF930C1 for ; Tue, 16 May 2023 02:56:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1684230983; x=1715766983; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=hx9Y/3ZHGLMDYmc0w44PzlFD44KxlGR39l+QKDUCr1k=; b=cyk05BtjwOExXX+104wMV6Mx5cuJqsI0yi6rof1IwrAqVPVp7FwSl3Dd 5OIXEJFhV4JfBDiivC9bwcpBOkNla5/tNle29Ro4aF20p+7EVjAJ0DzSB Af3zxmE9hhzD+x9Nop2ZYgWoRT/MFuF12s4F7msAO2J++JFxOg9wPCmpx nzbomCGN92lsw9smCOrnzJ5qpAt+HTyvq+x55cM2aOfxxSrmfipOuAPB1 E8kjG8mGQQLQJShjEmMgmF+E7hEPLoG3xBbwl9mzYosWJ6Mrt70WZdF2z z472gvR0STfyP7cLfvS68/9n0ceXraf1lzX3UxRX2o4P2AQVRni2jmyZ2 g==; X-IronPort-AV: E=McAfee;i="6600,9927,10711"; a="354601527" X-IronPort-AV: E=Sophos;i="5.99,278,1677571200"; d="scan'208";a="354601527" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 May 2023 02:55:51 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10711"; a="731931866" X-IronPort-AV: E=Sophos;i="5.99,278,1677571200"; d="scan'208";a="731931866" Received: from turnipsi.fi.intel.com (HELO kekkonen.fi.intel.com) ([10.237.72.44]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 May 2023 02:55:48 -0700 Received: from punajuuri.localdomain (punajuuri.localdomain [192.168.240.130]) by kekkonen.fi.intel.com (Postfix) with ESMTP id 761D7122FB4; Tue, 16 May 2023 12:55:36 +0300 (EEST) Received: from sailus by punajuuri.localdomain with local (Exim 4.94.2) (envelope-from ) id 1pyrOy-002ZB4-Fi; Tue, 16 May 2023 12:55:28 +0300 From: Sakari Ailus To: linux-media@vger.kernel.org Cc: laurent.pinchart@ideasonboard.com, Philipp Zabel , hverkuil@xs4all.nl, Francesco Dolcini , aishwarya.kothari@toradex.com, Robert Foss , Todor Tomov , Hyun Kwon , bingbu.cao@intel.com Subject: [PATCH v2 26/31] media: omap3isp: Initialise V4L2 async notifier later Date: Tue, 16 May 2023 12:55:12 +0300 Message-Id: <20230516095517.611711-27-sakari.ailus@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230516095517.611711-1-sakari.ailus@linux.intel.com> References: <20230516095517.611711-1-sakari.ailus@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Initialise V4L2 async notifier and parse DT for async sub-devices later, just before registering the notifier. This way the V4L2 device has been registered before initialising the notifier which makes it possible to use it for debug prints. Signed-off-by: Sakari Ailus --- drivers/media/platform/ti/omap3isp/isp.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/media/platform/ti/omap3isp/isp.c b/drivers/media/platform/ti/omap3isp/isp.c index 73d5084dce8b9..39768684a6455 100644 --- a/drivers/media/platform/ti/omap3isp/isp.c +++ b/drivers/media/platform/ti/omap3isp/isp.c @@ -2002,6 +2002,7 @@ static void isp_remove(struct platform_device *pdev) struct isp_device *isp = platform_get_drvdata(pdev); v4l2_async_nf_unregister(&isp->notifier); + v4l2_async_nf_cleanup(&isp->notifier); isp_unregister_entities(isp); isp_cleanup_modules(isp); isp_xclk_cleanup(isp); @@ -2011,7 +2012,6 @@ static void isp_remove(struct platform_device *pdev) __omap3isp_put(isp, false); media_entity_enum_cleanup(&isp->crashed); - v4l2_async_nf_cleanup(&isp->notifier); kfree(isp); } @@ -2295,13 +2295,8 @@ static int isp_probe(struct platform_device *pdev) mutex_init(&isp->isp_mutex); spin_lock_init(&isp->stat_lock); - v4l2_async_nf_init(&isp->notifier); isp->dev = &pdev->dev; - ret = isp_parse_of_endpoints(isp); - if (ret < 0) - goto error; - isp->ref_count = 0; ret = dma_coerce_mask_and_coherent(isp->dev, DMA_BIT_MASK(32)); @@ -2433,6 +2428,12 @@ static int isp_probe(struct platform_device *pdev) isp->notifier.ops = &isp_subdev_notifier_ops; + v4l2_async_nf_init(&isp->notifier); + + ret = isp_parse_of_endpoints(isp); + if (ret < 0) + goto error_register_entities; + ret = v4l2_async_nf_register(&isp->v4l2_dev, &isp->notifier); if (ret) goto error_register_entities; @@ -2443,6 +2444,7 @@ static int isp_probe(struct platform_device *pdev) return 0; error_register_entities: + v4l2_async_nf_cleanup(&isp->notifier); isp_unregister_entities(isp); error_modules: isp_cleanup_modules(isp); @@ -2452,7 +2454,6 @@ static int isp_probe(struct platform_device *pdev) isp_xclk_cleanup(isp); __omap3isp_put(isp, false); error: - v4l2_async_nf_cleanup(&isp->notifier); mutex_destroy(&isp->isp_mutex); error_release_isp: kfree(isp);