Staging: wilc1000: coreconfigurator: Remove trailing whitespace
[firefly-linux-kernel-4.4.55.git] / drivers / staging / wilc1000 / linux_wlan_spi.c
index 3e242564701843479decf95fca6e4c674423bddb..039d06192d6b1af853e97207a1a11ccb642cb828 100644 (file)
@@ -10,6 +10,7 @@
 #include <linux/spi/spi.h>
 
 #include "linux_wlan_common.h"
+#include "linux_wlan_spi.h"
 
 #define USE_SPI_DMA     0       /* johnny add */
 
@@ -125,10 +126,8 @@ int linux_spi_write(u8 *b, u32 len)
                int remainder = len % TXRX_PHASE_SIZE;
 
                char *r_buffer = kzalloc(TXRX_PHASE_SIZE, GFP_KERNEL);
-
-               if (!r_buffer) {
-                       PRINT_ER("Failed to allocate memory for r_buffer\n");
-               }
+               if (!r_buffer)
+                       return -ENOMEM;
 
                if (blk) {
                        while (i < blk) {
@@ -208,10 +207,9 @@ int linux_spi_write(u8 *b, u32 len)
                        .delay_usecs = 0,
                };
                char *r_buffer = kzalloc(len, GFP_KERNEL);
+               if (!r_buffer)
+                       return -ENOMEM;
 
-               if (!r_buffer) {
-                       PRINT_ER("Failed to allocate memory for r_buffer\n");
-               }
                tr.rx_buf = r_buffer;
                PRINT_D(BUS_DBG, "Request writing %d bytes\n", len);
 
@@ -246,7 +244,7 @@ int linux_spi_write(u8 *b, u32 len)
 
 #if defined(TXRX_PHASE_SIZE)
 
-int linux_spi_read(unsigned char *rb, unsigned long rlen)
+int linux_spi_read(u8 *rb, u32 rlen)
 {
        int ret;
 
@@ -257,10 +255,8 @@ int linux_spi_read(unsigned char *rb, unsigned long rlen)
                int remainder = rlen % TXRX_PHASE_SIZE;
 
                char *t_buffer = kzalloc(TXRX_PHASE_SIZE, GFP_KERNEL);
-
-               if (!t_buffer) {
-                       PRINT_ER("Failed to allocate memory for t_buffer\n");
-               }
+               if (!t_buffer)
+                       return -ENOMEM;
 
                if (blk) {
                        while (i < blk) {
@@ -312,7 +308,7 @@ int linux_spi_read(unsigned char *rb, unsigned long rlen)
 
                kfree(t_buffer);
        } else {
-               PRINT_ER("can't read data with the following length: %ld\n", rlen);
+               PRINT_ER("can't read data with the following length: %u\n", rlen);
                ret = -1;
        }
        /* change return value to match WILC interface */
@@ -322,7 +318,7 @@ int linux_spi_read(unsigned char *rb, unsigned long rlen)
 }
 
 #else
-int linux_spi_read(unsigned char *rb, unsigned long rlen)
+int linux_spi_read(u8 *rb, u32 rlen)
 {
 
        int ret;
@@ -337,10 +333,9 @@ int linux_spi_read(unsigned char *rb, unsigned long rlen)
 
                };
                char *t_buffer = kzalloc(rlen, GFP_KERNEL);
+               if (!t_buffer)
+                       return -ENOMEM;
 
-               if (!t_buffer) {
-                       PRINT_ER("Failed to allocate memory for t_buffer\n");
-               }
                tr.tx_buf = t_buffer;
 
                memset(&msg, 0, sizeof(msg));
@@ -357,7 +352,7 @@ int linux_spi_read(unsigned char *rb, unsigned long rlen)
                }
                kfree(t_buffer);
        } else {
-               PRINT_ER("can't read data with the following length: %ld\n", rlen);
+               PRINT_ER("can't read data with the following length: %u\n", rlen);
                ret = -1;
        }
        /* change return value to match WILC interface */
@@ -368,7 +363,7 @@ int linux_spi_read(unsigned char *rb, unsigned long rlen)
 
 #endif
 
-int linux_spi_write_read(unsigned char *wb, unsigned char *rb, unsigned int rlen)
+int linux_spi_write_read(u8 *wb, u8 *rb, u32 rlen)
 {
 
        int ret;
@@ -396,7 +391,7 @@ int linux_spi_write_read(unsigned char *wb, unsigned char *rb, unsigned int rlen
                        PRINT_ER("SPI transaction failed\n");
                }
        } else {
-               PRINT_ER("can't read data with the following length: %d\n", rlen);
+               PRINT_ER("can't read data with the following length: %u\n", rlen);
                ret = -1;
        }
        /* change return value to match WILC interface */