Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[SCSI] bnx2i: removed the individual PCI DEVICE ID checking

Removed the individual PCI DEVICE ID checking inside bnx2i. The device
type can easily be read from the corresponding cnic->flags. This will
free bnx2i from having to get updated for every new device ID that gets
added.

Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
Acked-by: Michael Chan <mchan@broadcom.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>

authored by

Eddie Wai and committed by
James Bottomley
b83908ce 9a07da9f

+19 -28
+1 -1
drivers/scsi/bnx2i/bnx2i.h
··· 800 800 /* 801 801 * Function Prototypes 802 802 */ 803 - extern void bnx2i_identify_device(struct bnx2i_hba *hba); 803 + extern void bnx2i_identify_device(struct bnx2i_hba *hba, struct cnic_dev *dev); 804 804 805 805 extern void bnx2i_ulp_init(struct cnic_dev *dev); 806 806 extern void bnx2i_ulp_exit(struct cnic_dev *dev);
+17 -26
drivers/scsi/bnx2i/bnx2i_init.c
··· 79 79 /** 80 80 * bnx2i_identify_device - identifies NetXtreme II device type 81 81 * @hba: Adapter structure pointer 82 + * @cnic: Corresponding cnic device 82 83 * 83 84 * This function identifies the NX2 device type and sets appropriate 84 85 * queue mailbox register access method, 5709 requires driver to 85 86 * access MBOX regs using *bin* mode 86 87 */ 87 - void bnx2i_identify_device(struct bnx2i_hba *hba) 88 + void bnx2i_identify_device(struct bnx2i_hba *hba, struct cnic_dev *dev) 88 89 { 89 90 hba->cnic_dev_type = 0; 90 - if ((hba->pci_did == PCI_DEVICE_ID_NX2_5706) || 91 - (hba->pci_did == PCI_DEVICE_ID_NX2_5706S)) 92 - set_bit(BNX2I_NX2_DEV_5706, &hba->cnic_dev_type); 93 - else if ((hba->pci_did == PCI_DEVICE_ID_NX2_5708) || 94 - (hba->pci_did == PCI_DEVICE_ID_NX2_5708S)) 95 - set_bit(BNX2I_NX2_DEV_5708, &hba->cnic_dev_type); 96 - else if ((hba->pci_did == PCI_DEVICE_ID_NX2_5709) || 97 - (hba->pci_did == PCI_DEVICE_ID_NX2_5709S)) { 98 - set_bit(BNX2I_NX2_DEV_5709, &hba->cnic_dev_type); 99 - hba->mail_queue_access = BNX2I_MQ_BIN_MODE; 100 - } else if (hba->pci_did == PCI_DEVICE_ID_NX2_57710 || 101 - hba->pci_did == PCI_DEVICE_ID_NX2_57711 || 102 - hba->pci_did == PCI_DEVICE_ID_NX2_57711E || 103 - hba->pci_did == PCI_DEVICE_ID_NX2_57712 || 104 - hba->pci_did == PCI_DEVICE_ID_NX2_57712E || 105 - hba->pci_did == PCI_DEVICE_ID_NX2_57800 || 106 - hba->pci_did == PCI_DEVICE_ID_NX2_57800_MF || 107 - hba->pci_did == PCI_DEVICE_ID_NX2_57800_VF || 108 - hba->pci_did == PCI_DEVICE_ID_NX2_57810 || 109 - hba->pci_did == PCI_DEVICE_ID_NX2_57810_MF || 110 - hba->pci_did == PCI_DEVICE_ID_NX2_57810_VF || 111 - hba->pci_did == PCI_DEVICE_ID_NX2_57840 || 112 - hba->pci_did == PCI_DEVICE_ID_NX2_57840_MF || 113 - hba->pci_did == PCI_DEVICE_ID_NX2_57840_VF) 91 + if (test_bit(CNIC_F_BNX2_CLASS, &dev->flags)) { 92 + if (hba->pci_did == PCI_DEVICE_ID_NX2_5706 || 93 + hba->pci_did == PCI_DEVICE_ID_NX2_5706S) { 94 + set_bit(BNX2I_NX2_DEV_5706, &hba->cnic_dev_type); 95 + } else if (hba->pci_did == PCI_DEVICE_ID_NX2_5708 || 96 + hba->pci_did == PCI_DEVICE_ID_NX2_5708S) { 97 + set_bit(BNX2I_NX2_DEV_5708, &hba->cnic_dev_type); 98 + } else if (hba->pci_did == PCI_DEVICE_ID_NX2_5709 || 99 + hba->pci_did == PCI_DEVICE_ID_NX2_5709S) { 100 + set_bit(BNX2I_NX2_DEV_5709, &hba->cnic_dev_type); 101 + hba->mail_queue_access = BNX2I_MQ_BIN_MODE; 102 + } 103 + } else if (test_bit(CNIC_F_BNX2X_CLASS, &dev->flags)) { 114 104 set_bit(BNX2I_NX2_DEV_57710, &hba->cnic_dev_type); 115 - else 105 + } else { 116 106 printk(KERN_ALERT "bnx2i: unknown device, 0x%x\n", 117 107 hba->pci_did); 108 + } 118 109 } 119 110 120 111
+1 -1
drivers/scsi/bnx2i/bnx2i_iscsi.c
··· 808 808 hba->pci_func = PCI_FUNC(hba->pcidev->devfn); 809 809 hba->pci_devno = PCI_SLOT(hba->pcidev->devfn); 810 810 811 - bnx2i_identify_device(hba); 811 + bnx2i_identify_device(hba, cnic); 812 812 bnx2i_setup_host_queue_size(hba, shost); 813 813 814 814 hba->reg_base = pci_resource_start(hba->pcidev, 0);