alpha: Replace setup_irq() by request_irq()
PATCH v3 1/1 alpha: Replace setup_irq() by request_irq()
request_irq() is preferred over setup_irq(). Invocations of setup_irq() occur after memory allocators are ready.
Per tglx[1], setup_irq() existed in olden days when allocators were not ready by the time early interrupts were initialized.
Hence replace setup_irq() by request_irq().
[1] https://lkml.kernel.org/r/alpine.DEB.2.20.1710191609480.1971@nanos
---
Hi alpha maintainers,
if okay w/ this change, please consider taking it thr' your tree, else please let me know.
Regards
afzal
Link to v2 & v1,
[v2] https://lkml.kernel.org/r/[email protected]
[v1] https://lkml.kernel.org/r/[email protected]
v3:
* Split out from tree wide series, as Thomas suggested to get it thr' respective maintainers
* Modify pr_err displayed in case of error
* Re-arrange code & choose pr_err args as required to improve readability
* Remove irrelevant parts from commit message & improve
v2:
* Replace pr_err("request_irq() on %s failed" by
pr_err("%s: request_irq() failed"* Commit message massage
arch/alpha/kernel/irq_alpha.c | 29 +++++------------------------ arch/alpha/kernel/irq_i8259.c | 8 ++------ arch/alpha/kernel/irq_impl.h | 7 +------ arch/alpha/kernel/irq_pyxis.c | 3 ++- arch/alpha/kernel/sys_alcor.c | 3 ++- arch/alpha/kernel/sys_cabriolet.c | 3 ++- arch/alpha/kernel/sys_eb64p.c | 3 ++- arch/alpha/kernel/sys_marvel.c | 2 +- arch/alpha/kernel/sys_miata.c | 6 ++++-- arch/alpha/kernel/sys_ruffian.c | 3 ++- arch/alpha/kernel/sys_rx164.c | 3 ++- arch/alpha/kernel/sys_sx164.c | 3 ++- arch/alpha/kernel/sys_wildfire.c | 7 ++----- arch/alpha/kernel/time.c | 6 ++---- 14 files changed, 31 insertions(+), 55 deletions(-)
arch/alpha/kernel/irq_alpha.c +5 -24
@@ -213,32 +213,13 @@ process_mcheck_info(unsigned long vector, unsigned long la_ptr,* The special RTC interrupt type. The interrupt itself was * processed by PALcode, and comes in via entInt vector 1. */ - -struct irqaction timer_irqaction = { - .handler = rtc_timer_interrupt, - .name ="timer" , -}; -void __init -init_rtc_irq (void ) +init_rtc_irq (irqreturn_t handler) {irq_set_chip_and_handler_name (RTC_IRQ , &dummy_irq_chip, handle_percpu_irq,"RTC" ); -setup_irq (RTC_IRQ , &timer_irqaction); +if (!handler) + handler = rtc_timer_interrupt; +if (request_irq (RTC_IRQ , handler,0 ,"timer" ,NULL )) +pr_err ("Failed to register timer interrupt\n" ); } - -/* Dummy irqactions. */ -struct irqaction isa_cascade_irqaction = { - .handler = no_action, - .name ="isa-cascade" -}; - -struct irqaction timer_cascade_irqaction = { - .handler = no_action, - .name ="timer-cascade" -}; - -struct irqaction halt_switch_irqaction = { - .handler = no_action, - .name ="halt-switch" -};
arch/alpha/kernel/irq_i8259.c +2 -6
@@ -82,11 +82,6 @@ struct irq_chip i8259a_irq_type = {void __init init_i8259a_irqs (void ) { -static struct irqaction cascade = { - .handler = no_action, - .name ="cascade" , - }; -long i;outb (0xff ,0x21 );/* mask all of 8259A-1 */
@@ -96,7 +91,8 @@ init_i8259a_irqs(void)irq_set_chip_and_handler (i, &i8259a_irq_type, handle_level_irq); } -setup_irq (2 , &cascade); +if (request_irq (2 , no_action,0 ,"cascade" ,NULL )) +pr_err ("Failed to request irq 2 (cascade)\n" ); }
arch/alpha/kernel/irq_impl.h +1 -6
@@ -21,14 +21,9 @@ extern void isa_no_iack_sc_device_interrupt(unsigned long);extern void srm_device_interrupt (unsigned long );extern void pyxis_device_interrupt (unsigned long ); -extern struct irqaction timer_irqaction; -extern struct irqaction isa_cascade_irqaction; -extern struct irqaction timer_cascade_irqaction; -extern struct irqaction halt_switch_irqaction; -extern void init_srm_irqs (long ,unsigned long );extern void init_pyxis_irqs (unsigned long ); -extern void init_rtc_irq (void ); +extern void init_rtc_irq (irqreturn_t handler);extern void common_init_isa_dma (void );
arch/alpha/kernel/irq_pyxis.c +2 -1
@@ -107,5 +107,6 @@ init_pyxis_irqs(unsigned long ignore_mask)irq_set_status_flags (i,IRQ_LEVEL ); } -setup_irq (16 +7 , &isa_cascade_irqaction); +if (request_irq (16 +7 , no_action,0 ,"isa-cascade" ,NULL )) +pr_err ("Failed to register isa-cascade interrupt\n" ); }
arch/alpha/kernel/sys_alcor.c +2 -1
@@ -133,7 +133,8 @@ alcor_init_irq(void)init_i8259a_irqs ();common_init_isa_dma (); -setup_irq (16 +31 , &isa_cascade_irqaction); +if (request_irq (16 +31 , no_action,0 ,"isa-cascade" ,NULL )) +pr_err ("Failed to register isa-cascade interrupt\n" ); }
arch/alpha/kernel/sys_cabriolet.c +2 -1
@@ -112,7 +112,8 @@ common_init_irq(void (*srm_dev_int)(unsigned long v)) }common_init_isa_dma (); -setup_irq (16 +4 , &isa_cascade_irqaction); +if (request_irq (16 +4 , no_action,0 ,"isa-cascade" ,NULL )) +pr_err ("Failed to register isa-cascade interrupt\n" ); }#ifndef CONFIG_ALPHA_PC164
arch/alpha/kernel/sys_eb64p.c +2 -1
@@ -123,7 +123,8 @@ eb64p_init_irq(void) }common_init_isa_dma (); -setup_irq (16 +5 , &isa_cascade_irqaction); +if (request_irq (16 +5 , no_action,0 ,"isa-cascade" ,NULL )) +pr_err ("Failed to register isa-cascade interrupt\n" ); }/*
arch/alpha/kernel/sys_marvel.c +1 -1
@@ -397,7 +397,7 @@ marvel_init_pci(void)static void __init marvel_init_rtc (void ) { -init_rtc_irq (); +init_rtc_irq (NULL ); } static void
arch/alpha/kernel/sys_miata.c +4 -2
@@ -81,8 +81,10 @@ miata_init_irq(void)init_pyxis_irqs (0x63b0000 );common_init_isa_dma (); -setup_irq (16 +2 , &halt_switch_irqaction);/* SRM only? */ -setup_irq (16 +6 , &timer_cascade_irqaction); +if (request_irq (16 +2 , no_action,0 ,"halt-switch" ,NULL )) +pr_err ("Failed to register halt-switch interrupt\n" ); +if (request_irq (16 +6 , no_action,0 ,"timer-cascade" ,NULL )) +pr_err ("Failed to register timer-cascade interrupt\n" ); }
arch/alpha/kernel/sys_ruffian.c +2 -1
@@ -82,7 +82,8 @@ ruffian_init_rtc(void)outb (0x31 ,0x42 );outb (0x13 ,0x42 ); -setup_irq (0 , &timer_irqaction); +if (request_irq (0 , rtc_timer_interrupt,0 ,"timer" ,NULL )) +pr_err ("Failed to request irq 0 (timer)\n" ); } static void
arch/alpha/kernel/sys_rx164.c +2 -1
@@ -106,7 +106,8 @@ rx164_init_irq(void)init_i8259a_irqs ();common_init_isa_dma (); -setup_irq (16 +20 , &isa_cascade_irqaction); +if (request_irq (16 +20 , no_action,0 ,"isa-cascade" ,NULL )) +pr_err ("Failed to register isa-cascade interrupt\n" ); }
arch/alpha/kernel/sys_sx164.c +2 -1
@@ -54,7 +54,8 @@ sx164_init_irq(void)else init_pyxis_irqs (0xff00003f0000UL ); -setup_irq (16 +6 , &timer_cascade_irqaction); +if (request_irq (16 +6 , no_action,0 ,"timer-cascade" ,NULL )) +pr_err ("Failed to register timer-cascade interrupt\n" ); }/*
arch/alpha/kernel/sys_wildfire.c +2 -5
@@ -156,10 +156,6 @@ static void __init wildfire_init_irq_per_pca(int qbbno, int pcano) { int i, irq_bias; -static struct irqaction isa_enable = { - .handler = no_action, - .name ="isa_enable" , - }; irq_bias = qbbno * (WILDFIRE_PCA_PER_QBB *WILDFIRE_IRQ_PER_PCA ) + pcano *WILDFIRE_IRQ_PER_PCA ;
@@ -198,7 +194,8 @@ wildfire_init_irq_per_pca(int qbbno, int pcano)irq_set_status_flags (i + irq_bias,IRQ_LEVEL ); } -setup_irq (32 +irq_bias, &isa_enable); +if (request_irq (32 + irq_bias, no_action,0 ,"isa_enable" ,NULL )) +pr_err ("Failed to register isa_enable interrupt\n" ); } static void __init
arch/alpha/kernel/time.c +2 -4
@@ -242,7 +242,7 @@ common_init_rtc(void)outb (0x31 ,0x42 );outb (0x13 ,0x42 ); -init_rtc_irq (); +init_rtc_irq (NULL ); }
@@ -396,9 +396,7 @@ time_init(void)if (alpha_using_qemu) {clocksource_register_hz (&qemu_cs,NSEC_PER_SEC );init_qemu_clockevent (); - - timer_irqaction.handler = qemu_timer_interrupt; -init_rtc_irq (); +init_rtc_irq (qemu_timer_interrupt);return ; }
Signature · 1 line
2.25.1
PATCH v4 1/1 alpha: Replace setup_irq() by request_irq()
request_irq() is preferred over setup_irq(). Invocations of setup_irq() occur after memory allocators are ready.
Per tglx[1], setup_irq() existed in olden days when allocators were not ready by the time early interrupts were initialized.
Hence replace setup_irq() by request_irq().
[1] https://lkml.kernel.org/r/alpine.DEB.2.20.1710191609480.1971@nanos
---
Hi alpha maintainers,
if okay w/ this change, please consider taking it thr' your tree, else please let me know.
Regards
afzal
Link to v3, v2 & v1,
[v3] https://lkml.kernel.org/r/[email protected]
[v2] https://lkml.kernel.org/r/[email protected]
[v1] https://lkml.kernel.org/r/[email protected]
v4:
* Fix build error @ init_rtc_irq arg
v3:
* Split out from tree wide series, as Thomas suggested to get it thr' respective maintainers
* Modify pr_err displayed in case of error
* Re-arrange code & choose pr_err args as required to improve readability
* Remove irrelevant parts from commit message & improve
v2:
* Replace pr_err("request_irq() on %s failed" by
pr_err("%s: request_irq() failed"* Commit message massage
arch/alpha/kernel/irq_alpha.c | 29 +++++------------------------ arch/alpha/kernel/irq_i8259.c | 8 ++------ arch/alpha/kernel/irq_impl.h | 7 +------ arch/alpha/kernel/irq_pyxis.c | 3 ++- arch/alpha/kernel/sys_alcor.c | 3 ++- arch/alpha/kernel/sys_cabriolet.c | 3 ++- arch/alpha/kernel/sys_eb64p.c | 3 ++- arch/alpha/kernel/sys_marvel.c | 2 +- arch/alpha/kernel/sys_miata.c | 6 ++++-- arch/alpha/kernel/sys_ruffian.c | 3 ++- arch/alpha/kernel/sys_rx164.c | 3 ++- arch/alpha/kernel/sys_sx164.c | 3 ++- arch/alpha/kernel/sys_wildfire.c | 7 ++----- arch/alpha/kernel/time.c | 6 ++---- 14 files changed, 31 insertions(+), 55 deletions(-)
arch/alpha/kernel/irq_alpha.c +5 -24
@@ -213,32 +213,13 @@ process_mcheck_info(unsigned long vector, unsigned long la_ptr,* The special RTC interrupt type. The interrupt itself was * processed by PALcode, and comes in via entInt vector 1. */ - -struct irqaction timer_irqaction = { - .handler = rtc_timer_interrupt, - .name ="timer" , -}; -void __init -init_rtc_irq (void ) +init_rtc_irq (irq_handler_t handler) {irq_set_chip_and_handler_name (RTC_IRQ , &dummy_irq_chip, handle_percpu_irq,"RTC" ); -setup_irq (RTC_IRQ , &timer_irqaction); +if (!handler) + handler = rtc_timer_interrupt; +if (request_irq (RTC_IRQ , handler,0 ,"timer" ,NULL )) +pr_err ("Failed to register timer interrupt\n" ); } - -/* Dummy irqactions. */ -struct irqaction isa_cascade_irqaction = { - .handler = no_action, - .name ="isa-cascade" -}; - -struct irqaction timer_cascade_irqaction = { - .handler = no_action, - .name ="timer-cascade" -}; - -struct irqaction halt_switch_irqaction = { - .handler = no_action, - .name ="halt-switch" -};
arch/alpha/kernel/irq_i8259.c +2 -6
@@ -82,11 +82,6 @@ struct irq_chip i8259a_irq_type = {void __init init_i8259a_irqs (void ) { -static struct irqaction cascade = { - .handler = no_action, - .name ="cascade" , - }; -long i;outb (0xff ,0x21 );/* mask all of 8259A-1 */
@@ -96,7 +91,8 @@ init_i8259a_irqs(void)irq_set_chip_and_handler (i, &i8259a_irq_type, handle_level_irq); } -setup_irq (2 , &cascade); +if (request_irq (2 , no_action,0 ,"cascade" ,NULL )) +pr_err ("Failed to request irq 2 (cascade)\n" ); }
arch/alpha/kernel/irq_impl.h +1 -6
@@ -21,14 +21,9 @@ extern void isa_no_iack_sc_device_interrupt(unsigned long);extern void srm_device_interrupt (unsigned long );extern void pyxis_device_interrupt (unsigned long ); -extern struct irqaction timer_irqaction; -extern struct irqaction isa_cascade_irqaction; -extern struct irqaction timer_cascade_irqaction; -extern struct irqaction halt_switch_irqaction; -extern void init_srm_irqs (long ,unsigned long );extern void init_pyxis_irqs (unsigned long ); -extern void init_rtc_irq (void ); +extern void init_rtc_irq (irq_handler_t handler);extern void common_init_isa_dma (void );
arch/alpha/kernel/irq_pyxis.c +2 -1
@@ -107,5 +107,6 @@ init_pyxis_irqs(unsigned long ignore_mask)irq_set_status_flags (i,IRQ_LEVEL ); } -setup_irq (16 +7 , &isa_cascade_irqaction); +if (request_irq (16 +7 , no_action,0 ,"isa-cascade" ,NULL )) +pr_err ("Failed to register isa-cascade interrupt\n" ); }
arch/alpha/kernel/sys_alcor.c +2 -1
@@ -133,7 +133,8 @@ alcor_init_irq(void)init_i8259a_irqs ();common_init_isa_dma (); -setup_irq (16 +31 , &isa_cascade_irqaction); +if (request_irq (16 +31 , no_action,0 ,"isa-cascade" ,NULL )) +pr_err ("Failed to register isa-cascade interrupt\n" ); }
arch/alpha/kernel/sys_cabriolet.c +2 -1
@@ -112,7 +112,8 @@ common_init_irq(void (*srm_dev_int)(unsigned long v)) }common_init_isa_dma (); -setup_irq (16 +4 , &isa_cascade_irqaction); +if (request_irq (16 +4 , no_action,0 ,"isa-cascade" ,NULL )) +pr_err ("Failed to register isa-cascade interrupt\n" ); }#ifndef CONFIG_ALPHA_PC164
arch/alpha/kernel/sys_eb64p.c +2 -1
@@ -123,7 +123,8 @@ eb64p_init_irq(void) }common_init_isa_dma (); -setup_irq (16 +5 , &isa_cascade_irqaction); +if (request_irq (16 +5 , no_action,0 ,"isa-cascade" ,NULL )) +pr_err ("Failed to register isa-cascade interrupt\n" ); }/*
arch/alpha/kernel/sys_marvel.c +1 -1
@@ -397,7 +397,7 @@ marvel_init_pci(void)static void __init marvel_init_rtc (void ) { -init_rtc_irq (); +init_rtc_irq (NULL ); } static void
arch/alpha/kernel/sys_miata.c +4 -2
@@ -81,8 +81,10 @@ miata_init_irq(void)init_pyxis_irqs (0x63b0000 );common_init_isa_dma (); -setup_irq (16 +2 , &halt_switch_irqaction);/* SRM only? */ -setup_irq (16 +6 , &timer_cascade_irqaction); +if (request_irq (16 +2 , no_action,0 ,"halt-switch" ,NULL )) +pr_err ("Failed to register halt-switch interrupt\n" ); +if (request_irq (16 +6 , no_action,0 ,"timer-cascade" ,NULL )) +pr_err ("Failed to register timer-cascade interrupt\n" ); }
arch/alpha/kernel/sys_ruffian.c +2 -1
@@ -82,7 +82,8 @@ ruffian_init_rtc(void)outb (0x31 ,0x42 );outb (0x13 ,0x42 ); -setup_irq (0 , &timer_irqaction); +if (request_irq (0 , rtc_timer_interrupt,0 ,"timer" ,NULL )) +pr_err ("Failed to request irq 0 (timer)\n" ); } static void
arch/alpha/kernel/sys_rx164.c +2 -1
@@ -106,7 +106,8 @@ rx164_init_irq(void)init_i8259a_irqs ();common_init_isa_dma (); -setup_irq (16 +20 , &isa_cascade_irqaction); +if (request_irq (16 +20 , no_action,0 ,"isa-cascade" ,NULL )) +pr_err ("Failed to register isa-cascade interrupt\n" ); }
arch/alpha/kernel/sys_sx164.c +2 -1
@@ -54,7 +54,8 @@ sx164_init_irq(void)else init_pyxis_irqs (0xff00003f0000UL ); -setup_irq (16 +6 , &timer_cascade_irqaction); +if (request_irq (16 +6 , no_action,0 ,"timer-cascade" ,NULL )) +pr_err ("Failed to register timer-cascade interrupt\n" ); }/*
arch/alpha/kernel/sys_wildfire.c +2 -5
@@ -156,10 +156,6 @@ static void __init wildfire_init_irq_per_pca(int qbbno, int pcano) { int i, irq_bias; -static struct irqaction isa_enable = { - .handler = no_action, - .name ="isa_enable" , - }; irq_bias = qbbno * (WILDFIRE_PCA_PER_QBB *WILDFIRE_IRQ_PER_PCA ) + pcano *WILDFIRE_IRQ_PER_PCA ;
@@ -198,7 +194,8 @@ wildfire_init_irq_per_pca(int qbbno, int pcano)irq_set_status_flags (i + irq_bias,IRQ_LEVEL ); } -setup_irq (32 +irq_bias, &isa_enable); +if (request_irq (32 + irq_bias, no_action,0 ,"isa_enable" ,NULL )) +pr_err ("Failed to register isa_enable interrupt\n" ); } static void __init
arch/alpha/kernel/time.c +2 -4
@@ -242,7 +242,7 @@ common_init_rtc(void)outb (0x31 ,0x42 );outb (0x13 ,0x42 ); -init_rtc_irq (); +init_rtc_irq (NULL ); }
@@ -396,9 +396,7 @@ time_init(void)if (alpha_using_qemu) {clocksource_register_hz (&qemu_cs,NSEC_PER_SEC );init_qemu_clockevent (); - - timer_irqaction.handler = qemu_timer_interrupt; -init_rtc_irq (); +init_rtc_irq (qemu_timer_interrupt);return ; }
Signature · 1 line
2.18.0
Hi Richard Henderson, Ivan Kokshaysky, Matt Turner,
Quoted 11 lines · afzal mohammed
request_irq()is preferred oversetup_irq(). Invocations ofsetup_irq()occur after memory allocators are ready.Per tglx[1],
setup_irq()existed in olden days when allocators were not ready by the time early interrupts were initialized.Hence replace
setup_irq()byrequest_irq().[1] https://lkml.kernel.org/r/alpine.DEB.2.20.1710191609480.1971@nanos
Signed-off-by afzal mohammed <[email protected]>
If this patch is okay, please consider acking it so as to take it via tglx.
Regards
afzal
Quoted 14 lines · afzal mohammed
Hi Richard Henderson, Ivan Kokshaysky, Matt Turner,
Quoted 10 lines · afzal mohammed
request_irq()is preferred oversetup_irq(). Invocations ofsetup_irq()occur after memory allocators are ready.Per tglx[1],
setup_irq()existed in olden days when allocators were not ready by the time early interrupts were initialized.Hence replace
setup_irq()byrequest_irq().[1] https://lkml.kernel.org/r/alpine.DEB.2.20.1710191609480.1971@nanos
Quoted 7 lines
Quoted 1 line
Signed-off-by afzal mohammed <[email protected]>If this patch is okay, please consider acking it so as to take it via tglx.
Regards
afzal
Thanks afzal,