diff options
| author | William Breathitt Gray <vilhelm.gray@gmail.com> | 2016-05-01 18:44:26 -0400 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-05-02 12:32:04 -0400 |
| commit | 4ef1bec4e4f393aa96d2b5345bb08baabaec8ee1 (patch) | |
| tree | 982095264b13c0e514bf386b080237e2307c5753 | |
| parent | 9c2cfc19e64a513a1b9e55f78e38661a1b97b91e (diff) | |
watchdog: ebc-c384_wdt: Utilize the ISA bus driver
The WinSystems EBC-C384 watchdog timer is controlled via ISA bus
communication. As such, the ISA bus driver is more appropriate than the
platform driver for the WinSystems EBC-C384 watchdog timer driver.
Cc: Wim Van Sebroeck <wim@iguana.be>
Acked-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| -rw-r--r-- | drivers/watchdog/Kconfig | 2 | ||||
| -rw-r--r-- | drivers/watchdog/ebc-c384_wdt.c | 43 |
2 files changed, 11 insertions, 34 deletions
diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig index fb947655badd..0aefe2510e42 100644 --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig | |||
| @@ -738,7 +738,7 @@ config ALIM7101_WDT | |||
| 738 | 738 | ||
| 739 | config EBC_C384_WDT | 739 | config EBC_C384_WDT |
| 740 | tristate "WinSystems EBC-C384 Watchdog Timer" | 740 | tristate "WinSystems EBC-C384 Watchdog Timer" |
| 741 | depends on X86 | 741 | depends on X86 && ISA |
| 742 | select WATCHDOG_CORE | 742 | select WATCHDOG_CORE |
| 743 | help | 743 | help |
| 744 | Enables watchdog timer support for the watchdog timer on the | 744 | Enables watchdog timer support for the watchdog timer on the |
diff --git a/drivers/watchdog/ebc-c384_wdt.c b/drivers/watchdog/ebc-c384_wdt.c index 77fda0b4b90e..4b849b8e37c2 100644 --- a/drivers/watchdog/ebc-c384_wdt.c +++ b/drivers/watchdog/ebc-c384_wdt.c | |||
| @@ -16,10 +16,10 @@ | |||
| 16 | #include <linux/errno.h> | 16 | #include <linux/errno.h> |
| 17 | #include <linux/io.h> | 17 | #include <linux/io.h> |
| 18 | #include <linux/ioport.h> | 18 | #include <linux/ioport.h> |
| 19 | #include <linux/isa.h> | ||
| 19 | #include <linux/kernel.h> | 20 | #include <linux/kernel.h> |
| 20 | #include <linux/module.h> | 21 | #include <linux/module.h> |
| 21 | #include <linux/moduleparam.h> | 22 | #include <linux/moduleparam.h> |
| 22 | #include <linux/platform_device.h> | ||
| 23 | #include <linux/types.h> | 23 | #include <linux/types.h> |
| 24 | #include <linux/watchdog.h> | 24 | #include <linux/watchdog.h> |
| 25 | 25 | ||
| @@ -95,9 +95,8 @@ static const struct watchdog_info ebc_c384_wdt_info = { | |||
| 95 | .identity = MODULE_NAME | 95 | .identity = MODULE_NAME |
| 96 | }; | 96 | }; |
| 97 | 97 | ||
| 98 | static int __init ebc_c384_wdt_probe(struct platform_device *pdev) | 98 | static int ebc_c384_wdt_probe(struct device *dev, unsigned int id) |
| 99 | { | 99 | { |
| 100 | struct device *dev = &pdev->dev; | ||
| 101 | struct watchdog_device *wdd; | 100 | struct watchdog_device *wdd; |
| 102 | 101 | ||
| 103 | if (!devm_request_region(dev, BASE_ADDR, ADDR_EXTENT, dev_name(dev))) { | 102 | if (!devm_request_region(dev, BASE_ADDR, ADDR_EXTENT, dev_name(dev))) { |
| @@ -122,61 +121,39 @@ static int __init ebc_c384_wdt_probe(struct platform_device *pdev) | |||
| 122 | dev_warn(dev, "Invalid timeout (%u seconds), using default (%u seconds)\n", | 121 | dev_warn(dev, "Invalid timeout (%u seconds), using default (%u seconds)\n", |
| 123 | timeout, WATCHDOG_TIMEOUT); | 122 | timeout, WATCHDOG_TIMEOUT); |
| 124 | 123 | ||
| 125 | platform_set_drvdata(pdev, wdd); | 124 | dev_set_drvdata(dev, wdd); |
| 126 | 125 | ||
| 127 | return watchdog_register_device(wdd); | 126 | return watchdog_register_device(wdd); |
| 128 | } | 127 | } |
| 129 | 128 | ||
| 130 | static int ebc_c384_wdt_remove(struct platform_device *pdev) | 129 | static int ebc_c384_wdt_remove(struct device *dev, unsigned int id) |
| 131 | { | 130 | { |
| 132 | struct watchdog_device *wdd = platform_get_drvdata(pdev); | 131 | struct watchdog_device *wdd = dev_get_drvdata(dev); |
| 133 | 132 | ||
| 134 | watchdog_unregister_device(wdd); | 133 | watchdog_unregister_device(wdd); |
| 135 | 134 | ||
| 136 | return 0; | 135 | return 0; |
| 137 | } | 136 | } |
| 138 | 137 | ||
| 139 | static struct platform_driver ebc_c384_wdt_driver = { | 138 | static struct isa_driver ebc_c384_wdt_driver = { |
| 139 | .probe = ebc_c384_wdt_probe, | ||
| 140 | .driver = { | 140 | .driver = { |
| 141 | .name = MODULE_NAME | 141 | .name = MODULE_NAME |
| 142 | }, | 142 | }, |
| 143 | .remove = ebc_c384_wdt_remove | 143 | .remove = ebc_c384_wdt_remove |
| 144 | }; | 144 | }; |
| 145 | 145 | ||
| 146 | static struct platform_device *ebc_c384_wdt_device; | ||
| 147 | |||
| 148 | static int __init ebc_c384_wdt_init(void) | 146 | static int __init ebc_c384_wdt_init(void) |
| 149 | { | 147 | { |
| 150 | int err; | ||
| 151 | |||
| 152 | if (!dmi_match(DMI_BOARD_NAME, "EBC-C384 SBC")) | 148 | if (!dmi_match(DMI_BOARD_NAME, "EBC-C384 SBC")) |
| 153 | return -ENODEV; | 149 | return -ENODEV; |
| 154 | 150 | ||
| 155 | ebc_c384_wdt_device = platform_device_alloc(MODULE_NAME, -1); | 151 | return isa_register_driver(&ebc_c384_wdt_driver, 1); |
| 156 | if (!ebc_c384_wdt_device) | ||
| 157 | return -ENOMEM; | ||
| 158 | |||
| 159 | err = platform_device_add(ebc_c384_wdt_device); | ||
| 160 | if (err) | ||
| 161 | goto err_platform_device; | ||
| 162 | |||
| 163 | err = platform_driver_probe(&ebc_c384_wdt_driver, ebc_c384_wdt_probe); | ||
| 164 | if (err) | ||
| 165 | goto err_platform_driver; | ||
| 166 | |||
| 167 | return 0; | ||
| 168 | |||
| 169 | err_platform_driver: | ||
| 170 | platform_device_del(ebc_c384_wdt_device); | ||
| 171 | err_platform_device: | ||
| 172 | platform_device_put(ebc_c384_wdt_device); | ||
| 173 | return err; | ||
| 174 | } | 152 | } |
| 175 | 153 | ||
| 176 | static void __exit ebc_c384_wdt_exit(void) | 154 | static void __exit ebc_c384_wdt_exit(void) |
| 177 | { | 155 | { |
| 178 | platform_device_unregister(ebc_c384_wdt_device); | 156 | isa_unregister_driver(&ebc_c384_wdt_driver); |
| 179 | platform_driver_unregister(&ebc_c384_wdt_driver); | ||
| 180 | } | 157 | } |
| 181 | 158 | ||
| 182 | module_init(ebc_c384_wdt_init); | 159 | module_init(ebc_c384_wdt_init); |
| @@ -185,4 +162,4 @@ module_exit(ebc_c384_wdt_exit); | |||
| 185 | MODULE_AUTHOR("William Breathitt Gray <vilhelm.gray@gmail.com>"); | 162 | MODULE_AUTHOR("William Breathitt Gray <vilhelm.gray@gmail.com>"); |
| 186 | MODULE_DESCRIPTION("WinSystems EBC-C384 watchdog timer driver"); | 163 | MODULE_DESCRIPTION("WinSystems EBC-C384 watchdog timer driver"); |
| 187 | MODULE_LICENSE("GPL v2"); | 164 | MODULE_LICENSE("GPL v2"); |
| 188 | MODULE_ALIAS("platform:" MODULE_NAME); | 165 | MODULE_ALIAS("isa:" MODULE_NAME); |
