From: Lubomir Rintel <lkundrak@v3.sk>
To: Kalle Valo <kvalo@codeaurora.org>
Cc: "David S. Miller" <davem@davemloft.net>,
linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
Lubomir Rintel <lkundrak@v3.sk>
Subject: [PATCH 3/3] libertas_tf: get the MAC address before registering the device
Date: Sun, 10 Feb 2019 20:52:17 +0100 [thread overview]
Message-ID: <20190210195217.18817-4-lkundrak@v3.sk> (raw)
In-Reply-To: <20190210195217.18817-1-lkundrak@v3.sk>
The start() callback is too late for this: NetworkManager would already
have seen the hardware, thinking 00:00:00:00:00:00 is its permanent
address.
Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
---
.../net/wireless/marvell/libertas_tf/main.c | 57 ++++---------------
1 file changed, 11 insertions(+), 46 deletions(-)
diff --git a/drivers/net/wireless/marvell/libertas_tf/main.c b/drivers/net/wireless/marvell/libertas_tf/main.c
index b4bd3047eb4e..da53da71987e 100644
--- a/drivers/net/wireless/marvell/libertas_tf/main.c
+++ b/drivers/net/wireless/marvell/libertas_tf/main.c
@@ -125,37 +125,6 @@ static void lbtf_cmd_work(struct work_struct *work)
lbtf_deb_leave(LBTF_DEB_CMD);
}
-/**
- * lbtf_setup_firmware: initialize firmware.
- *
- * @priv A pointer to struct lbtf_private structure
- *
- * Returns: 0 on success.
- */
-static int lbtf_setup_firmware(struct lbtf_private *priv)
-{
- int ret = -1;
-
- lbtf_deb_enter(LBTF_DEB_FW);
- /*
- * Read priv address from HW
- */
- eth_broadcast_addr(priv->current_addr);
- ret = lbtf_update_hw_spec(priv);
- if (ret) {
- ret = -1;
- goto done;
- }
-
- lbtf_set_mac_control(priv);
- lbtf_set_radio_control(priv);
-
- ret = 0;
-done:
- lbtf_deb_leave_args(LBTF_DEB_FW, "ret: %d", ret);
- return ret;
-}
-
/**
* This function handles the timeout of command sending.
* It will re-send the same command again.
@@ -289,30 +258,17 @@ static void lbtf_tx_work(struct work_struct *work)
static int lbtf_op_start(struct ieee80211_hw *hw)
{
struct lbtf_private *priv = hw->priv;
- int ret = -1;
lbtf_deb_enter(LBTF_DEB_MACOPS);
- /* poke the firmware */
priv->capability = WLAN_CAPABILITY_SHORT_PREAMBLE;
priv->radioon = RADIO_ON;
priv->mac_control = CMD_ACT_MAC_RX_ON | CMD_ACT_MAC_TX_ON;
- ret = lbtf_setup_firmware(priv);
- if (ret)
- goto err_setup_firmware;
-
- if ((priv->fwrelease < LBTF_FW_VER_MIN) ||
- (priv->fwrelease > LBTF_FW_VER_MAX)) {
- ret = -1;
- goto err_setup_firmware;
- }
+ lbtf_set_mac_control(priv);
+ lbtf_set_radio_control(priv);
lbtf_deb_leave(LBTF_DEB_MACOPS);
return 0;
-
-err_setup_firmware:
- lbtf_deb_leave_args(LBTF_DEB_MACOPS, "fw setup error; ret=%d", ret);
- return ret;
}
static void lbtf_op_stop(struct ieee80211_hw *hw)
@@ -649,6 +605,15 @@ struct lbtf_private *lbtf_add_card(void *card, struct device *dmdev,
goto err_init_adapter;
}
+ eth_broadcast_addr(priv->current_addr);
+ if (lbtf_update_hw_spec(priv))
+ goto err_init_adapter;
+
+ if (priv->fwrelease < LBTF_FW_VER_MIN ||
+ priv->fwrelease > LBTF_FW_VER_MAX) {
+ goto err_init_adapter;
+ }
+
/* The firmware seems to start with the radio enabled. Turn it
* off before an actual mac80211 start callback is invoked.
*/
--
2.20.1
next prev parent reply other threads:[~2019-02-10 19:52 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-10 19:52 [PATCH 0/3] libertas_tf: fix setting the hardware address Lubomir Rintel
2019-02-10 19:52 ` [PATCH 1/3] libertas_tf: move hardware callbacks to a separate structure Lubomir Rintel
2019-02-11 13:47 ` Steve deRosier
2019-02-19 15:13 ` Kalle Valo
2019-02-10 19:52 ` [PATCH 2/3] libertas_tf: don't defer firmware loading until start() Lubomir Rintel
2019-02-11 14:10 ` Steve deRosier
2019-02-10 19:52 ` Lubomir Rintel [this message]
2019-02-11 14:11 ` [PATCH 3/3] libertas_tf: get the MAC address before registering the device Steve deRosier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190210195217.18817-4-lkundrak@v3.sk \
--to=lkundrak@v3.sk \
--cc=davem@davemloft.net \
--cc=kvalo@codeaurora.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).