component.h 1.4 KB

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