Skip to content

Commit

Permalink
usb: gadget: FunctionFS: create utility file
Browse files Browse the repository at this point in the history
A header file to be used by f_fs.c and g_ffs.c will be required when
f_fs.c is converted into a module.

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 e6f3862 commit e72c39c
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 13 deletions.
1 change: 1 addition & 0 deletions drivers/usb/gadget/f_fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include <linux/usb/composite.h>
#include <linux/usb/functionfs.h>

#include "u_fs.h"

#define FUNCTIONFS_MAGIC 0xa647361 /* Chosen by a honest dice roll ;) */

Expand Down
19 changes: 6 additions & 13 deletions drivers/usb/gadget/g_ffs.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,6 @@ MODULE_LICENSE("GPL");

#define GFS_MAX_DEVS 10

struct gfs_ffs_obj {
const char *name;
bool mounted;
bool desc_ready;
struct ffs_data *ffs_data;
};

USB_GADGET_COMPOSITE_OPTIONS();

static struct usb_device_descriptor gfs_dev_desc = {
Expand Down Expand Up @@ -181,7 +174,7 @@ static DEFINE_MUTEX(gfs_lock);
static unsigned int missing_funcs;
static bool gfs_registered;
static bool gfs_single_func;
static struct gfs_ffs_obj *ffs_tab;
static struct ffs_dev *ffs_tab;

static int __init gfs_init(void)
{
Expand Down Expand Up @@ -224,7 +217,7 @@ static void __exit gfs_exit(void)
}
module_exit(gfs_exit);

static struct gfs_ffs_obj *gfs_find_dev(const char *dev_name)
static struct ffs_dev *gfs_find_dev(const char *dev_name)
{
int i;

Expand All @@ -242,7 +235,7 @@ static struct gfs_ffs_obj *gfs_find_dev(const char *dev_name)

static int functionfs_ready_callback(struct ffs_data *ffs)
{
struct gfs_ffs_obj *ffs_obj;
struct ffs_dev *ffs_obj;
int ret;

ENTER();
Expand Down Expand Up @@ -283,7 +276,7 @@ static int functionfs_ready_callback(struct ffs_data *ffs)

static void functionfs_closed_callback(struct ffs_data *ffs)
{
struct gfs_ffs_obj *ffs_obj;
struct ffs_dev *ffs_obj;

ENTER();
mutex_lock(&gfs_lock);
Expand All @@ -305,7 +298,7 @@ static void functionfs_closed_callback(struct ffs_data *ffs)

static void *functionfs_acquire_dev_callback(const char *dev_name)
{
struct gfs_ffs_obj *ffs_dev;
struct ffs_dev *ffs_dev;

ENTER();
mutex_lock(&gfs_lock);
Expand All @@ -329,7 +322,7 @@ static void *functionfs_acquire_dev_callback(const char *dev_name)

static void functionfs_release_dev_callback(struct ffs_data *ffs_data)
{
struct gfs_ffs_obj *ffs_dev;
struct ffs_dev *ffs_dev;

ENTER();
mutex_lock(&gfs_lock);
Expand Down
28 changes: 28 additions & 0 deletions drivers/usb/gadget/u_fs.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* u_fs.h
*
* Utility definitions for the FunctionFS
*
* Copyright (c) 2013 Samsung Electronics Co., Ltd.
* http://www.samsung.com
*
* Author: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/

#ifndef U_FFS_H
#define U_FFS_H

#include <linux/usb/composite.h>

struct ffs_dev {
const char *name;
bool mounted;
bool desc_ready;
struct ffs_data *ffs_data;
};

#endif /* U_FFS_H */

0 comments on commit e72c39c

Please sign in to comment.