]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/ppc64/kernel/iSeries_vio.c
Merge master.kernel.org:/pub/scm/linux/kernel/git/dtor/input
[linux-2.6-omap-h63xx.git] / arch / ppc64 / kernel / iSeries_vio.c
index e876b4380278797ebe4fdf7b6eb317ac86aafd41..6b754b0c83449651256e232ea8073f72a29bed31 100644 (file)
@@ -27,7 +27,7 @@ EXPORT_SYMBOL(iSeries_vio_dev);
 static struct iommu_table veth_iommu_table;
 static struct iommu_table vio_iommu_table;
 
-void __init iommu_vio_init(void)
+static void __init iommu_vio_init(void)
 {
        struct iommu_table *t;
        struct iommu_table_cb cb;
@@ -68,7 +68,7 @@ void __init iommu_vio_init(void)
 }
 
 /**
- * vio_register_device: - Register a new vio device.
+ * vio_register_device_iseries: - Register a new iSeries vio device.
  * @voidev:    The device to register.
  */
 static struct vio_dev *__init vio_register_device_iseries(char *type,
@@ -76,7 +76,7 @@ static struct vio_dev *__init vio_register_device_iseries(char *type,
 {
        struct vio_dev *viodev;
 
-       /* allocate a vio_dev for this node */
+       /* allocate a vio_dev for this device */
        viodev = kmalloc(sizeof(struct vio_dev), GFP_KERNEL);
        if (!viodev)
                return NULL;
@@ -84,8 +84,15 @@ static struct vio_dev *__init vio_register_device_iseries(char *type,
 
        snprintf(viodev->dev.bus_id, BUS_ID_SIZE, "%s%d", type, unit_num);
 
-       return vio_register_device_common(viodev, viodev->dev.bus_id, type,
-                       unit_num, &vio_iommu_table);
+       viodev->name = viodev->dev.bus_id;
+       viodev->type = type;
+       viodev->unit_address = unit_num;
+       viodev->iommu_table = &vio_iommu_table;
+       if (vio_register_device(viodev) == NULL) {
+               kfree(viodev);
+               return NULL;
+       }
+       return viodev;
 }
 
 void __init probe_bus_iseries(void)
@@ -114,6 +121,20 @@ void __init probe_bus_iseries(void)
                vio_register_device_iseries("viotape", i);
 }
 
+/**
+ * vio_match_device_iseries: - Tell if a iSeries VIO device matches a
+ *     vio_device_id
+ */
+static int vio_match_device_iseries(const struct vio_device_id *id,
+               const struct vio_dev *dev)
+{
+       return strncmp(dev->type, id->type, strlen(id->type)) == 0;
+}
+
+static struct vio_bus_ops vio_bus_ops_iseries = {
+       .match = vio_match_device_iseries,
+};
+
 /**
  * vio_bus_init_iseries: - Initialize the iSeries virtual IO bus
  */
@@ -121,8 +142,9 @@ static int __init vio_bus_init_iseries(void)
 {
        int err;
 
-       err = vio_bus_init();
+       err = vio_bus_init(&vio_bus_ops_iseries);
        if (err == 0) {
+               iommu_vio_init();
                vio_bus_device.iommu_table = &vio_iommu_table;
                iSeries_vio_dev = &vio_bus_device.dev;
                probe_bus_iseries();