2 * Intel Wireless WiMAX Connection 2400m
3 * Generic probe/disconnect, reset and message passing
6 * Copyright (C) 2007-2008 Intel Corporation <linux-wimax@intel.com>
7 * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License version
11 * 2 as published by the Free Software Foundation.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
24 * See i2400m.h for driver documentation. This contains helpers for
25 * the driver model glue [_setup()/_release()], handling device resets
26 * [_dev_reset_handle()], and the backends for the WiMAX stack ops
27 * reset [_op_reset()] and message from user [_op_msg_from_user()].
31 * i2400m_op_msg_from_user()
33 * wimax_msg_to_user_send()
38 * i2400m_dev_reset_handle()
39 * __i2400m_dev_reset_handle()
41 * __i2400m_dev_start()
44 * i2400m_bootrom_init()
47 * __i2400m_dev_start()
48 * i2400m_dev_bootstrap()
50 * i2400m->bus_dev_start()
51 * i2400m_firmware_check()
52 * i2400m_check_mac_addr()
59 * i2400m_dev_shutdown()
60 * i2400m->bus_dev_stop()
65 #include <linux/wimax/i2400m.h>
66 #include <linux/module.h>
67 #include <linux/moduleparam.h>
69 #define D_SUBMODULE driver
70 #include "debug-levels.h"
73 int i2400m_idle_mode_disabled
; /* 0 (idle mode enabled) by default */
74 module_param_named(idle_mode_disabled
, i2400m_idle_mode_disabled
, int, 0644);
75 MODULE_PARM_DESC(idle_mode_disabled
,
76 "If true, the device will not enable idle mode negotiation "
77 "with the base station (when connected) to save power.");
79 int i2400m_rx_reorder_disabled
; /* 0 (rx reorder enabled) by default */
80 module_param_named(rx_reorder_disabled
, i2400m_rx_reorder_disabled
, int, 0644);
81 MODULE_PARM_DESC(rx_reorder_disabled
,
82 "If true, RX reordering will be disabled.");
85 * i2400m_queue_work - schedule work on a i2400m's queue
87 * @i2400m: device descriptor
89 * @fn: function to run to execute work. It gets passed a 'struct
90 * work_struct' that is wrapped in a 'struct i2400m_work'. Once
91 * done, you have to (1) i2400m_put(i2400m_work->i2400m) and then
92 * (2) kfree(i2400m_work).
94 * @gfp_flags: GFP flags for memory allocation.
96 * @pl: pointer to a payload buffer that you want to pass to the _work
97 * function. Use this to pack (for example) a struct with extra
100 * @pl_size: size of the payload buffer.
102 * We do this quite often, so this just saves typing; allocate a
103 * wrapper for a i2400m, get a ref to it, pack arguments and launch
106 * A usual workflow is:
108 * struct my_work_args {
114 * struct my_work_args my_args = {
118 * i2400m_queue_work(i2400m, 1, my_work_function, GFP_KERNEL,
119 * &args, sizeof(args))
121 * And now the work function can unpack the arguments and call the
122 * real function (or do the job itself):
125 * void my_work_fn((struct work_struct *ws)
127 * struct i2400m_work *iw =
128 * container_of(ws, struct i2400m_work, ws);
129 * struct my_work_args *my_args = (void *) iw->pl;
131 * my_work(iw->i2400m, my_args->something, my_args->whatevert);
134 int i2400m_queue_work(struct i2400m
*i2400m
,
135 void (*fn
)(struct work_struct
*), gfp_t gfp_flags
,
136 const void *pl
, size_t pl_size
)
139 struct i2400m_work
*iw
;
141 BUG_ON(i2400m
->work_queue
== NULL
);
143 iw
= kzalloc(sizeof(*iw
) + pl_size
, gfp_flags
);
146 iw
->i2400m
= i2400m_get(i2400m
);
147 memcpy(iw
->pl
, pl
, pl_size
);
148 INIT_WORK(&iw
->ws
, fn
);
149 result
= queue_work(i2400m
->work_queue
, &iw
->ws
);
153 EXPORT_SYMBOL_GPL(i2400m_queue_work
);
157 * Schedule i2400m's specific work on the system's queue.
159 * Used for a few cases where we really need it; otherwise, identical
160 * to i2400m_queue_work().
162 * Returns < 0 errno code on error, 1 if ok.
164 * If it returns zero, something really bad happened, as it means the
165 * works struct was already queued, but we have just allocated it, so
166 * it should not happen.
168 int i2400m_schedule_work(struct i2400m
*i2400m
,
169 void (*fn
)(struct work_struct
*), gfp_t gfp_flags
)
172 struct i2400m_work
*iw
;
174 BUG_ON(i2400m
->work_queue
== NULL
);
176 iw
= kzalloc(sizeof(*iw
), gfp_flags
);
179 iw
->i2400m
= i2400m_get(i2400m
);
180 INIT_WORK(&iw
->ws
, fn
);
181 result
= schedule_work(&iw
->ws
);
190 * WiMAX stack operation: relay a message from user space
192 * @wimax_dev: device descriptor
193 * @pipe_name: named pipe the message is for
194 * @msg_buf: pointer to the message bytes
195 * @msg_len: length of the buffer
196 * @genl_info: passed by the generic netlink layer
198 * The WiMAX stack will call this function when a message was received
201 * For the i2400m, this is an L3L4 message, as specified in
202 * include/linux/wimax/i2400m.h, and thus prefixed with a 'struct
203 * i2400m_l3l4_hdr'. Driver (and device) expect the messages to be
204 * coded in Little Endian.
206 * This function just verifies that the header declaration and the
207 * payload are consistent and then deals with it, either forwarding it
208 * to the device or procesing it locally.
210 * In the i2400m, messages are basically commands that will carry an
211 * ack, so we use i2400m_msg_to_dev() and then deliver the ack back to
212 * user space. The rx.c code might intercept the response and use it
213 * to update the driver's state, but then it will pass it on so it can
214 * be relayed back to user space.
216 * Note that asynchronous events from the device are processed and
217 * sent to user space in rx.c.
220 int i2400m_op_msg_from_user(struct wimax_dev
*wimax_dev
,
221 const char *pipe_name
,
222 const void *msg_buf
, size_t msg_len
,
223 const struct genl_info
*genl_info
)
226 struct i2400m
*i2400m
= wimax_dev_to_i2400m(wimax_dev
);
227 struct device
*dev
= i2400m_dev(i2400m
);
228 struct sk_buff
*ack_skb
;
230 d_fnstart(4, dev
, "(wimax_dev %p [i2400m %p] msg_buf %p "
231 "msg_len %zu genl_info %p)\n", wimax_dev
, i2400m
,
232 msg_buf
, msg_len
, genl_info
);
233 ack_skb
= i2400m_msg_to_dev(i2400m
, msg_buf
, msg_len
);
234 result
= PTR_ERR(ack_skb
);
236 goto error_msg_to_dev
;
237 if (unlikely(i2400m
->trace_msg_from_user
))
238 wimax_msg(&i2400m
->wimax_dev
, "trace",
239 msg_buf
, msg_len
, GFP_KERNEL
);
240 result
= wimax_msg_send(&i2400m
->wimax_dev
, ack_skb
);
242 d_fnend(4, dev
, "(wimax_dev %p [i2400m %p] msg_buf %p msg_len %zu "
243 "genl_info %p) = %d\n", wimax_dev
, i2400m
, msg_buf
, msg_len
,
250 * Context to wait for a reset to finalize
252 struct i2400m_reset_ctx
{
253 struct completion completion
;
259 * WiMAX stack operation: reset a device
261 * @wimax_dev: device descriptor
263 * See the documentation for wimax_reset() and wimax_dev->op_reset for
264 * the requirements of this function. The WiMAX stack guarantees
265 * serialization on calls to this function.
267 * Do a warm reset on the device; if it fails, resort to a cold reset
268 * and return -ENODEV. On successful warm reset, we need to block
269 * until it is complete.
271 * The bus-driver implementation of reset takes care of falling back
272 * to cold reset if warm fails.
275 int i2400m_op_reset(struct wimax_dev
*wimax_dev
)
278 struct i2400m
*i2400m
= wimax_dev_to_i2400m(wimax_dev
);
279 struct device
*dev
= i2400m_dev(i2400m
);
280 struct i2400m_reset_ctx ctx
= {
281 .completion
= COMPLETION_INITIALIZER_ONSTACK(ctx
.completion
),
285 d_fnstart(4, dev
, "(wimax_dev %p)\n", wimax_dev
);
286 mutex_lock(&i2400m
->init_mutex
);
287 i2400m
->reset_ctx
= &ctx
;
288 mutex_unlock(&i2400m
->init_mutex
);
289 result
= i2400m
->bus_reset(i2400m
, I2400M_RT_WARM
);
292 result
= wait_for_completion_timeout(&ctx
.completion
, 4*HZ
);
297 /* if result < 0, pass it on */
298 mutex_lock(&i2400m
->init_mutex
);
299 i2400m
->reset_ctx
= NULL
;
300 mutex_unlock(&i2400m
->init_mutex
);
302 d_fnend(4, dev
, "(wimax_dev %p) = %d\n", wimax_dev
, result
);
308 * Check the MAC address we got from boot mode is ok
310 * @i2400m: device descriptor
312 * Returns: 0 if ok, < 0 errno code on error.
315 int i2400m_check_mac_addr(struct i2400m
*i2400m
)
318 struct device
*dev
= i2400m_dev(i2400m
);
320 const struct i2400m_tlv_detailed_device_info
*ddi
;
321 struct net_device
*net_dev
= i2400m
->wimax_dev
.net_dev
;
322 const unsigned char zeromac
[ETH_ALEN
] = { 0 };
324 d_fnstart(3, dev
, "(i2400m %p)\n", i2400m
);
325 skb
= i2400m_get_device_info(i2400m
);
327 result
= PTR_ERR(skb
);
328 dev_err(dev
, "Cannot verify MAC address, error reading: %d\n",
332 /* Extract MAC addresss */
333 ddi
= (void *) skb
->data
;
334 BUILD_BUG_ON(ETH_ALEN
!= sizeof(ddi
->mac_address
));
335 d_printf(2, dev
, "GET DEVICE INFO: mac addr "
336 "%02x:%02x:%02x:%02x:%02x:%02x\n",
337 ddi
->mac_address
[0], ddi
->mac_address
[1],
338 ddi
->mac_address
[2], ddi
->mac_address
[3],
339 ddi
->mac_address
[4], ddi
->mac_address
[5]);
340 if (!memcmp(net_dev
->perm_addr
, ddi
->mac_address
,
341 sizeof(ddi
->mac_address
)))
343 dev_warn(dev
, "warning: device reports a different MAC address "
344 "to that of boot mode's\n");
345 dev_warn(dev
, "device reports %02x:%02x:%02x:%02x:%02x:%02x\n",
346 ddi
->mac_address
[0], ddi
->mac_address
[1],
347 ddi
->mac_address
[2], ddi
->mac_address
[3],
348 ddi
->mac_address
[4], ddi
->mac_address
[5]);
349 dev_warn(dev
, "boot mode reported %02x:%02x:%02x:%02x:%02x:%02x\n",
350 net_dev
->perm_addr
[0], net_dev
->perm_addr
[1],
351 net_dev
->perm_addr
[2], net_dev
->perm_addr
[3],
352 net_dev
->perm_addr
[4], net_dev
->perm_addr
[5]);
353 if (!memcmp(zeromac
, ddi
->mac_address
, sizeof(zeromac
)))
354 dev_err(dev
, "device reports an invalid MAC address, "
357 dev_warn(dev
, "updating MAC address\n");
358 net_dev
->addr_len
= ETH_ALEN
;
359 memcpy(net_dev
->perm_addr
, ddi
->mac_address
, ETH_ALEN
);
360 memcpy(net_dev
->dev_addr
, ddi
->mac_address
, ETH_ALEN
);
366 d_fnend(3, dev
, "(i2400m %p) = %d\n", i2400m
, result
);
372 * __i2400m_dev_start - Bring up driver communication with the device
374 * @i2400m: device descriptor
375 * @flags: boot mode flags
377 * Returns: 0 if ok, < 0 errno code on error.
379 * Uploads firmware and brings up all the resources needed to be able
380 * to communicate with the device.
382 * TX needs to be setup before the bus-specific code (otherwise on
383 * shutdown, the bus-tx code could try to access it).
386 int __i2400m_dev_start(struct i2400m
*i2400m
, enum i2400m_bri flags
)
389 struct wimax_dev
*wimax_dev
= &i2400m
->wimax_dev
;
390 struct net_device
*net_dev
= wimax_dev
->net_dev
;
391 struct device
*dev
= i2400m_dev(i2400m
);
394 d_fnstart(3, dev
, "(i2400m %p)\n", i2400m
);
396 result
= i2400m_dev_bootstrap(i2400m
, flags
);
398 dev_err(dev
, "cannot bootstrap device: %d\n", result
);
399 goto error_bootstrap
;
401 result
= i2400m_tx_setup(i2400m
);
404 result
= i2400m_rx_setup(i2400m
);
407 result
= i2400m
->bus_dev_start(i2400m
);
409 goto error_bus_dev_start
;
410 i2400m
->work_queue
= create_singlethread_workqueue(wimax_dev
->name
);
411 if (i2400m
->work_queue
== NULL
) {
413 dev_err(dev
, "cannot create workqueue\n");
414 goto error_create_workqueue
;
416 result
= i2400m_firmware_check(i2400m
); /* fw versions ok? */
419 /* At this point is ok to send commands to the device */
420 result
= i2400m_check_mac_addr(i2400m
);
422 goto error_check_mac_addr
;
424 wimax_state_change(wimax_dev
, WIMAX_ST_UNINITIALIZED
);
425 result
= i2400m_dev_initialize(i2400m
);
427 goto error_dev_initialize
;
428 /* At this point, reports will come for the device and set it
429 * to the right state if it is different than UNINITIALIZED */
430 d_fnend(3, dev
, "(net_dev %p [i2400m %p]) = %d\n",
431 net_dev
, i2400m
, result
);
434 error_dev_initialize
:
435 error_check_mac_addr
:
437 destroy_workqueue(i2400m
->work_queue
);
438 error_create_workqueue
:
439 i2400m
->bus_dev_stop(i2400m
);
441 i2400m_rx_release(i2400m
);
443 i2400m_tx_release(i2400m
);
446 if (result
== -ERESTARTSYS
&& times
-- > 0) {
447 flags
= I2400M_BRI_SOFT
;
450 d_fnend(3, dev
, "(net_dev %p [i2400m %p]) = %d\n",
451 net_dev
, i2400m
, result
);
457 int i2400m_dev_start(struct i2400m
*i2400m
, enum i2400m_bri bm_flags
)
460 mutex_lock(&i2400m
->init_mutex
); /* Well, start the device */
461 result
= __i2400m_dev_start(i2400m
, bm_flags
);
464 mutex_unlock(&i2400m
->init_mutex
);
470 * i2400m_dev_stop - Tear down driver communication with the device
472 * @i2400m: device descriptor
474 * Returns: 0 if ok, < 0 errno code on error.
476 * Releases all the resources allocated to communicate with the device.
479 void __i2400m_dev_stop(struct i2400m
*i2400m
)
481 struct wimax_dev
*wimax_dev
= &i2400m
->wimax_dev
;
482 struct device
*dev
= i2400m_dev(i2400m
);
484 d_fnstart(3, dev
, "(i2400m %p)\n", i2400m
);
485 wimax_state_change(wimax_dev
, __WIMAX_ST_QUIESCING
);
486 i2400m_dev_shutdown(i2400m
);
488 destroy_workqueue(i2400m
->work_queue
);
489 i2400m
->bus_dev_stop(i2400m
);
490 i2400m_rx_release(i2400m
);
491 i2400m_tx_release(i2400m
);
492 wimax_state_change(wimax_dev
, WIMAX_ST_DOWN
);
493 d_fnend(3, dev
, "(i2400m %p) = 0\n", i2400m
);
498 * Watch out -- we only need to stop if there is a need for it. The
499 * device could have reset itself and failed to come up again (see
500 * _i2400m_dev_reset_handle()).
503 void i2400m_dev_stop(struct i2400m
*i2400m
)
505 mutex_lock(&i2400m
->init_mutex
);
506 if (i2400m
->updown
) {
507 __i2400m_dev_stop(i2400m
);
510 mutex_unlock(&i2400m
->init_mutex
);
515 * The device has rebooted; fix up the device and the driver
517 * Tear down the driver communication with the device, reload the
518 * firmware and reinitialize the communication with the device.
520 * If someone calls a reset when the device's firmware is down, in
521 * theory we won't see it because we are not listening. However, just
522 * in case, leave the code to handle it.
524 * If there is a reset context, use it; this means someone is waiting
525 * for us to tell him when the reset operation is complete and the
526 * device is ready to rock again.
528 * NOTE: if we are in the process of bringing up or down the
529 * communication with the device [running i2400m_dev_start() or
530 * _stop()], don't do anything, let it fail and handle it.
532 * This function is ran always in a thread context
535 void __i2400m_dev_reset_handle(struct work_struct
*ws
)
538 struct i2400m_work
*iw
= container_of(ws
, struct i2400m_work
, ws
);
539 struct i2400m
*i2400m
= iw
->i2400m
;
540 struct device
*dev
= i2400m_dev(i2400m
);
541 enum wimax_st wimax_state
;
542 struct i2400m_reset_ctx
*ctx
= i2400m
->reset_ctx
;
544 d_fnstart(3, dev
, "(ws %p i2400m %p)\n", ws
, i2400m
);
546 if (mutex_trylock(&i2400m
->init_mutex
) == 0) {
547 /* We are still in i2400m_dev_start() [let it fail] or
548 * i2400m_dev_stop() [we are shutting down anyway, so
549 * ignore it] or we are resetting somewhere else. */
550 dev_err(dev
, "device rebooted\n");
551 i2400m_msg_to_dev_cancel_wait(i2400m
, -ERESTARTSYS
);
552 complete(&i2400m
->msg_completion
);
555 wimax_state
= wimax_state_get(&i2400m
->wimax_dev
);
556 if (wimax_state
< WIMAX_ST_UNINITIALIZED
) {
557 dev_info(dev
, "device rebooted: it is down, ignoring\n");
558 goto out_unlock
; /* ifconfig up/down wasn't called */
560 dev_err(dev
, "device rebooted: reinitializing driver\n");
561 __i2400m_dev_stop(i2400m
);
563 result
= __i2400m_dev_start(i2400m
,
564 I2400M_BRI_SOFT
| I2400M_BRI_MAC_REINIT
);
566 dev_err(dev
, "device reboot: cannot start the device: %d\n",
568 result
= i2400m
->bus_reset(i2400m
, I2400M_RT_BUS
);
574 if (i2400m
->reset_ctx
) {
575 ctx
->result
= result
;
576 complete(&ctx
->completion
);
578 mutex_unlock(&i2400m
->init_mutex
);
582 d_fnend(3, dev
, "(ws %p i2400m %p) = void\n", ws
, i2400m
);
588 * i2400m_dev_reset_handle - Handle a device's reset in a thread context
590 * Schedule a device reset handling out on a thread context, so it
591 * is safe to call from atomic context. We can't use the i2400m's
592 * queue as we are going to destroy it and reinitialize it as part of
593 * the driver bringup/bringup process.
595 * See __i2400m_dev_reset_handle() for details; that takes care of
596 * reinitializing the driver to handle the reset, calling into the
597 * bus-specific functions ops as needed.
599 int i2400m_dev_reset_handle(struct i2400m
*i2400m
)
601 return i2400m_schedule_work(i2400m
, __i2400m_dev_reset_handle
,
604 EXPORT_SYMBOL_GPL(i2400m_dev_reset_handle
);
608 * i2400m_setup - bus-generic setup function for the i2400m device
610 * @i2400m: device descriptor (bus-specific parts have been initialized)
612 * Returns: 0 if ok, < 0 errno code on error.
614 * Initializes the bus-generic parts of the i2400m driver; the
615 * bus-specific parts have been initialized, function pointers filled
616 * out by the bus-specific probe function.
618 * As well, this registers the WiMAX and net device nodes. Once this
619 * function returns, the device is operative and has to be ready to
620 * receive and send network traffic and WiMAX control operations.
622 int i2400m_setup(struct i2400m
*i2400m
, enum i2400m_bri bm_flags
)
624 int result
= -ENODEV
;
625 struct device
*dev
= i2400m_dev(i2400m
);
626 struct wimax_dev
*wimax_dev
= &i2400m
->wimax_dev
;
627 struct net_device
*net_dev
= i2400m
->wimax_dev
.net_dev
;
629 d_fnstart(3, dev
, "(i2400m %p)\n", i2400m
);
631 snprintf(wimax_dev
->name
, sizeof(wimax_dev
->name
),
632 "i2400m-%s:%s", dev
->bus
->name
, dev_name(dev
));
634 i2400m
->bm_cmd_buf
= kzalloc(I2400M_BM_CMD_BUF_SIZE
, GFP_KERNEL
);
635 if (i2400m
->bm_cmd_buf
== NULL
) {
636 dev_err(dev
, "cannot allocate USB command buffer\n");
637 goto error_bm_cmd_kzalloc
;
639 i2400m
->bm_ack_buf
= kzalloc(I2400M_BM_ACK_BUF_SIZE
, GFP_KERNEL
);
640 if (i2400m
->bm_ack_buf
== NULL
) {
641 dev_err(dev
, "cannot allocate USB ack buffer\n");
642 goto error_bm_ack_buf_kzalloc
;
644 result
= i2400m_bootrom_init(i2400m
, bm_flags
);
646 dev_err(dev
, "read mac addr: bootrom init "
647 "failed: %d\n", result
);
648 goto error_bootrom_init
;
650 result
= i2400m_read_mac_addr(i2400m
);
652 goto error_read_mac_addr
;
654 result
= register_netdev(net_dev
); /* Okey dokey, bring it up */
656 dev_err(dev
, "cannot register i2400m network device: %d\n",
658 goto error_register_netdev
;
660 netif_carrier_off(net_dev
);
662 result
= i2400m_dev_start(i2400m
, bm_flags
);
664 goto error_dev_start
;
666 i2400m
->wimax_dev
.op_msg_from_user
= i2400m_op_msg_from_user
;
667 i2400m
->wimax_dev
.op_rfkill_sw_toggle
= i2400m_op_rfkill_sw_toggle
;
668 i2400m
->wimax_dev
.op_reset
= i2400m_op_reset
;
669 result
= wimax_dev_add(&i2400m
->wimax_dev
, net_dev
);
671 goto error_wimax_dev_add
;
672 /* User space needs to do some init stuff */
673 wimax_state_change(wimax_dev
, WIMAX_ST_UNINITIALIZED
);
675 /* Now setup all that requires a registered net and wimax device. */
676 result
= sysfs_create_group(&net_dev
->dev
.kobj
, &i2400m_dev_attr_group
);
678 dev_err(dev
, "cannot setup i2400m's sysfs: %d\n", result
);
679 goto error_sysfs_setup
;
681 result
= i2400m_debugfs_add(i2400m
);
683 dev_err(dev
, "cannot setup i2400m's debugfs: %d\n", result
);
684 goto error_debugfs_setup
;
686 d_fnend(3, dev
, "(i2400m %p) = %d\n", i2400m
, result
);
690 sysfs_remove_group(&i2400m
->wimax_dev
.net_dev
->dev
.kobj
,
691 &i2400m_dev_attr_group
);
693 wimax_dev_rm(&i2400m
->wimax_dev
);
695 i2400m_dev_stop(i2400m
);
697 unregister_netdev(net_dev
);
698 error_register_netdev
:
701 kfree(i2400m
->bm_ack_buf
);
702 error_bm_ack_buf_kzalloc
:
703 kfree(i2400m
->bm_cmd_buf
);
704 error_bm_cmd_kzalloc
:
705 d_fnend(3, dev
, "(i2400m %p) = %d\n", i2400m
, result
);
708 EXPORT_SYMBOL_GPL(i2400m_setup
);
712 * i2400m_release - release the bus-generic driver resources
714 * Sends a disconnect message and undoes any setup done by i2400m_setup()
716 void i2400m_release(struct i2400m
*i2400m
)
718 struct device
*dev
= i2400m_dev(i2400m
);
720 d_fnstart(3, dev
, "(i2400m %p)\n", i2400m
);
721 netif_stop_queue(i2400m
->wimax_dev
.net_dev
);
723 i2400m_debugfs_rm(i2400m
);
724 sysfs_remove_group(&i2400m
->wimax_dev
.net_dev
->dev
.kobj
,
725 &i2400m_dev_attr_group
);
726 wimax_dev_rm(&i2400m
->wimax_dev
);
727 i2400m_dev_stop(i2400m
);
728 unregister_netdev(i2400m
->wimax_dev
.net_dev
);
729 kfree(i2400m
->bm_ack_buf
);
730 kfree(i2400m
->bm_cmd_buf
);
731 d_fnend(3, dev
, "(i2400m %p) = void\n", i2400m
);
733 EXPORT_SYMBOL_GPL(i2400m_release
);
737 * Debug levels control; see debug.h
739 struct d_level D_LEVEL
[] = {
740 D_SUBMODULE_DEFINE(control
),
741 D_SUBMODULE_DEFINE(driver
),
742 D_SUBMODULE_DEFINE(debugfs
),
743 D_SUBMODULE_DEFINE(fw
),
744 D_SUBMODULE_DEFINE(netdev
),
745 D_SUBMODULE_DEFINE(rfkill
),
746 D_SUBMODULE_DEFINE(rx
),
747 D_SUBMODULE_DEFINE(tx
),
749 size_t D_LEVEL_SIZE
= ARRAY_SIZE(D_LEVEL
);
753 int __init
i2400m_driver_init(void)
757 module_init(i2400m_driver_init
);
760 void __exit
i2400m_driver_exit(void)
762 /* for scheds i2400m_dev_reset_handle() */
763 flush_scheduled_work();
766 module_exit(i2400m_driver_exit
);
768 MODULE_AUTHOR("Intel Corporation <linux-wimax@intel.com>");
769 MODULE_DESCRIPTION("Intel 2400M WiMAX networking bus-generic driver");
770 MODULE_LICENSE("GPL");