[PATCH 3/5] irqchip: Constify some direct access to irq_data->chip

Christophe JAILLET
2024-11-17T09:50:11Z

When the 'chip' member of struct irq_data will be turned into a const
struct irq_chip, the const qualifier will be needed for local variables
that keep a reference to this field.

So start to add some of these const qualifiers.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
Compile tested only
---
kernel/irq/chip.c | 8 ++++----
kernel/irq/debugfs.c | 2 +-
kernel/irq/manage.c | 10 +++++-----
kernel/irq/migration.c | 2 +-
4 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
index 502133dc3b9c..eca39c4dd094 100644
--- a/kernel/irq/chip.c
+++ b/kernel/irq/chip.c
@@ -442,7 +442,7 @@ void unmask_irq(struct irq_desc *desc)

void unmask_threaded_irq(struct irq_desc *desc)
{
- struct irq_chip *chip = desc->irq_data.chip;
+ const struct irq_chip *chip = desc->irq_data.chip;

if (chip->flags & IRQCHIP_EOI_THREADED)
chip->irq_eoi(&desc->irq_data);
@@ -687,7 +687,7 @@ static void cond_unmask_eoi_irq(struct irq_desc *desc,
*/
void handle_fasteoi_irq(struct irq_desc *desc)
{
- struct irq_chip *chip = desc->irq_data.chip;
+ const struct irq_chip *chip = desc->irq_data.chip;

raw_spin_lock(&desc->lock);

@@ -1212,7 +1212,7 @@ void irq_cpu_offline(void)
*/
void handle_fasteoi_ack_irq(struct irq_desc *desc)
{
- struct irq_chip *chip = desc->irq_data.chip;
+ const struct irq_chip *chip = desc->irq_data.chip;

raw_spin_lock(&desc->lock);

@@ -1263,7 +1263,7 @@ EXPORT_SYMBOL_GPL(handle_fasteoi_ack_irq);
*/
void handle_fasteoi_mask_irq(struct irq_desc *desc)
{
- struct irq_chip *chip = desc->irq_data.chip;
+ const struct irq_chip *chip = desc->irq_data.chip;

raw_spin_lock(&desc->lock);
mask_ack_irq(desc);
diff --git a/kernel/irq/debugfs.c b/kernel/irq/debugfs.c
index c6ffb97966be..c9c1c28be1a9 100644
--- a/kernel/irq/debugfs.c
+++ b/kernel/irq/debugfs.c
@@ -58,7 +58,7 @@ static const struct irq_bit_descr irqchip_flags[] = {
static void
irq_debug_show_chip(struct seq_file *m, struct irq_data *data, int ind)
{
- struct irq_chip *chip = data->chip;
+ const struct irq_chip *chip = data->chip;

if (!chip) {
seq_printf(m, "chip: None\n");
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index f0803d6bd296..e7f548bc976b 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -958,7 +958,7 @@ int can_request_irq(unsigned int irq, unsigned long irqflags)

int __irq_set_trigger(struct irq_desc *desc, unsigned long flags)
{
- struct irq_chip *chip = desc->irq_data.chip;
+ const struct irq_chip *chip = desc->irq_data.chip;
int ret, unmask = 0;

if (!chip || !chip->irq_set_type) {
@@ -1407,7 +1407,7 @@ static int irq_setup_forced_threading(struct irqaction *new)
static int irq_request_resources(struct irq_desc *desc)
{
struct irq_data *d = &desc->irq_data;
- struct irq_chip *c = d->chip;
+ const struct irq_chip *c = d->chip;

return c->irq_request_resources ? c->irq_request_resources(d) : 0;
}
@@ -1415,7 +1415,7 @@ static int irq_request_resources(struct irq_desc *desc)
static void irq_release_resources(struct irq_desc *desc)
{
struct irq_data *d = &desc->irq_data;
- struct irq_chip *c = d->chip;
+ const struct irq_chip *c = d->chip;

if (c->irq_release_resources)
c->irq_release_resources(d);
@@ -1440,7 +1440,7 @@ static bool irq_supports_nmi(struct irq_desc *desc)
static int irq_nmi_setup(struct irq_desc *desc)
{
struct irq_data *d = irq_desc_get_irq_data(desc);
- struct irq_chip *c = d->chip;
+ const struct irq_chip *c = d->chip;

return c->irq_nmi_setup ? c->irq_nmi_setup(d) : -EINVAL;
}
@@ -1448,7 +1448,7 @@ static int irq_nmi_setup(struct irq_desc *desc)
static void irq_nmi_teardown(struct irq_desc *desc)
{
struct irq_data *d = irq_desc_get_irq_data(desc);
- struct irq_chip *c = d->chip;
+ const struct irq_chip *c = d->chip;

if (c->irq_nmi_teardown)
c->irq_nmi_teardown(d);
diff --git a/kernel/irq/migration.c b/kernel/irq/migration.c
index eb150afd671f..fff2d9cd0239 100644
--- a/kernel/irq/migration.c
+++ b/kernel/irq/migration.c
@@ -39,7 +39,7 @@ void irq_move_masked_irq(struct irq_data *idata)
{
struct irq_desc *desc = irq_data_to_desc(idata);
struct irq_data *data = &desc->irq_data;
- struct irq_chip *chip = data->chip;
+ const struct irq_chip *chip = data->chip;

if (likely(!irqd_is_setaffinity_pending(data)))
return;
--
2.47.0