clocksource/drivers/moxart: Replace setup_irq by request_irq
PATCH 1/2 clocksource/drivers/moxart: Replace setup_irq by request_irq
Save memory space and line of code by replacing setup_irq by request_irq.
Signed-off-by Daniel Lezcano <[email protected]>
--- drivers/clocksource/moxart_timer.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/clocksource/moxart_timer.c +2 -6
@@ -79,7 +79,6 @@ struct moxart_timer {unsigned int t1_enable_val;unsigned int count_per_tick;struct clock_event_device clkevt; -struct irqaction act; };static inline struct moxart_timer *to_moxart (struct clock_event_device *evt)
@@ -201,10 +200,6 @@ static int __init moxart_timer_init(struct device_node *node) timer->clkevt.set_next_event = moxart_clkevt_next_event; timer->clkevt.cpumask =cpumask_of (0 ); timer->clkevt.irq = irq; - timer->act.name = node->name; - timer->act.flags =IRQF_TIMER ; - timer->act.handler = moxart_timer_interrupt; - timer->act.dev_id = &timer->clkevt; ret = clocksource_mmio_init(timer->base + TIMER2_BASE + REG_COUNT, "moxart_timer", pclk, 200, 32,
@@ -214,7 +209,8 @@ static int __init moxart_timer_init(struct device_node *node)return ret; } - ret =setup_irq (irq, &timer->act); + ret =request_irq (irq, moxart_timer_interrupt,IRQF_TIMER , + node->name, &timer->clkevt);if (ret) {pr_err ("%s: setup_irq failed\n" , node->full_name);return ret;
Signature · 1 line
1.9.1
PATCH 2/2 clocksource/drivers/moxart: Replace panic by pr_err
The clksrc-of code is supposed to catch the return code and fail gracefully.
Don't panic on error, but print the error and exit with a relevant error code.
Signed-off-by Daniel Lezcano <[email protected]>
--- drivers/clocksource/moxart_timer.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/clocksource/moxart_timer.c +4 -2
@@ -184,8 +184,10 @@ static int __init moxart_timer_init(struct device_node *node) }else if (of_device_is_compatible (node,"aspeed,ast2400-timer" )) { timer->t1_enable_val =ASPEED_TIMER1_ENABLE ; timer->t1_disable_val =ASPEED_TIMER1_DISABLE ; - }else -panic ("%s: unknown platform\n" , node->full_name); + }else { +pr_err ("%s: unknown platform\n" , node->full_name); +return -EINVAL ; + } timer->count_per_tick =DIV_ROUND_CLOSEST (pclk,HZ );
Signature · 1 line
1.9.1
Re: [PATCH 2/2] clocksource/drivers/moxart: Replace panic by pr_err
Quoted 6 lines · Daniel Lezcano
The clksrc-of code is supposed to catch the return code and fail gracefully.
Don't panic on error, but print the error and exit with a relevant error code.
Signed-off-by Daniel Lezcano <[email protected]>
Acked-by Joel Stanley <[email protected]>
Quoted 24 lines
--- drivers/clocksource/moxart_timer.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/clocksource/moxart_timer.c +4
-3@@ -184,8 +184,10 @@ static int __init moxart_timer_init(struct device_node *node) }else if (of_device_is_compatible (node,"aspeed,ast2400-timer" )) { timer->t1_enable_val =ASPEED_TIMER1_ENABLE ; timer->t1_disable_val =ASPEED_TIMER1_DISABLE ; - }else -panic ("%s: unknown platform\n" , node->full_name); + }else { +pr_err ("%s: unknown platform\n" , node->full_name); +return -EINVAL ; + } timer->count_per_tick =DIV_ROUND_CLOSEST (pclk,HZ ); --1.9.1
Quoted 1 line · Daniel Lezcano
Save memory space and line of code by replacing
setup_irqbyrequest_irq.
Thanks. I also gave it a spin on our hardware to be sure.
Quoted 1 line
Signed-off-by Daniel Lezcano <[email protected]>
Acked-by Joel Stanley <[email protected]>
Quoted 40 lines
--- drivers/clocksource/moxart_timer.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)drivers/clocksource/moxart_timer.c +2
-7@@ -79,7 +79,6 @@ struct moxart_timer {unsigned int t1_enable_val;unsigned int count_per_tick;struct clock_event_device clkevt; -struct irqaction act; };static inline struct moxart_timer *to_moxart (struct clock_event_device *evt)@@ -201,10 +200,6 @@ static int __init moxart_timer_init(struct device_node *node) timer->clkevt.set_next_event = moxart_clkevt_next_event; timer->clkevt.cpumask =cpumask_of (0 ); timer->clkevt.irq = irq; - timer->act.name = node->name; - timer->act.flags =IRQF_TIMER ; - timer->act.handler = moxart_timer_interrupt; - timer->act.dev_id = &timer->clkevt; ret = clocksource_mmio_init(timer->base + TIMER2_BASE + REG_COUNT, "moxart_timer", pclk, 200, 32,@@ -214,7 +209,8 @@ static int __init moxart_timer_init(struct device_node *node)return ret; } - ret =setup_irq (irq, &timer->act); + ret =request_irq (irq, moxart_timer_interrupt,IRQF_TIMER , + node->name, &timer->clkevt);if (ret) {pr_err ("%s: setup_irq failed\n" , node->full_name);return ret; --1.9.1