[PATCH v4 15/16] usb/gadget: FunctionFS: Remove compatibility layer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



There are no old function interface users left, so the old interface can
be removed.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@xxxxxxxxxxx>
Signed-off-by: Kyungmin Park <kyungmin.park@xxxxxxxxxxx>
---
 drivers/usb/gadget/f_fs.c      |  114 ----------------------------------------
 drivers/usb/gadget/u_fs.h      |    2 -
 include/linux/usb/functionfs.h |   18 ------
 3 files changed, 0 insertions(+), 134 deletions(-)

diff --git a/drivers/usb/gadget/f_fs.c b/drivers/usb/gadget/f_fs.c
index 901f0ba..e9eaa91 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);
@@ -1302,75 +1293,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)
 {
@@ -2034,7 +1956,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)
 {
@@ -2083,7 +2004,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)
@@ -2189,12 +2109,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);
 }
@@ -2202,28 +2120,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)
 {
@@ -2400,8 +2296,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;
@@ -2506,8 +2400,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
  */
@@ -2552,9 +2444,7 @@ int ffs_name_dev(struct ffs_dev *dev, const char *name)
 
 	return 0;
 }
-#ifndef USB_FFS_INCLUDED
 EXPORT_SYMBOL(ffs_name_dev);
-#endif
 
 /*
  * ffs_lock must be taken by the caller of this function
@@ -2568,9 +2458,7 @@ int ffs_single_dev(struct ffs_dev *dev, bool single)
 
 	return 0;
 }
-#ifndef USB_FFS_INCLUDED
 EXPORT_SYMBOL(ffs_single_dev);
-#endif
 
 /*
  * ffs_lock must be taken by the caller of this function
@@ -2701,8 +2589,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 984e47e..9ea4215 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 3448efb..7119066 100644
--- a/include/linux/usb/functionfs.h
+++ b/include/linux/usb/functionfs.h
@@ -3,22 +3,4 @@
 
 #include <uapi/linux/usb/functionfs.h>
 
-#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
-- 
1.7.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux