summaryrefslogtreecommitdiff
path: root/drivers/usb/gadget/inode.c
AgeCommit message (Collapse)Author
2008-04-24USB: replace remaining __FUNCTION__ occurrencesHarvey Harrison
__FUNCTION__ is gcc-specific, use __func__ Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-03-24USB: fix gadgetfs class request delegationRoy Hashimoto
gadgetfs (drivers/usb/gadget/inode.c) was not delegating all non-device requests to userspace. This patch makes the handling of all request cases consistent. Signed-off-by: Roy Hashimoto <hashimot@alumni.caltech.edu> Acked-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-02-01USB: gadget code switches to pr_err() and friendsDavid Brownell
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>
2007-10-12USB: move <linux/usb_gadget.h> to <linux/usb/gadget.h>David Brownell
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>
2007-10-12USB: gadget: gadget_is_{dualspeed,otg} predicates and cleanupDavid Brownell
This adds two small inlines to the gadget stack, which will often evaluate to compile-time constants. That can help shrink object code and remove #ifdeffery. - gadget_is_dualspeed(), currently always a compile-time constant (depending on which controller is selected). - gadget_is_otg(), usually a compile time "false", but this is a runtime test if the platform enables OTG (since it's reasonable to populate boards with different USB sockets). It also updates two peripheral controller drivers to use these: - fsl_usb2_udc, mostly OTG-related bugfixes: non-OTG devices must follow the rules about drawing VBUS power, and OTG ones need to reject invalid SET_FEATURE requests. - omap_udc, just scrubbing a bit of #ifdeffery. And also gadgetfs, which lost some #ifdefs and moved to a more standard handling of DEBUG and VERBOSE_DEBUG. The main benefits come from patches which will follow. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-30USB: "sparse" cleanups for usb gadgetsDavid Brownell
This removes complaints about the gadget stack which are generated by the currrent "sparse": it doesn't like the fact that zero is the null pointer. (Last I checked, C guarantees that's correct ...) Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12usb gadget stack: remove usb_ep_*_buffer(), part 1David Brownell
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>
2007-07-12USB: export <linux/usb_gadgetfs> as <linux/usb/gadgetfs.h>David Brownell
Make sure gadgetfs userspace interface is properly exported: - Move <linux/usb_gadgetfs.h> to <linux/usb/gadgetfs.h>; - Export it using Kbuild; - Add an #include guard; - Correct some internal documentation; - Update struct layout so it's the same on 32/64 bit kernels. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12USB: usb gadget, dead config cleanupDavid Brownell
Remove some dead CONFIG_ symbols, and document the status of a few others. The "gadget_chips.h" references are by and large to drivers which exist but haven't yet been submitted for merging to the main 2.6 tree. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-06-08USB: usb gadgets avoid le{16,32}_to_cpup()David Brownell
It turns out that le16_to_cpup() and le32_to_cpup() aren't always safe to call with pointers into packed structures, since those are inlined functions and GCC may lose the "packed" attribute. So those references can become unaligned kernel accesses, which are evil on some hardware. This patch updates uses of those routines in the gadget stack. The references into packed structures can just use leXX_to_cpu(*x), which in most cases is more natural. Some other uses in RNDIS, mostly in debug code, were wrong in the first place; those use get_unaligned(). Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-02-23gadgetfs: Fixed bug in ep_aio_read_retry.Sarah Bailey
I don't think the current code works with multiple iovecs. The original would just copy the first part of priv->buf over and over into multiple iovecs. Signed-off-by: Sarah Bailey <saharabeara@gmail.com> Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-02-07USB: gadgetfs AIO tweaksAlan Stern
This patch (as837) fixes several mistakes in the AIO interface of the gadgetfs driver: The ki_retry method is not supposed to do a put on the kiocb. The extra call to aio_put_req() causes memory corruption. (Note: This call was removed before, by patch as691, and then mysteriously re-introduced later.) Even if a read transfer is cancelled, we can and should send to the user all the data that did manage to get transferred. Testing for AIO cancellation in the I/O completion handler is both racy and (now) unnecessary. aio_complete() does its own checking, in a safe manner. 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>
2007-02-07USB: gadgetfs behaves better on userspace init bugDavid Brownell
Resolve an initizlization issue that could come up if the userspace driver wrote invalid descriptors to a dual-speed device. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-02-07USB: gadgetfs race fixDavid Brownell
This resolves a race in gadgetfs associated with changing device/ep0 when processing control requests. The fix is to change that state earlier, when the control response is issued, so there's no window in which userspace could see the wrong state; and enlarge the scope of the spinlock during the ep0 request completion handler. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-02-07USB: gadgetfs simplificationsDavid Brownell
This simplifies event reading by eliminating arithmetic and being more direct/obvious, and tweaks some debug messages slightly. The math elimination will change timings, sometimes enough to allow a race to appear. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-02-07USB: gadgetfs cleanupsDavid Brownell
Minor gadgetfs cleanups: - EP0 state constants become consistently STATE_DEV_* rather than sometimes omitting the "DEV_"; STATE_EP_* were already consistent. - Comment that ep0 state is protected by the spinlock, and update code that was neglecting that rule. None of this is expected to change behavior. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-02-07usb: gadgetfs remove delayed init modePhil Endecott
Gadgetfs had a mode in which endpoint descriptors were written by the user program before connection. This mode had some bugs, and hasn't seen much (if any) use. This patch removes that mode, leaving the mode of operation where the user program waits for endpoint 0 to report a SET_CONFIGURATION, and only then configures the endpoints. From: "Phil Endecott" <spam_from_usb_devel@chezphil.org> Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-02-07usb: gadgetfs whitespace cleanupDavid Brownell
Remove some whitespace bugs in gadgetfs (mostly from someone's patch updating the AIO support). Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-12-07[PATCH] slab: remove SLAB_KERNELChristoph Lameter
SLAB_KERNEL is an alias of GFP_KERNEL. Signed-off-by: Christoph Lameter <clameter@sgi.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-10-01[PATCH] Vectorize aio_read/aio_write fileop methodsBadari Pulavarty
This patch vectorizes aio_read() and aio_write() methods to prepare for collapsing all aio & vectored operations into one interface - which is aio_read()/aio_write(). Signed-off-by: Badari Pulavarty <pbadari@us.ibm.com> Signed-off-by: Christoph Hellwig <hch@lst.de> Cc: Michael Holzheu <HOLZHEU@de.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-10-01[PATCH] completions: lockdep annotate on stack completionsPeter Zijlstra
All on stack DECLARE_COMPLETIONs should be replaced by: DECLARE_COMPLETION_ONSTACK Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Acked-by: Ingo Molnar <mingo@elte.hu> Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-09-27gadgetfs patch for ep0outSkip Hansen
For ep0out transfers (rare), be sure to copy the right data to userspace. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-09-27USB gadget: gadgetfs dont try to lock before freeMilan Svoboda
I spotted this during my tests with -rt on arm. The -rt patch contains some better tools to diagnose problems with locks and some other things... Original code tries to take semaphore in BUG_ON and then free the memory with this semaphore. Signed-off-by: Milan Svoboda <msvoboda@ra.rockwell.com> Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-09-27USB: add poll to gadgetfs's endpoint zeroMilan Svoboda
Add poll() support to gadgetfs ep0 Signed-off-by: Milan Svoboda <msvoboda@ra.rockwell.com> Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-09-27USB: Make file operations structs in drivers/usb const.Luiz Fernando N. Capitulino
Making structs const prevents accidental bugs and with the proper debug options they're protected against corruption. Signed-off-by: Luiz Fernando N. Capitulino <lcapitulino@mandriva.com.br> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-09-27USB: gadgetfs: protect ep_release with lockMilan Svoboda
This patch adds mutex protection to ep_release. Signed-off-by: Milan Svoboda <msvoboda@ra.rockwell.com> Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-09-27USB: fix ep_config to return correct valueMilan Svoboda
This patch fixes ep_config to return correct value. Without patch ep_config returns submitted lenght minus 4 on succes. With this patch applied, whole submitted lenght is returned. ep_config parses submitted data and if buffer starts with (int) 1 it is parsed, otherwise error is reported. Problem is that ep_config returns size of buffer minus 4 on success. I think that size of buffer should be returned instead, because there were no problems and all data were processed. Signed-off-by: Milan Svoboda <msvoboda@ra.rockwell.com> Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-09-27USB: correct locking in gadgetfs_disconnectMilan Svoboda
This patch moves spin_lock (&dev->lock) before first use of dev. I think that test to the state of device should be protected with this spin_lock... Signed-off-by: Milan Svoboda <msvoboda@ra.rockwell.com> Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-09-27[PATCH] inode-diet: Eliminate i_blksize from the inode structureTheodore Ts'o
This eliminates the i_blksize field from struct inode. Filesystems that want to provide a per-inode st_blksize can do so by providing their own getattr routine instead of using the generic_fillattr() function. Note that some filesystems were providing pretty much random (and incorrect) values for i_blksize. [bunk@stusta.de: cleanup] [akpm@osdl.org: generic_fillattr() fix] Signed-off-by: "Theodore Ts'o" <tytso@mit.edu> Signed-off-by: Adrian Bunk <bunk@stusta.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-09-27[PATCH] inode_diet: Replace inode.u.generic_ip with inode.i_privateTheodore Ts'o
The following patches reduce the size of the VFS inode structure by 28 bytes on a UP x86. (It would be more on an x86_64 system). This is a 10% reduction in the inode size on a UP kernel that is configured in a production mode (i.e., with no spinlock or other debugging functions enabled; if you want to save memory taken up by in-core inodes, the first thing you should do is disable the debugging options; they are responsible for a huge amount of bloat in the VFS inode structure). This patch: The filesystem or device-specific pointer in the inode is inside a union, which is pretty pointless given that all 30+ users of this field have been using the void pointer. Get rid of the union and rename it to i_private, with a comment to explain who is allowed to use the void pointer. This is just a cleanup, but it allows us to reuse the union 'u' for something something where the union will actually be used. [judith@osdl.org: powerpc build fix] Signed-off-by: "Theodore Ts'o" <tytso@mit.edu> Signed-off-by: Judith Lebzelter <judith@osdl.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-06-23[PATCH] VFS: Permit filesystem to override root dentry on mountDavid Howells
Extend the get_sb() filesystem operation to take an extra argument that permits the VFS to pass in the target vfsmount that defines the mountpoint. The filesystem is then required to manually set the superblock and root dentry pointers. For most filesystems, this should be done with simple_set_mnt() which will set the superblock pointer and then set the root dentry to the superblock's s_root (as per the old default behaviour). The get_sb() op now returns an integer as there's now no need to return the superblock pointer. This patch permits a superblock to be implicitly shared amongst several mount points, such as can be done with NFS to avoid potential inode aliasing. In such a case, simple_set_mnt() would not be called, and instead the mnt_root and mnt_sb would be set directly. The patch also makes the following changes: (*) the get_sb_*() convenience functions in the core kernel now take a vfsmount pointer argument and return an integer, so most filesystems have to change very little. (*) If one of the convenience function is not used, then get_sb() should normally call simple_set_mnt() to instantiate the vfsmount. This will always return 0, and so can be tail-called from get_sb(). (*) generic_shutdown_super() now calls shrink_dcache_sb() to clean up the dcache upon superblock destruction rather than shrink_dcache_anon(). This is required because the superblock may now have multiple trees that aren't actually bound to s_root, but that still need to be cleaned up. The currently called functions assume that the whole tree is rooted at s_root, and that anonymous dentries are not the roots of trees which results in dentries being left unculled. However, with the way NFS superblock sharing are currently set to be implemented, these assumptions are violated: the root of the filesystem is simply a dummy dentry and inode (the real inode for '/' may well be inaccessible), and all the vfsmounts are rooted on anonymous[*] dentries with child trees. [*] Anonymous until discovered from another tree. (*) The documentation has been adjusted, including the additional bit of changing ext2_* into foo_* in the documentation. [akpm@osdl.org: convert ipath_fs, do other stuff] Signed-off-by: David Howells <dhowells@redhat.com> Acked-by: Al Viro <viro@zeniv.linux.org.uk> Cc: Nathan Scott <nathans@sgi.com> Cc: Roland Dreier <rolandd@cisco.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-06-21[PATCH] gadgetfs: fix memory leaksAlan Stern
This patch (as692) fixes a few memory leaks in some unimportant error pathways of the gadgetfs driver. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Acked-by: David Brownell <david-b@pacbell.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-06-21[PATCH] gadgetfs: fix AIO interface bugsAlan Stern
This patch (as691) fixes a few errors in the AIO interface for the gadgetfs driver. Now requests will complete properly instead of hanging. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-04-26[PATCH] fix leak in activate_ep_files()Al Viro
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-04-14[PATCH] USB: gadgetfs highspeed bugfixDavid Brownell
This catches up to a change in the Kconfig support for highspeed modes; the change predated 2.6.10, and anyone using gadgetfs on a highspeed device would see the kernel wrongly reject the alternate descriptors. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-03-28[PATCH] mark f_ops const in the inodeArjan van de Ven
Mark the f_ops members of inodes as const, as well as fix the ripple-through this causes by places that copy this f_ops and then "do stuff" with it. Signed-off-by: Arjan van de Ven <arjan@infradead.org> Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-03-20[PATCH] USB: kzalloc() conversion in drivers/usb/gadgetEric Sesterhenn
this patch converts drivers/usb to kzalloc usage. Compile tested with allyes config. I think there was a bug in drivers/usb/gadget/inode.c because it used sizeof(*data) for the kmalloc() and sizeof(data) for the memset(), since sizeof(data) just returns the size for a pointer. Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de> Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-01-31[PATCH] USB: gadgetfs: set "zero" flag for short control-IN responseAlan Stern
This patch (as622) makes gadgetfs set the "zero" flag for control-IN responses, when the length of the response is shorter than the length of the request. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Acked-by: David Brownell <david-b@pacbell.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-01-13[PATCH] Remove usb gadget generic driver methodsRussell King
USB gadget drivers make no use of these, remove the pointless comments. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-01-09[PATCH] mutex subsystem, semaphore to mutex: VFS, ->i_semJes Sorensen
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>
2005-09-12[PATCH] USB gadgetfs: fixes an error on writing to endpoint filePavol Kurina
this patch fixes an "Invalid argument" error returned by a write to an endpoint-file after reopening it in the gadgetfs module in the kernel 2.6.12. This was testet only with dummy_hcd module! Signed-off-by: Pavol Kurina <kurina@gmx.net> Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2005-06-27[PATCH] USB: gadget driver updates (SETUP api change)David Brownell
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>
2005-05-03[PATCH] USB: Spelling fixes for drivers/usb.Steven Cole
Here are some spelling corrections for drivers/usb. cancelation -> cancellation succesful -> successful cancelation -> cancellation decriptor -> descriptor Initalize -> Initialize wierd -> weird Protocoll -> Protocol occured -> occurred successfull -> successful Procesing -> Processing devide -> divide Isochronuous -> Isochronous noticable -> noticeable Basicly -> Basically transfering -> transferring intialize -> initialize Incomming -> Incoming additionnal -> additional asume -> assume Unfortunatly -> Unfortunately retreive -> retrieve tranceiver -> transceiver Compatiblity -> Compatibility Incorprated -> Incorporated existance -> existence Ununsual -> Unusual Signed-off-by: Steven Cole <elenstev@mesatop.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-04-16Linux-2.6.12-rc2v2.6.12-rc2Linus Torvalds
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!