staging: mei: enable msi when supported
authorTomas Winkler <tomas.winkler@intel.com>
Thu, 14 Jul 2011 17:11:25 +0000 (20:11 +0300)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 23 Aug 2011 19:56:44 +0000 (12:56 -0700)
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: Maarten Lankhorst <m.b.lankhorst@gmail.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/mei/interrupt.c
drivers/staging/mei/main.c

index 9cb186bf1874849d1ee7af28f94dd09207d67571..ca1e0c90a94143a223465747ca29949624426029 100644 (file)
@@ -1540,6 +1540,12 @@ irqreturn_t mei_interrupt_thread_handler(int irq, void *dev_id)
        mutex_lock(&dev->device_lock);
        mei_io_list_init(&complete_list);
        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);
 
        /* check if ME wants a reset */
index de8825fcd8ce0adf28fa92e8306b00de04d6bbb8..8d7678569e7196e6d374f98bfb06d4e0e7e36c30 100644 (file)
@@ -151,11 +151,20 @@ static int __devinit mei_probe(struct pci_dev *pdev,
                err = -ENOMEM;
                goto free_device;
        }
-       /* request and enable interrupt   */
-       err = request_threaded_irq(pdev->irq,
+       pci_enable_msi(pdev);
+
+        /* 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,
                        mei_interrupt_quick_handler,
                        mei_interrupt_thread_handler,
                        IRQF_SHARED, mei_driver_name, dev);
+
        if (err) {
                printk(KERN_ERR "mei: request_threaded_irq failure. irq = %d\n",
                       pdev->irq);
@@ -183,6 +192,7 @@ release_irq:
        mei_disable_interrupts(dev);
        flush_scheduled_work();
        free_irq(pdev->irq, dev);
+       pci_disable_msi(pdev);
 unmap_memory:
        pci_iounmap(pdev, dev->mem_addr);
 free_device:
@@ -247,6 +257,7 @@ static void __devexit mei_remove(struct pci_dev *pdev)
        mei_disable_interrupts(dev);
 
        free_irq(pdev->irq, dev);
+       pci_disable_msi(pdev);
        pci_set_drvdata(pdev, NULL);
 
        if (dev->mem_addr)
@@ -1096,7 +1107,7 @@ static int mei_pci_suspend(struct device *device)
        mutex_unlock(&dev->device_lock);
 
        free_irq(pdev->irq, dev);
-
+       pci_disable_msi(pdev);
 
        return err;
 }
@@ -1111,11 +1122,20 @@ static int mei_pci_resume(struct device *device)
        if (!dev)
                return -ENODEV;
 
-       /* request and enable interrupt   */
-       err = request_threaded_irq(pdev->irq,
+       pci_enable_msi(pdev);
+
+       /* 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,
                        mei_interrupt_quick_handler,
                        mei_interrupt_thread_handler,
                        IRQF_SHARED, mei_driver_name, dev);
+
        if (err) {
                printk(KERN_ERR "mei: Request_irq failure. irq = %d\n",
                       pdev->irq);