Commit abd59f4a authored by Hollis Blanchard's avatar Hollis Blanchard Committed by Linus Torvalds

[PATCH] ppc64: virtual IO bus updates

This makes GregKH happy by removing the device name from the
device.bus_id field (and replacing it with a "name" sysfs attribute).

It also renames the parent device from "vdevice" to "vio", making the
/sys/bus and /sys/devices hierarchies consistent.
parent f8c72e9e
...@@ -145,7 +145,7 @@ static int __init vio_bus_init(void) ...@@ -145,7 +145,7 @@ static int __init vio_bus_init(void)
return 1; return 1;
} }
memset(vio_bus_device, 0, sizeof(struct vio_dev)); memset(vio_bus_device, 0, sizeof(struct vio_dev));
strcpy(vio_bus_device->dev.bus_id, "vdevice"); strcpy(vio_bus_device->dev.bus_id, "vio");
err = device_register(&vio_bus_device->dev); err = device_register(&vio_bus_device->dev);
if (err) { if (err) {
...@@ -194,6 +194,15 @@ static void __devinit vio_dev_release(struct device *dev) ...@@ -194,6 +194,15 @@ static void __devinit vio_dev_release(struct device *dev)
kfree(viodev); kfree(viodev);
} }
static ssize_t viodev_show_name(struct device *dev, char *buf)
{
struct vio_dev *viodev = to_vio_dev(dev);
struct device_node *of_node = viodev->archdata;
return sprintf(buf, "%s\n", of_node->name);
}
DEVICE_ATTR(name, S_IRUSR | S_IRGRP | S_IROTH, viodev_show_name, NULL);
/** /**
* vio_register_device: - Register a new vio device. * vio_register_device: - Register a new vio device.
* @of_node: The OF node for this device. * @of_node: The OF node for this device.
...@@ -251,8 +260,7 @@ struct vio_dev * __devinit vio_register_device(struct device_node *of_node) ...@@ -251,8 +260,7 @@ struct vio_dev * __devinit vio_register_device(struct device_node *of_node)
/* init generic 'struct device' fields: */ /* init generic 'struct device' fields: */
viodev->dev.parent = &vio_bus_device->dev; viodev->dev.parent = &vio_bus_device->dev;
viodev->dev.bus = &vio_bus_type; viodev->dev.bus = &vio_bus_type;
snprintf(viodev->dev.bus_id, BUS_ID_SIZE, "%s@%lx", snprintf(viodev->dev.bus_id, BUS_ID_SIZE, "%lx", viodev->unit_address);
of_node->name, viodev->unit_address);
viodev->dev.release = vio_dev_release; viodev->dev.release = vio_dev_release;
/* register with generic device framework */ /* register with generic device framework */
...@@ -263,6 +271,7 @@ struct vio_dev * __devinit vio_register_device(struct device_node *of_node) ...@@ -263,6 +271,7 @@ struct vio_dev * __devinit vio_register_device(struct device_node *of_node)
kfree(viodev); kfree(viodev);
return NULL; return NULL;
} }
device_create_file(&viodev->dev, &dev_attr_name);
return viodev; return viodev;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment