struct mdev_driver {
             int  (*probe)  (struct mdev_device *dev);
             void (*remove) (struct mdev_device *dev);
+            struct attribute_group **supported_type_groups;
             struct device_driver    driver;
      };
 
 
     extern void mdev_unregister_driver(struct mdev_driver *drv);
 
-The mediated bus driver is responsible for adding mediated devices to the VFIO
-group when devices are bound to the driver and removing mediated devices from
-the VFIO when devices are unbound from the driver.
-
-
-Physical Device Driver Interface
---------------------------------
-
-The physical device driver interface provides the mdev_parent_ops[3] structure
-to define the APIs to manage work in the mediated core driver that is related
-to the physical device.
-
-The structures in the mdev_parent_ops structure are as follows:
-
-* dev_attr_groups: attributes of the parent device
-* mdev_attr_groups: attributes of the mediated device
-* supported_config: attributes to define supported configurations
-* device_driver: device driver to bind for mediated device instances
+The mediated bus driver's probe function should create a vfio_device on top of
+the mdev_device and connect it to an appropriate implementation of
+vfio_device_ops.
 
 When a driver wants to add the GUID creation sysfs to an existing device it has
 probe'd to then it should call::
 
        extern int  mdev_register_device(struct device *dev,
-                                        const struct mdev_parent_ops *ops);
+                                        struct mdev_driver *mdev_driver);
 
 This will provide the 'mdev_supported_types/XX/create' files which can then be
 used to trigger the creation of a mdev_device. The created mdev_device will be
 
        },
        .probe          = intel_vgpu_probe,
        .remove         = intel_vgpu_remove,
-};
-
-static const struct mdev_parent_ops intel_vgpu_mdev_ops = {
-       .owner                  = THIS_MODULE,
        .supported_type_groups  = gvt_vgpu_type_groups,
-       .device_driver          = &intel_vgpu_mdev_driver,
 };
 
 int intel_gvt_page_track_add(struct intel_vgpu *info, u64 gfn)
        if (ret)
                goto out_destroy_idle_vgpu;
 
-       ret = mdev_register_device(i915->drm.dev, &intel_vgpu_mdev_ops);
+       ret = mdev_register_device(i915->drm.dev, &intel_vgpu_mdev_driver);
        if (ret)
                goto out_cleanup_vgpu_type_groups;
 
 
        },
        .probe = vfio_ccw_mdev_probe,
        .remove = vfio_ccw_mdev_remove,
-};
-
-static const struct mdev_parent_ops vfio_ccw_mdev_ops = {
-       .owner                  = THIS_MODULE,
-       .device_driver          = &vfio_ccw_mdev_driver,
        .supported_type_groups  = mdev_type_groups,
 };
 
 int vfio_ccw_mdev_reg(struct subchannel *sch)
 {
-       return mdev_register_device(&sch->dev, &vfio_ccw_mdev_ops);
+       return mdev_register_device(&sch->dev, &vfio_ccw_mdev_driver);
 }
 
 void vfio_ccw_mdev_unreg(struct subchannel *sch)
 
        },
        .probe = vfio_ap_mdev_probe,
        .remove = vfio_ap_mdev_remove,
-};
-
-static const struct mdev_parent_ops vfio_ap_matrix_ops = {
-       .owner                  = THIS_MODULE,
-       .device_driver          = &vfio_ap_matrix_driver,
-       .supported_type_groups  = vfio_ap_mdev_type_groups,
+       .supported_type_groups = vfio_ap_mdev_type_groups,
 };
 
 int vfio_ap_mdev_register(void)
        if (ret)
                return ret;
 
-       ret = mdev_register_device(&matrix_dev->device, &vfio_ap_matrix_ops);
+       ret = mdev_register_device(&matrix_dev->device, &vfio_ap_matrix_driver);
        if (ret)
                goto err_driver;
        return 0;
 
 /*
  * mdev_register_device : Register a device
  * @dev: device structure representing parent device.
- * @ops: Parent device operation structure to be registered.
+ * @mdev_driver: Device driver to bind to the newly created mdev
  *
  * Add device to list of registered parent devices.
  * Returns a negative value on error, otherwise 0.
  */
