* [PATCH 0/8 V2] staging: rts5208: Fix several style warnings
@ 2016-09-23 14:12 Sergio Paracuellos
2016-09-23 14:12 ` [PATCH 1/8 V2] staging: rts5208: avoid new typedef in rtsx.h: rtsx_dev_t Sergio Paracuellos
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: Sergio Paracuellos @ 2016-09-23 14:12 UTC (permalink / raw)
To: gregkh; +Cc: bhumirks, jrickertkc, devel, linux-kernel
This patchset fix several style warnings reported by checkpatch.pl script.
Changes V2:
* Fix commit subject names to be more specific
Sergio Paracuellos (8):
staging: rts5208: avoid new typedef in rtsx.h: rtsx_dev_t
staging: rts5208: avoid symbolic permissions in rtsx.c
staging: rts5208: fix comment blocks style in rtsx_chip.h
staging: rts5208: fix comment blocks style in rtsx.h
staging: rts5208: remove not used typedef in rtsx_sys.h
staging: rts5208: fix line style warnings in spi.c
staging: rts5208: fix style warnings in sd.c
staging: rts5208: fix style warnings in xd.c
drivers/staging/rts5208/rtsx.c | 12 +--
drivers/staging/rts5208/rtsx.h | 10 +--
drivers/staging/rts5208/rtsx_chip.h | 54 +++++------
drivers/staging/rts5208/rtsx_sys.h | 2 -
drivers/staging/rts5208/sd.c | 173 +++++++++++++-----------------------
drivers/staging/rts5208/spi.c | 3 +-
drivers/staging/rts5208/xd.c | 38 +++-----
7 files changed, 115 insertions(+), 177 deletions(-)
--
1.9.1
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/8 V2] staging: rts5208: avoid new typedef in rtsx.h: rtsx_dev_t
2016-09-23 14:12 [PATCH 0/8 V2] staging: rts5208: Fix several style warnings Sergio Paracuellos
@ 2016-09-23 14:12 ` Sergio Paracuellos
2016-09-23 14:12 ` [PATCH 2/8 V2] staging: rts5208: avoid symbolic permissions in rtsx.c Sergio Paracuellos
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Sergio Paracuellos @ 2016-09-23 14:12 UTC (permalink / raw)
To: gregkh; +Cc: bhumirks, jrickertkc, devel, linux-kernel
This patch fixes the following checkpatch.pl warning in rtsx.h:
WARNING: do not add new typedefs
It also remove DELAY_PARA_T because code is not using it.
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
---
drivers/staging/rts5208/rtsx.h | 4 ----
drivers/staging/rts5208/rtsx_chip.h | 2 +-
2 files changed, 1 insertion(+), 5 deletions(-)
diff --git a/drivers/staging/rts5208/rtsx.h b/drivers/staging/rts5208/rtsx.h
index 7a21e46..2de4719 100644
--- a/drivers/staging/rts5208/rtsx.h
+++ b/drivers/staging/rts5208/rtsx.h
@@ -88,8 +88,6 @@
#define SCSI_LUN(srb) ((srb)->device->lun)
-typedef unsigned long DELAY_PARA_T;
-
struct rtsx_chip;
struct rtsx_dev {
@@ -130,8 +128,6 @@ struct rtsx_dev {
struct rtsx_chip *chip;
};
-typedef struct rtsx_dev rtsx_dev_t;
-
/* Convert between rtsx_dev and the corresponding Scsi_Host */
static inline struct Scsi_Host *rtsx_to_host(struct rtsx_dev *dev)
{
diff --git a/drivers/staging/rts5208/rtsx_chip.h b/drivers/staging/rts5208/rtsx_chip.h
index 132c2e6..6ef34fa 100644
--- a/drivers/staging/rts5208/rtsx_chip.h
+++ b/drivers/staging/rts5208/rtsx_chip.h
@@ -683,7 +683,7 @@ struct trace_msg_t {
#define CLR_SDIO_IGNORED(chip) ((chip)->sdio_func_exist &= ~SDIO_IGNORED)
struct rtsx_chip {
- rtsx_dev_t *rtsx;
+ struct rtsx_dev *rtsx;
u32 int_reg; /* Bus interrupt pending register */
char max_lun;
--
1.9.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/8 V2] staging: rts5208: avoid symbolic permissions in rtsx.c
2016-09-23 14:12 [PATCH 0/8 V2] staging: rts5208: Fix several style warnings Sergio Paracuellos
2016-09-23 14:12 ` [PATCH 1/8 V2] staging: rts5208: avoid new typedef in rtsx.h: rtsx_dev_t Sergio Paracuellos
@ 2016-09-23 14:12 ` Sergio Paracuellos
2016-09-23 14:12 ` [PATCH 3/8 V2] staging: rts5208: fix comment blocks style in rtsx_chip.h Sergio Paracuellos
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Sergio Paracuellos @ 2016-09-23 14:12 UTC (permalink / raw)
To: gregkh; +Cc: bhumirks, jrickertkc, devel, linux-kernel
This patch fixes the following checkpatch.pl warning in rtsx.c:
WARNING: Symbolic permissions are not preferred.
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
---
drivers/staging/rts5208/rtsx.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/staging/rts5208/rtsx.c b/drivers/staging/rts5208/rtsx.c
index d7554f4..5d65a5c 100644
--- a/drivers/staging/rts5208/rtsx.c
+++ b/drivers/staging/rts5208/rtsx.c
@@ -34,27 +34,27 @@
MODULE_LICENSE("GPL");
static unsigned int delay_use = 1;
-module_param(delay_use, uint, S_IRUGO | S_IWUSR);
+module_param(delay_use, uint, 0644);
MODULE_PARM_DESC(delay_use, "seconds to delay before using a new device");
static int ss_en;
-module_param(ss_en, int, S_IRUGO | S_IWUSR);
+module_param(ss_en, int, 0644);
MODULE_PARM_DESC(ss_en, "enable selective suspend");
static int ss_interval = 50;
-module_param(ss_interval, int, S_IRUGO | S_IWUSR);
+module_param(ss_interval, int, 0644);
MODULE_PARM_DESC(ss_interval, "Interval to enter ss state in seconds");
static int auto_delink_en;
-module_param(auto_delink_en, int, S_IRUGO | S_IWUSR);
+module_param(auto_delink_en, int, 0644);
MODULE_PARM_DESC(auto_delink_en, "enable auto delink");
static unsigned char aspm_l0s_l1_en;
-module_param(aspm_l0s_l1_en, byte, S_IRUGO | S_IWUSR);
+module_param(aspm_l0s_l1_en, byte, 0644);
MODULE_PARM_DESC(aspm_l0s_l1_en, "enable device aspm");
static int msi_en;
-module_param(msi_en, int, S_IRUGO | S_IWUSR);
+module_param(msi_en, int, 0644);
MODULE_PARM_DESC(msi_en, "enable msi");
static irqreturn_t rtsx_interrupt(int irq, void *dev_id);
--
1.9.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 3/8 V2] staging: rts5208: fix comment blocks style in rtsx_chip.h
2016-09-23 14:12 [PATCH 0/8 V2] staging: rts5208: Fix several style warnings Sergio Paracuellos
2016-09-23 14:12 ` [PATCH 1/8 V2] staging: rts5208: avoid new typedef in rtsx.h: rtsx_dev_t Sergio Paracuellos
2016-09-23 14:12 ` [PATCH 2/8 V2] staging: rts5208: avoid symbolic permissions in rtsx.c Sergio Paracuellos
@ 2016-09-23 14:12 ` Sergio Paracuellos
2016-09-23 14:12 ` [PATCH 4/8 V2] staging: rts5208: fix comment blocks style in rtsx.h Sergio Paracuellos
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Sergio Paracuellos @ 2016-09-23 14:12 UTC (permalink / raw)
To: gregkh; +Cc: bhumirks, jrickertkc, devel, linux-kernel
This patch fixes the following checkpatch.pl warning in rtsx_chip.h:
WARNING: Block comments use a trailing */ on a separate line
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
---
drivers/staging/rts5208/rtsx_chip.h | 52 +++++++++++++++++++------------------
1 file changed, 27 insertions(+), 25 deletions(-)
diff --git a/drivers/staging/rts5208/rtsx_chip.h b/drivers/staging/rts5208/rtsx_chip.h
index 6ef34fa..f366428 100644
--- a/drivers/staging/rts5208/rtsx_chip.h
+++ b/drivers/staging/rts5208/rtsx_chip.h
@@ -44,8 +44,10 @@
#define MG_SET_ICV_SLOW
/* HW may miss ERR/CMDNK signal when sampling INT status. */
#define MS_SAMPLE_INT_ERR
- /* HW DO NOT support Wait_INT function during READ_BYTES
- * transfer mode */
+ /*
+ * HW DO NOT support Wait_INT function
+ * during READ_BYTES transfer mode
+ */
#define READ_BYTES_WAIT_INT
#endif
@@ -101,17 +103,17 @@
#define TRANSPORT_NO_SENSE 2 /* Command failed, no auto-sense */
#define TRANSPORT_ERROR 3 /* Transport bad (i.e. device dead) */
-/*-----------------------------------
- Start-Stop-Unit
------------------------------------*/
+/*
+ * Start-Stop-Unit
+ */
#define STOP_MEDIUM 0x00 /* access disable */
#define MAKE_MEDIUM_READY 0x01 /* access enable */
#define UNLOAD_MEDIUM 0x02 /* unload */
#define LOAD_MEDIUM 0x03 /* load */
-/*-----------------------------------
- STANDARD_INQUIRY
------------------------------------*/
+/*
+ * STANDARD_INQUIRY
+ */
#define QULIFIRE 0x00
#define AENC_FNC 0x00
#define TRML_IOP 0x00
@@ -128,17 +130,15 @@
#define PRDCT_REV_LEN 4 /* Product LOT Length */
/* Dynamic flag definitions: used in set_bit() etc. */
-#define RTSX_FLIDX_TRANS_ACTIVE 18 /* 0x00040000 transfer is active */
-#define RTSX_FLIDX_ABORTING 20 /* 0x00100000 abort is in
- * progress */
-#define RTSX_FLIDX_DISCONNECTING 21 /* 0x00200000 disconnect
- * in progress */
+#define RTSX_FLIDX_TRANS_ACTIVE 18 /* 0x00040000 transfer is active */
+#define RTSX_FLIDX_ABORTING 20 /* 0x00100000 abort is in progress */
+#define RTSX_FLIDX_DISCONNECTING 21 /* 0x00200000 disconnect in progress */
+
#define ABORTING_OR_DISCONNECTING ((1UL << US_FLIDX_ABORTING) | \
(1UL << US_FLIDX_DISCONNECTING))
-#define RTSX_FLIDX_RESETTING 22 /* 0x00400000 device reset
- * in progress */
-#define RTSX_FLIDX_TIMED_OUT 23 /* 0x00800000 SCSI
- * midlayer timed out */
+
+#define RTSX_FLIDX_RESETTING 22 /* 0x00400000 device reset in progress */
+#define RTSX_FLIDX_TIMED_OUT 23 /* 0x00800000 SCSI midlayer timed out */
#define DRCT_ACCESS_DEV 0x00 /* Direct Access Device */
#define RMB_DISC 0x80 /* The Device is Removable */
@@ -173,9 +173,9 @@
#define FIRST_RESET 0x01
#define USED_EXIST 0x02
-/*-----------------------------------
- SENSE_DATA
------------------------------------*/
+/*
+ * SENSE_DATA
+ */
/*---- valid ----*/
#define SENSE_VALID 0x80 /* Sense data is valid as SCSI2 */
#define SENSE_INVALID 0x00 /* Sense data is invalid as SCSI2 */
@@ -706,9 +706,9 @@ struct rtsx_chip {
int cur_card;
unsigned long need_release; /* need release bit map */
- unsigned long need_reset; /* need reset
- * bit map */
- /* Flag to indicate that this card is just resumed from SS state,
+ unsigned long need_reset; /* need reset bit map */
+ /*
+ * Flag to indicate that this card is just resumed from SS state,
* and need released before being resetted
*/
unsigned long need_reinit;
@@ -726,8 +726,10 @@ struct rtsx_chip {
u8 card_ejected; /* card ejected bit map */
u8 card_wp; /* card write protected bit map */
- u8 lun_mc; /* flag to indicate whether to answer
- * MediaChange */
+ u8 lun_mc; /*
+ * flag to indicate whether to answer
+ * MediaChange
+ */
#ifndef LED_AUTO_BLINK
int led_toggle_counter;
--
1.9.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 4/8 V2] staging: rts5208: fix comment blocks style in rtsx.h
2016-09-23 14:12 [PATCH 0/8 V2] staging: rts5208: Fix several style warnings Sergio Paracuellos
` (2 preceding siblings ...)
2016-09-23 14:12 ` [PATCH 3/8 V2] staging: rts5208: fix comment blocks style in rtsx_chip.h Sergio Paracuellos
@ 2016-09-23 14:12 ` Sergio Paracuellos
2016-09-23 14:12 ` [PATCH 5/8 V2] staging: rts5208: remove not used typedef in rtsx_sys.h Sergio Paracuellos
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Sergio Paracuellos @ 2016-09-23 14:12 UTC (permalink / raw)
To: gregkh; +Cc: bhumirks, jrickertkc, devel, linux-kernel
This patch fixes the following checkpatch.pl warning in rtsx.h:
WARNING: Block comments use a trailing */ on a separate line
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
---
drivers/staging/rts5208/rtsx.h | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/rts5208/rtsx.h b/drivers/staging/rts5208/rtsx.h
index 2de4719..e725b10 100644
--- a/drivers/staging/rts5208/rtsx.h
+++ b/drivers/staging/rts5208/rtsx.h
@@ -161,8 +161,10 @@ static inline void get_current_time(u8 *timeval_buf, int buf_len)
timeval_buf[7] = (u8)(tv_usec);
}
-/* The scsi_lock() and scsi_unlock() macros protect the sm_state and the
- * single queue element srb for write access */
+/*
+ * The scsi_lock() and scsi_unlock() macros protect the sm_state and the
+ * single queue element srb for write access
+ */
#define scsi_unlock(host) spin_unlock_irq(host->host_lock)
#define scsi_lock(host) spin_lock_irq(host->host_lock)
--
1.9.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 5/8 V2] staging: rts5208: remove not used typedef in rtsx_sys.h
2016-09-23 14:12 [PATCH 0/8 V2] staging: rts5208: Fix several style warnings Sergio Paracuellos
` (3 preceding siblings ...)
2016-09-23 14:12 ` [PATCH 4/8 V2] staging: rts5208: fix comment blocks style in rtsx.h Sergio Paracuellos
@ 2016-09-23 14:12 ` Sergio Paracuellos
2016-09-23 14:12 ` [PATCH 6/8 V2] staging: rts5208: fix line style warnings in spi.c Sergio Paracuellos
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Sergio Paracuellos @ 2016-09-23 14:12 UTC (permalink / raw)
To: gregkh; +Cc: bhumirks, jrickertkc, devel, linux-kernel
This patch fixes the following checkpatch.pl warning in rtsx_sys.h:
WARNING: do not add new typedefs
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
---
drivers/staging/rts5208/rtsx_sys.h | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/staging/rts5208/rtsx_sys.h b/drivers/staging/rts5208/rtsx_sys.h
index 0b6b4d4..f49bed9 100644
--- a/drivers/staging/rts5208/rtsx_sys.h
+++ b/drivers/staging/rts5208/rtsx_sys.h
@@ -28,8 +28,6 @@
#include "rtsx_chip.h"
#include "rtsx_card.h"
-typedef dma_addr_t ULONG_PTR;
-
static inline void rtsx_exclusive_enter_ss(struct rtsx_chip *chip)
{
struct rtsx_dev *dev = chip->rtsx;
--
1.9.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 6/8 V2] staging: rts5208: fix line style warnings in spi.c
2016-09-23 14:12 [PATCH 0/8 V2] staging: rts5208: Fix several style warnings Sergio Paracuellos
` (4 preceding siblings ...)
2016-09-23 14:12 ` [PATCH 5/8 V2] staging: rts5208: remove not used typedef in rtsx_sys.h Sergio Paracuellos
@ 2016-09-23 14:12 ` Sergio Paracuellos
2016-09-23 14:12 ` [PATCH 7/8 V2] staging: rts5208: fix style warnings in sd.c Sergio Paracuellos
2016-09-23 14:12 ` [PATCH 8/8 V2] staging: rts5208: fix style warnings in xd.c Sergio Paracuellos
7 siblings, 0 replies; 9+ messages in thread
From: Sergio Paracuellos @ 2016-09-23 14:12 UTC (permalink / raw)
To: gregkh; +Cc: bhumirks, jrickertkc, devel, linux-kernel
This patch fixes the following checkpatch.pl warning in spi.c:
WARNING: line over 80 characters
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
---
drivers/staging/rts5208/spi.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/staging/rts5208/spi.c b/drivers/staging/rts5208/spi.c
index 26eb2a1..13c539c 100644
--- a/drivers/staging/rts5208/spi.c
+++ b/drivers/staging/rts5208/spi.c
@@ -39,7 +39,8 @@ static int spi_init(struct rtsx_chip *chip)
int retval;
retval = rtsx_write_register(chip, SPI_CONTROL, 0xFF,
- CS_POLARITY_LOW | DTO_MSB_FIRST | SPI_MASTER | SPI_MODE0 | SPI_AUTO);
+ CS_POLARITY_LOW | DTO_MSB_FIRST
+ | SPI_MASTER | SPI_MODE0 | SPI_AUTO);
if (retval) {
rtsx_trace(chip);
return retval;
--
1.9.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 7/8 V2] staging: rts5208: fix style warnings in sd.c
2016-09-23 14:12 [PATCH 0/8 V2] staging: rts5208: Fix several style warnings Sergio Paracuellos
` (5 preceding siblings ...)
2016-09-23 14:12 ` [PATCH 6/8 V2] staging: rts5208: fix line style warnings in spi.c Sergio Paracuellos
@ 2016-09-23 14:12 ` Sergio Paracuellos
2016-09-23 14:12 ` [PATCH 8/8 V2] staging: rts5208: fix style warnings in xd.c Sergio Paracuellos
7 siblings, 0 replies; 9+ messages in thread
From: Sergio Paracuellos @ 2016-09-23 14:12 UTC (permalink / raw)
To: gregkh; +Cc: bhumirks, jrickertkc, devel, linux-kernel
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>
---
drivers/staging/rts5208/sd.c | 173 +++++++++++++++----------------------------
1 file changed, 61 insertions(+), 112 deletions(-)
diff --git a/drivers/staging/rts5208/sd.c b/drivers/staging/rts5208/sd.c
index e72c432..b0bbb36 100644
--- a/drivers/staging/rts5208/sd.c
+++ b/drivers/staging/rts5208/sd.c
@@ -2588,16 +2588,12 @@ static int reset_sd(struct rtsx_chip *chip)
#endif
retval = sd_prepare_reset(chip);
- if (retval != STATUS_SUCCESS) {
- rtsx_trace(chip);
- return STATUS_FAIL;
- }
+ if (retval != STATUS_SUCCESS)
+ goto Status_Fail;
retval = sd_dummy_clock(chip);
- if (retval != STATUS_SUCCESS) {
- rtsx_trace(chip);
- return STATUS_FAIL;
- }
+ if (retval != STATUS_SUCCESS)
+ goto Status_Fail;
if (CHK_SDIO_EXIST(chip) && !CHK_SDIO_IGNORED(chip) && try_sdio) {
int rty_cnt = 0;
@@ -2605,8 +2601,7 @@ static int reset_sd(struct rtsx_chip *chip)
for (; rty_cnt < chip->sdio_retry_cnt; rty_cnt++) {
if (detect_card_cd(chip, SD_CARD) != STATUS_SUCCESS) {
sd_set_err_code(chip, SD_NO_CARD);
- rtsx_trace(chip);
- return STATUS_FAIL;
+ goto Status_Fail;
}
retval = sd_send_cmd_get_rsp(chip, IO_SEND_OP_COND, 0,
@@ -2618,8 +2613,7 @@ static int reset_sd(struct rtsx_chip *chip)
dev_dbg(rtsx_dev(chip), "SD_IO card (Function number: %d)!\n",
func_num);
chip->sd_io = 1;
- rtsx_trace(chip);
- return STATUS_FAIL;
+ goto Status_Fail;
}
break;
@@ -2637,10 +2631,8 @@ static int reset_sd(struct rtsx_chip *chip)
RTY_SD_RST:
retval = sd_send_cmd_get_rsp(chip, GO_IDLE_STATE, 0, SD_RSP_TYPE_R0,
NULL, 0);
- if (retval != STATUS_SUCCESS) {
- rtsx_trace(chip);
- return STATUS_FAIL;
- }
+ if (retval != STATUS_SUCCESS)
+ goto Status_Fail;
wait_timeout(20);
@@ -2658,10 +2650,8 @@ static int reset_sd(struct rtsx_chip *chip)
retval = sd_send_cmd_get_rsp(chip, GO_IDLE_STATE, 0,
SD_RSP_TYPE_R0, NULL, 0);
- if (retval != STATUS_SUCCESS) {
- rtsx_trace(chip);
- return STATUS_FAIL;
- }
+ if (retval != STATUS_SUCCESS)
+ goto Status_Fail;
wait_timeout(20);
}
@@ -2672,39 +2662,32 @@ static int reset_sd(struct rtsx_chip *chip)
if (retval != STATUS_SUCCESS) {
if (detect_card_cd(chip, SD_CARD) != STATUS_SUCCESS) {
sd_set_err_code(chip, SD_NO_CARD);
- rtsx_trace(chip);
- return STATUS_FAIL;
+ goto Status_Fail;
}
j++;
- if (j < 3) {
+ if (j < 3)
goto RTY_SD_RST;
- } else {
- rtsx_trace(chip);
- return STATUS_FAIL;
- }
+ else
+ goto Status_Fail;
}
retval = sd_send_cmd_get_rsp(chip, SD_APP_OP_COND, voltage,
SD_RSP_TYPE_R3, rsp, 5);
if (retval != STATUS_SUCCESS) {
k++;
- if (k < 3) {
+ if (k < 3)
goto RTY_SD_RST;
- } else {
- rtsx_trace(chip);
- return STATUS_FAIL;
- }
+ else
+ goto Status_Fail;
}
i++;
wait_timeout(20);
} while (!(rsp[1] & 0x80) && (i < 255));
- if (i == 255) {
- rtsx_trace(chip);
- return STATUS_FAIL;
- }
+ if (i == 255)
+ goto Status_Fail;
if (hi_cap_flow) {
if (rsp[1] & 0x40)
@@ -2721,26 +2704,20 @@ static int reset_sd(struct rtsx_chip *chip)
if (support_1v8) {
retval = sd_voltage_switch(chip);
- if (retval != STATUS_SUCCESS) {
- rtsx_trace(chip);
- return STATUS_FAIL;
- }
+ if (retval != STATUS_SUCCESS)
+ goto Status_Fail;
}
retval = sd_send_cmd_get_rsp(chip, ALL_SEND_CID, 0, SD_RSP_TYPE_R2,
NULL, 0);
- if (retval != STATUS_SUCCESS) {
- rtsx_trace(chip);
- return STATUS_FAIL;
- }
+ if (retval != STATUS_SUCCESS)
+ goto Status_Fail;
for (i = 0; i < 3; i++) {
retval = sd_send_cmd_get_rsp(chip, SEND_RELATIVE_ADDR, 0,
SD_RSP_TYPE_R6, rsp, 5);
- if (retval != STATUS_SUCCESS) {
- rtsx_trace(chip);
- return STATUS_FAIL;
- }
+ if (retval != STATUS_SUCCESS)
+ goto Status_Fail;
sd_card->sd_addr = (u32)rsp[1] << 24;
sd_card->sd_addr += (u32)rsp[2] << 16;
@@ -2750,24 +2727,18 @@ static int reset_sd(struct rtsx_chip *chip)
}
retval = sd_check_csd(chip, 1);
- if (retval != STATUS_SUCCESS) {
- rtsx_trace(chip);
- return STATUS_FAIL;
- }
+ if (retval != STATUS_SUCCESS)
+ goto Status_Fail;
retval = sd_select_card(chip, 1);
- if (retval != STATUS_SUCCESS) {
- rtsx_trace(chip);
- return STATUS_FAIL;
- }
+ if (retval != STATUS_SUCCESS)
+ goto Status_Fail;
#ifdef SUPPORT_SD_LOCK
SD_UNLOCK_ENTRY:
retval = sd_update_lock_status(chip);
- if (retval != STATUS_SUCCESS) {
- rtsx_trace(chip);
- return STATUS_FAIL;
- }
+ if (retval != STATUS_SUCCESS)
+ goto Status_Fail;
if (sd_card->sd_lock_status & SD_LOCKED) {
sd_card->sd_lock_status |= (SD_LOCK_1BIT_MODE | SD_PWD_EXIST);
@@ -2779,32 +2750,24 @@ static int reset_sd(struct rtsx_chip *chip)
retval = sd_send_cmd_get_rsp(chip, APP_CMD, sd_card->sd_addr,
SD_RSP_TYPE_R1, NULL, 0);
- if (retval != STATUS_SUCCESS) {
- rtsx_trace(chip);
- return STATUS_FAIL;
- }
+ if (retval != STATUS_SUCCESS)
+ goto Status_Fail;
retval = sd_send_cmd_get_rsp(chip, SET_CLR_CARD_DETECT, 0,
SD_RSP_TYPE_R1, NULL, 0);
- if (retval != STATUS_SUCCESS) {
- rtsx_trace(chip);
- return STATUS_FAIL;
- }
+ if (retval != STATUS_SUCCESS)
+ goto Status_Fail;
if (support_1v8) {
retval = sd_send_cmd_get_rsp(chip, APP_CMD, sd_card->sd_addr,
SD_RSP_TYPE_R1, NULL, 0);
- if (retval != STATUS_SUCCESS) {
- rtsx_trace(chip);
- return STATUS_FAIL;
- }
+ if (retval != STATUS_SUCCESS)
+ goto Status_Fail;
retval = sd_send_cmd_get_rsp(chip, SET_BUS_WIDTH, 2,
SD_RSP_TYPE_R1, NULL, 0);
- if (retval != STATUS_SUCCESS) {
- rtsx_trace(chip);
- return STATUS_FAIL;
- }
+ if (retval != STATUS_SUCCESS)
+ goto Status_Fail;
switch_bus_width = SD_BUS_WIDTH_4;
} else {
@@ -2813,16 +2776,12 @@ static int reset_sd(struct rtsx_chip *chip)
retval = sd_send_cmd_get_rsp(chip, SET_BLOCKLEN, 0x200, SD_RSP_TYPE_R1,
NULL, 0);
- if (retval != STATUS_SUCCESS) {
- rtsx_trace(chip);
- return STATUS_FAIL;
- }
+ if (retval != STATUS_SUCCESS)
+ goto Status_Fail;
retval = sd_set_clock_divider(chip, SD_CLK_DIVIDE_0);
- if (retval != STATUS_SUCCESS) {
- rtsx_trace(chip);
- return STATUS_FAIL;
- }
+ if (retval != STATUS_SUCCESS)
+ goto Status_Fail;
if (!(sd_card->raw_csd[4] & 0x40))
sd_dont_switch = true;
@@ -2861,17 +2820,13 @@ static int reset_sd(struct rtsx_chip *chip)
if (!support_1v8) {
retval = sd_send_cmd_get_rsp(chip, APP_CMD, sd_card->sd_addr,
SD_RSP_TYPE_R1, NULL, 0);
- if (retval != STATUS_SUCCESS) {
- rtsx_trace(chip);
- return STATUS_FAIL;
- }
+ if (retval != STATUS_SUCCESS)
+ goto Status_Fail;
retval = sd_send_cmd_get_rsp(chip, SET_BUS_WIDTH, 2,
SD_RSP_TYPE_R1, NULL, 0);
- if (retval != STATUS_SUCCESS) {
- rtsx_trace(chip);
- return STATUS_FAIL;
- }
+ if (retval != STATUS_SUCCESS)
+ goto Status_Fail;
}
#ifdef SUPPORT_SD_LOCK
@@ -2889,10 +2844,8 @@ static int reset_sd(struct rtsx_chip *chip)
}
retval = sd_set_init_para(chip);
- if (retval != STATUS_SUCCESS) {
- rtsx_trace(chip);
- return STATUS_FAIL;
- }
+ if (retval != STATUS_SUCCESS)
+ goto Status_Fail;
if (CHK_SD_DDR50(sd_card))
retval = sd_ddr_tuning(chip);
@@ -2901,14 +2854,11 @@ static int reset_sd(struct rtsx_chip *chip)
if (retval != STATUS_SUCCESS) {
if (sd20_mode) {
- rtsx_trace(chip);
- return STATUS_FAIL;
+ goto Status_Fail;
} else {
retval = sd_init_power(chip);
- if (retval != STATUS_SUCCESS) {
- rtsx_trace(chip);
- return STATUS_FAIL;
- }
+ if (retval != STATUS_SUCCESS)
+ goto Status_Fail;
try_sdio = false;
sd20_mode = true;
@@ -2929,14 +2879,11 @@ static int reset_sd(struct rtsx_chip *chip)
retval = sd_read_lba0(chip);
if (retval != STATUS_SUCCESS) {
if (sd20_mode) {
- rtsx_trace(chip);
- return STATUS_FAIL;
+ goto Status_Fail;
} else {
retval = sd_init_power(chip);
- if (retval != STATUS_SUCCESS) {
- rtsx_trace(chip);
- return STATUS_FAIL;
- }
+ if (retval != STATUS_SUCCESS)
+ goto Status_Fail;
try_sdio = false;
sd20_mode = true;
@@ -2947,10 +2894,8 @@ static int reset_sd(struct rtsx_chip *chip)
}
retval = sd_check_wp_state(chip);
- if (retval != STATUS_SUCCESS) {
- rtsx_trace(chip);
- return STATUS_FAIL;
- }
+ if (retval != STATUS_SUCCESS)
+ goto Status_Fail;
chip->card_bus_width[chip->card2lun[SD_CARD]] = 4;
@@ -2972,6 +2917,10 @@ static int reset_sd(struct rtsx_chip *chip)
#endif
return STATUS_SUCCESS;
+
+Status_Fail:
+ rtsx_trace(chip);
+ return STATUS_FAIL;
}
static int mmc_test_switch_bus(struct rtsx_chip *chip, u8 width)
--
1.9.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 8/8 V2] staging: rts5208: fix style warnings in xd.c
2016-09-23 14:12 [PATCH 0/8 V2] staging: rts5208: Fix several style warnings Sergio Paracuellos
` (6 preceding siblings ...)
2016-09-23 14:12 ` [PATCH 7/8 V2] staging: rts5208: fix style warnings in sd.c Sergio Paracuellos
@ 2016-09-23 14:12 ` Sergio Paracuellos
7 siblings, 0 replies; 9+ messages in thread
From: Sergio Paracuellos @ 2016-09-23 14:12 UTC (permalink / raw)
To: gregkh; +Cc: bhumirks, jrickertkc, devel, linux-kernel
This patch fixes the following checkpatch.pl warning in xd.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>
---
drivers/staging/rts5208/xd.c | 38 ++++++++++++++------------------------
1 file changed, 14 insertions(+), 24 deletions(-)
diff --git a/drivers/staging/rts5208/xd.c b/drivers/staging/rts5208/xd.c
index ff423fa..1de02bb 100644
--- a/drivers/staging/rts5208/xd.c
+++ b/drivers/staging/rts5208/xd.c
@@ -1622,10 +1622,8 @@ static int xd_read_multiple_pages(struct rtsx_chip *chip, u32 phy_blk,
u8 reg_val, page_cnt;
int zone_no, retval, i;
- if (start_page > end_page) {
- rtsx_trace(chip);
- return STATUS_FAIL;
- }
+ if (start_page > end_page)
+ goto Status_Fail;
page_cnt = end_page - start_page;
zone_no = (int)(log_blk / 1000);
@@ -1641,8 +1639,7 @@ static int xd_read_multiple_pages(struct rtsx_chip *chip, u32 phy_blk,
if (detect_card_cd(chip, XD_CARD) != STATUS_SUCCESS) {
xd_set_err_code(chip, XD_NO_CARD);
- rtsx_trace(chip);
- return STATUS_FAIL;
+ goto Status_Fail;
}
}
}
@@ -1677,8 +1674,7 @@ static int xd_read_multiple_pages(struct rtsx_chip *chip, u32 phy_blk,
if (retval == -ETIMEDOUT) {
xd_set_err_code(chip, XD_TO_ERROR);
- rtsx_trace(chip);
- return STATUS_FAIL;
+ goto Status_Fail;
} else {
rtsx_trace(chip);
goto Fail;
@@ -1711,8 +1707,7 @@ static int xd_read_multiple_pages(struct rtsx_chip *chip, u32 phy_blk,
if (detect_card_cd(chip, XD_CARD) != STATUS_SUCCESS) {
xd_set_err_code(chip, XD_NO_CARD);
- rtsx_trace(chip);
- return STATUS_FAIL;
+ goto Status_Fail;
}
xd_set_err_code(chip, XD_ECC_ERROR);
@@ -1720,8 +1715,7 @@ static int xd_read_multiple_pages(struct rtsx_chip *chip, u32 phy_blk,
new_blk = xd_get_unused_block(chip, zone_no);
if (new_blk == NO_NEW_BLK) {
XD_CLR_BAD_OLDBLK(xd_card);
- rtsx_trace(chip);
- return STATUS_FAIL;
+ goto Status_Fail;
}
retval = xd_copy_page(chip, phy_blk, new_blk, 0,
@@ -1735,8 +1729,7 @@ static int xd_read_multiple_pages(struct rtsx_chip *chip, u32 phy_blk,
XD_CLR_BAD_NEWBLK(xd_card);
}
XD_CLR_BAD_OLDBLK(xd_card);
- rtsx_trace(chip);
- return STATUS_FAIL;
+ goto Status_Fail;
}
xd_set_l2p_tbl(chip, zone_no, log_off, (u16)(new_blk & 0x3FF));
xd_erase_block(chip, phy_blk);
@@ -1744,6 +1737,7 @@ static int xd_read_multiple_pages(struct rtsx_chip *chip, u32 phy_blk,
XD_CLR_BAD_OLDBLK(xd_card);
}
+Status_Fail:
rtsx_trace(chip);
return STATUS_FAIL;
}
@@ -1842,10 +1836,8 @@ static int xd_write_multiple_pages(struct rtsx_chip *chip, u32 old_blk,
dev_dbg(rtsx_dev(chip), "%s, old_blk = 0x%x, new_blk = 0x%x, log_blk = 0x%x\n",
__func__, old_blk, new_blk, log_blk);
- if (start_page > end_page) {
- rtsx_trace(chip);
- return STATUS_FAIL;
- }
+ if (start_page > end_page)
+ goto Status_Fail;
page_cnt = end_page - start_page;
zone_no = (int)(log_blk / 1000);
@@ -1854,10 +1846,8 @@ static int xd_write_multiple_pages(struct rtsx_chip *chip, u32 old_blk,
page_addr = (new_blk << xd_card->block_shift) + start_page;
retval = xd_send_cmd(chip, READ1_1);
- if (retval != STATUS_SUCCESS) {
- rtsx_trace(chip);
- return STATUS_FAIL;
- }
+ if (retval != STATUS_SUCCESS)
+ goto Status_Fail;
rtsx_init_cmd(chip);
@@ -1892,8 +1882,7 @@ static int xd_write_multiple_pages(struct rtsx_chip *chip, u32 old_blk,
if (retval == -ETIMEDOUT) {
xd_set_err_code(chip, XD_TO_ERROR);
- rtsx_trace(chip);
- return STATUS_FAIL;
+ goto Status_Fail;
} else {
rtsx_trace(chip);
goto Fail;
@@ -1933,6 +1922,7 @@ static int xd_write_multiple_pages(struct rtsx_chip *chip, u32 old_blk,
xd_mark_bad_block(chip, new_blk);
}
+Status_Fail:
rtsx_trace(chip);
return STATUS_FAIL;
}
--
1.9.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
end of thread, other threads:[~2016-09-23 14:13 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-23 14:12 [PATCH 0/8 V2] staging: rts5208: Fix several style warnings Sergio Paracuellos
2016-09-23 14:12 ` [PATCH 1/8 V2] staging: rts5208: avoid new typedef in rtsx.h: rtsx_dev_t Sergio Paracuellos
2016-09-23 14:12 ` [PATCH 2/8 V2] staging: rts5208: avoid symbolic permissions in rtsx.c Sergio Paracuellos
2016-09-23 14:12 ` [PATCH 3/8 V2] staging: rts5208: fix comment blocks style in rtsx_chip.h Sergio Paracuellos
2016-09-23 14:12 ` [PATCH 4/8 V2] staging: rts5208: fix comment blocks style in rtsx.h Sergio Paracuellos
2016-09-23 14:12 ` [PATCH 5/8 V2] staging: rts5208: remove not used typedef in rtsx_sys.h Sergio Paracuellos
2016-09-23 14:12 ` [PATCH 6/8 V2] staging: rts5208: fix line style warnings in spi.c Sergio Paracuellos
2016-09-23 14:12 ` [PATCH 7/8 V2] staging: rts5208: fix style warnings in sd.c Sergio Paracuellos
2016-09-23 14:12 ` [PATCH 8/8 V2] staging: rts5208: fix style warnings in xd.c Sergio Paracuellos
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.