Commit graph

21 commits

Author SHA1 Message Date
Omri Arad 3331f9cbdd drivers: staging: rts5208: fix endianness handling
'cb' and 'sgb' were assigned __le values but were not marked as such,
this fixes the following sparse warnings:

drivers/staging/rts5208/rtsx_transport.c:220:34: warning: incorrect type in assignment (different base types)
drivers/staging/rts5208/rtsx_transport.c:220:34:    expected unsigned int [unsigned] [usertype] <noident>
drivers/staging/rts5208/rtsx_transport.c:220:34:    got restricted __le32 [usertype] <noident>
drivers/staging/rts5208/rtsx_transport.c:319:44: warning: incorrect type in assignment (different base types)
drivers/staging/rts5208/rtsx_transport.c:319:44:    expected unsigned long long [unsigned] [long] [long long] [usertype] <noident>
drivers/staging/rts5208/rtsx_transport.c:319:44:    got restricted __le64 [usertype] <noident>
drivers/staging/rts5208/rtsx_transport.c:319:44: warning: incorrect type in assignment (different base types)
drivers/staging/rts5208/rtsx_transport.c:319:44:    expected unsigned long long [unsigned] [long] [long long] [usertype] <noident>
drivers/staging/rts5208/rtsx_transport.c:319:44:    got restricted __le64 [usertype] <noident>

Signed-off-by: Omri Arad <omriarad3@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-01-16 18:08:57 +01:00
Janani Ravichandran 51a4731133 staging: rts5208: rtsx_transport.c: Drop void pointer cast
Void pointers need not be cast to other pointer types.
Semantic patch used:

@r@
expression x;
void *e;
type T;
identifier f;
@@

(
  *((T *)e)
|
  ((T *)x) [...]
|
  ((T *)x)->f
|
- (T *)
  e
)

Signed-off-by: Janani Ravichandran <janani.rvchndrn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Bhaktipriya Shridhar 040fa2217c staging: rts5208: Prefer using BIT macro
Replace all instances of bit shifting on 1 with the BIT(x) macro.
This was done using Coccinelle.

@@ int c; @@
- (1 << c)
+ BIT(c)

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Shaun Ren 50dcad2a2c Staging: rts5208: rtsx_transport.c: Fix comparisons to NULL
This patch changes all comparsions to NULL with !..., as reported by
checkpatch.pl.

Signed-off-by: Shaun Ren <shaun.ren@linux.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-20 15:35:42 -08:00
Shaun Ren 69e3bc543c Staging: rts5208: rtsx_transport.c: Remove unnecessary parentheses
This patch removes all unnecessary parentheses found by checkpatch.pl.

Signed-off-by: Shaun Ren <shaun.ren@linux.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-20 15:35:42 -08:00
Shaun Ren c1a018eee3 Staging: rts5208: rtsx_transport.c: Fix label naming convention
This patch fixes the following naming convention issue in rtsx_transport.c,
as reported by checkpatch.pl:

CHECK: Avoid CamelCase: <Handle_Errors>

Signed-off-by: Shaun Ren <shaun.ren@linux.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-20 15:35:42 -08:00
Shaun Ren 4961c44e4b Staging: rts5208: rtsx_transport.c: Remove extra newlines
This patch fixes the following issues in rtsx_transport.c as reported by
checkpatch.pl:

CHECK: Blank lines aren't necessary after an open brace '{'
CHECK: Please don't use multiple blank lines

Signed-off-by: Shaun Ren <shaun.ren@linux.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-20 15:35:42 -08:00
Shaun Ren 010c7d2ffb Staging: rts5208: rtsx_transport.c: Add spaces around -
This patch fixes the following styling issue in rtsx_transport.c
as reported by checkpatch.pl:

CHECK: spaces preferred around that '-' (ctx:VxV)

Signed-off-by: Shaun Ren <shaun.ren@linux.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-20 15:35:42 -08:00
Shaun Ren 53374ad203 Staging: rts5208: rtsx_transport.c: Remove spaces after casts
This patch removes all spaces after casts in rtsx_transport.c, as reported
by checkpatch.pl:

CHECK: No space is necessary after a cast

Signed-off-by: Shaun Ren <shaun.ren@linux.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-20 15:35:42 -08:00
Shaun Ren d1303c1a9a Staging: rts5208: rtsx_transport.c: Align to open parenthesis
This patch fixes the alignment issue reported by checkpatch.pl:

CHECK: Alignment should match open parenthesis

Add a unsigned char *sgbuffer in rtsx_stor_access_xfer_buffer to make the
following memcpy logic easier to read.

Add a struct scatterlist *sg in the use_sg branch of
rtsx_transfer_data_partial to make the parameters of the
rtsx_transfer_sglist_adma_partial call fit in 80 character lines after
aligning them to the open parenthesis.

Refactor memcpy logic in rtsx_stor_access_xfer_buf to make it more legible.

Signed-off-by: Shaun Ren <shaun.ren@linux.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-20 15:35:42 -08:00
Shaun Ren 64cfe606e5 Staging: rts5208: rtsx_transport.c: Cleanup comments
This patch fixes all multiline comments to conform to the coding style,
which states that multiline comments should start with "/*" and end
with "*/" on a separate line.

Also cleans up some comments to make them more clear and/or reflect what
the code is doing.

Signed-off-by: Shaun Ren <shaun.ren@linux.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-20 15:35:42 -08:00
Haneen Mohammed b3232842db Staging: rts5208: remove unnecessary parantheses
This patch removes unnecessary parantheses around rtsx->pci->dev.

Signed-off-by: Haneen Mohammed <hamohammed.sa@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-09 17:43:09 -08:00
Haneen Mohammed 9a66d05d82 Staging: rts5208: fix check for dma mapping error
use dma_mapping_error() instead of comparing the returned address with
zero after dma_map_single().

Signed-off-by: Haneen Mohammed <hamohammed.sa@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-09 17:43:09 -08: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
Aya Mahfouz 5a80ee6f88 staging: rts5208: remove extra parentheses around left bit shift operation
Removes extra parentheses around bitwise left shift operations.
The case handled is when resultant value is assigned to a variable.
The issue was detected and resolved using the following
coccinelle script:

@@
expression e, e1;
constant c;
@@

e =
-(e1
+e1
<<
-c);
+c;

@@
identifier i;
constant c;
type t;
expression e;
@@

t i =
-(e
+e
<<
-c);
+c;

@@
expression e, e1;
identifier f;
constant c;
@@

e1 = f(...,
-(e
+e
<<
-c)
+c
,...);

Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-06 15:24:23 -08:00
Nicholas Mc Guire 9df56d9bde staging: rts5208: use msecs_to_jiffies for timeouts
This is only an API consolidation and should make things more readable

Converting milliseconds to jiffies by val * HZ / 1000 is technically
not wrong but msecs_to_jiffies(val) is the cleaner solution and handles
corner cases correctly.

Signed-off-by: Nicholas Mc Guire <der.herr@hofr.at>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-01-25 19:59:19 +08:00
Surya Seetharaman 87a979318f Staging: rts5028: rtsx_transport.c: fixed a brace coding style issue.
Removed unwanted braces using checkpatch.pl tool.

Signed-off-by: Surya Seetharaman <suryaseetharaman.9@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-10-28 15:58:18 +08:00
Tina Johnson 9fd4af8ab4 Staging: rts5208: Removed unnecessary parentheses
Unnecessary parentheses around the right hand side of an assignment
is removed using the following semantic patch:

@@
identifier x,f;
constant C;
@@
(
-x = (f / C );
+x = f / C ;
|
-x = (f % C );
+x = f % C ;
)

Signed-off-by: Tina Johnson <tinajohnson.1234@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-10-28 15:58:17 +08: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
Keerthimai Janarthanan 1b67070565 staging: rts5208: Fixed line over 80 characters.
Fixes the following checkpatch warning:
WARNING: line over 80 characters.

Signed-off-by: Keerthimai Janarthanan <keerthimaipb@gmail.com>
Reviewed-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-03-08 20:31:53 -08: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