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

@ -17,6 +17,14 @@
#include <libconfig.h>
#endif
struct usbg_f_fs {
struct usbg_function func;
};
GENERIC_ALLOC_INST(ffs, struct usbg_f_fs, func);
GENERIC_FREE_INST(ffs, struct usbg_f_fs, func);
static int ffs_set_attrs(struct usbg_function *f,
const usbg_function_attrs *f_attrs)
{
@ -72,6 +80,8 @@ static int ffs_libconfig_export(struct usbg_function *f,
struct usbg_function_type usbg_f_type_ffs = {
.name = "ffs",
.alloc_inst = ffs_alloc_inst,
.free_inst = ffs_free_inst,
.set_attrs = ffs_set_attrs,
.get_attrs = ffs_get_attrs,
.cleanup_attrs = ffs_cleanup_attrs,