aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/igb/e1000_82575.c
diff options
context:
space:
mode:
authorAlexander Duyck <alexander.h.duyck@intel.com>2009-02-06 18:16:45 -0500
committerDavid S. Miller <davem@davemloft.net>2009-02-07 05:43:04 -0500
commitc1889bfe687c22f74d1333913ffe8f8da173d601 (patch)
treedff3d16c38181e79437c6d6c82817a127b4de686 /drivers/net/igb/e1000_82575.c
parent4d6b725e4d8e499fad012a25381c8d9bf53fbf4b (diff)
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.c34
1 files changed, 5 insertions, 29 deletions
diff --git a/drivers/net/igb/e1000_82575.c b/drivers/net/igb/e1000_82575.c
index f5e4cad7971a..ed9e8c0333a3 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 *);
62static s32 igb_reset_init_script_82575(struct e1000_hw *); 62static s32 igb_reset_init_script_82575(struct e1000_hw *);
63static s32 igb_read_mac_addr_82575(struct e1000_hw *); 63static s32 igb_read_mac_addr_82575(struct e1000_hw *);
64 64
65
66struct e1000_dev_spec_82575 {
67 bool sgmii_active;
68};
69
70static s32 igb_get_invariants_82575(struct e1000_hw *hw) 65static s32 igb_get_invariants_82575(struct e1000_hw *hw)
71{ 66{
72 struct e1000_phy_info *phy = &hw->phy; 67 struct e1000_phy_info *phy = &hw->phy;
73 struct e1000_nvm_info *nvm = &hw->nvm; 68 struct e1000_nvm_info *nvm = &hw->nvm;
74 struct e1000_mac_info *mac = &hw->mac; 69 struct e1000_mac_info *mac = &hw->mac;
75 struct e1000_dev_spec_82575 *dev_spec; 70 struct e1000_dev_spec_82575 * dev_spec = &hw->dev_spec._82575;
76 u32 eecd; 71 u32 eecd;
77 s32 ret_val; 72 s32 ret_val;
78 u16 size; 73 u16 size;
@@ -94,17 +89,6 @@ static s32 igb_get_invariants_82575(struct e1000_hw *hw)
94 break; 89 break;
95 } 90 }
96 91
97 /* MAC initialization */
98 hw->dev_spec_size = sizeof(struct e1000_dev_spec_82575);
99
100 /* Device-specific structure allocation */
101 hw->dev_spec = kzalloc(hw->dev_spec_size, GFP_KERNEL);
102
103 if (!hw->dev_spec)
104 return -ENOMEM;
105
106 dev_spec = (struct e1000_dev_spec_82575 *)hw->dev_spec;
107
108 /* Set media type */ 92 /* Set media type */
109 /* 93 /*
110 * The 82575 uses bits 22:23 for link mode. The mode can be changed 94 * The 82575 uses bits 22:23 for link mode. The mode can be changed
@@ -1234,20 +1218,12 @@ out:
1234 **/ 1218 **/
1235static bool igb_sgmii_active_82575(struct e1000_hw *hw) 1219static bool igb_sgmii_active_82575(struct e1000_hw *hw)
1236{ 1220{
1237 struct e1000_dev_spec_82575 *dev_spec; 1221 struct e1000_dev_spec_82575 *dev_spec = &hw->dev_spec._82575;
1238 bool ret_val;
1239 1222
1240 if (hw->mac.type != e1000_82575) { 1223 if (hw->mac.type != e1000_82575 && hw->mac.type != e1000_82576)
1241 ret_val = false; 1224 return false;
1242 goto out;
1243 }
1244
1245 dev_spec = (struct e1000_dev_spec_82575 *)hw->dev_spec;
1246 1225
1247 ret_val = dev_spec->sgmii_active; 1226 return dev_spec->sgmii_active;
1248
1249out:
1250 return ret_val;
1251} 1227}
1252 1228
1253/** 1229/**