[PATCH 5/5] irqchip: Constify some irq_data_get_irq_chip() usage

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

When irq_data_get_irq_chip() will return a const struct irq_chip, the const
qualifier will be needed for local variables that store the return value of
this function.

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 | 4 ++--
kernel/irq/cpuhotplug.c | 2 +-
kernel/irq/manage.c | 12 ++++++------
3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
index d3acccf7e2e2..2d540884ca05 100644
--- a/kernel/irq/chip.c
+++ b/kernel/irq/chip.c
@@ -1145,7 +1145,7 @@ EXPORT_SYMBOL_GPL(irq_modify_status);
void irq_cpu_online(void)
{
struct irq_desc *desc;
- struct irq_chip *chip;
+ const struct irq_chip *chip;
unsigned long flags;
unsigned int irq;

@@ -1175,7 +1175,7 @@ void irq_cpu_online(void)
void irq_cpu_offline(void)
{
struct irq_desc *desc;
- struct irq_chip *chip;
+ const struct irq_chip *chip;
unsigned long flags;
unsigned int irq;

diff --git a/kernel/irq/cpuhotplug.c b/kernel/irq/cpuhotplug.c
index 15a7654eff68..dbfa7d63438f 100644
--- a/kernel/irq/cpuhotplug.c
+++ b/kernel/irq/cpuhotplug.c
@@ -53,7 +53,7 @@ static inline bool irq_needs_fixup(struct irq_data *d)
static bool migrate_one_irq(struct irq_desc *desc)
{
struct irq_data *d = irq_desc_get_irq_data(desc);
- struct irq_chip *chip = irq_data_get_irq_chip(d);
+ const struct irq_chip *chip = irq_data_get_irq_chip(d);
bool maskchip = !irq_can_move_pcntxt(d) && !irqd_irq_masked(d);
const struct cpumask *affinity;
bool brokeaff = false;
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index e7f548bc976b..dfe184218cc2 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -207,7 +207,7 @@ void irq_set_thread_affinity(struct irq_desc *desc)
static void irq_validate_effective_affinity(struct irq_data *data)
{
const struct cpumask *m = irq_data_get_effective_affinity_mask(data);
- struct irq_chip *chip = irq_data_get_irq_chip(data);
+ const struct irq_chip *chip = irq_data_get_irq_chip(data);

if (!cpumask_empty(m))
return;
@@ -225,7 +225,7 @@ int irq_do_set_affinity(struct irq_data *data, const struct cpumask *mask,
{
struct cpumask *tmp_mask = this_cpu_ptr(&__tmp_mask);
struct irq_desc *desc = irq_data_to_desc(data);
- struct irq_chip *chip = irq_data_get_irq_chip(data);
+ const struct irq_chip *chip = irq_data_get_irq_chip(data);
const struct cpumask *prog_mask;
int ret;

@@ -353,7 +353,7 @@ static bool irq_set_affinity_deactivated(struct irq_data *data,
int irq_set_affinity_locked(struct irq_data *data, const struct cpumask *mask,
bool force)
{
- struct irq_chip *chip = irq_data_get_irq_chip(data);
+ const struct irq_chip *chip = irq_data_get_irq_chip(data);
struct irq_desc *desc = irq_data_to_desc(data);
int ret = 0;

@@ -658,7 +658,7 @@ int irq_set_vcpu_affinity(unsigned int irq, void *vcpu_info)
unsigned long flags;
struct irq_desc *desc = irq_get_desc_lock(irq, &flags, 0);
struct irq_data *data;
- struct irq_chip *chip;
+ const struct irq_chip *chip;
int ret = -ENOSYS;

if (!desc)
@@ -2799,7 +2799,7 @@ void teardown_percpu_nmi(unsigned int irq)
int __irq_get_irqchip_state(struct irq_data *data, enum irqchip_irq_state which,
bool *state)
{
- struct irq_chip *chip;
+ const struct irq_chip *chip;
int err = -EINVAL;

do {
@@ -2871,7 +2871,7 @@ int irq_set_irqchip_state(unsigned int irq, enum irqchip_irq_state which,
{
struct irq_desc *desc;
struct irq_data *data;
- struct irq_chip *chip;
+ const struct irq_chip *chip;
unsigned long flags;
int err = -EINVAL;

--
2.47.0