linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 5/9] cciss: rework pci pm related code for simplification
@ 2013-06-18  8:19 Yijing Wang
  2013-07-02  1:48 ` Yijing Wang
  0 siblings, 1 reply; 6+ messages in thread
From: Yijing Wang @ 2013-06-18  8:19 UTC (permalink / raw)
  To: Jens Axboe, Mike Miller
  Cc: linux-kernel, Hanjun Guo, jiang.liu, Yijing Wang, iss_storagedev

Use pci core pm interface to simplify code.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
Cc: Mike Miller <mike.miller@hp.com>
Cc: iss_storagedev@hp.com
Cc: linux-kernel@vger.kernel.org
---
 drivers/block/cciss.c |   16 +++-------------
 1 files changed, 3 insertions(+), 13 deletions(-)

diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index 62b6c2c..18da685 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -4528,9 +4528,6 @@ static int cciss_message(struct pci_dev *pdev, unsigned char opcode,
 static int cciss_controller_hard_reset(struct pci_dev *pdev,
 	void * __iomem vaddr, u32 use_doorbell)
 {
-	u16 pmcsr;
-	int pos;
-
 	if (use_doorbell) {
 		/* For everything after the P600, the PCI power state method
 		 * of resetting the controller doesn't work, so we have this
@@ -4548,8 +4545,7 @@ static int cciss_controller_hard_reset(struct pci_dev *pdev,
 		 * this causes a secondary PCI reset which will reset the
 		 * controller." */
 
-		pos = pci_find_capability(pdev, PCI_CAP_ID_PM);
-		if (pos == 0) {
+		if (!pdev->pm_cap) {
 			dev_err(&pdev->dev,
 				"cciss_controller_hard_reset: "
 				"PCI PM not supported\n");
@@ -4557,18 +4553,12 @@ static int cciss_controller_hard_reset(struct pci_dev *pdev,
 		}
 		dev_info(&pdev->dev, "using PCI PM to reset controller\n");
 		/* enter the D3hot power management state */
-		pci_read_config_word(pdev, pos + PCI_PM_CTRL, &pmcsr);
-		pmcsr &= ~PCI_PM_CTRL_STATE_MASK;
-		pmcsr |= PCI_D3hot;
-		pci_write_config_word(pdev, pos + PCI_PM_CTRL, pmcsr);
+		pci_set_power_state(pdev, PCI_D3hot);
 
 		msleep(500);
 
 		/* enter the D0 power management state */
-		pmcsr &= ~PCI_PM_CTRL_STATE_MASK;
-		pmcsr |= PCI_D0;
-		pci_write_config_word(pdev, pos + PCI_PM_CTRL, pmcsr);
-
+		pci_set_power_state(pdev, PCI_D0);
 		/*
 		 * The P600 requires a small delay when changing states.
 		 * Otherwise we may think the board did not reset and we bail.
-- 
1.7.1



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

* Re: [PATCH 5/9] cciss: rework pci pm related code for simplification
  2013-06-18  8:19 [PATCH 5/9] cciss: rework pci pm related code for simplification Yijing Wang
@ 2013-07-02  1:48 ` Yijing Wang
  2013-07-02  8:02   ` Jens Axboe
  0 siblings, 1 reply; 6+ messages in thread
From: Yijing Wang @ 2013-07-02  1:48 UTC (permalink / raw)
  To: Yijing Wang
  Cc: Jens Axboe, Mike Miller, linux-kernel, Jiri Kosina, iss_storagedev

Hi Jens,
   Sorry to disturb you, do you have any comments for this patch?

Thanks!
Yijing.

On 2013/6/18 16:19, Yijing Wang wrote:
> Use pci core pm interface to simplify code.
> 
> Signed-off-by: Yijing Wang <wangyijing@huawei.com>
> Cc: Mike Miller <mike.miller@hp.com>
> Cc: iss_storagedev@hp.com
> Cc: linux-kernel@vger.kernel.org
> ---
>  drivers/block/cciss.c |   16 +++-------------
>  1 files changed, 3 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
> index 62b6c2c..18da685 100644
> --- a/drivers/block/cciss.c
> +++ b/drivers/block/cciss.c
> @@ -4528,9 +4528,6 @@ static int cciss_message(struct pci_dev *pdev, unsigned char opcode,
>  static int cciss_controller_hard_reset(struct pci_dev *pdev,
>  	void * __iomem vaddr, u32 use_doorbell)
>  {
> -	u16 pmcsr;
> -	int pos;
> -
>  	if (use_doorbell) {
>  		/* For everything after the P600, the PCI power state method
>  		 * of resetting the controller doesn't work, so we have this
> @@ -4548,8 +4545,7 @@ static int cciss_controller_hard_reset(struct pci_dev *pdev,
>  		 * this causes a secondary PCI reset which will reset the
>  		 * controller." */
>  
> -		pos = pci_find_capability(pdev, PCI_CAP_ID_PM);
> -		if (pos == 0) {
> +		if (!pdev->pm_cap) {
>  			dev_err(&pdev->dev,
>  				"cciss_controller_hard_reset: "
>  				"PCI PM not supported\n");
> @@ -4557,18 +4553,12 @@ static int cciss_controller_hard_reset(struct pci_dev *pdev,
>  		}
>  		dev_info(&pdev->dev, "using PCI PM to reset controller\n");
>  		/* enter the D3hot power management state */
> -		pci_read_config_word(pdev, pos + PCI_PM_CTRL, &pmcsr);
> -		pmcsr &= ~PCI_PM_CTRL_STATE_MASK;
> -		pmcsr |= PCI_D3hot;
> -		pci_write_config_word(pdev, pos + PCI_PM_CTRL, pmcsr);
> +		pci_set_power_state(pdev, PCI_D3hot);
>  
>  		msleep(500);
>  
>  		/* enter the D0 power management state */
> -		pmcsr &= ~PCI_PM_CTRL_STATE_MASK;
> -		pmcsr |= PCI_D0;
> -		pci_write_config_word(pdev, pos + PCI_PM_CTRL, pmcsr);
> -
> +		pci_set_power_state(pdev, PCI_D0);
>  		/*
>  		 * The P600 requires a small delay when changing states.
>  		 * Otherwise we may think the board did not reset and we bail.
> 


-- 
Thanks!
Yijing


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

* Re: [PATCH 5/9] cciss: rework pci pm related code for simplification
  2013-07-02  1:48 ` Yijing Wang
