Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp235367iof; Mon, 6 Jun 2022 02:19:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy6TB5iF6P3yhG14DUZvNwaxi8NOSwU+wpiZ7YcfjC6xlcmQ7RM5bpUo8wqQHz/MmKYPwe6 X-Received: by 2002:a05:6a00:1741:b0:51b:ca1a:8563 with SMTP id j1-20020a056a00174100b0051bca1a8563mr21236440pfc.58.1654507165445; Mon, 06 Jun 2022 02:19:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654507165; cv=none; d=google.com; s=arc-20160816; b=tYpsjzDQwn9lWN3kmGZCnnnq9ntDl0y/maQFXG0QtyKsjaOipcjT+sfD6cjtj3cuei tO63ToWgYMaDSusLDQfnNWRxoTAT3t70DqjK1rKiE4eVorPX6IU0n2Re4ugBSITdeOR+ 72YhIjFoNeyvrUx5Qn63U2YOQ7ca73NWzvFv5qwIlatHScaz8+p7Yy5f1cAaX5Z8Z7en ZNUeJg4AzbI4rjjZtc9p/Ibe4chQ0MwrhheddKf7fUB7Wf0tlfnHgNL0TKwrAm7f4lum bvuiKc2K1dA6C+hNGs/vgYux265pNcn5U5+Juc8ZMNzGFIDhR3/ip/d91lCl0OJTgNKp ozDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:in-reply-to :subject:cc:to:from:message-id:date:dkim-signature; bh=nbrkPPR1UGkysYVk3OiOwHR846JELnrxUju3IFA4BQg=; b=wj5G9yRyH6WC1n7Iw7rwn2+b2PfOszobw23cDIdc7ikD5sDw16z5PdFHXcXRIBCE6Z F0owkiOd/Ab5EQy64IAmunfDEhy/YfHqdTctZ4YPpFNS/KsliNobe2iu7xs97YA7ZGmY TePN9uexjaboNW6+x1j6EVsYaGXQYPf4J19YjpRDCb6q0QPvpGBjIx6dAuRkOhTlIq+8 ACwx2mM/iyIObmu+WA9hp4JOvGbidlY5nOrig68y5Og1m/rNjg7EPlJGGQgvR8VgsyJc b9i8oWAyoJxk0QK0xQsjtq/ofhKlq6eODzR43v4K/1OZOWXTCi6DUpciNYcyy73UGV6j UuJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=p0Du64LW; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id w23-20020a1709027b9700b00155d894798fsi19305355pll.362.2022.06.06.02.19.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jun 2022 02:19:25 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=p0Du64LW; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id EB65E3983C; Mon, 6 Jun 2022 01:52:53 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232464AbiFFIwU (ORCPT + 99 others); Mon, 6 Jun 2022 04:52:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33266 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232704AbiFFIwF (ORCPT ); Mon, 6 Jun 2022 04:52:05 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E7E805044B; Mon, 6 Jun 2022 01:49:47 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8B90361251; Mon, 6 Jun 2022 08:49:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EDD7DC3411F; Mon, 6 Jun 2022 08:49:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1654505386; bh=14B/zX7li0hOyh4z+Cjf/cYsZsY3+4GGu6OY8K+7/7Y=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=p0Du64LW1GHof7k1nwU8AqvG9NbbmRhG67bNOI2aImTPkt/RJdJuPHb8lnbFsbYWw RIF0GEzLN+2NdYTvhC0Q3xz3pkpRpx/YI2/ncPEEuFSuQH9fbXC2CBOdWzvjnOMwIe XVCr5stqVLLv86CW8tGAKAHqtiRMJTdXlthZUQoKunJ09M5ya6n7RzON8Um4N/veX0 pTq4aASxa6qa13kVaO2tI3Rd3Ooe0YuA8RTS8bqzHPNN1WH/olLwVbyXyl49UoxxUo 3DK89lX/clB5/camkNap+PW5U185MxoAcMiwggXkbaJZ4lwi0m1CmAj2LWkNbtued1 cQ9wHUq1KNdqg== Received: from sofa.misterjones.org ([185.219.108.64] helo=why.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ny8Qh-00Fq92-Je; Mon, 06 Jun 2022 09:49:43 +0100 Date: Mon, 06 Jun 2022 09:49:43 +0100 Message-ID: <8735gi5g7s.wl-maz@kernel.org> From: Marc Zyngier To: Manivannan Sadhasivam Cc: tglx@linutronix.de, bjorn.andersson@linaro.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org Subject: Re: [PATCH 3/3] genirq: Check for trigger type mismatch in __setup_irq() In-Reply-To: <20220530080842.37024-4-manivannan.sadhasivam@linaro.org> References: <20220530080842.37024-1-manivannan.sadhasivam@linaro.org> <20220530080842.37024-4-manivannan.sadhasivam@linaro.org> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/27.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: manivannan.sadhasivam@linaro.org, tglx@linutronix.de, bjorn.andersson@linaro.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-Spam-Status: No, score=-3.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 On Mon, 30 May 2022 09:08:42 +0100, Manivannan Sadhasivam wrote: > > Currently, if the trigger type defined by the platform like DT does not > match the driver requested trigger type, the below warning is shown > during platform_get_irq() but only during the second time of the drive > probe (due to probe deferral or module unload/load). > > irq: type mismatch, failed to map hwirq-9 for interrupt-controller@b220000! > > Consider a typical usecase of requesting an IRQ in a driver: > > ``` > /* Assume DT has set the trigger type to IRQF_TYPE_LEVEL_HIGH */ > > q6v5->wdog_irq = platform_get_irq_byname(pdev, "wdog"); > if (q6v5->wdog_irq <= 0) > return q6v5->wdog_irq; > > ret = devm_request_threaded_irq(&pdev->dev, q6v5->wdog_irq, > NULL, q6v5_wdog_interrupt, > IRQF_TRIGGER_RISING | IRQF_ONESHOT, > "q6v5 wdog", q6v5); > if (ret) { > dev_err(&pdev->dev, "failed to acquire wdog IRQ\n"); > return ret; > } > ``` > > For the first time probe of a driver, platform_get_irq_byname() does not > return an error and it sets the platform requested trigger type. Then, > request_irq() also does not check for the trigger type mismatch and sets > the driver requested trigger type. Later if the driver gets probed again, > platform_get_irq() throws the "type mismatch" warning and fails. > > Ideally, request_irq() should throw the error during the first time itself, > when it detects the trigger type mismatch. So let's add a check in > __setup_irq() for checking the trigger type mismatch. No, that's wrong. The whole point is to be able to *override* the default that is exposed by the device tree or ACPI. We have countless examples of that, and they cannot be broken. If the issue exists after an unload, then it is a unload time that the previous behaviour should be restored. Thanks, M. -- Without deviation from the norm, progress is not possible.