Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp936866pxb; Fri, 22 Apr 2022 14:48:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwhNYconsuINby7pUByA1SO7idymk5Ggva3zULNtbh5ZjQN4SyPB0X8D3ZZY4MIxqii8C9N X-Received: by 2002:a17:903:248:b0:155:e8c6:8770 with SMTP id j8-20020a170903024800b00155e8c68770mr6203471plh.129.1650664100050; Fri, 22 Apr 2022 14:48:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650664100; cv=none; d=google.com; s=arc-20160816; b=QRkCnKyeI2oEI8akgcJ3uiU3/CbPFDGDFwYAXn6JdK+HTmIWEqS7jssdAHqW5325kt tp2M+oeoWAd+neaziYZpQEVES/K0onP2DlOOfmBF8SCwb+oM8H/vA1sltAeE5kLwfwNM c4jJFd2NNSsQPVCQ+fgmTqpNCsywwRWWoF5A6rWWlMlzo3NVwSRuykEpFdUyFKwdAaNl KwIk7Henzg09ArqLdgXFgqpMwMQE0ZzaXIxZ8cggT8HOyoQuukg5bMR+wGL6uzmpJgTE FxxFl6M7/rDyo6OAhxtgfRNOZllWZR7jKsOuk0Yihc8YtdG7knhTss5BYcQqYDSGX9Ib lwIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=pmdYZG57UDB3nKmKGQneikiRzLQywHmdFzppNpNTQLM=; b=bnKI26FCDMN96fMZTqwF5PHjeBIX5oCsLzPqs0kQ0np29flQcz707MEPkScop6hfk6 3qG/aM4m2yr4CFUfGAOqeQSc0o++umUPi+9uvGepXCcAiHtOsbG7Bnm0+XbKOFppDhON SfFmaTK49Q1xA9M3FnNA8vFDgSVFPyhmMYIMVLPkwk+GHnI8cRFSRanhmdFYTnzqfK9w IyFOPvZ/6QE9AW3oD5D7PTp8ph4ISWi9Ag8YidYEYtQt5Z2WpPvriDw0mRKjngeakMlc DdpYopEisU/yHu7Uc96IyDtlhtXcuVpZ7N20/D+g+PJCmEJXz7Do3P6KfPwwdRDHUOst Ezwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=afZaWc3Z; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=38ipGL4B; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id w13-20020a63a74d000000b003816043f118si9766999pgo.781.2022.04.22.14.48.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 14:48:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=afZaWc3Z; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=38ipGL4B; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E11B02F7E32; Fri, 22 Apr 2022 12:55:47 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353429AbiDSOcV (ORCPT + 99 others); Tue, 19 Apr 2022 10:32:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353347AbiDSObv (ORCPT ); Tue, 19 Apr 2022 10:31:51 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B5E6C35A86 for ; Tue, 19 Apr 2022 07:29:08 -0700 (PDT) Date: Tue, 19 Apr 2022 14:29:06 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1650378547; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pmdYZG57UDB3nKmKGQneikiRzLQywHmdFzppNpNTQLM=; b=afZaWc3ZCCuzTZrKEr1aVWbY2FBIq0H/gYfOUd2cdq2uBVB3rKTvYL69+wicoOJY/5ihLr O1fMzQjrEEZfQWr/bWrtGDc+UtCq0w1sMOBoZxUxFcGw33r8lbh8alQUCFpMALw3F+jcvP p/ImS4QS2oHw2Ym7kF1Yi+iRbZvy1Hl/5uqSt2gK7veZfTSpeo2Gky1esJef02iC5miwqr So7aqUdS/oqy7ncB7sXYMc/Cc0D8Pi8tEo3Hhcoq+C7A4k16XdT1cz48bR0IPnOEpqpfG7 52m8bHUzPmlVUl10Y3UenAVuFiAyJK9TdAosNGDUhBup9Tdd4H5ol6oPsclYSw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1650378547; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pmdYZG57UDB3nKmKGQneikiRzLQywHmdFzppNpNTQLM=; b=38ipGL4B3CCkqcmeBktKFlq2VAqmpLS2y02aEUhgJ9R7dwQCLIpqa6RHFlafzS8k/g0Lci LyrcweihDnZ6MGCQ== From: "irqchip-bot for Marc Zyngier" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-kernel@vger.kernel.org Subject: [irqchip: irq/irqchip-next] gpio: Don't fiddle with irqchips marked as immutable Cc: Andy Shevchenko , Bartosz Golaszewski , Marc Zyngier , tglx@linutronix.de In-Reply-To: <20220419141846.598305-2-maz@kernel.org> References: <20220419141846.598305-2-maz@kernel.org> MIME-Version: 1.0 Message-ID: <165037854631.4207.10307653212413379012.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE autolearn=no 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 The following commit has been merged into the irq/irqchip-next branch of irqchip: Commit-ID: 6c846d026d490b2383d395bc8e7b06336219667b Gitweb: https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms/6c846d026d490b2383d395bc8e7b06336219667b Author: Marc Zyngier AuthorDate: Tue, 19 Apr 2022 15:18:37 +01:00 Committer: Marc Zyngier CommitterDate: Tue, 19 Apr 2022 15:22:25 +01:00 gpio: Don't fiddle with irqchips marked as immutable In order to move away from gpiolib messing with the internals of unsuspecting irqchips, add a flag by which irqchips advertise that they are not to be messed with, and do solemnly swear that they correctly call into the gpiolib helpers when required. Also nudge the users into converting their drivers to the new model. Reviewed-by: Andy Shevchenko Reviewed-by: Bartosz Golaszewski Signed-off-by: Marc Zyngier Link: https://lore.kernel.org/r/20220419141846.598305-2-maz@kernel.org --- drivers/gpio/gpiolib.c | 7 ++++++- include/linux/irq.h | 2 ++ kernel/irq/debugfs.c | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index e59884c..48191e6 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -1475,6 +1475,11 @@ static void gpiochip_set_irq_hooks(struct gpio_chip *gc) { struct irq_chip *irqchip = gc->irq.chip; + if (irqchip->flags & IRQCHIP_IMMUTABLE) + return; + + chip_warn(gc, "not an immutable chip, please consider fixing it!\n"); + if (!irqchip->irq_request_resources && !irqchip->irq_release_resources) { irqchip->irq_request_resources = gpiochip_irq_reqres; @@ -1633,7 +1638,7 @@ static void gpiochip_irqchip_remove(struct gpio_chip *gc) irq_domain_remove(gc->irq.domain); } - if (irqchip) { + if (irqchip && !(irqchip->flags & IRQCHIP_IMMUTABLE)) { if (irqchip->irq_request_resources == gpiochip_irq_reqres) { irqchip->irq_request_resources = NULL; irqchip->irq_release_resources = NULL; diff --git a/include/linux/irq.h b/include/linux/irq.h index f92788c..5053082 100644 --- a/include/linux/irq.h +++ b/include/linux/irq.h @@ -569,6 +569,7 @@ struct irq_chip { * IRQCHIP_ENABLE_WAKEUP_ON_SUSPEND: Invokes __enable_irq()/__disable_irq() for wake irqs * in the suspend path if they are in disabled state * IRQCHIP_AFFINITY_PRE_STARTUP: Default affinity update before startup + * IRQCHIP_IMMUTABLE: Don't ever change anything in this chip */ enum { IRQCHIP_SET_TYPE_MASKED = (1 << 0), @@ -582,6 +583,7 @@ enum { IRQCHIP_SUPPORTS_NMI = (1 << 8), IRQCHIP_ENABLE_WAKEUP_ON_SUSPEND = (1 << 9), IRQCHIP_AFFINITY_PRE_STARTUP = (1 << 10), + IRQCHIP_IMMUTABLE = (1 << 11), }; #include diff --git a/kernel/irq/debugfs.c b/kernel/irq/debugfs.c index 2b43f5f..bc8e40c 100644 --- a/kernel/irq/debugfs.c +++ b/kernel/irq/debugfs.c @@ -58,6 +58,7 @@ static const struct irq_bit_descr irqchip_flags[] = { BIT_MASK_DESCR(IRQCHIP_SUPPORTS_LEVEL_MSI), BIT_MASK_DESCR(IRQCHIP_SUPPORTS_NMI), BIT_MASK_DESCR(IRQCHIP_ENABLE_WAKEUP_ON_SUSPEND), + BIT_MASK_DESCR(IRQCHIP_IMMUTABLE), }; static void