Commit graph

14 commits

Author SHA1 Message Date
Quentin Lambert de904bf0e4 staging: rts5208: Convert non-returned local variable to boolean when relevant
This patch was produced using Coccinelle. A simplified version of the
semantic patch is:

@r exists@
identifier f;
local idexpression u8 x;
identifier xname;
@@

f(...) {
...when any
(
  x@xname = 1;
|
  x@xname = 0;
)
...when any
}

@bad exists@
identifier r.f;
local idexpression u8 r.x
expression e1 != {0, 1}, e2;
@@

f(...) {
...when any
(
  x = e1;
|
  x + e2
)
...when any
}

@depends on !bad@
identifier r.f;
local idexpression u8 r.x;
identifier r.xname;
@@

f(...) {
...
++ bool xname;
- int xname;
<...
(
  x =
- 1
+ true
|
  x =
- -1
+ false
)
...>

}

Signed-off-by: Quentin Lambert <lambert.quentin@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-06 17:25:00 -08:00
Fabio Falzoi 506fe17dae Staging: rts5208: helper function to enable interrupts during reset
Define the helper function rtsx_enable_pcie_intr to shorten the
rtsx_reset_chip code and get rid of the LONG_LINE checkpatch warnings.

Signed-off-by: Fabio Falzoi <fabio.falzoi84@gmail.com>
Reviewed-by: Dan Carpenter <dan.carpente@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-10-29 17:28:51 +08:00
Fabio Falzoi 5d069c8886 Staging: rts5208: helper function to manage aspm during reset
Define the helper function rtsx_reset_aspm to shorten the
rtsx_reset_chip code and get rid of the LONG_LINE checkpatch warnings.

Signed-off-by: Fabio Falzoi <fabio.falzoi84@gmail.com>
Reviewed-by: Dan Carpenter <dan.carpente@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-10-29 17:28:51 +08:00
Giedrius Statkevičius 609fc15ef8 staging: rts5208: use ternary operators to reduce indentation level
Convert code in format of if (a) if(b) { [...] } to one line with a
simple ternary operation to avoid unnecesary increase of indentation
level.

Signed-off-by: Giedrius Statkevičius <giedrius.statkevicius@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-10-20 10:29:27 +08:00
Giedrius Statkevičius fbbf359c4c staging: rts5208: divide lines to make them less than 80 characters long
Make a couple of lines shorter than the max limit by diving them and
also make sure to align them properly where possible.

Signed-off-by: Giedrius Statkevičius <giedrius.statkevicius@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-10-20 10:29:27 +08:00
Giedrius Statkevičius 21e69b7274 staging: rts5208: align divided lines to opening paranthesis
Make all divided lines aligned to the opening paranthesis.

Basically makes all lines aligned to the opening paranthesis to make the
code more readable and it also gets rid of a lot of checkpatch.pl
"checks".

Signed-off-by: Giedrius Statkevičius <giedrius.statkevicius@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-10-20 10:29:27 +08:00
Giedrius Statkevičius e050dda1e5 staging: rts5208: get rid of Camel Case, remove unneeded lines and parantheses
Convert labels from Camel Case to lower case, remove unnecessary
parantheses around operands of dereference operators and remove unneeded
empty lines before }.

Gets rid of a checkpatch.pl "check" that code should avoid Camel Case,
also the code had a bunch of &(a) where a is some variable so it gets
rid of them too.  Finally, in a few places there were a empty line
before } so remove them.

Signed-off-by: Giedrius Statkevičius <giedrius.statkevicius@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-10-20 10:29:27 +08:00
Giedrius Statkevičius 175dbfae60 staging: rts5208: combine ifs where possible
Join together chained if's where possible to lower the indentation
level.

In a lot of places of this code the indentation level is already very
high.
As a result, this patch increases the code flow and readability.

Signed-off-by: Giedrius Statkevičius <giedrius.statkevicius@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-10-20 10:29:27 +08:00
Melike Yurtoglu 4dae2a4fca staging: rts5208: Remove unneeded void return
Fixes "void function return statements are not generally
useful"checkpatch.pl warning

Signed-off-by: Melike Yurtoglu <aysemelikeyurtoglu@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-10-02 10:07:04 -07:00
Mahati Chamarthy 0be0b27dac Staging: rts5208: Fix missing blank line warning
This fixes the following checkpatch.pl warnings:
WARNING: Missing a blank line after declarations

Signed-off-by: Mahati Chamarthy <mahati.chamarthy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-28 22:47:54 -04:00
Fabio Falzoi 69b8b22489 Staging: rts5208: Use dev_dbg and print_hex_dump_bytes to dump memory
Use dev_dbg with %*ph format specifier and print_hex_dump_bytes to dump memory
instead of relying on custom macro.

Signed-off-by: Fabio Falzoi <fabio.falzoi84@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-08-16 12:23:13 -07:00
Fabio Falzoi bf6c0d110e Staging: rts5208: Replace custom macro with dev_dbg
Use dev_dbg macro to control tracing verbosity through dynamic debug facility.

Signed-off-by: Fabio Falzoi <fabio.falzoi84@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-30 17:22:18 -07:00
Micky Ching bf2ec0f9ad staging: rts5208: fix static checker warnings
The patch fa590c222f: "staging: rts5208: add support for rts5208
and rts5288" from Nov 12, 2013, leads to the following static checker
warning:
	drivers/staging/rts5208/rtsx_chip.c:107 rtsx_enable_bus_int()
	warn: add curly braces?
This warning is produced because incorrect code indent.

Signed-off-by: Micky Ching <micky_ching@realsil.com.cn>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-15 13:56:10 -07:00
Micky Ching fa590c222f staging: rts5208: add support for rts5208 and rts5288
There are still many rts5208/5288 card readers being used, but no
drivers are supported them in kernel now. This driver can make a
great convenience for people who use them.

Many other rts-series card reader are supported by mfd driver, but due
to much difference with others, rts5208/5288 can not add into mfd driver
pretty now, so we provide a separated driver here to support the device.

Signed-off-by: Micky Ching <micky_ching@realsil.com.cn>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-11-25 12:44:37 -08:00