summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFranky Lin <frankyl@broadcom.com>2011-08-08 15:58:35 +0200
committerGreg Kroah-Hartman <gregkh@suse.de>2011-08-23 13:00:04 -0700
commit0f188ea3d9c8457cdc788bb509929908b80efe46 (patch)
tree2af11a905089f0d630b2622b235d4ccb155b51dc
parent1a1038033ea08bf4f82e6abbdd9fbed5df2148c8 (diff)
downloadop-kernel-dev-0f188ea3d9c8457cdc788bb509929908b80efe46.zip
op-kernel-dev-0f188ea3d9c8457cdc788bb509929908b80efe46.tar.gz
staging: brcm80211: absorb brcmf_sdcard_attach into brcmf_sdio_probe
Increase readability of brcmfmac Reviewed-by: Roland Vossen <rvossen@broadcom.com> Signed-off-by: Arend van Spriel <arend@broadcom.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/staging/brcm80211/brcmfmac/bcmsdh.c68
-rw-r--r--drivers/staging/brcm80211/brcmfmac/sdio_host.h11
2 files changed, 27 insertions, 52 deletions
diff --git a/drivers/staging/brcm80211/brcmfmac/bcmsdh.c b/drivers/staging/brcm80211/brcmfmac/bcmsdh.c
index 53dfecd..6f88bd2 100644
--- a/drivers/staging/brcm80211/brcmfmac/bcmsdh.c
+++ b/drivers/staging/brcm80211/brcmfmac/bcmsdh.c
@@ -57,32 +57,6 @@ static struct brcmf_sdioh_driver drvinfo = { NULL, NULL };
module_param(sd_f2_blocksize, int, 0);
-struct brcmf_sdio_card*
-brcmf_sdcard_attach(void *cfghdl, u32 *regsva)
-{
- struct brcmf_sdio_card *card;
-
- card = kzalloc(sizeof(struct brcmf_sdio_card), GFP_ATOMIC);
- if (card == NULL) {
- BRCMF_ERROR(("sdcard_attach: out of memory"));
- return NULL;
- }
-
- card->sdioh = brcmf_sdioh_attach(cfghdl);
- if (!card->sdioh) {
- brcmf_sdcard_detach(card);
- return NULL;
- }
-
- card->init_success = true;
-
- *regsva = SI_ENUM_BASE;
-
- /* Report the BAR, to fix if needed */
- card->sbwad = SI_ENUM_BASE;
- return card;
-}
-
int brcmf_sdcard_detach(struct brcmf_sdio_card *card)
{
if (card != NULL) {
@@ -455,35 +429,47 @@ u32 brcmf_sdcard_cur_sbwad(struct brcmf_sdio_card *card)
int brcmf_sdio_probe(struct brcmf_sdio_dev *sdiodev)
{
u32 regs = 0;
- struct brcmf_sdio_card *card = NULL;
u32 vendevid;
+ int ret = 0;
+
+ sdiodev->card = kzalloc(sizeof(struct brcmf_sdio_card), GFP_ATOMIC);
+ if (sdiodev->card == NULL) {
+ BRCMF_ERROR(("sdcard_attach: out of memory"));
+ ret = -ENOMEM;
+ goto out;
+ }
- card = brcmf_sdcard_attach((void *)0, &regs);
- if (!card) {
- BRCMF_ERROR(("%s: attach failed\n", __func__));
- goto err;
+ sdiodev->card->sdioh = brcmf_sdioh_attach((void *)0);
+ if (!sdiodev->card->sdioh) {
+ brcmf_sdcard_detach(sdiodev->card);
+ ret = -ENODEV;
+ goto out;
}
- sdiodev->card = card;
+
+ sdiodev->card->init_success = true;
+
+ regs = SI_ENUM_BASE;
+
+ /* Report the BAR, to fix if needed */
+ sdiodev->card->sbwad = SI_ENUM_BASE;
/* Read the vendor/device ID from the CIS */
- vendevid = brcmf_sdcard_query_device(card);
+ vendevid = brcmf_sdcard_query_device(sdiodev->card);
/* try to attach to the target device */
sdiodev->bus = drvinfo.attach((vendevid >> 16), (vendevid & 0xFFFF),
- 0, 0, 0, 0, regs, card);
+ 0, 0, 0, 0, regs, sdiodev->card);
if (!sdiodev->bus) {
BRCMF_ERROR(("%s: device attach failed\n", __func__));
- goto err;
+ ret = -ENODEV;
+ goto out;
}
- return 0;
-
- /* error handling */
-err:
- if (sdiodev->card)
+out:
+ if ((ret) && (sdiodev->card))
brcmf_sdcard_detach(sdiodev->card);
- return -ENODEV;
+ return ret;
}
EXPORT_SYMBOL(brcmf_sdio_probe);
diff --git a/drivers/staging/brcm80211/brcmfmac/sdio_host.h b/drivers/staging/brcm80211/brcmfmac/sdio_host.h
index 5e7552e..68b6843 100644
--- a/drivers/staging/brcm80211/brcmfmac/sdio_host.h
+++ b/drivers/staging/brcm80211/brcmfmac/sdio_host.h
@@ -136,17 +136,6 @@ struct brcmf_sdio_dev {
void *bus;
};
-/* Attach and build an interface to the underlying SD host driver.
- * - Allocates resources (structs, arrays, mem, OS handles, etc) needed by
- * brcmf_sdcard.
- * - Returns the sdio card handle and virtual address base for register access.
- * The returned handle should be used in all subsequent calls, but the bcmsh
- * implementation may maintain a single "default" handle (e.g. the first or
- * most recent one) to enable single-instance implementations to pass NULL.
- */
-extern struct brcmf_sdio_card*
-brcmf_sdcard_attach(void *cfghdl, u32 *regsva);
-
/* Detach - freeup resources allocated in attach */
extern int brcmf_sdcard_detach(struct brcmf_sdio_card *card);
OpenPOWER on IntegriCloud