1
0
Fork 0
mirror of https://github.com/linux-usb-gadgets/libusbgx.git synced 2025-07-23 03:15:09 +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

@ -17,6 +17,14 @@
#include <libconfig.h>
#endif
struct usbg_f_serial {
struct usbg_function func;
};
GENERIC_ALLOC_INST(serial, struct usbg_f_serial, func);
GENERIC_FREE_INST(serial, struct usbg_f_serial, func);
static int serial_set_attrs(struct usbg_function *f,
const usbg_function_attrs *f_attrs)
{
@ -92,8 +100,10 @@ static int serial_libconfig_import(struct usbg_function *f,
/* We don' import port_num as it is read only */
#define SERIAL_FUNCTION_OPTS \
.set_attrs = serial_set_attrs, \
.get_attrs = serial_get_attrs, \
.alloc_inst = serial_alloc_inst, \
.free_inst = serial_free_inst, \
.set_attrs = serial_set_attrs, \
.get_attrs = serial_get_attrs, \
SERIAL_LIBCONFIG_DEP_OPS, \
.import = serial_libconfig_import