aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/hostap/hostap_pci.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/hostap/hostap_pci.c')
-rw-r--r--drivers/net/wireless/hostap/hostap_pci.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/drivers/net/wireless/hostap/hostap_pci.c b/drivers/net/wireless/hostap/hostap_pci.c
index 025f8cdb5566..da0c80fb941c 100644
--- a/drivers/net/wireless/hostap/hostap_pci.c
+++ b/drivers/net/wireless/hostap/hostap_pci.c
@@ -59,11 +59,13 @@ static struct pci_device_id prism2_pci_id_table[] __devinitdata = {
59static inline void hfa384x_outb_debug(struct net_device *dev, int a, u8 v) 59static inline void hfa384x_outb_debug(struct net_device *dev, int a, u8 v)
60{ 60{
61 struct hostap_interface *iface; 61 struct hostap_interface *iface;
62 struct hostap_pci_priv *hw_priv;
62 local_info_t *local; 63 local_info_t *local;
63 unsigned long flags; 64 unsigned long flags;
64 65
65 iface = netdev_priv(dev); 66 iface = netdev_priv(dev);
66 local = iface->local; 67 local = iface->local;
68 hw_priv = local->hw_priv;
67 69
68 spin_lock_irqsave(&local->lock, flags); 70 spin_lock_irqsave(&local->lock, flags);
69 prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_OUTB, a, v); 71 prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_OUTB, a, v);
@@ -74,12 +76,14 @@ static inline void hfa384x_outb_debug(struct net_device *dev, int a, u8 v)
74static inline u8 hfa384x_inb_debug(struct net_device *dev, int a) 76static inline u8 hfa384x_inb_debug(struct net_device *dev, int a)
75{ 77{
76 struct hostap_interface *iface; 78 struct hostap_interface *iface;
79 struct hostap_pci_priv *hw_priv;
77 local_info_t *local; 80 local_info_t *local;
78 unsigned long flags; 81 unsigned long flags;
79 u8 v; 82 u8 v;
80 83
81 iface = netdev_priv(dev); 84 iface = netdev_priv(dev);
82 local = iface->local; 85 local = iface->local;
86 hw_priv = local->hw_priv;
83 87
84 spin_lock_irqsave(&local->lock, flags); 88 spin_lock_irqsave(&local->lock, flags);
85 v = readb(hw_priv->mem_start + a); 89 v = readb(hw_priv->mem_start + a);
@@ -91,11 +95,13 @@ static inline u8 hfa384x_inb_debug(struct net_device *dev, int a)
91static inline void hfa384x_outw_debug(struct net_device *dev, int a, u16 v) 95static inline void hfa384x_outw_debug(struct net_device *dev, int a, u16 v)
92{ 96{
93 struct hostap_interface *iface; 97 struct hostap_interface *iface;
98 struct hostap_pci_priv *hw_priv;
94 local_info_t *local; 99 local_info_t *local;
95 unsigned long flags; 100 unsigned long flags;
96 101
97 iface = netdev_priv(dev); 102 iface = netdev_priv(dev);
98 local = iface->local; 103 local = iface->local;
104 hw_priv = local->hw_priv;
99 105
100 spin_lock_irqsave(&local->lock, flags); 106 spin_lock_irqsave(&local->lock, flags);
101 prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_OUTW, a, v); 107 prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_OUTW, a, v);
@@ -106,12 +112,14 @@ static inline void hfa384x_outw_debug(struct net_device *dev, int a, u16 v)
106static inline u16 hfa384x_inw_debug(struct net_device *dev, int a) 112static inline u16 hfa384x_inw_debug(struct net_device *dev, int a)
107{ 113{
108 struct hostap_interface *iface; 114 struct hostap_interface *iface;
115 struct hostap_pci_priv *hw_priv;
109 local_info_t *local; 116 local_info_t *local;
110 unsigned long flags; 117 unsigned long flags;
111 u16 v; 118 u16 v;
112 119
113 iface = netdev_priv(dev); 120 iface = netdev_priv(dev);
114 local = iface->local; 121 local = iface->local;
122 hw_priv = local->hw_priv;
115 123
116 spin_lock_irqsave(&local->lock, flags); 124 spin_lock_irqsave(&local->lock, flags);
117 v = readw(hw_priv->mem_start + a); 125 v = readw(hw_priv->mem_start + a);
@@ -277,8 +285,6 @@ static struct prism2_helper_functions prism2_pci_funcs =
277{ 285{
278 .card_present = NULL, 286 .card_present = NULL,
279 .cor_sreset = prism2_pci_cor_sreset, 287 .cor_sreset = prism2_pci_cor_sreset,
280 .dev_open = NULL,
281 .dev_close = NULL,
282 .genesis_reset = prism2_pci_genesis_reset, 288 .genesis_reset = prism2_pci_genesis_reset,
283 .hw_type = HOSTAP_HW_PCI, 289 .hw_type = HOSTAP_HW_PCI,
284}; 290};
@@ -352,8 +358,6 @@ static int prism2_pci_probe(struct pci_dev *pdev,
352 return hostap_hw_ready(dev); 358 return hostap_hw_ready(dev);
353 359
354 fail: 360 fail:
355 kfree(hw_priv);
356
357 if (irq_registered && dev) 361 if (irq_registered && dev)
358 free_irq(dev->irq, dev); 362 free_irq(dev->irq, dev);
359 363
@@ -364,10 +368,8 @@ static int prism2_pci_probe(struct pci_dev *pdev,
364 368
365 err_out_disable: 369 err_out_disable:
366 pci_disable_device(pdev); 370 pci_disable_device(pdev);
367 kfree(hw_priv);
368 if (local)
369 local->hw_priv = NULL;
370 prism2_free_local_data(dev); 371 prism2_free_local_data(dev);
372 kfree(hw_priv);
371 373
372 return -ENODEV; 374 return -ENODEV;
373} 375}
@@ -392,9 +394,8 @@ static void prism2_pci_remove(struct pci_dev *pdev)
392 free_irq(dev->irq, dev); 394 free_irq(dev->irq, dev);
393 395
394 mem_start = hw_priv->mem_start; 396 mem_start = hw_priv->mem_start;
395 kfree(hw_priv);
396 iface->local->hw_priv = NULL;
397 prism2_free_local_data(dev); 397 prism2_free_local_data(dev);
398 kfree(hw_priv);
398 399
399 iounmap(mem_start); 400 iounmap(mem_start);
400 401
@@ -441,7 +442,7 @@ static int prism2_pci_resume(struct pci_dev *pdev)
441MODULE_DEVICE_TABLE(pci, prism2_pci_id_table); 442MODULE_DEVICE_TABLE(pci, prism2_pci_id_table);
442 443
443static struct pci_driver prism2_pci_drv_id = { 444static struct pci_driver prism2_pci_drv_id = {
444 .name = "prism2_pci", 445 .name = "hostap_pci",
445 .id_table = prism2_pci_id_table, 446 .id_table = prism2_pci_id_table,
446 .probe = prism2_pci_probe, 447 .probe = prism2_pci_probe,
447 .remove = prism2_pci_remove, 448 .remove = prism2_pci_remove,