[PATCH] PCI changes and fixes for 2.5.72

From: Greg KH (greg@kroah.com)
Date: Thu Jun 19 2003 - 18:39:29 EST


ChangeSet 1.1327.5.1, 2003/06/16 16:43:45-07:00, willy@debian.org

[PATCH] PCI: Tidy up sysfs a bit

This patch contains a set of uncontroversial changes to PCI sysfs.

 - Always output 64-bit resources so userspace doesn't need ifdefs
   and 32-bit userspace works on 64-bit architectures. Separate them
   with spaces rather than tabs.
 - Prefix hex quantities with "0x"
 - Always show 7 resources for non-bridge devices, and all resources for
   bridges rather than stopping on the first empty resource.

 drivers/pci/pci-sysfs.c | 24 +++++++++++-------------
 1 files changed, 11 insertions(+), 13 deletions(-)

diff -Nru a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
--- a/drivers/pci/pci-sysfs.c Thu Jun 19 16:32:26 2003
+++ b/drivers/pci/pci-sysfs.c Thu Jun 19 16:32:26 2003
@@ -18,12 +18,6 @@
 
 #include "pci.h"
 
-#if BITS_PER_LONG == 32
-#define LONG_FORMAT "\t%08lx"
-#else
-#define LONG_FORMAT "\t%16lx"
-#endif
-
 /* show configuration fields */
 #define pci_config_attr(field, format_string) \
 static ssize_t \
@@ -36,11 +30,11 @@
 } \
 static DEVICE_ATTR(field, S_IRUGO, show_##field, NULL);
 
-pci_config_attr(vendor, "%04x\n");
-pci_config_attr(device, "%04x\n");
-pci_config_attr(subsystem_vendor, "%04x\n");
-pci_config_attr(subsystem_device, "%04x\n");
-pci_config_attr(class, "%06x\n");
+pci_config_attr(vendor, "0x%04x\n");
+pci_config_attr(device, "0x%04x\n");
+pci_config_attr(subsystem_vendor, "0x%04x\n");
+pci_config_attr(subsystem_device, "0x%04x\n");
+pci_config_attr(class, "0x%06x\n");
 pci_config_attr(irq, "%u\n");
 
 /* show resources */
@@ -50,9 +44,13 @@
         struct pci_dev * pci_dev = to_pci_dev(dev);
         char * str = buf;
         int i;
+ int max = 7;
+
+ if (pci_dev->subordinate)
+ max = DEVICE_COUNT_RESOURCE;
 
- for (i = 0; i < DEVICE_COUNT_RESOURCE && pci_resource_start(pci_dev,i); i++) {
- str += sprintf(str,LONG_FORMAT LONG_FORMAT LONG_FORMAT "\n",
+ for (i = 0; i < max; i++) {
+ str += sprintf(str,"0x%016lx 0x%016lx 0x%016lx\n",
                                pci_resource_start(pci_dev,i),
                                pci_resource_end(pci_dev,i),
                                pci_resource_flags(pci_dev,i));

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



This archive was generated by hypermail 2b29 : Mon Jun 23 2003 - 22:00:31 EST