On Sun, Jan 10, 2016 at 1:17 PM, Martin Sperl <kernel@xxxxxxxxxxxxxxxx> wrote: >> On 10.01.2016, at 12:58, Mark Brown <broonie@xxxxxxxxxx> wrote: >> >> On Sun, Jan 10, 2016 at 11:55:48AM +0100, Martin Sperl wrote: >> >>> So if someone with a better idea how to keep those dt-binding includes >>> synchronized with the definitions used by the code step forward and >>> propose a better solution how to get that implemented? >> >>> I guess there will be a few more occurrences of clocks that are >>> currently not defined, which will need to get introduced in the future >>> PWM and PCM were just the last in this series. >> >> Presumably just making the code not rely on having a define for the >> number of clocks would deal with the problem (eg, using ARRAY_SIZE >> internally). > ARRAY_SIZE would work fine, but the code is: > > #include <dt-bindings/clock/bcm2835.h> > ... > struct bcm2835_cprman { > struct device *dev; > void __iomem *regs; > spinlock_t regs_lock; > const char *osc_name; > > struct clk_onecell_data onecell; > struct clk *clks[BCM2835_CLOCK_COUNT]; > }; > ... > static int bcm2835_clk_probe(struct platform_device *pdev) > { > ... > clks[BCM2835_PLLA_CORE] = > bcm2835_register_pll_divider(cprman, &bcm2835_plla_core_data); > ... > clks[BCM2835_CLOCK_PCM] = > bcm2835_register_clock(cprman, &bcm2835_clock_pcm_data); > ... > } > > So the Array size is defined by the dt-bindings. I wrote: | Hence it can better be replaced (it seems to be unused in dts files, but you | can keep the definition to be 100% sure) by an ARRAY_SIZE() in the C driver. | This requires changing the driver to e.g. initialize clks[] in |bcm2835_clk_probe() based on a table instead of explicit code. If you fill in clks[] from a static table, you can take ARRAY_SIZE of the static table. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds _______________________________________________ Alsa-devel mailing list Alsa-devel@xxxxxxxxxxxxxxxx http://mailman.alsa-project.org/mailman/listinfo/alsa-devel