Commit 95dad872 authored by Jeb J. Cramer's avatar Jeb J. Cramer Committed by Jeff Garzik

e1000 net driver minor fixes/cleanups:

* don't read PCI bus for values stored in struct pci_dev
* remove silly BUG() in e1000_sw_init, and
* return error from e1000_sw_init
parent 0c83531d
...@@ -135,7 +135,7 @@ static int e1000_init_module(void); ...@@ -135,7 +135,7 @@ static int e1000_init_module(void);
static void e1000_exit_module(void); static void e1000_exit_module(void);
static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent); static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent);
static void e1000_remove(struct pci_dev *pdev); static void e1000_remove(struct pci_dev *pdev);
static void e1000_sw_init(struct e1000_adapter *adapter); static int e1000_sw_init(struct e1000_adapter *adapter);
static int e1000_open(struct net_device *netdev); static int e1000_open(struct net_device *netdev);
static int e1000_close(struct net_device *netdev); static int e1000_close(struct net_device *netdev);
static int e1000_setup_tx_resources(struct e1000_adapter *adapter); static int e1000_setup_tx_resources(struct e1000_adapter *adapter);
...@@ -415,7 +415,8 @@ e1000_probe(struct pci_dev *pdev, ...@@ -415,7 +415,8 @@ e1000_probe(struct pci_dev *pdev,
/* setup the private structure */ /* setup the private structure */
e1000_sw_init(adapter); if(e1000_sw_init(adapter))
goto err_sw_init;
if(adapter->hw.mac_type >= e1000_82543) { if(adapter->hw.mac_type >= e1000_82543) {
netdev->features = NETIF_F_SG | netdev->features = NETIF_F_SG |
...@@ -500,6 +501,7 @@ e1000_probe(struct pci_dev *pdev, ...@@ -500,6 +501,7 @@ e1000_probe(struct pci_dev *pdev,
cards_found++; cards_found++;
return 0; return 0;
err_sw_init:
err_eeprom: err_eeprom:
iounmap(adapter->hw.hw_addr); iounmap(adapter->hw.hw_addr);
err_ioremap: err_ioremap:
...@@ -555,7 +557,7 @@ e1000_remove(struct pci_dev *pdev) ...@@ -555,7 +557,7 @@ e1000_remove(struct pci_dev *pdev)
* OS network device settings (MTU size). * OS network device settings (MTU size).
**/ **/
static void __devinit static int __devinit
e1000_sw_init(struct e1000_adapter *adapter) e1000_sw_init(struct e1000_adapter *adapter)
{ {
struct e1000_hw *hw = &adapter->hw; struct e1000_hw *hw = &adapter->hw;
...@@ -564,11 +566,11 @@ e1000_sw_init(struct e1000_adapter *adapter) ...@@ -564,11 +566,11 @@ e1000_sw_init(struct e1000_adapter *adapter)
/* PCI config space info */ /* PCI config space info */
pci_read_config_word(pdev, PCI_VENDOR_ID, &hw->vendor_id); hw->vendor_id = pdev->vendor;
pci_read_config_word(pdev, PCI_DEVICE_ID, &hw->device_id); hw->device_id = pdev->device;
pci_read_config_word(pdev, PCI_SUBSYSTEM_VENDOR_ID, hw->subsystem_vendor_id = pdev->subsystem_vendor;
&hw->subsystem_vendor_id); hw->subsystem_id = pdev->subsystem_device;
pci_read_config_word(pdev, PCI_SUBSYSTEM_ID, &hw->subsystem_id);
pci_read_config_byte(pdev, PCI_REVISION_ID, &hw->revision_id); pci_read_config_byte(pdev, PCI_REVISION_ID, &hw->revision_id);
pci_read_config_word(pdev, PCI_COMMAND, &hw->pci_cmd_word); pci_read_config_word(pdev, PCI_COMMAND, &hw->pci_cmd_word);
...@@ -581,7 +583,7 @@ e1000_sw_init(struct e1000_adapter *adapter) ...@@ -581,7 +583,7 @@ e1000_sw_init(struct e1000_adapter *adapter)
if (e1000_set_mac_type(hw)) { if (e1000_set_mac_type(hw)) {
E1000_ERR("Unknown MAC Type\n"); E1000_ERR("Unknown MAC Type\n");
BUG(); return -1;
} }
/* flow control settings */ /* flow control settings */
...@@ -622,6 +624,8 @@ e1000_sw_init(struct e1000_adapter *adapter) ...@@ -622,6 +624,8 @@ e1000_sw_init(struct e1000_adapter *adapter)
atomic_set(&adapter->irq_sem, 1); atomic_set(&adapter->irq_sem, 1);
spin_lock_init(&adapter->stats_lock); spin_lock_init(&adapter->stats_lock);
return 0;
} }
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment