#include <linux/slab.h>
#include <linux/types.h>
#include <linux/cdev.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
#include <linux/device.h>
#include <linux/spi/spi.h>
#include "linux_wlan_common.h"
+#include "linux_wlan_spi.h"
#define USE_SPI_DMA 0 /* johnny add */
#define MAX_SPEED 6000000
#endif /* WILC_ASIC_A0 */
-static uint32_t SPEED = MIN_SPEED;
+static u32 SPEED = MIN_SPEED;
struct spi_device *wilc_spi_dev;
void linux_spi_deinit(void *vp);
#if defined(TXRX_PHASE_SIZE)
-int linux_spi_write(uint8_t *b, uint32_t len)
+int linux_spi_write(u8 *b, u32 len)
{
int ret;
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) {
}
#else
-int linux_spi_write(uint8_t *b, uint32_t len)
+int linux_spi_write(u8 *b, u32 len)
{
int ret;
.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 */