From 1e5cf9b0be4e8902c06bf9600ea0b256e731c862 Mon Sep 17 00:00:00 2001 From: Johannes Berg Date: Tue, 21 Jun 2011 04:30:56 -0700 Subject: iwlagn: use PM ops macro Simplify the code and use SIMPLE_DEV_PM_OPS to define iwl_dev_pm_ops instead of doing the same thing manually. Signed-off-by: Johannes Berg Signed-off-by: Wey-Yi Guy --- drivers/net/wireless/iwlwifi/iwl-pci.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'drivers/net/wireless/iwlwifi/iwl-pci.c') diff --git a/drivers/net/wireless/iwlwifi/iwl-pci.c b/drivers/net/wireless/iwlwifi/iwl-pci.c index 7328fbff7f7..3927c802a5d 100644 --- a/drivers/net/wireless/iwlwifi/iwl-pci.c +++ b/drivers/net/wireless/iwlwifi/iwl-pci.c @@ -530,14 +530,7 @@ static int iwl_pci_resume(struct device *device) return iwl_resume(priv); } -static const struct dev_pm_ops iwl_dev_pm_ops = { - .suspend = iwl_pci_suspend, - .resume = iwl_pci_resume, - .freeze = iwl_pci_suspend, - .thaw = iwl_pci_resume, - .poweroff = iwl_pci_suspend, - .restore = iwl_pci_resume, -}; +static SIMPLE_DEV_PM_OPS(iwl_dev_pm_ops, iwl_pci_suspend, iwl_pci_resume); #define IWL_PM_OPS (&iwl_dev_pm_ops) -- cgit v1.2.3-70-g09d2 From 428bc8c3960d2b18cb9f0d90cfe197ec9a822a54 Mon Sep 17 00:00:00 2001 From: Stanislaw Gruszka Date: Fri, 24 Jun 2011 11:34:34 +0200 Subject: iwlagn: fix rmmod crash priv->bus.bus_specific pointer is used after priv structures was freed, in iwl_pci_remove(), what make ugly rmmod crash. This bug was introduced by current pci changes. On the way remove fake check, if prober error code is returned from .probe() function, .remove() will never be called be null drvdata. Signed-off-by: Stanislaw Gruszka Signed-off-by: Wey-Yi Guy Signed-off-by: John W. Linville --- drivers/net/wireless/iwlwifi/iwl-pci.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'drivers/net/wireless/iwlwifi/iwl-pci.c') diff --git a/drivers/net/wireless/iwlwifi/iwl-pci.c b/drivers/net/wireless/iwlwifi/iwl-pci.c index 3927c802a5d..d582cc11145 100644 --- a/drivers/net/wireless/iwlwifi/iwl-pci.c +++ b/drivers/net/wireless/iwlwifi/iwl-pci.c @@ -496,14 +496,11 @@ static void iwl_pci_down(void *bus) static void __devexit iwl_pci_remove(struct pci_dev *pdev) { struct iwl_priv *priv = pci_get_drvdata(pdev); - - /* This can happen if probe failed */ - if (unlikely(!priv)) - return; + void *bus_specific = priv->bus.bus_specific; iwl_remove(priv); - iwl_pci_down(IWL_BUS_GET_PCI_BUS(&priv->bus)); + iwl_pci_down(bus_specific); } #ifdef CONFIG_PM -- cgit v1.2.3-70-g09d2 From 6691678dca1057840d8f25ee038541d4e4100b17 Mon Sep 17 00:00:00 2001 From: Sergei Shtylyov Date: Fri, 24 Jun 2011 19:39:37 +0400 Subject: iwlwifi: use pci_dev->revision, again Commit ff938e43d39e926de74b32a3656c190f979ab642 (net: use pci_dev->revision, again) already converted this driver to using the 'revision' field of 'struct pci_dev' but commit 084dd79172cb3aad11d2b7ee5628d57badca7c6e (iwlagn: move PCI related operations from probe and remove to PCI layer) has again added the code to read the PCI revision ID register... Signed-off-by: Sergei Shtylyov Signed-off-by: John W. Linville --- drivers/net/wireless/iwlwifi/iwl-pci.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'drivers/net/wireless/iwlwifi/iwl-pci.c') diff --git a/drivers/net/wireless/iwlwifi/iwl-pci.c b/drivers/net/wireless/iwlwifi/iwl-pci.c index d582cc11145..3b5844b60e7 100644 --- a/drivers/net/wireless/iwlwifi/iwl-pci.c +++ b/drivers/net/wireless/iwlwifi/iwl-pci.c @@ -383,7 +383,6 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) { struct iwl_cfg *cfg = (struct iwl_cfg *)(ent->driver_data); struct iwl_pci_bus *bus; - u8 rev_id; u16 pci_cmd; int err; @@ -440,8 +439,7 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) (unsigned long long) pci_resource_len(pdev, 0)); pr_info("pci_resource_base = %p\n", bus->hw_base); - pci_read_config_byte(pdev, PCI_REVISION_ID, &rev_id); - pr_info("HW Revision ID = 0x%X\n", rev_id); + pr_info("HW Revision ID = 0x%X\n", pdev->revision); /* We disable the RETRY_TIMEOUT register (0x41) to keep * PCI Tx retries from interfering with C3 CPU state */ -- cgit v1.2.3-70-g09d2