History log of /linux-master/drivers/staging/rts5208/sd.c
Revision Date Author Comments
# 93bc49d6 16-Jul-2023 Cyrus Ramavarapu <cyrus.ramavarapu@gmail.com>

staging: rts5208: Correct line ending with '('

Adhere to Linux kernel coding style.

Reported by checkpatch:

CHECK: Lines should not end with a '('

Signed-off-by: Cyrus Ramavarapu <cyrus.ramavarapu@gmail.com>
Link: https://lore.kernel.org/r/20230716223905.2187-1-cyrus.ramavarapu@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 0c04b83d 17-Oct-2022 Tanjuate Brunostar <tanjubrunostar0@gmail.com>

staging: rts5208: split long line of code

Fix checkpatch warning by splitting up a long line of code, improving
code readability

Signed-off-by: Tanjuate Brunostar <tanjubrunostar0@gmail.com>
Acked-by: Julia Lawall <julia.lawall@inria.fr>
Link: https://lore.kernel.org/r/Y06Vsr7JVvpPem5T@elroy-temp-vm.gaiao0uenmiufjlowqgp5yxwdh.gvxx.internal.cloudapp.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 51a72ec7 21-Sep-2021 Benjamin Philip <benjamin.philip495@gmail.com>

staging: rts5208: remove parentheses pair in sd.c

I had missed a single parentheses pair in the commit for sd.c.
This commit removes the pair I missed.

Signed-off-by: Benjamin Philip <benjamin.philip495@gmail.com>
Link: https://lore.kernel.org/r/4a56facd2c04a321b091d3b7dbea87168e8ddd6e.1632209460.git.benjamin.philip495@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 53e8b740 21-Sep-2021 Benjamin Philip <benjamin.philip495@gmail.com>

staging: rts5208: remove unnecessary parentheses in sd.c

This commit removes unnecessary parentheses, that have been flagged
by checkpatch.pl in sd.c

Signed-off-by: Benjamin Philip <benjamin.philip495@gmail.com>
Link: https://lore.kernel.org/r/b96aa1a0d9b306566a54d4b4643c06c520877042.1632209460.git.benjamin.philip495@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 2e63a4a4 30-Aug-2019 Colin Ian King <colin.king@canonical.com>

staging: rts5208: remove redundant sd30_mode checks

There are two hunks of code that check if sd30_mode is true however
an earlier check in an outer code block on sd30_mode being false means
that sd30_mode can never be true at these points so these checks are
redundant. Remove the dead code.

Addresses-Coverity: ("Logically dead code")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Link: https://lore.kernel.org/r/20190830081047.13630-1-colin.king@canonical.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 34a49d9e 26-Jun-2019 Tobias Nießen <tobias.niessen@stud.uni-hannover.de>

staging: rts5208: Rewrite redundant if statement to improve code style

This commit uses the fact that

if (a) {
if (b) {
...
}
}

can instead be written as

if (a && b) {
...
}

without any change in behavior, allowing to decrease the indentation
of the contained code block and thus reducing the average line length.

Signed-off-by: Tobias Nießen <tobias.niessen@stud.uni-hannover.de>
Signed-off-by: Sabrina Gaube <sabrina-gaube@web.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# e5dc970e 19-Jun-2019 Nishka Dasgupta <nishkadg.linux@gmail.com>

staging: rts5208: Remove function soft_reset_sd_card()

Remove function soft_reset_sd_card, as all it does is call reset_sd.
Modify call sites of the former to call the latter instead.
Issue found with Coccinelle.

Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# c8c27024 05-Jan-2019 Aditya Pakki <pakki001@umn.edu>

Staging: rts5208: Fix error handling on rtsx_send_cmd

In sd_execute_write_data, the rtsx_send_cmd could fail with ETIMEDOUT
or EIO. The fix adds a check to handle these failures.

Signed-off-by: Aditya Pakki <pakki001@umn.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# bb1e6779 22-Oct-2018 Kim Bradley <kim.jamie.bradley@gmail.com>

Staging: rts5208: Add SPDX license tags

Add SPDX license tags to remove checkpatch SPDX warnings.

Signed-off-by: Kim Bradley <kim.jamie.bradley@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 9f902b49 20-Sep-2018 Aymen Qader <qader.aymen@gmail.com>

staging: rts5208: Remove unnecessary braces {}

This patch fixes the checkpatch.pl warning "braces {} are not necessary"
in the rts5208 driver. Mostly applies to single-line return/goto if
blocks.

Signed-off-by: Aymen Qader <qader.aymen@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# c5fae4f4 02-Jul-2018 Colin Ian King <colin.king@canonical.com>

staging: rts5208: fix missing error check on call to rtsx_write_register

Currently the check on error return from the call to rtsx_write_register
is checking the error status from the previous call. Fix this by adding
in the missing assignment of retval.

Detected by CoverityScan, CID#709877

Fixes: fa590c222fba ("staging: rts5208: add support for rts5208 and rts5288")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# c238d7b1 18-Jun-2018 Arnd Bergmann <arnd@arndb.de>

staging: rtsx: remove rtsx_trace() and related code

The driver has rather excessive amount of tracing code, which would be
better done using ftrace. This is obviously not a main feature of the
driver, and it should work just as well without it.

Removing it saves over 1300 lines of code and likely makes the driver
a bit faster by avoiding lots of calls into the timekeeping code.

I came across this while cleaning up the last users of the deprecated
getnstimeofday64() function, of which there is one in the now-removed
get_current_time() function of the rtsx driver that was only used for
tracing.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 58930cce 05-Sep-2017 Arnd Bergmann <arnd@arndb.de>

staging: rts5208: fix gcc-8 logic error warning

As gcc-8 points out, the bit mask check makes no sense here:

drivers/staging/rts5208/sd.c: In function 'ext_sd_send_cmd_get_rsp':
drivers/staging/rts5208/sd.c:4130:25: error: bitwise comparison always evaluates to true [-Werror=tautological-compare]

However, the code is even more bogus, as we have already
checked for the SD_RSP_TYPE_R0 case earlier in the function
and returned success. As seen in the mmc/sd driver core,
SD_RSP_TYPE_R0 means "no response" anyway, so checking for
a particular response would not help either.

This just removes the nonsensical code to get rid of the
warning.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# da7ca1e0 30-Aug-2017 Colin Ian King <colin.king@canonical.com>

staging: rts5208: rename mmc_ddr_tunning_rx_cmd to mmc_ddr_tuning_rx_cmd

Trival fix to spelling mistake in function name

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 2d772591 20-Jul-2017 Gaurav Pathak <gauravpathak129@gmail.com>

staging: rts5208: Change fixed function names with "%s: ", __func__

staging: rts5208: Fix coding style issue caught by checkpatch.pl related to
function name in debug print

Signed-off-by: Gaurav Pathak <gauravpathak129@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# ed99f014 31-May-2017 Jia-Ju Bai <baijiaju1990@163.com>

rts5208: Fix a sleep-in-atomic bug in rtsx_exclusive_enter_ss

The driver may sleep under a spin lock, and the function call path is:
rtsx_exclusive_enter_ss (acquire the lock by spin_lock)
rtsx_enter_ss
rtsx_power_off_card
sd_cleanup_work
sd_stop_seq_mode
sd_switch_clock
sd_ddr_tuning
sd_ddr_pre_tuning_tx
sd_change_phase
wait_timeout
schedule_timeout --> may sleep

To fix it, "wait_timeout" is replaced with mdelay in sd_change_phase.

Signed-off-by: Jia-Ju Bai <baijiaju1990@163.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 385cab7c 31-May-2017 Jia-Ju Bai <baijiaju1990@163.com>

rts5208: Fix a sleep-in-atomic bug in sd_power_off_card3v3

The driver may sleep under a spin lock, and the function call path is:
rtsx_exclusive_enter_ss (acquire the lock by spin_lock)
rtsx_enter_ss
rtsx_power_off_card
sd_power_off_card3v3
wait_timeout
schedule_timeout --> may sleep

To fix it, "wait_timeout" is replaced with mdelay in sd_power_off_card3v3.

Signed-off-by: Jia-Ju Bai <baijiaju1990@163.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# fe421a75 11-Oct-2016 Wayne Porter <wporter82@gmail.com>

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>


# 3c377644 11-Oct-2016 Wayne Porter <wporter82@gmail.com>

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>


# 57a3fcfa 11-Oct-2016 Wayne Porter <wporter82@gmail.com>

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>


# 7fbe04f1 11-Oct-2016 Wayne Porter <wporter82@gmail.com>

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>


# 20390dc7 11-Oct-2016 Wayne Porter <wporter82@gmail.com>

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>


# 33f2b121 11-Oct-2016 Wayne Porter <wporter82@gmail.com>

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>


# e040b626 23-Sep-2016 Sergio Paracuellos <sergio.paracuellos@gmail.com>

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>


# 03282179 20-Sep-2016 Rehas Sachdeva <aquannie@gmail.com>

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>


# d5b7d2b0 30-Jul-2016 Jonas Rickert <jrickertkc@gmail.com>

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>


# 649b55b4 05-Apr-2016 Nicholas Sim <nicholassimws@gmail.com>

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>


# 7586170c 27-Feb-2016 Eva Rachel Retuya <eraretuya@gmail.com>

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>


# eff8bf82 26-Feb-2016 Bhumika Goyal <bhumirks@gmail.com>

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>


# 3b15cfbb 13-Feb-2016 Janani Ravichandran <janani.rvchndrn@gmail.com>

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>


# 66e6d70d 03-Aug-2015 Yash Shah <yshah1@visteon.com>

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>


# 364b91be 01-Jul-2015 Leung Timothy Chi King <contact@timothyleung.co>

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>


# 8ee775f9 25-Mar-2015 Joe Perches <joe@perches.com>

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>


# 031366ea 25-Mar-2015 Joe Perches <joe@perches.com>

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>


# 11201769 04-Mar-2015 Quentin Lambert <lambert.quentin@gmail.com>

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>


# de904bf0 04-Mar-2015 Quentin Lambert <lambert.quentin@gmail.com>

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>


# 767c6a55 21-Sep-2014 Tina Johnson <tinajohnson.1234@gmail.com>

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>


# a855861d 05-Aug-2014 Fabio Falzoi <fabio.falzoi84@gmail.com>

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>


# 69b8b224 05-Aug-2014 Fabio Falzoi <fabio.falzoi84@gmail.com>

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>


# bf6c0d11 29-Jul-2014 Fabio Falzoi <fabio.falzoi84@gmail.com>

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>


# fa590c22 12-Nov-2013 Micky Ching <micky_ching@realsil.com.cn>

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>