Skip to contentSkip to conversation

brcmfmac: avoid duplicated suspend/resume operation

PATCH In review Fu, Zhonghui 4 participants 6 messages Jan 12, 2015 – Jan 20, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 brcmfmac: avoid duplicated suspend/resume operation

Quoted 1 line

From 8685c3c2746b4275fc808d9db23c364b2f54b52a Mon Sep 17 00:00:00 2001

From: Zhonghui Fu <[email protected]>
Date: Mon, 12 Jan 2015 14:25:46 +0800
Subject: [PATCH] brcmfmac: avoid duplicated suspend/resume operation

WiFi chip has 2 SDIO functions, and PM core will trigger twice suspend/resume operations for one WiFi chip to do the same things. This patch avoid this case.

---
 drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c |   21 +++++++++++++++++----
 1 files changed, 17 insertions(+), 4 deletions(-)
drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c +17 -4
index 9880dae..8f71485 100644
@@ -1070,7 +1070,7 @@ static int brcmf_ops_sdio_probe(struct sdio_func *func,
 	 */
 	if ((sdio_get_host_pm_caps(sdiodev->func[1]) & MMC_PM_KEEP_POWER) &&
 	    ((sdio_get_host_pm_caps(sdiodev->func[1]) & MMC_PM_WAKE_SDIO_IRQ) ||
-	     (sdiodev->pdata && sdiodev->pdata->oob_irq_supported)))
+	     (sdiodev->pdata->oob_irq_supported)))
 		bus_if->wowl_supported = true;
 #endif
 