@ 2013-07-02  8:02   ` Jens Axboe
  2013-07-02  8:10     ` Yijing Wang
  2013-07-02  8:15     ` Yijing Wang
  0 siblings, 2 replies; 6+ messages in thread
From: Jens Axboe @ 2013-07-02  8:02 UTC (permalink / raw)
  To: Yijing Wang; +Cc: Mike Miller, linux-kernel, Jiri Kosina, iss_storagedev

On Tue, Jul 02 2013, Yijing Wang wrote:
> Hi Jens,
>    Sorry to disturb you, do you have any comments for this patch?

Looks fine to me, was waiting for Stephen/Mike to ack it and I'll pick
it up.

-- 
Jens Axboe


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

* Re: [PATCH 5/9] cciss: rework pci pm related code for simplification
  2013-07-02  8:02   ` Jens Axboe
@ 2013-07-02  8:10     ` Yijing Wang
  2013-07-02  8:18       ` Jens Axboe
  2013-07-02  8:15     ` Yijing Wang
  1 sibling, 1 reply; 6+ messages in thread
From: Yijing Wang @ 2013-07-02  8:10 UTC (permalink / raw)
  To: Jens Axboe; +Cc: Mike Miller, linux-kernel, Jiri Kosina, iss_storagedev

On 2013/7/2 16:02, Jens Axboe wrote:
> On Tue, Jul 02 2013, Yijing Wang wrote:
>> Hi Jens,
>>    Sorry to disturb you, do you have any comments for this patch?
> 
> Looks fine to me, was waiting for Stephen/Mike to ack it and I'll pick
> it up.
> 

Hi Jens,
   Thanks for your comment, because I'm not familiar with cciss driver, so
should I cc Stephen email address ? And what is his e-mail address?

-- 
Thanks!
Yijing


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

* Re: [PATCH 5/9] cciss: rework pci pm related code for simplification
  2013-07-02  8:02   ` Jens Axboe
  2013-07-02  8:10     ` Yijing Wang
@ 2013-07-02  8:15     ` Yijing Wang
  1 sibling, 0 replies; 6+ messages in thread
From: Yijing Wang @ 2013-07-02  8:15 UTC (permalink / raw)
  To: Jens Axboe, Stephen M. Cameron
  Cc: Mike Miller, linux-kernel, Jiri Kosina, iss_storagedev

Cc: Stephen M. Cameron <scameron@beardog.cce.hp.com>

On 2013/7/2 16:02, Jens Axboe wrote:
> On Tue, Jul 02 2013, Yijing Wang wrote:
>> Hi Jens,
>>    Sorry to disturb you, do you have any comments for this patch?
> 
> Looks fine to me, was waiting for Stephen/Mike to ack it and I'll pick
> it up.
> 

I find his address by git log info, thanks!


-- 
Thanks!
Yijing


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

* Re: [PATCH 5/9] cciss: rework pci pm related code for simplification
  2013-07-02  8:10     ` Yijing Wang
@ 2013-07-02  8:18       ` Jens Axboe
  0 siblings, 0 replies; 6+ messages in thread
From: Jens Axboe @ 2013-07-02  8:18 UTC (permalink / raw)
  To: Yijing Wang
  Cc: Mike Miller, linux-kernel, Jiri Kosina, iss_storagedev, scameron

On Tue, Jul 02 2013, Yijing Wang wrote:
> On 2013/7/2 16:02, Jens Axboe wrote:
> > On Tue, Jul 02 2013, Yijing Wang wrote:
> >> Hi Jens,
> >>    Sorry to disturb you, do you have any comments for this patch?
> > 
> > Looks fine to me, was waiting for Stephen/Mike to ack it and I'll pick
> > it up.
> > 
> 
> Hi Jens,
>    Thanks for your comment, because I'm not familiar with cciss driver, so
> should I cc Stephen email address ? And what is his e-mail address?

Now CC'ed :-)

-- 
Jens Axboe


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

end of thread, other threads:[~2013-07-02  8:33 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-18  8:19 [PATCH 5/9] cciss: rework pci pm related code for simplification Yijing Wang
2013-07-02  1:48 ` Yijing Wang
2013-07-02  8:02   ` Jens Axboe
2013-07-02  8:10     ` Yijing Wang
2013-07-02  8:18       ` Jens Axboe
2013-07-02  8:15     ` Yijing 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).