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>,
	linux-wireless@vger.kernel.org, devel@linuxdriverproject.org,
	"Arend van Spriel" <arend@broadcom.com>
Subject: [PATCH 18/19] staging: brcm80211: absorb brcmf_sdcard_detach into brcmf_sdio_remove
Date: Mon, 18 Jul 2011 16:30:04 +0200	[thread overview]
Message-ID: <1310999405-10062-19-git-send-email-arend@broadcom.com> (raw)
In-Reply-To: <1310999405-10062-1-git-send-email-arend@broadcom.com>

From: Franky Lin <frankyl@broadcom.com>

To increase code readability of brcmfmac

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

diff --git a/drivers/staging/brcm80211/brcmfmac/bcmsdh.c b/drivers/staging/brcm80211/brcmfmac/bcmsdh.c
index 6f88bd2..0cd449d 100644
--- a/drivers/staging/brcm80211/brcmfmac/bcmsdh.c
+++ b/drivers/staging/brcm80211/brcmfmac/bcmsdh.c
@@ -57,19 +57,6 @@ static struct brcmf_sdioh_driver drvinfo = { NULL, NULL };
 
 module_param(sd_f2_blocksize, int, 0);
 
-int brcmf_sdcard_detach(struct brcmf_sdio_card *card)
-{
-	if (card != NULL) {
-		if (card->sdioh) {
-			brcmf_sdioh_detach(card->sdioh);
-			card->sdioh = NULL;
-		}
-		kfree(card);
-	}
-
-	return 0;
-}
-
 int
 brcmf_sdcard_iovar_op(struct brcmf_sdio_card *card, const char *name,
 		void *params, int plen, void *arg, int len, bool set)
@@ -441,7 +428,6 @@ int brcmf_sdio_probe(struct brcmf_sdio_dev *sdiodev)
 
 	sdiodev->card->sdioh = brcmf_sdioh_attach((void *)0);
 	if (!sdiodev->card->sdioh) {
-		brcmf_sdcard_detach(sdiodev->card);
 		ret = -ENODEV;
 		goto out;
 	}
@@ -466,8 +452,8 @@ int brcmf_sdio_probe(struct brcmf_sdio_dev *sdiodev)
 	}
 
 out:
-	if ((ret) && (sdiodev->card))
-		brcmf_sdcard_detach(sdiodev->card);
+	if (ret)
+		brcmf_sdio_remove(sdiodev);
 
 	return ret;
 }
@@ -475,8 +461,18 @@ EXPORT_SYMBOL(brcmf_sdio_probe);
 
 int brcmf_sdio_remove(struct brcmf_sdio_dev *sdiodev)
 {
-	drvinfo.detach(sdiodev->bus);
-	brcmf_sdcard_detach(sdiodev->card);
+	if (sdiodev->bus) {
+		drvinfo.detach(sdiodev->bus);
+		sdiodev->bus = NULL;
+	}
+
+	if (sdiodev->card) {
+		if (sdiodev->card->sdioh)
+			brcmf_sdioh_detach(sdiodev->card->sdioh);
+		kfree(sdiodev->card);
+		sdiodev->card = NULL;
+	}
+
 	return 0;
 }
 EXPORT_SYMBOL(brcmf_sdio_remove);
diff --git a/drivers/staging/brcm80211/brcmfmac/sdio_host.h b/drivers/staging/brcm80211/brcmfmac/sdio_host.h
index 68b6843..cf3b8fc 100644
--- a/drivers/staging/brcm80211/brcmfmac/sdio_host.h
+++ b/drivers/staging/brcm80211/brcmfmac/sdio_host.h
@@ -136,9 +136,6 @@ struct brcmf_sdio_dev {
 	void *bus;
 };
 
-/* Detach - freeup resources allocated in attach */
-extern int brcmf_sdcard_detach(struct brcmf_sdio_card *card);
-
 /* Enable/disable SD interrupt */
 extern int brcmf_sdcard_intr_enable(struct brcmf_sdio_card *card);
 extern int brcmf_sdcard_intr_disable(struct brcmf_sdio_card *card);
-- 
1.7.4.1



  parent reply	other threads:[~2011-07-18 14:30 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-18 14:29 [PATCH 00/19] checkpatch changes and brcmfmac cleanup Arend van Spriel
2011-07-18 14:29 ` [PATCH 01/19] staging: brcm80211: fix for checkpatch warnings in phy directory Arend van Spriel
2011-07-18 14:29 ` [PATCH 02/19] staging: brcm80211: resolved checkpatch warnings in LCN phy Arend van Spriel
2011-07-18 14:29 ` [PATCH 03/19] staging: brcm80211: resolved checkpatch warnings in N phy Arend van Spriel
2011-07-18 14:29 ` [PATCH 04/19] staging: brcm80211: fixed build issue for big endian platforms Arend van Spriel
2011-07-18 14:29 ` [PATCH 05/19] staging: brcm80211: remove MIPS specific 'sync' instruction in fullmac Arend van Spriel
2011-07-18 14:29 ` [PATCH 06/19] staging: brcm80211: removed R_REG and OR_REG macro's from fullmac Arend van Spriel
2011-07-18 14:29 ` [PATCH 07/19] staging: brcm80211: removed global variable from sdio fullmac Arend van Spriel
2011-07-18 14:29 ` [PATCH 08/19] staging: brcm80211: replace simple_strtoul usage in brcmsmac Arend van Spriel
2011-07-18 14:29 ` [PATCH 09/19] staging: brcm80211: remove private timeout functions in fullmac Arend van Spriel
2011-07-18 14:29 ` [PATCH 10/19] staging: brcm80211: move brcmf_mmc_suspend to sdio layer " Arend van Spriel
2011-07-18 14:29 ` [PATCH 11/19] staging: brcm80211: remove global wait queue head sdioh_spinwait_sleep Arend van Spriel
2011-07-18 14:29 ` [PATCH 12/19] staging: brcm80211: remove code for unsupported chip Arend van Spriel
2011-07-18 19:42   ` Dan Carpenter
2011-07-18 21:18     ` Franky Lin
2011-07-18 21:34       ` Pavel Roskin
2011-07-18 22:23         ` Franky Lin
2011-07-19  5:44         ` Dan Carpenter
2011-07-19 12:36           ` Pavel Roskin
2011-07-18 14:29 ` [PATCH 13/19] staging: brcm80211: get rid of sd debug message macro in fullmac Arend van Spriel
2011-07-18 14:30 ` [PATCH 14/19] staging: brcm80211: remove structure sdio_hc in brcmfmac Arend van Spriel
2011-07-18 14:30 ` [PATCH 15/19] staging: brcm80211: remove SDLX_MSG from brcmfmac Arend van Spriel
2011-07-18 14:30 ` [PATCH 16/19] staging: brcm80211: remove BRCMF_SD_* debug macros " Arend van Spriel
2011-07-18 14:30 ` [PATCH 17/19] staging: brcm80211: absorb brcmf_sdcard_attach into brcmf_sdio_probe Arend van Spriel
2011-07-18 14:30 ` Arend van Spriel [this message]
2011-07-18 14:30 ` [PATCH 19/19] staging: brcm80211: replace simple_strtoul usage in brcmfmac 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=1310999405-10062-19-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).