On Tue, 23 Mar 2021 14:55:28 -0300 Jason Gunthorpe <jgg@xxxxxxxxxx> wrote: > This returns the index in the supported_type_groups array that is > associated with the mdev_type attached to the struct mdev_device or its > containing struct kobject. > > Each mdev_device can be spawned from exactly one mdev_type, which in turn > originates from exactly one supported_type_group. > > Drivers are using weird string calculations to try and get back to this > index, providing a direct access to the index removes a bunch of wonky > driver code. > > mdev_type->group can be deleted as the group is obtained using the > type_group_id. > > Signed-off-by: Jason Gunthorpe <jgg@xxxxxxxxxx> > --- > drivers/vfio/mdev/mdev_core.c | 20 ++++++++++++++++++++ > drivers/vfio/mdev/mdev_private.h | 2 +- > drivers/vfio/mdev/mdev_sysfs.c | 15 +++++++++------ > include/linux/mdev.h | 3 +++ > 4 files changed, 33 insertions(+), 7 deletions(-) Reviewed-by: Cornelia Huck <cohuck@xxxxxxxxxx>