WLAN: WCN1314: Add card removal notification functionality.
Function driver can register for card removal notifications.
Before removing the card, let function driver notify the same
and allow it to cleanup.
Change-Id: I5d423807277bdd7476a6ea7d6a7c9ef71c0725f5
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 3421f84..9b90184 100644
--- a/drivers/net/wireless/libra/libra_sdioif.c
+++ b/drivers/net/wireless/libra/libra_sdioif.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2009-2011, Code Aurora Forum. All rights reserved.
+/* Copyright (c) 2009-2012, Code Aurora Forum. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -28,6 +28,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;
int libra_enable_sdio_irq_in_chip(struct sdio_func *func, u8 enable)
{
@@ -397,6 +398,8 @@
static void libra_sdio_remove(struct sdio_func *func)
{
+ if (libra_notify_card_removal_hdlr)
+ libra_notify_card_removal_hdlr();
libra_sdio_func = NULL;
printk(KERN_INFO "%s : Module removed.\n", __func__);
@@ -449,6 +452,14 @@
#define libra_sdio_resume 0
#endif
+int libra_sdio_notify_card_removal(
+ notify_card_removal_t *libra_sdio_notify_card_removal_hdlr)
+{
+ libra_notify_card_removal_hdlr = libra_sdio_notify_card_removal_hdlr;
+ return 0;
+}
+EXPORT_SYMBOL(libra_sdio_notify_card_removal);
+
static struct sdio_device_id libra_sdioid[] = {
{.class = 0, .vendor = LIBRA_MAN_ID, .device = LIBRA_REV_1_0_CARD_ID},
{.class = 0, .vendor = VOLANS_MAN_ID, .device = VOLANS_REV_2_0_CARD_ID},
@@ -475,6 +486,7 @@
libra_mmc_host_index = -1;
libra_suspend_hldr = NULL;
libra_resume_hldr = NULL;
+ libra_notify_card_removal_hdlr = NULL;
sdio_register_driver(&libra_sdiofn_driver);
diff --git a/include/linux/libra_sdioif.h b/include/linux/libra_sdioif.h
index 08be83a..99e6f72 100644
--- a/include/linux/libra_sdioif.h
+++ b/include/linux/libra_sdioif.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2009-2011, Code Aurora Forum. All rights reserved.
+/* Copyright (c) 2009-2012, Code Aurora Forum. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -34,6 +34,7 @@
typedef int (suspend_handler_t)(struct sdio_func *);
typedef void (resume_handler_t)(struct sdio_func *);
+typedef void (notify_card_removal_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,
@@ -74,5 +75,6 @@
int libra_enable_sdio_irq(struct sdio_func *func, u8 enable);
void libra_sdio_disable_func(struct sdio_func *func);
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);
#endif /* __LIBRA_SDIOIF_H__ */