summaryrefslogtreecommitdiff
path: root/drivers/usb/gadget
AgeCommit message (Collapse)Author
2013-10-01usb: gadget: f_mass_storage: add a level of indirection for luns storageAndrzej Pietrasiewicz
This is needed to prepare for configfs integration. So far the luns have been allocated during gadget's initialization, based on the nluns module parameter's value; the exact number is known when the gadget is initialized and that number of luns is allocated in one go; they all will be used. When configfs is in place, the luns will be created one-by-one by the user. Once the user is satisfied with the number of luns, they activate the gadget. The number of luns must be <= FSG_MAX_LUN (currently 8), but other than that it is not known up front and the user need not use contiguous numbering (apart from the default lun #0). On the other hand, the function code uses lun numbers to identify them and the number needs to be used as an index into an array. Given the above, an array needs to be allocated, but it might happen that 7 out of its 8 elements will not be used. On my machine sizeof(struct fsg_lun) == 462, so > 3k of memory is allocated but not used in the worst case. By adding another level of indirection (allocating an array of pointers to struct fsg_lun and then allocating individual luns instead of an array of struct fsg_luns) at most 7 pointers are wasted, which is much less. This patch also changes some for/while loops to cope with the fact that in the luns array some entries are potentially empty. Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-10-01usb: gadget: f_mass_storage: factor out a header fileAndrzej Pietrasiewicz
In order to prepare for the new function interface the f_mass_storage.c needs to be compiled as a module, and so a header file will be required. This patch factors out some code to a new f_mass_storage.h. Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-10-01usb: gadget: create a utility module for mass_storageAndrzej Pietrasiewicz
Converting to configfs requires making the f_mass_storage.c a module. But first we need to get rid of "#include "storage_common.c". This patch makes storage_common.c a separately compiled file, which is built as a utility module named u_ms.ko. After all mass storage users are converted to the new function interface this module can be eliminated by merging it with the mass storage function's module. USB descriptors are exported so that they can be accessed from f_mass_storage. FSG_VENDOR_ID and FSG_PRODUCT_ID are moved to their only user. Handling of CONFIG_USB_GADGET_DEBUG_FILES is moved to f_mass_storage.c. The fsg_num_buffers static is moved to FSG_MODULE_PARAMETER users, so instead of using a global variable the f_mass_storage introduces fsg_num_buffers member in fsg_common (and fsg_config). fsg_strings and fsg_stringtab are moved to f_mass_storage.c. Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-10-01usb: gadget: configfs: add a method to unregister the gadgetAndrzej Pietrasiewicz
Add a method to unregister the gadget using its config_item. There can be functions (e.g. mass storage), which in some circumstances need the gadget stopped. Add a method of stopping the gadget. Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-10-01usb: gadget: Use ERR_CAST inlined function instead of ERR_PTR(PTR_ERR(...))Duan Jiong
trivial patch converting ERR_PTR(PTR_ERR()) into ERR_CAST(). No functional changes. Signed-off-by: Duan Jiong <duanj.fnst@cn.fujitsu.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-10-01usb: gadget: mv_u3d_core: fix memory leaksValentin Ilie
When trb_hw is NULL, trb should be free'd before return. Signed-off-by: Valentin Ilie <valentin.ilie@gmail.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-10-01usb: gadget: net2280: remove unnecessary pci_set_drvdata()Jingoo Han
The driver core clears the driver data to NULL after device_release or on probe failure. Thus, it is not needed to manually clear the device driver data to NULL. Signed-off-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-10-01usb: gadget: pch_udc: remove unnecessary pci_set_drvdata()Jingoo Han
The driver core clears the driver data to NULL after device_release or on probe failure. Thus, it is not needed to manually clear the device driver data to NULL. Signed-off-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-10-01usb: gadget: goku_udc: remove unnecessary pci_set_drvdata()Jingoo Han
The driver core clears the driver data to NULL after device_release or on probe failure. Thus, it is not needed to manually clear the device driver data to NULL. Signed-off-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-10-01usb: gadget: amd5536udc: remove unnecessary pci_set_drvdata()Jingoo Han
The driver core clears the driver data to NULL after device_release or on probe failure. Thus, it is not needed to manually clear the device driver data to NULL. Signed-off-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-10-01usb: gadget: zero: Add flexible auto remote wakeup test methodPeter Chen
In order to increase test coverage, we can change the interval between two remote wakeups every time, and the interval can be any user defined value. This change will no affect current behavior if the user does not use two introduced module paramters. Signed-off-by: Peter Chen <peter.chen@freescale.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-10-01usb: gadget: s3c-hsotg: fix can_write limit for non-periodic endpointsRobert Baldyga
Value of can_write variable in s3c_hsotg_write_fifo function should be limited to 512 only for non-periodic endpoints. There was some discrepancy between comment and code, because comment suggests correct behavior, but in the code limit was applied to periodic endpoints too. So there is additional check causing the limitation concerns only non-periodic endpoints. Signed-off-by: Robert Baldyga <r.baldyga@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-10-01usb: gadget: f_fs: fix error handlingRobert Baldyga
This patch add missing error check in ffs_func_bind() function, after ffs_do_descs() function call for high speed descriptors. Without this check it's possible that the module will try dereference incorrect pointer. [ balbi@ti.com : removed trailing empty line ] Acked-by: Michal Nazarewicz <mina86@mina86.com> Signed-off-by: Robert Baldyga <r.baldyga@samsung.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-09-30Merge 3.12-rc3 into usb-nextGreg Kroah-Hartman
We want the USB fixes in here as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-09-26USB: Fix breakage in ffs_fs_mount()Al Viro
There's a bunch of failure exits in ffs_fs_mount() with seriously broken recovery logics. Most of that appears to stem from misunderstanding of the ->kill_sb() semantics; unlike ->put_super() it is called for *all* superblocks of given type, no matter how (in)complete the setup had been. ->put_super() is called only if ->s_root is not NULL; any failure prior to setting ->s_root will have the call of ->put_super() skipped. ->kill_sb(), OTOH, awaits every superblock that has come from sget(). Current behaviour of ffs_fs_mount(): We have struct ffs_sb_fill_data data on stack there. We do ffs_dev = functionfs_acquire_dev_callback(dev_name); and store that in data.private_data. Then we call mount_nodev(), passing it ffs_sb_fill() as a callback. That will either fail outright, or manage to call ffs_sb_fill(). There we allocate an instance of struct ffs_data, slap the value of ffs_dev (picked from data.private_data) into ffs->private_data and overwrite data.private_data by storing ffs into an overlapping member (data.ffs_data). Then we store ffs into sb->s_fs_info and attempt to set the rest of the things up (root inode, root dentry, then create /ep0 there). Any of those might fail. Should that happen, we get ffs_fs_kill_sb() called before mount_nodev() returns. If mount_nodev() fails for any reason whatsoever, we proceed to functionfs_release_dev_callback(data.ffs_data); That's broken in a lot of ways. Suppose the thing has failed in allocation of e.g. root inode or dentry. We have functionfs_release_dev_callback(ffs); ffs_data_put(ffs); done by ffs_fs_kill_sb() (ffs accessed via sb->s_fs_info), followed by functionfs_release_dev_callback(ffs); from ffs_fs_mount() (via data.ffs_data). Note that the second functionfs_release_dev_callback() has every chance to be done to freed memory. Suppose we fail *before* root inode allocation. What happens then? ffs_fs_kill_sb() doesn't do anything to ffs (it's either not called at all, or it doesn't have a pointer to ffs stored in sb->s_fs_info). And functionfs_release_dev_callback(data.ffs_data); is called by ffs_fs_mount(), but here we are in nasal daemon country - we are reading from a member of union we'd never stored into. In practice, we'll get what we used to store into the overlapping field, i.e. ffs_dev. And then we get screwed, since we treat it (struct gfs_ffs_obj * in disguise, returned by functionfs_acquire_dev_callback()) as struct ffs_data *, pick what would've been ffs_data ->private_data from it (*well* past the actual end of the struct gfs_ffs_obj - struct ffs_data is much bigger) and poke in whatever it points to. FWIW, there's a minor leak on top of all that in case if ffs_sb_fill() fails on kstrdup() - ffs is obviously forgotten. The thing is, there is no point in playing all those games with union. Just allocate and initialize ffs_data *before* calling mount_nodev() and pass a pointer to it via data.ffs_data. And once it's stored in sb->s_fs_info, clear data.ffs_data, so that ffs_fs_mount() knows that it doesn't need to kill the sucker manually - from that point on we'll have it done by ->kill_sb(). Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Acked-by: Michal Nazarewicz <mina86@mina86.com> Cc: stable <stable@vger.kernel.org> # 3.3+ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-09-26usb: gadget: Remove redundant pci_set_drvdataSachin Kamat
Driver core sets driver data to NULL upon failure or remove. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-09-23usb: gadget: pxa25x_udc: fix deferred probe from __initJohan Hovold
Move probe out of __init section and don't use platform_driver_probe which cannot be used with deferred probing. Since commit e9354576 ("gpiolib: Defer failed gpio requests by default") this driver might return -EPROBE_DEFER if a gpio_request fails. Cc: Eric Miao <eric.y.miao@gmail.com> Cc: Russell King <linux@arm.linux.org.uk> Cc: Haojian Zhuang <haojian.zhuang@gmail.com> Cc: Felipe Balbi <balbi@ti.com> Signed-off-by: Johan Hovold <jhovold@gmail.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-09-17Merge tag 'fixes-for-v3.12-rc2' of ↵Greg Kroah-Hartman
git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-linus Felipe writes: usb: fixes for v3.12-rc2 Here's first set of fixes for v3.12-rc series, patches have been soaking in linux-usb for a while now. We have the usual sparse and build warnings, a Kconfig fix to a mismerge on dwc3 Kconfig, fix for a possible memory leak in dwc3, s3c-hsotg won't disconnect when bus goes idle, locking fix in mv_u3d_core, endpoint disable fix in f_mass_storage. We also have one device ID added to dwc3's PCI glue layer in order to support Intel's BayTrail devices. Signed-of-by: Felipe Balbi <balbi@ti.com>
2013-09-17USB: Faraday fotg210: fix email addressesDave Jones
Update the MODULE_AUTHOR field of the Faraday OTG drivers to reflect current maintainers email address. Signed-off-by: Dave Jones <davej@fedoraproject.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-09-17usb: s3c-hsotg: do not disconnect gadget when receiving ErlySusp intrChanho Park
DWC2 databook indicates if the core sets "ErlySusp" bit, an idle state has been detected on the USB for 3 ms. This situation can be occurred when waiting a request from user daemon. So, we should keep the connection between udc and gadget even though this interrupt is occurred. Signed-off-by: Chanho Park <chanho61.park@samsung.com> Signed-off-by: Robert Baldyga <r.baldyga@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-09-17usb: s3c-hsotg: fix unregistration functionMarek Szyprowski
After driver conversion to udc_start/udc_stop infrastructure (commit "usb:hsotg:samsung: Use new udc_start and udc_stop callbacks" f65f0f1098) the gadget unregistration function is almost always called with 'driver' parameter being NULL, what caused that the unregistration code has not been executed at all. This is a leftover from the earlier verison of this function (which used simple start/stop interface), where driver parameter was obligatory. This patch removes the NULL check for the 'driver' pointer and removes all dereferences of it. It also moves disabling voltage regulators out of the atomic context, because handling regulators (which are usually i2c devices) might require sleeping. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Robert Baldyga <r.baldyga@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-09-17usb: gadget: f_mass_storage: reset endpoint driver data when disabledPeter Oh
Gadgets endpoint driver data is a criteria to judge that whether the endpoints are in use or not. When gadget gets assigned an endpoint from endpoint list, they check its driver data if the driver data is NULL. If the driver data is not NULL then they regard it as in use. Therefore all of gadgets should reset their endpoints driver data to NULL as they are disabled. Otherwise it causes a leak of endpoint resource. Signed-off-by: Peter Oh <poh@broadcom.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-09-17usb: gadget: f_eem: Staticize eem_allocSachin Kamat
'eem_alloc' is local to this file. Make it static. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-09-17usb: gadget: f_ecm: Staticize ecm_allocSachin Kamat
'ecm_alloc' is local to this file. Make it static. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-09-17usb: gadget: add '__ref' for rndis_config_register() and cdc_config_register()Chen Gang
They are only called by '__ref' function multi_bind(), and they will call '__init' functions, so recommend to let them '__ref' too. The related warnings: WARNING: drivers/usb/gadget/g_multi.o(.text+0xded6): Section mismatch in reference from the variable .LM2921 to the variable .init.text:_rndis_do_config The function .LM2921() references the variable __init _rndis_do_config. This is often because .LM2921 lacks a __init annotation or the annotation of _rndis_do_config is wrong. WARNING: drivers/usb/gadget/g_multi.o(.text+0xdf16): Section mismatch in reference from the variable .LM2953 to the variable .init.text:_cdc_do_config The function .LM2953() references the variable __init _cdc_do_config. This is often because .LM2953 lacks a __init annotation or the annotation of _cdc_do_config is wrong. Signed-off-by: Chen Gang <gang.chen@asianux.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-09-17usb: gadget: cdc2: fix conversion to new interface of f_ecmAndrzej Pietrasiewicz
This fixes commit a38a275030086d95306555e544fc7c0e65ccd00e (usb: gadget: cdc2: convert to new interface of f_ecm) The invocation of usb_get_function_instance() is in cdc_bind() and should not be repeated in cdc_do_config(). Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-09-17usb: gadget: fix a bug and a WARN_ON in dummy-hcdAlan Stern
This patch fixes a NULL pointer dereference and a WARN_ON in dummy-hcd. These things were the result of moving to the UDC core framework, and possibly of changes to that framework. Now unloading a gadget driver causes the UDC to be stopped after the gadget driver is unbound, not before. Therefore the "driver" argument to dummy_udc_stop() can be NULL, so we must not try to print the driver's name without checking first. Also, the UDC framework automatically unregisters the gadget when the UDC is deleted. Therefore a sysfs attribute file attached to the gadget must be removed before the UDC is deleted, not after. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> CC: <stable@vger.kernel.org> Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-09-17usb: gadget: mv_u3d_core: fix violation of locking discipline in ↵Alexey Khoroshilov
mv_u3d_ep_disable() mv_u3d_nuke() expects to be calles with ep->u3d->lock held, because mv_u3d_done() does. But mv_u3d_ep_disable() calls it without lock that can lead to unpleasant consequences. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru> Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-09-13Merge git://git.kvack.org/~bcrl/aio-nextLinus Torvalds
Pull aio changes from Ben LaHaise: "First off, sorry for this pull request being late in the merge window. Al had raised a couple of concerns about 2 items in the series below. I addressed the first issue (the race introduced by Gu's use of mm_populate()), but he has not provided any further details on how he wants to rework the anon_inode.c changes (which were sent out months ago but have yet to be commented on). The bulk of the changes have been sitting in the -next tree for a few months, with all the issues raised being addressed" * git://git.kvack.org/~bcrl/aio-next: (22 commits) aio: rcu_read_lock protection for new rcu_dereference calls aio: fix race in ring buffer page lookup introduced by page migration support aio: fix rcu sparse warnings introduced by ioctx table lookup patch aio: remove unnecessary debugging from aio_free_ring() aio: table lookup: verify ctx pointer staging/lustre: kiocb->ki_left is removed aio: fix error handling and rcu usage in "convert the ioctx list to table lookup v3" aio: be defensive to ensure request batching is non-zero instead of BUG_ON() aio: convert the ioctx list to table lookup v3 aio: double aio_max_nr in calculations aio: Kill ki_dtor aio: Kill ki_users aio: Kill unneeded kiocb members aio: Kill aio_rw_vect_retry() aio: Don't use ctx->tail unnecessarily aio: io_cancel() no longer returns the io_event aio: percpu ioctx refcount aio: percpu reqs_available aio: reqs_active -> reqs_available aio: fix build when migration is disabled ...
2013-09-13Remove GENERIC_HARDIRQ config optionMartin Schwidefsky
After the last architecture switched to generic hard irqs the config options HAVE_GENERIC_HARDIRQS & GENERIC_HARDIRQS and the related code for !CONFIG_GENERIC_HARDIRQS can be removed. Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2013-08-30usb: acm gadget: Null termintate strings tableGraham Williams
The gadget strings table should be null terminated. usb_gadget_get_string() loops through the table expecting a null at the end of the list. Signed-off-by: Graham Williams <gwilli@broadcom.com> Cc: stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-28usb: fotg210-udc: use platform_{get,set}_drvdata()Libo Chen
Use the wrapper functions for getting and setting the driver data using platform_device instead of using dev_{get,set}_drvdata() with &pdev->dev, so we can directly pass a struct platform_device. Signed-off-by: Libo Chen <libo.chen@huawei.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-27Merge tag 'usb-for-v3.12-part2' of ↵Greg Kroah-Hartman
git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-next Felipe writes: usb: patches for v3.12 merge window (part 2) Here's a set of important fixes for v3.12 merge window which have been pending in the mailing list for quite some time. We have use-after-free fixes, signedness fixes, more of HAS_DMA dependencies, fixes for NULL pointer deferences, build fixes and some other fixes to the musb driver caused by recent patches. Patches are quite small and contain valuable fixes which will give us a much better -rc1 release. Please consider merging Signed-of-by: Felipe Balbi <balbi@ti.com>
2013-08-27usb: gadget: double unlocks on error in atmel_usba_start()Dan Carpenter
The "goto out" statements were wrong. We aren't holding any locks at that point so we should return directly. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-08-27usb: gadget: gadgetfs: potential use after free in unbind()Dan Carpenter
ffs_data_put() can sometimes free "ffs" so I have moved the call down a line below the dereference. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-08-27usb: gadget: gadgetfs: use after free in dev_release()Dan Carpenter
The call to put_dev() releases "dev". Hopefully, we don't need to set the state to STATE_DEV_DISABLED anyway so I have removed those lines. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-08-27USB: gadget: audit sysfs attribute permissionsGreg Kroah-Hartman
Convert all USB gadget sysfs attributes to use the _RO or _RW variants, to make them easier to audit and ensure that the permissions are correct. Note, two are left using the DEVICE_ATTR() macro, as there is no DEVICE_ATTR_WO() in Linus's tree, that will happen after 3.12-rc1 is out, a follow-on patch will be sent then. Reviewed-by: Felipe Balbi <balbi@ti.com> Acked-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> -- drivers/usb/gadget/composite.c | 8 +++----- drivers/usb/gadget/dummy_hcd.c | 8 ++++---- drivers/usb/gadget/f_mass_storage.c | 14 ++++++-------- drivers/usb/gadget/net2272.c | 4 ++-- drivers/usb/gadget/net2280.c | 18 +++++++++--------- drivers/usb/gadget/storage_common.c | 25 ++++++++++++------------- drivers/usb/gadget/udc-core.c | 14 +++++++------- 7 files changed, 43 insertions(+), 48 deletions(-)
2013-08-27usb: gadget: USB_NET2272_DMA should depend on HAS_DMAGeert Uytterhoeven
If NO_DMA=y: drivers/built-in.o: In function `net2272_done': drivers/usb/gadget/net2272.c:386: undefined reference to `usb_gadget_unmap_request' drivers/built-in.o: In function `net2272_queue': drivers/usb/gadget/net2272.c:848: undefined reference to `usb_gadget_map_request' Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-08-27usb: gadget: USB_R8A66597 should depend on HAS_DMAGeert Uytterhoeven
If NO_DMA=y: drivers/built-in.o: In function `sudmac_free_channel': drivers/usb/gadget/r8a66597-udc.c:676: undefined reference to `usb_gadget_unmap_request' drivers/built-in.o: In function `sudmac_alloc_channel': drivers/usb/gadget/r8a66597-udc.c:666: undefined reference to `usb_gadget_map_request' Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-08-27usb: gadget: USB_FUSB300 should depend on HAS_DMAGeert Uytterhoeven
If NO_DMA=y: drivers/built-in.o: In function `fusb300_set_idma': drivers/usb/gadget/fusb300_udc.c:946: undefined reference to `usb_gadget_map_request' drivers/usb/gadget/fusb300_udc.c:958: undefined reference to `usb_gadget_unmap_request' Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-08-27usb: gadget: configfs: keep a function if it is not successfully addedAndrzej Pietrasiewicz
If usb_add_function() fails then the currently processed function is already not in the list in struct config_usb_cfg, and neither is it in the list in struct usb_configuration. At the err_purge_funcs label the purge_config_funcs() is called, which iterates over all configurations, and in each configuration it iterates over all _successfully_ added functions, and moves them back from the list in struct usb_configuration to the list in struct config_usb_cfg. BUT the function which has just failed adding and caused the unwind process is not taken care of and is effectively lost. This patch modifies the configfs_composite_bind() function so that if the usb_add_function() fails, then the currently processed function is returned to the list in struct config_usb_cfg. It would be tempting to delay the list_del() in question after usb_add_function() invocation, but a struct list_head (&f->list) cannot be stored in more than one list at the same time, so the list_del() must be called before usb_add_function(). Hence, the solution is to list_add() after usb_add_function() in case of error. Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-08-20usb:gadget Fix comment for pointer to configfsPhilippe De Swert
The documentation for the USB gadget fs is actually in Documentation/usb/gadget_configfs.txt. Signed-off-by: Philippe De Swert <philippe.deswert@jollamobile.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-13Merge tag 'usb-for-v3.12' of ↵Greg Kroah-Hartman
git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-next Felipe writes: usb: patches for v3.12 merge window All patches here have been pending on linux-usb and sitting in linux-next for a while now. The biggest things in this tag are: DWC3 learned proper usage of threaded IRQ handlers and now we spend very little time in hardirq context. MUSB now has proper support for BeagleBone and Beaglebone Black. Tegra's USB support also got quite a bit of love and is learning to use PHY layer and generic DT attributes. Other than that, the usual pack of cleanups and non-critical fixes follow. Signed-of-by: Felipe Balbi <balbi@ti.com> Conflicts: drivers/usb/gadget/udc-core.c drivers/usb/host/ehci-tegra.c drivers/usb/musb/omap2430.c drivers/usb/musb/tusb6010.c
2013-08-09usb: gadget: uvc: Fix error handling in uvc_queue_buffer()Laurent Pinchart
The conversion to videobuf2 failed to check the return value of vb2_qbuf(). Fix it. Cc: stable@vger.kernel.org Reported-by: Michael Grzeschik <mgr@pengutronix.de> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Tested-By: Michael Grzeschik <mgr@pengutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-08-09usb: gadget: f_uac1: Staticize local functionsJingoo Han
control_selector_init() is used only in this file. audio_bind_config() is used only in audio.c file to which f_uac1.c is included. Thus, these functions are staticized to fix the following warnings. drivers/usb/gadget/f_uac1.c:698:12: warning: symbol 'control_selector_init' was not declared. Should it be static? drivers/usb/gadget/f_uac1.c:722:12: warning: symbol 'audio_bind_config' was not declared. Should it be static? Acked-by: Jassi Brar <jaswinder.singh@linaro.org> Signed-off-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-08-09usb: gadget: u_uac1: add __user annotationJingoo Han
Added __user annotation to fix the following sparse warning. drivers/usb/gadget/u_uac1.c:194:52: warning: incorrect type in argument 2 (different address spaces) drivers/usb/gadget/u_uac1.c:194:52: expected void const [noderef] <asn:1>*buf drivers/usb/gadget/u_uac1.c:194:52: got void *buf Acked-by: Jassi Brar <jaswinder.singh@linaro.org> Signed-off-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-08-09usb: gadget: rndis: Staticize rndis_init()/rndis_exit()Jingoo Han
rndis_init() and rndis_exit() are used only in this file. Fix the following sparse warnings: drivers/usb/gadget/rndis.c:1145:5: warning: symbol 'rndis_init' was not declared. Should it be static? drivers/usb/gadget/rndis.c:1179:6: warning: symbol 'rndis_exit' was not declared. Should it be static? Signed-off-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-08-09usb: gadget: f_mass_storage: use NULL instead of 0Jingoo Han
The local variables such as 'filename', 'vendor_name', and 'product_name' are pointers; thus, use NULL instead of 0 to fix the following sparse warnings drivers/usb/gadget/f_mass_storage.c:3046:27: warning: Using plain integer as NULL pointer drivers/usb/gadget/f_mass_storage.c:3050:28: warning: Using plain integer as NULL pointer drivers/usb/gadget/f_mass_storage.c:3051:29: warning: Using plain integer as NULL pointer Signed-off-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-08-09usb: gadget: amd5536udc: unconditionally use GFP_ATOMIC in udc_queue()Alexey Khoroshilov
As far as prep_dma() is called with spinlock held, we have to pass GFP_ATOMIC regardless of gfp argument. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru> Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-08-05Merge 3.11-rc4 into usb-nextGreg Kroah-Hartman
We want those fixes in here also. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>