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) {
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.
/* 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 */
kfree(viodev);
return NULL;
}
+ device_create_file(&viodev->dev, &dev_attr_name);
return viodev;
}