From: Hollis Blanchard Date: Fri, 27 Feb 2004 03:30:41 +0000 (-0800) Subject: [PATCH] ppc64: virtual IO bus updates X-Git-Tag: v2.6.4-rc1~3 X-Git-Url: http://git.neil.brown.name/?a=commitdiff_plain;h=abd59f4ab940341353dd7ee4540b64c790d98a8d;p=history.git [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. --- diff --git a/arch/ppc64/kernel/vio.c b/arch/ppc64/kernel/vio.c index 7292fea34785..de52db4f915a 100644 --- a/arch/ppc64/kernel/vio.c +++ b/arch/ppc64/kernel/vio.c @@ -145,7 +145,7 @@ static int __init vio_bus_init(void) return 1; } 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); if (err) { @@ -194,6 +194,15 @@ static void __devinit vio_dev_release(struct device *dev) 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. * @of_node: The OF node for this device. @@ -251,8 +260,7 @@ struct vio_dev * __devinit vio_register_device(struct device_node *of_node) /* init generic 'struct device' fields: */ viodev->dev.parent = &vio_bus_device->dev; viodev->dev.bus = &vio_bus_type; - snprintf(viodev->dev.bus_id, BUS_ID_SIZE, "%s@%lx", - of_node->name, viodev->unit_address); + snprintf(viodev->dev.bus_id, BUS_ID_SIZE, "%lx", viodev->unit_address); viodev->dev.release = vio_dev_release; /* register with generic device framework */ @@ -263,6 +271,7 @@ struct vio_dev * __devinit vio_register_device(struct device_node *of_node) kfree(viodev); return NULL; } + device_create_file(&viodev->dev, &dev_attr_name); return viodev; }