WLAN: WCN1314: Add shutdown handler support.
Function driver can register for shutdown notifications.
Before shutdown, lets notify the same to function driver
and allow it to cleanup.
Change-Id: Ie95342ac37e822d1679370597a22ba222b199686
Signed-off-by: Pavan kumar <pavan@codeaurora.org>
diff --git a/drivers/net/wireless/libra/libra_sdioif.c b/drivers/net/wireless/libra/libra_sdioif.c
index 9b90184..8cfc0fa 100644
--- a/drivers/net/wireless/libra/libra_sdioif.c
+++ b/drivers/net/wireless/libra/libra_sdioif.c
@@ -29,6 +29,7 @@
static suspend_handler_t *libra_suspend_hldr;
static resume_handler_t *libra_resume_hldr;
static notify_card_removal_t *libra_notify_card_removal_hdlr;
+static shutdown_handler_t *libra_sdio_shutdown_hdlr;
int libra_enable_sdio_irq_in_chip(struct sdio_func *func, u8 enable)
{
@@ -452,6 +453,23 @@
#define libra_sdio_resume 0
#endif
+static void libra_sdio_shutdown(struct device *dev)
+{
+ if (libra_sdio_shutdown_hdlr) {
+ libra_sdio_shutdown_hdlr();
+ printk(KERN_INFO "%s : Notified shutdown event to Libra driver.\n",
+ __func__);
+ }
+}
+
+int libra_sdio_register_shutdown_hdlr(
+ shutdown_handler_t *libra_shutdown_hdlr)
+{
+ libra_sdio_shutdown_hdlr = libra_shutdown_hdlr;
+ return 0;
+}
+EXPORT_SYMBOL(libra_sdio_register_shutdown_hdlr);
+
int libra_sdio_notify_card_removal(
notify_card_removal_t *libra_sdio_notify_card_removal_hdlr)
{
@@ -472,11 +490,12 @@
};
static struct sdio_driver libra_sdiofn_driver = {
- .name = "libra_sdiofn",
- .id_table = libra_sdioid,
- .probe = libra_sdio_probe,
- .remove = libra_sdio_remove,
- .drv.pm = &libra_sdio_pm_ops,
+ .name = "libra_sdiofn",
+ .id_table = libra_sdioid,
+ .probe = libra_sdio_probe,
+ .remove = libra_sdio_remove,
+ .drv.pm = &libra_sdio_pm_ops,
+ .drv.shutdown = libra_sdio_shutdown,
};
static int __init libra_sdioif_init(void)
@@ -487,6 +506,7 @@
libra_suspend_hldr = NULL;
libra_resume_hldr = NULL;
libra_notify_card_removal_hdlr = NULL;
+ libra_sdio_shutdown_hdlr = NULL;
sdio_register_driver(&libra_sdiofn_driver);