diff options
Diffstat (limited to 'drivers/char')
78 files changed, 948 insertions, 1374 deletions
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig index 4135d8c5bcae..05ba410682a3 100644 --- a/drivers/char/Kconfig +++ b/drivers/char/Kconfig | |||
@@ -222,7 +222,7 @@ config SYNCLINKMP | |||
222 | 222 | ||
223 | config SYNCLINK_GT | 223 | config SYNCLINK_GT |
224 | tristate "SyncLink GT/AC support" | 224 | tristate "SyncLink GT/AC support" |
225 | depends on SERIAL_NONSTANDARD | 225 | depends on SERIAL_NONSTANDARD && PCI |
226 | help | 226 | help |
227 | Support for SyncLink GT and SyncLink AC families of | 227 | Support for SyncLink GT and SyncLink AC families of |
228 | synchronous and asynchronous serial adapters | 228 | synchronous and asynchronous serial adapters |
@@ -992,7 +992,7 @@ config HPET_MMAP | |||
992 | 992 | ||
993 | config HANGCHECK_TIMER | 993 | config HANGCHECK_TIMER |
994 | tristate "Hangcheck timer" | 994 | tristate "Hangcheck timer" |
995 | depends on X86 || IA64 || PPC64 || S390 | 995 | depends on X86 || IA64 || PPC64 |
996 | help | 996 | help |
997 | The hangcheck-timer module detects when the system has gone | 997 | The hangcheck-timer module detects when the system has gone |
998 | out to lunch past a certain margin. It can reboot the system | 998 | out to lunch past a certain margin. It can reboot the system |
diff --git a/drivers/char/agp/Kconfig b/drivers/char/agp/Kconfig index 486ed8a11b59..a4d425d2dce2 100644 --- a/drivers/char/agp/Kconfig +++ b/drivers/char/agp/Kconfig | |||
@@ -15,22 +15,23 @@ config AGP | |||
15 | due to kernel allocation issues), you could use PCI accesses | 15 | due to kernel allocation issues), you could use PCI accesses |
16 | and have up to a couple gigs of texture space. | 16 | and have up to a couple gigs of texture space. |
17 | 17 | ||
18 | Note that this is the only means to have XFree4/GLX use | 18 | Note that this is the only means to have X/GLX use |
19 | write-combining with MTRR support on the AGP bus. Without it, OpenGL | 19 | write-combining with MTRR support on the AGP bus. Without it, OpenGL |
20 | direct rendering will be a lot slower but still faster than PIO. | 20 | direct rendering will be a lot slower but still faster than PIO. |
21 | 21 | ||
22 | You should say Y here if you use XFree86 3.3.6 or 4.x and want to | ||
23 | use GLX or DRI. If unsure, say N. | ||
24 | |||
25 | To compile this driver as a module, choose M here: the | 22 | To compile this driver as a module, choose M here: the |
26 | module will be called agpgart. | 23 | module will be called agpgart. |
27 | 24 | ||
25 | You should say Y here if you want to use GLX or DRI. | ||
26 | |||
27 | If unsure, say N. | ||
28 | |||
28 | config AGP_ALI | 29 | config AGP_ALI |
29 | tristate "ALI chipset support" | 30 | tristate "ALI chipset support" |
30 | depends on AGP && X86_32 | 31 | depends on AGP && X86_32 |
31 | ---help--- | 32 | ---help--- |
32 | This option gives you AGP support for the GLX component of | 33 | This option gives you AGP support for the GLX component of |
33 | XFree86 4.x on the following ALi chipsets. The supported chipsets | 34 | X on the following ALi chipsets. The supported chipsets |
34 | include M1541, M1621, M1631, M1632, M1641,M1647,and M1651. | 35 | include M1541, M1621, M1631, M1632, M1641,M1647,and M1651. |
35 | For the ALi-chipset question, ALi suggests you refer to | 36 | For the ALi-chipset question, ALi suggests you refer to |
36 | <http://www.ali.com.tw/eng/support/index.shtml>. | 37 | <http://www.ali.com.tw/eng/support/index.shtml>. |
@@ -40,28 +41,19 @@ config AGP_ALI | |||
40 | timing issues, this chipset cannot do AGP 2x with the G200. | 41 | timing issues, this chipset cannot do AGP 2x with the G200. |
41 | This is a hardware limitation. AGP 1x seems to be fine, though. | 42 | This is a hardware limitation. AGP 1x seems to be fine, though. |
42 | 43 | ||
43 | You should say Y here if you use XFree86 3.3.6 or 4.x and want to | ||
44 | use GLX or DRI. If unsure, say N. | ||
45 | |||
46 | config AGP_ATI | 44 | config AGP_ATI |
47 | tristate "ATI chipset support" | 45 | tristate "ATI chipset support" |
48 | depends on AGP && X86_32 | 46 | depends on AGP && X86_32 |
49 | ---help--- | 47 | ---help--- |
50 | This option gives you AGP support for the GLX component of | 48 | This option gives you AGP support for the GLX component of |
51 | XFree86 4.x on the ATI RadeonIGP family of chipsets. | 49 | X on the ATI RadeonIGP family of chipsets. |
52 | |||
53 | You should say Y here if you use XFree86 3.3.6 or 4.x and want to | ||
54 | use GLX or DRI. If unsure, say N. | ||
55 | 50 | ||
56 | config AGP_AMD | 51 | config AGP_AMD |
57 | tristate "AMD Irongate, 761, and 762 chipset support" | 52 | tristate "AMD Irongate, 761, and 762 chipset support" |
58 | depends on AGP && X86_32 | 53 | depends on AGP && X86_32 |
59 | help | 54 | help |
60 | This option gives you AGP support for the GLX component of | 55 | This option gives you AGP support for the GLX component of |
61 | XFree86 4.x on AMD Irongate, 761, and 762 chipsets. | 56 | X on AMD Irongate, 761, and 762 chipsets. |
62 | |||
63 | You should say Y here if you use XFree86 3.3.6 or 4.x and want to | ||
64 | use GLX or DRI. If unsure, say N. | ||
65 | 57 | ||
66 | config AGP_AMD64 | 58 | config AGP_AMD64 |
67 | tristate "AMD Opteron/Athlon64 on-CPU GART support" if !GART_IOMMU | 59 | tristate "AMD Opteron/Athlon64 on-CPU GART support" if !GART_IOMMU |
@@ -69,45 +61,38 @@ config AGP_AMD64 | |||
69 | default y if GART_IOMMU | 61 | default y if GART_IOMMU |
70 | help | 62 | help |
71 | This option gives you AGP support for the GLX component of | 63 | This option gives you AGP support for the GLX component of |
72 | XFree86 4.x using the on-CPU northbridge of the AMD Athlon64/Opteron CPUs. | 64 | X using the on-CPU northbridge of the AMD Athlon64/Opteron CPUs. |
73 | You still need an external AGP bridge like the AMD 8151, VIA | 65 | You still need an external AGP bridge like the AMD 8151, VIA |
74 | K8T400M, SiS755. It may also support other AGP bridges when loaded | 66 | K8T400M, SiS755. It may also support other AGP bridges when loaded |
75 | with agp_try_unsupported=1. | 67 | with agp_try_unsupported=1. |
76 | You should say Y here if you use XFree86 3.3.6 or 4.x and want to | ||
77 | use GLX or DRI. If unsure, say Y | ||
78 | 68 | ||
79 | config AGP_INTEL | 69 | config AGP_INTEL |
80 | tristate "Intel 440LX/BX/GX, I8xx and E7x05 chipset support" | 70 | tristate "Intel 440LX/BX/GX, I8xx and E7x05 chipset support" |
81 | depends on AGP && X86 | 71 | depends on AGP && X86 |
82 | help | 72 | help |
83 | This option gives you AGP support for the GLX component of XFree86 4.x | 73 | This option gives you AGP support for the GLX component of X |
84 | on Intel 440LX/BX/GX, 815, 820, 830, 840, 845, 850, 860, 875, | 74 | on Intel 440LX/BX/GX, 815, 820, 830, 840, 845, 850, 860, 875, |
85 | E7205 and E7505 chipsets and full support for the 810, 815, 830M, 845G, | 75 | E7205 and E7505 chipsets and full support for the 810, 815, 830M, |
86 | 852GM, 855GM, 865G and I915 integrated graphics chipsets. | 76 | 845G, 852GM, 855GM, 865G and I915 integrated graphics chipsets. |
77 | |||
87 | 78 | ||
88 | You should say Y here if you use XFree86 3.3.6 or 4.x and want to | ||
89 | use GLX or DRI, or if you have any Intel integrated graphics | ||
90 | chipsets. If unsure, say Y. | ||
91 | 79 | ||
92 | config AGP_NVIDIA | 80 | config AGP_NVIDIA |
93 | tristate "NVIDIA nForce/nForce2 chipset support" | 81 | tristate "NVIDIA nForce/nForce2 chipset support" |
94 | depends on AGP && X86_32 | 82 | depends on AGP && X86_32 |
95 | help | 83 | help |
96 | This option gives you AGP support for the GLX component of | 84 | This option gives you AGP support for the GLX component of |
97 | XFree86 4.x on the following NVIDIA chipsets. The supported chipsets | 85 | X on NVIDIA chipsets including nForce and nForce2 |
98 | include nForce and nForce2 | ||
99 | 86 | ||
100 | config AGP_SIS | 87 | config AGP_SIS |
101 | tristate "SiS chipset support" | 88 | tristate "SiS chipset support" |
102 | depends on AGP && X86_32 | 89 | depends on AGP && X86_32 |
103 | help | 90 | help |
104 | This option gives you AGP support for the GLX component of | 91 | This option gives you AGP support for the GLX component of |
105 | XFree86 4.x on Silicon Integrated Systems [SiS] chipsets. | 92 | X on Silicon Integrated Systems [SiS] chipsets. |
106 | 93 | ||
107 | Note that 5591/5592 AGP chipsets are NOT supported. | 94 | Note that 5591/5592 AGP chipsets are NOT supported. |
108 | 95 | ||
109 | You should say Y here if you use XFree86 3.3.6 or 4.x and want to | ||
110 | use GLX or DRI. If unsure, say N. | ||
111 | 96 | ||
112 | config AGP_SWORKS | 97 | config AGP_SWORKS |
113 | tristate "Serverworks LE/HE chipset support" | 98 | tristate "Serverworks LE/HE chipset support" |
@@ -121,10 +106,7 @@ config AGP_VIA | |||
121 | depends on AGP && X86_32 | 106 | depends on AGP && X86_32 |
122 | help | 107 | help |
123 | This option gives you AGP support for the GLX component of | 108 | This option gives you AGP support for the GLX component of |
124 | XFree86 4.x on VIA MVP3/Apollo Pro chipsets. | 109 | X on VIA MVP3/Apollo Pro chipsets. |
125 | |||
126 | You should say Y here if you use XFree86 3.3.6 or 4.x and want to | ||
127 | use GLX or DRI. If unsure, say N. | ||
128 | 110 | ||
129 | config AGP_I460 | 111 | config AGP_I460 |
130 | tristate "Intel 460GX chipset support" | 112 | tristate "Intel 460GX chipset support" |
@@ -159,9 +141,6 @@ config AGP_EFFICEON | |||
159 | This option gives you AGP support for the Transmeta Efficeon | 141 | This option gives you AGP support for the Transmeta Efficeon |
160 | series processors with integrated northbridges. | 142 | series processors with integrated northbridges. |
161 | 143 | ||
162 | You should say Y here if you use XFree86 3.3.6 or 4.x and want to | ||
163 | use GLX or DRI. If unsure, say Y. | ||
164 | |||
165 | config AGP_SGI_TIOCA | 144 | config AGP_SGI_TIOCA |
166 | tristate "SGI TIO chipset AGP support" | 145 | tristate "SGI TIO chipset AGP support" |
167 | depends on AGP && (IA64_SGI_SN2 || IA64_GENERIC) | 146 | depends on AGP && (IA64_SGI_SN2 || IA64_GENERIC) |
diff --git a/drivers/char/agp/amd64-agp.c b/drivers/char/agp/amd64-agp.c index 810679dcbbb0..1251b2515bbe 100644 --- a/drivers/char/agp/amd64-agp.c +++ b/drivers/char/agp/amd64-agp.c | |||
@@ -516,8 +516,10 @@ static int __devinit nforce3_agp_init(struct pci_dev *pdev) | |||
516 | pci_read_config_dword (hammers[0], AMD64_GARTAPERTUREBASE, &apbase); | 516 | pci_read_config_dword (hammers[0], AMD64_GARTAPERTUREBASE, &apbase); |
517 | 517 | ||
518 | /* if x86-64 aperture base is beyond 4G, exit here */ | 518 | /* if x86-64 aperture base is beyond 4G, exit here */ |
519 | if ( (apbase & 0x7fff) >> (32 - 25) ) | 519 | if ( (apbase & 0x7fff) >> (32 - 25) ) { |
520 | return -ENODEV; | 520 | printk(KERN_INFO PFX "aperture base > 4G\n"); |
521 | return -ENODEV; | ||
522 | } | ||
521 | 523 | ||
522 | apbase = (apbase & 0x7fff) << 25; | 524 | apbase = (apbase & 0x7fff) << 25; |
523 | 525 | ||
@@ -600,6 +602,26 @@ static void __devexit agp_amd64_remove(struct pci_dev *pdev) | |||
600 | agp_put_bridge(bridge); | 602 | agp_put_bridge(bridge); |
601 | } | 603 | } |
602 | 604 | ||
605 | #ifdef CONFIG_PM | ||
606 | |||
607 | static int agp_amd64_suspend(struct pci_dev *pdev, pm_message_t state) | ||
608 | { | ||
609 | pci_save_state(pdev); | ||
610 | pci_set_power_state(pdev, pci_choose_state(pdev, state)); | ||
611 | |||
612 | return 0; | ||
613 | } | ||
614 | |||
615 | static int agp_amd64_resume(struct pci_dev *pdev) | ||
616 | { | ||
617 | pci_set_power_state(pdev, PCI_D0); | ||
618 | pci_restore_state(pdev); | ||
619 | |||
620 | return amd_8151_configure(); | ||
621 | } | ||
622 | |||
623 | #endif /* CONFIG_PM */ | ||
624 | |||
603 | static struct pci_device_id agp_amd64_pci_table[] = { | 625 | static struct pci_device_id agp_amd64_pci_table[] = { |
604 | { | 626 | { |
605 | .class = (PCI_CLASS_BRIDGE_HOST << 8), | 627 | .class = (PCI_CLASS_BRIDGE_HOST << 8), |
@@ -718,6 +740,10 @@ static struct pci_driver agp_amd64_pci_driver = { | |||
718 | .id_table = agp_amd64_pci_table, | 740 | .id_table = agp_amd64_pci_table, |
719 | .probe = agp_amd64_probe, | 741 | .probe = agp_amd64_probe, |
720 | .remove = agp_amd64_remove, | 742 | .remove = agp_amd64_remove, |
743 | #ifdef CONFIG_PM | ||
744 | .suspend = agp_amd64_suspend, | ||
745 | .resume = agp_amd64_resume, | ||
746 | #endif | ||
721 | }; | 747 | }; |
722 | 748 | ||
723 | 749 | ||
diff --git a/drivers/char/agp/ati-agp.c b/drivers/char/agp/ati-agp.c index 53372a83b675..5b74c36c116c 100644 --- a/drivers/char/agp/ati-agp.c +++ b/drivers/char/agp/ati-agp.c | |||
@@ -244,6 +244,22 @@ static int ati_configure(void) | |||
244 | } | 244 | } |
245 | 245 | ||
246 | 246 | ||
247 | #ifdef CONFIG_PM | ||
248 | static int agp_ati_resume(struct pci_dev *dev) | ||
249 | { | ||
250 | pci_restore_state(dev); | ||
251 | |||
252 | return ati_configure(); | ||
253 | } | ||
254 | |||
255 | static int agp_ati_suspend(struct pci_dev *dev, pm_message_t state) | ||
256 | { | ||
257 | pci_save_state(dev); | ||
258 | |||
259 | return 0; | ||
260 | } | ||
261 | #endif | ||
262 | |||
247 | /* | 263 | /* |
248 | *Since we don't need contigious memory we just try | 264 | *Since we don't need contigious memory we just try |
249 | * to get the gatt table once | 265 | * to get the gatt table once |
@@ -525,6 +541,10 @@ static struct pci_driver agp_ati_pci_driver = { | |||
525 | .id_table = agp_ati_pci_table, | 541 | .id_table = agp_ati_pci_table, |
526 | .probe = agp_ati_probe, | 542 | .probe = agp_ati_probe, |
527 | .remove = agp_ati_remove, | 543 | .remove = agp_ati_remove, |
544 | #ifdef CONFIG_PM | ||
545 | .resume = agp_ati_resume, | ||
546 | .suspend = agp_ati_suspend, | ||
547 | #endif | ||
528 | }; | 548 | }; |
529 | 549 | ||
530 | static int __init agp_ati_init(void) | 550 | static int __init agp_ati_init(void) |
diff --git a/drivers/char/agp/frontend.c b/drivers/char/agp/frontend.c index 17f520c9d471..97eeb2345b18 100644 --- a/drivers/char/agp/frontend.c +++ b/drivers/char/agp/frontend.c | |||
@@ -592,7 +592,7 @@ static int agp_mmap(struct file *file, struct vm_area_struct *vma) | |||
592 | struct agp_file_private *priv = file->private_data; | 592 | struct agp_file_private *priv = file->private_data; |
593 | struct agp_kern_info kerninfo; | 593 | struct agp_kern_info kerninfo; |
594 | 594 | ||
595 | down(&(agp_fe.agp_mutex)); | 595 | mutex_lock(&(agp_fe.agp_mutex)); |
596 | 596 | ||
597 | if (agp_fe.backend_acquired != TRUE) | 597 | if (agp_fe.backend_acquired != TRUE) |
598 | goto out_eperm; | 598 | goto out_eperm; |
@@ -627,7 +627,7 @@ static int agp_mmap(struct file *file, struct vm_area_struct *vma) | |||
627 | size, vma->vm_page_prot)) { | 627 | size, vma->vm_page_prot)) { |
628 | goto out_again; | 628 | goto out_again; |
629 | } | 629 | } |
630 | up(&(agp_fe.agp_mutex)); | 630 | mutex_unlock(&(agp_fe.agp_mutex)); |
631 | return 0; | 631 | return 0; |
632 | } | 632 | } |
633 | 633 | ||
@@ -643,20 +643,20 @@ static int agp_mmap(struct file *file, struct vm_area_struct *vma) | |||
643 | size, vma->vm_page_prot)) { | 643 | size, vma->vm_page_prot)) { |
644 | goto out_again; | 644 | goto out_again; |
645 | } | 645 | } |
646 | up(&(agp_fe.agp_mutex)); | 646 | mutex_unlock(&(agp_fe.agp_mutex)); |
647 | return 0; | 647 | return 0; |
648 | } | 648 | } |
649 | 649 | ||
650 | out_eperm: | 650 | out_eperm: |
651 | up(&(agp_fe.agp_mutex)); | 651 | mutex_unlock(&(agp_fe.agp_mutex)); |
652 | return -EPERM; | 652 | return -EPERM; |
653 | 653 | ||
654 | out_inval: | 654 | out_inval: |
655 | up(&(agp_fe.agp_mutex)); | 655 | mutex_unlock(&(agp_fe.agp_mutex)); |
656 | return -EINVAL; | 656 | return -EINVAL; |
657 | 657 | ||
658 | out_again: | 658 | out_again: |
659 | up(&(agp_fe.agp_mutex)); | 659 | mutex_unlock(&(agp_fe.agp_mutex)); |
660 | return -EAGAIN; | 660 | return -EAGAIN; |
661 | } | 661 | } |
662 | 662 | ||
@@ -664,7 +664,7 @@ static int agp_release(struct inode *inode, struct file *file) | |||
664 | { | 664 | { |
665 | struct agp_file_private *priv = file->private_data; | 665 | struct agp_file_private *priv = file->private_data; |
666 | 666 | ||
667 | down(&(agp_fe.agp_mutex)); | 667 | mutex_lock(&(agp_fe.agp_mutex)); |
668 | 668 | ||
669 | DBG("priv=%p", priv); | 669 | DBG("priv=%p", priv); |
670 | 670 | ||
@@ -687,7 +687,7 @@ static int agp_release(struct inode *inode, struct file *file) | |||
687 | agp_remove_file_private(priv); | 687 | agp_remove_file_private(priv); |
688 | kfree(priv); | 688 | kfree(priv); |
689 | file->private_data = NULL; | 689 | file->private_data = NULL; |
690 | up(&(agp_fe.agp_mutex)); | 690 | mutex_unlock(&(agp_fe.agp_mutex)); |
691 | return 0; | 691 | return 0; |
692 | } | 692 | } |
693 | 693 | ||
@@ -698,7 +698,7 @@ static int agp_open(struct inode *inode, struct file *file) | |||
698 | struct agp_client *client; | 698 | struct agp_client *client; |
699 | int rc = -ENXIO; | 699 | int rc = -ENXIO; |
700 | 700 | ||
701 | down(&(agp_fe.agp_mutex)); | 701 | mutex_lock(&(agp_fe.agp_mutex)); |
702 | 702 | ||
703 | if (minor != AGPGART_MINOR) | 703 | if (minor != AGPGART_MINOR) |
704 | goto err_out; | 704 | goto err_out; |
@@ -723,13 +723,13 @@ static int agp_open(struct inode *inode, struct file *file) | |||
723 | file->private_data = (void *) priv; | 723 | file->private_data = (void *) priv; |
724 | agp_insert_file_private(priv); | 724 | agp_insert_file_private(priv); |
725 | DBG("private=%p, client=%p", priv, client); | 725 | DBG("private=%p, client=%p", priv, client); |
726 | up(&(agp_fe.agp_mutex)); | 726 | mutex_unlock(&(agp_fe.agp_mutex)); |
727 | return 0; | 727 | return 0; |
728 | 728 | ||
729 | err_out_nomem: | 729 | err_out_nomem: |
730 | rc = -ENOMEM; | 730 | rc = -ENOMEM; |
731 | err_out: | 731 | err_out: |
732 | up(&(agp_fe.agp_mutex)); | 732 | mutex_unlock(&(agp_fe.agp_mutex)); |
733 | return rc; | 733 | return rc; |
734 | } | 734 | } |
735 | 735 | ||
@@ -985,7 +985,7 @@ static int agp_ioctl(struct inode *inode, struct file *file, | |||
985 | int ret_val = -ENOTTY; | 985 | int ret_val = -ENOTTY; |
986 | 986 | ||
987 | DBG("priv=%p, cmd=%x", curr_priv, cmd); | 987 | DBG("priv=%p, cmd=%x", curr_priv, cmd); |
988 | down(&(agp_fe.agp_mutex)); | 988 | mutex_lock(&(agp_fe.agp_mutex)); |
989 | 989 | ||
990 | if ((agp_fe.current_controller == NULL) && | 990 | if ((agp_fe.current_controller == NULL) && |
991 | (cmd != AGPIOC_ACQUIRE)) { | 991 | (cmd != AGPIOC_ACQUIRE)) { |
@@ -1055,7 +1055,7 @@ static int agp_ioctl(struct inode *inode, struct file *file, | |||
1055 | 1055 | ||
1056 | ioctl_out: | 1056 | ioctl_out: |
1057 | DBG("ioctl returns %d\n", ret_val); | 1057 | DBG("ioctl returns %d\n", ret_val); |
1058 | up(&(agp_fe.agp_mutex)); | 1058 | mutex_unlock(&(agp_fe.agp_mutex)); |
1059 | return ret_val; | 1059 | return ret_val; |
1060 | } | 1060 | } |
1061 | 1061 | ||
@@ -1081,7 +1081,7 @@ static struct miscdevice agp_miscdev = | |||
1081 | int agp_frontend_initialize(void) | 1081 | int agp_frontend_initialize(void) |
1082 | { | 1082 | { |
1083 | memset(&agp_fe, 0, sizeof(struct agp_front_data)); | 1083 | memset(&agp_fe, 0, sizeof(struct agp_front_data)); |
1084 | sema_init(&(agp_fe.agp_mutex), 1); | 1084 | mutex_init(&(agp_fe.agp_mutex)); |
1085 | 1085 | ||
1086 | if (misc_register(&agp_miscdev)) { | 1086 | if (misc_register(&agp_miscdev)) { |
1087 | printk(KERN_ERR PFX "unable to get minor: %d\n", AGPGART_MINOR); | 1087 | printk(KERN_ERR PFX "unable to get minor: %d\n", AGPGART_MINOR); |
diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c index e7bed5047dcc..631531fd97a5 100644 --- a/drivers/char/agp/intel-agp.c +++ b/drivers/char/agp/intel-agp.c | |||
@@ -422,7 +422,8 @@ static void intel_i830_init_gtt_entries(void) | |||
422 | /* Check it's really I915G */ | 422 | /* Check it's really I915G */ |
423 | if (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82915G_HB || | 423 | if (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82915G_HB || |
424 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82915GM_HB || | 424 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82915GM_HB || |
425 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82945G_HB) | 425 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82945G_HB || |
426 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82945GM_HB) | ||
426 | gtt_entries = MB(48) - KB(size); | 427 | gtt_entries = MB(48) - KB(size); |
427 | else | 428 | else |
428 | gtt_entries = 0; | 429 | gtt_entries = 0; |
@@ -431,7 +432,8 @@ static void intel_i830_init_gtt_entries(void) | |||
431 | /* Check it's really I915G */ | 432 | /* Check it's really I915G */ |
432 | if (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82915G_HB || | 433 | if (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82915G_HB || |
433 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82915GM_HB || | 434 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82915GM_HB || |
434 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82945G_HB) | 435 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82945G_HB || |
436 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82945GM_HB) | ||
435 | gtt_entries = MB(64) - KB(size); | 437 | gtt_entries = MB(64) - KB(size); |
436 | else | 438 | else |
437 | gtt_entries = 0; | 439 | gtt_entries = 0; |
@@ -1681,6 +1683,14 @@ static int __devinit agp_intel_probe(struct pci_dev *pdev, | |||
1681 | } | 1683 | } |
1682 | name = "945G"; | 1684 | name = "945G"; |
1683 | break; | 1685 | break; |
1686 | case PCI_DEVICE_ID_INTEL_82945GM_HB: | ||
1687 | if (find_i830(PCI_DEVICE_ID_INTEL_82945GM_IG)) { | ||
1688 | bridge->driver = &intel_915_driver; | ||
1689 | } else { | ||
1690 | bridge->driver = &intel_845_driver; | ||
1691 | } | ||
1692 | name = "945GM"; | ||
1693 | break; | ||
1684 | case PCI_DEVICE_ID_INTEL_7505_0: | 1694 | case PCI_DEVICE_ID_INTEL_7505_0: |
1685 | bridge->driver = &intel_7505_driver; | 1695 | bridge->driver = &intel_7505_driver; |
1686 | name = "E7505"; | 1696 | name = "E7505"; |
@@ -1821,6 +1831,7 @@ static struct pci_device_id agp_intel_pci_table[] = { | |||
1821 | ID(PCI_DEVICE_ID_INTEL_82915G_HB), | 1831 | ID(PCI_DEVICE_ID_INTEL_82915G_HB), |
1822 | ID(PCI_DEVICE_ID_INTEL_82915GM_HB), | 1832 | ID(PCI_DEVICE_ID_INTEL_82915GM_HB), |
1823 | ID(PCI_DEVICE_ID_INTEL_82945G_HB), | 1833 | ID(PCI_DEVICE_ID_INTEL_82945G_HB), |
1834 | ID(PCI_DEVICE_ID_INTEL_82945GM_HB), | ||
1824 | { } | 1835 | { } |
1825 | }; | 1836 | }; |
1826 | 1837 | ||
diff --git a/drivers/char/agp/isoch.c b/drivers/char/agp/isoch.c index 40083241804e..7c14a096b85e 100644 --- a/drivers/char/agp/isoch.c +++ b/drivers/char/agp/isoch.c | |||
@@ -218,10 +218,8 @@ static int agp_3_5_isochronous_node_enable(struct agp_bridge_data *bridge, | |||
218 | master[cdev].rq *= (1 << (master[cdev].y - 1)); | 218 | master[cdev].rq *= (1 << (master[cdev].y - 1)); |
219 | 219 | ||
220 | tot_rq += master[cdev].rq; | 220 | tot_rq += master[cdev].rq; |
221 | |||
222 | if (cdev == ndevs-1) | ||
223 | master[cdev].n += rem; | ||
224 | } | 221 | } |
222 | master[ndevs-1].n += rem; | ||
225 | 223 | ||
226 | /* Figure the number of isochronous and asynchronous RQ slots the | 224 | /* Figure the number of isochronous and asynchronous RQ slots the |
227 | * target is providing. */ | 225 | * target is providing. */ |
diff --git a/drivers/char/agp/sworks-agp.c b/drivers/char/agp/sworks-agp.c index 268f78d926d3..efef9999f1cf 100644 --- a/drivers/char/agp/sworks-agp.c +++ b/drivers/char/agp/sworks-agp.c | |||
@@ -468,9 +468,7 @@ static int __devinit agp_serverworks_probe(struct pci_dev *pdev, | |||
468 | 468 | ||
469 | switch (pdev->device) { | 469 | switch (pdev->device) { |
470 | case 0x0006: | 470 | case 0x0006: |
471 | /* ServerWorks CNB20HE | 471 | printk (KERN_ERR PFX "ServerWorks CNB20HE is unsupported due to lack of documentation.\n"); |
472 | Fail silently.*/ | ||
473 | printk (KERN_ERR PFX "Detected ServerWorks CNB20HE chipset: No AGP present.\n"); | ||
474 | return -ENODEV; | 472 | return -ENODEV; |
475 | 473 | ||
476 | case PCI_DEVICE_ID_SERVERWORKS_HE: | 474 | case PCI_DEVICE_ID_SERVERWORKS_HE: |
diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c index 39c61a71176e..cc7acf877dc0 100644 --- a/drivers/char/cyclades.c +++ b/drivers/char/cyclades.c | |||
@@ -1233,7 +1233,7 @@ cyy_interrupt(int irq, void *dev_id, struct pt_regs *regs) | |||
1233 | } | 1233 | } |
1234 | info->idle_stats.recv_idle = jiffies; | 1234 | info->idle_stats.recv_idle = jiffies; |
1235 | } | 1235 | } |
1236 | schedule_delayed_work(&tty->buf.work, 1); | 1236 | tty_schedule_flip(tty); |
1237 | } | 1237 | } |
1238 | /* end of service */ | 1238 | /* end of service */ |
1239 | cy_writeb(base_addr+(CyRIR<<index), (save_xir & 0x3f)); | 1239 | cy_writeb(base_addr+(CyRIR<<index), (save_xir & 0x3f)); |
@@ -1606,7 +1606,7 @@ cyz_handle_rx(struct cyclades_port *info, | |||
1606 | } | 1606 | } |
1607 | #endif | 1607 | #endif |
1608 | info->idle_stats.recv_idle = jiffies; | 1608 | info->idle_stats.recv_idle = jiffies; |
1609 | schedule_delayed_work(&tty->buf.work, 1); | 1609 | tty_schedule_flip(tty); |
1610 | } | 1610 | } |
1611 | /* Update rx_get */ | 1611 | /* Update rx_get */ |
1612 | cy_writel(&buf_ctrl->rx_get, new_rx_get); | 1612 | cy_writel(&buf_ctrl->rx_get, new_rx_get); |
@@ -1809,7 +1809,7 @@ cyz_handle_cmd(struct cyclades_card *cinfo) | |||
1809 | if(delta_count) | 1809 | if(delta_count) |
1810 | cy_sched_event(info, Cy_EVENT_DELTA_WAKEUP); | 1810 | cy_sched_event(info, Cy_EVENT_DELTA_WAKEUP); |
1811 | if(special_count) | 1811 | if(special_count) |
1812 | schedule_delayed_work(&tty->buf.work, 1); | 1812 | tty_schedule_flip(tty); |
1813 | } | 1813 | } |
1814 | } | 1814 | } |
1815 | 1815 | ||
diff --git a/drivers/char/drm/ati_pcigart.c b/drivers/char/drm/ati_pcigart.c index 5485382cadec..bd7be09ea53d 100644 --- a/drivers/char/drm/ati_pcigart.c +++ b/drivers/char/drm/ati_pcigart.c | |||
@@ -59,17 +59,16 @@ static void *drm_ati_alloc_pcigart_table(void) | |||
59 | int i; | 59 | int i; |
60 | DRM_DEBUG("%s\n", __FUNCTION__); | 60 | DRM_DEBUG("%s\n", __FUNCTION__); |
61 | 61 | ||
62 | address = __get_free_pages(GFP_KERNEL, ATI_PCIGART_TABLE_ORDER); | 62 | address = __get_free_pages(GFP_KERNEL | __GFP_COMP, |
63 | ATI_PCIGART_TABLE_ORDER); | ||
63 | if (address == 0UL) { | 64 | if (address == 0UL) { |
64 | return 0; | 65 | return NULL; |
65 | } | 66 | } |
66 | 67 | ||
67 | page = virt_to_page(address); | 68 | page = virt_to_page(address); |
68 | 69 | ||
69 | for (i = 0; i < ATI_PCIGART_TABLE_PAGES; i++, page++) { | 70 | for (i = 0; i < ATI_PCIGART_TABLE_PAGES; i++, page++) |
70 | get_page(page); | ||
71 | SetPageReserved(page); | 71 | SetPageReserved(page); |
72 | } | ||
73 | 72 | ||
74 | DRM_DEBUG("%s: returning 0x%08lx\n", __FUNCTION__, address); | 73 | DRM_DEBUG("%s: returning 0x%08lx\n", __FUNCTION__, address); |
75 | return (void *)address; | 74 | return (void *)address; |
@@ -83,10 +82,8 @@ static void drm_ati_free_pcigart_table(void *address) | |||
83 | 82 | ||
84 | page = virt_to_page((unsigned long)address); | 83 | page = virt_to_page((unsigned long)address); |
85 | 84 | ||
86 | for (i = 0; i < ATI_PCIGART_TABLE_PAGES; i++, page++) { | 85 | for (i = 0; i < ATI_PCIGART_TABLE_PAGES; i++, page++) |
87 | __put_page(page); | ||
88 | ClearPageReserved(page); | 86 | ClearPageReserved(page); |
89 | } | ||
90 | 87 | ||
91 | free_pages((unsigned long)address, ATI_PCIGART_TABLE_ORDER); | 88 | free_pages((unsigned long)address, ATI_PCIGART_TABLE_ORDER); |
92 | } | 89 | } |
@@ -127,7 +124,7 @@ int drm_ati_pcigart_cleanup(drm_device_t *dev, drm_ati_pcigart_info *gart_info) | |||
127 | if (gart_info->gart_table_location == DRM_ATI_GART_MAIN | 124 | if (gart_info->gart_table_location == DRM_ATI_GART_MAIN |
128 | && gart_info->addr) { | 125 | && gart_info->addr) { |
129 | drm_ati_free_pcigart_table(gart_info->addr); | 126 | drm_ati_free_pcigart_table(gart_info->addr); |
130 | gart_info->addr = 0; | 127 | gart_info->addr = NULL; |
131 | } | 128 | } |
132 | 129 | ||
133 | return 1; | 130 | return 1; |
@@ -168,7 +165,7 @@ int drm_ati_pcigart_init(drm_device_t *dev, drm_ati_pcigart_info *gart_info) | |||
168 | if (bus_address == 0) { | 165 | if (bus_address == 0) { |
169 | DRM_ERROR("unable to map PCIGART pages!\n"); | 166 | DRM_ERROR("unable to map PCIGART pages!\n"); |
170 | drm_ati_free_pcigart_table(address); | 167 | drm_ati_free_pcigart_table(address); |
171 | address = 0; | 168 | address = NULL; |
172 | goto done; | 169 | goto done; |
173 | } | 170 | } |
174 | } else { | 171 | } else { |
diff --git a/drivers/char/drm/drmP.h b/drivers/char/drm/drmP.h index 54b561e69486..107df9fdba4e 100644 --- a/drivers/char/drm/drmP.h +++ b/drivers/char/drm/drmP.h | |||
@@ -57,6 +57,7 @@ | |||
57 | #include <linux/smp_lock.h> /* For (un)lock_kernel */ | 57 | #include <linux/smp_lock.h> /* For (un)lock_kernel */ |
58 | #include <linux/mm.h> | 58 | #include <linux/mm.h> |
59 | #include <linux/cdev.h> | 59 | #include <linux/cdev.h> |
60 | #include <linux/mutex.h> | ||
60 | #if defined(__alpha__) || defined(__powerpc__) | 61 | #if defined(__alpha__) || defined(__powerpc__) |
61 | #include <asm/pgtable.h> /* For pte_wrprotect */ | 62 | #include <asm/pgtable.h> /* For pte_wrprotect */ |
62 | #endif | 63 | #endif |
@@ -623,7 +624,7 @@ typedef struct drm_device { | |||
623 | /** \name Locks */ | 624 | /** \name Locks */ |
624 | /*@{ */ | 625 | /*@{ */ |
625 | spinlock_t count_lock; /**< For inuse, drm_device::open_count, drm_device::buf_use */ | 626 | spinlock_t count_lock; /**< For inuse, drm_device::open_count, drm_device::buf_use */ |
626 | struct semaphore struct_sem; /**< For others */ | 627 | struct mutex struct_mutex; /**< For others */ |
627 | /*@} */ | 628 | /*@} */ |
628 | 629 | ||
629 | /** \name Usage Counters */ | 630 | /** \name Usage Counters */ |
@@ -658,7 +659,7 @@ typedef struct drm_device { | |||
658 | /*@{ */ | 659 | /*@{ */ |
659 | drm_ctx_list_t *ctxlist; /**< Linked list of context handles */ | 660 | drm_ctx_list_t *ctxlist; /**< Linked list of context handles */ |
660 | int ctx_count; /**< Number of context handles */ | 661 | int ctx_count; /**< Number of context handles */ |
661 | struct semaphore ctxlist_sem; /**< For ctxlist */ | 662 | struct mutex ctxlist_mutex; /**< For ctxlist */ |
662 | 663 | ||
663 | drm_map_t **context_sareas; /**< per-context SAREA's */ | 664 | drm_map_t **context_sareas; /**< per-context SAREA's */ |
664 | int max_context; | 665 | int max_context; |
@@ -979,7 +980,7 @@ extern int drm_put_head(drm_head_t * head); | |||
979 | extern unsigned int drm_debug; | 980 | extern unsigned int drm_debug; |
980 | extern unsigned int drm_cards_limit; | 981 | extern unsigned int drm_cards_limit; |
981 | extern drm_head_t **drm_heads; | 982 | extern drm_head_t **drm_heads; |
982 | extern struct drm_sysfs_class *drm_class; | 983 | extern struct class *drm_class; |
983 | extern struct proc_dir_entry *drm_proc_root; | 984 | extern struct proc_dir_entry *drm_proc_root; |
984 | 985 | ||
985 | /* Proc support (drm_proc.h) */ | 986 | /* Proc support (drm_proc.h) */ |
@@ -1010,11 +1011,9 @@ extern void __drm_pci_free(drm_device_t * dev, drm_dma_handle_t * dmah); | |||
1010 | extern void drm_pci_free(drm_device_t * dev, drm_dma_handle_t * dmah); | 1011 | extern void drm_pci_free(drm_device_t * dev, drm_dma_handle_t * dmah); |
1011 | 1012 | ||
1012 | /* sysfs support (drm_sysfs.c) */ | 1013 | /* sysfs support (drm_sysfs.c) */ |
1013 | struct drm_sysfs_class; | 1014 | extern struct class *drm_sysfs_create(struct module *owner, char *name); |
1014 | extern struct drm_sysfs_class *drm_sysfs_create(struct module *owner, | 1015 | extern void drm_sysfs_destroy(struct class *cs); |
1015 | char *name); | 1016 | extern struct class_device *drm_sysfs_device_add(struct class *cs, |
1016 | extern void drm_sysfs_destroy(struct drm_sysfs_class *cs); | ||
1017 | extern struct class_device *drm_sysfs_device_add(struct drm_sysfs_class *cs, | ||
1018 | drm_head_t *head); | 1017 | drm_head_t *head); |
1019 | extern void drm_sysfs_device_remove(struct class_device *class_dev); | 1018 | extern void drm_sysfs_device_remove(struct class_device *class_dev); |
1020 | 1019 | ||
diff --git a/drivers/char/drm/drm_auth.c b/drivers/char/drm/drm_auth.c index a47b502bc7cc..2a37586a7ee8 100644 --- a/drivers/char/drm/drm_auth.c +++ b/drivers/char/drm/drm_auth.c | |||
@@ -56,7 +56,7 @@ static int drm_hash_magic(drm_magic_t magic) | |||
56 | * \param magic magic number. | 56 | * \param magic magic number. |
57 | * | 57 | * |
58 | * Searches in drm_device::magiclist within all files with the same hash key | 58 | * Searches in drm_device::magiclist within all files with the same hash key |
59 | * the one with matching magic number, while holding the drm_device::struct_sem | 59 | * the one with matching magic number, while holding the drm_device::struct_mutex |
60 | * lock. | 60 | * lock. |
61 | */ | 61 | */ |
62 | static drm_file_t *drm_find_file(drm_device_t * dev, drm_magic_t magic) | 62 | static drm_file_t *drm_find_file(drm_device_t * dev, drm_magic_t magic) |
@@ -65,14 +65,14 @@ static drm_file_t *drm_find_file(drm_device_t * dev, drm_magic_t magic) | |||
65 | drm_magic_entry_t *pt; | 65 | drm_magic_entry_t *pt; |
66 | int hash = drm_hash_magic(magic); | 66 | int hash = drm_hash_magic(magic); |
67 | 67 | ||
68 | down(&dev->struct_sem); | 68 | mutex_lock(&dev->struct_mutex); |
69 | for (pt = dev->magiclist[hash].head; pt; pt = pt->next) { | 69 | for (pt = dev->magiclist[hash].head; pt; pt = pt->next) { |
70 | if (pt->magic == magic) { | 70 | if (pt->magic == magic) { |
71 | retval = pt->priv; | 71 | retval = pt->priv; |
72 | break; | 72 | break; |
73 | } | 73 | } |
74 | } | 74 | } |
75 | up(&dev->struct_sem); | 75 | mutex_unlock(&dev->struct_mutex); |
76 | return retval; | 76 | return retval; |
77 | } | 77 | } |
78 | 78 | ||
@@ -85,7 +85,7 @@ static drm_file_t *drm_find_file(drm_device_t * dev, drm_magic_t magic) | |||
85 | * | 85 | * |
86 | * Creates a drm_magic_entry structure and appends to the linked list | 86 | * Creates a drm_magic_entry structure and appends to the linked list |
87 | * associated the magic number hash key in drm_device::magiclist, while holding | 87 | * associated the magic number hash key in drm_device::magiclist, while holding |
88 | * the drm_device::struct_sem lock. | 88 | * the drm_device::struct_mutex lock. |
89 | */ | 89 | */ |
90 | static int drm_add_magic(drm_device_t * dev, drm_file_t * priv, | 90 | static int drm_add_magic(drm_device_t * dev, drm_file_t * priv, |
91 | drm_magic_t magic) | 91 | drm_magic_t magic) |
@@ -104,7 +104,7 @@ static int drm_add_magic(drm_device_t * dev, drm_file_t * priv, | |||
104 | entry->priv = priv; | 104 | entry->priv = priv; |
105 | entry->next = NULL; | 105 | entry->next = NULL; |
106 | 106 | ||
107 | down(&dev->struct_sem); | 107 | mutex_lock(&dev->struct_mutex); |
108 | if (dev->magiclist[hash].tail) { | 108 | if (dev->magiclist[hash].tail) { |
109 | dev->magiclist[hash].tail->next = entry; | 109 | dev->magiclist[hash].tail->next = entry; |
110 | dev->magiclist[hash].tail = entry; | 110 | dev->magiclist[hash].tail = entry; |
@@ -112,7 +112,7 @@ static int drm_add_magic(drm_device_t * dev, drm_file_t * priv, | |||
112 | dev->magiclist[hash].head = entry; | 112 | dev->magiclist[hash].head = entry; |
113 | dev->magiclist[hash].tail = entry; | 113 | dev->magiclist[hash].tail = entry; |
114 | } | 114 | } |
115 | up(&dev->struct_sem); | 115 | mutex_unlock(&dev->struct_mutex); |
116 | 116 | ||
117 | return 0; | 117 | return 0; |
118 | } | 118 | } |
@@ -124,7 +124,7 @@ static int drm_add_magic(drm_device_t * dev, drm_file_t * priv, | |||
124 | * \param magic magic number. | 124 | * \param magic magic number. |
125 | * | 125 | * |
126 | * Searches and unlinks the entry in drm_device::magiclist with the magic | 126 | * Searches and unlinks the entry in drm_device::magiclist with the magic |
127 | * number hash key, while holding the drm_device::struct_sem lock. | 127 | * number hash key, while holding the drm_device::struct_mutex lock. |
128 | */ | 128 | */ |
129 | static int drm_remove_magic(drm_device_t * dev, drm_magic_t magic) | 129 | static int drm_remove_magic(drm_device_t * dev, drm_magic_t magic) |
130 | { | 130 | { |
@@ -135,7 +135,7 @@ static int drm_remove_magic(drm_device_t * dev, drm_magic_t magic) | |||
135 | DRM_DEBUG("%d\n", magic); | 135 | DRM_DEBUG("%d\n", magic); |
136 | hash = drm_hash_magic(magic); | 136 | hash = drm_hash_magic(magic); |
137 | 137 | ||
138 | down(&dev->struct_sem); | 138 | mutex_lock(&dev->struct_mutex); |
139 | for (pt = dev->magiclist[hash].head; pt; prev = pt, pt = pt->next) { | 139 | for (pt = dev->magiclist[hash].head; pt; prev = pt, pt = pt->next) { |
140 | if (pt->magic == magic) { | 140 | if (pt->magic == magic) { |
141 | if (dev->magiclist[hash].head == pt) { | 141 | if (dev->magiclist[hash].head == pt) { |
@@ -147,11 +147,11 @@ static int drm_remove_magic(drm_device_t * dev, drm_magic_t magic) | |||
147 | if (prev) { | 147 | if (prev) { |
148 | prev->next = pt->next; | 148 | prev->next = pt->next; |
149 | } | 149 | } |
150 | up(&dev->struct_sem); | 150 | mutex_unlock(&dev->struct_mutex); |
151 | return 0; | 151 | return 0; |
152 | } | 152 | } |
153 | } | 153 | } |
154 | up(&dev->struct_sem); | 154 | mutex_unlock(&dev->struct_mutex); |
155 | 155 | ||
156 | drm_free(pt, sizeof(*pt), DRM_MEM_MAGIC); | 156 | drm_free(pt, sizeof(*pt), DRM_MEM_MAGIC); |
157 | 157 | ||
diff --git a/drivers/char/drm/drm_bufs.c b/drivers/char/drm/drm_bufs.c index 1db12dcb6802..e2637b4d51de 100644 --- a/drivers/char/drm/drm_bufs.c +++ b/drivers/char/drm/drm_bufs.c | |||
@@ -255,14 +255,14 @@ static int drm_addmap_core(drm_device_t * dev, unsigned int offset, | |||
255 | memset(list, 0, sizeof(*list)); | 255 | memset(list, 0, sizeof(*list)); |
256 | list->map = map; | 256 | list->map = map; |
257 | 257 | ||
258 | down(&dev->struct_sem); | 258 | mutex_lock(&dev->struct_mutex); |
259 | list_add(&list->head, &dev->maplist->head); | 259 | list_add(&list->head, &dev->maplist->head); |
260 | /* Assign a 32-bit handle */ | 260 | /* Assign a 32-bit handle */ |
261 | /* We do it here so that dev->struct_sem protects the increment */ | 261 | /* We do it here so that dev->struct_mutex protects the increment */ |
262 | list->user_token = HandleID(map->type == _DRM_SHM | 262 | list->user_token = HandleID(map->type == _DRM_SHM |
263 | ? (unsigned long)map->handle | 263 | ? (unsigned long)map->handle |
264 | : map->offset, dev); | 264 | : map->offset, dev); |
265 | up(&dev->struct_sem); | 265 | mutex_unlock(&dev->struct_mutex); |
266 | 266 | ||
267 | *maplist = list; | 267 | *maplist = list; |
268 | return 0; | 268 | return 0; |
@@ -392,9 +392,9 @@ int drm_rmmap(drm_device_t *dev, drm_local_map_t *map) | |||
392 | { | 392 | { |
393 | int ret; | 393 | int ret; |
394 | 394 | ||
395 | down(&dev->struct_sem); | 395 | mutex_lock(&dev->struct_mutex); |
396 | ret = drm_rmmap_locked(dev, map); | 396 | ret = drm_rmmap_locked(dev, map); |
397 | up(&dev->struct_sem); | 397 | mutex_unlock(&dev->struct_mutex); |
398 | 398 | ||
399 | return ret; | 399 | return ret; |
400 | } | 400 | } |
@@ -423,7 +423,7 @@ int drm_rmmap_ioctl(struct inode *inode, struct file *filp, | |||
423 | return -EFAULT; | 423 | return -EFAULT; |
424 | } | 424 | } |
425 | 425 | ||
426 | down(&dev->struct_sem); | 426 | mutex_lock(&dev->struct_mutex); |
427 | list_for_each(list, &dev->maplist->head) { | 427 | list_for_each(list, &dev->maplist->head) { |
428 | drm_map_list_t *r_list = list_entry(list, drm_map_list_t, head); | 428 | drm_map_list_t *r_list = list_entry(list, drm_map_list_t, head); |
429 | 429 | ||
@@ -439,7 +439,7 @@ int drm_rmmap_ioctl(struct inode *inode, struct file *filp, | |||
439 | * find anything. | 439 | * find anything. |
440 | */ | 440 | */ |
441 | if (list == (&dev->maplist->head)) { | 441 | if (list == (&dev->maplist->head)) { |
442 | up(&dev->struct_sem); | 442 | mutex_unlock(&dev->struct_mutex); |
443 | return -EINVAL; | 443 | return -EINVAL; |
444 | } | 444 | } |
445 | 445 | ||
@@ -448,13 +448,13 @@ int drm_rmmap_ioctl(struct inode *inode, struct file *filp, | |||
448 | 448 | ||
449 | /* Register and framebuffer maps are permanent */ | 449 | /* Register and framebuffer maps are permanent */ |
450 | if ((map->type == _DRM_REGISTERS) || (map->type == _DRM_FRAME_BUFFER)) { | 450 | if ((map->type == _DRM_REGISTERS) || (map->type == _DRM_FRAME_BUFFER)) { |
451 | up(&dev->struct_sem); | 451 | mutex_unlock(&dev->struct_mutex); |
452 | return 0; | 452 | return 0; |
453 | } | 453 | } |
454 | 454 | ||
455 | ret = drm_rmmap_locked(dev, map); | 455 | ret = drm_rmmap_locked(dev, map); |
456 | 456 | ||
457 | up(&dev->struct_sem); | 457 | mutex_unlock(&dev->struct_mutex); |
458 | 458 | ||
459 | return ret; | 459 | return ret; |
460 | } | 460 | } |
@@ -566,16 +566,16 @@ int drm_addbufs_agp(drm_device_t * dev, drm_buf_desc_t * request) | |||
566 | atomic_inc(&dev->buf_alloc); | 566 | atomic_inc(&dev->buf_alloc); |
567 | spin_unlock(&dev->count_lock); | 567 | spin_unlock(&dev->count_lock); |
568 | 568 | ||
569 | down(&dev->struct_sem); | 569 | mutex_lock(&dev->struct_mutex); |
570 | entry = &dma->bufs[order]; | 570 | entry = &dma->bufs[order]; |
571 | if (entry->buf_count) { | 571 | if (entry->buf_count) { |
572 | up(&dev->struct_sem); | 572 | mutex_unlock(&dev->struct_mutex); |
573 | atomic_dec(&dev->buf_alloc); | 573 | atomic_dec(&dev->buf_alloc); |
574 | return -ENOMEM; /* May only call once for each order */ | 574 | return -ENOMEM; /* May only call once for each order */ |
575 | } | 575 | } |
576 | 576 | ||
577 | if (count < 0 || count > 4096) { | 577 | if (count < 0 || count > 4096) { |
578 | up(&dev->struct_sem); | 578 | mutex_unlock(&dev->struct_mutex); |
579 | atomic_dec(&dev->buf_alloc); | 579 | atomic_dec(&dev->buf_alloc); |
580 | return -EINVAL; | 580 | return -EINVAL; |
581 | } | 581 | } |
@@ -583,7 +583,7 @@ int drm_addbufs_agp(drm_device_t * dev, drm_buf_desc_t * request) | |||
583 | entry->buflist = drm_alloc(count * sizeof(*entry->buflist), | 583 | entry->buflist = drm_alloc(count * sizeof(*entry->buflist), |
584 | DRM_MEM_BUFS); | 584 | DRM_MEM_BUFS); |
585 | if (!entry->buflist) { | 585 | if (!entry->buflist) { |
586 | up(&dev->struct_sem); | 586 | mutex_unlock(&dev->struct_mutex); |
587 | atomic_dec(&dev->buf_alloc); | 587 | atomic_dec(&dev->buf_alloc); |
588 | return -ENOMEM; | 588 | return -ENOMEM; |
589 | } | 589 | } |
@@ -616,7 +616,7 @@ int drm_addbufs_agp(drm_device_t * dev, drm_buf_desc_t * request) | |||
616 | /* Set count correctly so we free the proper amount. */ | 616 | /* Set count correctly so we free the proper amount. */ |
617 | entry->buf_count = count; | 617 | entry->buf_count = count; |
618 | drm_cleanup_buf_error(dev, entry); | 618 | drm_cleanup_buf_error(dev, entry); |
619 | up(&dev->struct_sem); | 619 | mutex_unlock(&dev->struct_mutex); |
620 | atomic_dec(&dev->buf_alloc); | 620 | atomic_dec(&dev->buf_alloc); |
621 | return -ENOMEM; | 621 | return -ENOMEM; |
622 | } | 622 | } |
@@ -638,7 +638,7 @@ int drm_addbufs_agp(drm_device_t * dev, drm_buf_desc_t * request) | |||
638 | if (!temp_buflist) { | 638 | if (!temp_buflist) { |
639 | /* Free the entry because it isn't valid */ | 639 | /* Free the entry because it isn't valid */ |
640 | drm_cleanup_buf_error(dev, entry); | 640 | drm_cleanup_buf_error(dev, entry); |
641 | up(&dev->struct_sem); | 641 | mutex_unlock(&dev->struct_mutex); |
642 | atomic_dec(&dev->buf_alloc); | 642 | atomic_dec(&dev->buf_alloc); |
643 | return -ENOMEM; | 643 | return -ENOMEM; |
644 | } | 644 | } |
@@ -656,7 +656,7 @@ int drm_addbufs_agp(drm_device_t * dev, drm_buf_desc_t * request) | |||
656 | DRM_DEBUG("dma->buf_count : %d\n", dma->buf_count); | 656 | DRM_DEBUG("dma->buf_count : %d\n", dma->buf_count); |
657 | DRM_DEBUG("entry->buf_count : %d\n", entry->buf_count); | 657 | DRM_DEBUG("entry->buf_count : %d\n", entry->buf_count); |
658 | 658 | ||
659 | up(&dev->struct_sem); | 659 | mutex_unlock(&dev->struct_mutex); |
660 | 660 | ||
661 | request->count = entry->buf_count; | 661 | request->count = entry->buf_count; |
662 | request->size = size; | 662 | request->size = size; |
@@ -722,16 +722,16 @@ int drm_addbufs_pci(drm_device_t * dev, drm_buf_desc_t * request) | |||
722 | atomic_inc(&dev->buf_alloc); | 722 | atomic_inc(&dev->buf_alloc); |
723 | spin_unlock(&dev->count_lock); | 723 | spin_unlock(&dev->count_lock); |
724 | 724 | ||
725 | down(&dev->struct_sem); | 725 | mutex_lock(&dev->struct_mutex); |
726 | entry = &dma->bufs[order]; | 726 | entry = &dma->bufs[order]; |
727 | if (entry->buf_count) { | 727 | if (entry->buf_count) { |
728 | up(&dev->struct_sem); | 728 | mutex_unlock(&dev->struct_mutex); |
729 | atomic_dec(&dev->buf_alloc); | 729 | atomic_dec(&dev->buf_alloc); |
730 | return -ENOMEM; /* May only call once for each order */ | 730 | return -ENOMEM; /* May only call once for each order */ |
731 | } | 731 | } |
732 | 732 | ||
733 | if (count < 0 || count > 4096) { | 733 | if (count < 0 || count > 4096) { |
734 | up(&dev->struct_sem); | 734 | mutex_unlock(&dev->struct_mutex); |
735 | atomic_dec(&dev->buf_alloc); | 735 | atomic_dec(&dev->buf_alloc); |
736 | return -EINVAL; | 736 | return -EINVAL; |
737 | } | 737 | } |
@@ -739,7 +739,7 @@ int drm_addbufs_pci(drm_device_t * dev, drm_buf_desc_t * request) | |||
739 | entry->buflist = drm_alloc(count * sizeof(*entry->buflist), | 739 | entry->buflist = drm_alloc(count * sizeof(*entry->buflist), |
740 | DRM_MEM_BUFS); | 740 | DRM_MEM_BUFS); |
741 | if (!entry->buflist) { | 741 | if (!entry->buflist) { |
742 | up(&dev->struct_sem); | 742 | mutex_unlock(&dev->struct_mutex); |
743 | atomic_dec(&dev->buf_alloc); | 743 | atomic_dec(&dev->buf_alloc); |
744 | return -ENOMEM; | 744 | return -ENOMEM; |
745 | } | 745 | } |
@@ -750,7 +750,7 @@ int drm_addbufs_pci(drm_device_t * dev, drm_buf_desc_t * request) | |||
750 | if (!entry->seglist) { | 750 | if (!entry->seglist) { |
751 | drm_free(entry->buflist, | 751 | drm_free(entry->buflist, |
752 | count * sizeof(*entry->buflist), DRM_MEM_BUFS); | 752 | count * sizeof(*entry->buflist), DRM_MEM_BUFS); |
753 | up(&dev->struct_sem); | 753 | mutex_unlock(&dev->struct_mutex); |
754 | atomic_dec(&dev->buf_alloc); | 754 | atomic_dec(&dev->buf_alloc); |
755 | return -ENOMEM; | 755 | return -ENOMEM; |
756 | } | 756 | } |
@@ -766,7 +766,7 @@ int drm_addbufs_pci(drm_device_t * dev, drm_buf_desc_t * request) | |||
766 | count * sizeof(*entry->buflist), DRM_MEM_BUFS); | 766 | count * sizeof(*entry->buflist), DRM_MEM_BUFS); |
767 | drm_free(entry->seglist, | 767 | drm_free(entry->seglist, |
768 | count * sizeof(*entry->seglist), DRM_MEM_SEGS); | 768 | count * sizeof(*entry->seglist), DRM_MEM_SEGS); |
769 | up(&dev->struct_sem); | 769 | mutex_unlock(&dev->struct_mutex); |
770 | atomic_dec(&dev->buf_alloc); | 770 | atomic_dec(&dev->buf_alloc); |
771 | return -ENOMEM; | 771 | return -ENOMEM; |
772 | } | 772 | } |
@@ -790,7 +790,7 @@ int drm_addbufs_pci(drm_device_t * dev, drm_buf_desc_t * request) | |||
790 | drm_free(temp_pagelist, | 790 | drm_free(temp_pagelist, |
791 | (dma->page_count + (count << page_order)) | 791 | (dma->page_count + (count << page_order)) |
792 | * sizeof(*dma->pagelist), DRM_MEM_PAGES); | 792 | * sizeof(*dma->pagelist), DRM_MEM_PAGES); |
793 | up(&dev->struct_sem); | 793 | mutex_unlock(&dev->struct_mutex); |
794 | atomic_dec(&dev->buf_alloc); | 794 | atomic_dec(&dev->buf_alloc); |
795 | return -ENOMEM; | 795 | return -ENOMEM; |
796 | } | 796 | } |
@@ -831,7 +831,7 @@ int drm_addbufs_pci(drm_device_t * dev, drm_buf_desc_t * request) | |||
831 | (count << page_order)) | 831 | (count << page_order)) |
832 | * sizeof(*dma->pagelist), | 832 | * sizeof(*dma->pagelist), |
833 | DRM_MEM_PAGES); | 833 | DRM_MEM_PAGES); |
834 | up(&dev->struct_sem); | 834 | mutex_unlock(&dev->struct_mutex); |
835 | atomic_dec(&dev->buf_alloc); | 835 | atomic_dec(&dev->buf_alloc); |
836 | return -ENOMEM; | 836 | return -ENOMEM; |
837 | } | 837 | } |
@@ -853,7 +853,7 @@ int drm_addbufs_pci(drm_device_t * dev, drm_buf_desc_t * request) | |||
853 | drm_free(temp_pagelist, | 853 | drm_free(temp_pagelist, |
854 | (dma->page_count + (count << page_order)) | 854 | (dma->page_count + (count << page_order)) |
855 | * sizeof(*dma->pagelist), DRM_MEM_PAGES); | 855 | * sizeof(*dma->pagelist), DRM_MEM_PAGES); |
856 | up(&dev->struct_sem); | 856 | mutex_unlock(&dev->struct_mutex); |
857 | atomic_dec(&dev->buf_alloc); | 857 | atomic_dec(&dev->buf_alloc); |
858 | return -ENOMEM; | 858 | return -ENOMEM; |
859 | } | 859 | } |
@@ -878,7 +878,7 @@ int drm_addbufs_pci(drm_device_t * dev, drm_buf_desc_t * request) | |||
878 | dma->page_count += entry->seg_count << page_order; | 878 | dma->page_count += entry->seg_count << page_order; |
879 | dma->byte_count += PAGE_SIZE * (entry->seg_count << page_order); | 879 | dma->byte_count += PAGE_SIZE * (entry->seg_count << page_order); |
880 | 880 | ||
881 | up(&dev->struct_sem); | 881 | mutex_unlock(&dev->struct_mutex); |
882 | 882 | ||
883 | request->count = entry->buf_count; | 883 | request->count = entry->buf_count; |
884 | request->size = size; | 884 | request->size = size; |
@@ -948,16 +948,16 @@ static int drm_addbufs_sg(drm_device_t * dev, drm_buf_desc_t * request) | |||
948 | atomic_inc(&dev->buf_alloc); | 948 | atomic_inc(&dev->buf_alloc); |
949 | spin_unlock(&dev->count_lock); | 949 | spin_unlock(&dev->count_lock); |
950 | 950 | ||
951 | down(&dev->struct_sem); | 951 | mutex_lock(&dev->struct_mutex); |
952 | entry = &dma->bufs[order]; | 952 | entry = &dma->bufs[order]; |
953 | if (entry->buf_count) { | 953 | if (entry->buf_count) { |
954 | up(&dev->struct_sem); | 954 | mutex_unlock(&dev->struct_mutex); |
955 | atomic_dec(&dev->buf_alloc); | 955 | atomic_dec(&dev->buf_alloc); |
956 | return -ENOMEM; /* May only call once for each order */ | 956 | return -ENOMEM; /* May only call once for each order */ |
957 | } | 957 | } |
958 | 958 | ||
959 | if (count < 0 || count > 4096) { | 959 | if (count < 0 || count > 4096) { |
960 | up(&dev->struct_sem); | 960 | mutex_unlock(&dev->struct_mutex); |
961 | atomic_dec(&dev->buf_alloc); | 961 | atomic_dec(&dev->buf_alloc); |
962 | return -EINVAL; | 962 | return -EINVAL; |
963 | } | 963 | } |
@@ -965,7 +965,7 @@ static int drm_addbufs_sg(drm_device_t * dev, drm_buf_desc_t * request) | |||
965 | entry->buflist = drm_alloc(count * sizeof(*entry->buflist), | 965 | entry->buflist = drm_alloc(count * sizeof(*entry->buflist), |
966 | DRM_MEM_BUFS); | 966 | DRM_MEM_BUFS); |
967 | if (!entry->buflist) { | 967 | if (!entry->buflist) { |
968 | up(&dev->struct_sem); | 968 | mutex_unlock(&dev->struct_mutex); |
969 | atomic_dec(&dev->buf_alloc); | 969 | atomic_dec(&dev->buf_alloc); |
970 | return -ENOMEM; | 970 | return -ENOMEM; |
971 | } | 971 | } |
@@ -999,7 +999,7 @@ static int drm_addbufs_sg(drm_device_t * dev, drm_buf_desc_t * request) | |||
999 | /* Set count correctly so we free the proper amount. */ | 999 | /* Set count correctly so we free the proper amount. */ |
1000 | entry->buf_count = count; | 1000 | entry->buf_count = count; |
1001 | drm_cleanup_buf_error(dev, entry); | 1001 | drm_cleanup_buf_error(dev, entry); |
1002 | up(&dev->struct_sem); | 1002 | mutex_unlock(&dev->struct_mutex); |
1003 | atomic_dec(&dev->buf_alloc); | 1003 | atomic_dec(&dev->buf_alloc); |
1004 | return -ENOMEM; | 1004 | return -ENOMEM; |
1005 | } | 1005 | } |
@@ -1022,7 +1022,7 @@ static int drm_addbufs_sg(drm_device_t * dev, drm_buf_desc_t * request) | |||
1022 | if (!temp_buflist) { | 1022 | if (!temp_buflist) { |
1023 | /* Free the entry because it isn't valid */ | 1023 | /* Free the entry because it isn't valid */ |
1024 | drm_cleanup_buf_error(dev, entry); | 1024 | drm_cleanup_buf_error(dev, entry); |
1025 | up(&dev->struct_sem); | 1025 | mutex_unlock(&dev->struct_mutex); |
1026 | atomic_dec(&dev->buf_alloc); | 1026 | atomic_dec(&dev->buf_alloc); |
1027 | return -ENOMEM; | 1027 | return -ENOMEM; |
1028 | } | 1028 | } |
@@ -1040,7 +1040,7 @@ static int drm_addbufs_sg(drm_device_t * dev, drm_buf_desc_t * request) | |||
1040 | DRM_DEBUG("dma->buf_count : %d\n", dma->buf_count); | 1040 | DRM_DEBUG("dma->buf_count : %d\n", dma->buf_count); |
1041 | DRM_DEBUG("entry->buf_count : %d\n", entry->buf_count); | 1041 | DRM_DEBUG("entry->buf_count : %d\n", entry->buf_count); |
1042 | 1042 | ||
1043 | up(&dev->struct_sem); | 1043 | mutex_unlock(&dev->struct_mutex); |
1044 | 1044 | ||
1045 | request->count = entry->buf_count; | 1045 | request->count = entry->buf_count; |
1046 | request->size = size; | 1046 | request->size = size; |
@@ -1110,16 +1110,16 @@ int drm_addbufs_fb(drm_device_t * dev, drm_buf_desc_t * request) | |||
1110 | atomic_inc(&dev->buf_alloc); | 1110 | atomic_inc(&dev->buf_alloc); |
1111 | spin_unlock(&dev->count_lock); | 1111 | spin_unlock(&dev->count_lock); |
1112 | 1112 | ||
1113 | down(&dev->struct_sem); | 1113 | mutex_lock(&dev->struct_mutex); |
1114 | entry = &dma->bufs[order]; | 1114 | entry = &dma->bufs[order]; |
1115 | if (entry->buf_count) { | 1115 | if (entry->buf_count) { |
1116 | up(&dev->struct_sem); | 1116 | mutex_unlock(&dev->struct_mutex); |
1117 | atomic_dec(&dev->buf_alloc); | 1117 | atomic_dec(&dev->buf_alloc); |
1118 | return -ENOMEM; /* May only call once for each order */ | 1118 | return -ENOMEM; /* May only call once for each order */ |
1119 | } | 1119 | } |
1120 | 1120 | ||
1121 | if (count < 0 || count > 4096) { | 1121 | if (count < 0 || count > 4096) { |
1122 | up(&dev->struct_sem); | 1122 | mutex_unlock(&dev->struct_mutex); |
1123 | atomic_dec(&dev->buf_alloc); | 1123 | atomic_dec(&dev->buf_alloc); |
1124 | return -EINVAL; | 1124 | return -EINVAL; |
1125 | } | 1125 | } |
@@ -1127,7 +1127,7 @@ int drm_addbufs_fb(drm_device_t * dev, drm_buf_desc_t * request) | |||
1127 | entry->buflist = drm_alloc(count * sizeof(*entry->buflist), | 1127 | entry->buflist = drm_alloc(count * sizeof(*entry->buflist), |
1128 | DRM_MEM_BUFS); | 1128 | DRM_MEM_BUFS); |
1129 | if (!entry->buflist) { | 1129 | if (!entry->buflist) { |
1130 | up(&dev->struct_sem); | 1130 | mutex_unlock(&dev->struct_mutex); |
1131 | atomic_dec(&dev->buf_alloc); | 1131 | atomic_dec(&dev->buf_alloc); |
1132 | return -ENOMEM; | 1132 | return -ENOMEM; |
1133 | } | 1133 | } |
@@ -1160,7 +1160,7 @@ int drm_addbufs_fb(drm_device_t * dev, drm_buf_desc_t * request) | |||
1160 | /* Set count correctly so we free the proper amount. */ | 1160 | /* Set count correctly so we free the proper amount. */ |
1161 | entry->buf_count = count; | 1161 | entry->buf_count = count; |
1162 | drm_cleanup_buf_error(dev, entry); | 1162 | drm_cleanup_buf_error(dev, entry); |
1163 | up(&dev->struct_sem); | 1163 | mutex_unlock(&dev->struct_mutex); |
1164 | atomic_dec(&dev->buf_alloc); | 1164 | atomic_dec(&dev->buf_alloc); |
1165 | return -ENOMEM; | 1165 | return -ENOMEM; |
1166 | } | 1166 | } |
@@ -1182,7 +1182,7 @@ int drm_addbufs_fb(drm_device_t * dev, drm_buf_desc_t * request) | |||
1182 | if (!temp_buflist) { | 1182 | if (!temp_buflist) { |
1183 | /* Free the entry because it isn't valid */ | 1183 | /* Free the entry because it isn't valid */ |
1184 | drm_cleanup_buf_error(dev, entry); | 1184 | drm_cleanup_buf_error(dev, entry); |
1185 | up(&dev->struct_sem); | 1185 | mutex_unlock(&dev->struct_mutex); |
1186 | atomic_dec(&dev->buf_alloc); | 1186 | atomic_dec(&dev->buf_alloc); |
1187 | return -ENOMEM; | 1187 | return -ENOMEM; |
1188 | } | 1188 | } |
@@ -1200,7 +1200,7 @@ int drm_addbufs_fb(drm_device_t * dev, drm_buf_desc_t * request) | |||
1200 | DRM_DEBUG("dma->buf_count : %d\n", dma->buf_count); | 1200 | DRM_DEBUG("dma->buf_count : %d\n", dma->buf_count); |
1201 | DRM_DEBUG("entry->buf_count : %d\n", entry->buf_count); | 1201 | DRM_DEBUG("entry->buf_count : %d\n", entry->buf_count); |
1202 | 1202 | ||
1203 | up(&dev->struct_sem); | 1203 | mutex_unlock(&dev->struct_mutex); |
1204 | 1204 | ||
1205 | request->count = entry->buf_count; | 1205 | request->count = entry->buf_count; |
1206 | request->size = size; | 1206 | request->size = size; |
diff --git a/drivers/char/drm/drm_context.c b/drivers/char/drm/drm_context.c index f84254526949..83094c73da67 100644 --- a/drivers/char/drm/drm_context.c +++ b/drivers/char/drm/drm_context.c | |||
@@ -53,7 +53,7 @@ | |||
53 | * \param ctx_handle context handle. | 53 | * \param ctx_handle context handle. |
54 | * | 54 | * |
55 | * Clears the bit specified by \p ctx_handle in drm_device::ctx_bitmap and the entry | 55 | * Clears the bit specified by \p ctx_handle in drm_device::ctx_bitmap and the entry |
56 | * in drm_device::context_sareas, while holding the drm_device::struct_sem | 56 | * in drm_device::context_sareas, while holding the drm_device::struct_mutex |
57 | * lock. | 57 | * lock. |
58 | */ | 58 | */ |
59 | void drm_ctxbitmap_free(drm_device_t * dev, int ctx_handle) | 59 | void drm_ctxbitmap_free(drm_device_t * dev, int ctx_handle) |
@@ -64,10 +64,10 @@ void drm_ctxbitmap_free(drm_device_t * dev, int ctx_handle) | |||
64 | goto failed; | 64 | goto failed; |
65 | 65 | ||
66 | if (ctx_handle < DRM_MAX_CTXBITMAP) { | 66 | if (ctx_handle < DRM_MAX_CTXBITMAP) { |
67 | down(&dev->struct_sem); | 67 | mutex_lock(&dev->struct_mutex); |
68 | clear_bit(ctx_handle, dev->ctx_bitmap); | 68 | clear_bit(ctx_handle, dev->ctx_bitmap); |
69 | dev->context_sareas[ctx_handle] = NULL; | 69 | dev->context_sareas[ctx_handle] = NULL; |
70 | up(&dev->struct_sem); | 70 | mutex_unlock(&dev->struct_mutex); |
71 | return; | 71 | return; |
72 | } | 72 | } |
73 | failed: | 73 | failed: |
@@ -83,7 +83,7 @@ void drm_ctxbitmap_free(drm_device_t * dev, int ctx_handle) | |||
83 | * | 83 | * |
84 | * Find the first zero bit in drm_device::ctx_bitmap and (re)allocates | 84 | * Find the first zero bit in drm_device::ctx_bitmap and (re)allocates |
85 | * drm_device::context_sareas to accommodate the new entry while holding the | 85 | * drm_device::context_sareas to accommodate the new entry while holding the |
86 | * drm_device::struct_sem lock. | 86 | * drm_device::struct_mutex lock. |
87 | */ | 87 | */ |
88 | static int drm_ctxbitmap_next(drm_device_t * dev) | 88 | static int drm_ctxbitmap_next(drm_device_t * dev) |
89 | { | 89 | { |
@@ -92,7 +92,7 @@ static int drm_ctxbitmap_next(drm_device_t * dev) | |||
92 | if (!dev->ctx_bitmap) | 92 | if (!dev->ctx_bitmap) |
93 | return -1; | 93 | return -1; |
94 | 94 | ||
95 | down(&dev->struct_sem); | 95 | mutex_lock(&dev->struct_mutex); |
96 | bit = find_first_zero_bit(dev->ctx_bitmap, DRM_MAX_CTXBITMAP); | 96 | bit = find_first_zero_bit(dev->ctx_bitmap, DRM_MAX_CTXBITMAP); |
97 | if (bit < DRM_MAX_CTXBITMAP) { | 97 | if (bit < DRM_MAX_CTXBITMAP) { |
98 | set_bit(bit, dev->ctx_bitmap); | 98 | set_bit(bit, dev->ctx_bitmap); |
@@ -113,7 +113,7 @@ static int drm_ctxbitmap_next(drm_device_t * dev) | |||
113 | DRM_MEM_MAPS); | 113 | DRM_MEM_MAPS); |
114 | if (!ctx_sareas) { | 114 | if (!ctx_sareas) { |
115 | clear_bit(bit, dev->ctx_bitmap); | 115 | clear_bit(bit, dev->ctx_bitmap); |
116 | up(&dev->struct_sem); | 116 | mutex_unlock(&dev->struct_mutex); |
117 | return -1; | 117 | return -1; |
118 | } | 118 | } |
119 | dev->context_sareas = ctx_sareas; | 119 | dev->context_sareas = ctx_sareas; |
@@ -126,16 +126,16 @@ static int drm_ctxbitmap_next(drm_device_t * dev) | |||
126 | DRM_MEM_MAPS); | 126 | DRM_MEM_MAPS); |
127 | if (!dev->context_sareas) { | 127 | if (!dev->context_sareas) { |
128 | clear_bit(bit, dev->ctx_bitmap); | 128 | clear_bit(bit, dev->ctx_bitmap); |
129 | up(&dev->struct_sem); | 129 | mutex_unlock(&dev->struct_mutex); |
130 | return -1; | 130 | return -1; |
131 | } | 131 | } |
132 | dev->context_sareas[bit] = NULL; | 132 | dev->context_sareas[bit] = NULL; |
133 | } | 133 | } |
134 | } | 134 | } |
135 | up(&dev->struct_sem); | 135 | mutex_unlock(&dev->struct_mutex); |
136 | return bit; | 136 | return bit; |
137 | } | 137 | } |
138 | up(&dev->struct_sem); | 138 | mutex_unlock(&dev->struct_mutex); |
139 | return -1; | 139 | return -1; |
140 | } | 140 | } |
141 | 141 | ||
@@ -145,24 +145,24 @@ static int drm_ctxbitmap_next(drm_device_t * dev) | |||
145 | * \param dev DRM device. | 145 | * \param dev DRM device. |
146 | * | 146 | * |
147 | * Allocates and initialize drm_device::ctx_bitmap and drm_device::context_sareas, while holding | 147 | * Allocates and initialize drm_device::ctx_bitmap and drm_device::context_sareas, while holding |
148 | * the drm_device::struct_sem lock. | 148 | * the drm_device::struct_mutex lock. |
149 | */ | 149 | */ |
150 | int drm_ctxbitmap_init(drm_device_t * dev) | 150 | int drm_ctxbitmap_init(drm_device_t * dev) |
151 | { | 151 | { |
152 | int i; | 152 | int i; |
153 | int temp; | 153 | int temp; |
154 | 154 | ||
155 | down(&dev->struct_sem); | 155 | mutex_lock(&dev->struct_mutex); |
156 | dev->ctx_bitmap = (unsigned long *)drm_alloc(PAGE_SIZE, | 156 | dev->ctx_bitmap = (unsigned long *)drm_alloc(PAGE_SIZE, |
157 | DRM_MEM_CTXBITMAP); | 157 | DRM_MEM_CTXBITMAP); |
158 | if (dev->ctx_bitmap == NULL) { | 158 | if (dev->ctx_bitmap == NULL) { |
159 | up(&dev->struct_sem); | 159 | mutex_unlock(&dev->struct_mutex); |
160 | return -ENOMEM; | 160 | return -ENOMEM; |
161 | } | 161 | } |
162 | memset((void *)dev->ctx_bitmap, 0, PAGE_SIZE); | 162 | memset((void *)dev->ctx_bitmap, 0, PAGE_SIZE); |
163 | dev->context_sareas = NULL; | 163 | dev->context_sareas = NULL; |
164 | dev->max_context = -1; | 164 | dev->max_context = -1; |
165 | up(&dev->struct_sem); | 165 | mutex_unlock(&dev->struct_mutex); |
166 | 166 | ||
167 | for (i = 0; i < DRM_RESERVED_CONTEXTS; i++) { | 167 | for (i = 0; i < DRM_RESERVED_CONTEXTS; i++) { |
168 | temp = drm_ctxbitmap_next(dev); | 168 | temp = drm_ctxbitmap_next(dev); |
@@ -178,17 +178,17 @@ int drm_ctxbitmap_init(drm_device_t * dev) | |||
178 | * \param dev DRM device. | 178 | * \param dev DRM device. |
179 | * | 179 | * |
180 | * Frees drm_device::ctx_bitmap and drm_device::context_sareas, while holding | 180 | * Frees drm_device::ctx_bitmap and drm_device::context_sareas, while holding |
181 | * the drm_device::struct_sem lock. | 181 | * the drm_device::struct_mutex lock. |
182 | */ | 182 | */ |
183 | void drm_ctxbitmap_cleanup(drm_device_t * dev) | 183 | void drm_ctxbitmap_cleanup(drm_device_t * dev) |
184 | { | 184 | { |
185 | down(&dev->struct_sem); | 185 | mutex_lock(&dev->struct_mutex); |
186 | if (dev->context_sareas) | 186 | if (dev->context_sareas) |
187 | drm_free(dev->context_sareas, | 187 | drm_free(dev->context_sareas, |
188 | sizeof(*dev->context_sareas) * | 188 | sizeof(*dev->context_sareas) * |
189 | dev->max_context, DRM_MEM_MAPS); | 189 | dev->max_context, DRM_MEM_MAPS); |
190 | drm_free((void *)dev->ctx_bitmap, PAGE_SIZE, DRM_MEM_CTXBITMAP); | 190 | drm_free((void *)dev->ctx_bitmap, PAGE_SIZE, DRM_MEM_CTXBITMAP); |
191 | up(&dev->struct_sem); | 191 | mutex_unlock(&dev->struct_mutex); |
192 | } | 192 | } |
193 | 193 | ||
194 | /*@}*/ | 194 | /*@}*/ |
@@ -222,15 +222,15 @@ int drm_getsareactx(struct inode *inode, struct file *filp, | |||
222 | if (copy_from_user(&request, argp, sizeof(request))) | 222 | if (copy_from_user(&request, argp, sizeof(request))) |
223 | return -EFAULT; | 223 | return -EFAULT; |
224 | 224 | ||
225 | down(&dev->struct_sem); | 225 | mutex_lock(&dev->struct_mutex); |
226 | if (dev->max_context < 0 | 226 | if (dev->max_context < 0 |
227 | || request.ctx_id >= (unsigned)dev->max_context) { | 227 | || request.ctx_id >= (unsigned)dev->max_context) { |
228 | up(&dev->struct_sem); | 228 | mutex_unlock(&dev->struct_mutex); |
229 | return -EINVAL; | 229 | return -EINVAL; |
230 | } | 230 | } |
231 | 231 | ||
232 | map = dev->context_sareas[request.ctx_id]; | 232 | map = dev->context_sareas[request.ctx_id]; |
233 | up(&dev->struct_sem); | 233 | mutex_unlock(&dev->struct_mutex); |
234 | 234 | ||
235 | request.handle = NULL; | 235 | request.handle = NULL; |
236 | list_for_each_entry(_entry, &dev->maplist->head, head) { | 236 | list_for_each_entry(_entry, &dev->maplist->head, head) { |
@@ -274,7 +274,7 @@ int drm_setsareactx(struct inode *inode, struct file *filp, | |||
274 | (drm_ctx_priv_map_t __user *) arg, sizeof(request))) | 274 | (drm_ctx_priv_map_t __user *) arg, sizeof(request))) |
275 | return -EFAULT; | 275 | return -EFAULT; |
276 | 276 | ||
277 | down(&dev->struct_sem); | 277 | mutex_lock(&dev->struct_mutex); |
278 | list_for_each(list, &dev->maplist->head) { | 278 | list_for_each(list, &dev->maplist->head) { |
279 | r_list = list_entry(list, drm_map_list_t, head); | 279 | r_list = list_entry(list, drm_map_list_t, head); |
280 | if (r_list->map | 280 | if (r_list->map |
@@ -282,7 +282,7 @@ int drm_setsareactx(struct inode *inode, struct file *filp, | |||
282 | goto found; | 282 | goto found; |
283 | } | 283 | } |
284 | bad: | 284 | bad: |
285 | up(&dev->struct_sem); | 285 | mutex_unlock(&dev->struct_mutex); |
286 | return -EINVAL; | 286 | return -EINVAL; |
287 | 287 | ||
288 | found: | 288 | found: |
@@ -294,7 +294,7 @@ int drm_setsareactx(struct inode *inode, struct file *filp, | |||
294 | if (request.ctx_id >= (unsigned)dev->max_context) | 294 | if (request.ctx_id >= (unsigned)dev->max_context) |
295 | goto bad; | 295 | goto bad; |
296 | dev->context_sareas[request.ctx_id] = map; | 296 | dev->context_sareas[request.ctx_id] = map; |
297 | up(&dev->struct_sem); | 297 | mutex_unlock(&dev->struct_mutex); |
298 | return 0; | 298 | return 0; |
299 | } | 299 | } |
300 | 300 | ||
@@ -448,10 +448,10 @@ int drm_addctx(struct inode *inode, struct file *filp, | |||
448 | ctx_entry->handle = ctx.handle; | 448 | ctx_entry->handle = ctx.handle; |
449 | ctx_entry->tag = priv; | 449 | ctx_entry->tag = priv; |
450 | 450 | ||
451 | down(&dev->ctxlist_sem); | 451 | mutex_lock(&dev->ctxlist_mutex); |
452 | list_add(&ctx_entry->head, &dev->ctxlist->head); | 452 | list_add(&ctx_entry->head, &dev->ctxlist->head); |
453 | ++dev->ctx_count; | 453 | ++dev->ctx_count; |
454 | up(&dev->ctxlist_sem); | 454 | mutex_unlock(&dev->ctxlist_mutex); |
455 | 455 | ||
456 | if (copy_to_user(argp, &ctx, sizeof(ctx))) | 456 | if (copy_to_user(argp, &ctx, sizeof(ctx))) |
457 | return -EFAULT; | 457 | return -EFAULT; |
@@ -574,7 +574,7 @@ int drm_rmctx(struct inode *inode, struct file *filp, | |||
574 | drm_ctxbitmap_free(dev, ctx.handle); | 574 | drm_ctxbitmap_free(dev, ctx.handle); |
575 | } | 575 | } |
576 | 576 | ||
577 | down(&dev->ctxlist_sem); | 577 | mutex_lock(&dev->ctxlist_mutex); |
578 | if (!list_empty(&dev->ctxlist->head)) { | 578 | if (!list_empty(&dev->ctxlist->head)) { |
579 | drm_ctx_list_t *pos, *n; | 579 | drm_ctx_list_t *pos, *n; |
580 | 580 | ||
@@ -586,7 +586,7 @@ int drm_rmctx(struct inode *inode, struct file *filp, | |||
586 | } | 586 | } |
587 | } | 587 | } |
588 | } | 588 | } |
589 | up(&dev->ctxlist_sem); | 589 | mutex_unlock(&dev->ctxlist_mutex); |
590 | 590 | ||
591 | return 0; | 591 | return 0; |
592 | } | 592 | } |
diff --git a/drivers/char/drm/drm_drv.c b/drivers/char/drm/drm_drv.c index c4fa5a29582b..dc6bbe8a18dc 100644 --- a/drivers/char/drm/drm_drv.c +++ b/drivers/char/drm/drm_drv.c | |||
@@ -151,7 +151,7 @@ int drm_lastclose(drm_device_t * dev) | |||
151 | if (dev->irq_enabled) | 151 | if (dev->irq_enabled) |
152 | drm_irq_uninstall(dev); | 152 | drm_irq_uninstall(dev); |
153 | 153 | ||
154 | down(&dev->struct_sem); | 154 | mutex_lock(&dev->struct_mutex); |
155 | del_timer(&dev->timer); | 155 | del_timer(&dev->timer); |
156 | 156 | ||
157 | /* Clear pid list */ | 157 | /* Clear pid list */ |
@@ -231,7 +231,7 @@ int drm_lastclose(drm_device_t * dev) | |||
231 | dev->lock.filp = NULL; | 231 | dev->lock.filp = NULL; |
232 | wake_up_interruptible(&dev->lock.lock_queue); | 232 | wake_up_interruptible(&dev->lock.lock_queue); |
233 | } | 233 | } |
234 | up(&dev->struct_sem); | 234 | mutex_unlock(&dev->struct_mutex); |
235 | 235 | ||
236 | DRM_DEBUG("lastclose completed\n"); | 236 | DRM_DEBUG("lastclose completed\n"); |
237 | return 0; | 237 | return 0; |
diff --git a/drivers/char/drm/drm_fops.c b/drivers/char/drm/drm_fops.c index 403f44a1bf01..641f7633878c 100644 --- a/drivers/char/drm/drm_fops.c +++ b/drivers/char/drm/drm_fops.c | |||
@@ -262,7 +262,7 @@ static int drm_open_helper(struct inode *inode, struct file *filp, | |||
262 | goto out_free; | 262 | goto out_free; |
263 | } | 263 | } |
264 | 264 | ||
265 | down(&dev->struct_sem); | 265 | mutex_lock(&dev->struct_mutex); |
266 | if (!dev->file_last) { | 266 | if (!dev->file_last) { |
267 | priv->next = NULL; | 267 | priv->next = NULL; |
268 | priv->prev = NULL; | 268 | priv->prev = NULL; |
@@ -276,7 +276,7 @@ static int drm_open_helper(struct inode *inode, struct file *filp, | |||
276 | dev->file_last->next = priv; | 276 | dev->file_last->next = priv; |
277 | dev->file_last = priv; | 277 | dev->file_last = priv; |
278 | } | 278 | } |
279 | up(&dev->struct_sem); | 279 | mutex_unlock(&dev->struct_mutex); |
280 | 280 | ||
281 | #ifdef __alpha__ | 281 | #ifdef __alpha__ |
282 | /* | 282 | /* |
@@ -413,7 +413,7 @@ int drm_release(struct inode *inode, struct file *filp) | |||
413 | 413 | ||
414 | drm_fasync(-1, filp, 0); | 414 | drm_fasync(-1, filp, 0); |
415 | 415 | ||
416 | down(&dev->ctxlist_sem); | 416 | mutex_lock(&dev->ctxlist_mutex); |
417 | if (dev->ctxlist && (!list_empty(&dev->ctxlist->head))) { | 417 | if (dev->ctxlist && (!list_empty(&dev->ctxlist->head))) { |
418 | drm_ctx_list_t *pos, *n; | 418 | drm_ctx_list_t *pos, *n; |
419 | 419 | ||
@@ -432,9 +432,9 @@ int drm_release(struct inode *inode, struct file *filp) | |||
432 | } | 432 | } |
433 | } | 433 | } |
434 | } | 434 | } |
435 | up(&dev->ctxlist_sem); | 435 | mutex_unlock(&dev->ctxlist_mutex); |
436 | 436 | ||
437 | down(&dev->struct_sem); | 437 | mutex_lock(&dev->struct_mutex); |
438 | if (priv->remove_auth_on_close == 1) { | 438 | if (priv->remove_auth_on_close == 1) { |
439 | drm_file_t *temp = dev->file_first; | 439 | drm_file_t *temp = dev->file_first; |
440 | while (temp) { | 440 | while (temp) { |
@@ -452,7 +452,7 @@ int drm_release(struct inode *inode, struct file *filp) | |||
452 | } else { | 452 | } else { |
453 | dev->file_last = priv->prev; | 453 | dev->file_last = priv->prev; |
454 | } | 454 | } |
455 | up(&dev->struct_sem); | 455 | mutex_unlock(&dev->struct_mutex); |
456 | 456 | ||
457 | if (dev->driver->postclose) | 457 | if (dev->driver->postclose) |
458 | dev->driver->postclose(dev, priv); | 458 | dev->driver->postclose(dev, priv); |
diff --git a/drivers/char/drm/drm_ioctl.c b/drivers/char/drm/drm_ioctl.c index bcd4e604d3ec..555f323b8a32 100644 --- a/drivers/char/drm/drm_ioctl.c +++ b/drivers/char/drm/drm_ioctl.c | |||
@@ -194,9 +194,9 @@ int drm_getmap(struct inode *inode, struct file *filp, | |||
194 | return -EFAULT; | 194 | return -EFAULT; |
195 | idx = map.offset; | 195 | idx = map.offset; |
196 | 196 | ||
197 | down(&dev->struct_sem); | 197 | mutex_lock(&dev->struct_mutex); |
198 | if (idx < 0) { | 198 | if (idx < 0) { |
199 | up(&dev->struct_sem); | 199 | mutex_unlock(&dev->struct_mutex); |
200 | return -EINVAL; | 200 | return -EINVAL; |
201 | } | 201 | } |
202 | 202 | ||
@@ -209,7 +209,7 @@ int drm_getmap(struct inode *inode, struct file *filp, | |||
209 | i++; | 209 | i++; |
210 | } | 210 | } |
211 | if (!r_list || !r_list->map) { | 211 | if (!r_list || !r_list->map) { |
212 | up(&dev->struct_sem); | 212 | mutex_unlock(&dev->struct_mutex); |
213 | return -EINVAL; | 213 | return -EINVAL; |
214 | } | 214 | } |
215 | 215 | ||
@@ -219,7 +219,7 @@ int drm_getmap(struct inode *inode, struct file *filp, | |||
219 | map.flags = r_list->map->flags; | 219 | map.flags = r_list->map->flags; |
220 | map.handle = (void *)(unsigned long)r_list->user_token; | 220 | map.handle = (void *)(unsigned long)r_list->user_token; |
221 | map.mtrr = r_list->map->mtrr; | 221 | map.mtrr = r_list->map->mtrr; |
222 | up(&dev->struct_sem); | 222 | mutex_unlock(&dev->struct_mutex); |
223 | 223 | ||
224 | if (copy_to_user(argp, &map, sizeof(map))) | 224 | if (copy_to_user(argp, &map, sizeof(map))) |
225 | return -EFAULT; | 225 | return -EFAULT; |
@@ -253,11 +253,11 @@ int drm_getclient(struct inode *inode, struct file *filp, | |||
253 | if (copy_from_user(&client, argp, sizeof(client))) | 253 | if (copy_from_user(&client, argp, sizeof(client))) |
254 | return -EFAULT; | 254 | return -EFAULT; |
255 | idx = client.idx; | 255 | idx = client.idx; |
256 | down(&dev->struct_sem); | 256 | mutex_lock(&dev->struct_mutex); |
257 | for (i = 0, pt = dev->file_first; i < idx && pt; i++, pt = pt->next) ; | 257 | for (i = 0, pt = dev->file_first; i < idx && pt; i++, pt = pt->next) ; |
258 | 258 | ||
259 | if (!pt) { | 259 | if (!pt) { |
260 | up(&dev->struct_sem); | 260 | mutex_unlock(&dev->struct_mutex); |
261 | return -EINVAL; | 261 | return -EINVAL; |
262 | } | 262 | } |
263 | client.auth = pt->authenticated; | 263 | client.auth = pt->authenticated; |
@@ -265,7 +265,7 @@ int drm_getclient(struct inode *inode, struct file *filp, | |||
265 | client.uid = pt->uid; | 265 | client.uid = pt->uid; |
266 | client.magic = pt->magic; | 266 | client.magic = pt->magic; |
267 | client.iocs = pt->ioctl_count; | 267 | client.iocs = pt->ioctl_count; |
268 | up(&dev->struct_sem); | 268 | mutex_unlock(&dev->struct_mutex); |
269 | 269 | ||
270 | if (copy_to_user(argp, &client, sizeof(client))) | 270 | if (copy_to_user(argp, &client, sizeof(client))) |
271 | return -EFAULT; | 271 | return -EFAULT; |
@@ -292,7 +292,7 @@ int drm_getstats(struct inode *inode, struct file *filp, | |||
292 | 292 | ||
293 | memset(&stats, 0, sizeof(stats)); | 293 | memset(&stats, 0, sizeof(stats)); |
294 | 294 | ||
295 | down(&dev->struct_sem); | 295 | mutex_lock(&dev->struct_mutex); |
296 | 296 | ||
297 | for (i = 0; i < dev->counters; i++) { | 297 | for (i = 0; i < dev->counters; i++) { |
298 | if (dev->types[i] == _DRM_STAT_LOCK) | 298 | if (dev->types[i] == _DRM_STAT_LOCK) |
@@ -305,7 +305,7 @@ int drm_getstats(struct inode *inode, struct file *filp, | |||
305 | 305 | ||
306 | stats.count = dev->counters; | 306 | stats.count = dev->counters; |
307 | 307 | ||
308 | up(&dev->struct_sem); | 308 | mutex_unlock(&dev->struct_mutex); |
309 | 309 | ||
310 | if (copy_to_user((drm_stats_t __user *) arg, &stats, sizeof(stats))) | 310 | if (copy_to_user((drm_stats_t __user *) arg, &stats, sizeof(stats))) |
311 | return -EFAULT; | 311 | return -EFAULT; |
diff --git a/drivers/char/drm/drm_irq.c b/drivers/char/drm/drm_irq.c index b0d4b236e837..611a1173091d 100644 --- a/drivers/char/drm/drm_irq.c +++ b/drivers/char/drm/drm_irq.c | |||
@@ -98,20 +98,20 @@ static int drm_irq_install(drm_device_t * dev) | |||
98 | if (dev->irq == 0) | 98 | if (dev->irq == 0) |
99 | return -EINVAL; | 99 | return -EINVAL; |
100 | 100 | ||
101 | down(&dev->struct_sem); | 101 | mutex_lock(&dev->struct_mutex); |
102 | 102 | ||
103 | /* Driver must have been initialized */ | 103 | /* Driver must have been initialized */ |
104 | if (!dev->dev_private) { | 104 | if (!dev->dev_private) { |
105 | up(&dev->struct_sem); | 105 | mutex_unlock(&dev->struct_mutex); |
106 | return -EINVAL; | 106 | return -EINVAL; |
107 | } | 107 | } |
108 | 108 | ||
109 | if (dev->irq_enabled) { | 109 | if (dev->irq_enabled) { |
110 | up(&dev->struct_sem); | 110 | mutex_unlock(&dev->struct_mutex); |
111 | return -EBUSY; | 111 | return -EBUSY; |
112 | } | 112 | } |
113 | dev->irq_enabled = 1; | 113 | dev->irq_enabled = 1; |
114 | up(&dev->struct_sem); | 114 | mutex_unlock(&dev->struct_mutex); |
115 | 115 | ||
116 | DRM_DEBUG("%s: irq=%d\n", __FUNCTION__, dev->irq); | 116 | DRM_DEBUG("%s: irq=%d\n", __FUNCTION__, dev->irq); |
117 | 117 | ||
@@ -135,9 +135,9 @@ static int drm_irq_install(drm_device_t * dev) | |||
135 | ret = request_irq(dev->irq, dev->driver->irq_handler, | 135 | ret = request_irq(dev->irq, dev->driver->irq_handler, |
136 | sh_flags, dev->devname, dev); | 136 | sh_flags, dev->devname, dev); |
137 | if (ret < 0) { | 137 | if (ret < 0) { |
138 | down(&dev->struct_sem); | 138 | mutex_lock(&dev->struct_mutex); |
139 | dev->irq_enabled = 0; | 139 | dev->irq_enabled = 0; |
140 | up(&dev->struct_sem); | 140 | mutex_unlock(&dev->struct_mutex); |
141 | return ret; | 141 | return ret; |
142 | } | 142 | } |
143 | 143 | ||
@@ -161,10 +161,10 @@ int drm_irq_uninstall(drm_device_t * dev) | |||
161 | if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ)) | 161 | if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ)) |
162 | return -EINVAL; | 162 | return -EINVAL; |
163 | 163 | ||
164 | down(&dev->struct_sem); | 164 | mutex_lock(&dev->struct_mutex); |
165 | irq_enabled = dev->irq_enabled; | 165 | irq_enabled = dev->irq_enabled; |
166 | dev->irq_enabled = 0; | 166 | dev->irq_enabled = 0; |
167 | up(&dev->struct_sem); | 167 | mutex_unlock(&dev->struct_mutex); |
168 | 168 | ||
169 | if (!irq_enabled) | 169 | if (!irq_enabled) |
170 | return -EINVAL; | 170 | return -EINVAL; |
diff --git a/drivers/char/drm/drm_pciids.h b/drivers/char/drm/drm_pciids.h index 5b1d3a04458d..2c17e88a8847 100644 --- a/drivers/char/drm/drm_pciids.h +++ b/drivers/char/drm/drm_pciids.h | |||
@@ -3,6 +3,7 @@ | |||
3 | Please contact dri-devel@lists.sf.net to add new cards to this list | 3 | Please contact dri-devel@lists.sf.net to add new cards to this list |
4 | */ | 4 | */ |
5 | #define radeon_PCI_IDS \ | 5 | #define radeon_PCI_IDS \ |
6 | {0x1002, 0x3150, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV350},\ | ||
6 | {0x1002, 0x4136, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS100|CHIP_IS_IGP}, \ | 7 | {0x1002, 0x4136, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS100|CHIP_IS_IGP}, \ |
7 | {0x1002, 0x4137, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS200|CHIP_IS_IGP}, \ | 8 | {0x1002, 0x4137, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS200|CHIP_IS_IGP}, \ |
8 | {0x1002, 0x4144, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R300}, \ | 9 | {0x1002, 0x4144, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R300}, \ |
@@ -84,7 +85,6 @@ | |||
84 | {0x1002, 0x5969, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV100}, \ | 85 | {0x1002, 0x5969, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV100}, \ |
85 | {0x1002, 0x596A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280}, \ | 86 | {0x1002, 0x596A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280}, \ |
86 | {0x1002, 0x596B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280}, \ | 87 | {0x1002, 0x596B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280}, \ |
87 | {0x1002, 0x5b60, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV350}, \ | ||
88 | {0x1002, 0x5c61, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280|CHIP_IS_MOBILITY}, \ | 88 | {0x1002, 0x5c61, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280|CHIP_IS_MOBILITY}, \ |
89 | {0x1002, 0x5c62, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280}, \ | 89 | {0x1002, 0x5c62, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280}, \ |
90 | {0x1002, 0x5c63, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280|CHIP_IS_MOBILITY}, \ | 90 | {0x1002, 0x5c63, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280|CHIP_IS_MOBILITY}, \ |
@@ -242,5 +242,6 @@ | |||
242 | {0x8086, 0x2582, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ | 242 | {0x8086, 0x2582, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ |
243 | {0x8086, 0x2592, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ | 243 | {0x8086, 0x2592, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ |
244 | {0x8086, 0x2772, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ | 244 | {0x8086, 0x2772, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ |
245 | {0x8086, 0x27a2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ | ||
245 | {0, 0, 0} | 246 | {0, 0, 0} |
246 | 247 | ||
diff --git a/drivers/char/drm/drm_proc.c b/drivers/char/drm/drm_proc.c index 6f943e3309ef..362a270af0f1 100644 --- a/drivers/char/drm/drm_proc.c +++ b/drivers/char/drm/drm_proc.c | |||
@@ -258,7 +258,7 @@ static int drm__vm_info(char *buf, char **start, off_t offset, int request, | |||
258 | } | 258 | } |
259 | 259 | ||
260 | /** | 260 | /** |
261 | * Simply calls _vm_info() while holding the drm_device::struct_sem lock. | 261 | * Simply calls _vm_info() while holding the drm_device::struct_mutex lock. |
262 | */ | 262 | */ |
263 | static int drm_vm_info(char *buf, char **start, off_t offset, int request, | 263 | static int drm_vm_info(char *buf, char **start, off_t offset, int request, |
264 | int *eof, void *data) | 264 | int *eof, void *data) |
@@ -266,9 +266,9 @@ static int drm_vm_info(char *buf, char **start, off_t offset, int request, | |||
266 | drm_device_t *dev = (drm_device_t *) data; | 266 | drm_device_t *dev = (drm_device_t *) data; |
267 | int ret; | 267 | int ret; |
268 | 268 | ||
269 | down(&dev->struct_sem); | 269 | mutex_lock(&dev->struct_mutex); |
270 | ret = drm__vm_info(buf, start, offset, request, eof, data); | 270 | ret = drm__vm_info(buf, start, offset, request, eof, data); |
271 | up(&dev->struct_sem); | 271 | mutex_unlock(&dev->struct_mutex); |
272 | return ret; | 272 | return ret; |
273 | } | 273 | } |
274 | 274 | ||
@@ -331,7 +331,7 @@ static int drm__queues_info(char *buf, char **start, off_t offset, | |||
331 | } | 331 | } |
332 | 332 | ||
333 | /** | 333 | /** |
334 | * Simply calls _queues_info() while holding the drm_device::struct_sem lock. | 334 | * Simply calls _queues_info() while holding the drm_device::struct_mutex lock. |
335 | */ | 335 | */ |
336 | static int drm_queues_info(char *buf, char **start, off_t offset, int request, | 336 | static int drm_queues_info(char *buf, char **start, off_t offset, int request, |
337 | int *eof, void *data) | 337 | int *eof, void *data) |
@@ -339,9 +339,9 @@ static int drm_queues_info(char *buf, char **start, off_t offset, int request, | |||
339 | drm_device_t *dev = (drm_device_t *) data; | 339 | drm_device_t *dev = (drm_device_t *) data; |
340 | int ret; | 340 | int ret; |
341 | 341 | ||
342 | down(&dev->struct_sem); | 342 | mutex_lock(&dev->struct_mutex); |
343 | ret = drm__queues_info(buf, start, offset, request, eof, data); | 343 | ret = drm__queues_info(buf, start, offset, request, eof, data); |
344 | up(&dev->struct_sem); | 344 | mutex_unlock(&dev->struct_mutex); |
345 | return ret; | 345 | return ret; |
346 | } | 346 | } |
347 | 347 | ||
@@ -403,7 +403,7 @@ static int drm__bufs_info(char *buf, char **start, off_t offset, int request, | |||
403 | } | 403 | } |
404 | 404 | ||
405 | /** | 405 | /** |
406 | * Simply calls _bufs_info() while holding the drm_device::struct_sem lock. | 406 | * Simply calls _bufs_info() while holding the drm_device::struct_mutex lock. |
407 | */ | 407 | */ |
408 | static int drm_bufs_info(char *buf, char **start, off_t offset, int request, | 408 | static int drm_bufs_info(char *buf, char **start, off_t offset, int request, |
409 | int *eof, void *data) | 409 | int *eof, void *data) |
@@ -411,9 +411,9 @@ static int drm_bufs_info(char *buf, char **start, off_t offset, int request, | |||
411 | drm_device_t *dev = (drm_device_t *) data; | 411 | drm_device_t *dev = (drm_device_t *) data; |
412 | int ret; | 412 | int ret; |
413 | 413 | ||
414 | down(&dev->struct_sem); | 414 | mutex_lock(&dev->struct_mutex); |
415 | ret = drm__bufs_info(buf, start, offset, request, eof, data); | 415 | ret = drm__bufs_info(buf, start, offset, request, eof, data); |
416 | up(&dev->struct_sem); | 416 | mutex_unlock(&dev->struct_mutex); |
417 | return ret; | 417 | return ret; |
418 | } | 418 | } |
419 | 419 | ||
@@ -459,7 +459,7 @@ static int drm__clients_info(char *buf, char **start, off_t offset, | |||
459 | } | 459 | } |
460 | 460 | ||
461 | /** | 461 | /** |
462 | * Simply calls _clients_info() while holding the drm_device::struct_sem lock. | 462 | * Simply calls _clients_info() while holding the drm_device::struct_mutex lock. |
463 | */ | 463 | */ |
464 | static int drm_clients_info(char *buf, char **start, off_t offset, | 464 | static int drm_clients_info(char *buf, char **start, off_t offset, |
465 | int request, int *eof, void *data) | 465 | int request, int *eof, void *data) |
@@ -467,9 +467,9 @@ static int drm_clients_info(char *buf, char **start, off_t offset, | |||
467 | drm_device_t *dev = (drm_device_t *) data; | 467 | drm_device_t *dev = (drm_device_t *) data; |
468 | int ret; | 468 | int ret; |
469 | 469 | ||
470 | down(&dev->struct_sem); | 470 | mutex_lock(&dev->struct_mutex); |
471 | ret = drm__clients_info(buf, start, offset, request, eof, data); | 471 | ret = drm__clients_info(buf, start, offset, request, eof, data); |
472 | up(&dev->struct_sem); | 472 | mutex_unlock(&dev->struct_mutex); |
473 | return ret; | 473 | return ret; |
474 | } | 474 | } |
475 | 475 | ||
@@ -540,9 +540,9 @@ static int drm_vma_info(char *buf, char **start, off_t offset, int request, | |||
540 | drm_device_t *dev = (drm_device_t *) data; | 540 | drm_device_t *dev = (drm_device_t *) data; |
541 | int ret; | 541 | int ret; |
542 | 542 | ||
543 | down(&dev->struct_sem); | 543 | mutex_lock(&dev->struct_mutex); |
544 | ret = drm__vma_info(buf, start, offset, request, eof, data); | 544 | ret = drm__vma_info(buf, start, offset, request, eof, data); |
545 | up(&dev->struct_sem); | 545 | mutex_unlock(&dev->struct_mutex); |
546 | return ret; | 546 | return ret; |
547 | } | 547 | } |
548 | #endif | 548 | #endif |
diff --git a/drivers/char/drm/drm_stub.c b/drivers/char/drm/drm_stub.c index 42d766359caa..68073e14fdec 100644 --- a/drivers/char/drm/drm_stub.c +++ b/drivers/char/drm/drm_stub.c | |||
@@ -50,7 +50,7 @@ module_param_named(cards_limit, drm_cards_limit, int, 0444); | |||
50 | module_param_named(debug, drm_debug, int, 0600); | 50 | module_param_named(debug, drm_debug, int, 0600); |
51 | 51 | ||
52 | drm_head_t **drm_heads; | 52 | drm_head_t **drm_heads; |
53 | struct drm_sysfs_class *drm_class; | 53 | struct class *drm_class; |
54 | struct proc_dir_entry *drm_proc_root; | 54 | struct proc_dir_entry *drm_proc_root; |
55 | 55 | ||
56 | static int drm_fill_in_dev(drm_device_t * dev, struct pci_dev *pdev, | 56 | static int drm_fill_in_dev(drm_device_t * dev, struct pci_dev *pdev, |
@@ -61,8 +61,8 @@ static int drm_fill_in_dev(drm_device_t * dev, struct pci_dev *pdev, | |||
61 | 61 | ||
62 | spin_lock_init(&dev->count_lock); | 62 | spin_lock_init(&dev->count_lock); |
63 | init_timer(&dev->timer); | 63 | init_timer(&dev->timer); |
64 | sema_init(&dev->struct_sem, 1); | 64 | mutex_init(&dev->struct_mutex); |
65 | sema_init(&dev->ctxlist_sem, 1); | 65 | mutex_init(&dev->ctxlist_mutex); |
66 | 66 | ||
67 | dev->pdev = pdev; | 67 | dev->pdev = pdev; |
68 | 68 | ||
diff --git a/drivers/char/drm/drm_sysfs.c b/drivers/char/drm/drm_sysfs.c index 68e43ddc16ae..0b9f98a7eb10 100644 --- a/drivers/char/drm/drm_sysfs.c +++ b/drivers/char/drm/drm_sysfs.c | |||
@@ -1,3 +1,4 @@ | |||
1 | |||
1 | /* | 2 | /* |
2 | * drm_sysfs.c - Modifications to drm_sysfs_class.c to support | 3 | * drm_sysfs.c - Modifications to drm_sysfs_class.c to support |
3 | * extra sysfs attribute from DRM. Normal drm_sysfs_class | 4 | * extra sysfs attribute from DRM. Normal drm_sysfs_class |
@@ -19,36 +20,6 @@ | |||
19 | #include "drm_core.h" | 20 | #include "drm_core.h" |
20 | #include "drmP.h" | 21 | #include "drmP.h" |
21 | 22 | ||
22 | struct drm_sysfs_class { | ||
23 | struct class_device_attribute attr; | ||
24 | struct class class; | ||
25 | }; | ||
26 | #define to_drm_sysfs_class(d) container_of(d, struct drm_sysfs_class, class) | ||
27 | |||
28 | struct simple_dev { | ||
29 | dev_t dev; | ||
30 | struct class_device class_dev; | ||
31 | }; | ||
32 | #define to_simple_dev(d) container_of(d, struct simple_dev, class_dev) | ||
33 | |||
34 | static void release_simple_dev(struct class_device *class_dev) | ||
35 | { | ||
36 | struct simple_dev *s_dev = to_simple_dev(class_dev); | ||
37 | kfree(s_dev); | ||
38 | } | ||
39 | |||
40 | static ssize_t show_dev(struct class_device *class_dev, char *buf) | ||
41 | { | ||
42 | struct simple_dev *s_dev = to_simple_dev(class_dev); | ||
43 | return print_dev_t(buf, s_dev->dev); | ||
44 | } | ||
45 | |||
46 | static void drm_sysfs_class_release(struct class *class) | ||
47 | { | ||
48 | struct drm_sysfs_class *cs = to_drm_sysfs_class(class); | ||
49 | kfree(cs); | ||
50 | } | ||
51 | |||
52 | /* Display the version of drm_core. This doesn't work right in current design */ | 23 | /* Display the version of drm_core. This doesn't work right in current design */ |
53 | static ssize_t version_show(struct class *dev, char *buf) | 24 | static ssize_t version_show(struct class *dev, char *buf) |
54 | { | 25 | { |
@@ -69,38 +40,16 @@ static CLASS_ATTR(version, S_IRUGO, version_show, NULL); | |||
69 | * Note, the pointer created here is to be destroyed when finished by making a | 40 | * Note, the pointer created here is to be destroyed when finished by making a |
70 | * call to drm_sysfs_destroy(). | 41 | * call to drm_sysfs_destroy(). |
71 | */ | 42 | */ |
72 | struct drm_sysfs_class *drm_sysfs_create(struct module *owner, char *name) | 43 | struct class *drm_sysfs_create(struct module *owner, char *name) |
73 | { | 44 | { |
74 | struct drm_sysfs_class *cs; | 45 | struct class *class; |
75 | int retval; | 46 | |
76 | 47 | class = class_create(owner, name); | |
77 | cs = kmalloc(sizeof(*cs), GFP_KERNEL); | 48 | if (!class) |
78 | if (!cs) { | 49 | return class; |
79 | retval = -ENOMEM; | 50 | |
80 | goto error; | 51 | class_create_file(class, &class_attr_version); |
81 | } | 52 | return class; |
82 | memset(cs, 0x00, sizeof(*cs)); | ||
83 | |||
84 | cs->class.name = name; | ||
85 | cs->class.class_release = drm_sysfs_class_release; | ||
86 | cs->class.release = release_simple_dev; | ||
87 | |||
88 | cs->attr.attr.name = "dev"; | ||
89 | cs->attr.attr.mode = S_IRUGO; | ||
90 | cs->attr.attr.owner = owner; | ||
91 | cs->attr.show = show_dev; | ||
92 | cs->attr.store = NULL; | ||
93 | |||
94 | retval = class_register(&cs->class); | ||
95 | if (retval) | ||
96 | goto error; | ||
97 | class_create_file(&cs->class, &class_attr_version); | ||
98 | |||
99 | return cs; | ||
100 | |||
101 | error: | ||
102 | kfree(cs); | ||
103 | return ERR_PTR(retval); | ||
104 | } | 53 | } |
105 | 54 | ||
106 | /** | 55 | /** |
@@ -110,12 +59,13 @@ struct drm_sysfs_class *drm_sysfs_create(struct module *owner, char *name) | |||
110 | * Note, the pointer to be destroyed must have been created with a call to | 59 | * Note, the pointer to be destroyed must have been created with a call to |
111 | * drm_sysfs_create(). | 60 | * drm_sysfs_create(). |
112 | */ | 61 | */ |
113 | void drm_sysfs_destroy(struct drm_sysfs_class *cs) | 62 | void drm_sysfs_destroy(struct class *class) |
114 | { | 63 | { |
115 | if ((cs == NULL) || (IS_ERR(cs))) | 64 | if ((class == NULL) || (IS_ERR(class))) |
116 | return; | 65 | return; |
117 | 66 | ||
118 | class_unregister(&cs->class); | 67 | class_remove_file(class, &class_attr_version); |
68 | class_destroy(class); | ||
119 | } | 69 | } |
120 | 70 | ||
121 | static ssize_t show_dri(struct class_device *class_device, char *buf) | 71 | static ssize_t show_dri(struct class_device *class_device, char *buf) |
@@ -132,7 +82,7 @@ static struct class_device_attribute class_device_attrs[] = { | |||
132 | 82 | ||
133 | /** | 83 | /** |
134 | * drm_sysfs_device_add - adds a class device to sysfs for a character driver | 84 | * drm_sysfs_device_add - adds a class device to sysfs for a character driver |
135 | * @cs: pointer to the struct drm_sysfs_class that this device should be registered to. | 85 | * @cs: pointer to the struct class that this device should be registered to. |
136 | * @dev: the dev_t for the device to be added. | 86 | * @dev: the dev_t for the device to be added. |
137 | * @device: a pointer to a struct device that is assiociated with this class device. | 87 | * @device: a pointer to a struct device that is assiociated with this class device. |
138 | * @fmt: string for the class device's name | 88 | * @fmt: string for the class device's name |
@@ -141,46 +91,26 @@ static struct class_device_attribute class_device_attrs[] = { | |||
141 | * class. A "dev" file will be created, showing the dev_t for the device. The | 91 | * class. A "dev" file will be created, showing the dev_t for the device. The |
142 | * pointer to the struct class_device will be returned from the call. Any further | 92 | * pointer to the struct class_device will be returned from the call. Any further |
143 | * sysfs files that might be required can be created using this pointer. | 93 | * sysfs files that might be required can be created using this pointer. |
144 | * Note: the struct drm_sysfs_class passed to this function must have previously been | 94 | * Note: the struct class passed to this function must have previously been |
145 | * created with a call to drm_sysfs_create(). | 95 | * created with a call to drm_sysfs_create(). |
146 | */ | 96 | */ |
147 | struct class_device *drm_sysfs_device_add(struct drm_sysfs_class *cs, | 97 | struct class_device *drm_sysfs_device_add(struct class *cs, drm_head_t *head) |
148 | drm_head_t *head) | ||
149 | { | 98 | { |
150 | struct simple_dev *s_dev = NULL; | 99 | struct class_device *class_dev; |
151 | int i, retval; | 100 | int i; |
152 | |||
153 | if ((cs == NULL) || (IS_ERR(cs))) { | ||
154 | retval = -ENODEV; | ||
155 | goto error; | ||
156 | } | ||
157 | |||
158 | s_dev = kmalloc(sizeof(*s_dev), GFP_KERNEL); | ||
159 | if (!s_dev) { | ||
160 | retval = -ENOMEM; | ||
161 | goto error; | ||
162 | } | ||
163 | memset(s_dev, 0x00, sizeof(*s_dev)); | ||
164 | |||
165 | s_dev->dev = MKDEV(DRM_MAJOR, head->minor); | ||
166 | s_dev->class_dev.dev = &(head->dev->pdev)->dev; | ||
167 | s_dev->class_dev.class = &cs->class; | ||
168 | 101 | ||
169 | snprintf(s_dev->class_dev.class_id, BUS_ID_SIZE, "card%d", head->minor); | 102 | class_dev = class_device_create(cs, NULL, |
170 | retval = class_device_register(&s_dev->class_dev); | 103 | MKDEV(DRM_MAJOR, head->minor), |
171 | if (retval) | 104 | &(head->dev->pdev)->dev, |
172 | goto error; | 105 | "card%d", head->minor); |
106 | if (!class_dev) | ||
107 | return NULL; | ||
173 | 108 | ||
174 | class_device_create_file(&s_dev->class_dev, &cs->attr); | 109 | class_set_devdata(class_dev, head); |
175 | class_set_devdata(&s_dev->class_dev, head); | ||
176 | 110 | ||
177 | for (i = 0; i < ARRAY_SIZE(class_device_attrs); i++) | 111 | for (i = 0; i < ARRAY_SIZE(class_device_attrs); i++) |
178 | class_device_create_file(&s_dev->class_dev, &class_device_attrs[i]); | 112 | class_device_create_file(class_dev, &class_device_attrs[i]); |
179 | return &s_dev->class_dev; | 113 | return class_dev; |
180 | |||
181 | error: | ||
182 | kfree(s_dev); | ||
183 | return ERR_PTR(retval); | ||
184 | } | 114 | } |
185 | 115 | ||
186 | /** | 116 | /** |
@@ -192,10 +122,9 @@ error: | |||
192 | */ | 122 | */ |
193 | void drm_sysfs_device_remove(struct class_device *class_dev) | 123 | void drm_sysfs_device_remove(struct class_device *class_dev) |
194 | { | 124 | { |
195 | struct simple_dev *s_dev = to_simple_dev(class_dev); | ||
196 | int i; | 125 | int i; |
197 | 126 | ||
198 | for (i = 0; i < ARRAY_SIZE(class_device_attrs); i++) | 127 | for (i = 0; i < ARRAY_SIZE(class_device_attrs); i++) |
199 | class_device_remove_file(&s_dev->class_dev, &class_device_attrs[i]); | 128 | class_device_remove_file(class_dev, &class_device_attrs[i]); |
200 | class_device_unregister(&s_dev->class_dev); | 129 | class_device_unregister(class_dev); |
201 | } | 130 | } |
diff --git a/drivers/char/drm/drm_vm.c b/drivers/char/drm/drm_vm.c index 3f73aa774c80..0291cd62c69f 100644 --- a/drivers/char/drm/drm_vm.c +++ b/drivers/char/drm/drm_vm.c | |||
@@ -188,7 +188,7 @@ static void drm_vm_shm_close(struct vm_area_struct *vma) | |||
188 | 188 | ||
189 | map = vma->vm_private_data; | 189 | map = vma->vm_private_data; |
190 | 190 | ||
191 | down(&dev->struct_sem); | 191 | mutex_lock(&dev->struct_mutex); |
192 | for (pt = dev->vmalist, prev = NULL; pt; pt = next) { | 192 | for (pt = dev->vmalist, prev = NULL; pt; pt = next) { |
193 | next = pt->next; | 193 | next = pt->next; |
194 | if (pt->vma->vm_private_data == map) | 194 | if (pt->vma->vm_private_data == map) |
@@ -248,7 +248,7 @@ static void drm_vm_shm_close(struct vm_area_struct *vma) | |||
248 | drm_free(map, sizeof(*map), DRM_MEM_MAPS); | 248 | drm_free(map, sizeof(*map), DRM_MEM_MAPS); |
249 | } | 249 | } |
250 | } | 250 | } |
251 | up(&dev->struct_sem); | 251 | mutex_unlock(&dev->struct_mutex); |
252 | } | 252 | } |
253 | 253 | ||
254 | /** | 254 | /** |
@@ -404,12 +404,12 @@ static void drm_vm_open(struct vm_area_struct *vma) | |||
404 | 404 | ||
405 | vma_entry = drm_alloc(sizeof(*vma_entry), DRM_MEM_VMAS); | 405 | vma_entry = drm_alloc(sizeof(*vma_entry), DRM_MEM_VMAS); |
406 | if (vma_entry) { | 406 | if (vma_entry) { |
407 | down(&dev->struct_sem); | 407 | mutex_lock(&dev->struct_mutex); |
408 | vma_entry->vma = vma; | 408 | vma_entry->vma = vma; |
409 | vma_entry->next = dev->vmalist; | 409 | vma_entry->next = dev->vmalist; |
410 | vma_entry->pid = current->pid; | 410 | vma_entry->pid = current->pid; |
411 | dev->vmalist = vma_entry; | 411 | dev->vmalist = vma_entry; |
412 | up(&dev->struct_sem); | 412 | mutex_unlock(&dev->struct_mutex); |
413 | } | 413 | } |
414 | } | 414 | } |
415 | 415 | ||
@@ -431,7 +431,7 @@ static void drm_vm_close(struct vm_area_struct *vma) | |||
431 | vma->vm_start, vma->vm_end - vma->vm_start); | 431 | vma->vm_start, vma->vm_end - vma->vm_start); |
432 | atomic_dec(&dev->vma_count); | 432 | atomic_dec(&dev->vma_count); |
433 | 433 | ||
434 | down(&dev->struct_sem); | 434 | mutex_lock(&dev->struct_mutex); |
435 | for (pt = dev->vmalist, prev = NULL; pt; prev = pt, pt = pt->next) { | 435 | for (pt = dev->vmalist, prev = NULL; pt; prev = pt, pt = pt->next) { |
436 | if (pt->vma == vma) { | 436 | if (pt->vma == vma) { |
437 | if (prev) { | 437 | if (prev) { |
@@ -443,7 +443,7 @@ static void drm_vm_close(struct vm_area_struct *vma) | |||
443 | break; | 443 | break; |
444 | } | 444 | } |
445 | } | 445 | } |
446 | up(&dev->struct_sem); | 446 | mutex_unlock(&dev->struct_mutex); |
447 | } | 447 | } |
448 | 448 | ||
449 | /** | 449 | /** |
diff --git a/drivers/char/drm/i810_dma.c b/drivers/char/drm/i810_dma.c index cc1b89086876..ae0aa6d7e0bb 100644 --- a/drivers/char/drm/i810_dma.c +++ b/drivers/char/drm/i810_dma.c | |||
@@ -958,7 +958,7 @@ static int i810_flush_queue(drm_device_t * dev) | |||
958 | } | 958 | } |
959 | 959 | ||
960 | /* Must be called with the lock held */ | 960 | /* Must be called with the lock held */ |
961 | void i810_reclaim_buffers(drm_device_t * dev, struct file *filp) | 961 | static void i810_reclaim_buffers(drm_device_t * dev, struct file *filp) |
962 | { | 962 | { |
963 | drm_device_dma_t *dma = dev->dma; | 963 | drm_device_dma_t *dma = dev->dma; |
964 | int i; | 964 | int i; |
diff --git a/drivers/char/drm/i810_drv.h b/drivers/char/drm/i810_drv.h index a18b80d91920..e8cf3ff606f0 100644 --- a/drivers/char/drm/i810_drv.h +++ b/drivers/char/drm/i810_drv.h | |||
@@ -113,8 +113,6 @@ typedef struct drm_i810_private { | |||
113 | } drm_i810_private_t; | 113 | } drm_i810_private_t; |
114 | 114 | ||
115 | /* i810_dma.c */ | 115 | /* i810_dma.c */ |
116 | extern void i810_reclaim_buffers(drm_device_t * dev, struct file *filp); | ||
117 | |||
118 | extern int i810_driver_dma_quiescent(drm_device_t * dev); | 116 | extern int i810_driver_dma_quiescent(drm_device_t * dev); |
119 | extern void i810_driver_reclaim_buffers_locked(drm_device_t * dev, | 117 | extern void i810_driver_reclaim_buffers_locked(drm_device_t * dev, |
120 | struct file *filp); | 118 | struct file *filp); |
diff --git a/drivers/char/drm/i830_dma.c b/drivers/char/drm/i830_dma.c index 4fea32aed6d2..163f2cbfe60d 100644 --- a/drivers/char/drm/i830_dma.c +++ b/drivers/char/drm/i830_dma.c | |||
@@ -1239,7 +1239,7 @@ static int i830_flush_queue(drm_device_t * dev) | |||
1239 | } | 1239 | } |
1240 | 1240 | ||
1241 | /* Must be called with the lock held */ | 1241 | /* Must be called with the lock held */ |
1242 | void i830_reclaim_buffers(drm_device_t * dev, struct file *filp) | 1242 | static void i830_reclaim_buffers(drm_device_t * dev, struct file *filp) |
1243 | { | 1243 | { |
1244 | drm_device_dma_t *dma = dev->dma; | 1244 | drm_device_dma_t *dma = dev->dma; |
1245 | int i; | 1245 | int i; |
diff --git a/drivers/char/drm/i830_drv.h b/drivers/char/drm/i830_drv.h index bf9075b576bd..85bc5be6f916 100644 --- a/drivers/char/drm/i830_drv.h +++ b/drivers/char/drm/i830_drv.h | |||
@@ -123,9 +123,6 @@ typedef struct drm_i830_private { | |||
123 | extern drm_ioctl_desc_t i830_ioctls[]; | 123 | extern drm_ioctl_desc_t i830_ioctls[]; |
124 | extern int i830_max_ioctl; | 124 | extern int i830_max_ioctl; |
125 | 125 | ||
126 | /* i830_dma.c */ | ||
127 | extern void i830_reclaim_buffers(drm_device_t * dev, struct file *filp); | ||
128 | |||
129 | /* i830_irq.c */ | 126 | /* i830_irq.c */ |
130 | extern int i830_irq_emit(struct inode *inode, struct file *filp, | 127 | extern int i830_irq_emit(struct inode *inode, struct file *filp, |
131 | unsigned int cmd, unsigned long arg); | 128 | unsigned int cmd, unsigned long arg); |
diff --git a/drivers/char/drm/i915_dma.c b/drivers/char/drm/i915_dma.c index 9140703da1ba..1ff4c7ca0bff 100644 --- a/drivers/char/drm/i915_dma.c +++ b/drivers/char/drm/i915_dma.c | |||
@@ -344,18 +344,20 @@ static int i915_emit_cmds(drm_device_t * dev, int __user * buffer, int dwords) | |||
344 | int i; | 344 | int i; |
345 | RING_LOCALS; | 345 | RING_LOCALS; |
346 | 346 | ||
347 | if ((dwords+1) * sizeof(int) >= dev_priv->ring.Size - 8) | ||
348 | return DRM_ERR(EINVAL); | ||
349 | |||
350 | BEGIN_LP_RING(((dwords+1)&~1)); | ||
351 | |||
347 | for (i = 0; i < dwords;) { | 352 | for (i = 0; i < dwords;) { |
348 | int cmd, sz; | 353 | int cmd, sz; |
349 | 354 | ||
350 | if (DRM_COPY_FROM_USER_UNCHECKED(&cmd, &buffer[i], sizeof(cmd))) | 355 | if (DRM_COPY_FROM_USER_UNCHECKED(&cmd, &buffer[i], sizeof(cmd))) |
351 | return DRM_ERR(EINVAL); | 356 | return DRM_ERR(EINVAL); |
352 | 357 | ||
353 | /* printk("%d/%d ", i, dwords); */ | ||
354 | |||
355 | if ((sz = validate_cmd(cmd)) == 0 || i + sz > dwords) | 358 | if ((sz = validate_cmd(cmd)) == 0 || i + sz > dwords) |
356 | return DRM_ERR(EINVAL); | 359 | return DRM_ERR(EINVAL); |
357 | 360 | ||
358 | BEGIN_LP_RING(sz); | ||
359 | OUT_RING(cmd); | 361 | OUT_RING(cmd); |
360 | 362 | ||
361 | while (++i, --sz) { | 363 | while (++i, --sz) { |
@@ -365,9 +367,13 @@ static int i915_emit_cmds(drm_device_t * dev, int __user * buffer, int dwords) | |||
365 | } | 367 | } |
366 | OUT_RING(cmd); | 368 | OUT_RING(cmd); |
367 | } | 369 | } |
368 | ADVANCE_LP_RING(); | ||
369 | } | 370 | } |
370 | 371 | ||
372 | if (dwords & 1) | ||
373 | OUT_RING(0); | ||
374 | |||
375 | ADVANCE_LP_RING(); | ||
376 | |||
371 | return 0; | 377 | return 0; |
372 | } | 378 | } |
373 | 379 | ||
@@ -401,6 +407,21 @@ static int i915_emit_box(drm_device_t * dev, | |||
401 | return 0; | 407 | return 0; |
402 | } | 408 | } |
403 | 409 | ||
410 | static void i915_emit_breadcrumb(drm_device_t *dev) | ||
411 | { | ||
412 | drm_i915_private_t *dev_priv = dev->dev_private; | ||
413 | RING_LOCALS; | ||
414 | |||
415 | dev_priv->sarea_priv->last_enqueue = dev_priv->counter++; | ||
416 | |||
417 | BEGIN_LP_RING(4); | ||
418 | OUT_RING(CMD_STORE_DWORD_IDX); | ||
419 | OUT_RING(20); | ||
420 | OUT_RING(dev_priv->counter); | ||
421 | OUT_RING(0); | ||
422 | ADVANCE_LP_RING(); | ||
423 | } | ||
424 | |||
404 | static int i915_dispatch_cmdbuffer(drm_device_t * dev, | 425 | static int i915_dispatch_cmdbuffer(drm_device_t * dev, |
405 | drm_i915_cmdbuffer_t * cmd) | 426 | drm_i915_cmdbuffer_t * cmd) |
406 | { | 427 | { |
@@ -429,6 +450,7 @@ static int i915_dispatch_cmdbuffer(drm_device_t * dev, | |||
429 | return ret; | 450 | return ret; |
430 | } | 451 | } |
431 | 452 | ||
453 | i915_emit_breadcrumb(dev); | ||
432 | return 0; | 454 | return 0; |
433 | } | 455 | } |
434 | 456 | ||
@@ -475,12 +497,7 @@ static int i915_dispatch_batchbuffer(drm_device_t * dev, | |||
475 | 497 | ||
476 | dev_priv->sarea_priv->last_enqueue = dev_priv->counter++; | 498 | dev_priv->sarea_priv->last_enqueue = dev_priv->counter++; |
477 | 499 | ||
478 | BEGIN_LP_RING(4); | 500 | i915_emit_breadcrumb(dev); |
479 | OUT_RING(CMD_STORE_DWORD_IDX); | ||
480 | OUT_RING(20); | ||
481 | OUT_RING(dev_priv->counter); | ||
482 | OUT_RING(0); | ||
483 | ADVANCE_LP_RING(); | ||
484 | 501 | ||
485 | return 0; | 502 | return 0; |
486 | } | 503 | } |
@@ -657,7 +674,7 @@ static int i915_getparam(DRM_IOCTL_ARGS) | |||
657 | value = READ_BREADCRUMB(dev_priv); | 674 | value = READ_BREADCRUMB(dev_priv); |
658 | break; | 675 | break; |
659 | default: | 676 | default: |
660 | DRM_ERROR("Unkown parameter %d\n", param.param); | 677 | DRM_ERROR("Unknown parameter %d\n", param.param); |
661 | return DRM_ERR(EINVAL); | 678 | return DRM_ERR(EINVAL); |
662 | } | 679 | } |
663 | 680 | ||
@@ -742,7 +759,8 @@ drm_ioctl_desc_t i915_ioctls[] = { | |||
742 | [DRM_IOCTL_NR(DRM_I915_ALLOC)] = {i915_mem_alloc, DRM_AUTH}, | 759 | [DRM_IOCTL_NR(DRM_I915_ALLOC)] = {i915_mem_alloc, DRM_AUTH}, |
743 | [DRM_IOCTL_NR(DRM_I915_FREE)] = {i915_mem_free, DRM_AUTH}, | 760 | [DRM_IOCTL_NR(DRM_I915_FREE)] = {i915_mem_free, DRM_AUTH}, |
744 | [DRM_IOCTL_NR(DRM_I915_INIT_HEAP)] = {i915_mem_init_heap, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY}, | 761 | [DRM_IOCTL_NR(DRM_I915_INIT_HEAP)] = {i915_mem_init_heap, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY}, |
745 | [DRM_IOCTL_NR(DRM_I915_CMDBUFFER)] = {i915_cmdbuffer, DRM_AUTH} | 762 | [DRM_IOCTL_NR(DRM_I915_CMDBUFFER)] = {i915_cmdbuffer, DRM_AUTH}, |
763 | [DRM_IOCTL_NR(DRM_I915_DESTROY_HEAP)] = { i915_mem_destroy_heap, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY } | ||
746 | }; | 764 | }; |
747 | 765 | ||
748 | int i915_max_ioctl = DRM_ARRAY_SIZE(i915_ioctls); | 766 | int i915_max_ioctl = DRM_ARRAY_SIZE(i915_ioctls); |
diff --git a/drivers/char/drm/i915_drm.h b/drivers/char/drm/i915_drm.h index 77412ddac007..4cb3da578330 100644 --- a/drivers/char/drm/i915_drm.h +++ b/drivers/char/drm/i915_drm.h | |||
@@ -74,6 +74,30 @@ typedef struct _drm_i915_sarea { | |||
74 | int pf_active; | 74 | int pf_active; |
75 | int pf_current_page; /* which buffer is being displayed? */ | 75 | int pf_current_page; /* which buffer is being displayed? */ |
76 | int perf_boxes; /* performance boxes to be displayed */ | 76 | int perf_boxes; /* performance boxes to be displayed */ |
77 | int width, height; /* screen size in pixels */ | ||
78 | |||
79 | drm_handle_t front_handle; | ||
80 | int front_offset; | ||
81 | int front_size; | ||
82 | |||
83 | drm_handle_t back_handle; | ||
84 | int back_offset; | ||
85 | int back_size; | ||
86 | |||
87 | drm_handle_t depth_handle; | ||
88 | int depth_offset; | ||
89 | int depth_size; | ||
90 | |||
91 | drm_handle_t tex_handle; | ||
92 | int tex_offset; | ||
93 | int tex_size; | ||
94 | int log_tex_granularity; | ||
95 | int pitch; | ||
96 | int rotation; /* 0, 90, 180 or 270 */ | ||
97 | int rotated_offset; | ||
98 | int rotated_size; | ||
99 | int rotated_pitch; | ||
100 | int virtualX, virtualY; | ||
77 | } drm_i915_sarea_t; | 101 | } drm_i915_sarea_t; |
78 | 102 | ||
79 | /* Flags for perf_boxes | 103 | /* Flags for perf_boxes |
@@ -99,6 +123,7 @@ typedef struct _drm_i915_sarea { | |||
99 | #define DRM_I915_FREE 0x09 | 123 | #define DRM_I915_FREE 0x09 |
100 | #define DRM_I915_INIT_HEAP 0x0a | 124 | #define DRM_I915_INIT_HEAP 0x0a |
101 | #define DRM_I915_CMDBUFFER 0x0b | 125 | #define DRM_I915_CMDBUFFER 0x0b |
126 | #define DRM_I915_DESTROY_HEAP 0x0c | ||
102 | 127 | ||
103 | #define DRM_IOCTL_I915_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t) | 128 | #define DRM_IOCTL_I915_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t) |
104 | #define DRM_IOCTL_I915_FLUSH DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLUSH) | 129 | #define DRM_IOCTL_I915_FLUSH DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLUSH) |
@@ -112,6 +137,7 @@ typedef struct _drm_i915_sarea { | |||
112 | #define DRM_IOCTL_I915_FREE DRM_IOW( DRM_COMMAND_BASE + DRM_I915_FREE, drm_i915_mem_free_t) | 137 | #define DRM_IOCTL_I915_FREE DRM_IOW( DRM_COMMAND_BASE + DRM_I915_FREE, drm_i915_mem_free_t) |
113 | #define DRM_IOCTL_I915_INIT_HEAP DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT_HEAP, drm_i915_mem_init_heap_t) | 138 | #define DRM_IOCTL_I915_INIT_HEAP DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT_HEAP, drm_i915_mem_init_heap_t) |
114 | #define DRM_IOCTL_I915_CMDBUFFER DRM_IOW( DRM_COMMAND_BASE + DRM_I915_CMDBUFFER, drm_i915_cmdbuffer_t) | 139 | #define DRM_IOCTL_I915_CMDBUFFER DRM_IOW( DRM_COMMAND_BASE + DRM_I915_CMDBUFFER, drm_i915_cmdbuffer_t) |
140 | #define DRM_IOCTL_I915_DESTROY_HEAP DRM_IOW( DRM_COMMAND_BASE + DRM_I915_DESTROY_HEAP, drm_i915_mem_destroy_heap_t) | ||
115 | 141 | ||
116 | /* Allow drivers to submit batchbuffers directly to hardware, relying | 142 | /* Allow drivers to submit batchbuffers directly to hardware, relying |
117 | * on the security mechanisms provided by hardware. | 143 | * on the security mechanisms provided by hardware. |
@@ -191,4 +217,11 @@ typedef struct drm_i915_mem_init_heap { | |||
191 | int start; | 217 | int start; |
192 | } drm_i915_mem_init_heap_t; | 218 | } drm_i915_mem_init_heap_t; |
193 | 219 | ||
220 | /* Allow memory manager to be torn down and re-initialized (eg on | ||
221 | * rotate): | ||
222 | */ | ||
223 | typedef struct drm_i915_mem_destroy_heap { | ||
224 | int region; | ||
225 | } drm_i915_mem_destroy_heap_t; | ||
226 | |||
194 | #endif /* _I915_DRM_H_ */ | 227 | #endif /* _I915_DRM_H_ */ |
diff --git a/drivers/char/drm/i915_drv.h b/drivers/char/drm/i915_drv.h index c6c71b45f101..7a65666899e4 100644 --- a/drivers/char/drm/i915_drv.h +++ b/drivers/char/drm/i915_drv.h | |||
@@ -37,16 +37,17 @@ | |||
37 | 37 | ||
38 | #define DRIVER_NAME "i915" | 38 | #define DRIVER_NAME "i915" |
39 | #define DRIVER_DESC "Intel Graphics" | 39 | #define DRIVER_DESC "Intel Graphics" |
40 | #define DRIVER_DATE "20051209" | 40 | #define DRIVER_DATE "20060119" |
41 | 41 | ||
42 | /* Interface history: | 42 | /* Interface history: |
43 | * | 43 | * |
44 | * 1.1: Original. | 44 | * 1.1: Original. |
45 | * 1.2: Add Power Management | 45 | * 1.2: Add Power Management |
46 | * 1.3: Add vblank support | 46 | * 1.3: Add vblank support |
47 | * 1.4: Fix cmdbuffer path, add heap destroy | ||
47 | */ | 48 | */ |
48 | #define DRIVER_MAJOR 1 | 49 | #define DRIVER_MAJOR 1 |
49 | #define DRIVER_MINOR 3 | 50 | #define DRIVER_MINOR 4 |
50 | #define DRIVER_PATCHLEVEL 0 | 51 | #define DRIVER_PATCHLEVEL 0 |
51 | 52 | ||
52 | typedef struct _drm_i915_ring_buffer { | 53 | typedef struct _drm_i915_ring_buffer { |
@@ -123,6 +124,7 @@ extern void i915_driver_irq_uninstall(drm_device_t * dev); | |||
123 | extern int i915_mem_alloc(DRM_IOCTL_ARGS); | 124 | extern int i915_mem_alloc(DRM_IOCTL_ARGS); |
124 | extern int i915_mem_free(DRM_IOCTL_ARGS); | 125 | extern int i915_mem_free(DRM_IOCTL_ARGS); |
125 | extern int i915_mem_init_heap(DRM_IOCTL_ARGS); | 126 | extern int i915_mem_init_heap(DRM_IOCTL_ARGS); |
127 | extern int i915_mem_destroy_heap(DRM_IOCTL_ARGS); | ||
126 | extern void i915_mem_takedown(struct mem_block **heap); | 128 | extern void i915_mem_takedown(struct mem_block **heap); |
127 | extern void i915_mem_release(drm_device_t * dev, | 129 | extern void i915_mem_release(drm_device_t * dev, |
128 | DRMFILE filp, struct mem_block *heap); | 130 | DRMFILE filp, struct mem_block *heap); |
diff --git a/drivers/char/drm/i915_irq.c b/drivers/char/drm/i915_irq.c index a1381c61aa63..d3879ac9970f 100644 --- a/drivers/char/drm/i915_irq.c +++ b/drivers/char/drm/i915_irq.c | |||
@@ -202,10 +202,15 @@ void i915_driver_irq_postinstall(drm_device_t * dev) | |||
202 | void i915_driver_irq_uninstall(drm_device_t * dev) | 202 | void i915_driver_irq_uninstall(drm_device_t * dev) |
203 | { | 203 | { |
204 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; | 204 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; |
205 | u16 temp; | ||
206 | |||
205 | if (!dev_priv) | 207 | if (!dev_priv) |
206 | return; | 208 | return; |
207 | 209 | ||
208 | I915_WRITE16(I915REG_HWSTAM, 0xffff); | 210 | I915_WRITE16(I915REG_HWSTAM, 0xffff); |
209 | I915_WRITE16(I915REG_INT_MASK_R, 0xffff); | 211 | I915_WRITE16(I915REG_INT_MASK_R, 0xffff); |
210 | I915_WRITE16(I915REG_INT_ENABLE_R, 0x0); | 212 | I915_WRITE16(I915REG_INT_ENABLE_R, 0x0); |
213 | |||
214 | temp = I915_READ16(I915REG_INT_IDENTITY_R); | ||
215 | I915_WRITE16(I915REG_INT_IDENTITY_R, temp); | ||
211 | } | 216 | } |
diff --git a/drivers/char/drm/i915_mem.c b/drivers/char/drm/i915_mem.c index ba87ff17ff64..52c67324df58 100644 --- a/drivers/char/drm/i915_mem.c +++ b/drivers/char/drm/i915_mem.c | |||
@@ -365,3 +365,34 @@ int i915_mem_init_heap(DRM_IOCTL_ARGS) | |||
365 | 365 | ||
366 | return init_heap(heap, initheap.start, initheap.size); | 366 | return init_heap(heap, initheap.start, initheap.size); |
367 | } | 367 | } |
368 | |||
369 | int i915_mem_destroy_heap( DRM_IOCTL_ARGS ) | ||
370 | { | ||
371 | DRM_DEVICE; | ||
372 | drm_i915_private_t *dev_priv = dev->dev_private; | ||
373 | drm_i915_mem_destroy_heap_t destroyheap; | ||
374 | struct mem_block **heap; | ||
375 | |||
376 | if ( !dev_priv ) { | ||
377 | DRM_ERROR( "%s called with no initialization\n", __FUNCTION__ ); | ||
378 | return DRM_ERR(EINVAL); | ||
379 | } | ||
380 | |||
381 | DRM_COPY_FROM_USER_IOCTL( destroyheap, (drm_i915_mem_destroy_heap_t *)data, | ||
382 | sizeof(destroyheap) ); | ||
383 | |||
384 | heap = get_heap( dev_priv, destroyheap.region ); | ||
385 | if (!heap) { | ||
386 | DRM_ERROR("get_heap failed"); | ||
387 | return DRM_ERR(EFAULT); | ||
388 | } | ||
389 | |||
390 | if (!*heap) { | ||
391 | DRM_ERROR("heap not initialized?"); | ||
392 | return DRM_ERR(EFAULT); | ||
393 | } | ||
394 | |||
395 | i915_mem_takedown( heap ); | ||
396 | return 0; | ||
397 | } | ||
398 | |||
diff --git a/drivers/char/drm/r300_cmdbuf.c b/drivers/char/drm/r300_cmdbuf.c index 291dbf4c8186..c08fa5076f05 100644 --- a/drivers/char/drm/r300_cmdbuf.c +++ b/drivers/char/drm/r300_cmdbuf.c | |||
@@ -161,6 +161,7 @@ void r300_init_reg_flags(void) | |||
161 | ADD_RANGE(R300_VAP_PVS_CNTL_1, 3); | 161 | ADD_RANGE(R300_VAP_PVS_CNTL_1, 3); |
162 | ADD_RANGE(R300_GB_ENABLE, 1); | 162 | ADD_RANGE(R300_GB_ENABLE, 1); |
163 | ADD_RANGE(R300_GB_MSPOS0, 5); | 163 | ADD_RANGE(R300_GB_MSPOS0, 5); |
164 | ADD_RANGE(R300_TX_CNTL, 1); | ||
164 | ADD_RANGE(R300_TX_ENABLE, 1); | 165 | ADD_RANGE(R300_TX_ENABLE, 1); |
165 | ADD_RANGE(0x4200, 4); | 166 | ADD_RANGE(0x4200, 4); |
166 | ADD_RANGE(0x4214, 1); | 167 | ADD_RANGE(0x4214, 1); |
@@ -489,6 +490,50 @@ static __inline__ int r300_emit_3d_load_vbpntr(drm_radeon_private_t *dev_priv, | |||
489 | 490 | ||
490 | return 0; | 491 | return 0; |
491 | } | 492 | } |
493 | static __inline__ int r300_emit_bitblt_multi(drm_radeon_private_t *dev_priv, | ||
494 | drm_radeon_kcmd_buffer_t *cmdbuf) | ||
495 | { | ||
496 | u32 *cmd = (u32 *) cmdbuf->buf; | ||
497 | int count, ret; | ||
498 | RING_LOCALS; | ||
499 | |||
500 | count=(cmd[0]>>16) & 0x3fff; | ||
501 | |||
502 | if (cmd[0] & 0x8000) { | ||
503 | u32 offset; | ||
504 | |||
505 | if (cmd[1] & (RADEON_GMC_SRC_PITCH_OFFSET_CNTL | ||
506 | | RADEON_GMC_DST_PITCH_OFFSET_CNTL)) { | ||
507 | offset = cmd[2] << 10; | ||
508 | ret = r300_check_offset(dev_priv, offset); | ||
509 | if (ret) { | ||
510 | DRM_ERROR("Invalid bitblt first offset is %08X\n", offset); | ||
511 | return DRM_ERR(EINVAL); | ||
512 | } | ||
513 | } | ||
514 | |||
515 | if ((cmd[1] & RADEON_GMC_SRC_PITCH_OFFSET_CNTL) && | ||
516 | (cmd[1] & RADEON_GMC_DST_PITCH_OFFSET_CNTL)) { | ||
517 | offset = cmd[3] << 10; | ||
518 | ret = r300_check_offset(dev_priv, offset); | ||
519 | if (ret) { | ||
520 | DRM_ERROR("Invalid bitblt second offset is %08X\n", offset); | ||
521 | return DRM_ERR(EINVAL); | ||
522 | } | ||
523 | |||
524 | } | ||
525 | } | ||
526 | |||
527 | BEGIN_RING(count+2); | ||
528 | OUT_RING(cmd[0]); | ||
529 | OUT_RING_TABLE((int *)(cmdbuf->buf + 4), count + 1); | ||
530 | ADVANCE_RING(); | ||
531 | |||
532 | cmdbuf->buf += (count+2)*4; | ||
533 | cmdbuf->bufsz -= (count+2)*4; | ||
534 | |||
535 | return 0; | ||
536 | } | ||
492 | 537 | ||
493 | static __inline__ int r300_emit_raw_packet3(drm_radeon_private_t *dev_priv, | 538 | static __inline__ int r300_emit_raw_packet3(drm_radeon_private_t *dev_priv, |
494 | drm_radeon_kcmd_buffer_t *cmdbuf) | 539 | drm_radeon_kcmd_buffer_t *cmdbuf) |
@@ -527,6 +572,9 @@ static __inline__ int r300_emit_raw_packet3(drm_radeon_private_t *dev_priv, | |||
527 | case RADEON_3D_LOAD_VBPNTR: /* load vertex array pointers */ | 572 | case RADEON_3D_LOAD_VBPNTR: /* load vertex array pointers */ |
528 | return r300_emit_3d_load_vbpntr(dev_priv, cmdbuf, header); | 573 | return r300_emit_3d_load_vbpntr(dev_priv, cmdbuf, header); |
529 | 574 | ||
575 | case RADEON_CNTL_BITBLT_MULTI: | ||
576 | return r300_emit_bitblt_multi(dev_priv, cmdbuf); | ||
577 | |||
530 | case RADEON_CP_3D_DRAW_IMMD_2: /* triggers drawing using in-packet vertex data */ | 578 | case RADEON_CP_3D_DRAW_IMMD_2: /* triggers drawing using in-packet vertex data */ |
531 | case RADEON_CP_3D_DRAW_VBUF_2: /* triggers drawing of vertex buffers setup elsewhere */ | 579 | case RADEON_CP_3D_DRAW_VBUF_2: /* triggers drawing of vertex buffers setup elsewhere */ |
532 | case RADEON_CP_3D_DRAW_INDX_2: /* triggers drawing using indices to vertex buffer */ | 580 | case RADEON_CP_3D_DRAW_INDX_2: /* triggers drawing using indices to vertex buffer */ |
diff --git a/drivers/char/drm/r300_reg.h b/drivers/char/drm/r300_reg.h index a0ed20e25221..d1e19954406b 100644 --- a/drivers/char/drm/r300_reg.h +++ b/drivers/char/drm/r300_reg.h | |||
@@ -451,6 +451,9 @@ I am fairly certain that they are correct unless stated otherwise in comments. | |||
451 | /* END */ | 451 | /* END */ |
452 | 452 | ||
453 | /* gap */ | 453 | /* gap */ |
454 | /* Zero to flush caches. */ | ||
455 | #define R300_TX_CNTL 0x4100 | ||
456 | |||
454 | /* The upper enable bits are guessed, based on fglrx reported limits. */ | 457 | /* The upper enable bits are guessed, based on fglrx reported limits. */ |
455 | #define R300_TX_ENABLE 0x4104 | 458 | #define R300_TX_ENABLE 0x4104 |
456 | # define R300_TX_ENABLE_0 (1 << 0) | 459 | # define R300_TX_ENABLE_0 (1 << 0) |
diff --git a/drivers/char/drm/radeon_cp.c b/drivers/char/drm/radeon_cp.c index 915665c7fe7c..9bb8ae0c1c27 100644 --- a/drivers/char/drm/radeon_cp.c +++ b/drivers/char/drm/radeon_cp.c | |||
@@ -1640,7 +1640,7 @@ static int radeon_do_cleanup_cp(drm_device_t * dev) | |||
1640 | if (dev_priv->gart_info.gart_table_location == DRM_ATI_GART_FB) | 1640 | if (dev_priv->gart_info.gart_table_location == DRM_ATI_GART_FB) |
1641 | { | 1641 | { |
1642 | drm_core_ioremapfree(&dev_priv->gart_info.mapping, dev); | 1642 | drm_core_ioremapfree(&dev_priv->gart_info.mapping, dev); |
1643 | dev_priv->gart_info.addr = 0; | 1643 | dev_priv->gart_info.addr = NULL; |
1644 | } | 1644 | } |
1645 | } | 1645 | } |
1646 | /* only clear to the start of flags */ | 1646 | /* only clear to the start of flags */ |
diff --git a/drivers/char/drm/radeon_drv.h b/drivers/char/drm/radeon_drv.h index 498b19b1d641..1f7d2ab8c4fc 100644 --- a/drivers/char/drm/radeon_drv.h +++ b/drivers/char/drm/radeon_drv.h | |||
@@ -90,9 +90,10 @@ | |||
90 | * 1.19- Add support for gart table in FB memory and PCIE r300 | 90 | * 1.19- Add support for gart table in FB memory and PCIE r300 |
91 | * 1.20- Add support for r300 texrect | 91 | * 1.20- Add support for r300 texrect |
92 | * 1.21- Add support for card type getparam | 92 | * 1.21- Add support for card type getparam |
93 | * 1.22- Add support for texture cache flushes (R300_TX_CNTL) | ||
93 | */ | 94 | */ |
94 | #define DRIVER_MAJOR 1 | 95 | #define DRIVER_MAJOR 1 |
95 | #define DRIVER_MINOR 21 | 96 | #define DRIVER_MINOR 22 |
96 | #define DRIVER_PATCHLEVEL 0 | 97 | #define DRIVER_PATCHLEVEL 0 |
97 | 98 | ||
98 | /* | 99 | /* |
diff --git a/drivers/char/drm/savage_bci.c b/drivers/char/drm/savage_bci.c index 0d426deeefec..59c7520bf9a2 100644 --- a/drivers/char/drm/savage_bci.c +++ b/drivers/char/drm/savage_bci.c | |||
@@ -32,6 +32,8 @@ | |||
32 | #define SAVAGE_EVENT_USEC_TIMEOUT 5000000 /* 5s */ | 32 | #define SAVAGE_EVENT_USEC_TIMEOUT 5000000 /* 5s */ |
33 | #define SAVAGE_FREELIST_DEBUG 0 | 33 | #define SAVAGE_FREELIST_DEBUG 0 |
34 | 34 | ||
35 | static int savage_do_cleanup_bci(drm_device_t *dev); | ||
36 | |||
35 | static int | 37 | static int |
36 | savage_bci_wait_fifo_shadow(drm_savage_private_t * dev_priv, unsigned int n) | 38 | savage_bci_wait_fifo_shadow(drm_savage_private_t * dev_priv, unsigned int n) |
37 | { | 39 | { |
@@ -895,7 +897,7 @@ static int savage_do_init_bci(drm_device_t * dev, drm_savage_init_t * init) | |||
895 | return 0; | 897 | return 0; |
896 | } | 898 | } |
897 | 899 | ||
898 | int savage_do_cleanup_bci(drm_device_t * dev) | 900 | static int savage_do_cleanup_bci(drm_device_t * dev) |
899 | { | 901 | { |
900 | drm_savage_private_t *dev_priv = dev->dev_private; | 902 | drm_savage_private_t *dev_priv = dev->dev_private; |
901 | 903 | ||
diff --git a/drivers/char/drm/savage_drv.h b/drivers/char/drm/savage_drv.h index dd46cb85439c..8f04b3d82292 100644 --- a/drivers/char/drm/savage_drv.h +++ b/drivers/char/drm/savage_drv.h | |||
@@ -212,7 +212,6 @@ extern int savage_driver_load(drm_device_t *dev, unsigned long chipset); | |||
212 | extern int savage_driver_firstopen(drm_device_t *dev); | 212 | extern int savage_driver_firstopen(drm_device_t *dev); |
213 | extern void savage_driver_lastclose(drm_device_t *dev); | 213 | extern void savage_driver_lastclose(drm_device_t *dev); |
214 | extern int savage_driver_unload(drm_device_t *dev); | 214 | extern int savage_driver_unload(drm_device_t *dev); |
215 | extern int savage_do_cleanup_bci(drm_device_t * dev); | ||
216 | extern void savage_reclaim_buffers(drm_device_t * dev, DRMFILE filp); | 215 | extern void savage_reclaim_buffers(drm_device_t * dev, DRMFILE filp); |
217 | 216 | ||
218 | /* state functions */ | 217 | /* state functions */ |
diff --git a/drivers/char/drm/via_dma.c b/drivers/char/drm/via_dma.c index 593c0b8f650a..a691ae74129d 100644 --- a/drivers/char/drm/via_dma.c +++ b/drivers/char/drm/via_dma.c | |||
@@ -222,7 +222,7 @@ static int via_initialize(drm_device_t * dev, | |||
222 | return 0; | 222 | return 0; |
223 | } | 223 | } |
224 | 224 | ||
225 | int via_dma_init(DRM_IOCTL_ARGS) | 225 | static int via_dma_init(DRM_IOCTL_ARGS) |
226 | { | 226 | { |
227 | DRM_DEVICE; | 227 | DRM_DEVICE; |
228 | drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private; | 228 | drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private; |
@@ -321,7 +321,7 @@ int via_driver_dma_quiescent(drm_device_t * dev) | |||
321 | return 0; | 321 | return 0; |
322 | } | 322 | } |
323 | 323 | ||
324 | int via_flush_ioctl(DRM_IOCTL_ARGS) | 324 | static int via_flush_ioctl(DRM_IOCTL_ARGS) |
325 | { | 325 | { |
326 | DRM_DEVICE; | 326 | DRM_DEVICE; |
327 | 327 | ||
@@ -330,7 +330,7 @@ int via_flush_ioctl(DRM_IOCTL_ARGS) | |||
330 | return via_driver_dma_quiescent(dev); | 330 | return via_driver_dma_quiescent(dev); |
331 | } | 331 | } |
332 | 332 | ||
333 | int via_cmdbuffer(DRM_IOCTL_ARGS) | 333 | static int via_cmdbuffer(DRM_IOCTL_ARGS) |
334 | { | 334 | { |
335 | DRM_DEVICE; | 335 | DRM_DEVICE; |
336 | drm_via_cmdbuffer_t cmdbuf; | 336 | drm_via_cmdbuffer_t cmdbuf; |
@@ -375,7 +375,7 @@ static int via_dispatch_pci_cmdbuffer(drm_device_t * dev, | |||
375 | return ret; | 375 | return ret; |
376 | } | 376 | } |
377 | 377 | ||
378 | int via_pci_cmdbuffer(DRM_IOCTL_ARGS) | 378 | static int via_pci_cmdbuffer(DRM_IOCTL_ARGS) |
379 | { | 379 | { |
380 | DRM_DEVICE; | 380 | DRM_DEVICE; |
381 | drm_via_cmdbuffer_t cmdbuf; | 381 | drm_via_cmdbuffer_t cmdbuf; |
@@ -665,7 +665,7 @@ static void via_cmdbuf_reset(drm_via_private_t * dev_priv) | |||
665 | * User interface to the space and lag functions. | 665 | * User interface to the space and lag functions. |
666 | */ | 666 | */ |
667 | 667 | ||
668 | int via_cmdbuf_size(DRM_IOCTL_ARGS) | 668 | static int via_cmdbuf_size(DRM_IOCTL_ARGS) |
669 | { | 669 | { |
670 | DRM_DEVICE; | 670 | DRM_DEVICE; |
671 | drm_via_cmdbuf_size_t d_siz; | 671 | drm_via_cmdbuf_size_t d_siz; |
diff --git a/drivers/char/drm/via_dmablit.c b/drivers/char/drm/via_dmablit.c index 9d5e027dae0e..b7f17457b424 100644 --- a/drivers/char/drm/via_dmablit.c +++ b/drivers/char/drm/via_dmablit.c | |||
@@ -108,7 +108,7 @@ via_map_blit_for_device(struct pci_dev *pdev, | |||
108 | int num_desc = 0; | 108 | int num_desc = 0; |
109 | int cur_line; | 109 | int cur_line; |
110 | dma_addr_t next = 0 | VIA_DMA_DPR_EC; | 110 | dma_addr_t next = 0 | VIA_DMA_DPR_EC; |
111 | drm_via_descriptor_t *desc_ptr = 0; | 111 | drm_via_descriptor_t *desc_ptr = NULL; |
112 | 112 | ||
113 | if (mode == 1) | 113 | if (mode == 1) |
114 | desc_ptr = vsg->desc_pages[cur_descriptor_page]; | 114 | desc_ptr = vsg->desc_pages[cur_descriptor_page]; |
@@ -167,7 +167,7 @@ via_map_blit_for_device(struct pci_dev *pdev, | |||
167 | */ | 167 | */ |
168 | 168 | ||
169 | 169 | ||
170 | void | 170 | static void |
171 | via_free_sg_info(struct pci_dev *pdev, drm_via_sg_info_t *vsg) | 171 | via_free_sg_info(struct pci_dev *pdev, drm_via_sg_info_t *vsg) |
172 | { | 172 | { |
173 | struct page *page; | 173 | struct page *page; |
@@ -581,7 +581,7 @@ via_build_sg_info(drm_device_t *dev, drm_via_sg_info_t *vsg, drm_via_dmablit_t * | |||
581 | int ret = 0; | 581 | int ret = 0; |
582 | 582 | ||
583 | vsg->direction = (draw) ? DMA_TO_DEVICE : DMA_FROM_DEVICE; | 583 | vsg->direction = (draw) ? DMA_TO_DEVICE : DMA_FROM_DEVICE; |
584 | vsg->bounce_buffer = 0; | 584 | vsg->bounce_buffer = NULL; |
585 | 585 | ||
586 | vsg->state = dr_via_sg_init; | 586 | vsg->state = dr_via_sg_init; |
587 | 587 | ||
diff --git a/drivers/char/drm/via_drv.h b/drivers/char/drm/via_drv.h index aad4f99f5405..52bcc7b1ba45 100644 --- a/drivers/char/drm/via_drv.h +++ b/drivers/char/drm/via_drv.h | |||
@@ -110,11 +110,6 @@ extern int via_mem_free(DRM_IOCTL_ARGS); | |||
110 | extern int via_agp_init(DRM_IOCTL_ARGS); | 110 | extern int via_agp_init(DRM_IOCTL_ARGS); |
111 | extern int via_map_init(DRM_IOCTL_ARGS); | 111 | extern int via_map_init(DRM_IOCTL_ARGS); |
112 | extern int via_decoder_futex(DRM_IOCTL_ARGS); | 112 | extern int via_decoder_futex(DRM_IOCTL_ARGS); |
113 | extern int via_dma_init(DRM_IOCTL_ARGS); | ||
114 | extern int via_cmdbuffer(DRM_IOCTL_ARGS); | ||
115 | extern int via_flush_ioctl(DRM_IOCTL_ARGS); | ||
116 | extern int via_pci_cmdbuffer(DRM_IOCTL_ARGS); | ||
117 | extern int via_cmdbuf_size(DRM_IOCTL_ARGS); | ||
118 | extern int via_wait_irq(DRM_IOCTL_ARGS); | 113 | extern int via_wait_irq(DRM_IOCTL_ARGS); |
119 | extern int via_dma_blit_sync( DRM_IOCTL_ARGS ); | 114 | extern int via_dma_blit_sync( DRM_IOCTL_ARGS ); |
120 | extern int via_dma_blit( DRM_IOCTL_ARGS ); | 115 | extern int via_dma_blit( DRM_IOCTL_ARGS ); |
@@ -139,8 +134,6 @@ extern int via_driver_dma_quiescent(drm_device_t * dev); | |||
139 | extern void via_init_futex(drm_via_private_t * dev_priv); | 134 | extern void via_init_futex(drm_via_private_t * dev_priv); |
140 | extern void via_cleanup_futex(drm_via_private_t * dev_priv); | 135 | extern void via_cleanup_futex(drm_via_private_t * dev_priv); |
141 | extern void via_release_futex(drm_via_private_t * dev_priv, int context); | 136 | extern void via_release_futex(drm_via_private_t * dev_priv, int context); |
142 | extern int via_driver_irq_wait(drm_device_t * dev, unsigned int irq, | ||
143 | int force_sequence, unsigned int *sequence); | ||
144 | 137 | ||
145 | extern void via_dmablit_handler(drm_device_t *dev, int engine, int from_irq); | 138 | extern void via_dmablit_handler(drm_device_t *dev, int engine, int from_irq); |
146 | extern void via_init_dmablit(drm_device_t *dev); | 139 | extern void via_init_dmablit(drm_device_t *dev); |
diff --git a/drivers/char/drm/via_irq.c b/drivers/char/drm/via_irq.c index 56d7e3daea12..6152415644e9 100644 --- a/drivers/char/drm/via_irq.c +++ b/drivers/char/drm/via_irq.c | |||
@@ -190,7 +190,7 @@ int via_driver_vblank_wait(drm_device_t * dev, unsigned int *sequence) | |||
190 | return ret; | 190 | return ret; |
191 | } | 191 | } |
192 | 192 | ||
193 | int | 193 | static int |
194 | via_driver_irq_wait(drm_device_t * dev, unsigned int irq, int force_sequence, | 194 | via_driver_irq_wait(drm_device_t * dev, unsigned int irq, int force_sequence, |
195 | unsigned int *sequence) | 195 | unsigned int *sequence) |
196 | { | 196 | { |
diff --git a/drivers/char/esp.c b/drivers/char/esp.c index 3f3ac039f4d9..09dc4b01232c 100644 --- a/drivers/char/esp.c +++ b/drivers/char/esp.c | |||
@@ -150,17 +150,6 @@ static void rs_wait_until_sent(struct tty_struct *, int); | |||
150 | /* Standard COM flags (except for COM4, because of the 8514 problem) */ | 150 | /* Standard COM flags (except for COM4, because of the 8514 problem) */ |
151 | #define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST) | 151 | #define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST) |
152 | 152 | ||
153 | /* | ||
154 | * tmp_buf is used as a temporary buffer by serial_write. We need to | ||
155 | * lock it in case the memcpy_fromfs blocks while swapping in a page, | ||
156 | * and some other program tries to do a serial write at the same time. | ||
157 | * Since the lock will only come under contention when the system is | ||
158 | * swapping and available memory is low, it makes sense to share one | ||
159 | * buffer across all the serial ports, since it significantly saves | ||
160 | * memory if large numbers of serial ports are open. | ||
161 | */ | ||
162 | static unsigned char *tmp_buf; | ||
163 | |||
164 | static inline int serial_paranoia_check(struct esp_struct *info, | 153 | static inline int serial_paranoia_check(struct esp_struct *info, |
165 | char *name, const char *routine) | 154 | char *name, const char *routine) |
166 | { | 155 | { |
@@ -359,7 +348,7 @@ static inline void receive_chars_pio(struct esp_struct *info, int num_bytes) | |||
359 | } | 348 | } |
360 | } | 349 | } |
361 | 350 | ||
362 | schedule_delayed_work(&tty->buf.work, 1); | 351 | tty_schedule_flip(tty); |
363 | 352 | ||
364 | info->stat_flags &= ~ESP_STAT_RX_TIMEOUT; | 353 | info->stat_flags &= ~ESP_STAT_RX_TIMEOUT; |
365 | release_pio_buffer(pio_buf); | 354 | release_pio_buffer(pio_buf); |
@@ -426,7 +415,7 @@ static inline void receive_chars_dma_done(struct esp_struct *info, | |||
426 | } | 415 | } |
427 | tty_insert_flip_char(tty, dma_buffer[num_bytes - 1], statflag); | 416 | tty_insert_flip_char(tty, dma_buffer[num_bytes - 1], statflag); |
428 | } | 417 | } |
429 | schedule_delayed_work(&tty->buf.work, 1); | 418 | tty_schedule_flip(tty); |
430 | } | 419 | } |
431 | 420 | ||
432 | if (dma_bytes != num_bytes) { | 421 | if (dma_bytes != num_bytes) { |
@@ -1267,7 +1256,7 @@ static int rs_write(struct tty_struct * tty, | |||
1267 | if (serial_paranoia_check(info, tty->name, "rs_write")) | 1256 | if (serial_paranoia_check(info, tty->name, "rs_write")) |
1268 | return 0; | 1257 | return 0; |
1269 | 1258 | ||
1270 | if (!tty || !info->xmit_buf || !tmp_buf) | 1259 | if (!tty || !info->xmit_buf) |
1271 | return 0; | 1260 | return 0; |
1272 | 1261 | ||
1273 | while (1) { | 1262 | while (1) { |
@@ -2291,11 +2280,7 @@ static int esp_open(struct tty_struct *tty, struct file * filp) | |||
2291 | tty->driver_data = info; | 2280 | tty->driver_data = info; |
2292 | info->tty = tty; | 2281 | info->tty = tty; |
2293 | 2282 | ||
2294 | if (!tmp_buf) { | 2283 | spin_unlock_irqrestore(&info->lock, flags); |
2295 | tmp_buf = (unsigned char *) get_zeroed_page(GFP_KERNEL); | ||
2296 | if (!tmp_buf) | ||
2297 | return -ENOMEM; | ||
2298 | } | ||
2299 | 2284 | ||
2300 | /* | 2285 | /* |
2301 | * Start up serial port | 2286 | * Start up serial port |
@@ -2602,9 +2587,6 @@ static void __exit espserial_exit(void) | |||
2602 | free_pages((unsigned long)dma_buffer, | 2587 | free_pages((unsigned long)dma_buffer, |
2603 | get_order(DMA_BUFFER_SZ)); | 2588 | get_order(DMA_BUFFER_SZ)); |
2604 | 2589 | ||
2605 | if (tmp_buf) | ||
2606 | free_page((unsigned long)tmp_buf); | ||
2607 | |||
2608 | while (free_pio_buf) { | 2590 | while (free_pio_buf) { |
2609 | pio_buf = free_pio_buf->next; | 2591 | pio_buf = free_pio_buf->next; |
2610 | kfree(free_pio_buf); | 2592 | kfree(free_pio_buf); |
diff --git a/drivers/char/hangcheck-timer.c b/drivers/char/hangcheck-timer.c index 40a67c86420c..ac626418b329 100644 --- a/drivers/char/hangcheck-timer.c +++ b/drivers/char/hangcheck-timer.c | |||
@@ -117,12 +117,9 @@ __setup("hcheck_reboot", hangcheck_parse_reboot); | |||
117 | __setup("hcheck_dump_tasks", hangcheck_parse_dump_tasks); | 117 | __setup("hcheck_dump_tasks", hangcheck_parse_dump_tasks); |
118 | #endif /* not MODULE */ | 118 | #endif /* not MODULE */ |
119 | 119 | ||
120 | #if defined(CONFIG_X86) | 120 | #if defined(CONFIG_X86) || defined(CONFIG_S390) |
121 | # define HAVE_MONOTONIC | 121 | # define HAVE_MONOTONIC |
122 | # define TIMER_FREQ 1000000000ULL | 122 | # define TIMER_FREQ 1000000000ULL |
123 | #elif defined(CONFIG_S390) | ||
124 | /* FA240000 is 1 Second in the IBM time universe (Page 4-38 Principles of Op for zSeries */ | ||
125 | # define TIMER_FREQ 0xFA240000ULL | ||
126 | #elif defined(CONFIG_IA64) | 123 | #elif defined(CONFIG_IA64) |
127 | # define TIMER_FREQ ((unsigned long long)local_cpu_data->itc_freq) | 124 | # define TIMER_FREQ ((unsigned long long)local_cpu_data->itc_freq) |
128 | #elif defined(CONFIG_PPC64) | 125 | #elif defined(CONFIG_PPC64) |
@@ -134,12 +131,7 @@ extern unsigned long long monotonic_clock(void); | |||
134 | #else | 131 | #else |
135 | static inline unsigned long long monotonic_clock(void) | 132 | static inline unsigned long long monotonic_clock(void) |
136 | { | 133 | { |
137 | # ifdef __s390__ | ||
138 | /* returns the TOD. see 4-38 Principles of Op of zSeries */ | ||
139 | return get_clock(); | ||
140 | # else | ||
141 | return get_cycles(); | 134 | return get_cycles(); |
142 | # endif /* __s390__ */ | ||
143 | } | 135 | } |
144 | #endif /* HAVE_MONOTONIC */ | 136 | #endif /* HAVE_MONOTONIC */ |
145 | 137 | ||
@@ -188,8 +180,6 @@ static int __init hangcheck_init(void) | |||
188 | VERSION_STR, hangcheck_tick, hangcheck_margin); | 180 | VERSION_STR, hangcheck_tick, hangcheck_margin); |
189 | #if defined (HAVE_MONOTONIC) | 181 | #if defined (HAVE_MONOTONIC) |
190 | printk("Hangcheck: Using monotonic_clock().\n"); | 182 | printk("Hangcheck: Using monotonic_clock().\n"); |
191 | #elif defined(__s390__) | ||
192 | printk("Hangcheck: Using TOD.\n"); | ||
193 | #else | 183 | #else |
194 | printk("Hangcheck: Using get_cycles().\n"); | 184 | printk("Hangcheck: Using get_cycles().\n"); |
195 | #endif /* HAVE_MONOTONIC */ | 185 | #endif /* HAVE_MONOTONIC */ |
diff --git a/drivers/char/hpet.c b/drivers/char/hpet.c index 3808d9572619..ef140ebde117 100644 --- a/drivers/char/hpet.c +++ b/drivers/char/hpet.c | |||
@@ -927,9 +927,9 @@ static acpi_status hpet_resources(struct acpi_resource *res, void *data) | |||
927 | if (ACPI_SUCCESS(status)) { | 927 | if (ACPI_SUCCESS(status)) { |
928 | unsigned long size; | 928 | unsigned long size; |
929 | 929 | ||
930 | size = addr.max_address_range - addr.min_address_range + 1; | 930 | size = addr.maximum - addr.minimum + 1; |
931 | hdp->hd_phys_address = addr.min_address_range; | 931 | hdp->hd_phys_address = addr.minimum; |
932 | hdp->hd_address = ioremap(addr.min_address_range, size); | 932 | hdp->hd_address = ioremap(addr.minimum, size); |
933 | 933 | ||
934 | if (hpet_is_known(hdp)) { | 934 | if (hpet_is_known(hdp)) { |
935 | printk(KERN_DEBUG "%s: 0x%lx is busy\n", | 935 | printk(KERN_DEBUG "%s: 0x%lx is busy\n", |
@@ -937,15 +937,15 @@ static acpi_status hpet_resources(struct acpi_resource *res, void *data) | |||
937 | iounmap(hdp->hd_address); | 937 | iounmap(hdp->hd_address); |
938 | return -EBUSY; | 938 | return -EBUSY; |
939 | } | 939 | } |
940 | } else if (res->id == ACPI_RSTYPE_FIXED_MEM32) { | 940 | } else if (res->type == ACPI_RESOURCE_TYPE_FIXED_MEMORY32) { |
941 | struct acpi_resource_fixed_mem32 *fixmem32; | 941 | struct acpi_resource_fixed_memory32 *fixmem32; |
942 | 942 | ||
943 | fixmem32 = &res->data.fixed_memory32; | 943 | fixmem32 = &res->data.fixed_memory32; |
944 | if (!fixmem32) | 944 | if (!fixmem32) |
945 | return -EINVAL; | 945 | return -EINVAL; |
946 | 946 | ||
947 | hdp->hd_phys_address = fixmem32->range_base_address; | 947 | hdp->hd_phys_address = fixmem32->address; |
948 | hdp->hd_address = ioremap(fixmem32->range_base_address, | 948 | hdp->hd_address = ioremap(fixmem32->address, |
949 | HPET_RANGE_SIZE); | 949 | HPET_RANGE_SIZE); |
950 | 950 | ||
951 | if (hpet_is_known(hdp)) { | 951 | if (hpet_is_known(hdp)) { |
@@ -954,24 +954,20 @@ static acpi_status hpet_resources(struct acpi_resource *res, void *data) | |||
954 | iounmap(hdp->hd_address); | 954 | iounmap(hdp->hd_address); |
955 | return -EBUSY; | 955 | return -EBUSY; |
956 | } | 956 | } |
957 | } else if (res->id == ACPI_RSTYPE_EXT_IRQ) { | 957 | } else if (res->type == ACPI_RESOURCE_TYPE_EXTENDED_IRQ) { |
958 | struct acpi_resource_ext_irq *irqp; | 958 | struct acpi_resource_extended_irq *irqp; |
959 | int i; | 959 | int i, irq; |
960 | 960 | ||
961 | irqp = &res->data.extended_irq; | 961 | irqp = &res->data.extended_irq; |
962 | 962 | ||
963 | if (irqp->number_of_interrupts > 0) { | 963 | for (i = 0; i < irqp->interrupt_count; i++) { |
964 | hdp->hd_nirqs = irqp->number_of_interrupts; | 964 | irq = acpi_register_gsi(irqp->interrupts[i], |
965 | 965 | irqp->triggering, irqp->polarity); | |
966 | for (i = 0; i < hdp->hd_nirqs; i++) { | 966 | if (irq < 0) |
967 | int rc = | 967 | return AE_ERROR; |
968 | acpi_register_gsi(irqp->interrupts[i], | 968 | |
969 | irqp->edge_level, | 969 | hdp->hd_irq[hdp->hd_nirqs] = irq; |
970 | irqp->active_high_low); | 970 | hdp->hd_nirqs++; |
971 | if (rc < 0) | ||
972 | return AE_ERROR; | ||
973 | hdp->hd_irq[i] = rc; | ||
974 | } | ||
975 | } | 971 | } |
976 | } | 972 | } |
977 | 973 | ||
diff --git a/drivers/char/hvc_console.c b/drivers/char/hvc_console.c index 1994a92d4733..f65b2e14a485 100644 --- a/drivers/char/hvc_console.c +++ b/drivers/char/hvc_console.c | |||
@@ -335,6 +335,8 @@ static int hvc_open(struct tty_struct *tty, struct file * filp) | |||
335 | } /* else count == 0 */ | 335 | } /* else count == 0 */ |
336 | 336 | ||
337 | tty->driver_data = hp; | 337 | tty->driver_data = hp; |
338 | tty->low_latency = 1; /* Makes flushes to ldisc synchronous. */ | ||
339 | |||
338 | hp->tty = tty; | 340 | hp->tty = tty; |
339 | /* Save for request_irq outside of spin_lock. */ | 341 | /* Save for request_irq outside of spin_lock. */ |
340 | irq = hp->irq; | 342 | irq = hp->irq; |
@@ -633,9 +635,6 @@ static int hvc_poll(struct hvc_struct *hp) | |||
633 | tty_insert_flip_char(tty, buf[i], 0); | 635 | tty_insert_flip_char(tty, buf[i], 0); |
634 | } | 636 | } |
635 | 637 | ||
636 | if (count) | ||
637 | tty_schedule_flip(tty); | ||
638 | |||
639 | /* | 638 | /* |
640 | * Account for the total amount read in one loop, and if above | 639 | * Account for the total amount read in one loop, and if above |
641 | * 64 bytes, we do a quick schedule loop to let the tty grok | 640 | * 64 bytes, we do a quick schedule loop to let the tty grok |
@@ -656,6 +655,9 @@ static int hvc_poll(struct hvc_struct *hp) | |||
656 | bail: | 655 | bail: |
657 | spin_unlock_irqrestore(&hp->lock, flags); | 656 | spin_unlock_irqrestore(&hp->lock, flags); |
658 | 657 | ||
658 | if (read_total) | ||
659 | tty_flip_buffer_push(tty); | ||
660 | |||
659 | return poll_mask; | 661 | return poll_mask; |
660 | } | 662 | } |
661 | 663 | ||
diff --git a/drivers/char/hw_random.c b/drivers/char/hw_random.c index b3bc2e37e616..29dc87e59020 100644 --- a/drivers/char/hw_random.c +++ b/drivers/char/hw_random.c | |||
@@ -131,7 +131,9 @@ enum { | |||
131 | rng_hw_none, | 131 | rng_hw_none, |
132 | rng_hw_intel, | 132 | rng_hw_intel, |
133 | rng_hw_amd, | 133 | rng_hw_amd, |
134 | #ifdef __i386__ | ||
134 | rng_hw_via, | 135 | rng_hw_via, |
136 | #endif | ||
135 | rng_hw_geode, | 137 | rng_hw_geode, |
136 | }; | 138 | }; |
137 | 139 | ||
diff --git a/drivers/char/ip2/i2cmd.c b/drivers/char/ip2/i2cmd.c index cb8f4198e9a3..e7af647800b6 100644 --- a/drivers/char/ip2/i2cmd.c +++ b/drivers/char/ip2/i2cmd.c | |||
@@ -139,7 +139,6 @@ static UCHAR ct79[] = { 2, BYP, 0x4F,0 }; // XMIT_NOW | |||
139 | //static UCHAR ct86[]={ 2, BTH, 0x56,0 }; // RCV_ENABLE | 139 | //static UCHAR ct86[]={ 2, BTH, 0x56,0 }; // RCV_ENABLE |
140 | static UCHAR ct87[] = { 1, BYP, 0x57 }; // HW_TEST | 140 | static UCHAR ct87[] = { 1, BYP, 0x57 }; // HW_TEST |
141 | //static UCHAR ct88[]={ 3, BTH, 0x58,0,0 }; // RCV_THRESHOLD | 141 | //static UCHAR ct88[]={ 3, BTH, 0x58,0,0 }; // RCV_THRESHOLD |
142 | static UCHAR ct89[]={ 1, BYP, 0x59 }; // DSS_NOW | ||
143 | //static UCHAR ct90[]={ 3, BYP, 0x5A,0,0 }; // Set SILO | 142 | //static UCHAR ct90[]={ 3, BYP, 0x5A,0,0 }; // Set SILO |
144 | //static UCHAR ct91[]={ 2, BYP, 0x5B,0 }; // timed break | 143 | //static UCHAR ct91[]={ 2, BYP, 0x5B,0 }; // timed break |
145 | 144 | ||
diff --git a/drivers/char/ip2main.c b/drivers/char/ip2main.c index 56e93a5a1e24..48fcfba37bfa 100644 --- a/drivers/char/ip2main.c +++ b/drivers/char/ip2main.c | |||
@@ -2906,65 +2906,16 @@ ip2_ipl_ioctl ( struct inode *pInode, struct file *pFile, UINT cmd, ULONG arg ) | |||
2906 | rc = -EINVAL; | 2906 | rc = -EINVAL; |
2907 | break; | 2907 | break; |
2908 | case 3: // Trace device | 2908 | case 3: // Trace device |
2909 | if ( cmd == 1 ) { | 2909 | /* |
2910 | rc = put_user(iiSendPendingMail, pIndex++ ); | 2910 | * akpm: This used to write a whole bunch of function addresses |
2911 | rc = put_user(i2InitChannels, pIndex++ ); | 2911 | * to userspace, which generated lots of put_user() warnings. |
2912 | rc = put_user(i2QueueNeeds, pIndex++ ); | 2912 | * I killed it all. Just return "success" and don't do |
2913 | rc = put_user(i2QueueCommands, pIndex++ ); | 2913 | * anything. |
2914 | rc = put_user(i2GetStatus, pIndex++ ); | 2914 | */ |
2915 | rc = put_user(i2Input, pIndex++ ); | 2915 | if (cmd == 1) |
2916 | rc = put_user(i2InputFlush, pIndex++ ); | 2916 | rc = 0; |
2917 | rc = put_user(i2Output, pIndex++ ); | 2917 | else |
2918 | rc = put_user(i2FlushOutput, pIndex++ ); | ||
2919 | rc = put_user(i2DrainWakeup, pIndex++ ); | ||
2920 | rc = put_user(i2DrainOutput, pIndex++ ); | ||
2921 | rc = put_user(i2OutputFree, pIndex++ ); | ||
2922 | rc = put_user(i2StripFifo, pIndex++ ); | ||
2923 | rc = put_user(i2StuffFifoBypass, pIndex++ ); | ||
2924 | rc = put_user(i2StuffFifoFlow, pIndex++ ); | ||
2925 | rc = put_user(i2StuffFifoInline, pIndex++ ); | ||
2926 | rc = put_user(i2ServiceBoard, pIndex++ ); | ||
2927 | rc = put_user(serviceOutgoingFifo, pIndex++ ); | ||
2928 | // rc = put_user(ip2_init, pIndex++ ); | ||
2929 | rc = put_user(ip2_init_board, pIndex++ ); | ||
2930 | rc = put_user(find_eisa_board, pIndex++ ); | ||
2931 | rc = put_user(set_irq, pIndex++ ); | ||
2932 | rc = put_user(ip2_interrupt, pIndex++ ); | ||
2933 | rc = put_user(ip2_poll, pIndex++ ); | ||
2934 | rc = put_user(service_all_boards, pIndex++ ); | ||
2935 | rc = put_user(do_input, pIndex++ ); | ||
2936 | rc = put_user(do_status, pIndex++ ); | ||
2937 | #ifndef IP2DEBUG_OPEN | ||
2938 | rc = put_user(0, pIndex++ ); | ||
2939 | #else | ||
2940 | rc = put_user(open_sanity_check, pIndex++ ); | ||
2941 | #endif | ||
2942 | rc = put_user(ip2_open, pIndex++ ); | ||
2943 | rc = put_user(ip2_close, pIndex++ ); | ||
2944 | rc = put_user(ip2_hangup, pIndex++ ); | ||
2945 | rc = put_user(ip2_write, pIndex++ ); | ||
2946 | rc = put_user(ip2_putchar, pIndex++ ); | ||
2947 | rc = put_user(ip2_flush_chars, pIndex++ ); | ||
2948 | rc = put_user(ip2_write_room, pIndex++ ); | ||
2949 | rc = put_user(ip2_chars_in_buf, pIndex++ ); | ||
2950 | rc = put_user(ip2_flush_buffer, pIndex++ ); | ||
2951 | |||
2952 | //rc = put_user(ip2_wait_until_sent, pIndex++ ); | ||
2953 | rc = put_user(0, pIndex++ ); | ||
2954 | |||
2955 | rc = put_user(ip2_throttle, pIndex++ ); | ||
2956 | rc = put_user(ip2_unthrottle, pIndex++ ); | ||
2957 | rc = put_user(ip2_ioctl, pIndex++ ); | ||
2958 | rc = put_user(0, pIndex++ ); | ||
2959 | rc = put_user(get_serial_info, pIndex++ ); | ||
2960 | rc = put_user(set_serial_info, pIndex++ ); | ||
2961 | rc = put_user(ip2_set_termios, pIndex++ ); | ||
2962 | rc = put_user(ip2_set_line_discipline, pIndex++ ); | ||
2963 | rc = put_user(set_params, pIndex++ ); | ||
2964 | } else { | ||
2965 | rc = -EINVAL; | 2918 | rc = -EINVAL; |
2966 | } | ||
2967 | |||
2968 | break; | 2919 | break; |
2969 | 2920 | ||
2970 | default: | 2921 | default: |
diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c index 0097f06fa67b..d745004281d0 100644 --- a/drivers/char/ipmi/ipmi_msghandler.c +++ b/drivers/char/ipmi/ipmi_msghandler.c | |||
@@ -481,7 +481,7 @@ int ipmi_validate_addr(struct ipmi_addr *addr, int len) | |||
481 | } | 481 | } |
482 | 482 | ||
483 | if ((addr->channel == IPMI_BMC_CHANNEL) | 483 | if ((addr->channel == IPMI_BMC_CHANNEL) |
484 | || (addr->channel >= IPMI_NUM_CHANNELS) | 484 | || (addr->channel >= IPMI_MAX_CHANNELS) |
485 | || (addr->channel < 0)) | 485 | || (addr->channel < 0)) |
486 | return -EINVAL; | 486 | return -EINVAL; |
487 | 487 | ||
@@ -1321,7 +1321,7 @@ static int i_ipmi_request(ipmi_user_t user, | |||
1321 | unsigned char ipmb_seq; | 1321 | unsigned char ipmb_seq; |
1322 | long seqid; | 1322 | long seqid; |
1323 | 1323 | ||
1324 | if (addr->channel >= IPMI_NUM_CHANNELS) { | 1324 | if (addr->channel >= IPMI_MAX_CHANNELS) { |
1325 | spin_lock_irqsave(&intf->counter_lock, flags); | 1325 | spin_lock_irqsave(&intf->counter_lock, flags); |
1326 | intf->sent_invalid_commands++; | 1326 | intf->sent_invalid_commands++; |
1327 | spin_unlock_irqrestore(&intf->counter_lock, flags); | 1327 | spin_unlock_irqrestore(&intf->counter_lock, flags); |
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c index c67ef3e47ad5..e59b638766ef 100644 --- a/drivers/char/ipmi/ipmi_si_intf.c +++ b/drivers/char/ipmi/ipmi_si_intf.c | |||
@@ -1270,36 +1270,36 @@ static int try_init_port(int intf_num, struct smi_info **new_info) | |||
1270 | return 0; | 1270 | return 0; |
1271 | } | 1271 | } |
1272 | 1272 | ||
1273 | static unsigned char mem_inb(struct si_sm_io *io, unsigned int offset) | 1273 | static unsigned char intf_mem_inb(struct si_sm_io *io, unsigned int offset) |
1274 | { | 1274 | { |
1275 | return readb((io->addr)+(offset * io->regspacing)); | 1275 | return readb((io->addr)+(offset * io->regspacing)); |
1276 | } | 1276 | } |
1277 | 1277 | ||
1278 | static void mem_outb(struct si_sm_io *io, unsigned int offset, | 1278 | static void intf_mem_outb(struct si_sm_io *io, unsigned int offset, |
1279 | unsigned char b) | 1279 | unsigned char b) |
1280 | { | 1280 | { |
1281 | writeb(b, (io->addr)+(offset * io->regspacing)); | 1281 | writeb(b, (io->addr)+(offset * io->regspacing)); |
1282 | } | 1282 | } |
1283 | 1283 | ||
1284 | static unsigned char mem_inw(struct si_sm_io *io, unsigned int offset) | 1284 | static unsigned char intf_mem_inw(struct si_sm_io *io, unsigned int offset) |
1285 | { | 1285 | { |
1286 | return (readw((io->addr)+(offset * io->regspacing)) >> io->regshift) | 1286 | return (readw((io->addr)+(offset * io->regspacing)) >> io->regshift) |
1287 | && 0xff; | 1287 | && 0xff; |
1288 | } | 1288 | } |
1289 | 1289 | ||
1290 | static void mem_outw(struct si_sm_io *io, unsigned int offset, | 1290 | static void intf_mem_outw(struct si_sm_io *io, unsigned int offset, |
1291 | unsigned char b) | 1291 | unsigned char b) |
1292 | { | 1292 | { |
1293 | writeb(b << io->regshift, (io->addr)+(offset * io->regspacing)); | 1293 | writeb(b << io->regshift, (io->addr)+(offset * io->regspacing)); |
1294 | } | 1294 | } |
1295 | 1295 | ||
1296 | static unsigned char mem_inl(struct si_sm_io *io, unsigned int offset) | 1296 | static unsigned char intf_mem_inl(struct si_sm_io *io, unsigned int offset) |
1297 | { | 1297 | { |
1298 | return (readl((io->addr)+(offset * io->regspacing)) >> io->regshift) | 1298 | return (readl((io->addr)+(offset * io->regspacing)) >> io->regshift) |
1299 | && 0xff; | 1299 | && 0xff; |
1300 | } | 1300 | } |
1301 | 1301 | ||
1302 | static void mem_outl(struct si_sm_io *io, unsigned int offset, | 1302 | static void intf_mem_outl(struct si_sm_io *io, unsigned int offset, |
1303 | unsigned char b) | 1303 | unsigned char b) |
1304 | { | 1304 | { |
1305 | writel(b << io->regshift, (io->addr)+(offset * io->regspacing)); | 1305 | writel(b << io->regshift, (io->addr)+(offset * io->regspacing)); |
@@ -1349,16 +1349,16 @@ static int mem_setup(struct smi_info *info) | |||
1349 | upon the register size. */ | 1349 | upon the register size. */ |
1350 | switch (info->io.regsize) { | 1350 | switch (info->io.regsize) { |
1351 | case 1: | 1351 | case 1: |
1352 | info->io.inputb = mem_inb; | 1352 | info->io.inputb = intf_mem_inb; |
1353 | info->io.outputb = mem_outb; | 1353 | info->io.outputb = intf_mem_outb; |
1354 | break; | 1354 | break; |
1355 | case 2: | 1355 | case 2: |
1356 | info->io.inputb = mem_inw; | 1356 | info->io.inputb = intf_mem_inw; |
1357 | info->io.outputb = mem_outw; | 1357 | info->io.outputb = intf_mem_outw; |
1358 | break; | 1358 | break; |
1359 | case 4: | 1359 | case 4: |
1360 | info->io.inputb = mem_inl; | 1360 | info->io.inputb = intf_mem_inl; |
1361 | info->io.outputb = mem_outl; | 1361 | info->io.outputb = intf_mem_outl; |
1362 | break; | 1362 | break; |
1363 | #ifdef readq | 1363 | #ifdef readq |
1364 | case 8: | 1364 | case 8: |
@@ -1580,11 +1580,6 @@ static int try_init_acpi(int intf_num, struct smi_info **new_info) | |||
1580 | if (! is_new_interface(-1, addr_space, spmi->addr.address)) | 1580 | if (! is_new_interface(-1, addr_space, spmi->addr.address)) |
1581 | return -ENODEV; | 1581 | return -ENODEV; |
1582 | 1582 | ||
1583 | if (! spmi->addr.register_bit_width) { | ||
1584 | acpi_failure = 1; | ||
1585 | return -ENODEV; | ||
1586 | } | ||
1587 | |||
1588 | /* Figure out the interface type. */ | 1583 | /* Figure out the interface type. */ |
1589 | switch (spmi->InterfaceType) | 1584 | switch (spmi->InterfaceType) |
1590 | { | 1585 | { |
@@ -1634,9 +1629,6 @@ static int try_init_acpi(int intf_num, struct smi_info **new_info) | |||
1634 | regspacings[intf_num] = spmi->addr.register_bit_width / 8; | 1629 | regspacings[intf_num] = spmi->addr.register_bit_width / 8; |
1635 | info->io.regspacing = spmi->addr.register_bit_width / 8; | 1630 | info->io.regspacing = spmi->addr.register_bit_width / 8; |
1636 | } else { | 1631 | } else { |
1637 | /* Some broken systems get this wrong and set the value | ||
1638 | * to zero. Assume it is the default spacing. If that | ||
1639 | * is wrong, too bad, the vendor should fix the tables. */ | ||
1640 | regspacings[intf_num] = DEFAULT_REGSPACING; | 1632 | regspacings[intf_num] = DEFAULT_REGSPACING; |
1641 | info->io.regspacing = DEFAULT_REGSPACING; | 1633 | info->io.regspacing = DEFAULT_REGSPACING; |
1642 | } | 1634 | } |
diff --git a/drivers/char/mmtimer.c b/drivers/char/mmtimer.c index c92378121b4c..1b05fa688996 100644 --- a/drivers/char/mmtimer.c +++ b/drivers/char/mmtimer.c | |||
@@ -675,7 +675,7 @@ static int __init mmtimer_init(void) | |||
675 | cnodeid_t node, maxn = -1; | 675 | cnodeid_t node, maxn = -1; |
676 | 676 | ||
677 | if (!ia64_platform_is("sn2")) | 677 | if (!ia64_platform_is("sn2")) |
678 | return -1; | 678 | return 0; |
679 | 679 | ||
680 | /* | 680 | /* |
681 | * Sanity check the cycles/sec variable | 681 | * Sanity check the cycles/sec variable |
diff --git a/drivers/char/pcmcia/cm4000_cs.c b/drivers/char/pcmcia/cm4000_cs.c index 649677b5dc36..5fdf18515433 100644 --- a/drivers/char/pcmcia/cm4000_cs.c +++ b/drivers/char/pcmcia/cm4000_cs.c | |||
@@ -13,11 +13,12 @@ | |||
13 | * | 13 | * |
14 | * (C) 2000,2001,2002,2003,2004 Omnikey AG | 14 | * (C) 2000,2001,2002,2003,2004 Omnikey AG |
15 | * | 15 | * |
16 | * (C) 2005 Harald Welte <laforge@gnumonks.org> | 16 | * (C) 2005-2006 Harald Welte <laforge@gnumonks.org> |
17 | * - Adhere to Kernel CodingStyle | 17 | * - Adhere to Kernel CodingStyle |
18 | * - Port to 2.6.13 "new" style PCMCIA | 18 | * - Port to 2.6.13 "new" style PCMCIA |
19 | * - Check for copy_{from,to}_user return values | 19 | * - Check for copy_{from,to}_user return values |
20 | * - Use nonseekable_open() | 20 | * - Use nonseekable_open() |
21 | * - add class interface for udev device creation | ||
21 | * | 22 | * |
22 | * All rights reserved. Licensed under dual BSD/GPL license. | 23 | * All rights reserved. Licensed under dual BSD/GPL license. |
23 | */ | 24 | */ |
@@ -56,7 +57,7 @@ module_param(pc_debug, int, 0600); | |||
56 | #else | 57 | #else |
57 | #define DEBUGP(n, rdr, x, args...) | 58 | #define DEBUGP(n, rdr, x, args...) |
58 | #endif | 59 | #endif |
59 | static char *version = "cm4000_cs.c v2.4.0gm5 - All bugs added by Harald Welte"; | 60 | static char *version = "cm4000_cs.c v2.4.0gm6 - All bugs added by Harald Welte"; |
60 | 61 | ||
61 | #define T_1SEC (HZ) | 62 | #define T_1SEC (HZ) |
62 | #define T_10MSEC msecs_to_jiffies(10) | 63 | #define T_10MSEC msecs_to_jiffies(10) |
@@ -156,6 +157,7 @@ struct cm4000_dev { | |||
156 | /*queue*/ 4*sizeof(wait_queue_head_t)) | 157 | /*queue*/ 4*sizeof(wait_queue_head_t)) |
157 | 158 | ||
158 | static dev_link_t *dev_table[CM4000_MAX_DEV]; | 159 | static dev_link_t *dev_table[CM4000_MAX_DEV]; |
160 | static struct class *cmm_class; | ||
159 | 161 | ||
160 | /* This table doesn't use spaces after the comma between fields and thus | 162 | /* This table doesn't use spaces after the comma between fields and thus |
161 | * violates CodingStyle. However, I don't really think wrapping it around will | 163 | * violates CodingStyle. However, I don't really think wrapping it around will |
@@ -1937,6 +1939,9 @@ static int cm4000_attach(struct pcmcia_device *p_dev) | |||
1937 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | 1939 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; |
1938 | cm4000_config(link, i); | 1940 | cm4000_config(link, i); |
1939 | 1941 | ||
1942 | class_device_create(cmm_class, NULL, MKDEV(major, i), NULL, | ||
1943 | "cmm%d", i); | ||
1944 | |||
1940 | return 0; | 1945 | return 0; |
1941 | } | 1946 | } |
1942 | 1947 | ||
@@ -1962,6 +1967,8 @@ static void cm4000_detach(struct pcmcia_device *p_dev) | |||
1962 | dev_table[devno] = NULL; | 1967 | dev_table[devno] = NULL; |
1963 | kfree(dev); | 1968 | kfree(dev); |
1964 | 1969 | ||
1970 | class_device_destroy(cmm_class, MKDEV(major, devno)); | ||
1971 | |||
1965 | return; | 1972 | return; |
1966 | } | 1973 | } |
1967 | 1974 | ||
@@ -1995,8 +2002,18 @@ static struct pcmcia_driver cm4000_driver = { | |||
1995 | 2002 | ||
1996 | static int __init cmm_init(void) | 2003 | static int __init cmm_init(void) |
1997 | { | 2004 | { |
2005 | int rc; | ||
2006 | |||
1998 | printk(KERN_INFO "%s\n", version); | 2007 | printk(KERN_INFO "%s\n", version); |
1999 | pcmcia_register_driver(&cm4000_driver); | 2008 | |
2009 | cmm_class = class_create(THIS_MODULE, "cardman_4000"); | ||
2010 | if (!cmm_class) | ||
2011 | return -1; | ||
2012 | |||
2013 | rc = pcmcia_register_driver(&cm4000_driver); | ||
2014 | if (rc < 0) | ||
2015 | return rc; | ||
2016 | |||
2000 | major = register_chrdev(0, DEVICE_NAME, &cm4000_fops); | 2017 | major = register_chrdev(0, DEVICE_NAME, &cm4000_fops); |
2001 | if (major < 0) { | 2018 | if (major < 0) { |
2002 | printk(KERN_WARNING MODULE_NAME | 2019 | printk(KERN_WARNING MODULE_NAME |
@@ -2012,6 +2029,7 @@ static void __exit cmm_exit(void) | |||
2012 | printk(KERN_INFO MODULE_NAME ": unloading\n"); | 2029 | printk(KERN_INFO MODULE_NAME ": unloading\n"); |
2013 | pcmcia_unregister_driver(&cm4000_driver); | 2030 | pcmcia_unregister_driver(&cm4000_driver); |
2014 | unregister_chrdev(major, DEVICE_NAME); | 2031 | unregister_chrdev(major, DEVICE_NAME); |
2032 | class_destroy(cmm_class); | ||
2015 | }; | 2033 | }; |
2016 | 2034 | ||
2017 | module_init(cmm_init); | 2035 | module_init(cmm_init); |
diff --git a/drivers/char/pcmcia/cm4040_cs.c b/drivers/char/pcmcia/cm4040_cs.c index 46eb371bf17e..466e33bab029 100644 --- a/drivers/char/pcmcia/cm4040_cs.c +++ b/drivers/char/pcmcia/cm4040_cs.c | |||
@@ -3,12 +3,13 @@ | |||
3 | * | 3 | * |
4 | * (c) 2000-2004 Omnikey AG (http://www.omnikey.com/) | 4 | * (c) 2000-2004 Omnikey AG (http://www.omnikey.com/) |
5 | * | 5 | * |
6 | * (C) 2005 Harald Welte <laforge@gnumonks.org> | 6 | * (C) 2005-2006 Harald Welte <laforge@gnumonks.org> |
7 | * - add support for poll() | 7 | * - add support for poll() |
8 | * - driver cleanup | 8 | * - driver cleanup |
9 | * - add waitqueues | 9 | * - add waitqueues |
10 | * - adhere to linux kernel coding style and policies | 10 | * - adhere to linux kernel coding style and policies |
11 | * - support 2.6.13 "new style" pcmcia interface | 11 | * - support 2.6.13 "new style" pcmcia interface |
12 | * - add class interface for udev device creation | ||
12 | * | 13 | * |
13 | * The device basically is a USB CCID compliant device that has been | 14 | * The device basically is a USB CCID compliant device that has been |
14 | * attached to an I/O-Mapped FIFO. | 15 | * attached to an I/O-Mapped FIFO. |
@@ -53,7 +54,7 @@ module_param(pc_debug, int, 0600); | |||
53 | #endif | 54 | #endif |
54 | 55 | ||
55 | static char *version = | 56 | static char *version = |
56 | "OMNIKEY CardMan 4040 v1.1.0gm4 - All bugs added by Harald Welte"; | 57 | "OMNIKEY CardMan 4040 v1.1.0gm5 - All bugs added by Harald Welte"; |
57 | 58 | ||
58 | #define CCID_DRIVER_BULK_DEFAULT_TIMEOUT (150*HZ) | 59 | #define CCID_DRIVER_BULK_DEFAULT_TIMEOUT (150*HZ) |
59 | #define CCID_DRIVER_ASYNC_POWERUP_TIMEOUT (35*HZ) | 60 | #define CCID_DRIVER_ASYNC_POWERUP_TIMEOUT (35*HZ) |
@@ -67,6 +68,7 @@ static char *version = | |||
67 | static void reader_release(dev_link_t *link); | 68 | static void reader_release(dev_link_t *link); |
68 | 69 | ||
69 | static int major; | 70 | static int major; |
71 | static struct class *cmx_class; | ||
70 | 72 | ||
71 | #define BS_READABLE 0x01 | 73 | #define BS_READABLE 0x01 |
72 | #define BS_WRITABLE 0x02 | 74 | #define BS_WRITABLE 0x02 |
@@ -696,6 +698,9 @@ static int reader_attach(struct pcmcia_device *p_dev) | |||
696 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | 698 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; |
697 | reader_config(link, i); | 699 | reader_config(link, i); |
698 | 700 | ||
701 | class_device_create(cmx_class, NULL, MKDEV(major, i), NULL, | ||
702 | "cmx%d", i); | ||
703 | |||
699 | return 0; | 704 | return 0; |
700 | } | 705 | } |
701 | 706 | ||
@@ -721,6 +726,8 @@ static void reader_detach(struct pcmcia_device *p_dev) | |||
721 | dev_table[devno] = NULL; | 726 | dev_table[devno] = NULL; |
722 | kfree(dev); | 727 | kfree(dev); |
723 | 728 | ||
729 | class_device_destroy(cmx_class, MKDEV(major, devno)); | ||
730 | |||
724 | return; | 731 | return; |
725 | } | 732 | } |
726 | 733 | ||
@@ -755,8 +762,17 @@ static struct pcmcia_driver reader_driver = { | |||
755 | 762 | ||
756 | static int __init cm4040_init(void) | 763 | static int __init cm4040_init(void) |
757 | { | 764 | { |
765 | int rc; | ||
766 | |||
758 | printk(KERN_INFO "%s\n", version); | 767 | printk(KERN_INFO "%s\n", version); |
759 | pcmcia_register_driver(&reader_driver); | 768 | cmx_class = class_create(THIS_MODULE, "cardman_4040"); |
769 | if (!cmx_class) | ||
770 | return -1; | ||
771 | |||
772 | rc = pcmcia_register_driver(&reader_driver); | ||
773 | if (rc < 0) | ||
774 | return rc; | ||
775 | |||
760 | major = register_chrdev(0, DEVICE_NAME, &reader_fops); | 776 | major = register_chrdev(0, DEVICE_NAME, &reader_fops); |
761 | if (major < 0) { | 777 | if (major < 0) { |
762 | printk(KERN_WARNING MODULE_NAME | 778 | printk(KERN_WARNING MODULE_NAME |
@@ -771,6 +787,7 @@ static void __exit cm4040_exit(void) | |||
771 | printk(KERN_INFO MODULE_NAME ": unloading\n"); | 787 | printk(KERN_INFO MODULE_NAME ": unloading\n"); |
772 | pcmcia_unregister_driver(&reader_driver); | 788 | pcmcia_unregister_driver(&reader_driver); |
773 | unregister_chrdev(major, DEVICE_NAME); | 789 | unregister_chrdev(major, DEVICE_NAME); |
790 | class_destroy(cmx_class); | ||
774 | } | 791 | } |
775 | 792 | ||
776 | module_init(cm4040_init); | 793 | module_init(cm4040_init); |
diff --git a/drivers/char/rio/cirrus.h b/drivers/char/rio/cirrus.h index 217ff09f2fa1..89bd94eb45be 100644 --- a/drivers/char/rio/cirrus.h +++ b/drivers/char/rio/cirrus.h | |||
@@ -40,148 +40,6 @@ | |||
40 | #endif | 40 | #endif |
41 | #define _cirrus_h 1 | 41 | #define _cirrus_h 1 |
42 | 42 | ||
43 | #ifdef RTA | ||
44 | #define TO_UART RX | ||
45 | #define TO_DRIVER TX | ||
46 | #endif | ||
47 | |||
48 | #ifdef HOST | ||
49 | #define TO_UART TX | ||
50 | #define TO_DRIVER RX | ||
51 | #endif | ||
52 | #ifdef RTA | ||
53 | /* Miscellaneous defines for CIRRUS addresses and related logic for | ||
54 | interrupts etc. | ||
55 | */ | ||
56 | #define MAP(a) ((short *)(cirrus_base + (a))) | ||
57 | #define outp(a,b) (*MAP (a) =(b)) | ||
58 | #define inp(a) ((*MAP (a)) & 0xff) | ||
59 | #define CIRRUS_FIRST (short*)0x7300 | ||
60 | #define CIRRUS_SECOND (short*)0x7200 | ||
61 | #define CIRRUS_THIRD (short*)0x7100 | ||
62 | #define CIRRUS_FOURTH (short*)0x7000 | ||
63 | #define PORTS_ON_CIRRUS 4 | ||
64 | #define CIRRUS_FIFO_SIZE 12 | ||
65 | #define SPACE 0x20 | ||
66 | #define TAB 0x09 | ||
67 | #define LINE_FEED 0x0a | ||
68 | #define CARRIAGE_RETURN 0x0d | ||
69 | #define BACKSPACE 0x08 | ||
70 | #define SPACES_IN_TABS 8 | ||
71 | #define SEND_ESCAPE 0x00 | ||
72 | #define START_BREAK 0x81 | ||
73 | #define TIMER_TICK 0x82 | ||
74 | #define STOP_BREAK 0x83 | ||
75 | #define BASE(a) ((a) < 4 ? (short*)CIRRUS_FIRST : ((a) < 8 ? (short *)CIRRUS_SECOND : ((a) < 12 ? (short*)CIRRUS_THIRD : (short *)CIRRUS_FOURTH))) | ||
76 | #define txack1 ((short *)0x7104) | ||
77 | #define rxack1 ((short *)0x7102) | ||
78 | #define mdack1 ((short *)0x7106) | ||
79 | #define txack2 ((short *)0x7006) | ||
80 | #define rxack2 ((short *)0x7004) | ||
81 | #define mdack2 ((short *)0x7100) | ||
82 | #define int_latch ((short *) 0x7800) | ||
83 | #define int_status ((short *) 0x7c00) | ||
84 | #define tx1_pending 0x20 | ||
85 | #define rx1_pending 0x10 | ||
86 | #define md1_pending 0x40 | ||
87 | #define tx2_pending 0x02 | ||
88 | #define rx2_pending 0x01 | ||
89 | #define md2_pending 0x40 | ||
90 | #define module1_bits 0x07 | ||
91 | #define module1_modern 0x08 | ||
92 | #define module2_bits 0x70 | ||
93 | #define module2_modern 0x80 | ||
94 | #define module_blank 0xf | ||
95 | #define rs232_d25 0x0 | ||
96 | #define rs232_rj45 0x1 | ||
97 | #define rs422_d25 0x3 | ||
98 | #define parallel 0x5 | ||
99 | |||
100 | #define CLK0 0x00 | ||
101 | #define CLK1 0x01 | ||
102 | #define CLK2 0x02 | ||
103 | #define CLK3 0x03 | ||
104 | #define CLK4 0x04 | ||
105 | |||
106 | #define CIRRUS_REVC 0x42 | ||
107 | #define CIRRUS_REVE 0x44 | ||
108 | |||
109 | #define TURNON 1 | ||
110 | #define TURNOFF 0 | ||
111 | |||
112 | /* The list of CIRRUS registers. | ||
113 | NB. These registers are relative values on 8 bit boundaries whereas | ||
114 | on the RTA's the CIRRUS registers are on word boundaries. Use pointer | ||
115 | arithmetic (short *) to obtain the real addresses required */ | ||
116 | #define ccr 0x05 /* Channel Command Register */ | ||
117 | #define ier 0x06 /* Interrupt Enable Register */ | ||
118 | #define cor1 0x08 /* Channel Option Register 1 */ | ||
119 | #define cor2 0x09 /* Channel Option Register 2 */ | ||
120 | #define cor3 0x0a /* Channel Option Register 3 */ | ||
121 | #define cor4 0x1e /* Channel Option Register 4 */ | ||
122 | #define cor5 0x1f /* Channel Option Register 5 */ | ||
123 | |||
124 | #define ccsr 0x0b /* Channel Control Status Register */ | ||
125 | #define rdcr 0x0e /* Receive Data Count Register */ | ||
126 | #define tdcr 0x12 /* Transmit Data Count Register */ | ||
127 | #define mcor1 0x15 /* Modem Change Option Register 1 */ | ||
128 | #define mcor2 0x16 /* Modem Change Option Regsiter 2 */ | ||
129 | |||
130 | #define livr 0x18 /* Local Interrupt Vector Register */ | ||
131 | #define schr1 0x1a /* Special Character Register 1 */ | ||
132 | #define schr2 0x1b /* Special Character Register 2 */ | ||
133 | #define schr3 0x1c /* Special Character Register 3 */ | ||
134 | #define schr4 0x1d /* Special Character Register 4 */ | ||
135 | |||
136 | #define rtr 0x20 /* Receive Timer Register */ | ||
137 | #define rtpr 0x21 /* Receive Timeout Period Register */ | ||
138 | #define lnc 0x24 /* Lnext character */ | ||
139 | |||
140 | #define rivr 0x43 /* Receive Interrupt Vector Register */ | ||
141 | #define tivr 0x42 /* Transmit Interrupt Vector Register */ | ||
142 | #define mivr 0x41 /* Modem Interrupt Vector Register */ | ||
143 | #define gfrcr 0x40 /* Global Firmware Revision code Reg */ | ||
144 | #define ricr 0x44 /* Receive Interrupting Channel Reg */ | ||
145 | #define ticr 0x45 /* Transmit Interrupting Channel Reg */ | ||
146 | #define micr 0x46 /* Modem Interrupting Channel Register */ | ||
147 | |||
148 | #define gcr 0x4b /* Global configuration register */ | ||
149 | #define misr 0x4c /* Modem interrupt status register */ | ||
150 | |||
151 | #define rbusr 0x59 | ||
152 | #define tbusr 0x5a | ||
153 | #define mbusr 0x5b | ||
154 | |||
155 | #define eoir 0x60 /* End Of Interrupt Register */ | ||
156 | #define rdsr 0x62 /* Receive Data / Status Register */ | ||
157 | #define tdr 0x63 /* Transmit Data Register */ | ||
158 | #define svrr 0x67 /* Service Request Register */ | ||
159 | |||
160 | #define car 0x68 /* Channel Access Register */ | ||
161 | #define mir 0x69 /* Modem Interrupt Register */ | ||
162 | #define tir 0x6a /* Transmit Interrupt Register */ | ||
163 | #define rir 0x6b /* Receive Interrupt Register */ | ||
164 | #define msvr1 0x6c /* Modem Signal Value Register 1 */ | ||
165 | #define msvr2 0x6d /* Modem Signal Value Register 2 */ | ||
166 | #define psvr 0x6f /* Printer Signal Value Register */ | ||
167 | |||
168 | #define tbpr 0x72 /* Transmit Baud Rate Period Register */ | ||
169 | #define tcor 0x76 /* Transmit Clock Option Register */ | ||
170 | |||
171 | #define rbpr 0x78 /* Receive Baud Rate Period Register */ | ||
172 | #define rber 0x7a /* Receive Baud Rate Extension Register */ | ||
173 | #define rcor 0x7c /* Receive Clock Option Register */ | ||
174 | #define ppr 0x7e /* Prescalar Period Register */ | ||
175 | |||
176 | /* Misc registers used for forcing the 1400 out of its reset woes */ | ||
177 | #define airl 0x6d | ||
178 | #define airm 0x6e | ||
179 | #define airh 0x6f | ||
180 | #define btcr 0x66 | ||
181 | #define mtcr 0x6c | ||
182 | #define tber 0x74 | ||
183 | |||
184 | #endif /* #ifdef RTA */ | ||
185 | 43 | ||
186 | 44 | ||
187 | /* Bit fields for particular registers */ | 45 | /* Bit fields for particular registers */ |
diff --git a/drivers/char/rio/defaults.h b/drivers/char/rio/defaults.h index 5b600c32ac02..d55c2f6a9877 100644 --- a/drivers/char/rio/defaults.h +++ b/drivers/char/rio/defaults.h | |||
@@ -45,13 +45,6 @@ static char *_rio_defaults_h_sccs = "@(#)defaults.h 1.1"; | |||
45 | #define MILLISECOND (int) (1000/64) /* 15.625 low ticks */ | 45 | #define MILLISECOND (int) (1000/64) /* 15.625 low ticks */ |
46 | #define SECOND (int) 15625 /* Low priority ticks */ | 46 | #define SECOND (int) 15625 /* Low priority ticks */ |
47 | 47 | ||
48 | #ifdef RTA | ||
49 | #define RX_LIMIT (ushort) 3 | ||
50 | #endif | ||
51 | #ifdef HOST | ||
52 | #define RX_LIMIT (ushort) 1 | ||
53 | #endif | ||
54 | |||
55 | #define LINK_TIMEOUT (int) (POLL_PERIOD / 2) | 48 | #define LINK_TIMEOUT (int) (POLL_PERIOD / 2) |
56 | 49 | ||
57 | 50 | ||
diff --git a/drivers/char/rio/link.h b/drivers/char/rio/link.h index bfba5b0c033e..48d68ca7f825 100644 --- a/drivers/char/rio/link.h +++ b/drivers/char/rio/link.h | |||
@@ -102,30 +102,14 @@ | |||
102 | /* | 102 | /* |
103 | ** LED stuff | 103 | ** LED stuff |
104 | */ | 104 | */ |
105 | #if defined(RTA) | ||
106 | #define LED_OFF ((ushort) 0) /* LED off */ | ||
107 | #define LED_RED ((ushort) 1) /* LED Red */ | ||
108 | #define LED_GREEN ((ushort) 2) /* LED Green */ | ||
109 | #define LED_ORANGE ((ushort) 4) /* LED Orange */ | ||
110 | #define LED_1TO8_OPEN ((ushort) 1) /* Port 1->8 LED on */ | ||
111 | #define LED_9TO16_OPEN ((ushort) 2) /* Port 9->16 LED on */ | ||
112 | #define LED_SET_COLOUR(colour) (link->led = (colour)) | ||
113 | #define LED_OR_COLOUR(colour) (link->led |= (colour)) | ||
114 | #define LED_TIMEOUT(time) (link->led_timeout = RioTimePlus(RioTime(),(time))) | ||
115 | #else | ||
116 | #define LED_SET_COLOUR(colour) | 105 | #define LED_SET_COLOUR(colour) |
117 | #define LED_OR_COLOUR(colour) | 106 | #define LED_OR_COLOUR(colour) |
118 | #define LED_TIMEOUT(time) | 107 | #define LED_TIMEOUT(time) |
119 | #endif /* RTA */ | ||
120 | 108 | ||
121 | struct LPB { | 109 | struct LPB { |
122 | WORD link_number; /* Link Number */ | 110 | WORD link_number; /* Link Number */ |
123 | Channel_ptr in_ch; /* Link In Channel */ | 111 | Channel_ptr in_ch; /* Link In Channel */ |
124 | Channel_ptr out_ch; /* Link Out Channel */ | 112 | Channel_ptr out_ch; /* Link Out Channel */ |
125 | #ifdef RTA | ||
126 | uchar stat_led; /* Port open leds */ | ||
127 | uchar led; /* True, light led! */ | ||
128 | #endif | ||
129 | BYTE attached_serial[4]; /* Attached serial number */ | 113 | BYTE attached_serial[4]; /* Attached serial number */ |
130 | BYTE attached_host_serial[4]; | 114 | BYTE attached_host_serial[4]; |
131 | /* Serial number of Host who | 115 | /* Serial number of Host who |
@@ -144,30 +128,12 @@ struct LPB { | |||
144 | WORD WaitNoBoot; /* Secs to hold off booting */ | 128 | WORD WaitNoBoot; /* Secs to hold off booting */ |
145 | PKT_ptr add_packet_list; /* Add packets to here */ | 129 | PKT_ptr add_packet_list; /* Add packets to here */ |
146 | PKT_ptr remove_packet_list; /* Send packets from here */ | 130 | PKT_ptr remove_packet_list; /* Send packets from here */ |
147 | #ifdef RTA | ||
148 | #ifdef DCIRRUS | ||
149 | #define QBUFS_PER_REDIRECT (4 / PKTS_PER_BUFFER + 1) | ||
150 | #else | ||
151 | #define QBUFS_PER_REDIRECT (8 / PKTS_PER_BUFFER + 1) | ||
152 | #endif | ||
153 | PKT_ptr_ptr rd_add; /* Add a new Packet here */ | ||
154 | Q_BUF_ptr rd_add_qb; /* Pointer to the add Q buf */ | ||
155 | PKT_ptr_ptr rd_add_st_qbb; /* Pointer to start of the Q's buf */ | ||
156 | PKT_ptr_ptr rd_add_end_qbb; /* Pointer to the end of the Q's buf */ | ||
157 | PKT_ptr_ptr rd_remove; /* Remove a Packet here */ | ||
158 | Q_BUF_ptr rd_remove_qb; /* Pointer to the remove Q buf */ | ||
159 | PKT_ptr_ptr rd_remove_st_qbb; /* Pointer to the start of the Q buf */ | ||
160 | PKT_ptr_ptr rd_remove_end_qbb; /* Pointer to the end of the Q buf */ | ||
161 | ushort pkts_in_q; /* Packets in queue */ | ||
162 | #endif | ||
163 | 131 | ||
164 | Channel_ptr lrt_fail_chan; /* Lrt's failure channel */ | 132 | Channel_ptr lrt_fail_chan; /* Lrt's failure channel */ |
165 | Channel_ptr ltt_fail_chan; /* Ltt's failure channel */ | 133 | Channel_ptr ltt_fail_chan; /* Ltt's failure channel */ |
166 | 134 | ||
167 | #if defined (HOST) || defined (INKERNEL) | ||
168 | /* RUP structure for HOST to driver communications */ | 135 | /* RUP structure for HOST to driver communications */ |
169 | struct RUP rup; | 136 | struct RUP rup; |
170 | #endif | ||
171 | struct RUP link_rup; /* RUP for the link (POLL, | 137 | struct RUP link_rup; /* RUP for the link (POLL, |
172 | topology etc.) */ | 138 | topology etc.) */ |
173 | WORD attached_link; /* Number of attached link */ | 139 | WORD attached_link; /* Number of attached link */ |
diff --git a/drivers/char/rio/list.h b/drivers/char/rio/list.h index 36aad4c9cb3a..79b853140ae5 100644 --- a/drivers/char/rio/list.h +++ b/drivers/char/rio/list.h | |||
@@ -44,8 +44,6 @@ static char *_rio_list_h_sccs = "@(#)list.h 1.9"; | |||
44 | 44 | ||
45 | #define PKT_IN_USE 0x1 | 45 | #define PKT_IN_USE 0x1 |
46 | 46 | ||
47 | #ifdef INKERNEL | ||
48 | |||
49 | #define ZERO_PTR (ushort) 0x8000 | 47 | #define ZERO_PTR (ushort) 0x8000 |
50 | #define CaD PortP->Caddr | 48 | #define CaD PortP->Caddr |
51 | 49 | ||
@@ -54,143 +52,5 @@ static char *_rio_list_h_sccs = "@(#)list.h 1.9"; | |||
54 | ** to by the TxAdd pointer has PKT_IN_USE clear in its address. | 52 | ** to by the TxAdd pointer has PKT_IN_USE clear in its address. |
55 | */ | 53 | */ |
56 | 54 | ||
57 | #ifndef linux | ||
58 | #if defined( MIPS ) && !defined( MIPSEISA ) | ||
59 | /* May the shoes of the Devil dance on your grave for creating this */ | ||
60 | #define can_add_transmit(PacketP,PortP) \ | ||
61 | (!((uint)(PacketP = (struct PKT *)RIO_PTR(CaD,RINDW(PortP->TxAdd))) \ | ||
62 | & (PKT_IN_USE<<2))) | ||
63 | |||
64 | #elif defined(MIPSEISA) || defined(nx6000) || \ | ||
65 | defined(drs6000) || defined(UWsparc) | ||
66 | |||
67 | #define can_add_transmit(PacketP,PortP) \ | ||
68 | (!((uint)(PacketP = (struct PKT *)RIO_PTR(CaD,RINDW(PortP->TxAdd))) \ | ||
69 | & PKT_IN_USE)) | ||
70 | |||
71 | #else | ||
72 | #define can_add_transmit(PacketP,PortP) \ | ||
73 | (!((uint)(PacketP = (struct PKT *)RIO_PTR(CaD,*PortP->TxAdd)) \ | ||
74 | & PKT_IN_USE)) | ||
75 | #endif | ||
76 | |||
77 | /* | ||
78 | ** To add a packet to the queue, you set the PKT_IN_USE bit in the address, | ||
79 | ** and then move the TxAdd pointer along one position to point to the next | ||
80 | ** packet pointer. You must wrap the pointer from the end back to the start. | ||
81 | */ | ||
82 | #if defined(MIPS) || defined(nx6000) || defined(drs6000) || defined(UWsparc) | ||
83 | # define add_transmit(PortP) \ | ||
84 | WINDW(PortP->TxAdd,RINDW(PortP->TxAdd) | PKT_IN_USE);\ | ||
85 | if (PortP->TxAdd == PortP->TxEnd)\ | ||
86 | PortP->TxAdd = PortP->TxStart;\ | ||
87 | else\ | ||
88 | PortP->TxAdd++;\ | ||
89 | WWORD(PortP->PhbP->tx_add , RIO_OFF(CaD,PortP->TxAdd)); | ||
90 | #elif defined(AIX) | ||
91 | # define add_transmit(PortP) \ | ||
92 | {\ | ||
93 | register ushort *TxAddP = (ushort *)RIO_PTR(Cad,PortP->TxAddO);\ | ||
94 | WINDW( TxAddP, RINDW( TxAddP ) | PKT_IN_USE );\ | ||
95 | if (PortP->TxAddO == PortP->TxEndO )\ | ||
96 | PortP->TxAddO = PortP->TxStartO;\ | ||
97 | else\ | ||
98 | PortP->TxAddO += sizeof(ushort);\ | ||
99 | WWORD(((PHB *)RIO_PTR(Cad,PortP->PhbO))->tx_add , PortP->TxAddO );\ | ||
100 | } | ||
101 | #else | ||
102 | # define add_transmit(PortP) \ | ||
103 | *PortP->TxAdd |= PKT_IN_USE;\ | ||
104 | if (PortP->TxAdd == PortP->TxEnd)\ | ||
105 | PortP->TxAdd = PortP->TxStart;\ | ||
106 | else\ | ||
107 | PortP->TxAdd++;\ | ||
108 | PortP->PhbP->tx_add = RIO_OFF(CaD,PortP->TxAdd); | ||
109 | #endif | ||
110 | |||
111 | /* | ||
112 | ** can_remove_receive( PacketP, PortP ) returns non-zero if PKT_IN_USE is set | ||
113 | ** for the next packet on the queue. It will also set PacketP to point to the | ||
114 | ** relevant packet, [having cleared the PKT_IN_USE bit]. If PKT_IN_USE is clear, | ||
115 | ** then can_remove_receive() returns 0. | ||
116 | */ | ||
117 | #if defined(MIPS) || defined(nx6000) || defined(drs6000) || defined(UWsparc) | ||
118 | # define can_remove_receive(PacketP,PortP) \ | ||
119 | ((RINDW(PortP->RxRemove) & PKT_IN_USE) ? \ | ||
120 | (PacketP=(struct PKT *)RIO_PTR(CaD,(RINDW(PortP->RxRemove) & ~PKT_IN_USE))):0) | ||
121 | #elif defined(AIX) | ||
122 | # define can_remove_receive(PacketP,PortP) \ | ||
123 | ((RINDW((ushort *)RIO_PTR(Cad,PortP->RxRemoveO)) & PKT_IN_USE) ? \ | ||
124 | (PacketP=(struct PKT *)RIO_PTR(Cad,RINDW((ushort *)RIO_PTR(Cad,PortP->RxRemoveO)) & ~PKT_IN_USE)):0) | ||
125 | #else | ||
126 | # define can_remove_receive(PacketP,PortP) \ | ||
127 | ((*PortP->RxRemove & PKT_IN_USE) ? \ | ||
128 | (PacketP=(struct PKT *)RIO_PTR(CaD,(*PortP->RxRemove & ~PKT_IN_USE))):0) | ||
129 | #endif | ||
130 | |||
131 | |||
132 | /* | ||
133 | ** Will God see it within his heart to forgive us for this thing that | ||
134 | ** we have created? To remove a packet from the receive queue you clear | ||
135 | ** its PKT_IN_USE bit, and then bump the pointers. Once the pointers | ||
136 | ** get to the end, they must be wrapped back to the start. | ||
137 | */ | ||
138 | #if defined(MIPS) || defined(nx6000) || defined(drs6000) || defined(UWsparc) | ||
139 | # define remove_receive(PortP) \ | ||
140 | WINDW(PortP->RxRemove, (RINDW(PortP->RxRemove) & ~PKT_IN_USE));\ | ||
141 | if (PortP->RxRemove == PortP->RxEnd)\ | ||
142 | PortP->RxRemove = PortP->RxStart;\ | ||
143 | else\ | ||
144 | PortP->RxRemove++;\ | ||
145 | WWORD(PortP->PhbP->rx_remove , RIO_OFF(CaD,PortP->RxRemove)); | ||
146 | #elif defined(AIX) | ||
147 | # define remove_receive(PortP) \ | ||
148 | {\ | ||
149 | register ushort *RxRemoveP = (ushort *)RIO_PTR(Cad,PortP->RxRemoveO);\ | ||
150 | WINDW( RxRemoveP, RINDW( RxRemoveP ) & ~PKT_IN_USE );\ | ||
151 | if (PortP->RxRemoveO == PortP->RxEndO)\ | ||
152 | PortP->RxRemoveO = PortP->RxStartO;\ | ||
153 | else\ | ||
154 | PortP->RxRemoveO += sizeof(ushort);\ | ||
155 | WWORD(((PHB *)RIO_PTR(Cad,PortP->PhbO))->rx_remove, PortP->RxRemoveO );\ | ||
156 | } | ||
157 | #else | ||
158 | # define remove_receive(PortP) \ | ||
159 | *PortP->RxRemove &= ~PKT_IN_USE;\ | ||
160 | if (PortP->RxRemove == PortP->RxEnd)\ | ||
161 | PortP->RxRemove = PortP->RxStart;\ | ||
162 | else\ | ||
163 | PortP->RxRemove++;\ | ||
164 | PortP->PhbP->rx_remove = RIO_OFF(CaD,PortP->RxRemove); | ||
165 | #endif | ||
166 | #endif | ||
167 | |||
168 | |||
169 | #else /* !IN_KERNEL */ | ||
170 | |||
171 | #define ZERO_PTR NULL | ||
172 | |||
173 | |||
174 | #ifdef HOST | ||
175 | /* #define can_remove_transmit(pkt,phb) ((((char*)pkt = (*(char**)(phb->tx_remove))-1) || 1)) && (*phb->u3.s2.tx_remove_ptr & PKT_IN_USE)) */ | ||
176 | #define remove_transmit(phb) *phb->u3.s2.tx_remove_ptr &= ~(ushort)PKT_IN_USE;\ | ||
177 | if (phb->tx_remove == phb->tx_end)\ | ||
178 | phb->tx_remove = phb->tx_start;\ | ||
179 | else\ | ||
180 | phb->tx_remove++; | ||
181 | #define can_add_receive(phb) !(*phb->u4.s2.rx_add_ptr & PKT_IN_USE) | ||
182 | #define add_receive(pkt,phb) *phb->rx_add = pkt;\ | ||
183 | *phb->u4.s2.rx_add_ptr |= PKT_IN_USE;\ | ||
184 | if (phb->rx_add == phb->rx_end)\ | ||
185 | phb->rx_add = phb->rx_start;\ | ||
186 | else\ | ||
187 | phb->rx_add++; | ||
188 | #endif | ||
189 | #endif | ||
190 | |||
191 | #ifdef RTA | ||
192 | #define splx(oldspl) if ((oldspl) == 0) spl0() | ||
193 | #endif | ||
194 | |||
195 | #endif /* ifndef _list.h */ | 55 | #endif /* ifndef _list.h */ |
196 | /*********** end of file ***********/ | 56 | /*********** end of file ***********/ |
diff --git a/drivers/char/rio/parmmap.h b/drivers/char/rio/parmmap.h index fe4e00567065..e24acc1d1844 100644 --- a/drivers/char/rio/parmmap.h +++ b/drivers/char/rio/parmmap.h | |||
@@ -78,14 +78,9 @@ struct PARM_MAP { | |||
78 | WORD idle_count; /* Idle time counter */ | 78 | WORD idle_count; /* Idle time counter */ |
79 | WORD busy_count; /* Busy counter */ | 79 | WORD busy_count; /* Busy counter */ |
80 | WORD idle_control; /* Control Idle Process */ | 80 | WORD idle_control; /* Control Idle Process */ |
81 | #if defined(HOST) || defined(INKERNEL) | ||
82 | WORD tx_intr; /* TX interrupt pending */ | 81 | WORD tx_intr; /* TX interrupt pending */ |
83 | WORD rx_intr; /* RX interrupt pending */ | 82 | WORD rx_intr; /* RX interrupt pending */ |
84 | WORD rup_intr; /* RUP interrupt pending */ | 83 | WORD rup_intr; /* RUP interrupt pending */ |
85 | #endif | ||
86 | #if defined(RTA) | ||
87 | WORD dying_count; /* Count of processes dead */ | ||
88 | #endif | ||
89 | }; | 84 | }; |
90 | 85 | ||
91 | #endif | 86 | #endif |
diff --git a/drivers/char/rio/phb.h b/drivers/char/rio/phb.h index 3baebf8513af..2663ca0306e2 100644 --- a/drivers/char/rio/phb.h +++ b/drivers/char/rio/phb.h | |||
@@ -44,17 +44,6 @@ | |||
44 | #endif | 44 | #endif |
45 | 45 | ||
46 | 46 | ||
47 | /************************************************* | ||
48 | * Set the LIMIT values. | ||
49 | ************************************************/ | ||
50 | #ifdef RTA | ||
51 | #define RX_LIMIT (ushort) 3 | ||
52 | #endif | ||
53 | #ifdef HOST | ||
54 | #define RX_LIMIT (ushort) 1 | ||
55 | #endif | ||
56 | |||
57 | |||
58 | /************************************************* | 47 | /************************************************* |
59 | * Handshake asserted. Deasserted by the LTT(s) | 48 | * Handshake asserted. Deasserted by the LTT(s) |
60 | ************************************************/ | 49 | ************************************************/ |
@@ -69,11 +58,7 @@ | |||
69 | /************************************************* | 58 | /************************************************* |
70 | * Maximum number of PHB's | 59 | * Maximum number of PHB's |
71 | ************************************************/ | 60 | ************************************************/ |
72 | #if defined (HOST) || defined (INKERNEL) | ||
73 | #define MAX_PHB ((ushort) 128) /* range 0-127 */ | 61 | #define MAX_PHB ((ushort) 128) /* range 0-127 */ |
74 | #else | ||
75 | #define MAX_PHB ((ushort) 8) /* range 0-7 */ | ||
76 | #endif | ||
77 | 62 | ||
78 | /************************************************* | 63 | /************************************************* |
79 | * Defines for the mode fields | 64 | * Defines for the mode fields |
@@ -139,141 +124,23 @@ | |||
139 | * the start. The pointer tx_add points to a SPACE to put a Packet. | 124 | * the start. The pointer tx_add points to a SPACE to put a Packet. |
140 | * The pointer tx_remove points to the next Packet to remove | 125 | * The pointer tx_remove points to the next Packet to remove |
141 | *************************************************************************/ | 126 | *************************************************************************/ |
142 | #ifndef INKERNEL | ||
143 | #define src_unit u2.s2.unit | ||
144 | #define src_port u2.s2.port | ||
145 | #define dest_unit u1.s1.unit | ||
146 | #define dest_port u1.s1.port | ||
147 | #endif | ||
148 | #ifdef HOST | ||
149 | #define tx_start u3.s1.tx_start_ptr_ptr | ||
150 | #define tx_add u3.s1.tx_add_ptr_ptr | ||
151 | #define tx_end u3.s1.tx_end_ptr_ptr | ||
152 | #define tx_remove u3.s1.tx_remove_ptr_ptr | ||
153 | #define rx_start u4.s1.rx_start_ptr_ptr | ||
154 | #define rx_add u4.s1.rx_add_ptr_ptr | ||
155 | #define rx_end u4.s1.rx_end_ptr_ptr | ||
156 | #define rx_remove u4.s1.rx_remove_ptr_ptr | ||
157 | #endif | ||
158 | typedef struct PHB PHB; | 127 | typedef struct PHB PHB; |
159 | struct PHB { | 128 | struct PHB { |
160 | #ifdef RTA | ||
161 | ushort port; | ||
162 | #endif | ||
163 | #ifdef INKERNEL | ||
164 | WORD source; | 129 | WORD source; |
165 | #else | ||
166 | union { | ||
167 | ushort source; /* Complete source */ | ||
168 | struct { | ||
169 | unsigned char unit; /* Source unit */ | ||
170 | unsigned char port; /* Source port */ | ||
171 | } s2; | ||
172 | } u2; | ||
173 | #endif | ||
174 | WORD handshake; | 130 | WORD handshake; |
175 | WORD status; | 131 | WORD status; |
176 | NUMBER timeout; /* Maximum of 1.9 seconds */ | 132 | NUMBER timeout; /* Maximum of 1.9 seconds */ |
177 | WORD link; /* Send down this link */ | 133 | WORD link; /* Send down this link */ |
178 | #ifdef INKERNEL | ||
179 | WORD destination; | 134 | WORD destination; |
180 | #else | ||
181 | union { | ||
182 | ushort destination; /* Complete destination */ | ||
183 | struct { | ||
184 | unsigned char unit; /* Destination unit */ | ||
185 | unsigned char port; /* Destination port */ | ||
186 | } s1; | ||
187 | } u1; | ||
188 | #endif | ||
189 | #ifdef RTA | ||
190 | ushort tx_pkts_added; | ||
191 | ushort tx_pkts_removed; | ||
192 | Q_BUF_ptr tx_q_start; /* Start of the Q list chain */ | ||
193 | short num_tx_q_bufs; /* Number of Q buffers in the chain */ | ||
194 | PKT_ptr_ptr tx_add; /* Add a new Packet here */ | ||
195 | Q_BUF_ptr tx_add_qb; /* Pointer to the add Q buf */ | ||
196 | PKT_ptr_ptr tx_add_st_qbb; /* Pointer to start of the Q's buf */ | ||
197 | PKT_ptr_ptr tx_add_end_qbb; /* Pointer to the end of the Q's buf */ | ||
198 | PKT_ptr_ptr tx_remove; /* Remove a Packet here */ | ||
199 | Q_BUF_ptr tx_remove_qb; /* Pointer to the remove Q buf */ | ||
200 | PKT_ptr_ptr tx_remove_st_qbb; /* Pointer to the start of the Q buf */ | ||
201 | PKT_ptr_ptr tx_remove_end_qbb; /* Pointer to the end of the Q buf */ | ||
202 | #endif | ||
203 | #ifdef INKERNEL | ||
204 | PKT_ptr_ptr tx_start; | 135 | PKT_ptr_ptr tx_start; |
205 | PKT_ptr_ptr tx_end; | 136 | PKT_ptr_ptr tx_end; |
206 | PKT_ptr_ptr tx_add; | 137 | PKT_ptr_ptr tx_add; |
207 | PKT_ptr_ptr tx_remove; | 138 | PKT_ptr_ptr tx_remove; |
208 | #endif | ||
209 | #ifdef HOST | ||
210 | union { | ||
211 | struct { | ||
212 | PKT_ptr_ptr tx_start_ptr_ptr; | ||
213 | PKT_ptr_ptr tx_end_ptr_ptr; | ||
214 | PKT_ptr_ptr tx_add_ptr_ptr; | ||
215 | PKT_ptr_ptr tx_remove_ptr_ptr; | ||
216 | } s1; | ||
217 | struct { | ||
218 | ushort *tx_start_ptr; | ||
219 | ushort *tx_end_ptr; | ||
220 | ushort *tx_add_ptr; | ||
221 | ushort *tx_remove_ptr; | ||
222 | } s2; | ||
223 | } u3; | ||
224 | #endif | ||
225 | 139 | ||
226 | #ifdef RTA | ||
227 | ushort rx_pkts_added; | ||
228 | ushort rx_pkts_removed; | ||
229 | Q_BUF_ptr rx_q_start; /* Start of the Q list chain */ | ||
230 | short num_rx_q_bufs; /* Number of Q buffers in the chain */ | ||
231 | PKT_ptr_ptr rx_add; /* Add a new Packet here */ | ||
232 | Q_BUF_ptr rx_add_qb; /* Pointer to the add Q buf */ | ||
233 | PKT_ptr_ptr rx_add_st_qbb; /* Pointer to start of the Q's buf */ | ||
234 | PKT_ptr_ptr rx_add_end_qbb; /* Pointer to the end of the Q's buf */ | ||
235 | PKT_ptr_ptr rx_remove; /* Remove a Packet here */ | ||
236 | Q_BUF_ptr rx_remove_qb; /* Pointer to the remove Q buf */ | ||
237 | PKT_ptr_ptr rx_remove_st_qbb; /* Pointer to the start of the Q buf */ | ||
238 | PKT_ptr_ptr rx_remove_end_qbb; /* Pointer to the end of the Q buf */ | ||
239 | #endif | ||
240 | #ifdef INKERNEL | ||
241 | PKT_ptr_ptr rx_start; | 140 | PKT_ptr_ptr rx_start; |
242 | PKT_ptr_ptr rx_end; | 141 | PKT_ptr_ptr rx_end; |
243 | PKT_ptr_ptr rx_add; | 142 | PKT_ptr_ptr rx_add; |
244 | PKT_ptr_ptr rx_remove; | 143 | PKT_ptr_ptr rx_remove; |
245 | #endif | ||
246 | #ifdef HOST | ||
247 | union { | ||
248 | struct { | ||
249 | PKT_ptr_ptr rx_start_ptr_ptr; | ||
250 | PKT_ptr_ptr rx_end_ptr_ptr; | ||
251 | PKT_ptr_ptr rx_add_ptr_ptr; | ||
252 | PKT_ptr_ptr rx_remove_ptr_ptr; | ||
253 | } s1; | ||
254 | struct { | ||
255 | ushort *rx_start_ptr; | ||
256 | ushort *rx_end_ptr; | ||
257 | ushort *rx_add_ptr; | ||
258 | ushort *rx_remove_ptr; | ||
259 | } s2; | ||
260 | } u4; | ||
261 | #endif | ||
262 | |||
263 | #ifdef RTA /* some fields for the remotes */ | ||
264 | ushort flush_count; /* Count of write flushes */ | ||
265 | ushort txmode; /* Modes for tx */ | ||
266 | ushort rxmode; /* Modes for rx */ | ||
267 | ushort portmode; /* Generic modes */ | ||
268 | ushort column; /* TAB3 column count */ | ||
269 | ushort tx_subscript; /* (TX) Subscript into data field */ | ||
270 | ushort rx_subscript; /* (RX) Subscript into data field */ | ||
271 | PKT_ptr rx_incomplete; /* Hold an incomplete packet here */ | ||
272 | ushort modem_bits; /* Modem bits to mask */ | ||
273 | ushort lastModem; /* Modem control lines. */ | ||
274 | ushort addr; /* Address for sub commands */ | ||
275 | ushort MonitorTstate; /* TRUE if monitoring tstop */ | ||
276 | #endif | ||
277 | 144 | ||
278 | }; | 145 | }; |
279 | 146 | ||
diff --git a/drivers/char/rio/pkt.h b/drivers/char/rio/pkt.h index 882fd429ac2e..7011e52e82db 100644 --- a/drivers/char/rio/pkt.h +++ b/drivers/char/rio/pkt.h | |||
@@ -70,39 +70,12 @@ | |||
70 | #define CONTROL_DATA_WNDW (DATA_WNDW << 8) | 70 | #define CONTROL_DATA_WNDW (DATA_WNDW << 8) |
71 | 71 | ||
72 | struct PKT { | 72 | struct PKT { |
73 | #ifdef INKERNEL | ||
74 | BYTE dest_unit; /* Destination Unit Id */ | 73 | BYTE dest_unit; /* Destination Unit Id */ |
75 | BYTE dest_port; /* Destination POrt */ | 74 | BYTE dest_port; /* Destination POrt */ |
76 | BYTE src_unit; /* Source Unit Id */ | 75 | BYTE src_unit; /* Source Unit Id */ |
77 | BYTE src_port; /* Source POrt */ | 76 | BYTE src_port; /* Source POrt */ |
78 | #else | ||
79 | union { | ||
80 | ushort destination; /* Complete destination */ | ||
81 | struct { | ||
82 | unsigned char unit; /* Destination unit */ | ||
83 | unsigned char port; /* Destination port */ | ||
84 | } s1; | ||
85 | } u1; | ||
86 | union { | ||
87 | ushort source; /* Complete source */ | ||
88 | struct { | ||
89 | unsigned char unit; /* Source unit */ | ||
90 | unsigned char port; /* Source port */ | ||
91 | } s2; | ||
92 | } u2; | ||
93 | #endif | ||
94 | #ifdef INKERNEL | ||
95 | BYTE len; | 77 | BYTE len; |
96 | BYTE control; | 78 | BYTE control; |
97 | #else | ||
98 | union { | ||
99 | ushort control; | ||
100 | struct { | ||
101 | unsigned char len; | ||
102 | unsigned char control; | ||
103 | } s3; | ||
104 | } u3; | ||
105 | #endif | ||
106 | BYTE data[PKT_MAX_DATA_LEN]; | 79 | BYTE data[PKT_MAX_DATA_LEN]; |
107 | /* Actual data :-) */ | 80 | /* Actual data :-) */ |
108 | WORD csum; /* C-SUM */ | 81 | WORD csum; /* C-SUM */ |
diff --git a/drivers/char/rio/qbuf.h b/drivers/char/rio/qbuf.h index acd9e8e5307d..391ffc335535 100644 --- a/drivers/char/rio/qbuf.h +++ b/drivers/char/rio/qbuf.h | |||
@@ -46,11 +46,7 @@ static char *_rio_qbuf_h_sccs = "@(#)qbuf.h 1.1"; | |||
46 | 46 | ||
47 | 47 | ||
48 | 48 | ||
49 | #ifdef HOST | ||
50 | #define PKTS_PER_BUFFER 1 | ||
51 | #else | ||
52 | #define PKTS_PER_BUFFER (220 / PKT_LENGTH) | 49 | #define PKTS_PER_BUFFER (220 / PKT_LENGTH) |
53 | #endif | ||
54 | 50 | ||
55 | typedef struct Q_BUF Q_BUF; | 51 | typedef struct Q_BUF Q_BUF; |
56 | struct Q_BUF { | 52 | struct Q_BUF { |
diff --git a/drivers/char/rio/riotypes.h b/drivers/char/rio/riotypes.h index 9b67e2468bec..46084d5c7e98 100644 --- a/drivers/char/rio/riotypes.h +++ b/drivers/char/rio/riotypes.h | |||
@@ -43,9 +43,6 @@ | |||
43 | #endif | 43 | #endif |
44 | #endif | 44 | #endif |
45 | 45 | ||
46 | #ifdef INKERNEL | ||
47 | |||
48 | #if !defined(MIPSAT) | ||
49 | typedef unsigned short NUMBER_ptr; | 46 | typedef unsigned short NUMBER_ptr; |
50 | typedef unsigned short WORD_ptr; | 47 | typedef unsigned short WORD_ptr; |
51 | typedef unsigned short BYTE_ptr; | 48 | typedef unsigned short BYTE_ptr; |
@@ -65,69 +62,6 @@ typedef unsigned short RUP_ptr; | |||
65 | typedef unsigned short short_ptr; | 62 | typedef unsigned short short_ptr; |
66 | typedef unsigned short u_short_ptr; | 63 | typedef unsigned short u_short_ptr; |
67 | typedef unsigned short ushort_ptr; | 64 | typedef unsigned short ushort_ptr; |
68 | #else | ||
69 | /* MIPSAT types */ | ||
70 | typedef char RIO_POINTER[8]; | ||
71 | typedef RIO_POINTER NUMBER_ptr; | ||
72 | typedef RIO_POINTER WORD_ptr; | ||
73 | typedef RIO_POINTER BYTE_ptr; | ||
74 | typedef RIO_POINTER char_ptr; | ||
75 | typedef RIO_POINTER Channel_ptr; | ||
76 | typedef RIO_POINTER FREE_LIST_ptr_ptr; | ||
77 | typedef RIO_POINTER FREE_LIST_ptr; | ||
78 | typedef RIO_POINTER LPB_ptr; | ||
79 | typedef RIO_POINTER Process_ptr; | ||
80 | typedef RIO_POINTER PHB_ptr; | ||
81 | typedef RIO_POINTER PKT_ptr; | ||
82 | typedef RIO_POINTER PKT_ptr_ptr; | ||
83 | typedef RIO_POINTER Q_BUF_ptr; | ||
84 | typedef RIO_POINTER Q_BUF_ptr_ptr; | ||
85 | typedef RIO_POINTER ROUTE_STR_ptr; | ||
86 | typedef RIO_POINTER RUP_ptr; | ||
87 | typedef RIO_POINTER short_ptr; | ||
88 | typedef RIO_POINTER u_short_ptr; | ||
89 | typedef RIO_POINTER ushort_ptr; | ||
90 | #endif | ||
91 | |||
92 | #else /* not INKERNEL */ | ||
93 | typedef unsigned char BYTE; | ||
94 | typedef unsigned short WORD; | ||
95 | typedef unsigned long DWORD; | ||
96 | typedef short NUMBER; | ||
97 | typedef short *NUMBER_ptr; | ||
98 | typedef unsigned short *WORD_ptr; | ||
99 | typedef unsigned char *BYTE_ptr; | ||
100 | typedef unsigned char uchar; | ||
101 | typedef unsigned short ushort; | ||
102 | typedef unsigned int uint; | ||
103 | typedef unsigned long ulong; | ||
104 | typedef unsigned char u_char; | ||
105 | typedef unsigned short u_short; | ||
106 | typedef unsigned int u_int; | ||
107 | typedef unsigned long u_long; | ||
108 | typedef unsigned short ERROR; | ||
109 | typedef unsigned long ID; | ||
110 | typedef char *char_ptr; | ||
111 | typedef Channel *Channel_ptr; | ||
112 | typedef struct FREE_LIST *FREE_LIST_ptr; | ||
113 | typedef struct FREE_LIST **FREE_LIST_ptr_ptr; | ||
114 | typedef struct LPB *LPB_ptr; | ||
115 | typedef struct Process *Process_ptr; | ||
116 | typedef struct PHB *PHB_ptr; | ||
117 | typedef struct PKT *PKT_ptr; | ||
118 | typedef struct PKT **PKT_ptr_ptr; | ||
119 | typedef struct Q_BUF *Q_BUF_ptr; | ||
120 | typedef struct Q_BUF **Q_BUF_ptr_ptr; | ||
121 | typedef struct ROUTE_STR *ROUTE_STR_ptr; | ||
122 | typedef struct RUP *RUP_ptr; | ||
123 | typedef short *short_ptr; | ||
124 | typedef u_short *u_short_ptr; | ||
125 | typedef ushort *ushort_ptr; | ||
126 | typedef struct PKT PKT; | ||
127 | typedef struct LPB LPB; | ||
128 | typedef struct RUP RUP; | ||
129 | #endif | ||
130 | |||
131 | 65 | ||
132 | #endif /* __riotypes__ */ | 66 | #endif /* __riotypes__ */ |
133 | 67 | ||
diff --git a/drivers/char/rio/rup.h b/drivers/char/rio/rup.h index 8d44fec91dd5..f74f67c6f702 100644 --- a/drivers/char/rio/rup.h +++ b/drivers/char/rio/rup.h | |||
@@ -43,12 +43,7 @@ | |||
43 | #endif | 43 | #endif |
44 | #endif | 44 | #endif |
45 | 45 | ||
46 | #if defined( HOST ) || defined( INKERNEL ) | ||
47 | #define MAX_RUP ((short) 16) | 46 | #define MAX_RUP ((short) 16) |
48 | #endif | ||
49 | #ifdef RTA | ||
50 | #define MAX_RUP ((short) 1) | ||
51 | #endif | ||
52 | 47 | ||
53 | #define PKTS_PER_RUP ((short) 2) /* They are always used in pairs */ | 48 | #define PKTS_PER_RUP ((short) 2) /* They are always used in pairs */ |
54 | 49 | ||
diff --git a/drivers/char/rio/sam.h b/drivers/char/rio/sam.h index 31494054b213..6f754e19015d 100644 --- a/drivers/char/rio/sam.h +++ b/drivers/char/rio/sam.h | |||
@@ -43,10 +43,6 @@ | |||
43 | #endif | 43 | #endif |
44 | 44 | ||
45 | 45 | ||
46 | #if !defined( HOST ) && !defined( INKERNEL ) | ||
47 | #define RTA 1 | ||
48 | #endif | ||
49 | |||
50 | #define NUM_FREE_LIST_UNITS 500 | 46 | #define NUM_FREE_LIST_UNITS 500 |
51 | 47 | ||
52 | #ifndef FALSE | 48 | #ifndef FALSE |
diff --git a/drivers/char/rocket.c b/drivers/char/rocket.c index 0949dcef0697..7edc6a4dbdc4 100644 --- a/drivers/char/rocket.c +++ b/drivers/char/rocket.c | |||
@@ -433,7 +433,7 @@ static void rp_do_receive(struct r_port *info, | |||
433 | count += ToRecv; | 433 | count += ToRecv; |
434 | } | 434 | } |
435 | /* Push the data up to the tty layer */ | 435 | /* Push the data up to the tty layer */ |
436 | ld->receive_buf(tty, cbuf, fbuf, count); | 436 | ld->receive_buf(tty, chead, fhead, count); |
437 | done: | 437 | done: |
438 | tty_ldisc_deref(ld); | 438 | tty_ldisc_deref(ld); |
439 | } | 439 | } |
diff --git a/drivers/char/ser_a2232.c b/drivers/char/ser_a2232.c index 80a5b840e22f..fee68cc895f8 100644 --- a/drivers/char/ser_a2232.c +++ b/drivers/char/ser_a2232.c | |||
@@ -103,6 +103,7 @@ | |||
103 | 103 | ||
104 | #include <linux/serial.h> | 104 | #include <linux/serial.h> |
105 | #include <linux/generic_serial.h> | 105 | #include <linux/generic_serial.h> |
106 | #include <linux/tty_flip.h> | ||
106 | 107 | ||
107 | #include "ser_a2232.h" | 108 | #include "ser_a2232.h" |
108 | #include "ser_a2232fw.h" | 109 | #include "ser_a2232fw.h" |
diff --git a/drivers/char/sx.c b/drivers/char/sx.c index 64bf89cb574f..a6b4f02bdceb 100644 --- a/drivers/char/sx.c +++ b/drivers/char/sx.c | |||
@@ -931,7 +931,7 @@ static int sx_set_real_termios (void *ptr) | |||
931 | case CS6:sx_write_channel_byte (port, hi_mask, 0x3f);break; | 931 | case CS6:sx_write_channel_byte (port, hi_mask, 0x3f);break; |
932 | case CS5:sx_write_channel_byte (port, hi_mask, 0x1f);break; | 932 | case CS5:sx_write_channel_byte (port, hi_mask, 0x1f);break; |
933 | default: | 933 | default: |
934 | printk (KERN_INFO "sx: Invalid wordsize: %d\n", CFLAG & CSIZE); | 934 | printk (KERN_INFO "sx: Invalid wordsize: %u\n", CFLAG & CSIZE); |
935 | break; | 935 | break; |
936 | } | 936 | } |
937 | 937 | ||
@@ -958,7 +958,7 @@ static int sx_set_real_termios (void *ptr) | |||
958 | } else { | 958 | } else { |
959 | set_bit(TTY_HW_COOK_IN, &port->gs.tty->flags); | 959 | set_bit(TTY_HW_COOK_IN, &port->gs.tty->flags); |
960 | } | 960 | } |
961 | sx_dprintk (SX_DEBUG_TERMIOS, "iflags: %x(%d) ", | 961 | sx_dprintk (SX_DEBUG_TERMIOS, "iflags: %x(%d) ", |
962 | port->gs.tty->termios->c_iflag, | 962 | port->gs.tty->termios->c_iflag, |
963 | I_OTHER(port->gs.tty)); | 963 | I_OTHER(port->gs.tty)); |
964 | 964 | ||
@@ -973,7 +973,7 @@ static int sx_set_real_termios (void *ptr) | |||
973 | } else { | 973 | } else { |
974 | clear_bit(TTY_HW_COOK_OUT, &port->gs.tty->flags); | 974 | clear_bit(TTY_HW_COOK_OUT, &port->gs.tty->flags); |
975 | } | 975 | } |
976 | sx_dprintk (SX_DEBUG_TERMIOS, "oflags: %x(%d)\n", | 976 | sx_dprintk (SX_DEBUG_TERMIOS, "oflags: %x(%d)\n", |
977 | port->gs.tty->termios->c_oflag, | 977 | port->gs.tty->termios->c_oflag, |
978 | O_OTHER(port->gs.tty)); | 978 | O_OTHER(port->gs.tty)); |
979 | /* port->c_dcd = sx_get_CD (port); */ | 979 | /* port->c_dcd = sx_get_CD (port); */ |
@@ -1095,17 +1095,17 @@ static inline void sx_receive_chars (struct sx_port *port) | |||
1095 | 1095 | ||
1096 | sx_dprintk (SX_DEBUG_RECEIVE, "rxop=%d, c = %d.\n", rx_op, c); | 1096 | sx_dprintk (SX_DEBUG_RECEIVE, "rxop=%d, c = %d.\n", rx_op, c); |
1097 | 1097 | ||
1098 | /* Don't copy past the end of the hardware receive buffer */ | ||
1099 | if (rx_op + c > 0x100) c = 0x100 - rx_op; | ||
1100 | |||
1101 | sx_dprintk (SX_DEBUG_RECEIVE, "c = %d.\n", c); | ||
1102 | |||
1098 | /* Don't copy more bytes than there is room for in the buffer */ | 1103 | /* Don't copy more bytes than there is room for in the buffer */ |
1099 | 1104 | ||
1100 | c = tty_prepare_flip_string(tty, &rp, c); | 1105 | c = tty_prepare_flip_string(tty, &rp, c); |
1101 | 1106 | ||
1102 | sx_dprintk (SX_DEBUG_RECEIVE, "c = %d.\n", c); | 1107 | sx_dprintk (SX_DEBUG_RECEIVE, "c = %d.\n", c); |
1103 | 1108 | ||
1104 | /* Don't copy past the end of the hardware receive buffer */ | ||
1105 | if (rx_op + c > 0x100) c = 0x100 - rx_op; | ||
1106 | |||
1107 | sx_dprintk (SX_DEBUG_RECEIVE, "c = %d.\n", c); | ||
1108 | |||
1109 | /* If for one reason or another, we can't copy more data, we're done! */ | 1109 | /* If for one reason or another, we can't copy more data, we're done! */ |
1110 | if (c == 0) break; | 1110 | if (c == 0) break; |
1111 | 1111 | ||
@@ -2173,15 +2173,17 @@ static int probe_si (struct sx_board *board) | |||
2173 | if ( IS_SI1_BOARD(board)) { | 2173 | if ( IS_SI1_BOARD(board)) { |
2174 | /* This should be an SI1 board, which has this | 2174 | /* This should be an SI1 board, which has this |
2175 | location writable... */ | 2175 | location writable... */ |
2176 | if (read_sx_byte (board, SI2_ISA_ID_BASE) != 0x10) | 2176 | if (read_sx_byte (board, SI2_ISA_ID_BASE) != 0x10) { |
2177 | func_exit (); | 2177 | func_exit (); |
2178 | return 0; | 2178 | return 0; |
2179 | } | ||
2179 | } else { | 2180 | } else { |
2180 | /* This should be an SI2 board, which has the bottom | 2181 | /* This should be an SI2 board, which has the bottom |
2181 | 3 bits non-writable... */ | 2182 | 3 bits non-writable... */ |
2182 | if (read_sx_byte (board, SI2_ISA_ID_BASE) == 0x10) | 2183 | if (read_sx_byte (board, SI2_ISA_ID_BASE) == 0x10) { |
2183 | func_exit (); | 2184 | func_exit (); |
2184 | return 0; | 2185 | return 0; |
2186 | } | ||
2185 | } | 2187 | } |
2186 | 2188 | ||
2187 | /* Now we're pretty much convinced that there is an SI board here, | 2189 | /* Now we're pretty much convinced that there is an SI board here, |
@@ -2192,15 +2194,17 @@ static int probe_si (struct sx_board *board) | |||
2192 | if ( IS_SI1_BOARD(board)) { | 2194 | if ( IS_SI1_BOARD(board)) { |
2193 | /* This should be an SI1 board, which has this | 2195 | /* This should be an SI1 board, which has this |
2194 | location writable... */ | 2196 | location writable... */ |
2195 | if (read_sx_byte (board, SI2_ISA_ID_BASE) != 0x10) | 2197 | if (read_sx_byte (board, SI2_ISA_ID_BASE) != 0x10) { |
2196 | func_exit(); | 2198 | func_exit(); |
2197 | return 0; | 2199 | return 0; |
2200 | } | ||
2198 | } else { | 2201 | } else { |
2199 | /* This should be an SI2 board, which has the bottom | 2202 | /* This should be an SI2 board, which has the bottom |
2200 | 3 bits non-writable... */ | 2203 | 3 bits non-writable... */ |
2201 | if (read_sx_byte (board, SI2_ISA_ID_BASE) == 0x10) | 2204 | if (read_sx_byte (board, SI2_ISA_ID_BASE) == 0x10) { |
2202 | func_exit (); | 2205 | func_exit (); |
2203 | return 0; | 2206 | return 0; |
2207 | } | ||
2204 | } | 2208 | } |
2205 | 2209 | ||
2206 | printheader (); | 2210 | printheader (); |
diff --git a/drivers/char/synclink_gt.c b/drivers/char/synclink_gt.c index a85a60a93deb..b046390cd256 100644 --- a/drivers/char/synclink_gt.c +++ b/drivers/char/synclink_gt.c | |||
@@ -306,7 +306,7 @@ struct slgt_info { | |||
306 | int tx_active; | 306 | int tx_active; |
307 | 307 | ||
308 | unsigned char signals; /* serial signal states */ | 308 | unsigned char signals; /* serial signal states */ |
309 | unsigned int init_error; /* initialization error */ | 309 | int init_error; /* initialization error */ |
310 | 310 | ||
311 | unsigned char *tx_buf; | 311 | unsigned char *tx_buf; |
312 | int tx_count; | 312 | int tx_count; |
diff --git a/drivers/char/sysrq.c b/drivers/char/sysrq.c index 5765f672e853..d58f82318853 100644 --- a/drivers/char/sysrq.c +++ b/drivers/char/sysrq.c | |||
@@ -243,7 +243,7 @@ static struct sysrq_key_op sysrq_term_op = { | |||
243 | 243 | ||
244 | static void moom_callback(void *ignored) | 244 | static void moom_callback(void *ignored) |
245 | { | 245 | { |
246 | out_of_memory(GFP_KERNEL, 0); | 246 | out_of_memory(&NODE_DATA(0)->node_zonelists[ZONE_NORMAL], GFP_KERNEL, 0); |
247 | } | 247 | } |
248 | 248 | ||
249 | static DECLARE_WORK(moom_work, moom_callback, NULL); | 249 | static DECLARE_WORK(moom_work, moom_callback, NULL); |
diff --git a/drivers/char/tipar.c b/drivers/char/tipar.c index 41a94bc79f67..eb2eb3e12d6a 100644 --- a/drivers/char/tipar.c +++ b/drivers/char/tipar.c | |||
@@ -250,12 +250,17 @@ tipar_open(struct inode *inode, struct file *file) | |||
250 | { | 250 | { |
251 | unsigned int minor = iminor(inode) - TIPAR_MINOR; | 251 | unsigned int minor = iminor(inode) - TIPAR_MINOR; |
252 | 252 | ||
253 | if (minor > tp_count - 1) | 253 | if (tp_count == 0 || minor > tp_count - 1) |
254 | return -ENXIO; | 254 | return -ENXIO; |
255 | 255 | ||
256 | if (test_and_set_bit(minor, &opened)) | 256 | if (test_and_set_bit(minor, &opened)) |
257 | return -EBUSY; | 257 | return -EBUSY; |
258 | 258 | ||
259 | if (!table[minor].dev) { | ||
260 | printk(KERN_ERR "%s: NULL device for minor %u\n", | ||
261 | __FUNCTION__, minor); | ||
262 | return -ENXIO; | ||
263 | } | ||
259 | parport_claim_or_block(table[minor].dev); | 264 | parport_claim_or_block(table[minor].dev); |
260 | init_ti_parallel(minor); | 265 | init_ti_parallel(minor); |
261 | parport_release(table[minor].dev); | 266 | parport_release(table[minor].dev); |
@@ -510,16 +515,20 @@ tipar_init_module(void) | |||
510 | err = PTR_ERR(tipar_class); | 515 | err = PTR_ERR(tipar_class); |
511 | goto out_chrdev; | 516 | goto out_chrdev; |
512 | } | 517 | } |
513 | if (parport_register_driver(&tipar_driver)) { | 518 | if (parport_register_driver(&tipar_driver) || tp_count == 0) { |
514 | printk(KERN_ERR "tipar: unable to register with parport\n"); | 519 | printk(KERN_ERR "tipar: unable to register with parport\n"); |
515 | err = -EIO; | 520 | err = -EIO; |
516 | goto out; | 521 | goto out_class; |
517 | } | 522 | } |
518 | 523 | ||
519 | err = 0; | 524 | err = 0; |
520 | goto out; | 525 | goto out; |
521 | 526 | ||
527 | out_class: | ||
528 | class_destroy(tipar_class); | ||
529 | |||
522 | out_chrdev: | 530 | out_chrdev: |
531 | devfs_remove("ticables/par"); | ||
523 | unregister_chrdev(TIPAR_MAJOR, "tipar"); | 532 | unregister_chrdev(TIPAR_MAJOR, "tipar"); |
524 | out: | 533 | out: |
525 | return err; | 534 | return err; |
diff --git a/drivers/char/tpm/tpm_bios.c b/drivers/char/tpm/tpm_bios.c index aedf7a8e6da7..537aa45d8c67 100644 --- a/drivers/char/tpm/tpm_bios.c +++ b/drivers/char/tpm/tpm_bios.c | |||
@@ -191,7 +191,7 @@ static int get_event_name(char *dest, struct tcpa_event *event, | |||
191 | const char *name = ""; | 191 | const char *name = ""; |
192 | char data[40] = ""; | 192 | char data[40] = ""; |
193 | int i, n_len = 0, d_len = 0; | 193 | int i, n_len = 0, d_len = 0; |
194 | u32 event_id, event_data_size; | 194 | u32 event_id; |
195 | 195 | ||
196 | switch(event->event_type) { | 196 | switch(event->event_type) { |
197 | case PREBOOT: | 197 | case PREBOOT: |
@@ -220,8 +220,7 @@ static int get_event_name(char *dest, struct tcpa_event *event, | |||
220 | } | 220 | } |
221 | break; | 221 | break; |
222 | case EVENT_TAG: | 222 | case EVENT_TAG: |
223 | event_id = be32_to_cpu(event_entry); | 223 | event_id = be32_to_cpu(*((u32 *)event_entry)); |
224 | event_data_size = be32_to_cpu(&event_entry[4]); | ||
225 | 224 | ||
226 | /* ToDo Row data -> Base64 */ | 225 | /* ToDo Row data -> Base64 */ |
227 | 226 | ||
@@ -376,7 +375,7 @@ static int read_log(struct tpm_bios_log *log) | |||
376 | { | 375 | { |
377 | struct acpi_tcpa *buff; | 376 | struct acpi_tcpa *buff; |
378 | acpi_status status; | 377 | acpi_status status; |
379 | void *virt; | 378 | struct acpi_table_header *virt; |
380 | 379 | ||
381 | if (log->bios_event_log != NULL) { | 380 | if (log->bios_event_log != NULL) { |
382 | printk(KERN_ERR | 381 | printk(KERN_ERR |
@@ -413,7 +412,7 @@ static int read_log(struct tpm_bios_log *log) | |||
413 | 412 | ||
414 | log->bios_event_log_end = log->bios_event_log + buff->log_max_len; | 413 | log->bios_event_log_end = log->bios_event_log + buff->log_max_len; |
415 | 414 | ||
416 | acpi_os_map_memory(buff->log_start_addr, buff->log_max_len, &virt); | 415 | acpi_os_map_memory(buff->log_start_addr, buff->log_max_len, (void *) &virt); |
417 | 416 | ||
418 | memcpy(log->bios_event_log, virt, buff->log_max_len); | 417 | memcpy(log->bios_event_log, virt, buff->log_max_len); |
419 | 418 | ||
@@ -487,26 +486,35 @@ struct file_operations tpm_binary_bios_measurements_ops = { | |||
487 | .release = tpm_bios_measurements_release, | 486 | .release = tpm_bios_measurements_release, |
488 | }; | 487 | }; |
489 | 488 | ||
489 | static int is_bad(void *p) | ||
490 | { | ||
491 | if (!p) | ||
492 | return 1; | ||
493 | if (IS_ERR(p) && (PTR_ERR(p) != -ENODEV)) | ||
494 | return 1; | ||
495 | return 0; | ||
496 | } | ||
497 | |||
490 | struct dentry **tpm_bios_log_setup(char *name) | 498 | struct dentry **tpm_bios_log_setup(char *name) |
491 | { | 499 | { |
492 | struct dentry **ret = NULL, *tpm_dir, *bin_file, *ascii_file; | 500 | struct dentry **ret = NULL, *tpm_dir, *bin_file, *ascii_file; |
493 | 501 | ||
494 | tpm_dir = securityfs_create_dir(name, NULL); | 502 | tpm_dir = securityfs_create_dir(name, NULL); |
495 | if (!tpm_dir) | 503 | if (is_bad(tpm_dir)) |
496 | goto out; | 504 | goto out; |
497 | 505 | ||
498 | bin_file = | 506 | bin_file = |
499 | securityfs_create_file("binary_bios_measurements", | 507 | securityfs_create_file("binary_bios_measurements", |
500 | S_IRUSR | S_IRGRP, tpm_dir, NULL, | 508 | S_IRUSR | S_IRGRP, tpm_dir, NULL, |
501 | &tpm_binary_bios_measurements_ops); | 509 | &tpm_binary_bios_measurements_ops); |
502 | if (!bin_file) | 510 | if (is_bad(bin_file)) |
503 | goto out_tpm; | 511 | goto out_tpm; |
504 | 512 | ||
505 | ascii_file = | 513 | ascii_file = |
506 | securityfs_create_file("ascii_bios_measurements", | 514 | securityfs_create_file("ascii_bios_measurements", |
507 | S_IRUSR | S_IRGRP, tpm_dir, NULL, | 515 | S_IRUSR | S_IRGRP, tpm_dir, NULL, |
508 | &tpm_ascii_bios_measurements_ops); | 516 | &tpm_ascii_bios_measurements_ops); |
509 | if (!ascii_file) | 517 | if (is_bad(ascii_file)) |
510 | goto out_bin; | 518 | goto out_bin; |
511 | 519 | ||
512 | ret = kmalloc(3 * sizeof(struct dentry *), GFP_KERNEL); | 520 | ret = kmalloc(3 * sizeof(struct dentry *), GFP_KERNEL); |
@@ -538,3 +546,4 @@ void tpm_bios_log_teardown(struct dentry **lst) | |||
538 | securityfs_remove(lst[i]); | 546 | securityfs_remove(lst[i]); |
539 | } | 547 | } |
540 | EXPORT_SYMBOL_GPL(tpm_bios_log_teardown); | 548 | EXPORT_SYMBOL_GPL(tpm_bios_log_teardown); |
549 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/char/tpm/tpm_infineon.c b/drivers/char/tpm/tpm_infineon.c index 8198dbb7370f..24095f6ee6da 100644 --- a/drivers/char/tpm/tpm_infineon.c +++ b/drivers/char/tpm/tpm_infineon.c | |||
@@ -33,6 +33,7 @@ | |||
33 | static int TPM_INF_DATA; | 33 | static int TPM_INF_DATA; |
34 | static int TPM_INF_ADDR; | 34 | static int TPM_INF_ADDR; |
35 | static int TPM_INF_BASE; | 35 | static int TPM_INF_BASE; |
36 | static int TPM_INF_ADDR_LEN; | ||
36 | static int TPM_INF_PORT_LEN; | 37 | static int TPM_INF_PORT_LEN; |
37 | 38 | ||
38 | /* TPM header definitions */ | 39 | /* TPM header definitions */ |
@@ -195,6 +196,7 @@ static int tpm_inf_recv(struct tpm_chip *chip, u8 * buf, size_t count) | |||
195 | int i; | 196 | int i; |
196 | int ret; | 197 | int ret; |
197 | u32 size = 0; | 198 | u32 size = 0; |
199 | number_of_wtx = 0; | ||
198 | 200 | ||
199 | recv_begin: | 201 | recv_begin: |
200 | /* start receiving header */ | 202 | /* start receiving header */ |
@@ -378,24 +380,35 @@ static int __devinit tpm_inf_pnp_probe(struct pnp_dev *dev, | |||
378 | if (pnp_port_valid(dev, 0) && pnp_port_valid(dev, 1) && | 380 | if (pnp_port_valid(dev, 0) && pnp_port_valid(dev, 1) && |
379 | !(pnp_port_flags(dev, 0) & IORESOURCE_DISABLED)) { | 381 | !(pnp_port_flags(dev, 0) & IORESOURCE_DISABLED)) { |
380 | TPM_INF_ADDR = pnp_port_start(dev, 0); | 382 | TPM_INF_ADDR = pnp_port_start(dev, 0); |
383 | TPM_INF_ADDR_LEN = pnp_port_len(dev, 0); | ||
381 | TPM_INF_DATA = (TPM_INF_ADDR + 1); | 384 | TPM_INF_DATA = (TPM_INF_ADDR + 1); |
382 | TPM_INF_BASE = pnp_port_start(dev, 1); | 385 | TPM_INF_BASE = pnp_port_start(dev, 1); |
383 | TPM_INF_PORT_LEN = pnp_port_len(dev, 1); | 386 | TPM_INF_PORT_LEN = pnp_port_len(dev, 1); |
384 | if (!TPM_INF_PORT_LEN) | 387 | if ((TPM_INF_PORT_LEN < 4) || (TPM_INF_ADDR_LEN < 2)) { |
385 | return -EINVAL; | 388 | rc = -EINVAL; |
389 | goto err_last; | ||
390 | } | ||
386 | dev_info(&dev->dev, "Found %s with ID %s\n", | 391 | dev_info(&dev->dev, "Found %s with ID %s\n", |
387 | dev->name, dev_id->id); | 392 | dev->name, dev_id->id); |
388 | if (!((TPM_INF_BASE >> 8) & 0xff)) | 393 | if (!((TPM_INF_BASE >> 8) & 0xff)) { |
389 | return -EINVAL; | 394 | rc = -EINVAL; |
395 | goto err_last; | ||
396 | } | ||
390 | /* publish my base address and request region */ | 397 | /* publish my base address and request region */ |
391 | tpm_inf.base = TPM_INF_BASE; | 398 | tpm_inf.base = TPM_INF_BASE; |
392 | if (request_region | 399 | if (request_region |
393 | (tpm_inf.base, TPM_INF_PORT_LEN, "tpm_infineon0") == NULL) { | 400 | (tpm_inf.base, TPM_INF_PORT_LEN, "tpm_infineon0") == NULL) { |
394 | release_region(tpm_inf.base, TPM_INF_PORT_LEN); | 401 | rc = -EINVAL; |
395 | return -EINVAL; | 402 | goto err_last; |
403 | } | ||
404 | if (request_region(TPM_INF_ADDR, TPM_INF_ADDR_LEN, | ||
405 | "tpm_infineon0") == NULL) { | ||
406 | rc = -EINVAL; | ||
407 | goto err_last; | ||
396 | } | 408 | } |
397 | } else { | 409 | } else { |
398 | return -EINVAL; | 410 | rc = -EINVAL; |
411 | goto err_last; | ||
399 | } | 412 | } |
400 | 413 | ||
401 | /* query chip for its vendor, its version number a.s.o. */ | 414 | /* query chip for its vendor, its version number a.s.o. */ |
@@ -441,10 +454,10 @@ static int __devinit tpm_inf_pnp_probe(struct pnp_dev *dev, | |||
441 | 454 | ||
442 | if ((ioh << 8 | iol) != tpm_inf.base) { | 455 | if ((ioh << 8 | iol) != tpm_inf.base) { |
443 | dev_err(&dev->dev, | 456 | dev_err(&dev->dev, |
444 | "Could not set IO-ports to %04x\n", | 457 | "Could not set IO-ports to 0x%lx\n", |
445 | tpm_inf.base); | 458 | tpm_inf.base); |
446 | release_region(tpm_inf.base, TPM_INF_PORT_LEN); | 459 | rc = -EIO; |
447 | return -EIO; | 460 | goto err_release_region; |
448 | } | 461 | } |
449 | 462 | ||
450 | /* activate register */ | 463 | /* activate register */ |
@@ -471,14 +484,21 @@ static int __devinit tpm_inf_pnp_probe(struct pnp_dev *dev, | |||
471 | 484 | ||
472 | rc = tpm_register_hardware(&dev->dev, &tpm_inf); | 485 | rc = tpm_register_hardware(&dev->dev, &tpm_inf); |
473 | if (rc < 0) { | 486 | if (rc < 0) { |
474 | release_region(tpm_inf.base, TPM_INF_PORT_LEN); | 487 | rc = -ENODEV; |
475 | return -ENODEV; | 488 | goto err_release_region; |
476 | } | 489 | } |
477 | return 0; | 490 | return 0; |
478 | } else { | 491 | } else { |
479 | dev_info(&dev->dev, "No Infineon TPM found!\n"); | 492 | rc = -ENODEV; |
480 | return -ENODEV; | 493 | goto err_release_region; |
481 | } | 494 | } |
495 | |||
496 | err_release_region: | ||
497 | release_region(tpm_inf.base, TPM_INF_PORT_LEN); | ||
498 | release_region(TPM_INF_ADDR, TPM_INF_ADDR_LEN); | ||
499 | |||
500 | err_last: | ||
501 | return rc; | ||
482 | } | 502 | } |
483 | 503 | ||
484 | static __devexit void tpm_inf_pnp_remove(struct pnp_dev *dev) | 504 | static __devexit void tpm_inf_pnp_remove(struct pnp_dev *dev) |
@@ -518,5 +538,5 @@ module_exit(cleanup_inf); | |||
518 | 538 | ||
519 | MODULE_AUTHOR("Marcel Selhorst <selhorst@crypto.rub.de>"); | 539 | MODULE_AUTHOR("Marcel Selhorst <selhorst@crypto.rub.de>"); |
520 | MODULE_DESCRIPTION("Driver for Infineon TPM SLD 9630 TT 1.1 / SLB 9635 TT 1.2"); | 540 | MODULE_DESCRIPTION("Driver for Infineon TPM SLD 9630 TT 1.1 / SLB 9635 TT 1.2"); |
521 | MODULE_VERSION("1.6"); | 541 | MODULE_VERSION("1.7"); |
522 | MODULE_LICENSE("GPL"); | 542 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c index eb8b5be4e249..53d3d066554e 100644 --- a/drivers/char/tty_io.c +++ b/drivers/char/tty_io.c | |||
@@ -253,6 +253,7 @@ static void tty_buffer_free_all(struct tty_struct *tty) | |||
253 | 253 | ||
254 | static void tty_buffer_init(struct tty_struct *tty) | 254 | static void tty_buffer_init(struct tty_struct *tty) |
255 | { | 255 | { |
256 | spin_lock_init(&tty->buf.lock); | ||
256 | tty->buf.head = NULL; | 257 | tty->buf.head = NULL; |
257 | tty->buf.tail = NULL; | 258 | tty->buf.tail = NULL; |
258 | tty->buf.free = NULL; | 259 | tty->buf.free = NULL; |
@@ -266,6 +267,9 @@ static struct tty_buffer *tty_buffer_alloc(size_t size) | |||
266 | p->used = 0; | 267 | p->used = 0; |
267 | p->size = size; | 268 | p->size = size; |
268 | p->next = NULL; | 269 | p->next = NULL; |
270 | p->active = 0; | ||
271 | p->commit = 0; | ||
272 | p->read = 0; | ||
269 | p->char_buf_ptr = (char *)(p->data); | 273 | p->char_buf_ptr = (char *)(p->data); |
270 | p->flag_buf_ptr = (unsigned char *)p->char_buf_ptr + size; | 274 | p->flag_buf_ptr = (unsigned char *)p->char_buf_ptr + size; |
271 | /* printk("Flip create %p\n", p); */ | 275 | /* printk("Flip create %p\n", p); */ |
@@ -296,8 +300,10 @@ static struct tty_buffer *tty_buffer_find(struct tty_struct *tty, size_t size) | |||
296 | *tbh = t->next; | 300 | *tbh = t->next; |
297 | t->next = NULL; | 301 | t->next = NULL; |
298 | t->used = 0; | 302 | t->used = 0; |
303 | t->commit = 0; | ||
304 | t->read = 0; | ||
299 | /* DEBUG ONLY */ | 305 | /* DEBUG ONLY */ |
300 | memset(t->data, '*', size); | 306 | /* memset(t->data, '*', size); */ |
301 | /* printk("Flip recycle %p\n", t); */ | 307 | /* printk("Flip recycle %p\n", t); */ |
302 | return t; | 308 | return t; |
303 | } | 309 | } |
@@ -312,25 +318,37 @@ static struct tty_buffer *tty_buffer_find(struct tty_struct *tty, size_t size) | |||
312 | 318 | ||
313 | int tty_buffer_request_room(struct tty_struct *tty, size_t size) | 319 | int tty_buffer_request_room(struct tty_struct *tty, size_t size) |
314 | { | 320 | { |
315 | struct tty_buffer *b = tty->buf.tail, *n; | 321 | struct tty_buffer *b, *n; |
316 | int left = 0; | 322 | int left; |
323 | unsigned long flags; | ||
324 | |||
325 | spin_lock_irqsave(&tty->buf.lock, flags); | ||
317 | 326 | ||
318 | /* OPTIMISATION: We could keep a per tty "zero" sized buffer to | 327 | /* OPTIMISATION: We could keep a per tty "zero" sized buffer to |
319 | remove this conditional if its worth it. This would be invisible | 328 | remove this conditional if its worth it. This would be invisible |
320 | to the callers */ | 329 | to the callers */ |
321 | if(b != NULL) | 330 | if ((b = tty->buf.tail) != NULL) { |
322 | left = b->size - b->used; | 331 | left = b->size - b->used; |
323 | if(left >= size) | 332 | b->active = 1; |
324 | return size; | 333 | } else |
325 | /* This is the slow path - looking for new buffers to use */ | 334 | left = 0; |
326 | n = tty_buffer_find(tty, size); | 335 | |
327 | if(n == NULL) | 336 | if (left < size) { |
328 | return left; | 337 | /* This is the slow path - looking for new buffers to use */ |
329 | if(b != NULL) | 338 | if ((n = tty_buffer_find(tty, size)) != NULL) { |
330 | b->next = n; | 339 | if (b != NULL) { |
331 | else | 340 | b->next = n; |
332 | tty->buf.head = n; | 341 | b->active = 0; |
333 | tty->buf.tail = n; | 342 | b->commit = b->used; |
343 | } else | ||
344 | tty->buf.head = n; | ||
345 | tty->buf.tail = n; | ||
346 | n->active = 1; | ||
347 | } else | ||
348 | size = left; | ||
349 | } | ||
350 | |||
351 | spin_unlock_irqrestore(&tty->buf.lock, flags); | ||
334 | return size; | 352 | return size; |
335 | } | 353 | } |
336 | 354 | ||
@@ -396,10 +414,12 @@ EXPORT_SYMBOL_GPL(tty_insert_flip_string_flags); | |||
396 | int tty_prepare_flip_string(struct tty_struct *tty, unsigned char **chars, size_t size) | 414 | int tty_prepare_flip_string(struct tty_struct *tty, unsigned char **chars, size_t size) |
397 | { | 415 | { |
398 | int space = tty_buffer_request_room(tty, size); | 416 | int space = tty_buffer_request_room(tty, size); |
399 | struct tty_buffer *tb = tty->buf.tail; | 417 | if (likely(space)) { |
400 | *chars = tb->char_buf_ptr + tb->used; | 418 | struct tty_buffer *tb = tty->buf.tail; |
401 | memset(tb->flag_buf_ptr + tb->used, TTY_NORMAL, space); | 419 | *chars = tb->char_buf_ptr + tb->used; |
402 | tb->used += space; | 420 | memset(tb->flag_buf_ptr + tb->used, TTY_NORMAL, space); |
421 | tb->used += space; | ||
422 | } | ||
403 | return space; | 423 | return space; |
404 | } | 424 | } |
405 | 425 | ||
@@ -416,10 +436,12 @@ EXPORT_SYMBOL_GPL(tty_prepare_flip_string); | |||
416 | int tty_prepare_flip_string_flags(struct tty_struct *tty, unsigned char **chars, char **flags, size_t size) | 436 | int tty_prepare_flip_string_flags(struct tty_struct *tty, unsigned char **chars, char **flags, size_t size) |
417 | { | 437 | { |
418 | int space = tty_buffer_request_room(tty, size); | 438 | int space = tty_buffer_request_room(tty, size); |
419 | struct tty_buffer *tb = tty->buf.tail; | 439 | if (likely(space)) { |
420 | *chars = tb->char_buf_ptr + tb->used; | 440 | struct tty_buffer *tb = tty->buf.tail; |
421 | *flags = tb->flag_buf_ptr + tb->used; | 441 | *chars = tb->char_buf_ptr + tb->used; |
422 | tb->used += space; | 442 | *flags = tb->flag_buf_ptr + tb->used; |
443 | tb->used += space; | ||
444 | } | ||
423 | return space; | 445 | return space; |
424 | } | 446 | } |
425 | 447 | ||
@@ -1819,7 +1841,6 @@ static void release_dev(struct file * filp) | |||
1819 | tty_closing = tty->count <= 1; | 1841 | tty_closing = tty->count <= 1; |
1820 | o_tty_closing = o_tty && | 1842 | o_tty_closing = o_tty && |
1821 | (o_tty->count <= (pty_master ? 1 : 0)); | 1843 | (o_tty->count <= (pty_master ? 1 : 0)); |
1822 | up(&tty_sem); | ||
1823 | do_sleep = 0; | 1844 | do_sleep = 0; |
1824 | 1845 | ||
1825 | if (tty_closing) { | 1846 | if (tty_closing) { |
@@ -1847,6 +1868,7 @@ static void release_dev(struct file * filp) | |||
1847 | 1868 | ||
1848 | printk(KERN_WARNING "release_dev: %s: read/write wait queue " | 1869 | printk(KERN_WARNING "release_dev: %s: read/write wait queue " |
1849 | "active!\n", tty_name(tty, buf)); | 1870 | "active!\n", tty_name(tty, buf)); |
1871 | up(&tty_sem); | ||
1850 | schedule(); | 1872 | schedule(); |
1851 | } | 1873 | } |
1852 | 1874 | ||
@@ -1855,8 +1877,6 @@ static void release_dev(struct file * filp) | |||
1855 | * both sides, and we've completed the last operation that could | 1877 | * both sides, and we've completed the last operation that could |
1856 | * block, so it's safe to proceed with closing. | 1878 | * block, so it's safe to proceed with closing. |
1857 | */ | 1879 | */ |
1858 | |||
1859 | down(&tty_sem); | ||
1860 | if (pty_master) { | 1880 | if (pty_master) { |
1861 | if (--o_tty->count < 0) { | 1881 | if (--o_tty->count < 0) { |
1862 | printk(KERN_WARNING "release_dev: bad pty slave count " | 1882 | printk(KERN_WARNING "release_dev: bad pty slave count " |
@@ -1870,7 +1890,6 @@ static void release_dev(struct file * filp) | |||
1870 | tty->count, tty_name(tty, buf)); | 1890 | tty->count, tty_name(tty, buf)); |
1871 | tty->count = 0; | 1891 | tty->count = 0; |
1872 | } | 1892 | } |
1873 | up(&tty_sem); | ||
1874 | 1893 | ||
1875 | /* | 1894 | /* |
1876 | * We've decremented tty->count, so we need to remove this file | 1895 | * We've decremented tty->count, so we need to remove this file |
@@ -1915,6 +1934,8 @@ static void release_dev(struct file * filp) | |||
1915 | read_unlock(&tasklist_lock); | 1934 | read_unlock(&tasklist_lock); |
1916 | } | 1935 | } |
1917 | 1936 | ||
1937 | up(&tty_sem); | ||
1938 | |||
1918 | /* check whether both sides are closing ... */ | 1939 | /* check whether both sides are closing ... */ |
1919 | if (!tty_closing || (o_tty && !o_tty_closing)) | 1940 | if (!tty_closing || (o_tty && !o_tty_closing)) |
1920 | return; | 1941 | return; |
@@ -2735,6 +2756,9 @@ static void flush_to_ldisc(void *private_) | |||
2735 | unsigned long flags; | 2756 | unsigned long flags; |
2736 | struct tty_ldisc *disc; | 2757 | struct tty_ldisc *disc; |
2737 | struct tty_buffer *tbuf; | 2758 | struct tty_buffer *tbuf; |
2759 | int count; | ||
2760 | char *char_buf; | ||
2761 | unsigned char *flag_buf; | ||
2738 | 2762 | ||
2739 | disc = tty_ldisc_ref(tty); | 2763 | disc = tty_ldisc_ref(tty); |
2740 | if (disc == NULL) /* !TTY_LDISC */ | 2764 | if (disc == NULL) /* !TTY_LDISC */ |
@@ -2747,20 +2771,24 @@ static void flush_to_ldisc(void *private_) | |||
2747 | schedule_delayed_work(&tty->buf.work, 1); | 2771 | schedule_delayed_work(&tty->buf.work, 1); |
2748 | goto out; | 2772 | goto out; |
2749 | } | 2773 | } |
2750 | spin_lock_irqsave(&tty->read_lock, flags); | 2774 | spin_lock_irqsave(&tty->buf.lock, flags); |
2751 | while((tbuf = tty->buf.head) != NULL) { | 2775 | while((tbuf = tty->buf.head) != NULL) { |
2776 | while ((count = tbuf->commit - tbuf->read) != 0) { | ||
2777 | char_buf = tbuf->char_buf_ptr + tbuf->read; | ||
2778 | flag_buf = tbuf->flag_buf_ptr + tbuf->read; | ||
2779 | tbuf->read += count; | ||
2780 | spin_unlock_irqrestore(&tty->buf.lock, flags); | ||
2781 | disc->receive_buf(tty, char_buf, flag_buf, count); | ||
2782 | spin_lock_irqsave(&tty->buf.lock, flags); | ||
2783 | } | ||
2784 | if (tbuf->active) | ||
2785 | break; | ||
2752 | tty->buf.head = tbuf->next; | 2786 | tty->buf.head = tbuf->next; |
2753 | if (tty->buf.head == NULL) | 2787 | if (tty->buf.head == NULL) |
2754 | tty->buf.tail = NULL; | 2788 | tty->buf.tail = NULL; |
2755 | spin_unlock_irqrestore(&tty->read_lock, flags); | ||
2756 | /* printk("Process buffer %p for %d\n", tbuf, tbuf->used); */ | ||
2757 | disc->receive_buf(tty, tbuf->char_buf_ptr, | ||
2758 | tbuf->flag_buf_ptr, | ||
2759 | tbuf->used); | ||
2760 | spin_lock_irqsave(&tty->read_lock, flags); | ||
2761 | tty_buffer_free(tty, tbuf); | 2789 | tty_buffer_free(tty, tbuf); |
2762 | } | 2790 | } |
2763 | spin_unlock_irqrestore(&tty->read_lock, flags); | 2791 | spin_unlock_irqrestore(&tty->buf.lock, flags); |
2764 | out: | 2792 | out: |
2765 | tty_ldisc_deref(disc); | 2793 | tty_ldisc_deref(disc); |
2766 | } | 2794 | } |
@@ -2852,6 +2880,14 @@ EXPORT_SYMBOL(tty_get_baud_rate); | |||
2852 | 2880 | ||
2853 | void tty_flip_buffer_push(struct tty_struct *tty) | 2881 | void tty_flip_buffer_push(struct tty_struct *tty) |
2854 | { | 2882 | { |
2883 | unsigned long flags; | ||
2884 | spin_lock_irqsave(&tty->buf.lock, flags); | ||
2885 | if (tty->buf.tail != NULL) { | ||
2886 | tty->buf.tail->active = 0; | ||
2887 | tty->buf.tail->commit = tty->buf.tail->used; | ||
2888 | } | ||
2889 | spin_unlock_irqrestore(&tty->buf.lock, flags); | ||
2890 | |||
2855 | if (tty->low_latency) | 2891 | if (tty->low_latency) |
2856 | flush_to_ldisc((void *) tty); | 2892 | flush_to_ldisc((void *) tty); |
2857 | else | 2893 | else |
diff --git a/drivers/char/vt.c b/drivers/char/vt.c index f1d9cb7feae6..0900d1dbee59 100644 --- a/drivers/char/vt.c +++ b/drivers/char/vt.c | |||
@@ -3213,6 +3213,7 @@ void getconsxy(struct vc_data *vc, unsigned char *p) | |||
3213 | 3213 | ||
3214 | void putconsxy(struct vc_data *vc, unsigned char *p) | 3214 | void putconsxy(struct vc_data *vc, unsigned char *p) |
3215 | { | 3215 | { |
3216 | hide_cursor(vc); | ||
3216 | gotoxy(vc, p[0], p[1]); | 3217 | gotoxy(vc, p[0], p[1]); |
3217 | set_cursor(vc); | 3218 | set_cursor(vc); |
3218 | } | 3219 | } |
diff --git a/drivers/char/watchdog/pcwd.c b/drivers/char/watchdog/pcwd.c index 37c9e13ad3ac..8d6b249ad66b 100644 --- a/drivers/char/watchdog/pcwd.c +++ b/drivers/char/watchdog/pcwd.c | |||
@@ -49,29 +49,37 @@ | |||
49 | * More info available at http://www.berkprod.com/ or http://www.pcwatchdog.com/ | 49 | * More info available at http://www.berkprod.com/ or http://www.pcwatchdog.com/ |
50 | */ | 50 | */ |
51 | 51 | ||
52 | #include <linux/module.h> | 52 | #include <linux/config.h> /* For CONFIG_WATCHDOG_NOWAYOUT/... */ |
53 | #include <linux/moduleparam.h> | 53 | #include <linux/module.h> /* For module specific items */ |
54 | #include <linux/types.h> | 54 | #include <linux/moduleparam.h> /* For new moduleparam's */ |
55 | #include <linux/timer.h> | 55 | #include <linux/types.h> /* For standard types (like size_t) */ |
56 | #include <linux/jiffies.h> | 56 | #include <linux/errno.h> /* For the -ENODEV/... values */ |
57 | #include <linux/config.h> | 57 | #include <linux/kernel.h> /* For printk/panic/... */ |
58 | #include <linux/wait.h> | 58 | #include <linux/delay.h> /* For mdelay function */ |
59 | #include <linux/slab.h> | 59 | #include <linux/timer.h> /* For timer related operations */ |
60 | #include <linux/ioport.h> | 60 | #include <linux/jiffies.h> /* For jiffies stuff */ |
61 | #include <linux/delay.h> | 61 | #include <linux/miscdevice.h> /* For MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR) */ |
62 | #include <linux/fs.h> | 62 | #include <linux/watchdog.h> /* For the watchdog specific items */ |
63 | #include <linux/miscdevice.h> | 63 | #include <linux/notifier.h> /* For notifier support */ |
64 | #include <linux/watchdog.h> | 64 | #include <linux/reboot.h> /* For reboot_notifier stuff */ |
65 | #include <linux/notifier.h> | 65 | #include <linux/init.h> /* For __init/__exit/... */ |
66 | #include <linux/init.h> | 66 | #include <linux/fs.h> /* For file operations */ |
67 | #include <linux/spinlock.h> | 67 | #include <linux/ioport.h> /* For io-port access */ |
68 | #include <linux/reboot.h> | 68 | #include <linux/spinlock.h> /* For spin_lock/spin_unlock/... */ |
69 | #include <linux/sched.h> /* TASK_INTERRUPTIBLE, set_current_state() and friends */ | 69 | #include <linux/sched.h> /* TASK_INTERRUPTIBLE, set_current_state() and friends */ |
70 | #include <asm/uaccess.h> | 70 | #include <linux/slab.h> /* For kmalloc */ |
71 | #include <asm/io.h> | ||
72 | 71 | ||
73 | #define WD_VER "1.16 (06/12/2004)" | 72 | #include <asm/uaccess.h> /* For copy_to_user/put_user/... */ |
74 | #define PFX "pcwd: " | 73 | #include <asm/io.h> /* For inb/outb/... */ |
74 | |||
75 | /* Module and version information */ | ||
76 | #define WATCHDOG_VERSION "1.16" | ||
77 | #define WATCHDOG_DATE "03 Jan 2006" | ||
78 | #define WATCHDOG_DRIVER_NAME "ISA-PC Watchdog" | ||
79 | #define WATCHDOG_NAME "pcwd" | ||
80 | #define PFX WATCHDOG_NAME ": " | ||
81 | #define DRIVER_VERSION WATCHDOG_DRIVER_NAME " driver, v" WATCHDOG_VERSION " (" WATCHDOG_DATE ")\n" | ||
82 | #define WD_VER WATCHDOG_VERSION " (" WATCHDOG_DATE ")" | ||
75 | 83 | ||
76 | /* | 84 | /* |
77 | * It should be noted that PCWD_REVISION_B was removed because A and B | 85 | * It should be noted that PCWD_REVISION_B was removed because A and B |
@@ -85,36 +93,38 @@ | |||
85 | 93 | ||
86 | /* | 94 | /* |
87 | * These are the defines that describe the control status bits for the | 95 | * These are the defines that describe the control status bits for the |
88 | * PC Watchdog card, revision A. | 96 | * PCI-PC Watchdog card. |
89 | */ | 97 | */ |
98 | /* Port 1 : Control Status #1 for the PC Watchdog card, revision A. */ | ||
90 | #define WD_WDRST 0x01 /* Previously reset state */ | 99 | #define WD_WDRST 0x01 /* Previously reset state */ |
91 | #define WD_T110 0x02 /* Temperature overheat sense */ | 100 | #define WD_T110 0x02 /* Temperature overheat sense */ |
92 | #define WD_HRTBT 0x04 /* Heartbeat sense */ | 101 | #define WD_HRTBT 0x04 /* Heartbeat sense */ |
93 | #define WD_RLY2 0x08 /* External relay triggered */ | 102 | #define WD_RLY2 0x08 /* External relay triggered */ |
94 | #define WD_SRLY2 0x80 /* Software external relay triggered */ | 103 | #define WD_SRLY2 0x80 /* Software external relay triggered */ |
95 | 104 | /* Port 1 : Control Status #1 for the PC Watchdog card, revision C. */ | |
96 | /* | ||
97 | * These are the defines that describe the control status bits for the | ||
98 | * PC Watchdog card, revision C. | ||
99 | */ | ||
100 | #define WD_REVC_WTRP 0x01 /* Watchdog Trip status */ | 105 | #define WD_REVC_WTRP 0x01 /* Watchdog Trip status */ |
101 | #define WD_REVC_HRBT 0x02 /* Watchdog Heartbeat */ | 106 | #define WD_REVC_HRBT 0x02 /* Watchdog Heartbeat */ |
102 | #define WD_REVC_TTRP 0x04 /* Temperature Trip status */ | 107 | #define WD_REVC_TTRP 0x04 /* Temperature Trip status */ |
108 | /* Port 2 : Control Status #2 */ | ||
109 | #define WD_WDIS 0x10 /* Watchdog Disabled */ | ||
110 | #define WD_ENTP 0x20 /* Watchdog Enable Temperature Trip */ | ||
111 | #define WD_SSEL 0x40 /* Watchdog Switch Select (1:SW1 <-> 0:SW2) */ | ||
112 | #define WD_WCMD 0x80 /* Watchdog Command Mode */ | ||
103 | 113 | ||
104 | /* max. time we give an ISA watchdog card to process a command */ | 114 | /* max. time we give an ISA watchdog card to process a command */ |
105 | /* 500ms for each 4 bit response (according to spec.) */ | 115 | /* 500ms for each 4 bit response (according to spec.) */ |
106 | #define ISA_COMMAND_TIMEOUT 1000 | 116 | #define ISA_COMMAND_TIMEOUT 1000 |
107 | 117 | ||
108 | /* Watchdog's internal commands */ | 118 | /* Watchdog's internal commands */ |
109 | #define CMD_ISA_IDLE 0x00 | 119 | #define CMD_ISA_IDLE 0x00 |
110 | #define CMD_ISA_VERSION_INTEGER 0x01 | 120 | #define CMD_ISA_VERSION_INTEGER 0x01 |
111 | #define CMD_ISA_VERSION_TENTH 0x02 | 121 | #define CMD_ISA_VERSION_TENTH 0x02 |
112 | #define CMD_ISA_VERSION_HUNDRETH 0x03 | 122 | #define CMD_ISA_VERSION_HUNDRETH 0x03 |
113 | #define CMD_ISA_VERSION_MINOR 0x04 | 123 | #define CMD_ISA_VERSION_MINOR 0x04 |
114 | #define CMD_ISA_SWITCH_SETTINGS 0x05 | 124 | #define CMD_ISA_SWITCH_SETTINGS 0x05 |
115 | #define CMD_ISA_DELAY_TIME_2SECS 0x0A | 125 | #define CMD_ISA_DELAY_TIME_2SECS 0x0A |
116 | #define CMD_ISA_DELAY_TIME_4SECS 0x0B | 126 | #define CMD_ISA_DELAY_TIME_4SECS 0x0B |
117 | #define CMD_ISA_DELAY_TIME_8SECS 0x0C | 127 | #define CMD_ISA_DELAY_TIME_8SECS 0x0C |
118 | 128 | ||
119 | /* | 129 | /* |
120 | * We are using an kernel timer to do the pinging of the watchdog | 130 | * We are using an kernel timer to do the pinging of the watchdog |
@@ -130,15 +140,17 @@ static int cards_found; | |||
130 | /* internal variables */ | 140 | /* internal variables */ |
131 | static atomic_t open_allowed = ATOMIC_INIT(1); | 141 | static atomic_t open_allowed = ATOMIC_INIT(1); |
132 | static char expect_close; | 142 | static char expect_close; |
133 | static struct timer_list timer; | ||
134 | static unsigned long next_heartbeat; | ||
135 | static int temp_panic; | 143 | static int temp_panic; |
136 | static int revision; /* The card's revision */ | 144 | static struct { /* this is private data for each ISA-PC watchdog card */ |
137 | static int supports_temp; /* Wether or not the card has a temperature device */ | 145 | int revision; /* The card's revision */ |
138 | static int command_mode; /* Wether or not the card is in command mode */ | 146 | int supports_temp; /* Wether or not the card has a temperature device */ |
139 | static int initial_status; /* The card's boot status */ | 147 | int command_mode; /* Wether or not the card is in command mode */ |
140 | static int current_readport; /* The cards I/O address */ | 148 | int boot_status; /* The card's boot status */ |
141 | static spinlock_t io_lock; | 149 | int io_addr; /* The cards I/O address */ |
150 | spinlock_t io_lock; /* the lock for io operations */ | ||
151 | struct timer_list timer; /* The timer that pings the watchdog */ | ||
152 | unsigned long next_heartbeat; /* the next_heartbeat for the timer */ | ||
153 | } pcwd_private; | ||
142 | 154 | ||
143 | /* module parameters */ | 155 | /* module parameters */ |
144 | #define WATCHDOG_HEARTBEAT 60 /* 60 sec default heartbeat */ | 156 | #define WATCHDOG_HEARTBEAT 60 /* 60 sec default heartbeat */ |
@@ -161,14 +173,14 @@ static int send_isa_command(int cmd) | |||
161 | int port0, last_port0; /* Double read for stabilising */ | 173 | int port0, last_port0; /* Double read for stabilising */ |
162 | 174 | ||
163 | /* The WCMD bit must be 1 and the command is only 4 bits in size */ | 175 | /* The WCMD bit must be 1 and the command is only 4 bits in size */ |
164 | control_status = (cmd & 0x0F) | 0x80; | 176 | control_status = (cmd & 0x0F) | WD_WCMD; |
165 | outb_p(control_status, current_readport + 2); | 177 | outb_p(control_status, pcwd_private.io_addr + 2); |
166 | udelay(ISA_COMMAND_TIMEOUT); | 178 | udelay(ISA_COMMAND_TIMEOUT); |
167 | 179 | ||
168 | port0 = inb_p(current_readport); | 180 | port0 = inb_p(pcwd_private.io_addr); |
169 | for (i = 0; i < 25; ++i) { | 181 | for (i = 0; i < 25; ++i) { |
170 | last_port0 = port0; | 182 | last_port0 = port0; |
171 | port0 = inb_p(current_readport); | 183 | port0 = inb_p(pcwd_private.io_addr); |
172 | 184 | ||
173 | if (port0 == last_port0) | 185 | if (port0 == last_port0) |
174 | break; /* Data is stable */ | 186 | break; /* Data is stable */ |
@@ -184,7 +196,7 @@ static int set_command_mode(void) | |||
184 | int i, found=0, count=0; | 196 | int i, found=0, count=0; |
185 | 197 | ||
186 | /* Set the card into command mode */ | 198 | /* Set the card into command mode */ |
187 | spin_lock(&io_lock); | 199 | spin_lock(&pcwd_private.io_lock); |
188 | while ((!found) && (count < 3)) { | 200 | while ((!found) && (count < 3)) { |
189 | i = send_isa_command(CMD_ISA_IDLE); | 201 | i = send_isa_command(CMD_ISA_IDLE); |
190 | 202 | ||
@@ -192,15 +204,15 @@ static int set_command_mode(void) | |||
192 | found = 1; | 204 | found = 1; |
193 | else if (i == 0xF3) { | 205 | else if (i == 0xF3) { |
194 | /* Card does not like what we've done to it */ | 206 | /* Card does not like what we've done to it */ |
195 | outb_p(0x00, current_readport + 2); | 207 | outb_p(0x00, pcwd_private.io_addr + 2); |
196 | udelay(1200); /* Spec says wait 1ms */ | 208 | udelay(1200); /* Spec says wait 1ms */ |
197 | outb_p(0x00, current_readport + 2); | 209 | outb_p(0x00, pcwd_private.io_addr + 2); |
198 | udelay(ISA_COMMAND_TIMEOUT); | 210 | udelay(ISA_COMMAND_TIMEOUT); |
199 | } | 211 | } |
200 | count++; | 212 | count++; |
201 | } | 213 | } |
202 | spin_unlock(&io_lock); | 214 | spin_unlock(&pcwd_private.io_lock); |
203 | command_mode = found; | 215 | pcwd_private.command_mode = found; |
204 | 216 | ||
205 | return(found); | 217 | return(found); |
206 | } | 218 | } |
@@ -208,12 +220,95 @@ static int set_command_mode(void) | |||
208 | static void unset_command_mode(void) | 220 | static void unset_command_mode(void) |
209 | { | 221 | { |
210 | /* Set the card into normal mode */ | 222 | /* Set the card into normal mode */ |
211 | spin_lock(&io_lock); | 223 | spin_lock(&pcwd_private.io_lock); |
212 | outb_p(0x00, current_readport + 2); | 224 | outb_p(0x00, pcwd_private.io_addr + 2); |
213 | udelay(ISA_COMMAND_TIMEOUT); | 225 | udelay(ISA_COMMAND_TIMEOUT); |
214 | spin_unlock(&io_lock); | 226 | spin_unlock(&pcwd_private.io_lock); |
227 | |||
228 | pcwd_private.command_mode = 0; | ||
229 | } | ||
230 | |||
231 | static inline void pcwd_check_temperature_support(void) | ||
232 | { | ||
233 | if (inb(pcwd_private.io_addr) != 0xF0) | ||
234 | pcwd_private.supports_temp = 1; | ||
235 | } | ||
236 | |||
237 | static inline char *get_firmware(void) | ||
238 | { | ||
239 | int one, ten, hund, minor; | ||
240 | char *ret; | ||
241 | |||
242 | ret = kmalloc(6, GFP_KERNEL); | ||
243 | if(ret == NULL) | ||
244 | return NULL; | ||
245 | |||
246 | if (set_command_mode()) { | ||
247 | one = send_isa_command(CMD_ISA_VERSION_INTEGER); | ||
248 | ten = send_isa_command(CMD_ISA_VERSION_TENTH); | ||
249 | hund = send_isa_command(CMD_ISA_VERSION_HUNDRETH); | ||
250 | minor = send_isa_command(CMD_ISA_VERSION_MINOR); | ||
251 | sprintf(ret, "%c.%c%c%c", one, ten, hund, minor); | ||
252 | } | ||
253 | else | ||
254 | sprintf(ret, "ERROR"); | ||
255 | |||
256 | unset_command_mode(); | ||
257 | return(ret); | ||
258 | } | ||
259 | |||
260 | static inline int pcwd_get_option_switches(void) | ||
261 | { | ||
262 | int option_switches=0; | ||
263 | |||
264 | if (set_command_mode()) { | ||
265 | /* Get switch settings */ | ||
266 | option_switches = send_isa_command(CMD_ISA_SWITCH_SETTINGS); | ||
267 | } | ||
268 | |||
269 | unset_command_mode(); | ||
270 | return(option_switches); | ||
271 | } | ||
272 | |||
273 | static void pcwd_show_card_info(void) | ||
274 | { | ||
275 | char *firmware; | ||
276 | int option_switches; | ||
277 | |||
278 | /* Get some extra info from the hardware (in command/debug/diag mode) */ | ||
279 | if (pcwd_private.revision == PCWD_REVISION_A) | ||
280 | printk(KERN_INFO PFX "ISA-PC Watchdog (REV.A) detected at port 0x%04x\n", pcwd_private.io_addr); | ||
281 | else if (pcwd_private.revision == PCWD_REVISION_C) { | ||
282 | firmware = get_firmware(); | ||
283 | printk(KERN_INFO PFX "ISA-PC Watchdog (REV.C) detected at port 0x%04x (Firmware version: %s)\n", | ||
284 | pcwd_private.io_addr, firmware); | ||
285 | kfree(firmware); | ||
286 | option_switches = pcwd_get_option_switches(); | ||
287 | printk(KERN_INFO PFX "Option switches (0x%02x): Temperature Reset Enable=%s, Power On Delay=%s\n", | ||
288 | option_switches, | ||
289 | ((option_switches & 0x10) ? "ON" : "OFF"), | ||
290 | ((option_switches & 0x08) ? "ON" : "OFF")); | ||
291 | |||
292 | /* Reprogram internal heartbeat to 2 seconds */ | ||
293 | if (set_command_mode()) { | ||
294 | send_isa_command(CMD_ISA_DELAY_TIME_2SECS); | ||
295 | unset_command_mode(); | ||
296 | } | ||
297 | } | ||
298 | |||
299 | if (pcwd_private.supports_temp) | ||
300 | printk(KERN_INFO PFX "Temperature Option Detected\n"); | ||
301 | |||
302 | if (pcwd_private.boot_status & WDIOF_CARDRESET) | ||
303 | printk(KERN_INFO PFX "Previous reboot was caused by the card\n"); | ||
304 | |||
305 | if (pcwd_private.boot_status & WDIOF_OVERHEAT) { | ||
306 | printk(KERN_EMERG PFX "Card senses a CPU Overheat. Panicking!\n"); | ||
307 | printk(KERN_EMERG PFX "CPU Overheat\n"); | ||
308 | } | ||
215 | 309 | ||
216 | command_mode = 0; | 310 | if (pcwd_private.boot_status == 0) |
311 | printk(KERN_INFO PFX "No previous trip detected - Cold boot or reset\n"); | ||
217 | } | 312 | } |
218 | 313 | ||
219 | static void pcwd_timer_ping(unsigned long data) | 314 | static void pcwd_timer_ping(unsigned long data) |
@@ -222,25 +317,25 @@ static void pcwd_timer_ping(unsigned long data) | |||
222 | 317 | ||
223 | /* If we got a heartbeat pulse within the WDT_INTERVAL | 318 | /* If we got a heartbeat pulse within the WDT_INTERVAL |
224 | * we agree to ping the WDT */ | 319 | * we agree to ping the WDT */ |
225 | if(time_before(jiffies, next_heartbeat)) { | 320 | if(time_before(jiffies, pcwd_private.next_heartbeat)) { |
226 | /* Ping the watchdog */ | 321 | /* Ping the watchdog */ |
227 | spin_lock(&io_lock); | 322 | spin_lock(&pcwd_private.io_lock); |
228 | if (revision == PCWD_REVISION_A) { | 323 | if (pcwd_private.revision == PCWD_REVISION_A) { |
229 | /* Rev A cards are reset by setting the WD_WDRST bit in register 1 */ | 324 | /* Rev A cards are reset by setting the WD_WDRST bit in register 1 */ |
230 | wdrst_stat = inb_p(current_readport); | 325 | wdrst_stat = inb_p(pcwd_private.io_addr); |
231 | wdrst_stat &= 0x0F; | 326 | wdrst_stat &= 0x0F; |
232 | wdrst_stat |= WD_WDRST; | 327 | wdrst_stat |= WD_WDRST; |
233 | 328 | ||
234 | outb_p(wdrst_stat, current_readport + 1); | 329 | outb_p(wdrst_stat, pcwd_private.io_addr + 1); |
235 | } else { | 330 | } else { |
236 | /* Re-trigger watchdog by writing to port 0 */ | 331 | /* Re-trigger watchdog by writing to port 0 */ |
237 | outb_p(0x00, current_readport); | 332 | outb_p(0x00, pcwd_private.io_addr); |
238 | } | 333 | } |
239 | 334 | ||
240 | /* Re-set the timer interval */ | 335 | /* Re-set the timer interval */ |
241 | mod_timer(&timer, jiffies + WDT_INTERVAL); | 336 | mod_timer(&pcwd_private.timer, jiffies + WDT_INTERVAL); |
242 | 337 | ||
243 | spin_unlock(&io_lock); | 338 | spin_unlock(&pcwd_private.io_lock); |
244 | } else { | 339 | } else { |
245 | printk(KERN_WARNING PFX "Heartbeat lost! Will not ping the watchdog\n"); | 340 | printk(KERN_WARNING PFX "Heartbeat lost! Will not ping the watchdog\n"); |
246 | } | 341 | } |
@@ -250,19 +345,19 @@ static int pcwd_start(void) | |||
250 | { | 345 | { |
251 | int stat_reg; | 346 | int stat_reg; |
252 | 347 | ||
253 | next_heartbeat = jiffies + (heartbeat * HZ); | 348 | pcwd_private.next_heartbeat = jiffies + (heartbeat * HZ); |
254 | 349 | ||
255 | /* Start the timer */ | 350 | /* Start the timer */ |
256 | mod_timer(&timer, jiffies + WDT_INTERVAL); | 351 | mod_timer(&pcwd_private.timer, jiffies + WDT_INTERVAL); |
257 | 352 | ||
258 | /* Enable the port */ | 353 | /* Enable the port */ |
259 | if (revision == PCWD_REVISION_C) { | 354 | if (pcwd_private.revision == PCWD_REVISION_C) { |
260 | spin_lock(&io_lock); | 355 | spin_lock(&pcwd_private.io_lock); |
261 | outb_p(0x00, current_readport + 3); | 356 | outb_p(0x00, pcwd_private.io_addr + 3); |
262 | udelay(ISA_COMMAND_TIMEOUT); | 357 | udelay(ISA_COMMAND_TIMEOUT); |
263 | stat_reg = inb_p(current_readport + 2); | 358 | stat_reg = inb_p(pcwd_private.io_addr + 2); |
264 | spin_unlock(&io_lock); | 359 | spin_unlock(&pcwd_private.io_lock); |
265 | if (stat_reg & 0x10) { | 360 | if (stat_reg & WD_WDIS) { |
266 | printk(KERN_INFO PFX "Could not start watchdog\n"); | 361 | printk(KERN_INFO PFX "Could not start watchdog\n"); |
267 | return -EIO; | 362 | return -EIO; |
268 | } | 363 | } |
@@ -275,18 +370,18 @@ static int pcwd_stop(void) | |||
275 | int stat_reg; | 370 | int stat_reg; |
276 | 371 | ||
277 | /* Stop the timer */ | 372 | /* Stop the timer */ |
278 | del_timer(&timer); | 373 | del_timer(&pcwd_private.timer); |
279 | 374 | ||
280 | /* Disable the board */ | 375 | /* Disable the board */ |
281 | if (revision == PCWD_REVISION_C) { | 376 | if (pcwd_private.revision == PCWD_REVISION_C) { |
282 | spin_lock(&io_lock); | 377 | spin_lock(&pcwd_private.io_lock); |
283 | outb_p(0xA5, current_readport + 3); | 378 | outb_p(0xA5, pcwd_private.io_addr + 3); |
284 | udelay(ISA_COMMAND_TIMEOUT); | 379 | udelay(ISA_COMMAND_TIMEOUT); |
285 | outb_p(0xA5, current_readport + 3); | 380 | outb_p(0xA5, pcwd_private.io_addr + 3); |
286 | udelay(ISA_COMMAND_TIMEOUT); | 381 | udelay(ISA_COMMAND_TIMEOUT); |
287 | stat_reg = inb_p(current_readport + 2); | 382 | stat_reg = inb_p(pcwd_private.io_addr + 2); |
288 | spin_unlock(&io_lock); | 383 | spin_unlock(&pcwd_private.io_lock); |
289 | if ((stat_reg & 0x10) == 0) { | 384 | if ((stat_reg & WD_WDIS) == 0) { |
290 | printk(KERN_INFO PFX "Could not stop watchdog\n"); | 385 | printk(KERN_INFO PFX "Could not stop watchdog\n"); |
291 | return -EIO; | 386 | return -EIO; |
292 | } | 387 | } |
@@ -297,7 +392,7 @@ static int pcwd_stop(void) | |||
297 | static int pcwd_keepalive(void) | 392 | static int pcwd_keepalive(void) |
298 | { | 393 | { |
299 | /* user land ping */ | 394 | /* user land ping */ |
300 | next_heartbeat = jiffies + (heartbeat * HZ); | 395 | pcwd_private.next_heartbeat = jiffies + (heartbeat * HZ); |
301 | return 0; | 396 | return 0; |
302 | } | 397 | } |
303 | 398 | ||
@@ -315,23 +410,23 @@ static int pcwd_get_status(int *status) | |||
315 | int card_status; | 410 | int card_status; |
316 | 411 | ||
317 | *status=0; | 412 | *status=0; |
318 | spin_lock(&io_lock); | 413 | spin_lock(&pcwd_private.io_lock); |
319 | if (revision == PCWD_REVISION_A) | 414 | if (pcwd_private.revision == PCWD_REVISION_A) |
320 | /* Rev A cards return status information from | 415 | /* Rev A cards return status information from |
321 | * the base register, which is used for the | 416 | * the base register, which is used for the |
322 | * temperature in other cards. */ | 417 | * temperature in other cards. */ |
323 | card_status = inb(current_readport); | 418 | card_status = inb(pcwd_private.io_addr); |
324 | else { | 419 | else { |
325 | /* Rev C cards return card status in the base | 420 | /* Rev C cards return card status in the base |
326 | * address + 1 register. And use different bits | 421 | * address + 1 register. And use different bits |
327 | * to indicate a card initiated reset, and an | 422 | * to indicate a card initiated reset, and an |
328 | * over-temperature condition. And the reboot | 423 | * over-temperature condition. And the reboot |
329 | * status can be reset. */ | 424 | * status can be reset. */ |
330 | card_status = inb(current_readport + 1); | 425 | card_status = inb(pcwd_private.io_addr + 1); |
331 | } | 426 | } |
332 | spin_unlock(&io_lock); | 427 | spin_unlock(&pcwd_private.io_lock); |
333 | 428 | ||
334 | if (revision == PCWD_REVISION_A) { | 429 | if (pcwd_private.revision == PCWD_REVISION_A) { |
335 | if (card_status & WD_WDRST) | 430 | if (card_status & WD_WDRST) |
336 | *status |= WDIOF_CARDRESET; | 431 | *status |= WDIOF_CARDRESET; |
337 | 432 | ||
@@ -360,10 +455,10 @@ static int pcwd_get_status(int *status) | |||
360 | 455 | ||
361 | static int pcwd_clear_status(void) | 456 | static int pcwd_clear_status(void) |
362 | { | 457 | { |
363 | if (revision == PCWD_REVISION_C) { | 458 | if (pcwd_private.revision == PCWD_REVISION_C) { |
364 | spin_lock(&io_lock); | 459 | spin_lock(&pcwd_private.io_lock); |
365 | outb_p(0x00, current_readport + 1); /* clear reset status */ | 460 | outb_p(0x00, pcwd_private.io_addr + 1); /* clear reset status */ |
366 | spin_unlock(&io_lock); | 461 | spin_unlock(&pcwd_private.io_lock); |
367 | } | 462 | } |
368 | return 0; | 463 | return 0; |
369 | } | 464 | } |
@@ -371,20 +466,20 @@ static int pcwd_clear_status(void) | |||
371 | static int pcwd_get_temperature(int *temperature) | 466 | static int pcwd_get_temperature(int *temperature) |
372 | { | 467 | { |
373 | /* check that port 0 gives temperature info and no command results */ | 468 | /* check that port 0 gives temperature info and no command results */ |
374 | if (command_mode) | 469 | if (pcwd_private.command_mode) |
375 | return -1; | 470 | return -1; |
376 | 471 | ||
377 | *temperature = 0; | 472 | *temperature = 0; |
378 | if (!supports_temp) | 473 | if (!pcwd_private.supports_temp) |
379 | return -ENODEV; | 474 | return -ENODEV; |
380 | 475 | ||
381 | /* | 476 | /* |
382 | * Convert celsius to fahrenheit, since this was | 477 | * Convert celsius to fahrenheit, since this was |
383 | * the decided 'standard' for this return value. | 478 | * the decided 'standard' for this return value. |
384 | */ | 479 | */ |
385 | spin_lock(&io_lock); | 480 | spin_lock(&pcwd_private.io_lock); |
386 | *temperature = ((inb(current_readport)) * 9 / 5) + 32; | 481 | *temperature = ((inb(pcwd_private.io_addr)) * 9 / 5) + 32; |
387 | spin_unlock(&io_lock); | 482 | spin_unlock(&pcwd_private.io_lock); |
388 | 483 | ||
389 | return 0; | 484 | return 0; |
390 | } | 485 | } |
@@ -425,7 +520,7 @@ static int pcwd_ioctl(struct inode *inode, struct file *file, | |||
425 | return put_user(status, argp); | 520 | return put_user(status, argp); |
426 | 521 | ||
427 | case WDIOC_GETBOOTSTATUS: | 522 | case WDIOC_GETBOOTSTATUS: |
428 | return put_user(initial_status, argp); | 523 | return put_user(pcwd_private.boot_status, argp); |
429 | 524 | ||
430 | case WDIOC_GETTEMP: | 525 | case WDIOC_GETTEMP: |
431 | if (pcwd_get_temperature(&temperature)) | 526 | if (pcwd_get_temperature(&temperature)) |
@@ -434,7 +529,7 @@ static int pcwd_ioctl(struct inode *inode, struct file *file, | |||
434 | return put_user(temperature, argp); | 529 | return put_user(temperature, argp); |
435 | 530 | ||
436 | case WDIOC_SETOPTIONS: | 531 | case WDIOC_SETOPTIONS: |
437 | if (revision == PCWD_REVISION_C) | 532 | if (pcwd_private.revision == PCWD_REVISION_C) |
438 | { | 533 | { |
439 | if(copy_from_user(&rv, argp, sizeof(int))) | 534 | if(copy_from_user(&rv, argp, sizeof(int))) |
440 | return -EFAULT; | 535 | return -EFAULT; |
@@ -550,7 +645,7 @@ static ssize_t pcwd_temp_read(struct file *file, char __user *buf, size_t count, | |||
550 | 645 | ||
551 | static int pcwd_temp_open(struct inode *inode, struct file *file) | 646 | static int pcwd_temp_open(struct inode *inode, struct file *file) |
552 | { | 647 | { |
553 | if (!supports_temp) | 648 | if (!pcwd_private.supports_temp) |
554 | return -ENODEV; | 649 | return -ENODEV; |
555 | 650 | ||
556 | return nonseekable_open(inode, file); | 651 | return nonseekable_open(inode, file); |
@@ -616,68 +711,24 @@ static struct notifier_block pcwd_notifier = { | |||
616 | * Init & exit routines | 711 | * Init & exit routines |
617 | */ | 712 | */ |
618 | 713 | ||
619 | static inline void get_support(void) | ||
620 | { | ||
621 | if (inb(current_readport) != 0xF0) | ||
622 | supports_temp = 1; | ||
623 | } | ||
624 | |||
625 | static inline int get_revision(void) | 714 | static inline int get_revision(void) |
626 | { | 715 | { |
627 | int r = PCWD_REVISION_C; | 716 | int r = PCWD_REVISION_C; |
628 | 717 | ||
629 | spin_lock(&io_lock); | 718 | spin_lock(&pcwd_private.io_lock); |
630 | /* REV A cards use only 2 io ports; test | 719 | /* REV A cards use only 2 io ports; test |
631 | * presumes a floating bus reads as 0xff. */ | 720 | * presumes a floating bus reads as 0xff. */ |
632 | if ((inb(current_readport + 2) == 0xFF) || | 721 | if ((inb(pcwd_private.io_addr + 2) == 0xFF) || |
633 | (inb(current_readport + 3) == 0xFF)) | 722 | (inb(pcwd_private.io_addr + 3) == 0xFF)) |
634 | r=PCWD_REVISION_A; | 723 | r=PCWD_REVISION_A; |
635 | spin_unlock(&io_lock); | 724 | spin_unlock(&pcwd_private.io_lock); |
636 | 725 | ||
637 | return r; | 726 | return r; |
638 | } | 727 | } |
639 | 728 | ||
640 | static inline char *get_firmware(void) | ||
641 | { | ||
642 | int one, ten, hund, minor; | ||
643 | char *ret; | ||
644 | |||
645 | ret = kmalloc(6, GFP_KERNEL); | ||
646 | if(ret == NULL) | ||
647 | return NULL; | ||
648 | |||
649 | if (set_command_mode()) { | ||
650 | one = send_isa_command(CMD_ISA_VERSION_INTEGER); | ||
651 | ten = send_isa_command(CMD_ISA_VERSION_TENTH); | ||
652 | hund = send_isa_command(CMD_ISA_VERSION_HUNDRETH); | ||
653 | minor = send_isa_command(CMD_ISA_VERSION_MINOR); | ||
654 | sprintf(ret, "%c.%c%c%c", one, ten, hund, minor); | ||
655 | } | ||
656 | else | ||
657 | sprintf(ret, "ERROR"); | ||
658 | |||
659 | unset_command_mode(); | ||
660 | return(ret); | ||
661 | } | ||
662 | |||
663 | static inline int get_option_switches(void) | ||
664 | { | ||
665 | int rv=0; | ||
666 | |||
667 | if (set_command_mode()) { | ||
668 | /* Get switch settings */ | ||
669 | rv = send_isa_command(CMD_ISA_SWITCH_SETTINGS); | ||
670 | } | ||
671 | |||
672 | unset_command_mode(); | ||
673 | return(rv); | ||
674 | } | ||
675 | |||
676 | static int __devinit pcwatchdog_init(int base_addr) | 729 | static int __devinit pcwatchdog_init(int base_addr) |
677 | { | 730 | { |
678 | int ret; | 731 | int ret; |
679 | char *firmware; | ||
680 | int option_switches; | ||
681 | 732 | ||
682 | cards_found++; | 733 | cards_found++; |
683 | if (cards_found == 1) | 734 | if (cards_found == 1) |
@@ -692,104 +743,66 @@ static int __devinit pcwatchdog_init(int base_addr) | |||
692 | printk(KERN_ERR PFX "No I/O-Address for card detected\n"); | 743 | printk(KERN_ERR PFX "No I/O-Address for card detected\n"); |
693 | return -ENODEV; | 744 | return -ENODEV; |
694 | } | 745 | } |
695 | current_readport = base_addr; | 746 | pcwd_private.io_addr = base_addr; |
696 | 747 | ||
697 | /* Check card's revision */ | 748 | /* Check card's revision */ |
698 | revision = get_revision(); | 749 | pcwd_private.revision = get_revision(); |
699 | 750 | ||
700 | if (!request_region(current_readport, (revision == PCWD_REVISION_A) ? 2 : 4, "PCWD")) { | 751 | if (!request_region(pcwd_private.io_addr, (pcwd_private.revision == PCWD_REVISION_A) ? 2 : 4, "PCWD")) { |
701 | printk(KERN_ERR PFX "I/O address 0x%04x already in use\n", | 752 | printk(KERN_ERR PFX "I/O address 0x%04x already in use\n", |
702 | current_readport); | 753 | pcwd_private.io_addr); |
703 | current_readport = 0x0000; | 754 | pcwd_private.io_addr = 0x0000; |
704 | return -EIO; | 755 | return -EIO; |
705 | } | 756 | } |
706 | 757 | ||
707 | /* Initial variables */ | 758 | /* Initial variables */ |
708 | supports_temp = 0; | 759 | pcwd_private.supports_temp = 0; |
709 | temp_panic = 0; | 760 | temp_panic = 0; |
710 | initial_status = 0x0000; | 761 | pcwd_private.boot_status = 0x0000; |
711 | 762 | ||
712 | /* get the boot_status */ | 763 | /* get the boot_status */ |
713 | pcwd_get_status(&initial_status); | 764 | pcwd_get_status(&pcwd_private.boot_status); |
714 | 765 | ||
715 | /* clear the "card caused reboot" flag */ | 766 | /* clear the "card caused reboot" flag */ |
716 | pcwd_clear_status(); | 767 | pcwd_clear_status(); |
717 | 768 | ||
718 | init_timer(&timer); | 769 | init_timer(&pcwd_private.timer); |
719 | timer.function = pcwd_timer_ping; | 770 | pcwd_private.timer.function = pcwd_timer_ping; |
720 | timer.data = 0; | 771 | pcwd_private.timer.data = 0; |
721 | 772 | ||
722 | /* Disable the board */ | 773 | /* Disable the board */ |
723 | pcwd_stop(); | 774 | pcwd_stop(); |
724 | 775 | ||
725 | /* Check whether or not the card supports the temperature device */ | 776 | /* Check whether or not the card supports the temperature device */ |
726 | get_support(); | 777 | pcwd_check_temperature_support(); |
727 | |||
728 | /* Get some extra info from the hardware (in command/debug/diag mode) */ | ||
729 | if (revision == PCWD_REVISION_A) | ||
730 | printk(KERN_INFO PFX "ISA-PC Watchdog (REV.A) detected at port 0x%04x\n", current_readport); | ||
731 | else if (revision == PCWD_REVISION_C) { | ||
732 | firmware = get_firmware(); | ||
733 | printk(KERN_INFO PFX "ISA-PC Watchdog (REV.C) detected at port 0x%04x (Firmware version: %s)\n", | ||
734 | current_readport, firmware); | ||
735 | kfree(firmware); | ||
736 | option_switches = get_option_switches(); | ||
737 | printk(KERN_INFO PFX "Option switches (0x%02x): Temperature Reset Enable=%s, Power On Delay=%s\n", | ||
738 | option_switches, | ||
739 | ((option_switches & 0x10) ? "ON" : "OFF"), | ||
740 | ((option_switches & 0x08) ? "ON" : "OFF")); | ||
741 | |||
742 | /* Reprogram internal heartbeat to 2 seconds */ | ||
743 | if (set_command_mode()) { | ||
744 | send_isa_command(CMD_ISA_DELAY_TIME_2SECS); | ||
745 | unset_command_mode(); | ||
746 | } | ||
747 | } else { | ||
748 | /* Should NEVER happen, unless get_revision() fails. */ | ||
749 | printk(KERN_INFO PFX "Unable to get revision\n"); | ||
750 | release_region(current_readport, (revision == PCWD_REVISION_A) ? 2 : 4); | ||
751 | current_readport = 0x0000; | ||
752 | return -1; | ||
753 | } | ||
754 | 778 | ||
755 | if (supports_temp) | 779 | /* Show info about the card itself */ |
756 | printk(KERN_INFO PFX "Temperature Option Detected\n"); | 780 | pcwd_show_card_info(); |
757 | |||
758 | if (initial_status & WDIOF_CARDRESET) | ||
759 | printk(KERN_INFO PFX "Previous reboot was caused by the card\n"); | ||
760 | |||
761 | if (initial_status & WDIOF_OVERHEAT) { | ||
762 | printk(KERN_EMERG PFX "Card senses a CPU Overheat. Panicking!\n"); | ||
763 | printk(KERN_EMERG PFX "CPU Overheat\n"); | ||
764 | } | ||
765 | |||
766 | if (initial_status == 0) | ||
767 | printk(KERN_INFO PFX "No previous trip detected - Cold boot or reset\n"); | ||
768 | 781 | ||
769 | /* Check that the heartbeat value is within it's range ; if not reset to the default */ | 782 | /* Check that the heartbeat value is within it's range ; if not reset to the default */ |
770 | if (pcwd_set_heartbeat(heartbeat)) { | 783 | if (pcwd_set_heartbeat(heartbeat)) { |
771 | pcwd_set_heartbeat(WATCHDOG_HEARTBEAT); | 784 | pcwd_set_heartbeat(WATCHDOG_HEARTBEAT); |
772 | printk(KERN_INFO PFX "heartbeat value must be 2<=heartbeat<=7200, using %d\n", | 785 | printk(KERN_INFO PFX "heartbeat value must be 2<=heartbeat<=7200, using %d\n", |
773 | WATCHDOG_HEARTBEAT); | 786 | WATCHDOG_HEARTBEAT); |
774 | } | 787 | } |
775 | 788 | ||
776 | ret = register_reboot_notifier(&pcwd_notifier); | 789 | ret = register_reboot_notifier(&pcwd_notifier); |
777 | if (ret) { | 790 | if (ret) { |
778 | printk(KERN_ERR PFX "cannot register reboot notifier (err=%d)\n", | 791 | printk(KERN_ERR PFX "cannot register reboot notifier (err=%d)\n", |
779 | ret); | 792 | ret); |
780 | release_region(current_readport, (revision == PCWD_REVISION_A) ? 2 : 4); | 793 | release_region(pcwd_private.io_addr, (pcwd_private.revision == PCWD_REVISION_A) ? 2 : 4); |
781 | current_readport = 0x0000; | 794 | pcwd_private.io_addr = 0x0000; |
782 | return ret; | 795 | return ret; |
783 | } | 796 | } |
784 | 797 | ||
785 | if (supports_temp) { | 798 | if (pcwd_private.supports_temp) { |
786 | ret = misc_register(&temp_miscdev); | 799 | ret = misc_register(&temp_miscdev); |
787 | if (ret) { | 800 | if (ret) { |
788 | printk(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n", | 801 | printk(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n", |
789 | TEMP_MINOR, ret); | 802 | TEMP_MINOR, ret); |
790 | unregister_reboot_notifier(&pcwd_notifier); | 803 | unregister_reboot_notifier(&pcwd_notifier); |
791 | release_region(current_readport, (revision == PCWD_REVISION_A) ? 2 : 4); | 804 | release_region(pcwd_private.io_addr, (pcwd_private.revision == PCWD_REVISION_A) ? 2 : 4); |
792 | current_readport = 0x0000; | 805 | pcwd_private.io_addr = 0x0000; |
793 | return ret; | 806 | return ret; |
794 | } | 807 | } |
795 | } | 808 | } |
@@ -798,11 +811,11 @@ static int __devinit pcwatchdog_init(int base_addr) | |||
798 | if (ret) { | 811 | if (ret) { |
799 | printk(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n", | 812 | printk(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n", |
800 | WATCHDOG_MINOR, ret); | 813 | WATCHDOG_MINOR, ret); |
801 | if (supports_temp) | 814 | if (pcwd_private.supports_temp) |
802 | misc_deregister(&temp_miscdev); | 815 | misc_deregister(&temp_miscdev); |
803 | unregister_reboot_notifier(&pcwd_notifier); | 816 | unregister_reboot_notifier(&pcwd_notifier); |
804 | release_region(current_readport, (revision == PCWD_REVISION_A) ? 2 : 4); | 817 | release_region(pcwd_private.io_addr, (pcwd_private.revision == PCWD_REVISION_A) ? 2 : 4); |
805 | current_readport = 0x0000; | 818 | pcwd_private.io_addr = 0x0000; |
806 | return ret; | 819 | return ret; |
807 | } | 820 | } |
808 | 821 | ||
@@ -820,11 +833,12 @@ static void __devexit pcwatchdog_exit(void) | |||
820 | 833 | ||
821 | /* Deregister */ | 834 | /* Deregister */ |
822 | misc_deregister(&pcwd_miscdev); | 835 | misc_deregister(&pcwd_miscdev); |
823 | if (supports_temp) | 836 | if (pcwd_private.supports_temp) |
824 | misc_deregister(&temp_miscdev); | 837 | misc_deregister(&temp_miscdev); |
825 | unregister_reboot_notifier(&pcwd_notifier); | 838 | unregister_reboot_notifier(&pcwd_notifier); |
826 | release_region(current_readport, (revision == PCWD_REVISION_A) ? 2 : 4); | 839 | release_region(pcwd_private.io_addr, (pcwd_private.revision == PCWD_REVISION_A) ? 2 : 4); |
827 | current_readport = 0x0000; | 840 | pcwd_private.io_addr = 0x0000; |
841 | cards_found--; | ||
828 | } | 842 | } |
829 | 843 | ||
830 | /* | 844 | /* |
@@ -887,7 +901,7 @@ static int __init pcwd_init_module(void) | |||
887 | { | 901 | { |
888 | int i, found = 0; | 902 | int i, found = 0; |
889 | 903 | ||
890 | spin_lock_init(&io_lock); | 904 | spin_lock_init(&pcwd_private.io_lock); |
891 | 905 | ||
892 | for (i = 0; pcwd_ioports[i] != 0; i++) { | 906 | for (i = 0; pcwd_ioports[i] != 0; i++) { |
893 | if (pcwd_checkcard(pcwd_ioports[i])) { | 907 | if (pcwd_checkcard(pcwd_ioports[i])) { |
@@ -906,7 +920,7 @@ static int __init pcwd_init_module(void) | |||
906 | 920 | ||
907 | static void __exit pcwd_cleanup_module(void) | 921 | static void __exit pcwd_cleanup_module(void) |
908 | { | 922 | { |
909 | if (current_readport) | 923 | if (pcwd_private.io_addr) |
910 | pcwatchdog_exit(); | 924 | pcwatchdog_exit(); |
911 | return; | 925 | return; |
912 | } | 926 | } |
diff --git a/drivers/char/watchdog/sa1100_wdt.c b/drivers/char/watchdog/sa1100_wdt.c index b474ea52d6e8..522a9370db94 100644 --- a/drivers/char/watchdog/sa1100_wdt.c +++ b/drivers/char/watchdog/sa1100_wdt.c | |||
@@ -93,23 +93,25 @@ static int sa1100dog_ioctl(struct inode *inode, struct file *file, | |||
93 | { | 93 | { |
94 | int ret = -ENOIOCTLCMD; | 94 | int ret = -ENOIOCTLCMD; |
95 | int time; | 95 | int time; |
96 | void __user *argp = (void __user *)arg; | ||
97 | int __user *p = argp; | ||
96 | 98 | ||
97 | switch (cmd) { | 99 | switch (cmd) { |
98 | case WDIOC_GETSUPPORT: | 100 | case WDIOC_GETSUPPORT: |
99 | ret = copy_to_user((struct watchdog_info __user *)arg, &ident, | 101 | ret = copy_to_user(argp, &ident, |
100 | sizeof(ident)) ? -EFAULT : 0; | 102 | sizeof(ident)) ? -EFAULT : 0; |
101 | break; | 103 | break; |
102 | 104 | ||
103 | case WDIOC_GETSTATUS: | 105 | case WDIOC_GETSTATUS: |
104 | ret = put_user(0, (int __user *)arg); | 106 | ret = put_user(0, p); |
105 | break; | 107 | break; |
106 | 108 | ||
107 | case WDIOC_GETBOOTSTATUS: | 109 | case WDIOC_GETBOOTSTATUS: |
108 | ret = put_user(boot_status, (int __user *)arg); | 110 | ret = put_user(boot_status, p); |
109 | break; | 111 | break; |
110 | 112 | ||
111 | case WDIOC_SETTIMEOUT: | 113 | case WDIOC_SETTIMEOUT: |
112 | ret = get_user(time, (int __user *)arg); | 114 | ret = get_user(time, p); |
113 | if (ret) | 115 | if (ret) |
114 | break; | 116 | break; |
115 | 117 | ||
@@ -123,7 +125,7 @@ static int sa1100dog_ioctl(struct inode *inode, struct file *file, | |||
123 | /*fall through*/ | 125 | /*fall through*/ |
124 | 126 | ||
125 | case WDIOC_GETTIMEOUT: | 127 | case WDIOC_GETTIMEOUT: |
126 | ret = put_user(pre_margin / OSCR_FREQ, (int __user *)arg); | 128 | ret = put_user(pre_margin / OSCR_FREQ, p); |
127 | break; | 129 | break; |
128 | 130 | ||
129 | case WDIOC_KEEPALIVE: | 131 | case WDIOC_KEEPALIVE: |
diff --git a/drivers/char/watchdog/sbc_epx_c3.c b/drivers/char/watchdog/sbc_epx_c3.c index 951764614ebf..837b1ec3ffe3 100644 --- a/drivers/char/watchdog/sbc_epx_c3.c +++ b/drivers/char/watchdog/sbc_epx_c3.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/notifier.h> | 25 | #include <linux/notifier.h> |
26 | #include <linux/reboot.h> | 26 | #include <linux/reboot.h> |
27 | #include <linux/init.h> | 27 | #include <linux/init.h> |
28 | #include <linux/ioport.h> | ||
28 | #include <asm/uaccess.h> | 29 | #include <asm/uaccess.h> |
29 | #include <asm/io.h> | 30 | #include <asm/io.h> |
30 | 31 | ||
@@ -91,7 +92,7 @@ static int epx_c3_release(struct inode *inode, struct file *file) | |||
91 | return 0; | 92 | return 0; |
92 | } | 93 | } |
93 | 94 | ||
94 | static ssize_t epx_c3_write(struct file *file, const char *data, | 95 | static ssize_t epx_c3_write(struct file *file, const char __user *data, |
95 | size_t len, loff_t *ppos) | 96 | size_t len, loff_t *ppos) |
96 | { | 97 | { |
97 | /* Refresh the timer. */ | 98 | /* Refresh the timer. */ |
@@ -104,6 +105,7 @@ static int epx_c3_ioctl(struct inode *inode, struct file *file, | |||
104 | unsigned int cmd, unsigned long arg) | 105 | unsigned int cmd, unsigned long arg) |
105 | { | 106 | { |
106 | int options, retval = -EINVAL; | 107 | int options, retval = -EINVAL; |
108 | int __user *argp = (void __user *)arg; | ||
107 | static struct watchdog_info ident = { | 109 | static struct watchdog_info ident = { |
108 | .options = WDIOF_KEEPALIVEPING | | 110 | .options = WDIOF_KEEPALIVEPING | |
109 | WDIOF_MAGICCLOSE, | 111 | WDIOF_MAGICCLOSE, |
@@ -113,20 +115,19 @@ static int epx_c3_ioctl(struct inode *inode, struct file *file, | |||
113 | 115 | ||
114 | switch (cmd) { | 116 | switch (cmd) { |
115 | case WDIOC_GETSUPPORT: | 117 | case WDIOC_GETSUPPORT: |
116 | if (copy_to_user((struct watchdog_info *)arg, | 118 | if (copy_to_user(argp, &ident, sizeof(ident))) |
117 | &ident, sizeof(ident))) | ||
118 | return -EFAULT; | 119 | return -EFAULT; |
119 | return 0; | 120 | return 0; |
120 | case WDIOC_GETSTATUS: | 121 | case WDIOC_GETSTATUS: |
121 | case WDIOC_GETBOOTSTATUS: | 122 | case WDIOC_GETBOOTSTATUS: |
122 | return put_user(0,(int *)arg); | 123 | return put_user(0, argp); |
123 | case WDIOC_KEEPALIVE: | 124 | case WDIOC_KEEPALIVE: |
124 | epx_c3_pet(); | 125 | epx_c3_pet(); |
125 | return 0; | 126 | return 0; |
126 | case WDIOC_GETTIMEOUT: | 127 | case WDIOC_GETTIMEOUT: |
127 | return put_user(WATCHDOG_TIMEOUT,(int *)arg); | 128 | return put_user(WATCHDOG_TIMEOUT, argp); |
128 | case WDIOC_SETOPTIONS: { | 129 | case WDIOC_SETOPTIONS: |
129 | if (get_user(options, (int *)arg)) | 130 | if (get_user(options, argp)) |
130 | return -EFAULT; | 131 | return -EFAULT; |
131 | 132 | ||
132 | if (options & WDIOS_DISABLECARD) { | 133 | if (options & WDIOS_DISABLECARD) { |
@@ -140,7 +141,6 @@ static int epx_c3_ioctl(struct inode *inode, struct file *file, | |||
140 | } | 141 | } |
141 | 142 | ||
142 | return retval; | 143 | return retval; |
143 | } | ||
144 | default: | 144 | default: |
145 | return -ENOIOCTLCMD; | 145 | return -ENOIOCTLCMD; |
146 | } | 146 | } |
@@ -181,11 +181,14 @@ static int __init watchdog_init(void) | |||
181 | { | 181 | { |
182 | int ret; | 182 | int ret; |
183 | 183 | ||
184 | if (!request_region(EPXC3_WATCHDOG_CTL_REG, 2, "epxc3_watchdog")) | ||
185 | return -EBUSY; | ||
186 | |||
184 | ret = register_reboot_notifier(&epx_c3_notifier); | 187 | ret = register_reboot_notifier(&epx_c3_notifier); |
185 | if (ret) { | 188 | if (ret) { |
186 | printk(KERN_ERR PFX "cannot register reboot notifier " | 189 | printk(KERN_ERR PFX "cannot register reboot notifier " |
187 | "(err=%d)\n", ret); | 190 | "(err=%d)\n", ret); |
188 | return ret; | 191 | goto out; |
189 | } | 192 | } |
190 | 193 | ||
191 | ret = misc_register(&epx_c3_miscdev); | 194 | ret = misc_register(&epx_c3_miscdev); |
@@ -193,18 +196,23 @@ static int __init watchdog_init(void) | |||
193 | printk(KERN_ERR PFX "cannot register miscdev on minor=%d " | 196 | printk(KERN_ERR PFX "cannot register miscdev on minor=%d " |
194 | "(err=%d)\n", WATCHDOG_MINOR, ret); | 197 | "(err=%d)\n", WATCHDOG_MINOR, ret); |
195 | unregister_reboot_notifier(&epx_c3_notifier); | 198 | unregister_reboot_notifier(&epx_c3_notifier); |
196 | return ret; | 199 | goto out; |
197 | } | 200 | } |
198 | 201 | ||
199 | printk(banner); | 202 | printk(banner); |
200 | 203 | ||
201 | return 0; | 204 | return 0; |
205 | |||
206 | out: | ||
207 | release_region(EPXC3_WATCHDOG_CTL_REG, 2); | ||
208 | return ret; | ||
202 | } | 209 | } |
203 | 210 | ||
204 | static void __exit watchdog_exit(void) | 211 | static void __exit watchdog_exit(void) |
205 | { | 212 | { |
206 | misc_deregister(&epx_c3_miscdev); | 213 | misc_deregister(&epx_c3_miscdev); |
207 | unregister_reboot_notifier(&epx_c3_notifier); | 214 | unregister_reboot_notifier(&epx_c3_notifier); |
215 | release_region(EPXC3_WATCHDOG_CTL_REG, 2); | ||
208 | } | 216 | } |
209 | 217 | ||
210 | module_init(watchdog_init); | 218 | module_init(watchdog_init); |