-int mdev_register_device(struct device *dev, const struct mdev_parent_ops *ops)
+int mdev_register_device(struct device *dev, struct mdev_driver *mdev_driver)
 {
        int ret;
        struct mdev_parent *parent;
        char *envp[] = { env_string, NULL };
 
        /* check for mandatory ops */
-       if (!ops || !ops->supported_type_groups)
-               return -EINVAL;
-       if (!ops->device_driver)
+       if (!mdev_driver->supported_type_groups)
                return -EINVAL;
 
        dev = get_device(dev);
        init_rwsem(&parent->unreg_sem);
 
        parent->dev = dev;
-       parent->ops = ops;
+       parent->mdev_driver = mdev_driver;
 
        if (!mdev_bus_compat_class) {
                mdev_bus_compat_class = class_compat_register("mdev_bus");
        int ret;
        struct mdev_device *mdev, *tmp;
        struct mdev_parent *parent = type->parent;
-       struct mdev_driver *drv = parent->ops->device_driver;
+       struct mdev_driver *drv = parent->mdev_driver;
 
        mutex_lock(&mdev_list_lock);
 
        mdev->dev.parent  = parent->dev;
        mdev->dev.bus = &mdev_bus_type;
        mdev->dev.release = mdev_device_release;
-       mdev->dev.groups = parent->ops->mdev_attr_groups;
        mdev->type = type;
        /* Pairs with the put in mdev_device_release() */
        kobject_get(&type->kobj);
 
 
 struct mdev_parent {
        struct device *dev;
-       const struct mdev_parent_ops *ops;
+       struct mdev_driver *mdev_driver;
        struct kref ref;
        struct list_head next;
        struct kset *mdev_types_kset;
 
 {
        struct mdev_type *type;
        struct attribute_group *group =
-               parent->ops->supported_type_groups[type_group_id];
+               parent->mdev_driver->supported_type_groups[type_group_id];
        int ret;
 
        if (!group->name) {
 static void remove_mdev_supported_type(struct mdev_type *type)
 {
        struct attribute_group *group =
-               type->parent->ops->supported_type_groups[type->type_group_id];
+               type->parent->mdev_driver->supported_type_groups[type->type_group_id];
 
        sysfs_remove_files(&type->kobj,
                           (const struct attribute **)group->attrs);
 {
        int i;
 
-       for (i = 0; parent->ops->supported_type_groups[i]; i++) {
+       for (i = 0; parent->mdev_driver->supported_type_groups[i]; i++) {
                struct mdev_type *type;
 
                type = add_mdev_supported_type(parent, i);
 
 unsigned int mtype_get_type_group_id(struct mdev_type *mtype);
 struct device *mtype_get_parent_dev(struct mdev_type *mtype);
 
-/**
- * struct mdev_parent_ops - Structure to be registered for each parent device to
- * register the device to mdev module.
- *
- * @owner:             The module owner.
- * @device_driver:     Which device driver to probe() on newly created devices
- * @mdev_attr_groups:  Attributes of the mediated device.
- * @supported_type_groups: Attributes to define supported types. It is mandatory
- *                     to provide supported types.
- *
- * Parent device that support mediated device should be registered with mdev
- * module with mdev_parent_ops structure.
- **/
-struct mdev_parent_ops {
-       struct module   *owner;
-       struct mdev_driver *device_driver;
-       const struct attribute_group **mdev_attr_groups;
-       struct attribute_group **supported_type_groups;
-};
-
 /* interface for exporting mdev supported type attributes */
 struct mdev_type_attribute {
        struct attribute attr;
  * struct mdev_driver - Mediated device driver
  * @probe: called when new device created
  * @remove: called when device removed
+ * @supported_type_groups: Attributes to define supported types. It is mandatory
+ *                     to provide supported types.
  * @driver: device driver structure
  *
  **/
 struct mdev_driver {
        int (*probe)(struct mdev_device *dev);
        void (*remove)(struct mdev_device *dev);
+       struct attribute_group **supported_type_groups;
        struct device_driver driver;
 };
 
 
 extern struct bus_type mdev_bus_type;
 
-int mdev_register_device(struct device *dev, const struct mdev_parent_ops *ops);
+int mdev_register_device(struct device *dev, struct mdev_driver *mdev_driver);
 void mdev_unregister_device(struct device *dev);
 
 int mdev_register_driver(struct mdev_driver *drv);
 
        },
        .probe = mbochs_probe,
        .remove = mbochs_remove,
-};
-
-static const struct mdev_parent_ops mdev_fops = {
-       .owner                  = THIS_MODULE,
-       .device_driver          = &mbochs_driver,
-       .supported_type_groups  = mdev_type_groups,
+       .supported_type_groups = mdev_type_groups,
 };
 
 static const struct file_operations vd_fops = {
        if (ret)
                goto err_class;
 
-       ret = mdev_register_device(&mbochs_dev, &mdev_fops);
+       ret = mdev_register_device(&mbochs_dev, &mbochs_driver);
        if (ret)
                goto err_device;
 
 
        },
        .probe = mdpy_probe,
        .remove = mdpy_remove,
-};
-
-static const struct mdev_parent_ops mdev_fops = {
-       .owner                  = THIS_MODULE,
-       .device_driver          = &mdpy_driver,
-       .supported_type_groups  = mdev_type_groups,
+       .supported_type_groups = mdev_type_groups,
 };
 
 static const struct file_operations vd_fops = {
        if (ret)
                goto err_class;
 
-       ret = mdev_register_device(&mdpy_dev, &mdev_fops);
+       ret = mdev_register_device(&mdpy_dev, &mdpy_driver);
        if (ret)
                goto err_device;
 
 
        },
        .probe = mtty_probe,
        .remove = mtty_remove,
-};
-
-static const struct mdev_parent_ops mdev_fops = {
-       .owner                  = THIS_MODULE,
-       .device_driver          = &mtty_driver,
-       .supported_type_groups  = mdev_type_groups,
+       .supported_type_groups = mdev_type_groups,
 };
 
 static void mtty_device_release(struct device *dev)
        if (ret)
                goto err_class;
 
-       ret = mdev_register_device(&mtty_dev.dev, &mdev_fops);
+       ret = mdev_register_device(&mtty_dev.dev, &mtty_driver);
        if (ret)
                goto err_device;
        return 0;