From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
To: tglx@linutronix.de
Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Subject: [PATCH 0/5] Initial steps to constify irq_chip
Date: Sun, 17 Nov 2024 10:49:42 +0100 [thread overview]
Message-ID: <cover.1731835733.git.christophe.jaillet@wanadoo.fr> (raw)
struct irq_chip holds many function pointers and so, is a good
candidate for constification.
Some steps to constify these structures have already been done in 2022
with commit 393e1280f765 ("genirq: Allow irq_chip registration functions
to take a const irq_chip") and ef6e5d61eb7a ("genirq: Allow
irq_set_chip_handler_name_locked() to take a const irq_chip")
However these commits introduce some ugly casting to store some const
parameters into non-const struct members. [1] [2]
The goal of this serie is to try to go further, and eventually cleanly
constify irq_chip. As a consequence, it will increase the overall
security, because of the constification of some function pointers.
Based on elixir, it is referenced in 565 files. [3]
So, the road looks long because this structure is used in many places.
It will need to constify the return value of irq_get_chip(),
irq_data_get_irq_chip() and irq_desc_get_chip() which are widely used.
It is expected that many other functions may need to be tweaked in order
to propagate this const qualifier where needed in call chains.
So, let start somewhere and see how far we can go :)
patch 1 and 2 only update the prototypes of some functions and should be
straightforward.
The 3 other patches update some variable declaration in kernel/irq/
I have split the patches according to the way a reference to a struct
irq_chip is gotten.
This serie may be invasive and touch many places to get rid of the ugly
castings, but as least patch 1 and 2 should IMHO be merged because they
are simple and go in the right direction.
The 3 other ones, and all the oher ones that will be needed, may not
need the effort.
Before going further, feedback is aoppreciated
CJ
[1]: https://elixir.bootlin.com/linux/v6.12-rc7/source/kernel/irq/chip.c#L49
[2]: https://elixir.bootlin.com/linux/v6.12-rc7/source/include/linux/irqdesc.h#L236
[3]: https://elixir.bootlin.com/linux/v6.12-rc7/A/ident/irq_chip
Christophe JAILLET (5):
irqchip: Constify "struct irq_chip *" parameter in chained_irq_xxx()
functions
irqchip: Constify "struct irq_chip *" parameter in
cond_unmask_eoi_irq()
irqchip: Constify some direct access to irq_data->chip
irqchip: Constify some irq_desc_get_chip() usage
irqchip: Constify some irq_data_get_irq_chip() usage
include/linux/irqchip/chained_irq.h | 4 ++--
kernel/irq/chip.c | 25 +++++++++++++------------
kernel/irq/cpuhotplug.c | 2 +-
kernel/irq/debugfs.c | 2 +-
kernel/irq/manage.c | 20 ++++++++++----------
kernel/irq/migration.c | 2 +-
6 files changed, 28 insertions(+), 27 deletions(-)
--
2.47.0
next reply other threads:[~2024-11-17 9:50 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-17 9:49 Christophe JAILLET [this message]
2024-11-17 9:49 ` [PATCH 1/5] irqchip: Constify "struct irq_chip *" parameter in chained_irq_xxx() functions Christophe JAILLET
2024-11-17 9:49 ` [PATCH 2/5] irqchip: Constify "struct irq_chip *" parameter in cond_unmask_eoi_irq() Christophe JAILLET
2024-11-17 9:49 ` [PATCH 3/5] irqchip: Constify some direct access to irq_data->chip Christophe JAILLET
2024-11-17 9:49 ` [PATCH 4/5] irqchip: Constify some irq_desc_get_chip() usage Christophe JAILLET
2024-12-03 11:32 ` Thomas Gleixner
2024-11-17 9:49 ` [PATCH 5/5] irqchip: Constify some irq_data_get_irq_chip() usage Christophe JAILLET
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=cover.1731835733.git.christophe.jaillet@wanadoo.fr \
--to=christophe.jaillet@wanadoo.fr \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tglx@linutronix.de \
/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