From: Greg KH <greg@kroah.com>
To: linux-kernel@vger.kernel.org
Subject: [PATCH] PCI changes and fixes for 2.5.72
Date: Thu, 19 Jun 2003 16:39:29 -0700 [thread overview]
Message-ID: <1056065969234@kroah.com> (raw)
In-Reply-To: <20030619233727.GA7200@kroah.com>
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));
next prev parent reply other threads:[~2003-06-19 23:28 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-06-19 23:37 [BK PATCH] PCI changes and fixes for 2.5.72 Greg KH
2003-06-19 23:39 ` Greg KH [this message]
2003-06-19 23:39 ` [PATCH] " Greg KH
2003-06-19 23:39 ` Greg KH
2003-06-19 23:39 ` Greg KH
2003-06-19 23:39 ` Greg KH
2003-06-19 23:39 ` Greg KH
2003-06-19 23:39 ` Greg KH
2003-06-19 23:39 ` Greg KH
-- strict thread matches above, loose matches on Subject: below --
2003-06-20 15:44 Albert Cahalan
2003-06-20 18:35 ` Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1056065969234@kroah.com \
--to=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox