diff options
author | Hauke Mehrtens <hauke@hauke-m.de> | 2013-02-03 17:25:33 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2013-02-04 16:46:24 -0500 |
commit | c50ae9470e542862f782e2d9c106270152bbf3ce (patch) | |
tree | d9b17d4f6427e7b2bb35a0ecdf08f1891dbcc9e5 | |
parent | a5ffbe0a1993a27072742ef7db6cf9839956fce9 (diff) |
bcma: unregister gpios before unloading bcma
This patch unregisters the gpio chip before bcma gets unloaded.
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Reported-by: Piotr Haber <phaber@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/bcma/bcma_private.h | 5 | ||||
-rw-r--r-- | drivers/bcma/driver_gpio.c | 5 | ||||
-rw-r--r-- | drivers/bcma/main.c | 7 |
3 files changed, 17 insertions, 0 deletions
diff --git a/drivers/bcma/bcma_private.h b/drivers/bcma/bcma_private.h index 4a2d72ec6d43..966ce4d05791 100644 --- a/drivers/bcma/bcma_private.h +++ b/drivers/bcma/bcma_private.h | |||
@@ -94,11 +94,16 @@ void __devinit bcma_core_pci_hostmode_init(struct bcma_drv_pci *pc); | |||
94 | #ifdef CONFIG_BCMA_DRIVER_GPIO | 94 | #ifdef CONFIG_BCMA_DRIVER_GPIO |
95 | /* driver_gpio.c */ | 95 | /* driver_gpio.c */ |
96 | int bcma_gpio_init(struct bcma_drv_cc *cc); | 96 | int bcma_gpio_init(struct bcma_drv_cc *cc); |
97 | int bcma_gpio_unregister(struct bcma_drv_cc *cc); | ||
97 | #else | 98 | #else |
98 | static inline int bcma_gpio_init(struct bcma_drv_cc *cc) | 99 | static inline int bcma_gpio_init(struct bcma_drv_cc *cc) |
99 | { | 100 | { |
100 | return -ENOTSUPP; | 101 | return -ENOTSUPP; |
101 | } | 102 | } |
103 | static inline int bcma_gpio_unregister(struct bcma_drv_cc *cc) | ||
104 | { | ||
105 | return 0; | ||
106 | } | ||
102 | #endif /* CONFIG_BCMA_DRIVER_GPIO */ | 107 | #endif /* CONFIG_BCMA_DRIVER_GPIO */ |
103 | 108 | ||
104 | #endif | 109 | #endif |
diff --git a/drivers/bcma/driver_gpio.c b/drivers/bcma/driver_gpio.c index 9a6f585da2d9..71f755c06fc6 100644 --- a/drivers/bcma/driver_gpio.c +++ b/drivers/bcma/driver_gpio.c | |||
@@ -96,3 +96,8 @@ int bcma_gpio_init(struct bcma_drv_cc *cc) | |||
96 | 96 | ||
97 | return gpiochip_add(chip); | 97 | return gpiochip_add(chip); |
98 | } | 98 | } |
99 | |||
100 | int bcma_gpio_unregister(struct bcma_drv_cc *cc) | ||
101 | { | ||
102 | return gpiochip_remove(&cc->gpio); | ||
103 | } | ||
diff --git a/drivers/bcma/main.c b/drivers/bcma/main.c index 53ba20ca17e0..e08b9c604448 100644 --- a/drivers/bcma/main.c +++ b/drivers/bcma/main.c | |||
@@ -268,6 +268,13 @@ int __devinit bcma_bus_register(struct bcma_bus *bus) | |||
268 | void bcma_bus_unregister(struct bcma_bus *bus) | 268 | void bcma_bus_unregister(struct bcma_bus *bus) |
269 | { | 269 | { |
270 | struct bcma_device *cores[3]; | 270 | struct bcma_device *cores[3]; |
271 | int err; | ||
272 | |||
273 | err = bcma_gpio_unregister(&bus->drv_cc); | ||
274 | if (err == -EBUSY) | ||
275 | bcma_err(bus, "Some GPIOs are still in use.\n"); | ||
276 | else if (err) | ||
277 | bcma_err(bus, "Can not unregister GPIO driver: %i\n", err); | ||
271 | 278 | ||
272 | cores[0] = bcma_find_core(bus, BCMA_CORE_MIPS_74K); | 279 | cores[0] = bcma_find_core(bus, BCMA_CORE_MIPS_74K); |
273 | cores[1] = bcma_find_core(bus, BCMA_CORE_PCIE); | 280 | cores[1] = bcma_find_core(bus, BCMA_CORE_PCIE); |