Skip to content

Commit

Permalink
staging: brcm80211: move utility functions into new module
Browse files Browse the repository at this point in the history
Move utility functions shared by the brcmsmac and brcmfmac drivers into a new
module, brcmutil.ko.  This eliminates the need to compile and link the shared
functions into both drivers.  Prefix all exported symbols with "bcm_".

Cc: devel@linuxdriverproject.org
Reviewed-by: Roland Vossen <rvossen@broadcom.com>
Reviewed-by: Brett Rudley <brudley@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Henry Ptasinski authored and Greg Kroah-Hartman committed May 11, 2011
1 parent 4e458c1 commit b33f0e2
Show file tree
Hide file tree
Showing 21 changed files with 251 additions and 172 deletions.
6 changes: 6 additions & 0 deletions drivers/staging/brcm80211/Kconfig
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
config BRCMUTIL
tristate
default n

config BRCMSMAC
tristate "Broadcom IEEE802.11n PCIe SoftMAC WLAN driver"
default n
depends on PCI
depends on WLAN && MAC80211
select BRCMUTIL
select FW_LOADER
select CRC_CCITT
---help---
Expand All @@ -15,6 +20,7 @@ config BRCMFMAC
default n
depends on MMC
depends on WLAN && CFG80211
select BRCMUTIL
select FW_LOADER
select WIRELESS_EXT
select WEXT_PRIV
Expand Down
1 change: 1 addition & 0 deletions drivers/staging/brcm80211/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@
subdir-ccflags-y := -DBCMDMA32
subdir-ccflags-$(CONFIG_BRCMDBG) += -DBCMDBG -DBCMDBG_ASSERT

obj-$(CONFIG_BRCMUTIL) += util/
obj-$(CONFIG_BRCMFMAC) += brcmfmac/
obj-$(CONFIG_BRCMSMAC) += brcmsmac/
4 changes: 1 addition & 3 deletions drivers/staging/brcm80211/brcmfmac/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,7 @@ DHDOFILES = \
bcmsdh.o \
bcmsdh_linux.o \
bcmsdh_sdmmc.o \
bcmsdh_sdmmc_linux.o \
bcmutils.o \
bcmwifi.o
bcmsdh_sdmmc_linux.o

obj-m += brcmfmac.o
brcmfmac-objs += $(DHDOFILES)
12 changes: 6 additions & 6 deletions drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1042,9 +1042,9 @@ sdioh_request_buffer(sdioh_info_t *sd, uint pio_dma, uint fix_inc, uint write,
if (pkt == NULL) {
sd_data(("%s: Creating new %s Packet, len=%d\n",
__func__, write ? "TX" : "RX", buflen_u));
mypkt = pkt_buf_get_skb(buflen_u);
mypkt = bcm_pkt_buf_get_skb(buflen_u);
if (!mypkt) {
sd_err(("%s: pkt_buf_get_skb failed: len %d\n",
sd_err(("%s: bcm_pkt_buf_get_skb failed: len %d\n",
__func__, buflen_u));
return SDIOH_API_RC_FAIL;
}
Expand All @@ -1060,7 +1060,7 @@ sdioh_request_buffer(sdioh_info_t *sd, uint pio_dma, uint fix_inc, uint write,
if (!write)
memcpy(buffer, mypkt->data, buflen_u);

pkt_buf_free_skb(mypkt);
bcm_pkt_buf_free_skb(mypkt);
} else if (((u32) (pkt->data) & DMA_ALIGN_MASK) != 0) {
/* Case 2: We have a packet, but it is unaligned. */

Expand All @@ -1069,9 +1069,9 @@ sdioh_request_buffer(sdioh_info_t *sd, uint pio_dma, uint fix_inc, uint write,

sd_data(("%s: Creating aligned %s Packet, len=%d\n",
__func__, write ? "TX" : "RX", pkt->len));
mypkt = pkt_buf_get_skb(pkt->len);
mypkt = bcm_pkt_buf_get_skb(pkt->len);
if (!mypkt) {
sd_err(("%s: pkt_buf_get_skb failed: len %d\n",
sd_err(("%s: bcm_pkt_buf_get_skb failed: len %d\n",
__func__, pkt->len));
return SDIOH_API_RC_FAIL;
}
Expand All @@ -1087,7 +1087,7 @@ sdioh_request_buffer(sdioh_info_t *sd, uint pio_dma, uint fix_inc, uint write,
if (!write)
memcpy(pkt->data, mypkt->data, mypkt->len);

pkt_buf_free_skb(mypkt);
bcm_pkt_buf_free_skb(mypkt);
} else { /* case 3: We have a packet and
it is aligned. */
sd_data(("%s: Aligned %s Packet, direct DMA\n",
Expand Down
1 change: 0 additions & 1 deletion drivers/staging/brcm80211/brcmfmac/bcmutils.c

This file was deleted.

1 change: 0 additions & 1 deletion drivers/staging/brcm80211/brcmfmac/bcmwifi.c

This file was deleted.

16 changes: 8 additions & 8 deletions drivers/staging/brcm80211/brcmfmac/dhd_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -316,15 +316,15 @@ bool dhd_prec_enq(dhd_pub_t *dhdp, struct pktq *q, struct sk_buff *pkt,
* exceeding total queue length
*/
if (!pktq_pfull(q, prec) && !pktq_full(q)) {
pktq_penq(q, prec, pkt);
bcm_pktq_penq(q, prec, pkt);
return true;
}

/* Determine precedence from which to evict packet, if any */
if (pktq_pfull(q, prec))
eprec = prec;
else if (pktq_full(q)) {
p = pktq_peek_tail(q, &eprec);
p = bcm_pktq_peek_tail(q, &eprec);
ASSERT(p);
if (eprec > prec)
return false;
Expand All @@ -338,21 +338,21 @@ bool dhd_prec_enq(dhd_pub_t *dhdp, struct pktq *q, struct sk_buff *pkt,
if (eprec == prec && !discard_oldest)
return false; /* refuse newer (incoming) packet */
/* Evict packet according to discard policy */
p = discard_oldest ? pktq_pdeq(q, eprec) : pktq_pdeq_tail(q,
eprec);
p = discard_oldest ? bcm_pktq_pdeq(q, eprec) :
bcm_pktq_pdeq_tail(q, eprec);
if (p == NULL) {
DHD_ERROR(("%s: pktq_penq() failed, oldest %d.",
DHD_ERROR(("%s: bcm_pktq_penq() failed, oldest %d.",
__func__, discard_oldest));
ASSERT(p);
}

pkt_buf_free_skb(p);
bcm_pkt_buf_free_skb(p);
}

/* Enqueue */
p = pktq_penq(q, prec, pkt);
p = bcm_pktq_penq(q, prec, pkt);
if (p == NULL) {
DHD_ERROR(("%s: pktq_penq() failed.", __func__));
DHD_ERROR(("%s: bcm_pktq_penq() failed.", __func__));
ASSERT(p);
}

Expand Down
Loading

0 comments on commit b33f0e2

Please sign in to comment.