diff options
author | Ivo van Doorn <ivdoorn@gmail.com> | 2008-03-13 10:38:03 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-03-13 15:57:26 -0400 |
commit | 1682fe6de206bd1e937529cbb393915e5ea40b2c (patch) | |
tree | 4890282b3ea30708d27667015664d6b742261277 /drivers/net/wireless/rt2x00/rt2x00dev.c | |
parent | f50e4a8494a74bdbc0f86f1430a4cca2a4f28799 (diff) |
rt2x00: Add suspend/resume handlers to rt2x00rfkill
Add suspend/resume handlers to rt2x00rfkill to have it stop
the input-polldev and prevent it from calling rt2x00 during
suspend period. This could lead to a NULL pointer fault when
rt2x00 suspended, but polldev send a request, because
the csr_addr is NULL.
Also don't let the rfkill allocation/registration block
the initialization of the entire device. Just print a warning
and continue as if nothing happened.
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2x00dev.c')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00dev.c | 35 |
1 files changed, 14 insertions, 21 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c index 0d51f478bcdf..bc846ba12f63 100644 --- a/drivers/net/wireless/rt2x00/rt2x00dev.c +++ b/drivers/net/wireless/rt2x00/rt2x00dev.c | |||
@@ -1098,7 +1098,7 @@ static void rt2x00lib_uninitialize(struct rt2x00_dev *rt2x00dev) | |||
1098 | return; | 1098 | return; |
1099 | 1099 | ||
1100 | /* | 1100 | /* |
1101 | * Unregister rfkill. | 1101 | * Unregister extra components. |
1102 | */ | 1102 | */ |
1103 | rt2x00rfkill_unregister(rt2x00dev); | 1103 | rt2x00rfkill_unregister(rt2x00dev); |
1104 | 1104 | ||
@@ -1139,11 +1139,9 @@ static int rt2x00lib_initialize(struct rt2x00_dev *rt2x00dev) | |||
1139 | __set_bit(DEVICE_INITIALIZED, &rt2x00dev->flags); | 1139 | __set_bit(DEVICE_INITIALIZED, &rt2x00dev->flags); |
1140 | 1140 | ||
1141 | /* | 1141 | /* |
1142 | * Register the rfkill handler. | 1142 | * Register the extra components. |
1143 | */ | 1143 | */ |
1144 | status = rt2x00rfkill_register(rt2x00dev); | 1144 | rt2x00rfkill_register(rt2x00dev); |
1145 | if (status) | ||
1146 | goto exit_unitialize; | ||
1147 | 1145 | ||
1148 | return 0; | 1146 | return 0; |
1149 | 1147 | ||
@@ -1313,15 +1311,9 @@ int rt2x00lib_probe_dev(struct rt2x00_dev *rt2x00dev) | |||
1313 | } | 1311 | } |
1314 | 1312 | ||
1315 | /* | 1313 | /* |
1316 | * Allocatie rfkill. | 1314 | * Register extra components. |
1317 | */ | ||
1318 | retval = rt2x00rfkill_allocate(rt2x00dev); | ||
1319 | if (retval) | ||
1320 | goto exit; | ||
1321 | |||
1322 | /* | ||
1323 | * Open the debugfs entry. | ||
1324 | */ | 1315 | */ |
1316 | rt2x00rfkill_allocate(rt2x00dev); | ||
1325 | rt2x00debug_register(rt2x00dev); | 1317 | rt2x00debug_register(rt2x00dev); |
1326 | 1318 | ||
1327 | __set_bit(DEVICE_PRESENT, &rt2x00dev->flags); | 1319 | __set_bit(DEVICE_PRESENT, &rt2x00dev->flags); |
@@ -1350,13 +1342,9 @@ void rt2x00lib_remove_dev(struct rt2x00_dev *rt2x00dev) | |||
1350 | rt2x00lib_uninitialize(rt2x00dev); | 1342 | rt2x00lib_uninitialize(rt2x00dev); |
1351 | 1343 | ||
1352 | /* | 1344 | /* |
1353 | * Close debugfs entry. | 1345 | * Free extra components |
1354 | */ | 1346 | */ |
1355 | rt2x00debug_deregister(rt2x00dev); | 1347 | rt2x00debug_deregister(rt2x00dev); |
1356 | |||
1357 | /* | ||
1358 | * Free rfkill | ||
1359 | */ | ||
1360 | rt2x00rfkill_free(rt2x00dev); | 1348 | rt2x00rfkill_free(rt2x00dev); |
1361 | 1349 | ||
1362 | /* | 1350 | /* |
@@ -1395,11 +1383,15 @@ int rt2x00lib_suspend(struct rt2x00_dev *rt2x00dev, pm_message_t state) | |||
1395 | __set_bit(DEVICE_STARTED_SUSPEND, &rt2x00dev->flags); | 1383 | __set_bit(DEVICE_STARTED_SUSPEND, &rt2x00dev->flags); |
1396 | 1384 | ||
1397 | /* | 1385 | /* |
1398 | * Disable radio and unitialize all items | 1386 | * Disable radio. |
1399 | * that must be recreated on resume. | ||
1400 | */ | 1387 | */ |
1401 | rt2x00lib_stop(rt2x00dev); | 1388 | rt2x00lib_stop(rt2x00dev); |
1402 | rt2x00lib_uninitialize(rt2x00dev); | 1389 | rt2x00lib_uninitialize(rt2x00dev); |
1390 | |||
1391 | /* | ||
1392 | * Suspend/disable extra components. | ||
1393 | */ | ||
1394 | rt2x00rfkill_suspend(rt2x00dev); | ||
1403 | rt2x00debug_deregister(rt2x00dev); | 1395 | rt2x00debug_deregister(rt2x00dev); |
1404 | 1396 | ||
1405 | exit: | 1397 | exit: |
@@ -1422,9 +1414,10 @@ int rt2x00lib_resume(struct rt2x00_dev *rt2x00dev) | |||
1422 | NOTICE(rt2x00dev, "Waking up.\n"); | 1414 | NOTICE(rt2x00dev, "Waking up.\n"); |
1423 | 1415 | ||
1424 | /* | 1416 | /* |
1425 | * Open the debugfs entry. | 1417 | * Restore/enable extra components. |
1426 | */ | 1418 | */ |
1427 | rt2x00debug_register(rt2x00dev); | 1419 | rt2x00debug_register(rt2x00dev); |
1420 | rt2x00rfkill_resume(rt2x00dev); | ||
1428 | 1421 | ||
1429 | /* | 1422 | /* |
1430 | * Only continue if mac80211 had open interfaces. | 1423 | * Only continue if mac80211 had open interfaces. |