2011-08-13 16:42:33

by Wey-Yi Guy

[permalink] [raw]
Subject: [PATCH 0/2] iwlwifi fix for 3.1

Fix introduced a bug: bad pointer in unload in
commit cc1a93e68f6c0d736b771f0746e8e4186f483fdc.

ALso fix bug has been introduced by:
d593411084a56124aa9d80aafa15db8463b2d8f7

Emmanuel Grumbach (2):
iwlagn: Revert "iwlagn: sysfs couldn't find the priv pointer"
iwlagn: sysfs couldn't find the priv pointer

these patches are also available from wireless-2.6 branch on
git://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi/iwlwifi-2.6.git

drivers/net/wireless/iwlwifi/iwl-pci.c | 39 +++++++++++++++++++++++---------------------------
1 files changed, 26 insertions(+), 31 deletions(-)




2011-08-13 16:42:35

by Wey-Yi Guy

[permalink] [raw]
Subject: [PATCH 2/2] iwlagn: sysfs couldn't find the priv pointer

From: Emmanuel Grumbach <[email protected]>

This bug has been introduced by:
d593411084a56124aa9d80aafa15db8463b2d8f7
Author: Emmanuel Grumbach <[email protected]>
Date: Mon Jul 11 10:48:51 2011 +0300

iwlagn: simplify the bus architecture

Revert part of the buggy patch: dev_get_drvdata will now return
iwl_priv as it did before the patch.

Signed-off-by: Emmanuel Grumbach <[email protected]>
Signed-off-by: Wey-Yi Guy <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl-pci.c | 39 ++++++++++++++------------------
1 files changed, 17 insertions(+), 22 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-pci.c b/drivers/net/wireless/iwlwifi/iwl-pci.c
index fb7e436..2fdbffa 100644
--- a/drivers/net/wireless/iwlwifi/iwl-pci.c
+++ b/drivers/net/wireless/iwlwifi/iwl-pci.c
@@ -134,6 +134,7 @@ static void iwl_pci_apm_config(struct iwl_bus *bus)
static void iwl_pci_set_drv_data(struct iwl_bus *bus, void *drv_data)
{
bus->drv_data = drv_data;
+ pci_set_drvdata(IWL_BUS_GET_PCI_DEV(bus), drv_data);
}

static void iwl_pci_get_hw_id(struct iwl_bus *bus, char buf[],
@@ -454,8 +455,6 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
pci_write_config_word(pdev, PCI_COMMAND, pci_cmd);
}

- pci_set_drvdata(pdev, bus);
-
bus->dev = &pdev->dev;
bus->irq = pdev->irq;
bus->ops = &pci_ops;
@@ -479,26 +478,22 @@ out_no_pci:
return err;
}

-static void iwl_pci_down(struct iwl_bus *bus)
-{
- struct iwl_pci_bus *pci_bus = (struct iwl_pci_bus *) bus->bus_specific;
-
- pci_disable_msi(pci_bus->pci_dev);
- pci_iounmap(pci_bus->pci_dev, pci_bus->hw_base);
- pci_release_regions(pci_bus->pci_dev);
- pci_disable_device(pci_bus->pci_dev);
- pci_set_drvdata(pci_bus->pci_dev, NULL);
-
- kfree(bus);
-}
-
static void __devexit iwl_pci_remove(struct pci_dev *pdev)
{
- struct iwl_bus *bus = pci_get_drvdata(pdev);
+ struct iwl_priv *priv = pci_get_drvdata(pdev);
+ struct iwl_bus *bus = priv->bus;
+ struct iwl_pci_bus *pci_bus = IWL_BUS_GET_PCI_BUS(bus);
+ struct pci_dev *pci_dev = IWL_BUS_GET_PCI_DEV(bus);

- iwl_remove(bus->drv_data);
+ iwl_remove(priv);

- iwl_pci_down(bus);
+ pci_disable_msi(pci_dev);
+ pci_iounmap(pci_dev, pci_bus->hw_base);
+ pci_release_regions(pci_dev);
+ pci_disable_device(pci_dev);
+ pci_set_drvdata(pci_dev, NULL);
+
+ kfree(bus);
}

#ifdef CONFIG_PM
@@ -506,20 +501,20 @@ static void __devexit iwl_pci_remove(struct pci_dev *pdev)
static int iwl_pci_suspend(struct device *device)
{
struct pci_dev *pdev = to_pci_dev(device);
- struct iwl_bus *bus = pci_get_drvdata(pdev);
+ struct iwl_priv *priv = pci_get_drvdata(pdev);

/* Before you put code here, think about WoWLAN. You cannot check here
* whether WoWLAN is enabled or not, and your code will run even if
* WoWLAN is enabled - don't kill the NIC, someone may need it in Sx.
*/

- return iwl_suspend(bus->drv_data);
+ return iwl_suspend(priv);
}

