Question on __pci_bus_find_cap().

From: Naresh Kumar Inna
Date: Fri May 07 2004 - 05:01:05 EST


Hi,

The PCI spec 3.0 says that the Capabilities List is terminated with 00H
which indicates the last capability in the linked list. But in the code of
'__pci_bus_find_cap()', the while loop ( see below) terminates when the
value of the position is < 0x40 or a ttl value becomes zero. Shouldnt it
simply check for the value 0x0 and terminate? Please let me know if I am
missing something. Here is the diff:

--- pci.c.orig 2004-04-04 09:06:54.000000000 +0530
+++ pci.c.mod 2004-05-07 15:06:50.000000000 +0530
@@ -71,7 +71,6 @@
{
u16 status;
u8 pos, id;
- int ttl = 48;

pci_bus_read_config_word(bus, devfn, PCI_STATUS, &status);
if (!(status & PCI_STATUS_CAP_LIST))
@@ -88,7 +87,7 @@
default:
return 0;
}
- while (ttl-- && pos >= 0x40) {
+ while (pos != 0x0) {
pos &= ~3;
pci_bus_read_config_byte(bus, devfn, pos + PCI_CAP_LIST_ID,
&id);
if (id == 0xff)

Regards,
Naresh Kumar,
HP-ISO,
Bangalore.



-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/