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 B035DC433F5 for ; Sat, 26 Feb 2022 10:32:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229455AbiBZKc4 (ORCPT ); Sat, 26 Feb 2022 05:32:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231140AbiBZKcy (ORCPT ); Sat, 26 Feb 2022 05:32:54 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 695D725794C; Sat, 26 Feb 2022 02:32:20 -0800 (PST) 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 ams.source.kernel.org (Postfix) with ESMTPS id D2407B80E9E; Sat, 26 Feb 2022 10:32:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6D2B0C340E8; Sat, 26 Feb 2022 10:32:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1645871537; bh=J/i1dumb0mZxElEmXwi6DbevV9tFlTtn/ahQ4gUjGfM=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=VQ3sc0i4kFjee2QupZiMhQ0MpUFtnztiKVXCqH6ohlwYJO3Y9R0aSnIM7GaMEwKaB f+agBQMCQOA1Q8k89ExF3VN8x+K3f4q/o6pmpuA3iBde2QpfIBnIprRpqNupmUOsHG pijwu7HidrvZ0jjNXU8KI+V7NBsyVsnwcPFmGA3Xanjtaaal3ofgJJUBln54k4xGIt TBNjwan1XrIk1/gCxSmxeckO1J7Wa5kd2vERWoMWpOxoVg/IugU4ThUryaKGgCh2H3 XlKGa1cNeogu0rK+2V2V0Bu2dsMQeJcZkccYQeMlF06supyUhMSafincETd5TtVsq6 hrrp3uGFZE/Cg== Received: from sofa.misterjones.org ([185.219.108.64] helo=billy-the-mountain.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 1nNuN5-00AimC-3q; Sat, 26 Feb 2022 10:32:15 +0000 Date: Sat, 26 Feb 2022 10:32:10 +0000 Message-ID: <877d9h7wb9.wl-maz@kernel.org> From: Marc Zyngier To: Thierry Reding Cc: linux-kernel@vger.kernel.org, Linus Walleij , Bartosz Golaszewski , Joey Gouly , Jonathan Hunter , Hector Martin , Sven Peter , Alyssa Rosenzweig , Bjorn Andersson , Andy Gross , Thomas Gleixner , linux-gpio@vger.kernel.org, linux-tegra@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, kernel-team@android.com Subject: Re: [PATCH 1/5] gpio: Don't fiddle with irqchips marked as immutable In-Reply-To: References: <20220223154405.54912-1-maz@kernel.org> <20220223154405.54912-2-maz@kernel.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 (aarch64-unknown-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: thierry.reding@gmail.com, linux-kernel@vger.kernel.org, linus.walleij@linaro.org, brgl@bgdev.pl, joey.gouly@arm.com, jonathanh@nvidia.com, marcan@marcan.st, sven@svenpeter.dev, alyssa@rosenzweig.io, bjorn.andersson@linaro.org, agross@kernel.org, tglx@linutronix.de, linux-gpio@vger.kernel.org, linux-tegra@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, kernel-team@android.com 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-gpio@vger.kernel.org On Thu, 24 Feb 2022 16:51:41 +0000, Thierry Reding wrote: > > On Wed, Feb 23, 2022 at 03:44:01PM +0000, Marc Zyngier wrote: > > 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 wueh required. > > > > Signed-off-by: Marc Zyngier > > --- > > drivers/gpio/gpiolib.c | 7 ++++++- > > include/linux/irq.h | 2 ++ > > kernel/irq/debugfs.c | 1 + > > 3 files changed, 9 insertions(+), 1 deletion(-) > > I kind of like this. The bit where the const cast is essentially guarded > by an "immutable" flag is a bit funky, but it doesn't look like there is > a good way to do it by making all references const without doing a huge > all-at-once conversion. Exactly. Somehow, we need to advertise it to the gpiolib code, and this does the job. I hope to be able to simply drop it once everthing is converted. One day. > I've always found it a bit irritating that irq_chip was somewhere > between a container for chip-specific data and an "ops" structure. I > think it'd be even nicer if this was split into an extra struct > irq_chip_ops, which could then always be const and a struct irq_chip > that contained primarily chip-specific data as well as a pointer to > struct irq_chip_ops. But that's the thing: it almost is a pure 'ops' structure. Only two things are getting in the way of it: - the 'parent_dev' field: this is now sorted, as I moved it to the irq_domain structure, and updated all the relevant drivers (see what is currently in -next). - the .name field: it really should never be something that changes from one instance of the chip to another. Which is why we have the .irq_print_chip() method to handle that (and ideally we'd stick to pure const names). I'm addressing this as I go, but everything in drivers/irqchip/ should be fixed in -next. The "context" part really lives in irq_domain. > But again, this seems fairly tricky to pull off given all the > interdependencies and we can iterate on this in the future, so this > seems like a good enough compromise: > > Acked-by: Thierry Reding Thanks, M. -- Without deviation from the norm, progress is not possible.