lkml.org 
[lkml]   [2022]   [Feb]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/5] gpio: Don't fiddle with irqchips marked as immutable
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.

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 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>
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2022-02-24 17:52    [W:0.165 / U:0.092 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site