struct device *mdev_parent_dev(struct mdev_device *mdev)
 {
-       return mdev->parent->dev;
+       return mdev->type->parent->dev;
 }
 EXPORT_SYMBOL(mdev_parent_dev);
 
 /* Caller must hold parent unreg_sem read or write lock */
 static void mdev_device_remove_common(struct mdev_device *mdev)
 {
-       struct mdev_parent *parent;
+       struct mdev_parent *parent = mdev->type->parent;
        int ret;
 
        mdev_remove_sysfs_files(mdev);
        device_del(&mdev->dev);
-       parent = mdev->parent;
        lockdep_assert_held(&parent->unreg_sem);
        ret = parent->ops->remove(mdev);
        if (ret)
        struct mdev_device *mdev = to_mdev_device(dev);
 
        /* Pairs with the get in mdev_device_create() */
-       mdev_put_parent(mdev->parent);
+       kobject_put(&mdev->type->kobj);
 
        mutex_lock(&mdev_list_lock);
        list_del(&mdev->next);
        mdev->dev.release = mdev_device_release;
        mdev->dev.groups = parent->ops->mdev_attr_groups;
        mdev->type = type;
-       mdev->parent = parent;
        /* Pairs with the put in mdev_device_release() */
-       mdev_get_parent(parent);
+       kobject_get(&type->kobj);
 
        guid_copy(&mdev->uuid, uuid);
        list_add(&mdev->next, &mdev_list);
 int mdev_device_remove(struct mdev_device *mdev)
 {
        struct mdev_device *tmp;
-       struct mdev_parent *parent;
+       struct mdev_parent *parent = mdev->type->parent;
 
        mutex_lock(&mdev_list_lock);
        list_for_each_entry(tmp, &mdev_list, next) {
        mdev->active = false;
        mutex_unlock(&mdev_list_lock);
 
-       parent = mdev->parent;
        /* Check if parent unregistration has started */
        if (!down_read_trylock(&parent->unreg_sem))
                return -ENODEV;
 
 static int vfio_mdev_open(struct vfio_device *core_vdev)
 {
        struct mdev_device *mdev = to_mdev_device(core_vdev->dev);
-       struct mdev_parent *parent = mdev->parent;
+       struct mdev_parent *parent = mdev->type->parent;
 
        int ret;
 
 static void vfio_mdev_release(struct vfio_device *core_vdev)
 {
        struct mdev_device *mdev = to_mdev_device(core_vdev->dev);
-       struct mdev_parent *parent = mdev->parent;
+       struct mdev_parent *parent = mdev->type->parent;
 
        if (likely(parent->ops->release))
                parent->ops->release(mdev);
                                     unsigned int cmd, unsigned long arg)
 {
        struct mdev_device *mdev = to_mdev_device(core_vdev->dev);
-       struct mdev_parent *parent = mdev->parent;
+       struct mdev_parent *parent = mdev->type->parent;
 
        if (unlikely(!parent->ops->ioctl))
                return -EINVAL;
                              size_t count, loff_t *ppos)
 {
        struct mdev_device *mdev = to_mdev_device(core_vdev->dev);
-       struct mdev_parent *parent = mdev->parent;
+       struct mdev_parent *parent = mdev->type->parent;
 
        if (unlikely(!parent->ops->read))
                return -EINVAL;
                               loff_t *ppos)
 {
        struct mdev_device *mdev = to_mdev_device(core_vdev->dev);
-       struct mdev_parent *parent = mdev->parent;
+       struct mdev_parent *parent = mdev->type->parent;
 
        if (unlikely(!parent->ops->write))
                return -EINVAL;
                          struct vm_area_struct *vma)
 {
        struct mdev_device *mdev = to_mdev_device(core_vdev->dev);
-       struct mdev_parent *parent = mdev->parent;
+       struct mdev_parent *parent = mdev->type->parent;
 
        if (unlikely(!parent->ops->mmap))
                return -EINVAL;
 static void vfio_mdev_request(struct vfio_device *core_vdev, unsigned int count)
 {
        struct mdev_device *mdev = to_mdev_device(core_vdev->dev);
-       struct mdev_parent *parent = mdev->parent;
+       struct mdev_parent *parent = mdev->type->parent;
 
        if (parent->ops->request)
                parent->ops->request(mdev, count);