summaryrefslogtreecommitdiffstats
path: root/drivers/vfio/mdev/mdev_driver.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/vfio/mdev/mdev_driver.c')
-rw-r--r--drivers/vfio/mdev/mdev_driver.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/drivers/vfio/mdev/mdev_driver.c b/drivers/vfio/mdev/mdev_driver.c
index 44c3ba7e56d9..041699571b7e 100644
--- a/drivers/vfio/mdev/mdev_driver.c
+++ b/drivers/vfio/mdev/mdev_driver.c
@@ -39,7 +39,8 @@ static void mdev_detach_iommu(struct mdev_device *mdev)
static int mdev_probe(struct device *dev)
{
- struct mdev_driver *drv = to_mdev_driver(dev->driver);
+ struct mdev_driver *drv =
+ container_of(dev->driver, struct mdev_driver, driver);
struct mdev_device *mdev = to_mdev_device(dev);
int ret;
@@ -47,7 +48,7 @@ static int mdev_probe(struct device *dev)
if (ret)
return ret;
- if (drv && drv->probe) {
+ if (drv->probe) {
ret = drv->probe(mdev);
if (ret)
mdev_detach_iommu(mdev);
@@ -58,10 +59,11 @@ static int mdev_probe(struct device *dev)
static int mdev_remove(struct device *dev)
{
- struct mdev_driver *drv = to_mdev_driver(dev->driver);
+ struct mdev_driver *drv =
+ container_of(dev->driver, struct mdev_driver, driver);
struct mdev_device *mdev = to_mdev_device(dev);
- if (drv && drv->remove)
+ if (drv->remove)
drv->remove(mdev);
mdev_detach_iommu(mdev);
@@ -79,16 +81,13 @@ EXPORT_SYMBOL_GPL(mdev_bus_type);
/**
* mdev_register_driver - register a new MDEV driver
* @drv: the driver to register
- * @owner: module owner of driver to be registered
*
* Returns a negative value on error, otherwise 0.
**/
-int mdev_register_driver(struct mdev_driver *drv, struct module *owner)
+int mdev_register_driver(struct mdev_driver *drv)
{
/* initialize common driver fields */
- drv->driver.name = drv->name;
drv->driver.bus = &mdev_bus_type;
- drv->driver.owner = owner;
/* register with core */
return driver_register(&drv->driver);