aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/s2io.c
diff options
context:
space:
mode:
authorAuke Kok <auke-jan.h.kok@intel.com>2007-06-08 18:46:36 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2007-07-11 19:02:10 -0400
commit44c10138fd4bbc4b6d6bff0873c24902f2a9da65 (patch)
tree6e16d3ec80c87490dc743f72da086356f2906ace /drivers/net/s2io.c
parentb8a3a5214d7cc115f1ca3a3967b7229d97c46f4a (diff)
PCI: Change all drivers to use pci_device->revision
Instead of all drivers reading pci config space to get the revision ID, they can now use the pci_device->revision member. This exposes some issues where drivers where reading a word or a dword for the revision number, and adding useless error-handling around the read. Some drivers even just read it for no purpose of all. In devices where the revision ID is being copied over and used in what appears to be the equivalent of hotpath, I have left the copy code and the cached copy as not to influence the driver's performance. Compile tested with make all{yes,mod}config on x86_64 and i386. Signed-off-by: Auke Kok <auke-jan.h.kok@intel.com> Acked-by: Dave Jones <davej@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/net/s2io.c')
-rw-r--r--drivers/net/s2io.c25
1 files changed, 4 insertions, 21 deletions
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c
index fa29a403a247..58bbfdd4f901 100644
--- a/drivers/net/s2io.c
+++ b/drivers/net/s2io.c
@@ -1135,7 +1135,7 @@ static int init_nic(struct s2io_nic *nic)
1135 * SXE-008 TRANSMIT DMA ARBITRATION ISSUE. 1135 * SXE-008 TRANSMIT DMA ARBITRATION ISSUE.
1136 */ 1136 */
1137 if ((nic->device_type == XFRAME_I_DEVICE) && 1137 if ((nic->device_type == XFRAME_I_DEVICE) &&
1138 (get_xena_rev_id(nic->pdev) < 4)) 1138 (nic->pdev->revision < 4))
1139 writeq(PCC_ENABLE_FOUR, &bar0->pcc_enable); 1139 writeq(PCC_ENABLE_FOUR, &bar0->pcc_enable);
1140 1140
1141 val64 = readq(&bar0->tx_fifo_partition_0); 1141 val64 = readq(&bar0->tx_fifo_partition_0);
@@ -1873,7 +1873,7 @@ static int verify_pcc_quiescent(struct s2io_nic *sp, int flag)
1873 herc = (sp->device_type == XFRAME_II_DEVICE); 1873 herc = (sp->device_type == XFRAME_II_DEVICE);
1874 1874
1875 if (flag == FALSE) { 1875 if (flag == FALSE) {
1876 if ((!herc && (get_xena_rev_id(sp->pdev) >= 4)) || herc) { 1876 if ((!herc && (sp->pdev->revision >= 4)) || herc) {
1877 if (!(val64 & ADAPTER_STATUS_RMAC_PCC_IDLE)) 1877 if (!(val64 & ADAPTER_STATUS_RMAC_PCC_IDLE))
1878 ret = 1; 1878 ret = 1;
1879 } else { 1879 } else {
@@ -1881,7 +1881,7 @@ static int verify_pcc_quiescent(struct s2io_nic *sp, int flag)
1881 ret = 1; 1881 ret = 1;
1882 } 1882 }
1883 } else { 1883 } else {
1884 if ((!herc && (get_xena_rev_id(sp->pdev) >= 4)) || herc) { 1884 if ((!herc && (sp->pdev->revision >= 4)) || herc) {
1885 if (((val64 & ADAPTER_STATUS_RMAC_PCC_IDLE) == 1885 if (((val64 & ADAPTER_STATUS_RMAC_PCC_IDLE) ==
1886 ADAPTER_STATUS_RMAC_PCC_IDLE)) 1886 ADAPTER_STATUS_RMAC_PCC_IDLE))
1887 ret = 1; 1887 ret = 1;
@@ -7076,23 +7076,6 @@ static void s2io_link(struct s2io_nic * sp, int link)
7076} 7076}
7077 7077
7078/** 7078/**
7079 * get_xena_rev_id - to identify revision ID of xena.
7080 * @pdev : PCI Dev structure
7081 * Description:
7082 * Function to identify the Revision ID of xena.
7083 * Return value:
7084 * returns the revision ID of the device.
7085 */
7086
7087static int get_xena_rev_id(struct pci_dev *pdev)
7088{
7089 u8 id = 0;
7090 int ret;
7091 ret = pci_read_config_byte(pdev, PCI_REVISION_ID, (u8 *) & id);
7092 return id;
7093}
7094
7095/**
7096 * s2io_init_pci -Initialization of PCI and PCI-X configuration registers . 7079 * s2io_init_pci -Initialization of PCI and PCI-X configuration registers .
7097 * @sp : private member of the device structure, which is a pointer to the 7080 * @sp : private member of the device structure, which is a pointer to the
7098 * s2io_nic structure. 7081 * s2io_nic structure.
@@ -7550,7 +7533,7 @@ s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre)
7550 s2io_vpd_read(sp); 7533 s2io_vpd_read(sp);
7551 DBG_PRINT(ERR_DBG, "Copyright(c) 2002-2007 Neterion Inc.\n"); 7534 DBG_PRINT(ERR_DBG, "Copyright(c) 2002-2007 Neterion Inc.\n");
7552 DBG_PRINT(ERR_DBG, "%s: Neterion %s (rev %d)\n",dev->name, 7535 DBG_PRINT(ERR_DBG, "%s: Neterion %s (rev %d)\n",dev->name,
7553 sp->product_name, get_xena_rev_id(sp->pdev)); 7536 sp->product_name, pdev->revision);
7554 DBG_PRINT(ERR_DBG, "%s: Driver version %s\n", dev->name, 7537 DBG_PRINT(ERR_DBG, "%s: Driver version %s\n", dev->name,
7555 s2io_driver_version); 7538 s2io_driver_version);
7556 DBG_PRINT(ERR_DBG, "%s: MAC ADDR: " 7539 DBG_PRINT(ERR_DBG, "%s: MAC ADDR: "