summaryrefslogtreecommitdiff
path: root/drivers/usb/gadget/function (follow)
Commit message (Collapse)AuthorAge
...
* | | USB: f_fs: Set ffs->func to NULL after disabling endpoint in set_alt()Vijayavardhan Vennapusa2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When adb root is performed, userspace will close and open ffs_epsfile. Closing this file will call ffs_functionfs_callback() which does call remove_config(). This will call ffs_function_eps_disable to disable endpoints and then calls ffs_func_unbind(). Unbind() will also call endpoint disable which might lead to disabling endpoint which is already disabled. Some of UDC driver throws WARN_ON() if same endpoint is being disabled multiple time. Hence set ffs->func to NULL after disabling endpoints in set_alt() to overcome WARN_ON(). Change-Id: I3052bdee74a1793d4e003de4b991d353e5d699b0 Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org> Signed-off-by: Mayank Rana <mrana@codeaurora.org>
* | | usb: gadget: f_gsi: Add support for configFSHemant Kumar2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change adds APIs to allocate and instanciate multi instance gsi function driver using configFS. Add an entry in kconfig to select diag driver for configFS. This change fixes all compilation errors caused by moving gsi driver from android.c to compile independently. Change-Id: I0ddb2ca155fd29c6d58fb561cc197f8efee3495a Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
* | | usb: gadget: f_gsi: Use rndis params structureHemant Kumar2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | rndis APIs are modified to pass rndis params structure instead of config index to load the rndis device parameters. Hence update the API calls in gsi driver. Change-Id: I1492752b315f57866ca39c6fe0021c4adce97c58 Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
* | | usb: f_gsi: Configure fixed GSI endpoints and related EP OPsDevdutt Patnaik2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | GSI endpoints are now fixed and need to be requested by name. As the specific GSI endpoints or ops do not change, it is not required to be updated on every connect/disconnect of the cable. This will also fix suspend/disconnect race conditions. Since GSI endpoints are fixed, gadget restart is no longer required upon composition switch. CRs-Fixed: 946385 Change-Id: I36de64ea95470cb19eb3f084b518618a2fe9f0df Signed-off-by: Devdutt Patnaik <dpatnaik@codeaurora.org>
* | | usb: gadget: Add snapshot of GSI function driverHemant Kumar2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds a generic function driver that will handle all functions that support h/w acceleration to IPA over GSI. This snapshot is taken as of msm-3.18 commit 30b0c37abcd9cf0 (Merge "msm: vidc: add support to set low latency property to venus") Change-Id: I4f78a4a36727fec24b1c5481acd6d3122eeb9150 Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
* | | usb: gadget: rndis: Add new rndis parametersHemant Kumar2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add pkt_alignment_factor rndis parameter. This parameter along with max_pkt_per_xfer allow rndis function driver to aggregate more than one IP packets per transfer. This is done by calling newly added API rndis_set_pkt_alignment_factor(). Change-Id: Ic9c543c388f872452e708a3a26be4ae82b54c082 Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
* | | usb: gadget: Add support for rndis flow control callbackHemant Kumar2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | Allow registration for data flow control call back from rndis functions supporting different transport i.e. BAM2BAM_IPA, GSI_IPA. Change-Id: I09df5f7f81e9d9ed0cfd5e54d481db87727bbc75 Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
* | | usb: gadget: f_diag: Add support for configFSHemant Kumar2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change adds APIs to allocate and instanciate multi instance diag function driver using configFS. Add an entry in kconfig to select diag driver for configFS. Change-Id: I428631dc63643eddb075a09d0e46e1a6b1117f0e Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
* | | usb: gadget: Move diag dload handling to f_diag driverJack Pham2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Upon Diag function bind, the DLOAD memory region should be updated with the USB PID and serial number in order to support a persistent connection with the PC if the device reboots into download mode. This functionality need not be handled in the android.c driver. The only reason it is there is to be able to locate the IO address which is specified in device tree. Since this can be done from the Diag function driver directly, move the handling there. The address itself can be specified under the "qcom,msm-imem" parent with its own "qcom,msm-imem-diag-dload" compatible string. For now, allow falling back to retrieving the address from the "android_usb" for backwards compatibility until the device tree files are updated. Change-Id: I0d6d1dac0f12b7890220d857227ae45c9258c1f2 Signed-off-by: Jack Pham <jackp@codeaurora.org>
* | | usb: gadget: Add snapshot of DIAG function driverHemant Kumar2016-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add function driver to support Qualcomm diagnostics port over USB. This snapshot is taken as of msm-3.18 commit: commit e70ad0cd5e (Promotion of kernel.lnx.3.18-151201) Change-Id: I51aaa8f6a2e05fc252ea810244ddfc99ca2741cc Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
* | | USB: f_mass_storage: Send GADGET_DELAYED_STATUS for MSC RESET commandVijayavardhan Vennapusa2016-03-22
| |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When Host sends MSC RESET command to the device, device is expected to clear HALT condition on the bulk IN endpoint as part of handling it, before sending status phase to the Host. Since handling of MSC RESET is done by sending signal to fsg_thread, it could take time for handling it. It could lead to sending bulk IN endpoint as halted, when host asks for endpoint status as status phase is sent for MSC RESET command immediately after it is received. Due to this, MSC compliance tests fail. Hence send delayed status in case of MSC RESET and send status phase after it is handled and cleared halt condition. CRs-Fixed: 547929 Change-Id: If80d0ffb2d012724b899772b1b45dff8092bd8d5 Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org> Signed-off-by: Mayank Rana <mrana@codeaurora.org>
* | fix false disconnect due to a signal sent to the reading processkeunyoung2016-02-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | - In the current implementation, when a signal is sent to the reading process, read is cancelled by calling usb_ep_dequeue, which lead into calling acc_complete_out with ECONNRESET, but the current logic treats it as disconnection, which makes the device inaccessible until cable is actually disconnected. - The fix calls disconnect only when ESHUTDOWN error is passed. - If data has already arrived while trying cancelling, the data is marked as available, and it will be read out on the next read. This is necessary as USB bulk is assumed to guarantee no data loss. Signed-off-by: keunyoung <keunyoung@google.com>
* | usb: gadget: u_ether: use %z format specifier for size_tAmit Pundir2016-02-16
| | | | | | | | | | | | | | | | | | | | | | | | Use '%zd' format specifier for size_t type instead of '%d' to fix build warnings like: drivers/usb/gadget/function/u_ether.c: In function ‘rx_submit’: drivers/usb/gadget/function/u_ether.c:244:2: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘size_t’ [-Wformat=] DBG(dev, "%s: size: %d\n", __func__, size); ^ Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
* | usb: gadget: rndis: fix broken build for 4.4Amit Pundir2016-02-16
| | | | | | | | | | | | | | | | Use rndis_params instead of configNr to align with changes from mainline commit 83210e59ee15 "usb: gadget: rndis: use rndis_params instead of configNr". Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
* | usb: gadget: rndis: fix broken data aggregation buildAmit Pundir2016-02-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Declare "cdev" to fix broken AOSP commit "RNDIS: Add Data aggregation (multi packet) support", otherwise we run into following build failure: CC drivers/usb/gadget/function/f_rndis.o drivers/usb/gadget/function/f_rndis.c: In function ‘rndis_command_complete’: drivers/usb/gadget/function/f_rndis.c:479:3: error: ‘cdev’ undeclared (first use in this function) drivers/usb/gadget/function/f_rndis.c:479:3: note: each undeclared identifier is reported only once for each function it appears in make[4]: *** [drivers/usb/gadget/function/f_rndis.o] Error 1 Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
* | usb: gadget: rndis: use %z format specifier for size_tAmit Pundir2016-02-16
| | | | | | | | | | | | | | | | | | Use '%z' format specifier for sizeof operator instead of '%u' to fix build warnings like: warning: format '%u' expects type 'unsigned int', but argument 3 has type 'long unsigned int' Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
* | usb: gadget: cleanup: fix unused variable and function warningsAmit Pundir2016-02-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove unused variables and functions to fix following build warnings: CC drivers/usb/gadget/configfs.o drivers/usb/gadget/configfs.c: In function ‘gadgets_make’: drivers/usb/gadget/configfs.c:1710:6: warning: unused variable ‘err’ [-Wunused-variable] int err; ^ drivers/usb/gadget/configfs.c:1709:27: warning: unused variable ‘attr’ [-Wunused-variable] struct device_attribute *attr; ^ drivers/usb/gadget/configfs.c:1708:28: warning: unused variable ‘attrs’ [-Wunused-variable] struct device_attribute **attrs; ^ drivers/usb/gadget/configfs.c: In function ‘gadgets_drop’: drivers/usb/gadget/configfs.c:1774:27: warning: unused variable ‘attr’ [-Wunused-variable] struct device_attribute *attr; ^ drivers/usb/gadget/configfs.c:1773:28: warning: unused variable ‘attrs’ [-Wunused-variable] struct device_attribute **attrs; ^ <snip>... CC drivers/usb/gadget/function/f_mtp.o drivers/usb/gadget/function/f_mtp.c:1219:12: warning: ‘mtp_bind_config’ defined but not used [-Wunused-function] static int mtp_bind_config(struct usb_configuration *c, bool ptp_config) ^ drivers/usb/gadget/function/f_mtp.c:1300:12: warning: ‘mtp_setup’ defined but not used [-Wunused-function] static int mtp_setup(void) ^ <snip>... CC drivers/usb/gadget/function/f_accessory.o drivers/usb/gadget/function/f_accessory.c:969:1: warning: ‘acc_function_bind’ defined but not used [-Wunused-function] acc_function_bind(struct usb_configuration *c, struct usb_function *f) { ^ drivers/usb/gadget/function/f_accessory.c:1172:12: warning: ‘acc_bind_config’ defined but not used [-Wunused-function] static int acc_bind_config(struct usb_configuration *c) ^ Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
* | ANDROID: usb: gadget: create F_midi deviceBadhri Jagan Sridharan2016-02-16
| | | | | | | | | | | | | | | | Android frameworks relies on the alsa config reported by the f_midi device. Signed-off-by: Badhri Jagan Sridharan <Badhri@google.com> Change-Id: I0695e00b166fd953f50acea93802245b0d5a5240
* | usb: gadget: fix NULL ptr derefer while symlinking PTP funcAmit Pundir2016-02-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix NULL pointer dereference while trying to link PTP function to a gadget configuration without creating MTP function. PTP piggyback on MTP function so make sure we have MTP function created beforehand. Otherwise we run into following kernel panic: ----------------------- [ 70.329957] Unable to handle kernel NULL pointer dereference at virtual address 00000000 [ 70.330738] pgd = dd8ec000 [ 70.330916] [00000000] *pgd=00000000 [ 70.331663] Internal error: Oops: 805 [#1] SMP THUMB2 [ 70.332155] CPU: 0 PID: 2067 Comm: ln Not tainted 3.18.0-00587-gdfa582e #1 [ 70.332511] task: dd9c92c0 ti: dd822000 task.ti: dd822000 [ 70.333094] PC is at function_alloc_mtp_ptp+0xe/0x68 [ 70.333311] LR is at usb_get_function+0x11/0x1c [ 70.333489] pc : [<c034ec12>] lr : [<c033cce9>] psr: 60070033 <..snip..> [ 70.384111] 3fc0: bec14ae4 00000004 bec14c0a 00000053 00000004 b6f0422d 00000000 bec14adc [ 70.384369] 3fe0: bec14af8 bec14a98 b6f071f3 b6e8977c 20070010 bec14c0d 00000000 00000000 [ 70.384832] [<c034ec12>] (function_alloc_mtp_ptp) from [<c033cce9>] (usb_get_function+0x11/0x1c) [ 70.385146] [<c033cce9>] (usb_get_function) from [<c033da9b>] (config_usb_cfg_link+0x87/0xa8) [ 70.385421] [<c033da9b>] (config_usb_cfg_link) from [<c011f417>] (configfs_symlink+0xb7/0x1c8) [ 70.385696] [<c011f417>] (configfs_symlink) from [<c00dcd8d>] (vfs_symlink+0x85/0xc0) [ 70.386010] [<c00dcd8d>] (vfs_symlink) from [<c00dce0b>] (SyS_symlinkat+0x43/0x70) [ 70.386261] [<c00dce0b>] (SyS_symlinkat) from [<c000ce41>] (ret_fast_syscall+0x1/0x5c) [ 70.386610] Code: eb04 4a0f 6e03 480f (e883) 0005 [ 70.387346] ---[ end trace 8dba7c552e02f8fa ]--- [ 70.387647] Kernel panic - not syncing: Fatal exception [ 70.387980] ---[ end Kernel panic - not syncing: Fatal exception ----------------------- Steps to reproduce the kernel panic: mount -t configfs none /config mkdir /config/usb_gadget/g1 cd /config/usb_gadget/g1 echo 0x18d1 > idVendor echo 0x4e26 > idProduct mkdir strings/0x409 echo 0123459876 > strings/0x409/serialnumber echo Asus > strings/0x409/manufacturer echo Nexus7 > strings/0x409/product mkdir configs/c.1 mkdir configs/c.1/strings/0x409 echo "Conf 1" > configs/c.1/strings/0x409/configuration echo 120 > configs/c.1/MaxPower mkdir functions/ptp.ptp ln -s functions/ptp.ptp configs/c.1/ptp.ptp Also MTP and PTP are mutually exclusive functions so make sure we have only one of it linked to a configuration at a time. Otherwise it opens up another set of bug(s?). Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
* | usb: gadget: Relocate f_accessoryBadhri Jagan Sridharan2016-02-16
| | | | | | | | | | | | | | | | | | 3.18 kernel has reorganized drivers/usb/gadget directory. Moving accessory gadget driver from drivers/usb/gadget to drivers/usb/gadget/function Signed-off-by: Badhri Jagan Sridharan <Badhri@google.com> Change-Id: If73c6df0537c4b1f51338ed3b0db817e51f06b4a
* | usb: gadget: Move gadget functions codeBadhri Jagan Sridharan2016-02-16
| | | | | | | | | | | | | | | | | | 3.18 kernel has reorganized drivers/usb/gadget directory. Moving gadget functions drivers from drivers/usb/gadget to drivers/usb/gadget/function Signed-off-by: Badhri Jagan Sridharan <Badhri@google.com> Change-Id: I1eab0190f8d42e3be1b4e91ad3bc3a2dc853b0ef
* | usb: u_ether: Fix compile errorsPraneeth Bajjuri2016-02-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | commit f1a1823ff24fa4e3412b5078f20021cf40834946 usb: gadget: u_ether: convert into module changes qlen function definition. and this has to be fixed accordingly in current u_ether driver. This patch fixes following compile error in u_ether caused by commit. drivers/usb/gadget/u_ether.c: In function 'rx_fill': drivers/usb/gadget/u_ether.c:416:3: error: too few arguments to function 'qlen' if (++req_cnt > qlen(dev->gadget)) ^ drivers/usb/gadget/u_ether.c: In function 'eth_start_xmit': drivers/usb/gadget/u_ether.c:738:24: error: 'qmult' undeclared (first use in this function) if (dev->tx_qlen == (qmult/2)) { which was caused by commits commit 79467317949e1621240f632acfb7453783bec2e7 USB: gadget: u_ether: Fix data stall issue in RNDIS tethering mode commit 68b91e8c54f5c091986c5719631893b10eab760a usb: u_ether: Add workqueue as bottom half handler for rx data path Change-Id: Ic4e5a1e08cb688e5a606c7c1895f869d8f887b9f Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
* | USB: gadget: rndis: Add module parameter for DL max packets per xferxerox_lin2016-02-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently DL aggregation is supported in RNDIS driver and is set to 3 by default. And there is no support to change downlink maximum packets per transfer at runtime through module parameter. Hence add module parameter for DL maximum packets per transfer to change it at runtime. echo 6 > /sys/module/g_android/parameters/rndis_dl_max_pkt_per_xfer To disable DL aggregation during runtime, echo 1 > /sys/module/g_android/parameters/rndis_dl_max_pkt_per_xfer Change-Id: I3a1d0bc97358e2b6f233df7ae8725fb507de50db Signed-off-by: Xerox Lin <xerox_lin@htc.com> Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
* | ndis: Add debug support to disable RNDIS Multipacket FeatureBadhri Jagan Sridharan2016-02-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change adds module param which allows to disable RNDIS Multi-packet Feature (Aggregation support in Downlink path) as this feature is enabled by default. To disable use this param before moving to RNDIS Composition: echo 1 > /sys/module/g_android/parameters/rndis_multipacket_dl_disable Also counts errors as Rx errors if received RNDIS packets are not following RNDIS message format as those packets are being discarded. Change-Id: I764430da78f2204af92e14bb279c11b24c7e4c67 Signed-off-by: Mayank Rana <mrana@codeaurora.org>
* | RNDIS: Add Data aggregation (multi packet) supportBadhri Jagan Sridharan2016-02-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Add data aggregation support using RNDIS Multi Packet feature to achieve better UDP Downlink throughput. Max 3 RNDIS Packets aggregated into one RNDIS Packet with this implementation. With this change, seeing UDP Downlink throughput increase from 90 Mbps to above 100 Mbps when using Iperf and sending data more than 100 Mbps. Change-Id: I21c39482718944bb1b1068bdd02f626531e58f08 Signed-off-by: Mayank Rana <mrana@codeaurora.org> Signed-off-by: Rajkumar Raghupathy <raghup@codeaurora.org>
* | USB: gadget: u_ether: Fix data stall issue in RNDIS tethering modeBadhri Jagan Sridharan2016-02-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | For dual speed gadget, with current no. of request(10), there is possibility of corner case occurence where all 10 reuqests are queued to HW without setting IOC bit, which could lead to data stall in RNDIS tethering and RNDIS local networking. With this patch, counter will be incremented before queueing request to HW and sets IOC bit for every nth request due to which the corner case of all requests queued to HW without IOC bit set will be avoided. Change-Id: I26515bfd9bbc8f7af38be7835692143f7093118a Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
* | usb: gadget: prevent change of Host MAC address of 'usb0' interfacetaeju.park2016-02-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On windows 7 platform, previously allocated ip address is maintained. However, Host MAC address of 'usb0' interface is changed when the tethering driver re-enumerated. Thus, the tethering network driver can't be allocated ip address from dhcp. It causes connection delay between host and phone for usb tethering. This patch prevents from changing Host MAC address of 'usb0' interface. In other words, this patch maintains the Host MAC address allocated when first tethering driver although the driver is re-enumerated. However, after reboot, the Host MAC address can be changed. Change-Id: I43add9925e9d6d90c56cffbd3ed999104448f818 Signed-off-by: Badhri Jagan Sridharan <Badhri@google.com>
* | usb: u_ether: Add workqueue as bottom half handler for rx data pathBadhri Jagan Sridharan2016-02-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | u_ether driver passes rx data to network layer and resubmits the request back to usb hardware in interrupt context. Network layer processes rx data by scheduling tasklet. For high throughput scenarios on rx data path driver is spending lot of time in interrupt context due to rx data processing by tasklet and continuous completion and re-submission of the usb requests which results in watchdog bark. Hence move the rx data processing and usb request submission to a workqueue bottom half handler. Change-Id: I316de8e267997137ac189a8b7b2846fa325f4a5a Signed-off-by: Badhri Jagan Sridharan <Badhri@google.com>
* | usb: Add support for rndis uplink aggregationxerox_lin2016-02-16
| | | | | | | | | | | | | | | | | | | | | | | | | | RNDIS protocol supports data aggregation on uplink and can help reduce mips by reducing number of interrupts on device. Throughput also improved by 20-30%. Aggregation is disabled by setting aggregation packet size to 1. To help better UL throughput, set as ul aggregation support to 3 rndis packets by default. It can be configured via module parameter: rndis_ul_max_pkt_per_xfer. Change-Id: I0b62a21a5c3ceb6b04933d0d6da33301dbafe493 Signed-off-by: Vamsi Krishna <vskrishn@codeaurora.org> Signed-off-by: Xerox Lin <xerox_lin@htc.com>
* | USB: rndis: Free the rndis response queue during REMOTE_NDIS_RESET_MSGxerox_lin2016-02-16
|/ | | | | | | | | | | | | | | | | | | | | When rndis data transfer is in progress, some Windows7 Host PC is not sending the GET_ENCAPSULATED_RESPONSE command for receiving the response for the previous SEND_ENCAPSULATED_COMMAND processed. The rndis function driver appends each response for the SEND_ENCAPSULATED_COMMAND in a queue. As the above process got corrupted, the Host sends a REMOTE_NDIS_RESET_MSG command to do a soft-reset. As the rndis response queue is not freed, the previous response is sent as a part of this REMOTE_NDIS_RESET_MSG's reset response and the Host blocks any more Rndis transfers. Hence free the rndis response queue as a part of this soft-reset so that the current response for REMOTE_NDIS_RESET_MSG is sent properly during the response command. Change-Id: I8eff3849db452fe01b7d1fe4140ef1f1ad3f4fd4 Signed-off-by: Rajkumar Raghupathy <raghup@codeaurora.org> Signed-off-by: Xerox Lin <xerox_lin@htc.com>
* usb: gadget: uvc: fix permissions of configfs attributesMian Yousaf Kaukab2015-12-08
| | | | | | | | | | | | 76e0da3 "usb-gadget/uvc: use per-attribute show and store methods" removed write permission for writeable attributes. Correct attribute permissions. Fixes: 76e0da3 "usb-gadget/uvc: use per-attribute show and store methods" Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mian Yousaf Kaukab <yousaf.kaukab@intel.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: gadget: f_midi: fix leak on failed to enqueue out requestsFelipe F. Tonello2015-11-19
| | | | | | | | | This patch fixes a memory leak that occurs when an endpoint fails to enqueue the request. If that happens the complete function will never be called, thus never freeing the request. Signed-off-by: Felipe F. Tonello <eu@felipetonello.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: gadget: f_midi: Transmit data only when IN ep is enabledFelipe F. Tonello2015-11-19
| | | | | | | | | This makes sure f_midi doesn't try to enqueue data when the IN endpoint is disabled, ie, USB cable is disconnected. Reviewed-by: Robert Baldyga <r.baldyga@samsung.com> Signed-off-by: Felipe F. Tonello <eu@felipetonello.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: gadget: functionfs: fix missing access_ok checksDaniel Walter2015-11-18
| | | | | | | | use safe copy_*_user instead of unsafe __copy_*_user functions when accessing userland memory. Signed-off-by: Daniel Walter <dwalter@sigma-star.at> Signed-off-by: Felipe Balbi <balbi@ti.com>
* usb: gadget: f_loopback: fix the warning during the enumerationPeter Chen2015-11-17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current code tries to allocate memory with GFP_KERNEL at interrupt context, it would show below warning during the enumeration when I test it with chipidea hardware, change GFP flag as GFP_ATOMIC can fix this issue. [ 40.438237] zero gadget: high-speed config #2: loopback [ 40.444924] ------------[ cut here ]------------ [ 40.449609] WARNING: CPU: 0 PID: 0 at kernel/locking/lockdep.c:2755 lockdep_trace_alloc+0x108/0x128() [ 40.461715] DEBUG_LOCKS_WARN_ON(irqs_disabled_flags(flags)) [ 40.467130] Modules linked in: [ 40.470216] usb_f_ss_lb g_zero libcomposite evbug [ 40.473822] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.3.0-rc5-00168-gb730aaf #604 [ 40.481496] Hardware name: Freescale i.MX6 SoloX (Device Tree) [ 40.487345] Backtrace: [ 40.489857] [<80014e94>] (dump_backtrace) from [<80015088>] (show_stack+0x18/0x1c) [ 40.497445] r6:80b67a80 r5:00000000 r4:00000000 r3:00000000 [ 40.503234] [<80015070>] (show_stack) from [<802e27b4>] (dump_stack+0x8c/0xa4) [ 40.510503] [<802e2728>] (dump_stack) from [<8002cfe8>] (warn_slowpath_common+0x80/0xbc) [ 40.518612] r6:8007510c r5:00000009 r4:80b49c88 r3:00000001 [ 40.524396] [<8002cf68>] (warn_slowpath_common) from [<8002d05c>] (warn_slowpath_fmt+0x38/0x40) [ 40.533109] r8:bcfdef80 r7:bdb705cc r6:000080d0 r5:be001e80 r4:809cc278 [ 40.539965] [<8002d028>] (warn_slowpath_fmt) from [<8007510c>] (lockdep_trace_alloc+0x108/0x128) [ 40.548766] r3:809d0128 r2:809cc278 [ 40.552401] r4:600b0193 [ 40.554990] [<80075004>] (lockdep_trace_alloc) from [<801093d4>] (kmem_cache_alloc+0x28/0x15c) [ 40.563618] r4:000080d0 r3:80b4aa8c [ 40.567270] [<801093ac>] (kmem_cache_alloc) from [<804d95e4>] (ep_alloc_request+0x58/0x68) [ 40.575550] r10:7f01f104 r9:00000001 r8:bcfdef80 r7:bdb705cc r6:bc178700 r5:00000000 [ 40.583512] r4:bcfdef80 r3:813c0a38 [ 40.587183] [<804d958c>] (ep_alloc_request) from [<7f01f7ec>] (loopback_set_alt+0x114/0x21c [usb_f_ss_lb]) [ 40.596929] [<7f01f6d8>] (loopback_set_alt [usb_f_ss_lb]) from [<7f006910>] (composite_setup+0xbd0/0x17e8 [libcomposite]) [ 40.607902] r10:bd3a2c0c r9:00000000 r8:bcfdef80 r7:bc178700 r6:bdb702d0 r5:bcfdefdc [ 40.615866] r4:7f0199b4 r3:00000002 [ 40.619542] [<7f005d40>] (composite_setup [libcomposite]) from [<804dae88>] (udc_irq+0x784/0xd1c) [ 40.628431] r10:80bb5619 r9:c0876140 r8:00012001 r7:bdb71010 r6:bdb70568 r5:00010001 [ 40.636392] r4:bdb70014 [ 40.638985] [<804da704>] (udc_irq) from [<804d64f8>] (ci_irq+0x5c/0x118) [ 40.645702] r10:80bb5619 r9:be11e000 r8:00000117 r7:00000000 r6:bdb71010 r5:be11e060 [ 40.653666] r4:bdb70010 [ 40.656261] [<804d649c>] (ci_irq) from [<8007f638>] (handle_irq_event_percpu+0x7c/0x13c) [ 40.664367] r6:00000000 r5:be11e060 r4:bdb05cc0 r3:804d649c [ 40.670149] [<8007f5bc>] (handle_irq_event_percpu) from [<8007f740>] (handle_irq_event+0x48/0x6c) [ 40.679036] r10:00000000 r9:be008000 r8:00000001 r7:00000000 r6:bdb05cc0 r5:be11e060 [ 40.686998] r4:be11e000 [ 40.689581] [<8007f6f8>] (handle_irq_event) from [<80082850>] (handle_fasteoi_irq+0xd4/0x1b0) [ 40.698120] r6:80b56a30 r5:be11e060 r4:be11e000 r3:00000000 [ 40.703898] [<8008277c>] (handle_fasteoi_irq) from [<8007ec04>] (generic_handle_irq+0x28/0x3c) [ 40.712524] r7:00000000 r6:80b4aaf4 r5:00000117 r4:80b445fc [ 40.718304] [<8007ebdc>] (generic_handle_irq) from [<8007ef20>] (__handle_domain_irq+0x6c/0xe8) [ 40.727033] [<8007eeb4>] (__handle_domain_irq) from [<800095d4>] (gic_handle_irq+0x48/0x94) [ 40.735402] r9:c080f100 r8:80b4ac6c r7:c080e100 r6:80b67d40 r5:80b49f00 r4:c080e10c [ 40.743290] [<8000958c>] (gic_handle_irq) from [<80015d38>] (__irq_svc+0x58/0x78) [ 40.750791] Exception stack(0x80b49f00 to 0x80b49f48) [ 40.755873] 9f00: 00000001 00000001 00000000 80024320 80b48000 80b4a9d0 80b4a984 80b433e4 [ 40.764078] 9f20: 00000001 807f4680 00000000 80b49f5c 80b49f20 80b49f50 80071ca4 800113fc [ 40.772272] 9f40: 200b0013 ffffffff [ 40.775776] r9:807f4680 r8:00000001 r7:80b49f34 r6:ffffffff r5:200b0013 r4:800113fc [ 40.783677] [<800113d4>] (arch_cpu_idle) from [<8006c5bc>] (default_idle_call+0x28/0x38) [ 40.791798] [<8006c594>] (default_idle_call) from [<8006c6dc>] (cpu_startup_entry+0x110/0x1b0) [ 40.800445] [<8006c5cc>] (cpu_startup_entry) from [<807e95dc>] (rest_init+0x12c/0x168) [ 40.808376] r7:80b4a8c0 r3:807f4b7c [ 40.812030] [<807e94b0>] (rest_init) from [<80ad7cc0>] (start_kernel+0x360/0x3d4) [ 40.819528] r5:80bcb000 r4:80bcb050 [ 40.823171] [<80ad7960>] (start_kernel) from [<8000807c>] (0x8000807c) It fixes commit 91c42b0da8e3 ("usb: gadget: loopback: Fix looping back logic implementation"). Cc: <stable@vger.kernel.org> # v3.18+ Signed-off-by: Peter Chen <peter.chen@freescale.com> Reviewed-by: Krzysztof Opasiak <k.opasiak@samsung.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
* Merge branch 'for-next' of ↵Linus Torvalds2015-11-13
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending Pull SCSI target updates from Nicholas Bellinger: "This series contains HCH's changes to absorb configfs attribute ->show() + ->store() function pointer usage from it's original tree-wide consumers, into common configfs code. It includes usb-gadget, target w/ drivers, netconsole and ocfs2 changes to realize the improved simplicity, that now renders the original include/target/configfs_macros.h CPP magic for fabric drivers and others, unnecessary and obsolete. And with common code in place, new configfs attributes can be added easier than ever before. Note, there are further improvements in-flight from other folks for v4.5 code in configfs land, plus number of target fixes for post -rc1 code" In the meantime, a new user of the now-removed old configfs API came in through the char/misc tree in commit 7bd1d4093c2f ("stm class: Introduce an abstraction for System Trace Module devices"). This merge resolution comes from Alexander Shishkin, who updated his stm class tracing abstraction to account for the removal of the old show_attribute and store_attribute methods in commit 517982229f78 ("configfs: remove old API") from this pull. As Alexander says about that patch: "There's no need to keep an extra wrapper structure per item and the awkward show_attribute/store_attribute item ops are no longer needed. This patch converts policy code to the new api, all the while making the code quite a bit smaller and easier on the eyes. Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>" That patch was folded into the merge so that the tree should be fully bisectable. * 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending: (23 commits) configfs: remove old API ocfs2/cluster: use per-attribute show and store methods ocfs2/cluster: move locking into attribute store methods netconsole: use per-attribute show and store methods target: use per-attribute show and store methods spear13xx_pcie_gadget: use per-attribute show and store methods dlm: use per-attribute show and store methods usb-gadget/f_serial: use per-attribute show and store methods usb-gadget/f_phonet: use per-attribute show and store methods usb-gadget/f_obex: use per-attribute show and store methods usb-gadget/f_uac2: use per-attribute show and store methods usb-gadget/f_uac1: use per-attribute show and store methods usb-gadget/f_mass_storage: use per-attribute show and store methods usb-gadget/f_sourcesink: use per-attribute show and store methods usb-gadget/f_printer: use per-attribute show and store methods usb-gadget/f_midi: use per-attribute show and store methods usb-gadget/f_loopback: use per-attribute show and store methods usb-gadget/ether: use per-attribute show and store methods usb-gadget/f_acm: use per-attribute show and store methods usb-gadget/f_hid: use per-attribute show and store methods ...
| * usb-gadget/f_serial: use per-attribute show and store methodsChristoph Hellwig2015-10-13
| | | | | | | | | | | | | | | | | | | | To simplify the configfs interface and remove boilerplate code that also causes binary bloat. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Acked-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
| * usb-gadget/f_phonet: use per-attribute show and store methodsChristoph Hellwig2015-10-13
| | | | | | | | | | | | | | | | | | | | To simplify the configfs interface and remove boilerplate code that also causes binary bloat. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Acked-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
| * usb-gadget/f_obex: use per-attribute show and store methodsChristoph Hellwig2015-10-13
| | | | | | | | | | | | | | | | | | | | To simplify the configfs interface and remove boilerplate code that also causes binary bloat. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Acked-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
| * usb-gadget/f_uac2: use per-attribute show and store methodsChristoph Hellwig2015-10-13
| | | | | | | | | | | | | | | | | | | | To simplify the configfs interface and remove boilerplate code that also causes binary bloat. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Acked-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
| * usb-gadget/f_uac1: use per-attribute show and store methodsChristoph Hellwig2015-10-13
| | | | | | | | | | | | | | | | | | | | To simplify the configfs interface and remove boilerplate code that also causes binary bloat. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Acked-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
| * usb-gadget/f_mass_storage: use per-attribute show and store methodsChristoph Hellwig2015-10-13
| | | | | | | | | | | | | | | | | | | | To simplify the configfs interface and remove boilerplate code that also causes binary bloat. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Acked-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
| * usb-gadget/f_sourcesink: use per-attribute show and store methodsChristoph Hellwig2015-10-13
| | | | | | | | | | | | | | | | | | | | To simplify the configfs interface and remove boilerplate code that also causes binary bloat. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Acked-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
| * usb-gadget/f_printer: use per-attribute show and store methodsChristoph Hellwig2015-10-13
| | | | | | | | | | | | | | | | | | | | To simplify the configfs interface and remove boilerplate code that also causes binary bloat. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Acked-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
| * usb-gadget/f_midi: use per-attribute show and store methodsChristoph Hellwig2015-10-13
| | | | | | | | | | | | | | | | | | | | To simplify the configfs interface and remove boilerplate code that also causes binary bloat. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Acked-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
| * usb-gadget/f_loopback: use per-attribute show and store methodsChristoph Hellwig2015-10-13
| | | | | | | | | | | | | | | | | | | | To simplify the configfs interface and remove boilerplate code that also causes binary bloat. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Acked-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
| * usb-gadget/ether: use per-attribute show and store methodsChristoph Hellwig2015-10-13
| | | | | | | | | | | | | | | | | | | | To simplify the configfs interface and remove boilerplate code that also causes binary bloat. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Acked-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
| * usb-gadget/f_acm: use per-attribute show and store methodsChristoph Hellwig2015-10-13
| | | | | | | | | | | | | | | | | | | | To simplify the configfs interface and remove boilerplate code that also causes binary bloat. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Acked-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
| * usb-gadget/f_hid: use per-attribute show and store methodsChristoph Hellwig2015-10-13
| | | | | | | | | | | | | | | | | | | | To simplify the configfs interface and remove boilerplate code that also causes binary bloat. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Acked-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
| * usb-gadget/uvc: use per-attribute show and store methodsChristoph Hellwig2015-10-13
| | | | | | | | | | | | | | | | | | | | | | | | UVC is a little different from other configfs consumers in that it wants different function and field names from the exposed attribute name, so it keeps it's local macros to define attributes instead of using the common ones. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Acked-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>