All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Staging: rts5208: rtsx_reset_chip style clean up
@ 2014-10-19  9:55 Fabio Falzoi
  2014-10-19  9:55 ` [PATCH 1/2] Staging: rts5208: helper function to manage aspm during reset Fabio Falzoi
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Fabio Falzoi @ 2014-10-19  9:55 UTC (permalink / raw)
  To: gregkh
  Cc: micky_ching, joe, giedrius.statkevicius, devel, linux-kernel,
	Fabio Falzoi

Clean up the code in rtsx_reset_chip function defining two new helper
functions rtsx_reset_aspm and rtsx_enable_pcie_intr.
Specifically, the following checkpatch warnings are corrected:
* PARENTHESIS_ALIGNMENT at rows 271, 302, 343 and 346
* LONG_LINE at rows 294, 313 and 315
* BRACES at rowa 320 and 351
This patch is inspired by the following post on LKML regarding another
clean up for rts5208 module:
http://www.spinics.net/lists/linux-driver-devel/msg55038.html

Fabio Falzoi (2):
  Staging: rts5208: helper function to manage aspm during reset
  Staging: rts5208: helper function to enable interrupts during reset

 drivers/staging/rts5208/rtsx_chip.c | 168 +++++++++++++++++++-----------------
 1 file changed, 87 insertions(+), 81 deletions(-)

-- 
2.1.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] Staging: rts5208: helper function to manage aspm during reset
  2014-10-19  9:55 [PATCH 0/2] Staging: rts5208: rtsx_reset_chip style clean up Fabio Falzoi
@ 2014-10-19  9:55 ` Fabio Falzoi
  2014-10-19  9:55 ` [PATCH 2/2] Staging: rts5208: helper function to enable interrupts " Fabio Falzoi
  2014-10-19 10:48 ` [PATCH 0/2] Staging: rts5208: rtsx_reset_chip style clean up Giedrius Statkevicius
  2 siblings, 0 replies; 4+ messages in thread
From: Fabio Falzoi @ 2014-10-19  9:55 UTC (permalink / raw)
  To: gregkh
  Cc: micky_ching, joe, giedrius.statkevicius, devel, linux-kernel,
	Fabio Falzoi

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>
---
 drivers/staging/rts5208/rtsx_chip.c | 72 ++++++++++++++++++++-----------------
 1 file changed, 39 insertions(+), 33 deletions(-)

diff --git a/drivers/staging/rts5208/rtsx_chip.c b/drivers/staging/rts5208/rtsx_chip.c
index a7ade8b..17f68b8 100644
--- a/drivers/staging/rts5208/rtsx_chip.c
+++ b/drivers/staging/rts5208/rtsx_chip.c
@@ -226,6 +226,42 @@ static int rtsx_pre_handle_sdio_new(struct rtsx_chip *chip)
 }
 #endif
 
