vfio/mdev: Remove kobj from mdev_parent_ops->create()
authorJason Gunthorpe <jgg@nvidia.com>
Tue, 6 Apr 2021 19:40:40 +0000 (16:40 -0300)
committerAlex Williamson <alex.williamson@redhat.com>
Mon, 12 Apr 2021 16:36:00 +0000 (10:36 -0600)
The kobj here is a type-erased version of mdev_type, which is already
stored in the struct mdev_device being passed in. It was only ever used to
compute the type_group_id, which is now extracted directly from the mdev.

Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Message-Id: <17-v2-d36939638fc6+d54-vfio2_jgg@nvidia.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
drivers/gpu/drm/i915/gvt/kvmgt.c
drivers/s390/cio/vfio_ccw_ops.c
drivers/s390/crypto/vfio_ap_ops.c
drivers/vfio/mdev/mdev_core.c
include/linux/mdev.h
samples/vfio-mdev/mbochs.c
samples/vfio-mdev/mdpy.c
samples/vfio-mdev/mtty.c

index 16e1e4a..6bf176e 100644 (file)
@@ -689,7 +689,7 @@ static void kvmgt_put_vfio_device(void *vgpu)
        vfio_device_put(vdev->vfio_device);
 }
 
-static int intel_vgpu_create(struct kobject *kobj, struct mdev_device *mdev)
+static int intel_vgpu_create(struct mdev_device *mdev)
 {
        struct intel_vgpu *vgpu = NULL;
        struct intel_vgpu_type *type;
index 767ac41..10407cf 100644 (file)
@@ -110,7 +110,7 @@ static struct attribute_group *mdev_type_groups[] = {
        NULL,
 };
 
-static int vfio_ccw_mdev_create(struct kobject *kobj, struct mdev_device *mdev)
+static int vfio_ccw_mdev_create(struct mdev_device *mdev)
 {
        struct vfio_ccw_private *private =
                dev_get_drvdata(mdev_parent_dev(mdev));
index 1ffdd41..d319152 100644 (file)
@@ -322,7 +322,7 @@ static void vfio_ap_matrix_init(struct ap_config_info *info,
        matrix->adm_max = info->apxa ? info->Nd : 15;
 }
 
-static int vfio_ap_mdev_create(struct kobject *kobj, struct mdev_device *mdev)
+static int vfio_ap_mdev_create(struct mdev_device *mdev)
 {
        struct ap_matrix_mdev *matrix_mdev;
 
index 5ae06f9..10eff33 100644 (file)
@@ -286,7 +286,7 @@ int mdev_device_create(struct mdev_type *type, const guid_t *uuid)
                goto out_put_device;
        }
 
-       ret = parent->ops->create(&type->kobj, mdev);
+       ret = parent->ops->create(mdev);
        if (ret)
                goto out_unlock;
 
index 41e9193..c3a8000 100644 (file)
@@ -61,7 +61,6 @@ unsigned int mtype_get_type_group_id(struct kobject *mtype_kobj);
  * @create:            Called to allocate basic resources in parent device's
  *                     driver for a particular mediated device. It is
  *                     mandatory to provide create ops.
- *                     @kobj: kobject of type for which 'create' is called.
  *                     @mdev: mdev_device structure on of mediated device
  *                           that is being created
  *                     Returns integer: success (0) or error (< 0)
@@ -107,7 +106,7 @@ struct mdev_parent_ops {
        const struct attribute_group **mdev_attr_groups;
        struct attribute_group **supported_type_groups;
 
-       int     (*create)(struct kobject *kobj, struct mdev_device *mdev);
+       int     (*create)(struct mdev_device *mdev);
        int     (*remove)(struct mdev_device *mdev);
        int     (*open)(struct mdev_device *mdev);
        void    (*release)(struct mdev_device *mdev);
index a1af30d..ac4d0dc 100644 (file)
@@ -506,7 +506,7 @@ static int mbochs_reset(struct mdev_device *mdev)
        return 0;
 }
 
-static int mbochs_create(struct kobject *kobj, struct mdev_device *mdev)
+static int mbochs_create(struct mdev_device *mdev)
 {
        const struct mbochs_type *type =
                &mbochs_types[mdev_get_type_group_id(mdev)];
index 08c15f9..da88fd7 100644 (file)
@@ -216,7 +216,7 @@ static int mdpy_reset(struct mdev_device *mdev)
        return 0;
 }
 
-static int mdpy_create(struct kobject *kobj, struct mdev_device *mdev)
+static int mdpy_create(struct mdev_device *mdev)
 {
        const struct mdpy_type *type =
                &mdpy_types[mdev_get_type_group_id(mdev)];
index 191a587..f2e36c0 100644 (file)
@@ -708,7 +708,7 @@ accessfailed:
        return ret;
 }
 
-static int mtty_create(struct kobject *kobj, struct mdev_device *mdev)
+static int mtty_create(struct mdev_device *mdev)
 {
        struct mdev_state *mdev_state;
        int nr_ports = mdev_get_type_group_id(mdev) + 1;