Skip to content

Commit f4b694a

Browse files
committed
Resolved reconnect issue
1 parent dacac83 commit f4b694a

File tree

3 files changed

+13
-29
lines changed

3 files changed

+13
-29
lines changed

host/linux/host_driver/esp32/main.c

+13
Original file line numberDiff line numberDiff line change
@@ -728,11 +728,24 @@ static int __init esp_init(void)
728728
deinit_adapter();
729729
}
730730

731+
#ifdef CONFIG_SUPPORT_ESP_SERIAL
732+
/* Create the char devices */
733+
ret = esp_serial_init((void *)adapter);
734+
if (ret != 0) {
735+
printk(KERN_ERR "Error initialising serial char devices!\n");
736+
return ret;
737+
}
738+
#endif
739+
731740
return ret;
732741
}
733742

734743
static void __exit esp_exit(void)
735744
{
745+
#ifdef CONFIG_SUPPORT_ESP_SERIAL
746+
/* Remove the char devices */
747+
esp_serial_cleanup();
748+
#endif
736749
esp_deinit_interface_layer();
737750
deinit_adapter();
738751
if (resetpin != HOST_GPIO_PIN_INVALID) {

host/linux/host_driver/esp32/sdio/esp_sdio.c

-16
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@
2727
#include "esp_sdio_api.h"
2828
#include "esp_api.h"
2929
#include "esp_bt_api.h"
30-
#ifdef CONFIG_SUPPORT_ESP_SERIAL
31-
#include "esp_serial.h"
32-
#endif
3330
#include <linux/kthread.h>
3431
#include <linux/printk.h>
3532

@@ -261,10 +258,6 @@ static void esp_remove(struct sdio_func *func)
261258

262259
printk(KERN_INFO "%s -> Remove card", __func__);
263260

264-
#ifdef CONFIG_SUPPORT_ESP_SERIAL
265-
esp_serial_cleanup();
266-
#endif
267-
268261
#ifdef CONFIG_ENABLE_MONITOR_PROCESS
269262
if (monitor_thread)
270263
kthread_stop(monitor_thread);
@@ -714,15 +707,6 @@ static int esp_probe(struct sdio_func *func,
714707
if (!tx_thread)
715708
printk (KERN_ERR "Failed to create esp32_sdio TX thread\n");
716709

717-
#ifdef CONFIG_SUPPORT_ESP_SERIAL
718-
ret = esp_serial_init((void *) context->adapter);
719-
if (ret != 0) {
720-
esp_remove(func);
721-
printk(KERN_ERR "Error initialising serial interface\n");
722-
return ret;
723-
}
724-
#endif
725-
726710
ret = esp_add_card(context->adapter);
727711
if (ret) {
728712
esp_remove(func);

host/linux/host_driver/esp32/spi/esp_spi.c

-13
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@
2323
#include "esp_if.h"
2424
#include "esp_api.h"
2525
#include "esp_bt_api.h"
26-
#ifdef CONFIG_SUPPORT_ESP_SERIAL
27-
#include "esp_serial.h"
28-
#endif
2926

3027
#define SPI_INITIAL_CLK_MHZ 10
3128
#define NUMBER_1M 1000000
@@ -493,15 +490,6 @@ static int spi_init(void)
493490
return status;
494491
}
495492

496-
#ifdef CONFIG_SUPPORT_ESP_SERIAL
497-
status = esp_serial_init((void *) spi_context.adapter);
498-
if (status != 0) {
499-
spi_exit();
500-
printk(KERN_ERR "Error initialising serial interface\n");
501-
return status;
502-
}
503-
#endif
504-
505493
status = esp_add_card(spi_context.adapter);
506494
if (status) {
507495
spi_exit();
@@ -530,7 +518,6 @@ static void spi_exit(void)
530518
spi_context.spi_workqueue = NULL;
531519
}
532520

533-
esp_serial_cleanup();
534521
esp_remove_card(spi_context.adapter);
535522

536523
if (spi_context.adapter->hcidev)

0 commit comments

Comments
 (0)