staging: wilc1000: wilc_spi_write: pass struct wilc
authorGlen Lee <glen.lee@atmel.com>
Wed, 18 Nov 2015 06:11:29 +0000 (15:11 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 18 Dec 2015 22:30:50 +0000 (14:30 -0800)
This patch add new function parameter struct wilc and use it instead of
wilc_dev, and pass wilc to the function as well.

Signed-off-by: Glen Lee <glen.lee@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/wilc1000/linux_wlan_spi.c
drivers/staging/wilc1000/linux_wlan_spi.h
drivers/staging/wilc1000/wilc_spi.c

index bfd3cc39149468708f16057b91ce23310ff71261..7be750bbe9da8769433b1edc94d354be93ba0bff 100644 (file)
@@ -66,9 +66,9 @@ int wilc_spi_init(void)
        return 1;
 }
 
-int wilc_spi_write(u8 *b, u32 len)
+int wilc_spi_write(struct wilc *wilc, u8 *b, u32 len)
 {
-       struct spi_device *spi = to_spi_device(wilc_dev->dev);
+       struct spi_device *spi = to_spi_device(wilc->dev);
        int ret;
        struct spi_message msg;
 
index baa98cc9a247e603b5bfcbd404f00fe35a6f19ab..41d47dc9cf95966c4cfd55e92ff723989eb0cd43 100644 (file)
@@ -2,9 +2,10 @@
 #define LINUX_WLAN_SPI_H
 
 #include <linux/spi/spi.h>
+#include "wilc_wfi_netdevice.h"
 
 int wilc_spi_init(void);
-int wilc_spi_write(u8 *b, u32 len);
+int wilc_spi_write(struct wilc *wilc, u8 *b, u32 len);
 int wilc_spi_read(u8 *rb, u32 rlen);
 int wilc_spi_write_read(u8 *wb, u8 *rb, u32 rlen);
 #endif
index 53d098f8015686e921ca9603845259fd29936f89..46f7ea83577024eacd6a04c09e7c11ac8d7294ba 100644 (file)
@@ -482,7 +482,7 @@ static int spi_data_write(struct wilc *wilc, u8 *b, u32 sz)
                                order = 0x2;
                }
                cmd |= order;
-               if (!wilc_spi_write(&cmd, 1)) {
+               if (!wilc_spi_write(wilc, &cmd, 1)) {
                        PRINT_ER("[wilc spi]: Failed data block cmd write, bus error...\n");
                        result = N_FAIL;
                        break;
@@ -491,7 +491,7 @@ static int spi_data_write(struct wilc *wilc, u8 *b, u32 sz)
                /**
                 *      Write data
                 **/
-               if (!wilc_spi_write(&b[ix], nbytes)) {
+               if (!wilc_spi_write(wilc, &b[ix], nbytes)) {
                        PRINT_ER("[wilc spi]: Failed data block write, bus error...\n");
                        result = N_FAIL;
                        break;
@@ -501,7 +501,7 @@ static int spi_data_write(struct wilc *wilc, u8 *b, u32 sz)
                 *      Write Crc
                 **/
                if (!g_spi.crc_off) {
-                       if (!wilc_spi_write(crc, 2)) {
+                       if (!wilc_spi_write(wilc, crc, 2)) {
                                PRINT_ER("[wilc spi]: Failed data block crc write, bus error...\n");
                                result = N_FAIL;
                                break;