]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/powerpc/platforms/ps3/system-bus.c
Driver core: change add_uevent_var to use a struct
[linux-2.6-omap-h63xx.git] / arch / powerpc / platforms / ps3 / system-bus.c
index 14bbaff93e57647b252e24c2076714650b38d100..ea0b2c790412483b29438f5b18b8d6693370b2d0 100644 (file)
@@ -437,12 +437,38 @@ static void ps3_system_bus_shutdown(struct device *_dev)
        dev_dbg(&dev->core, " <- %s:%d\n", __func__, __LINE__);
 }
 
+static int ps3_system_bus_uevent(struct device *_dev, struct kobj_uevent_env *env)
+{
+       struct ps3_system_bus_device *dev = ps3_dev_to_system_bus_dev(_dev);
+       int i = 0, length = 0;
+
+       if (add_uevent_var(env, "MODALIAS=ps3:%d", dev->match_id))
+               return -ENOMEM;
+       return 0;
+}
+
+static ssize_t modalias_show(struct device *_dev, struct device_attribute *a,
+       char *buf)
+{
+       struct ps3_system_bus_device *dev = ps3_dev_to_system_bus_dev(_dev);
+       int len = snprintf(buf, PAGE_SIZE, "ps3:%d\n", dev->match_id);
+
+       return (len >= PAGE_SIZE) ? (PAGE_SIZE - 1) : len;
+}
+
+static struct device_attribute ps3_system_bus_dev_attrs[] = {
+       __ATTR_RO(modalias),
+       __ATTR_NULL,
+};
+
 struct bus_type ps3_system_bus_type = {
        .name = "ps3_system_bus",
        .match = ps3_system_bus_match,
+       .uevent = ps3_system_bus_uevent,
        .probe = ps3_system_bus_probe,
        .remove = ps3_system_bus_remove,
        .shutdown = ps3_system_bus_shutdown,
+       .dev_attrs = ps3_system_bus_dev_attrs,
 };
 
 static int __init ps3_system_bus_init(void)