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

Signed-off-by: Andrzej Pietrasiewicz <andrze...@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.p...@samsung.com>
---
 drivers/usb/gadget/f_fs.c      |  148 +---------------------------------------
 drivers/usb/gadget/u_fs.h      |    2 -
 include/linux/usb/functionfs.h |   33 ---------
 3 files changed, 2 insertions(+), 181 deletions(-)

diff --git a/drivers/usb/gadget/f_fs.c b/drivers/usb/gadget/f_fs.c
index bba96ad..fbceb47 100644
--- a/drivers/usb/gadget/f_fs.c
+++ b/drivers/usb/gadget/f_fs.c
@@ -87,19 +87,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 *,
@@ -157,7 +150,6 @@ ffs_sb_create_file(struct super_block *sb, const char 
*name, void *data,
 static struct ffs_dev *ffs_alloc_dev(void);
 static void ffs_free_dev(struct ffs_dev *dev);
 
-#ifndef USB_FFS_INCLUDED
 static struct mutex *ffs_dev_lock;
 
 static void *(*ffs_acquire_dev_cb)(const char *name);
@@ -172,7 +164,6 @@ static struct kref auto_init_ref;
 static DEFINE_MUTEX(auto_init_lock);
 
 static struct module *ffs_owner;
-#endif
 
 /* Misc helper functions ****************************************************/
 
@@ -298,11 +289,8 @@ static ssize_t ffs_ep0_write(struct file *file, const char 
__user *buf,
                        ffs->state = FFS_ACTIVE;
                        mutex_unlock(&ffs->mutex);
 
-#ifdef USB_FFS_INCLUDED
-                       ret = functionfs_ready_callback(ffs);
-#else
                        ret = ffs_ready_cb(ffs);
-#endif
+
                        if (unlikely(ret < 0)) {
                                ffs->state = FFS_CLOSING;
                                return ret;
@@ -1033,13 +1021,6 @@ ffs_fs_mount(struct file_system_type *t, int flags,
                return ERR_PTR(-ENOMEM);
        }
 
-#ifdef USB_FFS_INCLUDED
-       ffs_dev = functionfs_acquire_dev_callback(dev_name);
-       if (IS_ERR(ffs_dev)) {
-               ffs_data_put(ffs);
-               return ERR_CAST(ffs_dev);
-       }
-#else
        if (ffs_owner && !try_module_get(ffs_owner)) {
                ffs_data_put(ffs);
                return ERR_PTR(-ENODEV);
@@ -1052,21 +1033,16 @@ ffs_fs_mount(struct file_system_type *t, int flags,
 
                return ERR_CAST(ffs_dev);
        }
-#endif
+
        ffs->private_data = ffs_dev;
        data.ffs_data = ffs;
 
        rv = mount_nodev(t, flags, &data, ffs_sb_fill);
        if (IS_ERR(rv) && data.ffs_data) {
-#ifdef USB_FFS_INCLUDED
-               functionfs_release_dev_callback(data.ffs_data);
-               ffs_data_put(data.ffs_data);
-#else
                ffs_release_dev_cb(data.ffs_data);
                ffs_data_put(data.ffs_data);
                if (ffs_owner)
                        module_put(ffs_owner);
-#endif
        }
        return rv;
 }
@@ -1078,15 +1054,10 @@ ffs_fs_kill_sb(struct super_block *sb)
 
        kill_litter_super(sb);
        if (sb->s_fs_info) {
-#ifdef USB_FFS_INCLUDED
-               functionfs_release_dev_callback(sb->s_fs_info);
-               ffs_data_put(sb->s_fs_info);
-#else
                ffs_release_dev_cb(sb->s_fs_info);
                ffs_data_put(sb->s_fs_info);
                if (ffs_owner)
                        module_put(ffs_owner);
-#endif
        }
 }
 
@@ -1107,7 +1078,6 @@ int functionfs_init(struct module *owner)
 
        ENTER();
 
-#ifndef USB_FFS_INCLUDED
        if (!ffs_acquire_dev_cb || !ffs_release_dev_cb ||
            !ffs_ready_cb || !ffs_closed_cb) {
                ret = -ENODEV;
@@ -1115,7 +1085,6 @@ int functionfs_init(struct module *owner)
                return ret;
        }
        ffs_owner = owner;
-#endif
 
        ret = register_filesystem(&ffs_fs_type);
        if (likely(!ret))
@@ -1125,17 +1094,13 @@ int functionfs_init(struct module *owner)
 
        return ret;
 }
-#ifndef USB_FFS_INCLUDED
 EXPORT_SYMBOL(functionfs_init);
-#endif
 
 void functionfs_cleanup(void)
 {
-#ifndef USB_FFS_INCLUDED
        ffs_owner = NULL;
        do_auto_init = true;
        auto_init_active = true;
-#endif
 
        ENTER();
 
@@ -1143,9 +1108,7 @@ void functionfs_cleanup(void)
 
        unregister_filesystem(&ffs_fs_type);
 }
-#ifndef USB_FFS_INCLUDED
 EXPORT_SYMBOL(functionfs_cleanup);
-#endif
 
 
 /* ffs_data and ffs_function construction and destruction code **************/
@@ -1221,11 +1184,7 @@ static void ffs_data_clear(struct ffs_data *ffs)
        ENTER();
 
        if (test_and_clear_bit(FFS_FL_CALL_CLOSED_CALLBACK, &ffs->flags))
-#ifdef USB_FFS_INCLUDED
-               functionfs_closed_callback(ffs);
-#else
                ffs_closed_cb(ffs);
-#endif
 
        BUG_ON(ffs->gadget);
 
@@ -1361,75 +1320,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)
 {
        struct ffs_ep *ep         = func->eps;
@@ -2108,7 +1998,6 @@ static inline void mutex_unlock_if_nonnull(struct mutex 
*mutex)
                mutex_unlock(mutex);
 }
 
