diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-11-10 17:23:56 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-11-10 17:23:56 -0500 |
commit | 1da63a2131b0185f64a4c623a0e0b030479185fe (patch) | |
tree | e859fc05e2904400bf8b0b23f419532c874e43a9 /drivers/net/wireless/b43 | |
parent | 3902beb48d369d5e19f66acc2f857865ddc9b3bf (diff) | |
parent | a6baf3af89a266a3d745117de570788b956396e7 (diff) |
Merge branch 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6
* 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6: (40 commits)
r8169: prevent bit sign expansion error in mdio_write
r8169: revert 7da97ec96a0934319c7fbedd3d38baf533e20640 (bis repetita)
sky2: new pci id's
ax88796: add superh to kconfig dependencies
qla3xxx: bugfix: Fix bad logical operation in link state machine.
qla3xxx: bugfix: Move link state machine into a worker thread
pasemi_mac: Fix CRC checks
pasemi_mac: Don't set replace-source-address descriptor bits
bonding: don't validate address at device open
bonding: fix rtnl locking merge error
sky2: netpoll on port 0 only
b43: Fix kconfig dependencies for rfkill and leds
b43legacy: Fix sparse warning
b43: properly request pcmcia IRQ
b43legacy: fix shared IRQ race condition
b43: fix shared IRQ race condition
b43legacy: add me as maintainer and fix URLs
b43legacy: fix possible buffer overrun in debugfs
b43: Rewrite and fix rfkill init
b43: debugfs SHM read buffer overrun fix
...
Diffstat (limited to 'drivers/net/wireless/b43')
-rw-r--r-- | drivers/net/wireless/b43/Kconfig | 10 | ||||
-rw-r--r-- | drivers/net/wireless/b43/debugfs.c | 2 | ||||
-rw-r--r-- | drivers/net/wireless/b43/main.c | 19 | ||||
-rw-r--r-- | drivers/net/wireless/b43/pcmcia.c | 52 | ||||
-rw-r--r-- | drivers/net/wireless/b43/rfkill.c | 115 | ||||
-rw-r--r-- | drivers/net/wireless/b43/rfkill.h | 14 |
6 files changed, 106 insertions, 106 deletions
diff --git a/drivers/net/wireless/b43/Kconfig b/drivers/net/wireless/b43/Kconfig index e3c573e56b63..fdbc351ac333 100644 --- a/drivers/net/wireless/b43/Kconfig +++ b/drivers/net/wireless/b43/Kconfig | |||
@@ -61,16 +61,18 @@ config B43_PCMCIA | |||
61 | 61 | ||
62 | If unsure, say N. | 62 | If unsure, say N. |
63 | 63 | ||
64 | # LED support | 64 | # This config option automatically enables b43 LEDS support, |
65 | # if it's possible. | ||
65 | config B43_LEDS | 66 | config B43_LEDS |
66 | bool | 67 | bool |
67 | depends on B43 && MAC80211_LEDS | 68 | depends on B43 && MAC80211_LEDS && (LEDS_CLASS = y || LEDS_CLASS = B43) |
68 | default y | 69 | default y |
69 | 70 | ||
70 | # RFKILL support | 71 | # This config option automatically enables b43 RFKILL support, |
72 | # if it's possible. | ||
71 | config B43_RFKILL | 73 | config B43_RFKILL |
72 | bool | 74 | bool |
73 | depends on B43 && RFKILL && RFKILL_INPUT && INPUT_POLLDEV | 75 | depends on B43 && (RFKILL = y || RFKILL = B43) && RFKILL_INPUT && (INPUT_POLLDEV = y || INPUT_POLLDEV = B43) |
74 | default y | 76 | default y |
75 | 77 | ||
76 | config B43_DEBUG | 78 | config B43_DEBUG |
diff --git a/drivers/net/wireless/b43/debugfs.c b/drivers/net/wireless/b43/debugfs.c index 734e70e1a06d..ef0075d9f9cb 100644 --- a/drivers/net/wireless/b43/debugfs.c +++ b/drivers/net/wireless/b43/debugfs.c | |||
@@ -128,7 +128,7 @@ static ssize_t shm_read_file(struct b43_wldev *dev, | |||
128 | __le16 *le16buf = (__le16 *)buf; | 128 | __le16 *le16buf = (__le16 *)buf; |
129 | 129 | ||
130 | for (i = 0; i < 0x1000; i++) { | 130 | for (i = 0; i < 0x1000; i++) { |
131 | if (bufsize <= 0) | 131 | if (bufsize < sizeof(tmp)) |
132 | break; | 132 | break; |
133 | tmp = b43_shm_read16(dev, B43_SHM_SHARED, 2 * i); | 133 | tmp = b43_shm_read16(dev, B43_SHM_SHARED, 2 * i); |
134 | le16buf[i] = cpu_to_le16(tmp); | 134 | le16buf[i] = cpu_to_le16(tmp); |
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c index 5058e60e5703..2b17c1dc46f1 100644 --- a/drivers/net/wireless/b43/main.c +++ b/drivers/net/wireless/b43/main.c | |||
@@ -2985,6 +2985,16 @@ static void b43_wireless_core_stop(struct b43_wldev *dev) | |||
2985 | 2985 | ||
2986 | if (b43_status(dev) < B43_STAT_STARTED) | 2986 | if (b43_status(dev) < B43_STAT_STARTED) |
2987 | return; | 2987 | return; |
2988 | |||
2989 | /* Disable and sync interrupts. We must do this before than | ||
2990 | * setting the status to INITIALIZED, as the interrupt handler | ||
2991 | * won't care about IRQs then. */ | ||
2992 | spin_lock_irqsave(&wl->irq_lock, flags); | ||
2993 | dev->irq_savedstate = b43_interrupt_disable(dev, B43_IRQ_ALL); | ||
2994 | b43_read32(dev, B43_MMIO_GEN_IRQ_MASK); /* flush */ | ||
2995 | spin_unlock_irqrestore(&wl->irq_lock, flags); | ||
2996 | b43_synchronize_irq(dev); | ||
2997 | |||
2988 | b43_set_status(dev, B43_STAT_INITIALIZED); | 2998 | b43_set_status(dev, B43_STAT_INITIALIZED); |
2989 | 2999 | ||
2990 | mutex_unlock(&wl->mutex); | 3000 | mutex_unlock(&wl->mutex); |
@@ -2995,13 +3005,6 @@ static void b43_wireless_core_stop(struct b43_wldev *dev) | |||
2995 | 3005 | ||
2996 | ieee80211_stop_queues(wl->hw); //FIXME this could cause a deadlock, as mac80211 seems buggy. | 3006 | ieee80211_stop_queues(wl->hw); //FIXME this could cause a deadlock, as mac80211 seems buggy. |
2997 | 3007 | ||
2998 | /* Disable and sync interrupts. */ | ||
2999 | spin_lock_irqsave(&wl->irq_lock, flags); | ||
3000 | dev->irq_savedstate = b43_interrupt_disable(dev, B43_IRQ_ALL); | ||
3001 | b43_read32(dev, B43_MMIO_GEN_IRQ_MASK); /* flush */ | ||
3002 | spin_unlock_irqrestore(&wl->irq_lock, flags); | ||
3003 | b43_synchronize_irq(dev); | ||
3004 | |||
3005 | b43_mac_suspend(dev); | 3008 | b43_mac_suspend(dev); |
3006 | free_irq(dev->dev->irq, dev); | 3009 | free_irq(dev->dev->irq, dev); |
3007 | b43dbg(wl, "Wireless interface stopped\n"); | 3010 | b43dbg(wl, "Wireless interface stopped\n"); |
@@ -3661,7 +3664,6 @@ static int b43_setup_modes(struct b43_wldev *dev, | |||
3661 | 3664 | ||
3662 | static void b43_wireless_core_detach(struct b43_wldev *dev) | 3665 | static void b43_wireless_core_detach(struct b43_wldev *dev) |
3663 | { | 3666 | { |
3664 | b43_rfkill_free(dev); | ||
3665 | /* We release firmware that late to not be required to re-request | 3667 | /* We release firmware that late to not be required to re-request |
3666 | * is all the time when we reinit the core. */ | 3668 | * is all the time when we reinit the core. */ |
3667 | b43_release_firmware(dev); | 3669 | b43_release_firmware(dev); |
@@ -3747,7 +3749,6 @@ static int b43_wireless_core_attach(struct b43_wldev *dev) | |||
3747 | if (!wl->current_dev) | 3749 | if (!wl->current_dev) |
3748 | wl->current_dev = dev; | 3750 | wl->current_dev = dev; |
3749 | INIT_WORK(&dev->restart_work, b43_chip_reset); | 3751 | INIT_WORK(&dev->restart_work, b43_chip_reset); |
3750 | b43_rfkill_alloc(dev); | ||
3751 | 3752 | ||
3752 | b43_radio_turn_off(dev, 1); | 3753 | b43_radio_turn_off(dev, 1); |
3753 | b43_switch_analog(dev, 0); | 3754 | b43_switch_analog(dev, 0); |
diff --git a/drivers/net/wireless/b43/pcmcia.c b/drivers/net/wireless/b43/pcmcia.c index b242a9a90dd2..b79a6bd5396d 100644 --- a/drivers/net/wireless/b43/pcmcia.c +++ b/drivers/net/wireless/b43/pcmcia.c | |||
@@ -65,12 +65,12 @@ static int __devinit b43_pcmcia_probe(struct pcmcia_device *dev) | |||
65 | tuple_t tuple; | 65 | tuple_t tuple; |
66 | cisparse_t parse; | 66 | cisparse_t parse; |
67 | int err = -ENOMEM; | 67 | int err = -ENOMEM; |
68 | int res; | 68 | int res = 0; |
69 | unsigned char buf[64]; | 69 | unsigned char buf[64]; |
70 | 70 | ||
71 | ssb = kzalloc(sizeof(*ssb), GFP_KERNEL); | 71 | ssb = kzalloc(sizeof(*ssb), GFP_KERNEL); |
72 | if (!ssb) | 72 | if (!ssb) |
73 | goto out; | 73 | goto out_error; |
74 | 74 | ||
75 | err = -ENODEV; | 75 | err = -ENODEV; |
76 | tuple.DesiredTuple = CISTPL_CONFIG; | 76 | tuple.DesiredTuple = CISTPL_CONFIG; |
@@ -96,10 +96,12 @@ static int __devinit b43_pcmcia_probe(struct pcmcia_device *dev) | |||
96 | dev->io.NumPorts2 = 0; | 96 | dev->io.NumPorts2 = 0; |
97 | dev->io.Attributes2 = 0; | 97 | dev->io.Attributes2 = 0; |
98 | 98 | ||
99 | win.Attributes = WIN_MEMORY_TYPE_CM | WIN_ENABLE | WIN_USE_WAIT; | 99 | win.Attributes = WIN_ADDR_SPACE_MEM | WIN_MEMORY_TYPE_CM | |
100 | WIN_ENABLE | WIN_DATA_WIDTH_16 | | ||
101 | WIN_USE_WAIT; | ||
100 | win.Base = 0; | 102 | win.Base = 0; |
101 | win.Size = SSB_CORE_SIZE; | 103 | win.Size = SSB_CORE_SIZE; |
102 | win.AccessSpeed = 1000; | 104 | win.AccessSpeed = 250; |
103 | res = pcmcia_request_window(&dev, &win, &dev->win); | 105 | res = pcmcia_request_window(&dev, &win, &dev->win); |
104 | if (res != CS_SUCCESS) | 106 | if (res != CS_SUCCESS) |
105 | goto err_kfree_ssb; | 107 | goto err_kfree_ssb; |
@@ -108,21 +110,34 @@ static int __devinit b43_pcmcia_probe(struct pcmcia_device *dev) | |||
108 | mem.Page = 0; | 110 | mem.Page = 0; |
109 | res = pcmcia_map_mem_page(dev->win, &mem); | 111 | res = pcmcia_map_mem_page(dev->win, &mem); |
110 | if (res != CS_SUCCESS) | 112 | if (res != CS_SUCCESS) |
111 | goto err_kfree_ssb; | 113 | goto err_disable; |
114 | |||
115 | dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING | IRQ_FIRST_SHARED; | ||
116 | dev->irq.IRQInfo1 = IRQ_LEVEL_ID | IRQ_SHARE_ID; | ||
117 | dev->irq.Handler = NULL; /* The handler is registered later. */ | ||
118 | dev->irq.Instance = NULL; | ||
119 | res = pcmcia_request_irq(dev, &dev->irq); | ||
120 | if (res != CS_SUCCESS) | ||
121 | goto err_disable; | ||
112 | 122 | ||
113 | res = pcmcia_request_configuration(dev, &dev->conf); | 123 | res = pcmcia_request_configuration(dev, &dev->conf); |
114 | if (res != CS_SUCCESS) | 124 | if (res != CS_SUCCESS) |
115 | goto err_disable; | 125 | goto err_disable; |
116 | 126 | ||
117 | err = ssb_bus_pcmciabus_register(ssb, dev, win.Base); | 127 | err = ssb_bus_pcmciabus_register(ssb, dev, win.Base); |
128 | if (err) | ||
129 | goto err_disable; | ||
118 | dev->priv = ssb; | 130 | dev->priv = ssb; |
119 | 131 | ||
120 | out: | 132 | return 0; |
121 | return err; | 133 | |
122 | err_disable: | 134 | err_disable: |
123 | pcmcia_disable_device(dev); | 135 | pcmcia_disable_device(dev); |
124 | err_kfree_ssb: | 136 | err_kfree_ssb: |
125 | kfree(ssb); | 137 | kfree(ssb); |
138 | out_error: | ||
139 | printk(KERN_ERR "b43-pcmcia: Initialization failed (%d, %d)\n", | ||
140 | res, err); | ||
126 | return err; | 141 | return err; |
127 | } | 142 | } |
128 | 143 | ||
@@ -131,22 +146,21 @@ static void __devexit b43_pcmcia_remove(struct pcmcia_device *dev) | |||
131 | struct ssb_bus *ssb = dev->priv; | 146 | struct ssb_bus *ssb = dev->priv; |
132 | 147 | ||
133 | ssb_bus_unregister(ssb); | 148 | ssb_bus_unregister(ssb); |
134 | pcmcia_release_window(dev->win); | ||
135 | pcmcia_disable_device(dev); | 149 | pcmcia_disable_device(dev); |
136 | kfree(ssb); | 150 | kfree(ssb); |
137 | dev->priv = NULL; | 151 | dev->priv = NULL; |
138 | } | 152 | } |
139 | 153 | ||
140 | static struct pcmcia_driver b43_pcmcia_driver = { | 154 | static struct pcmcia_driver b43_pcmcia_driver = { |
141 | .owner = THIS_MODULE, | 155 | .owner = THIS_MODULE, |
142 | .drv = { | 156 | .drv = { |
143 | .name = "b43-pcmcia", | 157 | .name = "b43-pcmcia", |
144 | }, | 158 | }, |
145 | .id_table = b43_pcmcia_tbl, | 159 | .id_table = b43_pcmcia_tbl, |
146 | .probe = b43_pcmcia_probe, | 160 | .probe = b43_pcmcia_probe, |
147 | .remove = b43_pcmcia_remove, | 161 | .remove = __devexit_p(b43_pcmcia_remove), |
148 | .suspend = b43_pcmcia_suspend, | 162 | .suspend = b43_pcmcia_suspend, |
149 | .resume = b43_pcmcia_resume, | 163 | .resume = b43_pcmcia_resume, |
150 | }; | 164 | }; |
151 | 165 | ||
152 | int b43_pcmcia_init(void) | 166 | int b43_pcmcia_init(void) |
diff --git a/drivers/net/wireless/b43/rfkill.c b/drivers/net/wireless/b43/rfkill.c index 800e0a61a7f5..9b1f905ffbf4 100644 --- a/drivers/net/wireless/b43/rfkill.c +++ b/drivers/net/wireless/b43/rfkill.c | |||
@@ -47,32 +47,35 @@ static void b43_rfkill_poll(struct input_polled_dev *poll_dev) | |||
47 | struct b43_wldev *dev = poll_dev->private; | 47 | struct b43_wldev *dev = poll_dev->private; |
48 | struct b43_wl *wl = dev->wl; | 48 | struct b43_wl *wl = dev->wl; |
49 | bool enabled; | 49 | bool enabled; |
50 | bool report_change = 0; | ||
50 | 51 | ||
51 | mutex_lock(&wl->mutex); | 52 | mutex_lock(&wl->mutex); |
52 | B43_WARN_ON(b43_status(dev) < B43_STAT_INITIALIZED); | 53 | B43_WARN_ON(b43_status(dev) < B43_STAT_INITIALIZED); |
53 | enabled = b43_is_hw_radio_enabled(dev); | 54 | enabled = b43_is_hw_radio_enabled(dev); |
54 | if (unlikely(enabled != dev->radio_hw_enable)) { | 55 | if (unlikely(enabled != dev->radio_hw_enable)) { |
55 | dev->radio_hw_enable = enabled; | 56 | dev->radio_hw_enable = enabled; |
57 | report_change = 1; | ||
56 | b43info(wl, "Radio hardware status changed to %s\n", | 58 | b43info(wl, "Radio hardware status changed to %s\n", |
57 | enabled ? "ENABLED" : "DISABLED"); | 59 | enabled ? "ENABLED" : "DISABLED"); |
58 | mutex_unlock(&wl->mutex); | 60 | } |
61 | mutex_unlock(&wl->mutex); | ||
62 | |||
63 | if (unlikely(report_change)) | ||
59 | input_report_key(poll_dev->input, KEY_WLAN, enabled); | 64 | input_report_key(poll_dev->input, KEY_WLAN, enabled); |
60 | } else | ||
61 | mutex_unlock(&wl->mutex); | ||
62 | } | 65 | } |
63 | 66 | ||
64 | /* Called when the RFKILL toggled in software. | 67 | /* Called when the RFKILL toggled in software. */ |
65 | * This is called without locking. */ | ||
66 | static int b43_rfkill_soft_toggle(void *data, enum rfkill_state state) | 68 | static int b43_rfkill_soft_toggle(void *data, enum rfkill_state state) |
67 | { | 69 | { |
68 | struct b43_wldev *dev = data; | 70 | struct b43_wldev *dev = data; |
69 | struct b43_wl *wl = dev->wl; | 71 | struct b43_wl *wl = dev->wl; |
70 | int err = 0; | 72 | int err = 0; |
71 | 73 | ||
72 | mutex_lock(&wl->mutex); | 74 | if (!wl->rfkill.registered) |
73 | if (b43_status(dev) < B43_STAT_INITIALIZED) | 75 | return 0; |
74 | goto out_unlock; | ||
75 | 76 | ||
77 | mutex_lock(&wl->mutex); | ||
78 | B43_WARN_ON(b43_status(dev) < B43_STAT_INITIALIZED); | ||
76 | switch (state) { | 79 | switch (state) { |
77 | case RFKILL_STATE_ON: | 80 | case RFKILL_STATE_ON: |
78 | if (!dev->radio_hw_enable) { | 81 | if (!dev->radio_hw_enable) { |
@@ -89,7 +92,6 @@ static int b43_rfkill_soft_toggle(void *data, enum rfkill_state state) | |||
89 | b43_radio_turn_off(dev, 0); | 92 | b43_radio_turn_off(dev, 0); |
90 | break; | 93 | break; |
91 | } | 94 | } |
92 | |||
93 | out_unlock: | 95 | out_unlock: |
94 | mutex_unlock(&wl->mutex); | 96 | mutex_unlock(&wl->mutex); |
95 | 97 | ||
@@ -98,11 +100,11 @@ out_unlock: | |||
98 | 100 | ||
99 | char * b43_rfkill_led_name(struct b43_wldev *dev) | 101 | char * b43_rfkill_led_name(struct b43_wldev *dev) |
100 | { | 102 | { |
101 | struct b43_wl *wl = dev->wl; | 103 | struct b43_rfkill *rfk = &(dev->wl->rfkill); |
102 | 104 | ||
103 | if (!wl->rfkill.rfkill) | 105 | if (!rfk->registered) |
104 | return NULL; | 106 | return NULL; |
105 | return rfkill_get_led_name(wl->rfkill.rfkill); | 107 | return rfkill_get_led_name(rfk->rfkill); |
106 | } | 108 | } |
107 | 109 | ||
108 | void b43_rfkill_init(struct b43_wldev *dev) | 110 | void b43_rfkill_init(struct b43_wldev *dev) |
@@ -111,53 +113,13 @@ void b43_rfkill_init(struct b43_wldev *dev) | |||
111 | struct b43_rfkill *rfk = &(wl->rfkill); | 113 | struct b43_rfkill *rfk = &(wl->rfkill); |
112 | int err; | 114 | int err; |
113 | 115 | ||
114 | if (rfk->rfkill) { | 116 | rfk->registered = 0; |
115 | err = rfkill_register(rfk->rfkill); | ||
116 | if (err) { | ||
117 | b43warn(wl, "Failed to register RF-kill button\n"); | ||
118 | goto err_free_rfk; | ||
119 | } | ||
120 | } | ||
121 | if (rfk->poll_dev) { | ||
122 | err = input_register_polled_device(rfk->poll_dev); | ||
123 | if (err) { | ||
124 | b43warn(wl, "Failed to register RF-kill polldev\n"); | ||
125 | goto err_free_polldev; | ||
126 | } | ||
127 | } | ||
128 | |||
129 | return; | ||
130 | err_free_rfk: | ||
131 | rfkill_free(rfk->rfkill); | ||
132 | rfk->rfkill = NULL; | ||
133 | err_free_polldev: | ||
134 | input_free_polled_device(rfk->poll_dev); | ||
135 | rfk->poll_dev = NULL; | ||
136 | } | ||
137 | |||
138 | void b43_rfkill_exit(struct b43_wldev *dev) | ||
139 | { | ||
140 | struct b43_rfkill *rfk = &(dev->wl->rfkill); | ||
141 | |||
142 | if (rfk->poll_dev) | ||
143 | input_unregister_polled_device(rfk->poll_dev); | ||
144 | if (rfk->rfkill) | ||
145 | rfkill_unregister(rfk->rfkill); | ||
146 | } | ||
147 | |||
148 | void b43_rfkill_alloc(struct b43_wldev *dev) | ||
149 | { | ||
150 | struct b43_wl *wl = dev->wl; | ||
151 | struct b43_rfkill *rfk = &(wl->rfkill); | ||
152 | 117 | ||
118 | rfk->rfkill = rfkill_allocate(dev->dev->dev, RFKILL_TYPE_WLAN); | ||
119 | if (!rfk->rfkill) | ||
120 | goto out_error; | ||
153 | snprintf(rfk->name, sizeof(rfk->name), | 121 | snprintf(rfk->name, sizeof(rfk->name), |
154 | "b43-%s", wiphy_name(wl->hw->wiphy)); | 122 | "b43-%s", wiphy_name(wl->hw->wiphy)); |
155 | |||
156 | rfk->rfkill = rfkill_allocate(dev->dev->dev, RFKILL_TYPE_WLAN); | ||
157 | if (!rfk->rfkill) { | ||
158 | b43warn(wl, "Failed to allocate RF-kill button\n"); | ||
159 | return; | ||
160 | } | ||
161 | rfk->rfkill->name = rfk->name; | 123 | rfk->rfkill->name = rfk->name; |
162 | rfk->rfkill->state = RFKILL_STATE_ON; | 124 | rfk->rfkill->state = RFKILL_STATE_ON; |
163 | rfk->rfkill->data = dev; | 125 | rfk->rfkill->data = dev; |
@@ -165,18 +127,45 @@ void b43_rfkill_alloc(struct b43_wldev *dev) | |||
165 | rfk->rfkill->user_claim_unsupported = 1; | 127 | rfk->rfkill->user_claim_unsupported = 1; |
166 | 128 | ||
167 | rfk->poll_dev = input_allocate_polled_device(); | 129 | rfk->poll_dev = input_allocate_polled_device(); |
168 | if (rfk->poll_dev) { | 130 | if (!rfk->poll_dev) |
169 | rfk->poll_dev->private = dev; | 131 | goto err_free_rfk; |
170 | rfk->poll_dev->poll = b43_rfkill_poll; | 132 | rfk->poll_dev->private = dev; |
171 | rfk->poll_dev->poll_interval = 1000; /* msecs */ | 133 | rfk->poll_dev->poll = b43_rfkill_poll; |
172 | } else | 134 | rfk->poll_dev->poll_interval = 1000; /* msecs */ |
173 | b43warn(wl, "Failed to allocate RF-kill polldev\n"); | 135 | |
136 | err = rfkill_register(rfk->rfkill); | ||
137 | if (err) | ||
138 | goto err_free_polldev; | ||
139 | err = input_register_polled_device(rfk->poll_dev); | ||
140 | if (err) | ||
141 | goto err_unreg_rfk; | ||
142 | |||
143 | rfk->registered = 1; | ||
144 | |||
145 | return; | ||
146 | err_unreg_rfk: | ||
147 | rfkill_unregister(rfk->rfkill); | ||
148 | err_free_polldev: | ||
149 | input_free_polled_device(rfk->poll_dev); | ||
150 | rfk->poll_dev = NULL; | ||
151 | err_free_rfk: | ||
152 | rfkill_free(rfk->rfkill); | ||
153 | rfk->rfkill = NULL; | ||
154 | out_error: | ||
155 | rfk->registered = 0; | ||
156 | b43warn(wl, "RF-kill button init failed\n"); | ||
174 | } | 157 | } |
175 | 158 | ||
176 | void b43_rfkill_free(struct b43_wldev *dev) | 159 | void b43_rfkill_exit(struct b43_wldev *dev) |
177 | { | 160 | { |
178 | struct b43_rfkill *rfk = &(dev->wl->rfkill); | 161 | struct b43_rfkill *rfk = &(dev->wl->rfkill); |
179 | 162 | ||
163 | if (!rfk->registered) | ||
164 | return; | ||
165 | rfk->registered = 0; | ||
166 | |||
167 | input_unregister_polled_device(rfk->poll_dev); | ||
168 | rfkill_unregister(rfk->rfkill); | ||
180 | input_free_polled_device(rfk->poll_dev); | 169 | input_free_polled_device(rfk->poll_dev); |
181 | rfk->poll_dev = NULL; | 170 | rfk->poll_dev = NULL; |
182 | rfkill_free(rfk->rfkill); | 171 | rfkill_free(rfk->rfkill); |
diff --git a/drivers/net/wireless/b43/rfkill.h b/drivers/net/wireless/b43/rfkill.h index 29544e8c9e5f..adacf936d815 100644 --- a/drivers/net/wireless/b43/rfkill.h +++ b/drivers/net/wireless/b43/rfkill.h | |||
@@ -15,14 +15,14 @@ struct b43_rfkill { | |||
15 | struct rfkill *rfkill; | 15 | struct rfkill *rfkill; |
16 | /* The poll device for the RFKILL input button */ | 16 | /* The poll device for the RFKILL input button */ |
17 | struct input_polled_dev *poll_dev; | 17 | struct input_polled_dev *poll_dev; |
18 | /* Did initialization succeed? Used for freeing. */ | ||
19 | bool registered; | ||
18 | /* The unique name of this rfkill switch */ | 20 | /* The unique name of this rfkill switch */ |
19 | char name[32]; | 21 | char name[sizeof("b43-phy4294967295")]; |
20 | }; | 22 | }; |
21 | 23 | ||
22 | /* All the init functions return void, because we are not interested | 24 | /* The init function returns void, because we are not interested |
23 | * in failing the b43 init process when rfkill init failed. */ | 25 | * in failing the b43 init process when rfkill init failed. */ |
24 | void b43_rfkill_alloc(struct b43_wldev *dev); | ||
25 | void b43_rfkill_free(struct b43_wldev *dev); | ||
26 | void b43_rfkill_init(struct b43_wldev *dev); | 26 | void b43_rfkill_init(struct b43_wldev *dev); |
27 | void b43_rfkill_exit(struct b43_wldev *dev); | 27 | void b43_rfkill_exit(struct b43_wldev *dev); |
28 | 28 | ||
@@ -36,12 +36,6 @@ struct b43_rfkill { | |||
36 | /* empty */ | 36 | /* empty */ |
37 | }; | 37 | }; |
38 | 38 | ||
39 | static inline void b43_rfkill_alloc(struct b43_wldev *dev) | ||
40 | { | ||
41 | } | ||
42 | static inline void b43_rfkill_free(struct b43_wldev *dev) | ||
43 | { | ||
44 | } | ||
45 | static inline void b43_rfkill_init(struct b43_wldev *dev) | 39 | static inline void b43_rfkill_init(struct b43_wldev *dev) |
46 | { | 40 | { |
47 | } | 41 | } |