[PATCH] sparc64: modalias support for of_device

From: Kyle McMartin
Date: Mon Apr 16 2007 - 00:22:02 EST


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 majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/