From: Eddie Cai <eddie.cai.linux@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [U-Boot PATCH V2 1/8] usb: ums: split macro and data struct in f_mass_storage.c
Date: Sun, 16 Apr 2017 23:48:49 +0800 [thread overview]
Message-ID: <20170416154856.14636-2-eddie.cai.linux@gmail.com> (raw)
In-Reply-To: <20170416154856.14636-1-eddie.cai.linux@gmail.com>
split the macro and data struct in f_mass_storage.c to f_mass_storage.h
Signed-off-by: Eddie Cai <eddie.cai.linux@gmail.com>
---
drivers/usb/gadget/f_mass_storage.c | 108 ---------------------------------
include/f_mass_storage.h | 116 ++++++++++++++++++++++++++++++++++++
2 files changed, 116 insertions(+), 108 deletions(-)
diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c
index 1ecb92a..7164655 100644
--- a/drivers/usb/gadget/f_mass_storage.c
+++ b/drivers/usb/gadget/f_mass_storage.c
@@ -274,15 +274,6 @@ static const char fsg_string_interface[] = "Mass Storage";
/*-------------------------------------------------------------------------*/
-#define GFP_ATOMIC ((gfp_t) 0)
-#define PAGE_CACHE_SHIFT 12
-#define PAGE_CACHE_SIZE (1 << PAGE_CACHE_SHIFT)
-#define kthread_create(...) __builtin_return_address(0)
-#define wait_for_completion(...) do {} while (0)
-
-struct kref {int x; };
-struct completion {int x; };
-
inline void set_bit(int nr, volatile void *addr)
{
int mask;
@@ -303,105 +294,6 @@ inline void clear_bit(int nr, volatile void *addr)
*a &= ~mask;
}
-struct fsg_dev;
-struct fsg_common;
-
-/* Data shared by all the FSG instances. */
-struct fsg_common {
- struct usb_gadget *gadget;
- struct fsg_dev *fsg, *new_fsg;
-
- struct usb_ep *ep0; /* Copy of gadget->ep0 */
- struct usb_request *ep0req; /* Copy of cdev->req */
- unsigned int ep0_req_tag;
-
- struct fsg_buffhd *next_buffhd_to_fill;
- struct fsg_buffhd *next_buffhd_to_drain;
- struct fsg_buffhd buffhds[FSG_NUM_BUFFERS];
-
- int cmnd_size;
- u8 cmnd[MAX_COMMAND_SIZE];
-
- unsigned int nluns;
- unsigned int lun;
- struct fsg_lun luns[FSG_MAX_LUNS];
-
- unsigned int bulk_out_maxpacket;
- enum fsg_state state; /* For exception handling */
- unsigned int exception_req_tag;
-
- enum data_direction data_dir;
- u32 data_size;
- u32 data_size_from_cmnd;
- u32 tag;
- u32 residue;
- u32 usb_amount_left;
-
- unsigned int can_stall:1;
- unsigned int free_storage_on_release:1;
- unsigned int phase_error:1;
- unsigned int short_packet_received:1;
- unsigned int bad_lun_okay:1;
- unsigned int running:1;
-
- int thread_wakeup_needed;
- struct completion thread_notifier;
- struct task_struct *thread_task;
-
- /* Callback functions. */
- const struct fsg_operations *ops;
- /* Gadget's private data. */
- void *private_data;
-
- const char *vendor_name; /* 8 characters or less */
- const char *product_name; /* 16 characters or less */
- u16 release;
-
- /* Vendor (8 chars), product (16 chars), release (4
- * hexadecimal digits) and NUL byte */
- char inquiry_string[8 + 16 + 4 + 1];
-
- struct kref ref;
-};
-
-struct fsg_config {
- unsigned nluns;
- struct fsg_lun_config {
- const char *filename;
- char ro;
- char removable;
- char cdrom;
- char nofua;
- } luns[FSG_MAX_LUNS];
-
- /* Callback functions. */
- const struct fsg_operations *ops;
- /* Gadget's private data. */
- void *private_data;
-
- const char *vendor_name; /* 8 characters or less */
- const char *product_name; /* 16 characters or less */
-
- char can_stall;
-};
-
-struct fsg_dev {
- struct usb_function function;
- struct usb_gadget *gadget; /* Copy of cdev->gadget */
- struct fsg_common *common;
-
- u16 interface_number;
-
- unsigned int bulk_in_enabled:1;
- unsigned int bulk_out_enabled:1;
-
- unsigned long atomic_bitflags;
-#define IGNORE_BULK_OUT 0
-
- struct usb_ep *bulk_in;
- struct usb_ep *bulk_out;
-};
-
static inline int __fsg_is_set(struct fsg_common *common,
const char *func, unsigned line)
diff --git a/include/f_mass_storage.h b/include/f_mass_storage.h
index 679f242..620af06 100644
--- a/include/f_mass_storage.h
+++ b/include/f_mass_storage.h
@@ -390,4 +390,120 @@ fsg_otg_desc = {
};
#endif
+
+
+
+
+#define GFP_ATOMIC ((gfp_t) 0)
+#define PAGE_CACHE_SHIFT 12
+#define PAGE_CACHE_SIZE (1 << PAGE_CACHE_SHIFT)
+#define kthread_create(...) __builtin_return_address(0)
+#define wait_for_completion(...) do {} while (0)
+
+struct kref {int x; };
+struct completion {int x; };
+
+
+struct fsg_dev;
+struct fsg_common;
+
+/* Data shared by all the FSG instances. */
+struct fsg_common {
+ struct usb_gadget *gadget;
+ struct fsg_dev *fsg, *new_fsg;
+
+ struct usb_ep *ep0; /* Copy of gadget->ep0 */
+ struct usb_request *ep0req; /* Copy of cdev->req */
+ unsigned int ep0_req_tag;
+
+ struct fsg_buffhd *next_buffhd_to_fill;
+ struct fsg_buffhd *next_buffhd_to_drain;
+ struct fsg_buffhd buffhds[FSG_NUM_BUFFERS];
+
+ int cmnd_size;
+ u8 cmnd[MAX_COMMAND_SIZE];
+
+ unsigned int nluns;
+ unsigned int lun;
+ struct fsg_lun luns[FSG_MAX_LUNS];
+
+ unsigned int bulk_out_maxpacket;
+ enum fsg_state state; /* For exception handling */
+ unsigned int exception_req_tag;
+
+ enum data_direction data_dir;
+ u32 data_size;
+ u32 data_size_from_cmnd;
+ u32 tag;
+ u32 residue;
+ u32 usb_amount_left;
+
+ unsigned int can_stall:1;
+ unsigned int free_storage_on_release:1;
+ unsigned int phase_error:1;
+ unsigned int short_packet_received:1;
+ unsigned int bad_lun_okay:1;
+ unsigned int running:1;
+
+ int thread_wakeup_needed;
+ struct completion thread_notifier;
+ struct task_struct *thread_task;
+
+ /* Callback functions. */
+ const struct fsg_operations *ops;
+ /* Gadget's private data. */
+ void *private_data;
+
+ const char *vendor_name; /* 8 characters or less */
+ const char *product_name; /* 16 characters or less */
+ u16 release;
+
+ /* Vendor (8 chars), product (16 chars), release (4
+ * hexadecimal digits) and NUL byte */
+ char inquiry_string[8 + 16 + 4 + 1];
+
+ struct kref ref;
+};
+
+struct fsg_config {
+ unsigned nluns;
+ struct fsg_lun_config {
+ const char *filename;
+ char ro;
+ char removable;
+ char cdrom;
+ char nofua;
+ } luns[FSG_MAX_LUNS];
+
+ /* Callback functions. */
+ const struct fsg_operations *ops;
+ /* Gadget's private data. */
+ void *private_data;
+
+ const char *vendor_name; /* 8 characters or less */
+ const char *product_name; /* 16 characters or less */
+
+ char can_stall;
+};
+
+struct fsg_dev {
+ struct usb_function function;
+ struct usb_gadget *gadget; /* Copy of cdev->gadget */
+ struct fsg_common *common;
+
+ u16 interface_number;
+
+ unsigned int bulk_in_enabled:1;
+ unsigned int bulk_out_enabled:1;
+
+ unsigned long atomic_bitflags;
+#define IGNORE_BULK_OUT 0
+
+ struct usb_ep *bulk_in;
+ struct usb_ep *bulk_out;
+};
+
#endif /* __F_MASS_STORAGE_H_ */
+
+
+
--
2.10.2
next prev parent reply other threads:[~2017-04-16 15:48 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-16 15:48 [U-Boot] [U-Boot PATCH V2 0/8] introduce Rockchip rockusb Eddie Cai
2017-04-16 15:48 ` Eddie Cai [this message]
2017-04-16 16:01 ` [U-Boot] [U-Boot PATCH V2 1/8] usb: ums: split macro and data struct in f_mass_storage.c Michael Nazzareno Trimarchi
2017-04-16 15:48 ` [U-Boot] [U-Boot PATCH V2 2/8] usb: ums: merge storage_common.c into f_mass_storage.c Eddie Cai
2017-04-16 15:48 ` [U-Boot] [U-Boot PATCH V2 3/8] usb: ums: remove static declaration of some ums functions Eddie Cai
2017-04-16 15:48 ` [U-Boot] [U-Boot PATCH V2 4/8] usb: ums: add functions to set and get usb interface descriptor Eddie Cai
2017-04-16 15:48 ` [U-Boot] [U-Boot PATCH V2 5/8] usb: ums: add do_extra_command Eddie Cai
2017-04-16 15:48 ` [U-Boot] [U-Boot PATCH V2 6/8] cmd: add rockusb command Eddie Cai
2017-04-16 15:48 ` [U-Boot] [U-Boot PATCH V2 7/8] rockchip: config: enable rockusb support on rk3288 based board Eddie Cai
2017-04-16 15:48 ` [U-Boot] [U-Boot PATCH V2 8/8] rockusb: add a simple readme Eddie Cai
2017-04-16 16:02 ` [U-Boot] [U-Boot PATCH V2 0/8] introduce Rockchip rockusb Michael Nazzareno Trimarchi
2017-04-16 16:10 ` Marek Vasut
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170416154856.14636-2-eddie.cai.linux@gmail.com \
--to=eddie.cai.linux@gmail.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox