Commit graph

24 commits

Author SHA1 Message Date
Wayne Porter fe421a75ec staging: rts5208: sd.c: Spacing cleanup
Add/remove spaces to make things more readable

Signed-off-by: Wayne Porter <wporter82@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-10-16 10:26:43 +02:00
Wayne Porter 3c3776441f staging: rts5208: sd.c: Fix logical continuations
Checkpatch detected && at the beginning of new lines

Signed-off-by: Wayne Porter <wporter82@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-10-16 10:26:42 +02:00
Wayne Porter 57a3fcfa6b staging: rts5208: sd.c: CamelCase fixes
Convert camel case lables to all lowercase

Signed-off-by: Wayne Porter <wporter82@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-10-16 10:26:41 +02:00
Wayne Porter 7fbe04f1ce staging: rts5208: sd.c: Long line fixes
Break up lines over 80 characters

Signed-off-by: Wayne Porter <wporter82@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-10-16 10:26:40 +02:00
Wayne Porter 20390dc72e staging: rts5208: sd.c: Alignment fixes
Lining up with open parenthesis found by checkpatch

Signed-off-by: Wayne Porter <wporter82@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-10-16 10:26:39 +02:00
Wayne Porter 33f2b12165 staging: rts5208: sd.c: Remove unnecessary parentheses
Cleanup of &(chip->sd_card) to remove parentheses where they are not
needed

Signed-off-by: Wayne Porter <wporter82@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-10-16 10:26:37 +02:00
Sergio Paracuellos e040b62683 staging: rts5208: fix style warnings in sd.c
This patch fixes the following checkpatch.pl warning in sd.c:
WARNING: else is not generally useful after a break or return

It also makes code more uniform with the new changes

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-25 12:40:30 +02:00
Rehas Sachdeva 0328217969 staging: rts5208: Put constant on right side of comparison
Replaces position of constant from left to right side of a comparison.
Additionally, modifies logical continuations to be on the previous line and
fixes alignment to match open parenthesis. Issues found by checkpatch.

Signed-off-by: Rehas Sachdeva <aquannie@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-20 14:03:04 +02:00
Jonas Rickert d5b7d2b02c Staging: rts5208: fix double blank line coding style issues
This is a patch for double blank lines and a missing blank line reported
by checkpatch.pl

Signed-off-by: Jonas Rickert <jrickertkc@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-08-21 18:37:36 +02:00
Nicholas Sim 649b55b426 staging: rts5208: ensure braces on all arms of if stmt
Added braces on if arm of if statement where else arm already needs
braces as suggested for clarity in Documentation/CodingStyle (several)

Signed-off-by: Nicholas Sim <nicholassimws@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-29 17:58:02 -07:00
Eva Rachel Retuya 7586170c84 staging: rts5208: simplify NULL tests
Replace direct comparisons to NULL i.e. 'x == NULL' with '!x' for
consistency. Coccinelle semantic patch used:

@@
identifier func;
expression x;
statement Z;
@@

x = func(...);

if (
(
+	!
	x
-	== NULL
|
+	!
-	NULL ==
	x
)
   ) Z

Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Bhumika Goyal eff8bf8243 Staging: rts5208: Use min instead of ternary operator
This patch replaces ternary operator with macro min as it shorter and
thus increases code readability. Macro min returns the minimum of the
two compared values.
Made a semantic patch for changes:

@@
type T;
T x;
T y;
@@
(
- x < y ? x : y
+ min(x,y)
|
- x > y ? x : y
+ max(x,y)
)

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Janani Ravichandran 3b15cfbbee staging: rts5208: Place constants on the right side of comparisons
Constants should be placed on the right hand side of comparisons. This
issue was identified by checkpatch.

Signed-off-by: Janani Ravichandran <janani.rvchndrn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-14 16:44:06 -08:00
Yash Shah 66e6d70df2 Staging: rts5208: Fix code indentation warning as detected by checkpatch.pl
Fixed code indentation warning as detected by checkpatch.pl.

Signed-off-by: Yash Shah <yshah1@visteon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-03 17:54:04 -07:00
Leung Timothy Chi King 364b91be26 Staging: rts5208: Fix checkpatch warning: else is not generally useful
The following checkpatch warning was fixed:

WARNING: else is not generally useful after a break or return

Signed-off-by: Leung Timothy Chi King <contact@timothyleung.co>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-07-14 20:18:56 -07:00
Joe Perches 8ee775f92c staging: rts5208: Remove RTSX_READ_REG and RTSX_WRITE_REG macros
Macros with hidden flow control are bad form as the code path
taken can be unexpected for the reader.

Expand these in-place and remove the macros.

Done with coccinelle script:

@@
expression chip;
expression arg1;
expression arg2;
expression arg3;
@@

-	RTSX_WRITE_REG(chip, arg1, arg2, arg3);
+	retval = rtsx_write_register(chip, arg1, arg2, arg3);
+	if (retval) {
+		rtsx_trace(chip);
+		return retval;
+	}

@@
expression chip;
expression arg1;
expression arg2;
@@

-	RTSX_READ_REG(chip, arg1, arg2);
+	retval = rtsx_read_register(chip, arg1, arg2);
+	if (retval) {
+		rtsx_trace(chip);
+		return retval;
+	}

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-26 13:17:05 +01:00
Joe Perches 031366ea65 staging: rts5208: Remove TRACE_RET and TRACE_GOTO macros
Remove these flow hiding macros.

Miscellanea:

o Add a macro and function to replace a large inline
o Simplify #includes
o Add trace.c and update Makefile
o Remove static inline filename function and use kbasename instead

This reduces object size quite a lot: ~350KB (x86-64 allyesconfig)

$ size drivers/staging/rts5208/built-in.o*
   text	   data	    bss	    dec	    hex	filename
 248385	  36728	  77888	 363001	  589f9	drivers/staging/rts5208/built-in.o.new
 506691	  83352	 115896	 705939	  ac593	drivers/staging/rts5208/built-in.o.old

Done via coccinelle script and some typing.

@@
expression chip;
expression ret;
@@

-	TRACE_RET(chip, ret);
+	rtsx_trace(chip);
+	return ret;

@@
expression chip;
identifier label;
@@

-	TRACE_GOTO(chip, label);
+	rtsx_trace(chip);
+	goto label;

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-26 13:16:19 +01:00
Quentin Lambert 11201769d1 staging: rts5208: Convert variable from int to bool and propagate the change to function parameters
This patch convert local variables declared as int into booleans.
It also propagates the conversion when these variables were used
as function parameters.

Coccinelle was used to generate this patch.

Signed-off-by: Quentin Lambert <lambert.quentin@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-06 17:25:01 -08:00
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
Tina Johnson 767c6a552b Staging: rts5208: Fix checkpatch warning: Missing blank line
The following checkpatch warning was fixed :

WARNING: Missing a blank line after declarations

Signed-off-by: Tina Johnson <tinajohnson.1234@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-23 13:22:25 -07:00
Fabio Falzoi a855861d57 Staging: rts5208: Remove CONFIG_RTS5208_DEBUG option
CONFIG_RTS5208_DEBUG is no more needed, we rely on dynamic debug config options
instead.

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 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 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