1
0
Fork 0
mirror of https://github.com/linux-usb-gadgets/libusbgx.git synced 2025-07-20 08:25:05 +03:00

libusbgx: common: Add alloc_inst() and free_inst() callbacks

Those callback can be used by specific function type to allocate
and then free more memory than in raw usbg_function structure.

Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
This commit is contained in:
Krzysztof Opasiak 2015-12-22 23:13:44 +01:00
parent 8c5f9cde66
commit 5ea221a027
10 changed files with 166 additions and 42 deletions

View file

@ -18,6 +18,14 @@
#include <libconfig.h>
#endif
struct usbg_f_ether {
struct usbg_function func;
};
GENERIC_ALLOC_INST(ether, struct usbg_f_ether, func);
GENERIC_FREE_INST(ether, struct usbg_f_ether, func);
static int ether_set_attrs(struct usbg_function *f,
const usbg_function_attrs *f_attrs)
{
@ -216,6 +224,8 @@ out:
#endif /* HAS_LIBCONFIG */
#define ETHER_FUNCTION_OPTS \
.alloc_inst = ether_alloc_inst, \
.free_inst = ether_free_inst, \
.set_attrs = ether_set_attrs, \
.get_attrs = ether_get_attrs, \
.cleanup_attrs = ether_cleanup_attrs, \