From 4178b5e968d03fd5d273eee883a373d47e15e781 Mon Sep 17 00:00:00 2001 From: Fabio Massimo Di Nitto Date: Wed, 20 Dec 2006 09:22:28 -0800 Subject: [PATCH] --- yaml --- r: 47639 b: refs/heads/master c: cf69eab231bb748b5c34912412a8fc8c763bcf57 h: refs/heads/master i: 47637: d884a75c24cfab483d26b01c9d3c52036146d3b1 47635: 190a536953fe6ca7db6a38db17e5790ca19ff623 47631: e1fe694a30439cd8c1d1bce9540785bd6331b628 v: v3 --- [refs] | 2 +- trunk/arch/sparc64/kernel/pci_common.c | 25 ++++++++++++++++++++++++- trunk/drivers/sbus/sbus.c | 18 +++++++++++++++++- 3 files changed, 42 insertions(+), 3 deletions(-) diff --git a/[refs] b/[refs] index 2516bad7b868..0b23ffd0dd30 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: d18d7682c18b617f523df6beea5ea0bd396ed0bd +refs/heads/master: cf69eab231bb748b5c34912412a8fc8c763bcf57 diff --git a/trunk/arch/sparc64/kernel/pci_common.c b/trunk/arch/sparc64/kernel/pci_common.c index 827ae30aa497..5a92cb90ebe0 100644 --- a/trunk/arch/sparc64/kernel/pci_common.c +++ b/trunk/arch/sparc64/kernel/pci_common.c @@ -7,6 +7,8 @@ #include #include #include +#include +#include #include #include @@ -129,6 +131,20 @@ static void __init fixup_obp_assignments(struct pci_dev *pdev, } } +static ssize_t +show_pciobppath_attr(struct device * dev, struct device_attribute * attr, char * buf) +{ + struct pci_dev *pdev; + struct pcidev_cookie *sysdata; + + pdev = to_pci_dev(dev); + sysdata = pdev->sysdata; + + return snprintf (buf, PAGE_SIZE, "%s\n", sysdata->prom_node->full_name); +} + +static DEVICE_ATTR(obppath, S_IRUSR | S_IRGRP | S_IROTH, show_pciobppath_attr, NULL); + /* Fill in the PCI device cookie sysdata for the given * PCI device. This cookie is the means by which one * can get to OBP and PCI controller specific information @@ -142,7 +158,7 @@ static void __init pdev_cookie_fillin(struct pci_pbm_info *pbm, struct pcidev_cookie *pcp; struct device_node *dp; struct property *prop; - int nregs, len; + int nregs, len, err; dp = find_device_prom_node(pbm, pdev, bus_node, &pregs, &nregs); @@ -215,6 +231,13 @@ static void __init pdev_cookie_fillin(struct pci_pbm_info *pbm, fixup_obp_assignments(pdev, pcp); pdev->sysdata = pcp; + + /* we don't really care if we can create this file or not, + * but we need to assign the result of the call or the world will fall + * under alien invasion and everybody will be frozen on a spaceship + * ready to be eaten on alpha centauri by some green and jelly humanoid. + */ + err = sysfs_create_file(&pdev->dev.kobj, &dev_attr_obppath.attr); } void __init pci_fill_in_pbm_cookies(struct pci_bus *pbus, diff --git a/trunk/drivers/sbus/sbus.c b/trunk/drivers/sbus/sbus.c index 98fcbb3d5560..6349dd617f85 100644 --- a/trunk/drivers/sbus/sbus.c +++ b/trunk/drivers/sbus/sbus.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include @@ -17,13 +18,25 @@ #include #include +static ssize_t +show_sbusobppath_attr(struct device * dev, struct device_attribute * attr, char * buf) +{ + struct sbus_dev *sbus; + + sbus = to_sbus_device(dev); + + return snprintf (buf, PAGE_SIZE, "%s\n", sbus->ofdev.node->full_name); +} + +static DEVICE_ATTR(obppath, S_IRUSR | S_IRGRP | S_IROTH, show_sbusobppath_attr, NULL); + struct sbus_bus *sbus_root; static void __init fill_sbus_device(struct device_node *dp, struct sbus_dev *sdev) { unsigned long base; void *pval; - int len; + int len, err; sdev->prom_node = dp->node; strcpy(sdev->prom_name, dp->name); @@ -66,6 +79,9 @@ static void __init fill_sbus_device(struct device_node *dp, struct sbus_dev *sde if (of_device_register(&sdev->ofdev) != 0) printk(KERN_DEBUG "sbus: device registration error for %s!\n", dp->path_component_name); + + /* WE HAVE BEEN INVADED BY ALIENS! */ + err = sysfs_create_file(&sdev->ofdev.dev.kobj, &dev_attr_obppath.attr); } static void __init sbus_bus_ranges_init(struct device_node *dp, struct sbus_bus *sbus)