From f4b694afd469c144fe41636f09a4c519b67d8f7f Mon Sep 17 00:00:00 2001 From: Dave Whitters Date: Thu, 13 Jan 2022 07:57:56 -0500 Subject: [PATCH] Resolved reconnect issue --- host/linux/host_driver/esp32/main.c | 13 +++++++++++++ host/linux/host_driver/esp32/sdio/esp_sdio.c | 16 ---------------- host/linux/host_driver/esp32/spi/esp_spi.c | 13 ------------- 3 files changed, 13 insertions(+), 29 deletions(-) diff --git a/host/linux/host_driver/esp32/main.c b/host/linux/host_driver/esp32/main.c index e005180019..e94844856b 100644 --- a/host/linux/host_driver/esp32/main.c +++ b/host/linux/host_driver/esp32/main.c @@ -728,11 +728,24 @@ static int __init esp_init(void) deinit_adapter(); } +#ifdef CONFIG_SUPPORT_ESP_SERIAL + /* Create the char devices */ + ret = esp_serial_init((void *)adapter); + if (ret != 0) { + printk(KERN_ERR "Error initialising serial char devices!\n"); + return ret; + } +#endif + return ret; } static void __exit esp_exit(void) { +#ifdef CONFIG_SUPPORT_ESP_SERIAL + /* Remove the char devices */ + esp_serial_cleanup(); +#endif esp_deinit_interface_layer(); deinit_adapter(); if (resetpin != HOST_GPIO_PIN_INVALID) { diff --git a/host/linux/host_driver/esp32/sdio/esp_sdio.c b/host/linux/host_driver/esp32/sdio/esp_sdio.c index 8768e6529c..4a5c0c2f5e 100644 --- a/host/linux/host_driver/esp32/sdio/esp_sdio.c +++ b/host/linux/host_driver/esp32/sdio/esp_sdio.c @@ -27,9 +27,6 @@ #include "esp_sdio_api.h" #include "esp_api.h" #include "esp_bt_api.h" -#ifdef CONFIG_SUPPORT_ESP_SERIAL -#include "esp_serial.h" -#endif #include #include @@ -261,10 +258,6 @@ static void esp_remove(struct sdio_func *func) printk(KERN_INFO "%s -> Remove card", __func__); -#ifdef CONFIG_SUPPORT_ESP_SERIAL - esp_serial_cleanup(); -#endif - #ifdef CONFIG_ENABLE_MONITOR_PROCESS if (monitor_thread) kthread_stop(monitor_thread); @@ -714,15 +707,6 @@ static int esp_probe(struct sdio_func *func, if (!tx_thread) printk (KERN_ERR "Failed to create esp32_sdio TX thread\n"); -#ifdef CONFIG_SUPPORT_ESP_SERIAL - ret = esp_serial_init((void *) context->adapter); - if (ret != 0) { - esp_remove(func); - printk(KERN_ERR "Error initialising serial interface\n"); - return ret; - } -#endif - ret = esp_add_card(context->adapter); if (ret) { esp_remove(func); diff --git a/host/linux/host_driver/esp32/spi/esp_spi.c b/host/linux/host_driver/esp32/spi/esp_spi.c index 3a9bedf393..c354e72eac 100644 --- a/host/linux/host_driver/esp32/spi/esp_spi.c +++ b/host/linux/host_driver/esp32/spi/esp_spi.c @@ -23,9 +23,6 @@ #include "esp_if.h" #include "esp_api.h" #include "esp_bt_api.h" -#ifdef CONFIG_SUPPORT_ESP_SERIAL -#include "esp_serial.h" -#endif #define SPI_INITIAL_CLK_MHZ 10 #define NUMBER_1M 1000000 @@ -493,15 +490,6 @@ static int spi_init(void) return status; } -#ifdef CONFIG_SUPPORT_ESP_SERIAL - status = esp_serial_init((void *) spi_context.adapter); - if (status != 0) { - spi_exit(); - printk(KERN_ERR "Error initialising serial interface\n"); - return status; - } -#endif - status = esp_add_card(spi_context.adapter); if (status) { spi_exit(); @@ -530,7 +518,6 @@ static void spi_exit(void) spi_context.spi_workqueue = NULL; } - esp_serial_cleanup(); esp_remove_card(spi_context.adapter); if (spi_context.adapter->hcidev)