]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - drivers/pnp/driver.c
Merge tag 'iwlwifi-for-kalle-2016-02-15' of https://git.kernel.org/pub/scm/linux...
[mirror_ubuntu-bionic-kernel.git] / drivers / pnp / driver.c
index 153a493b5413e06482dd9909bf0301e6d26eae1f..63452f20e3e97e5f567cec533ac74a4ab100ebf8 100644 (file)
@@ -74,7 +74,6 @@ void pnp_device_detach(struct pnp_dev *pnp_dev)
        if (pnp_dev->status == PNP_ATTACHED)
                pnp_dev->status = PNP_READY;
        mutex_unlock(&pnp_lock);
-       pnp_disable_dev(pnp_dev);
 }
 
 static int pnp_device_probe(struct device *dev)
@@ -131,6 +130,11 @@ static int pnp_device_remove(struct device *dev)
                        drv->remove(pnp_dev);
                pnp_dev->driver = NULL;
        }
+
+       if (pnp_dev->active &&
+           (!drv || !(drv->flags & PNP_DRIVER_RES_DO_NOT_CHANGE)))
+               pnp_disable_dev(pnp_dev);
+
        pnp_device_detach(pnp_dev);
        return 0;
 }