Commit 4f61a7ad authored by Tomas Winkler's avatar Tomas Winkler Committed by Greg Kroah-Hartman

staging: mei: enable msi when supported

enable msi when supported
also in that case we can drop the quick handler
from the threaded interrupt that protected us from
handling USB interrupts
Signed-off-by: default avatarMaarten Lankhorst <m.b.lankhorst@gmail.com>
Signed-off-by: default avatarTomas Winkler <tomas.winkler@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent b4f6209d
...@@ -1540,6 +1540,12 @@ irqreturn_t mei_interrupt_thread_handler(int irq, void *dev_id) ...@@ -1540,6 +1540,12 @@ irqreturn_t mei_interrupt_thread_handler(int irq, void *dev_id)
mutex_lock(&dev->device_lock); mutex_lock(&dev->device_lock);
mei_io_list_init(&complete_list); mei_io_list_init(&complete_list);
dev->host_hw_state = mei_hcsr_read(dev); dev->host_hw_state = mei_hcsr_read(dev);
/* Ack the interrupt here
* In case of MSI we don't go throuhg the quick handler */
if (pci_dev_msi_enabled(dev->pdev))
mei_reg_write(dev, H_CSR, dev->host_hw_state);
dev->me_hw_state = mei_mecsr_read(dev); dev->me_hw_state = mei_mecsr_read(dev);
/* check if ME wants a reset */ /* check if ME wants a reset */
......
...@@ -151,11 +151,20 @@ static int __devinit mei_probe(struct pci_dev *pdev, ...@@ -151,11 +151,20 @@ static int __devinit mei_probe(struct pci_dev *pdev,
err = -ENOMEM; err = -ENOMEM;
goto free_device; goto free_device;
} }
pci_enable_msi(pdev);
/* request and enable interrupt */ /* request and enable interrupt */
if (pci_dev_msi_enabled(pdev))
err = request_threaded_irq(pdev->irq,
NULL,
mei_interrupt_thread_handler,
0, mei_driver_name, dev);
else
err = request_threaded_irq(pdev->irq, err = request_threaded_irq(pdev->irq,
mei_interrupt_quick_handler, mei_interrupt_quick_handler,
mei_interrupt_thread_handler, mei_interrupt_thread_handler,
IRQF_SHARED, mei_driver_name, dev); IRQF_SHARED, mei_driver_name, dev);
if (err) { if (err) {
printk(KERN_ERR "mei: request_threaded_irq failure. irq = %d\n", printk(KERN_ERR "mei: request_threaded_irq failure. irq = %d\n",
pdev->irq); pdev->irq);
...@@ -183,6 +192,7 @@ static int __devinit mei_probe(struct pci_dev *pdev, ...@@ -183,6 +192,7 @@ static int __devinit mei_probe(struct pci_dev *pdev,
mei_disable_interrupts(dev); mei_disable_interrupts(dev);
flush_scheduled_work(); flush_scheduled_work();
free_irq(pdev->irq, dev); free_irq(pdev->irq, dev);
pci_disable_msi(pdev);
unmap_memory: unmap_memory:
pci_iounmap(pdev, dev->mem_addr); pci_iounmap(pdev, dev->mem_addr);
free_device: free_device:
...@@ -247,6 +257,7 @@ static void __devexit mei_remove(struct pci_dev *pdev) ...@@ -247,6 +257,7 @@ static void __devexit mei_remove(struct pci_dev *pdev)
mei_disable_interrupts(dev); mei_disable_interrupts(dev);
free_irq(pdev->irq, dev); free_irq(pdev->irq, dev);
pci_disable_msi(pdev);
pci_set_drvdata(pdev, NULL); pci_set_drvdata(pdev, NULL);
if (dev->mem_addr) if (dev->mem_addr)
...@@ -1096,7 +1107,7 @@ static int mei_pci_suspend(struct device *device) ...@@ -1096,7 +1107,7 @@ static int mei_pci_suspend(struct device *device)
mutex_unlock(&dev->device_lock); mutex_unlock(&dev->device_lock);
free_irq(pdev->irq, dev); free_irq(pdev->irq, dev);
pci_disable_msi(pdev);
return err; return err;
} }
...@@ -1111,11 +1122,20 @@ static int mei_pci_resume(struct device *device) ...@@ -1111,11 +1122,20 @@ static int mei_pci_resume(struct device *device)
if (!dev) if (!dev)
return -ENODEV; return -ENODEV;
pci_enable_msi(pdev);
/* request and enable interrupt */ /* request and enable interrupt */
if (pci_dev_msi_enabled(pdev))
err = request_threaded_irq(pdev->irq,
NULL,
mei_interrupt_thread_handler,
0, mei_driver_name, dev);
else
err = request_threaded_irq(pdev->irq, err = request_threaded_irq(pdev->irq,
mei_interrupt_quick_handler, mei_interrupt_quick_handler,
mei_interrupt_thread_handler, mei_interrupt_thread_handler,
IRQF_SHARED, mei_driver_name, dev); IRQF_SHARED, mei_driver_name, dev);
if (err) { if (err) {
printk(KERN_ERR "mei: Request_irq failure. irq = %d\n", printk(KERN_ERR "mei: Request_irq failure. irq = %d\n",
pdev->irq); pdev->irq);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment