History log of /drivers/usb/gadget/file_storage.c
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
90ab5ee94171b3e28de6bb42ee30b527014e0be7 13-Jan-2012 Rusty Russell <rusty@rustcorp.com.au> module_param: make bool parameters really bool (drivers & misc)

module_param(bool) used to counter-intuitively take an int. In
fddd5201 (mid-2009) we allowed bool or int/unsigned int using a messy
trick.

It's time to remove the int/unsigned int option. For this version
it'll simply give a warning, but it'll break next kernel version.

Acked-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
/drivers/usb/gadget/file_storage.c
7177aed44f515d949f587170e0e177ce17e74793 19-Nov-2011 Michal Nazarewicz <mina86@mina86.com> usb: gadget: rename usb_gadget_driver::speed to max_speed

This commit renames the “speed” field of the usb_gadget_driver
structure to “max_speed”. This is so that to make it more
apparent that the field represents the maximum speed gadget
driver can support.

This also make the field look more like fields with the same
name in usb_gadget and usb_composite_driver structures. All
of those represent the *maximal* speed given entity supports.

After this commit, there are the following fields in various
structures:
* usb_gadget::speed - the current connection speed,
* usb_gadget::max_speed - maximal speed UDC supports,
* usb_gadget_driver::max_speed - maximal speed gadget driver
supports, and
* usb_composite_driver::max_speed - maximal speed composite
gadget supports.

Signed-off-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
/drivers/usb/gadget/file_storage.c
144974e7f9e32b53b02f6c8632be45d8f43d6ab5 26-Oct-2011 Yuping Luo <Yuping.Luo@csr.com> usb: gadget: mass_storage: support multi-luns with different logic block size

With Peiyu's patch "gadget: mass_storage: adapt logic block size to bound block
devices" (http://www.spinics.net/lists/linux-usb/msg50791.html), now mass storage
can adjust logic block size dynamically based on real devices.
Then there is one issue caused by it, if two luns have different logic block size,
mass storage can't work.
Let's check the current software flow:
1. get_next_command(): call received_cbw();
2. received_cbw(): update common->lun = cbw->Lun, but common->curlen is not updated;
3. do_scsi_command(): in READ_X and WRITE_X commands, common->data_size_from_cmnd is
updated by common->curlun->blkbits;
4. check_command(): update common->curlun according to common->lun
As you can see, the step 3 uses wrong common->curlun, then wrong common->curlun->blkbits.
If the two luns have same blkbits, there isn't issue. Otherwise, both will fail.
This patch moves the common->curlun update to step 1, then make sure step 3 gets right
blkbits and data_size_from_cmnd.

Cc: Peiyu Li <peiyu.li@csr.com>
Signed-off-by: YuPing Luo <yuping.luo@csr.com>
Signed-off-by: Barry Song <Baohua.Song@csr.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
/drivers/usb/gadget/file_storage.c
ce7b6121851c72d661134d113a78161095e0ae73 26-Oct-2011 Paul Zimmerman <Paul.Zimmerman@synopsys.com> usb: gadget: storage: check for valid USB_BULK_RESET_REQUEST wLength

The USB-IF CV compliance tester is getting stricter, and it would
be valid for it to fail a mass-storage device that accepts an
invalid USB_BULK_RESET_REQUEST request. Although it doesn't do
that yet, let's be proactive and fix that now.

Suggested by Alan Stern.

Signed-off-by: Paul Zimmerman <paulz@synopsys.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/usb/gadget/file_storage.c
db332bc9b26bbd79a37241721cccc9919489d5a9 14-Oct-2011 Paul Zimmerman <Paul.Zimmerman@synopsys.com> usb: gadget: storage: check for valid USB_BULK_GET_MAX_LUN_REQUEST

The latest USB-IF CV tester checks for a valid length for this
request.

Signed-off-by: Paul Zimmerman <paulz@synopsys.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/usb/gadget/file_storage.c
6eb0de827084060e6607c8f8542d9e9566214538 03-Jul-2011 Paul Gortmaker <paul.gortmaker@windriver.com> usb: Add module.h to drivers/usb consumers who really use it.

The situation up to this point meant that module.h was pretty
much everywhere, regardless of whether you asked for it or not.
We are fixing that, so give the USB folks who want it an actual
include of it.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
/drivers/usb/gadget/file_storage.c
91960c2ef095c4b0744349e80a933921cbdcfd6e 13-Oct-2011 Yauheni Kaliuta <yauheni.kaliuta@nokia.com> usb: gadget: file_storage: fix race on unloading

There is a race, reproduced rarely if you unload the module
when host finishes mass storage device initialization (reading
partition table and so on): fsg_unbind() code first closes
lun files then waits for worker thread to finish its work, as
the result the thread may operate on already closed device
with an oops and backtrace:

[ 484.937225] [<b00e403c>] (touch_atime+0x4/0x140) from [<b00a1498>] (generic_file_aio_read+0x678/0x6f0)
[ 484.946563] [<b00a1498>] (generic_file_aio_read+0x678/0x6f0) from [<b00d08c4>] (do_sync_read+0xb0/0xf4)
[ 484.955963] [<b00d08c4>] (do_sync_read+0xb0/0xf4) from [<b00d1478>] (vfs_read+0xac/0x144)
[ 484.964172] [<b00d1478>] (vfs_read+0xac/0x144) from [<af24c6a8>] (fsg_setup+0x7f4/0x900 [g_file_storage])
[ 484.973785] [<af24c6a8>] (fsg_setup+0x7f4/0x900 [g_file_storage]) from [<af24da14>] (fsg_main_thread+0x85c/0x175c [g_file_storage])
[ 484.985626] [<af24da14>] (fsg_main_thread+0x85c/0x175c [g_file_storage]) from [<b0077c48>] (kthread+0x7c/0x84)
[ 484.995666] [<b0077c48>] (kthread+0x7c/0x84) from [<b002f950>] (kernel_thread_exit+0x0/0x8)
[ 485.004028] Code: eaffffd0 e28dd008 e8bd8df0 e92d40f7 (e591400c)

Change the order in unbind: wait for the thread first, then close
the files.

Signed-off-by: Yauheni Kaliuta <yauheni.kaliuta@nokia.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/usb/gadget/file_storage.c
4bb99b7c82bac1488a0228d2363db1f68d90f6f3 03-Aug-2011 Felipe Balbi <balbi@ti.com> usb: gadget: storage: add superspeed support

this patch adds superspeed descriptors for the
storage gadgets.

Acked-by: Michal Nazarewicz <mina86@mina86.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Felipe Balbi <balbi@ti.com>
/drivers/usb/gadget/file_storage.c
fe69676530f182bbb1fe0edd027e18751a1a2595 01-Oct-2011 Paul Zimmerman <Paul.Zimmerman@synopsys.com> usb: gadget: storage: fix mass storage gadgets to work with Synopsys UDC

The Synopsys USB device controller requires all OUT transfer request
lengths to be aligned to max packet size. The mass storage gadgets do
not meet this requirement for Super Speed. The gadgets already have a
function which performs this alignment for CBW packets, so use it for
data packets too.

The alternative would be to implement bounce buffers in the DWC3
driver, but that could have a significant impact on performance.

This version is based upon a more-correct patch written by Alan
Stern.

Signed-off-by: Paul Zimmerman <paulz@synopsys.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
/drivers/usb/gadget/file_storage.c
073b85469308b41468149f4aa7144c1e1bf4f0d7 18-Sep-2011 Greg Kroah-Hartman <gregkh@suse.de> Merge branch 'for-next' of git://gitorious.org/usb/usb into usb-next

* 'for-next' of git://gitorious.org/usb/usb: (47 commits)
usb: musb: Enable DMA mode1 RX for transfers without short packets
usb: musb: fix build breakage
usb: gadget: audio: queue wLength-sized requests
usb: gadget: audio: actually support both speeds
usb: gadget: storage: make FSG_NUM_BUFFERS variable size
USB: gadget: storage: remove alignment assumption
usb: gadget: storage: adapt logic block size to bound block devices
usb: dwc3: gadget: improve debug on link state change
usb: dwc3: omap: set idle and standby modes
usb: dwc3: ep0: introduce ep0_expect_in flag
usb: dwc3: ep0: giveback requests on stall_and_restart
usb: dwc3: gadget: drop the useless dma_sync_single* calls
usb: dwc3: gadget: fix GCTL programming
usb: dwc3: define ScaleDown macro helper
usb: dwc3: Fix definition of DWC3_GCTL_U2RSTECN
usb: dwc3: gadget: do not map/unmap ZLP transfers
usb: dwc3: omap: fix IRQ handling
usb: dwc3: omap: change IRQ name to dwc3-omap
usb: dwc3: add module.h to dwc3-omap.c and core.c
usb: dwc3: omap: distinguish between SW and HW modes
...
e538dfdae85244fd2c4231725d82cc1f1bc4942c 30-Aug-2011 Michal Nazarewicz <mina86@mina86.com> usb: Provide usb_speed_string() function

