xref: /linux-6.15/include/linux/greybus/module.h (revision 5224f790)
1ec0ad868SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
2ec0ad868SGreg Kroah-Hartman /*
3ec0ad868SGreg Kroah-Hartman  * Greybus Module code
4ec0ad868SGreg Kroah-Hartman  *
5ec0ad868SGreg Kroah-Hartman  * Copyright 2016 Google Inc.
6ec0ad868SGreg Kroah-Hartman  * Copyright 2016 Linaro Ltd.
7ec0ad868SGreg Kroah-Hartman  */
8ec0ad868SGreg Kroah-Hartman 
9ec0ad868SGreg Kroah-Hartman #ifndef __MODULE_H
10ec0ad868SGreg Kroah-Hartman #define __MODULE_H
11ec0ad868SGreg Kroah-Hartman 
12c10bf392SRui Miguel Silva #include <linux/types.h>
13c10bf392SRui Miguel Silva #include <linux/device.h>
14c10bf392SRui Miguel Silva 
15ec0ad868SGreg Kroah-Hartman struct gb_module {
16ec0ad868SGreg Kroah-Hartman 	struct device dev;
17ec0ad868SGreg Kroah-Hartman 	struct gb_host_device *hd;
18ec0ad868SGreg Kroah-Hartman 
19ec0ad868SGreg Kroah-Hartman 	struct list_head hd_node;
20ec0ad868SGreg Kroah-Hartman 
21ec0ad868SGreg Kroah-Hartman 	u8 module_id;
22ec0ad868SGreg Kroah-Hartman 	size_t num_interfaces;
23ec0ad868SGreg Kroah-Hartman 
24ec0ad868SGreg Kroah-Hartman 	bool disconnected;
25ec0ad868SGreg Kroah-Hartman 
26*5224f790SGustavo A. R. Silva 	struct gb_interface *interfaces[];
27ec0ad868SGreg Kroah-Hartman };
28ec0ad868SGreg Kroah-Hartman #define to_gb_module(d) container_of(d, struct gb_module, dev)
29ec0ad868SGreg Kroah-Hartman 
30ec0ad868SGreg Kroah-Hartman struct gb_module *gb_module_create(struct gb_host_device *hd, u8 module_id,
31ec0ad868SGreg Kroah-Hartman 				   size_t num_interfaces);
32ec0ad868SGreg Kroah-Hartman int gb_module_add(struct gb_module *module);
33ec0ad868SGreg Kroah-Hartman void gb_module_del(struct gb_module *module);
34ec0ad868SGreg Kroah-Hartman void gb_module_put(struct gb_module *module);
35ec0ad868SGreg Kroah-Hartman 
36ec0ad868SGreg Kroah-Hartman #endif /* __MODULE_H */
37