+static int rtsx_reset_aspm(struct rtsx_chip *chip)
+{
+	int ret;
+
+	if (chip->dynamic_aspm) {
+		if (!CHK_SDIO_EXIST(chip) || !CHECK_PID(chip, 0x5288))
+			return STATUS_SUCCESS;
+
+		ret = rtsx_write_cfg_dw(chip, 2, 0xC0, 0xFF,
+					chip->aspm_l0s_l1_en);
+		if (ret != STATUS_SUCCESS)
+			TRACE_RET(chip, STATUS_FAIL);
+
+		return STATUS_SUCCESS;
+	}
+
+	if (CHECK_PID(chip, 0x5208))
+		RTSX_WRITE_REG(chip, ASPM_FORCE_CTL, 0xFF, 0x3F);
+	ret = rtsx_write_config_byte(chip, LCTLR, chip->aspm_l0s_l1_en);
+	if (ret != STATUS_SUCCESS)
+		TRACE_RET(chip, STATUS_FAIL);
+
+	chip->aspm_level[0] = chip->aspm_l0s_l1_en;
+	if (CHK_SDIO_EXIST(chip)) {
+		chip->aspm_level[1] = chip->aspm_l0s_l1_en;
+		ret = rtsx_write_cfg_dw(chip, CHECK_PID(chip, 0x5288) ? 2 : 1,
+					0xC0, 0xFF, chip->aspm_l0s_l1_en);
+		if (ret != STATUS_SUCCESS)
+			TRACE_RET(chip, STATUS_FAIL);
+	}
+
+	chip->aspm_enabled = 1;
+
+	return STATUS_SUCCESS;
+}
+
 int rtsx_reset_chip(struct rtsx_chip *chip)
 {
 	int retval;
@@ -288,39 +324,9 @@ int rtsx_reset_chip(struct rtsx_chip *chip)
 
 	/* Enable ASPM */
 	if (chip->aspm_l0s_l1_en) {
-		if (chip->dynamic_aspm) {
-			if (CHK_SDIO_EXIST(chip)) {
-				if (CHECK_PID(chip, 0x5288)) {
-					retval = rtsx_write_cfg_dw(chip, 2, 0xC0, 0xFF, chip->aspm_l0s_l1_en);
-					if (retval != STATUS_SUCCESS)
-						TRACE_RET(chip, STATUS_FAIL);
-				}
-			}
-		} else {
-			if (CHECK_PID(chip, 0x5208))
-				RTSX_WRITE_REG(chip, ASPM_FORCE_CTL,
-					0xFF, 0x3F);
-
-			retval = rtsx_write_config_byte(chip, LCTLR,
-							chip->aspm_l0s_l1_en);
-			if (retval != STATUS_SUCCESS)
-				TRACE_RET(chip, STATUS_FAIL);
-
-			chip->aspm_level[0] = chip->aspm_l0s_l1_en;
-			if (CHK_SDIO_EXIST(chip)) {
-				chip->aspm_level[1] = chip->aspm_l0s_l1_en;
-				if (CHECK_PID(chip, 0x5288))
-					retval = rtsx_write_cfg_dw(chip, 2, 0xC0, 0xFF, chip->aspm_l0s_l1_en);
-				else
-					retval = rtsx_write_cfg_dw(chip, 1, 0xC0, 0xFF, chip->aspm_l0s_l1_en);
-
-				if (retval != STATUS_SUCCESS)
-					TRACE_RET(chip, STATUS_FAIL);
-
-			}
-
-			chip->aspm_enabled = 1;
-		}
+		retval = rtsx_reset_aspm(chip);
+		if (retval != STATUS_SUCCESS)
+			TRACE_RET(chip, STATUS_FAIL);
 	} else {
 		if (chip->asic_code && CHECK_PID(chip, 0x5208)) {
 			retval = rtsx_write_phy_register(chip, 0x07, 0x0129);
-- 
2.1.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] Staging: rts5208: helper function to enable interrupts during reset
  2014-10-19  9:55 [PATCH 0/2] Staging: rts5208: rtsx_reset_chip style clean up Fabio Falzoi
  2014-10-19  9:55 ` [PATCH 1/2] Staging: rts5208: helper function to manage aspm during reset Fabio Falzoi
@ 2014-10-19  9:55 ` Fabio Falzoi
  2014-10-19 10:48 ` [PATCH 0/2] Staging: rts5208: rtsx_reset_chip style clean up Giedrius Statkevicius
  2 siblings, 0 replies; 4+ messages in thread
From: Fabio Falzoi @ 2014-10-19  9:55 UTC (permalink / raw)
  To: gregkh
  Cc: micky_ching, joe, giedrius.statkevicius, devel, linux-kernel,
	Fabio Falzoi

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>
---
 drivers/staging/rts5208/rtsx_chip.c | 96 ++++++++++++++++++-------------------
 1 file changed, 48 insertions(+), 48 deletions(-)

diff --git a/drivers/staging/rts5208/rtsx_chip.c b/drivers/staging/rts5208/rtsx_chip.c
index 17f68b8..c93a12a 100644
--- a/drivers/staging/rts5208/rtsx_chip.c
+++ b/drivers/staging/rts5208/rtsx_chip.c
@@ -262,6 +262,51 @@ static int rtsx_reset_aspm(struct rtsx_chip *chip)
 	return STATUS_SUCCESS;
 }
 
+static int rtsx_enable_pcie_intr(struct rtsx_chip *chip)
+{
+	int ret;
+
+	if (!chip->asic_code || !CHECK_PID(chip, 0x5208)) {
+		rtsx_enable_bus_int(chip);
+		return STATUS_SUCCESS;
+	}
+
+	if (chip->phy_debug_mode) {
+		RTSX_WRITE_REG(chip, CDRESUMECTL, 0x77, 0);
+		rtsx_disable_bus_int(chip);
+	} else {
+		rtsx_enable_bus_int(chip);
+	}
+
+	if (chip->ic_version >= IC_VER_D) {
+		u16 reg;
+
+		ret = rtsx_read_phy_register(chip, 0x00, &reg);
+		if (ret != STATUS_SUCCESS)
+			TRACE_RET(chip, STATUS_FAIL);
+
+		reg &= 0xFE7F;
+		reg |= 0x80;
+		ret = rtsx_write_phy_register(chip, 0x00, reg);
+		if (ret != STATUS_SUCCESS)
+			TRACE_RET(chip, STATUS_FAIL);
+
+		ret = rtsx_read_phy_register(chip, 0x1C, &reg);
+		if (ret != STATUS_SUCCESS)
+			TRACE_RET(chip, STATUS_FAIL);
+
+		reg &= 0xFFF7;
+		ret = rtsx_write_phy_register(chip, 0x1C, reg);
+		if (ret != STATUS_SUCCESS)
+			TRACE_RET(chip, STATUS_FAIL);
+	}
+
+	if (chip->driver_first_load && (chip->ic_version < IC_VER_C))
+		rtsx_calibration(chip);
+
+	return STATUS_SUCCESS;
+}
+
 int rtsx_reset_chip(struct rtsx_chip *chip)
 {
 	int retval;
@@ -374,54 +419,9 @@ int rtsx_reset_chip(struct rtsx_chip *chip)
 
 	RTSX_WRITE_REG(chip, PERST_GLITCH_WIDTH, 0xFF, 0x80);
 
-	/* Enable PCIE interrupt */
-	if (chip->asic_code) {
-		if (CHECK_PID(chip, 0x5208)) {
-			if (chip->phy_debug_mode) {
-				RTSX_WRITE_REG(chip, CDRESUMECTL, 0x77, 0);
-				rtsx_disable_bus_int(chip);
-			} else {
-				rtsx_enable_bus_int(chip);
-			}
-
-			if (chip->ic_version >= IC_VER_D) {
-				u16 reg;
-
-				retval = rtsx_read_phy_register(chip, 0x00,
-								&reg);
-				if (retval != STATUS_SUCCESS)
-					TRACE_RET(chip, STATUS_FAIL);
-
-				reg &= 0xFE7F;
-				reg |= 0x80;
-				retval = rtsx_write_phy_register(chip, 0x00,
-								reg);
-				if (retval != STATUS_SUCCESS)
-					TRACE_RET(chip, STATUS_FAIL);
-
-				retval = rtsx_read_phy_register(chip, 0x1C,
-								&reg);
-				if (retval != STATUS_SUCCESS)
-					TRACE_RET(chip, STATUS_FAIL);
-
-				reg &= 0xFFF7;
-				retval = rtsx_write_phy_register(chip, 0x1C,
-								reg);
-				if (retval != STATUS_SUCCESS)
-					TRACE_RET(chip, STATUS_FAIL);
-
-			}
-
-			if (chip->driver_first_load &&
-				(chip->ic_version < IC_VER_C))
-				rtsx_calibration(chip);
-
-		} else {
-			rtsx_enable_bus_int(chip);
-		}
-	} else {
-		rtsx_enable_bus_int(chip);
-	}
+	retval = rtsx_enable_pcie_intr(chip);
+	if (retval != STATUS_SUCCESS)
+		TRACE_RET(chip, STATUS_FAIL);
 
 	chip->need_reset = 0;
 
-- 
2.1.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/2] Staging: rts5208: rtsx_reset_chip style clean up
  2014-10-19  9:55 [PATCH 0/2] Staging: rts5208: rtsx_reset_chip style clean up Fabio Falzoi
  2014-10-19  9:55 ` [PATCH 1/2] Staging: rts5208: helper function to manage aspm during reset Fabio Falzoi
  2014-10-19  9:55 ` [PATCH 2/2] Staging: rts5208: helper function to enable interrupts " Fabio Falzoi
@ 2014-10-19 10:48 ` Giedrius Statkevicius
  2 siblings, 0 replies; 4+ messages in thread
From: Giedrius Statkevicius @ 2014-10-19 10:48 UTC (permalink / raw)
  To: Fabio Falzoi, gregkh; +Cc: micky_ching, joe, devel, linux-kernel

On 2014.10.19 12:55, Fabio Falzoi wrote:
> Clean up the code in rtsx_reset_chip function defining two new helper
> functions rtsx_reset_aspm and rtsx_enable_pcie_intr.
> Specifically, the following checkpatch warnings are corrected:
> * PARENTHESIS_ALIGNMENT at rows 271, 302, 343 and 346
> * LONG_LINE at rows 294, 313 and 315
> * BRACES at rowa 320 and 351
> This patch is inspired by the following post on LKML regarding another
> clean up for rts5208 module:
> http://www.spinics.net/lists/linux-driver-devel/msg55038.html
> 
> Fabio Falzoi (2):
>   Staging: rts5208: helper function to manage aspm during reset
>   Staging: rts5208: helper function to enable interrupts during reset
> 
>  drivers/staging/rts5208/rtsx_chip.c | 168 +++++++++++++++++++-----------------
>  1 file changed, 87 insertions(+), 81 deletions(-)
> 
Could you please remake this patch set against the staging-testing
branch? 
https://git.kernel.org/cgit/linux/kernel/git/gregkh/staging.git/commit/?h=staging-testing&id=ccf2d2456648ce84090ea1f37bd6774bafa99f00
This will break your patch on staging-testing.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-10-19 10:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-19  9:55 [PATCH 0/2] Staging: rts5208: rtsx_reset_chip style clean up Fabio Falzoi
2014-10-19  9:55 ` [PATCH 1/2] Staging: rts5208: helper function to manage aspm during reset Fabio Falzoi
2014-10-19  9:55 ` [PATCH 2/2] Staging: rts5208: helper function to enable interrupts " Fabio Falzoi
2014-10-19 10:48 ` [PATCH 0/2] Staging: rts5208: rtsx_reset_chip style clean up Giedrius Statkevicius

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.