From 158ea970eacf136aae5a95aeccd17838db5d827c Mon Sep 17 00:00:00 2001 From: Leandro Pereira Date: Fri, 1 Jun 2018 12:32:25 -0700 Subject: [PATCH] drivers: watchdog: Use common name configuration for all drivers Each driver seemed to use their own Kconfig option to set the name for their drivers. This makes writing example/test code difficult as each one of them will have to special case for each of the supported platforms. Use a consistent CONFIG_WDT_0_NAME option in all drivers. Fixes #8094. Signed-off-by: Leandro Pereira --- drivers/watchdog/Kconfig | 10 ++++++++++ drivers/watchdog/Kconfig.cmsdk_apb | 7 ------- drivers/watchdog/Kconfig.esp32 | 7 ------- drivers/watchdog/Kconfig.qmsi | 7 ------- drivers/watchdog/Kconfig.sam | 7 ------- drivers/watchdog/Kconfig.stm32 | 7 ------- drivers/watchdog/iwdg_stm32.c | 2 +- drivers/watchdog/wdog_cmsdk_apb.c | 2 +- drivers/watchdog/wdt_esp32.c | 2 +- drivers/watchdog/wdt_sam.c | 2 +- drivers/watchdog/wdt_sam0.c | 2 +- 11 files changed, 15 insertions(+), 40 deletions(-) diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig index b2ee6eab7a0..4d5e12edd8e 100644 --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig @@ -14,6 +14,16 @@ menuconfig WATCHDOG if WATCHDOG +if !HAS_DTS_WDT + +config WDT_0_NAME + string "Watchdog driver instance name" + default "WATCHDOG_0" + help + Set the name used by the watchdog device during registation. + +endif # HAS_DTS_WDT + config WDT_DISABLE_AT_BOOT bool prompt "Disable at boot" diff --git a/drivers/watchdog/Kconfig.cmsdk_apb b/drivers/watchdog/Kconfig.cmsdk_apb index 0cb8fb501f9..28d23d72b37 100644 --- a/drivers/watchdog/Kconfig.cmsdk_apb +++ b/drivers/watchdog/Kconfig.cmsdk_apb @@ -25,11 +25,4 @@ config WDOG_CMSDK_APB_START_AT_BOOT it must be reloaded before the counter reaches 0, otherwise the MCU will be reset. -config WDOG_CMSDK_APB_DEVICE_NAME - string "Device name for CMSDK APB Watchdog" - depends on WDOG_CMSDK_APB - default "WATCHDOG_0" - help - Set the name used by WDOG device during registration. - endif # SOC_FAMILY_ARM diff --git a/drivers/watchdog/Kconfig.esp32 b/drivers/watchdog/Kconfig.esp32 index 0fb7e0e95c9..167cac26141 100644 --- a/drivers/watchdog/Kconfig.esp32 +++ b/drivers/watchdog/Kconfig.esp32 @@ -12,13 +12,6 @@ menuconfig WDT_ESP32 help Enable WDT driver for ESP32. -config WDT_ESP32_DEVICE_NAME - string "Device name for Watchdog (WDT)" - depends on WDT_ESP32 - default "WATCHDOG_0" - help - Set the name used by WDT device during registration. - config WDT_ESP32_IRQ int "IRQ line for watchdog interrupt" depends on WDT_ESP32 diff --git a/drivers/watchdog/Kconfig.qmsi b/drivers/watchdog/Kconfig.qmsi index d6b9f489029..5c4e775c7e8 100644 --- a/drivers/watchdog/Kconfig.qmsi +++ b/drivers/watchdog/Kconfig.qmsi @@ -14,13 +14,6 @@ config WDT_QMSI This driver is simply a shim driver based on the watchdog driver provided by the QMSI BSP. -config WDT_0_NAME - string "Watchdog driver instance name" - default "WATCHDOG_0" - depends on WDT_QMSI - help - Watchdog driver instance name - config WDT_0_IRQ_PRI int "Interrupt priority" depends on WDT_QMSI diff --git a/drivers/watchdog/Kconfig.sam b/drivers/watchdog/Kconfig.sam index df396dff7e5..52f4104bd23 100644 --- a/drivers/watchdog/Kconfig.sam +++ b/drivers/watchdog/Kconfig.sam @@ -18,10 +18,3 @@ config WDT_SAM_DISABLE_AT_BOOT default y help Select this option to disable the WDT during boot. - -config WDT_SAM_DEVICE_NAME - string "Device name for Watchdog (WDT)" - depends on WDT_SAM - default "WDT" - help - Set the name used by WDT device during registration. diff --git a/drivers/watchdog/Kconfig.stm32 b/drivers/watchdog/Kconfig.stm32 index 812e95102e8..3022eef7105 100644 --- a/drivers/watchdog/Kconfig.stm32 +++ b/drivers/watchdog/Kconfig.stm32 @@ -22,13 +22,6 @@ config IWDG_STM32_START_AT_BOOT it must be reloaded before the counter reaches 0, otherwise the MCU will be reset. -config IWDG_STM32_DEVICE_NAME - string "Device name for Independent Watchdog (IWDG)" - depends on IWDG_STM32 - default "IWDG" - help - Set the name used by IWDG device during registration. - config IWDG_STM32_TIMEOUT int "Value for IWDG timeout in [us]" depends on IWDG_STM32 diff --git a/drivers/watchdog/iwdg_stm32.c b/drivers/watchdog/iwdg_stm32.c index 33c2f1f62bf..c143ac07f8d 100644 --- a/drivers/watchdog/iwdg_stm32.c +++ b/drivers/watchdog/iwdg_stm32.c @@ -173,7 +173,7 @@ static struct iwdg_stm32_data iwdg_stm32_dev_data = { .Instance = IWDG }; -DEVICE_AND_API_INIT(iwdg_stm32, CONFIG_IWDG_STM32_DEVICE_NAME, +DEVICE_AND_API_INIT(iwdg_stm32, CONFIG_WDT_0_NAME, iwdg_stm32_init, &iwdg_stm32_dev_data, NULL, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &iwdg_stm32_api); diff --git a/drivers/watchdog/wdog_cmsdk_apb.c b/drivers/watchdog/wdog_cmsdk_apb.c index e0a9f4cc455..cebb4199a9c 100644 --- a/drivers/watchdog/wdog_cmsdk_apb.c +++ b/drivers/watchdog/wdog_cmsdk_apb.c @@ -202,7 +202,7 @@ static int wdog_cmsdk_apb_init(struct device *dev) return 0; } -DEVICE_AND_API_INIT(wdog_cmsdk_apb, CONFIG_WDOG_CMSDK_APB_DEVICE_NAME, +DEVICE_AND_API_INIT(wdog_cmsdk_apb, CONFIG_WDT_0_NAME, wdog_cmsdk_apb_init, NULL, NULL, PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, diff --git a/drivers/watchdog/wdt_esp32.c b/drivers/watchdog/wdt_esp32.c index 67a4a35afc2..2ad50cfec98 100644 --- a/drivers/watchdog/wdt_esp32.c +++ b/drivers/watchdog/wdt_esp32.c @@ -228,7 +228,7 @@ static const struct wdt_driver_api wdt_api = { .reload = wdt_esp32_reload }; -DEVICE_AND_API_INIT(wdt_esp32, CONFIG_WDT_ESP32_DEVICE_NAME, wdt_esp32_init, +DEVICE_AND_API_INIT(wdt_esp32, CONFIG_WDT_0_NAME, wdt_esp32_init, &shared_data, NULL, PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &wdt_api); diff --git a/drivers/watchdog/wdt_sam.c b/drivers/watchdog/wdt_sam.c index 1051466a9b2..fbd95c1a50a 100644 --- a/drivers/watchdog/wdt_sam.c +++ b/drivers/watchdog/wdt_sam.c @@ -90,7 +90,7 @@ static const struct wdt_sam_dev_cfg wdt_sam_config = { .regs = WDT }; -DEVICE_AND_API_INIT(wdt_sam, CONFIG_WDT_SAM_DEVICE_NAME, wdt_sam_init, +DEVICE_AND_API_INIT(wdt_sam, CONFIG_WDT_0_NAME, wdt_sam_init, NULL, &wdt_sam_config, PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &wdt_sam_api); diff --git a/drivers/watchdog/wdt_sam0.c b/drivers/watchdog/wdt_sam0.c index dea5dd16be6..ef11f33e5d3 100644 --- a/drivers/watchdog/wdt_sam0.c +++ b/drivers/watchdog/wdt_sam0.c @@ -153,6 +153,6 @@ static int wdt_sam0_init(struct device *dev) static struct wdt_sam0_dev_data wdt_sam0_data; -DEVICE_AND_API_INIT(wdt_sam0, CONFIG_WDT_SAM0_LABEL, wdt_sam0_init, +DEVICE_AND_API_INIT(wdt_sam0, CONFIG_WDT_0_NAME, wdt_sam0_init, &wdt_sam0_data, NULL, PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &wdt_sam0_api);