[PATCH v4 01/11] macintosh/via-pmu: Fix section mismatch warning
The pmu_init() function has the __init qualifier, but the ops struct that holds a pointer to it does not. This causes a build warning. The driver works fine because the pointer is only dereferenced early. The function is so small that there's negligible benefit from using the __init qualifier. Remove it to fix the warning, consistent with the other ADB drivers. Tested-by: Stan Johnson Signed-off-by: Finn Thain Reviewed-by: Geert Uytterhoeven --- drivers/macintosh/via-pmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/macintosh/via-pmu.c b/drivers/macintosh/via-pmu.c index 25c1ce811053..f8a2c917201f 100644 --- a/drivers/macintosh/via-pmu.c +++ b/drivers/macintosh/via-pmu.c @@ -378,7 +378,7 @@ static int pmu_probe(void) return vias == NULL? -ENODEV: 0; } -static int __init pmu_init(void) +static int pmu_init(void) { if (vias == NULL) return -ENODEV; -- 2.16.4
Re: [PATCH v4 01/11] macintosh/via-pmu: Fix section mismatch warning
On Mon, Jul 2, 2018 at 10:25 AM Finn Thain wrote: > > The pmu_init() function has the __init qualifier, but the ops struct > that holds a pointer to it does not. This causes a build warning. > The driver works fine because the pointer is only dereferenced early. > > The function is so small that there's negligible benefit from using > the __init qualifier. Remove it to fix the warning, consistent with > the other ADB drivers. Would you mind copy/pasting the warning you are seeing. Make sure you have: 58935176ad17 powerpc/via-pmu: Fix section mismatch warning Thanks > Tested-by: Stan Johnson > Signed-off-by: Finn Thain > Reviewed-by: Geert Uytterhoeven > --- > drivers/macintosh/via-pmu.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/macintosh/via-pmu.c b/drivers/macintosh/via-pmu.c > index 25c1ce811053..f8a2c917201f 100644 > --- a/drivers/macintosh/via-pmu.c > +++ b/drivers/macintosh/via-pmu.c > @@ -378,7 +378,7 @@ static int pmu_probe(void) > return vias == NULL? -ENODEV: 0; > } > > -static int __init pmu_init(void) > +static int pmu_init(void) > { > if (vias == NULL) > return -ENODEV; > -- > 2.16.4 >
Re: [PATCH v4 01/11] macintosh/via-pmu: Fix section mismatch warning
On Mon, 2 Jul 2018, Mathieu Malaterre wrote: > On Mon, Jul 2, 2018 at 10:25 AM Finn Thain > wrote: > > > > The pmu_init() function has the __init qualifier, but the ops struct > > that holds a pointer to it does not. This causes a build warning. The > > driver works fine because the pointer is only dereferenced early. > > > > The function is so small that there's negligible benefit from using > > the __init qualifier. Remove it to fix the warning, consistent with > > the other ADB drivers. > > Would you mind copy/pasting the warning you are seeing. > > Make sure you have: > > 58935176ad17 powerpc/via-pmu: Fix section mismatch warning > > Thanks > It's true, the section mismatch warning from 'make' has disappeared since I wrote this patch, but that doesn't mean it is wrong. Before this patch: $ powerpc-linux-gnu-objdump -xda vmlinux |egrep -w "via_pmu_driver|pmu_init" c0711c84 l F .init.text 001c pmu_init c05eb408 g O .rodata0028 via_pmu_driver c0711c84 : $ After: $ powerpc-linux-gnu-objdump -xda vmlinux |egrep -w "via_pmu_driver|pmu_init" c038e42c l F .text 001c pmu_init c05e1e58 g O .rodata0028 via_pmu_driver c038e42c : $ I gather that commit 58935176ad17 ("powerpc/via-pmu: Fix section mismatch warning") has moved via_pmu_driver from .data to .rodata, but I'm afraid I don't see the point of that change. The commit log entry doesn't explain it either. If .rodata is not discarded then the dangling pointer remains, right? --