xref: /linux/drivers/usb/gadget/function/u_gether.h (revision aea7c84f28f1117653f7443806905d7aeef13ba8)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * u_gether.h
4  *
5  * Utility definitions for the subset function
6  *
7  * Copyright (c) 2013 Samsung Electronics Co., Ltd.
8  *		http://www.samsung.com
9  *
10  * Author: Andrzej Pietrasiewicz <andrzejtp2010@gmail.com>
11  */
12 
13 #ifndef U_GETHER_H
14 #define U_GETHER_H
15 
16 #include <linux/usb/composite.h>
17 
18 /**
19  * struct f_gether_opts - subset function options
20  * @func_inst: USB function instance.
21  * @net: The net_device associated with the subset function.
22  * @bound: True if the net_device is shared and pre-registered during the
23  *         legacy composite driver's bind phase (e.g., multi.c). If false,
24  *         the subset function will register the net_device during its own
25  *         bind phase.
26  * @bind_count: Tracks the number of configurations the subset function is
27  *              bound to, preventing double-registration of the @net device.
28  * @lock: Protects the data from concurrent access by configfs read/write
29  *        and create symlink/remove symlink operations.
30  * @refcnt: Reference counter for the function instance.
31  */
32 struct f_gether_opts {
33 	struct usb_function_instance	func_inst;
34 	struct net_device		*net;
35 	bool				bound;
36 	int				bind_count;
37 	struct mutex			lock;
38 	int				refcnt;
39 };
40 
41 #endif /* U_GETHER_H */
42