powerpc: make irq_chip const, __initdata and __initconst
PATCH 1/1 powerpc: make irq_chip const, __initdata and __initconst
Make ehv_pic_irq_chip, mpic_ipi_chip and mpic_tm_chip const as they are used only as a copy operation. This usage is during init, so make them __initconst too.
Make mpic_ipi_chip __initdata as it is only modified during the init phase and there is no reference of it anywhere after init.
--- arch/powerpc/sysdev/ehv_pic.c | 2 +- arch/powerpc/sysdev/mpic.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-)
arch/powerpc/sysdev/ehv_pic.c +1 -1
@@ -141,7 +141,7 @@ int ehv_pic_set_irq_type(struct irq_data *d, unsigned int flow_type)return IRQ_SET_MASK_OK_NOCOPY ; } -static struct irq_chip ehv_pic_irq_chip = { +static const struct irq_chip ehv_pic_irq_chip__initconst = { .irq_mask = ehv_pic_mask_irq, .irq_unmask = ehv_pic_unmask_irq, .irq_eoi = ehv_pic_end_irq,
arch/powerpc/sysdev/mpic.c +3 -3
@@ -964,21 +964,21 @@ static void mpic_set_destination(unsigned int virq, unsigned int cpuid) };#ifdef CONFIG_SMP -static struct irq_chip mpic_ipi_chip = { +static const struct irq_chip mpic_ipi_chip__initconst = { .irq_mask = mpic_mask_ipi, .irq_unmask = mpic_unmask_ipi, .irq_eoi = mpic_end_ipi, };#endif /* CONFIG_SMP */ -static struct irq_chip mpic_tm_chip = { +static struct irq_chip mpic_tm_chip__initdata = { .irq_mask = mpic_mask_tm, .irq_unmask = mpic_unmask_tm, .irq_eoi = mpic_end_irq, };#ifdef CONFIG_MPIC_U3_HT_IRQS -static struct irq_chip mpic_irq_ht_chip = { +static const struct irq_chip mpic_irq_ht_chip__initconst = { .irq_startup = mpic_startup_ht_irq, .irq_shutdown = mpic_shutdown_ht_irq, .irq_mask = mpic_mask_irq,
Signature · 1 line
1.9.1
Michael Ellerman
reviewerQuoted 5 lines · Bhumika Goyal
Make
ehv_pic_irq_chip,mpic_ipi_chipandmpic_tm_chipconst as they are used only as a copy operation. This usage is during init, so make them__initconsttoo.
Makempic_ipi_chip__initdataas it is only modified during the init phase and there is no reference of it anywhere after init.
The change log doesn't seem to match the code.
It's mpic_tm_chip which you marked __initdata, and that looks wrong, as we keep a pointer to it here:
mpic->hc_tm = mpic_tm_chip;
cheers
Quoted 8 lines · Michael Ellerman
Quoted 5 lines · Bhumika Goyal
Make
ehv_pic_irq_chip,mpic_ipi_chipandmpic_tm_chipconst as they are used only as a copy operation. This usage is during init, so make them__initconsttoo.
Makempic_ipi_chip__initdataas it is only modified during the init phase and there is no reference of it anywhere after init.
Quoted 6 lines
The change log doesn't seem to match the code.
It's
mpic_tm_chipwhich you marked__initdata, and that looks wrong, as we keep a pointer to it here:mpic->hc_tm = mpic_tm_chip;
This looks like a memory copy.
julia
Michael Ellerman
reviewerQuoted 10 lines · Julia Lawall
Quoted 8 lines · Michael Ellerman
Quoted 5 lines · Bhumika Goyal
Make
ehv_pic_irq_chip,mpic_ipi_chipandmpic_tm_chipconst as they are used only as a copy operation. This usage is during init, so make them__initconsttoo.
Makempic_ipi_chip__initdataas it is only modified during the init phase and there is no reference of it anywhere after init.
Quoted 8 lines
Quoted 6 lines
The change log doesn't seem to match the code.
It's
mpic_tm_chipwhich you marked__initdata, and that looks wrong, as we keep a pointer to it here:mpic->hc_tm = mpic_tm_chip;This looks like a memory copy.
Yes you're right.
That's pretty horrible given the size of struct irq_chip, but it's not a bug in this patch.
There are 5 struct irq_chip's embedded in struct mpic, it must be enormous!
cheers