From: Andrzej Pietrasiewicz Date: Tue, 3 Dec 2013 14:15:35 +0000 (+0100) Subject: usb: gadget: FunctionFS: Remove compatibility layer X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=3d8d72a4c3c844c3c770c153bf570dc843143ac0;p=linux-beck.git usb: gadget: FunctionFS: Remove compatibility layer There are no old function interface users left, so the old interface can be removed. Signed-off-by: Andrzej Pietrasiewicz Signed-off-by: Kyungmin Park Acked-by: Michal Nazarewicz Signed-off-by: Felipe Balbi --- diff --git a/drivers/usb/gadget/f_fs.c b/drivers/usb/gadget/f_fs.c index 8d318eaaaf20..9c8c74c25f1e 100644 --- a/drivers/usb/gadget/f_fs.c +++ b/drivers/usb/gadget/f_fs.c @@ -97,19 +97,12 @@ static struct ffs_function *ffs_func_from_usb(struct usb_function *f) return container_of(f, struct ffs_function, function); } -#ifdef USB_FFS_INCLUDED -static void ffs_func_free(struct ffs_function *func); -#endif static void ffs_func_eps_disable(struct ffs_function *func); static int __must_check ffs_func_eps_enable(struct ffs_function *func); static int ffs_func_bind(struct usb_configuration *, struct usb_function *); -#ifdef USB_FFS_INCLUDED -static void old_ffs_func_unbind(struct usb_configuration *, - struct usb_function *); -#endif static int ffs_func_set_alt(struct usb_function *, unsigned, unsigned); static void ffs_func_disable(struct usb_function *); static int ffs_func_setup(struct usb_function *, @@ -165,9 +158,7 @@ ffs_sb_create_file(struct super_block *sb, const char *name, void *data, /* Devices management *******************************************************/ DEFINE_MUTEX(ffs_lock); -#ifndef USB_FFS_INCLUDED EXPORT_SYMBOL(ffs_lock); -#endif static struct ffs_dev *ffs_find_dev(const char *name); static void *ffs_acquire_dev(const char *dev_name); @@ -1303,75 +1294,6 @@ static void ffs_epfiles_destroy(struct ffs_epfile *epfiles, unsigned count) kfree(epfiles); } -#ifdef USB_FFS_INCLUDED - -static int functionfs_bind_config(struct usb_composite_dev *cdev, - struct usb_configuration *c, - struct ffs_data *ffs) -{ - struct ffs_function *func; - int ret; - - ENTER(); - - func = kzalloc(sizeof *func, GFP_KERNEL); - if (unlikely(!func)) - return -ENOMEM; - - func->function.name = "Function FS Gadget"; - func->function.strings = ffs->stringtabs; - - func->function.bind = ffs_func_bind; - func->function.unbind = old_ffs_func_unbind; - func->function.set_alt = ffs_func_set_alt; - func->function.disable = ffs_func_disable; - func->function.setup = ffs_func_setup; - func->function.suspend = ffs_func_suspend; - func->function.resume = ffs_func_resume; - - func->conf = c; - func->gadget = cdev->gadget; - func->ffs = ffs; - ffs_data_get(ffs); - - ret = usb_add_function(c, &func->function); - if (unlikely(ret)) - ffs_func_free(func); - - return ret; -} - -static void ffs_func_free(struct ffs_function *func) -{ - struct ffs_ep *ep = func->eps; - unsigned count = func->ffs->eps_count; - unsigned long flags; - - ENTER(); - - /* cleanup after autoconfig */ - spin_lock_irqsave(&func->ffs->eps_lock, flags); - do { - if (ep->ep && ep->req) - usb_ep_free_request(ep->ep, ep->req); - ep->req = NULL; - ++ep; - } while (--count); - spin_unlock_irqrestore(&func->ffs->eps_lock, flags); - - ffs_data_put(func->ffs); - - kfree(func->eps); - /* - * eps and interfaces_nums are allocated in the same chunk so - * only one free is required. Descriptors are also allocated - * in the same chunk. - */ - - kfree(func); -} - -#endif static void ffs_func_eps_disable(struct ffs_function *func) { @@ -2035,7 +1957,6 @@ static int __ffs_func_bind_do_nums(enum ffs_entity_type type, u8 *valuep, return 0; } -#ifndef USB_FFS_INCLUDED static inline struct f_fs_opts *ffs_do_functionfs_bind(struct usb_function *f, struct usb_configuration *c) { @@ -2084,7 +2005,6 @@ static inline struct f_fs_opts *ffs_do_functionfs_bind(struct usb_function *f, return ffs_opts; } -#endif static int _ffs_func_bind(struct usb_configuration *c, struct usb_function *f) @@ -2190,12 +2110,10 @@ error: static int ffs_func_bind(struct usb_configuration *c, struct usb_function *f) { -#ifndef USB_FFS_INCLUDED struct f_fs_opts *ffs_opts = ffs_do_functionfs_bind(f, c); if (IS_ERR(ffs_opts)) return PTR_ERR(ffs_opts); -#endif return _ffs_func_bind(c, f); } @@ -2203,28 +2121,6 @@ static int ffs_func_bind(struct usb_configuration *c, /* Other USB function hooks *************************************************/ -#ifdef USB_FFS_INCLUDED - -static void old_ffs_func_unbind(struct usb_configuration *c, - struct usb_function *f) -{ - struct ffs_function *func = ffs_func_from_usb(f); - struct ffs_data *ffs = func->ffs; - - ENTER(); - - if (ffs->func == func) { - ffs_func_eps_disable(func); - ffs->func = NULL; - } - - ffs_event_add(ffs, FUNCTIONFS_UNBIND); - - ffs_func_free(func); -} - -#endif - static int ffs_func_set_alt(struct usb_function *f, unsigned interface, unsigned alt) { @@ -2401,8 +2297,6 @@ static struct ffs_dev *ffs_find_dev(const char *name) /* Function registration interface ******************************************/ -#ifndef USB_FFS_INCLUDED - static void ffs_free_inst(struct usb_function_instance *f) { struct f_fs_opts *opts; @@ -2507,8 +2401,6 @@ static struct usb_function *ffs_alloc(struct usb_function_instance *fi) return &func->function; } -#endif - /* * ffs_lock must be taken by the caller of this function */ @@ -2567,9 +2459,7 @@ int ffs_name_dev(struct ffs_dev *dev, const char *name) return ret; } -#ifndef USB_FFS_INCLUDED EXPORT_SYMBOL(ffs_name_dev); -#endif int ffs_single_dev(struct ffs_dev *dev) { @@ -2586,9 +2476,7 @@ int ffs_single_dev(struct ffs_dev *dev) ffs_dev_unlock(); return ret; } -#ifndef USB_FFS_INCLUDED EXPORT_SYMBOL(ffs_single_dev); -#endif /* * ffs_lock must be taken by the caller of this function @@ -2719,8 +2607,6 @@ static char *ffs_prepare_buffer(const char __user *buf, size_t len) return data; } -#ifndef USB_FFS_INCLUDED DECLARE_USB_FUNCTION_INIT(ffs, ffs_alloc_inst, ffs_alloc); MODULE_LICENSE("GPL"); MODULE_AUTHOR("Michal Nazarewicz"); -#endif diff --git a/drivers/usb/gadget/u_fs.h b/drivers/usb/gadget/u_fs.h index d60a9ddc0332..09313750f913 100644 --- a/drivers/usb/gadget/u_fs.h +++ b/drivers/usb/gadget/u_fs.h @@ -249,7 +249,6 @@ struct ffs_data { }; -#ifndef USB_FFS_INCLUDED struct f_fs_opts { struct usb_function_instance func_inst; struct ffs_dev *dev; @@ -261,6 +260,5 @@ static inline struct f_fs_opts *to_f_fs_opts(struct usb_function_instance *fi) { return container_of(fi, struct f_fs_opts, func_inst); } -#endif #endif /* U_FFS_H */ diff --git a/include/linux/usb/functionfs.h b/include/linux/usb/functionfs.h index 3448efbe56aa..71190663f1ee 100644 --- a/include/linux/usb/functionfs.h +++ b/include/linux/usb/functionfs.h @@ -3,22 +3,4 @@ #include -#ifdef USB_FFS_INCLUDED - -struct ffs_data; -struct usb_composite_dev; -struct usb_configuration; - -static int functionfs_bind(struct ffs_data *ffs, struct usb_composite_dev *cdev) - __attribute__((warn_unused_result, nonnull)); -static void functionfs_unbind(struct ffs_data *ffs) - __attribute__((nonnull)); - -static int functionfs_bind_config(struct usb_composite_dev *cdev, - struct usb_configuration *c, - struct ffs_data *ffs) - __attribute__((warn_unused_result, nonnull)); - - -#endif #endif