aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/macintosh
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2006-10-05 09:55:46 -0400
committerDavid Howells <dhowells@warthog.cambridge.redhat.com>2006-10-05 10:10:12 -0400
commit7d12e780e003f93433d49ce78cfedf4b4c52adc5 (patch)
tree6748550400445c11a306b132009f3001e3525df8 /drivers/macintosh
parentda482792a6d1a3fbaaa25fae867b343fb4db3246 (diff)
IRQ: Maintain regs pointer globally rather than passing to IRQ handlers
Maintain a per-CPU global "struct pt_regs *" variable which can be used instead of passing regs around manually through all ~1800 interrupt handlers in the Linux kernel. The regs pointer is used in few places, but it potentially costs both stack space and code to pass it around. On the FRV arch, removing the regs parameter from all the genirq function results in a 20% speed up of the IRQ exit path (ie: from leaving timer_interrupt() to leaving do_IRQ()). Where appropriate, an arch may override the generic storage facility and do something different with the variable. On FRV, for instance, the address is maintained in GR28 at all times inside the kernel as part of general exception handling. Having looked over the code, it appears that the parameter may be handed down through up to twenty or so layers of functions. Consider a USB character device attached to a USB hub, attached to a USB controller that posts its interrupts through a cascaded auxiliary interrupt controller. A character device driver may want to pass regs to the sysrq handler through the input layer which adds another few layers of parameter passing. I've build this code with allyesconfig for x86_64 and i386. I've runtested the main part of the code on FRV and i386, though I can't test most of the drivers. I've also done partial conversion for powerpc and MIPS - these at least compile with minimal configurations. This will affect all archs. Mostly the changes should be relatively easy. Take do_IRQ(), store the regs pointer at the beginning, saving the old one: struct pt_regs *old_regs = set_irq_regs(regs); And put the old one back at the end: set_irq_regs(old_regs); Don't pass regs through to generic_handle_irq() or __do_IRQ(). In timer_interrupt(), this sort of change will be necessary: - update_process_times(user_mode(regs)); - profile_tick(CPU_PROFILING, regs); + update_process_times(user_mode(get_irq_regs())); + profile_tick(CPU_PROFILING); I'd like to move update_process_times()'s use of get_irq_regs() into itself, except that i386, alone of the archs, uses something other than user_mode(). Some notes on the interrupt handling in the drivers: (*) input_dev() is now gone entirely. The regs pointer is no longer stored in the input_dev struct. (*) finish_unlinks() in drivers/usb/host/ohci-q.c needs checking. It does something different depending on whether it's been supplied with a regs pointer or not. (*) Various IRQ handler function pointers have been moved to type irq_handler_t. Signed-Off-By: David Howells <dhowells@redhat.com> (cherry picked from 1b16e7ac850969f38b375e511e3fa2f474a33867 commit)
Diffstat (limited to 'drivers/macintosh')
-rw-r--r--drivers/macintosh/adb-iop.c8
-rw-r--r--drivers/macintosh/adb.c10
-rw-r--r--drivers/macintosh/adbhid.c20
-rw-r--r--drivers/macintosh/macio-adb.c7
-rw-r--r--drivers/macintosh/smu.c6
-rw-r--r--drivers/macintosh/via-cuda.c12
-rw-r--r--drivers/macintosh/via-macii.c7
-rw-r--r--drivers/macintosh/via-maciisi.c12
-rw-r--r--drivers/macintosh/via-pmu.c32
-rw-r--r--drivers/macintosh/via-pmu68k.c13
10 files changed, 59 insertions, 68 deletions
diff --git a/drivers/macintosh/adb-iop.c b/drivers/macintosh/adb-iop.c
index d56d400b6aaa..1ffee7aaff20 100644
--- a/drivers/macintosh/adb-iop.c
+++ b/drivers/macintosh/adb-iop.c
@@ -30,7 +30,7 @@
30 30
31/*#define DEBUG_ADB_IOP*/ 31/*#define DEBUG_ADB_IOP*/
32 32
33extern void iop_ism_irq(int, void *, struct pt_regs *); 33extern void iop_ism_irq(int, void *);
34 34
35static struct adb_request *current_req; 35static struct adb_request *current_req;
36static struct adb_request *last_req; 36static struct adb_request *last_req;
@@ -78,7 +78,7 @@ static void adb_iop_end_req(struct adb_request *req, int state)
78 * This will be called when a packet has been successfully sent. 78 * This will be called when a packet has been successfully sent.
79 */ 79 */
80 80
81static void adb_iop_complete(struct iop_msg *msg, struct pt_regs *regs) 81static void adb_iop_complete(struct iop_msg *msg)
82{ 82{
83 struct adb_request *req; 83 struct adb_request *req;
84 uint flags; 84 uint flags;
@@ -100,7 +100,7 @@ static void adb_iop_complete(struct iop_msg *msg, struct pt_regs *regs)
100 * commands or autopoll packets) are received. 100 * commands or autopoll packets) are received.
101 */ 101 */
102 102
103static void adb_iop_listen(struct iop_msg *msg, struct pt_regs *regs) 103static void adb_iop_listen(struct iop_msg *msg)
104{ 104{
105 struct adb_iopmsg *amsg = (struct adb_iopmsg *) msg->message; 105 struct adb_iopmsg *amsg = (struct adb_iopmsg *) msg->message;
106 struct adb_request *req; 106 struct adb_request *req;
@@ -143,7 +143,7 @@ static void adb_iop_listen(struct iop_msg *msg, struct pt_regs *regs)
143 req->reply_len = amsg->count + 1; 143 req->reply_len = amsg->count + 1;
144 memcpy(req->reply, &amsg->cmd, req->reply_len); 144 memcpy(req->reply, &amsg->cmd, req->reply_len);
145 } else { 145 } else {
146 adb_input(&amsg->cmd, amsg->count + 1, regs, 146 adb_input(&amsg->cmd, amsg->count + 1,
147 amsg->flags & ADB_IOP_AUTOPOLL); 147 amsg->flags & ADB_IOP_AUTOPOLL);
148 } 148 }
149 memcpy(msg->reply, msg->message, IOP_MSG_LEN); 149 memcpy(msg->reply, msg->message, IOP_MSG_LEN);
diff --git a/drivers/macintosh/adb.c b/drivers/macintosh/adb.c
index 360f93f6fcdb..be0bd34ff6f9 100644
--- a/drivers/macintosh/adb.c
+++ b/drivers/macintosh/adb.c
@@ -103,7 +103,7 @@ static void adbdev_init(void);
103static int try_handler_change(int, int); 103static int try_handler_change(int, int);
104 104
105static struct adb_handler { 105static struct adb_handler {
106 void (*handler)(unsigned char *, int, struct pt_regs *, int); 106 void (*handler)(unsigned char *, int, int);
107 int original_address; 107 int original_address;
108 int handler_id; 108 int handler_id;
109 int busy; 109 int busy;
@@ -522,7 +522,7 @@ bail:
522 the handler_id id it doesn't match. */ 522 the handler_id id it doesn't match. */
523int 523int
524adb_register(int default_id, int handler_id, struct adb_ids *ids, 524adb_register(int default_id, int handler_id, struct adb_ids *ids,
525 void (*handler)(unsigned char *, int, struct pt_regs *, int)) 525 void (*handler)(unsigned char *, int, int))
526{ 526{
527 int i; 527 int i;
528 528
@@ -570,13 +570,13 @@ adb_unregister(int index)
570} 570}
571 571
572void 572void
573adb_input(unsigned char *buf, int nb, struct pt_regs *regs, int autopoll) 573adb_input(unsigned char *buf, int nb, int autopoll)
574{ 574{
575 int i, id; 575 int i, id;
576 static int dump_adb_input = 0; 576 static int dump_adb_input = 0;
577 unsigned long flags; 577 unsigned long flags;
578 578
579 void (*handler)(unsigned char *, int, struct pt_regs *, int); 579 void (*handler)(unsigned char *, int, int);
580 580
581 /* We skip keystrokes and mouse moves when the sleep process 581 /* We skip keystrokes and mouse moves when the sleep process
582 * has been started. We stop autopoll, but this is another security 582 * has been started. We stop autopoll, but this is another security
@@ -597,7 +597,7 @@ adb_input(unsigned char *buf, int nb, struct pt_regs *regs, int autopoll)
597 adb_handler[id].busy = 1; 597 adb_handler[id].busy = 1;
598 write_unlock_irqrestore(&adb_handler_lock, flags); 598 write_unlock_irqrestore(&adb_handler_lock, flags);
599 if (handler != NULL) { 599 if (handler != NULL) {
600 (*handler)(buf, nb, regs, autopoll); 600 (*handler)(buf, nb, autopoll);
601 wmb(); 601 wmb();
602 adb_handler[id].busy = 0; 602 adb_handler[id].busy = 0;
603 } 603 }
diff --git a/drivers/macintosh/adbhid.c b/drivers/macintosh/adbhid.c
index b7fb367808d8..5066e7a8ea9c 100644
--- a/drivers/macintosh/adbhid.c
+++ b/drivers/macintosh/adbhid.c
@@ -222,7 +222,7 @@ static struct adbhid *adbhid[16];
222 222
223static void adbhid_probe(void); 223static void adbhid_probe(void);
224 224
225static void adbhid_input_keycode(int, int, int, struct pt_regs *); 225static void adbhid_input_keycode(int, int, int);
226 226
227static void init_trackpad(int id); 227static void init_trackpad(int id);
228static void init_trackball(int id); 228static void init_trackball(int id);
@@ -253,7 +253,7 @@ static struct adb_ids buttons_ids;
253#define ADBMOUSE_MACALLY2 9 /* MacAlly 2-button mouse */ 253#define ADBMOUSE_MACALLY2 9 /* MacAlly 2-button mouse */
254 254
255static void 255static void
256adbhid_keyboard_input(unsigned char *data, int nb, struct pt_regs *regs, int apoll) 256adbhid_keyboard_input(unsigned char *data, int nb, int apoll)
257{ 257{
258 int id = (data[0] >> 4) & 0x0f; 258 int id = (data[0] >> 4) & 0x0f;
259 259
@@ -266,13 +266,13 @@ adbhid_keyboard_input(unsigned char *data, int nb, struct pt_regs *regs, int apo
266 /* first check this is from register 0 */ 266 /* first check this is from register 0 */
267 if (nb != 3 || (data[0] & 3) != KEYB_KEYREG) 267 if (nb != 3 || (data[0] & 3) != KEYB_KEYREG)
268 return; /* ignore it */ 268 return; /* ignore it */
269 adbhid_input_keycode(id, data[1], 0, regs); 269 adbhid_input_keycode(id, data[1], 0);
270 if (!(data[2] == 0xff || (data[2] == 0x7f && data[1] == 0x7f))) 270 if (!(data[2] == 0xff || (data[2] == 0x7f && data[1] == 0x7f)))
271 adbhid_input_keycode(id, data[2], 0, regs); 271 adbhid_input_keycode(id, data[2], 0);
272} 272}
273 273
274static void 274static void
275adbhid_input_keycode(int id, int keycode, int repeat, struct pt_regs *regs) 275adbhid_input_keycode(int id, int keycode, int repeat)
276{ 276{
277 struct adbhid *ahid = adbhid[id]; 277 struct adbhid *ahid = adbhid[id];
278 int up_flag; 278 int up_flag;
@@ -282,7 +282,6 @@ adbhid_input_keycode(int id, int keycode, int repeat, struct pt_regs *regs)
282 282
283 switch (keycode) { 283 switch (keycode) {
284 case ADB_KEY_CAPSLOCK: /* Generate down/up events for CapsLock everytime. */ 284 case ADB_KEY_CAPSLOCK: /* Generate down/up events for CapsLock everytime. */
285 input_regs(ahid->input, regs);
286 input_report_key(ahid->input, KEY_CAPSLOCK, 1); 285 input_report_key(ahid->input, KEY_CAPSLOCK, 1);
287 input_report_key(ahid->input, KEY_CAPSLOCK, 0); 286 input_report_key(ahid->input, KEY_CAPSLOCK, 0);
288 input_sync(ahid->input); 287 input_sync(ahid->input);
@@ -338,7 +337,6 @@ adbhid_input_keycode(int id, int keycode, int repeat, struct pt_regs *regs)
338 } 337 }
339 338
340 if (adbhid[id]->keycode[keycode]) { 339 if (adbhid[id]->keycode[keycode]) {
341 input_regs(adbhid[id]->input, regs);
342 input_report_key(adbhid[id]->input, 340 input_report_key(adbhid[id]->input,
343 adbhid[id]->keycode[keycode], !up_flag); 341 adbhid[id]->keycode[keycode], !up_flag);
344 input_sync(adbhid[id]->input); 342 input_sync(adbhid[id]->input);
@@ -349,7 +347,7 @@ adbhid_input_keycode(int id, int keycode, int repeat, struct pt_regs *regs)
349} 347}
350 348
351static void 349static void
352adbhid_mouse_input(unsigned char *data, int nb, struct pt_regs *regs, int autopoll) 350adbhid_mouse_input(unsigned char *data, int nb, int autopoll)
353{ 351{
354 int id = (data[0] >> 4) & 0x0f; 352 int id = (data[0] >> 4) & 0x0f;
355 353
@@ -432,8 +430,6 @@ adbhid_mouse_input(unsigned char *data, int nb, struct pt_regs *regs, int autopo
432 break; 430 break;
433 } 431 }
434 432
435 input_regs(adbhid[id]->input, regs);
436
437 input_report_key(adbhid[id]->input, BTN_LEFT, !((data[1] >> 7) & 1)); 433 input_report_key(adbhid[id]->input, BTN_LEFT, !((data[1] >> 7) & 1));
438 input_report_key(adbhid[id]->input, BTN_MIDDLE, !((data[2] >> 7) & 1)); 434 input_report_key(adbhid[id]->input, BTN_MIDDLE, !((data[2] >> 7) & 1));
439 435
@@ -449,7 +445,7 @@ adbhid_mouse_input(unsigned char *data, int nb, struct pt_regs *regs, int autopo
449} 445}
450 446
451static void 447static void
452adbhid_buttons_input(unsigned char *data, int nb, struct pt_regs *regs, int autopoll) 448adbhid_buttons_input(unsigned char *data, int nb, int autopoll)
453{ 449{
454 int id = (data[0] >> 4) & 0x0f; 450 int id = (data[0] >> 4) & 0x0f;
455 451
@@ -458,8 +454,6 @@ adbhid_buttons_input(unsigned char *data, int nb, struct pt_regs *regs, int auto
458 return; 454 return;
459 } 455 }
460 456
461 input_regs(adbhid[id]->input, regs);
462
463 switch (adbhid[id]->original_handler_id) { 457 switch (adbhid[id]->original_handler_id) {
464 default: 458 default:
465 case 0x02: /* Adjustable keyboard button device */ 459 case 0x02: /* Adjustable keyboard button device */
diff --git a/drivers/macintosh/macio-adb.c b/drivers/macintosh/macio-adb.c
index 4b08852c35ee..57ccc19cbdbf 100644
--- a/drivers/macintosh/macio-adb.c
+++ b/drivers/macintosh/macio-adb.c
@@ -64,7 +64,7 @@ static DEFINE_SPINLOCK(macio_lock);
64 64
65static int macio_probe(void); 65static int macio_probe(void);
66static int macio_init(void); 66static int macio_init(void);
67static irqreturn_t macio_adb_interrupt(int irq, void *arg, struct pt_regs *regs); 67static irqreturn_t macio_adb_interrupt(int irq, void *arg);
68static int macio_send_request(struct adb_request *req, int sync); 68static int macio_send_request(struct adb_request *req, int sync);
69static int macio_adb_autopoll(int devs); 69static int macio_adb_autopoll(int devs);
70static void macio_adb_poll(void); 70static void macio_adb_poll(void);
@@ -189,8 +189,7 @@ static int macio_send_request(struct adb_request *req, int sync)
189 return 0; 189 return 0;
190} 190}
191 191
192static irqreturn_t macio_adb_interrupt(int irq, void *arg, 192static irqreturn_t macio_adb_interrupt(int irq, void *arg)
193 struct pt_regs *regs)
194{ 193{
195 int i, n, err; 194 int i, n, err;
196 struct adb_request *req = NULL; 195 struct adb_request *req = NULL;
@@ -260,7 +259,7 @@ static irqreturn_t macio_adb_interrupt(int irq, void *arg,
260 (*done)(req); 259 (*done)(req);
261 } 260 }
262 if (ibuf_len) 261 if (ibuf_len)
263 adb_input(ibuf, ibuf_len, regs, autopoll); 262 adb_input(ibuf, ibuf_len, autopoll);
264 263
265 return IRQ_RETVAL(handled); 264 return IRQ_RETVAL(handled);
266} 265}
diff --git a/drivers/macintosh/smu.c b/drivers/macintosh/smu.c
index c0f9d82e4662..ade25b3fbb35 100644
--- a/drivers/macintosh/smu.c
+++ b/drivers/macintosh/smu.c
@@ -145,7 +145,7 @@ static void smu_start_cmd(void)
145} 145}
146 146
147 147
148static irqreturn_t smu_db_intr(int irq, void *arg, struct pt_regs *regs) 148static irqreturn_t smu_db_intr(int irq, void *arg)
149{ 149{
150 unsigned long flags; 150 unsigned long flags;
151 struct smu_cmd *cmd; 151 struct smu_cmd *cmd;
@@ -224,7 +224,7 @@ static irqreturn_t smu_db_intr(int irq, void *arg, struct pt_regs *regs)
224} 224}
225 225
226 226
227static irqreturn_t smu_msg_intr(int irq, void *arg, struct pt_regs *regs) 227static irqreturn_t smu_msg_intr(int irq, void *arg)
228{ 228{
229 /* I don't quite know what to do with this one, we seem to never 229 /* I don't quite know what to do with this one, we seem to never
230 * receive it, so I suspect we have to arm it someway in the SMU 230 * receive it, so I suspect we have to arm it someway in the SMU
@@ -309,7 +309,7 @@ void smu_poll(void)
309 309
310 gpio = pmac_do_feature_call(PMAC_FTR_READ_GPIO, NULL, smu->doorbell); 310 gpio = pmac_do_feature_call(PMAC_FTR_READ_GPIO, NULL, smu->doorbell);
311 if ((gpio & 7) == 7) 311 if ((gpio & 7) == 7)
312 smu_db_intr(smu->db_irq, smu, NULL); 312 smu_db_intr(smu->db_irq, smu);
313} 313}
314EXPORT_SYMBOL(smu_poll); 314EXPORT_SYMBOL(smu_poll);
315 315
diff --git a/drivers/macintosh/via-cuda.c b/drivers/macintosh/via-cuda.c
index 7512d1c15207..64a07ccfe369 100644
--- a/drivers/macintosh/via-cuda.c
+++ b/drivers/macintosh/via-cuda.c
@@ -98,8 +98,8 @@ static int cuda_reset_adb_bus(void);
98 98
99static int cuda_init_via(void); 99static int cuda_init_via(void);
100static void cuda_start(void); 100static void cuda_start(void);
101static irqreturn_t cuda_interrupt(int irq, void *arg, struct pt_regs *regs); 101static irqreturn_t cuda_interrupt(int irq, void *arg);
102static void cuda_input(unsigned char *buf, int nb, struct pt_regs *regs); 102static void cuda_input(unsigned char *buf, int nb);
103void cuda_poll(void); 103void cuda_poll(void);
104static int cuda_write(struct adb_request *req); 104static int cuda_write(struct adb_request *req);
105 105
@@ -442,7 +442,7 @@ cuda_poll(void)
442} 442}
443 443
444static irqreturn_t 444static irqreturn_t
445cuda_interrupt(int irq, void *arg, struct pt_regs *regs) 445cuda_interrupt(int irq, void *arg)
446{ 446{
447 int status; 447 int status;
448 struct adb_request *req = NULL; 448 struct adb_request *req = NULL;
@@ -594,12 +594,12 @@ cuda_interrupt(int irq, void *arg, struct pt_regs *regs)
594 (*done)(req); 594 (*done)(req);
595 } 595 }
596 if (ibuf_len) 596 if (ibuf_len)
597 cuda_input(ibuf, ibuf_len, regs); 597 cuda_input(ibuf, ibuf_len);
598 return IRQ_HANDLED; 598 return IRQ_HANDLED;
599} 599}
600 600
601static void 601static void
602cuda_input(unsigned char *buf, int nb, struct pt_regs *regs) 602cuda_input(unsigned char *buf, int nb)
603{ 603{
604 int i; 604 int i;
605 605
@@ -615,7 +615,7 @@ cuda_input(unsigned char *buf, int nb, struct pt_regs *regs)
615 } 615 }
616#endif /* CONFIG_XMON */ 616#endif /* CONFIG_XMON */
617#ifdef CONFIG_ADB 617#ifdef CONFIG_ADB
618 adb_input(buf+2, nb-2, regs, buf[1] & 0x40); 618 adb_input(buf+2, nb-2, buf[1] & 0x40);
619#endif /* CONFIG_ADB */ 619#endif /* CONFIG_ADB */
620 break; 620 break;
621 621
diff --git a/drivers/macintosh/via-macii.c b/drivers/macintosh/via-macii.c
index 2a2ffe060169..ad4bd579f610 100644
--- a/drivers/macintosh/via-macii.c
+++ b/drivers/macintosh/via-macii.c
@@ -77,7 +77,7 @@ static volatile unsigned char *via;
77 77
78static int macii_init_via(void); 78static int macii_init_via(void);
79static void macii_start(void); 79static void macii_start(void);
80static irqreturn_t macii_interrupt(int irq, void *arg, struct pt_regs *regs); 80static irqreturn_t macii_interrupt(int irq, void *arg);
81static void macii_retransmit(int); 81static void macii_retransmit(int);
82static void macii_queue_poll(void); 82static void macii_queue_poll(void);
83 83
@@ -410,7 +410,7 @@ static void macii_start(void)
410 * Note: As of 21/10/97, the MacII ADB part works including timeout detection 410 * Note: As of 21/10/97, the MacII ADB part works including timeout detection
411 * and retransmit (Talk to the last active device). 411 * and retransmit (Talk to the last active device).
412 */ 412 */
413static irqreturn_t macii_interrupt(int irq, void *arg, struct pt_regs *regs) 413static irqreturn_t macii_interrupt(int irq, void *arg)
414{ 414{
415 int x, adbdir; 415 int x, adbdir;
416 unsigned long flags; 416 unsigned long flags;
@@ -602,8 +602,7 @@ static irqreturn_t macii_interrupt(int irq, void *arg, struct pt_regs *regs)
602 current_req = req->next; 602 current_req = req->next;
603 if (req->done) (*req->done)(req); 603 if (req->done) (*req->done)(req);
604 } else { 604 } else {
605 adb_input(reply_buf, reply_ptr - reply_buf, 605 adb_input(reply_buf, reply_ptr - reply_buf, 0);
606 regs, 0);
607 } 606 }
608 607
609 /* 608 /*
diff --git a/drivers/macintosh/via-maciisi.c b/drivers/macintosh/via-maciisi.c
index 0129fcc3b183..789ee52086fe 100644
--- a/drivers/macintosh/via-maciisi.c
+++ b/drivers/macintosh/via-maciisi.c
@@ -84,8 +84,8 @@ static int maciisi_init(void);
84static int maciisi_send_request(struct adb_request* req, int sync); 84static int maciisi_send_request(struct adb_request* req, int sync);
85static void maciisi_sync(struct adb_request *req); 85static void maciisi_sync(struct adb_request *req);
86static int maciisi_write(struct adb_request* req); 86static int maciisi_write(struct adb_request* req);
87static irqreturn_t maciisi_interrupt(int irq, void* arg, struct pt_regs* regs); 87static irqreturn_t maciisi_interrupt(int irq, void* arg);
88static void maciisi_input(unsigned char *buf, int nb, struct pt_regs *regs); 88static void maciisi_input(unsigned char *buf, int nb);
89static int maciisi_init_via(void); 89static int maciisi_init_via(void);
90static void maciisi_poll(void); 90static void maciisi_poll(void);
91static int maciisi_start(void); 91static int maciisi_start(void);
@@ -433,7 +433,7 @@ maciisi_poll(void)
433 register is either full or empty. In practice, I have no idea what 433 register is either full or empty. In practice, I have no idea what
434 it means :( */ 434 it means :( */
435static irqreturn_t 435static irqreturn_t
436maciisi_interrupt(int irq, void* arg, struct pt_regs* regs) 436maciisi_interrupt(int irq, void* arg)
437{ 437{
438 int status; 438 int status;
439 struct adb_request *req; 439 struct adb_request *req;
@@ -612,7 +612,7 @@ maciisi_interrupt(int irq, void* arg, struct pt_regs* regs)
612 /* Obviously, we got it */ 612 /* Obviously, we got it */
613 reading_reply = 0; 613 reading_reply = 0;
614 } else { 614 } else {
615 maciisi_input(maciisi_rbuf, reply_ptr - maciisi_rbuf, regs); 615 maciisi_input(maciisi_rbuf, reply_ptr - maciisi_rbuf);
616 } 616 }
617 maciisi_state = idle; 617 maciisi_state = idle;
618 status = via[B] & (TIP|TREQ); 618 status = via[B] & (TIP|TREQ);
@@ -657,7 +657,7 @@ maciisi_interrupt(int irq, void* arg, struct pt_regs* regs)
657} 657}
658 658
659static void 659static void
660maciisi_input(unsigned char *buf, int nb, struct pt_regs *regs) 660maciisi_input(unsigned char *buf, int nb)
661{ 661{
662#ifdef DEBUG_MACIISI_ADB 662#ifdef DEBUG_MACIISI_ADB
663 int i; 663 int i;
@@ -665,7 +665,7 @@ maciisi_input(unsigned char *buf, int nb, struct pt_regs *regs)
665 665
666 switch (buf[0]) { 666 switch (buf[0]) {
667 case ADB_PACKET: 667 case ADB_PACKET:
668 adb_input(buf+2, nb-2, regs, buf[1] & 0x40); 668 adb_input(buf+2, nb-2, buf[1] & 0x40);
669 break; 669 break;
670 default: 670 default:
671#ifdef DEBUG_MACIISI_ADB 671#ifdef DEBUG_MACIISI_ADB
diff --git a/drivers/macintosh/via-pmu.c b/drivers/macintosh/via-pmu.c
index 4f04fd0956a0..e63ea1c1f3c1 100644
--- a/drivers/macintosh/via-pmu.c
+++ b/drivers/macintosh/via-pmu.c
@@ -191,8 +191,8 @@ static int pmu_adb_reset_bus(void);
191 191
192static int init_pmu(void); 192static int init_pmu(void);
193static void pmu_start(void); 193static void pmu_start(void);
194static irqreturn_t via_pmu_interrupt(int irq, void *arg, struct pt_regs *regs); 194static irqreturn_t via_pmu_interrupt(int irq, void *arg);
195static irqreturn_t gpio1_interrupt(int irq, void *arg, struct pt_regs *regs); 195static irqreturn_t gpio1_interrupt(int irq, void *arg);
196static int proc_get_info(char *page, char **start, off_t off, 196static int proc_get_info(char *page, char **start, off_t off,
197 int count, int *eof, void *data); 197 int count, int *eof, void *data);
198static int proc_get_irqstats(char *page, char **start, off_t off, 198static int proc_get_irqstats(char *page, char **start, off_t off,
@@ -555,7 +555,7 @@ init_pmu(void)
555 } 555 }
556 if (pmu_state == idle) 556 if (pmu_state == idle)
557 adb_int_pending = 1; 557 adb_int_pending = 1;
558 via_pmu_interrupt(0, NULL, NULL); 558 via_pmu_interrupt(0, NULL);
559 udelay(10); 559 udelay(10);
560 } 560 }
561 561
@@ -1215,7 +1215,7 @@ pmu_poll(void)
1215 return; 1215 return;
1216 if (disable_poll) 1216 if (disable_poll)
1217 return; 1217 return;
1218 via_pmu_interrupt(0, NULL, NULL); 1218 via_pmu_interrupt(0, NULL);
1219} 1219}
1220 1220
1221void 1221void
@@ -1228,7 +1228,7 @@ pmu_poll_adb(void)
1228 /* Kicks ADB read when PMU is suspended */ 1228 /* Kicks ADB read when PMU is suspended */
1229 adb_int_pending = 1; 1229 adb_int_pending = 1;
1230 do { 1230 do {
1231 via_pmu_interrupt(0, NULL, NULL); 1231 via_pmu_interrupt(0, NULL);
1232 } while (pmu_suspended && (adb_int_pending || pmu_state != idle 1232 } while (pmu_suspended && (adb_int_pending || pmu_state != idle
1233 || req_awaiting_reply)); 1233 || req_awaiting_reply));
1234} 1234}
@@ -1239,7 +1239,7 @@ pmu_wait_complete(struct adb_request *req)
1239 if (!via) 1239 if (!via)
1240 return; 1240 return;
1241 while((pmu_state != idle && pmu_state != locked) || !req->complete) 1241 while((pmu_state != idle && pmu_state != locked) || !req->complete)
1242 via_pmu_interrupt(0, NULL, NULL); 1242 via_pmu_interrupt(0, NULL);
1243} 1243}
1244 1244
1245/* This function loops until the PMU is idle and prevents it from 1245/* This function loops until the PMU is idle and prevents it from
@@ -1268,7 +1268,7 @@ pmu_suspend(void)
1268 spin_unlock_irqrestore(&pmu_lock, flags); 1268 spin_unlock_irqrestore(&pmu_lock, flags);
1269 if (req_awaiting_reply) 1269 if (req_awaiting_reply)
1270 adb_int_pending = 1; 1270 adb_int_pending = 1;
1271 via_pmu_interrupt(0, NULL, NULL); 1271 via_pmu_interrupt(0, NULL);
1272 spin_lock_irqsave(&pmu_lock, flags); 1272 spin_lock_irqsave(&pmu_lock, flags);
1273 if (!adb_int_pending && pmu_state == idle && !req_awaiting_reply) { 1273 if (!adb_int_pending && pmu_state == idle && !req_awaiting_reply) {
1274#ifdef SUSPEND_USES_PMU 1274#ifdef SUSPEND_USES_PMU
@@ -1318,7 +1318,7 @@ pmu_resume(void)
1318 1318
1319/* Interrupt data could be the result data from an ADB cmd */ 1319/* Interrupt data could be the result data from an ADB cmd */
1320static void 1320static void
1321pmu_handle_data(unsigned char *data, int len, struct pt_regs *regs) 1321pmu_handle_data(unsigned char *data, int len)
1322{ 1322{
1323 unsigned char ints, pirq; 1323 unsigned char ints, pirq;
1324 int i = 0; 1324 int i = 0;
@@ -1393,7 +1393,7 @@ next:
1393 if (!(pmu_kind == PMU_OHARE_BASED && len == 4 1393 if (!(pmu_kind == PMU_OHARE_BASED && len == 4
1394 && data[1] == 0x2c && data[3] == 0xff 1394 && data[1] == 0x2c && data[3] == 0xff
1395 && (data[2] & ~1) == 0xf4)) 1395 && (data[2] & ~1) == 0xf4))
1396 adb_input(data+1, len-1, regs, 1); 1396 adb_input(data+1, len-1, 1);
1397#endif /* CONFIG_ADB */ 1397#endif /* CONFIG_ADB */
1398 } 1398 }
1399 } 1399 }
@@ -1431,7 +1431,7 @@ next:
1431} 1431}
1432 1432
1433static struct adb_request* 1433static struct adb_request*
1434pmu_sr_intr(struct pt_regs *regs) 1434pmu_sr_intr(void)
1435{ 1435{
1436 struct adb_request *req; 1436 struct adb_request *req;
1437 int bite = 0; 1437 int bite = 0;
@@ -1537,7 +1537,7 @@ pmu_sr_intr(struct pt_regs *regs)
1537} 1537}
1538 1538
1539static irqreturn_t 1539static irqreturn_t
1540via_pmu_interrupt(int irq, void *arg, struct pt_regs *regs) 1540via_pmu_interrupt(int irq, void *arg)
1541{ 1541{
1542 unsigned long flags; 1542 unsigned long flags;
1543 int intr; 1543 int intr;
@@ -1567,7 +1567,7 @@ via_pmu_interrupt(int irq, void *arg, struct pt_regs *regs)
1567 pmu_irq_stats[0]++; 1567 pmu_irq_stats[0]++;
1568 } 1568 }
1569 if (intr & SR_INT) { 1569 if (intr & SR_INT) {
1570 req = pmu_sr_intr(regs); 1570 req = pmu_sr_intr();
1571 if (req) 1571 if (req)
1572 break; 1572 break;
1573 } 1573 }
@@ -1613,7 +1613,7 @@ no_free_slot:
1613 1613
1614 /* Deal with interrupt datas outside of the lock */ 1614 /* Deal with interrupt datas outside of the lock */
1615 if (int_data >= 0) { 1615 if (int_data >= 0) {
1616 pmu_handle_data(interrupt_data[int_data], interrupt_data_len[int_data], regs); 1616 pmu_handle_data(interrupt_data[int_data], interrupt_data_len[int_data]);
1617 spin_lock_irqsave(&pmu_lock, flags); 1617 spin_lock_irqsave(&pmu_lock, flags);
1618 ++disable_poll; 1618 ++disable_poll;
1619 int_data_state[int_data] = int_data_empty; 1619 int_data_state[int_data] = int_data_empty;
@@ -1638,7 +1638,7 @@ pmu_unlock(void)
1638 1638
1639 1639
1640static irqreturn_t 1640static irqreturn_t
1641gpio1_interrupt(int irq, void *arg, struct pt_regs *regs) 1641gpio1_interrupt(int irq, void *arg)
1642{ 1642{
1643 unsigned long flags; 1643 unsigned long flags;
1644 1644
@@ -1651,7 +1651,7 @@ gpio1_interrupt(int irq, void *arg, struct pt_regs *regs)
1651 pmu_irq_stats[1]++; 1651 pmu_irq_stats[1]++;
1652 adb_int_pending = 1; 1652 adb_int_pending = 1;
1653 spin_unlock_irqrestore(&pmu_lock, flags); 1653 spin_unlock_irqrestore(&pmu_lock, flags);
1654 via_pmu_interrupt(0, NULL, NULL); 1654 via_pmu_interrupt(0, NULL);
1655 return IRQ_HANDLED; 1655 return IRQ_HANDLED;
1656 } 1656 }
1657 return IRQ_NONE; 1657 return IRQ_NONE;
@@ -2116,7 +2116,7 @@ pmac_wakeup_devices(void)
2116 2116
2117 /* Force a poll of ADB interrupts */ 2117 /* Force a poll of ADB interrupts */
2118 adb_int_pending = 1; 2118 adb_int_pending = 1;
2119 via_pmu_interrupt(0, NULL, NULL); 2119 via_pmu_interrupt(0, NULL);
2120 2120
2121 /* Restart jiffies & scheduling */ 2121 /* Restart jiffies & scheduling */
2122 wakeup_decrementer(); 2122 wakeup_decrementer();
diff --git a/drivers/macintosh/via-pmu68k.c b/drivers/macintosh/via-pmu68k.c
index 9f4eff1d1a0f..98ec915d0409 100644
--- a/drivers/macintosh/via-pmu68k.c
+++ b/drivers/macintosh/via-pmu68k.c
@@ -107,7 +107,7 @@ BLOCKING_NOTIFIER_HEAD(sleep_notifier_list);
107static int pmu_probe(void); 107static int pmu_probe(void);
108static int pmu_init(void); 108static int pmu_init(void);
109static void pmu_start(void); 109static void pmu_start(void);
110static irqreturn_t pmu_interrupt(int irq, void *arg, struct pt_regs *regs); 110static irqreturn_t pmu_interrupt(int irq, void *arg);
111static int pmu_send_request(struct adb_request *req, int sync); 111static int pmu_send_request(struct adb_request *req, int sync);
112static int pmu_autopoll(int devs); 112static int pmu_autopoll(int devs);
113void pmu_poll(void); 113void pmu_poll(void);
@@ -118,8 +118,7 @@ static void pmu_start(void);
118static void send_byte(int x); 118static void send_byte(int x);
119static void recv_byte(void); 119static void recv_byte(void);
120static void pmu_done(struct adb_request *req); 120static void pmu_done(struct adb_request *req);
121static void pmu_handle_data(unsigned char *data, int len, 121static void pmu_handle_data(unsigned char *data, int len);
122 struct pt_regs *regs);
123static void set_volume(int level); 122static void set_volume(int level);
124static void pmu_enable_backlight(int on); 123static void pmu_enable_backlight(int on);
125static void pmu_set_brightness(int level); 124static void pmu_set_brightness(int level);
@@ -573,7 +572,7 @@ pmu_poll(void)
573} 572}
574 573
575static irqreturn_t 574static irqreturn_t
576pmu_interrupt(int irq, void *dev_id, struct pt_regs *regs) 575pmu_interrupt(int irq, void *dev_id)
577{ 576{
578 struct adb_request *req; 577 struct adb_request *req;
579 int timeout, bite = 0; /* to prevent compiler warning */ 578 int timeout, bite = 0; /* to prevent compiler warning */
@@ -657,7 +656,7 @@ pmu_interrupt(int irq, void *dev_id, struct pt_regs *regs)
657 } 656 }
658 657
659 if (pmu_state == reading_intr) { 658 if (pmu_state == reading_intr) {
660 pmu_handle_data(interrupt_data, data_index, regs); 659 pmu_handle_data(interrupt_data, data_index);
661 } else { 660 } else {
662 req = current_req; 661 req = current_req;
663 current_req = req->next; 662 current_req = req->next;
@@ -701,7 +700,7 @@ pmu_done(struct adb_request *req)
701 700
702/* Interrupt data could be the result data from an ADB cmd */ 701/* Interrupt data could be the result data from an ADB cmd */
703static void 702static void
704pmu_handle_data(unsigned char *data, int len, struct pt_regs *regs) 703pmu_handle_data(unsigned char *data, int len)
705{ 704{
706 static int show_pmu_ints = 1; 705 static int show_pmu_ints = 1;
707 706
@@ -726,7 +725,7 @@ pmu_handle_data(unsigned char *data, int len, struct pt_regs *regs)
726 } 725 }
727 pmu_done(req); 726 pmu_done(req);
728 } else { 727 } else {
729 adb_input(data+1, len-1, regs, 1); 728 adb_input(data+1, len-1, 1);
730 } 729 }
731 } else { 730 } else {
732 if (data[0] == 0x08 && len == 3) { 731 if (data[0] == 0x08 && len == 3) {