aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEven Xu <even.xu@intel.com>2016-10-21 18:48:40 -0400
committerJiri Kosina <jkosina@suse.cz>2016-11-05 10:57:38 -0400
commit2a1e3b932c5606e2b3671b82eb63929937eb1e0b (patch)
tree8ba12a61d738607ee435587d70a8afa08ee9f4f3
parent8b2979febc134f038f3c8396cb04893f96e03b4f (diff)
HID: intel-ish-hid: Fix driver reinit failure
When built as a module, modprobe followed by rmmod can fail because DMA was still active. So to fix this, DMA needs to be disabled during module exit. This change disables DMA during modules exit and change the ISH PCI device status to D3. Signed-off-by: Even Xu <even.xu@intel.com> Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
-rw-r--r--drivers/hid/intel-ish-hid/ipc/ipc.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/hid/intel-ish-hid/ipc/ipc.c b/drivers/hid/intel-ish-hid/ipc/ipc.c
index 0e0dfa616fab..0c9ac4d5d850 100644
--- a/drivers/hid/intel-ish-hid/ipc/ipc.c
+++ b/drivers/hid/intel-ish-hid/ipc/ipc.c
@@ -905,6 +905,21 @@ struct ishtp_device *ish_dev_init(struct pci_dev *pdev)
905 */ 905 */
906void ish_device_disable(struct ishtp_device *dev) 906void ish_device_disable(struct ishtp_device *dev)
907{ 907{
908 struct pci_dev *pdev = dev->pdev;
909
910 if (!pdev)
911 return;
912
913 /* Disable dma communication between FW and host */
914 if (ish_disable_dma(dev)) {
915 dev_err(&pdev->dev,
916 "Can't reset - stuck with DMA in-progress\n");
917 return;
918 }
919
920 /* Put ISH to D3hot state for power saving */
921 pci_set_power_state(pdev, PCI_D3hot);
922
908 dev->dev_state = ISHTP_DEV_DISABLED; 923 dev->dev_state = ISHTP_DEV_DISABLED;
909 ish_clr_host_rdy(dev); 924 ish_clr_host_rdy(dev);
910} 925}