[PATCH] sparc64: modalias support for of_device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Dave,

Quick patch to add modalias support for of_device to arch/sparc64 so
sbus drivers can be automatically loaded (I hope :)

Untested, as I'm sparc-less at the moment.

Cheers,
	Kyle

diff --git a/arch/sparc64/kernel/of_device.c b/arch/sparc64/kernel/of_device.c
index fb9bf1e..d00ed90 100644
--- a/arch/sparc64/kernel/of_device.c
+++ b/arch/sparc64/kernel/of_device.c
@@ -173,6 +173,19 @@ struct of_device *of_find_device_by_node(struct device_node *dp)
 }
 EXPORT_SYMBOL(of_find_device_by_node);
 
+static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
+			     char *buf)
+{
+	ssize_t len;
+	struct of_device *d = to_of_device(dev);
+	struct device_node *node = d->node;
+
+	len = sprintf(buf, "of:N%sT%sC%s\n",
+		      node->name, node->type, "*");
+
+	return len;
+}
+
 #ifdef CONFIG_PCI
 struct bus_type isa_bus_type = {
        .name	= "isa",
@@ -207,9 +220,15 @@ struct bus_type sbus_bus_type = {
 EXPORT_SYMBOL(sbus_bus_type);
 #endif
 
+static struct device_attribute of_dev_attrs[] = {
+	__ATTR_RO(modalias),
+	__ATTR_NULL
+};
+
 struct bus_type of_bus_type = {
        .name	= "of",
        .match	= of_platform_bus_match,
+       .dev_attrs	= of_dev_attrs,
        .probe	= of_device_probe,
        .remove	= of_device_remove,
        .suspend	= of_device_suspend,
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux