linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Kilroy <kilroyd@googlemail.com>
To: linux-wireless@vger.kernel.org
Cc: orinoco-devel@lists.sourceforge.net,
	David Kilroy <kilroyd@googlemail.com>
Subject: [PATCH 08/23] orinoco: Move FID allocation to hw.c
Date: Thu, 18 Jun 2009 23:21:20 +0100	[thread overview]
Message-ID: <1245363695-8289-9-git-send-email-kilroyd@googlemail.com> (raw)
In-Reply-To: <1245363695-8289-1-git-send-email-kilroyd@googlemail.com>

This is part of refactorring the initialisation code so that we can
load the firmware before registerring with netdev.

Signed-off-by: David Kilroy <kilroyd@googlemail.com>
---
 drivers/net/wireless/orinoco/hw.c   |   23 +++++++++++++++++++++++
 drivers/net/wireless/orinoco/hw.h   |    1 +
 drivers/net/wireless/orinoco/main.c |   25 ++-----------------------
 3 files changed, 26 insertions(+), 23 deletions(-)

diff --git a/drivers/net/wireless/orinoco/hw.c b/drivers/net/wireless/orinoco/hw.c
index 40dc25c..0f6426d 100644
--- a/drivers/net/wireless/orinoco/hw.c
+++ b/drivers/net/wireless/orinoco/hw.c
@@ -15,6 +15,9 @@
 
 #define SYMBOL_MAX_VER_LEN	(14)
 
+/* Symbol firmware has a bug allocating buffers larger than this */
+#define TX_NICBUF_SIZE_BUG	1585
+
 /********************************************************************/
 /* Data tables                                                      */
 /********************************************************************/
@@ -364,6 +367,26 @@ out:
 	return err;
 }
 
+int orinoco_hw_allocate_fid(struct orinoco_private *priv)
+{
+	struct net_device *dev = priv->ndev;
+	struct hermes *hw = &priv->hw;
+	int err;
+
+	err = hermes_allocate(hw, priv->nicbuf_size, &priv->txfid);
+	if (err == -EIO && priv->nicbuf_size > TX_NICBUF_SIZE_BUG) {
+		/* Try workaround for old Symbol firmware bug */
+		priv->nicbuf_size = TX_NICBUF_SIZE_BUG;
+		err = hermes_allocate(hw, priv->nicbuf_size, &priv->txfid);
+
+		printk(KERN_WARNING "%s: firmware ALLOC bug detected "
+		       "(old Symbol firmware?). Work around %s\n",
+		       dev->name, err ? "failed!" : "ok.");
+	}
+
+	return err;
+}
+
 int orinoco_get_bitratemode(int bitrate, int automatic)
 {
 	int ratemode = -1;
diff --git a/drivers/net/wireless/orinoco/hw.h b/drivers/net/wireless/orinoco/hw.h
index 6186e44..89277de 100644
--- a/drivers/net/wireless/orinoco/hw.h
+++ b/drivers/net/wireless/orinoco/hw.h
@@ -25,6 +25,7 @@ struct dev_addr_list;
 
 int determine_fw_capabilities(struct orinoco_private *priv);
 int orinoco_hw_read_card_settings(struct orinoco_private *priv, u8 *dev_addr);
+int orinoco_hw_allocate_fid(struct orinoco_private *priv);
 int orinoco_get_bitratemode(int bitrate, int automatic);
 void orinoco_get_ratemode_cfg(int ratemode, int *bitrate, int *automatic);
 
diff --git a/drivers/net/wireless/orinoco/main.c b/drivers/net/wireless/orinoco/main.c
index 0fe9420..58a48db 100644
--- a/drivers/net/wireless/orinoco/main.c
+++ b/drivers/net/wireless/orinoco/main.c
@@ -147,7 +147,6 @@ static const u8 encaps_hdr[] = {0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00};
 					    * how many events the
 					    * device could
 					    * legitimately generate */
-#define TX_NICBUF_SIZE_BUG	1585		/* Bug in Symbol firmware */
 
 #define DUMMY_FID		0xFFFF
 
@@ -1574,26 +1573,6 @@ int __orinoco_down(struct net_device *dev)
 }
 EXPORT_SYMBOL(__orinoco_down);
 
