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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0B17AC19F2A for ; Sat, 30 Jul 2022 15:29:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234949AbiG3P3h (ORCPT ); Sat, 30 Jul 2022 11:29:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232942AbiG3P3g (ORCPT ); Sat, 30 Jul 2022 11:29:36 -0400 X-Greylist: delayed 1759 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Sat, 30 Jul 2022 08:29:35 PDT Received: from viti.kaiser.cx (viti.kaiser.cx [IPv6:2a01:238:43fe:e600:cd0c:bd4a:7a3:8e9f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 19BF813DF7; Sat, 30 Jul 2022 08:29:35 -0700 (PDT) Received: from martin by viti.kaiser.cx with local (Exim 4.89) (envelope-from ) id 1oHnwf-0004xe-VY; Sat, 30 Jul 2022 17:00:01 +0200 Date: Sat, 30 Jul 2022 17:00:01 +0200 From: Martin Kaiser To: Ahmad Fatoum Cc: Kshitiz Varshney , Horia Geanta , Pankaj Gupta , Varun Sethi , Herbert Xu , "David S . Miller" , Iuliana Prodan , Gaurav Jain , Rahul Kumar Yadav , Vabhav Sharma , Sahil Malhotra , Matt Mackall , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Steffen Trumtrar , PrasannaKumar Muralidharan , linux-imx@nxp.com, linux-crypto@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v1] Moving init_completion before request_irq Message-ID: <20220730150001.e2tmrusybyherkra@viti.kaiser.cx> References: <20220729100211.2204126-1-kshitiz.varshney@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) Sender: Martin Kaiser Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello Kshitiz & Ahmad, Thus wrote Ahmad Fatoum (a.fatoum@pengutronix.de): > > + init_completion(&rngc->rng_op_done); > > + > > ret = devm_request_irq(&pdev->dev, > > irq, imx_rngc_irq, 0, pdev->name, (void *)rngc); > This should probably be moved below imx_rngc_irq_mask_clear(rngc). > init_completion can stay where it is. That way: I agree with Ahmad that this is the better approach. We should clear pending irqs and disable interrupt sources on the hardware level before we install our irq handler. Best regards, Martin > - You initialize rngc fully before registering the IRQ handler > - You don't handle pending IRQs that you want to dismiss anyway > - If the IRQ happens to be because of a SEED_DONE due to a previous > boot stage, you don't end up completing the completion prematurely.