#include <linux/spi/spi.h>
#include "linux_wlan_common.h"
+#include "linux_wlan_spi.h"
#define USE_SPI_DMA 0 /* johnny add */
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) {
.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);
#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;
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) {
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 */
}
#else
-int linux_spi_read(unsigned char *rb, unsigned long rlen)
+int linux_spi_read(u8 *rb, u32 rlen)
{
int ret;
};
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));
}
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 */
#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;
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 */