From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_2 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7125FC432BE for ; Wed, 28 Jul 2021 07:38:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5A22B60F93 for ; Wed, 28 Jul 2021 07:38:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235037AbhG1Hin convert rfc822-to-8bit (ORCPT ); Wed, 28 Jul 2021 03:38:43 -0400 Received: from relay8-d.mail.gandi.net ([217.70.183.201]:57451 "EHLO relay8-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234417AbhG1Hif (ORCPT ); Wed, 28 Jul 2021 03:38:35 -0400 Received: (Authenticated sender: clement.leger@bootlin.com) by relay8-d.mail.gandi.net (Postfix) with ESMTPSA id 374BD1BF206; Wed, 28 Jul 2021 07:38:32 +0000 (UTC) Date: Wed, 28 Jul 2021 09:38:31 +0200 From: =?UTF-8?B?Q2zDqW1lbnQgTMOpZ2Vy?= To: Vinod Koul Cc: Ludovic Desroches , Tudor Ambarus , Alexandre Belloni , linux-arm-kernel@lists.infradead.org, dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] dmaengine: at_xdmac: use module_platform_driver Message-ID: <20210728093831.27430737@fixe.home> In-Reply-To: References: <20210625090042.17085-1-clement.leger@bootlin.com> Organization: Bootlin X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le Wed, 28 Jul 2021 12:26:50 +0530, Vinod Koul a écrit : > On 25-06-21, 11:00, Clément Léger wrote: > > The driver was previously probed with platform_driver_probe. This > > does not allow the driver to be probed again later if probe function > > returns -EPROBE_DEFER. This patch replace the use of > > platform_driver_probe with module_platform_driver which allows that. > > > > Signed-off-by: Clément Léger > > --- > > drivers/dma/at_xdmac.c | 6 +----- > > 1 file changed, 1 insertion(+), 5 deletions(-) > > > > diff --git a/drivers/dma/at_xdmac.c b/drivers/dma/at_xdmac.c > > index 64a52bf4d737..109a4c0895f4 100644 > > --- a/drivers/dma/at_xdmac.c > > +++ b/drivers/dma/at_xdmac.c > > @@ -2238,11 +2238,7 @@ static struct platform_driver > > at_xdmac_driver = { } > > }; > > > > -static int __init at_xdmac_init(void) > > -{ > > - return platform_driver_probe(&at_xdmac_driver, > > at_xdmac_probe); -} > > -subsys_initcall(at_xdmac_init); > > +module_platform_driver(at_xdmac_driver); > > You are also changing the init call here, there is a reason why > dmaengine drivers are subsys_initcall.. have you tested this? > I understood that the subsys initcall was there to probe the DMA driver earlier than other drivers (at least I guess this was the reason). I also tested it and can confirm you this works as expected on my platform (sama5d2_xplained and sama5d27_som1). In my configuration, the clocks are provided using SCMI and the SCMI driver probes them later than other drivers. With the current subsys_initcall, platform_driver_probe calls __platform_driver_probe which will eventually calls platform_probe. This one will fails because SCMI clocks are not available at this time. And as said in the kernel doc, __platform_driver_probe is incompatible with deferred probing. This leads to failure of all drivers that needs DMA channels provbided by at_xdmac. With module_platform_driver, the at_xdmac driver is correctly probed again later and all drivers that depends on DMA channels provided by this one are also correctly probed. The deferred probing mechanism seems to do its job correctly (at least in my case).