From: "Arend van Spriel" <arend@broadcom.com>
To: gregkh@suse.de
Cc: devel@linuxdriverproject.org, linux-wireless@vger.kernel.org,
"Franky Lin" <frankyl@broadcom.com>,
"Arend van Spriel" <arend@broadcom.com>
Subject: [PATCHv2 51/82] staging: brcm80211: absorb brcmf_sdcard_attach into brcmf_sdio_probe
Date: Mon, 8 Aug 2011 15:58:35 +0200 [thread overview]
Message-ID: <1312811946-16713-52-git-send-email-arend@broadcom.com> (raw)
In-Reply-To: <1312811946-16713-1-git-send-email-arend@broadcom.com>
From: Franky Lin <frankyl@broadcom.com>
Increase readability of brcmfmac
Reviewed-by: Roland Vossen <rvossen@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
---
drivers/staging/brcm80211/brcmfmac/bcmsdh.c | 68 +++++++++--------------
drivers/staging/brcm80211/brcmfmac/sdio_host.h | 11 ----
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, ®s);
- 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);
--
1.7.4.1
next prev parent reply other threads:[~2011-08-08 13:59 UTC|newest]
Thread overview: 92+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-08 13:57 [PATCHv2 00/82] staging: brcm80211: resubmit previously posted patches Arend van Spriel
2011-08-08 13:57 ` [PATCHv2 01/82] staging: brcm80211: fix compile error on non-x86 archs since 3.0 kernel Arend van Spriel
2011-08-08 16:28 ` Arend van Spriel
2011-08-23 20:02 ` Greg KH
2011-08-08 13:57 ` [PATCHv2 02/82] staging: brcm80211: bugfix for len==0 parameter in 3 fullmac functions Arend van Spriel
2011-08-08 13:57 ` [PATCHv2 03/82] staging: brcm80211: merged bmac.c into main.c Arend van Spriel
2011-08-08 13:57 ` [PATCHv2 04/82] staging: brcm80211: shuffled sections in main.c Arend van Spriel
2011-08-08 13:57 ` [PATCHv2 05/82] staging: brcm80211: removed function declaration typedefs from phy_int.h Arend van Spriel
2011-08-08 13:57 ` [PATCHv2 06/82] staging: brcm80211: removed function declaration typedefs from aiutils.h Arend van Spriel
2011-08-08 13:57 ` [PATCHv2 07/82] staging: brcm80211: removed function declaration typedefs from dma.h part 1 Arend van Spriel
2011-08-08 13:57 ` [PATCHv2 08/82] staging: brcm80211: removed function declaration typedefs from dma.h part 2 Arend van Spriel
2011-08-08 13:57 ` [PATCHv2 09/82] staging: brcm80211: removed function declaration typedefs from dma.h part 3 Arend van Spriel
2011-08-08 13:57 ` [PATCHv2 10/82] staging: brcm80211: removed function declaration typedefs from dma.h part 4 Arend van Spriel
2011-08-08 13:57 ` [PATCHv2 11/82] staging: brcm80211: removed function declaration typedefs from otp.c Arend van Spriel
2011-08-08 13:57 ` [PATCHv2 12/82] staging: brcm80211: removed function declaration typedefs from main.h,pub.h Arend van Spriel
2011-08-08 13:57 ` [PATCHv2 13/82] staging: brcm80211: removed function declaration typedefs from brcmutil Arend van Spriel
2011-08-08 13:57 ` [PATCHv2 14/82] staging: brcm80211: replaced various typedefs Arend van Spriel
2011-08-08 13:57 ` [PATCHv2 15/82] staging: brcm80211: replaced typedef wlc_rateset_t Arend van Spriel
2011-08-08 13:58 ` [PATCHv2 16/82] staging: brcm80211: replaced typedef wl_rateset_t by struct brcm_rateset Arend van Spriel
2011-08-08 13:58 ` [PATCHv2 17/82] staging: brcm80211: replaced all volatile typedefs Arend van Spriel
2011-08-08 13:58 ` [PATCHv2 18/82] staging: brcm80211: modify the FOREACH_BSS macro Arend van Spriel
2011-08-08 13:58 ` [PATCHv2 19/82] staging: brcm80211: use mutex instead of semaphore in dhd_linux.c Arend van Spriel
2011-08-08 13:58 ` [PATCHv2 20/82] staging: brcm80211: remove duplicated code from brcmf_init_iscan Arend van Spriel
2011-08-08 13:58 ` [PATCHv2 21/82] staging: brcm80211: remove volatile keyword from driver sources Arend van Spriel
2011-08-08 13:58 ` [PATCHv2 22/82] staging: brcm80211: use native error code in brcmf_c_pattern_atoh() Arend van Spriel
2011-08-08 13:58 ` [PATCHv2 23/82] staging: brcm80211: fix for checkpatch 'avoid externs in c file' warning Arend van Spriel
2011-08-08 13:58 ` [PATCHv2 24/82] staging: brcm80211: power save issue fixed in brcmfmac driver Arend van Spriel
2011-08-08 13:58 ` [PATCHv2 25/82] staging: brcm80211: brcmfmac: Enabling FW roaming by default Arend van Spriel
2011-08-08 13:58 ` [PATCHv2 26/82] staging: brcm80211: brcmfmac: Connect request made robust Arend van Spriel
2011-08-08 13:58 ` [PATCHv2 27/82] staging: brcm80211: use mac_pton() instead of own implementation Arend van Spriel
2011-08-08 13:58 ` [PATCHv2 28/82] staging: brcm80211: fix for 'remove unnecessary braces' checkpatch warning Arend van Spriel
2011-08-08 13:58 ` [PATCHv2 29/82] staging: brcm80211: brcmfmac: Fixed issues with iscan Arend van Spriel
2011-08-08 13:58 ` [PATCHv2 30/82] staging: brcm80211: brcmfmac: Roamed channel info passed to cfg80211 Arend van Spriel
2011-08-08 13:58 ` [PATCHv2 31/82] staging: brcm80211: move sdio related variables to dhd_sdio.c Arend van Spriel
2011-08-08 13:58 ` [PATCHv2 32/82] staging: brcm80211: move ioctl response wait code " Arend van Spriel
2011-08-08 13:58 ` [PATCHv2 33/82] staging: brcm80211: replace semaphore by wait_queue for sysioc thread Arend van Spriel
2011-08-08 13:58 ` [PATCHv2 34/82] staging: brcm80211: remove volatile keyword used in struct rte_console Arend van Spriel
2011-08-08 13:58 ` [PATCHv2 35/82] staging: brcm80211: fix for checkpatch warnings in phy directory Arend van Spriel
2011-08-08 13:58 ` [PATCHv2 36/82] staging: brcm80211: resolved checkpatch warnings in LCN phy Arend van Spriel
2011-08-08 13:58 ` [PATCHv2 37/82] staging: brcm80211: resolved checkpatch warnings in N phy Arend van Spriel
2011-08-08 13:58 ` [PATCHv2 38/82] staging: brcm80211: fixed build issue for big endian platforms Arend van Spriel
2011-08-08 13:58 ` [PATCHv2 39/82] staging: brcm80211: remove MIPS specific 'sync' instruction in fullmac Arend van Spriel
2011-08-08 13:58 ` [PATCHv2 40/82] staging: brcm80211: removed R_REG and OR_REG macro's from fullmac Arend van Spriel
2011-08-08 13:58 ` [PATCHv2 41/82] staging: brcm80211: removed global variable from sdio fullmac Arend van Spriel
2011-08-08 13:58 ` [PATCHv2 42/82] staging: brcm80211: replace simple_strtoul usage in brcmsmac Arend van Spriel
2011-08-08 13:58 ` [PATCHv2 43/82] staging: brcm80211: remove private timeout functions in fullmac Arend van Spriel
2011-08-08 13:58 ` [PATCHv2 44/82] staging: brcm80211: move brcmf_mmc_suspend to sdio layer " Arend van Spriel
2011-08-08 13:58 ` [PATCHv2 45/82] staging: brcm80211: remove global wait queue head sdioh_spinwait_sleep Arend van Spriel
2011-08-08 13:58 ` [PATCHv2 46/82] staging: brcm80211: remove code for unsupported chip Arend van Spriel
2011-08-08 13:58 ` [PATCHv2 47/82] staging: brcm80211: get rid of sd debug message macro in fullmac Arend van Spriel
2011-08-08 13:58 ` [PATCHv2 48/82] staging: brcm80211: remove structure sdio_hc in brcmfmac Arend van Spriel
2011-08-08 13:58 ` [PATCHv2 49/82] staging: brcm80211: remove SDLX_MSG from brcmfmac Arend van Spriel
2011-08-08 13:58 ` [PATCHv2 50/82] staging: brcm80211: remove BRCMF_SD_* debug macros " Arend van Spriel
2011-08-08 13:58 ` Arend van Spriel [this message]
2011-08-08 13:58 ` [PATCHv2 52/82] staging: brcm80211: absorb brcmf_sdcard_detach into brcmf_sdio_remove Arend van Spriel
2011-08-08 13:58 ` [PATCHv2 53/82] staging: brcm80211: replace simple_strtoul usage in brcmfmac Arend van Spriel
2011-08-08 13:58 ` [PATCHv2 54/82] staging: brcm80211: fixed checkpatch warnings for fullmac Arend van Spriel
2011-08-08 13:58 ` [PATCHv2 55/82] staging: brcm80211: fixed checkpatch warnings for brcmutil dir Arend van Spriel
2011-08-08 13:58 ` [PATCHv2 56/82] staging: brcm80211: fixed checkpatch warnings for 'include' dir Arend van Spriel
2011-08-08 13:58 ` [PATCHv2 57/82] staging: brcm80211: use PCI_DEVICE() macro in device table Arend van Spriel
2011-08-08 13:58 ` [PATCHv2 58/82] staging: brcm80211: remove unused rx status definitions Arend van Spriel
2011-08-08 13:58 ` [PATCHv2 59/82] staging: brcm80211: reformat long lines in brcmsmac to 80 columns Arend van Spriel
2011-08-08 13:58 ` [PATCHv2 60/82] staging: brcm80211: remove wl_alloc_dma_resources() function Arend van Spriel
2011-08-08 13:58 ` [PATCHv2 61/82] staging: brcm80211: remove dma_addrwidth() function Arend van Spriel
2011-08-08 13:58 ` [PATCHv2 62/82] staging: brcm80211: revert removal of atomic initialization Arend van Spriel
2011-08-08 13:58 ` [PATCHv2 63/82] staging: brcm80211: cleaned up softmac DMA layer Arend van Spriel
2011-08-08 13:58 ` [PATCHv2 64/82] staging: brcm80211: removed void * from softmac phy Arend van Spriel
2011-08-08 13:58 ` [PATCHv2 65/82] staging: brcm80211: simplified register access macro's in softmac Arend van Spriel
2011-08-08 13:58 ` [PATCHv2 66/82] staging: brcm80211: placed suspend flag in gInstance in brcmfmac Arend van Spriel
2011-08-08 13:58 ` [PATCHv2 67/82] staging: brcm80211: remove struct brcmf_sdioh_driver from brcmfmac Arend van Spriel
2011-08-08 13:58 ` [PATCHv2 68/82] staging: brcm80211: remove vendor and device id check " Arend van Spriel
2011-08-08 13:58 ` [PATCHv2 69/82] staging: brcm80211: remove struct brcmf_sdio_card " Arend van Spriel
2011-08-08 13:58 ` [PATCHv2 70/82] staging: brcm80211: remove dead code " Arend van Spriel
2011-08-08 13:58 ` [PATCHv2 71/82] staging: brcm80211: remove dead client interrupt " Arend van Spriel
2011-08-08 13:58 ` [PATCHv2 72/82] staging: brcm80211: remove function pointer of interrupt isr in brcmfmac Arend van Spriel
2011-08-08 13:58 ` [PATCHv2 73/82] staging: brcm80211: cleanup to get rid of 'over 80 character' line Arend van Spriel
2011-08-08 13:58 ` [PATCHv2 74/82] staging: brcm80211: removed unused bus code from softmac Arend van Spriel
2011-08-08 13:58 ` [PATCHv2 75/82] staging: brcm80211: replaced void *btparam into struct pci_dev *btparam Arend van Spriel
2011-08-08 13:59 ` [PATCHv2 76/82] staging: brcm80211: removed void * from ai_ functions Arend van Spriel
2011-08-08 13:59 ` [PATCHv2 77/82] staging: brcm80211: removed brcms_c_module_unregister() call in ampdu.c Arend van Spriel
2011-08-08 13:59 ` [PATCHv2 78/82] staging: brcm80211: removed watchdog function from softmac Arend van Spriel
2011-08-08 13:59 ` [PATCHv2 79/82] staging: brcm80211: SPARC build error fix Arend van Spriel
2011-08-08 13:59 ` [PATCHv2 80/82] staging: brcm80211: fix 'uninitialized usage' compiler warning Arend van Spriel
2011-08-08 13:59 ` [PATCHv2 81/82] staging: brcm80211: remove target platform limitations for drivers Arend van Spriel
2011-08-08 13:59 ` [PATCHv2 82/82] staging: brcm80211: updated TODO file Arend van Spriel
2011-08-08 14:29 ` [PATCHv2 00/82] staging: brcm80211: resubmit previously posted patches Sedat Dilek
2011-08-08 14:53 ` Dan Carpenter
2011-08-08 16:10 ` Arend van Spriel
2011-08-08 16:32 ` Greg KH
2011-08-08 16:38 ` Arend van Spriel
2011-08-23 20:01 ` Greg KH
2011-08-24 10:45 ` 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=1312811946-16713-52-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).