mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/2] scsi/ufs: reverse the ufshcd_is_device_present logic
@ 2012-04-06  5:27 Venkatraman S
  2012-04-06  5:27 ` [PATCH 2/2] scsi/ufs: Fix evaluation of task_failed status Venkatraman S
  2012-04-06  8:53 ` [PATCH 1/2] scsi/ufs: reverse the ufshcd_is_device_present logic Namjae Jeon
  0 siblings, 2 replies; 5+ messages in thread
From: Venkatraman S @ 2012-04-06  5:27 UTC (permalink / raw)
  To: linux-kernel; +Cc: Venkatraman S, Santosh Y, Andrew Morton

 Otherwise it counter intuitively returns 0 if device is present.

Signed-off-by: Venkatraman S <svenkatr@ti.com>
CC: Santosh Y <santoshsy@gmail.com>
CC: Andrew Morton <akpm@linux-foundation.org>
---
 drivers/scsi/ufs/ufshcd.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 52b96e8..aa97200 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -232,11 +232,11 @@ static inline u32 ufshcd_get_ufs_version(struct ufs_hba *hba)
  *			      the host controller
  * @reg_hcs - host controller status register value
  *
- * Returns 0 if device present, non-zero if no device detected
+ * Returns 1 if device present, 0 if no device detected
  */
 static inline int ufshcd_is_device_present(u32 reg_hcs)
 {
-	return (DEVICE_PRESENT & reg_hcs) ? 0 : -1;
+	return (DEVICE_PRESENT & reg_hcs) ? 1 : 0;
 }
 
 /**
@@ -911,7 +911,7 @@ static int ufshcd_make_hba_operational(struct ufs_hba *hba)
 
 	/* check if device present */
 	reg = readl((hba->mmio_base + REG_CONTROLLER_STATUS));
-	if (ufshcd_is_device_present(reg)) {
+	if (!ufshcd_is_device_present(reg)) {
 		dev_err(&hba->pdev->dev, "cc: Device not present\n");
 		err = -ENXIO;
 		goto out;
-- 
1.7.5.4


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

* [PATCH 2/2] scsi/ufs: Fix evaluation of task_failed status
  2012-04-06  5:27 [PATCH 1/2] scsi/ufs: reverse the ufshcd_is_device_present logic Venkatraman S
@ 2012-04-06  5:27 ` Venkatraman S
  2012-04-06  8:57   ` Namjae Jeon
  2012-04-06  9:19   ` Santosh Y
  2012-04-06  8:53 ` [PATCH 1/2] scsi/ufs: reverse the ufshcd_is_device_present logic Namjae Jeon
  1 sibling, 2 replies; 5+ messages in thread
From: Venkatraman S @ 2012-04-06  5:27 UTC (permalink / raw)
  To: linux-kernel; +Cc: Venkatraman S, Santosh Y, Andrew Morton

Else FAILED would be set even if task_result was
originally equal to UPIU_TASK_MANAGEMENT_FUNC_SUCCEEDED.

Reported-by: Joe Perches <joe@perches.com>
Signed-off-by: Venkatraman S <svenkatr@ti.com>
CC: Santosh Y <santoshsy@gmail.com>
CC: Andrew Morton <akpm@linux-foundation.org>
---
 drivers/scsi/ufs/ufshcd.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index aa97200..cd59f6f 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -1160,7 +1160,7 @@ static int ufshcd_task_req_compl(struct ufs_hba *hba, u32 index)
 		task_result = be32_to_cpu(task_rsp_upiup->header.dword_1);
 		task_result = ((task_result & MASK_TASK_RESPONSE) >> 8);
 
-		if (task_result != UPIU_TASK_MANAGEMENT_FUNC_COMPL ||
+		if (task_result != UPIU_TASK_MANAGEMENT_FUNC_COMPL &&
 		    task_result != UPIU_TASK_MANAGEMENT_FUNC_SUCCEEDED)
 			task_result = FAILED;
 	} else {
-- 
1.7.5.4


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

* Re: [PATCH 1/2] scsi/ufs: reverse the ufshcd_is_device_present logic
  2012-04-06  5:27 [PATCH 1/2] scsi/ufs: reverse the ufshcd_is_device_present logic Venkatraman S
  2012-04-06  5:27 ` [PATCH 2/2] scsi/ufs: Fix evaluation of task_failed status Venkatraman S
@ 2012-04-06  8:53 ` Namjae Jeon
  1 sibling, 0 replies; 5+ messages in thread
From: Namjae Jeon @ 2012-04-06  8:53 UTC (permalink / raw)
  To: Venkatraman S; +Cc: linux-kernel, Santosh Y, Andrew Morton

2012/4/6 Venkatraman S <svenkatr@ti.com>:
>  Otherwise it counter intuitively returns 0 if device is present.
>
> Signed-off-by: Venkatraman S <svenkatr@ti.com>
> CC: Santosh Y <santoshsy@gmail.com>
> CC: Andrew Morton <akpm@linux-foundation.org>
This patch make sense.
Reviewed-by: Namjae Jeon <linkinjeon@gmail.com>

> ---

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

* Re: [PATCH 2/2] scsi/ufs: Fix evaluation of task_failed status
  2012-04-06  5:27 ` [PATCH 2/2] scsi/ufs: Fix evaluation of task_failed status Venkatraman S
@ 2012-04-06  8:57   ` Namjae Jeon
  2012-04-06  9:19   ` Santosh Y
  1 sibling, 0 replies; 5+ messages in thread
From: Namjae Jeon @ 2012-04-06  8:57 UTC (permalink / raw)
  To: Venkatraman S; +Cc: linux-kernel, Santosh Y, Andrew Morton

2012/4/6 Venkatraman S <svenkatr@ti.com>:
> Else FAILED would be set even if task_result was
> originally equal to UPIU_TASK_MANAGEMENT_FUNC_SUCCEEDED.
>
> Reported-by: Joe Perches <joe@perches.com>
> Signed-off-by: Venkatraman S <svenkatr@ti.com>
> CC: Santosh Y <santoshsy@gmail.com>
> CC: Andrew Morton <akpm@linux-foundation.org>
Good catch!!!
Reviewed-by: Namjae Jeon <linkinjeon@gmail.com>
> ---

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

* Re: [PATCH 2/2] scsi/ufs: Fix evaluation of task_failed status
  2012-04-06  5:27 ` [PATCH 2/2] scsi/ufs: Fix evaluation of task_failed status Venkatraman S
  2012-04-06  8:57   ` Namjae Jeon
@ 2012-04-06  9:19   ` Santosh Y
  1 sibling, 0 replies; 5+ messages in thread
From: Santosh Y @ 2012-04-06  9:19 UTC (permalink / raw)
  To: Venkatraman S; +Cc: linux-kernel, Andrew Morton

> @@ -1160,7 +1160,7 @@ static int ufshcd_task_req_compl(struct ufs_hba *hba, u32 index)
>                task_result = be32_to_cpu(task_rsp_upiup->header.dword_1);
>                task_result = ((task_result & MASK_TASK_RESPONSE) >> 8);
>
> -               if (task_result != UPIU_TASK_MANAGEMENT_FUNC_COMPL ||
> +               if (task_result != UPIU_TASK_MANAGEMENT_FUNC_COMPL &&
>                    task_result != UPIU_TASK_MANAGEMENT_FUNC_SUCCEEDED)
>                        task_result = FAILED;
>        } else {
> --
> 1.7.5.4
>

Acked-by: Santosh Y <santoshsy@gmail.com>

-- 
~Santosh

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

end of thread, other threads:[~2012-04-06  9:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-06  5:27 [PATCH 1/2] scsi/ufs: reverse the ufshcd_is_device_present logic Venkatraman S
2012-04-06  5:27 ` [PATCH 2/2] scsi/ufs: Fix evaluation of task_failed status Venkatraman S
2012-04-06  8:57   ` Namjae Jeon
2012-04-06  9:19   ` Santosh Y
2012-04-06  8:53 ` [PATCH 1/2] scsi/ufs: reverse the ufshcd_is_device_present logic Namjae Jeon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®