kernels/linux-2.4.0/drivers/macintosh/adb.c
/*
 * notify clients before sleep and reset bus afterwards
 */
notify clients before sleep and reset bus afterwards
notify clients before sleep and reset bus afterwards
int
adb_notify_sleep(struct pmu_sleep_notifier *self, int when)
{
	int ret;
	switch (when) {
	case PBOOK_SLEEP_REQUEST:
		adb_got_sleep = 1;
		if (adb_controller->autopoll)
			adb_controller->autopoll(0);
		ret = notifier_call_chain(&adb_client_list, ADB_MSG_POWERDOWN, NULL);
		if (ret & NOTIFY_STOP_MASK)
			return PBOOK_SLEEP_REFUSE;
		break;
	case PBOOK_SLEEP_REJECT:
		if (adb_got_sleep) {
			adb_got_sleep = 0;
			adb_reset_bus();
		}
		break;
	case PBOOK_SLEEP_NOW:
		break;
	case PBOOK_WAKE:
		adb_reset_bus();
		adb_got_sleep = 0;
		break;
	}
	return PBOOK_SLEEP_OK;
}
int adb_notify_sleep ( struct pmu_sleep_notifier * self , int when ) { int ret ; switch ( when ) { case PBOOK_SLEEP_REQUEST : adb_got_sleep = 1 ; if ( adb_controller -> autopoll ) adb_controller -> autopoll ( 0 ) ; ret = notifier_call_chain ( & adb_client_list , ADB_MSG_POWERDOWN , NULL ) ; if ( ret & NOTIFY_STOP_MASK ) return PBOOK_SLEEP_REFUSE ; break ; case PBOOK_SLEEP_REJECT : if ( adb_got_sleep ) { adb_got_sleep = 0 ; adb_reset_bus ( ) ; } break ; case PBOOK_SLEEP_NOW : break ; case PBOOK_WAKE : adb_reset_bus ( ) ; adb_got_sleep = 0 ; break ; } return PBOOK_SLEEP_OK ; }
notify clients before sleep and reset bus afterwards
notify clients before sleep and reset bus afterwards