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

Re: [sparc] Automatic sbus module loading (was: Adding Emanuele Rocca to the team)



On Sun, Apr 15, 2007 at 11:35:56PM -0400, Kyle McMartin wrote:
> sbus modules are loaded by matching on openfirmware devices...
> 

not if the of_device didn't have a modalias... money where my mouth
is time...

untested (as i don't own a sparc) patch attached.

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,



Reply to: