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);
diff --git a/include/linux/libra_sdioif.h b/include/linux/libra_sdioif.h
index 99e6f72..99b7d04 100644
--- a/include/linux/libra_sdioif.h
+++ b/include/linux/libra_sdioif.h
@@ -35,6 +35,7 @@
typedef int (suspend_handler_t)(struct sdio_func *);
typedef void (resume_handler_t)(struct sdio_func *);
typedef void (notify_card_removal_t)(void);
+typedef void (shutdown_handler_t)(void);
int libra_enable_sdio_irq_in_chip(struct sdio_func *func, u8 enable);
int libra_sdio_configure(sdio_irq_handler_t libra_sdio_rxhandler,
@@ -77,4 +78,6 @@
int libra_disable_sdio_irq_capability(struct sdio_func *func, u8 disable);
int libra_sdio_notify_card_removal(
notify_card_removal_t *libra_sdio_notify_card_removal_hdlr);
+int libra_sdio_register_shutdown_hdlr(
+ shutdown_handler_t *libra_shutdown_hdlr);
#endif /* __LIBRA_SDIOIF_H__ */