In a few places in the kernel, the code prints
a human-readable USB device speed (eg. "high speed").
This involves a switch statement sometimes wrapped
around in ({ ... }) block leading to code repetition.

To mitigate this issue, this commit introduces
usb_speed_string() function, which returns
a human-readable name of provided speed.

It also changes a few places switch was used to use
this new function. This changes a bit the way the
speed is printed in few instances at the same time
standardising it.

Signed-off-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/usb/gadget/file_storage.c
6532c7fdb2c3a2ec1b949ecd2ff5375069c1639a 19-Aug-2011 Per Forlin <per.forlin@linaro.org> usb: gadget: storage: make FSG_NUM_BUFFERS variable size

FSG_NUM_BUFFERS is set to 2 as default.
Usually 2 buffers are enough to establish a good buffering pipeline.
The number may be increased in order to compensate a for bursty VFS
behaviour.

Here follows a description of system that may require more than
2 buffers.
* CPU ondemand governor active
* latency cost for wake up and/or frequency change
* DMA for IO

Use case description.
* Data transfer from MMC via VFS to USB.
* DMA shuffles data from MMC and to USB.
* The CPU wakes up every now and then to pass data in and out from VFS,
which cause the bursty VFS behaviour.

Test set up
* Running dd on the host reading from the mass storage device
* cmdline: dd if=/dev/sdb of=/dev/null bs=4k count=$((256*100))
* Caches are dropped on the host and on the device before each run

Measurements on a Snowball board with ondemand_governor active.

FSG_NUM_BUFFERS 2
104857600 bytes (105 MB) copied, 5.62173 s, 18.7 MB/s
104857600 bytes (105 MB) copied, 5.61811 s, 18.7 MB/s
104857600 bytes (105 MB) copied, 5.57817 s, 18.8 MB/s

FSG_NUM_BUFFERS 4
104857600 bytes (105 MB) copied, 5.26839 s, 19.9 MB/s
104857600 bytes (105 MB) copied, 5.2691 s, 19.9 MB/s
104857600 bytes (105 MB) copied, 5.2711 s, 19.9 MB/s

There may not be one optimal number for all boards. This is why
the number is added to Kconfig. If selecting USB_GADGET_DEBUG_FILES
this value may be set by a module parameter as well.

Signed-off-by: Per Forlin <per.forlin@linaro.org>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Felipe Balbi <balbi@ti.com>
/drivers/usb/gadget/file_storage.c
04eee25b1d754a837360504b7af426d1f86ffeb7 18-Aug-2011 Alan Stern <stern@rowland.harvard.edu> USB: gadget: storage: remove alignment assumption

This patch (as1481) fixes a problem affecting g_file_storage and
g_mass_storage when running at SuperSpeed. The two drivers currently
assume that the bulk-out maxpacket size can evenly divide the SCSI
block size, which is 512 bytes. But SuperSpeed bulk endpoints have a
maxpacket size of 1024, so the assumption is no longer true.

This patch removes that assumption from the drivers, by getting rid of
a small optimization (they try to align VFS reads and writes on page
cache boundaries). If a command's starting logical block address is
512 bytes below the end of a page, it's not okay to issue a USB
command for just those 512 bytes when the maxpacket size is 1024 -- it
would result in either babble (for an OUT transfer) or a short packet
(for an IN transfer).

Also, for backward compatibility, the test for writes extending beyond
the end of the backing storage has to be changed. If the host tries
to do this, we should accept the data that fits in the backing storage
and ignore the rest. Because the storage's end may not align with a
USB packet boundary, this means we may have to accept a USB OUT
transfer that extends beyond the end of the storage and then write out
only the part of the data that fits.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
/drivers/usb/gadget/file_storage.c
3f565a363cee14d2ed281823196d455bfc7c4170 18-Aug-2011 Peiyu Li <peiyu.li@csr.com> usb: gadget: storage: adapt logic block size to bound block devices

Now the mass storage driver has fixed logic block size of 512 bytes.

The mass storage gadget read/write bound devices only through VFS, so the
bottom level devices actually are just RAW devices to the driver and connected
PC. As a RAW, hosts can always format, read and write it right in 512 bytes
logic block and don't care about the actual logic block size of devices bound
to the gadget.

But if we want to share the bound block device partition between target board
and PC, in case the logic block size of the bound block device is 4KB, we
execute the following steps:

1. connect a board with mass storage gadget to PC(the board has set one
partition of on-board block device as file name of the mass storage)
2. PC format the mass storage to VFAT by default logic block size and
read/write it
3. disconnect boards from PC
4. target board mount the partition as VFAT

Step 4 will fail since kernel on target thinks the logic block size of the
bound partition as 4KB.
A typical error is "FAT: logical sector size too small for device (logical
sector size = 512)"

If we execute opposite steps:
1. format the partition to VFAT on target board and read/write this partition
2. connect the board to Windows PC as usb mass storage gadget, windows will
think the disk is not formatted

So the conclusion is that only as a gadget, the mass storage driver has no any
problem. But being shared VFAT or other filesystem on PC and target board, it
will fail.

This patch adapts logic block size to bound block devices and fix the issue.

Cc: Michal Nazarewicz <mina86@mina86.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Peiyu Li <peiyu.li@csr.com>
Signed-off-by: Xianglong Du <xianglong.du@csr.com>
Signed-off-by: Huayi Li <huayi.li@csr.com>
Signed-off-by: Barry Song <Baohua.Song@csr.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
/drivers/usb/gadget/file_storage.c
29cc88979a8818cd8c5019426e945aed118b400e 23-Aug-2011 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> USB: use usb_endpoint_maxp() instead of le16_to_cpu()

