diff options
author | Helge Deller <deller@gmx.de> | 2007-02-28 23:51:19 -0500 |
---|---|---|
committer | Dmitry Torokhov <dtor@insightbb.com> | 2007-02-28 23:51:19 -0500 |
commit | 3acaf540a33199141695f2e2fcfa8829053159bf (patch) | |
tree | 8cc083df919078ec15665cfc34bc977f6996e939 /drivers/input/serio | |
parent | 969111e900226a8dbd1f596f34c09eecd20afc7d (diff) |
Input: HIL - various fixes for HIL drivers
- mark some structures const or __read_mostly
- hilkbd.c: fix uninitialized spinlock in HIL keyboard driver
- hil_mlc.c: use USEC_PER_SEC instead of 1000000
- hp_sdc: bugfix for request_irq()/free_irq() parameters, this prevented
multiple load/unload cycles as module
Signed-off-by: Helge Deller <deller@gmx.de>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/serio')
-rw-r--r-- | drivers/input/serio/hil_mlc.c | 20 | ||||
-rw-r--r-- | drivers/input/serio/hp_sdc.c | 16 | ||||
-rw-r--r-- | drivers/input/serio/hp_sdc_mlc.c | 3 |
3 files changed, 20 insertions, 19 deletions
diff --git a/drivers/input/serio/hil_mlc.c b/drivers/input/serio/hil_mlc.c index 4fa93ff30919..0710704d2fd3 100644 --- a/drivers/input/serio/hil_mlc.c +++ b/drivers/input/serio/hil_mlc.c | |||
@@ -408,7 +408,7 @@ static int hilse_operate(hil_mlc *mlc, int repoll) { | |||
408 | #define OUT_LAST(pack) \ | 408 | #define OUT_LAST(pack) \ |
409 | { HILSE_OUT_LAST, { .packet = pack }, 0, 0, 0, 0 }, | 409 | { HILSE_OUT_LAST, { .packet = pack }, 0, 0, 0, 0 }, |
410 | 410 | ||
411 | struct hilse_node hil_mlc_se[HILSEN_END] = { | 411 | const struct hilse_node hil_mlc_se[HILSEN_END] = { |
412 | 412 | ||
413 | /* 0 HILSEN_START */ | 413 | /* 0 HILSEN_START */ |
414 | FUNC(hilse_init_lcv, 0, HILSEN_NEXT, HILSEN_SLEEP, 0) | 414 | FUNC(hilse_init_lcv, 0, HILSEN_NEXT, HILSEN_SLEEP, 0) |
@@ -530,7 +530,7 @@ struct hilse_node hil_mlc_se[HILSEN_END] = { | |||
530 | /* 60 HILSEN_END */ | 530 | /* 60 HILSEN_END */ |
531 | }; | 531 | }; |
532 | 532 | ||
533 | static inline void hilse_setup_input(hil_mlc *mlc, struct hilse_node *node) { | 533 | static inline void hilse_setup_input(hil_mlc *mlc, const struct hilse_node *node) { |
534 | 534 | ||
535 | switch (node->act) { | 535 | switch (node->act) { |
536 | case HILSE_EXPECT_DISC: | 536 | case HILSE_EXPECT_DISC: |
@@ -563,21 +563,19 @@ static inline void hilse_setup_input(hil_mlc *mlc, struct hilse_node *node) { | |||
563 | #ifdef HIL_MLC_DEBUG | 563 | #ifdef HIL_MLC_DEBUG |
564 | static int doze = 0; | 564 | static int doze = 0; |
565 | static int seidx; /* For debug */ | 565 | static int seidx; /* For debug */ |
566 | static int kick = 1; | ||
567 | #endif | 566 | #endif |
568 | 567 | ||
569 | static int hilse_donode (hil_mlc *mlc) { | 568 | static int hilse_donode (hil_mlc *mlc) { |
570 | struct hilse_node *node; | 569 | const struct hilse_node *node; |
571 | int nextidx = 0; | 570 | int nextidx = 0; |
572 | int sched_long = 0; | 571 | int sched_long = 0; |
573 | unsigned long flags; | 572 | unsigned long flags; |
574 | 573 | ||
575 | #ifdef HIL_MLC_DEBUG | 574 | #ifdef HIL_MLC_DEBUG |
576 | if (mlc->seidx && (mlc->seidx != seidx) && mlc->seidx != 41 && mlc->seidx != 42 && mlc->seidx != 43) { | 575 | if (mlc->seidx && (mlc->seidx != seidx) && mlc->seidx != 41 && mlc->seidx != 42 && mlc->seidx != 43) { |
577 | printk(KERN_DEBUG PREFIX "z%i \n%s {%i}", doze, kick ? "K" : "", mlc->seidx); | 576 | printk(KERN_DEBUG PREFIX "z%i \n {%i}", doze, mlc->seidx); |
578 | doze = 0; | 577 | doze = 0; |
579 | } | 578 | } |
580 | kick = 0; | ||
581 | 579 | ||
582 | seidx = mlc->seidx; | 580 | seidx = mlc->seidx; |
583 | #endif | 581 | #endif |
@@ -588,7 +586,7 @@ static int hilse_donode (hil_mlc *mlc) { | |||
588 | hil_packet pack; | 586 | hil_packet pack; |
589 | 587 | ||
590 | case HILSE_FUNC: | 588 | case HILSE_FUNC: |
591 | if (node->object.func == NULL) break; | 589 | BUG_ON(node->object.func == NULL); |
592 | rc = node->object.func(mlc, node->arg); | 590 | rc = node->object.func(mlc, node->arg); |
593 | nextidx = (rc > 0) ? node->ugly : | 591 | nextidx = (rc > 0) ? node->ugly : |
594 | ((rc < 0) ? node->bad : node->good); | 592 | ((rc < 0) ? node->bad : node->good); |
@@ -674,10 +672,10 @@ static int hilse_donode (hil_mlc *mlc) { | |||
674 | if (!sched_long) goto sched; | 672 | if (!sched_long) goto sched; |
675 | 673 | ||
676 | do_gettimeofday(&tv); | 674 | do_gettimeofday(&tv); |
677 | tv.tv_usec += 1000000 * (tv.tv_sec - mlc->instart.tv_sec); | 675 | tv.tv_usec += USEC_PER_SEC * (tv.tv_sec - mlc->instart.tv_sec); |
678 | tv.tv_usec -= mlc->instart.tv_usec; | 676 | tv.tv_usec -= mlc->instart.tv_usec; |
679 | if (tv.tv_usec >= mlc->intimeout) goto sched; | 677 | if (tv.tv_usec >= mlc->intimeout) goto sched; |
680 | tv.tv_usec = (mlc->intimeout - tv.tv_usec) * HZ / 1000000; | 678 | tv.tv_usec = (mlc->intimeout - tv.tv_usec) * HZ / USEC_PER_SEC; |
681 | if (!tv.tv_usec) goto sched; | 679 | if (!tv.tv_usec) goto sched; |
682 | mod_timer(&hil_mlcs_kicker, jiffies + tv.tv_usec); | 680 | mod_timer(&hil_mlcs_kicker, jiffies + tv.tv_usec); |
683 | break; | 681 | break; |
@@ -837,7 +835,7 @@ static void hil_mlc_serio_close(struct serio *serio) { | |||
837 | /* TODO wake up interruptable */ | 835 | /* TODO wake up interruptable */ |
838 | } | 836 | } |
839 | 837 | ||
840 | static struct serio_device_id hil_mlc_serio_id = { | 838 | static const struct serio_device_id hil_mlc_serio_id = { |
841 | .type = SERIO_HIL_MLC, | 839 | .type = SERIO_HIL_MLC, |
842 | .proto = SERIO_HIL, | 840 | .proto = SERIO_HIL, |
843 | .extra = SERIO_ANY, | 841 | .extra = SERIO_ANY, |
@@ -873,6 +871,8 @@ int hil_mlc_register(hil_mlc *mlc) { | |||
873 | hil_mlc_copy_di_scratch(mlc, i); | 871 | hil_mlc_copy_di_scratch(mlc, i); |
874 | mlc_serio = kzalloc(sizeof(*mlc_serio), GFP_KERNEL); | 872 | mlc_serio = kzalloc(sizeof(*mlc_serio), GFP_KERNEL); |
875 | mlc->serio[i] = mlc_serio; | 873 | mlc->serio[i] = mlc_serio; |
874 | snprintf(mlc_serio->name, sizeof(mlc_serio->name)-1, "HIL_SERIO%d", i); | ||
875 | snprintf(mlc_serio->phys, sizeof(mlc_serio->phys)-1, "HIL%d", i); | ||
876 | mlc_serio->id = hil_mlc_serio_id; | 876 | mlc_serio->id = hil_mlc_serio_id; |
877 | mlc_serio->write = hil_mlc_serio_write; | 877 | mlc_serio->write = hil_mlc_serio_write; |
878 | mlc_serio->open = hil_mlc_serio_open; | 878 | mlc_serio->open = hil_mlc_serio_open; |
diff --git a/drivers/input/serio/hp_sdc.c b/drivers/input/serio/hp_sdc.c index b57370dc4e3d..353a8a18948b 100644 --- a/drivers/input/serio/hp_sdc.c +++ b/drivers/input/serio/hp_sdc.c | |||
@@ -748,7 +748,7 @@ void hp_sdc_kicker (unsigned long data) { | |||
748 | 748 | ||
749 | #if defined(__hppa__) | 749 | #if defined(__hppa__) |
750 | 750 | ||
751 | static struct parisc_device_id hp_sdc_tbl[] = { | 751 | static const struct parisc_device_id hp_sdc_tbl[] = { |
752 | { | 752 | { |
753 | .hw_type = HPHW_FIO, | 753 | .hw_type = HPHW_FIO, |
754 | .hversion_rev = HVERSION_REV_ANY_ID, | 754 | .hversion_rev = HVERSION_REV_ANY_ID, |
@@ -817,12 +817,12 @@ static int __init hp_sdc_init(void) | |||
817 | #endif | 817 | #endif |
818 | 818 | ||
819 | errstr = "IRQ not available for"; | 819 | errstr = "IRQ not available for"; |
820 | if(request_irq(hp_sdc.irq, &hp_sdc_isr, 0, "HP SDC", | 820 | if (request_irq(hp_sdc.irq, &hp_sdc_isr, IRQF_SHARED|IRQF_SAMPLE_RANDOM, |
821 | (void *) hp_sdc.base_io)) goto err1; | 821 | "HP SDC", &hp_sdc)) goto err1; |
822 | 822 | ||
823 | errstr = "NMI not available for"; | 823 | errstr = "NMI not available for"; |
824 | if (request_irq(hp_sdc.nmi, &hp_sdc_nmisr, 0, "HP SDC NMI", | 824 | if (request_irq(hp_sdc.nmi, &hp_sdc_nmisr, IRQF_SHARED, |
825 | (void *) hp_sdc.base_io)) goto err2; | 825 | "HP SDC NMI", &hp_sdc)) goto err2; |
826 | 826 | ||
827 | printk(KERN_INFO PREFIX "HP SDC at 0x%p, IRQ %d (NMI IRQ %d)\n", | 827 | printk(KERN_INFO PREFIX "HP SDC at 0x%p, IRQ %d (NMI IRQ %d)\n", |
828 | (void *)hp_sdc.base_io, hp_sdc.irq, hp_sdc.nmi); | 828 | (void *)hp_sdc.base_io, hp_sdc.irq, hp_sdc.nmi); |
@@ -854,7 +854,7 @@ static int __init hp_sdc_init(void) | |||
854 | hp_sdc.dev_err = 0; | 854 | hp_sdc.dev_err = 0; |
855 | return 0; | 855 | return 0; |
856 | err2: | 856 | err2: |
857 | free_irq(hp_sdc.irq, NULL); | 857 | free_irq(hp_sdc.irq, &hp_sdc); |
858 | err1: | 858 | err1: |
859 | release_region(hp_sdc.data_io, 2); | 859 | release_region(hp_sdc.data_io, 2); |
860 | err0: | 860 | err0: |
@@ -898,8 +898,8 @@ static void hp_sdc_exit(void) | |||
898 | /* Wait until we know this has been processed by the i8042 */ | 898 | /* Wait until we know this has been processed by the i8042 */ |
899 | hp_sdc_spin_ibf(); | 899 | hp_sdc_spin_ibf(); |
900 | 900 | ||
901 | free_irq(hp_sdc.nmi, NULL); | 901 | free_irq(hp_sdc.nmi, &hp_sdc); |
902 | free_irq(hp_sdc.irq, NULL); | 902 | free_irq(hp_sdc.irq, &hp_sdc); |
903 | write_unlock_irq(&hp_sdc.lock); | 903 | write_unlock_irq(&hp_sdc.lock); |
904 | 904 | ||
905 | del_timer(&hp_sdc.kicker); | 905 | del_timer(&hp_sdc.kicker); |
diff --git a/drivers/input/serio/hp_sdc_mlc.c b/drivers/input/serio/hp_sdc_mlc.c index aa4a8a4ccfdb..1f131ff1f69e 100644 --- a/drivers/input/serio/hp_sdc_mlc.c +++ b/drivers/input/serio/hp_sdc_mlc.c | |||
@@ -323,11 +323,12 @@ static int __init hp_sdc_mlc_init(void) | |||
323 | mlc->in = &hp_sdc_mlc_in; | 323 | mlc->in = &hp_sdc_mlc_in; |
324 | mlc->out = &hp_sdc_mlc_out; | 324 | mlc->out = &hp_sdc_mlc_out; |
325 | 325 | ||
326 | mlc->priv = &hp_sdc_mlc_priv; | ||
327 | |||
326 | if (hil_mlc_register(mlc)) { | 328 | if (hil_mlc_register(mlc)) { |
327 | printk(KERN_WARNING PREFIX "Failed to register MLC structure with hil_mlc\n"); | 329 | printk(KERN_WARNING PREFIX "Failed to register MLC structure with hil_mlc\n"); |
328 | goto err0; | 330 | goto err0; |
329 | } | 331 | } |
330 | mlc->priv = &hp_sdc_mlc_priv; | ||
331 | 332 | ||
332 | if (hp_sdc_request_hil_irq(&hp_sdc_mlc_isr)) { | 333 | if (hp_sdc_request_hil_irq(&hp_sdc_mlc_isr)) { |
333 | printk(KERN_WARNING PREFIX "Request for raw HIL ISR hook denied\n"); | 334 | printk(KERN_WARNING PREFIX "Request for raw HIL ISR hook denied\n"); |