]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/sbus/sbus.c
Merge branch 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm
[linux-2.6-omap-h63xx.git] / drivers / sbus / sbus.c
index 935952ef88f19d04127a560a2b2942d5a54c9c56..002643392d424accdbeb33a79f546bbe5c5d8543 100644 (file)
@@ -6,7 +6,7 @@
 #include <linux/kernel.h>
 #include <linux/slab.h>
 #include <linux/init.h>
-#include <linux/pci.h>
+#include <linux/device.h>
 
 #include <asm/system.h>
 #include <asm/sbus.h>
 #include <asm/bpp.h>
 #include <asm/irq.h>
 
+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;
+       const void *pval;
+       int len, err;
 
        sdev->prom_node = dp->node;
        strcpy(sdev->prom_name, dp->name);
@@ -61,16 +73,19 @@ static void __init fill_sbus_device(struct device_node *dp, struct sbus_dev *sde
        else
                sdev->ofdev.dev.parent = &sdev->bus->ofdev.dev;
        sdev->ofdev.dev.bus = &sbus_bus_type;
-       strcpy(sdev->ofdev.dev.bus_id, dp->path_component_name);
+       sprintf(sdev->ofdev.dev.bus_id, "sbus[%08x]", dp->node);
 
        if (of_device_register(&sdev->ofdev) != 0)
                printk(KERN_DEBUG "sbus: device registration error for %s!\n",
-                      sdev->ofdev.dev.bus_id);
+                      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)
 {
-       void *pval;
+       const void *pval;
        int len;
 
        pval = of_get_property(dp, "ranges", &len);