static DECLARE_RWSEM(sc8800_wsem);
struct sc8800_data *g_sc8800 = NULL;
-char tmp_buf[1024];
+void *tmp_buf = NULL;
static int bp_rts(struct sc8800_data *sc8800)
{
return gpio_get_value(sc8800->slav_rts);
struct spi_message message;
struct spi_transfer tran;
+ tmp_buf = kzalloc(len, GFP_KERNEL);
+ if(!tmp_buf){
+ *err = -ENOMEM;
+ return;
+ }
+
buf_swp(tx_buf, len);
tran.tx_buf = (void *)tx_buf;
spi_message_add_tail(&tran, &message);
*err = spi_sync(sc8800->spi, &message);
sc8800_print_buf(sc8800, tx_buf, __func__, len);
+ kfree(tmp_buf);
}
static void spi_out(struct sc8800_data *sc8800, char *rx_buf, unsigned len, int* err)
struct spi_message message;
struct spi_transfer tran;
+ tmp_buf = kzalloc(len, GFP_KERNEL);
+ if(!tmp_buf){
+ *err = -ENOMEM;
+ return;
+ }
+
memset(rx_buf, 0, len);
tran.tx_buf = tmp_buf;
tran.rx_buf = (void *)rx_buf;
sc8800_print_buf(sc8800, rx_buf, __func__, len);
buf_swp(rx_buf, len);
+ kfree(tmp_buf);
}
static int ap_get_head(struct sc8800_data *sc8800, struct bp_head *packet)