diff options
author | Jason Gunthorpe <jgg@nvidia.com> | 2021-04-06 21:40:27 +0200 |
---|---|---|
committer | Alex Williamson <alex.williamson@redhat.com> | 2021-04-07 23:39:16 +0200 |
commit | 91b9969d9c6bb7c02253bbfc536bfd892f636fdc (patch) | |
tree | db6bbb6639ffa0c14f8dae99463064417ea90d56 /Documentation/driver-api/vfio-mediated-device.rst | |
parent | vfio/mdev: Add missing typesafety around mdev_device (diff) | |
download | linux-91b9969d9c6bb7c02253bbfc536bfd892f636fdc.tar.xz linux-91b9969d9c6bb7c02253bbfc536bfd892f636fdc.zip |
vfio/mdev: Simplify driver registration
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.
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Message-Id: <4-v2-d36939638fc6+d54-vfio2_jgg@nvidia.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Diffstat (limited to 'Documentation/driver-api/vfio-mediated-device.rst')
-rw-r--r-- | Documentation/driver-api/vfio-mediated-device.rst | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/Documentation/driver-api/vfio-mediated-device.rst b/Documentation/driver-api/vfio-mediated-device.rst index c43c1dc33333..1779b85f014e 100644 --- a/Documentation/driver-api/vfio-mediated-device.rst +++ b/Documentation/driver-api/vfio-mediated-device.rst @@ -98,13 +98,11 @@ structure to represent a mediated device's driver:: /* * struct mdev_driver [2] - Mediated device's driver - * @name: driver name * @probe: called when new device created * @remove: called when device removed * @driver: device driver structure */ struct mdev_driver { - const char *name; int (*probe) (struct mdev_device *dev); void (*remove) (struct mdev_device *dev); struct device_driver driver; @@ -115,8 +113,7 @@ to register and unregister itself with the core driver: * Register:: - extern int mdev_register_driver(struct mdev_driver *drv, - struct module *owner); + extern int mdev_register_driver(struct mdev_driver *drv); * Unregister:: |