linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 5/6] pm80xx : Removing redundant code snippets
@ 2013-11-20  7:21 Viswas G
  2013-11-20  9:38 ` Jack Wang
  0 siblings, 1 reply; 2+ messages in thread
From: Viswas G @ 2013-11-20  7:21 UTC (permalink / raw)
  To: linux-scsi
  Cc: xjtuwjp, Vasanthalakshmi.Tharmarajan, Suresh.Thiagarajan,
	Viswas.G

Removed redundant code snipptes in pm8001_hwi.c
and pm8001_ctl.c

Signed-off-by: Viswas G <Viswas.G@pmcs.com>
---
 drivers/scsi/pm8001/pm8001_ctl.c |   22 ++++++++--------------
 drivers/scsi/pm8001/pm8001_hwi.c |    7 +------
 2 files changed, 9 insertions(+), 20 deletions(-)

diff --git a/drivers/scsi/pm8001/pm8001_ctl.c b/drivers/scsi/pm8001/pm8001_ctl.c
index a04b4ff..1e055ae 100644
--- a/drivers/scsi/pm8001/pm8001_ctl.c
+++ b/drivers/scsi/pm8001/pm8001_ctl.c
@@ -323,16 +323,13 @@ static ssize_t pm8001_ctl_ib_queue_log_show(struct device *cdev,
 	int offset;
 	char *str = buf;
 	int start = 0;
-#define IB_MEMMAP(c)		\
-		(*(u32 *)((u8 *)pm8001_ha->		\
-		memoryMap.region[IB].virt_ptr +		\
+#define IB_MEMMAP(c)	\
+		(*(u32 *)((u8 *)pm8001_ha->	\
+		memoryMap.region[IB].virt_ptr +	\
 		pm8001_ha->evtlog_ib_offset + (c)))
 
 	for (offset = 0; offset < IB_OB_READ_TIMES; offset++) {
-		if (pm8001_ha->chip_id != chip_8001)
-			str += sprintf(str, "0x%08x\n", IB_MEMMAP(start));
-		else
-			str += sprintf(str, "0x%08x\n", IB_MEMMAP(start));
+		str += sprintf(str, "0x%08x\n", IB_MEMMAP(start));
 		start = start + 4;
 	}
 	pm8001_ha->evtlog_ib_offset += SYSFS_OFFSET;
@@ -363,16 +360,13 @@ static ssize_t pm8001_ctl_ob_queue_log_show(struct device *cdev,
 	int offset;
 	char *str = buf;
 	int start = 0;
-#define OB_MEMMAP(c)		\
-		(*(u32 *)((u8 *)pm8001_ha->		\
-		memoryMap.region[OB].virt_ptr +		\
+#define OB_MEMMAP(c)	\
+		(*(u32 *)((u8 *)pm8001_ha->	\
+		memoryMap.region[OB].virt_ptr +	\
 		pm8001_ha->evtlog_ob_offset + (c)))
 
 	for (offset = 0; offset < IB_OB_READ_TIMES; offset++) {
-		if (pm8001_ha->chip_id != chip_8001)
-			str += sprintf(str, "0x%08x\n", OB_MEMMAP(start));
-		else
-			str += sprintf(str, "0x%08x\n", OB_MEMMAP(start));
+		str += sprintf(str, "0x%08x\n", OB_MEMMAP(start));
 		start = start + 4;
 	}
 	pm8001_ha->evtlog_ob_offset += SYSFS_OFFSET;
diff --git a/drivers/scsi/pm8001/pm8001_hwi.c b/drivers/scsi/pm8001/pm8001_hwi.c
index b23f49d..f6ea277 100644
--- a/drivers/scsi/pm8001/pm8001_hwi.c
+++ b/drivers/scsi/pm8001/pm8001_hwi.c
@@ -5072,13 +5072,8 @@ pm8001_get_gsm_dump(struct device *cdev, u32 length, char* buf)
 		direct_data += sprintf(direct_data, "%08x ", value);
 	}
 	/* Shift back to BAR4 original address */
-	if (pm8001_ha->chip_id == chip_8001) {
-		if (-1 == pm8001_bar4_shift(pm8001_ha, 0))
+	if (-1 == pm8001_bar4_shift(pm8001_ha, 0))
 			return 1;
-	} else {
-		if (-1 == pm80xx_bar4_shift(pm8001_ha, 0))
-			return 1;
-	}
 	pm8001_ha->fatal_forensic_shift_offset += 1024;
 
 	if (pm8001_ha->fatal_forensic_shift_offset >= 0x100000)
-- 
1.7.1


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

* Re: [PATCH 5/6] pm80xx : Removing redundant code snippets
  2013-11-20  7:21 [PATCH 5/6] pm80xx : Removing redundant code snippets Viswas G
@ 2013-11-20  9:38 ` Jack Wang
  0 siblings, 0 replies; 2+ messages in thread
From: Jack Wang @ 2013-11-20  9:38 UTC (permalink / raw)
  To: Viswas G; +Cc: linux-scsi, Vasanthalakshmi.Tharmarajan, Suresh.Thiagarajan

On 11/20/2013 08:21 AM, Viswas G wrote:
> Removed redundant code snipptes in pm8001_hwi.c
> and pm8001_ctl.c
> 
> Signed-off-by: Viswas G <Viswas.G@pmcs.com>
Looks good, thanks
Reviewed-by: Jack Wang <jinpu.wang@profitbricks.com>
> ---
>  drivers/scsi/pm8001/pm8001_ctl.c |   22 ++++++++--------------
>  drivers/scsi/pm8001/pm8001_hwi.c |    7 +------
>  2 files changed, 9 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/scsi/pm8001/pm8001_ctl.c b/drivers/scsi/pm8001/pm8001_ctl.c
> index a04b4ff..1e055ae 100644
> --- a/drivers/scsi/pm8001/pm8001_ctl.c
> +++ b/drivers/scsi/pm8001/pm8001_ctl.c
> @@ -323,16 +323,13 @@ static ssize_t pm8001_ctl_ib_queue_log_show(struct device *cdev,
>  	int offset;
>  	char *str = buf;
>  	int start = 0;
> -#define IB_MEMMAP(c)		\
> -		(*(u32 *)((u8 *)pm8001_ha->		\
> -		memoryMap.region[IB].virt_ptr +		\
> +#define IB_MEMMAP(c)	\
> +		(*(u32 *)((u8 *)pm8001_ha->	\
> +		memoryMap.region[IB].virt_ptr +	\
>  		pm8001_ha->evtlog_ib_offset + (c)))
>  
>  	for (offset = 0; offset < IB_OB_READ_TIMES; offset++) {
> -		if (pm8001_ha->chip_id != chip_8001)
> -			str += sprintf(str, "0x%08x\n", IB_MEMMAP(start));
> -		else
> -			str += sprintf(str, "0x%08x\n", IB_MEMMAP(start));
> +		str += sprintf(str, "0x%08x\n", IB_MEMMAP(start));
>  		start = start + 4;
>  	}
>  	pm8001_ha->evtlog_ib_offset += SYSFS_OFFSET;
> @@ -363,16 +360,13 @@ static ssize_t pm8001_ctl_ob_queue_log_show(struct device *cdev,
>  	int offset;
>  	char *str = buf;
>  	int start = 0;
> -#define OB_MEMMAP(c)		\
> -		(*(u32 *)((u8 *)pm8001_ha->		\
> -		memoryMap.region[OB].virt_ptr +		\
> +#define OB_MEMMAP(c)	\
> +		(*(u32 *)((u8 *)pm8001_ha->	\
> +		memoryMap.region[OB].virt_ptr +	\
>  		pm8001_ha->evtlog_ob_offset + (c)))
>  
>  	for (offset = 0; offset < IB_OB_READ_TIMES; offset++) {
> -		if (pm8001_ha->chip_id != chip_8001)
> -			str += sprintf(str, "0x%08x\n", OB_MEMMAP(start));
> -		else
> -			str += sprintf(str, "0x%08x\n", OB_MEMMAP(start));
> +		str += sprintf(str, "0x%08x\n", OB_MEMMAP(start));
>  		start = start + 4;
>  	}
>  	pm8001_ha->evtlog_ob_offset += SYSFS_OFFSET;
> diff --git a/drivers/scsi/pm8001/pm8001_hwi.c b/drivers/scsi/pm8001/pm8001_hwi.c
> index b23f49d..f6ea277 100644
> --- a/drivers/scsi/pm8001/pm8001_hwi.c
> +++ b/drivers/scsi/pm8001/pm8001_hwi.c
> @@ -5072,13 +5072,8 @@ pm8001_get_gsm_dump(struct device *cdev, u32 length, char* buf)
>  		direct_data += sprintf(direct_data, "%08x ", value);
>  	}
>  	/* Shift back to BAR4 original address */
> -	if (pm8001_ha->chip_id == chip_8001) {
> -		if (-1 == pm8001_bar4_shift(pm8001_ha, 0))
> +	if (-1 == pm8001_bar4_shift(pm8001_ha, 0))
>  			return 1;
> -	} else {
> -		if (-1 == pm80xx_bar4_shift(pm8001_ha, 0))
> -			return 1;
> -	}
>  	pm8001_ha->fatal_forensic_shift_offset += 1024;
>  
>  	if (pm8001_ha->fatal_forensic_shift_offset >= 0x100000)
> 


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

end of thread, other threads:[~2013-11-20  9:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-20  7:21 [PATCH 5/6] pm80xx : Removing redundant code snippets Viswas G
2013-11-20  9:38 ` Jack Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).