[PATCH] identify_ppc_sys_by_name_and_id function implementation final

Kumar Gala kumar.gala at freescale.com
Sat Aug 13 05:48:49 EST 2005


On Aug 12, 2005, at 11:30 AM, Vitaly Bordug wrote:

> Kumar Gala wrote:
>
>> Can you do a sizeof instead?
>>
>> #define num_ele sizeof(ppc_sys_specs[])/sizeof(struct ppc_sys_spec)
>>
>> Something like matchted[num_ele] ??
>>
>>
>
> That's what the first I tried actually :)
> gcc is not happy with it:
>
> arch/ppc/syslib/ppc_sys.c: In function `find_chip_by_name_and_id':
> arch/ppc/syslib/ppc_sys.c:54: error: parse error before ']' token
>
> and if I remove [] from the ppc_sys_specs, it outputs:
>
> arch/ppc/syslib/ppc_sys.c: In function `find_chip_by_name_and_id':
> arch/ppc/syslib/ppc_sys.c:54: error: invalid application of  
> `sizeof' to
> incomplete type `({anonymous})'
>
> So I cannot use sizeof this case, I think...

Realized the same thing.  I'm thinking that your original method is  
the best solution to just do this on the stack.  In general the  
number or processors (array size) is going to be less than 100.  So  
at most this array is going to end up being 100 bytes on the stack.   
I dont think that's a big deal at the point we are calling this.

- kumar




More information about the Linuxppc-embedded mailing list