#define EXPORT __attribute__ ((visibility("default")))
#endif
-static struct usb_function *_available_funcs[];
+static const struct usb_function *_available_funcs[];
static void simple_cleanup_config(struct usb_configuration *config)
{
return -ENOMEM;
}
-static inline struct usb_function *find_func(struct usb_gadget *gadget,
+static inline const struct usb_function *find_func(struct usb_gadget *gadget,
int func_id)
{
int i;
int n_functions;
int n_configs = 0;
struct usb_gadget *gadget;
- struct usb_function **funcs;
+ const struct usb_function **funcs;
int functions[2][sizeof(gadget_id->function_mask)*8]; /* zero terminates */
if (!gadget_id || !_gadget)
}
#define DEFINE_USB_FUNCTION(_id, _name, _is_functionfs, _service, _handler) \
- static struct usb_function _##_name##_function = { \
+ static const struct usb_function _##_name##_function = { \
.id = _id, \
.name = #_name, \
.instance = "default", \
#undef DEFINE_USB_FUNCTION
/* Caution: index order of arrary is important, because simple_id_to_gadget() uses it. */
-static struct usb_function *_available_funcs[] = {
+static const struct usb_function *_available_funcs[] = {
[USB_FUNCTION_IDX_MTP] = &_mtp_function,
[USB_FUNCTION_IDX_ACM] = &_acm_function,
[USB_FUNCTION_IDX_SDB] = &_sdb_function,
[USB_FUNCTION_IDX_MAX] = NULL /* An indicator to end the array */
};
-struct usb_function *find_usb_function_by_name(const char *name)
+const struct usb_function *find_usb_function_by_name(const char *name)
{
int i;
return NULL;
}
-struct usb_function *find_usb_function_by_name_instance(const char *name, const char *instance)
+const struct usb_function *find_usb_function_by_name_instance(const char *name, const char *instance)
{
int i;
* As a result, all usb operations do not work properly.
* So in environments that mtp doesn't support, use dummy mtp.
*/
- if (access("/usr/lib/systemd/system/mtp-responder.socket", F_OK)) {
- _available_funcs[USB_FUNCTION_IDX_MTP]->service = "mtp-responder-dummy";
- }
+ if (access("/usr/lib/systemd/system/mtp-responder.socket", F_OK))
+ ((struct usb_function*)_available_funcs[USB_FUNCTION_IDX_MTP])->service = "mtp-responder-dummy";
*common = &simple_translator->common;
return 0;