From: Greg Kroah-Hartman Date: Fri, 4 Sep 2015 01:50:27 +0000 (-0700) Subject: staging: wilc1000: remove pointless kmalloc wrapper X-Git-Tag: firefly_0821_release~176^2~802^2~2184 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=f019b9d91d84cb62bfa22fccf15bd4457d4acb2f;p=firefly-linux-kernel-4.4.55.git staging: wilc1000: remove pointless kmalloc wrapper just call kmalloc directly, don't use an indirect pointer to a wrapper function. Cc: Johnny Kim Cc: Rachel Kim Cc: Dean Lee Cc: Chris Park Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 1e0b1d5f05bc..903fc7c9fd4d 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -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; diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index e0da7b446435..c5fd55a4989c 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -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 */ diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h b/drivers/staging/wilc1000/wilc_wlan_if.h index 5cf74e4c4a70..b5aa83c61e1a 100644 --- a/drivers/staging/wilc1000/wilc_wlan_if.h +++ b/drivers/staging/wilc1000/wilc_wlan_if.h @@ -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 *);