diff options
| author | Grant Likely <grant.likely@linaro.org> | 2014-11-24 12:58:01 -0500 |
|---|---|---|
| committer | Grant Likely <grant.likely@linaro.org> | 2014-11-24 17:25:03 -0500 |
| commit | f5242e5a883bf1c1aba6bfd87b85e7dda0e62191 (patch) | |
| tree | ff348e70ad50d96de50212f9a6e6b6088bb7feef /include/linux/of.h | |
| parent | 00aa37206e1a54dae61a0dba96bf2ee0938b99d7 (diff) | |
of/reconfig: Always use the same structure for notifiers
The OF_RECONFIG notifier callback uses a different structure depending
on whether it is a node change or a property change. This is silly, and
not very safe. Rework the code to use the same data structure regardless
of the type of notifier.
Signed-off-by: Grant Likely <grant.likely@linaro.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
Cc: <linuxppc-dev@lists.ozlabs.org>
Diffstat (limited to 'include/linux/of.h')
| -rw-r--r-- | include/linux/of.h | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/include/linux/of.h b/include/linux/of.h index b59ee21933a4..fe1dec87fd68 100644 --- a/include/linux/of.h +++ b/include/linux/of.h | |||
| @@ -73,6 +73,12 @@ struct of_phandle_args { | |||
| 73 | uint32_t args[MAX_PHANDLE_ARGS]; | 73 | uint32_t args[MAX_PHANDLE_ARGS]; |
| 74 | }; | 74 | }; |
| 75 | 75 | ||
| 76 | struct of_reconfig_data { | ||
| 77 | struct device_node *dn; | ||
| 78 | struct property *prop; | ||
| 79 | struct property *old_prop; | ||
| 80 | }; | ||
| 81 | |||
| 76 | /* initialize a node */ | 82 | /* initialize a node */ |
| 77 | extern struct kobj_type of_node_ktype; | 83 | extern struct kobj_type of_node_ktype; |
| 78 | static inline void of_node_init(struct device_node *node) | 84 | static inline void of_node_init(struct device_node *node) |
| @@ -318,12 +324,6 @@ extern int of_update_property(struct device_node *np, struct property *newprop); | |||
| 318 | #define OF_RECONFIG_REMOVE_PROPERTY 0x0004 | 324 | #define OF_RECONFIG_REMOVE_PROPERTY 0x0004 |
| 319 | #define OF_RECONFIG_UPDATE_PROPERTY 0x0005 | 325 | #define OF_RECONFIG_UPDATE_PROPERTY 0x0005 |
| 320 | 326 | ||
| 321 | struct of_prop_reconfig { | ||
| 322 | struct device_node *dn; | ||
| 323 | struct property *prop; | ||
| 324 | struct property *old_prop; | ||
| 325 | }; | ||
| 326 | |||
| 327 | extern int of_attach_node(struct device_node *); | 327 | extern int of_attach_node(struct device_node *); |
| 328 | extern int of_detach_node(struct device_node *); | 328 | extern int of_detach_node(struct device_node *); |
| 329 | 329 | ||
| @@ -892,8 +892,9 @@ enum of_reconfig_change { | |||
| 892 | #ifdef CONFIG_OF_DYNAMIC | 892 | #ifdef CONFIG_OF_DYNAMIC |
| 893 | extern int of_reconfig_notifier_register(struct notifier_block *); | 893 | extern int of_reconfig_notifier_register(struct notifier_block *); |
| 894 | extern int of_reconfig_notifier_unregister(struct notifier_block *); | 894 | extern int of_reconfig_notifier_unregister(struct notifier_block *); |
| 895 | extern int of_reconfig_notify(unsigned long, void *); | 895 | extern int of_reconfig_notify(unsigned long, struct of_reconfig_data *rd); |
| 896 | extern int of_reconfig_get_state_change(unsigned long action, void *arg); | 896 | extern int of_reconfig_get_state_change(unsigned long action, |
| 897 | struct of_reconfig_data *arg); | ||
| 897 | 898 | ||
| 898 | extern void of_changeset_init(struct of_changeset *ocs); | 899 | extern void of_changeset_init(struct of_changeset *ocs); |
| 899 | extern void of_changeset_destroy(struct of_changeset *ocs); | 900 | extern void of_changeset_destroy(struct of_changeset *ocs); |
| @@ -941,11 +942,13 @@ static inline int of_reconfig_notifier_unregister(struct notifier_block *nb) | |||
| 941 | { | 942 | { |
| 942 | return -EINVAL; | 943 | return -EINVAL; |
| 943 | } | 944 | } |
| 944 | static inline int of_reconfig_notify(unsigned long action, void *arg) | 945 | static inline int of_reconfig_notify(unsigned long action, |
| 946 | struct of_reconfig_data *arg) | ||
| 945 | { | 947 | { |
| 946 | return -EINVAL; | 948 | return -EINVAL; |
| 947 | } | 949 | } |
| 948 | static inline int of_reconfig_get_state_change(unsigned long action, void *arg) | 950 | static inline int of_reconfig_get_state_change(unsigned long action, |
| 951 | struct of_reconfig_data *arg) | ||
| 949 | { | 952 | { |
| 950 | return -EINVAL; | 953 | return -EINVAL; |
| 951 | } | 954 | } |
