2008-10-21 18:24:07

by Andrew Morton

[permalink] [raw]
Subject: Re: [Bugme-new] [Bug 11782] New: p54 misbehaves when firmware can't be found


(switched to email. Please respond via emailed reply-to-all, not via the
bugzilla web interface).

On Sat, 18 Oct 2008 09:13:00 -0700 (PDT)
[email protected] wrote:

> http://bugzilla.kernel.org/show_bug.cgi?id=11782
>
> Summary: p54 misbehaves when firmware can't be found
> Product: Drivers
> Version: 2.5
> KernelVersion: 2.6.27-git8
> Platform: All
> OS/Version: Linux
> Tree: Mainline
> Status: NEW
> Severity: low
> Priority: P1
> Component: network-wireless
> AssignedTo: [email protected]
> ReportedBy: [email protected]
>
>
> Latest working kernel version: 2.6.26

A regression.

> Earliest failing kernel version: ?
> Distribution: Ubuntu 8.04
> Hardware Environment: AMD Elan (TS-5500)
> Software Environment:
> Problem Description:
>
> When firmware can't be found free_irq complains.
>
> Steps to reproduce:
> Ensure the firmware is not available in /lib/firmware/$(uname -r)/
>
> p54pci 0000:01:00.0: enabling device (0000 -> 0002)
> p54pci 0000:01:00.0: setting latency timer to 64
> p54pci 0000:01:00.0: firmware: requesting isl3886
> 0000:01:00.0 (p54pci): cannot find firmware (isl3886)
> phy0: device does not respond!
> Trying to free already-free IRQ 10
> Pid: 108, comm: pccardd Not tainted 2.6.27-05577-g0cfd810-dirty #1
> Call Trace:
> [<c01265dc>] free_irq+0xad/0xb9
> [<c01050dd>] dma_generic_alloc_coherent+0x0/0xd7
> [<c01ba8e6>] p54p_stop+0x4a/0x1fa
> [<c01050dd>] dma_generic_alloc_coherent+0x0/0xd7
> [<c02348c5>] p54p_probe+0x23e/0x302
> [<c0192dd3>] kobject_get+0xf/0x13
> [<c019cd9f>] pci_device_probe+0x36/0x55
> [<c01adf86>] driver_probe_device+0x9c/0x112
> [<c01ad5f2>] bus_for_each_drv+0x34/0x5b
> [<c01ae0d1>] device_attach+0x4e/0x61
> [<c01ae063>] __device_attach+0x0/0x5
> [<c01ad4bc>] bus_attach_device+0x1e/0x46
> [<c01ac8c8>] device_add+0x2c8/0x3ef
> [<c0199cd9>] pci_bus_write_config_byte+0x16/0x1e
> [<c0199e24>] pci_bus_add_device+0xc/0x2c
> [<c0199e62>] pci_bus_add_devices+0x1e/0x134
> [<c0232e4a>] cb_alloc+0x92/0xa4
> [<c01ccee7>] socket_insert+0x80/0xa5
> [<c01cd347>] pccardd+0x13c/0x1b5
> [<c01cd20b>] pccardd+0x0/0x1b5
> [<c011bc3b>] kthread+0x36/0x5b
> [<c011bc05>] kthread+0x0/0x5b
> [<c0102dc7>] kernel_thread_helper+0x7/0x10
> p54pci: probe of 0000:01:00.0 failed with error -16
>



2008-10-22 12:19:58

by Christian Lamparter

[permalink] [raw]
Subject: [PATCH] p54: fix misbehavings when firmware can't be found

This patch fixes a double-free error in p54pci
( http://bugzilla.kernel.org/show_bug.cgi?id=3D11782 )

Trying to free already-free IRQ 10
Pid: 108, comm: pccardd Not tainted 2.6.27-05577-g0cfd810-dirty #1
Call Trace:
=A0[<c01265dc>] free_irq+0xad/0xb9
=A0[<c01050dd>] dma_generic_alloc_coherent+0x0/0xd7
=A0[<c01ba8e6>] p54p_stop+0x4a/0x1fa
=A0[<c01050dd>] dma_generic_alloc_coherent+0x0/0xd7
=A0[<c02348c5>] p54p_probe+0x23e/0x302

Tested-by: Sean Young
Signed-off-by: Christian Lamparter <[email protected]>
---
[Ignore the first one, it was wordwrapped]
John / Andrew,

There is another, older patch for a different regression,
wasn't merged yet...

[PATCH] p54: enable 2.4/5GHz spectrum by eeprom bits.
http://article.gmane.org/gmane.linux.kernel.wireless.general/22234

regards,=A0=A0=A0=A0=A0=A0=A0=A0
=A0=A0=A0=A0=A0=A0=A0=A0Chr
---
diff --git a/drivers/net/wireless/p54/p54pci.c b/drivers/net/wireless/p=
54/p54pci.c
index 1c2a02a..88b3cad 100644
--- a/drivers/net/wireless/p54/p54pci.c
+++ b/drivers/net/wireless/p54/p54pci.c
@@ -346,68 +346,6 @@ static void p54p_tx(struct ieee80211_hw *dev, stru=
ct p54_control_hdr *data,
printk(KERN_INFO "%s: tx overflow.\n", wiphy_name(dev->wiphy));
}
=20
-static int p54p_open(struct ieee80211_hw *dev)
-{
- struct p54p_priv *priv =3D dev->priv;
- int err;
-
- init_completion(&priv->boot_comp);
- err =3D request_irq(priv->pdev->irq, &p54p_interrupt,
- IRQF_SHARED, "p54pci", dev);
- if (err) {
- printk(KERN_ERR "%s: failed to register IRQ handler\n",
- wiphy_name(dev->wiphy));
- return err;
- }
-
- memset(priv->ring_control, 0, sizeof(*priv->ring_control));
- err =3D p54p_upload_firmware(dev);
- if (err) {
- free_irq(priv->pdev->irq, dev);
- return err;
- }
- priv->rx_idx_data =3D priv->tx_idx_data =3D 0;
- priv->rx_idx_mgmt =3D priv->tx_idx_mgmt =3D 0;
-
- p54p_refill_rx_ring(dev, 0, priv->ring_control->rx_data,
- ARRAY_SIZE(priv->ring_control->rx_data), priv->rx_buf_data);
-
- p54p_refill_rx_ring(dev, 2, priv->ring_control->rx_mgmt,
- ARRAY_SIZE(priv->ring_control->rx_mgmt), priv->rx_buf_mgmt);
-
- P54P_WRITE(ring_control_base, cpu_to_le32(priv->ring_control_dma));
- P54P_READ(ring_control_base);
- wmb();
- udelay(10);
-
- P54P_WRITE(int_enable, cpu_to_le32(ISL38XX_INT_IDENT_INIT));
- P54P_READ(int_enable);
- wmb();
- udelay(10);
-
- P54P_WRITE(dev_int, cpu_to_le32(ISL38XX_DEV_INT_RESET));
- P54P_READ(dev_int);
-
- if (!wait_for_completion_interruptible_timeout(&priv->boot_comp, HZ))=
{
- printk(KERN_ERR "%s: Cannot boot firmware!\n",
- wiphy_name(dev->wiphy));
- free_irq(priv->pdev->irq, dev);
- return -ETIMEDOUT;
- }
-
- P54P_WRITE(int_enable, cpu_to_le32(ISL38XX_INT_IDENT_UPDATE));
- P54P_READ(int_enable);
- wmb();
- udelay(10);
-
- P54P_WRITE(dev_int, cpu_to_le32(ISL38XX_DEV_INT_UPDATE));
- P54P_READ(dev_int);
- wmb();
- udelay(10);
-
- return 0;
-}
-
static void p54p_stop(struct ieee80211_hw *dev)
{
struct p54p_priv *priv =3D dev->priv;
@@ -474,6 +412,68 @@ static void p54p_stop(struct ieee80211_hw *dev)
memset(ring_control, 0, sizeof(*ring_control));
}
=20
+static int p54p_open(struct ieee80211_hw *dev)
+{
+ struct p54p_priv *priv =3D dev->priv;
+ int err;
+
+ init_completion(&priv->boot_comp);
+ err =3D request_irq(priv->pdev->irq, &p54p_interrupt,
+ IRQF_SHARED, "p54pci", dev);
+ if (err) {
+ printk(KERN_ERR "%s: failed to register IRQ handler\n",
+ wiphy_name(dev->wiphy));
+ return err;
+ }
+
+ memset(priv->ring_control, 0, sizeof(*priv->ring_control));
+ err =3D p54p_upload_firmware(dev);
+ if (err) {
+ free_irq(priv->pdev->irq, dev);
+ return err;
+ }
+ priv->rx_idx_data =3D priv->tx_idx_data =3D 0;
+ priv->rx_idx_mgmt =3D priv->tx_idx_mgmt =3D 0;
+
+ p54p_refill_rx_ring(dev, 0, priv->ring_control->rx_data,
+ ARRAY_SIZE(priv->ring_control->rx_data), priv->rx_buf_data);
+
+ p54p_refill_rx_ring(dev, 2, priv->ring_control->rx_mgmt,
+ ARRAY_SIZE(priv->ring_control->rx_mgmt), priv->rx_buf_mgmt);
+
+ P54P_WRITE(ring_control_base, cpu_to_le32(priv->ring_control_dma));
+ P54P_READ(ring_control_base);
+ wmb();
+ udelay(10);
+
+ P54P_WRITE(int_enable, cpu_to_le32(ISL38XX_INT_IDENT_INIT));
+ P54P_READ(int_enable);
+ wmb();
+ udelay(10);
+
+ P54P_WRITE(dev_int, cpu_to_le32(ISL38XX_DEV_INT_RESET));
+ P54P_READ(dev_int);
+
+ if (!wait_for_completion_interruptible_timeout(&priv->boot_comp, HZ))=
{
+ printk(KERN_ERR "%s: Cannot boot firmware!\n",
+ wiphy_name(dev->wiphy));
+ p54p_stop(dev);
+ return -ETIMEDOUT;
+ }
+
+ P54P_WRITE(int_enable, cpu_to_le32(ISL38XX_INT_IDENT_UPDATE));
+ P54P_READ(int_enable);
+ wmb();
+ udelay(10);
+
+ P54P_WRITE(dev_int, cpu_to_le32(ISL38XX_DEV_INT_UPDATE));
+ P54P_READ(dev_int);
+ wmb();
+ udelay(10);
+
+ return 0;
+}
+
static int __devinit p54p_probe(struct pci_dev *pdev,
const struct pci_device_id *id)
{
@@ -556,11 +556,13 @@ static int __devinit p54p_probe(struct pci_dev *p=
dev,
spin_lock_init(&priv->lock);
tasklet_init(&priv->rx_tasklet, p54p_rx_tasklet, (unsigned long)dev);
=20
- p54p_open(dev);
+ err =3D p54p_open(dev);
+ if (err)
+ goto err_free_common;
err =3D p54_read_eeprom(dev);
p54p_stop(dev);
if (err)
- goto err_free_desc;
+ goto err_free_common;
=20
err =3D ieee80211_register_hw(dev);
if (err) {
@@ -573,8 +575,6 @@ static int __devinit p54p_probe(struct pci_dev *pde=
v,
=20
err_free_common:
p54_free_common(dev);
-
- err_free_desc:
pci_free_consistent(pdev, sizeof(*priv->ring_control),
priv->ring_control, priv->ring_control_dma);
=20

2008-10-22 12:16:40

by Christian Lamparter

[permalink] [raw]
Subject: [PATCH] p54: fix misbehavings when firmware can't be found

This patch fixes a double-free error in p54pci
( http://bugzilla.kernel.org/show_bug.cgi?id=3D11782 )

Trying to free already-free IRQ 10
Pid: 108, comm: pccardd Not tainted 2.6.27-05577-g0cfd810-dirty #1
Call Trace:
=A0[<c01265dc>] free_irq+0xad/0xb9
=A0[<c01050dd>] dma_generic_alloc_coherent+0x0/0xd7
=A0[<c01ba8e6>] p54p_stop+0x4a/0x1fa
=A0[<c01050dd>] dma_generic_alloc_coherent+0x0/0xd7
=A0[<c02348c5>] p54p_probe+0x23e/0x302

Tested-by: Sean Young
Signed-off-by: Christian Lamparter <[email protected]>
---
John / Andrew

There is another, older patch for a different regression,
wasn't merged yet...

[PATCH] p54: enable 2.4/5GHz spectrum by eeprom bits.
http://article.gmane.org/gmane.linux.kernel.wireless.general/22234

regards,=09
Chr
---
diff --git a/drivers/net/wireless/p54/p54pci.c=20
b/drivers/net/wireless/p54/p54pci.c
index 1c2a02a..88b3cad 100644
--- a/drivers/net/wireless/p54/p54pci.c
+++ b/drivers/net/wireless/p54/p54pci.c
@@ -346,68 +346,6 @@ static void p54p_tx(struct ieee80211_hw *dev, stru=
ct=20
p54_control_hdr *data,
printk(KERN_INFO "%s: tx overflow.\n", wiphy_name(dev->wiphy));
}
=20
-static int p54p_open(struct ieee80211_hw *dev)
-{
- struct p54p_priv *priv =3D dev->priv;
- int err;
-
- init_completion(&priv->boot_comp);
- err =3D request_irq(priv->pdev->irq, &p54p_interrupt,
- IRQF_SHARED, "p54pci", dev);
- if (err) {
- printk(KERN_ERR "%s: failed to register IRQ handler\n",
- wiphy_name(dev->wiphy));
- return err;
- }
-
- memset(priv->ring_control, 0, sizeof(*priv->ring_control));
- err =3D p54p_upload_firmware(dev);
- if (err) {
- free_irq(priv->pdev->irq, dev);
- return err;
- }
- priv->rx_idx_data =3D priv->tx_idx_data =3D 0;
- priv->rx_idx_mgmt =3D priv->tx_idx_mgmt =3D 0;
-
- p54p_refill_rx_ring(dev, 0, priv->ring_control->rx_data,
- ARRAY_SIZE(priv->ring_control->rx_data), priv->rx_buf_data);
-
- p54p_refill_rx_ring(dev, 2, priv->ring_control->rx_mgmt,
- ARRAY_SIZE(priv->ring_control->rx_mgmt), priv->rx_buf_mgmt);
-
- P54P_WRITE(ring_control_base, cpu_to_le32(priv->ring_control_dma));
- P54P_READ(ring_control_base);
- wmb();
- udelay(10);
-
- P54P_WRITE(int_enable, cpu_to_le32(ISL38XX_INT_IDENT_INIT));
- P54P_READ(int_enable);
- wmb();
- udelay(10);
-
- P54P_WRITE(dev_int, cpu_to_le32(ISL38XX_DEV_INT_RESET));
- P54P_READ(dev_int);
-
- if (!wait_for_completion_interruptible_timeout(&priv->boot_comp, HZ))=
{
- printk(KERN_ERR "%s: Cannot boot firmware!\n",
- wiphy_name(dev->wiphy));
- free_irq(priv->pdev->irq, dev);
- return -ETIMEDOUT;
- }
-
- P54P_WRITE(int_enable, cpu_to_le32(ISL38XX_INT_IDENT_UPDATE));
- P54P_READ(int_enable);
- wmb();
- udelay(10);
-
- P54P_WRITE(dev_int, cpu_to_le32(ISL38XX_DEV_INT_UPDATE));
- P54P_READ(dev_int);
- wmb();
- udelay(10);
-
- return 0;
-}
-
static void p54p_stop(struct ieee80211_hw *dev)
{
struct p54p_priv *priv =3D dev->priv;
@@ -474,6 +412,68 @@ static void p54p_stop(struct ieee80211_hw *dev)
memset(ring_control, 0, sizeof(*ring_control));
}
=20
+static int p54p_open(struct ieee80211_hw *dev)
+{
+ struct p54p_priv *priv =3D dev->priv;
+ int err;
+
+ init_completion(&priv->boot_comp);
+ err =3D request_irq(priv->pdev->irq, &p54p_interrupt,
+ IRQF_SHARED, "p54pci", dev);
+ if (err) {
+ printk(KERN_ERR "%s: failed to register IRQ handler\n",
+ wiphy_name(dev->wiphy));
+ return err;
+ }
+
+ memset(priv->ring_control, 0, sizeof(*priv->ring_control));
+ err =3D p54p_upload_firmware(dev);
+ if (err) {
+ free_irq(priv->pdev->irq, dev);
+ return err;
+ }
+ priv->rx_idx_data =3D priv->tx_idx_data =3D 0;
+ priv->rx_idx_mgmt =3D priv->tx_idx_mgmt =3D 0;
+
+ p54p_refill_rx_ring(dev, 0, priv->ring_control->rx_data,
+ ARRAY_SIZE(priv->ring_control->rx_data), priv->rx_buf_data);
+
+ p54p_refill_rx_ring(dev, 2, priv->ring_control->rx_mgmt,
+ ARRAY_SIZE(priv->ring_control->rx_mgmt), priv->rx_buf_mgmt);
+
+ P54P_WRITE(ring_control_base, cpu_to_le32(priv->ring_control_dma));
+ P54P_READ(ring_control_base);
+ wmb();
+ udelay(10);
+
+ P54P_WRITE(int_enable, cpu_to_le32(ISL38XX_INT_IDENT_INIT));
+ P54P_READ(int_enable);
+ wmb();
+ udelay(10);
+
+ P54P_WRITE(dev_int, cpu_to_le32(ISL38XX_DEV_INT_RESET));
+ P54P_READ(dev_int);
+
+ if (!wait_for_completion_interruptible_timeout(&priv->boot_comp, HZ))=
{
+ printk(KERN_ERR "%s: Cannot boot firmware!\n",
+ wiphy_name(dev->wiphy));
+ p54p_stop(dev);
+ return -ETIMEDOUT;
+ }
+
+ P54P_WRITE(int_enable, cpu_to_le32(ISL38XX_INT_IDENT_UPDATE));
+ P54P_READ(int_enable);
+ wmb();
+ udelay(10);
+
+ P54P_WRITE(dev_int, cpu_to_le32(ISL38XX_DEV_INT_UPDATE));
+ P54P_READ(dev_int);
+ wmb();
+ udelay(10);
+
+ return 0;
+}
+
static int __devinit p54p_probe(struct pci_dev *pdev,
const struct pci_device_id *id)
{
@@ -556,11 +556,13 @@ static int __devinit p54p_probe(struct pci_dev *p=
dev,
spin_lock_init(&priv->lock);
tasklet_init(&priv->rx_tasklet, p54p_rx_tasklet, (unsigned long)dev);
=20
- p54p_open(dev);
+ err =3D p54p_open(dev);
+ if (err)
+ goto err_free_common;
err =3D p54_read_eeprom(dev);
p54p_stop(dev);
if (err)
- goto err_free_desc;
+ goto err_free_common;
=20
err =3D ieee80211_register_hw(dev);
if (err) {
@@ -573,8 +575,6 @@ static int __devinit p54p_probe(struct pci_dev *pde=
v,
=20
err_free_common:
p54_free_common(dev);
-
- err_free_desc:
pci_free_consistent(pdev, sizeof(*priv->ring_control),
priv->ring_control, priv->ring_control_dma);

2008-10-21 19:56:31

by Christian Lamparter

[permalink] [raw]
Subject: [RFT/RFC][PATCH] p54: fix misbehavings when firmware can't be found

On Tuesday 21 October 2008 20:23:13 Andrew Morton wrote:
> (switched to email. Please respond via emailed reply-to-all, not via the
> bugzilla web interface).
>
> On Sat, 18 Oct 2008 09:13:00 -0700 (PDT)
>
> [email protected] wrote:
> > http://bugzilla.kernel.org/show_bug.cgi?id=11782
> >
> > Summary: p54 misbehaves when firmware can't be found
> > Product: Drivers
> > Version: 2.5
> > KernelVersion: 2.6.27-git8
> > Platform: All
> > OS/Version: Linux
> > Tree: Mainline
> > Status: NEW
> > Severity: low
> > Priority: P1
> > Component: network-wireless
> > AssignedTo: [email protected]
> > ReportedBy: [email protected]
> >
> >
> > Latest working kernel version: 2.6.26
>
well, you can increase 26 to 27. The patch that caused this regression
went into in 2.6.27-gitX so no stable kernel is affected only this pre-rc1...

anyway, I don't have any p54p hardware right now (for the next two weeks
to be more precise), so sean you have to test it and report back, otherwise
this will properly stay RFT...

I made two versions of the patch, both do the same,
so it more a matter of which one you would like to have.

I prefer the first and bigger one, since it hopefully won't break the other
patches I send some time ago for wireless-testing...

Regards,
Chr
---
diff --git a/drivers/net/wireless/p54/p54pci.c
b/drivers/net/wireless/p54/p54pci.c
index 1c2a02a..88b3cad 100644
--- a/drivers/net/wireless/p54/p54pci.c
+++ b/drivers/net/wireless/p54/p54pci.c
@@ -346,68 +346,6 @@ static void p54p_tx(struct ieee80211_hw *dev, struct
p54_control_hdr *data,
printk(KERN_INFO "%s: tx overflow.\n", wiphy_name(dev->wiphy));
}

-static int p54p_open(struct ieee80211_hw *dev)
-{
- struct p54p_priv *priv = dev->priv;
- int err;
-
- init_completion(&priv->boot_comp);
- err = request_irq(priv->pdev->irq, &p54p_interrupt,
- IRQF_SHARED, "p54pci", dev);
- if (err) {
- printk(KERN_ERR "%s: failed to register IRQ handler\n",
- wiphy_name(dev->wiphy));
- return err;
- }
-
- memset(priv->ring_control, 0, sizeof(*priv->ring_control));
- err = p54p_upload_firmware(dev);
- if (err) {
- free_irq(priv->pdev->irq, dev);
- return err;
- }
- priv->rx_idx_data = priv->tx_idx_data = 0;
- priv->rx_idx_mgmt = priv->tx_idx_mgmt = 0;
-
- p54p_refill_rx_ring(dev, 0, priv->ring_control->rx_data,
- ARRAY_SIZE(priv->ring_control->rx_data), priv->rx_buf_data);
-
- p54p_refill_rx_ring(dev, 2, priv->ring_control->rx_mgmt,
- ARRAY_SIZE(priv->ring_control->rx_mgmt), priv->rx_buf_mgmt);
-
- P54P_WRITE(ring_control_base, cpu_to_le32(priv->ring_control_dma));
- P54P_READ(ring_control_base);
- wmb();
- udelay(10);
-
- P54P_WRITE(int_enable, cpu_to_le32(ISL38XX_INT_IDENT_INIT));
- P54P_READ(int_enable);
- wmb();
- udelay(10);
-
- P54P_WRITE(dev_int, cpu_to_le32(ISL38XX_DEV_INT_RESET));
- P54P_READ(dev_int);
-
- if (!wait_for_completion_interruptible_timeout(&priv->boot_comp, HZ)) {
- printk(KERN_ERR "%s: Cannot boot firmware!\n",
- wiphy_name(dev->wiphy));
- free_irq(priv->pdev->irq, dev);
- return -ETIMEDOUT;
- }
-
- P54P_WRITE(int_enable, cpu_to_le32(ISL38XX_INT_IDENT_UPDATE));
- P54P_READ(int_enable);
- wmb();
- udelay(10);
-
- P54P_WRITE(dev_int, cpu_to_le32(ISL38XX_DEV_INT_UPDATE));
- P54P_READ(dev_int);
- wmb();
- udelay(10);
-
- return 0;
-}
-
static void p54p_stop(struct ieee80211_hw *dev)
{
struct p54p_priv *priv = dev->priv;
@@ -474,6 +412,68 @@ static void p54p_stop(struct ieee80211_hw *dev)
memset(ring_control, 0, sizeof(*ring_control));
}

+static int p54p_open(struct ieee80211_hw *dev)
+{
+ struct p54p_priv *priv = dev->priv;
+ int err;
+
+ init_completion(&priv->boot_comp);
+ err = request_irq(priv->pdev->irq, &p54p_interrupt,
+ IRQF_SHARED, "p54pci", dev);
+ if (err) {
+ printk(KERN_ERR "%s: failed to register IRQ handler\n",
+ wiphy_name(dev->wiphy));
+ return err;
+ }
+
+ memset(priv->ring_control, 0, sizeof(*priv->ring_control));
+ err = p54p_upload_firmware(dev);
+ if (err) {
+ free_irq(priv->pdev->irq, dev);
+ return err;
+ }
+ priv->rx_idx_data = priv->tx_idx_data = 0;
+ priv->rx_idx_mgmt = priv->tx_idx_mgmt = 0;
+
+ p54p_refill_rx_ring(dev, 0, priv->ring_control->rx_data,
+ ARRAY_SIZE(priv->ring_control->rx_data), priv->rx_buf_data);
+
+ p54p_refill_rx_ring(dev, 2, priv->ring_control->rx_mgmt,
+ ARRAY_SIZE(priv->ring_control->rx_mgmt), priv->rx_buf_mgmt);
+
+ P54P_WRITE(ring_control_base, cpu_to_le32(priv->ring_control_dma));
+ P54P_READ(ring_control_base);
+ wmb();
+ udelay(10);
+
+ P54P_WRITE(int_enable, cpu_to_le32(ISL38XX_INT_IDENT_INIT));
+ P54P_READ(int_enable);
+ wmb();
+ udelay(10);
+
+ P54P_WRITE(dev_int, cpu_to_le32(ISL38XX_DEV_INT_RESET));
+ P54P_READ(dev_int);
+
+ if (!wait_for_completion_interruptible_timeout(&priv->boot_comp, HZ)) {
+ printk(KERN_ERR "%s: Cannot boot firmware!\n",
+ wiphy_name(dev->wiphy));
+ p54p_stop(dev);
+ return -ETIMEDOUT;
+ }
+
+ P54P_WRITE(int_enable, cpu_to_le32(ISL38XX_INT_IDENT_UPDATE));
+ P54P_READ(int_enable);
+ wmb();
+ udelay(10);
+
+ P54P_WRITE(dev_int, cpu_to_le32(ISL38XX_DEV_INT_UPDATE));
+ P54P_READ(dev_int);
+ wmb();
+ udelay(10);
+
+ return 0;
+}
+
static int __devinit p54p_probe(struct pci_dev *pdev,
const struct pci_device_id *id)
{
@@ -556,11 +556,13 @@ static int __devinit p54p_probe(struct pci_dev *pdev,
spin_lock_init(&priv->lock);
tasklet_init(&priv->rx_tasklet, p54p_rx_tasklet, (unsigned long)dev);

- p54p_open(dev);
+ err = p54p_open(dev);
+ if (err)
+ goto err_free_common;
err = p54_read_eeprom(dev);
p54p_stop(dev);
if (err)
- goto err_free_desc;
+ goto err_free_common;

err = ieee80211_register_hw(dev);
if (err) {
@@ -573,8 +575,6 @@ static int __devinit p54p_probe(struct pci_dev *pdev,

err_free_common:
p54_free_common(dev);
-
- err_free_desc:
pci_free_consistent(pdev, sizeof(*priv->ring_control),
priv->ring_control, priv->ring_control_dma);

---





this is the alternative patch





---
diff --git a/drivers/net/wireless/p54/p54pci.c
b/drivers/net/wireless/p54/p54pci.c
index 1c2a02a..3f91fbc 100644
--- a/drivers/net/wireless/p54/p54pci.c
+++ b/drivers/net/wireless/p54/p54pci.c
@@ -346,6 +346,8 @@ static void p54p_tx(struct ieee80211_hw *dev, struct
p54_control_hdr *data,
printk(KERN_INFO "%s: tx overflow.\n", wiphy_name(dev->wiphy));
}

+static void p54p_stop(struct ieee80211_hw *dev);
+
static int p54p_open(struct ieee80211_hw *dev)
{
struct p54p_priv *priv = dev->priv;
@@ -391,7 +393,7 @@ static int p54p_open(struct ieee80211_hw *dev)
if (!wait_for_completion_interruptible_timeout(&priv->boot_comp, HZ)) {
printk(KERN_ERR "%s: Cannot boot firmware!\n",
wiphy_name(dev->wiphy));
- free_irq(priv->pdev->irq, dev);
+ p54p_stop(dev);
return -ETIMEDOUT;
}

@@ -556,11 +558,13 @@ static int __devinit p54p_probe(struct pci_dev *pdev,
spin_lock_init(&priv->lock);
tasklet_init(&priv->rx_tasklet, p54p_rx_tasklet, (unsigned long)dev);

- p54p_open(dev);
+ err = p54p_open(dev);
+ if (err)
+ goto err_free_common;
err = p54_read_eeprom(dev);
p54p_stop(dev);
if (err)
- goto err_free_desc;
+ goto err_free_common;

err = ieee80211_register_hw(dev);
if (err) {
@@ -573,8 +577,6 @@ static int __devinit p54p_probe(struct pci_dev *pdev,

err_free_common:
p54_free_common(dev);
-
- err_free_desc:
pci_free_consistent(pdev, sizeof(*priv->ring_control),
priv->ring_control, priv->ring_control_dma);


Attachments:
(No filename) (7.40 kB)
p54pci-fix-no-firmware-move.diff (4.51 kB)
p54pci-fix-no-firmware.diff (1.44 kB)
Download all attachments

2008-10-22 08:30:03

by Sean Young

[permalink] [raw]
Subject: Re: [RFT/RFC][PATCH] p54: fix misbehavings when firmware can't be found

On Tue, Oct 21, 2008 at 09:56:24PM +0200, Chr wrote:
> On Tuesday 21 October 2008 20:23:13 Andrew Morton wrote:
> > (switched to email. Please respond via emailed reply-to-all, not via the
> > bugzilla web interface).
> >
> > On Sat, 18 Oct 2008 09:13:00 -0700 (PDT)
> >
> > [email protected] wrote:
> > > http://bugzilla.kernel.org/show_bug.cgi?id=11782
> > >
> > > Summary: p54 misbehaves when firmware can't be found
> > > Product: Drivers
> > > Version: 2.5
> > > KernelVersion: 2.6.27-git8
> > > Platform: All
> > > OS/Version: Linux
> > > Tree: Mainline
> > > Status: NEW
> > > Severity: low
> > > Priority: P1
> > > Component: network-wireless
> > > AssignedTo: [email protected]
> > > ReportedBy: [email protected]
> > >
> > >
> > > Latest working kernel version: 2.6.26
> >
> well, you can increase 26 to 27. The patch that caused this regression
> went into in 2.6.27-gitX so no stable kernel is affected only this pre-rc1...
>
> anyway, I don't have any p54p hardware right now (for the next two weeks
> to be more precise), so sean you have to test it and report back, otherwise
> this will properly stay RFT...
>
> I made two versions of the patch, both do the same,
> so it more a matter of which one you would like to have.
>
> I prefer the first and bigger one, since it hopefully won't break the other
> patches I send some time ago for wireless-testing...

Both patches work. I tested both patches with the firmware not in place
(no stack trace) and in place (works as expected).

Thanks
Sean