summaryrefslogtreecommitdiffstats
path: root/drivers/staging/brcm80211/brcmfmac
diff options
context:
space:
mode:
authormike.rapoport@gmail.com <mike.rapoport@gmail.com>2010-10-13 00:09:10 +0200
committerGreg Kroah-Hartman <gregkh@suse.de>2010-10-14 12:28:58 -0700
commit5fcc1fcb2ec18094b3a8022b1974c0b2e9f5f73c (patch)
treec60c70596d4dcc69e23a1830b4e60e5c3f262787 /drivers/staging/brcm80211/brcmfmac
parent97e17d0e7bb861c197e50433325bf2f5f9871f90 (diff)
downloadop-kernel-dev-5fcc1fcb2ec18094b3a8022b1974c0b2e9f5f73c.zip
op-kernel-dev-5fcc1fcb2ec18094b3a8022b1974c0b2e9f5f73c.tar.gz
staging: brcm80211: replace MALLOC() with k[zm]alloc
Signed-off-by: Mike Rapoport <mike.rapoport@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/brcm80211/brcmfmac')
-rw-r--r--drivers/staging/brcm80211/brcmfmac/bcmsdh.c5
-rw-r--r--drivers/staging/brcm80211/brcmfmac/bcmsdh_linux.c6
-rw-r--r--drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c3
-rw-r--r--drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc_linux.c2
-rw-r--r--drivers/staging/brcm80211/brcmfmac/dhd_cdc.c3
-rw-r--r--drivers/staging/brcm80211/brcmfmac/dhd_common.c8
-rw-r--r--drivers/staging/brcm80211/brcmfmac/dhd_linux.c10
-rw-r--r--drivers/staging/brcm80211/brcmfmac/dhd_sdio.c39
8 files changed, 35 insertions, 41 deletions
diff --git a/drivers/staging/brcm80211/brcmfmac/bcmsdh.c b/drivers/staging/brcm80211/brcmfmac/bcmsdh.c
index 04d92d1..3cc979f 100644
--- a/drivers/staging/brcm80211/brcmfmac/bcmsdh.c
+++ b/drivers/staging/brcm80211/brcmfmac/bcmsdh.c
@@ -58,12 +58,11 @@ bcmsdh_info_t *bcmsdh_attach(osl_t *osh, void *cfghdl, void **regsva, uint irq)
{
bcmsdh_info_t *bcmsdh;
- bcmsdh = (bcmsdh_info_t *) MALLOC(osh, sizeof(bcmsdh_info_t));
+ bcmsdh = kzalloc(sizeof(bcmsdh_info_t), GFP_ATOMIC);
if (bcmsdh == NULL) {
BCMSDH_ERROR(("bcmsdh_attach: out of memory"));
return NULL;
}
- bzero((char *)bcmsdh, sizeof(bcmsdh_info_t));
/* save the handler locally */
l_bcmsdh = bcmsdh;
@@ -317,7 +316,7 @@ int bcmsdh_cis_read(void *sdh, uint func, u8 * cis, uint length)
if (ascii) {
/* Move binary bits to tmp and format them
into the provided buffer. */
- tmp_buf = (u8 *) MALLOC(bcmsdh->osh, length);
+ tmp_buf = kmalloc(length, GFP_ATOMIC);
if (tmp_buf == NULL) {
BCMSDH_ERROR(("%s: out of memory\n", __func__));
return BCME_NOMEM;
diff --git a/drivers/staging/brcm80211/brcmfmac/bcmsdh_linux.c b/drivers/staging/brcm80211/brcmfmac/bcmsdh_linux.c
index 164a752..b24644e 100644
--- a/drivers/staging/brcm80211/brcmfmac/bcmsdh_linux.c
+++ b/drivers/staging/brcm80211/brcmfmac/bcmsdh_linux.c
@@ -195,12 +195,11 @@ int bcmsdh_probe(struct device *dev)
SDLX_MSG(("%s: osl_attach failed\n", __func__));
goto err;
}
- sdhc = MALLOC(osh, sizeof(bcmsdh_hc_t));
+ sdhc = kzalloc(sizeof(bcmsdh_hc_t), GFP_ATOMIC);
if (!sdhc) {
SDLX_MSG(("%s: out of memory\n", __func__));
goto err;
}
- bzero(sdhc, sizeof(bcmsdh_hc_t));
sdhc->osh = osh;
sdhc->dev = (void *)dev;
@@ -427,12 +426,11 @@ bcmsdh_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
SDLX_MSG(("%s: osl_attach failed\n", __func__));
goto err;
}
- sdhc = MALLOC(osh, sizeof(bcmsdh_hc_t));
+ sdhc = kzalloc(sizeof(bcmsdh_hc_t), GFP_ATOMIC);
if (!sdhc) {
SDLX_MSG(("%s: out of memory\n", __func__));
goto err;
}
- bzero(sdhc, sizeof(bcmsdh_hc_t));
sdhc->osh = osh;
sdhc->dev = pdev;
diff --git a/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c b/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c
index 22c1e77..d6e699c 100644
--- a/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c
+++ b/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c
@@ -123,12 +123,11 @@ extern sdioh_info_t *sdioh_attach(osl_t *osh, void *bar0, uint irq)
return NULL;
}
- sd = (sdioh_info_t *) MALLOC(osh, sizeof(sdioh_info_t));
+ sd = kzalloc(sizeof(sdioh_info_t), GFP_ATOMIC);
if (sd == NULL) {
sd_err(("sdioh_attach: out of memory\n"));
return NULL;
}
- bzero((char *)sd, sizeof(sdioh_info_t));
sd->osh = osh;
if (sdioh_sdmmc_osinit(sd) != 0) {
sd_err(("%s:sdioh_sdmmc_osinit() failed\n", __func__));
diff --git a/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc_linux.c b/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc_linux.c
index ac89f82..7a80bcf 100644
--- a/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc_linux.c
+++ b/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc_linux.c
@@ -148,7 +148,7 @@ int sdioh_sdmmc_osinit(sdioh_info_t *sd)
{
struct sdos_info *sdos;
- sdos = (struct sdos_info *)MALLOC(sd->osh, sizeof(struct sdos_info));
+ sdos = kmalloc(sizeof(struct sdos_info), GFP_ATOMIC);
sd->sdos_info = (void *)sdos;
if (sdos == NULL)
return BCME_NOMEM;
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_cdc.c b/drivers/staging/brcm80211/brcmfmac/dhd_cdc.c
index 00b725f..f1d550f 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd_cdc.c
+++ b/drivers/staging/brcm80211/brcmfmac/dhd_cdc.c
@@ -406,12 +406,11 @@ int dhd_prot_attach(dhd_pub_t *dhd)
{
dhd_prot_t *cdc;
- cdc = (dhd_prot_t *) MALLOC(dhd->osh, sizeof(dhd_prot_t));
+ cdc = kzalloc(sizeof(dhd_prot_t), GFP_ATOMIC);
if (!cdc) {
DHD_ERROR(("%s: kmalloc failed\n", __func__));
goto fail;
}
- memset(cdc, 0, sizeof(dhd_prot_t));
/* ensure that the msg buf directly follows the cdc msg struct */
if ((uintptr) (&cdc->msg + 1) != (uintptr) cdc->buf) {
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_common.c b/drivers/staging/brcm80211/brcmfmac/dhd_common.c
index 83a000e..66b4c7d 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd_common.c
+++ b/drivers/staging/brcm80211/brcmfmac/dhd_common.c
@@ -998,7 +998,7 @@ dhd_pktfilter_offload_enable(dhd_pub_t *dhd, char *arg, int enable,
wl_pkt_filter_enable_t enable_parm;
wl_pkt_filter_enable_t *pkt_filterp;
- arg_save = MALLOC(dhd->osh, strlen(arg) + 1);
+ arg_save = kmalloc(strlen(arg) + 1, GFP_ATOMIC);
if (!arg_save) {
DHD_ERROR(("%s: kmalloc failed\n", __func__));
goto fail;
@@ -1070,7 +1070,7 @@ void dhd_pktfilter_offload_set(dhd_pub_t *dhd, char *arg)
char *arg_save = 0, *arg_org = 0;
#define BUF_SIZE 2048
- arg_save = MALLOC(dhd->osh, strlen(arg) + 1);
+ arg_save = kmalloc(strlen(arg) + 1, GFP_ATOMIC);
if (!arg_save) {
DHD_ERROR(("%s: kmalloc failed\n", __func__));
goto fail;
@@ -1078,7 +1078,7 @@ void dhd_pktfilter_offload_set(dhd_pub_t *dhd, char *arg)
arg_org = arg_save;
- buf = MALLOC(dhd->osh, BUF_SIZE);
+ buf = kmalloc(BUF_SIZE, GFP_ATOMIC);
if (!buf) {
DHD_ERROR(("%s: kmalloc failed\n", __func__));
goto fail;
@@ -1363,7 +1363,7 @@ iscan_buf_t *dhd_iscan_allocate_buf(dhd_pub_t *dhd, iscan_buf_t **iscanbuf)
dhd_iscan_lock();
- iscanbuf_alloc = (iscan_buf_t *) MALLOC(dhd->osh, sizeof(iscan_buf_t));
+ iscanbuf_alloc = kmalloc(sizeof(iscan_buf_t), GFP_ATOMIC);
if (iscanbuf_alloc == NULL)
goto fail;
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_linux.c b/drivers/staging/brcm80211/brcmfmac/dhd_linux.c
index 20a90b2..e37ed4b 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd_linux.c
+++ b/drivers/staging/brcm80211/brcmfmac/dhd_linux.c
@@ -712,7 +712,7 @@ static void _dhd_set_multicast_list(dhd_info_t *dhd, int ifidx)
/* Send down the multicast list first. */
buflen = sizeof("mcast_list") + sizeof(cnt) + (cnt * ETHER_ADDR_LEN);
- bufp = buf = MALLOC(dhd->pub.osh, buflen);
+ bufp = buf = kmalloc(buflen, GFP_ATOMIC);
if (!bufp) {
DHD_ERROR(("%s: out of memory for mcast_list, cnt %d\n",
dhd_ifname(&dhd->pub, ifidx), cnt));
@@ -755,7 +755,7 @@ static void _dhd_set_multicast_list(dhd_info_t *dhd, int ifidx)
*/
buflen = sizeof("allmulti") + sizeof(allmulti);
- buf = MALLOC(dhd->pub.osh, buflen);
+ buf = kmalloc(buflen, GFP_ATOMIC);
if (!buf) {
DHD_ERROR(("%s: out of memory for allmulti\n",
dhd_ifname(&dhd->pub, ifidx)));
@@ -1676,7 +1676,7 @@ static int dhd_ioctl_entry(struct net_device *net, struct ifreq *ifr, int cmd)
} else {
*/
{
- buf = (char *)MALLOC(dhd->pub.osh, buflen);
+ buf = kmalloc(buflen, GFP_ATOMIC);
if (!buf) {
bcmerror = -BCME_NOMEM;
goto done;
@@ -1841,7 +1841,7 @@ dhd_add_if(dhd_info_t *dhd, int ifidx, void *handle, char *name,
ASSERT(dhd && (ifidx < DHD_MAX_IFS));
ifp = dhd->iflist[ifidx];
- if (!ifp && !(ifp = MALLOC(dhd->pub.osh, sizeof(dhd_if_t)))) {
+ if (!ifp && !(ifp = kmalloc(sizeof(dhd_if_t), GFP_ATOMIC))) {
DHD_ERROR(("%s: OOM - dhd_if_t\n", __func__));
return -ENOMEM;
}
@@ -1904,7 +1904,7 @@ dhd_pub_t *dhd_attach(osl_t *osh, struct dhd_bus *bus, uint bus_hdrlen)
}
/* Allocate primary dhd_info */
- dhd = MALLOC(osh, sizeof(dhd_info_t));
+ dhd = kmalloc(sizeof(dhd_info_t), GFP_ATOMIC);
if (!dhd) {
DHD_ERROR(("%s: OOM - alloc dhd_info\n", __func__));
goto fail;
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c b/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
index e0e1d2b..18bc396 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
+++ b/drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
@@ -1822,18 +1822,18 @@ static int dhdsdio_checkdied(dhd_bus_t *bus, u8 *data, uint size)
* allocate memory to trace the trap or assert.
*/
size = msize;
- mbuffer = data = MALLOC(bus->dhd->osh, msize);
+ mbuffer = data = kmalloc(msize, GFP_ATOMIC);
if (mbuffer == NULL) {
- DHD_ERROR(("%s: MALLOC(%d) failed\n", __func__,
+ DHD_ERROR(("%s: kmalloc(%d) failed\n", __func__,
msize));
bcmerror = BCME_NOMEM;
goto done;
}
}
- str = MALLOC(bus->dhd->osh, maxstrlen);
+ str = kmalloc(maxstrlen, GFP_ATOMIC);
if (str == NULL) {
- DHD_ERROR(("%s: MALLOC(%d) failed\n", __func__, maxstrlen));
+ DHD_ERROR(("%s: kmalloc(%d) failed\n", __func__, maxstrlen));
bcmerror = BCME_NOMEM;
goto done;
}
@@ -1944,7 +1944,7 @@ static int dhdsdio_mem_dump(dhd_bus_t *bus)
/* Get full mem size */
size = bus->ramsize;
- buf = MALLOC(bus->dhd->osh, size);
+ buf = kmalloc(size, GFP_ATOMIC);
if (!buf) {
printf("%s: Out of memory (%d bytes)\n", __func__, size);
return -1;
@@ -2004,7 +2004,7 @@ static int dhdsdio_readconsole(dhd_bus_t *bus)
/* Allocate console buffer (one time only) */
if (c->buf == NULL) {
c->bufsize = ltoh32(c->log.buf_size);
- c->buf = MALLOC(bus->dhd->osh, c->bufsize);
+ c->buf = kmalloc(c->bufsize, GFP_ATOMIC);
if (c->buf == NULL)
return BCME_NOMEM;
}
@@ -2080,7 +2080,7 @@ int dhdsdio_downloadvars(dhd_bus_t *bus, void *arg, int len)
if (bus->vars)
MFREE(bus->dhd->osh, bus->vars, bus->varsz);
- bus->vars = MALLOC(bus->dhd->osh, len);
+ bus->vars = kmalloc(len, GFP_ATOMIC);
bus->varsz = bus->vars ? len : 0;
if (bus->vars == NULL) {
bcmerror = BCME_NOMEM;
@@ -2526,7 +2526,7 @@ static int dhdsdio_write_vars(dhd_bus_t *bus)
varaddr = (bus->ramsize - 4) - varsize;
if (bus->vars) {
- vbuffer = (u8 *) MALLOC(bus->dhd->osh, varsize);
+ vbuffer = kmalloc(varsize, GFP_ATOMIC);
if (!vbuffer)
return BCME_NOMEM;
@@ -2539,7 +2539,7 @@ static int dhdsdio_write_vars(dhd_bus_t *bus)
#ifdef DHD_DEBUG
/* Verify NVRAM bytes */
DHD_INFO(("Compare NVRAM dl & ul; varsize=%d\n", varsize));
- nvram_ularray = (char *)MALLOC(bus->dhd->osh, varsize);
+ nvram_ularray = kmalloc(varsize, GFP_ATOMIC);
if (!nvram_ularray)
return BCME_NOMEM;
@@ -5147,12 +5147,11 @@ static void *dhdsdio_probe(u16 venid, u16 devid, u16 bus_no,
}
/* Allocate private bus interface state */
- bus = MALLOC(osh, sizeof(dhd_bus_t));
+ bus = kzalloc(sizeof(dhd_bus_t), GFP_ATOMIC);
if (!bus) {
- DHD_ERROR(("%s: MALLOC of dhd_bus_t failed\n", __func__));
+ DHD_ERROR(("%s: kmalloc of dhd_bus_t failed\n", __func__));
goto fail;
}
- bzero(bus, sizeof(dhd_bus_t));
bus->sdh = sdh;
bus->cl_devid = (u16) devid;
bus->bus = DHD_BUS;
@@ -5274,7 +5273,7 @@ dhdsdio_probe_attach(struct dhd_bus *bus, osl_t *osh, void *sdh, void *regsva,
udelay(65);
for (fn = 0; fn <= numfn; fn++) {
- cis[fn] = MALLOC(osh, SBSDIO_CIS_SIZE_LIMIT);
+ cis[fn] = kmalloc(SBSDIO_CIS_SIZE_LIMIT, GFP_ATOMIC);
if (!cis[fn]) {
DHD_INFO(("dhdsdio_probe: fn %d cis malloc "
"failed\n", fn));
@@ -5386,18 +5385,18 @@ static bool dhdsdio_probe_malloc(dhd_bus_t *bus, osl_t *osh, void *sdh)
bus->rxblen =
roundup((bus->dhd->maxctl + SDPCM_HDRLEN),
ALIGNMENT) + DHD_SDALIGN;
- bus->rxbuf = MALLOC(osh, bus->rxblen);
+ bus->rxbuf = kmalloc(bus->rxblen, GFP_ATOMIC);
if (!(bus->rxbuf)) {
- DHD_ERROR(("%s: MALLOC of %d-byte rxbuf failed\n",
+ DHD_ERROR(("%s: kmalloc of %d-byte rxbuf failed\n",
__func__, bus->rxblen));
goto fail;
}
}
/* Allocate buffer to receive glomed packet */
- bus->databuf = MALLOC(osh, MAX_DATA_BUF);
+ bus->databuf = kmalloc(MAX_DATA_BUF, GFP_ATOMIC);
if (!(bus->databuf)) {
- DHD_ERROR(("%s: MALLOC of %d-byte databuf failed\n",
+ DHD_ERROR(("%s: kmalloc of %d-byte databuf failed\n",
__func__, MAX_DATA_BUF));
/* release rxbuf which was already located as above */
if (!bus->rxblen)
@@ -5672,7 +5671,7 @@ static int dhdsdio_download_code_array(struct dhd_bus *bus)
{
unsigned char *ularray;
- ularray = MALLOC(bus->dhd->osh, bus->ramsize);
+ ularray = kmalloc(bus->ramsize, GFP_ATOMIC);
/* Upload image to verify downloaded contents. */
offset = 0;
memset(ularray, 0xaa, bus->ramsize);
@@ -5734,7 +5733,7 @@ static int dhdsdio_download_code_file(struct dhd_bus *bus, char *fw_path)
if (image == NULL)
goto err;
- memptr = memblock = MALLOC(bus->dhd->osh, MEMBLOCK + DHD_SDALIGN);
+ memptr = memblock = kmalloc(MEMBLOCK + DHD_SDALIGN, GFP_ATOMIC);
if (memblock == NULL) {
DHD_ERROR(("%s: Failed to allocate memory %d bytes\n",
__func__, MEMBLOCK));
@@ -5861,7 +5860,7 @@ static int dhdsdio_download_nvram(struct dhd_bus *bus)
goto err;
}
- memblock = MALLOC(bus->dhd->osh, MEMBLOCK);
+ memblock = kmalloc(MEMBLOCK, GFP_ATOMIC);
if (memblock == NULL) {
DHD_ERROR(("%s: Failed to allocate memory %d bytes\n",
__func__, MEMBLOCK));
OpenPOWER on IntegriCloud