Russell King | 2a41e60 | 2014-01-10 23:23:37 +0000 | [diff] [blame] | 1 | #ifndef COMPONENT_H |
| 2 | #define COMPONENT_H |
| 3 | |
Russell King | ce657b1 | 2015-11-17 12:08:01 +0000 | [diff] [blame] | 4 | #include <linux/stddef.h> |
| 5 | |
Russell King | 2a41e60 | 2014-01-10 23:23:37 +0000 | [diff] [blame] | 6 | struct device; |
| 7 | |
| 8 | struct component_ops { |
Russell King | ce657b1 | 2015-11-17 12:08:01 +0000 | [diff] [blame] | 9 | int (*bind)(struct device *comp, struct device *master, |
| 10 | void *master_data); |
| 11 | void (*unbind)(struct device *comp, struct device *master, |
| 12 | void *master_data); |
Russell King | 2a41e60 | 2014-01-10 23:23:37 +0000 | [diff] [blame] | 13 | }; |
| 14 | |
| 15 | int component_add(struct device *, const struct component_ops *); |
| 16 | void component_del(struct device *, const struct component_ops *); |
| 17 | |
Russell King | ce657b1 | 2015-11-17 12:08:01 +0000 | [diff] [blame] | 18 | int component_bind_all(struct device *master, void *master_data); |
| 19 | void component_unbind_all(struct device *master, void *master_data); |
Russell King | 2a41e60 | 2014-01-10 23:23:37 +0000 | [diff] [blame] | 20 | |
| 21 | struct master; |
| 22 | |
| 23 | struct component_master_ops { |
Russell King | ce657b1 | 2015-11-17 12:08:01 +0000 | [diff] [blame] | 24 | int (*bind)(struct device *master); |
| 25 | void (*unbind)(struct device *master); |
Russell King | 2a41e60 | 2014-01-10 23:23:37 +0000 | [diff] [blame] | 26 | }; |
| 27 | |
Russell King | 2a41e60 | 2014-01-10 23:23:37 +0000 | [diff] [blame] | 28 | void component_master_del(struct device *, |
| 29 | const struct component_master_ops *); |
| 30 | |
Russell King | 6955b58 | 2014-04-19 11:18:01 +0100 | [diff] [blame] | 31 | struct component_match; |
| 32 | |
| 33 | int component_master_add_with_match(struct device *, |
| 34 | const struct component_master_ops *, struct component_match *); |
Russell King | ce657b1 | 2015-11-17 12:08:01 +0000 | [diff] [blame] | 35 | void component_match_add_release(struct device *master, |
| 36 | struct component_match **matchptr, |
| 37 | void (*release)(struct device *, void *), |
Russell King | 6955b58 | 2014-04-19 11:18:01 +0100 | [diff] [blame] | 38 | int (*compare)(struct device *, void *), void *compare_data); |
| 39 | |
Russell King | ce657b1 | 2015-11-17 12:08:01 +0000 | [diff] [blame] | 40 | static inline void component_match_add(struct device *master, |
| 41 | struct component_match **matchptr, |
| 42 | int (*compare)(struct device *, void *), void *compare_data) |
| 43 | { |
| 44 | component_match_add_release(master, matchptr, NULL, compare, |
| 45 | compare_data); |
| 46 | } |
| 47 | |
Russell King | 2a41e60 | 2014-01-10 23:23:37 +0000 | [diff] [blame] | 48 | #endif |