aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/macintosh/adb.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/macintosh/adb.c')
-rw-r--r--drivers/macintosh/adb.c42
1 files changed, 9 insertions, 33 deletions
diff --git a/drivers/macintosh/adb.c b/drivers/macintosh/adb.c
index f729eebf771f..adfea3c7c62a 100644
--- a/drivers/macintosh/adb.c
+++ b/drivers/macintosh/adb.c
@@ -90,7 +90,7 @@ static int autopoll_devs;
90int __adb_probe_sync; 90int __adb_probe_sync;
91 91
92#ifdef CONFIG_PM 92#ifdef CONFIG_PM
93static int adb_notify_sleep(struct pmu_sleep_notifier *self, int when); 93static void adb_notify_sleep(struct pmu_sleep_notifier *self, int when);
94static struct pmu_sleep_notifier adb_sleep_notifier = { 94static struct pmu_sleep_notifier adb_sleep_notifier = {
95 adb_notify_sleep, 95 adb_notify_sleep,
96 SLEEP_LEVEL_ADB, 96 SLEEP_LEVEL_ADB,
@@ -340,11 +340,9 @@ __initcall(adb_init);
340/* 340/*
341 * notify clients before sleep and reset bus afterwards 341 * notify clients before sleep and reset bus afterwards
342 */ 342 */
343int 343void
344adb_notify_sleep(struct pmu_sleep_notifier *self, int when) 344adb_notify_sleep(struct pmu_sleep_notifier *self, int when)
345{ 345{
346 int ret;
347
348 switch (when) { 346 switch (when) {
349 case PBOOK_SLEEP_REQUEST: 347 case PBOOK_SLEEP_REQUEST:
350 adb_got_sleep = 1; 348 adb_got_sleep = 1;
@@ -353,22 +351,8 @@ adb_notify_sleep(struct pmu_sleep_notifier *self, int when)
353 /* Stop autopoll */ 351 /* Stop autopoll */
354 if (adb_controller->autopoll) 352 if (adb_controller->autopoll)
355 adb_controller->autopoll(0); 353 adb_controller->autopoll(0);
356 ret = blocking_notifier_call_chain(&adb_client_list, 354 blocking_notifier_call_chain(&adb_client_list,
357 ADB_MSG_POWERDOWN, NULL); 355 ADB_MSG_POWERDOWN, NULL);
358 if (ret & NOTIFY_STOP_MASK) {
359 up(&adb_probe_mutex);
360 return PBOOK_SLEEP_REFUSE;
361 }
362 break;
363 case PBOOK_SLEEP_REJECT:
364 if (adb_got_sleep) {
365 adb_got_sleep = 0;
366 up(&adb_probe_mutex);
367 adb_reset_bus();
368 }
369 break;
370
371 case PBOOK_SLEEP_NOW:
372 break; 356 break;
373 case PBOOK_WAKE: 357 case PBOOK_WAKE:
374 adb_got_sleep = 0; 358 adb_got_sleep = 0;
@@ -376,14 +360,13 @@ adb_notify_sleep(struct pmu_sleep_notifier *self, int when)
376 adb_reset_bus(); 360 adb_reset_bus();
377 break; 361 break;
378 } 362 }
379 return PBOOK_SLEEP_OK;
380} 363}
381#endif /* CONFIG_PM */ 364#endif /* CONFIG_PM */
382 365
383static int 366static int
384do_adb_reset_bus(void) 367do_adb_reset_bus(void)
385{ 368{
386 int ret, nret; 369 int ret;
387 370
388 if (adb_controller == NULL) 371 if (adb_controller == NULL)
389 return -ENXIO; 372 return -ENXIO;
@@ -391,13 +374,8 @@ do_adb_reset_bus(void)
391 if (adb_controller->autopoll) 374 if (adb_controller->autopoll)
392 adb_controller->autopoll(0); 375 adb_controller->autopoll(0);
393 376
394 nret = blocking_notifier_call_chain(&adb_client_list, 377 blocking_notifier_call_chain(&adb_client_list,
395 ADB_MSG_PRE_RESET, NULL); 378 ADB_MSG_PRE_RESET, NULL);
396 if (nret & NOTIFY_STOP_MASK) {
397 if (adb_controller->autopoll)
398 adb_controller->autopoll(autopoll_devs);
399 return -EBUSY;
400 }
401 379
402 if (sleepy_trackpad) { 380 if (sleepy_trackpad) {
403 /* Let the trackpad settle down */ 381 /* Let the trackpad settle down */
@@ -427,10 +405,8 @@ do_adb_reset_bus(void)
427 } 405 }
428 up(&adb_handler_sem); 406 up(&adb_handler_sem);
429 407
430 nret = blocking_notifier_call_chain(&adb_client_list, 408 blocking_notifier_call_chain(&adb_client_list,
431 ADB_MSG_POST_RESET, NULL); 409 ADB_MSG_POST_RESET, NULL);
432 if (nret & NOTIFY_STOP_MASK)
433 return -EBUSY;
434 410
435 return ret; 411 return ret;
436} 412}