aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/input/ati_remote.c
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/usb/input/ati_remote.c
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/usb/input/ati_remote.c')
-rw-r--r--drivers/usb/input/ati_remote.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/drivers/usb/input/ati_remote.c b/drivers/usb/input/ati_remote.c
index 3558d7ed99b9..f659f3028ad2 100644
--- a/drivers/usb/input/ati_remote.c
+++ b/drivers/usb/input/ati_remote.c
@@ -283,9 +283,9 @@ static void ati_remote_dump (unsigned char *data, unsigned int actual_length);
283static int ati_remote_open (struct input_dev *inputdev); 283static int ati_remote_open (struct input_dev *inputdev);
284static void ati_remote_close (struct input_dev *inputdev); 284static void ati_remote_close (struct input_dev *inputdev);
285static int ati_remote_sendpacket (struct ati_remote *ati_remote, u16 cmd, unsigned char *data); 285static int ati_remote_sendpacket (struct ati_remote *ati_remote, u16 cmd, unsigned char *data);
286static void ati_remote_irq_out (struct urb *urb, struct pt_regs *regs); 286static void ati_remote_irq_out (struct urb *urb);
287static void ati_remote_irq_in (struct urb *urb, struct pt_regs *regs); 287static void ati_remote_irq_in (struct urb *urb);
288static void ati_remote_input_report (struct urb *urb, struct pt_regs *regs); 288static void ati_remote_input_report (struct urb *urb);
289static int ati_remote_initialize (struct ati_remote *ati_remote); 289static int ati_remote_initialize (struct ati_remote *ati_remote);
290static int ati_remote_probe (struct usb_interface *interface, const struct usb_device_id *id); 290static int ati_remote_probe (struct usb_interface *interface, const struct usb_device_id *id);
291static void ati_remote_disconnect (struct usb_interface *interface); 291static void ati_remote_disconnect (struct usb_interface *interface);
@@ -344,7 +344,7 @@ static void ati_remote_close(struct input_dev *inputdev)
344/* 344/*
345 * ati_remote_irq_out 345 * ati_remote_irq_out
346 */ 346 */
347static void ati_remote_irq_out(struct urb *urb, struct pt_regs *regs) 347static void ati_remote_irq_out(struct urb *urb)
348{ 348{
349 struct ati_remote *ati_remote = urb->context; 349 struct ati_remote *ati_remote = urb->context;
350 350
@@ -453,7 +453,7 @@ static int ati_remote_compute_accel(struct ati_remote *ati_remote)
453/* 453/*
454 * ati_remote_report_input 454 * ati_remote_report_input
455 */ 455 */
456static void ati_remote_input_report(struct urb *urb, struct pt_regs *regs) 456static void ati_remote_input_report(struct urb *urb)
457{ 457{
458 struct ati_remote *ati_remote = urb->context; 458 struct ati_remote *ati_remote = urb->context;
459 unsigned char *data= ati_remote->inbuf; 459 unsigned char *data= ati_remote->inbuf;
@@ -491,7 +491,6 @@ static void ati_remote_input_report(struct urb *urb, struct pt_regs *regs)
491 remote_num, data[1], data[2], index, ati_remote_tbl[index].code); 491 remote_num, data[1], data[2], index, ati_remote_tbl[index].code);
492 492
493 if (ati_remote_tbl[index].kind == KIND_LITERAL) { 493 if (ati_remote_tbl[index].kind == KIND_LITERAL) {
494 input_regs(dev, regs);
495 input_event(dev, ati_remote_tbl[index].type, 494 input_event(dev, ati_remote_tbl[index].type,
496 ati_remote_tbl[index].code, 495 ati_remote_tbl[index].code,
497 ati_remote_tbl[index].value); 496 ati_remote_tbl[index].value);
@@ -520,7 +519,6 @@ static void ati_remote_input_report(struct urb *urb, struct pt_regs *regs)
520 return; 519 return;
521 520
522 521
523 input_regs(dev, regs);
524 input_event(dev, ati_remote_tbl[index].type, 522 input_event(dev, ati_remote_tbl[index].type,
525 ati_remote_tbl[index].code, 1); 523 ati_remote_tbl[index].code, 1);
526 input_sync(dev); 524 input_sync(dev);
@@ -537,7 +535,6 @@ static void ati_remote_input_report(struct urb *urb, struct pt_regs *regs)
537 */ 535 */
538 acc = ati_remote_compute_accel(ati_remote); 536 acc = ati_remote_compute_accel(ati_remote);
539 537
540 input_regs(dev, regs);
541 switch (ati_remote_tbl[index].kind) { 538 switch (ati_remote_tbl[index].kind) {
542 case KIND_ACCEL: 539 case KIND_ACCEL:
543 input_event(dev, ati_remote_tbl[index].type, 540 input_event(dev, ati_remote_tbl[index].type,
@@ -575,14 +572,14 @@ static void ati_remote_input_report(struct urb *urb, struct pt_regs *regs)
575/* 572/*
576 * ati_remote_irq_in 573 * ati_remote_irq_in
577 */ 574 */
578static void ati_remote_irq_in(struct urb *urb, struct pt_regs *regs) 575static void ati_remote_irq_in(struct urb *urb)
579{ 576{
580 struct ati_remote *ati_remote = urb->context; 577 struct ati_remote *ati_remote = urb->context;
581 int retval; 578 int retval;
582 579
583 switch (urb->status) { 580 switch (urb->status) {
584 case 0: /* success */ 581 case 0: /* success */
585 ati_remote_input_report(urb, regs); 582 ati_remote_input_report(urb);
586 break; 583 break;
587 case -ECONNRESET: /* unlink */ 584 case -ECONNRESET: /* unlink */
588 case -ENOENT: 585 case -ENOENT: