refactor(gpio): add esp_err_t return type to gpio_uninstall_isr_service

Closes https://github.com/espressif/esp-idf/issues/14114
This commit is contained in:
Song Ruo Jing
2025-11-07 15:26:52 +08:00
parent 266c06354d
commit 56cbd596f5
4 changed files with 11 additions and 4 deletions
@@ -344,8 +344,11 @@ esp_err_t gpio_install_isr_service(int intr_alloc_flags);
/** /**
* @brief Uninstall the driver's GPIO ISR service, freeing related resources. * @brief Uninstall the driver's GPIO ISR service, freeing related resources.
*
* @return
* - ESP_OK Success
*/ */
void gpio_uninstall_isr_service(void); esp_err_t gpio_uninstall_isr_service(void);
/** /**
* @brief Add ISR handler for the corresponding GPIO pin. * @brief Add ISR handler for the corresponding GPIO pin.
+3 -3
View File
@@ -579,14 +579,14 @@ esp_err_t gpio_isr_handler_remove(gpio_num_t gpio_num)
return ESP_OK; return ESP_OK;
} }
void gpio_uninstall_isr_service(void) esp_err_t gpio_uninstall_isr_service(void)
{ {
gpio_isr_func_t *gpio_isr_func_free = NULL; gpio_isr_func_t *gpio_isr_func_free = NULL;
gpio_isr_handle_t gpio_isr_handle_free = NULL; gpio_isr_handle_t gpio_isr_handle_free = NULL;
portENTER_CRITICAL(&gpio_context.gpio_spinlock); portENTER_CRITICAL(&gpio_context.gpio_spinlock);
if (gpio_context.gpio_isr_func == NULL) { if (gpio_context.gpio_isr_func == NULL) {
portEXIT_CRITICAL(&gpio_context.gpio_spinlock); portEXIT_CRITICAL(&gpio_context.gpio_spinlock);
return; return ESP_OK;
} }
gpio_isr_func_free = gpio_context.gpio_isr_func; gpio_isr_func_free = gpio_context.gpio_isr_func;
gpio_context.gpio_isr_func = NULL; gpio_context.gpio_isr_func = NULL;
@@ -596,7 +596,7 @@ void gpio_uninstall_isr_service(void)
portEXIT_CRITICAL(&gpio_context.gpio_spinlock); portEXIT_CRITICAL(&gpio_context.gpio_spinlock);
esp_intr_free(gpio_isr_handle_free); esp_intr_free(gpio_isr_handle_free);
free(gpio_isr_func_free); free(gpio_isr_func_free);
return; return ESP_OK;
} }
static void gpio_isr_register_on_core_static(void *param) static void gpio_isr_register_on_core_static(void *param)
@@ -117,6 +117,8 @@ GPIO
- ``MAX_PAD_GPIO_NUM``, ``MAX_GPIO_NUM``, and ``DIG_IO_HOLD_BIT_SHIFT`` macros have been removed. - ``MAX_PAD_GPIO_NUM``, ``MAX_GPIO_NUM``, and ``DIG_IO_HOLD_BIT_SHIFT`` macros have been removed.
- Added the :cpp:type:`esp_err_t` return type to :func:`gpio_uninstall_isr_service`.
LEDC LEDC
---- ----
@@ -117,6 +117,8 @@ GPIO
- ``MAX_PAD_GPIO_NUM``、 ``MAX_GPIO_NUM`` 和 ``DIG_IO_HOLD_BIT_SHIFT`` 宏已被移除。 - ``MAX_PAD_GPIO_NUM``、 ``MAX_GPIO_NUM`` 和 ``DIG_IO_HOLD_BIT_SHIFT`` 宏已被移除。
- 为 :func:`gpio_uninstall_isr_service` 添加了 :cpp:type:`esp_err_t` 返回类型。
LEDC LEDC
---- ----