--- drivers/macintosh/adb.c.orig 2007-06-19 21:09:59.000000000 +0200 +++ drivers/macintosh/adb.c 2007-06-19 21:11:34.000000000 +0200 @@ -89,7 +89,7 @@ static int autopoll_devs; int __adb_probe_sync; -#ifdef CONFIG_PM +#ifdef CONFIG_PM && CONFIG_ADB_PMU static int adb_notify_sleep(struct pmu_sleep_notifier *self, int when); static struct pmu_sleep_notifier adb_sleep_notifier = { adb_notify_sleep, @@ -149,7 +149,7 @@ int i, highFree=0, noMovement; int devmask = 0; struct adb_request req; - + /* assumes adb_handler[] is all zeroes at this point */ for (i = 1; i < 16; i++) { /* see if there is anything at address i */ @@ -222,7 +222,7 @@ (highFree << 4) | 0xb, (i | 0x60), 0xfe); } - } + } } /* Now fill in the handler_id field of the adb_handler entries. */ @@ -259,10 +259,10 @@ printk(KERN_INFO "adb: starting probe task...\n"); do_adb_reset_bus(); printk(KERN_INFO "adb: finished probe task...\n"); - + adb_probe_task_pid = 0; up(&adb_probe_mutex); - + return 0; } @@ -305,7 +305,7 @@ if (adb_inited) return 0; adb_inited = 1; - + adb_controller = NULL; i = 0; @@ -319,7 +319,7 @@ printk(KERN_WARNING "Warning: no ADB interface detected\n"); adb_controller = NULL; } else { -#ifdef CONFIG_PM +#ifdef CONFIG_PM && CONFIG_ADB_PMU pmu_register_sleep_notifier(&adb_sleep_notifier); #endif /* CONFIG_PM */ #ifdef CONFIG_PPC @@ -336,7 +336,7 @@ __initcall(adb_init); -#ifdef CONFIG_PM +#ifdef CONFIG_PM && CONFIG_ADB_PMU /* * notify clients before sleep and reset bus afterwards */ @@ -344,7 +344,7 @@ adb_notify_sleep(struct pmu_sleep_notifier *self, int when) { int ret; - + switch (when) { case PBOOK_SLEEP_REQUEST: adb_got_sleep = 1; @@ -367,7 +367,7 @@ adb_reset_bus(); } break; - + case PBOOK_SLEEP_NOW: break; case PBOOK_WAKE: @@ -384,10 +384,10 @@ do_adb_reset_bus(void) { int ret, nret; - + if (adb_controller == NULL) return -ENXIO; - + if (adb_controller->autopoll) adb_controller->autopoll(0); @@ -431,7 +431,7 @@ ADB_MSG_POST_RESET, NULL); if (nret & NOTIFY_STOP_MASK) return -EBUSY; - + return ret; } @@ -451,7 +451,7 @@ /* Static request used during probe */ static struct adb_request adb_sreq; -static unsigned long adb_sreq_lock; // Use semaphore ! */ +static unsigned long adb_sreq_lock; // Use semaphore ! */ int adb_request(struct adb_request *req, void (*done)(struct adb_request *), @@ -467,7 +467,7 @@ return -EINVAL; if (req == NULL && (flags & ADBREQ_NOSEND)) return -EINVAL; - + if (req == NULL) { if (test_and_set_bit(0,&adb_sreq_lock)) { printk("adb.c: Warning: contention on static request !\n"); @@ -530,7 +530,7 @@ ids->nids = 0; for (i = 1; i < 16; i++) { if ((adb_handler[i].original_address == default_id) && - (!handler_id || (handler_id == adb_handler[i].handler_id) || + (!handler_id || (handler_id == adb_handler[i].handler_id) || try_handler_change(i, handler_id))) { if (adb_handler[i].handler != 0) { printk(KERN_ERR @@ -575,7 +575,7 @@ int i, id; static int dump_adb_input = 0; unsigned long flags; - + void (*handler)(unsigned char *, int, int); /* We skip keystrokes and mouse moves when the sleep process @@ -583,7 +583,7 @@ */ if (adb_got_sleep) return; - + id = buf[0] >> 4; if (dump_adb_input) { printk(KERN_INFO "adb packet: "); @@ -601,7 +601,7 @@ wmb(); adb_handler[id].busy = 0; } - + } /* Try to change handler to new_id. Will return 1 if successful. */ @@ -783,7 +783,7 @@ ret = -EIO; if (req != NULL || ret != 0) break; - + if (file->f_flags & O_NONBLOCK) { ret = -EAGAIN; break; @@ -800,7 +800,7 @@ current->state = TASK_RUNNING; remove_wait_queue(&state->wait_queue, &wait); spin_unlock_irqrestore(&state->lock, flags); - + if (ret) return ret; @@ -837,7 +837,7 @@ req->done = adb_write_done; req->arg = (void *) state; req->complete = 0; - + ret = -EFAULT; if (copy_from_user(req->data, buf, count)) goto out; @@ -865,7 +865,7 @@ if (ret == 0) ret = count; goto out; - } else { + } else { req->reply_expected = ((req->data[1] & 0xc) == 0xc); if (adb_controller && adb_controller->send_request) ret = adb_controller->send_request(req, 0);