Commit Graph

213 Commits

Author SHA1 Message Date
Naveen Panwar 414b804a71 drivers: staging: octeon-usb: fixed codestyle check warning
Fixed line cannot end with '(' check.

Signed-off-by: Naveen Panwar <naveen.panwar27@gmail.com>
Link: https://lore.kernel.org/r/20200908030239.10131-1-naveen.panwar27@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-09-13 09:21:15 +02:00
Gustavo A. R. Silva 5979afa2c4 staging: Replace zero-length array with flexible-array member
The current codebase makes use of the zero-length array language
extension to the C90 standard, but the preferred mechanism to declare
variable-length types such as these ones is a flexible array member[1][2],
introduced in C99:

struct foo {
        int stuff;
        struct boo array[];
};

By making use of the mechanism above, we will get a compiler warning
in case the flexible array does not occur last in the structure, which
will help us prevent some kind of undefined behavior bugs from being
inadvertently introduced[3] to the codebase from now on.

Also, notice that, dynamic memory allocations won't be affected by
this change:

"Flexible array members have incomplete type, and so the sizeof operator
may not be applied. As a quirk of the original implementation of
zero-length arrays, sizeof evaluates to zero."[1]

This issue was found with the help of Coccinelle.

[1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
[2] https://github.com/KSPP/linux/issues/21
[3] commit 7649773293 ("cxgb3/l2t: Fix undefined behaviour")

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Link: https://lore.kernel.org/r/20200220132908.GA30501@embeddedor
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-02-23 19:18:54 +01:00
Chris Packham 96b06c0a16 Revert "staging: octeon-usb: delete the octeon usb host controller driver"
This reverts commit 95ace52e40. Re-instate
the code so subsequent commits can clean it up and get it building
properly.

Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
Link: https://lore.kernel.org/r/20200205001116.14096-2-chris.packham@alliedtelesis.co.nz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-02-12 13:50:32 -08:00
Greg Kroah-Hartman 95ace52e40 staging: octeon-usb: delete the octeon usb host controller driver
This driver was merged back in 2013 and shows no progress toward every
being merged into the "correct" part of the kernel.  The code doesn't
even build for anyone unless you have the specific hardware platform
selected, so odds are it doesn't even work anymore.

Remove it for now and is someone comes along that has the hardware and
is willing to fix it up, it can be reverted.

Cc: Aaro Koskinen <aaro.koskinen@iki.fi>
Cc: David Daney <ddaney.cavm@gmail.com>
Cc: Nishka Dasgupta <nishkadg.linux@gmail.com>
Cc: Himadri Pandya <himadri18.07@gmail.com>
Cc: "Frank A. Cancio Bello" <frank@generalsoftwareinc.com>
Cc: Sumit Pundir <pundirsumit11@gmail.com>
Cc: Laura Lazzati <laura.lazzati.15@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/20191210091509.3546251-2-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-17 12:54:55 +01:00
Frank A. Cancio Bello f3a54e19d4 staging: octeon-usb: Fix line ending with a '('
checkpatch.pl message:
"CHECK:OPEN_ENDED_LINE: Lines should not end with a '('"

Signed-off-by: Frank A. Cancio Bello <frank@generalsoftwareinc.com>
Link: https://lore.kernel.org/r/20191028042111.tzfhugs6f4erohir@linux-kernel-dev
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-10-28 16:41:42 +01:00
Christoph Hellwig 7b81cb6bdd usb: add a HCD_DMA flag instead of guestimating DMA capabilities
The usb core is the only major place in the kernel that checks for
a non-NULL device dma_mask to see if a device is DMA capable.  This
is generally a bad idea, as all major busses always set up a DMA mask,
even if the device is not DMA capable - in fact bus layers like PCI
can't even know if a device is DMA capable at enumeration time.  This
leads to lots of workaround in HCD drivers, and also prevented us from
setting up a DMA mask for platform devices by default last time we
tried.

Replace this guess with an explicit HCD_DMA that is set by drivers that
appear to have DMA support.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20190816062435.881-4-hch@lst.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-08-21 10:03:35 -07:00
Nishka Dasgupta 8fe0260030 staging: octeon-usb: Remove return variable
Remove return variable result and return the value directly.
Issue found using Coccinelle.

Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-30 14:13:45 -07:00
Greg Kroah-Hartman 99b75a4e32 staging: add missing SPDX lines to Kconfig files
There are a few remaining drivers/staging/*/Kconfig files that do not
have SPDX identifiers in them.  Add the correct GPL-2.0 identifier to
them to make scanning tools happy.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-03 11:10:15 +02:00
Laura Lazzati fbcd84743a staging: octeon-usb octeon-hcd: Fix several typos.
I found that the comments had several typos such as "aenable", "internaly" and some others.
I fixed them all.

Signed-off-by: Laura Lazzati <laura.lazzati.15@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-03-18 07:06:08 +01:00
Himadri Pandya b92f5d83fa staging: octeon-usb: remove unnecessary variable frame_number
Remove unnecessary local variable "frame_number" and its assignments from function
cvmx_usb_get_frame_numbe. Suggested by Coccinelle.

Signed-off-by: Himadri Pandya <himadri18.07@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-03-18 07:05:22 +01:00
Sumit Pundir e1167d7b45 staging: octeon-usb: fix misspelled "re-enable"
Fixes misspelled "re-enable" in comment. Reported by checkpatch.pl

Signed-off-by: Sumit Pundir <pundirsumit11@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-02-21 10:58:11 +01:00
Aaro Koskinen b5630e3019 staging: octeon-usb: use a helper function to set the DMA mask
Use a helper function to set the DMA mask.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-05 09:47:02 +01:00
Igor Stoppa 009e451c4f staging: octeon-hcd: remove unnecessary unlikely()
WARN_ON() already contains an unlikely(), so it's not necessary to
wrap it into another.

Signed-off-by: Igor Stoppa <igor.stoppa@huawei.com>
Cc: Aaro Koskinen <aaro.koskinen@iki.fi>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: devel@driverdev.osuosl.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-09-14 15:21:06 +02:00
Georgios Tsotsos 3e195a80e0 Staging: octeon-usb: Replaces CVMX_WAIT_FOR_FIELD32 macro with a function
Replaces CVMX_WAIT_FOR_FIELD32 macro with equivalent function.

Signed-off-by: Georgios Tsotsos <tsotsos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-08-27 19:56:59 +02:00
Georgios Tsotsos 4e336dff0d Staging: octeon-usb: Adding SPDX license identifier
Adding appropriate SPDX-License-Identifier (GPL-2) that were missing
from code, header and make files.

Signed-off-by: Georgios Tsotsos <tsotsos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-27 17:18:14 +02:00
Aaro Koskinen 0590cdfead staging: octeon-usb: use __delay() instead of cvmx_wait()
Commit edf188bee1 ("MIPS: Octeon: Remove usage of cvmx_wait()
everywhere.") deleted cvmx_wait() but forgot to update OCTEON USB
staging driver. Fix that to allow driver build.

Fixes: edf188bee1 ("MIPS: Octeon: Remove usage of cvmx_wait() everywhere.")
Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Reviewed-by: James Hogan <jhogan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-28 14:36:46 +01:00
Anton Bondarenko 9bbf84e604 staging: octeon-usb: use correct function for hcd cleanup
Use usb_put_hdc to release hdc allocated by usb_create_hcd.
This is needed to handle sub-allocations and HCD sharing correctly.

Signed-off-by: Anton Bondarenko <anton.bondarenko.sama@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-05-15 07:43:55 +02:00
Rehas Sachdeva efb35d12b3 staging: octeon-usb: Remove unnecessary assignment
Remove 'x=a;' from a consecutive double assignment of the form 'x=a; x=b;'.
Issue detected by the semantic patch found here:
https://github.com/coccinelle/coccinellery/blob/master/write2/write2.cocci

Signed-off-by: Rehas Sachdeva <aquannie@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-22 11:54:48 +02:00
Randy Dunlap e7a69540e1 staging: octeon-usb: correct driver name in Kconfig help text
The module name in the Makefile and in the driver source file is
octeon-hcd, so correct the Kconfig text to be the same.

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-08-30 19:09:47 +02:00
Aaro Koskinen 8ad6e09d55 staging: octeon-usb: update TODO
Update TODO.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-25 22:38:16 -08:00
Aaro Koskinen a00265de23 staging: octeon-usb: avoid an overlong line
Avoid an overlong line.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-25 22:38:16 -08:00
Aaro Koskinen d07374987f staging: octeon-usb: move next pipe selection into a separate function
Move next pipe selection into a separate function to avoid deep
nesting.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-25 22:38:16 -08:00
Aaro Koskinen dd588994fa staging: octeon-usb: move isoc transfer handling into separate function
Move isochronous transfer handling into a separate function to
avoid deep indentation.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-25 22:38:16 -08:00
Aaro Koskinen dfce62674c staging: octeon-usb: move interrupt transfer handling into separate function
Move bulk transfer handling into a separate function to avoid
deep indentation.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-25 22:38:16 -08:00
Aaro Koskinen 8ed3094c62 staging: octeon-usb: move bulk transfer handling into separate function
Move bulk transfer handling into a separate function to avoid
deep indentation.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-25 22:38:16 -08:00
Aaro Koskinen 81a71bad40 staging: octeon-usb: move control transfer handling into separate function
Move control transfer handling into a separate function to
avoid deep indentation.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-25 22:38:16 -08:00
Aaro Koskinen 8b07d2fe38 staging: octeon-usb: fold cvmx_usb_state into octeon_hcd
Fold cvmx_usb_state into octeon_hcd.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-25 22:38:16 -08:00
Aaro Koskinen b186eb64d4 staging: octeon-usb: rename STATUS_SUCCESS to STATUS_OK
Rename STATUS_SUCCESS to STATUS_OK.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-25 22:38:16 -08:00
Aaro Koskinen e6bff5a070 staging: octeon-usb: rename cvmx_usb_perform_complete to cvmx_usb_complete
Rename cvmx_usb_perform_complete to cvmx_usb_complete.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-25 22:38:16 -08:00
Aaro Koskinen add3ea324c staging: octeon-usb: rename cvmx_usb_complete to cvmx_usb_status
Rename cvmx_usb_complete to cvmx_usb_status.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-25 22:38:16 -08:00
Aaro Koskinen 284ea26aaa staging: octeon-usb: simplify if statement
Simplify if statement to avoid deep nesting.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-25 22:38:16 -08:00
Aaro Koskinen 25adcca6ec staging: octeon-usb: pass transfer type to find_ready_pipe
Since we always search the same list, we can just pass the transfer type.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-25 22:38:16 -08:00
Aaro Koskinen 38492ccbd1 staging: octeon-usb: eliminate redundant parameter from find_ready_pipe
current_frame always equals usb->frame_number.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-25 22:38:16 -08:00
Aaro Koskinen 68ea338017 staging: octeon-usb: align split lines to match open parenthesis
Align split lines to match open parenthesis.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-25 22:38:16 -08:00
Aaro Koskinen a2fcca426d staging: octeon-usb: use preferred style for NULL comparison
Use preferred coding style for NULL comparison.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-25 22:38:16 -08:00
Aaro Koskinen a89e28e3e2 staging: octeon-usb: make driver name to match the file name
Make driver name to match the file name.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-20 15:14:01 -08:00
Aaro Koskinen 3c98ef90f0 staging: octeon-usb: add spaces around operator
Add spaces around operator to improve readability.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-20 15:14:01 -08:00
Aaro Koskinen cce66005b4 staging: octeon-usb: switch to use kernel types
Switch to use kernel types:

	uint64_t -> u64
	uint32_t -> u32
	uint16_t -> u16
	uint8_t  -> u8
	int8_t   -> s8

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-20 15:14:01 -08:00
Aaro Koskinen 466657314b staging: octeon-usb: clean up includes
Clean up includes.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-20 15:14:01 -08:00
Aaro Koskinen ec7c4d7d52 staging: octeon-usb: delete space after cast
Delete space after cast.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-20 15:14:01 -08:00
Aaro Koskinen 6de14f12c3 staging: octeon-usb: add missing braces
Some if branches are missing braces as required by coding style.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-20 15:14:01 -08:00
Aaro Koskinen c9d19612e8 staging: octeon-usb: delete redundant blank lines
Delete redundant blank lines.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-20 15:14:01 -08:00
Aaro Koskinen bb778553d4 staging: octeon-usb: support official bindings
Support official DT bindings alongside with the deprecated ones.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-14 16:52:15 -08:00
Janani Ravichandran 1d5047c981 staging: octeon: Remove unneeded parentheses in assignment
Remove parentheses around the right hand side of assignments as they are
not needed. Semantic patch used:

@@
expression a, b, c;
@@

(
  a = (b == c)
|
  a =
- (
  b
- )
)

Signed-off-by: Janani Ravichandran <janani.rvchndrn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-11 19:40:02 -08:00
Saatvik Arya edb0d9d4a3 drivers: staging: octeon-usb: octeon-hcd.c: fixed coding style related warnings
fixed coding style warnings related to comment blocks

Signed-off-by: Saatvik Arya <aryasaatvik@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07 19:35:16 -08:00
Cristina Moraru 73eee567cb staging: octeon-usb: Replace kmalloc with kmalloc_array
Replace kmalloc with specialized function kmalloc_array
when the size is a multiplication of:
	number_of_elements * size_of_element

Signed-off-by: Cristina Moraru <cristina.moraru09@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-24 19:28:52 -07:00
Luis de Bethencourt 1972308bf5 staging: octeon-usb: Fix module autoload for OF platform driver
This platform driver has a OF device ID table but the OF module
alias information is not created so module autoloading won't work.

Signed-off-by: Luis de Bethencourt <luis@debethencourt.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-09-12 18:24:37 -07:00
Carlos E. Garcia 69e98df782 Staging: fixed multiple spelling errors.
Fixed multiple spelling errors.

Signed-off-by: Carlos E. Garcia <carlos@cgarcia.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-05-08 09:23:58 +02:00
Johan Hovold b97c3c1a0b staging: octeon-usb: fix unaligned isochronous transfers
Make sure to copy the whole transfer buffer when releasing the temporary
buffer used for unaligned isochronous transfers as the data is not
necessarily contiguous in that case.

Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-04-28 13:14:21 +02:00
Aaro Koskinen 203d776214 staging: octeon-usb: make CVMX_WAIT_FOR_FIELD32 to take condition expression
Make CVMX_WAIT_FOR_FIELD32 to take full condition expression.
This should make the usage simpler, and the macro more readable.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-04-03 13:57:28 +02:00