Skip to content

Commit e72c39c

Browse files
Andrzej PietrasiewiczFelipe Balbi
Andrzej Pietrasiewicz
authored and
Felipe Balbi
committed
usb: gadget: FunctionFS: create utility file
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 <[email protected]> Signed-off-by: Kyungmin Park <[email protected]> Acked-by: Michal Nazarewicz <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
1 parent e6f3862 commit e72c39c

File tree

3 files changed

+35
-13
lines changed

3 files changed

+35
-13
lines changed

drivers/usb/gadget/f_fs.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include <linux/usb/composite.h>
2828
#include <linux/usb/functionfs.h>
2929

30+
#include "u_fs.h"
3031

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

drivers/usb/gadget/g_ffs.c

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,6 @@ MODULE_LICENSE("GPL");
6969

7070
#define GFS_MAX_DEVS 10
7171

72-
struct gfs_ffs_obj {
73-
const char *name;
74-
bool mounted;
75-
bool desc_ready;
76-
struct ffs_data *ffs_data;
77-
};
78-
7972
USB_GADGET_COMPOSITE_OPTIONS();
8073

8174
static struct usb_device_descriptor gfs_dev_desc = {
@@ -181,7 +174,7 @@ static DEFINE_MUTEX(gfs_lock);
181174
static unsigned int missing_funcs;
182175
static bool gfs_registered;
183176
static bool gfs_single_func;
184-
static struct gfs_ffs_obj *ffs_tab;
177+
static struct ffs_dev *ffs_tab;
185178

186179
static int __init gfs_init(void)
187180
{
@@ -224,7 +217,7 @@ static void __exit gfs_exit(void)
224217
}
225218
module_exit(gfs_exit);
226219

227-
static struct gfs_ffs_obj *gfs_find_dev(const char *dev_name)
220+
static struct ffs_dev *gfs_find_dev(const char *dev_name)
228221
{
229222
int i;
230223

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

243236
static int functionfs_ready_callback(struct ffs_data *ffs)
244237
{
245-
struct gfs_ffs_obj *ffs_obj;
238+
struct ffs_dev *ffs_obj;
246239
int ret;
247240

248241
ENTER();
@@ -283,7 +276,7 @@ static int functionfs_ready_callback(struct ffs_data *ffs)
283276

284277
static void functionfs_closed_callback(struct ffs_data *ffs)
285278
{
286-
struct gfs_ffs_obj *ffs_obj;
279+
struct ffs_dev *ffs_obj;
287280

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

306299
static void *functionfs_acquire_dev_callback(const char *dev_name)
307300
{
308-
struct gfs_ffs_obj *ffs_dev;
301+
struct ffs_dev *ffs_dev;
309302

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

330323
static void functionfs_release_dev_callback(struct ffs_data *ffs_data)
331324
{
332-
struct gfs_ffs_obj *ffs_dev;
325+
struct ffs_dev *ffs_dev;
333326

334327
ENTER();
335328
mutex_lock(&gfs_lock);

drivers/usb/gadget/u_fs.h

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/*
2+
* u_fs.h
3+
*
4+
* Utility definitions for the FunctionFS
5+
*
6+
* Copyright (c) 2013 Samsung Electronics Co., Ltd.
7+
* http://www.samsung.com
8+
*
9+
* Author: Andrzej Pietrasiewicz <[email protected]>
10+
*
11+
* This program is free software; you can redistribute it and/or modify
12+
* it under the terms of the GNU General Public License version 2 as
13+
* published by the Free Software Foundation.
14+
*/
15+
16+
#ifndef U_FFS_H
17+
#define U_FFS_H
18+
19+
#include <linux/usb/composite.h>
20+
21+
struct ffs_dev {
22+
const char *name;
23+
bool mounted;
24+
bool desc_ready;
25+
struct ffs_data *ffs_data;
26+
};
27+
28+
#endif /* U_FFS_H */

0 commit comments

Comments
 (0)