Patchwork pata_platform struct resource signness fix

login
register
mail settings
Submitter Wang Jian
Date Sept. 25, 2008, 8:36 a.m.
Message ID <20080925083622.GA2701@debian>
Download mbox | patch
Permalink /patch/1465/
State Not Applicable, archived
Headers show

Comments

Wang Jian - Sept. 25, 2008, 8:36 a.m.
Hi,

This patch is to pata_platform.c but at this time, it's powerpc specific
because it can only be triggerred using openfirmware, so I post the patch
here. The patch is against 2.6.26-rc8.

The problem is triggerred when ata device is populated using 
pata_of_platform.c, and no irq is assigned (poll mode, such as CF card).

pata_of_platform_probe() parse device tree and

        if (ret == NO_IRQ)
	                irq_res.start = irq_res.end = -1;

Then irq is 0xffffffff, not NULL. Probe will fail coz irq can't be
requested.


---
(irq_res->start > 0) will be true even when it is (-1). When the device
has no irq, irq_res->start is assigned (-1).

Signed-off-by: Wang Jian <lark@linux.net.cn>
---
 drivers/ata/pata_platform.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Leo Li - Sept. 25, 2008, 9:12 a.m.
On Thu, Sep 25, 2008 at 4:36 PM, Wang Jian <lark@linux.net.cn> wrote:
> Hi,
>
> This patch is to pata_platform.c but at this time, it's powerpc specific
> because it can only be triggerred using openfirmware, so I post the patch
> here. The patch is against 2.6.26-rc8.

Powerpc isn't the only arch to use openfirmware.  Anyway, you have to
cc linux-ide@vger.kernel.org if you want the patch to be merged.

- Leo
Wang Jian - Sept. 25, 2008, 9:30 a.m.
As I said, I didn't spend much time on the issue, so I don't know which patch
is better. (But I do think the patch to pata_of_platform.c is better ATM).

AFAIK, powerpc is the only consumer of pata_of_platform.c, so I think this list
is better for discussion.

I should cc: Anton Vorontsov <avorontsov@ru.mvista.com> but last time I cc:
him I got bounced.

Leo Li wrote:
> On Thu, Sep 25, 2008 at 4:36 PM, Wang Jian <lark@linux.net.cn> wrote:
>> Hi,
>>
>> This patch is to pata_platform.c but at this time, it's powerpc specific
>> because it can only be triggerred using openfirmware, so I post the patch
>> here. The patch is against 2.6.26-rc8.
> 
> Powerpc isn't the only arch to use openfirmware.  Anyway, you have to
> cc linux-ide@vger.kernel.org if you want the patch to be merged.
> 
> - Leo
> 
>

Patch

diff --git a/drivers/ata/pata_platform.c b/drivers/ata/pata_platform.c
index 8f65ad6..b12cd0c 100644
--- a/drivers/ata/pata_platform.c
+++ b/drivers/ata/pata_platform.c
@@ -123,7 +123,7 @@  int __devinit __pata_platform_probe(struct device *dev,
 	/*
 	 * And the IRQ
 	 */
-	if (irq_res && irq_res->start > 0) {
+	if (irq_res && irq_res->start != -1) {
 		irq = irq_res->start;
 		irq_flags = irq_res->flags;
 	}