Message ID | 20230214073638.571417-1-alexander.stein@ew.tq-group.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2823564wrn; Mon, 13 Feb 2023 23:45:28 -0800 (PST) X-Google-Smtp-Source: AK7set/aTgXUFVcovSgtooMI1ztQg0dTvibGs9cRCDQAKT28ojW2QT3+1WojJ4D7KAaAeFsk1PTp X-Received: by 2002:a05:6a20:3952:b0:be:df22:96ca with SMTP id r18-20020a056a20395200b000bedf2296camr1658434pzg.25.1676360728006; Mon, 13 Feb 2023 23:45:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676360727; cv=none; d=google.com; s=arc-20160816; b=PqPfVTqy/KS9Tpsg1tIw6q/fTjceI7PMCKfvK4KL8nPmggbJQzpozQmW1CMFBX6pUl vNiGMSSAAehDcTePjURCaxp/C/tgQ7XEPhapAMSQjZ3pgdGOW099ZV4zlOHBMfkW759B vUEUIA0zE7GjETHjR1jfjpi4YvKHh/h/GxSm+sLy5UNugdNY8mZJeLEV3KdFn8pf8sfF QAZ9pieeV5xjqJV52+PnHAsKkd28hg7AQD3aiduqoV8cMzooAX5MTJ1x4QWPnr3qrEDc LKOxdbYmuY3uQDi1TzQRE7M9SYj/NJ1nvV0Fdb0r+VHlE+GppZEggvuheIq0bVVxXC8M EGVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature:dkim-signature; bh=q0jRgzfjk88MLjnmkmWogHFXwiLWrycu/Mr0YbBtyho=; b=T8SwFwhJH5VIDPxCKZr3/rstKpcJKxxOH6RivU+7dpY4hJ7o07xcTFzkh3oSeaY97O dTGT6lJdb54P72mgIxLhQpfwXtN7AklKDk0z1mUPRk9E3g2r8Tr1xItgI6nRm187EBhA B/E9H0LOz2S7V8YYe8SeYsAndJHB6r1l8W1Dd7gha/ENLFAJb0oig8HAVyOr1+YzHWZH NOYxkcxtMZzCcKPENEz4w0a1JDVuyqdKgmGapyoccTX8OGH6DVb0mJ2gLPA9hU8/ddRj qvjr29bPusDrGLW8apa7fvSYnBfIODuJhRlybDw6EixTnjzpu8Ymm0XbD8Ft3sLfmjwz 4hPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tq-group.com header.s=key1 header.b=mF7DButA; dkim=pass header.i=@tq-group.com header.s=key1 header.b=Bwct2luZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=tq-group.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l6-20020a63be06000000b004a192e25448si14038076pgf.723.2023.02.13.23.45.14; Mon, 13 Feb 2023 23:45:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@tq-group.com header.s=key1 header.b=mF7DButA; dkim=pass header.i=@tq-group.com header.s=key1 header.b=Bwct2luZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=tq-group.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229731AbjBNHgt (ORCPT <rfc822;tebrre53rla2o@gmail.com> + 99 others); Tue, 14 Feb 2023 02:36:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42168 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229591AbjBNHgs (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 14 Feb 2023 02:36:48 -0500 Received: from mx1.tq-group.com (mx1.tq-group.com [93.104.207.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D3B8E12F32; Mon, 13 Feb 2023 23:36:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1676360205; x=1707896205; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=q0jRgzfjk88MLjnmkmWogHFXwiLWrycu/Mr0YbBtyho=; b=mF7DButAltO0ZREyFfrdeUo27xIgY+yXFkrk0DY05Yx2hpAaUlLQtWMS pVjCqXr1K+04c9gsmDr8/9mZHgSvWS9IC6XHzDyqPjq8li4zUcw871hDg vwz5/rYIb2wgtunejJgkoIokGpoHNFFjxtiu52uCL6QAy87Nm0fZgmqnM x0E8tsGqEuMv32qr9Tm+z8iPw/PTIC31BhaICGHoGsp+lVAx+8b3uIs4l a9fPgztxzeMwKm3NlRXr5IvfxFaiyfsTtBKr5edck2EG4ZajcSyO/2Vef IX8NIFieesBxwda6qL5oHShZ6gCycB+ACo7OwGg67reO87JxgT8wLxWju A==; X-IronPort-AV: E=Sophos;i="5.97,296,1669071600"; d="scan'208";a="29060373" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 14 Feb 2023 08:36:42 +0100 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Tue, 14 Feb 2023 08:36:42 +0100 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Tue, 14 Feb 2023 08:36:42 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1676360202; x=1707896202; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=q0jRgzfjk88MLjnmkmWogHFXwiLWrycu/Mr0YbBtyho=; b=Bwct2luZmtOPBOlF8NVpMfPvMHfdUGir7tNGyPvsadQe4QPduE4uqEYv Zca4QDO0aBjflovemjR7GUA9HHBJZbBilTgMO3ThS3TbAU7qRaPbkLMXO rHUtGg4bNq2wUCKlL2MAjGobo5kuUGrn5xKBo3NXKsYKnDiP1B1vJ5cIN psDxKyW6hBss7uDoCLvSIzT+vVnze+5qB0XK3L+aYwYMUObkNvh9zK0r+ iSmPvGD0LlImAjxOvVOsCvu0OyyDdDmYcpYJCPWzeIJgdq2kyWsSYnbXw 6auN3Wfjk9PEelYYn+29QPOunP4MpwwY0lwLdb5VSgNgxVEmdcBCNsAt6 w==; X-IronPort-AV: E=Sophos;i="5.97,296,1669071600"; d="scan'208";a="29060372" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 14 Feb 2023 08:36:42 +0100 Received: from steina-w.tq-net.de (unknown [10.123.53.21]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by vtuxmail01.tq-net.de (Postfix) with ESMTPSA id 3CD95280056; Tue, 14 Feb 2023 08:36:42 +0100 (CET) From: Alexander Stein <alexander.stein@ew.tq-group.com> To: Linus Walleij <linus.walleij@linaro.org>, Bartosz Golaszewski <brgl@bgdev.pl>, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Alexander Stein <alexander.stein@ew.tq-group.com> Subject: [PATCH 1/1] gpio: vf610: make irq_chip immutable Date: Tue, 14 Feb 2023 08:36:38 +0100 Message-Id: <20230214073638.571417-1-alexander.stein@ew.tq-group.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757791626272936114?= X-GMAIL-MSGID: =?utf-8?q?1757791626272936114?= |
Series |
[1/1] gpio: vf610: make irq_chip immutable
|
|
Commit Message
Alexander Stein
Feb. 14, 2023, 7:36 a.m. UTC
Since recently, the kernel is nagging about mutable irq_chips:
"not an immutable chip, please consider fixing it!"
Drop the unneeded copy, flag it as IRQCHIP_IMMUTABLE, add the new
helper functions and call the appropriate gpiolib functions.
Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
---
The overall changes are based on commit f1138dacb7ff
("gpio: sch: make irq_chip immutable")
drivers/gpio/gpio-vf610.c | 23 ++++++++++++-----------
1 file changed, 12 insertions(+), 11 deletions(-)
Comments
Tue, Feb 14, 2023 at 08:36:38AM +0100, Alexander Stein kirjoitti: > Since recently, the kernel is nagging about mutable irq_chips: > > "not an immutable chip, please consider fixing it!" > > Drop the unneeded copy, flag it as IRQCHIP_IMMUTABLE, add the new > helper functions and call the appropriate gpiolib functions. ... > The overall changes are based on commit f1138dacb7ff > ("gpio: sch: make irq_chip immutable") Nice, but you forgot one crucial detail. You need to mark GPIO resuested whenever it's locked as IRQ and otherwise when unlocked.
On Tue, Feb 14, 2023 at 11:52 AM <andy.shevchenko@gmail.com> wrote: > Tue, Feb 14, 2023 at 08:36:38AM +0100, Alexander Stein kirjoitti: > > Since recently, the kernel is nagging about mutable irq_chips: > > > > "not an immutable chip, please consider fixing it!" > > > > Drop the unneeded copy, flag it as IRQCHIP_IMMUTABLE, add the new > > helper functions and call the appropriate gpiolib functions. > > ... > > > The overall changes are based on commit f1138dacb7ff > > ("gpio: sch: make irq_chip immutable") > > Nice, but you forgot one crucial detail. You need to mark GPIO resuested > whenever it's locked as IRQ and otherwise when unlocked. +static const struct irq_chip vf610_irqchip = { (...) + GPIOCHIP_IRQ_RESOURCE_HELPERS, That's what this macro does ;) Yours, Linus Walleij
On Tue, Feb 14, 2023 at 8:36 AM Alexander Stein <alexander.stein@ew.tq-group.com> wrote: > Since recently, the kernel is nagging about mutable irq_chips: > > "not an immutable chip, please consider fixing it!" > > Drop the unneeded copy, flag it as IRQCHIP_IMMUTABLE, add the new > helper functions and call the appropriate gpiolib functions. > > Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com> Looks good to me, CC to Marc Z. Reviewed-by: Linus Walleij <linus.walleij@linaro.org> We fixed quite a few of these now, Marc do you have an idea about how much we have left until we can make immutable the default? Yours, Linus Walleij
Am Mittwoch, 15. Februar 2023, 11:18:06 CET schrieb Linus Walleij: > On Tue, Feb 14, 2023 at 11:52 AM <andy.shevchenko@gmail.com> wrote: > > Tue, Feb 14, 2023 at 08:36:38AM +0100, Alexander Stein kirjoitti: > > > Since recently, the kernel is nagging about mutable irq_chips: > > > "not an immutable chip, please consider fixing it!" > > > > > > Drop the unneeded copy, flag it as IRQCHIP_IMMUTABLE, add the new > > > helper functions and call the appropriate gpiolib functions. > > > > ... > > > > > The overall changes are based on commit f1138dacb7ff > > > ("gpio: sch: make irq_chip immutable") > > > > Nice, but you forgot one crucial detail. You need to mark GPIO resuested > > whenever it's locked as IRQ and otherwise when unlocked. > > +static const struct irq_chip vf610_irqchip = { > (...) > + GPIOCHIP_IRQ_RESOURCE_HELPERS, > > That's what this macro does ;) Does this mean the calls to gpiochip_disable_irq/gpiochip_enable_irq in v2/v3 are not necessary? Best regards, Alexander > Yours, > Linus Walleij
On Wed, 15 Feb 2023 10:19:28 +0000, Linus Walleij <linus.walleij@linaro.org> wrote: > > On Tue, Feb 14, 2023 at 8:36 AM Alexander Stein > <alexander.stein@ew.tq-group.com> wrote: > > > Since recently, the kernel is nagging about mutable irq_chips: > > > > "not an immutable chip, please consider fixing it!" > > > > Drop the unneeded copy, flag it as IRQCHIP_IMMUTABLE, add the new > > helper functions and call the appropriate gpiolib functions. > > > > Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com> > > Looks good to me, CC to Marc Z. Looks wrong to me. This is missing the explicit callbacks into gpiolib so that it knows what gets enabled/disabled on mask/unmask. > > Reviewed-by: Linus Walleij <linus.walleij@linaro.org> > > We fixed quite a few of these now, Marc do you have an idea about > how much we have left until we can make immutable the default? I haven't tracked that, and making it the default would probably mean getting rid of the code that patches the irqchip structures. I'd say that once -rc1 is out, we replace the polite nag with something nastier (WARN_ON() of some sort), and push that into -next. Leave the warning in place for a couple of releases (until the next LTS), and then drop the patching code. The not-so-nice part is that that drivers that haven't been fixed will break silently. The good side is that these drivers will not have been touched over 2 LTS releases, and are thus most likely abandonware. Thanks, M.
On Wed, Feb 15, 2023 at 12:09 PM Alexander Stein <alexander.stein@ew.tq-group.com> wrote: > Am Mittwoch, 15. Februar 2023, 11:18:06 CET schrieb Linus Walleij: > > On Tue, Feb 14, 2023 at 11:52 AM <andy.shevchenko@gmail.com> wrote: > > > Tue, Feb 14, 2023 at 08:36:38AM +0100, Alexander Stein kirjoitti: > > > > Since recently, the kernel is nagging about mutable irq_chips: > > > > "not an immutable chip, please consider fixing it!" > > > > > > > > Drop the unneeded copy, flag it as IRQCHIP_IMMUTABLE, add the new > > > > helper functions and call the appropriate gpiolib functions. > > > > > > ... > > > > > > > The overall changes are based on commit f1138dacb7ff > > > > ("gpio: sch: make irq_chip immutable") > > > > > > Nice, but you forgot one crucial detail. You need to mark GPIO resuested > > > whenever it's locked as IRQ and otherwise when unlocked. > > > > +static const struct irq_chip vf610_irqchip = { > > (...) > > + GPIOCHIP_IRQ_RESOURCE_HELPERS, > > > > That's what this macro does ;) > > Does this mean the calls to gpiochip_disable_irq/gpiochip_enable_irq in v2/v3 > are not necessary? No I guess I just misunderstood Andy's comments about "mark GPIO requested". The callbacks to gpiolib are needed just like pointed out by Marc Z in his answer, these callbacks are indeed needed. Yours, Linus Walleij
On Wed, Feb 15, 2023 at 12:16 PM Marc Zyngier <maz@kernel.org> wrote: > > We fixed quite a few of these now, Marc do you have an idea about > > how much we have left until we can make immutable the default? > > I haven't tracked that, and making it the default would probably mean > getting rid of the code that patches the irqchip structures. I'd say > that once -rc1 is out, we replace the polite nag with something > nastier (WARN_ON() of some sort), and push that into -next. > > Leave the warning in place for a couple of releases (until the next > LTS), and then drop the patching code. The not-so-nice part is that > that drivers that haven't been fixed will break silently. The good > side is that these drivers will not have been touched over 2 LTS > releases, and are thus most likely abandonware. Hmmm I will take a round and fix some more that are simple and obvious, I know some that are definitely used but just sees low attention from users. Yours, Linus Walleij
On Wed, Feb 15, 2023 at 12:18 PM Linus Walleij <linus.walleij@linaro.org> wrote: > On Tue, Feb 14, 2023 at 11:52 AM <andy.shevchenko@gmail.com> wrote: > > Tue, Feb 14, 2023 at 08:36:38AM +0100, Alexander Stein kirjoitti: > > > Since recently, the kernel is nagging about mutable irq_chips: > > > > > > "not an immutable chip, please consider fixing it!" > > > > > > Drop the unneeded copy, flag it as IRQCHIP_IMMUTABLE, add the new > > > helper functions and call the appropriate gpiolib functions. > > > > ... > > > > > The overall changes are based on commit f1138dacb7ff > > > ("gpio: sch: make irq_chip immutable") > > > > Nice, but you forgot one crucial detail. You need to mark GPIO resuested > > whenever it's locked as IRQ and otherwise when unlocked. > > +static const struct irq_chip vf610_irqchip = { > (...) > + GPIOCHIP_IRQ_RESOURCE_HELPERS, > > That's what this macro does ;) Maybe I was unclear, but I meant that the above mentioned macro requires to have the helpers to be called to enable the GPIO line.
diff --git a/drivers/gpio/gpio-vf610.c b/drivers/gpio/gpio-vf610.c index a429176673e7..e63ca8c85bec 100644 --- a/drivers/gpio/gpio-vf610.c +++ b/drivers/gpio/gpio-vf610.c @@ -30,7 +30,6 @@ struct fsl_gpio_soc_data { struct vf610_gpio_port { struct gpio_chip gc; - struct irq_chip ic; void __iomem *base; void __iomem *gpio_base; const struct fsl_gpio_soc_data *sdata; @@ -237,6 +236,17 @@ static int vf610_gpio_irq_set_wake(struct irq_data *d, u32 enable) return 0; } +static const struct irq_chip vf610_irqchip = { + .name = "gpio-vf610", + .irq_ack = vf610_gpio_irq_ack, + .irq_mask = vf610_gpio_irq_mask, + .irq_unmask = vf610_gpio_irq_unmask, + .irq_set_type = vf610_gpio_irq_set_type, + .irq_set_wake = vf610_gpio_irq_set_wake, + .flags = IRQCHIP_IMMUTABLE, + GPIOCHIP_IRQ_RESOURCE_HELPERS, +}; + static void vf610_gpio_disable_clk(void *data) { clk_disable_unprepare(data); @@ -249,7 +259,6 @@ static int vf610_gpio_probe(struct platform_device *pdev) struct vf610_gpio_port *port; struct gpio_chip *gc; struct gpio_irq_chip *girq; - struct irq_chip *ic; int i; int ret; @@ -315,14 +324,6 @@ static int vf610_gpio_probe(struct platform_device *pdev) gc->direction_output = vf610_gpio_direction_output; gc->set = vf610_gpio_set; - ic = &port->ic; - ic->name = "gpio-vf610"; - ic->irq_ack = vf610_gpio_irq_ack; - ic->irq_mask = vf610_gpio_irq_mask; - ic->irq_unmask = vf610_gpio_irq_unmask; - ic->irq_set_type = vf610_gpio_irq_set_type; - ic->irq_set_wake = vf610_gpio_irq_set_wake; - /* Mask all GPIO interrupts */ for (i = 0; i < gc->ngpio; i++) vf610_gpio_writel(0, port->base + PORT_PCR(i)); @@ -331,7 +332,7 @@ static int vf610_gpio_probe(struct platform_device *pdev) vf610_gpio_writel(~0, port->base + PORT_ISFR); girq = &gc->irq; - girq->chip = ic; + gpio_irq_chip_set_chip(girq, &vf610_irqchip); girq->parent_handler = vf610_gpio_irq_handler; girq->num_parents = 1; girq->parents = devm_kcalloc(&pdev->dev, 1,