-static int orinoco_allocate_fid(struct net_device *dev)
-{
-	struct orinoco_private *priv = netdev_priv(dev);
-	struct hermes *hw = &priv->hw;
-	int err;
-
-	err = hermes_allocate(hw, priv->nicbuf_size, &priv->txfid);
-	if (err == -EIO && priv->nicbuf_size > TX_NICBUF_SIZE_BUG) {
-		/* Try workaround for old Symbol firmware bug */
-		priv->nicbuf_size = TX_NICBUF_SIZE_BUG;
-		err = hermes_allocate(hw, priv->nicbuf_size, &priv->txfid);
-
-		printk(KERN_WARNING "%s: firmware ALLOC bug detected "
-		       "(old Symbol firmware?). Work around %s\n",
-		       dev->name, err ? "failed!" : "ok.");
-	}
-
-	return err;
-}
-
 int orinoco_reinit_firmware(struct net_device *dev)
 {
 	struct orinoco_private *priv = netdev_priv(dev);
@@ -1607,7 +1586,7 @@ int orinoco_reinit_firmware(struct net_device *dev)
 			priv->do_fw_download = 0;
 	}
 	if (!err)
-		err = orinoco_allocate_fid(dev);
+		err = orinoco_hw_allocate_fid(priv);
 
 	return err;
 }
@@ -2167,7 +2146,7 @@ static int orinoco_init(struct net_device *dev)
 	if (err)
 		goto out;
 
-	err = orinoco_allocate_fid(dev);
+	err = orinoco_hw_allocate_fid(priv);
 	if (err) {
 		printk(KERN_ERR "%s: failed to allocate NIC buffer!\n",
 		       dev->name);
-- 
1.6.0.6


  parent reply	other threads:[~2009-06-18 22:22 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-18 22:21 [PATCH 00/23] orinoco: initiate cfg80211 conversion David Kilroy
2009-06-18 22:21 ` [PATCH 01/23] cfg80211: add wrapper function to get wiphy from priv pointer David Kilroy
2009-06-18 22:21 ` [PATCH 02/23] cfg80211: Advertise ciphers via WE according to driver capability David Kilroy
2009-06-18 23:38   ` Julian Calaby
2009-06-19 17:20     ` Dave
2009-06-20  0:38       ` Julian Calaby
2009-06-18 22:21 ` [PATCH 03/23] cfg80211: allow drivers that can't scan for specific ssids David Kilroy
2009-06-18 22:21 ` [PATCH 04/23] cfg80211: set WE encoding size based on available ciphers David Kilroy
2009-06-18 22:21 ` [PATCH 05/23] cfg80211: infer WPA and WPA2 support from TKIP and CCMP David Kilroy
2009-06-18 22:21 ` [PATCH 06/23] orinoco: Move firmware capability determination into hw.c David Kilroy
2009-06-18 22:21 ` [PATCH 07/23] orinoco: Move card reading code " David Kilroy
2009-06-18 22:21 ` David Kilroy [this message]
2009-06-18 22:21 ` [PATCH 09/23] orinoco: use dev_err in early initialisation routines David Kilroy
2009-06-18 22:21 ` [PATCH 10/23] orinoco: firmware helpers should use dev_err and friends David Kilroy
2009-06-18 22:21 ` [PATCH 11/23] orinoco: Replace net_device with orinoco_private in driver interfaces David Kilroy
2009-06-18 22:21 ` [PATCH 12/23] orinoco: initialise independently of netdev David Kilroy
2009-06-18 22:21 ` [PATCH 13/23] orinoco: Change set_tkip to use orinoco_private instead of hermes_t David Kilroy
2009-06-18 22:21 ` [PATCH 14/23] orinoco: initiate cfg80211 conversion David Kilroy
2009-06-18 22:21 ` [PATCH 15/23] orinoco: make firmware download less verbose David Kilroy
2009-06-18 22:21 ` [PATCH 16/23] orinoco: move netdev interface creation to main driver David Kilroy
2009-06-18 22:21 ` [PATCH 17/23] airport: store irq in card private structure David Kilroy
2009-06-18 22:21 ` [PATCH 18/23] orinoco: Handle suspend/restore in core driver David Kilroy
2009-06-18 22:21 ` [PATCH 19/23] orinoco: provide generic commit function David Kilroy
2009-06-18 22:21 ` [PATCH 20/23] orinoco: convert mode setting to cfg80211 David Kilroy
2009-06-18 22:21 ` [PATCH 21/23] orinoco: convert scanning " David Kilroy
2009-06-19 17:35   ` John W. Linville
2009-06-19 17:52     ` Dave
2009-06-19 18:02       ` John W. Linville
2009-06-19 21:25         ` Dave
2009-06-18 22:21 ` [PATCH 22/23] orinoco: convert giwrange " David Kilroy
2009-06-18 22:21 ` [PATCH 23/23] orinoco: remove WE nickname support David Kilroy
2009-06-18 22:52 ` [PATCH 00/23] orinoco: initiate cfg80211 conversion Johannes Berg

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=1245363695-8289-9-git-send-email-kilroyd@googlemail.com \
    --to=kilroyd@googlemail.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=orinoco-devel@lists.sourceforge.net \
    /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).