Re: [PATCH 03/18] vfio/mdev: Simplify driver registration
From: Cornelia Huck <cohuck@redhat.com>
Date: 2021-03-30 15:29:33
Also in:
kvm
From: Cornelia Huck <cohuck@redhat.com>
Date: 2021-03-30 15:29:33
Also in:
kvm
On Tue, 23 Mar 2021 14:55:20 -0300 Jason Gunthorpe [off-list ref] wrote:
This is only done once, we don't need to generate code to initialize a structure stored in the ELF .data segment. Fill in the three required .driver members directly instead of copying data into them during mdev_register_driver(). Further the to_mdev_driver() function doesn't belong in a public header, just inline it into the two places that need it. Finally, we can now clearly see that 'drv' derived from dev->driver cannot be NULL, firstly because the driver core forbids it, and secondly because NULL won't pass through the container_of(). Remove the dead code. Signed-off-by: Jason Gunthorpe <jgg@nvidia.com> --- Documentation/driver-api/vfio-mediated-device.rst | 5 +---- drivers/vfio/mdev/mdev_driver.c | 15 +++++++-------- drivers/vfio/mdev/vfio_mdev.c | 8 ++++++-- include/linux/mdev.h | 6 +----- 4 files changed, 15 insertions(+), 19 deletions(-)
Reviewed-by: Cornelia Huck <cohuck@redhat.com>