Hi! Haven't developed for many years, and I unfortunately see the effects ;-). Can someone please help me with a short question? After that I can finish a patch.. .
I have i.e.: static struct gpio_led board_leds_gpio[] __initdata = { { .name = "board:power", .gpio = BOARD_GPIO_LED_POWER, .active_low = 1, }, }; static struct mdio_board_info board_mdio0_info[] = { { .bus_id = "ag71xx-mdio.0", .phy_addr = 0, .platform_data = &board_ar8327_data, }, }; -- that was used like: static void __init board_setup(void) { ath79_register_leds_gpio(-1, ARRAY_SIZE(board_leds_gpio), board_leds_gpio); mdiobus_register_board_info(board_mdio0_info, ARRAY_SIZE(board_mdio0_info)); } -- now i want to use it this way: static void __init board_setup(void) { board_generic_setup(board_leds_gpio,board_gpio_keys,board_mdio0_info); } static void __init board_generic_setup(struct gpio_led *leds_gpio, struct gpio_keys_button *gpio_keys, struct mdio_board_info *mdio0_info) { ath79_register_leds_gpio(-1, ARRAY_SIZE(leds_gpio), leds_gpio); mdiobus_register_board_info(mdio0_info, ARRAY_SIZE(mdio0_info)); } -- I think you get what I want to do? But something has to be wrong with that, as the compiler throws the error: negative width in bit-field 'anonymous' (for every line with ARRAY_SIZE..). (Search engines and some other .c files didn't get me further except sometimes they use i.e. "static void __init board_generic_setup(struct gpio_led * const leds_gpio", or "const struct gpio_led *leds_gpio", so should I use a const too?) -- The next thought was that ARRAY_SIZE macro must get an array and not an pointer, so I tried it with: 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)); Which compiles! Is this the correct way now? Any better Ideas? No problems to expect from the functions like ath79_register_leds_gpio when getting the pointer instead the array? -- Thanks Alex _______________________________________________ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel