From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Linux Kernel list <linux-kernel@vger.kernel.org>
Cc: Andrew Morton <akpm@osdl.org>, Greg KH <greg@kroah.com>
Subject: [PATCH] PCI / OF linkage in sysfs
Date: Wed, 04 Feb 2004 18:12:08 +1100 [thread overview]
Message-ID: <1075878713.992.3.camel@gaston> (raw)
Hi !
This patch adds a "devspec" property to all PCI entries in sysfs
that provides the full "Open Firmware" path to each device on
PPC and PPC64 platforms that have Open Firmware support.
For various reasons, the OF path is and will still be different than
the sysfs path, and userland needs the OF path for various things,
ranging from bootloader setup to XFree needing to access some OF
properties provided by the graphic card F-Code driver, etc...
The "devspec" name is what we already use for "macio" type devices,
it doesn't clash with anything else.
If you are happy with it, please apply (independently of the rest
of the PowerMac patch), I need that to fix various things in XFree
(among others), so it would be nice to have it in by 2.6.3 final
Regards,
Ben.
diff -urN linux-2.5/drivers/pci/pci-sysfs.c linuxppc-2.5-benh/drivers/pci/pci-sysfs.c
--- linux-2.5/drivers/pci/pci-sysfs.c 2004-02-02 13:09:08.000000000 +1100
+++ linuxppc-2.5-benh/drivers/pci/pci-sysfs.c 2004-02-04 17:57:05.000000000 +1100
@@ -20,6 +20,24 @@
#include "pci.h"
+#ifdef CONFIG_PPC_OF
+#include <asm/prom.h>
+#include <asm/pci-bridge.h>
+
+static ssize_t pci_show_devspec(struct device *dev, char *buf)
+{
+ struct pci_dev *pdev;
+ struct device_node *np;
+
+ pdev = to_pci_dev (dev);
+ np = pci_device_to_OF_node(pdev);
+ if (np == NULL || np->full_name == NULL)
+ return 0;
+ return sprintf(buf, "%s", np->full_name);
+}
+static DEVICE_ATTR(devspec, S_IRUGO, pci_show_devspec, NULL);
+#endif /* CONFIG_PPC_OF */
+
/* show configuration fields */
#define pci_config_attr(field, format_string) \
static ssize_t \
@@ -179,5 +197,8 @@
device_create_file (dev, &dev_attr_class);
device_create_file (dev, &dev_attr_irq);
device_create_file (dev, &dev_attr_resource);
+#ifdef CONFIG_PPC_OF
+ device_create_file (dev, &dev_attr_devspec);
+#endif
sysfs_create_bin_file(&dev->kobj, &pci_config_attr);
}
next reply other threads:[~2004-02-04 7:12 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-02-04 7:12 Benjamin Herrenschmidt [this message]
2004-02-04 22:08 ` [PATCH] PCI / OF linkage in sysfs Linus Torvalds
2004-02-04 23:13 ` Greg KH
2004-02-04 23:28 ` Benjamin Herrenschmidt
2004-02-04 23:39 ` Greg KH
2004-02-04 23:28 ` Linus Torvalds
2004-02-04 23:38 ` Greg KH
2004-02-04 23:50 ` Benjamin Herrenschmidt
2004-02-05 0:04 ` Linus Torvalds
2004-02-05 0:13 ` Benjamin Herrenschmidt
2004-02-05 0:39 ` Linus Torvalds
2004-02-05 0:50 ` Benjamin Herrenschmidt
2004-02-05 15:08 ` Eric W. Biederman
2004-02-04 23:26 ` Benjamin Herrenschmidt
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=1075878713.992.3.camel@gaston \
--to=benh@kernel.crashing.org \
--cc=akpm@osdl.org \
--cc=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