diff options
author | Andrzej Pietrasiewicz <andrzej.p@samsung.com> | 2013-12-03 15:15:21 +0100 |
---|---|---|
committer | Marek Szyprowski <m.szyprowski@samsung.com> | 2014-05-15 07:26:41 +0200 |
commit | 6a48a545aea972be222bc6a6766bdba006cfb7b0 (patch) | |
tree | 2b07e7997529e69adb9056cef574e2c94d552381 /include | |
parent | a45b0aa999f80fc4f522d02ba0a5bc7c37435832 (diff) | |
download | linux-3.10-6a48a545aea972be222bc6a6766bdba006cfb7b0.tar.gz linux-3.10-6a48a545aea972be222bc6a6766bdba006cfb7b0.tar.bz2 linux-3.10-6a48a545aea972be222bc6a6766bdba006cfb7b0.zip |
usb: gadget: configfs: allow setting function instance's name
USB function's configfs config group is created in a generic way in
usb/gadget/configfs.c:function_make(), which in turn delegates actual
allocation and setup of the USB function instance to a particular
implementation, e.g. in f_acm.c. The said implementation does its job
in a parameter-less function e.g. acm_alloc_instance(), which results
in creating an unnamed config group, whose name is set later in
function_make(). function_make() creates the name by parsing a string
of the form:
<function name>.<instance name>
which comes from userspace as a parameter to mkdir invocation.
Up to now only <function name> has been used, while <instance name>
has been ignored. This patch adds a set_inst_name() operation to
struct usb_function_instance which allows passing the <instance name>
from function_make() so that it is not ignored. It is entirely up to the
implementor of set_inst_name() what to do with the <instance name>.
In a typical case, the struct usb_function_instance is embedded in a
larger struct which is retrieved in set_inst_name() with container_of(),
and the larger struct contains a field to store the <instance name>.
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/usb/composite.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h index 5e61589fc16..dba63f53906 100644 --- a/include/linux/usb/composite.h +++ b/include/linux/usb/composite.h @@ -468,6 +468,8 @@ struct usb_function_instance { struct config_group group; struct list_head cfs_list; struct usb_function_driver *fd; + int (*set_inst_name)(struct usb_function_instance *inst, + const char *name); void (*free_func_inst)(struct usb_function_instance *inst); }; |