Skip to content

Commit

Permalink
usb: gadget: FunctionFS: Remove compatibility layer
Browse files Browse the repository at this point in the history
There are no old function interface users left, so the old interface can
be removed.

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>
  • Loading branch information
Andrzej Pietrasiewicz authored and Felipe Balbi committed Dec 12, 2013
1 parent 6f823cd commit 3d8d72a
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 134 deletions.
114 changes: 0 additions & 114 deletions drivers/usb/gadget/f_fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 *,
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -2190,41 +2110,17 @@ static int _ffs_func_bind(struct usb_configuration *c,
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);
}


/* 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)
{
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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
*/
Expand Down Expand Up @@ -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)
{
Expand All @@ -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
Expand Down Expand Up @@ -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
2 changes: 0 additions & 2 deletions drivers/usb/gadget/u_fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 */
18 changes: 0 additions & 18 deletions include/linux/usb/functionfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 3d8d72a

Please sign in to comment.