linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Arend van Spriel" <arend@broadcom.com>
To: gregkh@suse.de
Cc: "Franky Lin" <frankyl@broadcom.com>,
	devel@linuxdriverproject.org, linux-wireless@vger.kernel.org,
	"Arend van Spriel" <arend@broadcom.com>
Subject: [PATCH 14/29] staging: brcm80211: placed suspend flag in gInstance in brcmfmac
Date: Fri, 22 Jul 2011 20:57:01 +0200	[thread overview]
Message-ID: <1311361036-3175-15-git-send-email-arend@broadcom.com> (raw)
In-Reply-To: <1311361036-3175-1-git-send-email-arend@broadcom.com>

From: Franky Lin <frankyl@broadcom.com>

One of the steps to remove global variable. gInstance will be
replaced by brcmf_sdio_dev in the upcoming patch.

Cc: devel@linuxdriverproject.org
Cc: linux-wireless@vger.kernel.org
Reviewed-by: Roland Vossen <rvossen@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
---
 drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c |   35 ++++++++++-----------
 drivers/staging/brcm80211/brcmfmac/sdio_host.h    |    1 +
 2 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c b/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c
index 2a9efc3..edcd98e 100644
--- a/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c
+++ b/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c
@@ -66,7 +66,6 @@ static int brcmf_sdio_resume(struct device *dev);
 uint sd_f2_blocksize = 512;	/* Default blocksize */
 
 struct brcmf_sdmmc_instance *gInstance;
-static atomic_t brcmf_mmc_suspend;
 
 /* devices we support, null terminated */
 static const struct sdio_device_id brcmf_sdmmc_ids[] = {
@@ -100,17 +99,17 @@ DECLARE_WAIT_QUEUE_HEAD(sdioh_request_byte_wait);
 DECLARE_WAIT_QUEUE_HEAD(sdioh_request_word_wait);
 DECLARE_WAIT_QUEUE_HEAD(sdioh_request_packet_wait);
 DECLARE_WAIT_QUEUE_HEAD(sdioh_request_buffer_wait);
-#define BRCMF_PM_RESUME_WAIT(a) do { \
+#define BRCMF_PM_RESUME_WAIT(a, b) do { \
 		int retry = 0; \
-		while (atomic_read(&brcmf_mmc_suspend) && retry++ != 30) { \
+		while (atomic_read(&b->suspend) && retry++ != 30) { \
 			wait_event_timeout(a, false, HZ/100); \
 		} \
 	}	while (0)
-#define BRCMF_PM_RESUME_RETURN_ERROR(a)	\
-	do { if (atomic_read(&brcmf_mmc_suspend)) return a; } while (0)
+#define BRCMF_PM_RESUME_RETURN_ERROR(a, b)	\
+	do { if (atomic_read(&b->suspend)) return a; } while (0)
 #else
-#define BRCMF_PM_RESUME_WAIT(a)
-#define BRCMF_PM_RESUME_RETURN_ERROR(a)
+#define BRCMF_PM_RESUME_WAIT(a, b)
+#define BRCMF_PM_RESUME_RETURN_ERROR(a, b)
 #endif		/* CONFIG_PM_SLEEP */
 
 static int
@@ -571,8 +570,8 @@ brcmf_sdioh_request_byte(struct sdioh_info *sd, uint rw, uint func,
 	BRCMF_INFO(("%s: rw=%d, func=%d, addr=0x%05x\n", __func__, rw, func,
 		 regaddr));
 
-	BRCMF_PM_RESUME_WAIT(sdioh_request_byte_wait);
-	BRCMF_PM_RESUME_RETURN_ERROR(-EIO);
+	BRCMF_PM_RESUME_WAIT(sdioh_request_byte_wait, gInstance);
+	BRCMF_PM_RESUME_RETURN_ERROR(-EIO, gInstance);
 	if (rw) {		/* CMD52 Write */
 		if (func == 0) {
 			/* Can only directly write to some F0 registers.
@@ -678,8 +677,8 @@ brcmf_sdioh_request_word(struct sdioh_info *sd, uint cmd_type, uint rw,
 	BRCMF_INFO(("%s: cmd_type=%d, rw=%d, func=%d, addr=0x%05x, nbytes=%d\n",
 		 __func__, cmd_type, rw, func, addr, nbytes));
 
-	BRCMF_PM_RESUME_WAIT(sdioh_request_word_wait);
-	BRCMF_PM_RESUME_RETURN_ERROR(-EIO);
+	BRCMF_PM_RESUME_WAIT(sdioh_request_word_wait, gInstance);
+	BRCMF_PM_RESUME_RETURN_ERROR(-EIO, gInstance);
 	/* Claim host controller */
 	sdio_claim_host(gInstance->func[func]);
 
@@ -728,8 +727,8 @@ brcmf_sdioh_request_packet(struct sdioh_info *sd, uint fix_inc, uint write,
 
 	BRCMF_TRACE(("%s: Enter\n", __func__));
 
-	BRCMF_PM_RESUME_WAIT(sdioh_request_packet_wait);
-	BRCMF_PM_RESUME_RETURN_ERROR(-EIO);
+	BRCMF_PM_RESUME_WAIT(sdioh_request_packet_wait, gInstance);
+	BRCMF_PM_RESUME_RETURN_ERROR(-EIO, gInstance);
 
 	/* Claim host controller */
 	sdio_claim_host(gInstance->func[func]);
@@ -806,8 +805,8 @@ brcmf_sdioh_request_buffer(struct sdioh_info *sd, uint pio_dma, uint fix_inc,
 
 	BRCMF_TRACE(("%s: Enter\n", __func__));
 
-	BRCMF_PM_RESUME_WAIT(sdioh_request_buffer_wait);
-	BRCMF_PM_RESUME_RETURN_ERROR(-EIO);
+	BRCMF_PM_RESUME_WAIT(sdioh_request_buffer_wait, gInstance);
+	BRCMF_PM_RESUME_RETURN_ERROR(-EIO, gInstance);
 	/* Case 1: we don't have a packet. */
 	if (pkt == NULL) {
 		BRCMF_DATA(("%s: Creating new %s Packet, len=%d\n",
@@ -981,7 +980,7 @@ static int brcmf_ops_sdio_probe(struct sdio_func *func,
 		sdiodev->func1 = func;
 		dev_set_drvdata(&func->card->dev, sdiodev);
 
-		atomic_set(&brcmf_mmc_suspend, false);
+		atomic_set(&gInstance->suspend, false);
 	}
 
 	gInstance->func[func->num] = func;
@@ -1029,7 +1028,7 @@ static int brcmf_sdio_suspend(struct device *dev)
 
 	BRCMF_TRACE(("%s\n", __func__));
 
-	atomic_set(&brcmf_mmc_suspend, true);
+	atomic_set(&gInstance->suspend, true);
 
 	sdio_flags = sdio_get_host_pm_caps(gInstance->func[1]);
 	if (!(sdio_flags & MMC_PM_KEEP_POWER)) {
@@ -1056,7 +1055,7 @@ static int brcmf_sdio_resume(struct device *dev)
 
 	sdiodev = dev_get_drvdata(&func->card->dev);
 	brcmf_sdio_wdtmr_enable(sdiodev, true);
-	atomic_set(&brcmf_mmc_suspend, false);
+	atomic_set(&gInstance->suspend, false);
 	return 0;
 }
 #endif		/* CONFIG_PM_SLEEP */
diff --git a/drivers/staging/brcm80211/brcmfmac/sdio_host.h b/drivers/staging/brcm80211/brcmfmac/sdio_host.h
index aecc8e3..f4e2329 100644
--- a/drivers/staging/brcm80211/brcmfmac/sdio_host.h
+++ b/drivers/staging/brcm80211/brcmfmac/sdio_host.h
@@ -152,6 +152,7 @@ struct brcmf_sdmmc_instance {
 	struct sdioh_info *sd;
 	struct sdio_func *func[SDIOD_MAX_IOFUNCS];
 	u32 host_claimed;
+	atomic_t suspend;	/* suspend flag */
 };
 
 struct brcmf_sdio_dev {
-- 
1.7.4.1



  parent reply	other threads:[~2011-07-22 18:57 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-22 18:56 [PATCH 00/29] staging: brcm80211: cleanup checkpatch warnings Arend van Spriel
2011-07-22 18:56 ` [PATCH 01/29] staging: brcm80211: fixed checkpatch warnings for fullmac Arend van Spriel
2011-07-22 18:56 ` [PATCH 02/29] staging: brcm80211: fixed checkpatch warnings for brcmutil dir Arend van Spriel
2011-07-22 18:56 ` [PATCH 03/29] staging: brcm80211: fixed checkpatch warnings for 'include' dir Arend van Spriel
2011-07-22 18:56 ` [PATCH 04/29] staging: brcm80211: use PCI_DEVICE() macro in device table Arend van Spriel
2011-07-22 18:56 ` [PATCH 05/29] staging: brcm80211: remove unused rx status definitions Arend van Spriel
2011-07-22 18:56 ` [PATCH 06/29] staging: brcm80211: reformat long lines in brcmsmac to 80 columns Arend van Spriel
2011-07-22 18:56 ` [PATCH 07/29] staging: brcm80211: remove wl_alloc_dma_resources() function Arend van Spriel
2011-07-22 18:56 ` [PATCH 09/29] staging: brcm80211: remove code for unsupported chip Arend van Spriel
2011-07-26  8:12   ` Dan Carpenter
2011-07-22 18:56 ` [PATCH 10/29] staging: brcm80211: cleaned up softmac DMA layer Arend van Spriel
2011-07-22 18:56 ` [PATCH 11/29] staging: brcm80211: removed void * from softmac phy Arend van Spriel
2011-07-22 18:56 ` [PATCH 12/29] staging: brcm80211: simplified register access macro's in softmac Arend van Spriel
2011-07-22 18:57 ` [PATCH 13/29] staging: brcm80211: revisited END_FOREACH_BSS macro Arend van Spriel
2011-07-26  8:26   ` Dan Carpenter
2011-07-26 16:34     ` Joe Perches
2011-07-22 18:57 ` Arend van Spriel [this message]
2011-07-22 18:57 ` [PATCH 15/29] staging: brcm80211: remove struct brcmf_sdioh_driver from brcmfmac Arend van Spriel
2011-07-22 18:57 ` [PATCH 16/29] staging: brcm80211: remove vendor and device id check " Arend van Spriel
2011-07-22 18:57 ` [PATCH 17/29] staging: brcm80211: remove struct brcmf_sdio_card " Arend van Spriel
2011-07-22 18:57 ` [PATCH 18/29] staging: brcm80211: remove dead code " Arend van Spriel
2011-07-22 18:57 ` [PATCH 19/29] staging: brcm80211: remove dead client interrupt " Arend van Spriel
2011-07-22 18:57 ` [PATCH 20/29] staging: brcm80211: remove function pointer of interrupt isr in brcmfmac Arend van Spriel
2011-07-22 18:57 ` [PATCH 21/29] staging: brcm80211: cleanup to get rid of 'over 80 character' line Arend van Spriel
2011-07-22 18:57 ` [PATCH 22/29] staging: brcm80211: removed unused bus code from softmac Arend van Spriel
2011-07-22 18:57 ` [PATCH 23/29] staging: brcm80211: replaced void *btparam into struct pci_dev *btparam Arend van Spriel
2011-07-22 18:57 ` [PATCH 24/29] staging: brcm80211: removed void * from ai_ functions Arend van Spriel
2011-07-22 18:57 ` [PATCH 25/29] staging: brcm80211: removed brcms_c_module_unregister() call in ampdu.c Arend van Spriel
2011-07-22 18:57 ` [PATCH 26/29] staging: brcm80211: removed watchdog function from softmac Arend van Spriel
2011-07-22 18:57 ` [PATCH 27/29] staging: brcm80211: SPARC build error fix Arend van Spriel
2011-07-22 18:57 ` [PATCH 28/29] staging: brcm80211: remove target platform limitations for drivers Arend van Spriel
2011-07-22 18:57 ` [PATCH 29/29] staging: brcm80211: updated TODO file Arend van Spriel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1311361036-3175-15-git-send-email-arend@broadcom.com \
    --to=arend@broadcom.com \
    --cc=devel@linuxdriverproject.org \
    --cc=frankyl@broadcom.com \
    --cc=gregkh@suse.de \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).