@@ -1139,11 +1139,17 @@ void brcmf_sdio_wowl_config(struct device *dev, bool enabled)
 static int brcmf_ops_sdio_suspend(struct device *dev)
 {
 	struct brcmf_bus *bus_if = dev_get_drvdata(dev);
-	struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio;
+	struct brcmf_sdio_dev *sdiodev;
 	mmc_pm_flag_t sdio_flags;
+	struct sdio_func *func = dev_to_sdio_func(dev);
 
 	brcmf_dbg(SDIO, "Enter\n");
 
+	if (func->num == 2)
+		return 0;
+
+	sdiodev = bus_if->bus_priv.sdio;
+
 	atomic_set(&sdiodev->suspend, true);
 
 	if (sdiodev->wowl_enabled) {
@@ -1164,10 +1170,17 @@ static int brcmf_ops_sdio_suspend(struct device *dev)
 static int brcmf_ops_sdio_resume(struct device *dev)
 {
 	struct brcmf_bus *bus_if = dev_get_drvdata(dev);
-	struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio;
+	struct brcmf_sdio_dev *sdiodev;
+	struct sdio_func *func = dev_to_sdio_func(dev);
 
 	brcmf_dbg(SDIO, "Enter\n");
-	if (sdiodev->pdata && sdiodev->pdata->oob_irq_supported)
+
+	if (func->num == 2)
+		return 0;
+
+	sdiodev = bus_if->bus_priv.sdio;
+
+	if (sdiodev->pdata->oob_irq_supported)
 		disable_irq_wake(sdiodev->pdata->oob_irq_nr);
 	brcmf_sdio_wd_timer(sdiodev->bus, BRCMF_WD_POLL_MS);
 	atomic_set(&sdiodev->suspend, false);

-- 1.7.1

#1 lore raw
Quoted 5 lines · Zhonghui

From 8685c3c2746b4275fc808d9db23c364b2f54b52a Mon Sep 17 00:00:00 2001
From: Zhonghui Fu<[email protected]>
Date: Mon, 12 Jan 2015 14:25:46 +0800
Subject: [PATCH] brcmfmac: avoid duplicated suspend/resume operation

Quoted 7 lines

WiFi chip has 2 SDIO functions, and PM core will trigger twice suspend/resume operations for one WiFi chip to do the same things. This patch avoid this case.

This patch needs to be rebased.

Kalle,

Please drop this one.

Regards,
Arend

Quoted 58 lines
---
  drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c |   21 +++++++++++++++++----
  1 files changed, 17 insertions(+), 4 deletions(-)
drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c +17 -5
index 9880dae..8f71485 100644
@@ -1070,7 +1070,7 @@ static int brcmf_ops_sdio_probe(struct sdio_func *func,
  	 */
  	if ((sdio_get_host_pm_caps(sdiodev->func[1])&  MMC_PM_KEEP_POWER)&&
  	((sdio_get_host_pm_caps(sdiodev->func[1])&  MMC_PM_WAKE_SDIO_IRQ) ||
-	     (sdiodev->pdata&&  sdiodev->pdata->oob_irq_supported)))
+	     (sdiodev->pdata->oob_irq_supported)))
  		bus_if->wowl_supported = true;
  #endif
 
@@ -1139,11 +1139,17 @@ void brcmf_sdio_wowl_config(struct device *dev, bool enabled)
  static int brcmf_ops_sdio_suspend(struct device *dev)
  {
  	struct brcmf_bus *bus_if = dev_get_drvdata(dev);
-	struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio;
+	struct brcmf_sdio_dev *sdiodev;
  	mmc_pm_flag_t sdio_flags;
+	struct sdio_func *func = dev_to_sdio_func(dev);
 
  	brcmf_dbg(SDIO, "Enter\n");
 
+	if (func->num == 2)
+		return 0;
+
+	sdiodev = bus_if->bus_priv.sdio;
+
  	atomic_set(&sdiodev->suspend, true);
 
  	if (sdiodev->wowl_enabled) {
@@ -1164,10 +1170,17 @@ static int brcmf_ops_sdio_suspend(struct device *dev)
  static int brcmf_ops_sdio_resume(struct device *dev)
  {
  	struct brcmf_bus *bus_if = dev_get_drvdata(dev);
-	struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio;
+	struct brcmf_sdio_dev *sdiodev;
+	struct sdio_func *func = dev_to_sdio_func(dev);
 
  	brcmf_dbg(SDIO, "Enter\n");
-	if (sdiodev->pdata&&  sdiodev->pdata->oob_irq_supported)
+
+	if (func->num == 2)
+		return 0;
+
+	sdiodev = bus_if->bus_priv.sdio;
+
+	if (sdiodev->pdata->oob_irq_supported)
  		disable_irq_wake(sdiodev->pdata->oob_irq_nr);
  	brcmf_sdio_wd_timer(sdiodev->bus, BRCMF_WD_POLL_MS);
  	atomic_set(&sdiodev->suspend, false);
-- 1.7.1
#2 lore raw
Quoted 14 lines · Arend van Spriel
Quoted 5 lines · Zhonghui

From 8685c3c2746b4275fc808d9db23c364b2f54b52a Mon Sep 17 00:00:00 2001
From: Zhonghui Fu<zhonghui.fu-VuQAYsv1563Yd54FQh9/[email protected]>
Date: Mon, 12 Jan 2015 14:25:46 +0800
Subject: [PATCH] brcmfmac: avoid duplicated suspend/resume operation

Quoted 7 lines

WiFi chip has 2 SDIO functions, and PM core will trigger twice suspend/resume operations for one WiFi chip to do the same things. This patch avoid this case.

Quoted 5 lines

This patch needs to be rebased.

Kalle,

Please drop this one.

Ok, dropped. I'll wait for the rebase.

Signature · 5 lines
Kalle Valo
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#3 lore raw
Quoted 15 lines · Kalle Valo
Quoted 13 lines · Arend van Spriel
Quoted 12 lines · Zhonghui

From 8685c3c2746b4275fc808d9db23c364b2f54b52a Mon Sep 17 00:00:00 2001
From: Zhonghui Fu<[email protected]>
Date: Mon, 12 Jan 2015 14:25:46 +0800
Subject: [PATCH] brcmfmac: avoid duplicated suspend/resume operation

WiFi chip has 2 SDIO functions, and PM core will trigger twice suspend/resume operations for one WiFi chip to do the same things. This patch avoid this case.

Quoted 6 lines
Quoted 5 lines

This patch needs to be rebased.

Kalle,

Please drop this one.

Ok, dropped. I'll wait for the rebase.

I have re-based this patch and sent it in another mail with the same subject.

Thanks,
Zhonghui

Quoted 1 line
#4 lore raw
In reply to Fu, Zhonghui

Hello.

Quoted 4 lines · Zhonghui

From 8685c3c2746b4275fc808d9db23c364b2f54b52a Mon Sep 17 00:00:00 2001
From: Zhonghui Fu <[email protected]>
Date: Mon, 12 Jan 2015 14:25:46 +0800
Subject: [PATCH] brcmfmac: avoid duplicated suspend/resume operation

The lines above are not needed.

Quoted 16 lines

WiFi chip has 2 SDIO functions, and PM core will trigger twice suspend/resume operations for one WiFi chip to do the same things. This patch avoid this case.

---
  drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c |   21 +++++++++++++++++----
  1 files changed, 17 insertions(+), 4 deletions(-)
drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c +0 -0
index 9880dae..8f71485 100644

drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c static int brcmf_ops_sdio_probe(struct sdio_func *func, · line 1073

Quoted 5 lines
drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c +1 -1
@@ -1070,7 +1070,7 @@ static int brcmf_ops_sdio_probe(struct sdio_func *func,
  	 */
  	if ((sdio_get_host_pm_caps(sdiodev->func[1]) & MMC_PM_KEEP_POWER) &&
  	    ((sdio_get_host_pm_caps(sdiodev->func[1]) & MMC_PM_WAKE_SDIO_IRQ) ||
-	     (sdiodev->pdata && sdiodev->pdata->oob_irq_supported)))
+	     (sdiodev->pdata->oob_irq_supported)))

Inner parens not needed on this line.

[...]

WBR, Sergei

#5 lore raw
Quoted 23 lines · Sergei Shtylyov

Hello.

Quoted 4 lines · Zhonghui

From 8685c3c2746b4275fc808d9db23c364b2f54b52a Mon Sep 17 00:00:00 2001
From: Zhonghui Fu <[email protected]>
Date: Mon, 12 Jan 2015 14:25:46 +0800
Subject: [PATCH] brcmfmac: avoid duplicated suspend/resume operation

The lines above are not needed.

Quoted 11 lines

WiFi chip has 2 SDIO functions, and PM core will trigger twice suspend/resume operations for one WiFi chip to do the same things. This patch avoid this case.

---
drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c | 21
+++++++++++++++++----

1 files changed, 17 insertions(+), 4 deletions(-)
Quoted 14 lines
Quoted 8 lines
drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c +0 -0
index 9880dae..8f71485 100644
@@ -1070,7 +1070,7 @@ static int brcmf_ops_sdio_probe(struct sdio_func
 *func,
 */
Quoted 4 lines

if ((sdio_get_host_pm_caps(sdiodev->func[1]) & MMC_PM_KEEP_POWER) && ((sdio_get_host_pm_caps(sdiodev->func[1]) & MMC_PM_WAKE_SDIO_IRQ) ||
- (sdiodev->pdata && sdiodev->pdata->oob_irq_supported)))
+ (sdiodev->pdata->oob_irq_supported)))

Inner parens not needed on this line.

Well, actually this patch should not affect those line as it would reintroduce a recently fixed issue.

Regards,
Arend

Quoted 4 lines

[...]

WBR, Sergei