On Tue, Aug 30, 2022 at 02:21:58PM +0530, Mitul Golani wrote: > While executing i915_selftest, wakeref imbalance warning is seen > with i915_selftest failure. > > Currently when Driver is suspended, while doing unregister > it is taking wakeref without resuming the device. > This patch is resuming the device, if driver is already suspended > and doing unregister process. > > Signed-off-by: Mitul Golani <mitulkumar.ajitkumar.golani@xxxxxxxxx> Reviewed-by: Imre Deak <imre.deak@xxxxxxxxx> > --- > drivers/gpu/drm/i915/i915_driver.c | 12 ++++++++---- > 1 file changed, 8 insertions(+), 4 deletions(-) > > diff --git a/drivers/gpu/drm/i915/i915_driver.c b/drivers/gpu/drm/i915/i915_driver.c > index 1332c70370a6..be0d51c04cc5 100644 > --- a/drivers/gpu/drm/i915/i915_driver.c > +++ b/drivers/gpu/drm/i915/i915_driver.c > @@ -953,7 +953,9 @@ int i915_driver_probe(struct pci_dev *pdev, const struct pci_device_id *ent) > > void i915_driver_remove(struct drm_i915_private *i915) > { > - disable_rpm_wakeref_asserts(&i915->runtime_pm); > + intel_wakeref_t wakeref; > + > + wakeref = intel_runtime_pm_get(&i915->runtime_pm); > > i915_driver_unregister(i915); > > @@ -977,18 +979,19 @@ void i915_driver_remove(struct drm_i915_private *i915) > > i915_driver_hw_remove(i915); > > - enable_rpm_wakeref_asserts(&i915->runtime_pm); > + intel_runtime_pm_put(&i915->runtime_pm, wakeref); > } > > static void i915_driver_release(struct drm_device *dev) > { > struct drm_i915_private *dev_priv = to_i915(dev); > struct intel_runtime_pm *rpm = &dev_priv->runtime_pm; > + intel_wakeref_t wakeref; > > if (!dev_priv->do_release) > return; > > - disable_rpm_wakeref_asserts(rpm); > + wakeref = intel_runtime_pm_get(rpm); > > i915_gem_driver_release(dev_priv); > > @@ -999,7 +1002,8 @@ static void i915_driver_release(struct drm_device *dev) > > i915_driver_mmio_release(dev_priv); > > - enable_rpm_wakeref_asserts(rpm); > + intel_runtime_pm_put(rpm, wakeref); > + > intel_runtime_pm_driver_release(rpm); > > i915_driver_late_release(dev_priv); > -- > 2.25.1 >