aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/libertas/ethtool.c
diff options
context:
space:
mode:
authorHolger Schurig <hs4233@mail.mn-solutions.de>2008-03-26 05:03:48 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-04-01 17:13:16 -0400
commit7460f5a69055357bf97f1890db547aba0c4bf2fa (patch)
tree57466a9c61f803b0bb2b7f65aa0b9a5c46100209 /drivers/net/wireless/libertas/ethtool.c
parent2af9f039a17c0acd9e5b21d10058688687bad86d (diff)
libertas: convert CMD_802_11_EEPROM_ACCESS to a direct command
Signed-off-by: Holger Schurig <hs4233@mail.mn-solutions.de> Acked-by: Dan Williams <dcbw@redhat.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/libertas/ethtool.c')
-rw-r--r--drivers/net/wireless/libertas/ethtool.c67
1 files changed, 17 insertions, 50 deletions
diff --git a/drivers/net/wireless/libertas/ethtool.c b/drivers/net/wireless/libertas/ethtool.c
index 21e6f988ea81..7c8ce7d0f23a 100644
--- a/drivers/net/wireless/libertas/ethtool.c
+++ b/drivers/net/wireless/libertas/ethtool.c
@@ -48,61 +48,28 @@ static int lbs_ethtool_get_eeprom(struct net_device *dev,
48 struct ethtool_eeprom *eeprom, u8 * bytes) 48 struct ethtool_eeprom *eeprom, u8 * bytes)
49{ 49{
50 struct lbs_private *priv = (struct lbs_private *) dev->priv; 50 struct lbs_private *priv = (struct lbs_private *) dev->priv;
51 struct lbs_ioctl_regrdwr regctrl; 51 struct cmd_ds_802_11_eeprom_access cmd;
52 char *ptr;
53 int ret; 52 int ret;
54 53
55 regctrl.action = 0; 54 lbs_deb_enter(LBS_DEB_ETHTOOL);
56 regctrl.offset = eeprom->offset;
57 regctrl.NOB = eeprom->len;
58
59 if (eeprom->offset + eeprom->len > LBS_EEPROM_LEN)
60 return -EINVAL;
61
62// mutex_lock(&priv->mutex);
63
64 priv->prdeeprom = kmalloc(eeprom->len+sizeof(regctrl), GFP_KERNEL);
65 if (!priv->prdeeprom)
66 return -ENOMEM;
67 memcpy(priv->prdeeprom, &regctrl, sizeof(regctrl));
68
69 /* +14 is for action, offset, and NOB in
70 * response */
71 lbs_deb_ethtool("action:%d offset: %x NOB: %02x\n",
72 regctrl.action, regctrl.offset, regctrl.NOB);
73 55
74 ret = lbs_prepare_and_send_command(priv, 56 if (eeprom->offset + eeprom->len > LBS_EEPROM_LEN ||
75 CMD_802_11_EEPROM_ACCESS, 57 eeprom->len > LBS_EEPROM_READ_LEN) {
76 regctrl.action, 58 ret = -EINVAL;
77 CMD_OPTION_WAITFORRSP, 0, 59 goto out;
78 &regctrl);
79
80 if (ret) {
81 if (priv->prdeeprom)
82 kfree(priv->prdeeprom);
83 goto done;
84 } 60 }
85 61
86 mdelay(10); 62 cmd.hdr.size = cpu_to_le16(sizeof(struct cmd_ds_802_11_eeprom_access) -
87 63 LBS_EEPROM_READ_LEN + eeprom->len);
88 ptr = (char *)priv->prdeeprom; 64 cmd.action = cpu_to_le16(CMD_ACT_GET);
89 65 cmd.offset = cpu_to_le16(eeprom->offset);
90 /* skip the command header, but include the "value" u32 variable */ 66 cmd.len = cpu_to_le16(eeprom->len);
91 ptr = ptr + sizeof(struct lbs_ioctl_regrdwr) - 4; 67 ret = lbs_cmd_with_response(priv, CMD_802_11_EEPROM_ACCESS, &cmd);
92 68 if (!ret)
93 /* 69 memcpy(bytes, cmd.value, eeprom->len);
94 * Return the result back to the user 70
95 */ 71out:
96 memcpy(bytes, ptr, eeprom->len); 72 lbs_deb_leave_args(LBS_DEB_ETHTOOL, "ret %d", ret);
97
98 if (priv->prdeeprom)
99 kfree(priv->prdeeprom);
100// mutex_unlock(&priv->mutex);
101
102 ret = 0;
103
104done:
105 lbs_deb_enter_args(LBS_DEB_ETHTOOL, "ret %d", ret);
106 return ret; 73 return ret;
107} 74}
108 75