Now ${LINUX}/drivers/usb/* can use usb_endpoint_maxp(desc) to get maximum packet size
instead of le16_to_cpu(desc->wMaxPacketSize).
This patch fix it up

Cc: Armin Fuerst <fuerst@in.tum.de>
Cc: Pavel Machek <pavel@ucw.cz>
Cc: Johannes Erdfelt <johannes@erdfelt.com>
Cc: Vojtech Pavlik <vojtech@suse.cz>
Cc: Oliver Neukum <oliver@neukum.name>
Cc: David Kubicek <dave@awk.cz>
Cc: Johan Hovold <jhovold@gmail.com>
Cc: Brad Hards <bhards@bigpond.net.au>
Acked-by: Felipe Balbi <balbi@ti.com>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Thomas Dahlmann <dahlmann.thomas@arcor.de>
Cc: David Brownell <david-b@pacbell.net>
Cc: David Lopo <dlopo@chipidea.mips.com>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: Michal Nazarewicz <m.nazarewicz@samsung.com>
Cc: Xie Xiaobo <X.Xie@freescale.com>
Cc: Li Yang <leoli@freescale.com>
Cc: Jiang Bo <tanya.jiang@freescale.com>
Cc: Yuan-hsin Chen <yhchen@faraday-tech.com>
Cc: Darius Augulis <augulis.darius@gmail.com>
Cc: Xiaochen Shen <xiaochen.shen@intel.com>
Cc: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Cc: OKI SEMICONDUCTOR, <toshiharu-linux@dsn.okisemi.com>
Cc: Robert Jarzmik <robert.jarzmik@free.fr>
Cc: Ben Dooks <ben@simtec.co.uk>
Cc: Thomas Abraham <thomas.ab@samsung.com>
Cc: Herbert Pötzl <herbert@13thfloor.at>
Cc: Arnaud Patard <arnaud.patard@rtp-net.org>
Cc: Roman Weissgaerber <weissg@vienna.at>
Acked-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Cc: Tony Olech <tony.olech@elandigitalsystems.com>
Cc: Florian Floe Echtler <echtler@fs.tum.de>
Cc: Christian Lucht <lucht@codemercs.com>
Cc: Juergen Stuber <starblue@sourceforge.net>
Cc: Georges Toth <g.toth@e-biz.lu>
Cc: Bill Ryder <bryder@sgi.com>
Cc: Kuba Ober <kuba@mareimbrium.org>
Cc: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/usb/gadget/file_storage.c
765f5b830e547229bb752e7b232ee83e2b3d49d5 23-Jun-2011 Sebastian Andrzej Siewior <bigeasy@linutronix.de> usb: gadget: defer setting maxpacket till ->setup()

maxpacket is set by the udc driver for ep0 very early. This value is
copied by the function gadget used later for the USB_DT_DEVICE and
USB_DT_DEVICE_QUALIFIER query. This seems to work fine so far. For USB3
we need set a different value here. In SS speed it is 2^x with x=9 and
in HS we set something <= 64. If the UDC starts in SS and continues in
HS after the cable has been plugged it will report a too small value.
There setting of this value is defered and taken automaticly from the
ep0 pointer where the UDC driver can update it according to the speed it
detected _after_ a cable has been plugged.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/usb/gadget/file_storage.c
72c973dd2b01b212a159faa330a2bc641a3ed809 28-Jun-2011 Tatyana Brokhman <tlinder@codeaurora.org> usb: gadget: add usb_endpoint_descriptor to struct usb_ep

Change usb_ep_enable() prototype to use endpoint
descriptor from usb_ep.

This optimization spares the FDs from saving the
endpoint chosen descriptor. This optimization is
not full though. To fully exploit this change, one
needs to update all the UDCs as well since in the
current implementation each of them saves the
endpoint descriptor in it's internal (and extended)
endpoint structure.

Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/usb/gadget/file_storage.c
664a51a81f6ba39db30cd7b7de61577ca0b2d20d 15-Jun-2011 Alan Stern <stern@rowland.harvard.edu> USB: deprecate g_file_storage

This patch (as1471) deprecates the File-backed Storage Driver and
schedules its replacement for the 3.8 kernel release (about two years
from now). Users are advised to switch to the Mass Storage Gadget
instead.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/usb/gadget/file_storage.c
849426c3a430a6fb4613b0e5dbb81bcd6b10a075 08-May-2011 Maxin B John <maxin.john@gmail.com> usb: gadget: Remove the LUN checks which are always true

Comparing an unsigned integer with greater than or equal to zero is
always true. So, it is safe to remove similar checks from
'f_mass_storage.c' and 'file_storage.c'

Signed-off-by: Maxin B. John <maxin.john@gmail.com>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/usb/gadget/file_storage.c
98346f7db014614a4814eb60639f651f8bbc591d 14-Apr-2011 Greg Kroah-Hartman <gregkh@suse.de> Revert "usb: usb_storage: do not align length of request for CBW to maxp size"

This reverts commit 806e8f8fcc27e1753947bd9f059ba2316cf8f92a.

To quote Alan Stern:
The necessity for this patch has been under discussion.

It turns out the UDC that Mian has been working on and Felipe's
UDC have contradictory requirements. Mian's UDC driver wants a
bulk-OUT transfer length to be shorter than the maxpacket size
if a short packet is expected, whereas Felipe's UDC hardware
always needs bulk-OUT transfer lengths to be evenly divisible by
the maxpacket size.

Mian has agreed to go back over the driver to resolve this
conflict. This means we probably will not want this patch after
all. (In fact, we may ultimately decide to change the gadget
framework to require that bulk-OUT transfer lengths _always_ be
divisible by the maxpacket size -- only the g_file_storage and
g_mass_storage gadgets would need to be changed.)

Cc: Mian Yousaf Kaukab <mian.yousaf.kaukab@stericsson.com>
Cc: Michal Nazarewicz <mina86@mina86.com>
Cc: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/usb/gadget/file_storage.c
ee81b3e086c907a3347b15ef219a24fc8bf900f6 25-Mar-2011 Alan Stern <stern@rowland.harvard.edu> USB: g_file_storage: don't send padding when stall=n

This patch (as1455) removes the extra padding sent by g_file_storage
and g_mass_storage when the gadget wants to send less data than
requested by the host and isn't allowed to halt the bulk-IN endpoint.

Although the Bulk-Only Transport specification requires the padding to
be present, it isn't truly needed since the transfer will be terminated
by a short packet anyway. Furthermore, many existing devices don't
bother to send any padding.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Acked-By: Michal Nazarewicz <mina86@mina86.com>
CC: Roger Quadros <roger.quadros@nokia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/usb/gadget/file_storage.c
806e8f8fcc27e1753947bd9f059ba2316cf8f92a 24-Mar-2011 Mian Yousaf Kaukab <mian.yousaf.kaukab@stericsson.com> usb: usb_storage: do not align length of request for CBW to maxp size

Mass-storage and file-storage gadgets align the length to maximum-packet-size
when preparing the request to receive CBW. This is unnecessary and prevents the
controller driver from knowing that a short-packet is expected.

It is incorrect to set short_not_ok when preparing the request to receive CBW.
CBW will be a short-packet so short_not_ok must not be set.

This makes bh->bulk_out_intended_length unnecessary so it is also removed.

Signed-off-by: Mian Yousaf Kaukab <mian.yousaf.kaukab@stericsson.com>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/usb/gadget/file_storage.c
d9385b6352da7fed50981f375c2ccb60354039a6 28-Oct-2010 Michal Nazarewicz <mina86@mina86.com> USB: gadget: file_storage: put_device() in error recovery

This commit fixes some issues with File-backed Storage Gadget
error recovery when registering LUN's devices.

First of all, when device_register() fails the device still
needs to be put. However, because lun_release() decreases
fsg->ref reference counter the counter must be incremented
beforehand.

Second of all, after any of the device_create_file()s fails,
device_unregister() is called which in turn (indirectly) calls
lun_release() which decrements fsg->ref. So, again, the
reference counter must be incremented beforehand.

Lastly, if the first or the second device_create_file()
succeeds, the files are never removed. To fix it,
device_remove_file() needs to be called. This is done by
simply marking LUN as registered prior to creating files so
that fsg_unbind() can handle removing files.

Signed-off-by: Michal Nazarewicz <mina86@mina86.com>
Reported-by: Rahul Ruikar <rahul.ruikar@gmail.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/usb/gadget/file_storage.c
0a6a717ceff67f887b16783ce891f5dcf846f1fc 07-Oct-2010 Michal Nazarewicz <mina86@mina86.com> USB: gadget: storage: reuse definitions from scsi.h header file

This commit changes storage_common.h, file_storage.c and
f_mass_storage.c to use definitions of SCSI commands from
scsi/scsi.h file instead of redefining the commands in
storage_common.c.

scsi/scsi.h header file was missing READ_FORMAT_CAPACITIES and
READ_HEADER so this commit also add those to the header.

Signed-off-by: Michal Nazarewicz <mina86@mina86.com>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: James Bottomley <James.Bottomley@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/usb/gadget/file_storage.c
d8087427ccefc0b3364735b96274375246fd452c 03-Sep-2010 Alan Stern <stern@rowland.harvard.edu> USB: g_file_storage: don't generate automatic serial string

This patch (as1413) changes g_file_storage to avoid generating a bogus
automatic serial-number string descriptor. If the user doesn't provide
a valid serial number via a module parameter then a warning is logged
and the gadget won't have any serial string descriptor at all.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Acked-by: David Brownell <david-b@pacbell.net>
CC: Michal Nazarewicz <m.nazarewicz@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/usb/gadget/file_storage.c
b0fca50f5a94a268ed02cfddf44448051ed9343f 12-Aug-2010 Uwe Kleine-König <u.kleine-koenig@pengutronix.de> usb gadget: don't save bind callback in struct usb_gadget_driver

To accomplish this the function to register a gadget driver takes the bind
function as a second argument. To make things clearer rename the function
to resemble platform_driver_probe.

This fixes many section mismatches like

WARNING: drivers/usb/gadget/g_printer.o(.data+0xc): Section mismatch in
reference from the variable printer_driver to the function
.init.text:printer_bind()
The variable printer_driver references
the function __init printer_bind()

All callers are fixed.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
[m.nazarewicz@samsung.com: added dbgp]
Signed-off-by: Michał Nazarewicz <m.nazarewicz@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/usb/gadget/file_storage.c
e12995ec8f8d99f2a339541fc28998af2d60af0f 12-Aug-2010 Michal Nazarewicz <m.nazarewicz@samsung.com> USB: Revert "USB: gadget: section mismatch warning fixed"

This reverts a commit which proposed an invalid solution
for a section mismatch. Next 3 commits will fix it correctly.

Conflicts:

drivers/usb/gadget/mass_storage.c

Signed-off-by: Michal Nazarewicz <m.nazarewicz@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/usb/gadget/file_storage.c
452ee0eb10bd3581cf667a1db18cb684889ce446 12-Aug-2010 Michal Nazarewicz <m.nazarewicz@samsung.com> usb: gadget: storage: remove nofua file when unbinding

The dev_attr_nofua file was created during fsg_bind() but
was never removed. Made it a bit more symmetrical and added
code to remove the file in fsg_unbind().

Signed-off-by: Michal Nazarewicz <m.nazarewicz@samsung.com>
Acked-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/usb/gadget/file_storage.c
567064916e4fe32af81b89e473a1e4f40c64b27b 22-Jul-2010 Michal Nazarewicz <m.nazarewicz@samsung.com> USB: gadget: file_storage: serial parameter even if not test mode

Moved the serial parameter handling code out of "#ifdef
CONFIG_USB_FILE_STORAGE_TEST".

This modifies Yann Cantin's commit "USB: Add a serial number
parameter to g_file_storage" module as per Alan Stern's request.

Signed-off-by: Michal Nazarewicz <m.nazarewicz@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Tested-by: Anand Gadiyar <gadiyar@ti.com>
Cc: David Brownell <david-b@pacbell.net>
Cc: Yann Cantin <yann.cantin@laposte.net>
/drivers/usb/gadget/file_storage.c
a93917d39fc388c4761d2530af82513e2d3bf9f6 22-Jul-2010 Andy Shevchenko <andy.shevchenko@gmail.com> USB: gadget: storage: optional SCSI WRITE FUA bit

MS Windows mounts removable storage in "Removal optimized mode" by
default. All the writes to the media are synchronous which is achieved
by setting FUA (Force Unit Access) bit in SCSI WRITE(10,12) commands.
This prevents I/O requests aggregation in block layer dramatically
decreasing performance.

This patch brings an option to accept or ignore mentioned bit
a) via specifying module parameter "nofua", or
b) through sysfs entry
/sys/devices/platform/_UDC_/gadget/gadget-lunX/nofua
(_UDC_ is the name of the USB Device Controller driver)

Patch is based on the work that was done by Denis Karpov for Maemo 5
platform.

Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Cc: Denis Karpov <ext-denis.2.karpov@nokia.com>
Cc: Adrian Hunter <adrian.hunter@nokia.com>
Cc: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/usb/gadget/file_storage.c
89ba85d4015b7fa738b35bcc228075c117a9a578 21-Jun-2010 Michal Nazarewicz <m.nazarewicz@samsung.com> USB: gadget: section mismatch warning fixed

In may gadgets bind and bind like functions were in a init section
as they were only run during initialisation. However, being
callback functions they were referenced from structures in “normal”
sections. Changing the tag from “__init” to “__ref” fixes the
warnings.

Signed-off-by: Michal Nazarewicz <m.nazarewicz@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/usb/gadget/file_storage.c
87eb1bead832b9880126fdbea74cc8ecb22b50c0 05-Jun-2010 Yann Cantin <yann.cantin@laposte.net> USB: Add a serial number parameter to g_file_storage module

This patch add a serial number parameter to the g_file_storage
module. There's validity checks against the string passed to comply
with the specs.

Signed-off-by: Yann Cantin <yann.cantin@laposte.net>
Cc: Michał Nazarewicz <m.nazarewicz@samsung.com>
Cc: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/usb/gadget/file_storage.c
0f2cc4ecd81dc1917a041dc93db0ada28f8356fa 04-Mar-2010 Linus Torvalds <torvalds@linux-foundation.org> Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6: (52 commits)
init: Open /dev/console from rootfs
mqueue: fix typo "failues" -> "failures"
mqueue: only set error codes if they are really necessary
mqueue: simplify do_open() error handling
mqueue: apply mathematics distributivity on mq_bytes calculation
mqueue: remove unneeded info->messages initialization
mqueue: fix mq_open() file descriptor leak on user-space processes
fix race in d_splice_alias()
set S_DEAD on unlink() and non-directory rename() victims
vfs: add NOFOLLOW flag to umount(2)
get rid of ->mnt_parent in tomoyo/realpath
hppfs can use existing proc_mnt, no need for do_kern_mount() in there
Mirror MS_KERNMOUNT in ->mnt_flags
get rid of useless vfsmount_lock use in put_mnt_ns()
Take vfsmount_lock to fs/internal.h
get rid of insanity with namespace roots in tomoyo
take check for new events in namespace (guts of mounts_poll()) to namespace.c
Don't mess with generic_permission() under ->d_lock in hpfs
sanitize const/signedness for udf
nilfs: sanitize const/signedness in dealing with ->d_name.name
...

Fix up fairly trivial (famous last words...) conflicts in
drivers/infiniband/core/uverbs_main.c and security/tomoyo/realpath.c
2ecdc82ef0b03e67ce5ecee79d0d108177a704df 26-Jan-2010 Christoph Hellwig <hch@lst.de> kill unused invalidate_inode_pages helper

No one is calling this anymore as everyone has switched to
invalidate_mapping_pages long time ago. Also update a few
references to it in comments. nfs has two more, but I can't
easily figure what they are actually referring to, so I left
them as-is.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
/drivers/usb/gadget/file_storage.c
90f7976880bbbf9968629500972f8e2f80401217 05-Feb-2010 Christoph Egger <siccegge@stud.informatik.uni-erlangen.de> USB: Remove unsupported usb gadget drivers

A bunch of USB gadget drivers where never ported from the linux 2.4
series to 2.6 kernels. However there's some code still in the tree for
them which isn't used and is probably untested for ages.

As the chance of these drivers being forward ported is probably quite
small now it might be time to get rid of them.

Signed-off-by: Christoph Egger <siccegge@stud.informatik.uni-erlangen.de>
Cc: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/usb/gadget/file_storage.c
3126c136bc30225d7a43af741778aa50e95e467a 12-Dec-2009 Linus Torvalds <torvalds@linux-foundation.org> Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs-2.6

* 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs-2.6: (21 commits)
ext3: PTR_ERR return of wrong pointer in setup_new_group_blocks()
ext3: Fix data / filesystem corruption when write fails to copy data
ext4: Support for 64-bit quota format
ext3: Support for vfsv1 quota format
quota: Implement quota format with 64-bit space and inode limits
quota: Move definition of QFMT_OCFS2 to linux/quota.h
ext2: fix comment in ext2_find_entry about return values
ext3: Unify log messages in ext3
ext2: clear uptodate flag on super block I/O error
ext2: Unify log messages in ext2
ext3: make "norecovery" an alias for "noload"
ext3: Don't update the superblock in ext3_statfs()
ext3: journal all modifications in ext3_xattr_set_handle
ext2: Explicitly assign values to on-disk enum of filetypes
quota: Fix WARN_ON in lookup_one_len
const: struct quota_format_ops
ubifs: remove manual O_SYNC handling
afs: remove manual O_SYNC handling
kill wait_on_page_writeback_range
vfs: Implement proper O_SYNC semantics
...
d23b0f08d18fc42f26f6a0776c6d827eb35143a9 09-Nov-2009 Michal Nazarewicz <m.nazarewicz@samsung.com> USB: g_mass_storage: Mass Storage Function created

The f_mass_storage.c has been changed into a composite function.
mass_storage.c file has been introduced which defines a
g_mass_storage gadget based on composite framework.

Signed-off-by: Michal Nazarewicz <m.nazarewicz@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/usb/gadget/file_storage.c
93f937405bd5280ced9bf845f620d1de19b9bf7d 28-Oct-2009 Michal Nazarewicz <m.nazarewicz@samsung.com> USB: g_file_storage: more code from file_storage.c moved to storage_common.c

Since storage_common.c no longer references mod_data object
it is now possible to include it before mod_data object is
defined. This makes it possible to move some defines that
are used as default values of mod_data fields to be defined
in storage_common.c file (where they should be set from
the beginning).

Also, show_ro(), show_file(), store_ro() and store_file()
have been moved to storage_common.c with LUN's device's
drvdata changed from pointing to fsg_dev to pointing to
rw_semaphore (&fsg->filesem).

Signed-off-by: Michal Nazarewicz <m.nazarewicz@samsung.com>
Cc: David Brownell <dbrownell@users.sourceforge.net>
Cc: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/usb/gadget/file_storage.c
e909ef5def59236b91fa9ee83446084eb6f48d1a 28-Oct-2009 Michal Nazarewicz <m.nazarewicz@samsung.com> USB: g_file_storage: per-LUN ro, removable and cdrom flags handling changed

removable and cdrom flag has been added to the fsg_lun structure
removing any references to mod_data object from storage_common.c.

As of read-only flag, previously it was set if a read-only
backing file was specified (which is good) and remained set
even after the file has been closed (which may be considered an
issue). Currently, the initial read-only flag is preserved so
if it was unset each time file is opened code will try to open
it read-write even if previous file was opened read-only.

Signed-off-by: Michal Nazarewicz <m.nazarewicz@samsung.com>
Cc: David Brownell <dbrownell@users.sourceforge.net>
Cc: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/usb/gadget/file_storage.c
d6181702f510302dce5666a50344b5acb196ab4e 28-Oct-2009 Michal Nazarewicz <m.nazarewicz@samsung.com> USB: g_file_storage: "fsg_" prefix added to some identifiers

Prefixed some identifiers that were defined in storage_common.c file
with "fsg_". Not all identifiers were prefixed but the ones that are
most likely to produce conflicts when used with other USB functions.

Signed-off-by: Michal Nazarewicz <m.nazarewicz@samsung.com>
Cc: David Brownell <dbrownell@users.sourceforge.net>
Cc: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/usb/gadget/file_storage.c
b6058d0fefc0b5ff777dfbff990a0a50a4ac144b 28-Oct-2009 Michal Nazarewicz <m.nazarewicz@samsung.com> USB: g_file_storage: parts of file_storage.c moved to separate file

Moved parts of the file_storage.c file which do not reference fsg_dev
structure to newly created storage_common.c file. dump_msg() and
dump_cdb() have been changed to macros to remove fsg_dev reference.

Signed-off-by: Michal Nazarewicz <m.nazarewicz@samsung.com>
Cc: David Brownell <dbrownell@users.sourceforge.net>
Cc: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/usb/gadget/file_storage.c
6b2f3d1f769be5779b479c37800229d9a4809fc3 27-Oct-2009 Christoph Hellwig <hch@lst.de> vfs: Implement proper O_SYNC semantics

While Linux provided an O_SYNC flag basically since day 1, it took until
Linux 2.4.0-test12pre2 to actually get it implemented for filesystems,
since that day we had generic_osync_around with only minor changes and the
great "For now, when the user asks for O_SYNC, we'll actually give
O_DSYNC" comment. This patch intends to actually give us real O_SYNC
semantics in addition to the O_DSYNC semantics. After Jan's O_SYNC
patches which are required before this patch it's actually surprisingly
simple, we just need to figure out when to set the datasync flag to
vfs_fsync_range and when not.

This patch renames the existing O_SYNC flag to O_DSYNC while keeping it's
numerical value to keep binary compatibility, and adds a new real O_SYNC
flag. To guarantee backwards compatiblity it is defined as expanding to
both the O_DSYNC and the new additional binary flag (__O_SYNC) to make
sure we are backwards-compatible when compiled against the new headers.

This also means that all places that don't care about the differences can
just check O_DSYNC and get the right behaviour for O_SYNC, too - only
places that actuall care need to check __O_SYNC in addition. Drivers and
network filesystems have been updated in a fail safe way to always do the
full sync magic if O_DSYNC is set. The few places setting O_SYNC for
lower layers are kept that way for now to stay failsafe.

We enforce that O_DSYNC is set when __O_SYNC is set early in the open path
to make sure we always get these sane options.

Note that parisc really screwed up their headers as they already define a
O_DSYNC that has always been a no-op. We try to repair it by using it for
the new O_DSYNC and redefinining O_SYNC to send both the traditional
O_SYNC numerical value _and_ the O_DSYNC one.

Cc: Richard Henderson <rth@twiddle.net>
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Cc: Grant Grundler <grundler@parisc-linux.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Andreas Dilger <adilger@sun.com>
Acked-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Acked-by: Kyle McMartin <kyle@mcmartin.ca>
Acked-by: Ulrich Drepper <drepper@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Jan Kara <jack@suse.cz>
/drivers/usb/gadget/file_storage.c
604eb89ffed9fba268582dc44d5b462ea94cc0ca 27-Apr-2009 Alan Stern <stern@rowland.harvard.edu> USB: g_file_storage: use the "unaligned" accessors

This patch (as1233) makes g_file_storage use the "unaligned" accessors.
This is based on work originally done by Harvey Harrison.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Acked-by: Harvey Harrison <harvey.harrison@gmail.com>
Acked-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/usb/gadget/file_storage.c
82a10a81c853be3859b3d222db0f372ee8d2eaa2 16-Apr-2009 Alan Stern <stern@rowland.harvard.edu> USB: g_file_storage: fix use-after-free bug when closing files

This patch (as1231) fixes a use-after-free bug in g_file_storage. A
device's name may not be available after the device is unregistered,
even if the device structure itself is still allocated. Since
close_backing_file() prints a LUN's name for debugging, it shouldn't
be called after the LUN has been unregistered.

That whole area needed to be cleaned up; the backing files were
getting closed in a couple of different places. The patch fixes
things so that they get closed in just one place, as part of the
unbind procedure, immediately before the LUN is unregistered.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/usb/gadget/file_storage.c
8e9d2089723d08d51e66c5eea49253d76e27941e 27-Mar-2009 Linus Torvalds <torvalds@linux-foundation.org> Merge branch 'bkl-removal' of git://git.lwn.net/linux-2.6

* 'bkl-removal' of git://git.lwn.net/linux-2.6:
Rationalize fasync return values
Move FASYNC bit handling to f_op->fasync()
Use f_lock to protect f_flags
Rename struct file->f_ep_lock
551509d267905705f6d723e51ec706916f06b859 11-Feb-2009 Harvey Harrison <harvey.harrison@gmail.com> USB: replace uses of __constant_{endian}

The base versions handle constant folding now.

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/usb/gadget/file_storage.c
db1dd4d376134eba0e08af523b61cc566a4ea1cd 06-Feb-2009 Jonathan Corbet <corbet@lwn.net> Use f_lock to protect f_flags

Traditionally, changes to struct file->f_flags have been done under BKL
protection, or with no protection at all. This patch causes all f_flags
changes after file open/creation time to be done under protection of
f_lock. This allows the removal of some BKL usage and fixes a number of
longstanding (if microscopic) races.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Cc: Al Viro <viro@ZenIV.linux.org.uk>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
/drivers/usb/gadget/file_storage.c
ce459ec1d278b19be8e0719dbfd47dd1d6687bfb 24-Feb-2009 Alan Stern <stern@rowland.harvard.edu> USB: g_file_storage: automatically disable stalls under Atmel

This patch (as1220) automatically disables stalls when g_file_storage
finds itself running with an Atmel device controller, because the
Atmel hardware/driver isn't capable of halting bulk endpoints
correctly.

Reported-by: Stanislaw Gruszka <stf_xl@wp.pl>
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Acked-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/usb/gadget/file_storage.c
889394b1eb95f040525d06dd4f2f1222b94023e2 08-Dec-2008 Felipe Balbi <felipe.balbi@nokia.com> USB: gadget: don't wait for completion twice

In some obscure scenarios e.g. passing a 0-byte backing file
storage, wait_for_completion() would wait forever in fsg_cleanup().

Prevent it by completing the thread in fsg_bind() error path.

Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/usb/gadget/file_storage.c
12aae68a203e97a58d3f8237fc389201a4d9282d 20-Nov-2008 Alan Stern <stern@rowland.harvard.edu> USB: g_file_storage: add CD-ROM emulation

This patch (as1172) adds the ability to emulate a CD-ROM drive to
g_file_storage. The emulation is limited, since it presents as a disc
containing a single data track and no audio tracks. Still, it may
come in useful on occasion.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/usb/gadget/file_storage.c
4c728ef583b3d82266584da5cb068294c09df31e 22-Dec-2008 Christoph Hellwig <hch@lst.de> add a vfs_fsync helper

Fsync currently has a fdatawrite/fdatawait pair around the method call,
and a mutex_lock/unlock of the inode mutex. All callers of fsync have
to duplicate this, but we have a few and most of them don't quite get
it right. This patch adds a new vfs_fsync that takes care of this.
It's a little more complicated as usual as ->fsync might get a NULL file
pointer and just a dentry from nfsd, but otherwise gets afile and we
want to take the mapping and file operations from it when it is there.

Notes on the fsync callers:

- ecryptfs wasn't calling filemap_fdatawrite / filemap_fdatawait on the
lower file
- coda wasn't calling filemap_fdatawrite / filemap_fdatawait on the host
file, and returning 0 when ->fsync was missing
- shm wasn't calling either filemap_fdatawrite / filemap_fdatawait nor
taking i_mutex. Now given that shared memory doesn't have disk
backing not doing anything in fsync seems fine and I left it out of
the vfs_fsync conversion for now, but in that case we might just
not pass it through to the lower file at all but just call the no-op
simple_sync_file directly.

[and now actually export vfs_fsync]

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
/drivers/usb/gadget/file_storage.c
36e893d25aa2abcae0f11ef263de0e8322641386 12-Sep-2008 David Brownell <dbrownell@users.sourceforge.net> usb gadget: USB_GADGET_VBUS_DRAW Kconfig option

Offer a "how much VBUS power to request" configuration option
for USB gadgets that aren't using board-specific customization
of their gadget or (composite) configuration drivers.

Also remove a couple pointless "depends on USB_GADGET" bits
from the Kconfig text; booleans inside an "if USB_GADGET" will
already have that dependency.

Based on a patch from Justin Clacherty.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Cc: Justin Clacherty <justin@redfish-group.com>
Tested-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/usb/gadget/file_storage.c
549c41e0ac0a3eb68cfdaeb43c1a314e2a6c289a 19-Sep-2008 Felipe Balbi <felipe.balbi@nokia.com> usb: gadget: workaround storage command size issues

Try to workaround issues with bad SCSI implementations
by ignoring the command size error.

Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/usb/gadget/file_storage.c
352e2b961c885b98065c402e2ad85057d0a334b2 19-Aug-2008 David Brownell <dbrownell@users.sourceforge.net> usb gadget: link fixes for storage gadget

Change how the file storage gadget driver builds: don't
use separate compilation, since it works poorly when key
parts are library code (with init sections etc). Instead
be as close as we can to "gcc --combine ...".

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/usb/gadget/file_storage.c
b6c63937001889af6fe431aaba97e59d04e028e7 25-Jul-2008 Arjan van de Ven <arjan@linux.intel.com> Rename WARN() to WARNING() to clear the namespace

We want to use WARN() as a variant of WARN_ON(), however a few drivers are
using WARN() internally. This patch renames these to WARNING() to avoid the
namespace clash. A few cases were defining but not using the thing, for those
cases I just deleted the definition.

Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Acked-by: Greg KH <greg@kroah.com>
Cc: Karsten Keil <kkeil@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
/drivers/usb/gadget/file_storage.c
0031a06e2f07ab0d1bc98c31dbb6801f95f4bf01 02-May-2008 Kay Sievers <kay.sievers@vrfy.org> USB: usb dev_set_name() instead of dev->bus_id

The bus_id field is going away, use the dev_set_name() function
to set it properly.

Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/usb/gadget/file_storage.c
7071a3ce0ca058ad2a9e3e8c33f30fb0bce62005 02-May-2008 Kay Sievers <kay.sievers@vrfy.org> USB: usb dev_name() instead of dev->bus_id

The bus_id field is going away, use the dev_name() function instead.

Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/usb/gadget/file_storage.c
62fd2cac5bf5cf9e6fcb2fc40b32e7271e605c53 29-Apr-2008 David Lopo <lopo.david@gmail.com> USB GADGET/PERIPHERAL: g_file_storage Bulk-Only Transport compliance, clear-feature ignore

Gadget tells controller driver to ignore Clear-Feature(HALT_ENDPOINT)

Signed-off-by: David Lopo <lopo.david@gmail.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
/drivers/usb/gadget/file_storage.c
441b62c1edb986827154768d89bbac0ba779984f 04-Mar-2008 Harvey Harrison <harvey.harrison@gmail.com> USB: replace remaining __FUNCTION__ occurrences

__FUNCTION__ is gcc-specific, use __func__

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/usb/gadget/file_storage.c
b950bdbc67041412cb042e404938667204c7902c 14-Apr-2008 Alan Stern <stern@rowland.harvard.edu> USB: g_file_storage: ignore bulk-out data after invalid CBW

This patch (as1061) makes g_file_storage more compliant with the
Bulk-Only Transport specification. After an invalid CBW is received,
the gadget must ignore any further bulk-OUT data until it is reset.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/usb/gadget/file_storage.c
cf28b4863f9ee8f122e8ff3ac0d403e07ba9c6d9 15-Feb-2008 Jan Blunck <jblunck@suse.de> d_path: Make d_path() use a struct path

d_path() is used on a <dentry,vfsmount> pair. Lets use a struct path to
reflect this.

[akpm@linux-foundation.org: fix build in mm/memory.c]
Signed-off-by: Jan Blunck <jblunck@suse.de>
Acked-by: Bryan Wu <bryan.wu@analog.com>
Acked-by: Christoph Hellwig <hch@infradead.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: "J. Bruce Fields" <bfields@fieldses.org>
Cc: Neil Brown <neilb@suse.de>
Cc: Michael Halcrow <mhalcrow@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
/drivers/usb/gadget/file_storage.c
00274921a052d3232d9f00856387fb269ac0af11 19-Nov-2007 David Brownell <david-b@pacbell.net> USB: gadget code switches to pr_err() and friends

We now have pr_err(), pr_warning(), and friends ... start using
them in the gadget stack instead of printk(KERN_ERR) and friends.
This gives us shorter lines and somewhat increased readability.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/usb/gadget/file_storage.c
ba25f9dcc4ea6e30839fcab5a5516f2176d5bfed 19-Oct-2007 Pavel Emelyanov <xemul@openvz.org> Use helpers to obtain task pid in printks

The task_struct->pid member is going to be deprecated, so start
using the helpers (task_pid_nr/task_pid_vnr/task_pid_nr_ns) in
the kernel.

The first thing to start with is the pid, printed to dmesg - in
this case we may safely use task_pid_nr(). Besides, printks produce
more (much more) than a half of all the explicit pid usage.

[akpm@linux-foundation.org: git-drm went and changed lots of stuff]
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Cc: Dave Airlie <airlied@linux.ie>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
/drivers/usb/gadget/file_storage.c
9454a57ab5922e5cd25321cae9d1a8cbeb3e2e85 05-Oct-2007 David Brownell <david-b@pacbell.net> USB: move <linux/usb_gadget.h> to <linux/usb/gadget.h>

Move <linux/usb_gadget.h> to <linux/usb/gadget.h>, reducing
some of the clutter in the main include directory.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/usb/gadget/file_storage.c
12943f097e5a4a0550f52f98ab8f476435e2ce15 24-Aug-2007 Alan Stern <stern@rowland.harvard.edu> USB: less-restrictive command checking in g-file-storage

This patch (as983) makes a test for minimum-length command sizes in
g_file_storage less restrictive. It doesn't matter because commands
with bad lengths will be detected later on anyway, and doing it like
this makes the driver interoperable with certain buggy hosts such as
the JVC HiFi (reported by Samuel Hangouet).

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/usb/gadget/file_storage.c
79a7d9ee1a2e8b8dc44dd217f07496911850ec0e 08-Aug-2007 Alan Stern <stern@rowland.harvard.edu> USB: cleanups for g_file_storage

This patch (as957) makes some minor cleanups to the g_file_storage
driver:

Update the copyright date and version string;

Uniformize the logging macros for the gadget and the LUNs;

Remove "inline" markers -- nowadays we rely on the compiler
to decide which routines are best inlined;

Use the print_hex_dump() library routines;

Remove some unnecessary assignments within conditionals
and fix some close-brace indenting levels;

Fix some column-80 violations.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/usb/gadget/file_storage.c
2e806f67cc570d25395469a0ded0df8ffbd4d82f 02-Aug-2007 David Brownell <david-b@pacbell.net> USB: gadget: file storage gadget cleanups

Clean up the file storage gadget, using newer APIs and conventions:

- gadget_is_dualspeed() and gadget_is_otg() ... #ifdef removal

- Remove many now-needless #includes

- Use the DEBUG (from Kconfig+Makefile) and VERBOSE_DEBUG conventions.

- Remove some "sparse" warnings (it still dislikes the __user annotations)

This gave only a minor object code shrinkage.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Cc: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/usb/gadget/file_storage.c
d1a94f080f5bdfe46c9fb4954ffe8ae9ec29e44a 17-Aug-2007 Alan Stern <stern@rowland.harvard.edu> USB: g_file_storage: fix bug in DMA buffer handling

This patch (as963) fixes a recently-introduced bug. The gadget
conversion removing DMA-mapped buffer allocation did not remove quite
enough code from the g_file_storage driver; DMA pointers were being
set to 0.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/usb/gadget/file_storage.c
88e45dbbababd29cd6c80a3e0b60a828676b3ba9 26-Jul-2007 Luis Lloret <luislloret@gmail.com> USB: Stall control endpoint when file storage class request wValue != 0

This patch makes the File Storage Gadget stall the control endpoint
when a MSC class request is made with wValue != 0. This change makes
some MSC compliance test warnings disappear.

Signed-off-by: Luis Lloret <luislloret@gmail.com>
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/usb/gadget/file_storage.c
831441862956fffa17b9801db37e6ea1650b0f69 17-Jul-2007 Rafael J. Wysocki <rjw@sisk.pl> Freezer: make kernel threads nonfreezable by default

Currently, the freezer treats all tasks as freezable, except for the kernel
threads that explicitly set the PF_NOFREEZE flag for themselves. This
approach is problematic, since it requires every kernel thread to either
set PF_NOFREEZE explicitly, or call try_to_freeze(), even if it doesn't
care for the freezing of tasks at all.

It seems better to only require the kernel threads that want to or need to
be frozen to use some freezer-related code and to remove any
freezer-related code from the other (nonfreezable) kernel threads, which is
done in this patch.

The patch causes all kernel threads to be nonfreezable by default (ie. to
have PF_NOFREEZE set by default) and introduces the set_freezable()
function that should be called by the freezable kernel threads in order to
unset PF_NOFREEZE. It also makes all of the currently freezable kernel
threads call set_freezable(), so it shouldn't cause any (intentional)
change of behaviour to appear. Additionally, it updates documentation to
describe the freezing of tasks more accurately.

[akpm@linux-foundation.org: build fixes]
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Nigel Cunningham <nigel@nigel.suspend2.net>
Cc: Pavel Machek <pavel@ucw.cz>
Cc: Oleg Nesterov <oleg@tv-sign.ru>
Cc: Gautham R Shenoy <ego@in.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
/drivers/usb/gadget/file_storage.c
9d8bab58b758cd5a96d368a8cc64111c9ab50407 01-Jul-2007 David Brownell <david-b@pacbell.net> usb gadget stack: remove usb_ep_*_buffer(), part 1

Remove usb_ep_{alloc,free}_buffer() calls, for small dma-coherent buffers.
This patch just removes the interface and its users; later patches will
remove controller driver support.

- This interface is invariably not implemented correctly in the
controller drivers (e.g. using dma pools, a mechanism which
post-dates the interface by several years).

- At this point no gadget driver really *needs* to use it. In
current kernels, any driver that needs such a mechanism could
allocate a dma pool themselves.

Removing this interface is thus a simplification and improvement.

Note that the gmidi.c driver had a bug in this area; fixed.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/usb/gadget/file_storage.c
020363384adfb02f26c1c038a127ed3da3d5cf37 29-May-2007 Tony Lindgren <tony@atomide.com> USB: Disable file_storage USB_CONFIG_ATT_WAKEUP

Disable file_storage USB_CONFIG_ATT_WAKEUP as it requires
user interaction during Chapter 9 tests.

Signed-off-by: Tony Lindgren <tony@atomide.com
Signed-off-by: Felipe Balbi <felipe.lima@indt.org.br>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Acked-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/usb/gadget/file_storage.c
8cfbe7e60d9618d8f80a3cd218c45dd64cb9e5cf 30-May-2007 Oleg Nesterov <oleg@tv-sign.ru> USB: g_file_storage: call allow_signal()

New changes in the signal-handling code require compensating changes
in g_file_storage. This patch (as913) by Oleg Nesterov makes the
code use allow_signal() instead of sigprocmask().

From: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/usb/gadget/file_storage.c
fc0ecff698165ae8e178efa086e0dd1f385206b1 10-Feb-2007 Andrew Morton <akpm@osdl.org> [PATCH] remove invalidate_inode_pages()

Convert all calls to invalidate_inode_pages() into open-coded calls to
invalidate_mapping_pages().

Leave the invalidate_inode_pages() wrapper in place for now, marked as
deprecated.

Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
/drivers/usb/gadget/file_storage.c
7ca46b862f0e30fe0dcc4a4aef5b32f6b6a3fda5 30-Dec-2006 John Daiker <daikerjohn@gmail.com> USB Gadget file_storage.c: remove unnecessary casts

Went looking through some usb stuff and found some unnecessary casts in
file_storage.c This is part of the KernelJanitors TODO list.

Signed-off-by: John Daiker <daikerjohn@gmail.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/usb/gadget/file_storage.c
5f848137744106ee737f559454ce5adfceb38347 17-Dec-2006 David Brownell <david-b@pacbell.net> USB: <linux/usb_ch9.h> becomes <linux/usb/ch9.h>

This moves <linux/usb_ch9.h> to <linux/usb/ch9.h> to reduce some of the
clutter of usb header files.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/usb/gadget/file_storage.c
6bea476cf628eb7bb18a036ac6a8fed1ad319951 05-Dec-2006 David Brownell <david-b@pacbell.net> USB: gadget driver unbind() is optional; section fixes; misc

Allow gadget drivers to omit the unbind() method. When they're
statically linked, that's an appropriate memory saving tweak.

Similarly, provide consistent/simpler handling for a should-not-happen
error case: removing a peripheral controller driver when a gadget
driver is still loaded. Such code dates back to early versions of the
first implementation of the gadget API, and has never been triggered.

Includes relevant section annotation fixs for gmidi.c, file_storage.c,
and serial.c; we don't yet have an "init or exit" annotation. Also
some whitespace fixes in gmidi.c (space at EOL, before tabs, etc).

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/usb/gadget/file_storage.c
33cb89940082c54f348062db2f8bab6cf8fed816 08-Dec-2006 Josef Sipek <jsipek@fsl.cs.sunysb.edu> [PATCH] struct path: convert usb

Signed-off-by: Josef Sipek <jsipek@fsl.cs.sunysb.edu>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
/drivers/usb/gadget/file_storage.c
7dfb71030f7636a0d65200158113c37764552f93 07-Dec-2006 Nigel Cunningham <ncunningham@linuxmail.org> [PATCH] Add include/linux/freezer.h and move definitions from sched.h

Move process freezing functions from include/linux/sched.h to freezer.h, so
that modifications to the freezer or the kernel configuration don't require
recompiling just about everything.

[akpm@osdl.org: fix ueagle driver]
Signed-off-by: Nigel Cunningham <nigel@suspend2.net>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
/drivers/usb/gadget/file_storage.c
96b644bdec977b97a45133e5b4466ba47a7a5e65 02-Oct-2006 Serge E. Hallyn <serue@us.ibm.com> [PATCH] namespaces: utsname: use init_utsname when appropriate

In some places, particularly drivers and __init code, the init utsns is the
appropriate one to use. This patch replaces those with a the init_utsname
helper.

Changes: Removed several uses of init_utsname(). Hope I picked all the
right ones in net/ipv4/ipconfig.c. These are now changed to
utsname() (the per-process namespace utsname) in the previous
patch (2/7)

[akpm@osdl.org: CIFS fix]
Signed-off-by: Serge E. Hallyn <serue@us.ibm.com>
Cc: Kirill Korotaev <dev@openvz.org>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Herbert Poetzl <herbert@13thfloor.at>
Cc: Andrey Savochkin <saw@sw.ru>
Cc: Serge Hallyn <serue@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
/drivers/usb/gadget/file_storage.c
6174d0fd35f486f59b743630bdf088a9f9792d4d 26-Sep-2006 Alan Stern <stern@rowland.harvard.edu> USB: g_file_storage: Set sense info Valid bit only when needed

Strictly speaking, the Valid bit in SCSI sense data is supposed to
be set only when the Information field contains a valid number. This
patch (as793) turns off the Valid bit when the Information field
hasn't been set.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/usb/gadget/file_storage.c
2de9eaefa7330b8e3d3fc5f31288cb1e826173a8 25-Sep-2006 Alan Stern <stern@rowland.harvard.edu> USB: g_file_storage: fix "ignoring return value" warnings

This patch (as792) fixes "ignoring return value" warnings in
file_storage.c.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/usb/gadget/file_storage.c
a353678d3136306c1d00f0d2319de1dac8a6b1db 07-Jul-2006 David Brownell <david-b@pacbell.net> [PATCH] USB: gadget section fixups

Recent section changes broke gadget builds on some platforms. This patch
is the best fix that's available until better section markings exist:

- There's a lot of cleanup code that gets used in both init and exit paths;
stop marking it as "__exit".

(Best fix for this would be an "__init_or_exit" section marking, putting
the cleanup in __init when __exit sections get discarded else in __exit.)

- Stop marking the use-once probe routines as "__init" since references
to those routines are not allowed from driver structures. They're now
marked "__devinit", which in practice is a net lose.

(Best fix for this is likely to separate such use-once probe routines
from the driver structure ... but in general, all busses that aren't
hotpluggable will be forced to waste memory for all probe-only code.)

In general these broken section rules waste an average of two to four kBytes
per driver of code bloat ... because none of the relevant code can ever be
reused after module initialization.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/usb/gadget/file_storage.c
6ab3d5624e172c553004ecc862bfeac16d9d68b7 30-Jun-2006 Jörn Engel <joern@wohnheim.fh-wedel.de> Remove obsolete #include <linux/config.h>

Signed-off-by: Jörn Engel <joern@wohnheim.fh-wedel.de>
Signed-off-by: Adrian Bunk <bunk@stusta.de>
/drivers/usb/gadget/file_storage.c
b31dc66a54ad986b6b73bdc49c8efc17cbad1833 13-Jun-2006 Jens Axboe <axboe@suse.de> [PATCH] Kill PF_SYNCWRITE flag

A process flag to indicate whether we are doing sync io is incredibly
ugly. It also causes performance problems when one does a lot of async
io and then proceeds to sync it. Part of the io will go out as async,
and the other part as sync. This causes a disconnect between the
previously submitted io and the synced io. For io schedulers such as CFQ,
this will cause us lost merges and suboptimal behaviour in scheduling.

Remove PF_SYNCWRITE completely from the fsync/msync paths, and let
the O_DIRECT path just directly indicate that the writes are sync
by using WRITE_SYNC instead.

Signed-off-by: Jens Axboe <axboe@suse.de>
/drivers/usb/gadget/file_storage.c
aafe5bd6ec341edfaf3233d272febbb8862a7251 31-Mar-2006 Alan Stern <stern@rowland.harvard.edu> [PATCH] USB: g_file_storage: use module_param_array_named macro

Randy Dunlap pointed out that there now is a module_param_array_named
macro available. This patch (as666) updates g_file_storage to make use of
it. It also adds a comment listing the specifications documents used in
the design of the driver's SCSI operation (at Pat LaVarre's request).

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/usb/gadget/file_storage.c
14cd5f8e85e90c9dead2393377b9a2c23131e0ce 23-Mar-2006 Alan Stern <stern@rowland.harvard.edu> [PATCH] USB: g_file_storage: add comment about buffer allocation

This patch (as664) adds a comment to file_storage.c, noting that the
driver is slightly non-portable because it assumes that a buffer
allocated for a bulk-in endpoint will also be useable for a bulk-out
endpoint.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/usb/gadget/file_storage.c
70ffe6e14d7c5db84b92841471ce6fd0200010cd 23-Mar-2006 Alan Stern <stern@rowland.harvard.edu> [PATCH] USB: g_file_storage: Set short_not_ok for bulk-out transfers

I'm told that some UDC hardware may work better if it knows that
receiving a short packet should always cause an error. Accordingly,
this patch (as663) sets the short_not_ok flag for bulk-out transfers in
g_file_storage. Oddly enough, there are no circumstances where that
driver can legally receive a shorter-than-expected bulk-out packet.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/usb/gadget/file_storage.c
329af28b141ab4ae847aff1362864c4cc332641f 18-Feb-2006 David Brownell <david-b@pacbell.net> [PATCH] USB: gadget driver section fixups

This adds __init section annotations to gadget driver bind() routines to
remove calls from .text into .init sections (for endpoint autoconfig).
Likewise it adds __exit section annotations to their unbind() routines.

The specification of the gadget driver register/unregister functions is
updated to explicitly allow use of those sections.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/usb/gadget/file_storage.c
1b1dcc1b57a49136f118a0f16367256ff9994a69 10-Jan-2006 Jes Sorensen <jes@sgi.com> [PATCH] mutex subsystem, semaphore to mutex: VFS, ->i_sem

This patch converts the inode semaphore to a mutex. I have tested it on
XFS and compiled as much as one can consider on an ia64. Anyway your
luck with it might be different.

Modified-by: Ingo Molnar <mingo@elte.hu>

(finished the conversion)

Signed-off-by: Jes Sorensen <jes@sgi.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
/drivers/usb/gadget/file_storage.c
a21d4fed4b00eaf7e7c3b2e2b25de24f540bfa66 29-Nov-2005 Alan Stern <stern@rowland.harvard.edu> [PATCH] USB Gadget: file_storage: remove "volatile" declarations

This patch (as612) removes the "volatile" declarations from the
file-storage gadget. It turns out that they aren't needed for anything
much; adding a few memory barriers does a sufficient job.

The patch also removes a wait_queue. Not much point having a queue when
only one task is ever going to be on it!

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/usb/gadget/file_storage.c
3aea4a76a3ec4e6484f6316a97efff8b144b2b11 27-Nov-2005 Pavel Machek <pavel@ucw.cz> [PATCH] USB: Cleanups for usb gadget mass-storage

Remove useless initalizers.

Signed-off-by: Pavel Machek <pavel@suse.cz>
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
/drivers/usb/gadget/file_storage.c
87c4252a35310fdbb2aabb880a39b83f83cadf62 09-Nov-2005 Alan Stern <stern@rowland.harvard.edu> [PATCH] USB: file-storage gadget: Add reference count for children

This patch (as601) adds a proper reference count to the file-storage
gadget's main data structure, to keep track of references held by child
devices (LUNs in this case). Before this, the driver would wait for
each child to be released before unbinding.

While there's nothing really wrong with that (you can't create a hang by
doing "rmmod g_file_storage </sys/.../lun0/ro" since the open file will
prevent rmmod from running), the code might as well follow the standard
procedures. Besides, this shrinks the size of the structure by a few
words... :-)

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/usb/gadget/file_storage.c
d0d5049fb02fc1082c17e08deecd6fed8db549b6 10-Oct-2005 Ben Dooks <ben@fluff.org.uk> [PATCH] USB: gadget drivers - add .owner initialisation

Ensure the the device_driver and usb_gadget_driver
have their .owner fields initialised to associate
the module owner to the driver.

Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/usb/gadget/file_storage.c
a922c68732725866c88457026cf06a7620846506 06-Oct-2005 Alan Stern <stern@rowland.harvard.edu> [PATCH] g_file_storage: fix obscure race condition

This patch (as575) fixes an unlikely race in the g_file_storage driver.
The problem can occur only when the driver is unbound before its
initialization routine has finished.

I also took the opportunity to replace kmalloc/memset with kzalloc.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/usb/gadget/file_storage.c
22efcf4adec4262e0f49e6225f6cd070e4a85d20 26-Sep-2005 Alan Stern <stern@rowland.harvard.edu> [PATCH] USB: File-Storage gadget: use the kthread API

This patch (as566) converts the File-Storage gadget over to the kthread
API. The new code doesn't use kthread_stop because the control thread
needs to terminate asynchronously when it receives a signal.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

drivers/usb/gadget/file_storage.c | 32 +++++++++++++-------------------
1 file changed, 13 insertions(+), 19 deletions(-)
/drivers/usb/gadget/file_storage.c
91e79c91fab10f5790159d8d0c1d16da2a9653f9 14-Jul-2005 David Brownell <david-b@pacbell.net> [PATCH] USB: Gadget library: centralize gadget controller numbers

This patch centralizes the assignment of bcdDevice numbers for different
gadget controllers. This won't improve the object code at all, but it
does save a lot of repetitive and error-prone source code ... and will
simplify the work of supporting a new controller driver, since most new
gadget drivers will no longer need patches (unless some hardware quirks
limit USB protocol messaging).

Added minor cleanups and identifer hooks for the UDC in the Freescale
iMX series processors.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/usb/gadget/file_storage.c
1bbc169621cbe502b9143a27eb12802a0f1d43a0 07-May-2005 David Brownell <david-b@pacbell.net> [PATCH] USB: gadget driver updates (SETUP api change)

This updates most of the gadget framework to expect SETUP packets use
USB byteorder (matching the annotation in <linux/usb_ch9.h> and usage
in the host side stack):

- definition in <linux/usb_gadget.h>
- gadget drivers: Ethernet/RNDIS, serial/ACM, file_storage, gadgetfs.
- dummy_hcd

It also includes some other similar changes as suggested by "sparse",
which was used to detect byteorder bugs.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/usb/gadget/file_storage.c
d794ac7ae3613c2abfb678617ac7d74c8ff0099c 18-Apr-2005 Alan Stern <stern@rowland.harvard.edu> [PATCH] USB: g_file_storage: export "stall" parameter

This patch changes the g_file_storage driver to make the "stall" module
parameter generally available; currently it is available only if the
testing version of the module has been configured. It also fixes a typo
in a comment -- thanks, Pat!

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/usb/gadget/file_storage.c
76f4af8efc72b6091d230cbe718cedca06d2d79e 05-Apr-2005 Alan Stern <stern@rowland.harvard.edu> [PATCH] USB: g_file_storage: Consolidate min()s

This patch simplifies the g_file_storage driver by consolidating a bunch
of min() calculations at a single spot.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/usb/gadget/file_storage.c
3e1d1d28d99dabe63c64f7f40f1ca1d646de1f73 25-Jun-2005 Christoph Lameter <christoph@lameter.com> [PATCH] Cleanup patch for process freezing

1. Establish a simple API for process freezing defined in linux/include/sched.h:

frozen(process) Check for frozen process
freezing(process) Check if a process is being frozen
freeze(process) Tell a process to freeze (go to refrigerator)
thaw_process(process) Restart process
frozen_process(process) Process is frozen now

2. Remove all references to PF_FREEZE and PF_FROZEN from all
kernel sources except sched.h

3. Fix numerous locations where try_to_freeze is manually done by a driver

4. Remove the argument that is no longer necessary from two function calls.

5. Some whitespace cleanup

6. Clear potential race in refrigerator (provides an open window of PF_FREEZE
cleared before setting PF_FROZEN, recalc_sigpending does not check
PF_FROZEN).

This patch does not address the problem of freeze_processes() violating the rule
that a task may only modify its own flags by setting PF_FREEZE. This is not clean
in an SMP environment. freeze(process) is therefore not SMP safe!

Signed-off-by: Christoph Lameter <christoph@lameter.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
/drivers/usb/gadget/file_storage.c
10523b3b82456e416cbaffcc24ea2246980aa746 17-May-2005 Yani Ioannou <yani.ioannou@gmail.com> [PATCH] Driver Core: drivers/s390/net/qeth_sys.c - drivers/usb/gadget/pxa2xx_udc.c: update device attribute callbacks

Signed-off-by: Yani Ioannou <yani.ioannou@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/drivers/usb/gadget/file_storage.c
1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 17-Apr-2005 Linus Torvalds <torvalds@ppc970.osdl.org> Linux-2.6.12-rc2

Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.

Let it rip!
/drivers/usb/gadget/file_storage.c