All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tg3: remove redundant pm init code
@ 2013-05-29  9:00 Yijing Wang
  2013-05-29 23:22 ` Michael Chan
  2013-06-03  7:13   ` David Miller
  0 siblings, 2 replies; 8+ messages in thread
From: Yijing Wang @ 2013-05-29  9:00 UTC (permalink / raw)
  To: Nithin Nayak Sujir, Michael Chan
  Cc: linux-pci, linux-kernel, netdev, Hanjun Guo, Jiang Liu,
	Yijing Wang

Pci_enable_device() will set device pm state to D0, so
it's no need to do it again in tg3_init_one().

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/net/ethernet/broadcom/tg3.c |   20 +-------------------
 1 files changed, 1 insertions(+), 19 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index 728d42a..1396ab3 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -17042,25 +17042,10 @@ static int tg3_init_one(struct pci_dev *pdev,
 
 	pci_set_master(pdev);
 
-	/* Find power-management capability. */
-	pm_cap = pci_find_capability(pdev, PCI_CAP_ID_PM);
-	if (pm_cap == 0) {
-		dev_err(&pdev->dev,
-			"Cannot find Power Management capability, aborting\n");
-		err = -EIO;
-		goto err_out_free_res;
-	}
-
-	err = pci_set_power_state(pdev, PCI_D0);
-	if (err) {
-		dev_err(&pdev->dev, "Transition to D0 failed, aborting\n");
-		goto err_out_free_res;
-	}
-
 	dev = alloc_etherdev_mq(sizeof(*tp), TG3_IRQ_MAX_VECS);
 	if (!dev) {
 		err = -ENOMEM;
-		goto err_out_power_down;
+		goto err_out_free_res;
 	}
 
 	SET_NETDEV_DEV(dev, &pdev->dev);
@@ -17406,9 +17391,6 @@ err_out_iounmap:
 err_out_free_dev:
 	free_netdev(dev);
 
-err_out_power_down:
-	pci_set_power_state(pdev, PCI_D3hot);
-
 err_out_free_res:
 	pci_release_regions(pdev);
 
-- 
1.7.1



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

* Re: [PATCH] tg3: remove redundant pm init code
  2013-05-29  9:00 [PATCH] tg3: remove redundant pm init code Yijing Wang
@ 2013-05-29 23:22 ` Michael Chan
  2013-06-03  7:13   ` David Miller
  1 sibling, 0 replies; 8+ messages in thread
From: Michael Chan @ 2013-05-29 23:22 UTC (permalink / raw)
  To: Yijing Wang
  Cc: Nithin Nayak Sujir, linux-pci, linux-kernel, netdev, Hanjun Guo,
	Jiang Liu

On Wed, 2013-05-29 at 17:00 +0800, Yijing Wang wrote: 
> Pci_enable_device() will set device pm state to D0, so
> it's no need to do it again in tg3_init_one().
> 
> Signed-off-by: Yijing Wang <wangyijing@huawei.com>

Acked-by: Michael Chan <mchan@broadcom.com>

> ---
>  drivers/net/ethernet/broadcom/tg3.c |   20 +-------------------
>  1 files changed, 1 insertions(+), 19 deletions(-)
> 
> diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
> index 728d42a..1396ab3 100644
> --- a/drivers/net/ethernet/broadcom/tg3.c
> +++ b/drivers/net/ethernet/broadcom/tg3.c
> @@ -17042,25 +17042,10 @@ static int tg3_init_one(struct pci_dev *pdev,
>  
>  	pci_set_master(pdev);
>  
> -	/* Find power-management capability. */
> -	pm_cap = pci_find_capability(pdev, PCI_CAP_ID_PM);
> -	if (pm_cap == 0) {
> -		dev_err(&pdev->dev,
> -			"Cannot find Power Management capability, aborting\n");
> -		err = -EIO;
> -		goto err_out_free_res;
> -	}
> -
> -	err = pci_set_power_state(pdev, PCI_D0);
> -	if (err) {
> -		dev_err(&pdev->dev, "Transition to D0 failed, aborting\n");
> -		goto err_out_free_res;
> -	}
> -
>  	dev = alloc_etherdev_mq(sizeof(*tp), TG3_IRQ_MAX_VECS);
>  	if (!dev) {
>  		err = -ENOMEM;
> -		goto err_out_power_down;
> +		goto err_out_free_res;
>  	}
>  
>  	SET_NETDEV_DEV(dev, &pdev->dev);
> @@ -17406,9 +17391,6 @@ err_out_iounmap:
>  err_out_free_dev:
>  	free_netdev(dev);
>  
> -err_out_power_down:
> -	pci_set_power_state(pdev, PCI_D3hot);
> -
>  err_out_free_res:
>  	pci_release_regions(pdev);
>  




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

* Re: [PATCH] tg3: remove redundant pm init code
  2013-05-29  9:00 [PATCH] tg3: remove redundant pm init code Yijing Wang
  2013-05-29 23:22 ` Michael Chan
@ 2013-06-03  7:13   ` David Miller
  1 sibling, 0 replies; 8+ messages in thread
From: David Miller @ 2013-06-03  7:13 UTC (permalink / raw)
  To: wangyijing
  Cc: nsujir, mchan, linux-pci, linux-kernel, netdev, guohanjun, liuj97

RnJvbTogWWlqaW5nIFdhbmcgPHdhbmd5aWppbmdAaHVhd2VpLmNvbT4NCkRhdGU6IFdlZCwgMjkg
TWF5IDIwMTMgMTc6MDA6MzIgKzA4MDANCg0KPiBQY2lfZW5hYmxlX2RldmljZSgpIHdpbGwgc2V0
IGRldmljZSBwbSBzdGF0ZSB0byBEMCwgc28NCj4gaXQncyBubyBuZWVkIHRvIGRvIGl0IGFnYWlu
IGluIHRnM19pbml0X29uZSgpLg0KPiANCj4gU2lnbmVkLW9mZi1ieTogWWlqaW5nIFdhbmcgPHdh
bmd5aWppbmdAaHVhd2VpLmNvbT4NCg0KVGhpcyBwYXRjaCBpbnRyb2R1Y2VzIGEgd2FybmluZzoN
Cg0KZHJpdmVycy9uZXQvZXRoZXJuZXQvYnJvYWRjb20vdGczLmM6IEluIGZ1bmN0aW9uIKF0ZzNf
aW5pdF9vbmWiOg0KZHJpdmVycy9uZXQvZXRoZXJuZXQvYnJvYWRjb20vdGczLmM6MTcyMzE6MTM6
IHdhcm5pbmc6IKFwbV9jYXCiIG1heSBiZSB1c2VkIHVuaW5pdGlhbGl6ZWQgaW4gdGhpcyBmdW5j
dGlvbiBbLVd1bmluaXRpYWxpemVkXQ0K

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

* Re: [PATCH] tg3: remove redundant pm init code
@ 2013-06-03  7:13   ` David Miller
  0 siblings, 0 replies; 8+ messages in thread
From: David Miller @ 2013-06-03  7:13 UTC (permalink / raw)
  To: wangyijing
  Cc: nsujir, mchan, linux-pci, linux-kernel, netdev, guohanjun, liuj97

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: Text/Plain; charset=iso-8859-7, Size: 628 bytes --]

From: Yijing Wang <wangyijing@huawei.com>
Date: Wed, 29 May 2013 17:00:32 +0800

> Pci_enable_device() will set device pm state to D0, so
> it's no need to do it again in tg3_init_one().
> 
> Signed-off-by: Yijing Wang <wangyijing@huawei.com>

This patch introduces a warning:

drivers/net/ethernet/broadcom/tg3.c: In function ¡tg3_init_one¢:
drivers/net/ethernet/broadcom/tg3.c:17231:13: warning: ¡pm_cap¢ may be used uninitialized in this function [-Wuninitialized]
ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

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

* Re: [PATCH] tg3: remove redundant pm init code
@ 2013-06-03  7:13   ` David Miller
  0 siblings, 0 replies; 8+ messages in thread
From: David Miller @ 2013-06-03  7:13 UTC (permalink / raw)
  To: wangyijing
  Cc: nsujir, mchan, linux-pci, linux-kernel, netdev, guohanjun, liuj97

From: Yijing Wang <wangyijing@huawei.com>
Date: Wed, 29 May 2013 17:00:32 +0800

> Pci_enable_device() will set device pm state to D0, so
> it's no need to do it again in tg3_init_one().
> 
> Signed-off-by: Yijing Wang <wangyijing@huawei.com>

This patch introduces a warning:

drivers/net/ethernet/broadcom/tg3.c: In function ‘tg3_init_one’:
drivers/net/ethernet/broadcom/tg3.c:17231:13: warning: ‘pm_cap’ may be used uninitialized in this function [-Wuninitialized]

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

* Re: [PATCH] tg3: remove redundant pm init code
  2013-06-03  7:13   ` David Miller
  (?)
  (?)
@ 2013-06-03  7:15   ` Yijing Wang
  -1 siblings, 0 replies; 8+ messages in thread
From: Yijing Wang @ 2013-06-03  7:15 UTC (permalink / raw)
  To: David Miller
  Cc: nsujir, mchan, linux-pci, linux-kernel, netdev, guohanjun, liuj97

On 2013/6/3 15:13, David Miller wrote:
> From: Yijing Wang <wangyijing@huawei.com>
> Date: Wed, 29 May 2013 17:00:32 +0800
> 
>> Pci_enable_device() will set device pm state to D0, so
>> it's no need to do it again in tg3_init_one().
>>
>> Signed-off-by: Yijing Wang <wangyijing@huawei.com>
> 
> This patch introduces a warning:
> 
> drivers/net/ethernet/broadcom/tg3.c: In function ‘tg3_init_one’:
> drivers/net/ethernet/broadcom/tg3.c:17231:13: warning: ‘pm_cap’ may be used uninitialized in this function [-Wuninitialized]
> 
Sorry, I will update it and resend soon.

Thanks!
Yijing.

-- 
Thanks!
Yijing


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

* [PATCH] tg3: remove redundant pm init code
@ 2013-06-03  7:36 Yijing Wang
  2013-06-03  7:49 ` David Miller
  0 siblings, 1 reply; 8+ messages in thread
From: Yijing Wang @ 2013-06-03  7:36 UTC (permalink / raw)
  To: David S. Miller; +Cc: linux-kernel, netdev, Hanjun Guo, Jiang Liu, Yijing Wang

Pci_enable_device() will set device pm state to D0, so
it's no need to do it again in tg3_init_one().

Acked-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: Yijing Wang <wangyijing@huawei.com>
---
 drivers/net/ethernet/broadcom/tg3.c |   24 +++---------------------
 1 files changed, 3 insertions(+), 21 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index 728d42a..ca5bc7e 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -17020,7 +17020,7 @@ static int tg3_init_one(struct pci_dev *pdev,
 {
 	struct net_device *dev;
 	struct tg3 *tp;
-	int i, err, pm_cap;
+	int i, err;
 	u32 sndmbx, rcvmbx, intmbx;
 	char str[40];
 	u64 dma_mask, persist_dma_mask;
@@ -17042,25 +17042,10 @@ static int tg3_init_one(struct pci_dev *pdev,
 
 	pci_set_master(pdev);
 
-	/* Find power-management capability. */
-	pm_cap = pci_find_capability(pdev, PCI_CAP_ID_PM);
-	if (pm_cap == 0) {
-		dev_err(&pdev->dev,
-			"Cannot find Power Management capability, aborting\n");
-		err = -EIO;
-		goto err_out_free_res;
-	}
-
-	err = pci_set_power_state(pdev, PCI_D0);
-	if (err) {
-		dev_err(&pdev->dev, "Transition to D0 failed, aborting\n");
-		goto err_out_free_res;
-	}
-
 	dev = alloc_etherdev_mq(sizeof(*tp), TG3_IRQ_MAX_VECS);
 	if (!dev) {
 		err = -ENOMEM;
-		goto err_out_power_down;
+		goto err_out_free_res;
 	}
 
 	SET_NETDEV_DEV(dev, &pdev->dev);
@@ -17068,7 +17053,7 @@ static int tg3_init_one(struct pci_dev *pdev,
 	tp = netdev_priv(dev);
 	tp->pdev = pdev;
 	tp->dev = dev;
-	tp->pm_cap = pm_cap;
+	tp->pm_cap = pdev->pm_cap;
 	tp->rx_mode = TG3_DEF_RX_MODE;
 	tp->tx_mode = TG3_DEF_TX_MODE;
 	tp->irq_sync = 1;
@@ -17406,9 +17391,6 @@ err_out_iounmap:
 err_out_free_dev:
 	free_netdev(dev);
 
-err_out_power_down:
-	pci_set_power_state(pdev, PCI_D3hot);
-
 err_out_free_res:
 	pci_release_regions(pdev);
 
-- 
1.7.1



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

* Re: [PATCH] tg3: remove redundant pm init code
  2013-06-03  7:36 Yijing Wang
@ 2013-06-03  7:49 ` David Miller
  0 siblings, 0 replies; 8+ messages in thread
From: David Miller @ 2013-06-03  7:49 UTC (permalink / raw)
  To: wangyijing; +Cc: linux-kernel, netdev, guohanjun, liuj97

From: Yijing Wang <wangyijing@huawei.com>
Date: Mon, 3 Jun 2013 15:36:21 +0800

> Pci_enable_device() will set device pm state to D0, so
> it's no need to do it again in tg3_init_one().
> 
> Acked-by: Michael Chan <mchan@broadcom.com>
> Signed-off-by: Yijing Wang <wangyijing@huawei.com>

This looks better, applied, thanks.

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

end of thread, other threads:[~2013-06-03  7:49 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-29  9:00 [PATCH] tg3: remove redundant pm init code Yijing Wang
2013-05-29 23:22 ` Michael Chan
2013-06-03  7:13 ` David Miller
2013-06-03  7:13   ` David Miller
2013-06-03  7:13   ` David Miller
2013-06-03  7:15   ` Yijing Wang
  -- strict thread matches above, loose matches on Subject: below --
2013-06-03  7:36 Yijing Wang
2013-06-03  7:49 ` David Miller

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.