diff options
| author | Arnd Bergmann <arnd@arndb.de> | 2013-03-19 10:38:50 -0400 |
|---|---|---|
| committer | Arnd Bergmann <arnd@arndb.de> | 2013-03-28 07:01:06 -0400 |
| commit | 3d5a96582303e28c48699f3faaf920ef7d43e6f2 (patch) | |
| tree | 7559859702f2fa02f6a4db64cf10f6c2e3f80c21 /include | |
| parent | da4a686a2cfb077a8bfc1697f597e7f86235b822 (diff) | |
clocksource: make CLOCKSOURCE_OF_DECLARE type safe
This ensures that a function pointer passed into CLOCKSOURCE_OF_DECLARE
takes the same arguments that we use for calling that function later.
Also fix the extraneous semicolon at end of the CLOCKSOURCE_OF_DECLARE
definition.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Rob Herring <rob.herring@calxeda.com>
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/clocksource.h | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h index 08ed5e19d8c6..192d6d1771ee 100644 --- a/include/linux/clocksource.h +++ b/include/linux/clocksource.h | |||
| @@ -332,16 +332,23 @@ extern int clocksource_mmio_init(void __iomem *, const char *, | |||
| 332 | 332 | ||
| 333 | extern int clocksource_i8253_init(void); | 333 | extern int clocksource_i8253_init(void); |
| 334 | 334 | ||
| 335 | struct device_node; | ||
| 336 | typedef void(*clocksource_of_init_fn)(struct device_node *); | ||
| 335 | #ifdef CONFIG_CLKSRC_OF | 337 | #ifdef CONFIG_CLKSRC_OF |
| 336 | extern void clocksource_of_init(void); | 338 | extern void clocksource_of_init(void); |
| 337 | 339 | ||
| 338 | #define CLOCKSOURCE_OF_DECLARE(name, compat, fn) \ | 340 | #define CLOCKSOURCE_OF_DECLARE(name, compat, fn) \ |
| 339 | static const struct of_device_id __clksrc_of_table_##name \ | 341 | static const struct of_device_id __clksrc_of_table_##name \ |
| 340 | __used __section(__clksrc_of_table) \ | 342 | __used __section(__clksrc_of_table) \ |
| 341 | = { .compatible = compat, .data = fn }; | 343 | = { .compatible = compat, \ |
| 344 | .data = (fn == (clocksource_of_init_fn)NULL) ? fn : fn } | ||
| 342 | #else | 345 | #else |
| 343 | static inline void clocksource_of_init(void) {} | 346 | static inline void clocksource_of_init(void) {} |
| 344 | #define CLOCKSOURCE_OF_DECLARE(name, compat, fn) | 347 | #define CLOCKSOURCE_OF_DECLARE(name, compat, fn) \ |
| 348 | static const struct of_device_id __clksrc_of_table_##name \ | ||
| 349 | __attribute__((unused)) \ | ||
| 350 | = { .compatible = compat, \ | ||
| 351 | .data = (fn == (clocksource_of_init_fn)NULL) ? fn : fn } | ||
| 345 | #endif | 352 | #endif |
| 346 | 353 | ||
| 347 | #endif /* _LINUX_CLOCKSOURCE_H */ | 354 | #endif /* _LINUX_CLOCKSOURCE_H */ |
