Am 07.03.2013 16:24, schrieb Matthijs Kooijman:
> Hi Alexander,
> 
>> The next thought was that ARRAY_SIZE macro must get an array and not
>> an pointer, so I tried it with:
> That's exactly right. An array's size is not stored in memory, so you
> can only get at it at compile time. However, then you must actually pass
> the array, not a pointer to the array (which could potentially point to
> different arrays).
> 
>> static void __init board_generic_setup(struct gpio_led *leds_gpio, size_t 
>> leds_gpio_size, struct gpio_keys_button *gpio_keys, size_t gpio_keys_size, 
>> struct mdio_board_info *mdio0_info, size_t mdio0_info_size)
>>
>> board_generic_setup(board_leds_gpio,ARRAY_SIZE(board_leds_gpio),board_gpio_keys,ARRAY_SIZE(board_gpio_keys),board_mdio0_info,ARRAY_SIZE(board_mdio0_info));

And no const(s)? I'm a bit confused because mdio_board_info seems to use const 
struct but ath79_register_leds_gpio does not.

> 
> This would indeed be a sane way to handle this.
> 
>> No problems to expect from the functions like ath79_register_leds_gpio
>> when getting the pointer instead the array?
> This should work, since that function also has a size parameter (for the
> same reason).

The functions use unsigned for the size parameter, not size_t. But I think "my" 
ARRAY_SIZE will return size_t and so this will be the better approach?

> 
> Gr.
> 
> Matthijs

Thanks

Alex
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to