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 8F8EEC433FE for ; Wed, 4 May 2022 11:35:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348950AbiEDLjT (ORCPT ); Wed, 4 May 2022 07:39:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49310 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349053AbiEDLjN (ORCPT ); Wed, 4 May 2022 07:39:13 -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 80D8C222A6; Wed, 4 May 2022 04:35:38 -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 1F48260F3A; Wed, 4 May 2022 11:35:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 81CB5C385A5; Wed, 4 May 2022 11:35:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1651664137; bh=PNar57YQTdXYctK0mUGX69cvLoEWngboH5a6JZfKJJ4=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=ZUY4ELDpxMlUefSXe2ZWF/ksNzztdd1YP8zKO2WPLQgybsuR4oCA0T/MKXHb1rqOs MzIZoSHarevXW1OzkCOFF/vahbGqmEzEcsObA1Xw94XGCAq/DD5howrBcCvLbyMUXs rskpPoMLr2qlHpLoBl3bwHo2H9XQqNVabl6YcXbyDXYn1nYO0j9uS7JVGJcLjnsY1K PMdyHB7dtfUZn7U9OAqCOglX3WTIVuIug00isGlHBt61B8kPQV45Y1IaEM5EdzXvTO fGmDSvIQ6CcT+98AbNNvJRldk2M0s8MrfCeqQh8p07wg/y0uEALwBajv8S3ZwWzI39 kuX/Cj0S4dcrw== 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 1nmDI6-008t0G-T4; Wed, 04 May 2022 12:35:35 +0100 Date: Wed, 04 May 2022 12:35:34 +0100 Message-ID: <877d718r95.wl-maz@kernel.org> From: Marc Zyngier To: Jon Hunter Cc: Linus Walleij , Bartosz Golaszewski , , , Subject: Re: [PATCH] gpio: max77620: Make the irqchip immutable In-Reply-To: <20220504111936.8412-1-jonathanh@nvidia.com> References: <20220504111936.8412-1-jonathanh@nvidia.com> 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: jonathanh@nvidia.com, linus.walleij@linaro.org, brgl@bgdev.pl, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-tegra@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 Precedence: bulk List-ID: X-Mailing-List: linux-tegra@vger.kernel.org Hi Jon, On Wed, 04 May 2022 12:19:36 +0100, Jon Hunter wrote: > > Commit 6c846d026d49 ("gpio: Don't fiddle with irqchips marked as > immutable") added a warning to indicate if the gpiolib is altering the > internals of irqchips. Following this change the following warning is > now observed for the max77620 gpio driver ... > > WARNING KERN gpio gpiochip0: (max77620-gpio): not an immutable chip, > please consider fixing it! > > Fix the above warning by making the max77620 gpio driver immutable. Thanks for looking into this. Comments below. > > Signed-off-by: Jon Hunter > --- > This warning is observed with v5.18-rc5 and so it would be great if > we can fix for v5.18. This is triggering a kernel warning test failure > on one of our platforms. I'm surprised. This is definitely *not* 5.18 material, and I can't see the patches in Linus' tree. Are you sure you're not running -next instead? > > drivers/gpio/gpio-max77620.c | 15 ++++++++++++--- > 1 file changed, 12 insertions(+), 3 deletions(-) > > diff --git a/drivers/gpio/gpio-max77620.c b/drivers/gpio/gpio-max77620.c > index ebf9dea6546b..aa92658780d6 100644 > --- a/drivers/gpio/gpio-max77620.c > +++ b/drivers/gpio/gpio-max77620.c > @@ -119,14 +119,23 @@ static void max77620_gpio_bus_sync_unlock(struct irq_data *data) > mutex_unlock(&gpio->buslock); > } > > -static struct irq_chip max77620_gpio_irqchip = { > +static void max77620_gpio_irq_print_chip(struct irq_data *data, struct seq_file *p) > +{ > + struct gpio_chip *gc = irq_data_get_irq_chip_data(data); > + > + seq_printf(p, dev_name(gc->parent)); > +} > + I'd rather you don't do this. This was added as a band-aid for drivers that display a device-specific string in /proc/interrupts, and that we cannot fix because the string is in effect an ABI. Here, you're going in the opposite direction (making the name device-specific while it was constant so far). This has the same ABI-breaking effect, and we shouldn't do that. It is also rather pointless, as we already have all the required debugging information in debugfs (and I assume that this is the reason this is added). > +static const struct irq_chip max77620_gpio_irqchip = { > .name = "max77620-gpio", > .irq_mask = max77620_gpio_irq_mask, > .irq_unmask = max77620_gpio_irq_unmask, You seem to be missing the updates for these two functions. Please see the updated documentation in commit 5644b66a9c63 ("Documentation: Update the recommended pattern for GPIO irqchips"). > .irq_set_type = max77620_gpio_set_irq_type, > .irq_bus_lock = max77620_gpio_bus_lock, > .irq_bus_sync_unlock = max77620_gpio_bus_sync_unlock, > - .flags = IRQCHIP_MASK_ON_SUSPEND, > + .irq_print_chip = max77620_gpio_irq_print_chip, > + .flags = IRQCHIP_IMMUTABLE | IRQCHIP_MASK_ON_SUSPEND, > + GPIOCHIP_IRQ_RESOURCE_HELPERS, > }; > > static int max77620_gpio_dir_input(struct gpio_chip *gc, unsigned int offset) > @@ -318,7 +327,7 @@ static int max77620_gpio_probe(struct platform_device *pdev) > mgpio->gpio_chip.base = -1; > > girq = &mgpio->gpio_chip.irq; > - girq->chip = &max77620_gpio_irqchip; > + gpio_irq_chip_set_chip(girq, &max77620_gpio_irqchip); > /* This will let us handle the parent IRQ in the driver */ > girq->parent_handler = NULL; > girq->num_parents = 0; > -- > 2.25.1 > > Thanks, M. -- Without deviation from the norm, progress is not possible.