aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/orinoco
diff options
context:
space:
mode:
authorDavid Kilroy <kilroyd@googlemail.com>2009-06-18 18:21:24 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-07-10 15:01:44 -0400
commit8e638267a896e171e49fb9013f5baf96a4ede754 (patch)
tree6bf1dfb8ef9388037b122478c1c649de5c8a5071 /drivers/net/wireless/orinoco
parenta2608362b22ade22ef5472a8c9b82687d86f976f (diff)
orinoco: initialise independently of netdev
Initialise the orinoco driver before registerring with netdev, which will help when we get to cfg80211... Signed-off-by: David Kilroy <kilroyd@googlemail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/orinoco')
-rw-r--r--drivers/net/wireless/orinoco/airport.c6
-rw-r--r--drivers/net/wireless/orinoco/main.c44
-rw-r--r--drivers/net/wireless/orinoco/orinoco.h1
-rw-r--r--drivers/net/wireless/orinoco/orinoco_cs.c6
-rw-r--r--drivers/net/wireless/orinoco/orinoco_nortel.c6
-rw-r--r--drivers/net/wireless/orinoco/orinoco_pci.c6
-rw-r--r--drivers/net/wireless/orinoco/orinoco_plx.c6
-rw-r--r--drivers/net/wireless/orinoco/orinoco_tmd.c6
-rw-r--r--drivers/net/wireless/orinoco/spectrum_cs.c6
9 files changed, 63 insertions, 24 deletions
diff --git a/drivers/net/wireless/orinoco/airport.c b/drivers/net/wireless/orinoco/airport.c
index 6559aee09e3b..9f90337344f1 100644
--- a/drivers/net/wireless/orinoco/airport.c
+++ b/drivers/net/wireless/orinoco/airport.c
@@ -234,6 +234,12 @@ airport_attach(struct macio_dev *mdev, const struct of_device_id *match)
234 } 234 }
235 card->irq_requested = 1; 235 card->irq_requested = 1;
236 236
237 /* Initialise the main driver */
238 if (orinoco_init(priv) != 0) {
239 printk(KERN_ERR PFX "orinoco_init() failed\n");
240 goto failed;
241 }
242
237 /* Tell the stack we exist */ 243 /* Tell the stack we exist */
238 if (register_netdev(dev) != 0) { 244 if (register_netdev(dev) != 0) {
239 printk(KERN_ERR PFX "register_netdev() failed\n"); 245 printk(KERN_ERR PFX "register_netdev() failed\n");
diff --git a/drivers/net/wireless/orinoco/main.c b/drivers/net/wireless/orinoco/main.c
index 4fa8264a400f..ff869a25024d 100644
--- a/drivers/net/wireless/orinoco/main.c
+++ b/drivers/net/wireless/orinoco/main.c
@@ -80,6 +80,7 @@
80#include <linux/kernel.h> 80#include <linux/kernel.h>
81#include <linux/init.h> 81#include <linux/init.h>
82#include <linux/delay.h> 82#include <linux/delay.h>
83#include <linux/device.h>
83#include <linux/netdevice.h> 84#include <linux/netdevice.h>
84#include <linux/etherdevice.h> 85#include <linux/etherdevice.h>
85#include <linux/ethtool.h> 86#include <linux/ethtool.h>
@@ -2073,9 +2074,9 @@ static void orinoco_unregister_pm_notifier(struct orinoco_private *priv)
2073/* Initialization */ 2074/* Initialization */
2074/********************************************************************/ 2075/********************************************************************/
2075 2076
2076static int orinoco_init(struct net_device *dev) 2077int orinoco_init(struct orinoco_private *priv)
2077{ 2078{
2078 struct orinoco_private *priv = netdev_priv(dev); 2079 struct device *dev = priv->dev;
2079 hermes_t *hw = &priv->hw; 2080 hermes_t *hw = &priv->hw;
2080 int err = 0; 2081 int err = 0;
2081 2082
@@ -2086,15 +2087,14 @@ static int orinoco_init(struct net_device *dev)
2086 /* Initialize the firmware */ 2087 /* Initialize the firmware */
2087 err = hermes_init(hw); 2088 err = hermes_init(hw);
2088 if (err != 0) { 2089 if (err != 0) {
2089 printk(KERN_ERR "%s: failed to initialize firmware (err = %d)\n", 2090 dev_err(dev, "Failed to initialize firmware (err = %d)\n",
2090 dev->name, err); 2091 err);
2091 goto out; 2092 goto out;
2092 } 2093 }
2093 2094
2094 err = determine_fw_capabilities(priv); 2095 err = determine_fw_capabilities(priv);
2095 if (err != 0) { 2096 if (err != 0) {
2096 printk(KERN_ERR "%s: Incompatible firmware, aborting\n", 2097 dev_err(dev, "Incompatible firmware, aborting\n");
2097 dev->name);
2098 goto out; 2098 goto out;
2099 } 2099 }
2100 2100
@@ -2110,27 +2110,23 @@ static int orinoco_init(struct net_device *dev)
2110 /* Check firmware version again */ 2110 /* Check firmware version again */
2111 err = determine_fw_capabilities(priv); 2111 err = determine_fw_capabilities(priv);
2112 if (err != 0) { 2112 if (err != 0) {
2113 printk(KERN_ERR "%s: Incompatible firmware, aborting\n", 2113 dev_err(dev, "Incompatible firmware, aborting\n");
2114 dev->name);
2115 goto out; 2114 goto out;
2116 } 2115 }
2117 } 2116 }
2118 2117
2119 if (priv->has_port3) 2118 if (priv->has_port3)
2120 printk(KERN_DEBUG "%s: Ad-hoc demo mode supported\n", 2119 dev_info(dev, "Ad-hoc demo mode supported\n");
2121 dev->name);
2122 if (priv->has_ibss) 2120 if (priv->has_ibss)
2123 printk(KERN_DEBUG "%s: IEEE standard IBSS ad-hoc mode supported\n", 2121 dev_info(dev, "IEEE standard IBSS ad-hoc mode supported\n");
2124 dev->name); 2122 if (priv->has_wep)
2125 if (priv->has_wep) { 2123 dev_info(dev, "WEP supported, %s-bit key\n",
2126 printk(KERN_DEBUG "%s: WEP supported, %s-bit key\n", dev->name, 2124 priv->has_big_wep ? "104" : "40");
2127 priv->has_big_wep ? "104" : "40");
2128 }
2129 if (priv->has_wpa) { 2125 if (priv->has_wpa) {
2130 printk(KERN_DEBUG "%s: WPA-PSK supported\n", dev->name); 2126 dev_info(dev, "WPA-PSK supported\n");
2131 if (orinoco_mic_init(priv)) { 2127 if (orinoco_mic_init(priv)) {
2132 printk(KERN_ERR "%s: Failed to setup MIC crypto " 2128 dev_err(dev, "Failed to setup MIC crypto algorithm. "
2133 "algorithm. Disabling WPA support\n", dev->name); 2129 "Disabling WPA support\n");
2134 priv->has_wpa = 0; 2130 priv->has_wpa = 0;
2135 } 2131 }
2136 } 2132 }
@@ -2141,14 +2137,14 @@ static int orinoco_init(struct net_device *dev)
2141 goto out; 2137 goto out;
2142 orinoco_bss_data_init(priv); 2138 orinoco_bss_data_init(priv);
2143 2139
2144 err = orinoco_hw_read_card_settings(priv, dev->dev_addr); 2140 /* Netdev has not initialised, but we have allocated the buffer. */
2141 err = orinoco_hw_read_card_settings(priv, priv->ndev->dev_addr);
2145 if (err) 2142 if (err)
2146 goto out; 2143 goto out;
2147 2144
2148 err = orinoco_hw_allocate_fid(priv); 2145 err = orinoco_hw_allocate_fid(priv);
2149 if (err) { 2146 if (err) {
2150 printk(KERN_ERR "%s: failed to allocate NIC buffer!\n", 2147 dev_err(dev, "Failed to allocate NIC buffer!\n");
2151 dev->name);
2152 goto out; 2148 goto out;
2153 } 2149 }
2154 2150
@@ -2174,14 +2170,14 @@ static int orinoco_init(struct net_device *dev)
2174 priv->hw_unavailable--; 2170 priv->hw_unavailable--;
2175 spin_unlock_irq(&priv->lock); 2171 spin_unlock_irq(&priv->lock);
2176 2172
2177 printk(KERN_DEBUG "%s: ready\n", dev->name); 2173 dev_dbg(dev, "Ready\n");
2178 2174
2179 out: 2175 out:
2180 return err; 2176 return err;
2181} 2177}
2178EXPORT_SYMBOL(orinoco_init);
2182 2179
2183static const struct net_device_ops orinoco_netdev_ops = { 2180static const struct net_device_ops orinoco_netdev_ops = {
2184 .ndo_init = orinoco_init,
2185 .ndo_open = orinoco_open, 2181 .ndo_open = orinoco_open,
2186 .ndo_stop = orinoco_stop, 2182 .ndo_stop = orinoco_stop,
2187 .ndo_start_xmit = orinoco_xmit, 2183 .ndo_start_xmit = orinoco_xmit,
diff --git a/drivers/net/wireless/orinoco/orinoco.h b/drivers/net/wireless/orinoco/orinoco.h
index b93e86cf0049..2e9d33fc6b18 100644
--- a/drivers/net/wireless/orinoco/orinoco.h
+++ b/drivers/net/wireless/orinoco/orinoco.h
@@ -187,6 +187,7 @@ extern struct orinoco_private *alloc_orinocodev(
187 int (*hard_reset)(struct orinoco_private *), 187 int (*hard_reset)(struct orinoco_private *),
188 int (*stop_fw)(struct orinoco_private *, int)); 188 int (*stop_fw)(struct orinoco_private *, int));
189extern void free_orinocodev(struct orinoco_private *priv); 189extern void free_orinocodev(struct orinoco_private *priv);
190extern int orinoco_init(struct orinoco_private *priv);
190extern int __orinoco_up(struct orinoco_private *priv); 191extern int __orinoco_up(struct orinoco_private *priv);
191extern int __orinoco_down(struct orinoco_private *priv); 192extern int __orinoco_down(struct orinoco_private *priv);
192extern int orinoco_reinit_firmware(struct orinoco_private *priv); 193extern int orinoco_reinit_firmware(struct orinoco_private *priv);
diff --git a/drivers/net/wireless/orinoco/orinoco_cs.c b/drivers/net/wireless/orinoco/orinoco_cs.c
index fa8fe5be58c9..20abf021c065 100644
--- a/drivers/net/wireless/orinoco/orinoco_cs.c
+++ b/drivers/net/wireless/orinoco/orinoco_cs.c
@@ -297,6 +297,12 @@ orinoco_cs_config(struct pcmcia_device *link)
297 dev->irq = link->irq.AssignedIRQ; 297 dev->irq = link->irq.AssignedIRQ;
298 card->node.major = card->node.minor = 0; 298 card->node.major = card->node.minor = 0;
299 299
300 /* Initialise the main driver */
301 if (orinoco_init(priv) != 0) {
302 printk(KERN_ERR PFX "orinoco_init() failed\n");
303 goto failed;
304 }
305
300 SET_NETDEV_DEV(dev, &handle_to_dev(link)); 306 SET_NETDEV_DEV(dev, &handle_to_dev(link));
301 /* Tell the stack we exist */ 307 /* Tell the stack we exist */
302 if (register_netdev(dev) != 0) { 308 if (register_netdev(dev) != 0) {
diff --git a/drivers/net/wireless/orinoco/orinoco_nortel.c b/drivers/net/wireless/orinoco/orinoco_nortel.c
index 4efd5a0d33bd..45cef818b292 100644
--- a/drivers/net/wireless/orinoco/orinoco_nortel.c
+++ b/drivers/net/wireless/orinoco/orinoco_nortel.c
@@ -217,6 +217,12 @@ static int orinoco_nortel_init_one(struct pci_dev *pdev,
217 goto fail; 217 goto fail;
218 } 218 }
219 219
220 err = orinoco_init(priv);
221 if (err) {
222 printk(KERN_ERR PFX "orinoco_init() failed\n");
223 goto fail;
224 }
225
220 err = register_netdev(dev); 226 err = register_netdev(dev);
221 if (err) { 227 if (err) {
222 printk(KERN_ERR PFX "Cannot register network device\n"); 228 printk(KERN_ERR PFX "Cannot register network device\n");
diff --git a/drivers/net/wireless/orinoco/orinoco_pci.c b/drivers/net/wireless/orinoco/orinoco_pci.c
index 12b9c6a1bbec..d0eb4ae9bd12 100644
--- a/drivers/net/wireless/orinoco/orinoco_pci.c
+++ b/drivers/net/wireless/orinoco/orinoco_pci.c
@@ -167,6 +167,12 @@ static int orinoco_pci_init_one(struct pci_dev *pdev,
167 goto fail; 167 goto fail;
168 } 168 }
169 169
170 err = orinoco_init(priv);
171 if (err) {
172 printk(KERN_ERR PFX "orinoco_init() failed\n");
173 goto fail;
174 }
175
170 err = register_netdev(dev); 176 err = register_netdev(dev);
171 if (err) { 177 if (err) {
172 printk(KERN_ERR PFX "Cannot register network device\n"); 178 printk(KERN_ERR PFX "Cannot register network device\n");
diff --git a/drivers/net/wireless/orinoco/orinoco_plx.c b/drivers/net/wireless/orinoco/orinoco_plx.c
index 77d5668a9e43..8f225d064a7b 100644
--- a/drivers/net/wireless/orinoco/orinoco_plx.c
+++ b/drivers/net/wireless/orinoco/orinoco_plx.c
@@ -256,6 +256,12 @@ static int orinoco_plx_init_one(struct pci_dev *pdev,
256 goto fail; 256 goto fail;
257 } 257 }
258 258
259 err = orinoco_init(priv);
260 if (err) {
261 printk(KERN_ERR PFX "orinoco_init() failed\n");
262 goto fail;
263 }
264
259 err = register_netdev(dev); 265 err = register_netdev(dev);
260 if (err) { 266 if (err) {
261 printk(KERN_ERR PFX "Cannot register network device\n"); 267 printk(KERN_ERR PFX "Cannot register network device\n");
diff --git a/drivers/net/wireless/orinoco/orinoco_tmd.c b/drivers/net/wireless/orinoco/orinoco_tmd.c
index 5f24c0332de9..3c04faee7ae6 100644
--- a/drivers/net/wireless/orinoco/orinoco_tmd.c
+++ b/drivers/net/wireless/orinoco/orinoco_tmd.c
@@ -153,6 +153,12 @@ static int orinoco_tmd_init_one(struct pci_dev *pdev,
153 goto fail; 153 goto fail;
154 } 154 }
155 155
156 err = orinoco_init(priv);
157 if (err) {
158 printk(KERN_ERR PFX "orinoco_init() failed\n");
159 goto fail;
160 }
161
156 err = register_netdev(dev); 162 err = register_netdev(dev);
157 if (err) { 163 if (err) {
158 printk(KERN_ERR PFX "Cannot register network device\n"); 164 printk(KERN_ERR PFX "Cannot register network device\n");
diff --git a/drivers/net/wireless/orinoco/spectrum_cs.c b/drivers/net/wireless/orinoco/spectrum_cs.c
index ce909e40329a..43e1aed4e4b2 100644
--- a/drivers/net/wireless/orinoco/spectrum_cs.c
+++ b/drivers/net/wireless/orinoco/spectrum_cs.c
@@ -368,6 +368,12 @@ spectrum_cs_config(struct pcmcia_device *link)
368 if (spectrum_cs_hard_reset(priv) != 0) 368 if (spectrum_cs_hard_reset(priv) != 0)
369 goto failed; 369 goto failed;
370 370
371 /* Initialise the main driver */
372 if (orinoco_init(priv) != 0) {
373 printk(KERN_ERR PFX "orinoco_init() failed\n");
374 goto failed;
375 }
376
371 SET_NETDEV_DEV(dev, &handle_to_dev(link)); 377 SET_NETDEV_DEV(dev, &handle_to_dev(link));
372 /* Tell the stack we exist */ 378 /* Tell the stack we exist */
373 if (register_netdev(dev) != 0) { 379 if (register_netdev(dev) != 0) {