[patch v2] DT3155: Use pci_get_device()

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

 



The use of pci_find_device() is deprecated.

Signed-off-by: Simon Horman <horms@xxxxxxxxxxxx>

--- 

Compile tested only.

Alternatively, if pci_find_device() really needs to be used
then this code needs to depend on PCI_LEGACY.

v2: call pci_dev_put() in error paths.

    I'm still unsure that this makes the use of pci_get_device() correct

Index: linux-2.6/drivers/staging/dt3155/dt3155_drv.c
===================================================================
--- linux-2.6.orig/drivers/staging/dt3155/dt3155_drv.c	2009-12-24 22:13:10.000000000 +1100
+++ linux-2.6/drivers/staging/dt3155/dt3155_drv.c	2009-12-24 22:33:57.000000000 +1100
@@ -963,7 +963,7 @@ static int find_PCI (void)
   unsigned long base;
   unsigned char irq;
 
-  while ((pci_dev = pci_find_device
+  while ((pci_dev = pci_get_device
 	  (DT3155_VENDORID, DT3155_DEVICEID, pci_dev)) != NULL)
     {
       pci_index ++;
@@ -983,7 +983,7 @@ static int find_PCI (void)
 	       "for %d devices\n"
 	       "DT3155: Please change MAXBOARDS in dt3155.h\n",
 	       pci_index, MAXBOARDS);
-	return DT_3155_FAILURE;
+	goto err;
       }
 
       /* Now, just go out and make sure that this/these device(s) is/are
@@ -992,7 +992,7 @@ static int find_PCI (void)
 					  (u_int *) &base)))
 	{
 	  printk("DT3155: Was not able to find device \n");
-	  return DT_3155_FAILURE;
+	  goto err;
 	}
 
       DT_3155_DEBUG_MSG("DT3155: Base address 0 for device is %lx \n", base);
@@ -1007,13 +1007,13 @@ static int find_PCI (void)
       if ( !dt3155_lbase[pci_index-1] )
 	{
 	  printk("DT3155: Unable to remap control registers\n");
-	  return DT_3155_FAILURE;
+	  goto err;
 	}
 
       if ( (error = pci_read_config_byte( pci_dev, PCI_INTERRUPT_LINE, &irq)) )
 	{
 	  printk("DT3155: Was not able to find device \n");
-	  return DT_3155_FAILURE;
+	  goto err;
 	}
 
       DT_3155_DEBUG_MSG("DT3155: IRQ is %d \n",irq);
@@ -1029,6 +1029,10 @@ static int find_PCI (void)
   ndevices = pci_index;
 
   return DT_3155_SUCCESS;
+
+err:
+  pci_dev_put(pci_dev);
+  return DT_3155_FAILURE;
 }
 
 u_long allocatorAddr = 0;
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/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