diff options
author | Alexander Duyck <alexander.h.duyck@intel.com> | 2009-02-06 23:16:45 (GMT) |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-02-07 10:43:04 (GMT) |
commit | c1889bfe687c22f74d1333913ffe8f8da173d601 (patch) | |
tree | dff3d16c38181e79437c6d6c82817a127b4de686 /drivers/net/igb/e1000_82575.c | |
parent | 4d6b725e4d8e499fad012a25381c8d9bf53fbf4b (diff) | |
download | linux-c1889bfe687c22f74d1333913ffe8f8da173d601.tar.xz |
igb: make dev_spec a union and remove dynamic allocation
This patch makes dev_spec a union and simplifies it so that it does not
require dynamic allocation and freeing in the driver.
Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/igb/e1000_82575.c')
-rw-r--r-- | drivers/net/igb/e1000_82575.c | 34 |
1 files changed, 5 insertions, 29 deletions
diff --git a/drivers/net/igb/e1000_82575.c b/drivers/net/igb/e1000_82575.c index f5e4cad..ed9e8c0 100644 --- a/drivers/net/igb/e1000_82575.c +++ b/drivers/net/igb/e1000_82575.c @@ -62,17 +62,12 @@ static bool igb_sgmii_active_82575(struct e1000_hw *); static s32 igb_reset_init_script_82575(struct e1000_hw *); static s32 igb_read_mac_addr_82575(struct e1000_hw *); - -struct e1000_dev_spec_82575 { - bool sgmii_active; -}; - static s32 igb_get_invariants_82575(struct e1000_hw *hw) { struct e1000_phy_info *phy = &hw->phy; struct e1000_nvm_info *nvm = &hw->nvm; struct e1000_mac_info *mac = &hw->mac; - struct e1000_dev_spec_82575 *dev_spec; + struct e1000_dev_spec_82575 * dev_spec = &hw->dev_spec._82575; u32 eecd; s32 ret_val; u16 size; @@ -94,17 +89,6 @@ static s32 igb_get_invariants_82575(struct e1000_hw *hw) break; } - /* MAC initialization */ - hw->dev_spec_size = sizeof(struct e1000_dev_spec_82575); - - /* Device-specific structure allocation */ - hw->dev_spec = kzalloc(hw->dev_spec_size, GFP_KERNEL); - - if (!hw->dev_spec) - return -ENOMEM; - - dev_spec = (struct e1000_dev_spec_82575 *)hw->dev_spec; - /* Set media type */ /* * The 82575 uses bits 22:23 for link mode. The mode can be changed @@ -1234,20 +1218,12 @@ out: **/ static bool igb_sgmii_active_82575(struct e1000_hw *hw) { - struct e1000_dev_spec_82575 *dev_spec; - bool ret_val; + struct e1000_dev_spec_82575 *dev_spec = &hw->dev_spec._82575; - if (hw->mac.type != e1000_82575) { - ret_val = false; - goto out; - } - - dev_spec = (struct e1000_dev_spec_82575 *)hw->dev_spec; + if (hw->mac.type != e1000_82575 && hw->mac.type != e1000_82576) + return false; - ret_val = dev_spec->sgmii_active; - -out: - return ret_val; + return dev_spec->sgmii_active; } /** |