2011-08-12 13:35:14

by Arend van Spriel

[permalink] [raw]
Subject: [PATCH 00/14] staging: brcm80211: brcmfmac driver cleanup

Several cleanup patches to reduce code for the brcmfmac driver and
get rid of a remaining checkpatch warning. The driver sources should
be clear from checkpatch issue now.

This series applies to staging-next and depends on the following patch set:

Message-ID: <[email protected]>

Arend van Spriel (1):
staging: brcm80211: use wait queues instead of semaphores in
wl_cfg80211.c

Franky Lin (13):
staging: brcm80211: remove iovar IOV_BLOCKSIZE in brcmfmac
staging: brcm80211: remove struct sdioh_info from brcmfmac
staging: brcm80211: remove global var gInstance from brcmfmac
staging: brcm80211: remove wext traces in fullmac
staging: brcm80211: absorb brcmf_sdioh_iovar_op into
brcmf_sdcard_iovar_op
staging: brcm80211: absorb brcmf_sdioh_interrupt_register into
brcmf_sdcard_intr_reg
staging: brcm80211: absorb brcmf_sdioh_interrupt_deregister into
brcmf_sdcard_intr_dereg
staging: brcm80211: absorb brcmf_sdioh_abort into brcmf_sdcard_abort
staging: brcm80211: remove dead code from dhd_sdio.c
staging: brcm80211: remove wrapper functions in bcmsdh_sdmmc.c
staging: brcm80211: remove unused parameter from data interface in
fullmac
staging: brcm80211: remove dead SDTEST code from fullmac
staging: brcm80211: remove unused func parameter in wl_cfg80211 of
fullmac

drivers/staging/brcm80211/Kconfig | 2 -
drivers/staging/brcm80211/brcmfmac/bcmsdh.c | 197 +++++-
drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c | 555 ++++------------
drivers/staging/brcm80211/brcmfmac/dhd.h | 37 -
drivers/staging/brcm80211/brcmfmac/dhd_sdio.c | 744 ++-------------------
drivers/staging/brcm80211/brcmfmac/sdio_host.h | 80 +--
drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c | 74 ++-
drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h | 5 +-
8 files changed, 409 insertions(+), 1285 deletions(-)

--
1.7.4.1




2011-08-12 15:43:36

by Rafał Miłecki

[permalink] [raw]
Subject: Re: [PATCH 00/14] staging: brcm80211: brcmfmac driver cleanup

W dniu 12 sierpnia 2011 17:14 użytkownik Hauke Mehrtens
<[email protected]> napisał:
> On 08/12/2011 04:02 PM, Rafał Miłecki wrote:
>> 2011/8/12 Arend van Spriel <[email protected]>:
>>> Several cleanup patches to reduce code for the brcmfmac driver and
>>> get rid of a remaining checkpatch warning. The driver sources should
>>> be clear from checkpatch issue now.
>>>
>>> This series applies to staging-next and depends on the following patch set:
>>
>> Are you testing patches on some hardware? Or just compile-testing?
>>
>> I believe this driver is meant to support BCM4329, which is not PCI(e)
>> board. What adapter do you use?
>>
>> I've heard about Arasan adapter. Have you tried it? Is that something
>> reachable from arasan.com?
>>
>
> Is there also a softmac version of the BCM4329 available? The wl driver
> shipped with the vendor firmware of my BCM4716 device detects one of the
> wifi chips as BCM4329. I think it is the one in the BCM4716 and that is
> already supported by b43. Or is this a wrong information?
>
> Here is the output of the kernel log:
> eth0: Broadcom BCM47XX 10/100/1000 Mbps Ethernet Controller 5.10.144.3
> eth1: Broadcom BCM4329 802.11 Wireless Controller 5.10.144.5
> PCI: Enabling device 01:01.0 (0000 -> 0002)
> eth2: Broadcom BCMa8d8 802.11 Wireless Controller 5.10.144.5

Please, try lspci and if you can, b43. I believe that is 14e4:4329
which is BCM4321.

Why wl can't properly print chipset name - ask Broadcom.

--
Rafał

2011-08-12 14:02:22

by Rafał Miłecki

[permalink] [raw]
Subject: Re: [PATCH 00/14] staging: brcm80211: brcmfmac driver cleanup

2011/8/12 Arend van Spriel <[email protected]>:
> Several cleanup patches to reduce code for the brcmfmac driver and
> get rid of a remaining checkpatch warning. The driver sources should
> be clear from checkpatch issue now.
>
> This series applies to staging-next and depends on the following patch set:

Are you testing patches on some hardware? Or just compile-testing?

I believe this driver is meant to support BCM4329, which is not PCI(e)
board. What adapter do you use?

I've heard about Arasan adapter. Have you tried it? Is that something
reachable from arasan.com?

--
Rafał

2011-08-12 13:35:12

by Arend van Spriel

[permalink] [raw]
Subject: [PATCH 13/14] staging: brcm80211: remove dead SDTEST code from fullmac

From: Franky Lin <[email protected]>

Remove legacy dead code of SDTEST

Reviewed-by: Arend van Spriel <[email protected]>
Reviewed-by: Roland Vossen <[email protected]>
Signed-off-by: Arend van Spriel <[email protected]>
---
drivers/staging/brcm80211/brcmfmac/dhd.h | 37 --
drivers/staging/brcm80211/brcmfmac/dhd_sdio.c | 455 +------------------------
2 files changed, 1 insertions(+), 491 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmfmac/dhd.h b/drivers/staging/brcm80211/brcmfmac/dhd.h
index cd1b90d..ae8a9a6 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd.h
+++ b/drivers/staging/brcm80211/brcmfmac/dhd.h
@@ -672,15 +672,6 @@ extern uint brcmf_radio_up;
/* Override to force tx queueing all the time */
extern uint brcmf_force_tx_queueing;

-#ifdef SDTEST
-/* Echo packet generator (SDIO), pkts/s */
-extern uint brcmf_pktgen;
-
-/* Echo packet len (0 => sawtooth, max 1800) */
-extern uint brcmf_pktgen_len;
-#define BRCMF_MAX_PKTGEN_LEN 1800
-#endif
-
extern const struct bcmevent_name bcmevent_names[];
extern const int bcmevent_names_size;

