component.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #ifndef COMPONENT_H
  2. #define COMPONENT_H
  3. #include <linux/stddef.h>
  4. struct device;
  5. struct component_ops {
  6. int (*bind)(struct device *comp, struct device *master,
  7. void *master_data);
  8. void (*unbind)(struct device *comp, struct device *master,
  9. void *master_data);
  10. };
  11. int component_add(struct device *, const struct component_ops *);
  12. void component_del(struct device *, const struct component_ops *);
  13. int component_bind_all(struct device *master, void *master_data);
  14. void component_unbind_all(struct device *master, void *master_data);
  15. struct master;
  16. struct component_master_ops {
  17. int (*bind)(struct device *master);
  18. void (*unbind)(struct device *master);
  19. };
  20. void component_master_del(struct device *,
  21. const struct component_master_ops *);
  22. struct component_match;
  23. int component_master_add_with_match(struct device *,
  24. const struct component_master_ops *, struct component_match *);
  25. void component_match_add_release(struct device *master,
  26. struct component_match **matchptr,
  27. void (*release)(struct device *, void *),
  28. int (*compare)(struct device *, void *), void *compare_data);
  29. static inline void component_match_add(struct device *master,
  30. struct component_match **matchptr,
  31. int (*compare)(struct device *, void *), void *compare_data)
  32. {
  33. component_match_add_release(master, matchptr, NULL, compare,
  34. compare_data);
  35. }
  36. #endif