diff options
author | Daniel Lezcano <daniel.lezcano@linaro.org> | 2016-04-18 23:06:48 +0200 |
---|---|---|
committer | Daniel Lezcano <daniel.lezcano@linaro.org> | 2016-06-28 10:19:17 +0200 |
commit | c35d9292fee0474a1a037f75b0b85af32200c76f (patch) | |
tree | 11e7965c92af6d08e4f93dce1aefea987c42a1d5 /include | |
parent | 43e88c8a73f5896b964183d503d9bf892a551e25 (diff) | |
download | linux-stable-c35d9292fee0474a1a037f75b0b85af32200c76f.tar.gz linux-stable-c35d9292fee0474a1a037f75b0b85af32200c76f.tar.bz2 linux-stable-c35d9292fee0474a1a037f75b0b85af32200c76f.zip |
of: Add a new macro to declare_of for one parameter function returning a value
The macro OF_DECLARE_1 expect a void (*func)(struct device_node *) while the
OF_DECLARE_2 expect a int (*func)(struct device_node *, struct device_node *).
The second one allows to pass an init function returning a value, which make
possible to call the functions in the table and check the return value in order
to catch at a higher level the errors and handle them from there instead of
doing a panic in each driver (well at least this is the case for the clkevt).
Unfortunately the OF_DECLARE_1 does not allow that and that lead to some code
duplication and crappyness in the drivers.
The OF_DECLARE_1 is used by all the clk drivers and the clocksource/clockevent
drivers. It is not possible to do the change in one shot as we have to change
all the init functions.
The OF_DECLARE_2 specifies an init function prototype with two parameters with
the node and its parent. The latter won't be used, ever, in the timer drivers.
Introduce a OF_DECLARE_1_RET macro to be used, and hopefully we can smoothly
and iteratively change the users of OF_DECLARE_1 to use the new macro instead.
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Acked-by: Rob Herring <robh@kernel.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/of.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/include/linux/of.h b/include/linux/of.h index c7292e8ea080..552943d37f40 100644 --- a/include/linux/of.h +++ b/include/linux/of.h @@ -1009,10 +1009,13 @@ static inline int of_get_available_child_count(const struct device_node *np) #endif typedef int (*of_init_fn_2)(struct device_node *, struct device_node *); +typedef int (*of_init_fn_1_ret)(struct device_node *); typedef void (*of_init_fn_1)(struct device_node *); #define OF_DECLARE_1(table, name, compat, fn) \ _OF_DECLARE(table, name, compat, fn, of_init_fn_1) +#define OF_DECLARE_1_RET(table, name, compat, fn) \ + _OF_DECLARE(table, name, compat, fn, of_init_fn_1_ret) #define OF_DECLARE_2(table, name, compat, fn) \ _OF_DECLARE(table, name, compat, fn, of_init_fn_2) |