lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 07 Jul 2011 13:32:21 +0200
From:	Maarten Lankhorst <m.b.lankhorst@...il.com>
To:	Tomas Winkler <tomas.winkler@...el.com>
CC:	devel@...uxdriverproject.org,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: [staging] mei: Enable msi when supported

Signed-off-by: Maarten Lankhorst <m.b.lankhorst@...il.com>
---
Tested suspend/resume, driver (re/un)loading. Comments welcome. :)

diff --git a/drivers/staging/mei/main.c b/drivers/staging/mei/main.c
index bfd1b46..58106bf 100644
--- a/drivers/staging/mei/main.c
+++ b/drivers/staging/mei/main.c
@@ -121,6 +121,7 @@ static int __devinit mei_probe(struct pci_dev *pdev,
 {
 	struct mei_device *dev;
 	int err;
+	unsigned long flags = 0;
 
 	mutex_lock(&mei_mutex);
 	if (mei_device) {
@@ -154,11 +155,13 @@ static int __devinit mei_probe(struct pci_dev *pdev,
 		err = -ENOMEM;
 		goto free_device;
 	}
+	if (pci_enable_msi(pdev) < 0)
+		flags |= IRQF_SHARED;
 	/* request and enable interrupt   */
 	err = request_threaded_irq(pdev->irq,
 			mei_interrupt_quick_handler,
 			mei_interrupt_thread_handler,
-			IRQF_SHARED, mei_driver_name, dev);
+			flags, mei_driver_name, dev);
 	if (err) {
 		printk(KERN_ERR "mei: request_threaded_irq failure. irq = %d\n",
 		       pdev->irq);
@@ -186,6 +189,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:
@@ -250,6 +254,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)
@@ -1103,7 +1108,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;
 }
@@ -1113,16 +1118,19 @@ static int mei_pci_resume(struct device *device)
 	struct pci_dev *pdev = to_pci_dev(device);
 	struct mei_device *dev;
 	int err;
+	unsigned long flags = 0;
 
 	dev = pci_get_drvdata(pdev);
 	if (!dev)
 		return -ENODEV;
 
+	if (pci_enable_msi(pdev) < 0)
+		flags |= IRQF_SHARED;
 	/* request and enable interrupt   */
 	err = request_threaded_irq(pdev->irq,
 			mei_interrupt_quick_handler,
 			mei_interrupt_thread_handler,
-			IRQF_SHARED, mei_driver_name, dev);
+			flags, mei_driver_name, dev);
 	if (err) {
 		printk(KERN_ERR "mei: Request_irq failure. irq = %d\n",
 		       pdev->irq);


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