linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marc Zyngier <maz@kernel.org>
To: Thierry Reding <thierry.reding@gmail.com>
Cc: linux-kernel@vger.kernel.org,
	Linus Walleij <linus.walleij@linaro.org>,
	Bartosz Golaszewski <brgl@bgdev.pl>,
	Joey Gouly <joey.gouly@arm.com>,
	Jonathan Hunter <jonathanh@nvidia.com>,
	Hector Martin <marcan@marcan.st>, Sven Peter <sven@svenpeter.dev>,
	Alyssa Rosenzweig <alyssa@rosenzweig.io>,
	Bjorn Andersson <bjorn.andersson@linaro.org>,
	Andy Gross <agross@kernel.org>,
	Thomas Gleixner <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
Subject: Re: [PATCH 1/5] gpio: Don't fiddle with irqchips marked as immutable
Date: Sat, 26 Feb 2022 10:32:10 +0000	[thread overview]
Message-ID: <877d9h7wb9.wl-maz@kernel.org> (raw)
In-Reply-To: <Yhe3neSJbAxRbt+Z@orome>

On Thu, 24 Feb 2022 16:51:41 +0000,
Thierry Reding <thierry.reding@gmail.com> 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 <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(-)
> 
> 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 <treding@nvidia.com>

Thanks,

	M.

-- 
Without deviation from the norm, progress is not possible.

  reply	other threads:[~2022-02-26 10:32 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-23 15:44 [PATCH 0/5] gpiolib: Handle immutable irq_chip structures Marc Zyngier
2022-02-23 15:44 ` [PATCH 1/5] gpio: Don't fiddle with irqchips marked as immutable Marc Zyngier
2022-02-23 17:48   ` Jeffrey Hugo
2022-02-23 18:14     ` Marc Zyngier
2022-02-24 16:51   ` Thierry Reding
2022-02-26 10:32     ` Marc Zyngier [this message]
2022-02-23 15:44 ` [PATCH 2/5] gpio: Expose the gpiochip_irq_re[ql]res helpers Marc Zyngier
2022-02-23 15:44 ` [PATCH 3/5] pinctrl: apple-gpio: Make the irqchip immutable Marc Zyngier
2022-02-23 15:44 ` [PATCH 4/5] pinctrl: msmgpio: " Marc Zyngier
2022-02-23 15:44 ` [PATCH 5/5] gpio: tegra186: " Marc Zyngier
2022-02-24 16:40 ` [PATCH 0/5] gpiolib: Handle immutable irq_chip structures Thierry Reding
2022-02-24 17:42   ` Marc Zyngier
2022-03-04 17:19     ` Marc Zyngier
2022-03-15  0:44 ` Linus Walleij
2022-03-15  9:35   ` Marc Zyngier
2022-03-24 22:30     ` Linus Walleij

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=877d9h7wb9.wl-maz@kernel.org \
    --to=maz@kernel.org \
    --cc=agross@kernel.org \
    --cc=alyssa@rosenzweig.io \
    --cc=bjorn.andersson@linaro.org \
    --cc=brgl@bgdev.pl \
    --cc=joey.gouly@arm.com \
    --cc=jonathanh@nvidia.com \
    --cc=kernel-team@android.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=marcan@marcan.st \
    --cc=sven@svenpeter.dev \
    --cc=tglx@linutronix.de \
    --cc=thierry.reding@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).