@@ -823,34 +814,6 @@ struct brcmf_c_ioctl {
#define BRCMF_BTA_VAL 0x1000
#define BRCMF_ISCAN_VAL 0x2000

-#ifdef SDTEST
-/* For pktgen iovar */
-struct brcmf_pktgen {
- uint version; /* To allow structure change tracking */
- uint freq; /* Max ticks between tx/rx attempts */
- uint count; /* Test packets to send/rcv each attempt */
- uint print; /* Print counts every <print> attempts */
- uint total; /* Total packets (or bursts) */
- uint minlen; /* Minimum length of packets to send */
- uint maxlen; /* Maximum length of packets to send */
- uint numsent; /* Count of test packets sent */
- uint numrcvd; /* Count of test packets received */
- uint numfail; /* Count of test send failures */
- uint mode; /* Test mode (type of test packets) */
- uint stop; /* Stop after this many tx failures */
-};
-
-/* Version in case structure changes */
-#define BRCMF_PKTGEN_VERSION 2
-
-/* Type of test packets to use */
-#define BRCMF_PKTGEN_ECHO 1 /* Send echo requests */
-#define BRCMF_PKTGEN_SEND 2 /* Send discard packets */
-#define BRCMF_PKTGEN_RXBURST 3 /* Request dongle send N packets */
-#define BRCMF_PKTGEN_RECV 4 /* Continuous rx from continuous
- tx dongle */
-#endif /* SDTEST */
-
/* Enter idle immediately (no timeout) */
#define BRCMF_IDLE_IMMEDIATE (-1)

diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c b/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
index 60e7a814..cc321d6 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
+++ b/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
@@ -251,11 +251,7 @@ struct rte_console {

/* Total length of frame header for dongle protocol */
#define SDPCM_HDRLEN (SDPCM_FRAMETAG_LEN + SDPCM_SWHEADER_LEN)
-#ifdef SDTEST
-#define SDPCM_RESERVE (SDPCM_HDRLEN + SDPCM_TEST_HDRLEN + BRCMF_SDALIGN)
-#else
#define SDPCM_RESERVE (SDPCM_HDRLEN + BRCMF_SDALIGN)
-#endif

/*
* Software allocation of To SB Mailbox resources
@@ -661,30 +657,6 @@ struct brcmf_bus {
/* Field to decide if rx of control frames happen in rxbuf or lb-pool */
bool usebufpool;

-#ifdef SDTEST
- /* external loopback */
- bool ext_loop;
- u8 loopid;
-
- /* pktgen configuration */
- uint pktgen_freq; /* Ticks between bursts */
- uint pktgen_count; /* Packets to send each burst */
- uint pktgen_print; /* Bursts between count displays */
- uint pktgen_total; /* Stop after this many */
- uint pktgen_minlen; /* Minimum packet data len */
- uint pktgen_maxlen; /* Maximum packet data len */
- uint pktgen_mode; /* Configured mode: tx, rx, or echo */
- uint pktgen_stop; /* Number of tx failures causing stop */
-
- /* active pktgen fields */
- uint pktgen_tick; /* Tick counter for bursts */
- uint pktgen_ptick; /* Burst counter for printing */
- uint pktgen_sent; /* Number of test packets generated */
- uint pktgen_rcvd; /* Number of test packets received */
- uint pktgen_fail; /* Number of failed send attempts */
- u16 pktgen_len; /* Length of next packet to send */
-#endif /* SDTEST */
-
/* Some additional counters */
uint tx_sderrs; /* Count of tx attempts with sd errors */
uint fcqueued; /* Tx packets that got queued */
@@ -915,11 +887,6 @@ w_sdreg32(struct brcmf_bus *bus, u32 regval, u32 reg_offset, u32 *retryvar)

#define HOSTINTMASK (I_HMB_SW_MASK | I_CHIPACTIVE)

-#ifdef SDTEST
-static void brcmf_sdbrcm_checkdied(struct brcmf_bus *bus, void *pkt, uint seq);
-static void brcmf_sdbrcm_sdtest_set(struct brcmf_bus *bus, bool start);
-#endif
-
#ifdef BCMDBG
static int brcmf_sdbrcm_bus_console_in(struct brcmf_pub *drvr,
unsigned char *msg, uint msglen);
@@ -1469,20 +1436,6 @@ int brcmf_sdbrcm_bus_txdata(struct brcmf_bus *bus, struct sk_buff *pkt)

datalen = pkt->len;

-#ifdef SDTEST
- /* Push the test header if doing loopback */
- if (bus->ext_loop) {
- u8 *data;
- skb_push(pkt, SDPCM_TEST_HDRLEN);
- data = pkt->data;
- *data++ = SDPCM_TEST_ECHOREQ;
- *data++ = (u8) bus->loopid++;
- *data++ = (datalen >> 0);
- *data++ = (datalen >> 8);
- datalen += SDPCM_TEST_HDRLEN;
- }
-#endif /* SDTEST */
-
/* Add space for the header */
skb_push(pkt, SDPCM_HDRLEN);
/* precondition: IS_ALIGNED((unsigned long)(pkt->data), 2) */
@@ -1534,14 +1487,8 @@ int brcmf_sdbrcm_bus_txdata(struct brcmf_bus *bus, struct sk_buff *pkt)
/* Make sure back plane ht clk is on, no pending allowed */
brcmf_sdbrcm_clkctl(bus, CLK_AVAIL, true);

-#ifndef SDTEST
BRCMF_TRACE(("%s: calling txpkt\n", __func__));
ret = brcmf_sdbrcm_txpkt(bus, pkt, SDPCM_DATA_CHANNEL, true);
-#else
- ret = brcmf_sdbrcm_txpkt(bus, pkt,
- (bus->ext_loop ? SDPCM_TEST_CHANNEL :
- SDPCM_DATA_CHANNEL), true);
-#endif
if (ret)
bus->drvr->tx_errors++;
else
@@ -1586,13 +1533,7 @@ static uint brcmf_sdbrcm_sendfromq(struct brcmf_bus *bus, uint maxframes)
spin_unlock_bh(&bus->txqlock);
datalen = pkt->len - SDPCM_HDRLEN;

-#ifndef SDTEST
ret = brcmf_sdbrcm_txpkt(bus, pkt, SDPCM_DATA_CHANNEL, true);
-#else
- ret = brcmf_sdbrcm_txpkt(bus, pkt,
- (bus->ext_loop ? SDPCM_TEST_CHANNEL :
- SDPCM_DATA_CHANNEL), true);
-#endif
if (ret)
bus->drvr->tx_errors++;
else
@@ -1857,10 +1798,6 @@ enum {
IOV_ALIGNCTL,
IOV_SDALIGN,
IOV_DEVRESET,
-#ifdef SDTEST
- IOV_PKTGEN,
- IOV_EXTLOOP,
-#endif /* SDTEST */
IOV_TXBOUND,
IOV_RXBOUND,
IOV_TXMINMAX,
@@ -1912,12 +1849,6 @@ const struct brcmu_iovar brcmf_sdio_iovars[] = {
{"checkdied", IOV_CHECKDIED, 0, IOVT_BUFFER, 0}
,
#endif /* BCMDBG */
-#ifdef SDTEST
- {"extloop", IOV_EXTLOOP, 0, IOVT_BOOL, 0}
- ,
- {"pktgen", IOV_PKTGEN, 0, IOVT_BUFFER, sizeof(struct brcmf_pktgen)}
- ,
-#endif /* SDTEST */

{NULL, 0, 0, 0, 0}
};
@@ -2011,19 +1942,6 @@ void brcmf_sdbrcm_bus_dump(struct brcmf_pub *drvr, struct brcmu_strbuf *strbuf)
brcmu_bprintf(strbuf, "\n\n");
}

-#ifdef SDTEST
- if (bus->pktgen_count) {
- brcmu_bprintf(strbuf, "pktgen config and count:\n");
- brcmu_bprintf(strbuf,
- "freq %d count %d print %d total %d min %d len %d\n",
- bus->pktgen_freq, bus->pktgen_count,
- bus->pktgen_print, bus->pktgen_total,
- bus->pktgen_minlen, bus->pktgen_maxlen);
- brcmu_bprintf(strbuf, "send attempts %d rcvd %d fail %d\n",
- bus->pktgen_sent, bus->pktgen_rcvd,
- bus->pktgen_fail);
- }
-#endif /* SDTEST */
#ifdef BCMDBG
brcmu_bprintf(strbuf, "dpc_sched %d host interrupt%spending\n",
bus->dpc_sched, " not ");
@@ -2048,62 +1966,6 @@ void brcmf_bus_clearcounts(struct brcmf_pub *drvr)
bus->f2rxhdrs = bus->f2rxdata = bus->f2txdata = bus->f1regdata = 0;
}

-#ifdef SDTEST
-static int brcmf_sdbrcm_pktgen_get(struct brcmf_bus *bus, u8 *arg)
-{
- struct brcmf_pktgen pktgen;
-
- pktgen.version = BRCMF_PKTGEN_VERSION;
- pktgen.freq = bus->pktgen_freq;
- pktgen.count = bus->pktgen_count;
- pktgen.print = bus->pktgen_print;
- pktgen.total = bus->pktgen_total;
- pktgen.minlen = bus->pktgen_minlen;
- pktgen.maxlen = bus->pktgen_maxlen;
- pktgen.numsent = bus->pktgen_sent;
- pktgen.numrcvd = bus->pktgen_rcvd;
- pktgen.numfail = bus->pktgen_fail;
- pktgen.mode = bus->pktgen_mode;
- pktgen.stop = bus->pktgen_stop;
-
- memcpy(arg, &pktgen, sizeof(pktgen));
-
- return 0;
-}
-
-static int brcmf_sdbrcm_pktgen_set(struct brcmf_bus *bus, u8 *arg)
-{
- struct brcmf_pktgen pktgen;
- uint oldcnt, oldmode;
-
- memcpy(&pktgen, arg, sizeof(pktgen));
- if (pktgen.version != BRCMF_PKTGEN_VERSION)
- return -EINVAL;
-
- oldcnt = bus->pktgen_count;
- oldmode = bus->pktgen_mode;
-
- bus->pktgen_freq = pktgen.freq;
- bus->pktgen_count = pktgen.count;
- bus->pktgen_print = pktgen.print;
- bus->pktgen_total = pktgen.total;
- bus->pktgen_minlen = pktgen.minlen;
- bus->pktgen_maxlen = pktgen.maxlen;
- bus->pktgen_mode = pktgen.mode;
- bus->pktgen_stop = pktgen.stop;
-
- bus->pktgen_tick = bus->pktgen_ptick = 0;
- bus->pktgen_len = max(bus->pktgen_len, bus->pktgen_minlen);
- bus->pktgen_len = min(bus->pktgen_len, bus->pktgen_maxlen);
-
- /* Clear counts for a new pktgen (mode change, or was stopped) */
- if (bus->pktgen_count && (!oldcnt || oldmode != bus->pktgen_mode))
- bus->pktgen_sent = bus->pktgen_rcvd = bus->pktgen_fail = 0;
-
- return 0;
-}
-#endif /* SDTEST */
-
static int
brcmf_sdbrcm_membytes(struct brcmf_bus *bus, bool write, u32 address, u8 *data,
uint size)
@@ -2858,25 +2720,6 @@ static int brcmf_sdbrcm_doiovar(struct brcmf_bus *bus,
break;
#endif /* BCMDBG */

-#ifdef SDTEST
- case IOV_GVAL(IOV_EXTLOOP):
- int_val = (s32) bus->ext_loop;
- memcpy(arg, &int_val, val_size);
- break;
-
- case IOV_SVAL(IOV_EXTLOOP):
- bus->ext_loop = bool_val;
- break;
-
- case IOV_GVAL(IOV_PKTGEN):
- bcmerror = brcmf_sdbrcm_pktgen_get(bus, arg);
- break;
-
- case IOV_SVAL(IOV_PKTGEN):
- bcmerror = brcmf_sdbrcm_pktgen_set(bus, arg);
- break;
-#endif /* SDTEST */
-
case IOV_SVAL(IOV_DEVRESET):
BRCMF_TRACE(("%s: Called set IOV_DEVRESET=%d dongle_reset=%d "
"busstate=%d\n",
@@ -3943,20 +3786,8 @@ brcmf_sdbrcm_readframes(struct brcmf_bus *bus, uint maxframes, bool *finished)
int ifidx = 0;
uint rxcount = 0; /* Total frames read */

-#if defined(BCMDBG) || defined(SDTEST)
- bool sdtest = false; /* To limit message spew from test mode */
-#endif
-
BRCMF_TRACE(("%s: Enter\n", __func__));

-#ifdef SDTEST
- /* Allow pktgen to override maxframes */
- if (bus->pktgen_count && (bus->pktgen_mode == BRCMF_PKTGEN_RECV)) {
- maxframes = bus->pktgen_count;
- sdtest = true;
- }
-#endif
-
/* Not finished unless we encounter no more frames indication */
*finished = false;

@@ -4405,14 +4236,6 @@ deliver:
__skb_trim(pkt, len);
skb_pull(pkt, doff);

-#ifdef SDTEST
- /* Test channel packets are processed separately */
- if (chan == SDPCM_TEST_CHANNEL) {
- brcmf_sdbrcm_checkdied(bus, pkt, seq);
- continue;
- }
-#endif /* SDTEST */
-
if (pkt->len == 0) {
brcmu_pkt_buf_free_skb(pkt);
continue;
@@ -4431,7 +4254,7 @@ deliver:
rxcount = maxframes - rxleft;
#ifdef BCMDBG
/* Message if we hit the limit */
- if (!rxleft && !sdtest)
+ if (!rxleft)
BRCMF_DATA(("%s: hit rx limit of %d frames\n", __func__,
maxframes));
else
@@ -4810,268 +4633,6 @@ void brcmf_sdbrcm_isr(void *arg)

}

-#ifdef SDTEST
-static void brcmf_sdbrcm_pktgen_init(struct brcmf_bus *bus)
-{
- /* Default to specified length, or full range */
- if (brcmf_pktgen_len) {
- bus->pktgen_maxlen = min(brcmf_pktgen_len,
- BRCMF_MAX_PKTGEN_LEN);
- bus->pktgen_minlen = bus->pktgen_maxlen;
- } else {
- bus->pktgen_maxlen = BRCMF_MAX_PKTGEN_LEN;
- bus->pktgen_minlen = 0;
- }
- bus->pktgen_len = (u16) bus->pktgen_minlen;
-
- /* Default to per-watchdog burst with 10s print time */
- bus->pktgen_freq = 1;
- bus->pktgen_print = 10000 / brcmf_watchdog_ms;
- bus->pktgen_count = (brcmf_pktgen * brcmf_watchdog_ms + 999) / 1000;
-
- /* Default to echo mode */
- bus->pktgen_mode = BRCMF_PKTGEN_ECHO;
- bus->pktgen_stop = 1;
-}
-
-static void brcmf_sdbrcm_pktgen(struct brcmf_bus *bus)
-{
- struct sk_buff *pkt;
- u8 *data;
- uint pktcount;
- uint fillbyte;
- u16 len;
-
- /* Display current count if appropriate */
- if (bus->pktgen_print && (++bus->pktgen_ptick >= bus->pktgen_print)) {
- bus->pktgen_ptick = 0;
- printk(KERN_DEBUG "%s: send attempts %d rcvd %d\n",
- __func__, bus->pktgen_sent, bus->pktgen_rcvd);
- }
-
- /* For recv mode, just make sure dongle has started sending */
- if (bus->pktgen_mode == BRCMF_PKTGEN_RECV) {
- if (!bus->pktgen_rcvd)
- brcmf_sdbrcm_sdtest_set(bus, true);
- return;
- }
-
- /* Otherwise, generate or request the specified number of packets */
- for (pktcount = 0; pktcount < bus->pktgen_count; pktcount++) {
- /* Stop if total has been reached */
- if (bus->pktgen_total
- && (bus->pktgen_sent >= bus->pktgen_total)) {
- bus->pktgen_count = 0;
- break;
- }
-
- /* Allocate an appropriate-sized packet */
- len = bus->pktgen_len;
- pkt = brcmu_pkt_buf_get_skb(
- len + SDPCM_HDRLEN + SDPCM_TEST_HDRLEN + BRCMF_SDALIGN,
- true);
- if (!pkt) {
- BRCMF_ERROR(("%s: brcmu_pkt_buf_get_skb failed!\n",
- __func__));
- break;
- }
- PKTALIGN(pkt, (len + SDPCM_HDRLEN + SDPCM_TEST_HDRLEN),
- BRCMF_SDALIGN);
- data = (u8 *) (pkt->data) + SDPCM_HDRLEN;
-
- /* Write test header cmd and extra based on mode */
- switch (bus->pktgen_mode) {
- case BRCMF_PKTGEN_ECHO:
- *data++ = SDPCM_TEST_ECHOREQ;
- *data++ = (u8) bus->pktgen_sent;
- break;
-
- case BRCMF_PKTGEN_SEND:
- *data++ = SDPCM_TEST_DISCARD;
- *data++ = (u8) bus->pktgen_sent;
- break;
-
- case BRCMF_PKTGEN_RXBURST:
- *data++ = SDPCM_TEST_BURST;
- *data++ = (u8) bus->pktgen_count;
- break;
-
- default:
- BRCMF_ERROR(("Unrecognized pktgen mode %d\n",
- bus->pktgen_mode));
- brcmu_pkt_buf_free_skb(pkt, true);
- bus->pktgen_count = 0;
- return;
- }
-
- /* Write test header length field */
- *data++ = (len >> 0);
- *data++ = (len >> 8);
-
- /* Then fill in the remainder -- N/A for burst,
- but who cares... */
- for (fillbyte = 0; fillbyte < len; fillbyte++)
- *data++ =
- SDPCM_TEST_FILL(fillbyte, (u8) bus->pktgen_sent);
-
-#ifdef BCMDBG
- if (BRCMF_BYTES_ON() && BRCMF_DATA_ON()) {
- data = (u8 *) (pkt->data) + SDPCM_HDRLEN;
- printk(KERN_DEBUG "brcmf_sdbrcm_pktgen: Tx Data:\n");
- print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, data,
- pkt->len - SDPCM_HDRLEN);
- }
-#endif
-
- /* Send it */
- if (brcmf_sdbrcm_txpkt(bus, pkt, SDPCM_TEST_CHANNEL, true)) {
- bus->pktgen_fail++;
- if (bus->pktgen_stop
- && bus->pktgen_stop == bus->pktgen_fail)
- bus->pktgen_count = 0;
- }
- bus->pktgen_sent++;
-
- /* Bump length if not fixed, wrap at max */
- if (++bus->pktgen_len > bus->pktgen_maxlen)
- bus->pktgen_len = (u16) bus->pktgen_minlen;
-
- /* Special case for burst mode: just send one request! */
- if (bus->pktgen_mode == BRCMF_PKTGEN_RXBURST)
- break;
- }
-}
-
-static void brcmf_sdbrcm_sdtest_set(struct brcmf_bus *bus, bool start)
-{
- struct sk_buff *pkt;
- u8 *data;
-
- /* Allocate the packet */
- pkt = brcmu_pkt_buf_get_skb(SDPCM_HDRLEN + SDPCM_TEST_HDRLEN +
- BRCMF_SDALIGN, true);
- if (!pkt) {
- BRCMF_ERROR(("%s: brcmu_pkt_buf_get_skb failed!\n", __func__));
- return;
- }
- PKTALIGN(pkt, (SDPCM_HDRLEN + SDPCM_TEST_HDRLEN), BRCMF_SDALIGN);
- data = (u8 *) (pkt->data) + SDPCM_HDRLEN;
-
- /* Fill in the test header */
- *data++ = SDPCM_TEST_SEND;
- *data++ = start;
- *data++ = (bus->pktgen_maxlen >> 0);
- *data++ = (bus->pktgen_maxlen >> 8);
-
- /* Send it */
- if (brcmf_sdbrcm_txpkt(bus, pkt, SDPCM_TEST_CHANNEL, true))
- bus->pktgen_fail++;
-}
-
-static void
-brcmf_sdbrcm_checkdied(struct brcmf_bus *bus, struct sk_buff *pkt, uint seq)
-{
- u8 *data;
- uint pktlen;
-
- u8 cmd;
- u8 extra;
- u16 len;
- u16 offset;
-
- /* Check for min length */
- pktlen = pkt->len;
- if (pktlen < SDPCM_TEST_HDRLEN) {
- BRCMF_ERROR(("brcmf_sdbrcm_checkdied: toss runt frame, pktlen "
- "%d\n", pktlen));
- brcmu_pkt_buf_free_skb(pkt, false);
- return;
- }
-
- /* Extract header fields */
- data = pkt->data;
- cmd = *data++;
- extra = *data++;
- len = *data++;
- len += *data++ << 8;
-
- /* Check length for relevant commands */
- if (cmd == SDPCM_TEST_DISCARD || cmd == SDPCM_TEST_ECHOREQ
- || cmd == SDPCM_TEST_ECHORSP) {
- if (pktlen != len + SDPCM_TEST_HDRLEN) {
- BRCMF_ERROR(("brcmf_sdbrcm_checkdied: frame length "
- "mismatch, pktlen %d seq %d"
- " cmd %d extra %d len %d\n",
- pktlen, seq, cmd, extra, len));
- brcmu_pkt_buf_free_skb(pkt, false);
- return;
- }
- }
-
- /* Process as per command */
- switch (cmd) {
- case SDPCM_TEST_ECHOREQ:
- /* Rx->Tx turnaround ok (even on NDIS w/current
- implementation) */
- *(u8 *) (pkt->data) = SDPCM_TEST_ECHORSP;
- if (brcmf_sdbrcm_txpkt(bus, pkt, SDPCM_TEST_CHANNEL, true) == 0)
- bus->pktgen_sent++;
- else {
- bus->pktgen_fail++;
- brcmu_pkt_buf_free_skb(pkt, false);
- }
- bus->pktgen_rcvd++;
- break;
-
- case SDPCM_TEST_ECHORSP:
- if (bus->ext_loop) {
- brcmu_pkt_buf_free_skb(pkt, false);
- bus->pktgen_rcvd++;
- break;
- }
-
- for (offset = 0; offset < len; offset++, data++) {
- if (*data != SDPCM_TEST_FILL(offset, extra)) {
- BRCMF_ERROR(("brcmf_sdbrcm_checkdied: echo"
- " data mismatch: "
- "offset %d (len %d) "
- "expect 0x%02x rcvd 0x%02x\n",
- offset, len,
- SDPCM_TEST_FILL(offset, extra),
- *data));
- break;
- }
- }
- brcmu_pkt_buf_free_skb(pkt, false);
- bus->pktgen_rcvd++;
- break;
-
- case SDPCM_TEST_DISCARD:
- brcmu_pkt_buf_free_skb(pkt, false);
- bus->pktgen_rcvd++;
- break;
-
- case SDPCM_TEST_BURST:
- case SDPCM_TEST_SEND:
- default:
- BRCMF_INFO(("brcmf_sdbrcm_checkdied: unsupported or unknown "
- "command, pktlen %d seq %d" " cmd %d extra %d"
- " len %d\n", pktlen, seq, cmd, extra, len));
- brcmu_pkt_buf_free_skb(pkt, false);
- break;
- }
-
- /* For recv mode, stop at limie (and tell dongle to stop sending) */
- if (bus->pktgen_mode == BRCMF_PKTGEN_RECV) {
- if (bus->pktgen_total
- && (bus->pktgen_rcvd >= bus->pktgen_total)) {
- bus->pktgen_count = 0;
- brcmf_sdbrcm_sdtest_set(bus, false);
- }
- }
-}
-#endif /* SDTEST */
-
extern bool brcmf_sdbrcm_bus_watchdog(struct brcmf_pub *drvr)
{
struct brcmf_bus *bus;
@@ -5139,16 +4700,6 @@ extern bool brcmf_sdbrcm_bus_watchdog(struct brcmf_pub *drvr)
}
#endif /* BCMDBG */

-#ifdef SDTEST
- /* Generate packets if configured */
- if (bus->pktgen_count && (++bus->pktgen_tick >= bus->pktgen_freq)) {
- /* Make sure backplane clock is on */
- brcmf_sdbrcm_clkctl(bus, CLK_AVAIL, false);
- bus->pktgen_tick = 0;
- brcmf_sdbrcm_pktgen(bus);
- }
-#endif
-
/* On idle timeout clear activity flag and/or turn off clock */
if ((bus->idletime > 0) && (bus->clkstate == CLK_AVAIL)) {
if (++bus->idlecount >= bus->idletime) {
@@ -5533,10 +5084,6 @@ static bool brcmf_sdbrcm_probe_init(struct brcmf_bus *bus)
{
BRCMF_TRACE(("%s: Enter\n", __func__));

-#ifdef SDTEST
- brcmf_sdbrcm_pktgen_init(bus);
-#endif /* SDTEST */
-
/* Disable F2 to clear any intermediate frame state on the dongle */
brcmf_sdcard_cfg_write(bus->sdiodev, SDIO_FUNC_0, SDIO_CCCR_IOEx,
SDIO_FUNC_ENABLE_1, NULL);
--
1.7.4.1



2011-08-12 20:02:43

by Rafał Miłecki

[permalink] [raw]
Subject: Re: [PATCH 02/14] staging: brcm80211: remove iovar IOV_BLOCKSIZE in brcmfmac

W dniu 12 sierpnia 2011 18:37 użytkownik Arend van Spriel
<[email protected]> napisał:
> On 08/12/2011 04:12 PM, Rafał Miłecki wrote:
>>
>> 2011/8/12 Arend van Spriel<[email protected]>:
>>>
>>> @@ -273,7 +270,6 @@ extern int brcmf_sdioh_interrupt_deregister(struct
>>> sdioh_info *sd)
>>>  /* IOVar table */
>>>  enum {
>>>        IOV_MSGLEVEL = 1,
>>> -       IOV_BLOCKSIZE,
>>>        IOV_NUMINTS,
>>>        IOV_DEVREG,
>>>        IOV_HCIREGS,
>>
>> You are forcing IOV_MSGLEVEL to 1, so I expected values of IOV_* are
>> really important in some piece of code. Now you change them. AFAIU it
>> means you break something, or you can drop " = 1".
>
> IOCTL codes do have a strong ordering as user-space application and driver
> need to have the same code for the same entity. IOVs are internal numbers
> for the driver only so there is no issue in renumbering those.

Then you can note dropping " = 1" to avoid confusion for
new-code-readers :) For your TODO.

--
Rafał

2011-08-12 14:07:13

by Rafał Miłecki

[permalink] [raw]
Subject: Re: [PATCH 01/14] staging: brcm80211: use wait queues instead of semaphores in wl_cfg80211.c

MjAxMS84LzEyIEFyZW5kIHZhbiBTcHJpZWwgPGFyZW5kQGJyb2FkY29tLmNvbT46Cj4gQEAgLTM1
MzcsMjcgKzM1NDQsMzkgQEAgc3RhdGljIHMzMiBicmNtZl9ldmVudF9oYW5kbGVyKHZvaWQgKmRh
dGEpCj4gwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAoc3RydWN0IGJyY21mX2Nm
ZzgwMjExX3ByaXYgKilkYXRhOwo+IMKgIMKgIMKgIMKgc3RydWN0IHNjaGVkX3BhcmFtIHBhcmFt
ID0gey5zY2hlZF9wcmlvcml0eSA9IE1BWF9SVF9QUklPIC0gMSB9Owo+IMKgIMKgIMKgIMKgc3Ry
dWN0IGJyY21mX2NmZzgwMjExX2V2ZW50X3EgKmU7Cj4gKyDCoCDCoCDCoCBERUNMQVJFX1dBSVRR
VUVVRSh3YWl0LCBjdXJyZW50KTsKPgo+IMKgIMKgIMKgIMKgc2NoZWRfc2V0c2NoZWR1bGVyKGN1
cnJlbnQsIFNDSEVEX0ZJRk8sICZwYXJhbSk7Cj4gwqAgwqAgwqAgwqBhbGxvd19zaWduYWwoU0lH
VEVSTSk7Cj4gLSDCoCDCoCDCoCB3aGlsZSAobGlrZWx5KCFkb3duX2ludGVycnVwdGlibGUoJmNm
Z19wcml2LT5ldmVudF9zeW5jKSkpIHsKPiArIMKgIMKgIMKgIGFkZF93YWl0X3F1ZXVlKCZjZmdf
cHJpdi0+ZXZlbnRfd2FpdHEsICZ3YWl0KTsKPiArIMKgIMKgIMKgIHdoaWxlICgxKSB7Cj4gKyDC
oCDCoCDCoCDCoCDCoCDCoCDCoCBwcmVwYXJlX3RvX3dhaXQoJmNmZ19wcml2LT5ldmVudF93YWl0
cSwgJndhaXQsCj4gKyDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDC
oCBUQVNLX0lOVEVSUlVQVElCTEUpOwo+ICsKPiArIMKgIMKgIMKgIMKgIMKgIMKgIMKgIHNjaGVk
dWxlKCk7Cj4gKwo+IMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgaWYgKGt0aHJlYWRfc2hvdWxkX3N0
b3AoKSkKPiDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoGJyZWFrOwo+ICsKPiDC
oCDCoCDCoCDCoCDCoCDCoCDCoCDCoGUgPSBicmNtZl9kZXFfZXZlbnQoY2ZnX3ByaXYpOwo+IMKg
IMKgIMKgIMKgIMKgIMKgIMKgIMKgaWYgKHVubGlrZWx5KCFlKSkgewo+IMKgIMKgIMKgIMKgIMKg
IMKgIMKgIMKgIMKgIMKgIMKgIMKgV0xfRVJSKCJldmVudCBxdWV1ZSBlbXB0eS4uLlxuIik7Cj4g
LSDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCBCVUcoKTsKPiArIMKgIMKgIMKgIMKg
IMKgIMKgIMKgIMKgIMKgIMKgIMKgIGNvbnRpbnVlOwo+IMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKg
fQo+IC0gwqAgwqAgwqAgwqAgwqAgwqAgwqAgV0xfSU5GTygiZXZlbnQgdHlwZSAoJWQpXG4iLCBl
LT5ldHlwZSk7Cj4gLSDCoCDCoCDCoCDCoCDCoCDCoCDCoCBpZiAoY2ZnX3ByaXYtPmVsLmhhbmRs
ZXJbZS0+ZXR5cGVdKQo+IC0gwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgY2ZnX3By
aXYtPmVsLmhhbmRsZXJbZS0+ZXR5cGVdKGNmZ19wcml2LAo+IC0gwqAgwqAgwqAgwqAgwqAgwqAg
wqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAg
wqAgwqBjZmdfdG9fbmRldihjZmdfcHJpdiksCj4gLSDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDC
oCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCZl
LT5lbXNnLCBlLT5lZGF0YSk7Cj4gLSDCoCDCoCDCoCDCoCDCoCDCoCDCoCBlbHNlCj4gLSDCoCDC
oCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCBXTF9JTkZPKCJVbmtub3duIEV2ZW50ICglZCk6
IGlnbm9yaW5nXG4iLCBlLT5ldHlwZSk7Cj4KPiAtIMKgIMKgIMKgIMKgIMKgIMKgIMKgIGJyY21m
X3B1dF9ldmVudChlKTsKPiArIMKgIMKgIMKgIMKgIMKgIMKgIMKgIGRvIHsKPiArIMKgIMKgIMKg
IMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIFdMX0lORk8oImV2ZW50IHR5cGUgKCVkKVxuIiwgZS0+
ZXR5cGUpOwo+ICsgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgaWYgKGNmZ19wcml2
LT5lbC5oYW5kbGVyW2UtPmV0eXBlXSkKPiArIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKg
IMKgIMKgIMKgIMKgIMKgIGNmZ19wcml2LT5lbC5oYW5kbGVyW2UtPmV0eXBlXShjZmdfcHJpdiwK
PiArIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKg
IMKgIGNmZ190b19uZGV2KGNmZ19wcml2KSwKPiArIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKg
IMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgICZlLT5lbXNnLCBlLT5lZGF0YSk7Cj4gKyDC
oCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCBlbHNlCj4gKyDCoCDCoCDCoCDCoCDCoCDC
oCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCBXTF9JTkZPKCJVbmtub3duIEV2ZW50ICglZCk6
IGlnbm9yaW5nXG4iLAo+ICsgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAg
wqAgwqAgwqAgwqAgwqAgwqAgZS0+ZXR5cGUpOwo+ICsgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAg
wqAgwqAgwqAgYnJjbWZfcHV0X2V2ZW50KGUpOwo+ICsgwqAgwqAgwqAgwqAgwqAgwqAgwqAgfSB3
aGlsZSAoKGUgPSBicmNtZl9kZXFfZXZlbnQoY2ZnX3ByaXYpKSk7CgppZiAoKCgoKGNhcmVfY29k
aW5nX3N0eWxlKSkpKSkKZml4KCk7Cgo6LSkKCi0tIApSYWZhxYIK

2011-08-12 16:45:02

by Arend van Spriel

[permalink] [raw]
Subject: Re: [PATCH 01/14] staging: brcm80211: use wait queues instead of semaphores in wl_cfg80211.c

On 08/12/2011 04:07 PM, Rafał Miłecki wrote:
> 2011/8/12 Arend van Spriel<[email protected]>:
>> @@ -3537,27 +3544,39 @@ static s32 brcmf_event_handler(void *data)
>> (struct brcmf_cfg80211_priv *)data;
>> struct sched_param param = {.sched_priority = MAX_RT_PRIO - 1 };
>> struct brcmf_cfg80211_event_q *e;
>> + DECLARE_WAITQUEUE(wait, current);
>>
>> sched_setscheduler(current, SCHED_FIFO,&param);
>> allow_signal(SIGTERM);
>> - while (likely(!down_interruptible(&cfg_priv->event_sync))) {
>> + add_wait_queue(&cfg_priv->event_waitq,&wait);
>> + while (1) {
>> + prepare_to_wait(&cfg_priv->event_waitq,&wait,
>> + TASK_INTERRUPTIBLE);
>> +
>> + schedule();
>> +
>> if (kthread_should_stop())
>> break;
>> +
>> e = brcmf_deq_event(cfg_priv);
>> if (unlikely(!e)) {
>> WL_ERR("event queue empty...\n");
>> - BUG();
>> + continue;
>> }
>> - WL_INFO("event type (%d)\n", e->etype);
>> - if (cfg_priv->el.handler[e->etype])
>> - cfg_priv->el.handler[e->etype](cfg_priv,
>> - cfg_to_ndev(cfg_priv),
>> -&e->emsg, e->edata);
>> - else
>> - WL_INFO("Unknown Event (%d): ignoring\n", e->etype);
>>
>> - brcmf_put_event(e);
>> + do {
>> + WL_INFO("event type (%d)\n", e->etype);
>> + if (cfg_priv->el.handler[e->etype])
>> + cfg_priv->el.handler[e->etype](cfg_priv,
>> + cfg_to_ndev(cfg_priv),
>> +&e->emsg, e->edata);
>> + else
>> + WL_INFO("Unknown Event (%d): ignoring\n",
>> + e->etype);
>> + brcmf_put_event(e);
>> + } while ((e = brcmf_deq_event(cfg_priv)));
> if (((((care_coding_style)))))
> fix();
>
> :-)
>

I assume you refer to the indents above. Not sure what exactly happened
there, but the patch email as I received it looks. Could it be a mail
reader issue?

Gr. AvS

--
Almost nobody dances sober, unless they happen to be insane.
-- H.P. Lovecraft --



2011-08-12 13:35:12

by Arend van Spriel

[permalink] [raw]
Subject: [PATCH 07/14] staging: brcm80211: absorb brcmf_sdioh_interrupt_register into brcmf_sdcard_intr_reg

From: Franky Lin <[email protected]>

brcmfmac wrapper function cleanup

Reviewed-by: Arend van Spriel <[email protected]>
Signed-off-by: Arend van Spriel <[email protected]>
---
drivers/staging/brcm80211/brcmfmac/bcmsdh.c | 22 ++++++++++-
drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c | 43 ---------------------
drivers/staging/brcm80211/brcmfmac/sdio_host.h | 1 -
3 files changed, 21 insertions(+), 45 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmfmac/bcmsdh.c b/drivers/staging/brcm80211/brcmfmac/bcmsdh.c
index 13b6dbe..e5cf138 100644
--- a/drivers/staging/brcm80211/brcmfmac/bcmsdh.c
+++ b/drivers/staging/brcm80211/brcmfmac/bcmsdh.c
@@ -21,6 +21,7 @@
#include <linux/pci_ids.h>
#include <linux/sched.h>
#include <linux/completion.h>
+#include <linux/mmc/sdio_func.h>
#include <linux/mmc/card.h>

#include <defs.h>
@@ -162,9 +163,28 @@ exit:
return bcmerror;
}

+static void brcmf_sdioh_irqhandler(struct sdio_func *func)
+{
+ struct brcmf_sdio_dev *sdiodev = dev_get_drvdata(&func->card->dev);
+
+ BRCMF_TRACE(("brcmf: ***IRQHandler\n"));
+
+ sdio_release_host(func);
+
+ brcmf_sdbrcm_isr(sdiodev->bus);
+
+ sdio_claim_host(func);
+}
+
int brcmf_sdcard_intr_reg(struct brcmf_sdio_dev *sdiodev)
{
- return brcmf_sdioh_interrupt_register(sdiodev);
+ BRCMF_TRACE(("%s: Entering\n", __func__));
+
+ sdio_claim_host(sdiodev->func[1]);
+ sdio_claim_irq(sdiodev->func[1], brcmf_sdioh_irqhandler);
+ sdio_release_host(sdiodev->func[1]);
+
+ return 0;
}

int brcmf_sdcard_intr_dereg(struct brcmf_sdio_dev *sdiodev)
diff --git a/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c b/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c
index 1bfeec6..2e7d3ce 100644
--- a/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c
+++ b/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c
@@ -44,8 +44,6 @@
#define SDIO_DEVICE_ID_BROADCOM_4329 0x4329
#endif /* !defined(SDIO_DEVICE_ID_BROADCOM_4329) */

-static void brcmf_sdioh_irqhandler(struct sdio_func *func);
-static void brcmf_sdioh_irqhandler_f2(struct sdio_func *func);
static int brcmf_sdioh_get_cisaddr(struct brcmf_sdio_dev *sdiodev, u32 regaddr);
static int brcmf_ops_sdio_probe(struct sdio_func *func,
const struct sdio_device_id *id);
@@ -192,28 +190,6 @@ void brcmf_sdioh_detach(struct brcmf_sdio_dev *sdiodev)

}

-/* Configure callback to client when we receive client interrupt */
-extern int
-brcmf_sdioh_interrupt_register(struct brcmf_sdio_dev *sdiodev)
-{
- BRCMF_TRACE(("%s: Entering\n", __func__));
-
- /* register and unmask irq */
- if (sdiodev->func[2]) {
- sdio_claim_host(sdiodev->func[2]);
- sdio_claim_irq(sdiodev->func[2], brcmf_sdioh_irqhandler_f2);
- sdio_release_host(sdiodev->func[2]);
- }
-
- if (sdiodev->func[1]) {
- sdio_claim_host(sdiodev->func[1]);
- sdio_claim_irq(sdiodev->func[1], brcmf_sdioh_irqhandler);
- sdio_release_host(sdiodev->func[1]);
- }
-
- return 0;
-}
-
int brcmf_sdioh_interrupt_deregister(struct brcmf_sdio_dev *sdiodev)
{
BRCMF_TRACE(("%s: Entering\n", __func__));
@@ -662,25 +638,6 @@ brcmf_sdioh_card_regread(struct brcmf_sdio_dev *sdiodev, int func, u32 regaddr,
return SUCCESS;
}

-static void brcmf_sdioh_irqhandler(struct sdio_func *func)
-{
- struct brcmf_sdio_dev *sdiodev = dev_get_drvdata(&func->card->dev);
-
- BRCMF_TRACE(("brcmf: ***IRQHandler\n"));
-
- sdio_release_host(func);
-
- brcmf_sdbrcm_isr(sdiodev->bus);
-
- sdio_claim_host(func);
-}
-
-/* interrupt handler for F2 (dummy handler) */
-static void brcmf_sdioh_irqhandler_f2(struct sdio_func *func)
-{
- BRCMF_TRACE(("brcmf: ***IRQHandlerF2\n"));
-}
-
static int brcmf_ops_sdio_probe(struct sdio_func *func,
const struct sdio_device_id *id)
{
diff --git a/drivers/staging/brcm80211/brcmfmac/sdio_host.h b/drivers/staging/brcm80211/brcmfmac/sdio_host.h
index 4a814e5..bdbf411 100644
--- a/drivers/staging/brcm80211/brcmfmac/sdio_host.h
+++ b/drivers/staging/brcm80211/brcmfmac/sdio_host.h
@@ -247,7 +247,6 @@ extern u32 brcmf_sdcard_cur_sbwad(struct brcmf_sdio_dev *sdiodev);
extern int brcmf_sdioh_attach(struct brcmf_sdio_dev *sdiodev);
extern void brcmf_sdioh_detach(struct brcmf_sdio_dev *sdiodev);

-extern int brcmf_sdioh_interrupt_register(struct brcmf_sdio_dev *sdiodev);
extern int brcmf_sdioh_interrupt_deregister(struct brcmf_sdio_dev *sdiodev);

/* read or write one byte using cmd52 */
--
1.7.4.1



2011-08-12 18:59:21

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH 01/14] staging: brcm80211: use wait queues instead of semaphores in wl_cfg80211.c

On Fri, 2011-08-12 at 20:55 +0200, Arend van Spriel wrote:

> >>> + } while ((e = brcmf_deq_event(cfg_priv)));
> >> if (((((care_coding_style)))))
> >> fix();
> >>
> >> :-)
> >>
> > I assume you refer to the indents above. Not sure what exactly happened
> > there, but the patch email as I received it looks. Could it be a mail
> > reader issue?
> >
> > Gr. AvS
>
> A colleague pointed out you probably meant the while condition. The
> extra braces may be there because an assignment is done, but in this
> case it does not make much sense.

Doesn't gcc warn if you don't have two parentheses?

johannes


2011-08-26 20:15:47

by Henry Ptasinski

[permalink] [raw]
Subject: Re: [PATCH 00/14] staging: brcm80211: brcmfmac driver cleanup

On Fri, Aug 26, 2011 at 01:00:57PM -0700, Jason wrote:
> On Fri, Aug 26, 2011 at 10:44:46AM -0700, Henry Ptasinski wrote:
> > On Fri, Aug 26, 2011 at 10:38:55AM -0700, Jason wrote:
> > > On Fri, Aug 26, 2011 at 10:31:59AM -0700, Henry Ptasinski wrote:
> > > > A possibly better approach would be a device with a BCM4329 on the
> > > > motherboard (e.g. table, phone, etc) that can run a relatively stock
> > > > linux kernel. However, I don't know of a specific platform at the
> > > > moment to recommend.
> > >
> > > Nexus One phone?
> >
> > That's a possibility. Are people running recent, relatively unmodified linux
> > kernels on the Nexus One? (Or you could backport brcmfmac to the Android
> > version of the kernel, perhaps using compat-wireless).
>
> folks run debian from the sdcard [1], a mainline kernel shouldn't be too
> big of a stretch from there. Especially if the purpose is for testing
> wifi. Don't need PM, GSM, display, 3D, etc for that.
>
> Note, I haven't tried it yet, myself. It's been on the _long_ list of
> projects. It would be higher on the list if brcmfmac supported all the
> normal Linux features like monitor mode, AP mode, multiple-VAPs, etc.
> Or, at least, was in mainline and would accept patches adding such
> features... ;-)

Would definitely accept patches for such features! We're definitely interested
in them, and they're all on our list to add, but crossing the chasm is the
first step.

- Henry


2011-08-12 14:31:31

by Rafał Miłecki

[permalink] [raw]
Subject: Re: [PATCH 07/14] staging: brcm80211: absorb brcmf_sdioh_interrupt_register into brcmf_sdcard_intr_reg

2011/8/12 Arend van Spriel <[email protected]>:
> +       BRCMF_TRACE(("brcmf: ***IRQHandler\n"));

> +       BRCMF_TRACE(("%s: Entering\n", __func__));

I guess I'd be way easier to modify your macro instead of having to
remember about double braces every time (assuming there are needed at
all).

--
Rafał

2011-08-12 19:09:42

by Arend van Spriel

[permalink] [raw]
Subject: Re: [PATCHv2 01/14] staging: brcm80211: use wait queues instead of semaphores in wl_cfg80211.c

On 08/12/2011 09:07 PM, Arend van Spriel wrote:
> On 08/12/2011 09:05 PM, Arend van Spriel wrote:
>> In wl_cfg80211.c two semaphores were used to trigger a task to process
>> an event. The wait queues are better suited for that purpose. This also
>> removes checkpatch warning on sema_init() calls in this source file.
>>
>> Reviewed-by: Rafal Milecki<[email protected]>
>> Reviewed-by: Roland Vossen<[email protected]>
>> Reviewed-by: Franky Lin<[email protected]>
>> Signed-off-by: Arend van Spriel<[email protected]>
>> ---
>> Hi Greg,
>>
>> This patch replaces the original submitted [01/14] patch identified by:
>>
>> Message-ID:<[email protected]>
>>
>> Gr. AvS
>> ---
> I should have compiled it before sending v2. Please drop this one and
> stick with the original patch.
>
> Gr. AvS
>

Or have people vote which version they prefer. I prefer v2.

Gr. AvS

--
Almost nobody dances sober, unless they happen to be insane.
-- H.P. Lovecraft --



2011-08-12 20:04:19

by Rafał Miłecki

[permalink] [raw]
Subject: Re: [PATCH 00/14] staging: brcm80211: brcmfmac driver cleanup

W dniu 12 sierpnia 2011 18:32 użytkownik Arend van Spriel
<[email protected]> napisał:
> On 08/12/2011 04:02 PM, Rafał Miłecki wrote:
>>
>> 2011/8/12 Arend van Spriel<[email protected]>:
>>>
>>> Several cleanup patches to reduce code for the brcmfmac driver and
>>> get rid of a remaining checkpatch warning. The driver sources should
>>> be clear from checkpatch issue now.
>>>
>>> This series applies to staging-next and depends on the following patch
>>> set:
>>
>> Are you testing patches on some hardware? Or just compile-testing?
>>
>> I believe this driver is meant to support BCM4329, which is not PCI(e)
>> board. What adapter do you use?
>>
>> I've heard about Arasan adapter. Have you tried it? Is that something
>> reachable from arasan.com?
>
> Our brcm80211 source tree under drivers/staging contain two drivers. The
> brcmsmac driver currently supporting the PCI(e) cards with bcm43224,
> bcm43225, and bcm4313 chips and the brcmfmac driver currently supporting the
> SDIO card with bcm4329 chip. brcmsmac is a mac80211 driver and brcmfmac is a
> cfg80211 driver.
>
> We indeed use the Arasan adapter and both drivers are running in nightly
> test cycle testing our common internal repository. So the drivers are
> functionally tested on the x86 platforms (32 and 64 bit). Also looking at
> sparc64 and powerpc64 but not in a nightly cycle.

Is there a chance you can donate me with such a adapter and card?

--
Rafał

2011-08-12 19:08:07

by Arend van Spriel

[permalink] [raw]
Subject: Re: [PATCHv2 01/14] staging: brcm80211: use wait queues instead of semaphores in wl_cfg80211.c

On 08/12/2011 09:05 PM, Arend van Spriel wrote:
> In wl_cfg80211.c two semaphores were used to trigger a task to process
> an event. The wait queues are better suited for that purpose. This also
> removes checkpatch warning on sema_init() calls in this source file.
>
> Reviewed-by: Rafal Milecki<[email protected]>
> Reviewed-by: Roland Vossen<[email protected]>
> Reviewed-by: Franky Lin<[email protected]>
> Signed-off-by: Arend van Spriel<[email protected]>
> ---
> Hi Greg,
>
> This patch replaces the original submitted [01/14] patch identified by:
>
> Message-ID:<[email protected]>
>
> Gr. AvS
> ---

I should have compiled it before sending v2. Please drop this one and
stick with the original patch.

Gr. AvS

--
Almost nobody dances sober, unless they happen to be insane.
-- H.P. Lovecraft --



2011-08-26 09:20:44

by Rafał Miłecki

[permalink] [raw]
Subject: Re: [PATCH 00/14] staging: brcm80211: brcmfmac driver cleanup

W dniu 12 sierpnia 2011 22:04 użytkownik Rafał Miłecki
<[email protected]> napisał:
> W dniu 12 sierpnia 2011 18:32 użytkownik Arend van Spriel
> <[email protected]> napisał:
>> On 08/12/2011 04:02 PM, Rafał Miłecki wrote:
>>>
>>> 2011/8/12 Arend van Spriel<[email protected]>:
>>>>
>>>> Several cleanup patches to reduce code for the brcmfmac driver and
>>>> get rid of a remaining checkpatch warning. The driver sources should
>>>> be clear from checkpatch issue now.
>>>>
>>>> This series applies to staging-next and depends on the following patch
>>>> set:
>>>
>>> Are you testing patches on some hardware? Or just compile-testing?
>>>
>>> I believe this driver is meant to support BCM4329, which is not PCI(e)
>>> board. What adapter do you use?
>>>
>>> I've heard about Arasan adapter. Have you tried it? Is that something
>>> reachable from arasan.com?
>>
>> Our brcm80211 source tree under drivers/staging contain two drivers. The
>> brcmsmac driver currently supporting the PCI(e) cards with bcm43224,
>> bcm43225, and bcm4313 chips and the brcmfmac driver currently supporting the
>> SDIO card with bcm4329 chip. brcmsmac is a mac80211 driver and brcmfmac is a
>> cfg80211 driver.
>>
>> We indeed use the Arasan adapter and both drivers are running in nightly
>> test cycle testing our common internal repository. So the drivers are
>> functionally tested on the x86 platforms (32 and 64 bit). Also looking at
>> sparc64 and powerpc64 but not in a nightly cycle.
>
> Is there a chance you can donate me with such a adapter and card?

Ping?

--
Rafał

2011-08-13 07:47:49

by Arend van Spriel

[permalink] [raw]
Subject: Re: [PATCH 00/14] staging: brcm80211: brcmfmac driver cleanup

On 08/12/2011 10:04 PM, Rafał Miłecki wrote:
> W dniu 12 sierpnia 2011 18:32 użytkownik Arend van Spriel
> <[email protected]> napisał:
>> On 08/12/2011 04:02 PM, Rafał Miłecki wrote:
>>> 2011/8/12 Arend van Spriel<[email protected]>:
>>>> Several cleanup patches to reduce code for the brcmfmac driver and
>>>> get rid of a remaining checkpatch warning. The driver sources should
>>>> be clear from checkpatch issue now.
>>>>
>>>> This series applies to staging-next and depends on the following patch
>>>> set:
>>> Are you testing patches on some hardware? Or just compile-testing?
>>>
>>> I believe this driver is meant to support BCM4329, which is not PCI(e)
>>> board. What adapter do you use?
>>>
>>> I've heard about Arasan adapter. Have you tried it? Is that something
>>> reachable from arasan.com?
>> Our brcm80211 source tree under drivers/staging contain two drivers. The
>> brcmsmac driver currently supporting the PCI(e) cards with bcm43224,
>> bcm43225, and bcm4313 chips and the brcmfmac driver currently supporting the
>> SDIO card with bcm4329 chip. brcmsmac is a mac80211 driver and brcmfmac is a
>> cfg80211 driver.
>>
>> We indeed use the Arasan adapter and both drivers are running in nightly
>> test cycle testing our common internal repository. So the drivers are
>> functionally tested on the x86 platforms (32 and 64 bit). Also looking at
>> sparc64 and powerpc64 but not in a nightly cycle.
> Is there a chance you can donate me with such a adapter and card?

Hi Rafał,

If your interest is getting SDIO supported in bcma this card is not very
useful to you. The bcm4329 is using the SSB interconnect.

Gr. AvS

--
Almost nobody dances sober, unless they happen to be insane.
-- H.P. Lovecraft --



2011-08-12 13:35:17

by Arend van Spriel

[permalink] [raw]
Subject: [PATCH 03/14] staging: brcm80211: remove struct sdioh_info from brcmfmac

From: Franky Lin <[email protected]>

Use brcmf_sdio_dev as the unified structure to store information
of device.

Reviewed-by: Arend van Spriel <[email protected]>
Signed-off-by: Arend van Spriel <[email protected]>
---
drivers/staging/brcm80211/brcmfmac/bcmsdh.c | 35 ++---
drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c | 186 +++++++++------------
drivers/staging/brcm80211/brcmfmac/sdio_host.h | 59 +++-----
3 files changed, 115 insertions(+), 165 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmfmac/bcmsdh.c b/drivers/staging/brcm80211/brcmfmac/bcmsdh.c
index c9893e9..6a9ac1d 100644
--- a/drivers/staging/brcm80211/brcmfmac/bcmsdh.c
+++ b/drivers/staging/brcm80211/brcmfmac/bcmsdh.c
@@ -49,18 +49,18 @@ int
brcmf_sdcard_iovar_op(struct brcmf_sdio_dev *sdiodev, const char *name,
void *params, int plen, void *arg, int len, bool set)
{
- return brcmf_sdioh_iovar_op(sdiodev->sdioh, name, params, plen, arg,
+ return brcmf_sdioh_iovar_op(sdiodev, name, params, plen, arg,
len, set);
}

int brcmf_sdcard_intr_reg(struct brcmf_sdio_dev *sdiodev)
{
- return brcmf_sdioh_interrupt_register(sdiodev->sdioh);
+ return brcmf_sdioh_interrupt_register();
}

int brcmf_sdcard_intr_dereg(struct brcmf_sdio_dev *sdiodev)
{
- return brcmf_sdioh_interrupt_deregister(sdiodev->sdioh);
+ return brcmf_sdioh_interrupt_deregister();
}

u8 brcmf_sdcard_cfg_read(struct brcmf_sdio_dev *sdiodev, uint fnc_num, u32 addr,
@@ -74,7 +74,7 @@ u8 brcmf_sdcard_cfg_read(struct brcmf_sdio_dev *sdiodev, uint fnc_num, u32 addr,
if (retry) /* wait for 1 ms till bus get settled down */
udelay(1000);
status =
- brcmf_sdioh_cfg_read(sdiodev->sdioh, fnc_num, addr,
+ brcmf_sdioh_cfg_read(sdiodev, fnc_num, addr,
(u8 *) &data);
} while (status != 0
&& (retry++ < SDIOH_API_ACCESS_RETRY_LIMIT));
@@ -98,7 +98,7 @@ brcmf_sdcard_cfg_write(struct brcmf_sdio_dev *sdiodev, uint fnc_num, u32 addr,
if (retry) /* wait for 1 ms till bus get settled down */
udelay(1000);
status =
- brcmf_sdioh_cfg_write(sdiodev->sdioh, fnc_num, addr,
+ brcmf_sdioh_cfg_write(sdiodev, fnc_num, addr,
(u8 *) &data);
} while (status != 0
&& (retry++ < SDIOH_API_ACCESS_RETRY_LIMIT));
@@ -119,7 +119,7 @@ int brcmf_sdcard_cis_read(struct brcmf_sdio_dev *sdiodev, uint func, u8 * cis,
bool ascii = func & ~0xf;
func &= 0x7;

- status = brcmf_sdioh_cis_read(sdiodev->sdioh, func, cis, length);
+ status = brcmf_sdioh_cis_read(sdiodev, func, cis, length);

if (ascii) {
/* Move binary bits to tmp and format them
@@ -181,7 +181,7 @@ u32 brcmf_sdcard_reg_read(struct brcmf_sdio_dev *sdiodev, u32 addr, uint size)
if (size == 4)
addr |= SBSDIO_SB_ACCESS_2_4B_FLAG;

- status = brcmf_sdioh_request_word(sdiodev->sdioh, SDIOH_CMD_TYPE_NORMAL,
+ status = brcmf_sdioh_request_word(sdiodev, SDIOH_CMD_TYPE_NORMAL,
SDIOH_READ, SDIO_FUNC_1, addr, &word, size);

sdiodev->regfail = (status != 0);
@@ -231,7 +231,7 @@ u32 brcmf_sdcard_reg_write(struct brcmf_sdio_dev *sdiodev, u32 addr, uint size,
if (size == 4)
addr |= SBSDIO_SB_ACCESS_2_4B_FLAG;
status =
- brcmf_sdioh_request_word(sdiodev->sdioh, SDIOH_CMD_TYPE_NORMAL,
+ brcmf_sdioh_request_word(sdiodev, SDIOH_CMD_TYPE_NORMAL,
SDIOH_WRITE, SDIO_FUNC_1, addr, &data, size);
sdiodev->regfail = (status != 0);

@@ -284,7 +284,7 @@ brcmf_sdcard_recv_buf(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn,
if (width == 4)
addr |= SBSDIO_SB_ACCESS_2_4B_FLAG;

- status = brcmf_sdioh_request_buffer(sdiodev->sdioh, SDIOH_DATA_PIO,
+ status = brcmf_sdioh_request_buffer(sdiodev, SDIOH_DATA_PIO,
incr_fix, SDIOH_READ, fn, addr, width, nbytes, buf, pkt);

return status;
@@ -324,7 +324,7 @@ brcmf_sdcard_send_buf(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn,
if (width == 4)
addr |= SBSDIO_SB_ACCESS_2_4B_FLAG;

- return brcmf_sdioh_request_buffer(sdiodev->sdioh, SDIOH_DATA_PIO,
+ return brcmf_sdioh_request_buffer(sdiodev, SDIOH_DATA_PIO,
incr_fix, SDIOH_WRITE, fn, addr, width, nbytes, buf, pkt);
}

@@ -334,14 +334,14 @@ int brcmf_sdcard_rwdata(struct brcmf_sdio_dev *sdiodev, uint rw, u32 addr,
addr &= SBSDIO_SB_OFT_ADDR_MASK;
addr |= SBSDIO_SB_ACCESS_2_4B_FLAG;

- return brcmf_sdioh_request_buffer(sdiodev->sdioh, SDIOH_DATA_PIO,
+ return brcmf_sdioh_request_buffer(sdiodev, SDIOH_DATA_PIO,
SDIOH_DATA_INC, (rw ? SDIOH_WRITE : SDIOH_READ), SDIO_FUNC_1,
addr, 4, nbytes, buf, NULL);
}

int brcmf_sdcard_abort(struct brcmf_sdio_dev *sdiodev, uint fn)
{
- return brcmf_sdioh_abort(sdiodev->sdioh, fn);
+ return brcmf_sdioh_abort(sdiodev, fn);
}

u32 brcmf_sdcard_cur_sbwad(struct brcmf_sdio_dev *sdiodev)
@@ -354,11 +354,9 @@ int brcmf_sdio_probe(struct brcmf_sdio_dev *sdiodev)
u32 regs = 0;
int ret = 0;

- sdiodev->sdioh = brcmf_sdioh_attach((void *)0);
- if (!sdiodev->sdioh) {
- ret = -ENODEV;
+ ret = brcmf_sdioh_attach(sdiodev);
+ if (ret)
goto out;
- }

regs = SI_ENUM_BASE;

@@ -388,10 +386,7 @@ int brcmf_sdio_remove(struct brcmf_sdio_dev *sdiodev)
sdiodev->bus = NULL;
}

- if (sdiodev->sdioh) {
- brcmf_sdioh_detach(sdiodev->sdioh);
- sdiodev->sdioh = NULL;
- }
+ brcmf_sdioh_detach(sdiodev);

sdiodev->sbwad = 0;

diff --git a/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c b/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c
index a2fba4f..877428c 100644
--- a/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c
+++ b/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c
@@ -46,7 +46,7 @@

static void brcmf_sdioh_irqhandler(struct sdio_func *func);
static void brcmf_sdioh_irqhandler_f2(struct sdio_func *func);
-static int brcmf_sdioh_get_cisaddr(struct sdioh_info *sd, u32 regaddr);
+static int brcmf_sdioh_get_cisaddr(struct brcmf_sdio_dev *sdiodev, u32 regaddr);
static int brcmf_ops_sdio_probe(struct sdio_func *func,
const struct sdio_device_id *id);
static void brcmf_ops_sdio_remove(struct sdio_func *func);
@@ -106,10 +106,10 @@ DECLARE_WAIT_QUEUE_HEAD(sdioh_request_buffer_wait);
#endif /* CONFIG_PM_SLEEP */

static int
-brcmf_sdioh_card_regread(struct sdioh_info *sd, int func, u32 regaddr,
+brcmf_sdioh_card_regread(struct brcmf_sdio_dev *sdiodev, int func, u32 regaddr,
int regsize, u32 *data);

-static int brcmf_sdioh_enablefuncs(struct sdioh_info *sd)
+static int brcmf_sdioh_enablefuncs(struct brcmf_sdio_dev *sdiodev)
{
int err_ret;
u32 fbraddr;
@@ -118,24 +118,20 @@ static int brcmf_sdioh_enablefuncs(struct sdioh_info *sd)
BRCMF_TRACE(("%s\n", __func__));

/* Get the Card's common CIS address */
- sd->com_cis_ptr = brcmf_sdioh_get_cisaddr(sd, SDIO_CCCR_CIS);
- sd->func_cis_ptr[0] = sd->com_cis_ptr;
+ sdiodev->func_cis_ptr[0] = brcmf_sdioh_get_cisaddr(sdiodev,
+ SDIO_CCCR_CIS);
BRCMF_INFO(("%s: Card's Common CIS Ptr = 0x%x\n", __func__,
- sd->com_cis_ptr));
+ sdiodev->func_cis_ptr[0]));

/* Get the Card's function CIS (for each function) */
for (fbraddr = SDIO_FBR_BASE(1), func = 1;
- func <= sd->num_funcs; func++, fbraddr += SDIOD_FBR_SIZE) {
- sd->func_cis_ptr[func] =
- brcmf_sdioh_get_cisaddr(sd, SDIO_FBR_CIS + fbraddr);
+ func <= sdiodev->num_funcs; func++, fbraddr += SDIOD_FBR_SIZE) {
+ sdiodev->func_cis_ptr[func] =
+ brcmf_sdioh_get_cisaddr(sdiodev, SDIO_FBR_CIS + fbraddr);
BRCMF_INFO(("%s: Function %d CIS Ptr = 0x%x\n", __func__, func,
- sd->func_cis_ptr[func]));
+ sdiodev->func_cis_ptr[func]));
}

- sd->func_cis_ptr[0] = sd->com_cis_ptr;
- BRCMF_INFO(("%s: Card's Common CIS Ptr = 0x%x\n", __func__,
- sd->com_cis_ptr));
-
/* Enable Function 1 */
sdio_claim_host(gInstance->func[1]);
err_ret = sdio_enable_func(gInstance->func[1]);
@@ -150,82 +146,66 @@ static int brcmf_sdioh_enablefuncs(struct sdioh_info *sd)
/*
* Public entry points & extern's
*/
-struct sdioh_info *brcmf_sdioh_attach(void *bar0)
+int brcmf_sdioh_attach(struct brcmf_sdio_dev *sdiodev)
{
- struct sdioh_info *sd;
- int err_ret;
+ int err_ret = 0;

BRCMF_TRACE(("%s\n", __func__));

if (gInstance == NULL) {
BRCMF_ERROR(("%s: SDIO Device not present\n", __func__));
- return NULL;
- }
-
- sd = kzalloc(sizeof(struct sdioh_info), GFP_ATOMIC);
- if (sd == NULL) {
- BRCMF_ERROR(("sdioh_attach: out of memory\n"));
- return NULL;
+ err_ret = -ENODEV;
+ goto out;
}

- sd->num_funcs = 2;
-
- gInstance->sd = sd;
+ sdiodev->num_funcs = 2;

- /* Claim host controller */
sdio_claim_host(gInstance->func[1]);
-
err_ret = sdio_set_block_size(gInstance->func[1], 64);
- if (err_ret)
- BRCMF_ERROR(("%s: Failed to set F1 blocksize\n", __func__));
-
- /* Release host controller F1 */
sdio_release_host(gInstance->func[1]);
+ if (err_ret) {
+ BRCMF_ERROR(("%s: Failed to set F1 blocksize\n", __func__));
+ goto out;
+ }

if (gInstance->func[2]) {
- /* Claim host controller F2 */
sdio_claim_host(gInstance->func[2]);
-
err_ret =
sdio_set_block_size(gInstance->func[2], sd_f2_blocksize);
- if (err_ret)
+ sdio_release_host(gInstance->func[2]);
+ if (err_ret) {
BRCMF_ERROR(("%s: Failed to set F2 blocksize"
" to %d\n", __func__, sd_f2_blocksize));
-
- /* Release host controller F2 */
- sdio_release_host(gInstance->func[2]);
+ goto out;
+ }
}

- brcmf_sdioh_enablefuncs(sd);
+ brcmf_sdioh_enablefuncs(sdiodev);

+out:
BRCMF_TRACE(("%s: Done\n", __func__));
- return sd;
+ return err_ret;
}

-extern int brcmf_sdioh_detach(struct sdioh_info *sd)
+void brcmf_sdioh_detach(struct brcmf_sdio_dev *sdiodev)
{
BRCMF_TRACE(("%s\n", __func__));

- if (sd) {
+ /* Disable Function 2 */
+ sdio_claim_host(gInstance->func[2]);
+ sdio_disable_func(gInstance->func[2]);
+ sdio_release_host(gInstance->func[2]);

- /* Disable Function 2 */
- sdio_claim_host(gInstance->func[2]);
- sdio_disable_func(gInstance->func[2]);
- sdio_release_host(gInstance->func[2]);
-
- /* Disable Function 1 */
- sdio_claim_host(gInstance->func[1]);
- sdio_disable_func(gInstance->func[1]);
- sdio_release_host(gInstance->func[1]);
+ /* Disable Function 1 */
+ sdio_claim_host(gInstance->func[1]);
+ sdio_disable_func(gInstance->func[1]);
+ sdio_release_host(gInstance->func[1]);

- kfree(sd);
- }
- return 0;
}

/* Configure callback to client when we receive client interrupt */
extern int
-brcmf_sdioh_interrupt_register(struct sdioh_info *sd)
+brcmf_sdioh_interrupt_register(void)
{
BRCMF_TRACE(("%s: Entering\n", __func__));

@@ -245,7 +225,7 @@ brcmf_sdioh_interrupt_register(struct sdioh_info *sd)
return 0;
}

-extern int brcmf_sdioh_interrupt_deregister(struct sdioh_info *sd)
+extern int brcmf_sdioh_interrupt_deregister(void)
{
BRCMF_TRACE(("%s: Entering\n", __func__));

@@ -270,14 +250,12 @@ extern int brcmf_sdioh_interrupt_deregister(struct sdioh_info *sd)
/* IOVar table */
enum {
IOV_MSGLEVEL = 1,
- IOV_NUMINTS,
IOV_DEVREG,
IOV_HCIREGS,
IOV_RXCHAIN
};

const struct brcmu_iovar sdioh_iovars[] = {
- {"sd_numints", IOV_NUMINTS, 0, IOVT_UINT32, 0},
{"sd_devreg", IOV_DEVREG, 0, IOVT_BUFFER, sizeof(struct brcmf_sdreg)}
,
{"sd_rxchain", IOV_RXCHAIN, 0, IOVT_BOOL, 0}
@@ -286,7 +264,7 @@ const struct brcmu_iovar sdioh_iovars[] = {
};

int
-brcmf_sdioh_iovar_op(struct sdioh_info *si, const char *name,
+brcmf_sdioh_iovar_op(struct brcmf_sdio_dev *sdiodev, const char *name,
void *params, int plen, void *arg, int len, bool set)
{
const struct brcmu_iovar *vi = NULL;
@@ -345,11 +323,6 @@ brcmf_sdioh_iovar_op(struct sdioh_info *si, const char *name,
memcpy(arg, &int_val, val_size);
break;

- case IOV_GVAL(IOV_NUMINTS):
- int_val = (s32) si->intrcount;
- memcpy(arg, &int_val, val_size);
- break;
-
case IOV_GVAL(IOV_DEVREG):
{
struct brcmf_sdreg *sd_ptr =
@@ -357,7 +330,7 @@ brcmf_sdioh_iovar_op(struct sdioh_info *si, const char *name,
u8 data = 0;

if (brcmf_sdioh_cfg_read
- (si, sd_ptr->func, sd_ptr->offset, &data)) {
+ (sdiodev, sd_ptr->func, sd_ptr->offset, &data)) {
bcmerror = -EIO;
break;
}
@@ -374,7 +347,7 @@ brcmf_sdioh_iovar_op(struct sdioh_info *si, const char *name,
u8 data = (u8) sd_ptr->value;

if (brcmf_sdioh_cfg_write
- (si, sd_ptr->func, sd_ptr->offset, &data)) {
+ (sdiodev, sd_ptr->func, sd_ptr->offset, &data)) {
bcmerror = -EIO;
break;
}
@@ -391,32 +364,36 @@ exit:
}

extern int
-brcmf_sdioh_cfg_read(struct sdioh_info *sd, uint fnc_num, u32 addr, u8 *data)
+brcmf_sdioh_cfg_read(struct brcmf_sdio_dev *sdiodev, uint fnc_num, u32 addr,
+ u8 *data)
{
int status;
/* No lock needed since brcmf_sdioh_request_byte does locking */
- status = brcmf_sdioh_request_byte(sd, SDIOH_READ, fnc_num, addr, data);
+ status = brcmf_sdioh_request_byte(sdiodev, SDIOH_READ, fnc_num,
+ addr, data);
return status;
}

extern int
-brcmf_sdioh_cfg_write(struct sdioh_info *sd, uint fnc_num, u32 addr, u8 *data)
+brcmf_sdioh_cfg_write(struct brcmf_sdio_dev *sdiodev, uint fnc_num, u32 addr,
+ u8 *data)
{
/* No lock needed since brcmf_sdioh_request_byte does locking */
int status;
- status = brcmf_sdioh_request_byte(sd, SDIOH_WRITE, fnc_num, addr, data);
+ status = brcmf_sdioh_request_byte(sdiodev, SDIOH_WRITE, fnc_num,
+ addr, data);
return status;
}

-static int brcmf_sdioh_get_cisaddr(struct sdioh_info *sd, u32 regaddr)
+static int brcmf_sdioh_get_cisaddr(struct brcmf_sdio_dev *sdiodev, u32 regaddr)
{
/* read 24 bits and return valid 17 bit addr */
int i;
u32 scratch, regdata;
u8 *ptr = (u8 *)&scratch;
for (i = 0; i < 3; i++) {
- if ((brcmf_sdioh_card_regread(sd, 0, regaddr, 1, &regdata)) !=
- SUCCESS)
+ if ((brcmf_sdioh_card_regread(sdiodev, 0, regaddr, 1,
+ &regdata)) != SUCCESS)
BRCMF_ERROR(("%s: Can't read!\n", __func__));

*ptr++ = (u8) regdata;
@@ -430,7 +407,8 @@ static int brcmf_sdioh_get_cisaddr(struct sdioh_info *sd, u32 regaddr)
}

extern int
-brcmf_sdioh_cis_read(struct sdioh_info *sd, uint func, u8 *cisd, u32 length)
+brcmf_sdioh_cis_read(struct brcmf_sdio_dev *sdiodev, uint func,
+ u8 *cisd, u32 length)
{
u32 count;
int offset;
@@ -439,18 +417,18 @@ brcmf_sdioh_cis_read(struct sdioh_info *sd, uint func, u8 *cisd, u32 length)

BRCMF_TRACE(("%s: Func = %d\n", __func__, func));

- if (!sd->func_cis_ptr[func]) {
+ if (!sdiodev->func_cis_ptr[func]) {
memset(cis, 0, length);
BRCMF_ERROR(("%s: no func_cis_ptr[%d]\n", __func__, func));
return -ENOTSUPP;
}

BRCMF_ERROR(("%s: func_cis_ptr[%d]=0x%04x\n", __func__, func,
- sd->func_cis_ptr[func]));
+ sdiodev->func_cis_ptr[func]));

for (count = 0; count < length; count++) {
- offset = sd->func_cis_ptr[func] + count;
- if (brcmf_sdioh_card_regread(sd, 0, offset, 1, &foo) < 0) {
+ offset = sdiodev->func_cis_ptr[func] + count;
+ if (brcmf_sdioh_card_regread(sdiodev, 0, offset, 1, &foo) < 0) {
BRCMF_ERROR(("%s: regread failed: Can't read CIS\n",
__func__));
return -EIO;
@@ -464,7 +442,7 @@ brcmf_sdioh_cis_read(struct sdioh_info *sd, uint func, u8 *cisd, u32 length)
}

extern int
-brcmf_sdioh_request_byte(struct sdioh_info *sd, uint rw, uint func,
+brcmf_sdioh_request_byte(struct brcmf_sdio_dev *sdiodev, uint rw, uint func,
uint regaddr, u8 *byte)
{
int err_ret;
@@ -566,7 +544,7 @@ brcmf_sdioh_request_byte(struct sdioh_info *sd, uint rw, uint func,
}

extern int
-brcmf_sdioh_request_word(struct sdioh_info *sd, uint cmd_type, uint rw,
+brcmf_sdioh_request_word(struct brcmf_sdio_dev *sdiodev, uint cmd_type, uint rw,
uint func, uint addr, u32 *word, uint nbytes)
{
int err_ret = -EIO;
@@ -618,8 +596,9 @@ brcmf_sdioh_request_word(struct sdioh_info *sd, uint cmd_type, uint rw,
}

static int
-brcmf_sdioh_request_packet(struct sdioh_info *sd, uint fix_inc, uint write,
- uint func, uint addr, struct sk_buff *pkt)
+brcmf_sdioh_request_packet(struct brcmf_sdio_dev *sdiodev, uint fix_inc,
+ uint write, uint func, uint addr,
+ struct sk_buff *pkt)
{
bool fifo = (fix_inc == SDIOH_DATA_FIX);
u32 SGCount = 0;
@@ -698,9 +677,10 @@ brcmf_sdioh_request_packet(struct sdioh_info *sd, uint fix_inc, uint write,
*
*/
extern int
-brcmf_sdioh_request_buffer(struct sdioh_info *sd, uint pio_dma, uint fix_inc,
- uint write, uint func, uint addr, uint reg_width,
- uint buflen_u, u8 *buffer, struct sk_buff *pkt)
+brcmf_sdioh_request_buffer(struct brcmf_sdio_dev *sdiodev, uint pio_dma,
+ uint fix_inc, uint write, uint func, uint addr,
+ uint reg_width, uint buflen_u, u8 *buffer,
+ struct sk_buff *pkt)
{
int Status;
struct sk_buff *mypkt = NULL;
@@ -724,8 +704,8 @@ brcmf_sdioh_request_buffer(struct sdioh_info *sd, uint pio_dma, uint fix_inc,
if (write)
memcpy(mypkt->data, buffer, buflen_u);

- Status = brcmf_sdioh_request_packet(sd, fix_inc, write, func,
- addr, mypkt);
+ Status = brcmf_sdioh_request_packet(sdiodev, fix_inc, write,
+ func, addr, mypkt);

/* For a read, copy the packet data back to the buffer. */
if (!write)
@@ -750,8 +730,8 @@ brcmf_sdioh_request_buffer(struct sdioh_info *sd, uint pio_dma, uint fix_inc,
if (write)
memcpy(mypkt->data, pkt->data, pkt->len);

- Status = brcmf_sdioh_request_packet(sd, fix_inc, write, func,
- addr, mypkt);
+ Status = brcmf_sdioh_request_packet(sdiodev, fix_inc, write,
+ func, addr, mypkt);

/* For a read, copy the packet data back to the buffer. */
if (!write)
@@ -762,22 +742,22 @@ brcmf_sdioh_request_buffer(struct sdioh_info *sd, uint pio_dma, uint fix_inc,
it is aligned. */
BRCMF_DATA(("%s: Aligned %s Packet, direct DMA\n",
__func__, write ? "Tx" : "Rx"));
- Status = brcmf_sdioh_request_packet(sd, fix_inc, write, func,
- addr, pkt);
+ Status = brcmf_sdioh_request_packet(sdiodev, fix_inc, write,
+ func, addr, pkt);
}

return Status;
}

/* this function performs "abort" for both of host & device */
-extern int brcmf_sdioh_abort(struct sdioh_info *sd, uint func)
+extern int brcmf_sdioh_abort(struct brcmf_sdio_dev *sdiodev, uint func)
{
char t_func = (char)func;
BRCMF_TRACE(("%s: Enter\n", __func__));

/* issue abort cmd52 command through F0 */
- brcmf_sdioh_request_byte(sd, SDIOH_WRITE, SDIO_FUNC_0, SDIO_CCCR_ABORT,
- &t_func);
+ brcmf_sdioh_request_byte(sdiodev, SDIOH_WRITE, SDIO_FUNC_0,
+ SDIO_CCCR_ABORT, &t_func);

BRCMF_TRACE(("%s: Exit\n", __func__));
return 0;
@@ -785,20 +765,21 @@ extern int brcmf_sdioh_abort(struct sdioh_info *sd, uint func)

/* Read client card reg */
int
-brcmf_sdioh_card_regread(struct sdioh_info *sd, int func, u32 regaddr,
+brcmf_sdioh_card_regread(struct brcmf_sdio_dev *sdiodev, int func, u32 regaddr,
int regsize, u32 *data)
{

if ((func == 0) || (regsize == 1)) {
u8 temp = 0;

- brcmf_sdioh_request_byte(sd, SDIOH_READ, func, regaddr, &temp);
+ brcmf_sdioh_request_byte(sdiodev, SDIOH_READ, func, regaddr,
+ &temp);
*data = temp;
*data &= 0xff;
BRCMF_DATA(("%s: byte read data=0x%02x\n", __func__, *data));
} else {
- brcmf_sdioh_request_word(sd, 0, SDIOH_READ, func, regaddr, data,
- regsize);
+ brcmf_sdioh_request_word(sdiodev, 0, SDIOH_READ, func, regaddr,
+ data, regsize);
if (regsize == 2)
*data &= 0xffff;

@@ -810,15 +791,12 @@ brcmf_sdioh_card_regread(struct sdioh_info *sd, int func, u32 regaddr,

static void brcmf_sdioh_irqhandler(struct sdio_func *func)
{
- struct sdioh_info *sd;
struct brcmf_sdio_dev *sdiodev = dev_get_drvdata(&func->card->dev);

BRCMF_TRACE(("brcmf: ***IRQHandler\n"));
- sd = gInstance->sd;

sdio_release_host(gInstance->func[0]);

- sd->intrcount++;
brcmf_sdbrcm_isr(sdiodev->bus);

sdio_claim_host(gInstance->func[0]);
@@ -827,11 +805,7 @@ static void brcmf_sdioh_irqhandler(struct sdio_func *func)
/* interrupt handler for F2 (dummy handler) */
static void brcmf_sdioh_irqhandler_f2(struct sdio_func *func)
{
- struct sdioh_info *sd;
-
BRCMF_TRACE(("brcmf: ***IRQHandlerF2\n"));
-
- sd = gInstance->sd;
}

static int brcmf_ops_sdio_probe(struct sdio_func *func,
diff --git a/drivers/staging/brcm80211/brcmfmac/sdio_host.h b/drivers/staging/brcm80211/brcmfmac/sdio_host.h
index c61a186..dc95c4d 100644
--- a/drivers/staging/brcm80211/brcmfmac/sdio_host.h
+++ b/drivers/staging/brcm80211/brcmfmac/sdio_host.h
@@ -122,23 +122,7 @@ struct brcmf_sdreg {
int value;
};

-struct sdioh_info {
- struct osl_info *osh; /* osh handler */
-
- uint irq; /* Client irq */
- int intrcount; /* Client interrupts */
- bool sd_blockmode; /* sd_blockmode == false => 64 Byte Cmd 53s. */
- /* Must be on for sd_multiblock to be effective */
- u8 num_funcs; /* Supported funcs on client */
- u32 com_cis_ptr;
- u32 func_cis_ptr[SDIOD_MAX_IOFUNCS];
- uint max_dma_len;
- /* DMA Descriptors supported by this controller. */
- uint max_dma_descriptors;
-};
-
struct brcmf_sdmmc_instance {
- struct sdioh_info *sd;
struct sdio_func *func[SDIOD_MAX_IOFUNCS];
u32 host_claimed;
atomic_t suspend; /* suspend flag */
@@ -147,7 +131,8 @@ struct brcmf_sdmmc_instance {
struct brcmf_sdio_dev {
struct sdio_func *func1;
struct sdio_func *func2;
- void *sdioh; /* sdioh handler */
+ u8 num_funcs; /* Supported funcs on client */
+ u32 func_cis_ptr[SDIOD_MAX_IOFUNCS];
u32 sbwad; /* Save backplane window address */
bool regfail; /* status of last reg_r/w call */
void *bus;
@@ -250,10 +235,6 @@ extern int brcmf_sdcard_iovar_op(struct brcmf_sdio_dev *sdiodev,
const char *name, void *params, int plen,
void *arg, int len, bool set);

-/* helper functions */
-
-struct sdioh_info;
-
/* platform specific/high level functions */
extern int brcmf_sdio_function_init(void);
extern int brcmf_sdio_register(void);
@@ -269,47 +250,47 @@ extern u32 brcmf_sdcard_cur_sbwad(struct brcmf_sdio_dev *sdiodev);
* The handler shall be provided by all subsequent calls. No local cache
* cfghdl points to the starting address of pci device mapped memory
*/
-extern struct sdioh_info *brcmf_sdioh_attach(void *cfghdl);
-extern int brcmf_sdioh_detach(struct sdioh_info *si);
+extern int brcmf_sdioh_attach(struct brcmf_sdio_dev *sdiodev);
+extern void brcmf_sdioh_detach(struct brcmf_sdio_dev *sdiodev);

extern int
-brcmf_sdioh_interrupt_register(struct sdioh_info *si);
+brcmf_sdioh_interrupt_register(void);

-extern int brcmf_sdioh_interrupt_deregister(struct sdioh_info *si);
+extern int brcmf_sdioh_interrupt_deregister(void);

/* read or write one byte using cmd52 */
-extern int
-brcmf_sdioh_request_byte(struct sdioh_info *si, uint rw, uint fnc, uint addr,
- u8 *byte);
+extern int brcmf_sdioh_request_byte(struct brcmf_sdio_dev *sdiodev, uint rw,
+ uint fnc, uint addr, u8 *byte);

/* read or write 2/4 bytes using cmd53 */
extern int
-brcmf_sdioh_request_word(struct sdioh_info *si, uint cmd_type,
+brcmf_sdioh_request_word(struct brcmf_sdio_dev *sdiodev, uint cmd_type,
uint rw, uint fnc, uint addr,
u32 *word, uint nbyte);

/* read or write any buffer using cmd53 */
extern int
-brcmf_sdioh_request_buffer(struct sdioh_info *si, uint pio_dma,
+brcmf_sdioh_request_buffer(struct brcmf_sdio_dev *sdiodev, uint pio_dma,
uint fix_inc, uint rw, uint fnc_num,
u32 addr, uint regwidth,
u32 buflen, u8 *buffer, struct sk_buff *pkt);

/* get cis data */
-extern int
-brcmf_sdioh_cis_read(struct sdioh_info *si, uint fuc, u8 *cis, u32 length);
+extern int brcmf_sdioh_cis_read(struct brcmf_sdio_dev *sdiodev, uint fuc,
+ u8 *cis, u32 length);

-extern int
-brcmf_sdioh_cfg_read(struct sdioh_info *si, uint fuc, u32 addr, u8 *data);
-extern int
-brcmf_sdioh_cfg_write(struct sdioh_info *si, uint fuc, u32 addr, u8 *data);
+extern int brcmf_sdioh_cfg_read(struct brcmf_sdio_dev *sdiodev, uint fuc,
+ u32 addr, u8 *data);
+extern int brcmf_sdioh_cfg_write(struct brcmf_sdio_dev *sdiodev, uint fuc,
+ u32 addr, u8 *data);

/* handle iovars */
-extern int brcmf_sdioh_iovar_op(struct sdioh_info *si, const char *name,
- void *params, int plen, void *arg, int len, bool set);
+extern int brcmf_sdioh_iovar_op(struct brcmf_sdio_dev *sdiodev,
+ const char *name, void *params, int plen,
+ void *arg, int len, bool set);

/* Issue abort to the specified function and clear controller as needed */
-extern int brcmf_sdioh_abort(struct sdioh_info *si, uint fnc);
+extern int brcmf_sdioh_abort(struct brcmf_sdio_dev *sdiodev, uint fnc);

/* Watchdog timer interface for pm ops */
extern void brcmf_sdio_wdtmr_enable(struct brcmf_sdio_dev *sdiodev,
--
1.7.4.1



2011-08-16 17:58:52

by Dan Carpenter

[permalink] [raw]
Subject: Re: [PATCHv2 01/14] staging: brcm80211: use wait queues instead of semaphores in wl_cfg80211.c

On Fri, Aug 12, 2011 at 09:09:31PM +0200, Arend van Spriel wrote:
>
> Or have people vote which version they prefer. I prefer v2.
>

It doesn't really matter either way, but I prefer the original one.

Checkpatch.pl only cares about if statements. This is fairly
idiomatic C. After all we wouldn't write a while statement like:

foo = some_func();
while (foo) {
frob();
frob();
foo = some_func();
}

We'd just write:
while ((foo = some_func())) {
frob();
frob();
}

And do while() feels the same to me.

regards,
dan carpenter


2011-08-16 20:27:48

by Rafał Miłecki

[permalink] [raw]
Subject: Re: [PATCH 01/14] staging: brcm80211: use wait queues instead of semaphores in wl_cfg80211.c

MjAxMS84LzEyIEZyYW5reSBMaW4gPGZyYW5reWxAYnJvYWRjb20uY29tPjoKPiBPbiAwOC8xMi8y
MDExIDA5OjQ0IEFNLCBBcmVuZCB2YW4gU3ByaWVsIHdyb3RlOgo+Pgo+PiBPbiAwOC8xMi8yMDEx
IDA0OjA3IFBNLCBSYWZhxYIgTWnFgmVja2kgd3JvdGU6Cj4+Pgo+Pj4gMjAxMS84LzEyIEFyZW5k
IHZhbiBTcHJpZWw8YXJlbmRAYnJvYWRjb20uY29tPjoKPj4+Pgo+Pj4+IEBAIC0zNTM3LDI3ICsz
NTQ0LDM5IEBAIHN0YXRpYyBzMzIgYnJjbWZfZXZlbnRfaGFuZGxlcih2b2lkICpkYXRhKQo+Pj4+
IMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIChzdHJ1Y3QgYnJjbWZfY2ZnODAy
MTFfcHJpdiAqKWRhdGE7Cj4+Pj4gwqAgwqAgwqAgwqAgc3RydWN0IHNjaGVkX3BhcmFtIHBhcmFt
ID0gey5zY2hlZF9wcmlvcml0eSA9IE1BWF9SVF9QUklPIC0gMSB9Owo+Pj4+IMKgIMKgIMKgIMKg
IHN0cnVjdCBicmNtZl9jZmc4MDIxMV9ldmVudF9xICplOwo+Pj4+ICsgwqAgwqAgwqAgREVDTEFS
RV9XQUlUUVVFVUUod2FpdCwgY3VycmVudCk7Cj4+Pj4KPj4+PiDCoCDCoCDCoCDCoCBzY2hlZF9z
ZXRzY2hlZHVsZXIoY3VycmVudCwgU0NIRURfRklGTywmcGFyYW0pOwo+Pj4+IMKgIMKgIMKgIMKg
IGFsbG93X3NpZ25hbChTSUdURVJNKTsKPj4+PiAtIMKgIMKgIMKgIHdoaWxlIChsaWtlbHkoIWRv
d25faW50ZXJydXB0aWJsZSgmY2ZnX3ByaXYtPmV2ZW50X3N5bmMpKSkgewo+Pj4+ICsgwqAgwqAg
wqAgYWRkX3dhaXRfcXVldWUoJmNmZ19wcml2LT5ldmVudF93YWl0cSwmd2FpdCk7Cj4+Pj4gKyDC
oCDCoCDCoCB3aGlsZSAoMSkgewo+Pj4+ICsgwqAgwqAgwqAgwqAgwqAgwqAgwqAgcHJlcGFyZV90
b193YWl0KCZjZmdfcHJpdi0+ZXZlbnRfd2FpdHEsJndhaXQsCj4+Pj4gKyDCoCDCoCDCoCDCoCDC
oCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCBUQVNLX0lOVEVSUlVQVElCTEUpOwo+Pj4+
ICsKPj4+PiArIMKgIMKgIMKgIMKgIMKgIMKgIMKgIHNjaGVkdWxlKCk7Cj4+Pj4gKwo+Pj4+IMKg
IMKgIMKgIMKgIMKgIMKgIMKgIMKgIGlmIChrdGhyZWFkX3Nob3VsZF9zdG9wKCkpCj4+Pj4gwqAg
wqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgYnJlYWs7Cj4+Pj4gKwo+Pj4+IMKgIMKg
IMKgIMKgIMKgIMKgIMKgIMKgIGUgPSBicmNtZl9kZXFfZXZlbnQoY2ZnX3ByaXYpOwo+Pj4+IMKg
IMKgIMKgIMKgIMKgIMKgIMKgIMKgIGlmICh1bmxpa2VseSghZSkpIHsKPj4+PiDCoCDCoCDCoCDC
oCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCBXTF9FUlIoImV2ZW50IHF1ZXVlIGVtcHR5Li4uXG4i
KTsKPj4+PiAtIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIEJVRygpOwo+Pj4+ICsg
wqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgY29udGludWU7Cj4+Pj4gwqAgwqAgwqAg
wqAgwqAgwqAgwqAgwqAgfQo+Pj4+IC0gwqAgwqAgwqAgwqAgwqAgwqAgwqAgV0xfSU5GTygiZXZl
bnQgdHlwZSAoJWQpXG4iLCBlLT5ldHlwZSk7Cj4+Pj4gLSDCoCDCoCDCoCDCoCDCoCDCoCDCoCBp
ZiAoY2ZnX3ByaXYtPmVsLmhhbmRsZXJbZS0+ZXR5cGVdKQo+Pj4+IC0gwqAgwqAgwqAgwqAgwqAg
wqAgwqAgwqAgwqAgwqAgwqAgY2ZnX3ByaXYtPmVsLmhhbmRsZXJbZS0+ZXR5cGVdKGNmZ19wcml2
LAo+Pj4+IC0KPj4+PiDCoGNmZ190b19uZGV2KGNmZ19wcml2KSwKPj4+PiAtJmUtPmVtc2csIGUt
PmVkYXRhKTsKPj4+PiAtIMKgIMKgIMKgIMKgIMKgIMKgIMKgIGVsc2UKPj4+PiAtIMKgIMKgIMKg
IMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIFdMX0lORk8oIlVua25vd24gRXZlbnQgKCVkKTogaWdu
b3JpbmdcbiIsCj4+Pj4gZS0+ZXR5cGUpOwo+Pj4+Cj4+Pj4gLSDCoCDCoCDCoCDCoCDCoCDCoCDC
oCBicmNtZl9wdXRfZXZlbnQoZSk7Cj4+Pj4gKyDCoCDCoCDCoCDCoCDCoCDCoCDCoCBkbyB7Cj4+
Pj4gKyDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCBXTF9JTkZPKCJldmVudCB0eXBl
ICglZClcbiIsIGUtPmV0eXBlKTsKPj4+PiArIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKg
IMKgIGlmIChjZmdfcHJpdi0+ZWwuaGFuZGxlcltlLT5ldHlwZV0pCj4+Pj4gKyDCoCDCoCDCoCDC
oCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCBjZmdfcHJpdi0+ZWwuaGFuZGxlcltl
LT5ldHlwZV0oY2ZnX3ByaXYsCj4+Pj4gKyDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDC
oCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCBjZmdfdG9fbmRldihjZmdfcHJpdiksCj4+Pj4gKyZl
LT5lbXNnLCBlLT5lZGF0YSk7Cj4+Pj4gKyDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDC
oCBlbHNlCj4+Pj4gKyDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDC
oCBXTF9JTkZPKCJVbmtub3duIEV2ZW50ICglZCk6Cj4+Pj4gaWdub3JpbmdcbiIsCj4+Pj4gKyDC
oCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCBl
LT5ldHlwZSk7Cj4+Pj4gKyDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCBicmNtZl9w
dXRfZXZlbnQoZSk7Cj4+Pj4gKyDCoCDCoCDCoCDCoCDCoCDCoCDCoCB9IHdoaWxlICgoZSA9IGJy
Y21mX2RlcV9ldmVudChjZmdfcHJpdikpKTsKPj4+Cj4+PiBpZiAoKCgoKGNhcmVfY29kaW5nX3N0
eWxlKSkpKSkKPj4+IGZpeCgpOwo+Pj4KPj4+IDotKQo+Pj4KPj4KPj4gSSBhc3N1bWUgeW91IHJl
ZmVyIHRvIHRoZSBpbmRlbnRzIGFib3ZlLiBOb3Qgc3VyZSB3aGF0IGV4YWN0bHkgaGFwcGVuZWQK
Pj4gdGhlcmUsIGJ1dCB0aGUgcGF0Y2ggZW1haWwgYXMgSSByZWNlaXZlZCBpdCBsb29rcy4gQ291
bGQgaXQgYmUgYSBtYWlsCj4+IHJlYWRlciBpc3N1ZT8KPgo+IEhpIFJhZmHFgiwKPgo+IElmIHlv
dSBhcmUgcmVmZXJpbmcgdG8gdGhpcyBsaW5lCj4+Pj4gKyDCoCDCoCDCoCDCoCDCoCDCoCDCoCB9
IHdoaWxlICgoZSA9IGJyY21mX2RlcV9ldmVudChjZmdfcHJpdikpKTsKPgo+IFRoZSBleHRyYSBw
YXJlbnRoZXNlcyBhcmUgYWRkZWQgdG8gZml4IGEgY29tcGlsZXIgd2FybmluZzoKPiDCoCDCoCDC
oCDCoGRyaXZlcnMvc3RhZ2luZy9icmNtODAyMTEvYnJjbWZtYWMvd2xfY2ZnODAyMTEuYzogSW4g
ZnVuY3Rpb24KPiDigJhicmNtZl9ldmVudF9oYW5kbGVy4oCZOgo+IMKgIMKgIMKgIMKgZHJpdmVy
cy9zdGFnaW5nL2JyY204MDIxMS9icmNtZm1hYy93bF9jZmc4MDIxMS5jOjM1NzY6IHdhcm5pbmc6
Cj4gc3VnZ2VzdCBwYXJlbnRoZXNlcyBhcm91bmQgYXNzaWdubWVudCB1c2VkIGFzIHRydXRoIHZh
bHVlCgpTb3JyeSBmb3IgY29uZnVzaW5nIHlvdSwgSSB0aG91Z2ggaXQncyBPSyB0byB1c2UKd2hp
bGUgKGUgPSBzdGgoKSkKSSBjYXVzZWQgYSBsaXR0bGUgb2YgbWVzcyBhbmQgZGlzY3Vzc2lvbiwg
dXBzIDp8CgotLSAKUmFmYcWCCg==

2011-08-12 16:38:13

by Arend van Spriel

[permalink] [raw]
Subject: Re: [PATCH 02/14] staging: brcm80211: remove iovar IOV_BLOCKSIZE in brcmfmac

On 08/12/2011 04:12 PM, Rafał Miłecki wrote:
> 2011/8/12 Arend van Spriel<[email protected]>:
>> @@ -273,7 +270,6 @@ extern int brcmf_sdioh_interrupt_deregister(struct sdioh_info *sd)
>> /* IOVar table */
>> enum {
>> IOV_MSGLEVEL = 1,
>> - IOV_BLOCKSIZE,
>> IOV_NUMINTS,
>> IOV_DEVREG,
>> IOV_HCIREGS,
> You are forcing IOV_MSGLEVEL to 1, so I expected values of IOV_* are
> really important in some piece of code. Now you change them. AFAIU it
> means you break something, or you can drop " = 1".

IOCTL codes do have a strong ordering as user-space application and
driver need to have the same code for the same entity. IOVs are internal
numbers for the driver only so there is no issue in renumbering those.

Gr. AvS

--
Almost nobody dances sober, unless they happen to be insane.
-- H.P. Lovecraft --



2011-08-26 17:44:58

by Henry Ptasinski

[permalink] [raw]
Subject: Re: [PATCH 00/14] staging: brcm80211: brcmfmac driver cleanup

On Fri, Aug 26, 2011 at 10:38:55AM -0700, Jason wrote:
> On Fri, Aug 26, 2011 at 10:31:59AM -0700, Henry Ptasinski wrote:
> > A possibly better approach would be a device with a BCM4329 on the
> > motherboard (e.g. table, phone, etc) that can run a relatively stock
> > linux kernel. However, I don't know of a specific platform at the
> > moment to recommend.
>
> Nexus One phone?

That's a possibility. Are people running recent, relatively unmodified linux
kernels on the Nexus One? (Or you could backport brcmfmac to the Android
version of the kernel, perhaps using compat-wireless).

- Henry



2011-08-12 13:35:12

by Arend van Spriel

[permalink] [raw]
Subject: [PATCH 08/14] staging: brcm80211: absorb brcmf_sdioh_interrupt_deregister into brcmf_sdcard_intr_dereg

From: Franky Lin <[email protected]>

brcmfmac wrapper function cleanup

Reviewed-by: Arend van Spriel <[email protected]>
Signed-off-by: Arend van Spriel <[email protected]>
---
drivers/staging/brcm80211/brcmfmac/bcmsdh.c | 8 ++++++-
drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c | 22 ---------------------
drivers/staging/brcm80211/brcmfmac/sdio_host.h | 2 -
3 files changed, 7 insertions(+), 25 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmfmac/bcmsdh.c b/drivers/staging/brcm80211/brcmfmac/bcmsdh.c
index e5cf138..6c1b57d 100644
--- a/drivers/staging/brcm80211/brcmfmac/bcmsdh.c
+++ b/drivers/staging/brcm80211/brcmfmac/bcmsdh.c
@@ -189,7 +189,13 @@ int brcmf_sdcard_intr_reg(struct brcmf_sdio_dev *sdiodev)

int brcmf_sdcard_intr_dereg(struct brcmf_sdio_dev *sdiodev)
{
- return brcmf_sdioh_interrupt_deregister(sdiodev);
+ BRCMF_TRACE(("%s: Entering\n", __func__));
+
+ sdio_claim_host(sdiodev->func[1]);
+ sdio_release_irq(sdiodev->func[1]);
+ sdio_release_host(sdiodev->func[1]);
+
+ return 0;
}

u8 brcmf_sdcard_cfg_read(struct brcmf_sdio_dev *sdiodev, uint fnc_num, u32 addr,
diff --git a/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c b/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c
index 2e7d3ce..1dfad3e 100644
--- a/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c
+++ b/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c
@@ -190,28 +190,6 @@ void brcmf_sdioh_detach(struct brcmf_sdio_dev *sdiodev)

}

-int brcmf_sdioh_interrupt_deregister(struct brcmf_sdio_dev *sdiodev)
-{
- BRCMF_TRACE(("%s: Entering\n", __func__));
-
- if (sdiodev->func[1]) {
- /* register and unmask irq */
- sdio_claim_host(sdiodev->func[1]);
- sdio_release_irq(sdiodev->func[1]);
- sdio_release_host(sdiodev->func[1]);
- }
-
- if (sdiodev->func[2]) {
- /* Claim host controller F2 */
- sdio_claim_host(sdiodev->func[2]);
- sdio_release_irq(sdiodev->func[2]);
- /* Release host controller F2 */
- sdio_release_host(sdiodev->func[2]);
- }
-
- return 0;
-}
-
extern int
brcmf_sdioh_cfg_read(struct brcmf_sdio_dev *sdiodev, uint fnc_num, u32 addr,
u8 *data)
diff --git a/drivers/staging/brcm80211/brcmfmac/sdio_host.h b/drivers/staging/brcm80211/brcmfmac/sdio_host.h
index bdbf411..d980307 100644
--- a/drivers/staging/brcm80211/brcmfmac/sdio_host.h
+++ b/drivers/staging/brcm80211/brcmfmac/sdio_host.h
@@ -247,8 +247,6 @@ extern u32 brcmf_sdcard_cur_sbwad(struct brcmf_sdio_dev *sdiodev);
extern int brcmf_sdioh_attach(struct brcmf_sdio_dev *sdiodev);
extern void brcmf_sdioh_detach(struct brcmf_sdio_dev *sdiodev);

-extern int brcmf_sdioh_interrupt_deregister(struct brcmf_sdio_dev *sdiodev);
-
/* read or write one byte using cmd52 */
extern int brcmf_sdioh_request_byte(struct brcmf_sdio_dev *sdiodev, uint rw,
uint fnc, uint addr, u8 *byte);
--
1.7.4.1



2011-08-26 17:32:50

by Henry Ptasinski

[permalink] [raw]
Subject: Re: [PATCH 00/14] staging: brcm80211: brcmfmac driver cleanup

On Fri, Aug 26, 2011 at 02:20:43AM -0700, Rafał Miłecki wrote:
> W dniu 12 sierpnia 2011 22:04 użytkownik Rafał Miłecki
> <[email protected]> napisał:
> > W dniu 12 sierpnia 2011 18:32 użytkownik Arend van Spriel
> > <[email protected]> napisał:
> >> On 08/12/2011 04:02 PM, Rafał Miłecki wrote:
> >>>
> >>> 2011/8/12 Arend van Spriel<[email protected]>:
> >>>>
> >>>> Several cleanup patches to reduce code for the brcmfmac driver and
> >>>> get rid of a remaining checkpatch warning. The driver sources should
> >>>> be clear from checkpatch issue now.
> >>>>
> >>>> This series applies to staging-next and depends on the following patch
> >>>> set:
> >>>
> >>> Are you testing patches on some hardware? Or just compile-testing?
> >>>
> >>> I believe this driver is meant to support BCM4329, which is not PCI(e)
> >>> board. What adapter do you use?
> >>>
> >>> I've heard about Arasan adapter. Have you tried it? Is that something
> >>> reachable from arasan.com?
> >>
> >> Our brcm80211 source tree under drivers/staging contain two drivers. The
> >> brcmsmac driver currently supporting the PCI(e) cards with bcm43224,
> >> bcm43225, and bcm4313 chips and the brcmfmac driver currently supporting the
> >> SDIO card with bcm4329 chip. brcmsmac is a mac80211 driver and brcmfmac is a
> >> cfg80211 driver.
> >>
> >> We indeed use the Arasan adapter and both drivers are running in nightly
> >> test cycle testing our common internal repository. So the drivers are
> >> functionally tested on the x86 platforms (32 and 64 bit). Also looking at
> >> sparc64 and powerpc64 but not in a nightly cycle.
> >
> > Is there a chance you can donate me with such a adapter and card?
>
> Ping?

Sorry, I meant to respond to this earlier. The Arasan adapters are in very
short supply here, and honestly they have enough issues that we're looking for
better options. A possibly better approach would be a device with a BCM4329 on
the motherboard (e.g. table, phone, etc) that can run a relatively stock linux
kernel. However, I don't know of a specific platform at the moment to
recommend.

A second choice would be something with a decent sdio controller built-in.
Some older laptops worked ok (e.g. Dell E4100), but they're more and more
diffucult to find.

- Henry



2011-08-12 13:35:13

by Arend van Spriel

[permalink] [raw]
Subject: [PATCH 05/14] staging: brcm80211: remove wext traces in fullmac

From: Franky Lin <[email protected]>

wext support code have been removed a while ago. This patch removes the
traces left behind.

Reviewed-by: Arend van Spriel <[email protected]>
Signed-off-by: Arend van Spriel <[email protected]>
---
drivers/staging/brcm80211/Kconfig | 2 --
drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c | 1 -
2 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/brcm80211/Kconfig b/drivers/staging/brcm80211/Kconfig
index f4cf9b2..621570a 100644
--- a/drivers/staging/brcm80211/Kconfig
+++ b/drivers/staging/brcm80211/Kconfig
@@ -22,8 +22,6 @@ config BRCMFMAC
depends on WLAN && CFG80211
select BRCMUTIL
select FW_LOADER
- select WIRELESS_EXT
- select WEXT_PRIV
---help---
This module adds support for embedded wireless adapters based on
Broadcom IEEE802.11n FullMAC chipsets. This driver uses the kernel's
diff --git a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
index 833defb..def1f77 100644
--- a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
+++ b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
@@ -21,7 +21,6 @@
#include <linux/netdevice.h>
#include <linux/sched.h>
#include <linux/etherdevice.h>
-#include <linux/wireless.h>
#include <linux/ieee80211.h>
#include <linux/mmc/sdio_func.h>
#include <linux/uaccess.h>
--
1.7.4.1



2011-08-12 18:59:58

by Franky Lin

[permalink] [raw]
Subject: Re: [PATCH 01/14] staging: brcm80211: use wait queues instead of semaphores in wl_cfg80211.c

On 08/12/2011 09:44 AM, Arend van Spriel wrote:
> On 08/12/2011 04:07 PM, Rafał Miłecki wrote:
>> 2011/8/12 Arend van Spriel<[email protected]>:
>>> @@ -3537,27 +3544,39 @@ static s32 brcmf_event_handler(void *data)
>>> (struct brcmf_cfg80211_priv *)data;
>>> struct sched_param param = {.sched_priority = MAX_RT_PRIO - 1 };
>>> struct brcmf_cfg80211_event_q *e;
>>> + DECLARE_WAITQUEUE(wait, current);
>>>
>>> sched_setscheduler(current, SCHED_FIFO,&param);
>>> allow_signal(SIGTERM);
>>> - while (likely(!down_interruptible(&cfg_priv->event_sync))) {
>>> + add_wait_queue(&cfg_priv->event_waitq,&wait);
>>> + while (1) {
>>> + prepare_to_wait(&cfg_priv->event_waitq,&wait,
>>> + TASK_INTERRUPTIBLE);
>>> +
>>> + schedule();
>>> +
>>> if (kthread_should_stop())
>>> break;
>>> +
>>> e = brcmf_deq_event(cfg_priv);
>>> if (unlikely(!e)) {
>>> WL_ERR("event queue empty...\n");
>>> - BUG();
>>> + continue;
>>> }
>>> - WL_INFO("event type (%d)\n", e->etype);
>>> - if (cfg_priv->el.handler[e->etype])
>>> - cfg_priv->el.handler[e->etype](cfg_priv,
>>> - cfg_to_ndev(cfg_priv),
>>> -&e->emsg, e->edata);
>>> - else
>>> - WL_INFO("Unknown Event (%d): ignoring\n", e->etype);
>>>
>>> - brcmf_put_event(e);
>>> + do {
>>> + WL_INFO("event type (%d)\n", e->etype);
>>> + if (cfg_priv->el.handler[e->etype])
>>> + cfg_priv->el.handler[e->etype](cfg_priv,
>>> + cfg_to_ndev(cfg_priv),
>>> +&e->emsg, e->edata);
>>> + else
>>> + WL_INFO("Unknown Event (%d): ignoring\n",
>>> + e->etype);
>>> + brcmf_put_event(e);
>>> + } while ((e = brcmf_deq_event(cfg_priv)));
>> if (((((care_coding_style)))))
>> fix();
>>
>> :-)
>>
>
> I assume you refer to the indents above. Not sure what exactly happened
> there, but the patch email as I received it looks. Could it be a mail
> reader issue?

Hi Rafał,

If you are refering to this line
>>> + } while ((e = brcmf_deq_event(cfg_priv)));

The extra parentheses are added to fix a compiler warning:
drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c: In function
‘brcmf_event_handler’:
drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c:3576: warning: suggest
parentheses around assignment used as truth value

Thanks
Franky



2011-08-12 13:35:12

by Arend van Spriel

[permalink] [raw]
Subject: [PATCH 04/14] staging: brcm80211: remove global var gInstance from brcmfmac

From: Franky Lin <[email protected]>

Use sdio function pointer stored in struct brcmf_sdio_dev instead
of those in gInstance.

Reviewed-by: Arend van Spriel <[email protected]>
Signed-off-by: Arend van Spriel <[email protected]>
---
drivers/staging/brcm80211/brcmfmac/bcmsdh.c | 5 +-
drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c | 198 +++++++++------------
drivers/staging/brcm80211/brcmfmac/dhd_sdio.c | 7 +-
drivers/staging/brcm80211/brcmfmac/sdio_host.h | 18 +--
4 files changed, 99 insertions(+), 129 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmfmac/bcmsdh.c b/drivers/staging/brcm80211/brcmfmac/bcmsdh.c
index 6a9ac1d..aaf13f4 100644
--- a/drivers/staging/brcm80211/brcmfmac/bcmsdh.c
+++ b/drivers/staging/brcm80211/brcmfmac/bcmsdh.c
@@ -21,6 +21,7 @@
#include <linux/pci_ids.h>
#include <linux/sched.h>
#include <linux/completion.h>
+#include <linux/mmc/card.h>

#include <defs.h>
#include <brcm_hw_ids.h>
@@ -55,12 +56,12 @@ brcmf_sdcard_iovar_op(struct brcmf_sdio_dev *sdiodev, const char *name,

int brcmf_sdcard_intr_reg(struct brcmf_sdio_dev *sdiodev)
{
- return brcmf_sdioh_interrupt_register();
+ return brcmf_sdioh_interrupt_register(sdiodev);
}

int brcmf_sdcard_intr_dereg(struct brcmf_sdio_dev *sdiodev)
{
- return brcmf_sdioh_interrupt_deregister();
+ return brcmf_sdioh_interrupt_deregister(sdiodev);
}

u8 brcmf_sdcard_cfg_read(struct brcmf_sdio_dev *sdiodev, uint fnc_num, u32 addr,
diff --git a/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c b/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c
index 877428c..76b3394 100644
--- a/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c
+++ b/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c
@@ -58,8 +58,6 @@ static int brcmf_sdio_resume(struct device *dev);

uint sd_f2_blocksize = 512; /* Default blocksize */

-struct brcmf_sdmmc_instance *gInstance;
-
/* devices we support, null terminated */
static const struct sdio_device_id brcmf_sdmmc_ids[] = {
{SDIO_DEVICE(SDIO_VENDOR_ID_BROADCOM, SDIO_DEVICE_ID_BROADCOM_4329)},
@@ -133,9 +131,9 @@ static int brcmf_sdioh_enablefuncs(struct brcmf_sdio_dev *sdiodev)
}

/* Enable Function 1 */
- sdio_claim_host(gInstance->func[1]);
- err_ret = sdio_enable_func(gInstance->func[1]);
- sdio_release_host(gInstance->func[1]);
+ sdio_claim_host(sdiodev->func[1]);
+ err_ret = sdio_enable_func(sdiodev->func[1]);
+ sdio_release_host(sdiodev->func[1]);
if (err_ret)
BRCMF_ERROR(("brcmf_sdioh_enablefuncs: Failed to enable F1 "
"Err: 0x%08x\n", err_ret));
@@ -152,32 +150,23 @@ int brcmf_sdioh_attach(struct brcmf_sdio_dev *sdiodev)

BRCMF_TRACE(("%s\n", __func__));

- if (gInstance == NULL) {
- BRCMF_ERROR(("%s: SDIO Device not present\n", __func__));
- err_ret = -ENODEV;
- goto out;
- }
-
sdiodev->num_funcs = 2;

- sdio_claim_host(gInstance->func[1]);
- err_ret = sdio_set_block_size(gInstance->func[1], 64);
- sdio_release_host(gInstance->func[1]);
+ sdio_claim_host(sdiodev->func[1]);
+ err_ret = sdio_set_block_size(sdiodev->func[1], 64);
+ sdio_release_host(sdiodev->func[1]);
if (err_ret) {
BRCMF_ERROR(("%s: Failed to set F1 blocksize\n", __func__));
goto out;
}

- if (gInstance->func[2]) {
- sdio_claim_host(gInstance->func[2]);
- err_ret =
- sdio_set_block_size(gInstance->func[2], sd_f2_blocksize);
- sdio_release_host(gInstance->func[2]);
- if (err_ret) {
- BRCMF_ERROR(("%s: Failed to set F2 blocksize"
- " to %d\n", __func__, sd_f2_blocksize));
- goto out;
- }
+ sdio_claim_host(sdiodev->func[2]);
+ err_ret = sdio_set_block_size(sdiodev->func[2], sd_f2_blocksize);
+ sdio_release_host(sdiodev->func[2]);
+ if (err_ret) {
+ BRCMF_ERROR(("%s: Failed to set F2 blocksize"
+ " to %d\n", __func__, sd_f2_blocksize));
+ goto out;
}

brcmf_sdioh_enablefuncs(sdiodev);
@@ -192,56 +181,56 @@ void brcmf_sdioh_detach(struct brcmf_sdio_dev *sdiodev)
BRCMF_TRACE(("%s\n", __func__));

/* Disable Function 2 */
- sdio_claim_host(gInstance->func[2]);
- sdio_disable_func(gInstance->func[2]);
- sdio_release_host(gInstance->func[2]);
+ sdio_claim_host(sdiodev->func[2]);
+ sdio_disable_func(sdiodev->func[2]);
+ sdio_release_host(sdiodev->func[2]);

/* Disable Function 1 */
- sdio_claim_host(gInstance->func[1]);
- sdio_disable_func(gInstance->func[1]);
- sdio_release_host(gInstance->func[1]);
+ sdio_claim_host(sdiodev->func[1]);
+ sdio_disable_func(sdiodev->func[1]);
+ sdio_release_host(sdiodev->func[1]);

}

/* Configure callback to client when we receive client interrupt */
extern int
-brcmf_sdioh_interrupt_register(void)
+brcmf_sdioh_interrupt_register(struct brcmf_sdio_dev *sdiodev)
{
BRCMF_TRACE(("%s: Entering\n", __func__));

/* register and unmask irq */
- if (gInstance->func[2]) {
- sdio_claim_host(gInstance->func[2]);
- sdio_claim_irq(gInstance->func[2], brcmf_sdioh_irqhandler_f2);
- sdio_release_host(gInstance->func[2]);
+ if (sdiodev->func[2]) {
+ sdio_claim_host(sdiodev->func[2]);
+ sdio_claim_irq(sdiodev->func[2], brcmf_sdioh_irqhandler_f2);
+ sdio_release_host(sdiodev->func[2]);
}

- if (gInstance->func[1]) {
- sdio_claim_host(gInstance->func[1]);
- sdio_claim_irq(gInstance->func[1], brcmf_sdioh_irqhandler);
- sdio_release_host(gInstance->func[1]);
+ if (sdiodev->func[1]) {
+ sdio_claim_host(sdiodev->func[1]);
+ sdio_claim_irq(sdiodev->func[1], brcmf_sdioh_irqhandler);
+ sdio_release_host(sdiodev->func[1]);
}

return 0;
}

-extern int brcmf_sdioh_interrupt_deregister(void)
+int brcmf_sdioh_interrupt_deregister(struct brcmf_sdio_dev *sdiodev)
{
BRCMF_TRACE(("%s: Entering\n", __func__));

- if (gInstance->func[1]) {
+ if (sdiodev->func[1]) {
/* register and unmask irq */
- sdio_claim_host(gInstance->func[1]);
- sdio_release_irq(gInstance->func[1]);
- sdio_release_host(gInstance->func[1]);
+ sdio_claim_host(sdiodev->func[1]);
+ sdio_release_irq(sdiodev->func[1]);
+ sdio_release_host(sdiodev->func[1]);
}

- if (gInstance->func[2]) {
+ if (sdiodev->func[2]) {
/* Claim host controller F2 */
- sdio_claim_host(gInstance->func[2]);
- sdio_release_irq(gInstance->func[2]);
+ sdio_claim_host(sdiodev->func[2]);
+ sdio_release_irq(sdiodev->func[2]);
/* Release host controller F2 */
- sdio_release_host(gInstance->func[2]);
+ sdio_release_host(sdiodev->func[2]);
}

return 0;
@@ -450,8 +439,8 @@ brcmf_sdioh_request_byte(struct brcmf_sdio_dev *sdiodev, 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, gInstance);
- BRCMF_PM_RESUME_RETURN_ERROR(-EIO, gInstance);
+ BRCMF_PM_RESUME_WAIT(sdioh_request_byte_wait, sdiodev);
+ BRCMF_PM_RESUME_RETURN_ERROR(-EIO, sdiodev);
if (rw) { /* CMD52 Write */
if (func == 0) {
/* Can only directly write to some F0 registers.
@@ -459,13 +448,13 @@ brcmf_sdioh_request_byte(struct brcmf_sdio_dev *sdiodev, uint rw, uint func,
* as a special case.
*/
if (regaddr == SDIO_CCCR_IOEx) {
- if (gInstance->func[2]) {
- sdio_claim_host(gInstance->func[2]);
+ if (sdiodev->func[2]) {
+ sdio_claim_host(sdiodev->func[2]);
if (*byte & SDIO_FUNC_ENABLE_2) {
/* Enable Function 2 */
err_ret =
sdio_enable_func
- (gInstance->func[2]);
+ (sdiodev->func[2]);
if (err_ret)
BRCMF_ERROR((
"request_byte: "
@@ -476,7 +465,7 @@ brcmf_sdioh_request_byte(struct brcmf_sdio_dev *sdiodev, uint rw, uint func,
/* Disable Function 2 */
err_ret =
sdio_disable_func
- (gInstance->func[2]);
+ (sdiodev->func[2]);
if (err_ret)
BRCMF_ERROR((
"request_byte: "
@@ -484,55 +473,55 @@ brcmf_sdioh_request_byte(struct brcmf_sdio_dev *sdiodev, uint rw, uint func,
"failed:%d\n",
err_ret));
}
- sdio_release_host(gInstance->func[2]);
+ sdio_release_host(sdiodev->func[2]);
}
}
/* to allow abort command through F1 */
else if (regaddr == SDIO_CCCR_ABORT) {
- sdio_claim_host(gInstance->func[func]);
+ sdio_claim_host(sdiodev->func[func]);
/*
* this sdio_f0_writeb() can be replaced
* with another api
* depending upon MMC driver change.
* As of this time, this is temporaray one
*/
- sdio_writeb(gInstance->func[func], *byte,
+ sdio_writeb(sdiodev->func[func], *byte,
regaddr, &err_ret);
- sdio_release_host(gInstance->func[func]);
+ sdio_release_host(sdiodev->func[func]);
} else if (regaddr < 0xF0) {
BRCMF_ERROR(("brcmf: F0 Wr:0x%02x: write "
"disallowed\n", regaddr));
} else {
/* Claim host controller, perform F0 write,
and release */
- sdio_claim_host(gInstance->func[func]);
- sdio_f0_writeb(gInstance->func[func], *byte,
+ sdio_claim_host(sdiodev->func[func]);
+ sdio_f0_writeb(sdiodev->func[func], *byte,
regaddr, &err_ret);
- sdio_release_host(gInstance->func[func]);
+ sdio_release_host(sdiodev->func[func]);
}
} else {
/* Claim host controller, perform Fn write,
and release */
- sdio_claim_host(gInstance->func[func]);
- sdio_writeb(gInstance->func[func], *byte, regaddr,
+ sdio_claim_host(sdiodev->func[func]);
+ sdio_writeb(sdiodev->func[func], *byte, regaddr,
&err_ret);
- sdio_release_host(gInstance->func[func]);
+ sdio_release_host(sdiodev->func[func]);
}
} else { /* CMD52 Read */
/* Claim host controller, perform Fn read, and release */
- sdio_claim_host(gInstance->func[func]);
+ sdio_claim_host(sdiodev->func[func]);

if (func == 0) {
*byte =
- sdio_f0_readb(gInstance->func[func], regaddr,
+ sdio_f0_readb(sdiodev->func[func], regaddr,
&err_ret);
} else {
*byte =
- sdio_readb(gInstance->func[func], regaddr,
+ sdio_readb(sdiodev->func[func], regaddr,
&err_ret);
}

- sdio_release_host(gInstance->func[func]);
+ sdio_release_host(sdiodev->func[func]);
}

if (err_ret)
@@ -557,17 +546,17 @@ brcmf_sdioh_request_word(struct brcmf_sdio_dev *sdiodev, 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, gInstance);
- BRCMF_PM_RESUME_RETURN_ERROR(-EIO, gInstance);
+ BRCMF_PM_RESUME_WAIT(sdioh_request_word_wait, sdiodev);
+ BRCMF_PM_RESUME_RETURN_ERROR(-EIO, sdiodev);
/* Claim host controller */
- sdio_claim_host(gInstance->func[func]);
+ sdio_claim_host(sdiodev->func[func]);

if (rw) { /* CMD52 Write */
if (nbytes == 4)
- sdio_writel(gInstance->func[func], *word, addr,
+ sdio_writel(sdiodev->func[func], *word, addr,
&err_ret);
else if (nbytes == 2)
- sdio_writew(gInstance->func[func], (*word & 0xFFFF),
+ sdio_writew(sdiodev->func[func], (*word & 0xFFFF),
addr, &err_ret);
else
BRCMF_ERROR(("%s: Invalid nbytes: %d\n",
@@ -575,10 +564,10 @@ brcmf_sdioh_request_word(struct brcmf_sdio_dev *sdiodev, uint cmd_type, uint rw,
} else { /* CMD52 Read */
if (nbytes == 4)
*word =
- sdio_readl(gInstance->func[func], addr, &err_ret);
+ sdio_readl(sdiodev->func[func], addr, &err_ret);
else if (nbytes == 2)
*word =
- sdio_readw(gInstance->func[func], addr,
+ sdio_readw(sdiodev->func[func], addr,
&err_ret) & 0xFFFF;
else
BRCMF_ERROR(("%s: Invalid nbytes: %d\n",
@@ -586,7 +575,7 @@ brcmf_sdioh_request_word(struct brcmf_sdio_dev *sdiodev, uint cmd_type, uint rw,
}

/* Release host controller */
- sdio_release_host(gInstance->func[func]);
+ sdio_release_host(sdiodev->func[func]);

if (err_ret)
BRCMF_ERROR(("brcmf: Failed to %s word, Err: 0x%08x\n",
@@ -608,30 +597,30 @@ brcmf_sdioh_request_packet(struct brcmf_sdio_dev *sdiodev, uint fix_inc,

BRCMF_TRACE(("%s: Enter\n", __func__));

- BRCMF_PM_RESUME_WAIT(sdioh_request_packet_wait, gInstance);
- BRCMF_PM_RESUME_RETURN_ERROR(-EIO, gInstance);
+ BRCMF_PM_RESUME_WAIT(sdioh_request_packet_wait, sdiodev);
+ BRCMF_PM_RESUME_RETURN_ERROR(-EIO, sdiodev);

/* Claim host controller */
- sdio_claim_host(gInstance->func[func]);
+ sdio_claim_host(sdiodev->func[func]);
for (pnext = pkt; pnext; pnext = pnext->next) {
uint pkt_len = pnext->len;
pkt_len += 3;
pkt_len &= 0xFFFFFFFC;

if ((write) && (!fifo)) {
- err_ret = sdio_memcpy_toio(gInstance->func[func], addr,
+ err_ret = sdio_memcpy_toio(sdiodev->func[func], addr,
((u8 *) (pnext->data)),
pkt_len);
} else if (write) {
- err_ret = sdio_memcpy_toio(gInstance->func[func], addr,
+ err_ret = sdio_memcpy_toio(sdiodev->func[func], addr,
((u8 *) (pnext->data)),
pkt_len);
} else if (fifo) {
- err_ret = sdio_readsb(gInstance->func[func],
+ err_ret = sdio_readsb(sdiodev->func[func],
((u8 *) (pnext->data)),
addr, pkt_len);
} else {
- err_ret = sdio_memcpy_fromio(gInstance->func[func],
+ err_ret = sdio_memcpy_fromio(sdiodev->func[func],
((u8 *) (pnext->data)),
addr, pkt_len);
}
@@ -655,7 +644,7 @@ brcmf_sdioh_request_packet(struct brcmf_sdio_dev *sdiodev, uint fix_inc,
}

/* Release host controller */
- sdio_release_host(gInstance->func[func]);
+ sdio_release_host(sdiodev->func[func]);

BRCMF_TRACE(("%s: Exit\n", __func__));
return err_ret;
@@ -687,8 +676,8 @@ brcmf_sdioh_request_buffer(struct brcmf_sdio_dev *sdiodev, uint pio_dma,

BRCMF_TRACE(("%s: Enter\n", __func__));

- BRCMF_PM_RESUME_WAIT(sdioh_request_buffer_wait, gInstance);
- BRCMF_PM_RESUME_RETURN_ERROR(-EIO, gInstance);
+ BRCMF_PM_RESUME_WAIT(sdioh_request_buffer_wait, sdiodev);
+ BRCMF_PM_RESUME_RETURN_ERROR(-EIO, sdiodev);
/* Case 1: we don't have a packet. */
if (pkt == NULL) {
BRCMF_DATA(("%s: Creating new %s Packet, len=%d\n",
@@ -795,11 +784,11 @@ static void brcmf_sdioh_irqhandler(struct sdio_func *func)

BRCMF_TRACE(("brcmf: ***IRQHandler\n"));

- sdio_release_host(gInstance->func[0]);
+ sdio_release_host(func);

brcmf_sdbrcm_isr(sdiodev->bus);

- sdio_claim_host(gInstance->func[0]);
+ sdio_claim_host(func);
}

/* interrupt handler for F2 (dummy handler) */
@@ -812,7 +801,6 @@ static int brcmf_ops_sdio_probe(struct sdio_func *func,
const struct sdio_device_id *id)
{
int ret = 0;
- static struct sdio_func sdio_func_0;
struct brcmf_sdio_dev *sdiodev;
BRCMF_TRACE(("sdio_probe: %s Enter\n", __func__));
BRCMF_TRACE(("sdio_probe: func->class=%x\n", func->class));
@@ -821,10 +809,6 @@ static int brcmf_ops_sdio_probe(struct sdio_func *func,
BRCMF_TRACE(("Function#: 0x%04x\n", func->num));

if (func->num == 1) {
- sdio_func_0.num = 0;
- sdio_func_0.card = func->card;
- gInstance->func[0] = &sdio_func_0;
-
if (dev_get_drvdata(&func->card->dev)) {
BRCMF_ERROR(("%s: card private drvdata occupied.\n",
__func__));
@@ -833,19 +817,18 @@ static int brcmf_ops_sdio_probe(struct sdio_func *func,
sdiodev = kzalloc(sizeof(struct brcmf_sdio_dev), GFP_KERNEL);
if (!sdiodev)
return -ENOMEM;
- sdiodev->func1 = func;
+ sdiodev->func[0] = func->card->sdio_func[0];
+ sdiodev->func[1] = func;
dev_set_drvdata(&func->card->dev, sdiodev);

- atomic_set(&gInstance->suspend, false);
+ atomic_set(&sdiodev->suspend, false);
}

- gInstance->func[func->num] = func;
-
if (func->num == 2) {
sdiodev = dev_get_drvdata(&func->card->dev);
- if ((!sdiodev) || (sdiodev->func1->card != func->card))
+ if ((!sdiodev) || (sdiodev->func[1]->card != func->card))
return -ENODEV;
- sdiodev->func2 = func;
+ sdiodev->func[2] = func;

brcmf_cfg80211_sdio_func(func);
BRCMF_TRACE(("F2 found, calling brcmf_sdio_probe...\n"));
@@ -884,21 +867,22 @@ static int brcmf_sdio_suspend(struct device *dev)

BRCMF_TRACE(("%s\n", __func__));

- atomic_set(&gInstance->suspend, true);
+ sdiodev = dev_get_drvdata(&func->card->dev);
+
+ atomic_set(&sdiodev->suspend, true);

- sdio_flags = sdio_get_host_pm_caps(gInstance->func[1]);
+ sdio_flags = sdio_get_host_pm_caps(sdiodev->func[1]);
if (!(sdio_flags & MMC_PM_KEEP_POWER)) {
BRCMF_ERROR(("Host can't keep power while suspended\n"));
return -EINVAL;
}

- ret = sdio_set_host_pm_flags(gInstance->func[1], MMC_PM_KEEP_POWER);
+ ret = sdio_set_host_pm_flags(sdiodev->func[1], MMC_PM_KEEP_POWER);
if (ret) {
BRCMF_ERROR(("Failed to set pm_flags\n"));
return ret;
}

- sdiodev = dev_get_drvdata(&func->card->dev);
brcmf_sdio_wdtmr_enable(sdiodev, false);

return ret;
@@ -911,7 +895,7 @@ static int brcmf_sdio_resume(struct device *dev)

sdiodev = dev_get_drvdata(&func->card->dev);
brcmf_sdio_wdtmr_enable(sdiodev, true);
- atomic_set(&gInstance->suspend, false);
+ atomic_set(&sdiodev->suspend, false);
return 0;
}
#endif /* CONFIG_PM_SLEEP */
@@ -924,10 +908,6 @@ int brcmf_sdio_function_init(void)
int error = 0;
BRCMF_TRACE(("brcmf_sdio_function_init: %s Enter\n", __func__));

- gInstance = kzalloc(sizeof(struct brcmf_sdmmc_instance), GFP_KERNEL);
- if (!gInstance)
- return -ENOMEM;
-
error = sdio_register_driver(&brcmf_sdmmc_driver);

return error;
@@ -941,6 +921,4 @@ void brcmf_sdio_function_cleanup(void)
BRCMF_TRACE(("%s Enter\n", __func__));

sdio_unregister_driver(&brcmf_sdmmc_driver);
-
- kfree(gInstance);
}
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c b/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
index 6e1fe5c..85ce5d9 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
+++ b/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
@@ -24,6 +24,7 @@
#include <linux/sched.h>
#include <linux/mmc/sdio.h>
#include <linux/mmc/sdio_func.h>
+#include <linux/mmc/card.h>
#include <linux/semaphore.h>
#include <linux/firmware.h>
#include <asm/unaligned.h>
@@ -5685,7 +5686,7 @@ static bool brcmf_sdbrcm_probe_init(struct brcmf_bus *bus)
bus->idleclock = BRCMF_IDLE_ACTIVE;

/* Query the F2 block size, set roundup accordingly */
- bus->blocksize = bus->sdiodev->func2->cur_blksize;
+ bus->blocksize = bus->sdiodev->func[2]->cur_blksize;
bus->roundup = min(max_roundup, bus->blocksize);

/* Query if bus module supports packet chaining,
@@ -5828,7 +5829,7 @@ static int brcmf_sdbrcm_download_code_file(struct brcmf_bus *bus)

bus->fw_name = BCM4329_FW_NAME;
ret = request_firmware(&bus->firmware, bus->fw_name,
- &gInstance->func[2]->dev);
+ &bus->sdiodev->func[2]->dev);
if (ret) {
BRCMF_ERROR(("%s: Fail to request firmware %d\n",
__func__, ret));
@@ -5930,7 +5931,7 @@ static int brcmf_sdbrcm_download_nvram(struct brcmf_bus *bus)

bus->nv_name = BCM4329_NV_NAME;
ret = request_firmware(&bus->firmware, bus->nv_name,
- &gInstance->func[2]->dev);
+ &bus->sdiodev->func[2]->dev);
if (ret) {
BRCMF_ERROR(("%s: Fail to request nvram %d\n", __func__, ret));
return ret;
diff --git a/drivers/staging/brcm80211/brcmfmac/sdio_host.h b/drivers/staging/brcm80211/brcmfmac/sdio_host.h
index dc95c4d..4296c93 100644
--- a/drivers/staging/brcm80211/brcmfmac/sdio_host.h
+++ b/drivers/staging/brcm80211/brcmfmac/sdio_host.h
@@ -122,20 +122,14 @@ struct brcmf_sdreg {
int value;
};

-struct brcmf_sdmmc_instance {
- struct sdio_func *func[SDIOD_MAX_IOFUNCS];
- u32 host_claimed;
- atomic_t suspend; /* suspend flag */
-};
-
struct brcmf_sdio_dev {
- struct sdio_func *func1;
- struct sdio_func *func2;
+ struct sdio_func *func[SDIO_MAX_FUNCS];
u8 num_funcs; /* Supported funcs on client */
u32 func_cis_ptr[SDIOD_MAX_IOFUNCS];
u32 sbwad; /* Save backplane window address */
bool regfail; /* status of last reg_r/w call */
void *bus;
+ atomic_t suspend; /* suspend flag */
};

/* Register/deregister device interrupt handler. */
@@ -253,10 +247,8 @@ extern u32 brcmf_sdcard_cur_sbwad(struct brcmf_sdio_dev *sdiodev);
extern int brcmf_sdioh_attach(struct brcmf_sdio_dev *sdiodev);
extern void brcmf_sdioh_detach(struct brcmf_sdio_dev *sdiodev);

-extern int
-brcmf_sdioh_interrupt_register(void);
-
-extern int brcmf_sdioh_interrupt_deregister(void);
+extern int brcmf_sdioh_interrupt_register(struct brcmf_sdio_dev *sdiodev);
+extern int brcmf_sdioh_interrupt_deregister(struct brcmf_sdio_dev *sdiodev);

/* read or write one byte using cmd52 */
extern int brcmf_sdioh_request_byte(struct brcmf_sdio_dev *sdiodev, uint rw,
@@ -298,8 +290,6 @@ extern void brcmf_sdio_wdtmr_enable(struct brcmf_sdio_dev *sdiodev,

extern uint sd_f2_blocksize;

-extern struct brcmf_sdmmc_instance *gInstance;
-
extern void *brcmf_sdbrcm_probe(u16 bus_no, u16 slot, u16 func, uint bustype,
u32 regsva, struct brcmf_sdio_dev *sdiodev);
extern void brcmf_sdbrcm_disconnect(void *ptr);
--
1.7.4.1



2011-08-12 13:35:49

by Arend van Spriel

[permalink] [raw]
Subject: [PATCH 14/14] staging: brcm80211: remove unused func parameter in wl_cfg80211 of fullmac

From: Franky Lin <[email protected]>

Get rid of some unused void *data parameter

Reviewed-by: Arend van Spriel <[email protected]>
Reviewed-by: Roland Vossen <[email protected]>
Signed-off-by: Arend van Spriel <[email protected]>
---
drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c | 24 +++++++++++-----------
1 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
index def1f77..6c604cf 100644
--- a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
+++ b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
@@ -117,7 +117,7 @@ static void brcmf_init_eloop_handler(struct brcmf_cfg80211_event_loop *el);
static struct brcmf_cfg80211_event_q *
brcmf_deq_event(struct brcmf_cfg80211_priv *cfg_priv);
static s32 brcmf_enq_event(struct brcmf_cfg80211_priv *cfg_priv, u32 type,
- const struct brcmf_event_msg *msg, void *data);
+ const struct brcmf_event_msg *msg);
static void brcmf_put_event(struct brcmf_cfg80211_event_q *e);
static void brcmf_wakeup_event(struct brcmf_cfg80211_priv *cfg_priv);
static s32 brcmf_notify_connect_status(struct brcmf_cfg80211_priv *cfg_priv,
@@ -134,11 +134,11 @@ static s32 brcmf_notify_scan_status(struct brcmf_cfg80211_priv *cfg_priv,
void *data);
static s32 brcmf_bss_connect_done(struct brcmf_cfg80211_priv *cfg_priv,
struct net_device *ndev,
- const struct brcmf_event_msg *e, void *data,
+ const struct brcmf_event_msg *e,
bool completed);
static s32 brcmf_bss_roaming_done(struct brcmf_cfg80211_priv *cfg_priv,
struct net_device *ndev,
- const struct brcmf_event_msg *e, void *data);
+ const struct brcmf_event_msg *e);
static s32 brcmf_notify_mic_status(struct brcmf_cfg80211_priv *cfg_priv,
struct net_device *ndev,
const struct brcmf_event_msg *e, void *data);
@@ -2631,7 +2631,7 @@ brcmf_notify_connect_status(struct brcmf_cfg80211_priv *cfg_priv,
clear_bit(WL_STATUS_CONNECTING, &cfg_priv->status);
set_bit(WL_STATUS_CONNECTED, &cfg_priv->status);
} else
- brcmf_bss_connect_done(cfg_priv, ndev, e, data, true);
+ brcmf_bss_connect_done(cfg_priv, ndev, e, true);
} else if (brcmf_is_linkdown(cfg_priv, e)) {
WL_CONN("Linkdown\n");
if (brcmf_is_ibssmode(cfg_priv)) {
@@ -2640,7 +2640,7 @@ brcmf_notify_connect_status(struct brcmf_cfg80211_priv *cfg_priv,
&cfg_priv->status))
brcmf_link_down(cfg_priv);
} else {
- brcmf_bss_connect_done(cfg_priv, ndev, e, data, false);
+ brcmf_bss_connect_done(cfg_priv, ndev, e, false);
if (test_and_clear_bit(WL_STATUS_CONNECTED,
&cfg_priv->status)) {
cfg80211_disconnected(ndev, 0, NULL, 0,
@@ -2653,7 +2653,7 @@ brcmf_notify_connect_status(struct brcmf_cfg80211_priv *cfg_priv,
if (brcmf_is_ibssmode(cfg_priv))
clear_bit(WL_STATUS_CONNECTING, &cfg_priv->status);
else
- brcmf_bss_connect_done(cfg_priv, ndev, e, data, false);
+ brcmf_bss_connect_done(cfg_priv, ndev, e, false);
}

return err;
@@ -2670,9 +2670,9 @@ brcmf_notify_roaming_status(struct brcmf_cfg80211_priv *cfg_priv,

if (event == BRCMF_E_ROAM && status == BRCMF_E_STATUS_SUCCESS) {
if (test_bit(WL_STATUS_CONNECTED, &cfg_priv->status))
- brcmf_bss_roaming_done(cfg_priv, ndev, e, data);
+ brcmf_bss_roaming_done(cfg_priv, ndev, e);
else
- brcmf_bss_connect_done(cfg_priv, ndev, e, data, true);
+ brcmf_bss_connect_done(cfg_priv, ndev, e, true);
}

return err;
@@ -2883,7 +2883,7 @@ update_bss_info_out:
static s32
brcmf_bss_roaming_done(struct brcmf_cfg80211_priv *cfg_priv,
struct net_device *ndev,
- const struct brcmf_event_msg *e, void *data)
+ const struct brcmf_event_msg *e)
{
struct brcmf_cfg80211_connect_info *conn_info = cfg_to_conn(cfg_priv);
struct wiphy *wiphy = cfg_to_wiphy(cfg_priv);
@@ -2927,7 +2927,7 @@ brcmf_bss_roaming_done(struct brcmf_cfg80211_priv *cfg_priv,
static s32
brcmf_bss_connect_done(struct brcmf_cfg80211_priv *cfg_priv,
struct net_device *ndev, const struct brcmf_event_msg *e,
- void *data, bool completed)
+ bool completed)
{
struct brcmf_cfg80211_connect_info *conn_info = cfg_to_conn(cfg_priv);
s32 err = 0;
@@ -3587,7 +3587,7 @@ brcmf_cfg80211_event(struct net_device *ndev,
u32 event_type = be32_to_cpu(e->event_type);
struct brcmf_cfg80211_priv *cfg_priv = ndev_to_cfg(ndev);

- if (likely(!brcmf_enq_event(cfg_priv, event_type, e, data)))
+ if (likely(!brcmf_enq_event(cfg_priv, event_type, e)))
brcmf_wakeup_event(cfg_priv);
}

@@ -3637,7 +3637,7 @@ static struct brcmf_cfg80211_event_q *brcmf_deq_event(

static s32
brcmf_enq_event(struct brcmf_cfg80211_priv *cfg_priv, u32 event,
- const struct brcmf_event_msg *msg, void *data)
+ const struct brcmf_event_msg *msg)
{
struct brcmf_cfg80211_event_q *e;
s32 err = 0;
--
1.7.4.1



2011-08-12 19:08:41

by Larry Finger

[permalink] [raw]
Subject: Re: [PATCH 01/14] staging: brcm80211: use wait queues instead of semaphores in wl_cfg80211.c

On 08/12/2011 01:59 PM, Franky Lin wrote:
> If you are refering to this line
> >>> + } while ((e = brcmf_deq_event(cfg_priv)));
>
> The extra parentheses are added to fix a compiler warning:
> drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c: In function
> ‘brcmf_event_handler’:
> drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c:3576: warning: suggest
> parentheses around assignment used as truth value

Does checkpatch allow that assignment in the while statement? I would expect it
to want you to

e = brcmf_deq_event(cfg_priv);
} while (e);

Larry

2011-08-12 15:14:47

by Hauke Mehrtens

[permalink] [raw]
Subject: Re: [PATCH 00/14] staging: brcm80211: brcmfmac driver cleanup

On 08/12/2011 04:02 PM, Rafał Miłecki wrote:
> 2011/8/12 Arend van Spriel <[email protected]>:
>> Several cleanup patches to reduce code for the brcmfmac driver and
>> get rid of a remaining checkpatch warning. The driver sources should
>> be clear from checkpatch issue now.
>>
>> This series applies to staging-next and depends on the following patch set:
>
> Are you testing patches on some hardware? Or just compile-testing?
>
> I believe this driver is meant to support BCM4329, which is not PCI(e)
> board. What adapter do you use?
>
> I've heard about Arasan adapter. Have you tried it? Is that something
> reachable from arasan.com?
>

Is there also a softmac version of the BCM4329 available? The wl driver
shipped with the vendor firmware of my BCM4716 device detects one of the
wifi chips as BCM4329. I think it is the one in the BCM4716 and that is
already supported by b43. Or is this a wrong information?

Here is the output of the kernel log:
eth0: Broadcom BCM47XX 10/100/1000 Mbps Ethernet Controller 5.10.144.3
eth1: Broadcom BCM4329 802.11 Wireless Controller 5.10.144.5
PCI: Enabling device 01:01.0 (0000 -> 0002)
eth2: Broadcom BCMa8d8 802.11 Wireless Controller 5.10.144.5

Hauke

2011-08-12 13:35:14

by Arend van Spriel

[permalink] [raw]
Subject: [PATCH 01/14] staging: brcm80211: use wait queues instead of semaphores in wl_cfg80211.c

In wl_cfg80211.c two semaphores were used to trigger a task to process
an event. The wait queues are better suited for that purpose. This also
removes checkpatch warning on sema_init() calls in this source file.

Reviewed-by: Roland Vossen <[email protected]>
Reviewed-by: Franky Lin <[email protected]>
Signed-off-by: Arend van Spriel <[email protected]>
---
drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c | 49 +++++++++++++++-------
drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h | 5 +-
2 files changed, 36 insertions(+), 18 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
index bc1e1a9..833defb 100644
--- a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
+++ b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
@@ -3162,7 +3162,7 @@ static void brcmf_deinit_priv_mem(struct brcmf_cfg80211_priv *cfg_priv)

static s32 brcmf_create_event_handler(struct brcmf_cfg80211_priv *cfg_priv)
{
- sema_init(&cfg_priv->event_sync, 0);
+ init_waitqueue_head(&cfg_priv->event_waitq);
cfg_priv->event_tsk = kthread_run(brcmf_event_handler, cfg_priv,
"wl_event_handler");
if (IS_ERR(cfg_priv->event_tsk)) {
@@ -3224,7 +3224,7 @@ static s32 brcmf_wakeup_iscan(struct brcmf_cfg80211_iscan_ctrl *iscan)
{
if (likely(iscan->state != WL_ISCAN_STATE_IDLE)) {
WL_SCAN("wake up iscan\n");
- up(&iscan->sync);
+ wake_up(&iscan->waitq);
return 0;
}

@@ -3330,13 +3330,19 @@ static s32 brcmf_iscan_thread(void *data)
(struct brcmf_cfg80211_iscan_ctrl *)data;
struct brcmf_cfg80211_priv *cfg_priv = iscan_to_cfg(iscan);
struct brcmf_cfg80211_iscan_eloop *el = &iscan->el;
+ DECLARE_WAITQUEUE(wait, current);
u32 status;
int err = 0;

sched_setscheduler(current, SCHED_FIFO, &param);
allow_signal(SIGTERM);
status = BRCMF_SCAN_RESULTS_PARTIAL;
- while (likely(!down_interruptible(&iscan->sync))) {
+ add_wait_queue(&iscan->waitq, &wait);
+ while (1) {
+ prepare_to_wait(&iscan->waitq, &wait, TASK_INTERRUPTIBLE);
+
+ schedule();
+
if (kthread_should_stop())
break;
if (iscan->timer_on) {
@@ -3353,6 +3359,7 @@ static s32 brcmf_iscan_thread(void *data)
rtnl_unlock();
el->handler[status](cfg_priv);
}
+ finish_wait(&iscan->waitq, &wait);
if (iscan->timer_on) {
del_timer_sync(&iscan->timer);
iscan->timer_on = 0;
@@ -3380,7 +3387,7 @@ static s32 brcmf_invoke_iscan(struct brcmf_cfg80211_priv *cfg_priv)

if (cfg_priv->iscan_on && !iscan->tsk) {
iscan->state = WL_ISCAN_STATE_IDLE;
- sema_init(&iscan->sync, 0);
+ init_waitqueue_head(&iscan->waitq);
iscan->tsk = kthread_run(brcmf_iscan_thread, iscan, "wl_iscan");
if (IS_ERR(iscan->tsk)) {
WL_ERR("Could not create iscan thread\n");
@@ -3528,7 +3535,7 @@ void brcmf_cfg80211_detach(void)

static void brcmf_wakeup_event(struct brcmf_cfg80211_priv *cfg_priv)
{
- up(&cfg_priv->event_sync);
+ wake_up(&cfg_priv->event_waitq);
}

static s32 brcmf_event_handler(void *data)
@@ -3537,27 +3544,39 @@ static s32 brcmf_event_handler(void *data)
(struct brcmf_cfg80211_priv *)data;
struct sched_param param = {.sched_priority = MAX_RT_PRIO - 1 };
struct brcmf_cfg80211_event_q *e;
+ DECLARE_WAITQUEUE(wait, current);

sched_setscheduler(current, SCHED_FIFO, &param);
allow_signal(SIGTERM);
- while (likely(!down_interruptible(&cfg_priv->event_sync))) {
+ add_wait_queue(&cfg_priv->event_waitq, &wait);
+ while (1) {
+ prepare_to_wait(&cfg_priv->event_waitq, &wait,
+ TASK_INTERRUPTIBLE);
+
+ schedule();
+
if (kthread_should_stop())
break;
+
e = brcmf_deq_event(cfg_priv);
if (unlikely(!e)) {
WL_ERR("event queue empty...\n");
- BUG();
+ continue;
}
- WL_INFO("event type (%d)\n", e->etype);
- if (cfg_priv->el.handler[e->etype])
- cfg_priv->el.handler[e->etype](cfg_priv,
- cfg_to_ndev(cfg_priv),
- &e->emsg, e->edata);
- else
- WL_INFO("Unknown Event (%d): ignoring\n", e->etype);

- brcmf_put_event(e);
+ do {
+ WL_INFO("event type (%d)\n", e->etype);
+ if (cfg_priv->el.handler[e->etype])
+ cfg_priv->el.handler[e->etype](cfg_priv,
+ cfg_to_ndev(cfg_priv),
+ &e->emsg, e->edata);
+ else
+ WL_INFO("Unknown Event (%d): ignoring\n",
+ e->etype);
+ brcmf_put_event(e);
+ } while ((e = brcmf_deq_event(cfg_priv)));
}
+ finish_wait(&cfg_priv->event_waitq, &wait);
WL_INFO("was terminated\n");
return 0;
}
diff --git a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h
index ff5c19a..049138b 100644
--- a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h
+++ b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h
@@ -249,7 +249,7 @@ struct brcmf_cfg80211_iscan_ctrl {
u32 timer_on;
s32 state;
struct task_struct *tsk;
- struct semaphore sync;
+ wait_queue_head_t waitq;
struct brcmf_cfg80211_iscan_eloop el;
void *data;
s8 ioctl_buf[BRCMF_C_IOCTL_SMLEN];
@@ -295,13 +295,12 @@ struct brcmf_cfg80211_priv {
cfg80211 layer */
struct brcmf_cfg80211_ie ie; /* information element object for
internal purpose */
- struct semaphore event_sync; /* for synchronization of main event
- thread */
struct brcmf_cfg80211_profile *profile; /* holding dongle profile */
struct brcmf_cfg80211_iscan_ctrl *iscan; /* iscan controller */
struct brcmf_cfg80211_connect_info conn_info; /* association info */
struct brcmf_cfg80211_pmk_list *pmk_list; /* wpa2 pmk list */
struct task_struct *event_tsk; /* task of main event handler thread */
+ wait_queue_head_t event_waitq; /* wait queue for main event handling */
unsigned long status; /* current dongle status */
void *pub;
u32 channel; /* current channel */
--
1.7.4.1



2011-08-12 13:35:12

by Arend van Spriel

[permalink] [raw]
Subject: [PATCH 02/14] staging: brcm80211: remove iovar IOV_BLOCKSIZE in brcmfmac

From: Franky Lin <[email protected]>

Iovar IOV_BLOCKSIZE code is not actually setting the sdio
function's block size. Use cur_blksize provided by mmc core where
necessary.

Reviewed-by: Arend van Spriel <[email protected]>
Signed-off-by: Arend van Spriel <[email protected]>
---
drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c | 52 ---------------------
drivers/staging/brcm80211/brcmfmac/dhd_sdio.c | 31 +------------
drivers/staging/brcm80211/brcmfmac/sdio_host.h | 1 -
3 files changed, 1 insertions(+), 83 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c b/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c
index 1256847..a2fba4f 100644
--- a/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c
+++ b/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c
@@ -169,14 +169,12 @@ struct sdioh_info *brcmf_sdioh_attach(void *bar0)
}

sd->num_funcs = 2;
- sd->client_block_size[0] = 64;

gInstance->sd = sd;

/* Claim host controller */
sdio_claim_host(gInstance->func[1]);

- sd->client_block_size[1] = 64;
err_ret = sdio_set_block_size(gInstance->func[1], 64);
if (err_ret)
BRCMF_ERROR(("%s: Failed to set F1 blocksize\n", __func__));
@@ -188,7 +186,6 @@ struct sdioh_info *brcmf_sdioh_attach(void *bar0)
/* Claim host controller F2 */
sdio_claim_host(gInstance->func[2]);

- sd->client_block_size[2] = sd_f2_blocksize;
err_ret =
sdio_set_block_size(gInstance->func[2], sd_f2_blocksize);
if (err_ret)
@@ -273,7 +270,6 @@ extern int brcmf_sdioh_interrupt_deregister(struct sdioh_info *sd)
/* IOVar table */
enum {
IOV_MSGLEVEL = 1,
- IOV_BLOCKSIZE,
IOV_NUMINTS,
IOV_DEVREG,
IOV_HCIREGS,
@@ -281,8 +277,6 @@ enum {
};

const struct brcmu_iovar sdioh_iovars[] = {
- {"sd_blocksize", IOV_BLOCKSIZE, 0, IOVT_UINT32, 0},/* ((fn << 16) |
- size) */
{"sd_numints", IOV_NUMINTS, 0, IOVT_UINT32, 0},
{"sd_devreg", IOV_DEVREG, 0, IOVT_BUFFER, sizeof(struct brcmf_sdreg)}
,
@@ -346,52 +340,6 @@ brcmf_sdioh_iovar_op(struct sdioh_info *si, const char *name,

actionid = set ? IOV_SVAL(vi->varid) : IOV_GVAL(vi->varid);
switch (actionid) {
- case IOV_GVAL(IOV_BLOCKSIZE):
- if ((u32) int_val > si->num_funcs) {
- bcmerror = -EINVAL;
- break;
- }
- int_val = (s32) si->client_block_size[int_val];
- memcpy(arg, &int_val, val_size);
- break;
-
- case IOV_SVAL(IOV_BLOCKSIZE):
- {
- uint func = ((u32) int_val >> 16);
- uint blksize = (u16) int_val;
- uint maxsize;
-
- if (func > si->num_funcs) {
- bcmerror = -EINVAL;
- break;
- }
-
- switch (func) {
- case 0:
- maxsize = 32;
- break;
- case 1:
- maxsize = 64;
- break;
- case 2:
- maxsize = 512;
- break;
- default:
- maxsize = 0;
- }
- if (blksize > maxsize) {
- bcmerror = -EINVAL;
- break;
- }
- if (!blksize)
- blksize = maxsize;
-
- /* Now set it */
- si->client_block_size[func] = blksize;
-
- break;
- }
-
case IOV_GVAL(IOV_RXCHAIN):
int_val = false;
memcpy(arg, &int_val, val_size);
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c b/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
index 74c9d4e..6e1fe5c 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
+++ b/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
@@ -3168,24 +3168,6 @@ brcmf_sdbrcm_bus_iovar_op(struct brcmf_pub *drvr, const char *name,
bcmerror = brcmf_sdcard_iovar_op(bus->sdiodev, name, params,
plen, arg, len, set);

- /* Similar check for blocksize change */
- if (set && strcmp(name, "sd_blocksize") == 0) {
- s32 fnum = 2;
- if (brcmf_sdcard_iovar_op
- (bus->sdiodev, "sd_blocksize", &fnum, sizeof(s32),
- &bus->blocksize, sizeof(s32),
- false) != 0) {
- bus->blocksize = 0;
- BRCMF_ERROR(("%s: fail on %s get\n", __func__,
- "sd_blocksize"));
- } else {
- BRCMF_INFO(("%s: noted sd_blocksize update,"
- " value now %d\n", __func__,
- bus->blocksize));
- }
- }
- bus->roundup = min(max_roundup, bus->blocksize);
-
if (bus->idletime == BRCMF_IDLE_IMMEDIATE &&
!bus->dpc_sched) {
bus->activity = false;
@@ -5679,8 +5661,6 @@ fail:

static bool brcmf_sdbrcm_probe_init(struct brcmf_bus *bus)
{
- s32 fnum;
-
BRCMF_TRACE(("%s: Enter\n", __func__));

#ifdef SDTEST
@@ -5705,16 +5685,7 @@ static bool brcmf_sdbrcm_probe_init(struct brcmf_bus *bus)
bus->idleclock = BRCMF_IDLE_ACTIVE;

/* Query the F2 block size, set roundup accordingly */
- fnum = 2;
- if (brcmf_sdcard_iovar_op(bus->sdiodev, "sd_blocksize", &fnum,
- sizeof(s32), &bus->blocksize,
- sizeof(s32), false) != 0) {
- bus->blocksize = 0;
- BRCMF_ERROR(("%s: fail on %s get\n", __func__, "sd_blocksize"));
- } else {
- BRCMF_INFO(("%s: Initial value for %s is %d\n",
- __func__, "sd_blocksize", bus->blocksize));
- }
+ bus->blocksize = bus->sdiodev->func2->cur_blksize;
bus->roundup = min(max_roundup, bus->blocksize);

/* Query if bus module supports packet chaining,
diff --git a/drivers/staging/brcm80211/brcmfmac/sdio_host.h b/drivers/staging/brcm80211/brcmfmac/sdio_host.h
index c5a68c0..c61a186 100644
--- a/drivers/staging/brcm80211/brcmfmac/sdio_host.h
+++ b/drivers/staging/brcm80211/brcmfmac/sdio_host.h
@@ -129,7 +129,6 @@ struct sdioh_info {
int intrcount; /* Client interrupts */
bool sd_blockmode; /* sd_blockmode == false => 64 Byte Cmd 53s. */
/* Must be on for sd_multiblock to be effective */
- int client_block_size[SDIOD_MAX_IOFUNCS]; /* Blocksize */
u8 num_funcs; /* Supported funcs on client */
u32 com_cis_ptr;
u32 func_cis_ptr[SDIOD_MAX_IOFUNCS];
--
1.7.4.1



2011-08-12 16:33:03

by Arend van Spriel

[permalink] [raw]
Subject: Re: [PATCH 00/14] staging: brcm80211: brcmfmac driver cleanup

On 08/12/2011 04:02 PM, Rafał Miłecki wrote:
> 2011/8/12 Arend van Spriel<[email protected]>:
>> Several cleanup patches to reduce code for the brcmfmac driver and
>> get rid of a remaining checkpatch warning. The driver sources should
>> be clear from checkpatch issue now.
>>
>> This series applies to staging-next and depends on the following patch set:
> Are you testing patches on some hardware? Or just compile-testing?
>
> I believe this driver is meant to support BCM4329, which is not PCI(e)
> board. What adapter do you use?
>
> I've heard about Arasan adapter. Have you tried it? Is that something
> reachable from arasan.com?

Our brcm80211 source tree under drivers/staging contain two drivers. The
brcmsmac driver currently supporting the PCI(e) cards with bcm43224,
bcm43225, and bcm4313 chips and the brcmfmac driver currently supporting
the SDIO card with bcm4329 chip. brcmsmac is a mac80211 driver and
brcmfmac is a cfg80211 driver.

We indeed use the Arasan adapter and both drivers are running in nightly
test cycle testing our common internal repository. So the drivers are
functionally tested on the x86 platforms (32 and 64 bit). Also looking
at sparc64 and powerpc64 but not in a nightly cycle.

Gr. AvS

--
Almost nobody dances sober, unless they happen to be insane.
-- H.P. Lovecraft --



2011-08-12 14:12:17

by Rafał Miłecki

[permalink] [raw]
Subject: Re: [PATCH 02/14] staging: brcm80211: remove iovar IOV_BLOCKSIZE in brcmfmac

2011/8/12 Arend van Spriel <[email protected]>:
> @@ -273,7 +270,6 @@ extern int brcmf_sdioh_interrupt_deregister(struct sdioh_info *sd)
>  /* IOVar table */
>  enum {
>        IOV_MSGLEVEL = 1,
> -       IOV_BLOCKSIZE,
>        IOV_NUMINTS,
>        IOV_DEVREG,
>        IOV_HCIREGS,

You are forcing IOV_MSGLEVEL to 1, so I expected values of IOV_* are
really important in some piece of code. Now you change them. AFAIU it
means you break something, or you can drop " = 1".

--
Rafał

2011-08-12 13:35:14

by Arend van Spriel

[permalink] [raw]
Subject: [PATCH 11/14] staging: brcm80211: remove wrapper functions in bcmsdh_sdmmc.c

From: Franky Lin <[email protected]>

Use brcmf_sdioh_request_byte directly instead of calling
brcmf_sdioh_cfg_read and brcmf_sdioh_cfg_write in brcmfmac

Reviewed-by: Arend van Spriel <[email protected]>
Reviewed-by: Roland Vossen <[email protected]>
Signed-off-by: Arend van Spriel <[email protected]>
---
drivers/staging/brcm80211/brcmfmac/bcmsdh.c | 18 +++++++---------
drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c | 22 ---------------------
drivers/staging/brcm80211/brcmfmac/sdio_host.h | 5 ----
3 files changed, 8 insertions(+), 37 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmfmac/bcmsdh.c b/drivers/staging/brcm80211/brcmfmac/bcmsdh.c
index 8bb84a9..824208f 100644
--- a/drivers/staging/brcm80211/brcmfmac/bcmsdh.c
+++ b/drivers/staging/brcm80211/brcmfmac/bcmsdh.c
@@ -130,8 +130,8 @@ brcmf_sdcard_iovar_op(struct brcmf_sdio_dev *sdiodev, const char *name,
(struct brcmf_sdreg *) params;
u8 data = 0;

- if (brcmf_sdioh_cfg_read
- (sdiodev, sd_ptr->func, sd_ptr->offset, &data)) {
+ if (brcmf_sdioh_request_byte(sdiodev, SDIOH_READ,
+ sd_ptr->func, sd_ptr->offset, &data)) {
bcmerror = -EIO;
break;
}
@@ -147,8 +147,8 @@ brcmf_sdcard_iovar_op(struct brcmf_sdio_dev *sdiodev, const char *name,
(struct brcmf_sdreg *) params;
u8 data = (u8) sd_ptr->value;

- if (brcmf_sdioh_cfg_write
- (sdiodev, sd_ptr->func, sd_ptr->offset, &data)) {
+ if (brcmf_sdioh_request_byte(sdiodev, SDIOH_WRITE,
+ sd_ptr->func, sd_ptr->offset, &data)) {
bcmerror = -EIO;
break;
}
@@ -209,9 +209,8 @@ u8 brcmf_sdcard_cfg_read(struct brcmf_sdio_dev *sdiodev, uint fnc_num, u32 addr,
do {
if (retry) /* wait for 1 ms till bus get settled down */
udelay(1000);
- status =
- brcmf_sdioh_cfg_read(sdiodev, fnc_num, addr,
- (u8 *) &data);
+ status = brcmf_sdioh_request_byte(sdiodev, SDIOH_READ, fnc_num,
+ addr, (u8 *) &data);
} while (status != 0
&& (retry++ < SDIOH_API_ACCESS_RETRY_LIMIT));
if (err)
@@ -233,9 +232,8 @@ brcmf_sdcard_cfg_write(struct brcmf_sdio_dev *sdiodev, uint fnc_num, u32 addr,
do {
if (retry) /* wait for 1 ms till bus get settled down */
udelay(1000);
- status =
- brcmf_sdioh_cfg_write(sdiodev, fnc_num, addr,
- (u8 *) &data);
+ status = brcmf_sdioh_request_byte(sdiodev, SDIOH_WRITE, fnc_num,
+ addr, (u8 *) &data);
} while (status != 0
&& (retry++ < SDIOH_API_ACCESS_RETRY_LIMIT));
if (err)
diff --git a/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c b/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c
index d7648f8..fca966c 100644
--- a/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c
+++ b/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c
@@ -190,28 +190,6 @@ void brcmf_sdioh_detach(struct brcmf_sdio_dev *sdiodev)

}

-extern int
-brcmf_sdioh_cfg_read(struct brcmf_sdio_dev *sdiodev, uint fnc_num, u32 addr,
- u8 *data)
-{
- int status;
- /* No lock needed since brcmf_sdioh_request_byte does locking */
- status = brcmf_sdioh_request_byte(sdiodev, SDIOH_READ, fnc_num,
- addr, data);
- return status;
-}
-
-extern int
-brcmf_sdioh_cfg_write(struct brcmf_sdio_dev *sdiodev, uint fnc_num, u32 addr,
- u8 *data)
-{
- /* No lock needed since brcmf_sdioh_request_byte does locking */
- int status;
- status = brcmf_sdioh_request_byte(sdiodev, SDIOH_WRITE, fnc_num,
- addr, data);
- return status;
-}
-
static int brcmf_sdioh_get_cisaddr(struct brcmf_sdio_dev *sdiodev, u32 regaddr)
{
/* read 24 bits and return valid 17 bit addr */
diff --git a/drivers/staging/brcm80211/brcmfmac/sdio_host.h b/drivers/staging/brcm80211/brcmfmac/sdio_host.h
index 555f17b..dc588e7 100644
--- a/drivers/staging/brcm80211/brcmfmac/sdio_host.h
+++ b/drivers/staging/brcm80211/brcmfmac/sdio_host.h
@@ -268,11 +268,6 @@ brcmf_sdioh_request_buffer(struct brcmf_sdio_dev *sdiodev, uint pio_dma,
extern int brcmf_sdioh_cis_read(struct brcmf_sdio_dev *sdiodev, uint fuc,
u8 *cis, u32 length);

-extern int brcmf_sdioh_cfg_read(struct brcmf_sdio_dev *sdiodev, uint fuc,
- u32 addr, u8 *data);
-extern int brcmf_sdioh_cfg_write(struct brcmf_sdio_dev *sdiodev, uint fuc,
- u32 addr, u8 *data);
-
/* Watchdog timer interface for pm ops */
extern void brcmf_sdio_wdtmr_enable(struct brcmf_sdio_dev *sdiodev,
bool enable);
--
1.7.4.1



2011-08-12 13:35:12

by Arend van Spriel

[permalink] [raw]
Subject: [PATCH 09/14] staging: brcm80211: absorb brcmf_sdioh_abort into brcmf_sdcard_abort

From: Franky Lin <[email protected]>

brcmfmac wrapper function cleanup

Reviewed-by: Arend van Spriel <[email protected]>
Signed-off-by: Arend van Spriel <[email protected]>
---
drivers/staging/brcm80211/brcmfmac/bcmsdh.c | 11 ++++++++++-
drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c | 14 --------------
drivers/staging/brcm80211/brcmfmac/sdio_host.h | 3 ---
3 files changed, 10 insertions(+), 18 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmfmac/bcmsdh.c b/drivers/staging/brcm80211/brcmfmac/bcmsdh.c
index 6c1b57d..8bb84a9 100644
--- a/drivers/staging/brcm80211/brcmfmac/bcmsdh.c
+++ b/drivers/staging/brcm80211/brcmfmac/bcmsdh.c
@@ -21,6 +21,7 @@
#include <linux/pci_ids.h>
#include <linux/sched.h>
#include <linux/completion.h>
+#include <linux/mmc/sdio.h>
#include <linux/mmc/sdio_func.h>
#include <linux/mmc/card.h>

@@ -476,7 +477,15 @@ int brcmf_sdcard_rwdata(struct brcmf_sdio_dev *sdiodev, uint rw, u32 addr,

int brcmf_sdcard_abort(struct brcmf_sdio_dev *sdiodev, uint fn)
{
- return brcmf_sdioh_abort(sdiodev, fn);
+ char t_func = (char)fn;
+ BRCMF_TRACE(("%s: Enter\n", __func__));
+
+ /* issue abort cmd52 command through F0 */
+ brcmf_sdioh_request_byte(sdiodev, SDIOH_WRITE, SDIO_FUNC_0,
+ SDIO_CCCR_ABORT, &t_func);
+
+ BRCMF_TRACE(("%s: Exit\n", __func__));
+ return 0;
}

u32 brcmf_sdcard_cur_sbwad(struct brcmf_sdio_dev *sdiodev)
diff --git a/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c b/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c
index 1dfad3e..d7648f8 100644
--- a/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c
+++ b/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c
@@ -576,20 +576,6 @@ brcmf_sdioh_request_buffer(struct brcmf_sdio_dev *sdiodev, uint pio_dma,
return Status;
}

-/* this function performs "abort" for both of host & device */
-extern int brcmf_sdioh_abort(struct brcmf_sdio_dev *sdiodev, uint func)
-{
- char t_func = (char)func;
- BRCMF_TRACE(("%s: Enter\n", __func__));
-
- /* issue abort cmd52 command through F0 */
- brcmf_sdioh_request_byte(sdiodev, SDIOH_WRITE, SDIO_FUNC_0,
- SDIO_CCCR_ABORT, &t_func);
-
- BRCMF_TRACE(("%s: Exit\n", __func__));
- return 0;
-}
-
/* Read client card reg */
int
brcmf_sdioh_card_regread(struct brcmf_sdio_dev *sdiodev, int func, u32 regaddr,
diff --git a/drivers/staging/brcm80211/brcmfmac/sdio_host.h b/drivers/staging/brcm80211/brcmfmac/sdio_host.h
index d980307..555f17b 100644
--- a/drivers/staging/brcm80211/brcmfmac/sdio_host.h
+++ b/drivers/staging/brcm80211/brcmfmac/sdio_host.h
@@ -273,9 +273,6 @@ extern int brcmf_sdioh_cfg_read(struct brcmf_sdio_dev *sdiodev, uint fuc,
extern int brcmf_sdioh_cfg_write(struct brcmf_sdio_dev *sdiodev, uint fuc,
u32 addr, u8 *data);

-/* Issue abort to the specified function and clear controller as needed */
-extern int brcmf_sdioh_abort(struct brcmf_sdio_dev *sdiodev, uint fnc);
-
/* Watchdog timer interface for pm ops */
extern void brcmf_sdio_wdtmr_enable(struct brcmf_sdio_dev *sdiodev,
bool enable);
--
1.7.4.1



2011-08-12 13:35:14

by Arend van Spriel

[permalink] [raw]
Subject: [PATCH 06/14] staging: brcm80211: absorb brcmf_sdioh_iovar_op into brcmf_sdcard_iovar_op

From: Franky Lin <[email protected]>

fullmac wrapper function cleanup.

Reviewed-by: Arend van Spriel <[email protected]>
Signed-off-by: Arend van Spriel <[email protected]>
---
drivers/staging/brcm80211/brcmfmac/bcmsdh.c | 112 +++++++++++++++++++-
drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c | 116 ---------------------
drivers/staging/brcm80211/brcmfmac/sdio_host.h | 5 -
3 files changed, 110 insertions(+), 123 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmfmac/bcmsdh.c b/drivers/staging/brcm80211/brcmfmac/bcmsdh.c
index aaf13f4..13b6dbe 100644
--- a/drivers/staging/brcm80211/brcmfmac/bcmsdh.c
+++ b/drivers/staging/brcm80211/brcmfmac/bcmsdh.c
@@ -46,12 +46,120 @@

module_param(sd_f2_blocksize, int, 0);

+/* IOVar table */
+enum {
+ IOV_MSGLEVEL = 1,
+ IOV_DEVREG,
+ IOV_HCIREGS,
+ IOV_RXCHAIN
+};
+
+const struct brcmu_iovar sdioh_iovars[] = {
+ {"sd_devreg", IOV_DEVREG, 0, IOVT_BUFFER, sizeof(struct brcmf_sdreg)}
+ ,
+ {"sd_rxchain", IOV_RXCHAIN, 0, IOVT_BOOL, 0}
+ ,
+ {NULL, 0, 0, 0, 0}
+};
+
int
brcmf_sdcard_iovar_op(struct brcmf_sdio_dev *sdiodev, const char *name,
void *params, int plen, void *arg, int len, bool set)
{
- return brcmf_sdioh_iovar_op(sdiodev, name, params, plen, arg,
- len, set);
+ const struct brcmu_iovar *vi = NULL;
+ int bcmerror = 0;
+ int val_size;
+ s32 int_val = 0;
+ bool bool_val;
+ u32 actionid;
+
+ if (name == NULL || len < 0)
+ return -EINVAL;
+
+ /* Set does not take qualifiers */
+ if (set && (params || plen))
+ return -EINVAL;
+
+ /* Get must have return space;*/
+ if (!set && !(arg && len))
+ return -EINVAL;
+
+ BRCMF_TRACE(("%s: Enter (%s %s)\n", __func__, (set ? "set" : "get"),
+ name));
+
+ vi = brcmu_iovar_lookup(sdioh_iovars, name);
+ if (vi == NULL) {
+ bcmerror = -ENOTSUPP;
+ goto exit;
+ }
+
+ bcmerror = brcmu_iovar_lencheck(vi, arg, len, set);
+ if (bcmerror != 0)
+ goto exit;
+
+ /* Set up params so get and set can share the convenience variables */
+ if (params == NULL) {
+ params = arg;
+ plen = len;
+ }
+
+ if (vi->type == IOVT_VOID)
+ val_size = 0;
+ else if (vi->type == IOVT_BUFFER)
+ val_size = len;
+ else
+ val_size = sizeof(int);
+
+ if (plen >= (int)sizeof(int_val))
+ memcpy(&int_val, params, sizeof(int_val));
+
+ bool_val = (int_val != 0) ? true : false;
+
+ actionid = set ? IOV_SVAL(vi->varid) : IOV_GVAL(vi->varid);
+ switch (actionid) {
+ case IOV_GVAL(IOV_RXCHAIN):
+ int_val = false;
+ memcpy(arg, &int_val, val_size);
+ break;
+
+ case IOV_GVAL(IOV_DEVREG):
+ {
+ struct brcmf_sdreg *sd_ptr =
+ (struct brcmf_sdreg *) params;
+ u8 data = 0;
+
+ if (brcmf_sdioh_cfg_read
+ (sdiodev, sd_ptr->func, sd_ptr->offset, &data)) {
+ bcmerror = -EIO;
+ break;
+ }
+
+ int_val = (int)data;
+ memcpy(arg, &int_val, sizeof(int_val));
+ break;
+ }
+
+ case IOV_SVAL(IOV_DEVREG):
+ {
+ struct brcmf_sdreg *sd_ptr =
+ (struct brcmf_sdreg *) params;
+ u8 data = (u8) sd_ptr->value;
+
+ if (brcmf_sdioh_cfg_write
+ (sdiodev, sd_ptr->func, sd_ptr->offset, &data)) {
+ bcmerror = -EIO;
+ break;
+ }
+ break;
+ }
+
+ default:
+ bcmerror = -ENOTSUPP;
+ break;
+ }
+exit:
+
+ return bcmerror;
}

int brcmf_sdcard_intr_reg(struct brcmf_sdio_dev *sdiodev)
diff --git a/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c b/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c
index 76b3394..1bfeec6 100644
--- a/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c
+++ b/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c
@@ -236,122 +236,6 @@ int brcmf_sdioh_interrupt_deregister(struct brcmf_sdio_dev *sdiodev)
return 0;
}

-/* IOVar table */
-enum {
- IOV_MSGLEVEL = 1,
- IOV_DEVREG,
- IOV_HCIREGS,
- IOV_RXCHAIN
-};
-
-const struct brcmu_iovar sdioh_iovars[] = {
- {"sd_devreg", IOV_DEVREG, 0, IOVT_BUFFER, sizeof(struct brcmf_sdreg)}
- ,
- {"sd_rxchain", IOV_RXCHAIN, 0, IOVT_BOOL, 0}
- ,
- {NULL, 0, 0, 0, 0}
-};
-
-int
-brcmf_sdioh_iovar_op(struct brcmf_sdio_dev *sdiodev, const char *name,
- void *params, int plen, void *arg, int len, bool set)
-{
- const struct brcmu_iovar *vi = NULL;
- int bcmerror = 0;
- int val_size;
- s32 int_val = 0;
- bool bool_val;
- u32 actionid;
-
- if (name == NULL || len < 0)
- return -EINVAL;
-
- /* Set does not take qualifiers */
- if (set && (params || plen))
- return -EINVAL;
-
- /* Get must have return space;*/
- if (!set && !(arg && len))
- return -EINVAL;
-
- BRCMF_TRACE(("%s: Enter (%s %s)\n", __func__, (set ? "set" : "get"),
- name));
-
- vi = brcmu_iovar_lookup(sdioh_iovars, name);
- if (vi == NULL) {
- bcmerror = -ENOTSUPP;
- goto exit;
- }
-
- bcmerror = brcmu_iovar_lencheck(vi, arg, len, set);
- if (bcmerror != 0)
- goto exit;
-
- /* Set up params so get and set can share the convenience variables */
- if (params == NULL) {
- params = arg;
- plen = len;
- }
-
- if (vi->type == IOVT_VOID)
- val_size = 0;
- else if (vi->type == IOVT_BUFFER)
- val_size = len;
- else
- val_size = sizeof(int);
-
- if (plen >= (int)sizeof(int_val))
- memcpy(&int_val, params, sizeof(int_val));
-
- bool_val = (int_val != 0) ? true : false;
-
- actionid = set ? IOV_SVAL(vi->varid) : IOV_GVAL(vi->varid);
- switch (actionid) {
- case IOV_GVAL(IOV_RXCHAIN):
- int_val = false;
- memcpy(arg, &int_val, val_size);
- break;
-
- case IOV_GVAL(IOV_DEVREG):
- {
- struct brcmf_sdreg *sd_ptr =
- (struct brcmf_sdreg *) params;
- u8 data = 0;
-
- if (brcmf_sdioh_cfg_read
- (sdiodev, sd_ptr->func, sd_ptr->offset, &data)) {
- bcmerror = -EIO;
- break;
- }
-
- int_val = (int)data;
- memcpy(arg, &int_val, sizeof(int_val));
- break;
- }
-
- case IOV_SVAL(IOV_DEVREG):
- {
- struct brcmf_sdreg *sd_ptr =
- (struct brcmf_sdreg *) params;
- u8 data = (u8) sd_ptr->value;
-
- if (brcmf_sdioh_cfg_write
- (sdiodev, sd_ptr->func, sd_ptr->offset, &data)) {
- bcmerror = -EIO;
- break;
- }
- break;
- }
-
- default:
- bcmerror = -ENOTSUPP;
- break;
- }
-exit:
-
- return bcmerror;
-}
-
extern int
brcmf_sdioh_cfg_read(struct brcmf_sdio_dev *sdiodev, uint fnc_num, u32 addr,
u8 *data)
diff --git a/drivers/staging/brcm80211/brcmfmac/sdio_host.h b/drivers/staging/brcm80211/brcmfmac/sdio_host.h
index 4296c93..4a814e5 100644
--- a/drivers/staging/brcm80211/brcmfmac/sdio_host.h
+++ b/drivers/staging/brcm80211/brcmfmac/sdio_host.h
@@ -276,11 +276,6 @@ extern int brcmf_sdioh_cfg_read(struct brcmf_sdio_dev *sdiodev, uint fuc,
extern int brcmf_sdioh_cfg_write(struct brcmf_sdio_dev *sdiodev, uint fuc,
u32 addr, u8 *data);

-/* handle iovars */
-extern int brcmf_sdioh_iovar_op(struct brcmf_sdio_dev *sdiodev,
- const char *name, void *params, int plen,
- void *arg, int len, bool set);
-
/* Issue abort to the specified function and clear controller as needed */
extern int brcmf_sdioh_abort(struct brcmf_sdio_dev *sdiodev, uint fnc);

--
1.7.4.1



2011-08-12 13:35:17

by Arend van Spriel

[permalink] [raw]
Subject: [PATCH 12/14] staging: brcm80211: remove unused parameter from data interface in fullmac

From: Franky Lin <[email protected]>

Remove redundant complete function pointer in send/recv buffer interface.

Reviewed-by: Arend van Spriel <[email protected]>
Reviewed-by: Roland Vossen <[email protected]>
Signed-off-by: Arend van Spriel <[email protected]>
---
drivers/staging/brcm80211/brcmfmac/bcmsdh.c | 10 +------
drivers/staging/brcm80211/brcmfmac/dhd_sdio.c | 31 +++++++++--------------
drivers/staging/brcm80211/brcmfmac/sdio_host.h | 10 +------
3 files changed, 16 insertions(+), 35 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmfmac/bcmsdh.c b/drivers/staging/brcm80211/brcmfmac/bcmsdh.c
index 824208f..0c845c9 100644
--- a/drivers/staging/brcm80211/brcmfmac/bcmsdh.c
+++ b/drivers/staging/brcm80211/brcmfmac/bcmsdh.c
@@ -385,10 +385,7 @@ bool brcmf_sdcard_regfail(struct brcmf_sdio_dev *sdiodev)
int
brcmf_sdcard_recv_buf(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn,
uint flags,
- u8 *buf, uint nbytes, struct sk_buff *pkt,
- void (*complete)(void *handle, int status,
- bool sync_waiting),
- void *handle)
+ u8 *buf, uint nbytes, struct sk_buff *pkt)
{
int status;
uint incr_fix;
@@ -426,10 +423,7 @@ brcmf_sdcard_recv_buf(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn,

int
brcmf_sdcard_send_buf(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn,
- uint flags, u8 *buf, uint nbytes, void *pkt,
- void (*complete)(void *handle, int status,
- bool sync_waiting),
- void *handle)
+ uint flags, u8 *buf, uint nbytes, struct sk_buff *pkt)
{
uint incr_fix;
uint width;
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c b/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
index 1d487db..60e7a814 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
+++ b/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
@@ -941,10 +941,7 @@ static uint brcmf_process_nvram_vars(char *varbuf, uint len);
static void brcmf_sdbrcm_setmemsize(struct brcmf_bus *bus, int mem_size);
static int brcmf_sdbrcm_send_buf(struct brcmf_bus *bus, u32 addr, uint fn,
uint flags, u8 *buf, uint nbytes,
- struct sk_buff *pkt,
- void (*complete)(void *handle, int status,
- bool sync_waiting),
- void *handle);
+ struct sk_buff *pkt);

static bool brcmf_sdbrcm_download_firmware(struct brcmf_bus *bus, void *card);
static int _brcmf_sdbrcm_download_firmware(struct brcmf_bus *bus);
@@ -1413,7 +1410,7 @@ static int brcmf_sdbrcm_txpkt(struct brcmf_bus *bus, struct sk_buff *pkt,
do {
ret = brcmf_sdbrcm_send_buf(bus,
brcmf_sdcard_cur_sbwad(bus->sdiodev),
- SDIO_FUNC_2, F2SYNC, frame, len, pkt, NULL, NULL);
+ SDIO_FUNC_2, F2SYNC, frame, len, pkt);
bus->f2txdata++;

if (ret < 0) {
@@ -1731,7 +1728,7 @@ brcmf_sdbrcm_bus_txctl(struct brcmf_bus *bus, unsigned char *msg, uint msglen)
ret = brcmf_sdbrcm_send_buf(bus,
brcmf_sdcard_cur_sbwad(bus->sdiodev),
SDIO_FUNC_2,
- F2SYNC, frame, len, NULL, NULL, NULL);
+ F2SYNC, frame, len, NULL);

if (ret < 0) {
/* On failure, abort the command and
@@ -3493,7 +3490,7 @@ brcmf_sdbrcm_read_control(struct brcmf_bus *bus, u8 *hdr, uint len, uint doff)
brcmf_sdcard_cur_sbwad(bus->sdiodev),
SDIO_FUNC_2,
F2SYNC, (bus->rxctl + firstread), rdlen,
- NULL, NULL, NULL);
+ NULL);
bus->f2rxdata++;

/* Control frame failures need retransmission */
@@ -3657,13 +3654,13 @@ static u8 brcmf_sdbrcm_rxglom(struct brcmf_bus *bus, u8 rxseq)
brcmf_sdcard_cur_sbwad(bus->sdiodev),
SDIO_FUNC_2,
F2SYNC, (u8 *) pfirst->data, dlen,
- pfirst, NULL, NULL);
+ pfirst);
} else if (bus->dataptr) {
errcode = brcmf_sdcard_recv_buf(bus->sdiodev,
brcmf_sdcard_cur_sbwad(bus->sdiodev),
SDIO_FUNC_2,
F2SYNC, bus->dataptr, dlen,
- NULL, NULL, NULL);
+ NULL);
sublen = (u16) brcmu_pktfrombuf(pfirst, 0, dlen,
bus->dataptr);
if (sublen != dlen) {
@@ -4032,7 +4029,7 @@ brcmf_sdbrcm_readframes(struct brcmf_bus *bus, uint maxframes, bool *finished)
bus->sdiodev),
SDIO_FUNC_2, F2SYNC,
rxbuf, rdlen,
- pkt, NULL, NULL);
+ pkt);
bus->f2rxdata++;

if (sdret < 0) {
@@ -4195,7 +4192,7 @@ brcmf_sdbrcm_readframes(struct brcmf_bus *bus, uint maxframes, bool *finished)
sdret = brcmf_sdcard_recv_buf(bus->sdiodev,
brcmf_sdcard_cur_sbwad(bus->sdiodev),
SDIO_FUNC_2, F2SYNC, bus->rxhdr, firstread,
- NULL, NULL, NULL);
+ NULL);
bus->f2rxhdrs++;

if (sdret < 0) {
@@ -4352,7 +4349,7 @@ brcmf_sdbrcm_readframes(struct brcmf_bus *bus, uint maxframes, bool *finished)
sdret = brcmf_sdcard_recv_buf(bus->sdiodev,
brcmf_sdcard_cur_sbwad(bus->sdiodev),
SDIO_FUNC_2, F2SYNC, ((u8 *) (pkt->data)),
- rdlen, pkt, NULL, NULL);
+ rdlen, pkt);
bus->f2rxdata++;

if (sdret < 0) {
@@ -4689,7 +4686,7 @@ clkwait:
ret = brcmf_sdbrcm_send_buf(bus,
brcmf_sdcard_cur_sbwad(bus->sdiodev),
SDIO_FUNC_2, F2SYNC, (u8 *) bus->ctrl_frame_buf,
- (u32) bus->ctrl_frame_len, NULL, NULL, NULL);
+ (u32) bus->ctrl_frame_len, NULL);

if (ret < 0) {
/* On failure, abort the command and
@@ -5885,14 +5882,10 @@ err:

static int
brcmf_sdbrcm_send_buf(struct brcmf_bus *bus, u32 addr, uint fn, uint flags,
- u8 *buf, uint nbytes, struct sk_buff *pkt,
- void (*complete)(void *handle, int status,
- bool sync_waiting),
- void *handle)
+ u8 *buf, uint nbytes, struct sk_buff *pkt)
{
return brcmf_sdcard_send_buf
- (bus->sdiodev, addr, fn, flags, buf, nbytes, pkt, complete,
- handle);
+ (bus->sdiodev, addr, fn, flags, buf, nbytes, pkt);
}

int brcmf_bus_devreset(struct brcmf_pub *drvr, u8 flag)
diff --git a/drivers/staging/brcm80211/brcmfmac/sdio_host.h b/drivers/staging/brcm80211/brcmfmac/sdio_host.h
index dc588e7..03ae16a 100644
--- a/drivers/staging/brcm80211/brcmfmac/sdio_host.h
+++ b/drivers/staging/brcm80211/brcmfmac/sdio_host.h
@@ -188,16 +188,10 @@ extern bool brcmf_sdcard_regfail(struct brcmf_sdio_dev *sdiodev);
*/
extern int
brcmf_sdcard_send_buf(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn,
- uint flags, u8 *buf, uint nbytes, void *pkt,
- void (*complete)(void *handle, int status,
- bool sync_waiting),
- void *handle);
+ uint flags, u8 *buf, uint nbytes, struct sk_buff *pkt);
extern int
brcmf_sdcard_recv_buf(struct brcmf_sdio_dev *sdiodev, u32 addr, uint fn,
- uint flags, u8 *buf, uint nbytes, struct sk_buff *pkt,
- void (*complete)(void *handle, int status,
- bool sync_waiting),
- void *handle);
+ uint flags, u8 *buf, uint nbytes, struct sk_buff *pkt);

/* Flags bits */

--
1.7.4.1



2011-08-12 18:55:39

by Arend van Spriel

[permalink] [raw]
Subject: Re: [PATCH 01/14] staging: brcm80211: use wait queues instead of semaphores in wl_cfg80211.c

On 08/12/2011 06:44 PM, Arend van Spriel wrote:
> On 08/12/2011 04:07 PM, Rafał Miłecki wrote:
>> 2011/8/12 Arend van Spriel<[email protected]>:
>>> @@ -3537,27 +3544,39 @@ static s32 brcmf_event_handler(void *data)
>>> (struct brcmf_cfg80211_priv *)data;
>>> struct sched_param param = {.sched_priority = MAX_RT_PRIO - 1 };
>>> struct brcmf_cfg80211_event_q *e;
>>> + DECLARE_WAITQUEUE(wait, current);
>>>
>>> sched_setscheduler(current, SCHED_FIFO,&param);
>>> allow_signal(SIGTERM);
>>> - while (likely(!down_interruptible(&cfg_priv->event_sync))) {
>>> + add_wait_queue(&cfg_priv->event_waitq,&wait);
>>> + while (1) {
>>> + prepare_to_wait(&cfg_priv->event_waitq,&wait,
>>> + TASK_INTERRUPTIBLE);
>>> +
>>> + schedule();
>>> +
>>> if (kthread_should_stop())
>>> break;
>>> +
>>> e = brcmf_deq_event(cfg_priv);
>>> if (unlikely(!e)) {
>>> WL_ERR("event queue empty...\n");
>>> - BUG();
>>> + continue;
>>> }
>>> - WL_INFO("event type (%d)\n", e->etype);
>>> - if (cfg_priv->el.handler[e->etype])
>>> - cfg_priv->el.handler[e->etype](cfg_priv,
>>> - cfg_to_ndev(cfg_priv),
>>> -&e->emsg, e->edata);
>>> - else
>>> - WL_INFO("Unknown Event (%d): ignoring\n", e->etype);
>>>
>>> - brcmf_put_event(e);
>>> + do {
>>> + WL_INFO("event type (%d)\n", e->etype);
>>> + if (cfg_priv->el.handler[e->etype])
>>> + cfg_priv->el.handler[e->etype](cfg_priv,
>>> + cfg_to_ndev(cfg_priv),
>>> +&e->emsg, e->edata);
>>> + else
>>> + WL_INFO("Unknown Event (%d): ignoring\n",
>>> + e->etype);
>>> + brcmf_put_event(e);
>>> + } while ((e = brcmf_deq_event(cfg_priv)));
>> if (((((care_coding_style)))))
>> fix();
>>
>> :-)
>>
> I assume you refer to the indents above. Not sure what exactly happened
> there, but the patch email as I received it looks. Could it be a mail
> reader issue?
>
> Gr. AvS

A colleague pointed out you probably meant the while condition. The
extra braces may be there because an assignment is done, but in this
case it does not make much sense.

I will fix it.

Gr. AvS

--
Almost nobody dances sober, unless they happen to be insane.
-- H.P. Lovecraft --



2011-08-26 17:39:02

by Jason

[permalink] [raw]
Subject: Re: [PATCH 00/14] staging: brcm80211: brcmfmac driver cleanup

On Fri, Aug 26, 2011 at 10:31:59AM -0700, Henry Ptasinski wrote:
> A possibly better approach would be a device with a BCM4329 on the
> motherboard (e.g. table, phone, etc) that can run a relatively stock
> linux kernel. However, I don't know of a specific platform at the
> moment to recommend.

Nexus One phone?

hth,

Jason.

2011-08-12 19:05:50

by Arend van Spriel

[permalink] [raw]
Subject: [PATCHv2 01/14] staging: brcm80211: use wait queues instead of semaphores in wl_cfg80211.c

In wl_cfg80211.c two semaphores were used to trigger a task to process
an event. The wait queues are better suited for that purpose. This also
removes checkpatch warning on sema_init() calls in this source file.

Reviewed-by: Rafal Milecki <[email protected]>
Reviewed-by: Roland Vossen <[email protected]>
Reviewed-by: Franky Lin <[email protected]>
Signed-off-by: Arend van Spriel <[email protected]>
---
Hi Greg,

This patch replaces the original submitted [01/14] patch identified by:

Message-ID: <[email protected]>

Gr. AvS
---
drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c | 49 +++++++++++++++-------
drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h | 5 +-
2 files changed, 36 insertions(+), 18 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
index bc1e1a9..833defb 100644
--- a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
+++ b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
@@ -3162,7 +3162,7 @@ static void brcmf_deinit_priv_mem(struct brcmf_cfg80211_priv *cfg_priv)

static s32 brcmf_create_event_handler(struct brcmf_cfg80211_priv *cfg_priv)
{
- sema_init(&cfg_priv->event_sync, 0);
+ init_waitqueue_head(&cfg_priv->event_waitq);
cfg_priv->event_tsk = kthread_run(brcmf_event_handler, cfg_priv,
"wl_event_handler");
if (IS_ERR(cfg_priv->event_tsk)) {
@@ -3224,7 +3224,7 @@ static s32 brcmf_wakeup_iscan(struct brcmf_cfg80211_iscan_ctrl *iscan)
{
if (likely(iscan->state != WL_ISCAN_STATE_IDLE)) {
WL_SCAN("wake up iscan\n");
- up(&iscan->sync);
+ wake_up(&iscan->waitq);
return 0;
}

@@ -3330,13 +3330,19 @@ static s32 brcmf_iscan_thread(void *data)
(struct brcmf_cfg80211_iscan_ctrl *)data;
struct brcmf_cfg80211_priv *cfg_priv = iscan_to_cfg(iscan);
struct brcmf_cfg80211_iscan_eloop *el = &iscan->el;
+ DECLARE_WAITQUEUE(wait, current);
u32 status;
int err = 0;

sched_setscheduler(current, SCHED_FIFO, &param);
allow_signal(SIGTERM);
status = BRCMF_SCAN_RESULTS_PARTIAL;
- while (likely(!down_interruptible(&iscan->sync))) {
+ add_wait_queue(&iscan->waitq, &wait);
+ while (1) {
+ prepare_to_wait(&iscan->waitq, &wait, TASK_INTERRUPTIBLE);
+
+ schedule();
+
if (kthread_should_stop())
break;
if (iscan->timer_on) {
@@ -3353,6 +3359,7 @@ static s32 brcmf_iscan_thread(void *data)
rtnl_unlock();
el->handler[status](cfg_priv);
}
+ finish_wait(&iscan->waitq, &wait);
if (iscan->timer_on) {
del_timer_sync(&iscan->timer);
iscan->timer_on = 0;
@@ -3380,7 +3387,7 @@ static s32 brcmf_invoke_iscan(struct brcmf_cfg80211_priv *cfg_priv)

if (cfg_priv->iscan_on && !iscan->tsk) {
iscan->state = WL_ISCAN_STATE_IDLE;
- sema_init(&iscan->sync, 0);
+ init_waitqueue_head(&iscan->waitq);
iscan->tsk = kthread_run(brcmf_iscan_thread, iscan, "wl_iscan");
if (IS_ERR(iscan->tsk)) {
WL_ERR("Could not create iscan thread\n");
@@ -3528,7 +3535,7 @@ void brcmf_cfg80211_detach(void)

static void brcmf_wakeup_event(struct brcmf_cfg80211_priv *cfg_priv)
{
- up(&cfg_priv->event_sync);
+ wake_up(&cfg_priv->event_waitq);
}

static s32 brcmf_event_handler(void *data)
@@ -3537,27 +3544,40 @@ static s32 brcmf_event_handler(void *data)
(struct brcmf_cfg80211_priv *)data;
struct sched_param param = {.sched_priority = MAX_RT_PRIO - 1 };
struct brcmf_cfg80211_event_q *e;
+ DECLARE_WAITQUEUE(wait, current);

sched_setscheduler(current, SCHED_FIFO, &param);
allow_signal(SIGTERM);
- while (likely(!down_interruptible(&cfg_priv->event_sync))) {
+ add_wait_queue(&cfg_priv->event_waitq, &wait);
+ while (1) {
+ prepare_to_wait(&cfg_priv->event_waitq, &wait,
+ TASK_INTERRUPTIBLE);
+
+ schedule();
+
if (kthread_should_stop())
break;
+
e = brcmf_deq_event(cfg_priv);
if (unlikely(!e)) {
WL_ERR("event queue empty...\n");
- BUG();
+ continue;
}
- WL_INFO("event type (%d)\n", e->etype);
- if (cfg_priv->el.handler[e->etype])
- cfg_priv->el.handler[e->etype](cfg_priv,
- cfg_to_ndev(cfg_priv),
- &e->emsg, e->edata);
- else
- WL_INFO("Unknown Event (%d): ignoring\n", e->etype);

- brcmf_put_event(e);
+ do {
+ WL_INFO("event type (%d)\n", e->etype);
+ if (cfg_priv->el.handler[e->etype])
+ cfg_priv->el.handler[e->etype](cfg_priv,
+ cfg_to_ndev(cfg_priv),
+ &e->emsg, e->edata);
+ else
+ WL_INFO("Unknown Event (%d): ignoring\n",
+ e->etype);
+ brcmf_put_event(e);
+ e = brcmf_deq_event(cfg_priv);
+ } while (e != NULL);
}
+ finish_wait(&cfg_priv->event_waitq, &wait);
WL_INFO("was terminated\n");
return 0;
}
diff --git a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h
index ff5c19a..049138b 100644
--- a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h
+++ b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h
@@ -249,7 +249,7 @@ struct brcmf_cfg80211_iscan_ctrl {
u32 timer_on;
s32 state;
struct task_struct *tsk;
- struct semaphore sync;
+ wait_queue_head_t waitq;
struct brcmf_cfg80211_iscan_eloop el;
void *data;
s8 ioctl_buf[BRCMF_C_IOCTL_SMLEN];
@@ -295,13 +295,12 @@ struct brcmf_cfg80211_priv {
cfg80211 layer */
struct brcmf_cfg80211_ie ie; /* information element object for
internal purpose */
- struct semaphore event_sync; /* for synchronization of main event
- thread */
struct brcmf_cfg80211_profile *profile; /* holding dongle profile */
struct brcmf_cfg80211_iscan_ctrl *iscan; /* iscan controller */
struct brcmf_cfg80211_connect_info conn_info; /* association info */
struct brcmf_cfg80211_pmk_list *pmk_list; /* wpa2 pmk list */
struct task_struct *event_tsk; /* task of main event handler thread */
+ wait_queue_head_t event_waitq; /* wait queue for main event handling */
unsigned long status; /* current dongle status */
void *pub;
u32 channel; /* current channel */
--
1.7.4.1



2011-08-23 20:08:28

by Greg KH

[permalink] [raw]
Subject: Re: [PATCH 00/14] staging: brcm80211: brcmfmac driver cleanup

On Fri, Aug 12, 2011 at 03:34:47PM +0200, Arend van Spriel wrote:
> Several cleanup patches to reduce code for the brcmfmac driver and
> get rid of a remaining checkpatch warning. The driver sources should
> be clear from checkpatch issue now.
>
> This series applies to staging-next and depends on the following patch set:
>
> Message-ID: <[email protected]>

All now applied, thanks.

greg k-h

2011-08-12 13:35:13

by Arend van Spriel

[permalink] [raw]
Subject: [PATCH 10/14] staging: brcm80211: remove dead code from dhd_sdio.c

From: Franky Lin <[email protected]>

Code cleanup for brcmfmac

Reviewed-by: Arend van Spriel <[email protected]>
Reviewed-by: Roland Vossen <[email protected]>
Signed-off-by: Arend van Spriel <[email protected]>
---
drivers/staging/brcm80211/brcmfmac/dhd_sdio.c | 222 +++++-------------------
1 files changed, 47 insertions(+), 175 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c b/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
index 85ce5d9..1d487db 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
+++ b/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
@@ -38,28 +38,6 @@
#ifdef BCMDBG

/* ARM trap handling */
-
-/* Trap types defined by ARM (see arminc.h) */
-
-#if defined(__ARM_ARCH_4T__)
-#define MAX_TRAP_TYPE (TR_FIQ + 1)
-#elif defined(__ARM_ARCH_7M__)
-#define MAX_TRAP_TYPE (TR_ISR + ARMCM3_NUMINTS)
-#endif /* __ARM_ARCH_7M__ */
-
-/* The trap structure is defined here as offsets for assembly */
-#define TR_TYPE 0x00
-#define TR_EPC 0x04
-#define TR_CPSR 0x08
-#define TR_SPSR 0x0c
-#define TR_REGS 0x10
-#define TR_REG(n) (TR_REGS + (n) * 4)
-#define TR_SP TR_REG(13)
-#define TR_LR TR_REG(14)
-#define TR_PC TR_REG(15)
-
-#define TRAP_T_SIZE 80
-
struct brcmf_trap {
u32 type;
u32 epc;
@@ -620,7 +598,6 @@ struct brcmf_bus {
u32 ramsize; /* Size of RAM in SOCRAM (bytes) */
u32 orig_ramsize; /* Size of RAM in SOCRAM (bytes) */

- u32 bus; /* gSPI or SDIO bus */
u32 hostintmask; /* Copy of Host Interrupt Mask */
u32 intstatus; /* Intstatus bits (events) pending */
bool dpc_sched; /* Indicates DPC schedule (intrpt rcvd) */
@@ -801,8 +778,6 @@ struct sbconfig {
#define CLK_PENDING 2 /* Not used yet */
#define CLK_AVAIL 3

-#define BRCMF_NOPMU(brcmf) (false)
-
#ifdef BCMDBG
static int qcount[NUMPRIO];
static int tx_packets[NUMPRIO];
@@ -862,12 +837,9 @@ module_param(brcmf_dongle_memsize, int, 0);

static bool brcmf_alignctl;

-static bool sd1idle;
-
static bool retrydata;
#define RETRYCHAN(chan) (((chan) == SDPCM_EVENT_CHANNEL) || retrydata)

-static const uint watermark = 8;
static const uint firstread = BRCMF_FIRSTREAD;

/* Retry count for register access failures */
@@ -939,8 +911,6 @@ w_sdreg32(struct brcmf_bus *bus, u32 regval, u32 reg_offset, u32 *retryvar)
}
}

-#define BRCMF_BUS SDIO_BUS
-
#define PKT_AVAILABLE() (intstatus & I_HMB_FRAME_IND)

#define HOSTINTMASK (I_HMB_SW_MASK | I_CHIPACTIVE)
@@ -1012,7 +982,7 @@ static int brcmf_sdbrcm_ioctl_resp_wake(struct brcmf_bus *bus);
*/
static void brcmf_sdbrcm_pktfree2(struct brcmf_bus *bus, struct sk_buff *pkt)
{
- if ((bus->bus != SPI_BUS) || bus->usebufpool)
+ if (bus->usebufpool)
brcmu_pkt_buf_free_skb(pkt);
}

@@ -1890,18 +1860,15 @@ enum {
IOV_ALIGNCTL,
IOV_SDALIGN,
IOV_DEVRESET,
- IOV_CPU,
#ifdef SDTEST
IOV_PKTGEN,
IOV_EXTLOOP,
#endif /* SDTEST */
- IOV_SPROM,
IOV_TXBOUND,
IOV_RXBOUND,
IOV_TXMINMAX,
IOV_IDLETIME,
IOV_IDLECLOCK,
- IOV_SD1IDLE,
IOV_SLEEP,
IOV_WDTICK,
IOV_IOCTLTIMEOUT,
@@ -1914,7 +1881,6 @@ const struct brcmu_iovar brcmf_sdio_iovars[] = {
{"pollrate", IOV_POLLRATE, 0, IOVT_UINT32, 0},
{"idletime", IOV_IDLETIME, 0, IOVT_INT32, 0},
{"idleclock", IOV_IDLECLOCK, 0, IOVT_INT32, 0},
- {"sd1idle", IOV_SD1IDLE, 0, IOVT_BOOL, 0},
{"membytes", IOV_MEMBYTES, 0, IOVT_BUFFER, 2 * sizeof(int)},
{"memsize", IOV_MEMSIZE, 0, IOVT_UINT32, 0},
{"download", IOV_DOWNLOAD, 0, IOVT_BOOL, 0},
@@ -1946,8 +1912,6 @@ const struct brcmu_iovar brcmf_sdio_iovars[] = {
,
{"txminmax", IOV_TXMINMAX, 0, IOVT_UINT32, 0}
,
- {"cpu", IOV_CPU, 0, IOVT_BOOL, 0}
- ,
{"checkdied", IOV_CHECKDIED, 0, IOVT_BUFFER, 0}
,
#endif /* BCMDBG */
@@ -2636,15 +2600,6 @@ static int brcmf_sdbrcm_doiovar(struct brcmf_bus *bus,
bus->idleclock = int_val;
break;

- case IOV_GVAL(IOV_SD1IDLE):
- int_val = (s32) sd1idle;
- memcpy(arg, &int_val, val_size);
- break;
-
- case IOV_SVAL(IOV_SD1IDLE):
- sd1idle = bool_val;
- break;
-
case IOV_SVAL(IOV_MEMBYTES):
case IOV_GVAL(IOV_MEMBYTES):
{
@@ -3370,7 +3325,7 @@ int brcmf_sdbrcm_bus_init(struct brcmf_pub *drvr, bool enforce_mutex)
offsetof(struct sdpcmd_regs, hostintmask), &retries);

brcmf_sdcard_cfg_write(bus->sdiodev, SDIO_FUNC_1,
- SBSDIO_WATERMARK, (u8) watermark, &err);
+ SBSDIO_WATERMARK, 8, &err);

/* Set bus state according to enable result */
drvr->busstate = BRCMF_BUS_DATA;
@@ -3484,10 +3439,6 @@ brcmf_sdbrcm_read_control(struct brcmf_bus *bus, u8 *hdr, uint len, uint doff)

BRCMF_TRACE(("%s: Enter\n", __func__));

- /* Control data already received in aligned rxctl */
- if ((bus->bus == SPI_BUS) && (!bus->usebufpool))
- goto gotpkt;
-
/* Set rxctl for frame (w/optional alignment) */
bus->rxctl = bus->rxbuf;
if (brcmf_alignctl) {
@@ -3503,12 +3454,6 @@ brcmf_sdbrcm_read_control(struct brcmf_bus *bus, u8 *hdr, uint len, uint doff)
if (len <= firstread)
goto gotpkt;

- /* Copy the full data pkt in gSPI case and process ioctl. */
- if (bus->bus == SPI_BUS) {
- memcpy(bus->rxctl, hdr, len);
- goto gotpkt;
- }
-
/* Raise rdlen to next SDIO block to avoid tail command */
rdlen = len - firstread;
if (bus->roundup && bus->blocksize && (rdlen > bus->blocksize)) {
@@ -4039,26 +3984,22 @@ brcmf_sdbrcm_readframes(struct brcmf_bus *bus, uint maxframes, bool *finished)
u16 nextlen = bus->nextlen;
bus->nextlen = 0;

- if (bus->bus == SPI_BUS) {
- rdlen = len = nextlen;
- } else {
- rdlen = len = nextlen << 4;
-
- /* Pad read to blocksize for efficiency */
- if (bus->roundup && bus->blocksize
- && (rdlen > bus->blocksize)) {
- pad =
- bus->blocksize -
- (rdlen % bus->blocksize);
- if ((pad <= bus->roundup)
- && (pad < bus->blocksize)
- && ((rdlen + pad + firstread) <
- MAX_RX_DATASZ))
- rdlen += pad;
- } else if (rdlen % BRCMF_SDALIGN) {
- rdlen += BRCMF_SDALIGN -
- (rdlen % BRCMF_SDALIGN);
- }
+ rdlen = len = nextlen << 4;
+
+ /* Pad read to blocksize for efficiency */
+ if (bus->roundup && bus->blocksize
+ && (rdlen > bus->blocksize)) {
+ pad =
+ bus->blocksize -
+ (rdlen % bus->blocksize);
+ if ((pad <= bus->roundup)
+ && (pad < bus->blocksize)
+ && ((rdlen + pad + firstread) <
+ MAX_RX_DATASZ))
+ rdlen += pad;
+ } else if (rdlen % BRCMF_SDALIGN) {
+ rdlen += BRCMF_SDALIGN -
+ (rdlen % BRCMF_SDALIGN);
}

/* We use bus->rxctl buffer in WinXP for initial
@@ -4074,60 +4015,15 @@ brcmf_sdbrcm_readframes(struct brcmf_bus *bus, uint maxframes, bool *finished)
/* Allocate a packet buffer */
pkt = brcmu_pkt_buf_get_skb(rdlen + BRCMF_SDALIGN);
if (!pkt) {
- if (bus->bus == SPI_BUS) {
- bus->usebufpool = false;
- bus->rxctl = bus->rxbuf;
- if (brcmf_alignctl) {
- bus->rxctl += firstread;
- pad = ((unsigned long)bus->rxctl
- % BRCMF_SDALIGN);
- if (pad)
- bus->rxctl +=
- (BRCMF_SDALIGN - pad);
- bus->rxctl -= firstread;
- }
- rxbuf = bus->rxctl;
- /* Read the entire frame */
- sdret = brcmf_sdcard_recv_buf(
- bus->sdiodev,
- brcmf_sdcard_cur_sbwad(
- bus->sdiodev),
- SDIO_FUNC_2, F2SYNC,
- rxbuf, rdlen,
- NULL, NULL, NULL);
- bus->f2rxdata++;
-
- /* Control frame failures need
- retransmission */
- if (sdret < 0) {
- BRCMF_ERROR(("%s: read %d "
- "control bytes "
- "failed: %d\n",
- __func__,
- rdlen, sdret));
- /* dhd.rx_ctlerrs is higher */
- bus->rxc_errors++;
- brcmf_sdbrcm_rxfail(bus, true,
- (bus->bus ==
- SPI_BUS) ? false
- : true);
- continue;
- }
- } else {
- /* Give up on data,
- request rtx of events */
- BRCMF_ERROR(("%s (nextlen): "
- "brcmu_pkt_buf_get_skb "
- "failed:"
- " len %d rdlen %d expected"
- " rxseq %d\n", __func__,
- len, rdlen, rxseq));
- continue;
- }
+ /* Give up on data, request rtx of events */
+ BRCMF_ERROR(("%s (nextlen): "
+ "brcmu_pkt_buf_get_skb "
+ "failed:"
+ " len %d rdlen %d expected"
+ " rxseq %d\n", __func__,
+ len, rdlen, rxseq));
+ continue;
} else {
- if (bus->bus == SPI_BUS)
- bus->usebufpool = true;
-
PKTALIGN(pkt, rdlen, BRCMF_SDALIGN);
rxbuf = (u8 *) (pkt->data);
/* Read the entire frame */
@@ -4149,10 +4045,7 @@ brcmf_sdbrcm_readframes(struct brcmf_bus *bus, uint maxframes, bool *finished)
* Don't attempt NAK for
* gSPI
*/
- brcmf_sdbrcm_rxfail(bus, true,
- (bus->bus ==
- SPI_BUS) ? false :
- true);
+ brcmf_sdbrcm_rxfail(bus, true, true);
continue;
}
}
@@ -4202,8 +4095,7 @@ brcmf_sdbrcm_readframes(struct brcmf_bus *bus, uint maxframes, bool *finished)
"expected rxseq %d\n",
__func__, nextlen,
len, roundup(len, 16), rxseq));
- brcmf_sdbrcm_rxfail(bus, true,
- bus->bus != SPI_BUS);
+ brcmf_sdbrcm_rxfail(bus, true, true);
brcmf_sdbrcm_pktfree2(bus, pkt);
continue;
}
@@ -4275,29 +4167,16 @@ brcmf_sdbrcm_readframes(struct brcmf_bus *bus, uint maxframes, bool *finished)
#endif

if (chan == SDPCM_CONTROL_CHANNEL) {
- if (bus->bus == SPI_BUS) {
- brcmf_sdbrcm_read_control(bus, rxbuf,
- len, doff);
- } else {
- BRCMF_ERROR(("%s (nextlen): readahead"
- " on control packet %d?\n",
- __func__, seq));
- /* Force retry w/normal header read */
- bus->nextlen = 0;
- brcmf_sdbrcm_rxfail(bus, false, true);
- }
+ BRCMF_ERROR(("%s (nextlen): readahead"
+ " on control packet %d?\n",
+ __func__, seq));
+ /* Force retry w/normal header read */
+ bus->nextlen = 0;
+ brcmf_sdbrcm_rxfail(bus, false, true);
brcmf_sdbrcm_pktfree2(bus, pkt);
continue;
}

- if ((bus->bus == SPI_BUS) && !bus->usebufpool) {
- BRCMF_ERROR(("Received %d bytes on %d channel."
- " Running out of " "rx pktbuf's or"
- " not yet malloced.\n",
- len, chan));
- continue;
- }
-
/* Validate data offset */
if ((doff < SDPCM_HDRLEN) || (doff > len)) {
BRCMF_ERROR(("%s (nextlen): bad data offset %d:"
@@ -4311,9 +4190,6 @@ brcmf_sdbrcm_readframes(struct brcmf_bus *bus, uint maxframes, bool *finished)
/* All done with this one -- now deliver the packet */
goto deliver;
}
- /* gSPI frames should not be handled in fractions */
- if (bus->bus == SPI_BUS)
- break;

/* Read frame header (hardware and software) */
sdret = brcmf_sdcard_recv_buf(bus->sdiodev,
@@ -5384,7 +5260,6 @@ void *brcmf_sdbrcm_probe(u16 bus_no, u16 slot, u16 func, uint bustype,
brcmf_txbound = BRCMF_TXBOUND;
brcmf_rxbound = BRCMF_RXBOUND;
brcmf_alignctl = true;
- sd1idle = true;
brcmf_readahead = true;
retrydata = false;
brcmf_dongle_memsize = 0;
@@ -5408,7 +5283,6 @@ void *brcmf_sdbrcm_probe(u16 bus_no, u16 slot, u16 func, uint bustype,
}
bus->sdiodev = sdiodev;
sdiodev->bus = bus;
- bus->bus = BRCMF_BUS;
bus->tx_seq = SDPCM_SEQUENCE_WRAP - 1;
bus->usebufpool = false; /* Use bufpool if allocated,
else use locally malloced rxbuf */
@@ -5578,22 +5452,20 @@ brcmf_sdbrcm_probe_attach(struct brcmf_bus *bus, u32 regsva)
brcmf_sdbrcm_sdiod_drive_strength_init(bus, brcmf_sdiod_drive_strength);

/* Get info on the ARM and SOCRAM cores... */
- if (!BRCMF_NOPMU(bus)) {
- brcmf_sdcard_reg_read(bus->sdiodev,
- CORE_SB(bus->ci->armcorebase, sbidhigh), 4);
- bus->orig_ramsize = bus->ci->ramsize;
- if (!(bus->orig_ramsize)) {
- BRCMF_ERROR(("%s: failed to find SOCRAM memory!\n",
- __func__));
- goto fail;
- }
- bus->ramsize = bus->orig_ramsize;
- if (brcmf_dongle_memsize)
- brcmf_sdbrcm_setmemsize(bus, brcmf_dongle_memsize);
-
- BRCMF_ERROR(("DHD: dongle ram size is set to %d(orig %d)\n",
- bus->ramsize, bus->orig_ramsize));
+ brcmf_sdcard_reg_read(bus->sdiodev,
+ CORE_SB(bus->ci->armcorebase, sbidhigh), 4);
+ bus->orig_ramsize = bus->ci->ramsize;
+ if (!(bus->orig_ramsize)) {
+ BRCMF_ERROR(("%s: failed to find SOCRAM memory!\n",
+ __func__));
+ goto fail;
}
+ bus->ramsize = bus->orig_ramsize;
+ if (brcmf_dongle_memsize)
+ brcmf_sdbrcm_setmemsize(bus, brcmf_dongle_memsize);
+
+ BRCMF_ERROR(("DHD: dongle ram size is set to %d(orig %d)\n",
+ bus->ramsize, bus->orig_ramsize));

/* Set core control so an SDIO reset does a backplane reset */
reg_addr = bus->ci->buscorebase +
--
1.7.4.1



2011-08-26 20:01:02

by Jason

[permalink] [raw]
Subject: Re: [PATCH 00/14] staging: brcm80211: brcmfmac driver cleanup

On Fri, Aug 26, 2011 at 10:44:46AM -0700, Henry Ptasinski wrote:
> On Fri, Aug 26, 2011 at 10:38:55AM -0700, Jason wrote:
> > On Fri, Aug 26, 2011 at 10:31:59AM -0700, Henry Ptasinski wrote:
> > > A possibly better approach would be a device with a BCM4329 on the
> > > motherboard (e.g. table, phone, etc) that can run a relatively stock
> > > linux kernel. However, I don't know of a specific platform at the
> > > moment to recommend.
> >
> > Nexus One phone?
>
> That's a possibility. Are people running recent, relatively unmodified linux
> kernels on the Nexus One? (Or you could backport brcmfmac to the Android
> version of the kernel, perhaps using compat-wireless).

folks run debian from the sdcard [1], a mainline kernel shouldn't be too
big of a stretch from there. Especially if the purpose is for testing
wifi. Don't need PM, GSM, display, 3D, etc for that.

Note, I haven't tried it yet, myself. It's been on the _long_ list of
projects. It would be higher on the list if brcmfmac supported all the
normal Linux features like monitor mode, AP mode, multiple-VAPs, etc.
Or, at least, was in mainline and would accept patches adding such
features... ;-)

hth,

Jason.

[1] http://www.irregular-expression.com/?p=30

2011-08-12 19:10:43

by Arend van Spriel

[permalink] [raw]
Subject: Re: [PATCH 01/14] staging: brcm80211: use wait queues instead of semaphores in wl_cfg80211.c

On 08/12/2011 09:08 PM, Larry Finger wrote:
> On 08/12/2011 01:59 PM, Franky Lin wrote:
>> If you are refering to this line
>> >>> + } while ((e = brcmf_deq_event(cfg_priv)));
>>
>> The extra parentheses are added to fix a compiler warning:
>> drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c: In function
>> ‘brcmf_event_handler’:
>> drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c:3576: warning: suggest
>> parentheses around assignment used as truth value
> Does checkpatch allow that assignment in the while statement? I would expect it
> to want you to
>
> e = brcmf_deq_event(cfg_priv);
> } while (e);
>
> Larry
>

Yep. That is the v2 I sent. btw checkpatch did not complain on the
original patch.

Gr. AvS

--
Almost nobody dances sober, unless they happen to be insane.
-- H.P. Lovecraft --



2011-08-13 08:30:44

by Rafał Miłecki

[permalink] [raw]
Subject: Re: [PATCH 00/14] staging: brcm80211: brcmfmac driver cleanup

W dniu 13 sierpnia 2011 09:47 użytkownik Arend van Spriel
<[email protected]> napisał:
> On 08/12/2011 10:04 PM, Rafał Miłecki wrote:
>>
>> W dniu 12 sierpnia 2011 18:32 użytkownik Arend van Spriel
>> <[email protected]>  napisał:
>>>
>>> On 08/12/2011 04:02 PM, Rafał Miłecki wrote:
>>>>
>>>> 2011/8/12 Arend van Spriel<[email protected]>:
>>>>>
>>>>> Several cleanup patches to reduce code for the brcmfmac driver and
>>>>> get rid of a remaining checkpatch warning. The driver sources should
>>>>> be clear from checkpatch issue now.
>>>>>
>>>>> This series applies to staging-next and depends on the following patch
>>>>> set:
>>>>
>>>> Are you testing patches on some hardware? Or just compile-testing?
>>>>
>>>> I believe this driver is meant to support BCM4329, which is not PCI(e)
>>>> board. What adapter do you use?
>>>>
>>>> I've heard about Arasan adapter. Have you tried it? Is that something
>>>> reachable from arasan.com?
>>>
>>> Our brcm80211 source tree under drivers/staging contain two drivers. The
>>> brcmsmac driver currently supporting the PCI(e) cards with bcm43224,
>>> bcm43225, and bcm4313 chips and the brcmfmac driver currently supporting
>>> the
>>> SDIO card with bcm4329 chip. brcmsmac is a mac80211 driver and brcmfmac
>>> is a
>>> cfg80211 driver.
>>>
>>> We indeed use the Arasan adapter and both drivers are running in nightly
>>> test cycle testing our common internal repository. So the drivers are
>>> functionally tested on the x86 platforms (32 and 64 bit). Also looking at
>>> sparc64 and powerpc64 but not in a nightly cycle.
>>
>> Is there a chance you can donate me with such a adapter and card?
>
> Hi Rafał,
>
> If your interest is getting SDIO supported in bcma this card is not very
> useful to you. The bcm4329 is using the SSB interconnect.

That surprised me, interesting. I've never dig into brcmfmac code.

This still should be possible to adopt brcmfmac to use ssb, right? A
first random ssb-related function: dhdsdio_chip_resetcore. It
duplicates ssb code.

I'm still willing to help in brcmfmac development.

--
Rafał