public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* re: ufs: add UFS power management support
@ 2014-10-02 15:31 Dan Carpenter
  2014-10-23  7:28 ` Dolev Raviv
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2014-10-02 15:31 UTC (permalink / raw)
  To: subhashj; +Cc: linux-scsi

Hello Subhash Jadavani,

The patch 57d104c153d3: "ufs: add UFS power management support" from
Sep 25, 2014, leads to the following static checker warning:

	drivers/scsi/ufs/ufshcd.c:4746 ufshcd_link_state_transition()
	warn: we tested 'check_for_bkops' before and it was 'true'

drivers/scsi/ufs/ufshcd.c
  4734          if (req_link_state == UIC_LINK_HIBERN8_STATE) {
  4735                  ret = ufshcd_uic_hibern8_enter(hba);
  4736                  if (!ret)
  4737                          ufshcd_set_link_hibern8(hba);
  4738                  else
  4739                          goto out;
  4740          }
  4741          /*
  4742           * If autobkops is enabled, link can't be turned off because
  4743           * turning off the link would also turn off the device.
  4744           */
  4745          else if ((req_link_state == UIC_LINK_OFF_STATE) &&
  4746                     (!check_for_bkops || (check_for_bkops &&
                                                 ^^^^^^^^^^^^^^^
Not needed.

  4747                      !hba->auto_bkops_enabled))) {
  4748                  /*
  4749                   * Change controller state to "reset state" which
  4750                   * should also put the link in off/reset state
  4751                   */
  4752                  ufshcd_hba_stop(hba);
  4753                  /*
  4754                   * TODO: Check if we need any delay to make sure that
  4755                   * controller is reset
  4756                   */
  4757                  ufshcd_set_link_off(hba);
  4758          }
  4759  
  4760  out:
  4761          return ret;
  4762  }

regards,
dan carpenter

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

* RE: ufs: add UFS power management support
  2014-10-02 15:31 ufs: add UFS power management support Dan Carpenter
@ 2014-10-23  7:28 ` Dolev Raviv
  2014-10-23 10:06   ` Dan Carpenter
  0 siblings, 1 reply; 3+ messages in thread
From: Dolev Raviv @ 2014-10-23  7:28 UTC (permalink / raw)
  To: 'Dan Carpenter', subhashj; +Cc: linux-scsi

Hi Dan,
This seem like a false alarm, please let me know if it requires a fix.

Thanks,
Dolev
-- 
Qualcomm Israel, on behalf of Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, 
a Linux Foundation Collaborative Project 

-----Original Message-----
From: Dan Carpenter [mailto:dan.carpenter@oracle.com] 
Sent: Thursday, October 02, 2014 6:31 PM
To: subhashj@codeaurora.org
Cc: linux-scsi@vger.kernel.org
Subject: re: ufs: add UFS power management support

Hello Subhash Jadavani,

The patch 57d104c153d3: "ufs: add UFS power management support" from Sep 25,
2014, leads to the following static checker warning:

	drivers/scsi/ufs/ufshcd.c:4746 ufshcd_link_state_transition()
	warn: we tested 'check_for_bkops' before and it was 'true'

drivers/scsi/ufs/ufshcd.c
  4734          if (req_link_state == UIC_LINK_HIBERN8_STATE) {
  4735                  ret = ufshcd_uic_hibern8_enter(hba);
  4736                  if (!ret)
  4737                          ufshcd_set_link_hibern8(hba);
  4738                  else
  4739                          goto out;
  4740          }
  4741          /*
  4742           * If autobkops is enabled, link can't be turned off because
  4743           * turning off the link would also turn off the device.
  4744           */
  4745          else if ((req_link_state == UIC_LINK_OFF_STATE) &&
  4746                     (!check_for_bkops || (check_for_bkops &&
                                                 ^^^^^^^^^^^^^^^ Not needed.

  4747                      !hba->auto_bkops_enabled))) {
  4748                  /*
  4749                   * Change controller state to "reset state" which
  4750                   * should also put the link in off/reset state
  4751                   */
  4752                  ufshcd_hba_stop(hba);
  4753                  /*
  4754                   * TODO: Check if we need any delay to make sure
that
  4755                   * controller is reset
  4756                   */
  4757                  ufshcd_set_link_off(hba);
  4758          }
  4759
  4760  out:
  4761          return ret;
  4762  }

regards,
dan carpenter


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

* Re: ufs: add UFS power management support
  2014-10-23  7:28 ` Dolev Raviv
@ 2014-10-23 10:06   ` Dan Carpenter
  0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2014-10-23 10:06 UTC (permalink / raw)
  To: Dolev Raviv; +Cc: subhashj, linux-scsi

On Thu, Oct 23, 2014 at 10:28:52AM +0300, Dolev Raviv wrote:
> Hi Dan,
> This seem like a false alarm, please let me know if it requires a fix.
> 

It may not indicate a bug, but it is correct in that the code could be
re-written:

Old:

	else if ((req_link_state == UIC_LINK_OFF_STATE) &&
		(!check_for_bkops || (check_for_bkops &&
		!hba->auto_bkops_enabled))) {

Proposed:

	else if ((req_link_state == UIC_LINK_OFF_STATE) &&
		 (!check_for_bkops || !hba->auto_bkops_enabled)) {

Those two are the same.

regards,
dan carpenter



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

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

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-02 15:31 ufs: add UFS power management support Dan Carpenter
2014-10-23  7:28 ` Dolev Raviv
2014-10-23 10:06   ` Dan Carpenter

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