staging: wilc1000: remove pointless kmalloc wrapper
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 4 Sep 2015 01:50:27 +0000 (18:50 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 13 Sep 2015 01:24:39 +0000 (18:24 -0700)
just call kmalloc directly, don't use an indirect pointer to a wrapper
function.

Cc: Johnny Kim <johnny.kim@atmel.com>
Cc: Rachel Kim <rachel.kim@atmel.com>
Cc: Dean Lee <dean.lee@atmel.com>
Cc: Chris Park <chris.park@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/wilc1000/linux_wlan.c
drivers/staging/wilc1000/wilc_wlan.c
drivers/staging/wilc1000/wilc_wlan_if.h

index 1e0b1d5..903fc7c 100644 (file)
@@ -559,15 +559,6 @@ static void *linux_wlan_malloc_atomic(uint32_t sz)
        return (void *)pntr;
 
 }
-static void *linux_wlan_malloc(uint32_t sz)
-{
-       char *pntr = NULL;
-
-       pntr = kmalloc(sz, GFP_KERNEL);
-       PRINT_D(MEM_DBG, "Allocating %d bytes at address %p\n", sz, pntr);
-       return (void *)pntr;
-}
-
 void linux_wlan_free(void *vp)
 {
        if (vp != NULL) {
@@ -1498,7 +1489,6 @@ void linux_to_wlan(wilc_wlan_inp_t *nwi, linux_wlan_t *nic)
        nwi->os_func.os_sleep = linux_wlan_msleep;
        nwi->os_func.os_atomic_sleep = linux_wlan_atomic_msleep;
        nwi->os_func.os_debug = linux_wlan_dbg;
-       nwi->os_func.os_malloc = linux_wlan_malloc;
        nwi->os_func.os_malloc_atomic = linux_wlan_malloc_atomic;
        nwi->os_func.os_free = linux_wlan_free;
        nwi->os_func.os_lock = linux_wlan_lock;
index e0da7b4..c5fd55a 100644 (file)
@@ -1414,7 +1414,7 @@ static void wilc_wlan_handle_isr_ext(uint32_t int_status)
                }
 
 #else
-               buffer = p->os_func.os_malloc(size);
+               buffer = kmalloc(size, GFP_KERNEL);
                if (buffer == NULL) {
                        wilc_debug(N_ERR, "[wilc isr]: fail alloc host memory...drop the packets (%d)\n", size);
                        usleep_range(100 * 1000, 100 * 1000);
@@ -1448,7 +1448,7 @@ _end_:
                        /**
                         *      add to rx queue
                         **/
-                       rqe = (struct rxq_entry_t *)p->os_func.os_malloc(sizeof(struct rxq_entry_t));
+                       rqe = kmalloc(sizeof(struct rxq_entry_t), GFP_KERNEL);
                        if (rqe != NULL) {
                                rqe->buffer = buffer;
                                rqe->buffer_size = size;
@@ -1517,7 +1517,7 @@ static int wilc_wlan_firmware_download(const uint8_t *buffer, uint32_t buffer_si
        blksz = (1ul << 12); /* Bug 4703: 4KB Good enough size for most platforms = PAGE_SIZE. */
        /* Allocate a DMA coherent  buffer. */
 
-       dma_buffer = (uint8_t *)g_wlan.os_func.os_malloc(blksz);
+       dma_buffer = kmalloc(blksz, GFP_KERNEL);
        if (dma_buffer == NULL) {
                /*EIO   5*/
                ret = -5;
@@ -2174,7 +2174,7 @@ int wilc_wlan_init(wilc_wlan_inp_t *inp, wilc_wlan_oup_t *oup)
         *      alloc tx, rx buffer
         **/
        if (g_wlan.tx_buffer == NULL)
-               g_wlan.tx_buffer = (uint8_t *)g_wlan.os_func.os_malloc(g_wlan.tx_buffer_size);
+               g_wlan.tx_buffer = kmalloc(g_wlan.tx_buffer_size, GFP_KERNEL);
        PRINT_D(TX_DBG, "g_wlan.tx_buffer = %p\n", g_wlan.tx_buffer);
 
        if (g_wlan.tx_buffer == NULL) {
@@ -2187,7 +2187,7 @@ int wilc_wlan_init(wilc_wlan_inp_t *inp, wilc_wlan_oup_t *oup)
 /* rx_buffer is not used unless we activate USE_MEM STATIC which is not applicable, allocating such memory is useless*/
 #if defined (MEMORY_STATIC)
        if (g_wlan.rx_buffer == NULL)
-               g_wlan.rx_buffer = (uint8_t *)g_wlan.os_func.os_malloc(g_wlan.rx_buffer_size);
+               g_wlan.rx_buffer = kmalloc(g_wlan.rx_buffer_size, GFP_KERNEL);
        PRINT_D(TX_DBG, "g_wlan.rx_buffer =%p\n", g_wlan.rx_buffer);
        if (g_wlan.rx_buffer == NULL) {
                /* ENOBUFS      105 */
index 5cf74e4..b5aa83c 100644 (file)
@@ -87,7 +87,6 @@ typedef struct {
        void (*os_sleep)(uint32_t);
        void (*os_atomic_sleep)(uint32_t);
        void (*os_debug)(uint8_t *);
-       void *(*os_malloc)(uint32_t);
        void *(*os_malloc_atomic)(uint32_t);
        void (*os_free)(void *);
        void (*os_lock)(void *);