static int iwl_pci_resume(struct device *device)
{
struct pci_dev *pdev = to_pci_dev(device);
- struct iwl_bus *bus = pci_get_drvdata(pdev);
+ struct iwl_priv *priv = pci_get_drvdata(pdev);

/* Before you put code here, think about WoWLAN. You cannot check here
* whether WoWLAN is enabled or not, and your code will run even if
@@ -532,7 +527,7 @@ static int iwl_pci_resume(struct device *device)
*/
pci_write_config_byte(pdev, PCI_CFG_RETRY_TIMEOUT, 0x00);

- return iwl_resume(bus->drv_data);
+ return iwl_resume(priv);
}

static SIMPLE_DEV_PM_OPS(iwl_dev_pm_ops, iwl_pci_suspend, iwl_pci_resume);
--
1.7.1


2011-08-13 16:42:34

by Wey-Yi Guy

[permalink] [raw]
Subject: [PATCH 1/2] Revert "iwlagn: sysfs couldn't find the priv pointer"

From: Emmanuel Grumbach <[email protected]>

This reverts commit cc1a93e68f6c0d736b771f0746e8e4186f483fdc.

This fix introduced a bug: bad pointer in unload.

Signed-off-by: Emmanuel Grumbach <[email protected]>
Signed-off-by: Wey-Yi Guy <[email protected]>
---
drivers/net/wireless/iwlwifi/iwl-pci.c | 18 +++++++++---------
1 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-pci.c b/drivers/net/wireless/iwlwifi/iwl-pci.c
index 69d4ec4..fb7e436 100644
--- a/drivers/net/wireless/iwlwifi/iwl-pci.c
+++ b/drivers/net/wireless/iwlwifi/iwl-pci.c
@@ -134,7 +134,6 @@ static void iwl_pci_apm_config(struct iwl_bus *bus)
static void iwl_pci_set_drv_data(struct iwl_bus *bus, void *drv_data)
{
bus->drv_data = drv_data;
- pci_set_drvdata(IWL_BUS_GET_PCI_DEV(bus), drv_data);
}

static void iwl_pci_get_hw_id(struct iwl_bus *bus, char buf[],
@@ -455,6 +454,8 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
pci_write_config_word(pdev, PCI_COMMAND, pci_cmd);
}

+ pci_set_drvdata(pdev, bus);
+
bus->dev = &pdev->dev;
bus->irq = pdev->irq;
bus->ops = &pci_ops;
@@ -493,12 +494,11 @@ static void iwl_pci_down(struct iwl_bus *bus)

static void __devexit iwl_pci_remove(struct pci_dev *pdev)
{
- struct iwl_priv *priv = pci_get_drvdata(pdev);
- void *bus_specific = priv->bus->bus_specific;
+ struct iwl_bus *bus = pci_get_drvdata(pdev);

- iwl_remove(priv);
+ iwl_remove(bus->drv_data);

- iwl_pci_down(bus_specific);
+ iwl_pci_down(bus);
}

#ifdef CONFIG_PM
@@ -506,20 +506,20 @@ static void __devexit iwl_pci_remove(struct pci_dev *pdev)
static int iwl_pci_suspend(struct device *device)
{
struct pci_dev *pdev = to_pci_dev(device);
- struct iwl_priv *priv = pci_get_drvdata(pdev);
+ struct iwl_bus *bus = pci_get_drvdata(pdev);

/* Before you put code here, think about WoWLAN. You cannot check here
* whether WoWLAN is enabled or not, and your code will run even if
* WoWLAN is enabled - don't kill the NIC, someone may need it in Sx.
*/

- return iwl_suspend(priv);
+ return iwl_suspend(bus->drv_data);
}

static int iwl_pci_resume(struct device *device)
{
struct pci_dev *pdev = to_pci_dev(device);
- struct iwl_priv *priv = pci_get_drvdata(pdev);
+ struct iwl_bus *bus = pci_get_drvdata(pdev);

/* Before you put code here, think about WoWLAN. You cannot check here
* whether WoWLAN is enabled or not, and your code will run even if
@@ -532,7 +532,7 @@ static int iwl_pci_resume(struct device *device)
*/
pci_write_config_byte(pdev, PCI_CFG_RETRY_TIMEOUT, 0x00);

- return iwl_resume(priv);
+ return iwl_resume(bus->drv_data);
}

static SIMPLE_DEV_PM_OPS(iwl_dev_pm_ops, iwl_pci_suspend, iwl_pci_resume);
--
1.7.1


2011-08-13 17:11:46

by Sedat Dilek

[permalink] [raw]
Subject: Re: [PATCH 0/2] iwlwifi fix for 3.1

On Sat, Aug 13, 2011 at 6:02 PM, Wey-Yi Guy <[email protected]> wrote:
> Fix introduced a bug: bad pointer in unload in
> commit cc1a93e68f6c0d736b771f0746e8e4186f483fdc.
>
> ALso fix bug has been introduced by:
> d593411084a56124aa9d80aafa15db8463b2d8f7
>
> Emmanuel Grumbach (2):
>  iwlagn: Revert "iwlagn: sysfs couldn't find the priv pointer"
>  iwlagn: sysfs couldn't find the priv pointer
>
> these patches are also available from wireless-2.6 branch on
>  git://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi/iwlwifi-2.6.git
>

It's time to drop -2.6 suffix from your GIT repository?

- Sedat -