iwlwifi: add notification infrastructure to iwlcore
authorMohamed Abbas <mabbas@linux.intel.com>
Fri, 28 Mar 2008 23:21:05 +0000 (16:21 -0700)
committerJohn W. Linville <linville@tuxdriver.com>
Tue, 1 Apr 2008 21:13:18 +0000 (17:13 -0400)
This patch add notification function to be called by low level
iwl driver to notify iwlcore with current state. This function
will call iwlcore subsystem with the new state. This will
help make the code more consistent and easy to extend. For example
the rf-kill need to know when the driver in init, start, stop or
remove state. Instead doing the same call in 3945 and 4965, we
just do it from this function.

Signed-off-by: Mohamed Abbas <mabbas@linux.intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/iwlwifi/iwl-core.c
drivers/net/wireless/iwlwifi/iwl-core.h
drivers/net/wireless/iwlwifi/iwl4965-base.c

index da51349cbd8b6b989a6ce6ebdc0209618881ce84..342a269b8abb2ab7dd769b5cd935d0133c159b76 100644 (file)
@@ -249,3 +249,24 @@ int iwl_setup(struct iwl_priv *priv)
 }
 EXPORT_SYMBOL(iwl_setup);
 
+/* Low level driver call this function to update iwlcore with
+ * driver status.
+ */
+int iwlcore_low_level_notify(struct iwl_priv *priv,
+                             enum iwlcore_card_notify notify)
+{
+       switch (notify) {
+       case IWLCORE_INIT_EVT:
+               break;
+       case IWLCORE_START_EVT:
+               break;
+       case IWLCORE_STOP_EVT:
+               break;
+       case IWLCORE_REMOVE_EVT:
+               break;
+       }
+
+       return 0;
+}
+EXPORT_SYMBOL(iwlcore_low_level_notify);
+
index ce7f90ebf367be4efa94293e7e48b76d103dc404..4dfa05948d73ef140866d0dc0f3e25ea000666da 100644 (file)
@@ -146,4 +146,13 @@ int iwl_send_cmd_pdu_async(struct iwl_priv *priv, u8 id, u16 len,
                                           struct iwl_cmd *cmd,
                                           struct sk_buff *skb));
 
+enum iwlcore_card_notify {
+       IWLCORE_INIT_EVT = 0,
+       IWLCORE_START_EVT = 1,
+       IWLCORE_STOP_EVT = 2,
+       IWLCORE_REMOVE_EVT = 3,
+};
+
+int iwlcore_low_level_notify(struct iwl_priv *priv,
+                            enum iwlcore_card_notify notify);
 #endif /* __iwl_core_h__ */
index cf56b95dd2219bc2651e8b1256cf384e9e5b10a8..5261b6179a869c6d52de3b07ce9e343bbf842c39 100644 (file)
@@ -5724,6 +5724,7 @@ static void iwl4965_alive_start(struct iwl_priv *priv)
        if (priv->error_recovering)
                iwl4965_error_recovery(priv);
 
+       iwlcore_low_level_notify(priv, IWLCORE_START_EVT);
        return;
 
  restart:
@@ -5747,6 +5748,8 @@ static void __iwl4965_down(struct iwl_priv *priv)
 
        iwl_leds_unregister(priv);
 
+       iwlcore_low_level_notify(priv, IWLCORE_STOP_EVT);
+
        iwlcore_clear_stations_table(priv);
 
        /* Unblock any waiting calls */
@@ -8167,6 +8170,8 @@ static int iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
        pci_save_state(pdev);
        pci_disable_device(pdev);
 
+       /* notify iwlcore to init */
+       iwlcore_low_level_notify(priv, IWLCORE_INIT_EVT);
        return 0;
 
  out_remove_sysfs:
@@ -8209,6 +8214,7 @@ static void __devexit iwl4965_pci_remove(struct pci_dev *pdev)
                }
        }
 
+       iwlcore_low_level_notify(priv, IWLCORE_REMOVE_EVT);
        iwl_dbgfs_unregister(priv);
        sysfs_remove_group(&pdev->dev.kobj, &iwl4965_attribute_group);