Skip to contentSkip to conversation

drivers/scsi/advansys.c: Convert pci_find_device() to

PATCH In review James Lamanna 2 participants 3 messages Jul 7, 2005 – Jul 8, 2005

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers/scsi/advansys.c: Convert pci_find_device() to

So here's a conversion of another driver from pci_find_device() to pci_get_device().
After reading Greg's earlier comments about this change, hopefully this is mostly correct.
Oh and BTW, advansys.c needs a serious Lindent run and some warnings cleanup, but that will have to be for another day...
This patch matches the current indentation of the file that's why there are spaces not tabs.
Compile-tested but not runtime-tested.

Signed-off by: James Lamanna <[email protected]>

advansys.c | 7 +++++--

 1 files changed, 5 insertions(+), 2 deletions(-)
drivers/scsi/advansys.c +5 -2
@@ -4472,7 +4472,7 @@ advansys_detect(struct scsi_host_templat
 
                     /* Find all PCI cards. */
                     while (pci_device_id_cnt < ASC_PCI_DEVICE_ID_CNT) {
-                        if ((pci_devp = pci_find_device(ASC_PCI_VENDORID,
+                        if ((pci_devp = pci_get_device(ASC_PCI_VENDORID,
                             pci_device_id[pci_device_id_cnt], pci_devp)) =
                             NULL) {
                             pci_device_id_cnt++;
@@ -5472,7 +5472,10 @@ advansys_release(struct Scsi_Host *shp)
             boardp->adv_sgblkp = sgp->next_sgblkp;
             kfree(sgp);
         }
-    }
+        pci_dev_put(to_pci_dev(boardp->dvc_cfg.adv_dvc_cfg.dev));
+    } else
+        pci_dev_put(to_pci_dev(boardp->dvc_cfg.asc_dvc_cfg.dev));
+
 #ifdef CONFIG_PROC_FS
     ASC_ASSERT(boardp->prtbuf != NULL);
     kfree(boardp->prtbuf);

_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors

#1 lore raw

Re: [KJ] [PATCH] drivers/scsi/advansys.c: Convert pci_find_device()

Quoted 19 lines · James Lamanna

So here's a conversion of another driver from pci_find_device() to pci_get_device().
After reading Greg's earlier comments about this change, hopefully this is mostly correct.
Oh and BTW, advansys.c needs a serious Lindent run and some warnings cleanup, but that will have to be for another day...
This patch matches the current indentation of the file that's why there are spaces not tabs.
Compile-tested but not runtime-tested.

Signed-off by: James Lamanna <[email protected]>

advansys.c | 7 +++++--

 1 files changed, 5 insertions(+), 2 deletions(-)

drivers/scsi/advansys.c advansys_detect(struct scsi_host_templat · line 4475

Quoted 5 lines
drivers/scsi/advansys.c +1 -1
@@ -4472,7 +4472,7 @@ advansys_detect(struct scsi_host_templat
 
                     /* Find all PCI cards. */
                     while (pci_device_id_cnt < ASC_PCI_DEVICE_ID_CNT) {
-                        if ((pci_devp = pci_find_device(ASC_PCI_VENDORID,
+                        if ((pci_devp = pci_get_device(ASC_PCI_VENDORID,

This looks correct.

drivers/scsi/advansys.c advansys_release(struct Scsi_Host *shp) · line 5478

Quoted 12 lines
drivers/scsi/advansys.c +4 -1
                             pci_device_id[pci_device_id_cnt], pci_devp)) ==
                             NULL) {
                             pci_device_id_cnt++;
@@ -5472,7 +5472,10 @@ advansys_release(struct Scsi_Host *shp)
             boardp->adv_sgblkp = sgp->next_sgblkp;
             kfree(sgp);
         }
-    }
+        pci_dev_put(to_pci_dev(boardp->dvc_cfg.adv_dvc_cfg.dev));
+    } else
+        pci_dev_put(to_pci_dev(boardp->dvc_cfg.asc_dvc_cfg.dev));
+

Why not just move this out of the if statement as you are doing it either way?

Also, this driver doesn't even work, see the big #warning at the top of it. You might want to ask the linux-scsi list if it's obsolete.

thanks,

greg k-h

_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors

#2 lore raw

Re: [KJ] [PATCH] drivers/scsi/advansys.c: Convert pci_find_device()

In reply to James Lamanna

On 7/8/05, Greg KH <[email protected]> wrote:
[snip]

Quoted 2 lines

Why not just move this out of the if statement as you are doing it either way?

Depending on whether the board is a "wide" or "narrow" board, the dev struct is stored in a different field of the union (adv_dvc_cfg vs. asc_dvc_cfg - not much difference in names there, easy to miss)

Quoted 2 lines

Also, this driver doesn't even work, see the big #warning at the top of it. You might want to ask the linux-scsi list if it's obsolete.

Ah, apparently I'm blind.
I guess this was the first driver I stumbled upon needing the conversion. I'll check around about that.
I'll also see if there are any non-broken/warned drivers that need this fix that I can tackle.

Thanks.

_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors