module.h 753 B

123456789101112131415161718192021222324252627282930313233343536
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Greybus Module code
  4. *
  5. * Copyright 2016 Google Inc.
  6. * Copyright 2016 Linaro Ltd.
  7. */
  8. #ifndef __MODULE_H
  9. #define __MODULE_H
  10. #include <linux/types.h>
  11. #include <linux/device.h>
  12. struct gb_module {
  13. struct device dev;
  14. struct gb_host_device *hd;
  15. struct list_head hd_node;
  16. u8 module_id;
  17. size_t num_interfaces;
  18. bool disconnected;
  19. struct gb_interface *interfaces[];
  20. };
  21. #define to_gb_module(d) container_of(d, struct gb_module, dev)
  22. struct gb_module *gb_module_create(struct gb_host_device *hd, u8 module_id,
  23. size_t num_interfaces);
  24. int gb_module_add(struct gb_module *module);
  25. void gb_module_del(struct gb_module *module);
  26. void gb_module_put(struct gb_module *module);
  27. #endif /* __MODULE_H */