Subject: Re: [PATCH] sh: intc: make intc_subsys const

Hi Ricardo,

On Thu, 2024-02-08 at 16:56 -0300, Ricardo B. Marliere wrote:
> Now that the driver core can properly handle constant struct bus_type,
> move the make intc_subsys variable to be a constant structure as well,
> placing it into read-only memory which can not be modified at runtime.
>
> Cc: Greg Kroah-Hartman <[email protected]>
> Suggested-by: Greg Kroah-Hartman <[email protected]>
> Signed-off-by: Ricardo B. Marliere <[email protected]>
> ---
> Built using sh-sh4 glibc stable toolchain from bootlin, with config:
>
> CONFIG_SH_INTC=y
> CONFIG_INTC_USERIMASK=y
> CONFIG_INTC_BALANCING=y
>
> Yielded unrelated warnings:
>
> <stdin>:1519:2: warning: #warning syscall clone3 not implemented [-Wcpp]
> arch/sh/kernel/cpu/sh4/fpu.c:389:6: warning: no previous prototype for 'float_raise' [-Wmissing-prototypes]
> arch/sh/kernel/cpu/sh4/fpu.c:394:5: warning: no previous prototype for 'float_rounding_mode' [-Wmissing-prototypes]
> arch/sh/mm/cache-sh4.c:384:13: warning: no previous prototype for 'sh4_cache_init' [-Wmissing-prototypes]
> arch/sh/mm/flush-sh4.c:106:13: warning: no previous prototype for 'sh4__flush_region_init' [-Wmissing-prototypes]
> arch/sh/mm/cache-shx3.c:18:13: warning: no previous prototype for 'shx3_cache_init' [-Wmissing-prototypes]
> kernel/locking/spinlock.c:68:17: warning: no previous prototype for '__raw_spin_lock' [-Wmissing-prototypes]
> kernel/locking/spinlock.c:80:26: warning: no previous prototype for '__raw_spin_lock_irqsave' [-Wmissing-prototypes]
> kernel/locking/spinlock.c:98:17: warning: no previous prototype for '__raw_spin_lock_irq' [-Wmissing-prototypes]
> kernel/locking/spinlock.c:103:17: warning: no previous prototype for '__raw_spin_lock_bh' [-Wmissing-prototypes]
> kernel/locking/spinlock.c:68:17: warning: no previous prototype for '__raw_read_lock' [-Wmissing-prototypes]
> kernel/locking/spinlock.c:80:26: warning: no previous prototype for '__raw_read_lock_irqsave' [-Wmissing-prototypes]
> kernel/locking/spinlock.c:98:17: warning: no previous prototype for '__raw_read_lock_irq' [-Wmissing-prototypes]
> kernel/locking/spinlock.c:103:17: warning: no previous prototype for '__raw_read_lock_bh' [-Wmissing-prototypes]
> kernel/locking/spinlock.c:68:17: warning: no previous prototype for '__raw_write_lock' [-Wmissing-prototypes]
> kernel/locking/spinlock.c:80:26: warning: no previous prototype for '__raw_write_lock_irqsave' [-Wmissing-prototypes]
> kernel/locking/spinlock.c:98:17: warning: no previous prototype for '__raw_write_lock_irq' [-Wmissing-prototypes]
> kernel/locking/spinlock.c:103:17: warning: no previous prototype for '__raw_write_lock_bh' [-Wmissing-prototypes]
> arch/sh/kernel/cpu/init.c:99:29: warning: no previous prototype for 'l2_cache_init' [-Wmissing-prototypes]
> arch/sh/mm/pgtable.c:10:6: warning: no previous prototype for 'pgd_ctor' [-Wmissing-prototypes]
> arch/sh/mm/pgtable.c:32:8: warning: no previous prototype for 'pgd_alloc' [-Wmissing-prototypes]
> arch/sh/mm/pgtable.c:37:6: warning: no previous prototype for 'pgd_free' [-Wmissing-prototypes]
> arch/sh/mm/pgtable.c:43:6: warning: no previous prototype for 'pud_populate' [-Wmissing-prototypes]
> arch/sh/mm/pgtable.c:48:8: warning: no previous prototype for 'pmd_alloc_one' [-Wmissing-prototypes]
> arch/sh/mm/pgtable.c:53:6: warning: no previous prototype for 'pmd_free' [-Wmissing-prototypes]
> arch/sh/mm/tlbex_32.c:22:1: warning: no previous prototype for 'handle_tlbmiss' [-Wmissing-prototypes]
> arch/sh/kernel/return_address.c:49:7: warning: no previous prototype for 'return_address' [-Wmissing-prototypes]
> arch/sh/kernel/sys_sh.c:58:16: warning: no previous prototype for 'sys_cacheflush' [-Wmissing-prototypes]
> arch/sh/kernel/traps_32.c:735:6: warning: no previous prototype for 'per_cpu_trap_init' [-Wmissing-prototypes]
> arch/sh/kernel/smp.c:173:17: warning: no previous prototype for 'start_secondary' [-Wmissing-prototypes]
> arch/sh/kernel/smp.c:324:5: warning: no previous prototype for 'setup_profiling_timer' [-Wmissing-prototypes]
> arch/sh/kernel/kprobes.c:52:16: warning: no previous prototype for 'arch_copy_kprobe' [-Wmissing-prototypes]
> arch/sh/kernel/kprobes.c:304:15: warning: no previous prototype for 'trampoline_probe_handler' [-Wmissing-prototypes]
> arch/sh/kernel/hw_breakpoint.c:135:5: warning: no previous prototype for 'arch_bp_generic_fields' [-Wmissing-prototypes]
> fs/ext4/readpage.c:392:1: warning: the frame size of 1124 bytes is larger than 1024 bytes [-Wframe-larger-than=]
> arch/sh/boot/compressed/cache.c:2:5: warning: no previous prototype for 'cache_control' [-Wmissing-prototypes]
> arch/sh/boot/compressed/misc.c:115:6: warning: no previous prototype for 'ftrace_stub' [-Wmissing-prototypes]
> arch/sh/boot/compressed/misc.c:118:6: warning: no previous prototype for 'arch_ftrace_ops_list_func' [-Wmissing-prototypes]
> arch/sh/boot/compressed/misc.c:128:6: warning: no previous prototype for 'decompress_kernel' [-Wmissing-prototypes]
> ---
> drivers/sh/intc/core.c | 2 +-
> drivers/sh/intc/internals.h | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/sh/intc/core.c b/drivers/sh/intc/core.c
> index ca4f4ca413f1..74350b5871dc 100644
> --- a/drivers/sh/intc/core.c
> +++ b/drivers/sh/intc/core.c
> @@ -455,7 +455,7 @@ struct syscore_ops intc_syscore_ops = {
> .resume = intc_resume,
> };
>
> -struct bus_type intc_subsys = {
> +const struct bus_type intc_subsys = {
> .name = "intc",
> .dev_name = "intc",
> };
> diff --git a/drivers/sh/intc/internals.h b/drivers/sh/intc/internals.h
> index fa73c173b56a..9b6cd1bebb4e 100644
> --- a/drivers/sh/intc/internals.h
> +++ b/drivers/sh/intc/internals.h
> @@ -160,7 +160,7 @@ void _intc_enable(struct irq_data *data, unsigned long handle);
> /* core.c */
> extern struct list_head intc_list;
> extern raw_spinlock_t intc_big_lock;
> -extern struct bus_type intc_subsys;
> +extern const struct bus_type intc_subsys;
>
> unsigned int intc_get_dfl_prio_level(void);
> unsigned int intc_get_prio_level(unsigned int irq);

Reviewed-by: John Paul Adrian Glaubitz <[email protected]>

Thanks for your patch. I will merge it into my linux-sh this weekend
after not managing it last weekend due to lack of time.

Thanks,
Adrian

--
.''`. John Paul Adrian Glaubitz
: :' : Debian Developer
`. `' Physicist
`- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913