Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

vfio/mdev: Remove kobj from mdev_parent_ops->create()

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>

authored by

Jason Gunthorpe and committed by
Alex Williamson
c2ef2f50 383987fd

+8 -9
+1 -1
drivers/gpu/drm/i915/gvt/kvmgt.c
··· 689 689 vfio_device_put(vdev->vfio_device); 690 690 } 691 691 692 - static int intel_vgpu_create(struct kobject *kobj, struct mdev_device *mdev) 692 + static int intel_vgpu_create(struct mdev_device *mdev) 693 693 { 694 694 struct intel_vgpu *vgpu = NULL; 695 695 struct intel_vgpu_type *type;
+1 -1
drivers/s390/cio/vfio_ccw_ops.c
··· 110 110 NULL, 111 111 }; 112 112 113 - static int vfio_ccw_mdev_create(struct kobject *kobj, struct mdev_device *mdev) 113 + static int vfio_ccw_mdev_create(struct mdev_device *mdev) 114 114 { 115 115 struct vfio_ccw_private *private = 116 116 dev_get_drvdata(mdev_parent_dev(mdev));
+1 -1
drivers/s390/crypto/vfio_ap_ops.c
··· 322 322 matrix->adm_max = info->apxa ? info->Nd : 15; 323 323 } 324 324 325 - static int vfio_ap_mdev_create(struct kobject *kobj, struct mdev_device *mdev) 325 + static int vfio_ap_mdev_create(struct mdev_device *mdev) 326 326 { 327 327 struct ap_matrix_mdev *matrix_mdev; 328 328
+1 -1
drivers/vfio/mdev/mdev_core.c
··· 286 286 goto out_put_device; 287 287 } 288 288 289 - ret = parent->ops->create(&type->kobj, mdev); 289 + ret = parent->ops->create(mdev); 290 290 if (ret) 291 291 goto out_unlock; 292 292
+1 -2
include/linux/mdev.h
··· 61 61 * @create: Called to allocate basic resources in parent device's 62 62 * driver for a particular mediated device. It is 63 63 * mandatory to provide create ops. 64 - * @kobj: kobject of type for which 'create' is called. 65 64 * @mdev: mdev_device structure on of mediated device 66 65 * that is being created 67 66 * Returns integer: success (0) or error (< 0) ··· 106 107 const struct attribute_group **mdev_attr_groups; 107 108 struct attribute_group **supported_type_groups; 108 109 109 - int (*create)(struct kobject *kobj, struct mdev_device *mdev); 110 + int (*create)(struct mdev_device *mdev); 110 111 int (*remove)(struct mdev_device *mdev); 111 112 int (*open)(struct mdev_device *mdev); 112 113 void (*release)(struct mdev_device *mdev);
+1 -1
samples/vfio-mdev/mbochs.c
··· 506 506 return 0; 507 507 } 508 508 509 - static int mbochs_create(struct kobject *kobj, struct mdev_device *mdev) 509 + static int mbochs_create(struct mdev_device *mdev) 510 510 { 511 511 const struct mbochs_type *type = 512 512 &mbochs_types[mdev_get_type_group_id(mdev)];
+1 -1
samples/vfio-mdev/mdpy.c
··· 216 216 return 0; 217 217 } 218 218 219 - static int mdpy_create(struct kobject *kobj, struct mdev_device *mdev) 219 + static int mdpy_create(struct mdev_device *mdev) 220 220 { 221 221 const struct mdpy_type *type = 222 222 &mdpy_types[mdev_get_type_group_id(mdev)];
+1 -1
samples/vfio-mdev/mtty.c
··· 708 708 return ret; 709 709 } 710 710 711 - static int mtty_create(struct kobject *kobj, struct mdev_device *mdev) 711 + static int mtty_create(struct mdev_device *mdev) 712 712 { 713 713 struct mdev_state *mdev_state; 714 714 int nr_ports = mdev_get_type_group_id(mdev) + 1;