-#ifndef USB_FFS_INCLUDED
 static inline struct f_fs_opts *ffs_do_functionfs_bind(struct usb_function *f,
                                                struct usb_configuration *c)
 {
@@ -2156,7 +2045,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)
@@ -2262,12 +2150,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);
 }
@@ -2275,28 +2161,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)
 {
@@ -2457,7 +2321,6 @@ struct ffs_dev *ffs_find_dev(const char *name)
 
        return NULL;
 }
-#ifndef USB_FFS_INCLUDED
 EXPORT_SYMBOL(ffs_find_dev);
 
 bool ffs_set_auto_init(bool flag)
@@ -2496,13 +2359,10 @@ void ffs_set_closed_cb(void (*cb)(struct ffs_data 
*ffs_data))
        ffs_closed_cb = cb;
 }
 EXPORT_SYMBOL(ffs_set_closed_cb);
-#endif
 
 
 /* Function registration interface ******************************************/
 
-#ifndef USB_FFS_INCLUDED
-
 static void do_cleanup(struct kref *ref)
 {
        if (auto_init_active)
@@ -2651,8 +2511,6 @@ static struct usb_function *ffs_alloc(struct 
usb_function_instance *fi)
        return &func->function;
 }
 
-#endif
-
 
 /* Misc helper functions ****************************************************/
 
@@ -2685,8 +2543,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 478a7ae..e5eca6c 100644
--- a/drivers/usb/gadget/u_fs.h
+++ b/drivers/usb/gadget/u_fs.h
@@ -225,7 +225,6 @@ struct ffs_data {
 };
 
 
-#ifndef USB_FFS_INCLUDED
 struct f_fs_opts {
        struct usb_function_instance    func_inst;
        struct ffs_dev                  *dev;
@@ -246,6 +245,5 @@ int functionfs_init(struct module *owner);
 void functionfs_cleanup(void);
 struct ffs_dev *ffs_find_dev(const char *name);
 bool ffs_set_auto_init(bool flag);
-#endif
 
 #endif /* U_FFS_H */
diff --git a/include/linux/usb/functionfs.h b/include/linux/usb/functionfs.h
index 5a1374a..7119066 100644
--- a/include/linux/usb/functionfs.h
+++ b/include/linux/usb/functionfs.h
@@ -3,37 +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_init(struct module *owner)
-       __attribute__((warn_unused_result));
-static void functionfs_cleanup(void);
-
-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));
-
-
-static int functionfs_ready_callback(struct ffs_data *ffs)
-       __attribute__((warn_unused_result, nonnull));
-static void functionfs_closed_callback(struct ffs_data *ffs)
-       __attribute__((nonnull));
-static void *functionfs_acquire_dev_callback(const char *dev_name)
-       __attribute__((warn_unused_result, nonnull));
-static void functionfs_release_dev_callback(struct ffs_data *ffs_data)
-       __attribute__((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 majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to