iwlwifi: drv object can release its own memory
authorEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Tue, 7 Feb 2012 12:27:31 +0000 (14:27 +0200)
committerWey-Yi Guy <wey-yi.w.guy@intel.com>
Mon, 27 Feb 2012 21:25:38 +0000 (13:25 -0800)
Move that code to the iwl-drv.c

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
drivers/net/wireless/iwlwifi/iwl-drv.c
drivers/net/wireless/iwlwifi/iwl-drv.h
drivers/net/wireless/iwlwifi/iwl-pci.c

index 49f7e70bc3621f322ccc0c5d685994b70dcaf853..b3876dec52af85f79fc117dc5f5ed97ceb2acdb2 100644 (file)
@@ -92,3 +92,10 @@ int iwl_drv_start(struct iwl_shared *shrd,
        return ret;
 }
 
+void iwl_drv_stop(struct iwl_shared *shrd)
+{
+       iwl_remove(shrd->priv);
+
+       kfree(shrd->nic);
+}
+
index c405451992246af9ead6898b714d430ca2b69927..90534a23ddc8742b230a74e04d0214ad85ced10d 100644 (file)
 int iwl_drv_start(struct iwl_shared *shrd,
                  struct iwl_trans *trans, struct iwl_cfg *cfg);
 
+/**
+ * iwl_drv_stop - stop the drv
+ *
+ * @shrd: the shrd area
+ *
+ * TODO: review the parameters given to this function
+ *
+ * Stop the driver. This should be called by bus specific system flows
+ * implementations. For example, the bus specific remove function should first
+ * call this function and then do the bus related operations only.
+ */
+void iwl_drv_stop(struct iwl_shared *shrd);
+
 #endif /* __iwl_drv_h__ */
index e2695445dfac8db03aa078b3bb8ea0fade965df5..b9cdd1ac17449c74c623c4df29676d7339fcdb01 100644 (file)
@@ -321,12 +321,11 @@ static void __devexit iwl_pci_remove(struct pci_dev *pdev)
        struct iwl_bus *bus = pci_get_drvdata(pdev);
        struct iwl_shared *shrd = bus->shrd;
 
-       iwl_remove(shrd->priv);
+       iwl_drv_stop(shrd);
        iwl_trans_free(shrd->trans);
 
        pci_set_drvdata(pdev, NULL);
 
-       kfree(bus->shrd->nic);
        kfree(bus->shrd);
        kfree(bus);
 }