aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/libertas
diff options
context:
space:
mode:
authorHolger Schurig <hs4233@mail.mn-solutions.de>2008-03-26 04:58:32 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-04-01 17:13:16 -0400
commit2af9f039a17c0acd9e5b21d10058688687bad86d (patch)
tree473a0dd553b60d1886cfbb40b40a570d78c3d839 /drivers/net/wireless/libertas
parent717ddc0ebdd00c233fcb1ae9a243e69f301cde24 (diff)
libertas: convert CMD_802_11_MAC_ADDRESS to a direct command
* directly call lbs_cmd_with_response() * only overwrite priv->current_addr once the firmware call succeeded 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')
-rw-r--r--drivers/net/wireless/libertas/cmd.c27
-rw-r--r--drivers/net/wireless/libertas/cmdresp.c17
-rw-r--r--drivers/net/wireless/libertas/hostcmd.h3
-rw-r--r--drivers/net/wireless/libertas/main.c25
4 files changed, 11 insertions, 61 deletions
diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c
index 44b918a6c219..d396a5f06666 100644
--- a/drivers/net/wireless/libertas/cmd.c
+++ b/drivers/net/wireless/libertas/cmd.c
@@ -953,29 +953,6 @@ static int lbs_cmd_reg_access(struct cmd_ds_command *cmdptr,
953 return 0; 953 return 0;
954} 954}
955 955
956static int lbs_cmd_802_11_mac_address(struct lbs_private *priv,
957 struct cmd_ds_command *cmd,
958 u16 cmd_action)
959{
960
961 lbs_deb_enter(LBS_DEB_CMD);
962 cmd->command = cpu_to_le16(CMD_802_11_MAC_ADDRESS);
963 cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_mac_address) +
964 S_DS_GEN);
965 cmd->result = 0;
966
967 cmd->params.macadd.action = cpu_to_le16(cmd_action);
968
969 if (cmd_action == CMD_ACT_SET) {
970 memcpy(cmd->params.macadd.macadd,
971 priv->current_addr, ETH_ALEN);
972 lbs_deb_hex(LBS_DEB_CMD, "SET_CMD: MAC addr", priv->current_addr, 6);
973 }
974
975 lbs_deb_leave(LBS_DEB_CMD);
976 return 0;
977}
978
979static int lbs_cmd_802_11_eeprom_access(struct cmd_ds_command *cmd, 956static int lbs_cmd_802_11_eeprom_access(struct cmd_ds_command *cmd,
980 void *pdata_buf) 957 void *pdata_buf)
981{ 958{
@@ -1435,10 +1412,6 @@ int lbs_prepare_and_send_command(struct lbs_private *priv,
1435 ret = lbs_cmd_80211_ad_hoc_stop(cmdptr); 1412 ret = lbs_cmd_80211_ad_hoc_stop(cmdptr);
1436 break; 1413 break;
1437 1414
1438 case CMD_802_11_MAC_ADDRESS:
1439 ret = lbs_cmd_802_11_mac_address(priv, cmdptr, cmd_action);
1440 break;
1441
1442 case CMD_802_11_EEPROM_ACCESS: 1415 case CMD_802_11_EEPROM_ACCESS:
1443 ret = lbs_cmd_802_11_eeprom_access(cmdptr, pdata_buf); 1416 ret = lbs_cmd_802_11_eeprom_access(cmdptr, pdata_buf);
1444 break; 1417 break;
diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c
index 9de9666d495b..c3b80c139d4f 100644
--- a/drivers/net/wireless/libertas/cmdresp.c
+++ b/drivers/net/wireless/libertas/cmdresp.c
@@ -188,19 +188,6 @@ static int lbs_ret_802_11_snmp_mib(struct lbs_private *priv,
188 return 0; 188 return 0;
189} 189}
190 190
191static int lbs_ret_802_11_mac_address(struct lbs_private *priv,
192 struct cmd_ds_command *resp)
193{
194 struct cmd_ds_802_11_mac_address *macadd = &resp->params.macadd;
195
196 lbs_deb_enter(LBS_DEB_CMD);
197
198 memcpy(priv->current_addr, macadd->macadd, ETH_ALEN);
199
200 lbs_deb_enter(LBS_DEB_CMD);
201 return 0;
202}
203
204static int lbs_ret_802_11_rf_tx_power(struct lbs_private *priv, 191static int lbs_ret_802_11_rf_tx_power(struct lbs_private *priv,
205 struct cmd_ds_command *resp) 192 struct cmd_ds_command *resp)
206{ 193{
@@ -368,10 +355,6 @@ static inline int handle_cmd_response(struct lbs_private *priv,
368 ret = lbs_ret_802_11_rssi(priv, resp); 355 ret = lbs_ret_802_11_rssi(priv, resp);
369 break; 356 break;
370 357
371 case CMD_RET(CMD_802_11_MAC_ADDRESS):
372 ret = lbs_ret_802_11_mac_address(priv, resp);
373 break;
374
375 case CMD_RET(CMD_802_11_AD_HOC_STOP): 358 case CMD_RET(CMD_802_11_AD_HOC_STOP):
376 ret = lbs_ret_80211_ad_hoc_stop(priv); 359 ret = lbs_ret_80211_ad_hoc_stop(priv);
377 break; 360 break;
diff --git a/drivers/net/wireless/libertas/hostcmd.h b/drivers/net/wireless/libertas/hostcmd.h
index b8e372007bb9..e56d0049f5fd 100644
--- a/drivers/net/wireless/libertas/hostcmd.h
+++ b/drivers/net/wireless/libertas/hostcmd.h
@@ -427,6 +427,8 @@ struct cmd_ds_802_11_rssi_rsp {
427}; 427};
428 428
429struct cmd_ds_802_11_mac_address { 429struct cmd_ds_802_11_mac_address {
430 struct cmd_header hdr;
431
430 __le16 action; 432 __le16 action;
431 u8 macadd[ETH_ALEN]; 433 u8 macadd[ETH_ALEN];
432}; 434};
@@ -708,7 +710,6 @@ struct cmd_ds_command {
708 struct cmd_ds_802_11_rssi rssi; 710 struct cmd_ds_802_11_rssi rssi;
709 struct cmd_ds_802_11_rssi_rsp rssirsp; 711 struct cmd_ds_802_11_rssi_rsp rssirsp;
710 struct cmd_ds_802_11_disassociate dassociate; 712 struct cmd_ds_802_11_disassociate dassociate;
711 struct cmd_ds_802_11_mac_address macadd;
712 struct cmd_ds_mac_reg_access macreg; 713 struct cmd_ds_mac_reg_access macreg;
713 struct cmd_ds_bbp_reg_access bbpreg; 714 struct cmd_ds_bbp_reg_access bbpreg;
714 struct cmd_ds_rf_reg_access rfreg; 715 struct cmd_ds_rf_reg_access rfreg;
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c
index dac72f7af701..d0e4c3b6deaa 100644
--- a/drivers/net/wireless/libertas/main.c
+++ b/drivers/net/wireless/libertas/main.c
@@ -531,34 +531,27 @@ static int lbs_set_mac_address(struct net_device *dev, void *addr)
531 int ret = 0; 531 int ret = 0;
532 struct lbs_private *priv = (struct lbs_private *) dev->priv; 532 struct lbs_private *priv = (struct lbs_private *) dev->priv;
533 struct sockaddr *phwaddr = addr; 533 struct sockaddr *phwaddr = addr;
534 struct cmd_ds_802_11_mac_address cmd;
534 535
535 lbs_deb_enter(LBS_DEB_NET); 536 lbs_deb_enter(LBS_DEB_NET);
536 537
537 /* In case it was called from the mesh device */ 538 /* In case it was called from the mesh device */
538 dev = priv->dev ; 539 dev = priv->dev;
539
540 memset(priv->current_addr, 0, ETH_ALEN);
541
542 /* dev->dev_addr is 8 bytes */
543 lbs_deb_hex(LBS_DEB_NET, "dev->dev_addr", dev->dev_addr, ETH_ALEN);
544
545 lbs_deb_hex(LBS_DEB_NET, "addr", phwaddr->sa_data, ETH_ALEN);
546 memcpy(priv->current_addr, phwaddr->sa_data, ETH_ALEN);
547 540
548 ret = lbs_prepare_and_send_command(priv, CMD_802_11_MAC_ADDRESS, 541 cmd.hdr.size = cpu_to_le16(sizeof(cmd));
549 CMD_ACT_SET, 542 cmd.action = cpu_to_le16(CMD_ACT_SET);
550 CMD_OPTION_WAITFORRSP, 0, NULL); 543 memcpy(cmd.macadd, phwaddr->sa_data, ETH_ALEN);
551 544
545 ret = lbs_cmd_with_response(priv, CMD_802_11_MAC_ADDRESS, &cmd);
552 if (ret) { 546 if (ret) {
553 lbs_deb_net("set MAC address failed\n"); 547 lbs_deb_net("set MAC address failed\n");
554 ret = -1;
555 goto done; 548 goto done;
556 } 549 }
557 550
558 lbs_deb_hex(LBS_DEB_NET, "priv->macaddr", priv->current_addr, ETH_ALEN); 551 memcpy(priv->current_addr, phwaddr->sa_data, ETH_ALEN);
559 memcpy(dev->dev_addr, priv->current_addr, ETH_ALEN); 552 memcpy(dev->dev_addr, phwaddr->sa_data, ETH_ALEN);
560 if (priv->mesh_dev) 553 if (priv->mesh_dev)
561 memcpy(priv->mesh_dev->dev_addr, priv->current_addr, ETH_ALEN); 554 memcpy(priv->mesh_dev->dev_addr, phwaddr->sa_data, ETH_ALEN);
562 555
563done: 556done:
564 lbs_deb_leave_args(LBS_DEB_NET, "ret %d", ret); 557 lbs_deb_leave_args(LBS_DEB_NET, "ret %d", ret);