diff options
-rw-r--r-- | drivers/vfio/platform/vfio_platform_common.c | 14 | ||||
-rw-r--r-- | drivers/vfio/platform/vfio_platform_private.h | 1 |
2 files changed, 13 insertions, 2 deletions
diff --git a/drivers/vfio/platform/vfio_platform_common.c b/drivers/vfio/platform/vfio_platform_common.c index ac0229622c1f..a1c50d630792 100644 --- a/drivers/vfio/platform/vfio_platform_common.c +++ b/drivers/vfio/platform/vfio_platform_common.c | |||
@@ -144,8 +144,12 @@ static void vfio_platform_release(void *device_data) | |||
144 | mutex_lock(&driver_lock); | 144 | mutex_lock(&driver_lock); |
145 | 145 | ||
146 | if (!(--vdev->refcnt)) { | 146 | if (!(--vdev->refcnt)) { |
147 | if (vdev->reset) | 147 | if (vdev->reset) { |
148 | dev_info(vdev->device, "reset\n"); | ||
148 | vdev->reset(vdev); | 149 | vdev->reset(vdev); |
150 | } else { | ||
151 | dev_warn(vdev->device, "no reset function found!\n"); | ||
152 | } | ||
149 | vfio_platform_regions_cleanup(vdev); | 153 | vfio_platform_regions_cleanup(vdev); |
150 | vfio_platform_irq_cleanup(vdev); | 154 | vfio_platform_irq_cleanup(vdev); |
151 | } | 155 | } |
@@ -174,8 +178,12 @@ static int vfio_platform_open(void *device_data) | |||
174 | if (ret) | 178 | if (ret) |
175 | goto err_irq; | 179 | goto err_irq; |
176 | 180 | ||
177 | if (vdev->reset) | 181 | if (vdev->reset) { |
182 | dev_info(vdev->device, "reset\n"); | ||
178 | vdev->reset(vdev); | 183 | vdev->reset(vdev); |
184 | } else { | ||
185 | dev_warn(vdev->device, "no reset function found!\n"); | ||
186 | } | ||
179 | } | 187 | } |
180 | 188 | ||
181 | vdev->refcnt++; | 189 | vdev->refcnt++; |
@@ -551,6 +559,8 @@ int vfio_platform_probe_common(struct vfio_platform_device *vdev, | |||
551 | return -EINVAL; | 559 | return -EINVAL; |
552 | } | 560 | } |
553 | 561 | ||
562 | vdev->device = dev; | ||
563 | |||
554 | group = iommu_group_get(dev); | 564 | group = iommu_group_get(dev); |
555 | if (!group) { | 565 | if (!group) { |
556 | pr_err("VFIO: No IOMMU group for device %s\n", vdev->name); | 566 | pr_err("VFIO: No IOMMU group for device %s\n", vdev->name); |
diff --git a/drivers/vfio/platform/vfio_platform_private.h b/drivers/vfio/platform/vfio_platform_private.h index d1b0668fe394..42816dd280cb 100644 --- a/drivers/vfio/platform/vfio_platform_private.h +++ b/drivers/vfio/platform/vfio_platform_private.h | |||
@@ -59,6 +59,7 @@ struct vfio_platform_device { | |||
59 | struct module *parent_module; | 59 | struct module *parent_module; |
60 | const char *compat; | 60 | const char *compat; |
61 | struct module *reset_module; | 61 | struct module *reset_module; |
62 | struct device *device; | ||
62 | 63 | ||
63 | /* | 64 | /* |
64 | * These fields should be filled by the bus specific binder | 65 | * These fields should be filled by the bus specific binder |