[PATCH v2 3/4] [media] lirc_bt829: Enable and disable device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



We must not assume that the PCI device is already enabled.

Signed-off-by: Ben Hutchings <ben@xxxxxxxxxxxxxxx>
---
 drivers/staging/media/lirc/lirc_bt829.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/media/lirc/lirc_bt829.c b/drivers/staging/media/lirc/lirc_bt829.c
index a61d233..623f10e 100644
--- a/drivers/staging/media/lirc/lirc_bt829.c
+++ b/drivers/staging/media/lirc/lirc_bt829.c
@@ -126,9 +126,13 @@ int init_module(void)
 	if (pdev == NULL)
 		return -ENODEV;
 
+	rc = pci_enable_device(pdev);
+	if (rc)
+		goto err_put_dev;
+
 	if (!atir_init_start()) {
 		rc = -ENODEV;
-		goto err_put_dev;
+		goto err_disable;
 	}
 
 	strcpy(atir_driver.name, "ATIR");
@@ -154,6 +158,8 @@ int init_module(void)
 
 err_unmap:
 	iounmap(pci_addr_lin);
+err_disable:
+	pci_disable_device(pdev);
 err_put_dev:
 	pci_dev_put(pdev);
 	return rc;
@@ -166,6 +172,7 @@ void cleanup_module(void)
 
 	lirc_unregister_driver(atir_minor);
 	iounmap(pci_addr_lin);
+	pci_disable_device(pdev);
 	pci_dev_put(pdev);
 }
 


Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux