| 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 | |
| 9 | #ifndef __MODULE_H |
| 10 | #define __MODULE_H |
| 11 | |
| 12 | #include <linux/types.h> |
| 13 | #include <linux/device.h> |
| 14 | |
| 15 | struct gb_module { |
| 16 | struct device dev; |
| 17 | struct gb_host_device *hd; |
| 18 | |
| 19 | struct list_head hd_node; |
| 20 | |
| 21 | u8 module_id; |
| 22 | size_t num_interfaces; |
| 23 | |
| 24 | bool disconnected; |
| 25 | |
| 26 | struct gb_interface *interfaces[]; |
| 27 | }; |
| 28 | #define to_gb_module(d) container_of(d, struct gb_module, dev) |
| 29 | |
| 30 | struct gb_module *gb_module_create(struct gb_host_device *hd, u8 module_id, |
| 31 | size_t num_interfaces); |
| 32 | int gb_module_add(struct gb_module *module); |
| 33 | void gb_module_del(struct gb_module *module); |
| 34 | void gb_module_put(struct gb_module *module); |
| 35 | |
| 36 | #endif /* __MODULE_H */ |
| 37 | |