[Pkg-pciutils-discuss] Removing the last lspci diff vs upstream

Matthew Wilcox matthew at wil.cx
Tue Jun 6 18:27:54 UTC 2006


This is the last difference between the Debian package and upstream in
lspci.c.  I'm going to revert it unless someone thinks it's worthwhile:

Index: lspci.c
===================================================================
RCS file: /cvsroot/pkg-pciutils/pciutils/lspci.c,v
retrieving revision 1.1.1.3
retrieving revision 1.9
diff -u -p -r1.1.1.3 -r1.9
--- lspci.c	6 Jun 2006 11:36:23 -0000	1.1.1.3
+++ lspci.c	6 Jun 2006 11:57:56 -0000	1.9
@@ -121,7 +121,11 @@ scan_device(struct pci_dev *p)
   d->present = xmalloc(64);
   memset(d->present, 1, 64);
   if (!pci_read_block(p, 0, d->config, 64))
-    die("Unable to read the standard configuration space header");
+    {
+      fprintf(stderr, "Unable to read 64 bytes of configuration space\n");
+      return NULL;
+    }
+     
   if ((d->config[PCI_HEADER_TYPE] & 0x7f) == PCI_HEADER_TYPE_CARDBUS)
     {
       /* For cardbus bridges, we need to fetch 64 bytes more to get the


This probably made a lot more sense before 2.2.1.  Then, the code looked
like this:

@@ -100,22 +102,25 @@ static struct device *
 scan_device(struct pci_dev *p)
 {
   int how_much = (show_hex > 2) ? 256 : 64;
   struct device *d;
 
   if (!pci_filter_match(&filter, p))
     return NULL;
   d = xmalloc(sizeof(struct device));
   bzero(d, sizeof(*d));
   d->dev = p;
-  if (!pci_read_block(p, 0, d->config, how_much))
-    die("Unable to read %d bytes of configuration space.", how_much);
+  if (!pci_read_block(p, 0, d->config, how_much)) {
+     fprintf(stderr, "Unable to read %d bytes of configuration space.",
+           how_much);
+     return NULL;
+  }

so we'd try to read 256 bytes if -xxx was specified.  The current
situation with 64 bytes being read, then more as necessary, is much
better.  I don't think there are any PCI devices that are so messed up
that they can't read the first 64 bytes of config space.




More information about the Pkg-pciutils-discuss mailing list