Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

vfio: platform: add dev_info on device reset

It might be helpful for the end-user to check the device reset
function was found by the vfio platform reset framework.

Lets store a pointer to the struct device in vfio_platform_device
and trace when the reset function is called or not found.

Signed-off-by: Eric Auger <eric.auger@linaro.org>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>

authored by

Eric Auger and committed by
Alex Williamson
705e60ba e9e0506e

+13 -2
+12 -2
drivers/vfio/platform/vfio_platform_common.c
··· 144 144 mutex_lock(&driver_lock); 145 145 146 146 if (!(--vdev->refcnt)) { 147 - if (vdev->reset) 147 + if (vdev->reset) { 148 + dev_info(vdev->device, "reset\n"); 148 149 vdev->reset(vdev); 150 + } else { 151 + dev_warn(vdev->device, "no reset function found!\n"); 152 + } 149 153 vfio_platform_regions_cleanup(vdev); 150 154 vfio_platform_irq_cleanup(vdev); 151 155 } ··· 178 174 if (ret) 179 175 goto err_irq; 180 176 181 - if (vdev->reset) 177 + if (vdev->reset) { 178 + dev_info(vdev->device, "reset\n"); 182 179 vdev->reset(vdev); 180 + } else { 181 + dev_warn(vdev->device, "no reset function found!\n"); 182 + } 183 183 } 184 184 185 185 vdev->refcnt++; ··· 558 550 pr_err("VFIO: cannot retrieve compat for %s\n", vdev->name); 559 551 return -EINVAL; 560 552 } 553 + 554 + vdev->device = dev; 561 555 562 556 group = iommu_group_get(dev); 563 557 if (!group) {
+1
drivers/vfio/platform/vfio_platform_private.h
··· 59 59 struct module *parent_module; 60 60 const char *compat; 61 61 struct module *reset_module; 62 + struct device *device; 62 63 63 64 /* 64 65 * These fields should be filled by the bus specific binder