summaryrefslogtreecommitdiff
path: root/drivers/usb/gadget/udc/goku_udc.c
AgeCommit message (Collapse)Author
2021-09-14usb: gadget: goku_udc: Fix mask and set operation on variable masterColin Ian King
The variable master is being masked with ~MST_R_BITS however this masked value is never used, the following updates to master are assignments. I suspect the original intention was to mask out the MST_R_BITS and then bit-wise or in the appropriate read bits rather than perform an assignment. Fix this by using the |= operator rather than a straight assignment. Note that this code is pre-git history, so I can't find a sha for it. Signed-off-by: Colin Ian King <colin.king@canonical.com> Addresses-Coverity: ("Unused value") Link: https://lore.kernel.org/r/20210910163131.94796-1-colin.king@canonical.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-10-27usb: gadget: goku_udc: fix potential crashes in probeEvgeny Novikov
goku_probe() goes to error label "err" and invokes goku_remove() in case of failures of pci_enable_device(), pci_resource_start() and ioremap(). goku_remove() gets a device from pci_get_drvdata(pdev) and works with it without any checks, in particular it dereferences a corresponding pointer. But goku_probe() did not set this device yet. So, one can expect various crashes. The patch moves setting the device just after allocation of memory for it. Found by Linux Driver Verification project (linuxtesting.org). Reported-by: Pavel Andrianov <andrianov@ispras.ru> Signed-off-by: Evgeny Novikov <novikov@ispras.ru> Signed-off-by: Felipe Balbi <balbi@kernel.org>
2020-07-10usb: gadget: Use fallthrough pseudo-keywordGustavo A. R. Silva
Replace the existing /* fall through */ comments and its variants with the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary fall-through markings when it is the case. [1] https://www.kernel.org/doc/html/latest/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org> Link: https://lore.kernel.org/r/20200707171500.GA13620@embeddedor Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-02-19usb: gadget: goku_udc: remove useless cast for driver.nameCorentin Labbe
pci_driver name is const char pointer, so it not useful to cast driver_name (which is already const char). Signed-off-by: Corentin Labbe <clabbe@baylibre.com> Link: https://lore.kernel.org/r/1582054383-35760-9-git-send-email-clabbe@baylibre.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-06remove ioremap_nocache and devm_ioremap_nocacheChristoph Hellwig
ioremap has provided non-cached semantics by default since the Linux 2.6 days, so remove the additional ioremap_nocache interface. Signed-off-by: Christoph Hellwig <hch@lst.de> Acked-by: Arnd Bergmann <arnd@arndb.de>
2018-05-16proc: introduce proc_create_single{,_data}Christoph Hellwig
Variants of proc_create{,_data} that directly take a seq_file show callback and drastically reduces the boilerplate code in the callers. All trivial callers converted over. Signed-off-by: Christoph Hellwig <hch@lst.de>
2017-11-07USB: gadget: udc: Remove redundant license textGreg Kroah-Hartman
Now that the SPDX tag is in all USB files, that identifies the license in a specific and legally-defined manner. So the extra GPL text wording can be removed as it is no longer needed at all. This is done on a quest to remove the 700+ different ways that files in the kernel describe the GPL license text. And there's unneeded stuff like the address (sometimes incorrect) for the FSF which is never needed. No copyright headers or other non-license-description text was removed. Cc: Kevin Cernekee <cernekee@gmail.com> Cc: Florian Fainelli <f.fainelli@gmail.com> Cc: Vladimir Zapolskiy <vz@mleia.com> Cc: Sylvain Lemieux <slemieux.tyco@gmail.com> Cc: Daniel Mack <daniel@zonque.org> Cc: Haojian Zhuang <haojian.zhuang@gmail.com> Cc: Michal Simek <michal.simek@xilinx.com> Cc: "Sören Brinkmann" <soren.brinkmann@xilinx.com> Cc: Raviteja Garimella <raviteja.garimella@broadcom.com> Cc: Romain Perier <romain.perier@collabora.com> Cc: Johan Hovold <johan@kernel.org> Cc: Al Cooper <alcooperx@gmail.com> Cc: Srinath Mannam <srinath.mannam@broadcom.com> Cc: Roger Quadros <rogerq@ti.com> Cc: Krzysztof Opasiak <k.opasiak@samsung.com> Cc: Stefan Agner <stefan@agner.ch> Cc: Alan Stern <stern@rowland.harvard.edu> Cc: "Felix Hädicke" <felixhaedicke@web.de> Cc: Peter Chen <peter.chen@nxp.com> Cc: Allen Pais <allen.lkml@gmail.com> Cc: Yuyang Du <yuyang.du@intel.com> Acked-by: Felipe Balbi <felipe.balbi@linux.intel.com> Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com> Acked-by: Robert Jarzmik <robert.jarzmik@free.fr> Acked-by: Li Yang <leoyang.li@nxp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-04USB: add SPDX identifiers to all remaining files in drivers/usb/Greg Kroah-Hartman
It's good to have SPDX identifiers in all files to make it easier to audit the kernel tree for correct licenses. Update the drivers/usb/ and include/linux/usb* files with the correct SPDX license identifier based on the license text in the file itself. The SPDX identifier is a legally binding shorthand, which can be used instead of the full boiler plate text. This work is based on a script and data from Thomas Gleixner, Philippe Ombredanne, and Kate Stewart. Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Kate Stewart <kstewart@linuxfoundation.org> Cc: Philippe Ombredanne <pombredanne@nexb.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Acked-by: Felipe Balbi <felipe.balbi@linux.intel.com> Acked-by: Johan Hovold <johan@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-24usb: gadget: goku_udc: mark expected switch fall-throughsGustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through. Addresses-Coverity-ID: 145713 Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2017-01-24usb: gadget: udc: constify usb_ep_ops structuresBhumika Goyal
Declare usb_ep_ops structures as const as they are only stored in the ops field of an usb_ep structure. This field is of type const, so usb_ep_ops structures having this property can be made const too. Done using Coccinelle( A smaller version of the script) @r disable optional_qualifier@ identifier i; position p; @@ static struct usb_ep_ops i@p={...}; @ok@ identifier r.i; position p; struct mv_ep a; struct mv_u3d_ep b; struct omap_ep c; @@ ( a.ep.ops=&i@p; | b.ep.ops=&i@p; | c.ep.ops=&i@p; ) @bad@ position p!={r.p,ok.p}; identifier r.i; @@ i@p @depends on !bad disable optional_qualifier@ identifier r.i; @@ +const struct usb_ep_ops i; File size details before and after applying the patch. First line of every .o file shows the file size before patching and second line shows the file size after patching. text data bss dec hex filename 7782 384 8 8174 1fee usb/gadget/udc/fotg210-udc.o 7878 296 8 8182 1ff6 usb/gadget/udc/fotg210-udc.o 17866 992 40 18898 49d2 usb/gadget/udc/fsl_udc_core.o 17954 896 40 18890 49ca usb/gadget/udc/fsl_udc_core.o 9646 288 8 9942 26d6 usb/gadget/udc/fusb300_udc.o 9742 192 8 9942 26d6 usb/gadget/udc/fusb300_udc.o 12752 416 8 13176 3378 drivers/usb/gadget/udc/goku_udc.o 12832 328 8 13168 3370 drivers/usb/gadget/udc/goku_udc.o 16541 1696 8 18245 4745 drivers/usb/gadget/udc/gr_udc.o 16637 1600 8 18245 4745 drivers/usb/gadget/udc/gr_udc.o 15798 288 16 16102 3ee6 drivers/usb/gadget/udc/m66592-udc.o 15894 192 16 16102 3ee6 drivers/usb/gadget/udc/m66592-udc.o 17751 3808 16 21575 5447 usb/gadget/udc/mv_u3d_core.o 17839 3712 16 21567 543f usb/gadget/udc/mv_u3d_core.o 17348 1112 24 18484 4834 usb/gadget/udc/mv_udc_core.o 17436 1016 24 18476 482c usb/gadget/udc/mv_udc_core.o 25990 2620 13 28623 6fcf drivers/usb/gadget/udc/net2272.o 26086 2524 13 28623 6fcf drivers/usb/gadget/udc/net2272.o 18409 7312 8 25729 6481 drivers/usb/gadget/udc/pxa27x_udc.o 18505 7208 8 25721 6479 drivers/usb/gadget/udc/pxa27x_udc.o 18644 288 16 18948 4a04 usb/gadget/udc/r8a66597-udc.o 18740 192 16 18948 4a04 usb/gadget/udc/r8a66597-udc.o Files: drivers/usb/gadget/udc/{s3c-hsudc.o/omap_udc.o/fsl_qe_udc.o} did not complie. Signed-off-by: Bhumika Goyal <bhumirks@gmail.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2016-08-29usb: gadget: goku_udc: fix memory leak in goku_probe()Alexey Khoroshilov
Memory allocated for goku_udc device is not deallocated at error paths in goku_probe(), because gadget_release() destructor is not registered yet. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2016-08-29usb: gadget: udc: goku_udc: don't print on ENOMEMWolfram Sang
All kmalloc-based functions print enough information on failures. Signed-off-by: Wolfram Sang <wsa-dev@sang-engineering.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2016-03-15PCI: Add PCI_CLASS_SERIAL_USB_DEVICE definitionHeikki Krogerus
PCI-SIG has defined Interface FEh for Base Class 0Ch, Sub-Class 03h as "USB Device (not host controller)". It is already being used in various USB device controller drivers for matching, so add PCI_CLASS_SERIAL_USB_DEVICE and use it. Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
2015-08-06usb: gadget: goku_udc: add goku_match_ep() functionRobert Baldyga
Add 'match_ep' callback to utilize chip-specific knowledge in endpoint matching process. Function does the same that was done by chip-specific code inside of epautoconf. Now this code can be removed from there to separate generic code from platform specific logic. [ balbi@ti.com : fix build breakage ] Signed-off-by: Robert Baldyga <r.baldyga@samsung.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-08-04usb: gadget: goku_udc: add ep capabilities supportRobert Baldyga
Convert endpoint configuration to new capabilities model. Signed-off-by: Robert Baldyga <r.baldyga@samsung.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-03-19usb: gadget: goku_udc: Remove uses of seq_<foo> return valuesJoe Perches
The seq_printf/seq_puts/seq_putc return values, because they are frequently misused, will eventually be converted to void. See: commit 1f33c41c03da ("seq_file: Rename seq_overflow() to seq_has_overflowed() and make public") Miscellanea: o Coalesce formats, realign arguments o Create static functions for statement expression macros o Use c90 style comments instead of c99 Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-11-03usb: gadget: remove unnecessary 'driver' argumentFelipe Balbi
now that no UDC driver relies on the extra 'driver' argument to ->udc_stop(), we can safely remove it. This commit is based on previous work by Robert Baldyga <r.baldyga@samsung.com> which can be found at [1]; however that patch turned out to have a high probability of regressing many UDC drivers because of a blind search & replace s/driver/$udc->driver/ which caused the 'driver' argument to stop_activity() to be a valid non-NULL pointer when it should be NULL, thus causing UDCs to mistakenly call gadget driver's ->disconnect() callback. [1] http://markmail.org/message/x5zneg4xea4zntab Acked-by: Peter Chen <peter.chen@freescale.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
2014-09-25usb: gadget: Refactor request completionMichal Sojka
Use the recently introduced usb_gadget_giveback_request() in favor of direct invocation of the completion routine. All places in drivers/usb/ matching "[-.]complete(" were replaced with a call to usb_gadget_giveback_request(). This was compile-tested with all ARM drivers enabled and runtime-tested for musb. Signed-off-by: Michal Sojka <sojka@merica.cz> Acked-by: Felipe Balbi <balbi@ti.com> Tested-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-16usb: gadget: Gadget directory cleanup - group UDC driversAndrzej Pietrasiewicz
The drivers/usb/gadget directory contains many files. Files which are related can be distributed into separate directories. This patch moves the UDC drivers into a separate directory. Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Signed-off-by: Felipe Balbi <balbi@ti.com>