Patchwork [U-Boot] avr32: fix timer_init() return type

login
register
mail settings
Submitter Mike Frysinger
Date Oct. 13, 2011, 5:11 a.m.
Message ID <1318482666-20394-1-git-send-email-vapier@gentoo.org>
Download mbox | patch
Permalink /patch/119348/
State Changes Requested
Delegated to: Reinhard Meyer
Headers show

Comments

Mike Frysinger - Oct. 13, 2011, 5:11 a.m.
The common.h header says this has to return an int, otherwise we get
build failures due to mismatched prototype and function definition.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
 arch/avr32/cpu/interrupts.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
Andreas Bießmann - Oct. 13, 2011, 7:38 a.m.
Dear Mike,

Am 13.10.2011 07:11, schrieb Mike Frysinger:
> The common.h header says this has to return an int, otherwise we get
> build failures due to mismatched prototype and function definition.
> 
> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
> ---
>  arch/avr32/cpu/interrupts.c |    6 ++++--
>  1 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/avr32/cpu/interrupts.c b/arch/avr32/cpu/interrupts.c
> index 6681e13..1127580 100644
> --- a/arch/avr32/cpu/interrupts.c
> +++ b/arch/avr32/cpu/interrupts.c
> @@ -107,7 +107,7 @@ static int set_interrupt_handler(unsigned int nr, void (*handler)(void),
>  	return 0;
>  }
>  
> -void timer_init(void)
> +int timer_init(void)
>  {
>  	extern void timer_interrupt_handler(void);
>  	u64 tmp;
> @@ -120,8 +120,10 @@ void timer_init(void)
>  	tb_factor = (u32)tmp;
>  
>  	if (set_interrupt_handler(0, &timer_interrupt_handler, 3))
> -		return;
> +		return 0;

NAK, this is an error and should return a negative value (though the
return value is currently not evaluated).

BTW there is another patch pending ->
http://patchwork.ozlabs.org/patch/117688/

best regards

Andreas Bießmann
Reinhard Meyer - Oct. 13, 2011, 10:27 a.m.
Dear Andreas Bießmann,
>>  	if (set_interrupt_handler(0, &timer_interrupt_handler, 3))
>> -		return;
>> +		return 0;
> 
> NAK, this is an error and should return a negative value (though the
> return value is currently not evaluated).

Agreed

> 
> BTW there is another patch pending ->
> http://patchwork.ozlabs.org/patch/117688/

I'll apply that one in the year 2015 ;)

NO.. its on my list for applying into next

Best Regards,
Reinhard
Mike Frysinger - Oct. 13, 2011, 3:29 p.m.
On Thursday 13 October 2011 06:27:38 Reinhard Meyer wrote:
> Dear Andreas Bießmann,
> > BTW there is another patch pending ->
> > http://patchwork.ozlabs.org/patch/117688/
> 
> I'll apply that one in the year 2015 ;)
> 
> NO.. its on my list for applying into next

WFM
-mike
Andreas Bießmann - Nov. 29, 2011, 9:10 a.m.
Dear Reinhard,

Am 13.10.2011 12:27, schrieb Reinhard Meyer:
> Dear Andreas Bießmann,
>>>  	if (set_interrupt_handler(0, &timer_interrupt_handler, 3))
>>> -		return;
>>> +		return 0;
>>
>> NAK, this is an error and should return a negative value (though the
>> return value is currently not evaluated).
> 
> Agreed
> 
>>
>> BTW there is another patch pending ->
>> http://patchwork.ozlabs.org/patch/117688/
> 
> I'll apply that one in the year 2015 ;)
> 
> NO.. its on my list for applying into next

it would be great to get this regression fix (or the other one) in now.

best regards

Andreas Bießmann

Patch

diff --git a/arch/avr32/cpu/interrupts.c b/arch/avr32/cpu/interrupts.c
index 6681e13..1127580 100644
--- a/arch/avr32/cpu/interrupts.c
+++ b/arch/avr32/cpu/interrupts.c
@@ -107,7 +107,7 @@  static int set_interrupt_handler(unsigned int nr, void (*handler)(void),
 	return 0;
 }
 
-void timer_init(void)
+int timer_init(void)
 {
 	extern void timer_interrupt_handler(void);
 	u64 tmp;
@@ -120,8 +120,10 @@  void timer_init(void)
 	tb_factor = (u32)tmp;
 
 	if (set_interrupt_handler(0, &timer_interrupt_handler, 3))
-		return;
+		return 0;
 
 	/* For all practical purposes, this gives us an overflow interrupt */
 	sysreg_write(COMPARE, 0xffffffff);
+
+	return 0;
 }