diff options
Diffstat (limited to 'drivers/char')
215 files changed, 4948 insertions, 3794 deletions
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig index 78d928f9d9f1..c40e487d9f5c 100644 --- a/drivers/char/Kconfig +++ b/drivers/char/Kconfig | |||
@@ -62,6 +62,23 @@ config HW_CONSOLE | |||
62 | depends on VT && !S390 && !UML | 62 | depends on VT && !S390 && !UML |
63 | default y | 63 | default y |
64 | 64 | ||
65 | config VT_HW_CONSOLE_BINDING | ||
66 | bool "Support for binding and unbinding console drivers" | ||
67 | depends on HW_CONSOLE | ||
68 | default n | ||
69 | ---help--- | ||
70 | The virtual terminal is the device that interacts with the physical | ||
71 | terminal through console drivers. On these systems, at least one | ||
72 | console driver is loaded. In other configurations, additional console | ||
73 | drivers may be enabled, such as the framebuffer console. If more than | ||
74 | 1 console driver is enabled, setting this to 'y' will allow you to | ||
75 | select the console driver that will serve as the backend for the | ||
76 | virtual terminals. | ||
77 | |||
78 | See <file:Documentation/console/console.txt> for more | ||
79 | information. For framebuffer console users, please refer to | ||
80 | <file:Documentation/fb/fbcon.txt>. | ||
81 | |||
65 | config SERIAL_NONSTANDARD | 82 | config SERIAL_NONSTANDARD |
66 | bool "Non-standard serial port support" | 83 | bool "Non-standard serial port support" |
67 | ---help--- | 84 | ---help--- |
@@ -670,20 +687,7 @@ config NWFLASH | |||
670 | 687 | ||
671 | If you're not sure, say N. | 688 | If you're not sure, say N. |
672 | 689 | ||
673 | config HW_RANDOM | 690 | source "drivers/char/hw_random/Kconfig" |
674 | tristate "Intel/AMD/VIA HW Random Number Generator support" | ||
675 | depends on (X86 || IA64) && PCI | ||
676 | ---help--- | ||
677 | This driver provides kernel-side support for the Random Number | ||
678 | Generator hardware found on Intel i8xx-based motherboards, | ||
679 | AMD 76x-based motherboards, and Via Nehemiah CPUs. | ||
680 | |||
681 | Provides a character driver, used to read() entropy data. | ||
682 | |||
683 | To compile this driver as a module, choose M here: the | ||
684 | module will be called hw_random. | ||
685 | |||
686 | If unsure, say N. | ||
687 | 691 | ||
688 | config NVRAM | 692 | config NVRAM |
689 | tristate "/dev/nvram support" | 693 | tristate "/dev/nvram support" |
@@ -865,6 +869,7 @@ config SONYPI | |||
865 | config TANBAC_TB0219 | 869 | config TANBAC_TB0219 |
866 | tristate "TANBAC TB0219 base board support" | 870 | tristate "TANBAC TB0219 base board support" |
867 | depends TANBAC_TB022X | 871 | depends TANBAC_TB022X |
872 | select GPIO_VR41XX | ||
868 | 873 | ||
869 | menu "Ftape, the floppy tape device driver" | 874 | menu "Ftape, the floppy tape device driver" |
870 | 875 | ||
@@ -934,12 +939,36 @@ config MWAVE | |||
934 | config SCx200_GPIO | 939 | config SCx200_GPIO |
935 | tristate "NatSemi SCx200 GPIO Support" | 940 | tristate "NatSemi SCx200 GPIO Support" |
936 | depends on SCx200 | 941 | depends on SCx200 |
942 | select NSC_GPIO | ||
937 | help | 943 | help |
938 | Give userspace access to the GPIO pins on the National | 944 | Give userspace access to the GPIO pins on the National |
939 | Semiconductor SCx200 processors. | 945 | Semiconductor SCx200 processors. |
940 | 946 | ||
941 | If compiled as a module, it will be called scx200_gpio. | 947 | If compiled as a module, it will be called scx200_gpio. |
942 | 948 | ||
949 | config PC8736x_GPIO | ||
950 | tristate "NatSemi PC8736x GPIO Support" | ||
951 | depends on X86 | ||
952 | default SCx200_GPIO # mostly N | ||
953 | select NSC_GPIO # needed for support routines | ||
954 | help | ||
955 | Give userspace access to the GPIO pins on the National | ||
956 | Semiconductor PC-8736x (x=[03456]) SuperIO chip. The chip | ||
957 | has multiple functional units, inc several managed by | ||
958 | hwmon/pc87360 driver. Tested with PC-87366 | ||
959 | |||
960 | If compiled as a module, it will be called pc8736x_gpio. | ||
961 | |||
962 | config NSC_GPIO | ||
963 | tristate "NatSemi Base GPIO Support" | ||
964 | depends on X86_32 | ||
965 | # selected by SCx200_GPIO and PC8736x_GPIO | ||
966 | # what about 2 selectors differing: m != y | ||
967 | help | ||
968 | Common support used (and needed) by scx200_gpio and | ||
969 | pc8736x_gpio drivers. If those drivers are built as | ||
970 | modules, this one will be too, named nsc_gpio | ||
971 | |||
943 | config CS5535_GPIO | 972 | config CS5535_GPIO |
944 | tristate "AMD CS5535/CS5536 GPIO (Geode Companion Device)" | 973 | tristate "AMD CS5535/CS5536 GPIO (Geode Companion Device)" |
945 | depends on X86_32 | 974 | depends on X86_32 |
diff --git a/drivers/char/Makefile b/drivers/char/Makefile index fb919bfb2824..6e0f4469d8bb 100644 --- a/drivers/char/Makefile +++ b/drivers/char/Makefile | |||
@@ -75,13 +75,15 @@ endif | |||
75 | obj-$(CONFIG_TOSHIBA) += toshiba.o | 75 | obj-$(CONFIG_TOSHIBA) += toshiba.o |
76 | obj-$(CONFIG_I8K) += i8k.o | 76 | obj-$(CONFIG_I8K) += i8k.o |
77 | obj-$(CONFIG_DS1620) += ds1620.o | 77 | obj-$(CONFIG_DS1620) += ds1620.o |
78 | obj-$(CONFIG_HW_RANDOM) += hw_random.o | 78 | obj-$(CONFIG_HW_RANDOM) += hw_random/ |
79 | obj-$(CONFIG_FTAPE) += ftape/ | 79 | obj-$(CONFIG_FTAPE) += ftape/ |
80 | obj-$(CONFIG_COBALT_LCD) += lcd.o | 80 | obj-$(CONFIG_COBALT_LCD) += lcd.o |
81 | obj-$(CONFIG_PPDEV) += ppdev.o | 81 | obj-$(CONFIG_PPDEV) += ppdev.o |
82 | obj-$(CONFIG_NWBUTTON) += nwbutton.o | 82 | obj-$(CONFIG_NWBUTTON) += nwbutton.o |
83 | obj-$(CONFIG_NWFLASH) += nwflash.o | 83 | obj-$(CONFIG_NWFLASH) += nwflash.o |
84 | obj-$(CONFIG_SCx200_GPIO) += scx200_gpio.o | 84 | obj-$(CONFIG_SCx200_GPIO) += scx200_gpio.o |
85 | obj-$(CONFIG_PC8736x_GPIO) += pc8736x_gpio.o | ||
86 | obj-$(CONFIG_NSC_GPIO) += nsc_gpio.o | ||
85 | obj-$(CONFIG_CS5535_GPIO) += cs5535_gpio.o | 87 | obj-$(CONFIG_CS5535_GPIO) += cs5535_gpio.o |
86 | obj-$(CONFIG_GPIO_VR41XX) += vr41xx_giu.o | 88 | obj-$(CONFIG_GPIO_VR41XX) += vr41xx_giu.o |
87 | obj-$(CONFIG_TANBAC_TB0219) += tb0219.o | 89 | obj-$(CONFIG_TANBAC_TB0219) += tb0219.o |
diff --git a/drivers/char/agp/Kconfig b/drivers/char/agp/Kconfig index 7c88c060a9e6..22f8cf218cc6 100644 --- a/drivers/char/agp/Kconfig +++ b/drivers/char/agp/Kconfig | |||
@@ -1,7 +1,7 @@ | |||
1 | config AGP | 1 | config AGP |
2 | tristate "/dev/agpgart (AGP Support)" if !GART_IOMMU | 2 | tristate "/dev/agpgart (AGP Support)" |
3 | depends on ALPHA || IA64 || PPC || X86 | 3 | depends on ALPHA || IA64 || PPC || X86 |
4 | default y if GART_IOMMU | 4 | depends on PCI |
5 | ---help--- | 5 | ---help--- |
6 | AGP (Accelerated Graphics Port) is a bus system mainly used to | 6 | AGP (Accelerated Graphics Port) is a bus system mainly used to |
7 | connect graphics cards to the rest of the system. | 7 | connect graphics cards to the rest of the system. |
@@ -56,9 +56,9 @@ config AGP_AMD | |||
56 | X on AMD Irongate, 761, and 762 chipsets. | 56 | X on AMD Irongate, 761, and 762 chipsets. |
57 | 57 | ||
58 | config AGP_AMD64 | 58 | config AGP_AMD64 |
59 | tristate "AMD Opteron/Athlon64 on-CPU GART support" if !GART_IOMMU | 59 | tristate "AMD Opteron/Athlon64 on-CPU GART support" if !IOMMU |
60 | depends on AGP && X86 | 60 | depends on AGP && X86 |
61 | default y if GART_IOMMU | 61 | default y if IOMMU |
62 | help | 62 | help |
63 | This option gives you AGP support for the GLX component of | 63 | This option gives you AGP support for the GLX component of |
64 | 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. |
diff --git a/drivers/char/agp/amd-k7-agp.c b/drivers/char/agp/amd-k7-agp.c index 1f776651ac64..51d0d562d01e 100644 --- a/drivers/char/agp/amd-k7-agp.c +++ b/drivers/char/agp/amd-k7-agp.c | |||
@@ -118,7 +118,7 @@ static int amd_create_gatt_pages(int nr_tables) | |||
118 | return retval; | 118 | return retval; |
119 | } | 119 | } |
120 | 120 | ||
121 | /* Since we don't need contigious memory we just try | 121 | /* Since we don't need contiguous memory we just try |
122 | * to get the gatt table once | 122 | * to get the gatt table once |
123 | */ | 123 | */ |
124 | 124 | ||
diff --git a/drivers/char/agp/amd64-agp.c b/drivers/char/agp/amd64-agp.c index ac3c33a2e37d..8cd52984cda5 100644 --- a/drivers/char/agp/amd64-agp.c +++ b/drivers/char/agp/amd64-agp.c | |||
@@ -8,18 +8,15 @@ | |||
8 | * work is done in the northbridge(s). | 8 | * work is done in the northbridge(s). |
9 | */ | 9 | */ |
10 | 10 | ||
11 | #include <linux/config.h> | ||
12 | #include <linux/module.h> | 11 | #include <linux/module.h> |
13 | #include <linux/pci.h> | 12 | #include <linux/pci.h> |
14 | #include <linux/init.h> | 13 | #include <linux/init.h> |
15 | #include <linux/agp_backend.h> | 14 | #include <linux/agp_backend.h> |
16 | #include <linux/mmzone.h> | 15 | #include <linux/mmzone.h> |
17 | #include <asm/page.h> /* PAGE_SIZE */ | 16 | #include <asm/page.h> /* PAGE_SIZE */ |
17 | #include <asm/k8.h> | ||
18 | #include "agp.h" | 18 | #include "agp.h" |
19 | 19 | ||
20 | /* Will need to be increased if AMD64 ever goes >8-way. */ | ||
21 | #define MAX_HAMMER_GARTS 8 | ||
22 | |||
23 | /* PTE bits. */ | 20 | /* PTE bits. */ |
24 | #define GPTE_VALID 1 | 21 | #define GPTE_VALID 1 |
25 | #define GPTE_COHERENT 2 | 22 | #define GPTE_COHERENT 2 |
@@ -53,28 +50,12 @@ | |||
53 | #define ULI_X86_64_HTT_FEA_REG 0x50 | 50 | #define ULI_X86_64_HTT_FEA_REG 0x50 |
54 | #define ULI_X86_64_ENU_SCR_REG 0x54 | 51 | #define ULI_X86_64_ENU_SCR_REG 0x54 |
55 | 52 | ||
56 | static int nr_garts; | ||
57 | static struct pci_dev * hammers[MAX_HAMMER_GARTS]; | ||
58 | |||
59 | static struct resource *aperture_resource; | 53 | static struct resource *aperture_resource; |
60 | static int __initdata agp_try_unsupported = 1; | 54 | static int __initdata agp_try_unsupported = 1; |
61 | 55 | ||
62 | #define for_each_nb() for(gart_iterator=0;gart_iterator<nr_garts;gart_iterator++) | ||
63 | |||
64 | static void flush_amd64_tlb(struct pci_dev *dev) | ||
65 | { | ||
66 | u32 tmp; | ||
67 | |||
68 | pci_read_config_dword (dev, AMD64_GARTCACHECTL, &tmp); | ||
69 | tmp |= INVGART; | ||
70 | pci_write_config_dword (dev, AMD64_GARTCACHECTL, tmp); | ||
71 | } | ||
72 | |||
73 | static void amd64_tlbflush(struct agp_memory *temp) | 56 | static void amd64_tlbflush(struct agp_memory *temp) |
74 | { | 57 | { |
75 | int gart_iterator; | 58 | k8_flush_garts(); |
76 | for_each_nb() | ||
77 | flush_amd64_tlb(hammers[gart_iterator]); | ||
78 | } | 59 | } |
79 | 60 | ||
80 | static int amd64_insert_memory(struct agp_memory *mem, off_t pg_start, int type) | 61 | static int amd64_insert_memory(struct agp_memory *mem, off_t pg_start, int type) |
@@ -153,7 +134,7 @@ static int amd64_fetch_size(void) | |||
153 | u32 temp; | 134 | u32 temp; |
154 | struct aper_size_info_32 *values; | 135 | struct aper_size_info_32 *values; |
155 | 136 | ||
156 | dev = hammers[0]; | 137 | dev = k8_northbridges[0]; |
157 | if (dev==NULL) | 138 | if (dev==NULL) |
158 | return 0; | 139 | return 0; |
159 | 140 | ||
@@ -201,9 +182,6 @@ static u64 amd64_configure (struct pci_dev *hammer, u64 gatt_table) | |||
201 | tmp &= ~(DISGARTCPU | DISGARTIO); | 182 | tmp &= ~(DISGARTCPU | DISGARTIO); |
202 | pci_write_config_dword(hammer, AMD64_GARTAPERTURECTL, tmp); | 183 | pci_write_config_dword(hammer, AMD64_GARTAPERTURECTL, tmp); |
203 | 184 | ||
204 | /* keep CPU's coherent. */ | ||
205 | flush_amd64_tlb (hammer); | ||
206 | |||
207 | return aper_base; | 185 | return aper_base; |
208 | } | 186 | } |
209 | 187 | ||
@@ -222,13 +200,14 @@ static struct aper_size_info_32 amd_8151_sizes[7] = | |||
222 | static int amd_8151_configure(void) | 200 | static int amd_8151_configure(void) |
223 | { | 201 | { |
224 | unsigned long gatt_bus = virt_to_gart(agp_bridge->gatt_table_real); | 202 | unsigned long gatt_bus = virt_to_gart(agp_bridge->gatt_table_real); |
225 | int gart_iterator; | 203 | int i; |
226 | 204 | ||
227 | /* Configure AGP regs in each x86-64 host bridge. */ | 205 | /* Configure AGP regs in each x86-64 host bridge. */ |
228 | for_each_nb() { | 206 | for (i = 0; i < num_k8_northbridges; i++) { |
229 | agp_bridge->gart_bus_addr = | 207 | agp_bridge->gart_bus_addr = |
230 | amd64_configure(hammers[gart_iterator],gatt_bus); | 208 | amd64_configure(k8_northbridges[i], gatt_bus); |
231 | } | 209 | } |
210 | k8_flush_garts(); | ||
232 | return 0; | 211 | return 0; |
233 | } | 212 | } |
234 | 213 | ||
@@ -236,12 +215,13 @@ static int amd_8151_configure(void) | |||
236 | static void amd64_cleanup(void) | 215 | static void amd64_cleanup(void) |
237 | { | 216 | { |
238 | u32 tmp; | 217 | u32 tmp; |
239 | int gart_iterator; | 218 | int i; |
240 | for_each_nb() { | 219 | for (i = 0; i < num_k8_northbridges; i++) { |
220 | struct pci_dev *dev = k8_northbridges[i]; | ||
241 | /* disable gart translation */ | 221 | /* disable gart translation */ |
242 | pci_read_config_dword (hammers[gart_iterator], AMD64_GARTAPERTURECTL, &tmp); | 222 | pci_read_config_dword (dev, AMD64_GARTAPERTURECTL, &tmp); |
243 | tmp &= ~AMD64_GARTEN; | 223 | tmp &= ~AMD64_GARTEN; |
244 | pci_write_config_dword (hammers[gart_iterator], AMD64_GARTAPERTURECTL, tmp); | 224 | pci_write_config_dword (dev, AMD64_GARTAPERTURECTL, tmp); |
245 | } | 225 | } |
246 | } | 226 | } |
247 | 227 | ||
@@ -311,7 +291,7 @@ static int __devinit aperture_valid(u64 aper, u32 size) | |||
311 | /* | 291 | /* |
312 | * W*s centric BIOS sometimes only set up the aperture in the AGP | 292 | * W*s centric BIOS sometimes only set up the aperture in the AGP |
313 | * bridge, not the northbridge. On AMD64 this is handled early | 293 | * bridge, not the northbridge. On AMD64 this is handled early |
314 | * in aperture.c, but when GART_IOMMU is not enabled or we run | 294 | * in aperture.c, but when IOMMU is not enabled or we run |
315 | * on a 32bit kernel this needs to be redone. | 295 | * on a 32bit kernel this needs to be redone. |
316 | * Unfortunately it is impossible to fix the aperture here because it's too late | 296 | * Unfortunately it is impossible to fix the aperture here because it's too late |
317 | * to allocate that much memory. But at least error out cleanly instead of | 297 | * to allocate that much memory. But at least error out cleanly instead of |
@@ -361,17 +341,15 @@ static __devinit int fix_northbridge(struct pci_dev *nb, struct pci_dev *agp, | |||
361 | 341 | ||
362 | static __devinit int cache_nbs (struct pci_dev *pdev, u32 cap_ptr) | 342 | static __devinit int cache_nbs (struct pci_dev *pdev, u32 cap_ptr) |
363 | { | 343 | { |
364 | struct pci_dev *loop_dev = NULL; | 344 | int i; |
365 | int i = 0; | 345 | |
366 | 346 | if (cache_k8_northbridges() < 0) | |
367 | /* cache pci_devs of northbridges. */ | 347 | return -ENODEV; |
368 | while ((loop_dev = pci_get_device(PCI_VENDOR_ID_AMD, 0x1103, loop_dev)) | 348 | |
369 | != NULL) { | 349 | i = 0; |
370 | if (i == MAX_HAMMER_GARTS) { | 350 | for (i = 0; i < num_k8_northbridges; i++) { |
371 | printk(KERN_ERR PFX "Too many northbridges for AGP\n"); | 351 | struct pci_dev *dev = k8_northbridges[i]; |
372 | return -1; | 352 | if (fix_northbridge(dev, pdev, cap_ptr) < 0) { |
373 | } | ||
374 | if (fix_northbridge(loop_dev, pdev, cap_ptr) < 0) { | ||
375 | printk(KERN_ERR PFX "No usable aperture found.\n"); | 353 | printk(KERN_ERR PFX "No usable aperture found.\n"); |
376 | #ifdef __x86_64__ | 354 | #ifdef __x86_64__ |
377 | /* should port this to i386 */ | 355 | /* should port this to i386 */ |
@@ -379,10 +357,8 @@ static __devinit int cache_nbs (struct pci_dev *pdev, u32 cap_ptr) | |||
379 | #endif | 357 | #endif |
380 | return -1; | 358 | return -1; |
381 | } | 359 | } |
382 | hammers[i++] = loop_dev; | ||
383 | } | 360 | } |
384 | nr_garts = i; | 361 | return 0; |
385 | return i == 0 ? -1 : 0; | ||
386 | } | 362 | } |
387 | 363 | ||
388 | /* Handle AMD 8151 quirks */ | 364 | /* Handle AMD 8151 quirks */ |
@@ -450,7 +426,7 @@ static int __devinit uli_agp_init(struct pci_dev *pdev) | |||
450 | } | 426 | } |
451 | 427 | ||
452 | /* shadow x86-64 registers into ULi registers */ | 428 | /* shadow x86-64 registers into ULi registers */ |
453 | pci_read_config_dword (hammers[0], AMD64_GARTAPERTUREBASE, &httfea); | 429 | pci_read_config_dword (k8_northbridges[0], AMD64_GARTAPERTUREBASE, &httfea); |
454 | 430 | ||
455 | /* if x86-64 aperture base is beyond 4G, exit here */ | 431 | /* if x86-64 aperture base is beyond 4G, exit here */ |
456 | if ((httfea & 0x7fff) >> (32 - 25)) | 432 | if ((httfea & 0x7fff) >> (32 - 25)) |
@@ -513,7 +489,7 @@ static int __devinit nforce3_agp_init(struct pci_dev *pdev) | |||
513 | pci_write_config_dword(dev1, NVIDIA_X86_64_1_APSIZE, tmp); | 489 | pci_write_config_dword(dev1, NVIDIA_X86_64_1_APSIZE, tmp); |
514 | 490 | ||
515 | /* shadow x86-64 registers into NVIDIA registers */ | 491 | /* shadow x86-64 registers into NVIDIA registers */ |
516 | pci_read_config_dword (hammers[0], AMD64_GARTAPERTUREBASE, &apbase); | 492 | pci_read_config_dword (k8_northbridges[0], AMD64_GARTAPERTUREBASE, &apbase); |
517 | 493 | ||
518 | /* if x86-64 aperture base is beyond 4G, exit here */ | 494 | /* if x86-64 aperture base is beyond 4G, exit here */ |
519 | if ( (apbase & 0x7fff) >> (32 - 25) ) { | 495 | if ( (apbase & 0x7fff) >> (32 - 25) ) { |
@@ -754,14 +730,10 @@ static struct pci_driver agp_amd64_pci_driver = { | |||
754 | int __init agp_amd64_init(void) | 730 | int __init agp_amd64_init(void) |
755 | { | 731 | { |
756 | int err = 0; | 732 | int err = 0; |
757 | static struct pci_device_id amd64nb[] = { | ||
758 | { PCI_DEVICE(PCI_VENDOR_ID_AMD, 0x1103) }, | ||
759 | { }, | ||
760 | }; | ||
761 | 733 | ||
762 | if (agp_off) | 734 | if (agp_off) |
763 | return -EINVAL; | 735 | return -EINVAL; |
764 | if (pci_register_driver(&agp_amd64_pci_driver) > 0) { | 736 | if (pci_register_driver(&agp_amd64_pci_driver) < 0) { |
765 | struct pci_dev *dev; | 737 | struct pci_dev *dev; |
766 | if (!agp_try_unsupported && !agp_try_unsupported_boot) { | 738 | if (!agp_try_unsupported && !agp_try_unsupported_boot) { |
767 | printk(KERN_INFO PFX "No supported AGP bridge found.\n"); | 739 | printk(KERN_INFO PFX "No supported AGP bridge found.\n"); |
@@ -774,7 +746,7 @@ int __init agp_amd64_init(void) | |||
774 | } | 746 | } |
775 | 747 | ||
776 | /* First check that we have at least one AMD64 NB */ | 748 | /* First check that we have at least one AMD64 NB */ |
777 | if (!pci_dev_present(amd64nb)) | 749 | if (!pci_dev_present(k8_nb_ids)) |
778 | return -ENODEV; | 750 | return -ENODEV; |
779 | 751 | ||
780 | /* Look for any AGP bridge */ | 752 | /* Look for any AGP bridge */ |
@@ -802,7 +774,7 @@ static void __exit agp_amd64_cleanup(void) | |||
802 | 774 | ||
803 | /* On AMD64 the PCI driver needs to initialize this driver early | 775 | /* On AMD64 the PCI driver needs to initialize this driver early |
804 | for the IOMMU, so it has to be called via a backdoor. */ | 776 | for the IOMMU, so it has to be called via a backdoor. */ |
805 | #ifndef CONFIG_GART_IOMMU | 777 | #ifndef CONFIG_IOMMU |
806 | module_init(agp_amd64_init); | 778 | module_init(agp_amd64_init); |
807 | module_exit(agp_amd64_cleanup); | 779 | module_exit(agp_amd64_cleanup); |
808 | #endif | 780 | #endif |
diff --git a/drivers/char/agp/ati-agp.c b/drivers/char/agp/ati-agp.c index 06fd10ba0c5e..f244c6682738 100644 --- a/drivers/char/agp/ati-agp.c +++ b/drivers/char/agp/ati-agp.c | |||
@@ -41,7 +41,6 @@ static struct gatt_mask ati_generic_masks[] = | |||
41 | }; | 41 | }; |
42 | 42 | ||
43 | 43 | ||
44 | |||
45 | typedef struct _ati_page_map { | 44 | typedef struct _ati_page_map { |
46 | unsigned long *real; | 45 | unsigned long *real; |
47 | unsigned long __iomem *remapped; | 46 | unsigned long __iomem *remapped; |
@@ -141,7 +140,8 @@ static int ati_create_gatt_pages(int nr_tables) | |||
141 | ati_generic_private.num_tables = nr_tables; | 140 | ati_generic_private.num_tables = nr_tables; |
142 | ati_generic_private.gatt_pages = tables; | 141 | ati_generic_private.gatt_pages = tables; |
143 | 142 | ||
144 | if (retval != 0) ati_free_gatt_pages(); | 143 | if (retval != 0) |
144 | ati_free_gatt_pages(); | ||
145 | 145 | ||
146 | return retval; | 146 | return retval; |
147 | } | 147 | } |
@@ -219,16 +219,16 @@ static int ati_configure(void) | |||
219 | ati_generic_private.registers = (volatile u8 __iomem *) ioremap(temp, 4096); | 219 | ati_generic_private.registers = (volatile u8 __iomem *) ioremap(temp, 4096); |
220 | 220 | ||
221 | if (is_r200()) | 221 | if (is_r200()) |
222 | pci_write_config_dword(agp_bridge->dev, ATI_RS100_IG_AGPMODE, 0x20000); | 222 | pci_write_config_dword(agp_bridge->dev, ATI_RS100_IG_AGPMODE, 0x20000); |
223 | else | 223 | else |
224 | pci_write_config_dword(agp_bridge->dev, ATI_RS300_IG_AGPMODE, 0x20000); | 224 | pci_write_config_dword(agp_bridge->dev, ATI_RS300_IG_AGPMODE, 0x20000); |
225 | 225 | ||
226 | /* address to map too */ | 226 | /* address to map too */ |
227 | /* | 227 | /* |
228 | pci_read_config_dword(agp_bridge.dev, AGP_APBASE, &temp); | 228 | pci_read_config_dword(agp_bridge.dev, AGP_APBASE, &temp); |
229 | agp_bridge.gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK); | 229 | agp_bridge.gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK); |
230 | printk(KERN_INFO PFX "IGP320 gart_bus_addr: %x\n", agp_bridge.gart_bus_addr); | 230 | printk(KERN_INFO PFX "IGP320 gart_bus_addr: %x\n", agp_bridge.gart_bus_addr); |
231 | */ | 231 | */ |
232 | writel(0x60000, ati_generic_private.registers+ATI_GART_FEATURE_ID); | 232 | writel(0x60000, ati_generic_private.registers+ATI_GART_FEATURE_ID); |
233 | readl(ati_generic_private.registers+ATI_GART_FEATURE_ID); /* PCI Posting.*/ | 233 | readl(ati_generic_private.registers+ATI_GART_FEATURE_ID); /* PCI Posting.*/ |
234 | 234 | ||
@@ -245,23 +245,25 @@ static int ati_configure(void) | |||
245 | 245 | ||
246 | 246 | ||
247 | #ifdef CONFIG_PM | 247 | #ifdef CONFIG_PM |
248 | static int agp_ati_resume(struct pci_dev *dev) | 248 | static int agp_ati_suspend(struct pci_dev *dev, pm_message_t state) |
249 | { | 249 | { |
250 | pci_restore_state(dev); | 250 | pci_save_state(dev); |
251 | pci_set_power_state(dev, 3); | ||
251 | 252 | ||
252 | return ati_configure(); | 253 | return 0; |
253 | } | 254 | } |
254 | 255 | ||
255 | static int agp_ati_suspend(struct pci_dev *dev, pm_message_t state) | 256 | static int agp_ati_resume(struct pci_dev *dev) |
256 | { | 257 | { |
257 | pci_save_state(dev); | 258 | pci_set_power_state(dev, 0); |
259 | pci_restore_state(dev); | ||
258 | 260 | ||
259 | return 0; | 261 | return ati_configure(); |
260 | } | 262 | } |
261 | #endif | 263 | #endif |
262 | 264 | ||
263 | /* | 265 | /* |
264 | *Since we don't need contigious memory we just try | 266 | *Since we don't need contiguous memory we just try |
265 | * to get the gatt table once | 267 | * to get the gatt table once |
266 | */ | 268 | */ |
267 | 269 | ||
@@ -321,9 +323,9 @@ static int ati_remove_memory(struct agp_memory * mem, off_t pg_start, | |||
321 | unsigned long __iomem *cur_gatt; | 323 | unsigned long __iomem *cur_gatt; |
322 | unsigned long addr; | 324 | unsigned long addr; |
323 | 325 | ||
324 | if (type != 0 || mem->type != 0) { | 326 | if (type != 0 || mem->type != 0) |
325 | return -EINVAL; | 327 | return -EINVAL; |
326 | } | 328 | |
327 | for (i = pg_start; i < (mem->page_count + pg_start); i++) { | 329 | for (i = pg_start; i < (mem->page_count + pg_start); i++) { |
328 | addr = (i * PAGE_SIZE) + agp_bridge->gart_bus_addr; | 330 | addr = (i * PAGE_SIZE) + agp_bridge->gart_bus_addr; |
329 | cur_gatt = GET_GATT(addr); | 331 | cur_gatt = GET_GATT(addr); |
@@ -502,9 +504,8 @@ found: | |||
502 | 504 | ||
503 | bridge->dev = pdev; | 505 | bridge->dev = pdev; |
504 | bridge->capndx = cap_ptr; | 506 | bridge->capndx = cap_ptr; |
505 | |||
506 | bridge->driver = &ati_generic_bridge; | ||
507 | 507 | ||
508 | bridge->driver = &ati_generic_bridge; | ||
508 | 509 | ||
509 | printk(KERN_INFO PFX "Detected Ati %s chipset\n", | 510 | printk(KERN_INFO PFX "Detected Ati %s chipset\n", |
510 | devs[j].chipset_name); | 511 | devs[j].chipset_name); |
@@ -546,8 +547,8 @@ static struct pci_driver agp_ati_pci_driver = { | |||
546 | .probe = agp_ati_probe, | 547 | .probe = agp_ati_probe, |
547 | .remove = agp_ati_remove, | 548 | .remove = agp_ati_remove, |
548 | #ifdef CONFIG_PM | 549 | #ifdef CONFIG_PM |
549 | .resume = agp_ati_resume, | ||
550 | .suspend = agp_ati_suspend, | 550 | .suspend = agp_ati_suspend, |
551 | .resume = agp_ati_resume, | ||
551 | #endif | 552 | #endif |
552 | }; | 553 | }; |
553 | 554 | ||
diff --git a/drivers/char/agp/efficeon-agp.c b/drivers/char/agp/efficeon-agp.c index 86a966b65236..b788b0a3bbf3 100644 --- a/drivers/char/agp/efficeon-agp.c +++ b/drivers/char/agp/efficeon-agp.c | |||
@@ -177,7 +177,7 @@ static int efficeon_free_gatt_table(struct agp_bridge_data *bridge) | |||
177 | 177 | ||
178 | 178 | ||
179 | /* | 179 | /* |
180 | * Since we don't need contigious memory we just try | 180 | * Since we don't need contiguous memory we just try |
181 | * to get the gatt table once | 181 | * to get the gatt table once |
182 | */ | 182 | */ |
183 | 183 | ||
diff --git a/drivers/char/agp/frontend.c b/drivers/char/agp/frontend.c index ffcf15c30e90..d9c5a9142ad1 100644 --- a/drivers/char/agp/frontend.c +++ b/drivers/char/agp/frontend.c | |||
@@ -1059,7 +1059,7 @@ ioctl_out: | |||
1059 | return ret_val; | 1059 | return ret_val; |
1060 | } | 1060 | } |
1061 | 1061 | ||
1062 | static struct file_operations agp_fops = | 1062 | static const struct file_operations agp_fops = |
1063 | { | 1063 | { |
1064 | .owner = THIS_MODULE, | 1064 | .owner = THIS_MODULE, |
1065 | .llseek = no_llseek, | 1065 | .llseek = no_llseek, |
diff --git a/drivers/char/agp/generic.c b/drivers/char/agp/generic.c index a92ab53a1370..cc5ea347a8a7 100644 --- a/drivers/char/agp/generic.c +++ b/drivers/char/agp/generic.c | |||
@@ -27,7 +27,6 @@ | |||
27 | * TODO: | 27 | * TODO: |
28 | * - Allocate more than order 0 pages to avoid too much linear map splitting. | 28 | * - Allocate more than order 0 pages to avoid too much linear map splitting. |
29 | */ | 29 | */ |
30 | #include <linux/config.h> | ||
31 | #include <linux/module.h> | 30 | #include <linux/module.h> |
32 | #include <linux/pci.h> | 31 | #include <linux/pci.h> |
33 | #include <linux/init.h> | 32 | #include <linux/init.h> |
diff --git a/drivers/char/agp/hp-agp.c b/drivers/char/agp/hp-agp.c index 8c4c6ef748ec..907fb66ec4a9 100644 --- a/drivers/char/agp/hp-agp.c +++ b/drivers/char/agp/hp-agp.c | |||
@@ -497,7 +497,7 @@ zx1_gart_probe (acpi_handle obj, u32 depth, void *context, void **ret) | |||
497 | info = buffer.pointer; | 497 | info = buffer.pointer; |
498 | info->hardware_id.value[sizeof(info->hardware_id)-1] = '\0'; | 498 | info->hardware_id.value[sizeof(info->hardware_id)-1] = '\0'; |
499 | match = (strcmp(info->hardware_id.value, "HWP0001") == 0); | 499 | match = (strcmp(info->hardware_id.value, "HWP0001") == 0); |
500 | ACPI_MEM_FREE(info); | 500 | kfree(info); |
501 | if (match) { | 501 | if (match) { |
502 | status = hp_acpi_csr_space(handle, &sba_hpa, &length); | 502 | status = hp_acpi_csr_space(handle, &sba_hpa, &length); |
503 | if (ACPI_SUCCESS(status)) | 503 | if (ACPI_SUCCESS(status)) |
diff --git a/drivers/char/agp/nvidia-agp.c b/drivers/char/agp/nvidia-agp.c index 4c67135c12d8..df7f37b2739a 100644 --- a/drivers/char/agp/nvidia-agp.c +++ b/drivers/char/agp/nvidia-agp.c | |||
@@ -376,6 +376,29 @@ static void __devexit agp_nvidia_remove(struct pci_dev *pdev) | |||
376 | agp_put_bridge(bridge); | 376 | agp_put_bridge(bridge); |
377 | } | 377 | } |
378 | 378 | ||
379 | #ifdef CONFIG_PM | ||
380 | static int agp_nvidia_suspend(struct pci_dev *pdev, pm_message_t state) | ||
381 | { | ||
382 | pci_save_state (pdev); | ||
383 | pci_set_power_state (pdev, 3); | ||
384 | |||
385 | return 0; | ||
386 | } | ||
387 | |||
388 | static int agp_nvidia_resume(struct pci_dev *pdev) | ||
389 | { | ||
390 | /* set power state 0 and restore PCI space */ | ||
391 | pci_set_power_state (pdev, 0); | ||
392 | pci_restore_state(pdev); | ||
393 | |||
394 | /* reconfigure AGP hardware again */ | ||
395 | nvidia_configure(); | ||
396 | |||
397 | return 0; | ||
398 | } | ||
399 | #endif | ||
400 | |||
401 | |||
379 | static struct pci_device_id agp_nvidia_pci_table[] = { | 402 | static struct pci_device_id agp_nvidia_pci_table[] = { |
380 | { | 403 | { |
381 | .class = (PCI_CLASS_BRIDGE_HOST << 8), | 404 | .class = (PCI_CLASS_BRIDGE_HOST << 8), |
@@ -403,6 +426,10 @@ static struct pci_driver agp_nvidia_pci_driver = { | |||
403 | .id_table = agp_nvidia_pci_table, | 426 | .id_table = agp_nvidia_pci_table, |
404 | .probe = agp_nvidia_probe, | 427 | .probe = agp_nvidia_probe, |
405 | .remove = agp_nvidia_remove, | 428 | .remove = agp_nvidia_remove, |
429 | #ifdef CONFIG_PM | ||
430 | .suspend = agp_nvidia_suspend, | ||
431 | .resume = agp_nvidia_resume, | ||
432 | #endif | ||
406 | }; | 433 | }; |
407 | 434 | ||
408 | static int __init agp_nvidia_init(void) | 435 | static int __init agp_nvidia_init(void) |
diff --git a/drivers/char/agp/sgi-agp.c b/drivers/char/agp/sgi-agp.c index cfa7922cb431..d73be4c2db8a 100644 --- a/drivers/char/agp/sgi-agp.c +++ b/drivers/char/agp/sgi-agp.c | |||
@@ -329,9 +329,8 @@ static int __devinit agp_sgi_init(void) | |||
329 | 329 | ||
330 | static void __devexit agp_sgi_cleanup(void) | 330 | static void __devexit agp_sgi_cleanup(void) |
331 | { | 331 | { |
332 | if (sgi_tioca_agp_bridges) | 332 | kfree(sgi_tioca_agp_bridges); |
333 | kfree(sgi_tioca_agp_bridges); | 333 | sgi_tioca_agp_bridges = NULL; |
334 | sgi_tioca_agp_bridges=NULL; | ||
335 | } | 334 | } |
336 | 335 | ||
337 | module_init(agp_sgi_init); | 336 | module_init(agp_sgi_init); |
diff --git a/drivers/char/amiserial.c b/drivers/char/amiserial.c index 6602b3156df5..9d6713a93ed7 100644 --- a/drivers/char/amiserial.c +++ b/drivers/char/amiserial.c | |||
@@ -31,7 +31,6 @@ | |||
31 | * ever possible. | 31 | * ever possible. |
32 | */ | 32 | */ |
33 | 33 | ||
34 | #include <linux/config.h> | ||
35 | #include <linux/delay.h> | 34 | #include <linux/delay.h> |
36 | 35 | ||
37 | #undef SERIAL_PARANOIA_CHECK | 36 | #undef SERIAL_PARANOIA_CHECK |
@@ -2052,7 +2051,7 @@ static int __init rs_init(void) | |||
2052 | 2051 | ||
2053 | /* set ISRs, and then disable the rx interrupts */ | 2052 | /* set ISRs, and then disable the rx interrupts */ |
2054 | request_irq(IRQ_AMIGA_TBE, ser_tx_int, 0, "serial TX", state); | 2053 | request_irq(IRQ_AMIGA_TBE, ser_tx_int, 0, "serial TX", state); |
2055 | request_irq(IRQ_AMIGA_RBF, ser_rx_int, SA_INTERRUPT, "serial RX", state); | 2054 | request_irq(IRQ_AMIGA_RBF, ser_rx_int, IRQF_DISABLED, "serial RX", state); |
2056 | 2055 | ||
2057 | /* turn off Rx and Tx interrupts */ | 2056 | /* turn off Rx and Tx interrupts */ |
2058 | custom.intena = IF_RBF | IF_TBE; | 2057 | custom.intena = IF_RBF | IF_TBE; |
diff --git a/drivers/char/applicom.c b/drivers/char/applicom.c index a370e7a0bad5..10a389dafd60 100644 --- a/drivers/char/applicom.c +++ b/drivers/char/applicom.c | |||
@@ -112,7 +112,7 @@ static int ac_ioctl(struct inode *, struct file *, unsigned int, | |||
112 | unsigned long); | 112 | unsigned long); |
113 | static irqreturn_t ac_interrupt(int, void *, struct pt_regs *); | 113 | static irqreturn_t ac_interrupt(int, void *, struct pt_regs *); |
114 | 114 | ||
115 | static struct file_operations ac_fops = { | 115 | static const struct file_operations ac_fops = { |
116 | .owner = THIS_MODULE, | 116 | .owner = THIS_MODULE, |
117 | .llseek = no_llseek, | 117 | .llseek = no_llseek, |
118 | .read = ac_read, | 118 | .read = ac_read, |
@@ -166,11 +166,7 @@ static int ac_register_board(unsigned long physloc, void __iomem *loc, | |||
166 | return boardno + 1; | 166 | return boardno + 1; |
167 | } | 167 | } |
168 | 168 | ||
169 | #ifdef MODULE | 169 | static void __exit applicom_exit(void) |
170 | |||
171 | #define applicom_init init_module | ||
172 | |||
173 | void cleanup_module(void) | ||
174 | { | 170 | { |
175 | unsigned int i; | 171 | unsigned int i; |
176 | 172 | ||
@@ -188,9 +184,7 @@ void cleanup_module(void) | |||
188 | } | 184 | } |
189 | } | 185 | } |
190 | 186 | ||
191 | #endif /* MODULE */ | 187 | static int __init applicom_init(void) |
192 | |||
193 | int __init applicom_init(void) | ||
194 | { | 188 | { |
195 | int i, numisa = 0; | 189 | int i, numisa = 0; |
196 | struct pci_dev *dev = NULL; | 190 | struct pci_dev *dev = NULL; |
@@ -215,13 +209,16 @@ int __init applicom_init(void) | |||
215 | RamIO = ioremap(dev->resource[0].start, LEN_RAM_IO); | 209 | RamIO = ioremap(dev->resource[0].start, LEN_RAM_IO); |
216 | 210 | ||
217 | if (!RamIO) { | 211 | if (!RamIO) { |
218 | printk(KERN_INFO "ac.o: Failed to ioremap PCI memory space at 0x%lx\n", dev->resource[0].start); | 212 | printk(KERN_INFO "ac.o: Failed to ioremap PCI memory " |
213 | "space at 0x%llx\n", | ||
214 | (unsigned long long)dev->resource[0].start); | ||
219 | pci_disable_device(dev); | 215 | pci_disable_device(dev); |
220 | return -EIO; | 216 | return -EIO; |
221 | } | 217 | } |
222 | 218 | ||
223 | printk(KERN_INFO "Applicom %s found at mem 0x%lx, irq %d\n", | 219 | printk(KERN_INFO "Applicom %s found at mem 0x%llx, irq %d\n", |
224 | applicom_pci_devnames[dev->device-1], dev->resource[0].start, | 220 | applicom_pci_devnames[dev->device-1], |
221 | (unsigned long long)dev->resource[0].start, | ||
225 | dev->irq); | 222 | dev->irq); |
226 | 223 | ||
227 | boardno = ac_register_board(dev->resource[0].start, RamIO,0); | 224 | boardno = ac_register_board(dev->resource[0].start, RamIO,0); |
@@ -232,7 +229,7 @@ int __init applicom_init(void) | |||
232 | continue; | 229 | continue; |
233 | } | 230 | } |
234 | 231 | ||
235 | if (request_irq(dev->irq, &ac_interrupt, SA_SHIRQ, "Applicom PCI", &dummy)) { | 232 | if (request_irq(dev->irq, &ac_interrupt, IRQF_SHARED, "Applicom PCI", &dummy)) { |
236 | printk(KERN_INFO "Could not allocate IRQ %d for PCI Applicom device.\n", dev->irq); | 233 | printk(KERN_INFO "Could not allocate IRQ %d for PCI Applicom device.\n", dev->irq); |
237 | iounmap(RamIO); | 234 | iounmap(RamIO); |
238 | pci_disable_device(dev); | 235 | pci_disable_device(dev); |
@@ -279,7 +276,7 @@ int __init applicom_init(void) | |||
279 | printk(KERN_NOTICE "Applicom ISA card found at mem 0x%lx, irq %d\n", mem + (LEN_RAM_IO*i), irq); | 276 | printk(KERN_NOTICE "Applicom ISA card found at mem 0x%lx, irq %d\n", mem + (LEN_RAM_IO*i), irq); |
280 | 277 | ||
281 | if (!numisa) { | 278 | if (!numisa) { |
282 | if (request_irq(irq, &ac_interrupt, SA_SHIRQ, "Applicom ISA", &dummy)) { | 279 | if (request_irq(irq, &ac_interrupt, IRQF_SHARED, "Applicom ISA", &dummy)) { |
283 | printk(KERN_WARNING "Could not allocate IRQ %d for ISA Applicom device.\n", irq); | 280 | printk(KERN_WARNING "Could not allocate IRQ %d for ISA Applicom device.\n", irq); |
284 | iounmap(RamIO); | 281 | iounmap(RamIO); |
285 | apbs[boardno - 1].RamIO = NULL; | 282 | apbs[boardno - 1].RamIO = NULL; |
@@ -355,10 +352,9 @@ out: | |||
355 | return ret; | 352 | return ret; |
356 | } | 353 | } |
357 | 354 | ||
355 | module_init(applicom_init); | ||
356 | module_exit(applicom_exit); | ||
358 | 357 | ||
359 | #ifndef MODULE | ||
360 | __initcall(applicom_init); | ||
361 | #endif | ||
362 | 358 | ||
363 | static ssize_t ac_write(struct file *file, const char __user *buf, size_t count, loff_t * ppos) | 359 | static ssize_t ac_write(struct file *file, const char __user *buf, size_t count, loff_t * ppos) |
364 | { | 360 | { |
@@ -851,28 +847,3 @@ static int ac_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un | |||
851 | return 0; | 847 | return 0; |
852 | } | 848 | } |
853 | 849 | ||
854 | #ifndef MODULE | ||
855 | static int __init applicom_setup(char *str) | ||
856 | { | ||
857 | int ints[4]; | ||
858 | |||
859 | (void) get_options(str, 4, ints); | ||
860 | |||
861 | if (ints[0] > 2) { | ||
862 | printk(KERN_WARNING "Too many arguments to 'applicom=', expected mem,irq only.\n"); | ||
863 | } | ||
864 | |||
865 | if (ints[0] < 2) { | ||
866 | printk(KERN_INFO"applicom numargs: %d\n", ints[0]); | ||
867 | return 0; | ||
868 | } | ||
869 | |||
870 | mem = ints[1]; | ||
871 | irq = ints[2]; | ||
872 | return 1; | ||
873 | } | ||
874 | |||
875 | __setup("applicom=", applicom_setup); | ||
876 | |||
877 | #endif /* MODULE */ | ||
878 | |||
diff --git a/drivers/char/consolemap.c b/drivers/char/consolemap.c index c85a4fa60da7..04a12027a740 100644 --- a/drivers/char/consolemap.c +++ b/drivers/char/consolemap.c | |||
@@ -11,7 +11,6 @@ | |||
11 | * Fix bug in inverse translation. Stanislav Voronyi <stas@cnti.uanet.kharkov.ua>, Dec 1998 | 11 | * Fix bug in inverse translation. Stanislav Voronyi <stas@cnti.uanet.kharkov.ua>, Dec 1998 |
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include <linux/config.h> | ||
15 | #include <linux/module.h> | 14 | #include <linux/module.h> |
16 | #include <linux/kd.h> | 15 | #include <linux/kd.h> |
17 | #include <linux/errno.h> | 16 | #include <linux/errno.h> |
diff --git a/drivers/char/cs5535_gpio.c b/drivers/char/cs5535_gpio.c index 46d66037b917..8ce3f34cfc22 100644 --- a/drivers/char/cs5535_gpio.c +++ b/drivers/char/cs5535_gpio.c | |||
@@ -158,7 +158,7 @@ static int cs5535_gpio_open(struct inode *inode, struct file *file) | |||
158 | return nonseekable_open(inode, file); | 158 | return nonseekable_open(inode, file); |
159 | } | 159 | } |
160 | 160 | ||
161 | static struct file_operations cs5535_gpio_fops = { | 161 | static const struct file_operations cs5535_gpio_fops = { |
162 | .owner = THIS_MODULE, | 162 | .owner = THIS_MODULE, |
163 | .write = cs5535_gpio_write, | 163 | .write = cs5535_gpio_write, |
164 | .read = cs5535_gpio_read, | 164 | .read = cs5535_gpio_read, |
diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c index cc7acf877dc0..c1c67281750d 100644 --- a/drivers/char/cyclades.c +++ b/drivers/char/cyclades.c | |||
@@ -633,7 +633,6 @@ static char rcsid[] = | |||
633 | /* | 633 | /* |
634 | * Include section | 634 | * Include section |
635 | */ | 635 | */ |
636 | #include <linux/config.h> | ||
637 | #include <linux/module.h> | 636 | #include <linux/module.h> |
638 | #include <linux/errno.h> | 637 | #include <linux/errno.h> |
639 | #include <linux/signal.h> | 638 | #include <linux/signal.h> |
@@ -2833,9 +2832,8 @@ cy_write(struct tty_struct * tty, const unsigned char *buf, int count) | |||
2833 | return 0; | 2832 | return 0; |
2834 | } | 2833 | } |
2835 | 2834 | ||
2836 | if (!tty || !info->xmit_buf || !tmp_buf){ | 2835 | if (!info->xmit_buf || !tmp_buf) |
2837 | return 0; | 2836 | return 0; |
2838 | } | ||
2839 | 2837 | ||
2840 | CY_LOCK(info, flags); | 2838 | CY_LOCK(info, flags); |
2841 | while (1) { | 2839 | while (1) { |
@@ -2884,7 +2882,7 @@ cy_put_char(struct tty_struct *tty, unsigned char ch) | |||
2884 | if (serial_paranoia_check(info, tty->name, "cy_put_char")) | 2882 | if (serial_paranoia_check(info, tty->name, "cy_put_char")) |
2885 | return; | 2883 | return; |
2886 | 2884 | ||
2887 | if (!tty || !info->xmit_buf) | 2885 | if (!info->xmit_buf) |
2888 | return; | 2886 | return; |
2889 | 2887 | ||
2890 | CY_LOCK(info, flags); | 2888 | CY_LOCK(info, flags); |
@@ -4614,7 +4612,7 @@ cy_detect_isa(void) | |||
4614 | 4612 | ||
4615 | /* allocate IRQ */ | 4613 | /* allocate IRQ */ |
4616 | if(request_irq(cy_isa_irq, cyy_interrupt, | 4614 | if(request_irq(cy_isa_irq, cyy_interrupt, |
4617 | SA_INTERRUPT, "Cyclom-Y", &cy_card[j])) | 4615 | IRQF_DISABLED, "Cyclom-Y", &cy_card[j])) |
4618 | { | 4616 | { |
4619 | printk("Cyclom-Y/ISA found at 0x%lx ", | 4617 | printk("Cyclom-Y/ISA found at 0x%lx ", |
4620 | (unsigned long) cy_isa_address); | 4618 | (unsigned long) cy_isa_address); |
@@ -4787,7 +4785,7 @@ cy_detect_pci(void) | |||
4787 | 4785 | ||
4788 | /* allocate IRQ */ | 4786 | /* allocate IRQ */ |
4789 | if(request_irq(cy_pci_irq, cyy_interrupt, | 4787 | if(request_irq(cy_pci_irq, cyy_interrupt, |
4790 | SA_SHIRQ, "Cyclom-Y", &cy_card[j])) | 4788 | IRQF_SHARED, "Cyclom-Y", &cy_card[j])) |
4791 | { | 4789 | { |
4792 | printk("Cyclom-Y/PCI found at 0x%lx ", | 4790 | printk("Cyclom-Y/PCI found at 0x%lx ", |
4793 | (ulong) cy_pci_phys2); | 4791 | (ulong) cy_pci_phys2); |
@@ -4967,7 +4965,7 @@ cy_detect_pci(void) | |||
4967 | /* allocate IRQ only if board has an IRQ */ | 4965 | /* allocate IRQ only if board has an IRQ */ |
4968 | if( (cy_pci_irq != 0) && (cy_pci_irq != 255) ) { | 4966 | if( (cy_pci_irq != 0) && (cy_pci_irq != 255) ) { |
4969 | if(request_irq(cy_pci_irq, cyz_interrupt, | 4967 | if(request_irq(cy_pci_irq, cyz_interrupt, |
4970 | SA_SHIRQ, "Cyclades-Z", &cy_card[j])) | 4968 | IRQF_SHARED, "Cyclades-Z", &cy_card[j])) |
4971 | { | 4969 | { |
4972 | printk("Cyclom-8Zo/PCI found at 0x%lx ", | 4970 | printk("Cyclom-8Zo/PCI found at 0x%lx ", |
4973 | (ulong) cy_pci_phys2); | 4971 | (ulong) cy_pci_phys2); |
@@ -5061,7 +5059,7 @@ cy_detect_pci(void) | |||
5061 | /* allocate IRQ only if board has an IRQ */ | 5059 | /* allocate IRQ only if board has an IRQ */ |
5062 | if( (cy_pci_irq != 0) && (cy_pci_irq != 255) ) { | 5060 | if( (cy_pci_irq != 0) && (cy_pci_irq != 255) ) { |
5063 | if(request_irq(cy_pci_irq, cyz_interrupt, | 5061 | if(request_irq(cy_pci_irq, cyz_interrupt, |
5064 | SA_SHIRQ, "Cyclades-Z", &cy_card[j])) | 5062 | IRQF_SHARED, "Cyclades-Z", &cy_card[j])) |
5065 | { | 5063 | { |
5066 | printk("Cyclom-Ze/PCI found at 0x%lx ", | 5064 | printk("Cyclom-Ze/PCI found at 0x%lx ", |
5067 | (ulong) cy_pci_phys2); | 5065 | (ulong) cy_pci_phys2); |
@@ -5251,7 +5249,6 @@ cy_init(void) | |||
5251 | cy_serial_driver->owner = THIS_MODULE; | 5249 | cy_serial_driver->owner = THIS_MODULE; |
5252 | cy_serial_driver->driver_name = "cyclades"; | 5250 | cy_serial_driver->driver_name = "cyclades"; |
5253 | cy_serial_driver->name = "ttyC"; | 5251 | cy_serial_driver->name = "ttyC"; |
5254 | cy_serial_driver->devfs_name = "tts/C"; | ||
5255 | cy_serial_driver->major = CYCLADES_MAJOR; | 5252 | cy_serial_driver->major = CYCLADES_MAJOR; |
5256 | cy_serial_driver->minor_start = 0; | 5253 | cy_serial_driver->minor_start = 0; |
5257 | cy_serial_driver->type = TTY_DRIVER_TYPE_SERIAL; | 5254 | cy_serial_driver->type = TTY_DRIVER_TYPE_SERIAL; |
diff --git a/drivers/char/decserial.c b/drivers/char/decserial.c index aa1440934e95..85f404e25c73 100644 --- a/drivers/char/decserial.c +++ b/drivers/char/decserial.c | |||
@@ -16,7 +16,6 @@ | |||
16 | * console device I strongly recommend to use only one. | 16 | * console device I strongly recommend to use only one. |
17 | */ | 17 | */ |
18 | 18 | ||
19 | #include <linux/config.h> | ||
20 | #include <linux/init.h> | 19 | #include <linux/init.h> |
21 | #include <asm/dec/machtype.h> | 20 | #include <asm/dec/machtype.h> |
22 | 21 | ||
diff --git a/drivers/char/drm/drm.h b/drivers/char/drm/drm.h index 9da0ddb892b5..5642ac43e0f5 100644 --- a/drivers/char/drm/drm.h +++ b/drivers/char/drm/drm.h | |||
@@ -38,7 +38,6 @@ | |||
38 | 38 | ||
39 | #if defined(__linux__) | 39 | #if defined(__linux__) |
40 | #if defined(__KERNEL__) | 40 | #if defined(__KERNEL__) |
41 | #include <linux/config.h> | ||
42 | #endif | 41 | #endif |
43 | #include <asm/ioctl.h> /* For _IO* macros */ | 42 | #include <asm/ioctl.h> /* For _IO* macros */ |
44 | #define DRM_IOCTL_NR(n) _IOC_NR(n) | 43 | #define DRM_IOCTL_NR(n) _IOC_NR(n) |
diff --git a/drivers/char/drm/drmP.h b/drivers/char/drm/drmP.h index cb76e5ca9a23..d2a56182bc35 100644 --- a/drivers/char/drm/drmP.h +++ b/drivers/char/drm/drmP.h | |||
@@ -44,7 +44,6 @@ | |||
44 | * can build the DRM (part of PI DRI). 4/21/2000 S + B */ | 44 | * can build the DRM (part of PI DRI). 4/21/2000 S + B */ |
45 | #include <asm/current.h> | 45 | #include <asm/current.h> |
46 | #endif /* __alpha__ */ | 46 | #endif /* __alpha__ */ |
47 | #include <linux/config.h> | ||
48 | #include <linux/module.h> | 47 | #include <linux/module.h> |
49 | #include <linux/kernel.h> | 48 | #include <linux/kernel.h> |
50 | #include <linux/miscdevice.h> | 49 | #include <linux/miscdevice.h> |
diff --git a/drivers/char/drm/drm_irq.c b/drivers/char/drm/drm_irq.c index 611a1173091d..ebdb7182c4fd 100644 --- a/drivers/char/drm/drm_irq.c +++ b/drivers/char/drm/drm_irq.c | |||
@@ -130,7 +130,7 @@ static int drm_irq_install(drm_device_t * dev) | |||
130 | 130 | ||
131 | /* Install handler */ | 131 | /* Install handler */ |
132 | if (drm_core_check_feature(dev, DRIVER_IRQ_SHARED)) | 132 | if (drm_core_check_feature(dev, DRIVER_IRQ_SHARED)) |
133 | sh_flags = SA_SHIRQ; | 133 | sh_flags = IRQF_SHARED; |
134 | 134 | ||
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); |
diff --git a/drivers/char/drm/drm_memory.c b/drivers/char/drm/drm_memory.c index 7e3318e1d1c6..5681cae1d404 100644 --- a/drivers/char/drm/drm_memory.c +++ b/drivers/char/drm/drm_memory.c | |||
@@ -33,7 +33,6 @@ | |||
33 | * OTHER DEALINGS IN THE SOFTWARE. | 33 | * OTHER DEALINGS IN THE SOFTWARE. |
34 | */ | 34 | */ |
35 | 35 | ||
36 | #include <linux/config.h> | ||
37 | #include <linux/highmem.h> | 36 | #include <linux/highmem.h> |
38 | #include "drmP.h" | 37 | #include "drmP.h" |
39 | 38 | ||
diff --git a/drivers/char/drm/drm_memory.h b/drivers/char/drm/drm_memory.h index 714d9aedcff5..f1b97aff10cf 100644 --- a/drivers/char/drm/drm_memory.h +++ b/drivers/char/drm/drm_memory.h | |||
@@ -33,7 +33,6 @@ | |||
33 | * OTHER DEALINGS IN THE SOFTWARE. | 33 | * OTHER DEALINGS IN THE SOFTWARE. |
34 | */ | 34 | */ |
35 | 35 | ||
36 | #include <linux/config.h> | ||
37 | #include <linux/highmem.h> | 36 | #include <linux/highmem.h> |
38 | #include <linux/vmalloc.h> | 37 | #include <linux/vmalloc.h> |
39 | #include "drmP.h" | 38 | #include "drmP.h" |
diff --git a/drivers/char/drm/drm_memory_debug.h b/drivers/char/drm/drm_memory_debug.h index 6543b9a14c42..74581af806e1 100644 --- a/drivers/char/drm/drm_memory_debug.h +++ b/drivers/char/drm/drm_memory_debug.h | |||
@@ -31,7 +31,6 @@ | |||
31 | * OTHER DEALINGS IN THE SOFTWARE. | 31 | * OTHER DEALINGS IN THE SOFTWARE. |
32 | */ | 32 | */ |
33 | 33 | ||
34 | #include <linux/config.h> | ||
35 | #include "drmP.h" | 34 | #include "drmP.h" |
36 | 35 | ||
37 | typedef struct drm_mem_stats { | 36 | typedef struct drm_mem_stats { |
@@ -43,7 +42,7 @@ typedef struct drm_mem_stats { | |||
43 | unsigned long bytes_freed; | 42 | unsigned long bytes_freed; |
44 | } drm_mem_stats_t; | 43 | } drm_mem_stats_t; |
45 | 44 | ||
46 | static spinlock_t drm_mem_lock = SPIN_LOCK_UNLOCKED; | 45 | static DEFINE_SPINLOCK(drm_mem_lock); |
47 | static unsigned long drm_ram_available = 0; /* In pages */ | 46 | static unsigned long drm_ram_available = 0; /* In pages */ |
48 | static unsigned long drm_ram_used = 0; | 47 | static unsigned long drm_ram_used = 0; |
49 | static drm_mem_stats_t drm_mem_stats[] = | 48 | static drm_mem_stats_t drm_mem_stats[] = |
diff --git a/drivers/char/drm/drm_scatter.c b/drivers/char/drm/drm_scatter.c index ce81bf248200..06ef7ddbe67d 100644 --- a/drivers/char/drm/drm_scatter.c +++ b/drivers/char/drm/drm_scatter.c | |||
@@ -31,7 +31,6 @@ | |||
31 | * DEALINGS IN THE SOFTWARE. | 31 | * DEALINGS IN THE SOFTWARE. |
32 | */ | 32 | */ |
33 | 33 | ||
34 | #include <linux/config.h> | ||
35 | #include <linux/vmalloc.h> | 34 | #include <linux/vmalloc.h> |
36 | #include "drmP.h" | 35 | #include "drmP.h" |
37 | 36 | ||
diff --git a/drivers/char/drm/drm_sysfs.c b/drivers/char/drm/drm_sysfs.c index 0b9f98a7eb10..51ad98c685c3 100644 --- a/drivers/char/drm/drm_sysfs.c +++ b/drivers/char/drm/drm_sysfs.c | |||
@@ -12,7 +12,6 @@ | |||
12 | * | 12 | * |
13 | */ | 13 | */ |
14 | 14 | ||
15 | #include <linux/config.h> | ||
16 | #include <linux/device.h> | 15 | #include <linux/device.h> |
17 | #include <linux/kdev_t.h> | 16 | #include <linux/kdev_t.h> |
18 | #include <linux/err.h> | 17 | #include <linux/err.h> |
diff --git a/drivers/char/drm/ffb_drv.c b/drivers/char/drm/ffb_drv.c index c13f9abb41e9..dd45111a4854 100644 --- a/drivers/char/drm/ffb_drv.c +++ b/drivers/char/drm/ffb_drv.c | |||
@@ -4,7 +4,6 @@ | |||
4 | * Copyright (C) 2000 David S. Miller (davem@redhat.com) | 4 | * Copyright (C) 2000 David S. Miller (davem@redhat.com) |
5 | */ | 5 | */ |
6 | 6 | ||
7 | #include <linux/config.h> | ||
8 | #include "ffb.h" | 7 | #include "ffb.h" |
9 | #include "drmP.h" | 8 | #include "drmP.h" |
10 | 9 | ||
diff --git a/drivers/char/drm/i810_drv.c b/drivers/char/drm/i810_drv.c index dfe6ad2b6a6e..fabb9a817966 100644 --- a/drivers/char/drm/i810_drv.c +++ b/drivers/char/drm/i810_drv.c | |||
@@ -30,7 +30,6 @@ | |||
30 | * Gareth Hughes <gareth@valinux.com> | 30 | * Gareth Hughes <gareth@valinux.com> |
31 | */ | 31 | */ |
32 | 32 | ||
33 | #include <linux/config.h> | ||
34 | #include "drmP.h" | 33 | #include "drmP.h" |
35 | #include "drm.h" | 34 | #include "drm.h" |
36 | #include "i810_drm.h" | 35 | #include "i810_drm.h" |
diff --git a/drivers/char/drm/i830_drv.c b/drivers/char/drm/i830_drv.c index 722658188f5f..389597e4a623 100644 --- a/drivers/char/drm/i830_drv.c +++ b/drivers/char/drm/i830_drv.c | |||
@@ -32,7 +32,6 @@ | |||
32 | * Keith Whitwell <keith@tungstengraphics.com> | 32 | * Keith Whitwell <keith@tungstengraphics.com> |
33 | */ | 33 | */ |
34 | 34 | ||
35 | #include <linux/config.h> | ||
36 | #include "drmP.h" | 35 | #include "drmP.h" |
37 | #include "drm.h" | 36 | #include "drm.h" |
38 | #include "i830_drm.h" | 37 | #include "i830_drm.h" |
diff --git a/drivers/char/drm/i915_dma.c b/drivers/char/drm/i915_dma.c index 9f4b8ce4c05e..a94233bdbc0e 100644 --- a/drivers/char/drm/i915_dma.c +++ b/drivers/char/drm/i915_dma.c | |||
@@ -758,7 +758,9 @@ drm_ioctl_desc_t i915_ioctls[] = { | |||
758 | [DRM_IOCTL_NR(DRM_I915_FREE)] = {i915_mem_free, DRM_AUTH}, | 758 | [DRM_IOCTL_NR(DRM_I915_FREE)] = {i915_mem_free, DRM_AUTH}, |
759 | [DRM_IOCTL_NR(DRM_I915_INIT_HEAP)] = {i915_mem_init_heap, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY}, | 759 | [DRM_IOCTL_NR(DRM_I915_INIT_HEAP)] = {i915_mem_init_heap, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY}, |
760 | [DRM_IOCTL_NR(DRM_I915_CMDBUFFER)] = {i915_cmdbuffer, DRM_AUTH}, | 760 | [DRM_IOCTL_NR(DRM_I915_CMDBUFFER)] = {i915_cmdbuffer, DRM_AUTH}, |
761 | [DRM_IOCTL_NR(DRM_I915_DESTROY_HEAP)] = { i915_mem_destroy_heap, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY } | 761 | [DRM_IOCTL_NR(DRM_I915_DESTROY_HEAP)] = { i915_mem_destroy_heap, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY }, |
762 | [DRM_IOCTL_NR(DRM_I915_SET_VBLANK_PIPE)] = { i915_vblank_pipe_set, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY }, | ||
763 | [DRM_IOCTL_NR(DRM_I915_GET_VBLANK_PIPE)] = { i915_vblank_pipe_get, DRM_AUTH }, | ||
762 | }; | 764 | }; |
763 | 765 | ||
764 | 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 4cb3da578330..5aa3e0e3bb45 100644 --- a/drivers/char/drm/i915_drm.h +++ b/drivers/char/drm/i915_drm.h | |||
@@ -124,6 +124,8 @@ typedef struct _drm_i915_sarea { | |||
124 | #define DRM_I915_INIT_HEAP 0x0a | 124 | #define DRM_I915_INIT_HEAP 0x0a |
125 | #define DRM_I915_CMDBUFFER 0x0b | 125 | #define DRM_I915_CMDBUFFER 0x0b |
126 | #define DRM_I915_DESTROY_HEAP 0x0c | 126 | #define DRM_I915_DESTROY_HEAP 0x0c |
127 | #define DRM_I915_SET_VBLANK_PIPE 0x0d | ||
128 | #define DRM_I915_GET_VBLANK_PIPE 0x0e | ||
127 | 129 | ||
128 | #define DRM_IOCTL_I915_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t) | 130 | #define DRM_IOCTL_I915_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t) |
129 | #define DRM_IOCTL_I915_FLUSH DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLUSH) | 131 | #define DRM_IOCTL_I915_FLUSH DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLUSH) |
@@ -138,6 +140,8 @@ typedef struct _drm_i915_sarea { | |||
138 | #define DRM_IOCTL_I915_INIT_HEAP DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT_HEAP, drm_i915_mem_init_heap_t) | 140 | #define DRM_IOCTL_I915_INIT_HEAP DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT_HEAP, drm_i915_mem_init_heap_t) |
139 | #define DRM_IOCTL_I915_CMDBUFFER DRM_IOW( DRM_COMMAND_BASE + DRM_I915_CMDBUFFER, drm_i915_cmdbuffer_t) | 141 | #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) | 142 | #define DRM_IOCTL_I915_DESTROY_HEAP DRM_IOW( DRM_COMMAND_BASE + DRM_I915_DESTROY_HEAP, drm_i915_mem_destroy_heap_t) |
143 | #define DRM_IOCTL_I915_SET_VBLANK_PIPE DRM_IOW( DRM_COMMAND_BASE + DRM_I915_SET_VBLANK_PIPE, drm_i915_vblank_pipe_t) | ||
144 | #define DRM_IOCTL_I915_GET_VBLANK_PIPE DRM_IOR( DRM_COMMAND_BASE + DRM_I915_GET_VBLANK_PIPE, drm_i915_vblank_pipe_t) | ||
141 | 145 | ||
142 | /* Allow drivers to submit batchbuffers directly to hardware, relying | 146 | /* Allow drivers to submit batchbuffers directly to hardware, relying |
143 | * on the security mechanisms provided by hardware. | 147 | * on the security mechanisms provided by hardware. |
@@ -224,4 +228,13 @@ typedef struct drm_i915_mem_destroy_heap { | |||
224 | int region; | 228 | int region; |
225 | } drm_i915_mem_destroy_heap_t; | 229 | } drm_i915_mem_destroy_heap_t; |
226 | 230 | ||
231 | /* Allow X server to configure which pipes to monitor for vblank signals | ||
232 | */ | ||
233 | #define DRM_I915_VBLANK_PIPE_A 1 | ||
234 | #define DRM_I915_VBLANK_PIPE_B 2 | ||
235 | |||
236 | typedef struct drm_i915_vblank_pipe { | ||
237 | int pipe; | ||
238 | } drm_i915_vblank_pipe_t; | ||
239 | |||
227 | #endif /* _I915_DRM_H_ */ | 240 | #endif /* _I915_DRM_H_ */ |
diff --git a/drivers/char/drm/i915_drv.h b/drivers/char/drm/i915_drv.h index 7a65666899e4..2d565031c002 100644 --- a/drivers/char/drm/i915_drv.h +++ b/drivers/char/drm/i915_drv.h | |||
@@ -45,9 +45,10 @@ | |||
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 | * 1.4: Fix cmdbuffer path, add heap destroy |
48 | * 1.5: Add vblank pipe configuration | ||
48 | */ | 49 | */ |
49 | #define DRIVER_MAJOR 1 | 50 | #define DRIVER_MAJOR 1 |
50 | #define DRIVER_MINOR 4 | 51 | #define DRIVER_MINOR 5 |
51 | #define DRIVER_PATCHLEVEL 0 | 52 | #define DRIVER_PATCHLEVEL 0 |
52 | 53 | ||
53 | typedef struct _drm_i915_ring_buffer { | 54 | typedef struct _drm_i915_ring_buffer { |
@@ -96,6 +97,7 @@ typedef struct drm_i915_private { | |||
96 | int allow_batchbuffer; | 97 | int allow_batchbuffer; |
97 | struct mem_block *agp_heap; | 98 | struct mem_block *agp_heap; |
98 | unsigned int sr01, adpa, ppcr, dvob, dvoc, lvds; | 99 | unsigned int sr01, adpa, ppcr, dvob, dvoc, lvds; |
100 | int vblank_pipe; | ||
99 | } drm_i915_private_t; | 101 | } drm_i915_private_t; |
100 | 102 | ||
101 | extern drm_ioctl_desc_t i915_ioctls[]; | 103 | extern drm_ioctl_desc_t i915_ioctls[]; |
@@ -119,6 +121,8 @@ extern irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS); | |||
119 | extern void i915_driver_irq_preinstall(drm_device_t * dev); | 121 | extern void i915_driver_irq_preinstall(drm_device_t * dev); |
120 | extern void i915_driver_irq_postinstall(drm_device_t * dev); | 122 | extern void i915_driver_irq_postinstall(drm_device_t * dev); |
121 | extern void i915_driver_irq_uninstall(drm_device_t * dev); | 123 | extern void i915_driver_irq_uninstall(drm_device_t * dev); |
124 | extern int i915_vblank_pipe_set(DRM_IOCTL_ARGS); | ||
125 | extern int i915_vblank_pipe_get(DRM_IOCTL_ARGS); | ||
122 | 126 | ||
123 | /* i915_mem.c */ | 127 | /* i915_mem.c */ |
124 | extern int i915_mem_alloc(DRM_IOCTL_ARGS); | 128 | extern int i915_mem_alloc(DRM_IOCTL_ARGS); |
diff --git a/drivers/char/drm/i915_irq.c b/drivers/char/drm/i915_irq.c index a752afd86ab8..cd96cfa430db 100644 --- a/drivers/char/drm/i915_irq.c +++ b/drivers/char/drm/i915_irq.c | |||
@@ -44,7 +44,8 @@ irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS) | |||
44 | u16 temp; | 44 | u16 temp; |
45 | 45 | ||
46 | temp = I915_READ16(I915REG_INT_IDENTITY_R); | 46 | temp = I915_READ16(I915REG_INT_IDENTITY_R); |
47 | temp &= (USER_INT_FLAG | VSYNC_PIPEA_FLAG); | 47 | |
48 | temp &= (USER_INT_FLAG | VSYNC_PIPEA_FLAG | VSYNC_PIPEB_FLAG); | ||
48 | 49 | ||
49 | DRM_DEBUG("%s flag=%08x\n", __FUNCTION__, temp); | 50 | DRM_DEBUG("%s flag=%08x\n", __FUNCTION__, temp); |
50 | 51 | ||
@@ -58,7 +59,7 @@ irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS) | |||
58 | if (temp & USER_INT_FLAG) | 59 | if (temp & USER_INT_FLAG) |
59 | DRM_WAKEUP(&dev_priv->irq_queue); | 60 | DRM_WAKEUP(&dev_priv->irq_queue); |
60 | 61 | ||
61 | if (temp & VSYNC_PIPEA_FLAG) { | 62 | if (temp & (VSYNC_PIPEA_FLAG | VSYNC_PIPEB_FLAG)) { |
62 | atomic_inc(&dev->vbl_received); | 63 | atomic_inc(&dev->vbl_received); |
63 | DRM_WAKEUP(&dev->vbl_queue); | 64 | DRM_WAKEUP(&dev->vbl_queue); |
64 | drm_vbl_send_signals(dev); | 65 | drm_vbl_send_signals(dev); |
@@ -182,6 +183,68 @@ int i915_irq_wait(DRM_IOCTL_ARGS) | |||
182 | return i915_wait_irq(dev, irqwait.irq_seq); | 183 | return i915_wait_irq(dev, irqwait.irq_seq); |
183 | } | 184 | } |
184 | 185 | ||
186 | static int i915_enable_interrupt (drm_device_t *dev) | ||
187 | { | ||
188 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; | ||
189 | u16 flag; | ||
190 | |||
191 | flag = 0; | ||
192 | if (dev_priv->vblank_pipe & DRM_I915_VBLANK_PIPE_A) | ||
193 | flag |= VSYNC_PIPEA_FLAG; | ||
194 | if (dev_priv->vblank_pipe & DRM_I915_VBLANK_PIPE_B) | ||
195 | flag |= VSYNC_PIPEB_FLAG; | ||
196 | if (dev_priv->vblank_pipe & ~(DRM_I915_VBLANK_PIPE_A|DRM_I915_VBLANK_PIPE_B)) { | ||
197 | DRM_ERROR("%s called with invalid pipe 0x%x\n", | ||
198 | __FUNCTION__, dev_priv->vblank_pipe); | ||
199 | return DRM_ERR(EINVAL); | ||
200 | } | ||
201 | I915_WRITE16(I915REG_INT_ENABLE_R, USER_INT_FLAG | flag); | ||
202 | return 0; | ||
203 | } | ||
204 | |||
205 | /* Set the vblank monitor pipe | ||
206 | */ | ||
207 | int i915_vblank_pipe_set(DRM_IOCTL_ARGS) | ||
208 | { | ||
209 | DRM_DEVICE; | ||
210 | drm_i915_private_t *dev_priv = dev->dev_private; | ||
211 | drm_i915_vblank_pipe_t pipe; | ||
212 | |||
213 | if (!dev_priv) { | ||
214 | DRM_ERROR("%s called with no initialization\n", __FUNCTION__); | ||
215 | return DRM_ERR(EINVAL); | ||
216 | } | ||
217 | |||
218 | DRM_COPY_FROM_USER_IOCTL(pipe, (drm_i915_vblank_pipe_t __user *) data, | ||
219 | sizeof(pipe)); | ||
220 | |||
221 | dev_priv->vblank_pipe = pipe.pipe; | ||
222 | return i915_enable_interrupt (dev); | ||
223 | } | ||
224 | |||
225 | int i915_vblank_pipe_get(DRM_IOCTL_ARGS) | ||
226 | { | ||
227 | DRM_DEVICE; | ||
228 | drm_i915_private_t *dev_priv = dev->dev_private; | ||
229 | drm_i915_vblank_pipe_t pipe; | ||
230 | u16 flag; | ||
231 | |||
232 | if (!dev_priv) { | ||
233 | DRM_ERROR("%s called with no initialization\n", __FUNCTION__); | ||
234 | return DRM_ERR(EINVAL); | ||
235 | } | ||
236 | |||
237 | flag = I915_READ(I915REG_INT_ENABLE_R); | ||
238 | pipe.pipe = 0; | ||
239 | if (flag & VSYNC_PIPEA_FLAG) | ||
240 | pipe.pipe |= DRM_I915_VBLANK_PIPE_A; | ||
241 | if (flag & VSYNC_PIPEB_FLAG) | ||
242 | pipe.pipe |= DRM_I915_VBLANK_PIPE_B; | ||
243 | DRM_COPY_TO_USER_IOCTL((drm_i915_vblank_pipe_t __user *) data, pipe, | ||
244 | sizeof(pipe)); | ||
245 | return 0; | ||
246 | } | ||
247 | |||
185 | /* drm_dma.h hooks | 248 | /* drm_dma.h hooks |
186 | */ | 249 | */ |
187 | void i915_driver_irq_preinstall(drm_device_t * dev) | 250 | void i915_driver_irq_preinstall(drm_device_t * dev) |
@@ -197,7 +260,7 @@ void i915_driver_irq_postinstall(drm_device_t * dev) | |||
197 | { | 260 | { |
198 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; | 261 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; |
199 | 262 | ||
200 | I915_WRITE16(I915REG_INT_ENABLE_R, USER_INT_FLAG | VSYNC_PIPEA_FLAG); | 263 | i915_enable_interrupt(dev); |
201 | DRM_INIT_WAITQUEUE(&dev_priv->irq_queue); | 264 | DRM_INIT_WAITQUEUE(&dev_priv->irq_queue); |
202 | } | 265 | } |
203 | 266 | ||
diff --git a/drivers/char/drm/mga_drv.c b/drivers/char/drm/mga_drv.c index 9f7ed0e0351b..e30f556b79f1 100644 --- a/drivers/char/drm/mga_drv.c +++ b/drivers/char/drm/mga_drv.c | |||
@@ -29,7 +29,6 @@ | |||
29 | * Gareth Hughes <gareth@valinux.com> | 29 | * Gareth Hughes <gareth@valinux.com> |
30 | */ | 30 | */ |
31 | 31 | ||
32 | #include <linux/config.h> | ||
33 | #include "drmP.h" | 32 | #include "drmP.h" |
34 | #include "drm.h" | 33 | #include "drm.h" |
35 | #include "mga_drm.h" | 34 | #include "mga_drm.h" |
diff --git a/drivers/char/drm/r128_drv.c b/drivers/char/drm/r128_drv.c index e20450ae220e..6108e7587e12 100644 --- a/drivers/char/drm/r128_drv.c +++ b/drivers/char/drm/r128_drv.c | |||
@@ -29,7 +29,6 @@ | |||
29 | * Gareth Hughes <gareth@valinux.com> | 29 | * Gareth Hughes <gareth@valinux.com> |
30 | */ | 30 | */ |
31 | 31 | ||
32 | #include <linux/config.h> | ||
33 | #include "drmP.h" | 32 | #include "drmP.h" |
34 | #include "drm.h" | 33 | #include "drm.h" |
35 | #include "r128_drm.h" | 34 | #include "r128_drm.h" |
diff --git a/drivers/char/drm/radeon_cp.c b/drivers/char/drm/radeon_cp.c index 7f949c9c9691..5ad43ba7b5aa 100644 --- a/drivers/char/drm/radeon_cp.c +++ b/drivers/char/drm/radeon_cp.c | |||
@@ -39,7 +39,7 @@ | |||
39 | static int radeon_do_cleanup_cp(drm_device_t * dev); | 39 | static int radeon_do_cleanup_cp(drm_device_t * dev); |
40 | 40 | ||
41 | /* CP microcode (from ATI) */ | 41 | /* CP microcode (from ATI) */ |
42 | static u32 R200_cp_microcode[][2] = { | 42 | static const u32 R200_cp_microcode[][2] = { |
43 | {0x21007000, 0000000000}, | 43 | {0x21007000, 0000000000}, |
44 | {0x20007000, 0000000000}, | 44 | {0x20007000, 0000000000}, |
45 | {0x000000ab, 0x00000004}, | 45 | {0x000000ab, 0x00000004}, |
@@ -298,7 +298,7 @@ static u32 R200_cp_microcode[][2] = { | |||
298 | {0000000000, 0000000000}, | 298 | {0000000000, 0000000000}, |
299 | }; | 299 | }; |
300 | 300 | ||
301 | static u32 radeon_cp_microcode[][2] = { | 301 | static const u32 radeon_cp_microcode[][2] = { |
302 | {0x21007000, 0000000000}, | 302 | {0x21007000, 0000000000}, |
303 | {0x20007000, 0000000000}, | 303 | {0x20007000, 0000000000}, |
304 | {0x000000b4, 0x00000004}, | 304 | {0x000000b4, 0x00000004}, |
@@ -557,7 +557,7 @@ static u32 radeon_cp_microcode[][2] = { | |||
557 | {0000000000, 0000000000}, | 557 | {0000000000, 0000000000}, |
558 | }; | 558 | }; |
559 | 559 | ||
560 | static u32 R300_cp_microcode[][2] = { | 560 | static const u32 R300_cp_microcode[][2] = { |
561 | {0x4200e000, 0000000000}, | 561 | {0x4200e000, 0000000000}, |
562 | {0x4000e000, 0000000000}, | 562 | {0x4000e000, 0000000000}, |
563 | {0x000000af, 0x00000008}, | 563 | {0x000000af, 0x00000008}, |
diff --git a/drivers/char/drm/radeon_drm.h b/drivers/char/drm/radeon_drm.h index c8e279e89c2e..8d6350dd5360 100644 --- a/drivers/char/drm/radeon_drm.h +++ b/drivers/char/drm/radeon_drm.h | |||
@@ -161,7 +161,8 @@ | |||
161 | #define R200_EMIT_PP_TXCTLALL_3 91 | 161 | #define R200_EMIT_PP_TXCTLALL_3 91 |
162 | #define R200_EMIT_PP_TXCTLALL_4 92 | 162 | #define R200_EMIT_PP_TXCTLALL_4 92 |
163 | #define R200_EMIT_PP_TXCTLALL_5 93 | 163 | #define R200_EMIT_PP_TXCTLALL_5 93 |
164 | #define RADEON_MAX_STATE_PACKETS 94 | 164 | #define R200_EMIT_VAP_PVS_CNTL 94 |
165 | #define RADEON_MAX_STATE_PACKETS 95 | ||
165 | 166 | ||
166 | /* Commands understood by cmd_buffer ioctl. More can be added but | 167 | /* Commands understood by cmd_buffer ioctl. More can be added but |
167 | * obviously these can't be removed or changed: | 168 | * obviously these can't be removed or changed: |
@@ -176,6 +177,7 @@ | |||
176 | #define RADEON_CMD_WAIT 8 /* emit hw wait commands -- note: | 177 | #define RADEON_CMD_WAIT 8 /* emit hw wait commands -- note: |
177 | * doesn't make the cpu wait, just | 178 | * doesn't make the cpu wait, just |
178 | * the graphics hardware */ | 179 | * the graphics hardware */ |
180 | #define RADEON_CMD_VECLINEAR 9 /* another r200 stopgap */ | ||
179 | 181 | ||
180 | typedef union { | 182 | typedef union { |
181 | int i; | 183 | int i; |
@@ -192,6 +194,9 @@ typedef union { | |||
192 | unsigned char cmd_type, offset, stride, count; | 194 | unsigned char cmd_type, offset, stride, count; |
193 | } vectors; | 195 | } vectors; |
194 | struct { | 196 | struct { |
197 | unsigned char cmd_type, addr_lo, addr_hi, count; | ||
198 | } veclinear; | ||
199 | struct { | ||
195 | unsigned char cmd_type, buf_idx, pad0, pad1; | 200 | unsigned char cmd_type, buf_idx, pad0, pad1; |
196 | } dma; | 201 | } dma; |
197 | struct { | 202 | struct { |
diff --git a/drivers/char/drm/radeon_drv.c b/drivers/char/drm/radeon_drv.c index b04ed1b562b9..eb985c2a31e9 100644 --- a/drivers/char/drm/radeon_drv.c +++ b/drivers/char/drm/radeon_drv.c | |||
@@ -29,7 +29,6 @@ | |||
29 | * OTHER DEALINGS IN THE SOFTWARE. | 29 | * OTHER DEALINGS IN THE SOFTWARE. |
30 | */ | 30 | */ |
31 | 31 | ||
32 | #include <linux/config.h> | ||
33 | #include "drmP.h" | 32 | #include "drmP.h" |
34 | #include "drm.h" | 33 | #include "drm.h" |
35 | #include "radeon_drm.h" | 34 | #include "radeon_drm.h" |
diff --git a/drivers/char/drm/radeon_drv.h b/drivers/char/drm/radeon_drv.h index 78345cee8f8e..e5a256f5429c 100644 --- a/drivers/char/drm/radeon_drv.h +++ b/drivers/char/drm/radeon_drv.h | |||
@@ -38,7 +38,7 @@ | |||
38 | 38 | ||
39 | #define DRIVER_NAME "radeon" | 39 | #define DRIVER_NAME "radeon" |
40 | #define DRIVER_DESC "ATI Radeon" | 40 | #define DRIVER_DESC "ATI Radeon" |
41 | #define DRIVER_DATE "20060225" | 41 | #define DRIVER_DATE "20060524" |
42 | 42 | ||
43 | /* Interface history: | 43 | /* Interface history: |
44 | * | 44 | * |
@@ -93,9 +93,11 @@ | |||
93 | * 1.22- Add support for texture cache flushes (R300_TX_CNTL) | 93 | * 1.22- Add support for texture cache flushes (R300_TX_CNTL) |
94 | * 1.23- Add new radeon memory map work from benh | 94 | * 1.23- Add new radeon memory map work from benh |
95 | * 1.24- Add general-purpose packet for manipulating scratch registers (r300) | 95 | * 1.24- Add general-purpose packet for manipulating scratch registers (r300) |
96 | * 1.25- Add support for r200 vertex programs (R200_EMIT_VAP_PVS_CNTL, | ||
97 | * new packet type) | ||
96 | */ | 98 | */ |
97 | #define DRIVER_MAJOR 1 | 99 | #define DRIVER_MAJOR 1 |
98 | #define DRIVER_MINOR 24 | 100 | #define DRIVER_MINOR 25 |
99 | #define DRIVER_PATCHLEVEL 0 | 101 | #define DRIVER_PATCHLEVEL 0 |
100 | 102 | ||
101 | /* | 103 | /* |
@@ -884,6 +886,8 @@ extern int r300_do_cp_cmdbuf(drm_device_t * dev, DRMFILE filp, | |||
884 | #define RADEON_PP_CUBIC_OFFSET_T1_0 0x1e00 | 886 | #define RADEON_PP_CUBIC_OFFSET_T1_0 0x1e00 |
885 | #define RADEON_PP_CUBIC_OFFSET_T2_0 0x1e14 | 887 | #define RADEON_PP_CUBIC_OFFSET_T2_0 0x1e14 |
886 | 888 | ||
889 | #define RADEON_SE_TCL_STATE_FLUSH 0x2284 | ||
890 | |||
887 | #define SE_VAP_CNTL__TCL_ENA_MASK 0x00000001 | 891 | #define SE_VAP_CNTL__TCL_ENA_MASK 0x00000001 |
888 | #define SE_VAP_CNTL__FORCE_W_TO_ONE_MASK 0x00010000 | 892 | #define SE_VAP_CNTL__FORCE_W_TO_ONE_MASK 0x00010000 |
889 | #define SE_VAP_CNTL__VF_MAX_VTX_NUM__SHIFT 0x00000012 | 893 | #define SE_VAP_CNTL__VF_MAX_VTX_NUM__SHIFT 0x00000012 |
@@ -905,6 +909,8 @@ extern int r300_do_cp_cmdbuf(drm_device_t * dev, DRMFILE filp, | |||
905 | #define R200_PP_AFS_0 0x2f80 | 909 | #define R200_PP_AFS_0 0x2f80 |
906 | #define R200_PP_AFS_1 0x2f00 /* same as txcblend_0 */ | 910 | #define R200_PP_AFS_1 0x2f00 /* same as txcblend_0 */ |
907 | 911 | ||
912 | #define R200_VAP_PVS_CNTL_1 0x22D0 | ||
913 | |||
908 | /* Constants */ | 914 | /* Constants */ |
909 | #define RADEON_MAX_USEC_TIMEOUT 100000 /* 100 ms */ | 915 | #define RADEON_MAX_USEC_TIMEOUT 100000 /* 100 ms */ |
910 | 916 | ||
diff --git a/drivers/char/drm/radeon_state.c b/drivers/char/drm/radeon_state.c index c5b8f774a599..5bb2234a9094 100644 --- a/drivers/char/drm/radeon_state.c +++ b/drivers/char/drm/radeon_state.c | |||
@@ -249,6 +249,7 @@ static __inline__ int radeon_check_and_fixup_packets(drm_radeon_private_t * | |||
249 | case R200_EMIT_PP_TXCTLALL_3: | 249 | case R200_EMIT_PP_TXCTLALL_3: |
250 | case R200_EMIT_PP_TXCTLALL_4: | 250 | case R200_EMIT_PP_TXCTLALL_4: |
251 | case R200_EMIT_PP_TXCTLALL_5: | 251 | case R200_EMIT_PP_TXCTLALL_5: |
252 | case R200_EMIT_VAP_PVS_CNTL: | ||
252 | /* These packets don't contain memory offsets */ | 253 | /* These packets don't contain memory offsets */ |
253 | break; | 254 | break; |
254 | 255 | ||
@@ -626,6 +627,7 @@ static struct { | |||
626 | {R200_PP_TXFILTER_3, 8, "R200_PP_TXCTLALL_3"}, | 627 | {R200_PP_TXFILTER_3, 8, "R200_PP_TXCTLALL_3"}, |
627 | {R200_PP_TXFILTER_4, 8, "R200_PP_TXCTLALL_4"}, | 628 | {R200_PP_TXFILTER_4, 8, "R200_PP_TXCTLALL_4"}, |
628 | {R200_PP_TXFILTER_5, 8, "R200_PP_TXCTLALL_5"}, | 629 | {R200_PP_TXFILTER_5, 8, "R200_PP_TXCTLALL_5"}, |
630 | {R200_VAP_PVS_CNTL_1, 2, "R200_VAP_PVS_CNTL"}, | ||
629 | }; | 631 | }; |
630 | 632 | ||
631 | /* ================================================================ | 633 | /* ================================================================ |
@@ -2595,7 +2597,8 @@ static __inline__ int radeon_emit_vectors(drm_radeon_private_t *dev_priv, | |||
2595 | int stride = header.vectors.stride; | 2597 | int stride = header.vectors.stride; |
2596 | RING_LOCALS; | 2598 | RING_LOCALS; |
2597 | 2599 | ||
2598 | BEGIN_RING(3 + sz); | 2600 | BEGIN_RING(5 + sz); |
2601 | OUT_RING_REG(RADEON_SE_TCL_STATE_FLUSH, 0); | ||
2599 | OUT_RING(CP_PACKET0(RADEON_SE_TCL_VECTOR_INDX_REG, 0)); | 2602 | OUT_RING(CP_PACKET0(RADEON_SE_TCL_VECTOR_INDX_REG, 0)); |
2600 | OUT_RING(start | (stride << RADEON_VEC_INDX_OCTWORD_STRIDE_SHIFT)); | 2603 | OUT_RING(start | (stride << RADEON_VEC_INDX_OCTWORD_STRIDE_SHIFT)); |
2601 | OUT_RING(CP_PACKET0_TABLE(RADEON_SE_TCL_VECTOR_DATA_REG, (sz - 1))); | 2604 | OUT_RING(CP_PACKET0_TABLE(RADEON_SE_TCL_VECTOR_DATA_REG, (sz - 1))); |
@@ -2607,6 +2610,32 @@ static __inline__ int radeon_emit_vectors(drm_radeon_private_t *dev_priv, | |||
2607 | return 0; | 2610 | return 0; |
2608 | } | 2611 | } |
2609 | 2612 | ||
2613 | static __inline__ int radeon_emit_veclinear(drm_radeon_private_t *dev_priv, | ||
2614 | drm_radeon_cmd_header_t header, | ||
2615 | drm_radeon_kcmd_buffer_t *cmdbuf) | ||
2616 | { | ||
2617 | int sz = header.veclinear.count * 4; | ||
2618 | int start = header.veclinear.addr_lo | (header.veclinear.addr_hi << 8); | ||
2619 | RING_LOCALS; | ||
2620 | |||
2621 | if (!sz) | ||
2622 | return 0; | ||
2623 | if (sz * 4 > cmdbuf->bufsz) | ||
2624 | return DRM_ERR(EINVAL); | ||
2625 | |||
2626 | BEGIN_RING(5 + sz); | ||
2627 | OUT_RING_REG(RADEON_SE_TCL_STATE_FLUSH, 0); | ||
2628 | OUT_RING(CP_PACKET0(RADEON_SE_TCL_VECTOR_INDX_REG, 0)); | ||
2629 | OUT_RING(start | (1 << RADEON_VEC_INDX_OCTWORD_STRIDE_SHIFT)); | ||
2630 | OUT_RING(CP_PACKET0_TABLE(RADEON_SE_TCL_VECTOR_DATA_REG, (sz - 1))); | ||
2631 | OUT_RING_TABLE(cmdbuf->buf, sz); | ||
2632 | ADVANCE_RING(); | ||
2633 | |||
2634 | cmdbuf->buf += sz * sizeof(int); | ||
2635 | cmdbuf->bufsz -= sz * sizeof(int); | ||
2636 | return 0; | ||
2637 | } | ||
2638 | |||
2610 | static int radeon_emit_packet3(drm_device_t * dev, | 2639 | static int radeon_emit_packet3(drm_device_t * dev, |
2611 | drm_file_t * filp_priv, | 2640 | drm_file_t * filp_priv, |
2612 | drm_radeon_kcmd_buffer_t *cmdbuf) | 2641 | drm_radeon_kcmd_buffer_t *cmdbuf) |
@@ -2865,6 +2894,14 @@ static int radeon_cp_cmdbuf(DRM_IOCTL_ARGS) | |||
2865 | goto err; | 2894 | goto err; |
2866 | } | 2895 | } |
2867 | break; | 2896 | break; |
2897 | case RADEON_CMD_VECLINEAR: | ||
2898 | DRM_DEBUG("RADEON_CMD_VECLINEAR\n"); | ||
2899 | if (radeon_emit_veclinear(dev_priv, header, &cmdbuf)) { | ||
2900 | DRM_ERROR("radeon_emit_veclinear failed\n"); | ||
2901 | goto err; | ||
2902 | } | ||
2903 | break; | ||
2904 | |||
2868 | default: | 2905 | default: |
2869 | DRM_ERROR("bad cmd_type %d at %p\n", | 2906 | DRM_ERROR("bad cmd_type %d at %p\n", |
2870 | header.header.cmd_type, | 2907 | header.header.cmd_type, |
diff --git a/drivers/char/drm/savage_drv.c b/drivers/char/drm/savage_drv.c index aa6c0d1a82f8..eee52aa92a7c 100644 --- a/drivers/char/drm/savage_drv.c +++ b/drivers/char/drm/savage_drv.c | |||
@@ -23,7 +23,6 @@ | |||
23 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 23 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
24 | */ | 24 | */ |
25 | 25 | ||
26 | #include <linux/config.h> | ||
27 | #include "drmP.h" | 26 | #include "drmP.h" |
28 | #include "savage_drm.h" | 27 | #include "savage_drm.h" |
29 | #include "savage_drv.h" | 28 | #include "savage_drv.h" |
diff --git a/drivers/char/drm/sis_drv.c b/drivers/char/drm/sis_drv.c index 6f6d7d613ede..5e9dc86f2956 100644 --- a/drivers/char/drm/sis_drv.c +++ b/drivers/char/drm/sis_drv.c | |||
@@ -25,7 +25,6 @@ | |||
25 | * | 25 | * |
26 | */ | 26 | */ |
27 | 27 | ||
28 | #include <linux/config.h> | ||
29 | #include "drmP.h" | 28 | #include "drmP.h" |
30 | #include "sis_drm.h" | 29 | #include "sis_drm.h" |
31 | #include "sis_drv.h" | 30 | #include "sis_drv.h" |
diff --git a/drivers/char/drm/tdfx_drv.c b/drivers/char/drm/tdfx_drv.c index baa4416032a8..012ff2e356b2 100644 --- a/drivers/char/drm/tdfx_drv.c +++ b/drivers/char/drm/tdfx_drv.c | |||
@@ -30,7 +30,6 @@ | |||
30 | * Gareth Hughes <gareth@valinux.com> | 30 | * Gareth Hughes <gareth@valinux.com> |
31 | */ | 31 | */ |
32 | 32 | ||
33 | #include <linux/config.h> | ||
34 | #include "drmP.h" | 33 | #include "drmP.h" |
35 | #include "tdfx_drv.h" | 34 | #include "tdfx_drv.h" |
36 | 35 | ||
diff --git a/drivers/char/drm/via_dmablit.c b/drivers/char/drm/via_dmablit.c index b7f17457b424..78a81a4a99c5 100644 --- a/drivers/char/drm/via_dmablit.c +++ b/drivers/char/drm/via_dmablit.c | |||
@@ -557,7 +557,7 @@ via_init_dmablit(drm_device_t *dev) | |||
557 | blitq->num_outstanding = 0; | 557 | blitq->num_outstanding = 0; |
558 | blitq->is_active = 0; | 558 | blitq->is_active = 0; |
559 | blitq->aborting = 0; | 559 | blitq->aborting = 0; |
560 | blitq->blit_lock = SPIN_LOCK_UNLOCKED; | 560 | spin_lock_init(&blitq->blit_lock); |
561 | for (j=0; j<VIA_NUM_BLIT_SLOTS; ++j) { | 561 | for (j=0; j<VIA_NUM_BLIT_SLOTS; ++j) { |
562 | DRM_INIT_WAITQUEUE(blitq->blit_queue + j); | 562 | DRM_INIT_WAITQUEUE(blitq->blit_queue + j); |
563 | } | 563 | } |
diff --git a/drivers/char/drm/via_drv.c b/drivers/char/drm/via_drv.c index 3f012255d315..b3d364d793d7 100644 --- a/drivers/char/drm/via_drv.c +++ b/drivers/char/drm/via_drv.c | |||
@@ -22,7 +22,6 @@ | |||
22 | * DEALINGS IN THE SOFTWARE. | 22 | * DEALINGS IN THE SOFTWARE. |
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include <linux/config.h> | ||
26 | #include "drmP.h" | 25 | #include "drmP.h" |
27 | #include "via_drm.h" | 26 | #include "via_drm.h" |
28 | #include "via_drv.h" | 27 | #include "via_drv.h" |
diff --git a/drivers/char/ds1286.c b/drivers/char/ds1286.c index d755cac14bc1..21c8229f5443 100644 --- a/drivers/char/ds1286.c +++ b/drivers/char/ds1286.c | |||
@@ -281,7 +281,7 @@ static unsigned int ds1286_poll(struct file *file, poll_table *wait) | |||
281 | * The various file operations we support. | 281 | * The various file operations we support. |
282 | */ | 282 | */ |
283 | 283 | ||
284 | static struct file_operations ds1286_fops = { | 284 | static const struct file_operations ds1286_fops = { |
285 | .llseek = no_llseek, | 285 | .llseek = no_llseek, |
286 | .read = ds1286_read, | 286 | .read = ds1286_read, |
287 | .poll = ds1286_poll, | 287 | .poll = ds1286_poll, |
diff --git a/drivers/char/ds1302.c b/drivers/char/ds1302.c index a75e8609be01..bcdb107aa967 100644 --- a/drivers/char/ds1302.c +++ b/drivers/char/ds1302.c | |||
@@ -12,7 +12,6 @@ | |||
12 | *! | 12 | *! |
13 | *!***************************************************************************/ | 13 | *!***************************************************************************/ |
14 | 14 | ||
15 | #include <linux/config.h> | ||
16 | 15 | ||
17 | #include <linux/fs.h> | 16 | #include <linux/fs.h> |
18 | #include <linux/init.h> | 17 | #include <linux/init.h> |
@@ -283,7 +282,7 @@ get_rtc_status(char *buf) | |||
283 | 282 | ||
284 | /* The various file operations we support. */ | 283 | /* The various file operations we support. */ |
285 | 284 | ||
286 | static struct file_operations rtc_fops = { | 285 | static const struct file_operations rtc_fops = { |
287 | .owner = THIS_MODULE, | 286 | .owner = THIS_MODULE, |
288 | .ioctl = rtc_ioctl, | 287 | .ioctl = rtc_ioctl, |
289 | }; | 288 | }; |
diff --git a/drivers/char/ds1620.c b/drivers/char/ds1620.c index 62cda25724e3..48cb8f0e8ebf 100644 --- a/drivers/char/ds1620.c +++ b/drivers/char/ds1620.c | |||
@@ -2,7 +2,6 @@ | |||
2 | * linux/drivers/char/ds1620.c: Dallas Semiconductors DS1620 | 2 | * linux/drivers/char/ds1620.c: Dallas Semiconductors DS1620 |
3 | * thermometer driver (as used in the Rebel.com NetWinder) | 3 | * thermometer driver (as used in the Rebel.com NetWinder) |
4 | */ | 4 | */ |
5 | #include <linux/config.h> | ||
6 | #include <linux/module.h> | 5 | #include <linux/module.h> |
7 | #include <linux/sched.h> | 6 | #include <linux/sched.h> |
8 | #include <linux/miscdevice.h> | 7 | #include <linux/miscdevice.h> |
@@ -337,7 +336,7 @@ proc_therm_ds1620_read(char *buf, char **start, off_t offset, | |||
337 | static struct proc_dir_entry *proc_therm_ds1620; | 336 | static struct proc_dir_entry *proc_therm_ds1620; |
338 | #endif | 337 | #endif |
339 | 338 | ||
340 | static struct file_operations ds1620_fops = { | 339 | static const struct file_operations ds1620_fops = { |
341 | .owner = THIS_MODULE, | 340 | .owner = THIS_MODULE, |
342 | .open = nonseekable_open, | 341 | .open = nonseekable_open, |
343 | .read = ds1620_read, | 342 | .read = ds1620_read, |
diff --git a/drivers/char/dsp56k.c b/drivers/char/dsp56k.c index e233cf280bc0..9b1bf60ffbe7 100644 --- a/drivers/char/dsp56k.c +++ b/drivers/char/dsp56k.c | |||
@@ -33,7 +33,6 @@ | |||
33 | #include <linux/fs.h> | 33 | #include <linux/fs.h> |
34 | #include <linux/mm.h> | 34 | #include <linux/mm.h> |
35 | #include <linux/init.h> | 35 | #include <linux/init.h> |
36 | #include <linux/devfs_fs_kernel.h> | ||
37 | #include <linux/smp_lock.h> | 36 | #include <linux/smp_lock.h> |
38 | #include <linux/device.h> | 37 | #include <linux/device.h> |
39 | 38 | ||
@@ -484,7 +483,7 @@ static int dsp56k_release(struct inode *inode, struct file *file) | |||
484 | return 0; | 483 | return 0; |
485 | } | 484 | } |
486 | 485 | ||
487 | static struct file_operations dsp56k_fops = { | 486 | static const struct file_operations dsp56k_fops = { |
488 | .owner = THIS_MODULE, | 487 | .owner = THIS_MODULE, |
489 | .read = dsp56k_read, | 488 | .read = dsp56k_read, |
490 | .write = dsp56k_write, | 489 | .write = dsp56k_write, |
@@ -518,17 +517,9 @@ static int __init dsp56k_init_driver(void) | |||
518 | } | 517 | } |
519 | class_device_create(dsp56k_class, NULL, MKDEV(DSP56K_MAJOR, 0), NULL, "dsp56k"); | 518 | class_device_create(dsp56k_class, NULL, MKDEV(DSP56K_MAJOR, 0), NULL, "dsp56k"); |
520 | 519 | ||
521 | err = devfs_mk_cdev(MKDEV(DSP56K_MAJOR, 0), | ||
522 | S_IFCHR | S_IRUSR | S_IWUSR, "dsp56k"); | ||
523 | if(err) | ||
524 | goto out_class; | ||
525 | |||
526 | printk(banner); | 520 | printk(banner); |
527 | goto out; | 521 | goto out; |
528 | 522 | ||
529 | out_class: | ||
530 | class_device_destroy(dsp56k_class, MKDEV(DSP56K_MAJOR, 0)); | ||
531 | class_destroy(dsp56k_class); | ||
532 | out_chrdev: | 523 | out_chrdev: |
533 | unregister_chrdev(DSP56K_MAJOR, "dsp56k"); | 524 | unregister_chrdev(DSP56K_MAJOR, "dsp56k"); |
534 | out: | 525 | out: |
@@ -541,7 +532,6 @@ static void __exit dsp56k_cleanup_driver(void) | |||
541 | class_device_destroy(dsp56k_class, MKDEV(DSP56K_MAJOR, 0)); | 532 | class_device_destroy(dsp56k_class, MKDEV(DSP56K_MAJOR, 0)); |
542 | class_destroy(dsp56k_class); | 533 | class_destroy(dsp56k_class); |
543 | unregister_chrdev(DSP56K_MAJOR, "dsp56k"); | 534 | unregister_chrdev(DSP56K_MAJOR, "dsp56k"); |
544 | devfs_remove("dsp56k"); | ||
545 | } | 535 | } |
546 | module_exit(dsp56k_cleanup_driver); | 536 | module_exit(dsp56k_cleanup_driver); |
547 | 537 | ||
diff --git a/drivers/char/dtlk.c b/drivers/char/dtlk.c index 87dcaa237f07..5e82c3bad2e3 100644 --- a/drivers/char/dtlk.c +++ b/drivers/char/dtlk.c | |||
@@ -62,7 +62,6 @@ | |||
62 | #include <linux/init.h> /* for __init, module_{init,exit} */ | 62 | #include <linux/init.h> /* for __init, module_{init,exit} */ |
63 | #include <linux/poll.h> /* for POLLIN, etc. */ | 63 | #include <linux/poll.h> /* for POLLIN, etc. */ |
64 | #include <linux/dtlk.h> /* local header file for DoubleTalk values */ | 64 | #include <linux/dtlk.h> /* local header file for DoubleTalk values */ |
65 | #include <linux/devfs_fs_kernel.h> | ||
66 | #include <linux/smp_lock.h> | 65 | #include <linux/smp_lock.h> |
67 | 66 | ||
68 | #ifdef TRACING | 67 | #ifdef TRACING |
@@ -95,7 +94,7 @@ static int dtlk_release(struct inode *, struct file *); | |||
95 | static int dtlk_ioctl(struct inode *inode, struct file *file, | 94 | static int dtlk_ioctl(struct inode *inode, struct file *file, |
96 | unsigned int cmd, unsigned long arg); | 95 | unsigned int cmd, unsigned long arg); |
97 | 96 | ||
98 | static struct file_operations dtlk_fops = | 97 | static const struct file_operations dtlk_fops = |
99 | { | 98 | { |
100 | .owner = THIS_MODULE, | 99 | .owner = THIS_MODULE, |
101 | .read = dtlk_read, | 100 | .read = dtlk_read, |
@@ -337,9 +336,6 @@ static int __init dtlk_init(void) | |||
337 | if (dtlk_dev_probe() == 0) | 336 | if (dtlk_dev_probe() == 0) |
338 | printk(", MAJOR %d\n", dtlk_major); | 337 | printk(", MAJOR %d\n", dtlk_major); |
339 | 338 | ||
340 | devfs_mk_cdev(MKDEV(dtlk_major, DTLK_MINOR), | ||
341 | S_IFCHR | S_IRUSR | S_IWUSR, "dtlk"); | ||
342 | |||
343 | init_timer(&dtlk_timer); | 339 | init_timer(&dtlk_timer); |
344 | dtlk_timer.function = dtlk_timer_tick; | 340 | dtlk_timer.function = dtlk_timer_tick; |
345 | init_waitqueue_head(&dtlk_process_list); | 341 | init_waitqueue_head(&dtlk_process_list); |
@@ -357,7 +353,6 @@ static void __exit dtlk_cleanup (void) | |||
357 | 353 | ||
358 | dtlk_write_tts(DTLK_CLEAR); | 354 | dtlk_write_tts(DTLK_CLEAR); |
359 | unregister_chrdev(dtlk_major, "dtlk"); | 355 | unregister_chrdev(dtlk_major, "dtlk"); |
360 | devfs_remove("dtlk"); | ||
361 | release_region(dtlk_port_lpc, DTLK_IO_EXTENT); | 356 | release_region(dtlk_port_lpc, DTLK_IO_EXTENT); |
362 | } | 357 | } |
363 | 358 | ||
diff --git a/drivers/char/ec3104_keyb.c b/drivers/char/ec3104_keyb.c index 4aed66968821..abac18b1871c 100644 --- a/drivers/char/ec3104_keyb.c +++ b/drivers/char/ec3104_keyb.c | |||
@@ -26,7 +26,6 @@ | |||
26 | * (prumpf@tux.org). | 26 | * (prumpf@tux.org). |
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include <linux/config.h> | ||
30 | 29 | ||
31 | #include <linux/spinlock.h> | 30 | #include <linux/spinlock.h> |
32 | #include <linux/sched.h> | 31 | #include <linux/sched.h> |
diff --git a/drivers/char/efirtc.c b/drivers/char/efirtc.c index 0090e7a4fcd3..004141d535a2 100644 --- a/drivers/char/efirtc.c +++ b/drivers/char/efirtc.c | |||
@@ -285,7 +285,7 @@ efi_rtc_close(struct inode *inode, struct file *file) | |||
285 | * The various file operations we support. | 285 | * The various file operations we support. |
286 | */ | 286 | */ |
287 | 287 | ||
288 | static struct file_operations efi_rtc_fops = { | 288 | static const struct file_operations efi_rtc_fops = { |
289 | .owner = THIS_MODULE, | 289 | .owner = THIS_MODULE, |
290 | .ioctl = efi_rtc_ioctl, | 290 | .ioctl = efi_rtc_ioctl, |
291 | .open = efi_rtc_open, | 291 | .open = efi_rtc_open, |
diff --git a/drivers/char/epca.c b/drivers/char/epca.c index 9cad8501d62c..86d290e9f307 100644 --- a/drivers/char/epca.c +++ b/drivers/char/epca.c | |||
@@ -30,7 +30,6 @@ | |||
30 | /* See README.epca for change history --DAT*/ | 30 | /* See README.epca for change history --DAT*/ |
31 | 31 | ||
32 | 32 | ||
33 | #include <linux/config.h> | ||
34 | #include <linux/module.h> | 33 | #include <linux/module.h> |
35 | #include <linux/kernel.h> | 34 | #include <linux/kernel.h> |
36 | #include <linux/types.h> | 35 | #include <linux/types.h> |
@@ -80,7 +79,7 @@ static int invalid_lilo_config; | |||
80 | /* The ISA boards do window flipping into the same spaces so its only sane | 79 | /* The ISA boards do window flipping into the same spaces so its only sane |
81 | with a single lock. It's still pretty efficient */ | 80 | with a single lock. It's still pretty efficient */ |
82 | 81 | ||
83 | static spinlock_t epca_lock = SPIN_LOCK_UNLOCKED; | 82 | static DEFINE_SPINLOCK(epca_lock); |
84 | 83 | ||
85 | /* ----------------------------------------------------------------------- | 84 | /* ----------------------------------------------------------------------- |
86 | MAXBOARDS is typically 12, but ISA and EISA cards are restricted to | 85 | MAXBOARDS is typically 12, but ISA and EISA cards are restricted to |
@@ -1232,7 +1231,6 @@ static int __init pc_init(void) | |||
1232 | 1231 | ||
1233 | pc_driver->owner = THIS_MODULE; | 1232 | pc_driver->owner = THIS_MODULE; |
1234 | pc_driver->name = "ttyD"; | 1233 | pc_driver->name = "ttyD"; |
1235 | pc_driver->devfs_name = "tts/D"; | ||
1236 | pc_driver->major = DIGI_MAJOR; | 1234 | pc_driver->major = DIGI_MAJOR; |
1237 | pc_driver->minor_start = 0; | 1235 | pc_driver->minor_start = 0; |
1238 | pc_driver->type = TTY_DRIVER_TYPE_SERIAL; | 1236 | pc_driver->type = TTY_DRIVER_TYPE_SERIAL; |
diff --git a/drivers/char/esp.c b/drivers/char/esp.c index 09dc4b01232c..afcd83d9984b 100644 --- a/drivers/char/esp.c +++ b/drivers/char/esp.c | |||
@@ -883,7 +883,7 @@ static int startup(struct esp_struct * info) | |||
883 | * Allocate the IRQ | 883 | * Allocate the IRQ |
884 | */ | 884 | */ |
885 | 885 | ||
886 | retval = request_irq(info->irq, rs_interrupt_single, SA_SHIRQ, | 886 | retval = request_irq(info->irq, rs_interrupt_single, IRQF_SHARED, |
887 | "esp serial", info); | 887 | "esp serial", info); |
888 | 888 | ||
889 | if (retval) { | 889 | if (retval) { |
@@ -1212,7 +1212,7 @@ static void rs_put_char(struct tty_struct *tty, unsigned char ch) | |||
1212 | if (serial_paranoia_check(info, tty->name, "rs_put_char")) | 1212 | if (serial_paranoia_check(info, tty->name, "rs_put_char")) |
1213 | return; | 1213 | return; |
1214 | 1214 | ||
1215 | if (!tty || !info->xmit_buf) | 1215 | if (!info->xmit_buf) |
1216 | return; | 1216 | return; |
1217 | 1217 | ||
1218 | spin_lock_irqsave(&info->lock, flags); | 1218 | spin_lock_irqsave(&info->lock, flags); |
@@ -1256,7 +1256,7 @@ static int rs_write(struct tty_struct * tty, | |||
1256 | if (serial_paranoia_check(info, tty->name, "rs_write")) | 1256 | if (serial_paranoia_check(info, tty->name, "rs_write")) |
1257 | return 0; | 1257 | return 0; |
1258 | 1258 | ||
1259 | if (!tty || !info->xmit_buf) | 1259 | if (!info->xmit_buf) |
1260 | return 0; | 1260 | return 0; |
1261 | 1261 | ||
1262 | while (1) { | 1262 | while (1) { |
@@ -2449,7 +2449,6 @@ static int __init espserial_init(void) | |||
2449 | 2449 | ||
2450 | esp_driver->owner = THIS_MODULE; | 2450 | esp_driver->owner = THIS_MODULE; |
2451 | esp_driver->name = "ttyP"; | 2451 | esp_driver->name = "ttyP"; |
2452 | esp_driver->devfs_name = "tts/P"; | ||
2453 | esp_driver->major = ESP_IN_MAJOR; | 2452 | esp_driver->major = ESP_IN_MAJOR; |
2454 | esp_driver->minor_start = 0; | 2453 | esp_driver->minor_start = 0; |
2455 | esp_driver->type = TTY_DRIVER_TYPE_SERIAL; | 2454 | esp_driver->type = TTY_DRIVER_TYPE_SERIAL; |
diff --git a/drivers/char/ftape/lowlevel/fdc-io.c b/drivers/char/ftape/lowlevel/fdc-io.c index 093fdf98b19a..65c9d2ec60bd 100644 --- a/drivers/char/ftape/lowlevel/fdc-io.c +++ b/drivers/char/ftape/lowlevel/fdc-io.c | |||
@@ -1268,7 +1268,7 @@ static int fdc_grab_irq_and_dma(void) | |||
1268 | /* Get fast interrupt handler. | 1268 | /* Get fast interrupt handler. |
1269 | */ | 1269 | */ |
1270 | if (request_irq(fdc.irq, ftape_interrupt, | 1270 | if (request_irq(fdc.irq, ftape_interrupt, |
1271 | SA_INTERRUPT, "ft", ftape_id)) { | 1271 | IRQF_DISABLED, "ft", ftape_id)) { |
1272 | TRACE_ABORT(-EIO, ft_t_bug, | 1272 | TRACE_ABORT(-EIO, ft_t_bug, |
1273 | "Unable to grab IRQ%d for ftape driver", | 1273 | "Unable to grab IRQ%d for ftape driver", |
1274 | fdc.irq); | 1274 | fdc.irq); |
diff --git a/drivers/char/ftape/lowlevel/ftape-calibr.c b/drivers/char/ftape/lowlevel/ftape-calibr.c index 956b2586e138..8e50bfd35a52 100644 --- a/drivers/char/ftape/lowlevel/ftape-calibr.c +++ b/drivers/char/ftape/lowlevel/ftape-calibr.c | |||
@@ -24,7 +24,6 @@ | |||
24 | * functions. | 24 | * functions. |
25 | */ | 25 | */ |
26 | 26 | ||
27 | #include <linux/config.h> | ||
28 | #include <linux/errno.h> | 27 | #include <linux/errno.h> |
29 | #include <linux/jiffies.h> | 28 | #include <linux/jiffies.h> |
30 | #include <asm/system.h> | 29 | #include <asm/system.h> |
diff --git a/drivers/char/ftape/lowlevel/ftape-ctl.c b/drivers/char/ftape/lowlevel/ftape-ctl.c index 32e043911790..5d7c1ce92d59 100644 --- a/drivers/char/ftape/lowlevel/ftape-ctl.c +++ b/drivers/char/ftape/lowlevel/ftape-ctl.c | |||
@@ -25,7 +25,6 @@ | |||
25 | * QIC-40/80/3010/3020 floppy-tape driver "ftape" for Linux. | 25 | * QIC-40/80/3010/3020 floppy-tape driver "ftape" for Linux. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | #include <linux/config.h> | ||
29 | #include <linux/errno.h> | 28 | #include <linux/errno.h> |
30 | #include <linux/mm.h> | 29 | #include <linux/mm.h> |
31 | #include <linux/mman.h> | 30 | #include <linux/mman.h> |
diff --git a/drivers/char/ftape/lowlevel/ftape-init.c b/drivers/char/ftape/lowlevel/ftape-init.c index b54260d457c2..4998132a81d1 100644 --- a/drivers/char/ftape/lowlevel/ftape-init.c +++ b/drivers/char/ftape/lowlevel/ftape-init.c | |||
@@ -21,7 +21,6 @@ | |||
21 | * for the QIC-40/80/3010/3020 floppy-tape driver for Linux. | 21 | * for the QIC-40/80/3010/3020 floppy-tape driver for Linux. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <linux/config.h> | ||
25 | #include <linux/module.h> | 24 | #include <linux/module.h> |
26 | #include <linux/errno.h> | 25 | #include <linux/errno.h> |
27 | #include <linux/fs.h> | 26 | #include <linux/fs.h> |
diff --git a/drivers/char/ftape/lowlevel/ftape-proc.c b/drivers/char/ftape/lowlevel/ftape-proc.c index c66251e997ed..e805b15e0a12 100644 --- a/drivers/char/ftape/lowlevel/ftape-proc.c +++ b/drivers/char/ftape/lowlevel/ftape-proc.c | |||
@@ -26,7 +26,6 @@ | |||
26 | * Old code removed, switched to dynamic proc entry. | 26 | * Old code removed, switched to dynamic proc entry. |
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include <linux/config.h> | ||
30 | 29 | ||
31 | #if defined(CONFIG_PROC_FS) && defined(CONFIG_FT_PROC_FS) | 30 | #if defined(CONFIG_PROC_FS) && defined(CONFIG_FT_PROC_FS) |
32 | 31 | ||
diff --git a/drivers/char/ftape/lowlevel/ftape-setup.c b/drivers/char/ftape/lowlevel/ftape-setup.c index 280a1a55d87e..678340acd0b7 100644 --- a/drivers/char/ftape/lowlevel/ftape-setup.c +++ b/drivers/char/ftape/lowlevel/ftape-setup.c | |||
@@ -25,7 +25,6 @@ | |||
25 | * "ftape" for Linux. | 25 | * "ftape" for Linux. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | #include <linux/config.h> | ||
29 | #include <linux/string.h> | 28 | #include <linux/string.h> |
30 | #include <linux/errno.h> | 29 | #include <linux/errno.h> |
31 | #include <linux/mm.h> | 30 | #include <linux/mm.h> |
diff --git a/drivers/char/ftape/lowlevel/ftape-tracing.h b/drivers/char/ftape/lowlevel/ftape-tracing.h index fa7cd20ee66c..2950810c7085 100644 --- a/drivers/char/ftape/lowlevel/ftape-tracing.h +++ b/drivers/char/ftape/lowlevel/ftape-tracing.h | |||
@@ -28,7 +28,6 @@ | |||
28 | * QIC-40/80/3010/3020 floppy-tape driver "ftape" for Linux. | 28 | * QIC-40/80/3010/3020 floppy-tape driver "ftape" for Linux. |
29 | */ | 29 | */ |
30 | 30 | ||
31 | #include <linux/config.h> | ||
32 | #include <linux/kernel.h> | 31 | #include <linux/kernel.h> |
33 | 32 | ||
34 | /* | 33 | /* |
diff --git a/drivers/char/ftape/lowlevel/ftape_syms.c b/drivers/char/ftape/lowlevel/ftape_syms.c index 5dc3a380c9bf..8e0dc4a07ca6 100644 --- a/drivers/char/ftape/lowlevel/ftape_syms.c +++ b/drivers/char/ftape/lowlevel/ftape_syms.c | |||
@@ -25,7 +25,6 @@ | |||
25 | * exports to its high level clients | 25 | * exports to its high level clients |
26 | */ | 26 | */ |
27 | 27 | ||
28 | #include <linux/config.h> | ||
29 | #include <linux/module.h> | 28 | #include <linux/module.h> |
30 | 29 | ||
31 | #include <linux/ftape.h> | 30 | #include <linux/ftape.h> |
diff --git a/drivers/char/ftape/zftape/zftape-ctl.c b/drivers/char/ftape/zftape/zftape-ctl.c index 6c7874e5c199..22ba0f5d00cf 100644 --- a/drivers/char/ftape/zftape/zftape-ctl.c +++ b/drivers/char/ftape/zftape/zftape-ctl.c | |||
@@ -24,7 +24,6 @@ | |||
24 | * for the QIC-40/80/3010/3020 floppy-tape driver for Linux. | 24 | * for the QIC-40/80/3010/3020 floppy-tape driver for Linux. |
25 | */ | 25 | */ |
26 | 26 | ||
27 | #include <linux/config.h> | ||
28 | #include <linux/errno.h> | 27 | #include <linux/errno.h> |
29 | #include <linux/mm.h> | 28 | #include <linux/mm.h> |
30 | #include <linux/module.h> | 29 | #include <linux/module.h> |
diff --git a/drivers/char/ftape/zftape/zftape-ctl.h b/drivers/char/ftape/zftape/zftape-ctl.h index 414159891990..8e6f2d7ac74e 100644 --- a/drivers/char/ftape/zftape/zftape-ctl.h +++ b/drivers/char/ftape/zftape/zftape-ctl.h | |||
@@ -27,7 +27,6 @@ | |||
27 | * for the QIC-40/80 floppy-tape driver for Linux. | 27 | * for the QIC-40/80 floppy-tape driver for Linux. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include <linux/config.h> | ||
31 | #include <linux/ioctl.h> | 30 | #include <linux/ioctl.h> |
32 | #include <linux/mtio.h> | 31 | #include <linux/mtio.h> |
33 | 32 | ||
diff --git a/drivers/char/ftape/zftape/zftape-init.c b/drivers/char/ftape/zftape/zftape-init.c index 821357ce7e0e..164a1aa77a2f 100644 --- a/drivers/char/ftape/zftape/zftape-init.c +++ b/drivers/char/ftape/zftape/zftape-init.c | |||
@@ -20,7 +20,6 @@ | |||
20 | * to the ftape floppy tape driver for Linux | 20 | * to the ftape floppy tape driver for Linux |
21 | */ | 21 | */ |
22 | 22 | ||
23 | #include <linux/config.h> | ||
24 | #include <linux/module.h> | 23 | #include <linux/module.h> |
25 | #include <linux/errno.h> | 24 | #include <linux/errno.h> |
26 | #include <linux/fs.h> | 25 | #include <linux/fs.h> |
@@ -33,7 +32,6 @@ | |||
33 | #endif | 32 | #endif |
34 | #include <linux/fcntl.h> | 33 | #include <linux/fcntl.h> |
35 | #include <linux/smp_lock.h> | 34 | #include <linux/smp_lock.h> |
36 | #include <linux/devfs_fs_kernel.h> | ||
37 | 35 | ||
38 | #include <linux/zftape.h> | 36 | #include <linux/zftape.h> |
39 | #include <linux/init.h> | 37 | #include <linux/init.h> |
@@ -88,7 +86,7 @@ static ssize_t zft_read (struct file *fp, char __user *buff, | |||
88 | static ssize_t zft_write(struct file *fp, const char __user *buff, | 86 | static ssize_t zft_write(struct file *fp, const char __user *buff, |
89 | size_t req_len, loff_t *ppos); | 87 | size_t req_len, loff_t *ppos); |
90 | 88 | ||
91 | static struct file_operations zft_cdev = | 89 | static const struct file_operations zft_cdev = |
92 | { | 90 | { |
93 | .owner = THIS_MODULE, | 91 | .owner = THIS_MODULE, |
94 | .read = zft_read, | 92 | .read = zft_read, |
@@ -332,29 +330,11 @@ KERN_INFO | |||
332 | zft_class = class_create(THIS_MODULE, "zft"); | 330 | zft_class = class_create(THIS_MODULE, "zft"); |
333 | for (i = 0; i < 4; i++) { | 331 | for (i = 0; i < 4; i++) { |
334 | class_device_create(zft_class, NULL, MKDEV(QIC117_TAPE_MAJOR, i), NULL, "qft%i", i); | 332 | class_device_create(zft_class, NULL, MKDEV(QIC117_TAPE_MAJOR, i), NULL, "qft%i", i); |
335 | devfs_mk_cdev(MKDEV(QIC117_TAPE_MAJOR, i), | ||
336 | S_IFCHR | S_IRUSR | S_IWUSR, | ||
337 | "qft%i", i); | ||
338 | class_device_create(zft_class, NULL, MKDEV(QIC117_TAPE_MAJOR, i + 4), NULL, "nqft%i", i); | 333 | class_device_create(zft_class, NULL, MKDEV(QIC117_TAPE_MAJOR, i + 4), NULL, "nqft%i", i); |
339 | devfs_mk_cdev(MKDEV(QIC117_TAPE_MAJOR, i + 4), | ||
340 | S_IFCHR | S_IRUSR | S_IWUSR, | ||
341 | "nqft%i", i); | ||
342 | class_device_create(zft_class, NULL, MKDEV(QIC117_TAPE_MAJOR, i + 16), NULL, "zqft%i", i); | 334 | class_device_create(zft_class, NULL, MKDEV(QIC117_TAPE_MAJOR, i + 16), NULL, "zqft%i", i); |
343 | devfs_mk_cdev(MKDEV(QIC117_TAPE_MAJOR, i + 16), | ||
344 | S_IFCHR | S_IRUSR | S_IWUSR, | ||
345 | "zqft%i", i); | ||
346 | class_device_create(zft_class, NULL, MKDEV(QIC117_TAPE_MAJOR, i + 20), NULL, "nzqft%i", i); | 335 | class_device_create(zft_class, NULL, MKDEV(QIC117_TAPE_MAJOR, i + 20), NULL, "nzqft%i", i); |
347 | devfs_mk_cdev(MKDEV(QIC117_TAPE_MAJOR, i + 20), | ||
348 | S_IFCHR | S_IRUSR | S_IWUSR, | ||
349 | "nzqft%i", i); | ||
350 | class_device_create(zft_class, NULL, MKDEV(QIC117_TAPE_MAJOR, i + 32), NULL, "rawqft%i", i); | 336 | class_device_create(zft_class, NULL, MKDEV(QIC117_TAPE_MAJOR, i + 32), NULL, "rawqft%i", i); |
351 | devfs_mk_cdev(MKDEV(QIC117_TAPE_MAJOR, i + 32), | ||
352 | S_IFCHR | S_IRUSR | S_IWUSR, | ||
353 | "rawqft%i", i); | ||
354 | class_device_create(zft_class, NULL, MKDEV(QIC117_TAPE_MAJOR, i + 36), NULL, "nrawrawqft%i", i); | 337 | class_device_create(zft_class, NULL, MKDEV(QIC117_TAPE_MAJOR, i + 36), NULL, "nrawrawqft%i", i); |
355 | devfs_mk_cdev(MKDEV(QIC117_TAPE_MAJOR, i + 36), | ||
356 | S_IFCHR | S_IRUSR | S_IWUSR, | ||
357 | "nrawqft%i", i); | ||
358 | } | 338 | } |
359 | 339 | ||
360 | #ifdef CONFIG_ZFT_COMPRESSOR | 340 | #ifdef CONFIG_ZFT_COMPRESSOR |
@@ -380,17 +360,11 @@ static void zft_exit(void) | |||
380 | TRACE(ft_t_info, "successful"); | 360 | TRACE(ft_t_info, "successful"); |
381 | } | 361 | } |
382 | for (i = 0; i < 4; i++) { | 362 | for (i = 0; i < 4; i++) { |
383 | devfs_remove("qft%i", i); | ||
384 | class_device_destroy(zft_class, MKDEV(QIC117_TAPE_MAJOR, i)); | 363 | class_device_destroy(zft_class, MKDEV(QIC117_TAPE_MAJOR, i)); |
385 | devfs_remove("nqft%i", i); | ||
386 | class_device_destroy(zft_class, MKDEV(QIC117_TAPE_MAJOR, i + 4)); | 364 | class_device_destroy(zft_class, MKDEV(QIC117_TAPE_MAJOR, i + 4)); |
387 | devfs_remove("zqft%i", i); | ||
388 | class_device_destroy(zft_class, MKDEV(QIC117_TAPE_MAJOR, i + 16)); | 365 | class_device_destroy(zft_class, MKDEV(QIC117_TAPE_MAJOR, i + 16)); |
389 | devfs_remove("nzqft%i", i); | ||
390 | class_device_destroy(zft_class, MKDEV(QIC117_TAPE_MAJOR, i + 20)); | 366 | class_device_destroy(zft_class, MKDEV(QIC117_TAPE_MAJOR, i + 20)); |
391 | devfs_remove("rawqft%i", i); | ||
392 | class_device_destroy(zft_class, MKDEV(QIC117_TAPE_MAJOR, i + 32)); | 367 | class_device_destroy(zft_class, MKDEV(QIC117_TAPE_MAJOR, i + 32)); |
393 | devfs_remove("nrawqft%i", i); | ||
394 | class_device_destroy(zft_class, MKDEV(QIC117_TAPE_MAJOR, i + 36)); | 368 | class_device_destroy(zft_class, MKDEV(QIC117_TAPE_MAJOR, i + 36)); |
395 | } | 369 | } |
396 | class_destroy(zft_class); | 370 | class_destroy(zft_class); |
diff --git a/drivers/char/genrtc.c b/drivers/char/genrtc.c index 588fca542a98..817dc409ac20 100644 --- a/drivers/char/genrtc.c +++ b/drivers/char/genrtc.c | |||
@@ -43,7 +43,6 @@ | |||
43 | #define RTC_VERSION "1.07" | 43 | #define RTC_VERSION "1.07" |
44 | 44 | ||
45 | #include <linux/module.h> | 45 | #include <linux/module.h> |
46 | #include <linux/config.h> | ||
47 | #include <linux/errno.h> | 46 | #include <linux/errno.h> |
48 | #include <linux/miscdevice.h> | 47 | #include <linux/miscdevice.h> |
49 | #include <linux/fcntl.h> | 48 | #include <linux/fcntl.h> |
@@ -483,7 +482,7 @@ static inline int gen_rtc_proc_init(void) { return 0; } | |||
483 | * The various file operations we support. | 482 | * The various file operations we support. |
484 | */ | 483 | */ |
485 | 484 | ||
486 | static struct file_operations gen_rtc_fops = { | 485 | static const struct file_operations gen_rtc_fops = { |
487 | .owner = THIS_MODULE, | 486 | .owner = THIS_MODULE, |
488 | #ifdef CONFIG_GEN_RTC_X | 487 | #ifdef CONFIG_GEN_RTC_X |
489 | .read = gen_rtc_read, | 488 | .read = gen_rtc_read, |
diff --git a/drivers/char/hangcheck-timer.c b/drivers/char/hangcheck-timer.c index ac626418b329..d69f2ad9a67d 100644 --- a/drivers/char/hangcheck-timer.c +++ b/drivers/char/hangcheck-timer.c | |||
@@ -117,12 +117,12 @@ __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) || defined(CONFIG_S390) | 120 | #if defined(CONFIG_X86_64) || 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_IA64) | 123 | #elif defined(CONFIG_IA64) |
124 | # define TIMER_FREQ ((unsigned long long)local_cpu_data->itc_freq) | 124 | # define TIMER_FREQ ((unsigned long long)local_cpu_data->itc_freq) |
125 | #elif defined(CONFIG_PPC64) | 125 | #else |
126 | # define TIMER_FREQ (HZ*loops_per_jiffy) | 126 | # define TIMER_FREQ (HZ*loops_per_jiffy) |
127 | #endif | 127 | #endif |
128 | 128 | ||
diff --git a/drivers/char/hpet.c b/drivers/char/hpet.c index ef140ebde117..8afba339f05a 100644 --- a/drivers/char/hpet.c +++ b/drivers/char/hpet.c | |||
@@ -11,7 +11,6 @@ | |||
11 | * published by the Free Software Foundation. | 11 | * published by the Free Software Foundation. |
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include <linux/config.h> | ||
15 | #include <linux/interrupt.h> | 14 | #include <linux/interrupt.h> |
16 | #include <linux/module.h> | 15 | #include <linux/module.h> |
17 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
@@ -396,7 +395,7 @@ static int hpet_ioctl_ieon(struct hpet_dev *devp) | |||
396 | 395 | ||
397 | sprintf(devp->hd_name, "hpet%d", (int)(devp - hpetp->hp_dev)); | 396 | sprintf(devp->hd_name, "hpet%d", (int)(devp - hpetp->hp_dev)); |
398 | irq_flags = devp->hd_flags & HPET_SHARED_IRQ | 397 | irq_flags = devp->hd_flags & HPET_SHARED_IRQ |
399 | ? SA_SHIRQ : SA_INTERRUPT; | 398 | ? IRQF_SHARED : IRQF_DISABLED; |
400 | if (request_irq(irq, hpet_interrupt, irq_flags, | 399 | if (request_irq(irq, hpet_interrupt, irq_flags, |
401 | devp->hd_name, (void *)devp)) { | 400 | devp->hd_name, (void *)devp)) { |
402 | printk(KERN_ERR "hpet: IRQ %d is not free\n", irq); | 401 | printk(KERN_ERR "hpet: IRQ %d is not free\n", irq); |
@@ -554,7 +553,7 @@ hpet_ioctl_common(struct hpet_dev *devp, int cmd, unsigned long arg, int kernel) | |||
554 | return err; | 553 | return err; |
555 | } | 554 | } |
556 | 555 | ||
557 | static struct file_operations hpet_fops = { | 556 | static const struct file_operations hpet_fops = { |
558 | .owner = THIS_MODULE, | 557 | .owner = THIS_MODULE, |
559 | .llseek = no_llseek, | 558 | .llseek = no_llseek, |
560 | .read = hpet_read, | 559 | .read = hpet_read, |
@@ -925,11 +924,8 @@ static acpi_status hpet_resources(struct acpi_resource *res, void *data) | |||
925 | status = acpi_resource_to_address64(res, &addr); | 924 | status = acpi_resource_to_address64(res, &addr); |
926 | 925 | ||
927 | if (ACPI_SUCCESS(status)) { | 926 | if (ACPI_SUCCESS(status)) { |
928 | unsigned long size; | ||
929 | |||
930 | size = addr.maximum - addr.minimum + 1; | ||
931 | hdp->hd_phys_address = addr.minimum; | 927 | hdp->hd_phys_address = addr.minimum; |
932 | hdp->hd_address = ioremap(addr.minimum, size); | 928 | hdp->hd_address = ioremap(addr.minimum, addr.address_length); |
933 | 929 | ||
934 | if (hpet_is_known(hdp)) { | 930 | if (hpet_is_known(hdp)) { |
935 | printk(KERN_DEBUG "%s: 0x%lx is busy\n", | 931 | printk(KERN_DEBUG "%s: 0x%lx is busy\n", |
diff --git a/drivers/char/hvc_console.c b/drivers/char/hvc_console.c index 2b6a56b2bf35..ca2f538e549e 100644 --- a/drivers/char/hvc_console.c +++ b/drivers/char/hvc_console.c | |||
@@ -22,7 +22,6 @@ | |||
22 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 22 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include <linux/config.h> | ||
26 | #include <linux/console.h> | 25 | #include <linux/console.h> |
27 | #include <linux/cpumask.h> | 26 | #include <linux/cpumask.h> |
28 | #include <linux/init.h> | 27 | #include <linux/init.h> |
@@ -347,7 +346,7 @@ static int hvc_open(struct tty_struct *tty, struct file * filp) | |||
347 | spin_unlock_irqrestore(&hp->lock, flags); | 346 | spin_unlock_irqrestore(&hp->lock, flags); |
348 | /* check error, fallback to non-irq */ | 347 | /* check error, fallback to non-irq */ |
349 | if (irq != NO_IRQ) | 348 | if (irq != NO_IRQ) |
350 | rc = request_irq(irq, hvc_handle_interrupt, SA_INTERRUPT, "hvc_console", hp); | 349 | rc = request_irq(irq, hvc_handle_interrupt, IRQF_DISABLED, "hvc_console", hp); |
351 | 350 | ||
352 | /* | 351 | /* |
353 | * If the request_irq() fails and we return an error. The tty layer | 352 | * If the request_irq() fails and we return an error. The tty layer |
@@ -553,7 +552,6 @@ static int hvc_chars_in_buffer(struct tty_struct *tty) | |||
553 | 552 | ||
554 | #define HVC_POLL_READ 0x00000001 | 553 | #define HVC_POLL_READ 0x00000001 |
555 | #define HVC_POLL_WRITE 0x00000002 | 554 | #define HVC_POLL_WRITE 0x00000002 |
556 | #define HVC_POLL_QUICK 0x00000004 | ||
557 | 555 | ||
558 | static int hvc_poll(struct hvc_struct *hp) | 556 | static int hvc_poll(struct hvc_struct *hp) |
559 | { | 557 | { |
@@ -568,6 +566,7 @@ static int hvc_poll(struct hvc_struct *hp) | |||
568 | /* Push pending writes */ | 566 | /* Push pending writes */ |
569 | if (hp->n_outbuf > 0) | 567 | if (hp->n_outbuf > 0) |
570 | hvc_push(hp); | 568 | hvc_push(hp); |
569 | |||
571 | /* Reschedule us if still some write pending */ | 570 | /* Reschedule us if still some write pending */ |
572 | if (hp->n_outbuf > 0) | 571 | if (hp->n_outbuf > 0) |
573 | poll_mask |= HVC_POLL_WRITE; | 572 | poll_mask |= HVC_POLL_WRITE; |
@@ -680,7 +679,7 @@ int khvcd(void *unused) | |||
680 | poll_mask |= HVC_POLL_READ; | 679 | poll_mask |= HVC_POLL_READ; |
681 | if (hvc_kicked) | 680 | if (hvc_kicked) |
682 | continue; | 681 | continue; |
683 | if (poll_mask & HVC_POLL_QUICK) { | 682 | if (poll_mask & HVC_POLL_WRITE) { |
684 | yield(); | 683 | yield(); |
685 | continue; | 684 | continue; |
686 | } | 685 | } |
@@ -820,7 +819,6 @@ int __init hvc_init(void) | |||
820 | return -ENOMEM; | 819 | return -ENOMEM; |
821 | 820 | ||
822 | drv->owner = THIS_MODULE; | 821 | drv->owner = THIS_MODULE; |
823 | drv->devfs_name = "hvc/"; | ||
824 | drv->driver_name = "hvc"; | 822 | drv->driver_name = "hvc"; |
825 | drv->name = "hvc"; | 823 | drv->name = "hvc"; |
826 | drv->major = HVC_MAJOR; | 824 | drv->major = HVC_MAJOR; |
diff --git a/drivers/char/hvc_rtas.c b/drivers/char/hvc_rtas.c index 83364ea63cba..57106e02fd2e 100644 --- a/drivers/char/hvc_rtas.c +++ b/drivers/char/hvc_rtas.c | |||
@@ -41,37 +41,28 @@ | |||
41 | #define hvc_rtas_cookie 0x67781e15 | 41 | #define hvc_rtas_cookie 0x67781e15 |
42 | struct hvc_struct *hvc_rtas_dev; | 42 | struct hvc_struct *hvc_rtas_dev; |
43 | 43 | ||
44 | #define RTASCONS_PUT_ATTEMPTS 16 | ||
45 | |||
46 | static int rtascons_put_char_token = RTAS_UNKNOWN_SERVICE; | 44 | static int rtascons_put_char_token = RTAS_UNKNOWN_SERVICE; |
47 | static int rtascons_get_char_token = RTAS_UNKNOWN_SERVICE; | 45 | static int rtascons_get_char_token = RTAS_UNKNOWN_SERVICE; |
48 | static int rtascons_put_delay = 100; | ||
49 | module_param_named(put_delay, rtascons_put_delay, int, 0644); | ||
50 | 46 | ||
51 | static inline int hvc_rtas_write_console(uint32_t vtermno, const char *buf, int count) | 47 | static inline int hvc_rtas_write_console(uint32_t vtermno, const char *buf, |
48 | int count) | ||
52 | { | 49 | { |
53 | int done; | 50 | int i; |
54 | 51 | ||
55 | /* if there is more than one character to be displayed, wait a bit */ | 52 | for (i = 0; i < count; i++) { |
56 | for (done = 0; done < count; done++) { | 53 | if (rtas_call(rtascons_put_char_token, 1, 1, NULL, buf[i])) |
57 | int result; | ||
58 | result = rtas_call(rtascons_put_char_token, 1, 1, NULL, buf[done]); | ||
59 | if (result) | ||
60 | break; | 54 | break; |
61 | } | 55 | } |
62 | /* the calling routine expects to receive the number of bytes sent */ | 56 | |
63 | return done; | 57 | return i; |
64 | } | 58 | } |
65 | 59 | ||
66 | static int hvc_rtas_read_console(uint32_t vtermno, char *buf, int count) | 60 | static int hvc_rtas_read_console(uint32_t vtermno, char *buf, int count) |
67 | { | 61 | { |
68 | int i; | 62 | int i, c; |
69 | 63 | ||
70 | for (i = 0; i < count; i++) { | 64 | for (i = 0; i < count; i++) { |
71 | int c, err; | 65 | if (rtas_call(rtascons_get_char_token, 0, 2, &c)) |
72 | |||
73 | err = rtas_call(rtascons_get_char_token, 0, 2, &c); | ||
74 | if (err) | ||
75 | break; | 66 | break; |
76 | 67 | ||
77 | buf[i] = c; | 68 | buf[i] = c; |
@@ -106,7 +97,9 @@ static int hvc_rtas_init(void) | |||
106 | hp = hvc_alloc(hvc_rtas_cookie, NO_IRQ, &hvc_rtas_get_put_ops); | 97 | hp = hvc_alloc(hvc_rtas_cookie, NO_IRQ, &hvc_rtas_get_put_ops); |
107 | if (IS_ERR(hp)) | 98 | if (IS_ERR(hp)) |
108 | return PTR_ERR(hp); | 99 | return PTR_ERR(hp); |
100 | |||
109 | hvc_rtas_dev = hp; | 101 | hvc_rtas_dev = hp; |
102 | |||
110 | return 0; | 103 | return 0; |
111 | } | 104 | } |
112 | module_init(hvc_rtas_init); | 105 | module_init(hvc_rtas_init); |
@@ -114,8 +107,8 @@ module_init(hvc_rtas_init); | |||
114 | /* This will tear down the tty portion of the driver */ | 107 | /* This will tear down the tty portion of the driver */ |
115 | static void __exit hvc_rtas_exit(void) | 108 | static void __exit hvc_rtas_exit(void) |
116 | { | 109 | { |
117 | /* Really the fun isn't over until the worker thread breaks down and the | 110 | /* Really the fun isn't over until the worker thread breaks down and |
118 | * tty cleans up */ | 111 | * the tty cleans up */ |
119 | if (hvc_rtas_dev) | 112 | if (hvc_rtas_dev) |
120 | hvc_remove(hvc_rtas_dev); | 113 | hvc_remove(hvc_rtas_dev); |
121 | } | 114 | } |
@@ -127,12 +120,14 @@ static int hvc_rtas_console_init(void) | |||
127 | rtascons_put_char_token = rtas_token("put-term-char"); | 120 | rtascons_put_char_token = rtas_token("put-term-char"); |
128 | if (rtascons_put_char_token == RTAS_UNKNOWN_SERVICE) | 121 | if (rtascons_put_char_token == RTAS_UNKNOWN_SERVICE) |
129 | return -EIO; | 122 | return -EIO; |
123 | |||
130 | rtascons_get_char_token = rtas_token("get-term-char"); | 124 | rtascons_get_char_token = rtas_token("get-term-char"); |
131 | if (rtascons_get_char_token == RTAS_UNKNOWN_SERVICE) | 125 | if (rtascons_get_char_token == RTAS_UNKNOWN_SERVICE) |
132 | return -EIO; | 126 | return -EIO; |
133 | 127 | ||
134 | hvc_instantiate(hvc_rtas_cookie, 0, &hvc_rtas_get_put_ops ); | 128 | hvc_instantiate(hvc_rtas_cookie, 0, &hvc_rtas_get_put_ops); |
135 | add_preferred_console("hvc", 0, NULL); | 129 | add_preferred_console("hvc", 0, NULL); |
130 | |||
136 | return 0; | 131 | return 0; |
137 | } | 132 | } |
138 | console_initcall(hvc_rtas_console_init); | 133 | console_initcall(hvc_rtas_console_init); |
diff --git a/drivers/char/hvcs.c b/drivers/char/hvcs.c index 8d97b3911293..4589ff302b07 100644 --- a/drivers/char/hvcs.c +++ b/drivers/char/hvcs.c | |||
@@ -899,7 +899,7 @@ static int hvcs_enable_device(struct hvcs_struct *hvcsd, uint32_t unit_address, | |||
899 | * the conn was registered and now. | 899 | * the conn was registered and now. |
900 | */ | 900 | */ |
901 | if (!(rc = request_irq(irq, &hvcs_handle_interrupt, | 901 | if (!(rc = request_irq(irq, &hvcs_handle_interrupt, |
902 | SA_INTERRUPT, "ibmhvcs", hvcsd))) { | 902 | IRQF_DISABLED, "ibmhvcs", hvcsd))) { |
903 | /* | 903 | /* |
904 | * It is possible the vty-server was removed after the irq was | 904 | * It is possible the vty-server was removed after the irq was |
905 | * requested but before we have time to enable interrupts. | 905 | * requested but before we have time to enable interrupts. |
@@ -1320,11 +1320,12 @@ static struct tty_operations hvcs_ops = { | |||
1320 | static int hvcs_alloc_index_list(int n) | 1320 | static int hvcs_alloc_index_list(int n) |
1321 | { | 1321 | { |
1322 | int i; | 1322 | int i; |
1323 | |||
1323 | hvcs_index_list = kmalloc(n * sizeof(hvcs_index_count),GFP_KERNEL); | 1324 | hvcs_index_list = kmalloc(n * sizeof(hvcs_index_count),GFP_KERNEL); |
1324 | if (!hvcs_index_list) | 1325 | if (!hvcs_index_list) |
1325 | return -ENOMEM; | 1326 | return -ENOMEM; |
1326 | hvcs_index_count = n; | 1327 | hvcs_index_count = n; |
1327 | for(i = 0; i < hvcs_index_count; i++) | 1328 | for (i = 0; i < hvcs_index_count; i++) |
1328 | hvcs_index_list[i] = -1; | 1329 | hvcs_index_list[i] = -1; |
1329 | return 0; | 1330 | return 0; |
1330 | } | 1331 | } |
@@ -1332,11 +1333,9 @@ static int hvcs_alloc_index_list(int n) | |||
1332 | static void hvcs_free_index_list(void) | 1333 | static void hvcs_free_index_list(void) |
1333 | { | 1334 | { |
1334 | /* Paranoia check to be thorough. */ | 1335 | /* Paranoia check to be thorough. */ |
1335 | if (hvcs_index_list) { | 1336 | kfree(hvcs_index_list); |
1336 | kfree(hvcs_index_list); | 1337 | hvcs_index_list = NULL; |
1337 | hvcs_index_list = NULL; | 1338 | hvcs_index_count = 0; |
1338 | hvcs_index_count = 0; | ||
1339 | } | ||
1340 | } | 1339 | } |
1341 | 1340 | ||
1342 | static int __init hvcs_module_init(void) | 1341 | static int __init hvcs_module_init(void) |
@@ -1364,7 +1363,6 @@ static int __init hvcs_module_init(void) | |||
1364 | 1363 | ||
1365 | hvcs_tty_driver->driver_name = hvcs_driver_name; | 1364 | hvcs_tty_driver->driver_name = hvcs_driver_name; |
1366 | hvcs_tty_driver->name = hvcs_device_node; | 1365 | hvcs_tty_driver->name = hvcs_device_node; |
1367 | hvcs_tty_driver->devfs_name = hvcs_device_node; | ||
1368 | 1366 | ||
1369 | /* | 1367 | /* |
1370 | * We'll let the system assign us a major number, indicated by leaving | 1368 | * We'll let the system assign us a major number, indicated by leaving |
diff --git a/drivers/char/hvsi.c b/drivers/char/hvsi.c index a9522189fc9e..56612a2dca6b 100644 --- a/drivers/char/hvsi.c +++ b/drivers/char/hvsi.c | |||
@@ -1154,7 +1154,6 @@ static int __init hvsi_init(void) | |||
1154 | return -ENOMEM; | 1154 | return -ENOMEM; |
1155 | 1155 | ||
1156 | hvsi_driver->owner = THIS_MODULE; | 1156 | hvsi_driver->owner = THIS_MODULE; |
1157 | hvsi_driver->devfs_name = "hvsi/"; | ||
1158 | hvsi_driver->driver_name = "hvsi"; | 1157 | hvsi_driver->driver_name = "hvsi"; |
1159 | hvsi_driver->name = "hvsi"; | 1158 | hvsi_driver->name = "hvsi"; |
1160 | hvsi_driver->major = HVSI_MAJOR; | 1159 | hvsi_driver->major = HVSI_MAJOR; |
@@ -1169,7 +1168,7 @@ static int __init hvsi_init(void) | |||
1169 | struct hvsi_struct *hp = &hvsi_ports[i]; | 1168 | struct hvsi_struct *hp = &hvsi_ports[i]; |
1170 | int ret = 1; | 1169 | int ret = 1; |
1171 | 1170 | ||
1172 | ret = request_irq(hp->virq, hvsi_interrupt, SA_INTERRUPT, "hvsi", hp); | 1171 | ret = request_irq(hp->virq, hvsi_interrupt, IRQF_DISABLED, "hvsi", hp); |
1173 | if (ret) | 1172 | if (ret) |
1174 | printk(KERN_ERR "HVSI: couldn't reserve irq 0x%x (error %i)\n", | 1173 | printk(KERN_ERR "HVSI: couldn't reserve irq 0x%x (error %i)\n", |
1175 | hp->virq, ret); | 1174 | hp->virq, ret); |
@@ -1179,7 +1178,7 @@ static int __init hvsi_init(void) | |||
1179 | if (tty_register_driver(hvsi_driver)) | 1178 | if (tty_register_driver(hvsi_driver)) |
1180 | panic("Couldn't register hvsi console driver\n"); | 1179 | panic("Couldn't register hvsi console driver\n"); |
1181 | 1180 | ||
1182 | printk(KERN_INFO "HVSI: registered %i devices\n", hvsi_count); | 1181 | printk(KERN_DEBUG "HVSI: registered %i devices\n", hvsi_count); |
1183 | 1182 | ||
1184 | return 0; | 1183 | return 0; |
1185 | } | 1184 | } |
@@ -1300,13 +1299,12 @@ static int __init hvsi_console_init(void) | |||
1300 | hp->inbuf_end = hp->inbuf; | 1299 | hp->inbuf_end = hp->inbuf; |
1301 | hp->state = HVSI_CLOSED; | 1300 | hp->state = HVSI_CLOSED; |
1302 | hp->vtermno = *vtermno; | 1301 | hp->vtermno = *vtermno; |
1303 | hp->virq = virt_irq_create_mapping(irq[0]); | 1302 | hp->virq = irq_create_mapping(NULL, irq[0], 0); |
1304 | if (hp->virq == NO_IRQ) { | 1303 | if (hp->virq == NO_IRQ) { |
1305 | printk(KERN_ERR "%s: couldn't create irq mapping for 0x%x\n", | 1304 | printk(KERN_ERR "%s: couldn't create irq mapping for 0x%x\n", |
1306 | __FUNCTION__, hp->virq); | 1305 | __FUNCTION__, irq[0]); |
1307 | continue; | 1306 | continue; |
1308 | } else | 1307 | } |
1309 | hp->virq = irq_offset_up(hp->virq); | ||
1310 | 1308 | ||
1311 | hvsi_count++; | 1309 | hvsi_count++; |
1312 | } | 1310 | } |
diff --git a/drivers/char/hw_random.c b/drivers/char/hw_random.c deleted file mode 100644 index 29dc87e59020..000000000000 --- a/drivers/char/hw_random.c +++ /dev/null | |||
@@ -1,698 +0,0 @@ | |||
1 | /* | ||
2 | Added support for the AMD Geode LX RNG | ||
3 | (c) Copyright 2004-2005 Advanced Micro Devices, Inc. | ||
4 | |||
5 | derived from | ||
6 | |||
7 | Hardware driver for the Intel/AMD/VIA Random Number Generators (RNG) | ||
8 | (c) Copyright 2003 Red Hat Inc <jgarzik@redhat.com> | ||
9 | |||
10 | derived from | ||
11 | |||
12 | Hardware driver for the AMD 768 Random Number Generator (RNG) | ||
13 | (c) Copyright 2001 Red Hat Inc <alan@redhat.com> | ||
14 | |||
15 | derived from | ||
16 | |||
17 | Hardware driver for Intel i810 Random Number Generator (RNG) | ||
18 | Copyright 2000,2001 Jeff Garzik <jgarzik@pobox.com> | ||
19 | Copyright 2000,2001 Philipp Rumpf <prumpf@mandrakesoft.com> | ||
20 | |||
21 | Please read Documentation/hw_random.txt for details on use. | ||
22 | |||
23 | ---------------------------------------------------------- | ||
24 | This software may be used and distributed according to the terms | ||
25 | of the GNU General Public License, incorporated herein by reference. | ||
26 | |||
27 | */ | ||
28 | |||
29 | |||
30 | #include <linux/module.h> | ||
31 | #include <linux/kernel.h> | ||
32 | #include <linux/fs.h> | ||
33 | #include <linux/init.h> | ||
34 | #include <linux/pci.h> | ||
35 | #include <linux/interrupt.h> | ||
36 | #include <linux/spinlock.h> | ||
37 | #include <linux/random.h> | ||
38 | #include <linux/miscdevice.h> | ||
39 | #include <linux/smp_lock.h> | ||
40 | #include <linux/mm.h> | ||
41 | #include <linux/delay.h> | ||
42 | |||
43 | #ifdef __i386__ | ||
44 | #include <asm/msr.h> | ||
45 | #include <asm/cpufeature.h> | ||
46 | #endif | ||
47 | |||
48 | #include <asm/io.h> | ||
49 | #include <asm/uaccess.h> | ||
50 | |||
51 | |||
52 | /* | ||
53 | * core module and version information | ||
54 | */ | ||
55 | #define RNG_VERSION "1.0.0" | ||
56 | #define RNG_MODULE_NAME "hw_random" | ||
57 | #define RNG_DRIVER_NAME RNG_MODULE_NAME " hardware driver " RNG_VERSION | ||
58 | #define PFX RNG_MODULE_NAME ": " | ||
59 | |||
60 | |||
61 | /* | ||
62 | * debugging macros | ||
63 | */ | ||
64 | |||
65 | /* pr_debug() collapses to a no-op if DEBUG is not defined */ | ||
66 | #define DPRINTK(fmt, args...) pr_debug(PFX "%s: " fmt, __FUNCTION__ , ## args) | ||
67 | |||
68 | |||
69 | #undef RNG_NDEBUG /* define to enable lightweight runtime checks */ | ||
70 | #ifdef RNG_NDEBUG | ||
71 | #define assert(expr) \ | ||
72 | if(!(expr)) { \ | ||
73 | printk(KERN_DEBUG PFX "Assertion failed! %s,%s,%s," \ | ||
74 | "line=%d\n", #expr, __FILE__, __FUNCTION__, __LINE__); \ | ||
75 | } | ||
76 | #else | ||
77 | #define assert(expr) | ||
78 | #endif | ||
79 | |||
80 | #define RNG_MISCDEV_MINOR 183 /* official */ | ||
81 | |||
82 | static int rng_dev_open (struct inode *inode, struct file *filp); | ||
83 | static ssize_t rng_dev_read (struct file *filp, char __user *buf, size_t size, | ||
84 | loff_t * offp); | ||
85 | |||
86 | static int __init intel_init (struct pci_dev *dev); | ||
87 | static void intel_cleanup(void); | ||
88 | static unsigned int intel_data_present (void); | ||
89 | static u32 intel_data_read (void); | ||
90 | |||
91 | static int __init amd_init (struct pci_dev *dev); | ||
92 | static void amd_cleanup(void); | ||
93 | static unsigned int amd_data_present (void); | ||
94 | static u32 amd_data_read (void); | ||
95 | |||
96 | #ifdef __i386__ | ||
97 | static int __init via_init(struct pci_dev *dev); | ||
98 | static void via_cleanup(void); | ||
99 | static unsigned int via_data_present (void); | ||
100 | static u32 via_data_read (void); | ||
101 | #endif | ||
102 | |||
103 | static int __init geode_init(struct pci_dev *dev); | ||
104 | static void geode_cleanup(void); | ||
105 | static unsigned int geode_data_present (void); | ||
106 | static u32 geode_data_read (void); | ||
107 | |||
108 | struct rng_operations { | ||
109 | int (*init) (struct pci_dev *dev); | ||
110 | void (*cleanup) (void); | ||
111 | unsigned int (*data_present) (void); | ||
112 | u32 (*data_read) (void); | ||
113 | unsigned int n_bytes; /* number of bytes per ->data_read */ | ||
114 | }; | ||
115 | static struct rng_operations *rng_ops; | ||
116 | |||
117 | static struct file_operations rng_chrdev_ops = { | ||
118 | .owner = THIS_MODULE, | ||
119 | .open = rng_dev_open, | ||
120 | .read = rng_dev_read, | ||
121 | }; | ||
122 | |||
123 | |||
124 | static struct miscdevice rng_miscdev = { | ||
125 | RNG_MISCDEV_MINOR, | ||
126 | RNG_MODULE_NAME, | ||
127 | &rng_chrdev_ops, | ||
128 | }; | ||
129 | |||
130 | enum { | ||
131 | rng_hw_none, | ||
132 | rng_hw_intel, | ||
133 | rng_hw_amd, | ||
134 | #ifdef __i386__ | ||
135 | rng_hw_via, | ||
136 | #endif | ||
137 | rng_hw_geode, | ||
138 | }; | ||
139 | |||
140 | static struct rng_operations rng_vendor_ops[] = { | ||
141 | /* rng_hw_none */ | ||
142 | { }, | ||
143 | |||
144 | /* rng_hw_intel */ | ||
145 | { intel_init, intel_cleanup, intel_data_present, | ||
146 | intel_data_read, 1 }, | ||
147 | |||
148 | /* rng_hw_amd */ | ||
149 | { amd_init, amd_cleanup, amd_data_present, amd_data_read, 4 }, | ||
150 | |||
151 | #ifdef __i386__ | ||
152 | /* rng_hw_via */ | ||
153 | { via_init, via_cleanup, via_data_present, via_data_read, 1 }, | ||
154 | #endif | ||
155 | |||
156 | /* rng_hw_geode */ | ||
157 | { geode_init, geode_cleanup, geode_data_present, geode_data_read, 4 } | ||
158 | }; | ||
159 | |||
160 | /* | ||
161 | * Data for PCI driver interface | ||
162 | * | ||
163 | * This data only exists for exporting the supported | ||
164 | * PCI ids via MODULE_DEVICE_TABLE. We do not actually | ||
165 | * register a pci_driver, because someone else might one day | ||
166 | * want to register another driver on the same PCI id. | ||
167 | */ | ||
168 | static struct pci_device_id rng_pci_tbl[] = { | ||
169 | { 0x1022, 0x7443, PCI_ANY_ID, PCI_ANY_ID, 0, 0, rng_hw_amd }, | ||
170 | { 0x1022, 0x746b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, rng_hw_amd }, | ||
171 | |||
172 | { 0x8086, 0x2418, PCI_ANY_ID, PCI_ANY_ID, 0, 0, rng_hw_intel }, | ||
173 | { 0x8086, 0x2428, PCI_ANY_ID, PCI_ANY_ID, 0, 0, rng_hw_intel }, | ||
174 | { 0x8086, 0x2430, PCI_ANY_ID, PCI_ANY_ID, 0, 0, rng_hw_intel }, | ||
175 | { 0x8086, 0x2448, PCI_ANY_ID, PCI_ANY_ID, 0, 0, rng_hw_intel }, | ||
176 | { 0x8086, 0x244e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, rng_hw_intel }, | ||
177 | { 0x8086, 0x245e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, rng_hw_intel }, | ||
178 | |||
179 | { PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_LX_AES, | ||
180 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, rng_hw_geode }, | ||
181 | |||
182 | { 0, }, /* terminate list */ | ||
183 | }; | ||
184 | MODULE_DEVICE_TABLE (pci, rng_pci_tbl); | ||
185 | |||
186 | |||
187 | /*********************************************************************** | ||
188 | * | ||
189 | * Intel RNG operations | ||
190 | * | ||
191 | */ | ||
192 | |||
193 | /* | ||
194 | * RNG registers (offsets from rng_mem) | ||
195 | */ | ||
196 | #define INTEL_RNG_HW_STATUS 0 | ||
197 | #define INTEL_RNG_PRESENT 0x40 | ||
198 | #define INTEL_RNG_ENABLED 0x01 | ||
199 | #define INTEL_RNG_STATUS 1 | ||
200 | #define INTEL_RNG_DATA_PRESENT 0x01 | ||
201 | #define INTEL_RNG_DATA 2 | ||
202 | |||
203 | /* | ||
204 | * Magic address at which Intel PCI bridges locate the RNG | ||
205 | */ | ||
206 | #define INTEL_RNG_ADDR 0xFFBC015F | ||
207 | #define INTEL_RNG_ADDR_LEN 3 | ||
208 | |||
209 | /* token to our ioremap'd RNG register area */ | ||
210 | static void __iomem *rng_mem; | ||
211 | |||
212 | static inline u8 intel_hwstatus (void) | ||
213 | { | ||
214 | assert (rng_mem != NULL); | ||
215 | return readb (rng_mem + INTEL_RNG_HW_STATUS); | ||
216 | } | ||
217 | |||
218 | static inline u8 intel_hwstatus_set (u8 hw_status) | ||
219 | { | ||
220 | assert (rng_mem != NULL); | ||
221 | writeb (hw_status, rng_mem + INTEL_RNG_HW_STATUS); | ||
222 | return intel_hwstatus (); | ||
223 | } | ||
224 | |||
225 | static unsigned int intel_data_present(void) | ||
226 | { | ||
227 | assert (rng_mem != NULL); | ||
228 | |||
229 | return (readb (rng_mem + INTEL_RNG_STATUS) & INTEL_RNG_DATA_PRESENT) ? | ||
230 | 1 : 0; | ||
231 | } | ||
232 | |||
233 | static u32 intel_data_read(void) | ||
234 | { | ||
235 | assert (rng_mem != NULL); | ||
236 | |||
237 | return readb (rng_mem + INTEL_RNG_DATA); | ||
238 | } | ||
239 | |||
240 | static int __init intel_init (struct pci_dev *dev) | ||
241 | { | ||
242 | int rc; | ||
243 | u8 hw_status; | ||
244 | |||
245 | DPRINTK ("ENTER\n"); | ||
246 | |||
247 | rng_mem = ioremap (INTEL_RNG_ADDR, INTEL_RNG_ADDR_LEN); | ||
248 | if (rng_mem == NULL) { | ||
249 | printk (KERN_ERR PFX "cannot ioremap RNG Memory\n"); | ||
250 | rc = -EBUSY; | ||
251 | goto err_out; | ||
252 | } | ||
253 | |||
254 | /* Check for Intel 82802 */ | ||
255 | hw_status = intel_hwstatus (); | ||
256 | if ((hw_status & INTEL_RNG_PRESENT) == 0) { | ||
257 | printk (KERN_ERR PFX "RNG not detected\n"); | ||
258 | rc = -ENODEV; | ||
259 | goto err_out_free_map; | ||
260 | } | ||
261 | |||
262 | /* turn RNG h/w on, if it's off */ | ||
263 | if ((hw_status & INTEL_RNG_ENABLED) == 0) | ||
264 | hw_status = intel_hwstatus_set (hw_status | INTEL_RNG_ENABLED); | ||
265 | if ((hw_status & INTEL_RNG_ENABLED) == 0) { | ||
266 | printk (KERN_ERR PFX "cannot enable RNG, aborting\n"); | ||
267 | rc = -EIO; | ||
268 | goto err_out_free_map; | ||
269 | } | ||
270 | |||
271 | DPRINTK ("EXIT, returning 0\n"); | ||
272 | return 0; | ||
273 | |||
274 | err_out_free_map: | ||
275 | iounmap (rng_mem); | ||
276 | rng_mem = NULL; | ||
277 | err_out: | ||
278 | DPRINTK ("EXIT, returning %d\n", rc); | ||
279 | return rc; | ||
280 | } | ||
281 | |||
282 | static void intel_cleanup(void) | ||
283 | { | ||
284 | u8 hw_status; | ||
285 | |||
286 | hw_status = intel_hwstatus (); | ||
287 | if (hw_status & INTEL_RNG_ENABLED) | ||
288 | intel_hwstatus_set (hw_status & ~INTEL_RNG_ENABLED); | ||
289 | else | ||
290 | printk(KERN_WARNING PFX "unusual: RNG already disabled\n"); | ||
291 | iounmap(rng_mem); | ||
292 | rng_mem = NULL; | ||
293 | } | ||
294 | |||
295 | /*********************************************************************** | ||
296 | * | ||
297 | * AMD RNG operations | ||
298 | * | ||
299 | */ | ||
300 | |||
301 | static u32 pmbase; /* PMxx I/O base */ | ||
302 | static struct pci_dev *amd_dev; | ||
303 | |||
304 | static unsigned int amd_data_present (void) | ||
305 | { | ||
306 | return inl(pmbase + 0xF4) & 1; | ||
307 | } | ||
308 | |||
309 | |||
310 | static u32 amd_data_read (void) | ||
311 | { | ||
312 | return inl(pmbase + 0xF0); | ||
313 | } | ||
314 | |||
315 | static int __init amd_init (struct pci_dev *dev) | ||
316 | { | ||
317 | int rc; | ||
318 | u8 rnen; | ||
319 | |||
320 | DPRINTK ("ENTER\n"); | ||
321 | |||
322 | pci_read_config_dword(dev, 0x58, &pmbase); | ||
323 | |||
324 | pmbase &= 0x0000FF00; | ||
325 | |||
326 | if (pmbase == 0) | ||
327 | { | ||
328 | printk (KERN_ERR PFX "power management base not set\n"); | ||
329 | rc = -EIO; | ||
330 | goto err_out; | ||
331 | } | ||
332 | |||
333 | pci_read_config_byte(dev, 0x40, &rnen); | ||
334 | rnen |= (1 << 7); /* RNG on */ | ||
335 | pci_write_config_byte(dev, 0x40, rnen); | ||
336 | |||
337 | pci_read_config_byte(dev, 0x41, &rnen); | ||
338 | rnen |= (1 << 7); /* PMIO enable */ | ||
339 | pci_write_config_byte(dev, 0x41, rnen); | ||
340 | |||
341 | pr_info( PFX "AMD768 system management I/O registers at 0x%X.\n", | ||
342 | pmbase); | ||
343 | |||
344 | amd_dev = dev; | ||
345 | |||
346 | DPRINTK ("EXIT, returning 0\n"); | ||
347 | return 0; | ||
348 | |||
349 | err_out: | ||
350 | DPRINTK ("EXIT, returning %d\n", rc); | ||
351 | return rc; | ||
352 | } | ||
353 | |||
354 | static void amd_cleanup(void) | ||
355 | { | ||
356 | u8 rnen; | ||
357 | |||
358 | pci_read_config_byte(amd_dev, 0x40, &rnen); | ||
359 | rnen &= ~(1 << 7); /* RNG off */ | ||
360 | pci_write_config_byte(amd_dev, 0x40, rnen); | ||
361 | |||
362 | /* FIXME: twiddle pmio, also? */ | ||
363 | } | ||
364 | |||
365 | #ifdef __i386__ | ||
366 | /*********************************************************************** | ||
367 | * | ||
368 | * VIA RNG operations | ||
369 | * | ||
370 | */ | ||
371 | |||
372 | enum { | ||
373 | VIA_STRFILT_CNT_SHIFT = 16, | ||
374 | VIA_STRFILT_FAIL = (1 << 15), | ||
375 | VIA_STRFILT_ENABLE = (1 << 14), | ||
376 | VIA_RAWBITS_ENABLE = (1 << 13), | ||
377 | VIA_RNG_ENABLE = (1 << 6), | ||
378 | VIA_XSTORE_CNT_MASK = 0x0F, | ||
379 | |||
380 | VIA_RNG_CHUNK_8 = 0x00, /* 64 rand bits, 64 stored bits */ | ||
381 | VIA_RNG_CHUNK_4 = 0x01, /* 32 rand bits, 32 stored bits */ | ||
382 | VIA_RNG_CHUNK_4_MASK = 0xFFFFFFFF, | ||
383 | VIA_RNG_CHUNK_2 = 0x02, /* 16 rand bits, 32 stored bits */ | ||
384 | VIA_RNG_CHUNK_2_MASK = 0xFFFF, | ||
385 | VIA_RNG_CHUNK_1 = 0x03, /* 8 rand bits, 32 stored bits */ | ||
386 | VIA_RNG_CHUNK_1_MASK = 0xFF, | ||
387 | }; | ||
388 | |||
389 | static u32 via_rng_datum; | ||
390 | |||
391 | /* | ||
392 | * Investigate using the 'rep' prefix to obtain 32 bits of random data | ||
393 | * in one insn. The upside is potentially better performance. The | ||
394 | * downside is that the instruction becomes no longer atomic. Due to | ||
395 | * this, just like familiar issues with /dev/random itself, the worst | ||
396 | * case of a 'rep xstore' could potentially pause a cpu for an | ||
397 | * unreasonably long time. In practice, this condition would likely | ||
398 | * only occur when the hardware is failing. (or so we hope :)) | ||
399 | * | ||
400 | * Another possible performance boost may come from simply buffering | ||
401 | * until we have 4 bytes, thus returning a u32 at a time, | ||
402 | * instead of the current u8-at-a-time. | ||
403 | */ | ||
404 | |||
405 | static inline u32 xstore(u32 *addr, u32 edx_in) | ||
406 | { | ||
407 | u32 eax_out; | ||
408 | |||
409 | asm(".byte 0x0F,0xA7,0xC0 /* xstore %%edi (addr=%0) */" | ||
410 | :"=m"(*addr), "=a"(eax_out) | ||
411 | :"D"(addr), "d"(edx_in)); | ||
412 | |||
413 | return eax_out; | ||
414 | } | ||
415 | |||
416 | static unsigned int via_data_present(void) | ||
417 | { | ||
418 | u32 bytes_out; | ||
419 | |||
420 | /* We choose the recommended 1-byte-per-instruction RNG rate, | ||
421 | * for greater randomness at the expense of speed. Larger | ||
422 | * values 2, 4, or 8 bytes-per-instruction yield greater | ||
423 | * speed at lesser randomness. | ||
424 | * | ||
425 | * If you change this to another VIA_CHUNK_n, you must also | ||
426 | * change the ->n_bytes values in rng_vendor_ops[] tables. | ||
427 | * VIA_CHUNK_8 requires further code changes. | ||
428 | * | ||
429 | * A copy of MSR_VIA_RNG is placed in eax_out when xstore | ||
430 | * completes. | ||
431 | */ | ||
432 | via_rng_datum = 0; /* paranoia, not really necessary */ | ||
433 | bytes_out = xstore(&via_rng_datum, VIA_RNG_CHUNK_1) & VIA_XSTORE_CNT_MASK; | ||
434 | if (bytes_out == 0) | ||
435 | return 0; | ||
436 | |||
437 | return 1; | ||
438 | } | ||
439 | |||
440 | static u32 via_data_read(void) | ||
441 | { | ||
442 | return via_rng_datum; | ||
443 | } | ||
444 | |||
445 | static int __init via_init(struct pci_dev *dev) | ||
446 | { | ||
447 | u32 lo, hi, old_lo; | ||
448 | |||
449 | /* Control the RNG via MSR. Tread lightly and pay very close | ||
450 | * close attention to values written, as the reserved fields | ||
451 | * are documented to be "undefined and unpredictable"; but it | ||
452 | * does not say to write them as zero, so I make a guess that | ||
453 | * we restore the values we find in the register. | ||
454 | */ | ||
455 | rdmsr(MSR_VIA_RNG, lo, hi); | ||
456 | |||
457 | old_lo = lo; | ||
458 | lo &= ~(0x7f << VIA_STRFILT_CNT_SHIFT); | ||
459 | lo &= ~VIA_XSTORE_CNT_MASK; | ||
460 | lo &= ~(VIA_STRFILT_ENABLE | VIA_STRFILT_FAIL | VIA_RAWBITS_ENABLE); | ||
461 | lo |= VIA_RNG_ENABLE; | ||
462 | |||
463 | if (lo != old_lo) | ||
464 | wrmsr(MSR_VIA_RNG, lo, hi); | ||
465 | |||
466 | /* perhaps-unnecessary sanity check; remove after testing if | ||
467 | unneeded */ | ||
468 | rdmsr(MSR_VIA_RNG, lo, hi); | ||
469 | if ((lo & VIA_RNG_ENABLE) == 0) { | ||
470 | printk(KERN_ERR PFX "cannot enable VIA C3 RNG, aborting\n"); | ||
471 | return -ENODEV; | ||
472 | } | ||
473 | |||
474 | return 0; | ||
475 | } | ||
476 | |||
477 | static void via_cleanup(void) | ||
478 | { | ||
479 | /* do nothing */ | ||
480 | } | ||
481 | #endif | ||
482 | |||
483 | /*********************************************************************** | ||
484 | * | ||
485 | * AMD Geode RNG operations | ||
486 | * | ||
487 | */ | ||
488 | |||
489 | static void __iomem *geode_rng_base = NULL; | ||
490 | |||
491 | #define GEODE_RNG_DATA_REG 0x50 | ||
492 | #define GEODE_RNG_STATUS_REG 0x54 | ||
493 | |||
494 | static u32 geode_data_read(void) | ||
495 | { | ||
496 | u32 val; | ||
497 | |||
498 | assert(geode_rng_base != NULL); | ||
499 | val = readl(geode_rng_base + GEODE_RNG_DATA_REG); | ||
500 | return val; | ||
501 | } | ||
502 | |||
503 | static unsigned int geode_data_present(void) | ||
504 | { | ||
505 | u32 val; | ||
506 | |||
507 | assert(geode_rng_base != NULL); | ||
508 | val = readl(geode_rng_base + GEODE_RNG_STATUS_REG); | ||
509 | return val; | ||
510 | } | ||
511 | |||
512 | static void geode_cleanup(void) | ||
513 | { | ||
514 | iounmap(geode_rng_base); | ||
515 | geode_rng_base = NULL; | ||
516 | } | ||
517 | |||
518 | static int geode_init(struct pci_dev *dev) | ||
519 | { | ||
520 | unsigned long rng_base = pci_resource_start(dev, 0); | ||
521 | |||
522 | if (rng_base == 0) | ||
523 | return 1; | ||
524 | |||
525 | geode_rng_base = ioremap(rng_base, 0x58); | ||
526 | |||
527 | if (geode_rng_base == NULL) { | ||
528 | printk(KERN_ERR PFX "Cannot ioremap RNG memory\n"); | ||
529 | return -EBUSY; | ||
530 | } | ||
531 | |||
532 | return 0; | ||
533 | } | ||
534 | |||
535 | /*********************************************************************** | ||
536 | * | ||
537 | * /dev/hwrandom character device handling (major 10, minor 183) | ||
538 | * | ||
539 | */ | ||
540 | |||
541 | static int rng_dev_open (struct inode *inode, struct file *filp) | ||
542 | { | ||
543 | /* enforce read-only access to this chrdev */ | ||
544 | if ((filp->f_mode & FMODE_READ) == 0) | ||
545 | return -EINVAL; | ||
546 | if (filp->f_mode & FMODE_WRITE) | ||
547 | return -EINVAL; | ||
548 | |||
549 | return 0; | ||
550 | } | ||
551 | |||
552 | |||
553 | static ssize_t rng_dev_read (struct file *filp, char __user *buf, size_t size, | ||
554 | loff_t * offp) | ||
555 | { | ||
556 | static DEFINE_SPINLOCK(rng_lock); | ||
557 | unsigned int have_data; | ||
558 | u32 data = 0; | ||
559 | ssize_t ret = 0; | ||
560 | |||
561 | while (size) { | ||
562 | spin_lock(&rng_lock); | ||
563 | |||
564 | have_data = 0; | ||
565 | if (rng_ops->data_present()) { | ||
566 | data = rng_ops->data_read(); | ||
567 | have_data = rng_ops->n_bytes; | ||
568 | } | ||
569 | |||
570 | spin_unlock (&rng_lock); | ||
571 | |||
572 | while (have_data && size) { | ||
573 | if (put_user((u8)data, buf++)) { | ||
574 | ret = ret ? : -EFAULT; | ||
575 | break; | ||
576 | } | ||
577 | size--; | ||
578 | ret++; | ||
579 | have_data--; | ||
580 | data>>=8; | ||
581 | } | ||
582 | |||
583 | if (filp->f_flags & O_NONBLOCK) | ||
584 | return ret ? : -EAGAIN; | ||
585 | |||
586 | if(need_resched()) | ||
587 | schedule_timeout_interruptible(1); | ||
588 | else | ||
589 | udelay(200); /* FIXME: We could poll for 250uS ?? */ | ||
590 | |||
591 | if (signal_pending (current)) | ||
592 | return ret ? : -ERESTARTSYS; | ||
593 | } | ||
594 | return ret; | ||
595 | } | ||
596 | |||
597 | |||
598 | |||
599 | /* | ||
600 | * rng_init_one - look for and attempt to init a single RNG | ||
601 | */ | ||
602 | static int __init rng_init_one (struct pci_dev *dev) | ||
603 | { | ||
604 | int rc; | ||
605 | |||
606 | DPRINTK ("ENTER\n"); | ||
607 | |||
608 | assert(rng_ops != NULL); | ||
609 | |||
610 | rc = rng_ops->init(dev); | ||
611 | if (rc) | ||
612 | goto err_out; | ||
613 | |||
614 | rc = misc_register (&rng_miscdev); | ||
615 | if (rc) { | ||
616 | printk (KERN_ERR PFX "misc device register failed\n"); | ||
617 | goto err_out_cleanup_hw; | ||
618 | } | ||
619 | |||
620 | DPRINTK ("EXIT, returning 0\n"); | ||
621 | return 0; | ||
622 | |||
623 | err_out_cleanup_hw: | ||
624 | rng_ops->cleanup(); | ||
625 | err_out: | ||
626 | DPRINTK ("EXIT, returning %d\n", rc); | ||
627 | return rc; | ||
628 | } | ||
629 | |||
630 | |||
631 | |||
632 | MODULE_AUTHOR("The Linux Kernel team"); | ||
633 | MODULE_DESCRIPTION("H/W Random Number Generator (RNG) driver"); | ||
634 | MODULE_LICENSE("GPL"); | ||
635 | |||
636 | |||
637 | /* | ||
638 | * rng_init - initialize RNG module | ||
639 | */ | ||
640 | static int __init rng_init (void) | ||
641 | { | ||
642 | int rc; | ||
643 | struct pci_dev *pdev = NULL; | ||
644 | const struct pci_device_id *ent; | ||
645 | |||
646 | DPRINTK ("ENTER\n"); | ||
647 | |||
648 | /* Probe for Intel, AMD, Geode RNGs */ | ||
649 | for_each_pci_dev(pdev) { | ||
650 | ent = pci_match_id(rng_pci_tbl, pdev); | ||
651 | if (ent) { | ||
652 | rng_ops = &rng_vendor_ops[ent->driver_data]; | ||
653 | goto match; | ||
654 | } | ||
655 | } | ||
656 | |||
657 | #ifdef __i386__ | ||
658 | /* Probe for VIA RNG */ | ||
659 | if (cpu_has_xstore) { | ||
660 | rng_ops = &rng_vendor_ops[rng_hw_via]; | ||
661 | pdev = NULL; | ||
662 | goto match; | ||
663 | } | ||
664 | #endif | ||
665 | |||
666 | DPRINTK ("EXIT, returning -ENODEV\n"); | ||
667 | return -ENODEV; | ||
668 | |||
669 | match: | ||
670 | rc = rng_init_one (pdev); | ||
671 | if (rc) | ||
672 | return rc; | ||
673 | |||
674 | pr_info( RNG_DRIVER_NAME " loaded\n"); | ||
675 | |||
676 | DPRINTK ("EXIT, returning 0\n"); | ||
677 | return 0; | ||
678 | } | ||
679 | |||
680 | |||
681 | /* | ||
682 | * rng_init - shutdown RNG module | ||
683 | */ | ||
684 | static void __exit rng_cleanup (void) | ||
685 | { | ||
686 | DPRINTK ("ENTER\n"); | ||
687 | |||
688 | misc_deregister (&rng_miscdev); | ||
689 | |||
690 | if (rng_ops->cleanup) | ||
691 | rng_ops->cleanup(); | ||
692 | |||
693 | DPRINTK ("EXIT\n"); | ||
694 | } | ||
695 | |||
696 | |||
697 | module_init (rng_init); | ||
698 | module_exit (rng_cleanup); | ||
diff --git a/drivers/char/hw_random/Kconfig b/drivers/char/hw_random/Kconfig new file mode 100644 index 000000000000..9f7635f75178 --- /dev/null +++ b/drivers/char/hw_random/Kconfig | |||
@@ -0,0 +1,90 @@ | |||
1 | # | ||
2 | # Hardware Random Number Generator (RNG) configuration | ||
3 | # | ||
4 | |||
5 | config HW_RANDOM | ||
6 | bool "Hardware Random Number Generator Core support" | ||
7 | default y | ||
8 | ---help--- | ||
9 | Hardware Random Number Generator Core infrastructure. | ||
10 | |||
11 | If unsure, say Y. | ||
12 | |||
13 | config HW_RANDOM_INTEL | ||
14 | tristate "Intel HW Random Number Generator support" | ||
15 | depends on HW_RANDOM && (X86 || IA64) && PCI | ||
16 | default y | ||
17 | ---help--- | ||
18 | This driver provides kernel-side support for the Random Number | ||
19 | Generator hardware found on Intel i8xx-based motherboards. | ||
20 | |||
21 | To compile this driver as a module, choose M here: the | ||
22 | module will be called intel-rng. | ||
23 | |||
24 | If unsure, say Y. | ||
25 | |||
26 | config HW_RANDOM_AMD | ||
27 | tristate "AMD HW Random Number Generator support" | ||
28 | depends on HW_RANDOM && X86 && PCI | ||
29 | default y | ||
30 | ---help--- | ||
31 | This driver provides kernel-side support for the Random Number | ||
32 | Generator hardware found on AMD 76x-based motherboards. | ||
33 | |||
34 | To compile this driver as a module, choose M here: the | ||
35 | module will be called amd-rng. | ||
36 | |||
37 | If unsure, say Y. | ||
38 | |||
39 | config HW_RANDOM_GEODE | ||
40 | tristate "AMD Geode HW Random Number Generator support" | ||
41 | depends on HW_RANDOM && X86 && PCI | ||
42 | default y | ||
43 | ---help--- | ||
44 | This driver provides kernel-side support for the Random Number | ||
45 | Generator hardware found on the AMD Geode LX. | ||
46 | |||
47 | To compile this driver as a module, choose M here: the | ||
48 | module will be called geode-rng. | ||
49 | |||
50 | If unsure, say Y. | ||
51 | |||
52 | config HW_RANDOM_VIA | ||
53 | tristate "VIA HW Random Number Generator support" | ||
54 | depends on HW_RANDOM && X86_32 | ||
55 | default y | ||
56 | ---help--- | ||
57 | This driver provides kernel-side support for the Random Number | ||
58 | Generator hardware found on VIA based motherboards. | ||
59 | |||
60 | To compile this driver as a module, choose M here: the | ||
61 | module will be called via-rng. | ||
62 | |||
63 | If unsure, say Y. | ||
64 | |||
65 | config HW_RANDOM_IXP4XX | ||
66 | tristate "Intel IXP4xx NPU HW Random Number Generator support" | ||
67 | depends on HW_RANDOM && ARCH_IXP4XX | ||
68 | default y | ||
69 | ---help--- | ||
70 | This driver provides kernel-side support for the Random | ||
71 | Number Generator hardware found on the Intel IXP4xx NPU. | ||
72 | |||
73 | To compile this driver as a module, choose M here: the | ||
74 | module will be called ixp4xx-rng. | ||
75 | |||
76 | If unsure, say Y. | ||
77 | |||
78 | config HW_RANDOM_OMAP | ||
79 | tristate "OMAP Random Number Generator support" | ||
80 | depends on HW_RANDOM && (ARCH_OMAP16XX || ARCH_OMAP24XX) | ||
81 | default y | ||
82 | ---help--- | ||
83 | This driver provides kernel-side support for the Random Number | ||
84 | Generator hardware found on OMAP16xx and OMAP24xx multimedia | ||
85 | processors. | ||
86 | |||
87 | To compile this driver as a module, choose M here: the | ||
88 | module will be called omap-rng. | ||
89 | |||
90 | If unsure, say Y. | ||
diff --git a/drivers/char/hw_random/Makefile b/drivers/char/hw_random/Makefile new file mode 100644 index 000000000000..e263ae96f940 --- /dev/null +++ b/drivers/char/hw_random/Makefile | |||
@@ -0,0 +1,11 @@ | |||
1 | # | ||
2 | # Makefile for HW Random Number Generator (RNG) device drivers. | ||
3 | # | ||
4 | |||
5 | obj-$(CONFIG_HW_RANDOM) += core.o | ||
6 | obj-$(CONFIG_HW_RANDOM_INTEL) += intel-rng.o | ||
7 | obj-$(CONFIG_HW_RANDOM_AMD) += amd-rng.o | ||
8 | obj-$(CONFIG_HW_RANDOM_GEODE) += geode-rng.o | ||
9 | obj-$(CONFIG_HW_RANDOM_VIA) += via-rng.o | ||
10 | obj-$(CONFIG_HW_RANDOM_IXP4XX) += ixp4xx-rng.o | ||
11 | obj-$(CONFIG_HW_RANDOM_OMAP) += omap-rng.o | ||
diff --git a/drivers/char/hw_random/amd-rng.c b/drivers/char/hw_random/amd-rng.c new file mode 100644 index 000000000000..71e4e0f3fd54 --- /dev/null +++ b/drivers/char/hw_random/amd-rng.c | |||
@@ -0,0 +1,152 @@ | |||
1 | /* | ||
2 | * RNG driver for AMD RNGs | ||
3 | * | ||
4 | * Copyright 2005 (c) MontaVista Software, Inc. | ||
5 | * | ||
6 | * with the majority of the code coming from: | ||
7 | * | ||
8 | * Hardware driver for the Intel/AMD/VIA Random Number Generators (RNG) | ||
9 | * (c) Copyright 2003 Red Hat Inc <jgarzik@redhat.com> | ||
10 | * | ||
11 | * derived from | ||
12 | * | ||
13 | * Hardware driver for the AMD 768 Random Number Generator (RNG) | ||
14 | * (c) Copyright 2001 Red Hat Inc <alan@redhat.com> | ||
15 | * | ||
16 | * derived from | ||
17 | * | ||
18 | * Hardware driver for Intel i810 Random Number Generator (RNG) | ||
19 | * Copyright 2000,2001 Jeff Garzik <jgarzik@pobox.com> | ||
20 | * Copyright 2000,2001 Philipp Rumpf <prumpf@mandrakesoft.com> | ||
21 | * | ||
22 | * This file is licensed under the terms of the GNU General Public | ||
23 | * License version 2. This program is licensed "as is" without any | ||
24 | * warranty of any kind, whether express or implied. | ||
25 | */ | ||
26 | |||
27 | #include <linux/module.h> | ||
28 | #include <linux/kernel.h> | ||
29 | #include <linux/pci.h> | ||
30 | #include <linux/hw_random.h> | ||
31 | #include <asm/io.h> | ||
32 | |||
33 | |||
34 | #define PFX KBUILD_MODNAME ": " | ||
35 | |||
36 | |||
37 | /* | ||
38 | * Data for PCI driver interface | ||
39 | * | ||
40 | * This data only exists for exporting the supported | ||
41 | * PCI ids via MODULE_DEVICE_TABLE. We do not actually | ||
42 | * register a pci_driver, because someone else might one day | ||
43 | * want to register another driver on the same PCI id. | ||
44 | */ | ||
45 | static const struct pci_device_id pci_tbl[] = { | ||
46 | { 0x1022, 0x7443, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, | ||
47 | { 0x1022, 0x746b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, | ||
48 | { 0, }, /* terminate list */ | ||
49 | }; | ||
50 | MODULE_DEVICE_TABLE(pci, pci_tbl); | ||
51 | |||
52 | static struct pci_dev *amd_pdev; | ||
53 | |||
54 | |||
55 | static int amd_rng_data_present(struct hwrng *rng) | ||
56 | { | ||
57 | u32 pmbase = (u32)rng->priv; | ||
58 | |||
59 | return !!(inl(pmbase + 0xF4) & 1); | ||
60 | } | ||
61 | |||
62 | static int amd_rng_data_read(struct hwrng *rng, u32 *data) | ||
63 | { | ||
64 | u32 pmbase = (u32)rng->priv; | ||
65 | |||
66 | *data = inl(pmbase + 0xF0); | ||
67 | |||
68 | return 4; | ||
69 | } | ||
70 | |||
71 | static int amd_rng_init(struct hwrng *rng) | ||
72 | { | ||
73 | u8 rnen; | ||
74 | |||
75 | pci_read_config_byte(amd_pdev, 0x40, &rnen); | ||
76 | rnen |= (1 << 7); /* RNG on */ | ||
77 | pci_write_config_byte(amd_pdev, 0x40, rnen); | ||
78 | |||
79 | pci_read_config_byte(amd_pdev, 0x41, &rnen); | ||
80 | rnen |= (1 << 7); /* PMIO enable */ | ||
81 | pci_write_config_byte(amd_pdev, 0x41, rnen); | ||
82 | |||
83 | return 0; | ||
84 | } | ||
85 | |||
86 | static void amd_rng_cleanup(struct hwrng *rng) | ||
87 | { | ||
88 | u8 rnen; | ||
89 | |||
90 | pci_read_config_byte(amd_pdev, 0x40, &rnen); | ||
91 | rnen &= ~(1 << 7); /* RNG off */ | ||
92 | pci_write_config_byte(amd_pdev, 0x40, rnen); | ||
93 | } | ||
94 | |||
95 | |||
96 | static struct hwrng amd_rng = { | ||
97 | .name = "amd", | ||
98 | .init = amd_rng_init, | ||
99 | .cleanup = amd_rng_cleanup, | ||
100 | .data_present = amd_rng_data_present, | ||
101 | .data_read = amd_rng_data_read, | ||
102 | }; | ||
103 | |||
104 | |||
105 | static int __init mod_init(void) | ||
106 | { | ||
107 | int err = -ENODEV; | ||
108 | struct pci_dev *pdev = NULL; | ||
109 | const struct pci_device_id *ent; | ||
110 | u32 pmbase; | ||
111 | |||
112 | for_each_pci_dev(pdev) { | ||
113 | ent = pci_match_id(pci_tbl, pdev); | ||
114 | if (ent) | ||
115 | goto found; | ||
116 | } | ||
117 | /* Device not found. */ | ||
118 | goto out; | ||
119 | |||
120 | found: | ||
121 | err = pci_read_config_dword(pdev, 0x58, &pmbase); | ||
122 | if (err) | ||
123 | goto out; | ||
124 | err = -EIO; | ||
125 | pmbase &= 0x0000FF00; | ||
126 | if (pmbase == 0) | ||
127 | goto out; | ||
128 | amd_rng.priv = (unsigned long)pmbase; | ||
129 | amd_pdev = pdev; | ||
130 | |||
131 | printk(KERN_INFO "AMD768 RNG detected\n"); | ||
132 | err = hwrng_register(&amd_rng); | ||
133 | if (err) { | ||
134 | printk(KERN_ERR PFX "RNG registering failed (%d)\n", | ||
135 | err); | ||
136 | goto out; | ||
137 | } | ||
138 | out: | ||
139 | return err; | ||
140 | } | ||
141 | |||
142 | static void __exit mod_exit(void) | ||
143 | { | ||
144 | hwrng_unregister(&amd_rng); | ||
145 | } | ||
146 | |||
147 | subsys_initcall(mod_init); | ||
148 | module_exit(mod_exit); | ||
149 | |||
150 | MODULE_AUTHOR("The Linux Kernel team"); | ||
151 | MODULE_DESCRIPTION("H/W RNG driver for AMD chipsets"); | ||
152 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c new file mode 100644 index 000000000000..154a81d328c1 --- /dev/null +++ b/drivers/char/hw_random/core.c | |||
@@ -0,0 +1,354 @@ | |||
1 | /* | ||
2 | Added support for the AMD Geode LX RNG | ||
3 | (c) Copyright 2004-2005 Advanced Micro Devices, Inc. | ||
4 | |||
5 | derived from | ||
6 | |||
7 | Hardware driver for the Intel/AMD/VIA Random Number Generators (RNG) | ||
8 | (c) Copyright 2003 Red Hat Inc <jgarzik@redhat.com> | ||
9 | |||
10 | derived from | ||
11 | |||
12 | Hardware driver for the AMD 768 Random Number Generator (RNG) | ||
13 | (c) Copyright 2001 Red Hat Inc <alan@redhat.com> | ||
14 | |||
15 | derived from | ||
16 | |||
17 | Hardware driver for Intel i810 Random Number Generator (RNG) | ||
18 | Copyright 2000,2001 Jeff Garzik <jgarzik@pobox.com> | ||
19 | Copyright 2000,2001 Philipp Rumpf <prumpf@mandrakesoft.com> | ||
20 | |||
21 | Added generic RNG API | ||
22 | Copyright 2006 Michael Buesch <mbuesch@freenet.de> | ||
23 | Copyright 2005 (c) MontaVista Software, Inc. | ||
24 | |||
25 | Please read Documentation/hw_random.txt for details on use. | ||
26 | |||
27 | ---------------------------------------------------------- | ||
28 | This software may be used and distributed according to the terms | ||
29 | of the GNU General Public License, incorporated herein by reference. | ||
30 | |||
31 | */ | ||
32 | |||
33 | |||
34 | #include <linux/device.h> | ||
35 | #include <linux/hw_random.h> | ||
36 | #include <linux/module.h> | ||
37 | #include <linux/kernel.h> | ||
38 | #include <linux/fs.h> | ||
39 | #include <linux/init.h> | ||
40 | #include <linux/miscdevice.h> | ||
41 | #include <linux/delay.h> | ||
42 | #include <asm/uaccess.h> | ||
43 | |||
44 | |||
45 | #define RNG_MODULE_NAME "hw_random" | ||
46 | #define PFX RNG_MODULE_NAME ": " | ||
47 | #define RNG_MISCDEV_MINOR 183 /* official */ | ||
48 | |||
49 | |||
50 | static struct hwrng *current_rng; | ||
51 | static LIST_HEAD(rng_list); | ||
52 | static DEFINE_MUTEX(rng_mutex); | ||
53 | |||
54 | |||
55 | static inline int hwrng_init(struct hwrng *rng) | ||
56 | { | ||
57 | if (!rng->init) | ||
58 | return 0; | ||
59 | return rng->init(rng); | ||
60 | } | ||
61 | |||
62 | static inline void hwrng_cleanup(struct hwrng *rng) | ||
63 | { | ||
64 | if (rng && rng->cleanup) | ||
65 | rng->cleanup(rng); | ||
66 | } | ||
67 | |||
68 | static inline int hwrng_data_present(struct hwrng *rng) | ||
69 | { | ||
70 | if (!rng->data_present) | ||
71 | return 1; | ||
72 | return rng->data_present(rng); | ||
73 | } | ||
74 | |||
75 | static inline int hwrng_data_read(struct hwrng *rng, u32 *data) | ||
76 | { | ||
77 | return rng->data_read(rng, data); | ||
78 | } | ||
79 | |||
80 | |||
81 | static int rng_dev_open(struct inode *inode, struct file *filp) | ||
82 | { | ||
83 | /* enforce read-only access to this chrdev */ | ||
84 | if ((filp->f_mode & FMODE_READ) == 0) | ||
85 | return -EINVAL; | ||
86 | if (filp->f_mode & FMODE_WRITE) | ||
87 | return -EINVAL; | ||
88 | return 0; | ||
89 | } | ||
90 | |||
91 | static ssize_t rng_dev_read(struct file *filp, char __user *buf, | ||
92 | size_t size, loff_t *offp) | ||
93 | { | ||
94 | u32 data; | ||
95 | ssize_t ret = 0; | ||
96 | int i, err = 0; | ||
97 | int data_present; | ||
98 | int bytes_read; | ||
99 | |||
100 | while (size) { | ||
101 | err = -ERESTARTSYS; | ||
102 | if (mutex_lock_interruptible(&rng_mutex)) | ||
103 | goto out; | ||
104 | if (!current_rng) { | ||
105 | mutex_unlock(&rng_mutex); | ||
106 | err = -ENODEV; | ||
107 | goto out; | ||
108 | } | ||
109 | if (filp->f_flags & O_NONBLOCK) { | ||
110 | data_present = hwrng_data_present(current_rng); | ||
111 | } else { | ||
112 | /* Some RNG require some time between data_reads to gather | ||
113 | * new entropy. Poll it. | ||
114 | */ | ||
115 | for (i = 0; i < 20; i++) { | ||
116 | data_present = hwrng_data_present(current_rng); | ||
117 | if (data_present) | ||
118 | break; | ||
119 | udelay(10); | ||
120 | } | ||
121 | } | ||
122 | bytes_read = 0; | ||
123 | if (data_present) | ||
124 | bytes_read = hwrng_data_read(current_rng, &data); | ||
125 | mutex_unlock(&rng_mutex); | ||
126 | |||
127 | err = -EAGAIN; | ||
128 | if (!bytes_read && (filp->f_flags & O_NONBLOCK)) | ||
129 | goto out; | ||
130 | |||
131 | err = -EFAULT; | ||
132 | while (bytes_read && size) { | ||
133 | if (put_user((u8)data, buf++)) | ||
134 | goto out; | ||
135 | size--; | ||
136 | ret++; | ||
137 | bytes_read--; | ||
138 | data >>= 8; | ||
139 | } | ||
140 | |||
141 | if (need_resched()) | ||
142 | schedule_timeout_interruptible(1); | ||
143 | err = -ERESTARTSYS; | ||
144 | if (signal_pending(current)) | ||
145 | goto out; | ||
146 | } | ||
147 | out: | ||
148 | return ret ? : err; | ||
149 | } | ||
150 | |||
151 | |||
152 | static const struct file_operations rng_chrdev_ops = { | ||
153 | .owner = THIS_MODULE, | ||
154 | .open = rng_dev_open, | ||
155 | .read = rng_dev_read, | ||
156 | }; | ||
157 | |||
158 | static struct miscdevice rng_miscdev = { | ||
159 | .minor = RNG_MISCDEV_MINOR, | ||
160 | .name = RNG_MODULE_NAME, | ||
161 | .fops = &rng_chrdev_ops, | ||
162 | }; | ||
163 | |||
164 | |||
165 | static ssize_t hwrng_attr_current_store(struct class_device *class, | ||
166 | const char *buf, size_t len) | ||
167 | { | ||
168 | int err; | ||
169 | struct hwrng *rng; | ||
170 | |||
171 | err = mutex_lock_interruptible(&rng_mutex); | ||
172 | if (err) | ||
173 | return -ERESTARTSYS; | ||
174 | err = -ENODEV; | ||
175 | list_for_each_entry(rng, &rng_list, list) { | ||
176 | if (strcmp(rng->name, buf) == 0) { | ||
177 | if (rng == current_rng) { | ||
178 | err = 0; | ||
179 | break; | ||
180 | } | ||
181 | err = hwrng_init(rng); | ||
182 | if (err) | ||
183 | break; | ||
184 | hwrng_cleanup(current_rng); | ||
185 | current_rng = rng; | ||
186 | err = 0; | ||
187 | break; | ||
188 | } | ||
189 | } | ||
190 | mutex_unlock(&rng_mutex); | ||
191 | |||
192 | return err ? : len; | ||
193 | } | ||
194 | |||
195 | static ssize_t hwrng_attr_current_show(struct class_device *class, | ||
196 | char *buf) | ||
197 | { | ||
198 | int err; | ||
199 | ssize_t ret; | ||
200 | const char *name = "none"; | ||
201 | |||
202 | err = mutex_lock_interruptible(&rng_mutex); | ||
203 | if (err) | ||
204 | return -ERESTARTSYS; | ||
205 | if (current_rng) | ||
206 | name = current_rng->name; | ||
207 | ret = snprintf(buf, PAGE_SIZE, "%s\n", name); | ||
208 | mutex_unlock(&rng_mutex); | ||
209 | |||
210 | return ret; | ||
211 | } | ||
212 | |||
213 | static ssize_t hwrng_attr_available_show(struct class_device *class, | ||
214 | char *buf) | ||
215 | { | ||
216 | int err; | ||
217 | ssize_t ret = 0; | ||
218 | struct hwrng *rng; | ||
219 | |||
220 | err = mutex_lock_interruptible(&rng_mutex); | ||
221 | if (err) | ||
222 | return -ERESTARTSYS; | ||
223 | buf[0] = '\0'; | ||
224 | list_for_each_entry(rng, &rng_list, list) { | ||
225 | strncat(buf, rng->name, PAGE_SIZE - ret - 1); | ||
226 | ret += strlen(rng->name); | ||
227 | strncat(buf, " ", PAGE_SIZE - ret - 1); | ||
228 | ret++; | ||
229 | } | ||
230 | strncat(buf, "\n", PAGE_SIZE - ret - 1); | ||
231 | ret++; | ||
232 | mutex_unlock(&rng_mutex); | ||
233 | |||
234 | return ret; | ||
235 | } | ||
236 | |||
237 | static CLASS_DEVICE_ATTR(rng_current, S_IRUGO | S_IWUSR, | ||
238 | hwrng_attr_current_show, | ||
239 | hwrng_attr_current_store); | ||
240 | static CLASS_DEVICE_ATTR(rng_available, S_IRUGO, | ||
241 | hwrng_attr_available_show, | ||
242 | NULL); | ||
243 | |||
244 | |||
245 | static void unregister_miscdev(void) | ||
246 | { | ||
247 | class_device_remove_file(rng_miscdev.class, | ||
248 | &class_device_attr_rng_available); | ||
249 | class_device_remove_file(rng_miscdev.class, | ||
250 | &class_device_attr_rng_current); | ||
251 | misc_deregister(&rng_miscdev); | ||
252 | } | ||
253 | |||
254 | static int register_miscdev(void) | ||
255 | { | ||
256 | int err; | ||
257 | |||
258 | err = misc_register(&rng_miscdev); | ||
259 | if (err) | ||
260 | goto out; | ||
261 | err = class_device_create_file(rng_miscdev.class, | ||
262 | &class_device_attr_rng_current); | ||
263 | if (err) | ||
264 | goto err_misc_dereg; | ||
265 | err = class_device_create_file(rng_miscdev.class, | ||
266 | &class_device_attr_rng_available); | ||
267 | if (err) | ||
268 | goto err_remove_current; | ||
269 | out: | ||
270 | return err; | ||
271 | |||
272 | err_remove_current: | ||
273 | class_device_remove_file(rng_miscdev.class, | ||
274 | &class_device_attr_rng_current); | ||
275 | err_misc_dereg: | ||
276 | misc_deregister(&rng_miscdev); | ||
277 | goto out; | ||
278 | } | ||
279 | |||
280 | int hwrng_register(struct hwrng *rng) | ||
281 | { | ||
282 | int must_register_misc; | ||
283 | int err = -EINVAL; | ||
284 | struct hwrng *old_rng, *tmp; | ||
285 | |||
286 | if (rng->name == NULL || | ||
287 | rng->data_read == NULL) | ||
288 | goto out; | ||
289 | |||
290 | mutex_lock(&rng_mutex); | ||
291 | |||
292 | /* Must not register two RNGs with the same name. */ | ||
293 | err = -EEXIST; | ||
294 | list_for_each_entry(tmp, &rng_list, list) { | ||
295 | if (strcmp(tmp->name, rng->name) == 0) | ||
296 | goto out_unlock; | ||
297 | } | ||
298 | |||
299 | must_register_misc = (current_rng == NULL); | ||
300 | old_rng = current_rng; | ||
301 | if (!old_rng) { | ||
302 | err = hwrng_init(rng); | ||
303 | if (err) | ||
304 | goto out_unlock; | ||
305 | current_rng = rng; | ||
306 | } | ||
307 | err = 0; | ||
308 | if (must_register_misc) { | ||
309 | err = register_miscdev(); | ||
310 | if (err) { | ||
311 | if (!old_rng) { | ||
312 | hwrng_cleanup(rng); | ||
313 | current_rng = NULL; | ||
314 | } | ||
315 | goto out_unlock; | ||
316 | } | ||
317 | } | ||
318 | INIT_LIST_HEAD(&rng->list); | ||
319 | list_add_tail(&rng->list, &rng_list); | ||
320 | out_unlock: | ||
321 | mutex_unlock(&rng_mutex); | ||
322 | out: | ||
323 | return err; | ||
324 | } | ||
325 | EXPORT_SYMBOL_GPL(hwrng_register); | ||
326 | |||
327 | void hwrng_unregister(struct hwrng *rng) | ||
328 | { | ||
329 | int err; | ||
330 | |||
331 | mutex_lock(&rng_mutex); | ||
332 | |||
333 | list_del(&rng->list); | ||
334 | if (current_rng == rng) { | ||
335 | hwrng_cleanup(rng); | ||
336 | if (list_empty(&rng_list)) { | ||
337 | current_rng = NULL; | ||
338 | } else { | ||
339 | current_rng = list_entry(rng_list.prev, struct hwrng, list); | ||
340 | err = hwrng_init(current_rng); | ||
341 | if (err) | ||
342 | current_rng = NULL; | ||
343 | } | ||
344 | } | ||
345 | if (list_empty(&rng_list)) | ||
346 | unregister_miscdev(); | ||
347 | |||
348 | mutex_unlock(&rng_mutex); | ||
349 | } | ||
350 | EXPORT_SYMBOL_GPL(hwrng_unregister); | ||
351 | |||
352 | |||
353 | MODULE_DESCRIPTION("H/W Random Number Generator (RNG) driver"); | ||
354 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/char/hw_random/geode-rng.c b/drivers/char/hw_random/geode-rng.c new file mode 100644 index 000000000000..be61f22ee7bb --- /dev/null +++ b/drivers/char/hw_random/geode-rng.c | |||
@@ -0,0 +1,128 @@ | |||
1 | /* | ||
2 | * RNG driver for AMD Geode RNGs | ||
3 | * | ||
4 | * Copyright 2005 (c) MontaVista Software, Inc. | ||
5 | * | ||
6 | * with the majority of the code coming from: | ||
7 | * | ||
8 | * Hardware driver for the Intel/AMD/VIA Random Number Generators (RNG) | ||
9 | * (c) Copyright 2003 Red Hat Inc <jgarzik@redhat.com> | ||
10 | * | ||
11 | * derived from | ||
12 | * | ||
13 | * Hardware driver for the AMD 768 Random Number Generator (RNG) | ||
14 | * (c) Copyright 2001 Red Hat Inc <alan@redhat.com> | ||
15 | * | ||
16 | * derived from | ||
17 | * | ||
18 | * Hardware driver for Intel i810 Random Number Generator (RNG) | ||
19 | * Copyright 2000,2001 Jeff Garzik <jgarzik@pobox.com> | ||
20 | * Copyright 2000,2001 Philipp Rumpf <prumpf@mandrakesoft.com> | ||
21 | * | ||
22 | * This file is licensed under the terms of the GNU General Public | ||
23 | * License version 2. This program is licensed "as is" without any | ||
24 | * warranty of any kind, whether express or implied. | ||
25 | */ | ||
26 | |||
27 | #include <linux/module.h> | ||
28 | #include <linux/kernel.h> | ||
29 | #include <linux/pci.h> | ||
30 | #include <linux/hw_random.h> | ||
31 | #include <asm/io.h> | ||
32 | |||
33 | |||
34 | #define PFX KBUILD_MODNAME ": " | ||
35 | |||
36 | #define GEODE_RNG_DATA_REG 0x50 | ||
37 | #define GEODE_RNG_STATUS_REG 0x54 | ||
38 | |||
39 | /* | ||
40 | * Data for PCI driver interface | ||
41 | * | ||
42 | * This data only exists for exporting the supported | ||
43 | * PCI ids via MODULE_DEVICE_TABLE. We do not actually | ||
44 | * register a pci_driver, because someone else might one day | ||
45 | * want to register another driver on the same PCI id. | ||
46 | */ | ||
47 | static const struct pci_device_id pci_tbl[] = { | ||
48 | { PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_LX_AES, | ||
49 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, | ||
50 | { 0, }, /* terminate list */ | ||
51 | }; | ||
52 | MODULE_DEVICE_TABLE(pci, pci_tbl); | ||
53 | |||
54 | |||
55 | static int geode_rng_data_read(struct hwrng *rng, u32 *data) | ||
56 | { | ||
57 | void __iomem *mem = (void __iomem *)rng->priv; | ||
58 | |||
59 | *data = readl(mem + GEODE_RNG_DATA_REG); | ||
60 | |||
61 | return 4; | ||
62 | } | ||
63 | |||
64 | static int geode_rng_data_present(struct hwrng *rng) | ||
65 | { | ||
66 | void __iomem *mem = (void __iomem *)rng->priv; | ||
67 | |||
68 | return !!(readl(mem + GEODE_RNG_STATUS_REG)); | ||
69 | } | ||
70 | |||
71 | |||
72 | static struct hwrng geode_rng = { | ||
73 | .name = "geode", | ||
74 | .data_present = geode_rng_data_present, | ||
75 | .data_read = geode_rng_data_read, | ||
76 | }; | ||
77 | |||
78 | |||
79 | static int __init mod_init(void) | ||
80 | { | ||
81 | int err = -ENODEV; | ||
82 | struct pci_dev *pdev = NULL; | ||
83 | const struct pci_device_id *ent; | ||
84 | void __iomem *mem; | ||
85 | unsigned long rng_base; | ||
86 | |||
87 | for_each_pci_dev(pdev) { | ||
88 | ent = pci_match_id(pci_tbl, pdev); | ||
89 | if (ent) | ||
90 | goto found; | ||
91 | } | ||
92 | /* Device not found. */ | ||
93 | goto out; | ||
94 | |||
95 | found: | ||
96 | rng_base = pci_resource_start(pdev, 0); | ||
97 | if (rng_base == 0) | ||
98 | goto out; | ||
99 | err = -ENOMEM; | ||
100 | mem = ioremap(rng_base, 0x58); | ||
101 | if (!mem) | ||
102 | goto out; | ||
103 | geode_rng.priv = (unsigned long)mem; | ||
104 | |||
105 | printk(KERN_INFO "AMD Geode RNG detected\n"); | ||
106 | err = hwrng_register(&geode_rng); | ||
107 | if (err) { | ||
108 | printk(KERN_ERR PFX "RNG registering failed (%d)\n", | ||
109 | err); | ||
110 | goto out; | ||
111 | } | ||
112 | out: | ||
113 | return err; | ||
114 | } | ||
115 | |||
116 | static void __exit mod_exit(void) | ||
117 | { | ||
118 | void __iomem *mem = (void __iomem *)geode_rng.priv; | ||
119 | |||
120 | hwrng_unregister(&geode_rng); | ||
121 | iounmap(mem); | ||
122 | } | ||
123 | |||
124 | subsys_initcall(mod_init); | ||
125 | module_exit(mod_exit); | ||
126 | |||
127 | MODULE_DESCRIPTION("H/W RNG driver for AMD Geode LX CPUs"); | ||
128 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/char/hw_random/intel-rng.c b/drivers/char/hw_random/intel-rng.c new file mode 100644 index 000000000000..6594bd5645f4 --- /dev/null +++ b/drivers/char/hw_random/intel-rng.c | |||
@@ -0,0 +1,189 @@ | |||
1 | /* | ||
2 | * RNG driver for Intel RNGs | ||
3 | * | ||
4 | * Copyright 2005 (c) MontaVista Software, Inc. | ||
5 | * | ||
6 | * with the majority of the code coming from: | ||
7 | * | ||
8 | * Hardware driver for the Intel/AMD/VIA Random Number Generators (RNG) | ||
9 | * (c) Copyright 2003 Red Hat Inc <jgarzik@redhat.com> | ||
10 | * | ||
11 | * derived from | ||
12 | * | ||
13 | * Hardware driver for the AMD 768 Random Number Generator (RNG) | ||
14 | * (c) Copyright 2001 Red Hat Inc <alan@redhat.com> | ||
15 | * | ||
16 | * derived from | ||
17 | * | ||
18 | * Hardware driver for Intel i810 Random Number Generator (RNG) | ||
19 | * Copyright 2000,2001 Jeff Garzik <jgarzik@pobox.com> | ||
20 | * Copyright 2000,2001 Philipp Rumpf <prumpf@mandrakesoft.com> | ||
21 | * | ||
22 | * This file is licensed under the terms of the GNU General Public | ||
23 | * License version 2. This program is licensed "as is" without any | ||
24 | * warranty of any kind, whether express or implied. | ||
25 | */ | ||
26 | |||
27 | #include <linux/module.h> | ||
28 | #include <linux/kernel.h> | ||
29 | #include <linux/pci.h> | ||
30 | #include <linux/hw_random.h> | ||
31 | #include <asm/io.h> | ||
32 | |||
33 | |||
34 | #define PFX KBUILD_MODNAME ": " | ||
35 | |||
36 | /* | ||
37 | * RNG registers | ||
38 | */ | ||
39 | #define INTEL_RNG_HW_STATUS 0 | ||
40 | #define INTEL_RNG_PRESENT 0x40 | ||
41 | #define INTEL_RNG_ENABLED 0x01 | ||
42 | #define INTEL_RNG_STATUS 1 | ||
43 | #define INTEL_RNG_DATA_PRESENT 0x01 | ||
44 | #define INTEL_RNG_DATA 2 | ||
45 | |||
46 | /* | ||
47 | * Magic address at which Intel PCI bridges locate the RNG | ||
48 | */ | ||
49 | #define INTEL_RNG_ADDR 0xFFBC015F | ||
50 | #define INTEL_RNG_ADDR_LEN 3 | ||
51 | |||
52 | /* | ||
53 | * Data for PCI driver interface | ||
54 | * | ||
55 | * This data only exists for exporting the supported | ||
56 | * PCI ids via MODULE_DEVICE_TABLE. We do not actually | ||
57 | * register a pci_driver, because someone else might one day | ||
58 | * want to register another driver on the same PCI id. | ||
59 | */ | ||
60 | static const struct pci_device_id pci_tbl[] = { | ||
61 | { 0x8086, 0x2418, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, | ||
62 | { 0x8086, 0x2428, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, | ||
63 | { 0x8086, 0x2430, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, | ||
64 | { 0x8086, 0x2448, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, | ||
65 | { 0x8086, 0x244e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, | ||
66 | { 0x8086, 0x245e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, | ||
67 | { 0, }, /* terminate list */ | ||
68 | }; | ||
69 | MODULE_DEVICE_TABLE(pci, pci_tbl); | ||
70 | |||
71 | |||
72 | static inline u8 hwstatus_get(void __iomem *mem) | ||
73 | { | ||
74 | return readb(mem + INTEL_RNG_HW_STATUS); | ||
75 | } | ||
76 | |||
77 | static inline u8 hwstatus_set(void __iomem *mem, | ||
78 | u8 hw_status) | ||
79 | { | ||
80 | writeb(hw_status, mem + INTEL_RNG_HW_STATUS); | ||
81 | return hwstatus_get(mem); | ||
82 | } | ||
83 | |||
84 | static int intel_rng_data_present(struct hwrng *rng) | ||
85 | { | ||
86 | void __iomem *mem = (void __iomem *)rng->priv; | ||
87 | |||
88 | return !!(readb(mem + INTEL_RNG_STATUS) & INTEL_RNG_DATA_PRESENT); | ||
89 | } | ||
90 | |||
91 | static int intel_rng_data_read(struct hwrng *rng, u32 *data) | ||
92 | { | ||
93 | void __iomem *mem = (void __iomem *)rng->priv; | ||
94 | |||
95 | *data = readb(mem + INTEL_RNG_DATA); | ||
96 | |||
97 | return 1; | ||
98 | } | ||
99 | |||
100 | static int intel_rng_init(struct hwrng *rng) | ||
101 | { | ||
102 | void __iomem *mem = (void __iomem *)rng->priv; | ||
103 | u8 hw_status; | ||
104 | int err = -EIO; | ||
105 | |||
106 | hw_status = hwstatus_get(mem); | ||
107 | /* turn RNG h/w on, if it's off */ | ||
108 | if ((hw_status & INTEL_RNG_ENABLED) == 0) | ||
109 | hw_status = hwstatus_set(mem, hw_status | INTEL_RNG_ENABLED); | ||
110 | if ((hw_status & INTEL_RNG_ENABLED) == 0) { | ||
111 | printk(KERN_ERR PFX "cannot enable RNG, aborting\n"); | ||
112 | goto out; | ||
113 | } | ||
114 | err = 0; | ||
115 | out: | ||
116 | return err; | ||
117 | } | ||
118 | |||
119 | static void intel_rng_cleanup(struct hwrng *rng) | ||
120 | { | ||
121 | void __iomem *mem = (void __iomem *)rng->priv; | ||
122 | u8 hw_status; | ||
123 | |||
124 | hw_status = hwstatus_get(mem); | ||
125 | if (hw_status & INTEL_RNG_ENABLED) | ||
126 | hwstatus_set(mem, hw_status & ~INTEL_RNG_ENABLED); | ||
127 | else | ||
128 | printk(KERN_WARNING PFX "unusual: RNG already disabled\n"); | ||
129 | } | ||
130 | |||
131 | |||
132 | static struct hwrng intel_rng = { | ||
133 | .name = "intel", | ||
134 | .init = intel_rng_init, | ||
135 | .cleanup = intel_rng_cleanup, | ||
136 | .data_present = intel_rng_data_present, | ||
137 | .data_read = intel_rng_data_read, | ||
138 | }; | ||
139 | |||
140 | |||
141 | static int __init mod_init(void) | ||
142 | { | ||
143 | int err = -ENODEV; | ||
144 | void __iomem *mem; | ||
145 | u8 hw_status; | ||
146 | |||
147 | if (!pci_dev_present(pci_tbl)) | ||
148 | goto out; /* Device not found. */ | ||
149 | |||
150 | err = -ENOMEM; | ||
151 | mem = ioremap(INTEL_RNG_ADDR, INTEL_RNG_ADDR_LEN); | ||
152 | if (!mem) | ||
153 | goto out; | ||
154 | intel_rng.priv = (unsigned long)mem; | ||
155 | |||
156 | /* Check for Intel 82802 */ | ||
157 | err = -ENODEV; | ||
158 | hw_status = hwstatus_get(mem); | ||
159 | if ((hw_status & INTEL_RNG_PRESENT) == 0) | ||
160 | goto err_unmap; | ||
161 | |||
162 | printk(KERN_INFO "Intel 82802 RNG detected\n"); | ||
163 | err = hwrng_register(&intel_rng); | ||
164 | if (err) { | ||
165 | printk(KERN_ERR PFX "RNG registering failed (%d)\n", | ||
166 | err); | ||
167 | goto out; | ||
168 | } | ||
169 | out: | ||
170 | return err; | ||
171 | |||
172 | err_unmap: | ||
173 | iounmap(mem); | ||
174 | goto out; | ||
175 | } | ||
176 | |||
177 | static void __exit mod_exit(void) | ||
178 | { | ||
179 | void __iomem *mem = (void __iomem *)intel_rng.priv; | ||
180 | |||
181 | hwrng_unregister(&intel_rng); | ||
182 | iounmap(mem); | ||
183 | } | ||
184 | |||
185 | subsys_initcall(mod_init); | ||
186 | module_exit(mod_exit); | ||
187 | |||
188 | MODULE_DESCRIPTION("H/W RNG driver for Intel chipsets"); | ||
189 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/char/hw_random/ixp4xx-rng.c b/drivers/char/hw_random/ixp4xx-rng.c new file mode 100644 index 000000000000..ef71022423c9 --- /dev/null +++ b/drivers/char/hw_random/ixp4xx-rng.c | |||
@@ -0,0 +1,73 @@ | |||
1 | /* | ||
2 | * drivers/char/rng/ixp4xx-rng.c | ||
3 | * | ||
4 | * RNG driver for Intel IXP4xx family of NPUs | ||
5 | * | ||
6 | * Author: Deepak Saxena <dsaxena@plexity.net> | ||
7 | * | ||
8 | * Copyright 2005 (c) MontaVista Software, Inc. | ||
9 | * | ||
10 | * Fixes by Michael Buesch | ||
11 | * | ||
12 | * This file is licensed under the terms of the GNU General Public | ||
13 | * License version 2. This program is licensed "as is" without any | ||
14 | * warranty of any kind, whether express or implied. | ||
15 | */ | ||
16 | |||
17 | #include <linux/kernel.h> | ||
18 | #include <linux/config.h> | ||
19 | #include <linux/types.h> | ||
20 | #include <linux/module.h> | ||
21 | #include <linux/moduleparam.h> | ||
22 | #include <linux/init.h> | ||
23 | #include <linux/bitops.h> | ||
24 | #include <linux/hw_random.h> | ||
25 | |||
26 | #include <asm/io.h> | ||
27 | #include <asm/hardware.h> | ||
28 | |||
29 | |||
30 | static int ixp4xx_rng_data_read(struct hwrng *rng, u32 *buffer) | ||
31 | { | ||
32 | void __iomem * rng_base = (void __iomem *)rng->priv; | ||
33 | |||
34 | *buffer = __raw_readl(rng_base); | ||
35 | |||
36 | return 4; | ||
37 | } | ||
38 | |||
39 | static struct hwrng ixp4xx_rng_ops = { | ||
40 | .name = "ixp4xx", | ||
41 | .data_read = ixp4xx_rng_data_read, | ||
42 | }; | ||
43 | |||
44 | static int __init ixp4xx_rng_init(void) | ||
45 | { | ||
46 | void __iomem * rng_base; | ||
47 | int err; | ||
48 | |||
49 | rng_base = ioremap(0x70002100, 4); | ||
50 | if (!rng_base) | ||
51 | return -ENOMEM; | ||
52 | ixp4xx_rng_ops.priv = (unsigned long)rng_base; | ||
53 | err = hwrng_register(&ixp4xx_rng_ops); | ||
54 | if (err) | ||
55 | iounmap(rng_base); | ||
56 | |||
57 | return err; | ||
58 | } | ||
59 | |||
60 | static void __exit ixp4xx_rng_exit(void) | ||
61 | { | ||
62 | void __iomem * rng_base = (void __iomem *)ixp4xx_rng_ops.priv; | ||
63 | |||
64 | hwrng_unregister(&ixp4xx_rng_ops); | ||
65 | iounmap(rng_base); | ||
66 | } | ||
67 | |||
68 | subsys_initcall(ixp4xx_rng_init); | ||
69 | module_exit(ixp4xx_rng_exit); | ||
70 | |||
71 | MODULE_AUTHOR("Deepak Saxena <dsaxena@plexity.net>"); | ||
72 | MODULE_DESCRIPTION("H/W Random Number Generator (RNG) driver for IXP4xx"); | ||
73 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/char/hw_random/omap-rng.c b/drivers/char/hw_random/omap-rng.c new file mode 100644 index 000000000000..819516b35a79 --- /dev/null +++ b/drivers/char/hw_random/omap-rng.c | |||
@@ -0,0 +1,208 @@ | |||
1 | /* | ||
2 | * driver/char/hw_random/omap-rng.c | ||
3 | * | ||
4 | * RNG driver for TI OMAP CPU family | ||
5 | * | ||
6 | * Author: Deepak Saxena <dsaxena@plexity.net> | ||
7 | * | ||
8 | * Copyright 2005 (c) MontaVista Software, Inc. | ||
9 | * | ||
10 | * Mostly based on original driver: | ||
11 | * | ||
12 | * Copyright (C) 2005 Nokia Corporation | ||
13 | * Author: Juha Yrj��<juha.yrjola@nokia.com> | ||
14 | * | ||
15 | * This file is licensed under the terms of the GNU General Public | ||
16 | * License version 2. This program is licensed "as is" without any | ||
17 | * warranty of any kind, whether express or implied. | ||
18 | * | ||
19 | * TODO: | ||
20 | * | ||
21 | * - Make status updated be interrupt driven so we don't poll | ||
22 | * | ||
23 | */ | ||
24 | |||
25 | #include <linux/module.h> | ||
26 | #include <linux/init.h> | ||
27 | #include <linux/random.h> | ||
28 | #include <linux/err.h> | ||
29 | #include <linux/device.h> | ||
30 | #include <linux/hw_random.h> | ||
31 | |||
32 | #include <asm/io.h> | ||
33 | #include <asm/hardware/clock.h> | ||
34 | |||
35 | #define RNG_OUT_REG 0x00 /* Output register */ | ||
36 | #define RNG_STAT_REG 0x04 /* Status register | ||
37 | [0] = STAT_BUSY */ | ||
38 | #define RNG_ALARM_REG 0x24 /* Alarm register | ||
39 | [7:0] = ALARM_COUNTER */ | ||
40 | #define RNG_CONFIG_REG 0x28 /* Configuration register | ||
41 | [11:6] = RESET_COUNT | ||
42 | [5:3] = RING2_DELAY | ||
43 | [2:0] = RING1_DELAY */ | ||
44 | #define RNG_REV_REG 0x3c /* Revision register | ||
45 | [7:0] = REV_NB */ | ||
46 | #define RNG_MASK_REG 0x40 /* Mask and reset register | ||
47 | [2] = IT_EN | ||
48 | [1] = SOFTRESET | ||
49 | [0] = AUTOIDLE */ | ||
50 | #define RNG_SYSSTATUS 0x44 /* System status | ||
51 | [0] = RESETDONE */ | ||
52 | |||
53 | static void __iomem *rng_base; | ||
54 | static struct clk *rng_ick; | ||
55 | static struct device *rng_dev; | ||
56 | |||
57 | static u32 omap_rng_read_reg(int reg) | ||
58 | { | ||
59 | return __raw_readl(rng_base + reg); | ||
60 | } | ||
61 | |||
62 | static void omap_rng_write_reg(int reg, u32 val) | ||
63 | { | ||
64 | __raw_writel(val, rng_base + reg); | ||
65 | } | ||
66 | |||
67 | /* REVISIT: Does the status bit really work on 16xx? */ | ||
68 | static int omap_rng_data_present(struct hwrng *rng) | ||
69 | { | ||
70 | return omap_rng_read_reg(RNG_STAT_REG) ? 0 : 1; | ||
71 | } | ||
72 | |||
73 | static int omap_rng_data_read(struct hwrng *rng, u32 *data) | ||
74 | { | ||
75 | *data = omap_rng_read_reg(RNG_OUT_REG); | ||
76 | |||
77 | return 4; | ||
78 | } | ||
79 | |||
80 | static struct hwrng omap_rng_ops = { | ||
81 | .name = "omap", | ||
82 | .data_present = omap_rng_data_present, | ||
83 | .data_read = omap_rng_data_read, | ||
84 | }; | ||
85 | |||
86 | static int __init omap_rng_probe(struct device *dev) | ||
87 | { | ||
88 | struct platform_device *pdev = to_platform_device(dev); | ||
89 | struct resource *res, *mem; | ||
90 | int ret; | ||
91 | |||
92 | /* | ||
93 | * A bit ugly, and it will never actually happen but there can | ||
94 | * be only one RNG and this catches any bork | ||
95 | */ | ||
96 | BUG_ON(rng_dev); | ||
97 | |||
98 | if (cpu_is_omap24xx()) { | ||
99 | rng_ick = clk_get(NULL, "rng_ick"); | ||
100 | if (IS_ERR(rng_ick)) { | ||
101 | dev_err(dev, "Could not get rng_ick\n"); | ||
102 | ret = PTR_ERR(rng_ick); | ||
103 | return ret; | ||
104 | } | ||
105 | else { | ||
106 | clk_use(rng_ick); | ||
107 | } | ||
108 | } | ||
109 | |||
110 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
111 | |||
112 | if (!res) | ||
113 | return -ENOENT; | ||
114 | |||
115 | mem = request_mem_region(res->start, res->end - res->start + 1, | ||
116 | pdev->name); | ||
117 | if (mem == NULL) | ||
118 | return -EBUSY; | ||
119 | |||
120 | dev_set_drvdata(dev, mem); | ||
121 | rng_base = (u32 __iomem *)io_p2v(res->start); | ||
122 | |||
123 | ret = hwrng_register(&omap_rng_ops); | ||
124 | if (ret) { | ||
125 | release_resource(mem); | ||
126 | rng_base = NULL; | ||
127 | return ret; | ||
128 | } | ||
129 | |||
130 | dev_info(dev, "OMAP Random Number Generator ver. %02x\n", | ||
131 | omap_rng_read_reg(RNG_REV_REG)); | ||
132 | omap_rng_write_reg(RNG_MASK_REG, 0x1); | ||
133 | |||
134 | rng_dev = dev; | ||
135 | |||
136 | return 0; | ||
137 | } | ||
138 | |||
139 | static int __exit omap_rng_remove(struct device *dev) | ||
140 | { | ||
141 | struct resource *mem = dev_get_drvdata(dev); | ||
142 | |||
143 | hwrng_unregister(&omap_rng_ops); | ||
144 | |||
145 | omap_rng_write_reg(RNG_MASK_REG, 0x0); | ||
146 | |||
147 | if (cpu_is_omap24xx()) { | ||
148 | clk_unuse(rng_ick); | ||
149 | clk_put(rng_ick); | ||
150 | } | ||
151 | |||
152 | release_resource(mem); | ||
153 | rng_base = NULL; | ||
154 | |||
155 | return 0; | ||
156 | } | ||
157 | |||
158 | #ifdef CONFIG_PM | ||
159 | |||
160 | static int omap_rng_suspend(struct device *dev, pm_message_t message, u32 level) | ||
161 | { | ||
162 | omap_rng_write_reg(RNG_MASK_REG, 0x0); | ||
163 | |||
164 | return 0; | ||
165 | } | ||
166 | |||
167 | static int omap_rng_resume(struct device *dev, pm_message_t message, u32 level) | ||
168 | { | ||
169 | omap_rng_write_reg(RNG_MASK_REG, 0x1); | ||
170 | |||
171 | return 1; | ||
172 | } | ||
173 | |||
174 | #else | ||
175 | |||
176 | #define omap_rng_suspend NULL | ||
177 | #define omap_rng_resume NULL | ||
178 | |||
179 | #endif | ||
180 | |||
181 | |||
182 | static struct device_driver omap_rng_driver = { | ||
183 | .name = "omap_rng", | ||
184 | .bus = &platform_bus_type, | ||
185 | .probe = omap_rng_probe, | ||
186 | .remove = __exit_p(omap_rng_remove), | ||
187 | .suspend = omap_rng_suspend, | ||
188 | .resume = omap_rng_resume | ||
189 | }; | ||
190 | |||
191 | static int __init omap_rng_init(void) | ||
192 | { | ||
193 | if (!cpu_is_omap16xx() && !cpu_is_omap24xx()) | ||
194 | return -ENODEV; | ||
195 | |||
196 | return driver_register(&omap_rng_driver); | ||
197 | } | ||
198 | |||
199 | static void __exit omap_rng_exit(void) | ||
200 | { | ||
201 | driver_unregister(&omap_rng_driver); | ||
202 | } | ||
203 | |||
204 | module_init(omap_rng_init); | ||
205 | module_exit(omap_rng_exit); | ||
206 | |||
207 | MODULE_AUTHOR("Deepak Saxena (and others)"); | ||
208 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/char/hw_random/via-rng.c b/drivers/char/hw_random/via-rng.c new file mode 100644 index 000000000000..0e786b617bb8 --- /dev/null +++ b/drivers/char/hw_random/via-rng.c | |||
@@ -0,0 +1,183 @@ | |||
1 | /* | ||
2 | * RNG driver for VIA RNGs | ||
3 | * | ||
4 | * Copyright 2005 (c) MontaVista Software, Inc. | ||
5 | * | ||
6 | * with the majority of the code coming from: | ||
7 | * | ||
8 | * Hardware driver for the Intel/AMD/VIA Random Number Generators (RNG) | ||
9 | * (c) Copyright 2003 Red Hat Inc <jgarzik@redhat.com> | ||
10 | * | ||
11 | * derived from | ||
12 | * | ||
13 | * Hardware driver for the AMD 768 Random Number Generator (RNG) | ||
14 | * (c) Copyright 2001 Red Hat Inc <alan@redhat.com> | ||
15 | * | ||
16 | * derived from | ||
17 | * | ||
18 | * Hardware driver for Intel i810 Random Number Generator (RNG) | ||
19 | * Copyright 2000,2001 Jeff Garzik <jgarzik@pobox.com> | ||
20 | * Copyright 2000,2001 Philipp Rumpf <prumpf@mandrakesoft.com> | ||
21 | * | ||
22 | * This file is licensed under the terms of the GNU General Public | ||
23 | * License version 2. This program is licensed "as is" without any | ||
24 | * warranty of any kind, whether express or implied. | ||
25 | */ | ||
26 | |||
27 | #include <linux/module.h> | ||
28 | #include <linux/kernel.h> | ||
29 | #include <linux/pci.h> | ||
30 | #include <linux/hw_random.h> | ||
31 | #include <asm/io.h> | ||
32 | #include <asm/msr.h> | ||
33 | #include <asm/cpufeature.h> | ||
34 | |||
35 | |||
36 | #define PFX KBUILD_MODNAME ": " | ||
37 | |||
38 | |||
39 | enum { | ||
40 | VIA_STRFILT_CNT_SHIFT = 16, | ||
41 | VIA_STRFILT_FAIL = (1 << 15), | ||
42 | VIA_STRFILT_ENABLE = (1 << 14), | ||
43 | VIA_RAWBITS_ENABLE = (1 << 13), | ||
44 | VIA_RNG_ENABLE = (1 << 6), | ||
45 | VIA_XSTORE_CNT_MASK = 0x0F, | ||
46 | |||
47 | VIA_RNG_CHUNK_8 = 0x00, /* 64 rand bits, 64 stored bits */ | ||
48 | VIA_RNG_CHUNK_4 = 0x01, /* 32 rand bits, 32 stored bits */ | ||
49 | VIA_RNG_CHUNK_4_MASK = 0xFFFFFFFF, | ||
50 | VIA_RNG_CHUNK_2 = 0x02, /* 16 rand bits, 32 stored bits */ | ||
51 | VIA_RNG_CHUNK_2_MASK = 0xFFFF, | ||
52 | VIA_RNG_CHUNK_1 = 0x03, /* 8 rand bits, 32 stored bits */ | ||
53 | VIA_RNG_CHUNK_1_MASK = 0xFF, | ||
54 | }; | ||
55 | |||
56 | /* | ||
57 | * Investigate using the 'rep' prefix to obtain 32 bits of random data | ||
58 | * in one insn. The upside is potentially better performance. The | ||
59 | * downside is that the instruction becomes no longer atomic. Due to | ||
60 | * this, just like familiar issues with /dev/random itself, the worst | ||
61 | * case of a 'rep xstore' could potentially pause a cpu for an | ||
62 | * unreasonably long time. In practice, this condition would likely | ||
63 | * only occur when the hardware is failing. (or so we hope :)) | ||
64 | * | ||
65 | * Another possible performance boost may come from simply buffering | ||
66 | * until we have 4 bytes, thus returning a u32 at a time, | ||
67 | * instead of the current u8-at-a-time. | ||
68 | */ | ||
69 | |||
70 | static inline u32 xstore(u32 *addr, u32 edx_in) | ||
71 | { | ||
72 | u32 eax_out; | ||
73 | |||
74 | asm(".byte 0x0F,0xA7,0xC0 /* xstore %%edi (addr=%0) */" | ||
75 | :"=m"(*addr), "=a"(eax_out) | ||
76 | :"D"(addr), "d"(edx_in)); | ||
77 | |||
78 | return eax_out; | ||
79 | } | ||
80 | |||
81 | static int via_rng_data_present(struct hwrng *rng) | ||
82 | { | ||
83 | u32 bytes_out; | ||
84 | u32 *via_rng_datum = (u32 *)(&rng->priv); | ||
85 | |||
86 | /* We choose the recommended 1-byte-per-instruction RNG rate, | ||
87 | * for greater randomness at the expense of speed. Larger | ||
88 | * values 2, 4, or 8 bytes-per-instruction yield greater | ||
89 | * speed at lesser randomness. | ||
90 | * | ||
91 | * If you change this to another VIA_CHUNK_n, you must also | ||
92 | * change the ->n_bytes values in rng_vendor_ops[] tables. | ||
93 | * VIA_CHUNK_8 requires further code changes. | ||
94 | * | ||
95 | * A copy of MSR_VIA_RNG is placed in eax_out when xstore | ||
96 | * completes. | ||
97 | */ | ||
98 | |||
99 | *via_rng_datum = 0; /* paranoia, not really necessary */ | ||
100 | bytes_out = xstore(via_rng_datum, VIA_RNG_CHUNK_1); | ||
101 | bytes_out &= VIA_XSTORE_CNT_MASK; | ||
102 | if (bytes_out == 0) | ||
103 | return 0; | ||
104 | return 1; | ||
105 | } | ||
106 | |||
107 | static int via_rng_data_read(struct hwrng *rng, u32 *data) | ||
108 | { | ||
109 | u32 via_rng_datum = (u32)rng->priv; | ||
110 | |||
111 | *data = via_rng_datum; | ||
112 | |||
113 | return 1; | ||
114 | } | ||
115 | |||
116 | static int via_rng_init(struct hwrng *rng) | ||
117 | { | ||
118 | u32 lo, hi, old_lo; | ||
119 | |||
120 | /* Control the RNG via MSR. Tread lightly and pay very close | ||
121 | * close attention to values written, as the reserved fields | ||
122 | * are documented to be "undefined and unpredictable"; but it | ||
123 | * does not say to write them as zero, so I make a guess that | ||
124 | * we restore the values we find in the register. | ||
125 | */ | ||
126 | rdmsr(MSR_VIA_RNG, lo, hi); | ||
127 | |||
128 | old_lo = lo; | ||
129 | lo &= ~(0x7f << VIA_STRFILT_CNT_SHIFT); | ||
130 | lo &= ~VIA_XSTORE_CNT_MASK; | ||
131 | lo &= ~(VIA_STRFILT_ENABLE | VIA_STRFILT_FAIL | VIA_RAWBITS_ENABLE); | ||
132 | lo |= VIA_RNG_ENABLE; | ||
133 | |||
134 | if (lo != old_lo) | ||
135 | wrmsr(MSR_VIA_RNG, lo, hi); | ||
136 | |||
137 | /* perhaps-unnecessary sanity check; remove after testing if | ||
138 | unneeded */ | ||
139 | rdmsr(MSR_VIA_RNG, lo, hi); | ||
140 | if ((lo & VIA_RNG_ENABLE) == 0) { | ||
141 | printk(KERN_ERR PFX "cannot enable VIA C3 RNG, aborting\n"); | ||
142 | return -ENODEV; | ||
143 | } | ||
144 | |||
145 | return 0; | ||
146 | } | ||
147 | |||
148 | |||
149 | static struct hwrng via_rng = { | ||
150 | .name = "via", | ||
151 | .init = via_rng_init, | ||
152 | .data_present = via_rng_data_present, | ||
153 | .data_read = via_rng_data_read, | ||
154 | }; | ||
155 | |||
156 | |||
157 | static int __init mod_init(void) | ||
158 | { | ||
159 | int err; | ||
160 | |||
161 | if (!cpu_has_xstore) | ||
162 | return -ENODEV; | ||
163 | printk(KERN_INFO "VIA RNG detected\n"); | ||
164 | err = hwrng_register(&via_rng); | ||
165 | if (err) { | ||
166 | printk(KERN_ERR PFX "RNG registering failed (%d)\n", | ||
167 | err); | ||
168 | goto out; | ||
169 | } | ||
170 | out: | ||
171 | return err; | ||
172 | } | ||
173 | |||
174 | static void __exit mod_exit(void) | ||
175 | { | ||
176 | hwrng_unregister(&via_rng); | ||
177 | } | ||
178 | |||
179 | subsys_initcall(mod_init); | ||
180 | module_exit(mod_exit); | ||
181 | |||
182 | MODULE_DESCRIPTION("H/W RNG driver for VIA chipsets"); | ||
183 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/char/i8k.c b/drivers/char/i8k.c index f3c3aaf4560e..353d9f3cf8d7 100644 --- a/drivers/char/i8k.c +++ b/drivers/char/i8k.c | |||
@@ -80,7 +80,7 @@ static int i8k_open_fs(struct inode *inode, struct file *file); | |||
80 | static int i8k_ioctl(struct inode *, struct file *, unsigned int, | 80 | static int i8k_ioctl(struct inode *, struct file *, unsigned int, |
81 | unsigned long); | 81 | unsigned long); |
82 | 82 | ||
83 | static struct file_operations i8k_fops = { | 83 | static const struct file_operations i8k_fops = { |
84 | .open = i8k_open_fs, | 84 | .open = i8k_open_fs, |
85 | .read = seq_read, | 85 | .read = seq_read, |
86 | .llseek = seq_lseek, | 86 | .llseek = seq_lseek, |
diff --git a/drivers/char/ip2/i2ellis.h b/drivers/char/ip2/i2ellis.h index 510b026d7d26..5eabe47b0bc8 100644 --- a/drivers/char/ip2/i2ellis.h +++ b/drivers/char/ip2/i2ellis.h | |||
@@ -47,7 +47,6 @@ | |||
47 | //---------------------- | 47 | //---------------------- |
48 | // Mandatory Includes: | 48 | // Mandatory Includes: |
49 | //---------------------- | 49 | //---------------------- |
50 | #include <linux/config.h> | ||
51 | #include "ip2types.h" | 50 | #include "ip2types.h" |
52 | #include "i2hw.h" // The hardware definitions | 51 | #include "i2hw.h" // The hardware definitions |
53 | 52 | ||
diff --git a/drivers/char/ip2/ip2main.c b/drivers/char/ip2/ip2main.c index 03db1cb3fa95..518ece7ac656 100644 --- a/drivers/char/ip2/ip2main.c +++ b/drivers/char/ip2/ip2main.c | |||
@@ -82,7 +82,6 @@ | |||
82 | /************/ | 82 | /************/ |
83 | /* Includes */ | 83 | /* Includes */ |
84 | /************/ | 84 | /************/ |
85 | #include <linux/config.h> | ||
86 | 85 | ||
87 | #include <linux/ctype.h> | 86 | #include <linux/ctype.h> |
88 | #include <linux/string.h> | 87 | #include <linux/string.h> |
@@ -91,7 +90,6 @@ | |||
91 | #include <linux/module.h> | 90 | #include <linux/module.h> |
92 | #include <linux/signal.h> | 91 | #include <linux/signal.h> |
93 | #include <linux/sched.h> | 92 | #include <linux/sched.h> |
94 | #include <linux/devfs_fs_kernel.h> | ||
95 | #include <linux/timer.h> | 93 | #include <linux/timer.h> |
96 | #include <linux/interrupt.h> | 94 | #include <linux/interrupt.h> |
97 | #include <linux/pci.h> | 95 | #include <linux/pci.h> |
@@ -235,7 +233,7 @@ static void *DevTableMem[IP2_MAX_BOARDS]; | |||
235 | /* This is the driver descriptor for the ip2ipl device, which is used to | 233 | /* This is the driver descriptor for the ip2ipl device, which is used to |
236 | * download the loadware to the boards. | 234 | * download the loadware to the boards. |
237 | */ | 235 | */ |
238 | static struct file_operations ip2_ipl = { | 236 | static const struct file_operations ip2_ipl = { |
239 | .owner = THIS_MODULE, | 237 | .owner = THIS_MODULE, |
240 | .read = ip2_ipl_read, | 238 | .read = ip2_ipl_read, |
241 | .write = ip2_ipl_write, | 239 | .write = ip2_ipl_write, |
@@ -305,7 +303,7 @@ static struct class *ip2_class; | |||
305 | 303 | ||
306 | // Some functions to keep track of what irq's we have | 304 | // Some functions to keep track of what irq's we have |
307 | 305 | ||
308 | static int __init | 306 | static int |
309 | is_valid_irq(int irq) | 307 | is_valid_irq(int irq) |
310 | { | 308 | { |
311 | int *i = Valid_Irqs; | 309 | int *i = Valid_Irqs; |
@@ -316,14 +314,14 @@ is_valid_irq(int irq) | |||
316 | return (*i); | 314 | return (*i); |
317 | } | 315 | } |
318 | 316 | ||
319 | static void __init | 317 | static void |
320 | mark_requested_irq( char irq ) | 318 | mark_requested_irq( char irq ) |
321 | { | 319 | { |
322 | rirqs[iindx++] = irq; | 320 | rirqs[iindx++] = irq; |
323 | } | 321 | } |
324 | 322 | ||
325 | #ifdef MODULE | 323 | #ifdef MODULE |
326 | static int __init | 324 | static int |
327 | clear_requested_irq( char irq ) | 325 | clear_requested_irq( char irq ) |
328 | { | 326 | { |
329 | int i; | 327 | int i; |
@@ -337,7 +335,7 @@ clear_requested_irq( char irq ) | |||
337 | } | 335 | } |
338 | #endif | 336 | #endif |
339 | 337 | ||
340 | static int __init | 338 | static int |
341 | have_requested_irq( char irq ) | 339 | have_requested_irq( char irq ) |
342 | { | 340 | { |
343 | // array init to zeros so 0 irq will not be requested as a side effect | 341 | // array init to zeros so 0 irq will not be requested as a side effect |
@@ -414,9 +412,7 @@ cleanup_module(void) | |||
414 | /* free io addresses and Tibet */ | 412 | /* free io addresses and Tibet */ |
415 | release_region( ip2config.addr[i], 8 ); | 413 | release_region( ip2config.addr[i], 8 ); |
416 | class_device_destroy(ip2_class, MKDEV(IP2_IPL_MAJOR, 4 * i)); | 414 | class_device_destroy(ip2_class, MKDEV(IP2_IPL_MAJOR, 4 * i)); |
417 | devfs_remove("ip2/ipl%d", i); | ||
418 | class_device_destroy(ip2_class, MKDEV(IP2_IPL_MAJOR, 4 * i + 1)); | 415 | class_device_destroy(ip2_class, MKDEV(IP2_IPL_MAJOR, 4 * i + 1)); |
419 | devfs_remove("ip2/stat%d", i); | ||
420 | } | 416 | } |
421 | /* Disable and remove interrupt handler. */ | 417 | /* Disable and remove interrupt handler. */ |
422 | if ( (ip2config.irq[i] > 0) && have_requested_irq(ip2config.irq[i]) ) { | 418 | if ( (ip2config.irq[i] > 0) && have_requested_irq(ip2config.irq[i]) ) { |
@@ -425,7 +421,6 @@ cleanup_module(void) | |||
425 | } | 421 | } |
426 | } | 422 | } |
427 | class_destroy(ip2_class); | 423 | class_destroy(ip2_class); |
428 | devfs_remove("ip2"); | ||
429 | if ( ( err = tty_unregister_driver ( ip2_tty_driver ) ) ) { | 424 | if ( ( err = tty_unregister_driver ( ip2_tty_driver ) ) ) { |
430 | printk(KERN_ERR "IP2: failed to unregister tty driver (%d)\n", err); | 425 | printk(KERN_ERR "IP2: failed to unregister tty driver (%d)\n", err); |
431 | } | 426 | } |
@@ -496,8 +491,8 @@ static struct tty_operations ip2_ops = { | |||
496 | /* initialisation of the devices and driver structures, and registers itself */ | 491 | /* initialisation of the devices and driver structures, and registers itself */ |
497 | /* with the relevant kernel modules. */ | 492 | /* with the relevant kernel modules. */ |
498 | /******************************************************************************/ | 493 | /******************************************************************************/ |
499 | /* SA_INTERRUPT- if set blocks all interrupts else only this line */ | 494 | /* IRQF_DISABLED - if set blocks all interrupts else only this line */ |
500 | /* SA_SHIRQ - for shared irq PCI or maybe EISA only */ | 495 | /* IRQF_SHARED - for shared irq PCI or maybe EISA only */ |
501 | /* SA_RANDOM - can be source for cert. random number generators */ | 496 | /* SA_RANDOM - can be source for cert. random number generators */ |
502 | #define IP2_SA_FLAGS 0 | 497 | #define IP2_SA_FLAGS 0 |
503 | 498 | ||
@@ -675,7 +670,6 @@ ip2_loadmain(int *iop, int *irqp, unsigned char *firmware, int firmsize) | |||
675 | 670 | ||
676 | ip2_tty_driver->owner = THIS_MODULE; | 671 | ip2_tty_driver->owner = THIS_MODULE; |
677 | ip2_tty_driver->name = "ttyF"; | 672 | ip2_tty_driver->name = "ttyF"; |
678 | ip2_tty_driver->devfs_name = "tts/F"; | ||
679 | ip2_tty_driver->driver_name = pcDriver_name; | 673 | ip2_tty_driver->driver_name = pcDriver_name; |
680 | ip2_tty_driver->major = IP2_TTY_MAJOR; | 674 | ip2_tty_driver->major = IP2_TTY_MAJOR; |
681 | ip2_tty_driver->minor_start = 0; | 675 | ip2_tty_driver->minor_start = 0; |
@@ -683,7 +677,7 @@ ip2_loadmain(int *iop, int *irqp, unsigned char *firmware, int firmsize) | |||
683 | ip2_tty_driver->subtype = SERIAL_TYPE_NORMAL; | 677 | ip2_tty_driver->subtype = SERIAL_TYPE_NORMAL; |
684 | ip2_tty_driver->init_termios = tty_std_termios; | 678 | ip2_tty_driver->init_termios = tty_std_termios; |
685 | ip2_tty_driver->init_termios.c_cflag = B9600|CS8|CREAD|HUPCL|CLOCAL; | 679 | ip2_tty_driver->init_termios.c_cflag = B9600|CS8|CREAD|HUPCL|CLOCAL; |
686 | ip2_tty_driver->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_NO_DEVFS; | 680 | ip2_tty_driver->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV; |
687 | tty_set_operations(ip2_tty_driver, &ip2_ops); | 681 | tty_set_operations(ip2_tty_driver, &ip2_ops); |
688 | 682 | ||
689 | ip2trace (ITRC_NO_PORT, ITRC_INIT, 3, 0 ); | 683 | ip2trace (ITRC_NO_PORT, ITRC_INIT, 3, 0 ); |
@@ -724,26 +718,9 @@ ip2_loadmain(int *iop, int *irqp, unsigned char *firmware, int firmsize) | |||
724 | class_device_create(ip2_class, NULL, | 718 | class_device_create(ip2_class, NULL, |
725 | MKDEV(IP2_IPL_MAJOR, 4 * i), | 719 | MKDEV(IP2_IPL_MAJOR, 4 * i), |
726 | NULL, "ipl%d", i); | 720 | NULL, "ipl%d", i); |
727 | err = devfs_mk_cdev(MKDEV(IP2_IPL_MAJOR, 4 * i), | ||
728 | S_IRUSR | S_IWUSR | S_IRGRP | S_IFCHR, | ||
729 | "ip2/ipl%d", i); | ||
730 | if (err) { | ||
731 | class_device_destroy(ip2_class, | ||
732 | MKDEV(IP2_IPL_MAJOR, 4 * i)); | ||
733 | goto out_class; | ||
734 | } | ||
735 | |||
736 | class_device_create(ip2_class, NULL, | 721 | class_device_create(ip2_class, NULL, |
737 | MKDEV(IP2_IPL_MAJOR, 4 * i + 1), | 722 | MKDEV(IP2_IPL_MAJOR, 4 * i + 1), |
738 | NULL, "stat%d", i); | 723 | NULL, "stat%d", i); |
739 | err = devfs_mk_cdev(MKDEV(IP2_IPL_MAJOR, 4 * i + 1), | ||
740 | S_IRUSR | S_IWUSR | S_IRGRP | S_IFCHR, | ||
741 | "ip2/stat%d", i); | ||
742 | if (err) { | ||
743 | class_device_destroy(ip2_class, | ||
744 | MKDEV(IP2_IPL_MAJOR, 4 * i + 1)); | ||
745 | goto out_class; | ||
746 | } | ||
747 | 724 | ||
748 | for ( box = 0; box < ABS_MAX_BOXES; ++box ) | 725 | for ( box = 0; box < ABS_MAX_BOXES; ++box ) |
749 | { | 726 | { |
@@ -776,7 +753,7 @@ retry: | |||
776 | if (have_requested_irq(ip2config.irq[i])) | 753 | if (have_requested_irq(ip2config.irq[i])) |
777 | continue; | 754 | continue; |
778 | rc = request_irq( ip2config.irq[i], ip2_interrupt, | 755 | rc = request_irq( ip2config.irq[i], ip2_interrupt, |
779 | IP2_SA_FLAGS | (ip2config.type[i] == PCI ? SA_SHIRQ : 0), | 756 | IP2_SA_FLAGS | (ip2config.type[i] == PCI ? IRQF_SHARED : 0), |
780 | pcName, (void *)&pcName); | 757 | pcName, (void *)&pcName); |
781 | if (rc) { | 758 | if (rc) { |
782 | printk(KERN_ERR "IP2: an request_irq failed: error %d\n",rc); | 759 | printk(KERN_ERR "IP2: an request_irq failed: error %d\n",rc); |
@@ -818,7 +795,7 @@ EXPORT_SYMBOL(ip2_loadmain); | |||
818 | /* the board, the channel structures are initialized, and the board details */ | 795 | /* the board, the channel structures are initialized, and the board details */ |
819 | /* are reported on the console. */ | 796 | /* are reported on the console. */ |
820 | /******************************************************************************/ | 797 | /******************************************************************************/ |
821 | static void __init | 798 | static void |
822 | ip2_init_board( int boardnum ) | 799 | ip2_init_board( int boardnum ) |
823 | { | 800 | { |
824 | int i; | 801 | int i; |
@@ -961,7 +938,7 @@ err_initialize: | |||
961 | /* EISA motherboard, or no valid board ID is selected it returns 0. Otherwise */ | 938 | /* EISA motherboard, or no valid board ID is selected it returns 0. Otherwise */ |
962 | /* it returns the base address of the controller. */ | 939 | /* it returns the base address of the controller. */ |
963 | /******************************************************************************/ | 940 | /******************************************************************************/ |
964 | static unsigned short __init | 941 | static unsigned short |
965 | find_eisa_board( int start_slot ) | 942 | find_eisa_board( int start_slot ) |
966 | { | 943 | { |
967 | int i, j; | 944 | int i, j; |
diff --git a/drivers/char/ip27-rtc.c b/drivers/char/ip27-rtc.c index 3acdac3c967e..a48da02aad2f 100644 --- a/drivers/char/ip27-rtc.c +++ b/drivers/char/ip27-rtc.c | |||
@@ -196,7 +196,7 @@ static int rtc_release(struct inode *inode, struct file *file) | |||
196 | * The various file operations we support. | 196 | * The various file operations we support. |
197 | */ | 197 | */ |
198 | 198 | ||
199 | static struct file_operations rtc_fops = { | 199 | static const struct file_operations rtc_fops = { |
200 | .owner = THIS_MODULE, | 200 | .owner = THIS_MODULE, |
201 | .ioctl = rtc_ioctl, | 201 | .ioctl = rtc_ioctl, |
202 | .open = rtc_open, | 202 | .open = rtc_open, |
diff --git a/drivers/char/ipmi/ipmi_devintf.c b/drivers/char/ipmi/ipmi_devintf.c index e1c95374984c..68d7c61a864e 100644 --- a/drivers/char/ipmi/ipmi_devintf.c +++ b/drivers/char/ipmi/ipmi_devintf.c | |||
@@ -31,7 +31,6 @@ | |||
31 | * 675 Mass Ave, Cambridge, MA 02139, USA. | 31 | * 675 Mass Ave, Cambridge, MA 02139, USA. |
32 | */ | 32 | */ |
33 | 33 | ||
34 | #include <linux/config.h> | ||
35 | #include <linux/module.h> | 34 | #include <linux/module.h> |
36 | #include <linux/moduleparam.h> | 35 | #include <linux/moduleparam.h> |
37 | #include <linux/errno.h> | 36 | #include <linux/errno.h> |
@@ -40,7 +39,6 @@ | |||
40 | #include <linux/poll.h> | 39 | #include <linux/poll.h> |
41 | #include <linux/spinlock.h> | 40 | #include <linux/spinlock.h> |
42 | #include <linux/slab.h> | 41 | #include <linux/slab.h> |
43 | #include <linux/devfs_fs_kernel.h> | ||
44 | #include <linux/ipmi.h> | 42 | #include <linux/ipmi.h> |
45 | #include <linux/mutex.h> | 43 | #include <linux/mutex.h> |
46 | #include <linux/init.h> | 44 | #include <linux/init.h> |
@@ -767,7 +765,7 @@ static long compat_ipmi_ioctl(struct file *filep, unsigned int cmd, | |||
767 | } | 765 | } |
768 | #endif | 766 | #endif |
769 | 767 | ||
770 | static struct file_operations ipmi_fops = { | 768 | static const struct file_operations ipmi_fops = { |
771 | .owner = THIS_MODULE, | 769 | .owner = THIS_MODULE, |
772 | .ioctl = ipmi_ioctl, | 770 | .ioctl = ipmi_ioctl, |
773 | #ifdef CONFIG_COMPAT | 771 | #ifdef CONFIG_COMPAT |
@@ -804,9 +802,6 @@ static void ipmi_new_smi(int if_num, struct device *device) | |||
804 | dev_t dev = MKDEV(ipmi_major, if_num); | 802 | dev_t dev = MKDEV(ipmi_major, if_num); |
805 | struct ipmi_reg_list *entry; | 803 | struct ipmi_reg_list *entry; |
806 | 804 | ||
807 | devfs_mk_cdev(dev, S_IFCHR | S_IRUSR | S_IWUSR, | ||
808 | "ipmidev/%d", if_num); | ||
809 | |||
810 | entry = kmalloc(sizeof(*entry), GFP_KERNEL); | 805 | entry = kmalloc(sizeof(*entry), GFP_KERNEL); |
811 | if (!entry) { | 806 | if (!entry) { |
812 | printk(KERN_ERR "ipmi_devintf: Unable to create the" | 807 | printk(KERN_ERR "ipmi_devintf: Unable to create the" |
@@ -836,7 +831,6 @@ static void ipmi_smi_gone(int if_num) | |||
836 | } | 831 | } |
837 | class_device_destroy(ipmi_class, dev); | 832 | class_device_destroy(ipmi_class, dev); |
838 | mutex_unlock(®_list_mutex); | 833 | mutex_unlock(®_list_mutex); |
839 | devfs_remove("ipmidev/%d", if_num); | ||
840 | } | 834 | } |
841 | 835 | ||
842 | static struct ipmi_smi_watcher smi_watcher = | 836 | static struct ipmi_smi_watcher smi_watcher = |
@@ -872,8 +866,6 @@ static __init int init_ipmi_devintf(void) | |||
872 | ipmi_major = rv; | 866 | ipmi_major = rv; |
873 | } | 867 | } |
874 | 868 | ||
875 | devfs_mk_dir(DEVICE_NAME); | ||
876 | |||
877 | rv = ipmi_smi_watcher_register(&smi_watcher); | 869 | rv = ipmi_smi_watcher_register(&smi_watcher); |
878 | if (rv) { | 870 | if (rv) { |
879 | unregister_chrdev(ipmi_major, DEVICE_NAME); | 871 | unregister_chrdev(ipmi_major, DEVICE_NAME); |
@@ -898,7 +890,6 @@ static __exit void cleanup_ipmi(void) | |||
898 | mutex_unlock(®_list_mutex); | 890 | mutex_unlock(®_list_mutex); |
899 | class_destroy(ipmi_class); | 891 | class_destroy(ipmi_class); |
900 | ipmi_smi_watcher_unregister(&smi_watcher); | 892 | ipmi_smi_watcher_unregister(&smi_watcher); |
901 | devfs_remove(DEVICE_NAME); | ||
902 | unregister_chrdev(ipmi_major, DEVICE_NAME); | 893 | unregister_chrdev(ipmi_major, DEVICE_NAME); |
903 | } | 894 | } |
904 | module_exit(cleanup_ipmi); | 895 | module_exit(cleanup_ipmi); |
diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c index 9f2f8fdec69a..0aa5d608fe6f 100644 --- a/drivers/char/ipmi/ipmi_msghandler.c +++ b/drivers/char/ipmi/ipmi_msghandler.c | |||
@@ -31,7 +31,6 @@ | |||
31 | * 675 Mass Ave, Cambridge, MA 02139, USA. | 31 | * 675 Mass Ave, Cambridge, MA 02139, USA. |
32 | */ | 32 | */ |
33 | 33 | ||
34 | #include <linux/config.h> | ||
35 | #include <linux/module.h> | 34 | #include <linux/module.h> |
36 | #include <linux/errno.h> | 35 | #include <linux/errno.h> |
37 | #include <asm/system.h> | 36 | #include <asm/system.h> |
@@ -57,8 +56,7 @@ static int ipmi_init_msghandler(void); | |||
57 | static int initialized = 0; | 56 | static int initialized = 0; |
58 | 57 | ||
59 | #ifdef CONFIG_PROC_FS | 58 | #ifdef CONFIG_PROC_FS |
60 | struct proc_dir_entry *proc_ipmi_root = NULL; | 59 | static struct proc_dir_entry *proc_ipmi_root = NULL; |
61 | EXPORT_SYMBOL(proc_ipmi_root); | ||
62 | #endif /* CONFIG_PROC_FS */ | 60 | #endif /* CONFIG_PROC_FS */ |
63 | 61 | ||
64 | #define MAX_EVENTS_IN_QUEUE 25 | 62 | #define MAX_EVENTS_IN_QUEUE 25 |
@@ -936,11 +934,8 @@ int ipmi_set_gets_events(ipmi_user_t user, int val) | |||
936 | 934 | ||
937 | if (val) { | 935 | if (val) { |
938 | /* Deliver any queued events. */ | 936 | /* Deliver any queued events. */ |
939 | list_for_each_entry_safe(msg, msg2, &intf->waiting_events, | 937 | list_for_each_entry_safe(msg, msg2, &intf->waiting_events, link) |
940 | link) { | 938 | list_move_tail(&msg->link, &msgs); |
941 | list_del(&msg->link); | ||
942 | list_add_tail(&msg->link, &msgs); | ||
943 | } | ||
944 | intf->waiting_events_count = 0; | 939 | intf->waiting_events_count = 0; |
945 | } | 940 | } |
946 | 941 | ||
@@ -3677,7 +3672,7 @@ static void send_panic_events(char *str) | |||
3677 | } | 3672 | } |
3678 | #endif /* CONFIG_IPMI_PANIC_EVENT */ | 3673 | #endif /* CONFIG_IPMI_PANIC_EVENT */ |
3679 | 3674 | ||
3680 | static int has_paniced = 0; | 3675 | static int has_panicked = 0; |
3681 | 3676 | ||
3682 | static int panic_event(struct notifier_block *this, | 3677 | static int panic_event(struct notifier_block *this, |
3683 | unsigned long event, | 3678 | unsigned long event, |
@@ -3686,9 +3681,9 @@ static int panic_event(struct notifier_block *this, | |||
3686 | int i; | 3681 | int i; |
3687 | ipmi_smi_t intf; | 3682 | ipmi_smi_t intf; |
3688 | 3683 | ||
3689 | if (has_paniced) | 3684 | if (has_panicked) |
3690 | return NOTIFY_DONE; | 3685 | return NOTIFY_DONE; |
3691 | has_paniced = 1; | 3686 | has_panicked = 1; |
3692 | 3687 | ||
3693 | /* For every registered interface, set it to run to completion. */ | 3688 | /* For every registered interface, set it to run to completion. */ |
3694 | for (i = 0; i < MAX_IPMI_INTERFACES; i++) { | 3689 | for (i = 0; i < MAX_IPMI_INTERFACES; i++) { |
@@ -3742,11 +3737,8 @@ static int ipmi_init_msghandler(void) | |||
3742 | proc_ipmi_root->owner = THIS_MODULE; | 3737 | proc_ipmi_root->owner = THIS_MODULE; |
3743 | #endif /* CONFIG_PROC_FS */ | 3738 | #endif /* CONFIG_PROC_FS */ |
3744 | 3739 | ||
3745 | init_timer(&ipmi_timer); | 3740 | setup_timer(&ipmi_timer, ipmi_timeout, 0); |
3746 | ipmi_timer.data = 0; | 3741 | mod_timer(&ipmi_timer, jiffies + IPMI_TIMEOUT_JIFFIES); |
3747 | ipmi_timer.function = ipmi_timeout; | ||
3748 | ipmi_timer.expires = jiffies + IPMI_TIMEOUT_JIFFIES; | ||
3749 | add_timer(&ipmi_timer); | ||
3750 | 3742 | ||
3751 | atomic_notifier_chain_register(&panic_notifier_list, &panic_block); | 3743 | atomic_notifier_chain_register(&panic_notifier_list, &panic_block); |
3752 | 3744 | ||
diff --git a/drivers/char/ipmi/ipmi_poweroff.c b/drivers/char/ipmi/ipmi_poweroff.c index d0b5c08e7b4e..8d941db83457 100644 --- a/drivers/char/ipmi/ipmi_poweroff.c +++ b/drivers/char/ipmi/ipmi_poweroff.c | |||
@@ -31,7 +31,6 @@ | |||
31 | * with this program; if not, write to the Free Software Foundation, Inc., | 31 | * with this program; if not, write to the Free Software Foundation, Inc., |
32 | * 675 Mass Ave, Cambridge, MA 02139, USA. | 32 | * 675 Mass Ave, Cambridge, MA 02139, USA. |
33 | */ | 33 | */ |
34 | #include <linux/config.h> | ||
35 | #include <linux/module.h> | 34 | #include <linux/module.h> |
36 | #include <linux/moduleparam.h> | 35 | #include <linux/moduleparam.h> |
37 | #include <linux/proc_fs.h> | 36 | #include <linux/proc_fs.h> |
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c index 02a7dd7a8a55..f57eba0bf253 100644 --- a/drivers/char/ipmi/ipmi_si_intf.c +++ b/drivers/char/ipmi/ipmi_si_intf.c | |||
@@ -38,7 +38,6 @@ | |||
38 | * and drives the real SMI state machine. | 38 | * and drives the real SMI state machine. |
39 | */ | 39 | */ |
40 | 40 | ||
41 | #include <linux/config.h> | ||
42 | #include <linux/module.h> | 41 | #include <linux/module.h> |
43 | #include <linux/moduleparam.h> | 42 | #include <linux/moduleparam.h> |
44 | #include <asm/system.h> | 43 | #include <asm/system.h> |
@@ -55,23 +54,6 @@ | |||
55 | #include <linux/mutex.h> | 54 | #include <linux/mutex.h> |
56 | #include <linux/kthread.h> | 55 | #include <linux/kthread.h> |
57 | #include <asm/irq.h> | 56 | #include <asm/irq.h> |
58 | #ifdef CONFIG_HIGH_RES_TIMERS | ||
59 | #include <linux/hrtime.h> | ||
60 | # if defined(schedule_next_int) | ||
61 | /* Old high-res timer code, do translations. */ | ||
62 | # define get_arch_cycles(a) quick_update_jiffies_sub(a) | ||
63 | # define arch_cycles_per_jiffy cycles_per_jiffies | ||
64 | # endif | ||
65 | static inline void add_usec_to_timer(struct timer_list *t, long v) | ||
66 | { | ||
67 | t->arch_cycle_expires += nsec_to_arch_cycle(v * 1000); | ||
68 | while (t->arch_cycle_expires >= arch_cycles_per_jiffy) | ||
69 | { | ||
70 | t->expires++; | ||
71 | t->arch_cycle_expires -= arch_cycles_per_jiffy; | ||
72 | } | ||
73 | } | ||
74 | #endif | ||
75 | #include <linux/interrupt.h> | 57 | #include <linux/interrupt.h> |
76 | #include <linux/rcupdate.h> | 58 | #include <linux/rcupdate.h> |
77 | #include <linux/ipmi_smi.h> | 59 | #include <linux/ipmi_smi.h> |
@@ -243,8 +225,6 @@ static int register_xaction_notifier(struct notifier_block * nb) | |||
243 | return atomic_notifier_chain_register(&xaction_notifier_list, nb); | 225 | return atomic_notifier_chain_register(&xaction_notifier_list, nb); |
244 | } | 226 | } |
245 | 227 | ||
246 | static void si_restart_short_timer(struct smi_info *smi_info); | ||
247 | |||
248 | static void deliver_recv_msg(struct smi_info *smi_info, | 228 | static void deliver_recv_msg(struct smi_info *smi_info, |
249 | struct ipmi_smi_msg *msg) | 229 | struct ipmi_smi_msg *msg) |
250 | { | 230 | { |
@@ -768,7 +748,6 @@ static void sender(void *send_info, | |||
768 | && (smi_info->curr_msg == NULL)) | 748 | && (smi_info->curr_msg == NULL)) |
769 | { | 749 | { |
770 | start_next_msg(smi_info); | 750 | start_next_msg(smi_info); |
771 | si_restart_short_timer(smi_info); | ||
772 | } | 751 | } |
773 | spin_unlock_irqrestore(&(smi_info->si_lock), flags); | 752 | spin_unlock_irqrestore(&(smi_info->si_lock), flags); |
774 | } | 753 | } |
@@ -809,7 +788,7 @@ static int ipmi_thread(void *data) | |||
809 | /* do nothing */ | 788 | /* do nothing */ |
810 | } | 789 | } |
811 | else if (smi_result == SI_SM_CALL_WITH_DELAY) | 790 | else if (smi_result == SI_SM_CALL_WITH_DELAY) |
812 | udelay(1); | 791 | schedule(); |
813 | else | 792 | else |
814 | schedule_timeout_interruptible(1); | 793 | schedule_timeout_interruptible(1); |
815 | } | 794 | } |
@@ -833,37 +812,6 @@ static void request_events(void *send_info) | |||
833 | 812 | ||
834 | static int initialized = 0; | 813 | static int initialized = 0; |
835 | 814 | ||
836 | /* Must be called with interrupts off and with the si_lock held. */ | ||
837 | static void si_restart_short_timer(struct smi_info *smi_info) | ||
838 | { | ||
839 | #if defined(CONFIG_HIGH_RES_TIMERS) | ||
840 | unsigned long flags; | ||
841 | unsigned long jiffies_now; | ||
842 | unsigned long seq; | ||
843 | |||
844 | if (del_timer(&(smi_info->si_timer))) { | ||
845 | /* If we don't delete the timer, then it will go off | ||
846 | immediately, anyway. So we only process if we | ||
847 | actually delete the timer. */ | ||
848 | |||
849 | do { | ||
850 | seq = read_seqbegin_irqsave(&xtime_lock, flags); | ||
851 | jiffies_now = jiffies; | ||
852 | smi_info->si_timer.expires = jiffies_now; | ||
853 | smi_info->si_timer.arch_cycle_expires | ||
854 | = get_arch_cycles(jiffies_now); | ||
855 | } while (read_seqretry_irqrestore(&xtime_lock, seq, flags)); | ||
856 | |||
857 | add_usec_to_timer(&smi_info->si_timer, SI_SHORT_TIMEOUT_USEC); | ||
858 | |||
859 | add_timer(&(smi_info->si_timer)); | ||
860 | spin_lock_irqsave(&smi_info->count_lock, flags); | ||
861 | smi_info->timeout_restarts++; | ||
862 | spin_unlock_irqrestore(&smi_info->count_lock, flags); | ||
863 | } | ||
864 | #endif | ||
865 | } | ||
866 | |||
867 | static void smi_timeout(unsigned long data) | 815 | static void smi_timeout(unsigned long data) |
868 | { | 816 | { |
869 | struct smi_info *smi_info = (struct smi_info *) data; | 817 | struct smi_info *smi_info = (struct smi_info *) data; |
@@ -904,31 +852,15 @@ static void smi_timeout(unsigned long data) | |||
904 | /* If the state machine asks for a short delay, then shorten | 852 | /* If the state machine asks for a short delay, then shorten |
905 | the timer timeout. */ | 853 | the timer timeout. */ |
906 | if (smi_result == SI_SM_CALL_WITH_DELAY) { | 854 | if (smi_result == SI_SM_CALL_WITH_DELAY) { |
907 | #if defined(CONFIG_HIGH_RES_TIMERS) | ||
908 | unsigned long seq; | ||
909 | #endif | ||
910 | spin_lock_irqsave(&smi_info->count_lock, flags); | 855 | spin_lock_irqsave(&smi_info->count_lock, flags); |
911 | smi_info->short_timeouts++; | 856 | smi_info->short_timeouts++; |
912 | spin_unlock_irqrestore(&smi_info->count_lock, flags); | 857 | spin_unlock_irqrestore(&smi_info->count_lock, flags); |
913 | #if defined(CONFIG_HIGH_RES_TIMERS) | ||
914 | do { | ||
915 | seq = read_seqbegin_irqsave(&xtime_lock, flags); | ||
916 | smi_info->si_timer.expires = jiffies; | ||
917 | smi_info->si_timer.arch_cycle_expires | ||
918 | = get_arch_cycles(smi_info->si_timer.expires); | ||
919 | } while (read_seqretry_irqrestore(&xtime_lock, seq, flags)); | ||
920 | add_usec_to_timer(&smi_info->si_timer, SI_SHORT_TIMEOUT_USEC); | ||
921 | #else | ||
922 | smi_info->si_timer.expires = jiffies + 1; | 858 | smi_info->si_timer.expires = jiffies + 1; |
923 | #endif | ||
924 | } else { | 859 | } else { |
925 | spin_lock_irqsave(&smi_info->count_lock, flags); | 860 | spin_lock_irqsave(&smi_info->count_lock, flags); |
926 | smi_info->long_timeouts++; | 861 | smi_info->long_timeouts++; |
927 | spin_unlock_irqrestore(&smi_info->count_lock, flags); | 862 | spin_unlock_irqrestore(&smi_info->count_lock, flags); |
928 | smi_info->si_timer.expires = jiffies + SI_TIMEOUT_JIFFIES; | 863 | smi_info->si_timer.expires = jiffies + SI_TIMEOUT_JIFFIES; |
929 | #if defined(CONFIG_HIGH_RES_TIMERS) | ||
930 | smi_info->si_timer.arch_cycle_expires = 0; | ||
931 | #endif | ||
932 | } | 864 | } |
933 | 865 | ||
934 | do_add_timer: | 866 | do_add_timer: |
@@ -1109,7 +1041,7 @@ static int std_irq_setup(struct smi_info *info) | |||
1109 | if (info->si_type == SI_BT) { | 1041 | if (info->si_type == SI_BT) { |
1110 | rv = request_irq(info->irq, | 1042 | rv = request_irq(info->irq, |
1111 | si_bt_irq_handler, | 1043 | si_bt_irq_handler, |
1112 | SA_INTERRUPT, | 1044 | IRQF_DISABLED, |
1113 | DEVICE_NAME, | 1045 | DEVICE_NAME, |
1114 | info); | 1046 | info); |
1115 | if (!rv) | 1047 | if (!rv) |
@@ -1119,7 +1051,7 @@ static int std_irq_setup(struct smi_info *info) | |||
1119 | } else | 1051 | } else |
1120 | rv = request_irq(info->irq, | 1052 | rv = request_irq(info->irq, |
1121 | si_irq_handler, | 1053 | si_irq_handler, |
1122 | SA_INTERRUPT, | 1054 | IRQF_DISABLED, |
1123 | DEVICE_NAME, | 1055 | DEVICE_NAME, |
1124 | info); | 1056 | info); |
1125 | if (rv) { | 1057 | if (rv) { |
diff --git a/drivers/char/ipmi/ipmi_watchdog.c b/drivers/char/ipmi/ipmi_watchdog.c index 2d11ddd99e55..accaaf1a6b69 100644 --- a/drivers/char/ipmi/ipmi_watchdog.c +++ b/drivers/char/ipmi/ipmi_watchdog.c | |||
@@ -31,7 +31,6 @@ | |||
31 | * 675 Mass Ave, Cambridge, MA 02139, USA. | 31 | * 675 Mass Ave, Cambridge, MA 02139, USA. |
32 | */ | 32 | */ |
33 | 33 | ||
34 | #include <linux/config.h> | ||
35 | #include <linux/module.h> | 34 | #include <linux/module.h> |
36 | #include <linux/moduleparam.h> | 35 | #include <linux/moduleparam.h> |
37 | #include <linux/ipmi.h> | 36 | #include <linux/ipmi.h> |
@@ -212,24 +211,16 @@ static int set_param_str(const char *val, struct kernel_param *kp) | |||
212 | { | 211 | { |
213 | action_fn fn = (action_fn) kp->arg; | 212 | action_fn fn = (action_fn) kp->arg; |
214 | int rv = 0; | 213 | int rv = 0; |
215 | const char *end; | 214 | char *dup, *s; |
216 | char valcp[16]; | 215 | |
217 | int len; | 216 | dup = kstrdup(val, GFP_KERNEL); |
218 | 217 | if (!dup) | |
219 | /* Truncate leading and trailing spaces. */ | 218 | return -ENOMEM; |
220 | while (isspace(*val)) | 219 | |
221 | val++; | 220 | s = strstrip(dup); |
222 | end = val + strlen(val) - 1; | ||
223 | while ((end >= val) && isspace(*end)) | ||
224 | end--; | ||
225 | len = end - val + 1; | ||
226 | if (len > sizeof(valcp) - 1) | ||
227 | return -EINVAL; | ||
228 | memcpy(valcp, val, len); | ||
229 | valcp[len] = '\0'; | ||
230 | 221 | ||
231 | down_read(®ister_sem); | 222 | down_read(®ister_sem); |
232 | rv = fn(valcp, NULL); | 223 | rv = fn(s, NULL); |
233 | if (rv) | 224 | if (rv) |
234 | goto out_unlock; | 225 | goto out_unlock; |
235 | 226 | ||
@@ -239,6 +230,7 @@ static int set_param_str(const char *val, struct kernel_param *kp) | |||
239 | 230 | ||
240 | out_unlock: | 231 | out_unlock: |
241 | up_read(®ister_sem); | 232 | up_read(®ister_sem); |
233 | kfree(dup); | ||
242 | return rv; | 234 | return rv; |
243 | } | 235 | } |
244 | 236 | ||
@@ -815,7 +807,7 @@ static int ipmi_close(struct inode *ino, struct file *filep) | |||
815 | return 0; | 807 | return 0; |
816 | } | 808 | } |
817 | 809 | ||
818 | static struct file_operations ipmi_wdog_fops = { | 810 | static const struct file_operations ipmi_wdog_fops = { |
819 | .owner = THIS_MODULE, | 811 | .owner = THIS_MODULE, |
820 | .read = ipmi_read, | 812 | .read = ipmi_read, |
821 | .poll = ipmi_poll, | 813 | .poll = ipmi_poll, |
@@ -956,9 +948,10 @@ static int wdog_reboot_handler(struct notifier_block *this, | |||
956 | /* Disable the WDT if we are shutting down. */ | 948 | /* Disable the WDT if we are shutting down. */ |
957 | ipmi_watchdog_state = WDOG_TIMEOUT_NONE; | 949 | ipmi_watchdog_state = WDOG_TIMEOUT_NONE; |
958 | panic_halt_ipmi_set_timeout(); | 950 | panic_halt_ipmi_set_timeout(); |
959 | } else { | 951 | } else if (ipmi_watchdog_state != WDOG_TIMEOUT_NONE) { |
960 | /* Set a long timer to let the reboot happens, but | 952 | /* Set a long timer to let the reboot happens, but |
961 | reboot if it hangs. */ | 953 | reboot if it hangs, but only if the watchdog |
954 | timer was already running. */ | ||
962 | timeout = 120; | 955 | timeout = 120; |
963 | pretimeout = 0; | 956 | pretimeout = 0; |
964 | ipmi_watchdog_state = WDOG_TIMEOUT_RESET; | 957 | ipmi_watchdog_state = WDOG_TIMEOUT_RESET; |
@@ -980,16 +973,17 @@ static int wdog_panic_handler(struct notifier_block *this, | |||
980 | { | 973 | { |
981 | static int panic_event_handled = 0; | 974 | static int panic_event_handled = 0; |
982 | 975 | ||
983 | /* On a panic, if we have a panic timeout, make sure that the thing | 976 | /* On a panic, if we have a panic timeout, make sure to extend |
984 | reboots, even if it hangs during that panic. */ | 977 | the watchdog timer to a reasonable value to complete the |
985 | if (watchdog_user && !panic_event_handled) { | 978 | panic, if the watchdog timer is running. Plus the |
986 | /* Make sure the panic doesn't hang, and make sure we | 979 | pretimeout is meaningless at panic time. */ |
987 | do this only once. */ | 980 | if (watchdog_user && !panic_event_handled && |
981 | ipmi_watchdog_state != WDOG_TIMEOUT_NONE) { | ||
982 | /* Make sure we do this only once. */ | ||
988 | panic_event_handled = 1; | 983 | panic_event_handled = 1; |
989 | 984 | ||
990 | timeout = 255; | 985 | timeout = 255; |
991 | pretimeout = 0; | 986 | pretimeout = 0; |
992 | ipmi_watchdog_state = WDOG_TIMEOUT_RESET; | ||
993 | panic_halt_ipmi_set_timeout(); | 987 | panic_halt_ipmi_set_timeout(); |
994 | } | 988 | } |
995 | 989 | ||
diff --git a/drivers/char/isicom.c b/drivers/char/isicom.c index e9ebabaf8cb0..913be23e0a24 100644 --- a/drivers/char/isicom.c +++ b/drivers/char/isicom.c | |||
@@ -245,7 +245,7 @@ static int lock_card(struct isi_board *card) | |||
245 | printk(KERN_WARNING "ISICOM: Failed to lock Card (0x%lx)\n", | 245 | printk(KERN_WARNING "ISICOM: Failed to lock Card (0x%lx)\n", |
246 | card->base); | 246 | card->base); |
247 | 247 | ||
248 | return 0; /* Failed to aquire the card! */ | 248 | return 0; /* Failed to acquire the card! */ |
249 | } | 249 | } |
250 | 250 | ||
251 | static int lock_card_at_interrupt(struct isi_board *card) | 251 | static int lock_card_at_interrupt(struct isi_board *card) |
@@ -262,7 +262,7 @@ static int lock_card_at_interrupt(struct isi_board *card) | |||
262 | spin_unlock_irqrestore(&card->card_lock, card->flags); | 262 | spin_unlock_irqrestore(&card->card_lock, card->flags); |
263 | } | 263 | } |
264 | /* Failing in interrupt is an acceptable event */ | 264 | /* Failing in interrupt is an acceptable event */ |
265 | return 0; /* Failed to aquire the card! */ | 265 | return 0; /* Failed to acquire the card! */ |
266 | } | 266 | } |
267 | 267 | ||
268 | static void unlock_card(struct isi_board *card) | 268 | static void unlock_card(struct isi_board *card) |
@@ -1145,7 +1145,7 @@ static int isicom_write(struct tty_struct *tty, const unsigned char *buf, | |||
1145 | if (isicom_paranoia_check(port, tty->name, "isicom_write")) | 1145 | if (isicom_paranoia_check(port, tty->name, "isicom_write")) |
1146 | return 0; | 1146 | return 0; |
1147 | 1147 | ||
1148 | if (!tty || !port->xmit_buf) | 1148 | if (!port->xmit_buf) |
1149 | return 0; | 1149 | return 0; |
1150 | 1150 | ||
1151 | spin_lock_irqsave(&card->card_lock, flags); | 1151 | spin_lock_irqsave(&card->card_lock, flags); |
@@ -1180,7 +1180,7 @@ static void isicom_put_char(struct tty_struct *tty, unsigned char ch) | |||
1180 | if (isicom_paranoia_check(port, tty->name, "isicom_put_char")) | 1180 | if (isicom_paranoia_check(port, tty->name, "isicom_put_char")) |
1181 | return; | 1181 | return; |
1182 | 1182 | ||
1183 | if (!tty || !port->xmit_buf) | 1183 | if (!port->xmit_buf) |
1184 | return; | 1184 | return; |
1185 | 1185 | ||
1186 | spin_lock_irqsave(&card->card_lock, flags); | 1186 | spin_lock_irqsave(&card->card_lock, flags); |
@@ -1581,7 +1581,6 @@ static int __devinit isicom_register_tty_driver(void) | |||
1581 | 1581 | ||
1582 | isicom_normal->owner = THIS_MODULE; | 1582 | isicom_normal->owner = THIS_MODULE; |
1583 | isicom_normal->name = "ttyM"; | 1583 | isicom_normal->name = "ttyM"; |
1584 | isicom_normal->devfs_name = "isicom/"; | ||
1585 | isicom_normal->major = ISICOM_NMAJOR; | 1584 | isicom_normal->major = ISICOM_NMAJOR; |
1586 | isicom_normal->minor_start = 0; | 1585 | isicom_normal->minor_start = 0; |
1587 | isicom_normal->type = TTY_DRIVER_TYPE_SERIAL; | 1586 | isicom_normal->type = TTY_DRIVER_TYPE_SERIAL; |
@@ -1615,14 +1614,14 @@ static int __devinit isicom_register_isr(struct pci_dev *pdev, | |||
1615 | const unsigned int index) | 1614 | const unsigned int index) |
1616 | { | 1615 | { |
1617 | struct isi_board *board = pci_get_drvdata(pdev); | 1616 | struct isi_board *board = pci_get_drvdata(pdev); |
1618 | unsigned long irqflags = SA_INTERRUPT; | 1617 | unsigned long irqflags = IRQF_DISABLED; |
1619 | int retval = -EINVAL; | 1618 | int retval = -EINVAL; |
1620 | 1619 | ||
1621 | if (!board->base) | 1620 | if (!board->base) |
1622 | goto end; | 1621 | goto end; |
1623 | 1622 | ||
1624 | if (board->isa == NO) | 1623 | if (board->isa == NO) |
1625 | irqflags |= SA_SHIRQ; | 1624 | irqflags |= IRQF_SHARED; |
1626 | 1625 | ||
1627 | retval = request_irq(board->irq, isicom_interrupt, irqflags, | 1626 | retval = request_irq(board->irq, isicom_interrupt, irqflags, |
1628 | ISICOM_NAME, board); | 1627 | ISICOM_NAME, board); |
diff --git a/drivers/char/istallion.c b/drivers/char/istallion.c index ef20c1fc9c4c..84dfc4278139 100644 --- a/drivers/char/istallion.c +++ b/drivers/char/istallion.c | |||
@@ -26,7 +26,6 @@ | |||
26 | 26 | ||
27 | /*****************************************************************************/ | 27 | /*****************************************************************************/ |
28 | 28 | ||
29 | #include <linux/config.h> | ||
30 | #include <linux/module.h> | 29 | #include <linux/module.h> |
31 | #include <linux/slab.h> | 30 | #include <linux/slab.h> |
32 | #include <linux/interrupt.h> | 31 | #include <linux/interrupt.h> |
@@ -39,16 +38,14 @@ | |||
39 | #include <linux/ioport.h> | 38 | #include <linux/ioport.h> |
40 | #include <linux/delay.h> | 39 | #include <linux/delay.h> |
41 | #include <linux/init.h> | 40 | #include <linux/init.h> |
42 | #include <linux/devfs_fs_kernel.h> | ||
43 | #include <linux/device.h> | 41 | #include <linux/device.h> |
44 | #include <linux/wait.h> | 42 | #include <linux/wait.h> |
43 | #include <linux/eisa.h> | ||
45 | 44 | ||
46 | #include <asm/io.h> | 45 | #include <asm/io.h> |
47 | #include <asm/uaccess.h> | 46 | #include <asm/uaccess.h> |
48 | 47 | ||
49 | #ifdef CONFIG_PCI | ||
50 | #include <linux/pci.h> | 48 | #include <linux/pci.h> |
51 | #endif | ||
52 | 49 | ||
53 | /*****************************************************************************/ | 50 | /*****************************************************************************/ |
54 | 51 | ||
@@ -137,6 +134,10 @@ static stlconf_t stli_brdconf[] = { | |||
137 | 134 | ||
138 | static int stli_nrbrds = ARRAY_SIZE(stli_brdconf); | 135 | static int stli_nrbrds = ARRAY_SIZE(stli_brdconf); |
139 | 136 | ||
137 | /* stli_lock must NOT be taken holding brd_lock */ | ||
138 | static spinlock_t stli_lock; /* TTY logic lock */ | ||
139 | static spinlock_t brd_lock; /* Board logic lock */ | ||
140 | |||
140 | /* | 141 | /* |
141 | * There is some experimental EISA board detection code in this driver. | 142 | * There is some experimental EISA board detection code in this driver. |
142 | * By default it is disabled, but for those that want to try it out, | 143 | * By default it is disabled, but for those that want to try it out, |
@@ -173,14 +174,6 @@ static char *stli_serialname = "ttyE"; | |||
173 | 174 | ||
174 | static struct tty_driver *stli_serial; | 175 | static struct tty_driver *stli_serial; |
175 | 176 | ||
176 | /* | ||
177 | * We will need to allocate a temporary write buffer for chars that | ||
178 | * come direct from user space. The problem is that a copy from user | ||
179 | * space might cause a page fault (typically on a system that is | ||
180 | * swapping!). All ports will share one buffer - since if the system | ||
181 | * is already swapping a shared buffer won't make things any worse. | ||
182 | */ | ||
183 | static char *stli_tmpwritebuf; | ||
184 | 177 | ||
185 | #define STLI_TXBUFSIZE 4096 | 178 | #define STLI_TXBUFSIZE 4096 |
186 | 179 | ||
@@ -288,7 +281,6 @@ static char *stli_brdnames[] = { | |||
288 | 281 | ||
289 | /*****************************************************************************/ | 282 | /*****************************************************************************/ |
290 | 283 | ||
291 | #ifdef MODULE | ||
292 | /* | 284 | /* |
293 | * Define some string labels for arguments passed from the module | 285 | * Define some string labels for arguments passed from the module |
294 | * load line. These allow for easy board definitions, and easy | 286 | * load line. These allow for easy board definitions, and easy |
@@ -387,8 +379,6 @@ MODULE_PARM_DESC(board2, "Board 2 config -> name[,ioaddr[,memaddr]"); | |||
387 | module_param_array(board3, charp, NULL, 0); | 379 | module_param_array(board3, charp, NULL, 0); |
388 | MODULE_PARM_DESC(board3, "Board 3 config -> name[,ioaddr[,memaddr]"); | 380 | MODULE_PARM_DESC(board3, "Board 3 config -> name[,ioaddr[,memaddr]"); |
389 | 381 | ||
390 | #endif | ||
391 | |||
392 | /* | 382 | /* |
393 | * Set up a default memory address table for EISA board probing. | 383 | * Set up a default memory address table for EISA board probing. |
394 | * The default addresses are all bellow 1Mbyte, which has to be the | 384 | * The default addresses are all bellow 1Mbyte, which has to be the |
@@ -419,7 +409,7 @@ static int stli_eisamempsize = ARRAY_SIZE(stli_eisamemprobeaddrs); | |||
419 | #endif | 409 | #endif |
420 | 410 | ||
421 | static struct pci_device_id istallion_pci_tbl[] = { | 411 | static struct pci_device_id istallion_pci_tbl[] = { |
422 | { PCI_VENDOR_ID_STALLION, PCI_DEVICE_ID_ECRA, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, | 412 | { PCI_DEVICE(PCI_VENDOR_ID_STALLION, PCI_DEVICE_ID_ECRA), }, |
423 | { 0 } | 413 | { 0 } |
424 | }; | 414 | }; |
425 | MODULE_DEVICE_TABLE(pci, istallion_pci_tbl); | 415 | MODULE_DEVICE_TABLE(pci, istallion_pci_tbl); |
@@ -649,14 +639,8 @@ static unsigned int stli_baudrates[] = { | |||
649 | * Prototype all functions in this driver! | 639 | * Prototype all functions in this driver! |
650 | */ | 640 | */ |
651 | 641 | ||
652 | #ifdef MODULE | ||
653 | static void stli_argbrds(void); | ||
654 | static int stli_parsebrd(stlconf_t *confp, char **argp); | 642 | static int stli_parsebrd(stlconf_t *confp, char **argp); |
655 | 643 | static int stli_init(void); | |
656 | static unsigned long stli_atol(char *str); | ||
657 | #endif | ||
658 | |||
659 | int stli_init(void); | ||
660 | static int stli_open(struct tty_struct *tty, struct file *filp); | 644 | static int stli_open(struct tty_struct *tty, struct file *filp); |
661 | static void stli_close(struct tty_struct *tty, struct file *filp); | 645 | static void stli_close(struct tty_struct *tty, struct file *filp); |
662 | static int stli_write(struct tty_struct *tty, const unsigned char *buf, int count); | 646 | static int stli_write(struct tty_struct *tty, const unsigned char *buf, int count); |
@@ -682,7 +666,7 @@ static int stli_startbrd(stlibrd_t *brdp); | |||
682 | static ssize_t stli_memread(struct file *fp, char __user *buf, size_t count, loff_t *offp); | 666 | static ssize_t stli_memread(struct file *fp, char __user *buf, size_t count, loff_t *offp); |
683 | static ssize_t stli_memwrite(struct file *fp, const char __user *buf, size_t count, loff_t *offp); | 667 | static ssize_t stli_memwrite(struct file *fp, const char __user *buf, size_t count, loff_t *offp); |
684 | static int stli_memioctl(struct inode *ip, struct file *fp, unsigned int cmd, unsigned long arg); | 668 | static int stli_memioctl(struct inode *ip, struct file *fp, unsigned int cmd, unsigned long arg); |
685 | static void stli_brdpoll(stlibrd_t *brdp, volatile cdkhdr_t *hdrp); | 669 | static void stli_brdpoll(stlibrd_t *brdp, cdkhdr_t __iomem *hdrp); |
686 | static void stli_poll(unsigned long arg); | 670 | static void stli_poll(unsigned long arg); |
687 | static int stli_hostcmd(stlibrd_t *brdp, stliport_t *portp); | 671 | static int stli_hostcmd(stlibrd_t *brdp, stliport_t *portp); |
688 | static int stli_initopen(stlibrd_t *brdp, stliport_t *portp); | 672 | static int stli_initopen(stlibrd_t *brdp, stliport_t *portp); |
@@ -693,7 +677,8 @@ static void stli_dohangup(void *arg); | |||
693 | static int stli_setport(stliport_t *portp); | 677 | static int stli_setport(stliport_t *portp); |
694 | static int stli_cmdwait(stlibrd_t *brdp, stliport_t *portp, unsigned long cmd, void *arg, int size, int copyback); | 678 | static int stli_cmdwait(stlibrd_t *brdp, stliport_t *portp, unsigned long cmd, void *arg, int size, int copyback); |
695 | static void stli_sendcmd(stlibrd_t *brdp, stliport_t *portp, unsigned long cmd, void *arg, int size, int copyback); | 679 | static void stli_sendcmd(stlibrd_t *brdp, stliport_t *portp, unsigned long cmd, void *arg, int size, int copyback); |
696 | static void stli_dodelaycmd(stliport_t *portp, volatile cdkctrl_t *cp); | 680 | static void __stli_sendcmd(stlibrd_t *brdp, stliport_t *portp, unsigned long cmd, void *arg, int size, int copyback); |
681 | static void stli_dodelaycmd(stliport_t *portp, cdkctrl_t __iomem *cp); | ||
697 | static void stli_mkasyport(stliport_t *portp, asyport_t *pp, struct termios *tiosp); | 682 | static void stli_mkasyport(stliport_t *portp, asyport_t *pp, struct termios *tiosp); |
698 | static void stli_mkasysigs(asysigs_t *sp, int dtr, int rts); | 683 | static void stli_mkasysigs(asysigs_t *sp, int dtr, int rts); |
699 | static long stli_mktiocm(unsigned long sigvalue); | 684 | static long stli_mktiocm(unsigned long sigvalue); |
@@ -763,7 +748,7 @@ static int stli_initpcibrd(int brdtype, struct pci_dev *devp); | |||
763 | * will give access to the shared memory on the Stallion intelligent | 748 | * will give access to the shared memory on the Stallion intelligent |
764 | * board. This is also a very useful debugging tool. | 749 | * board. This is also a very useful debugging tool. |
765 | */ | 750 | */ |
766 | static struct file_operations stli_fsiomem = { | 751 | static const struct file_operations stli_fsiomem = { |
767 | .owner = THIS_MODULE, | 752 | .owner = THIS_MODULE, |
768 | .read = stli_memread, | 753 | .read = stli_memread, |
769 | .write = stli_memwrite, | 754 | .write = stli_memwrite, |
@@ -791,26 +776,14 @@ static int stli_timeron; | |||
791 | 776 | ||
792 | static struct class *istallion_class; | 777 | static struct class *istallion_class; |
793 | 778 | ||
794 | #ifdef MODULE | ||
795 | |||
796 | /* | 779 | /* |
797 | * Loadable module initialization stuff. | 780 | * Loadable module initialization stuff. |
798 | */ | 781 | */ |
799 | 782 | ||
800 | static int __init istallion_module_init(void) | 783 | static int __init istallion_module_init(void) |
801 | { | 784 | { |
802 | unsigned long flags; | ||
803 | |||
804 | #ifdef DEBUG | ||
805 | printk("init_module()\n"); | ||
806 | #endif | ||
807 | |||
808 | save_flags(flags); | ||
809 | cli(); | ||
810 | stli_init(); | 785 | stli_init(); |
811 | restore_flags(flags); | 786 | return 0; |
812 | |||
813 | return(0); | ||
814 | } | 787 | } |
815 | 788 | ||
816 | /*****************************************************************************/ | 789 | /*****************************************************************************/ |
@@ -819,56 +792,43 @@ static void __exit istallion_module_exit(void) | |||
819 | { | 792 | { |
820 | stlibrd_t *brdp; | 793 | stlibrd_t *brdp; |
821 | stliport_t *portp; | 794 | stliport_t *portp; |
822 | unsigned long flags; | ||
823 | int i, j; | 795 | int i, j; |
824 | 796 | ||
825 | #ifdef DEBUG | ||
826 | printk("cleanup_module()\n"); | ||
827 | #endif | ||
828 | |||
829 | printk(KERN_INFO "Unloading %s: version %s\n", stli_drvtitle, | 797 | printk(KERN_INFO "Unloading %s: version %s\n", stli_drvtitle, |
830 | stli_drvversion); | 798 | stli_drvversion); |
831 | 799 | ||
832 | save_flags(flags); | 800 | /* |
833 | cli(); | 801 | * Free up all allocated resources used by the ports. This includes |
834 | 802 | * memory and interrupts. | |
835 | /* | 803 | */ |
836 | * Free up all allocated resources used by the ports. This includes | ||
837 | * memory and interrupts. | ||
838 | */ | ||
839 | if (stli_timeron) { | 804 | if (stli_timeron) { |
840 | stli_timeron = 0; | 805 | stli_timeron = 0; |
841 | del_timer(&stli_timerlist); | 806 | del_timer_sync(&stli_timerlist); |
842 | } | 807 | } |
843 | 808 | ||
844 | i = tty_unregister_driver(stli_serial); | 809 | i = tty_unregister_driver(stli_serial); |
845 | if (i) { | 810 | if (i) { |
846 | printk("STALLION: failed to un-register tty driver, " | 811 | printk("STALLION: failed to un-register tty driver, " |
847 | "errno=%d\n", -i); | 812 | "errno=%d\n", -i); |
848 | restore_flags(flags); | ||
849 | return; | 813 | return; |
850 | } | 814 | } |
851 | put_tty_driver(stli_serial); | 815 | put_tty_driver(stli_serial); |
852 | for (i = 0; i < 4; i++) { | 816 | for (i = 0; i < 4; i++) |
853 | devfs_remove("staliomem/%d", i); | ||
854 | class_device_destroy(istallion_class, MKDEV(STL_SIOMEMMAJOR, i)); | 817 | class_device_destroy(istallion_class, MKDEV(STL_SIOMEMMAJOR, i)); |
855 | } | ||
856 | devfs_remove("staliomem"); | ||
857 | class_destroy(istallion_class); | 818 | class_destroy(istallion_class); |
858 | if ((i = unregister_chrdev(STL_SIOMEMMAJOR, "staliomem"))) | 819 | if ((i = unregister_chrdev(STL_SIOMEMMAJOR, "staliomem"))) |
859 | printk("STALLION: failed to un-register serial memory device, " | 820 | printk("STALLION: failed to un-register serial memory device, " |
860 | "errno=%d\n", -i); | 821 | "errno=%d\n", -i); |
861 | 822 | ||
862 | kfree(stli_tmpwritebuf); | ||
863 | kfree(stli_txcookbuf); | 823 | kfree(stli_txcookbuf); |
864 | 824 | ||
865 | for (i = 0; (i < stli_nrbrds); i++) { | 825 | for (i = 0; (i < stli_nrbrds); i++) { |
866 | if ((brdp = stli_brds[i]) == (stlibrd_t *) NULL) | 826 | if ((brdp = stli_brds[i]) == NULL) |
867 | continue; | 827 | continue; |
868 | for (j = 0; (j < STL_MAXPORTS); j++) { | 828 | for (j = 0; (j < STL_MAXPORTS); j++) { |
869 | portp = brdp->ports[j]; | 829 | portp = brdp->ports[j]; |
870 | if (portp != (stliport_t *) NULL) { | 830 | if (portp != NULL) { |
871 | if (portp->tty != (struct tty_struct *) NULL) | 831 | if (portp->tty != NULL) |
872 | tty_hangup(portp->tty); | 832 | tty_hangup(portp->tty); |
873 | kfree(portp); | 833 | kfree(portp); |
874 | } | 834 | } |
@@ -878,10 +838,8 @@ static void __exit istallion_module_exit(void) | |||
878 | if (brdp->iosize > 0) | 838 | if (brdp->iosize > 0) |
879 | release_region(brdp->iobase, brdp->iosize); | 839 | release_region(brdp->iobase, brdp->iosize); |
880 | kfree(brdp); | 840 | kfree(brdp); |
881 | stli_brds[i] = (stlibrd_t *) NULL; | 841 | stli_brds[i] = NULL; |
882 | } | 842 | } |
883 | |||
884 | restore_flags(flags); | ||
885 | } | 843 | } |
886 | 844 | ||
887 | module_init(istallion_module_init); | 845 | module_init(istallion_module_init); |
@@ -895,19 +853,15 @@ module_exit(istallion_module_exit); | |||
895 | 853 | ||
896 | static void stli_argbrds(void) | 854 | static void stli_argbrds(void) |
897 | { | 855 | { |
898 | stlconf_t conf; | 856 | stlconf_t conf; |
899 | stlibrd_t *brdp; | 857 | stlibrd_t *brdp; |
900 | int i; | 858 | int i; |
901 | |||
902 | #ifdef DEBUG | ||
903 | printk("stli_argbrds()\n"); | ||
904 | #endif | ||
905 | 859 | ||
906 | for (i = stli_nrbrds; i < ARRAY_SIZE(stli_brdsp); i++) { | 860 | for (i = stli_nrbrds; i < ARRAY_SIZE(stli_brdsp); i++) { |
907 | memset(&conf, 0, sizeof(conf)); | 861 | memset(&conf, 0, sizeof(conf)); |
908 | if (stli_parsebrd(&conf, stli_brdsp[i]) == 0) | 862 | if (stli_parsebrd(&conf, stli_brdsp[i]) == 0) |
909 | continue; | 863 | continue; |
910 | if ((brdp = stli_allocbrd()) == (stlibrd_t *) NULL) | 864 | if ((brdp = stli_allocbrd()) == NULL) |
911 | continue; | 865 | continue; |
912 | stli_nrbrds = i + 1; | 866 | stli_nrbrds = i + 1; |
913 | brdp->brdnr = i; | 867 | brdp->brdnr = i; |
@@ -926,9 +880,9 @@ static void stli_argbrds(void) | |||
926 | 880 | ||
927 | static unsigned long stli_atol(char *str) | 881 | static unsigned long stli_atol(char *str) |
928 | { | 882 | { |
929 | unsigned long val; | 883 | unsigned long val; |
930 | int base, c; | 884 | int base, c; |
931 | char *sp; | 885 | char *sp; |
932 | 886 | ||
933 | val = 0; | 887 | val = 0; |
934 | sp = str; | 888 | sp = str; |
@@ -962,15 +916,11 @@ static unsigned long stli_atol(char *str) | |||
962 | 916 | ||
963 | static int stli_parsebrd(stlconf_t *confp, char **argp) | 917 | static int stli_parsebrd(stlconf_t *confp, char **argp) |
964 | { | 918 | { |
965 | char *sp; | 919 | char *sp; |
966 | int i; | 920 | int i; |
967 | |||
968 | #ifdef DEBUG | ||
969 | printk("stli_parsebrd(confp=%x,argp=%x)\n", (int) confp, (int) argp); | ||
970 | #endif | ||
971 | 921 | ||
972 | if ((argp[0] == (char *) NULL) || (*argp[0] == 0)) | 922 | if (argp[0] == NULL || *argp[0] == 0) |
973 | return(0); | 923 | return 0; |
974 | 924 | ||
975 | for (sp = argp[0], i = 0; ((*sp != 0) && (i < 25)); sp++, i++) | 925 | for (sp = argp[0], i = 0; ((*sp != 0) && (i < 25)); sp++, i++) |
976 | *sp = TOLOWER(*sp); | 926 | *sp = TOLOWER(*sp); |
@@ -985,47 +935,40 @@ static int stli_parsebrd(stlconf_t *confp, char **argp) | |||
985 | } | 935 | } |
986 | 936 | ||
987 | confp->brdtype = stli_brdstr[i].type; | 937 | confp->brdtype = stli_brdstr[i].type; |
988 | if ((argp[1] != (char *) NULL) && (*argp[1] != 0)) | 938 | if (argp[1] != NULL && *argp[1] != 0) |
989 | confp->ioaddr1 = stli_atol(argp[1]); | 939 | confp->ioaddr1 = stli_atol(argp[1]); |
990 | if ((argp[2] != (char *) NULL) && (*argp[2] != 0)) | 940 | if (argp[2] != NULL && *argp[2] != 0) |
991 | confp->memaddr = stli_atol(argp[2]); | 941 | confp->memaddr = stli_atol(argp[2]); |
992 | return(1); | 942 | return(1); |
993 | } | 943 | } |
994 | 944 | ||
995 | #endif | ||
996 | |||
997 | /*****************************************************************************/ | 945 | /*****************************************************************************/ |
998 | 946 | ||
999 | static int stli_open(struct tty_struct *tty, struct file *filp) | 947 | static int stli_open(struct tty_struct *tty, struct file *filp) |
1000 | { | 948 | { |
1001 | stlibrd_t *brdp; | 949 | stlibrd_t *brdp; |
1002 | stliport_t *portp; | 950 | stliport_t *portp; |
1003 | unsigned int minordev; | 951 | unsigned int minordev; |
1004 | int brdnr, portnr, rc; | 952 | int brdnr, portnr, rc; |
1005 | |||
1006 | #ifdef DEBUG | ||
1007 | printk("stli_open(tty=%x,filp=%x): device=%s\n", (int) tty, | ||
1008 | (int) filp, tty->name); | ||
1009 | #endif | ||
1010 | 953 | ||
1011 | minordev = tty->index; | 954 | minordev = tty->index; |
1012 | brdnr = MINOR2BRD(minordev); | 955 | brdnr = MINOR2BRD(minordev); |
1013 | if (brdnr >= stli_nrbrds) | 956 | if (brdnr >= stli_nrbrds) |
1014 | return(-ENODEV); | 957 | return -ENODEV; |
1015 | brdp = stli_brds[brdnr]; | 958 | brdp = stli_brds[brdnr]; |
1016 | if (brdp == (stlibrd_t *) NULL) | 959 | if (brdp == NULL) |
1017 | return(-ENODEV); | 960 | return -ENODEV; |
1018 | if ((brdp->state & BST_STARTED) == 0) | 961 | if ((brdp->state & BST_STARTED) == 0) |
1019 | return(-ENODEV); | 962 | return -ENODEV; |
1020 | portnr = MINOR2PORT(minordev); | 963 | portnr = MINOR2PORT(minordev); |
1021 | if ((portnr < 0) || (portnr > brdp->nrports)) | 964 | if ((portnr < 0) || (portnr > brdp->nrports)) |
1022 | return(-ENODEV); | 965 | return -ENODEV; |
1023 | 966 | ||
1024 | portp = brdp->ports[portnr]; | 967 | portp = brdp->ports[portnr]; |
1025 | if (portp == (stliport_t *) NULL) | 968 | if (portp == NULL) |
1026 | return(-ENODEV); | 969 | return -ENODEV; |
1027 | if (portp->devnr < 1) | 970 | if (portp->devnr < 1) |
1028 | return(-ENODEV); | 971 | return -ENODEV; |
1029 | 972 | ||
1030 | 973 | ||
1031 | /* | 974 | /* |
@@ -1037,8 +980,8 @@ static int stli_open(struct tty_struct *tty, struct file *filp) | |||
1037 | if (portp->flags & ASYNC_CLOSING) { | 980 | if (portp->flags & ASYNC_CLOSING) { |
1038 | interruptible_sleep_on(&portp->close_wait); | 981 | interruptible_sleep_on(&portp->close_wait); |
1039 | if (portp->flags & ASYNC_HUP_NOTIFY) | 982 | if (portp->flags & ASYNC_HUP_NOTIFY) |
1040 | return(-EAGAIN); | 983 | return -EAGAIN; |
1041 | return(-ERESTARTSYS); | 984 | return -ERESTARTSYS; |
1042 | } | 985 | } |
1043 | 986 | ||
1044 | /* | 987 | /* |
@@ -1054,7 +997,7 @@ static int stli_open(struct tty_struct *tty, struct file *filp) | |||
1054 | wait_event_interruptible(portp->raw_wait, | 997 | wait_event_interruptible(portp->raw_wait, |
1055 | !test_bit(ST_INITIALIZING, &portp->state)); | 998 | !test_bit(ST_INITIALIZING, &portp->state)); |
1056 | if (signal_pending(current)) | 999 | if (signal_pending(current)) |
1057 | return(-ERESTARTSYS); | 1000 | return -ERESTARTSYS; |
1058 | 1001 | ||
1059 | if ((portp->flags & ASYNC_INITIALIZED) == 0) { | 1002 | if ((portp->flags & ASYNC_INITIALIZED) == 0) { |
1060 | set_bit(ST_INITIALIZING, &portp->state); | 1003 | set_bit(ST_INITIALIZING, &portp->state); |
@@ -1065,7 +1008,7 @@ static int stli_open(struct tty_struct *tty, struct file *filp) | |||
1065 | clear_bit(ST_INITIALIZING, &portp->state); | 1008 | clear_bit(ST_INITIALIZING, &portp->state); |
1066 | wake_up_interruptible(&portp->raw_wait); | 1009 | wake_up_interruptible(&portp->raw_wait); |
1067 | if (rc < 0) | 1010 | if (rc < 0) |
1068 | return(rc); | 1011 | return rc; |
1069 | } | 1012 | } |
1070 | 1013 | ||
1071 | /* | 1014 | /* |
@@ -1077,8 +1020,8 @@ static int stli_open(struct tty_struct *tty, struct file *filp) | |||
1077 | if (portp->flags & ASYNC_CLOSING) { | 1020 | if (portp->flags & ASYNC_CLOSING) { |
1078 | interruptible_sleep_on(&portp->close_wait); | 1021 | interruptible_sleep_on(&portp->close_wait); |
1079 | if (portp->flags & ASYNC_HUP_NOTIFY) | 1022 | if (portp->flags & ASYNC_HUP_NOTIFY) |
1080 | return(-EAGAIN); | 1023 | return -EAGAIN; |
1081 | return(-ERESTARTSYS); | 1024 | return -ERESTARTSYS; |
1082 | } | 1025 | } |
1083 | 1026 | ||
1084 | /* | 1027 | /* |
@@ -1088,38 +1031,33 @@ static int stli_open(struct tty_struct *tty, struct file *filp) | |||
1088 | */ | 1031 | */ |
1089 | if (!(filp->f_flags & O_NONBLOCK)) { | 1032 | if (!(filp->f_flags & O_NONBLOCK)) { |
1090 | if ((rc = stli_waitcarrier(brdp, portp, filp)) != 0) | 1033 | if ((rc = stli_waitcarrier(brdp, portp, filp)) != 0) |
1091 | return(rc); | 1034 | return rc; |
1092 | } | 1035 | } |
1093 | portp->flags |= ASYNC_NORMAL_ACTIVE; | 1036 | portp->flags |= ASYNC_NORMAL_ACTIVE; |
1094 | return(0); | 1037 | return 0; |
1095 | } | 1038 | } |
1096 | 1039 | ||
1097 | /*****************************************************************************/ | 1040 | /*****************************************************************************/ |
1098 | 1041 | ||
1099 | static void stli_close(struct tty_struct *tty, struct file *filp) | 1042 | static void stli_close(struct tty_struct *tty, struct file *filp) |
1100 | { | 1043 | { |
1101 | stlibrd_t *brdp; | 1044 | stlibrd_t *brdp; |
1102 | stliport_t *portp; | 1045 | stliport_t *portp; |
1103 | unsigned long flags; | 1046 | unsigned long flags; |
1104 | |||
1105 | #ifdef DEBUG | ||
1106 | printk("stli_close(tty=%x,filp=%x)\n", (int) tty, (int) filp); | ||
1107 | #endif | ||
1108 | 1047 | ||
1109 | portp = tty->driver_data; | 1048 | portp = tty->driver_data; |
1110 | if (portp == (stliport_t *) NULL) | 1049 | if (portp == NULL) |
1111 | return; | 1050 | return; |
1112 | 1051 | ||
1113 | save_flags(flags); | 1052 | spin_lock_irqsave(&stli_lock, flags); |
1114 | cli(); | ||
1115 | if (tty_hung_up_p(filp)) { | 1053 | if (tty_hung_up_p(filp)) { |
1116 | restore_flags(flags); | 1054 | spin_unlock_irqrestore(&stli_lock, flags); |
1117 | return; | 1055 | return; |
1118 | } | 1056 | } |
1119 | if ((tty->count == 1) && (portp->refcount != 1)) | 1057 | if ((tty->count == 1) && (portp->refcount != 1)) |
1120 | portp->refcount = 1; | 1058 | portp->refcount = 1; |
1121 | if (portp->refcount-- > 1) { | 1059 | if (portp->refcount-- > 1) { |
1122 | restore_flags(flags); | 1060 | spin_unlock_irqrestore(&stli_lock, flags); |
1123 | return; | 1061 | return; |
1124 | } | 1062 | } |
1125 | 1063 | ||
@@ -1134,6 +1072,8 @@ static void stli_close(struct tty_struct *tty, struct file *filp) | |||
1134 | if (tty == stli_txcooktty) | 1072 | if (tty == stli_txcooktty) |
1135 | stli_flushchars(tty); | 1073 | stli_flushchars(tty); |
1136 | tty->closing = 1; | 1074 | tty->closing = 1; |
1075 | spin_unlock_irqrestore(&stli_lock, flags); | ||
1076 | |||
1137 | if (portp->closing_wait != ASYNC_CLOSING_WAIT_NONE) | 1077 | if (portp->closing_wait != ASYNC_CLOSING_WAIT_NONE) |
1138 | tty_wait_until_sent(tty, portp->closing_wait); | 1078 | tty_wait_until_sent(tty, portp->closing_wait); |
1139 | 1079 | ||
@@ -1157,7 +1097,7 @@ static void stli_close(struct tty_struct *tty, struct file *filp) | |||
1157 | stli_flushbuffer(tty); | 1097 | stli_flushbuffer(tty); |
1158 | 1098 | ||
1159 | tty->closing = 0; | 1099 | tty->closing = 0; |
1160 | portp->tty = (struct tty_struct *) NULL; | 1100 | portp->tty = NULL; |
1161 | 1101 | ||
1162 | if (portp->openwaitcnt) { | 1102 | if (portp->openwaitcnt) { |
1163 | if (portp->close_delay) | 1103 | if (portp->close_delay) |
@@ -1167,7 +1107,6 @@ static void stli_close(struct tty_struct *tty, struct file *filp) | |||
1167 | 1107 | ||
1168 | portp->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING); | 1108 | portp->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING); |
1169 | wake_up_interruptible(&portp->close_wait); | 1109 | wake_up_interruptible(&portp->close_wait); |
1170 | restore_flags(flags); | ||
1171 | } | 1110 | } |
1172 | 1111 | ||
1173 | /*****************************************************************************/ | 1112 | /*****************************************************************************/ |
@@ -1182,45 +1121,41 @@ static void stli_close(struct tty_struct *tty, struct file *filp) | |||
1182 | 1121 | ||
1183 | static int stli_initopen(stlibrd_t *brdp, stliport_t *portp) | 1122 | static int stli_initopen(stlibrd_t *brdp, stliport_t *portp) |
1184 | { | 1123 | { |
1185 | struct tty_struct *tty; | 1124 | struct tty_struct *tty; |
1186 | asynotify_t nt; | 1125 | asynotify_t nt; |
1187 | asyport_t aport; | 1126 | asyport_t aport; |
1188 | int rc; | 1127 | int rc; |
1189 | |||
1190 | #ifdef DEBUG | ||
1191 | printk("stli_initopen(brdp=%x,portp=%x)\n", (int) brdp, (int) portp); | ||
1192 | #endif | ||
1193 | 1128 | ||
1194 | if ((rc = stli_rawopen(brdp, portp, 0, 1)) < 0) | 1129 | if ((rc = stli_rawopen(brdp, portp, 0, 1)) < 0) |
1195 | return(rc); | 1130 | return rc; |
1196 | 1131 | ||
1197 | memset(&nt, 0, sizeof(asynotify_t)); | 1132 | memset(&nt, 0, sizeof(asynotify_t)); |
1198 | nt.data = (DT_TXLOW | DT_TXEMPTY | DT_RXBUSY | DT_RXBREAK); | 1133 | nt.data = (DT_TXLOW | DT_TXEMPTY | DT_RXBUSY | DT_RXBREAK); |
1199 | nt.signal = SG_DCD; | 1134 | nt.signal = SG_DCD; |
1200 | if ((rc = stli_cmdwait(brdp, portp, A_SETNOTIFY, &nt, | 1135 | if ((rc = stli_cmdwait(brdp, portp, A_SETNOTIFY, &nt, |
1201 | sizeof(asynotify_t), 0)) < 0) | 1136 | sizeof(asynotify_t), 0)) < 0) |
1202 | return(rc); | 1137 | return rc; |
1203 | 1138 | ||
1204 | tty = portp->tty; | 1139 | tty = portp->tty; |
1205 | if (tty == (struct tty_struct *) NULL) | 1140 | if (tty == NULL) |
1206 | return(-ENODEV); | 1141 | return -ENODEV; |
1207 | stli_mkasyport(portp, &aport, tty->termios); | 1142 | stli_mkasyport(portp, &aport, tty->termios); |
1208 | if ((rc = stli_cmdwait(brdp, portp, A_SETPORT, &aport, | 1143 | if ((rc = stli_cmdwait(brdp, portp, A_SETPORT, &aport, |
1209 | sizeof(asyport_t), 0)) < 0) | 1144 | sizeof(asyport_t), 0)) < 0) |
1210 | return(rc); | 1145 | return rc; |
1211 | 1146 | ||
1212 | set_bit(ST_GETSIGS, &portp->state); | 1147 | set_bit(ST_GETSIGS, &portp->state); |
1213 | if ((rc = stli_cmdwait(brdp, portp, A_GETSIGNALS, &portp->asig, | 1148 | if ((rc = stli_cmdwait(brdp, portp, A_GETSIGNALS, &portp->asig, |
1214 | sizeof(asysigs_t), 1)) < 0) | 1149 | sizeof(asysigs_t), 1)) < 0) |
1215 | return(rc); | 1150 | return rc; |
1216 | if (test_and_clear_bit(ST_GETSIGS, &portp->state)) | 1151 | if (test_and_clear_bit(ST_GETSIGS, &portp->state)) |
1217 | portp->sigs = stli_mktiocm(portp->asig.sigvalue); | 1152 | portp->sigs = stli_mktiocm(portp->asig.sigvalue); |
1218 | stli_mkasysigs(&portp->asig, 1, 1); | 1153 | stli_mkasysigs(&portp->asig, 1, 1); |
1219 | if ((rc = stli_cmdwait(brdp, portp, A_SETSIGNALS, &portp->asig, | 1154 | if ((rc = stli_cmdwait(brdp, portp, A_SETSIGNALS, &portp->asig, |
1220 | sizeof(asysigs_t), 0)) < 0) | 1155 | sizeof(asysigs_t), 0)) < 0) |
1221 | return(rc); | 1156 | return rc; |
1222 | 1157 | ||
1223 | return(0); | 1158 | return 0; |
1224 | } | 1159 | } |
1225 | 1160 | ||
1226 | /*****************************************************************************/ | 1161 | /*****************************************************************************/ |
@@ -1234,22 +1169,15 @@ static int stli_initopen(stlibrd_t *brdp, stliport_t *portp) | |||
1234 | 1169 | ||
1235 | static int stli_rawopen(stlibrd_t *brdp, stliport_t *portp, unsigned long arg, int wait) | 1170 | static int stli_rawopen(stlibrd_t *brdp, stliport_t *portp, unsigned long arg, int wait) |
1236 | { | 1171 | { |
1237 | volatile cdkhdr_t *hdrp; | 1172 | cdkhdr_t __iomem *hdrp; |
1238 | volatile cdkctrl_t *cp; | 1173 | cdkctrl_t __iomem *cp; |
1239 | volatile unsigned char *bits; | 1174 | unsigned char __iomem *bits; |
1240 | unsigned long flags; | 1175 | unsigned long flags; |
1241 | int rc; | 1176 | int rc; |
1242 | |||
1243 | #ifdef DEBUG | ||
1244 | printk("stli_rawopen(brdp=%x,portp=%x,arg=%x,wait=%d)\n", | ||
1245 | (int) brdp, (int) portp, (int) arg, wait); | ||
1246 | #endif | ||
1247 | 1177 | ||
1248 | /* | 1178 | /* |
1249 | * Send a message to the slave to open this port. | 1179 | * Send a message to the slave to open this port. |
1250 | */ | 1180 | */ |
1251 | save_flags(flags); | ||
1252 | cli(); | ||
1253 | 1181 | ||
1254 | /* | 1182 | /* |
1255 | * Slave is already closing this port. This can happen if a hangup | 1183 | * Slave is already closing this port. This can happen if a hangup |
@@ -1260,7 +1188,6 @@ static int stli_rawopen(stlibrd_t *brdp, stliport_t *portp, unsigned long arg, i | |||
1260 | wait_event_interruptible(portp->raw_wait, | 1188 | wait_event_interruptible(portp->raw_wait, |
1261 | !test_bit(ST_CLOSING, &portp->state)); | 1189 | !test_bit(ST_CLOSING, &portp->state)); |
1262 | if (signal_pending(current)) { | 1190 | if (signal_pending(current)) { |
1263 | restore_flags(flags); | ||
1264 | return -ERESTARTSYS; | 1191 | return -ERESTARTSYS; |
1265 | } | 1192 | } |
1266 | 1193 | ||
@@ -1269,19 +1196,20 @@ static int stli_rawopen(stlibrd_t *brdp, stliport_t *portp, unsigned long arg, i | |||
1269 | * memory. Once the message is in set the service bits to say that | 1196 | * memory. Once the message is in set the service bits to say that |
1270 | * this port wants service. | 1197 | * this port wants service. |
1271 | */ | 1198 | */ |
1199 | spin_lock_irqsave(&brd_lock, flags); | ||
1272 | EBRDENABLE(brdp); | 1200 | EBRDENABLE(brdp); |
1273 | cp = &((volatile cdkasy_t *) EBRDGETMEMPTR(brdp, portp->addr))->ctrl; | 1201 | cp = &((cdkasy_t __iomem *) EBRDGETMEMPTR(brdp, portp->addr))->ctrl; |
1274 | cp->openarg = arg; | 1202 | writel(arg, &cp->openarg); |
1275 | cp->open = 1; | 1203 | writeb(1, &cp->open); |
1276 | hdrp = (volatile cdkhdr_t *) EBRDGETMEMPTR(brdp, CDK_CDKADDR); | 1204 | hdrp = (cdkhdr_t __iomem *) EBRDGETMEMPTR(brdp, CDK_CDKADDR); |
1277 | bits = ((volatile unsigned char *) hdrp) + brdp->slaveoffset + | 1205 | bits = ((unsigned char __iomem *) hdrp) + brdp->slaveoffset + |
1278 | portp->portidx; | 1206 | portp->portidx; |
1279 | *bits |= portp->portbit; | 1207 | writeb(readb(bits) | portp->portbit, bits); |
1280 | EBRDDISABLE(brdp); | 1208 | EBRDDISABLE(brdp); |
1281 | 1209 | ||
1282 | if (wait == 0) { | 1210 | if (wait == 0) { |
1283 | restore_flags(flags); | 1211 | spin_unlock_irqrestore(&brd_lock, flags); |
1284 | return(0); | 1212 | return 0; |
1285 | } | 1213 | } |
1286 | 1214 | ||
1287 | /* | 1215 | /* |
@@ -1290,15 +1218,16 @@ static int stli_rawopen(stlibrd_t *brdp, stliport_t *portp, unsigned long arg, i | |||
1290 | */ | 1218 | */ |
1291 | rc = 0; | 1219 | rc = 0; |
1292 | set_bit(ST_OPENING, &portp->state); | 1220 | set_bit(ST_OPENING, &portp->state); |
1221 | spin_unlock_irqrestore(&brd_lock, flags); | ||
1222 | |||
1293 | wait_event_interruptible(portp->raw_wait, | 1223 | wait_event_interruptible(portp->raw_wait, |
1294 | !test_bit(ST_OPENING, &portp->state)); | 1224 | !test_bit(ST_OPENING, &portp->state)); |
1295 | if (signal_pending(current)) | 1225 | if (signal_pending(current)) |
1296 | rc = -ERESTARTSYS; | 1226 | rc = -ERESTARTSYS; |
1297 | restore_flags(flags); | ||
1298 | 1227 | ||
1299 | if ((rc == 0) && (portp->rc != 0)) | 1228 | if ((rc == 0) && (portp->rc != 0)) |
1300 | rc = -EIO; | 1229 | rc = -EIO; |
1301 | return(rc); | 1230 | return rc; |
1302 | } | 1231 | } |
1303 | 1232 | ||
1304 | /*****************************************************************************/ | 1233 | /*****************************************************************************/ |
@@ -1311,19 +1240,11 @@ static int stli_rawopen(stlibrd_t *brdp, stliport_t *portp, unsigned long arg, i | |||
1311 | 1240 | ||
1312 | static int stli_rawclose(stlibrd_t *brdp, stliport_t *portp, unsigned long arg, int wait) | 1241 | static int stli_rawclose(stlibrd_t *brdp, stliport_t *portp, unsigned long arg, int wait) |
1313 | { | 1242 | { |
1314 | volatile cdkhdr_t *hdrp; | 1243 | cdkhdr_t __iomem *hdrp; |
1315 | volatile cdkctrl_t *cp; | 1244 | cdkctrl_t __iomem *cp; |
1316 | volatile unsigned char *bits; | 1245 | unsigned char __iomem *bits; |
1317 | unsigned long flags; | 1246 | unsigned long flags; |
1318 | int rc; | 1247 | int rc; |
1319 | |||
1320 | #ifdef DEBUG | ||
1321 | printk("stli_rawclose(brdp=%x,portp=%x,arg=%x,wait=%d)\n", | ||
1322 | (int) brdp, (int) portp, (int) arg, wait); | ||
1323 | #endif | ||
1324 | |||
1325 | save_flags(flags); | ||
1326 | cli(); | ||
1327 | 1248 | ||
1328 | /* | 1249 | /* |
1329 | * Slave is already closing this port. This can happen if a hangup | 1250 | * Slave is already closing this port. This can happen if a hangup |
@@ -1333,7 +1254,6 @@ static int stli_rawclose(stlibrd_t *brdp, stliport_t *portp, unsigned long arg, | |||
1333 | wait_event_interruptible(portp->raw_wait, | 1254 | wait_event_interruptible(portp->raw_wait, |
1334 | !test_bit(ST_CLOSING, &portp->state)); | 1255 | !test_bit(ST_CLOSING, &portp->state)); |
1335 | if (signal_pending(current)) { | 1256 | if (signal_pending(current)) { |
1336 | restore_flags(flags); | ||
1337 | return -ERESTARTSYS; | 1257 | return -ERESTARTSYS; |
1338 | } | 1258 | } |
1339 | } | 1259 | } |
@@ -1341,21 +1261,22 @@ static int stli_rawclose(stlibrd_t *brdp, stliport_t *portp, unsigned long arg, | |||
1341 | /* | 1261 | /* |
1342 | * Write the close command into shared memory. | 1262 | * Write the close command into shared memory. |
1343 | */ | 1263 | */ |
1264 | spin_lock_irqsave(&brd_lock, flags); | ||
1344 | EBRDENABLE(brdp); | 1265 | EBRDENABLE(brdp); |
1345 | cp = &((volatile cdkasy_t *) EBRDGETMEMPTR(brdp, portp->addr))->ctrl; | 1266 | cp = &((cdkasy_t __iomem *) EBRDGETMEMPTR(brdp, portp->addr))->ctrl; |
1346 | cp->closearg = arg; | 1267 | writel(arg, &cp->closearg); |
1347 | cp->close = 1; | 1268 | writeb(1, &cp->close); |
1348 | hdrp = (volatile cdkhdr_t *) EBRDGETMEMPTR(brdp, CDK_CDKADDR); | 1269 | hdrp = (cdkhdr_t __iomem *) EBRDGETMEMPTR(brdp, CDK_CDKADDR); |
1349 | bits = ((volatile unsigned char *) hdrp) + brdp->slaveoffset + | 1270 | bits = ((unsigned char __iomem *) hdrp) + brdp->slaveoffset + |
1350 | portp->portidx; | 1271 | portp->portidx; |
1351 | *bits |= portp->portbit; | 1272 | writeb(readb(bits) |portp->portbit, bits); |
1352 | EBRDDISABLE(brdp); | 1273 | EBRDDISABLE(brdp); |
1353 | 1274 | ||
1354 | set_bit(ST_CLOSING, &portp->state); | 1275 | set_bit(ST_CLOSING, &portp->state); |
1355 | if (wait == 0) { | 1276 | spin_unlock_irqrestore(&brd_lock, flags); |
1356 | restore_flags(flags); | 1277 | |
1357 | return(0); | 1278 | if (wait == 0) |
1358 | } | 1279 | return 0; |
1359 | 1280 | ||
1360 | /* | 1281 | /* |
1361 | * Slave is in action, so now we must wait for the open acknowledgment | 1282 | * Slave is in action, so now we must wait for the open acknowledgment |
@@ -1366,11 +1287,10 @@ static int stli_rawclose(stlibrd_t *brdp, stliport_t *portp, unsigned long arg, | |||
1366 | !test_bit(ST_CLOSING, &portp->state)); | 1287 | !test_bit(ST_CLOSING, &portp->state)); |
1367 | if (signal_pending(current)) | 1288 | if (signal_pending(current)) |
1368 | rc = -ERESTARTSYS; | 1289 | rc = -ERESTARTSYS; |
1369 | restore_flags(flags); | ||
1370 | 1290 | ||
1371 | if ((rc == 0) && (portp->rc != 0)) | 1291 | if ((rc == 0) && (portp->rc != 0)) |
1372 | rc = -EIO; | 1292 | rc = -EIO; |
1373 | return(rc); | 1293 | return rc; |
1374 | } | 1294 | } |
1375 | 1295 | ||
1376 | /*****************************************************************************/ | 1296 | /*****************************************************************************/ |
@@ -1384,36 +1304,21 @@ static int stli_rawclose(stlibrd_t *brdp, stliport_t *portp, unsigned long arg, | |||
1384 | 1304 | ||
1385 | static int stli_cmdwait(stlibrd_t *brdp, stliport_t *portp, unsigned long cmd, void *arg, int size, int copyback) | 1305 | static int stli_cmdwait(stlibrd_t *brdp, stliport_t *portp, unsigned long cmd, void *arg, int size, int copyback) |
1386 | { | 1306 | { |
1387 | unsigned long flags; | ||
1388 | |||
1389 | #ifdef DEBUG | ||
1390 | printk("stli_cmdwait(brdp=%x,portp=%x,cmd=%x,arg=%x,size=%d," | ||
1391 | "copyback=%d)\n", (int) brdp, (int) portp, (int) cmd, | ||
1392 | (int) arg, size, copyback); | ||
1393 | #endif | ||
1394 | |||
1395 | save_flags(flags); | ||
1396 | cli(); | ||
1397 | wait_event_interruptible(portp->raw_wait, | 1307 | wait_event_interruptible(portp->raw_wait, |
1398 | !test_bit(ST_CMDING, &portp->state)); | 1308 | !test_bit(ST_CMDING, &portp->state)); |
1399 | if (signal_pending(current)) { | 1309 | if (signal_pending(current)) |
1400 | restore_flags(flags); | ||
1401 | return -ERESTARTSYS; | 1310 | return -ERESTARTSYS; |
1402 | } | ||
1403 | 1311 | ||
1404 | stli_sendcmd(brdp, portp, cmd, arg, size, copyback); | 1312 | stli_sendcmd(brdp, portp, cmd, arg, size, copyback); |
1405 | 1313 | ||
1406 | wait_event_interruptible(portp->raw_wait, | 1314 | wait_event_interruptible(portp->raw_wait, |
1407 | !test_bit(ST_CMDING, &portp->state)); | 1315 | !test_bit(ST_CMDING, &portp->state)); |
1408 | if (signal_pending(current)) { | 1316 | if (signal_pending(current)) |
1409 | restore_flags(flags); | ||
1410 | return -ERESTARTSYS; | 1317 | return -ERESTARTSYS; |
1411 | } | ||
1412 | restore_flags(flags); | ||
1413 | 1318 | ||
1414 | if (portp->rc != 0) | 1319 | if (portp->rc != 0) |
1415 | return(-EIO); | 1320 | return -EIO; |
1416 | return(0); | 1321 | return 0; |
1417 | } | 1322 | } |
1418 | 1323 | ||
1419 | /*****************************************************************************/ | 1324 | /*****************************************************************************/ |
@@ -1425,22 +1330,18 @@ static int stli_cmdwait(stlibrd_t *brdp, stliport_t *portp, unsigned long cmd, v | |||
1425 | 1330 | ||
1426 | static int stli_setport(stliport_t *portp) | 1331 | static int stli_setport(stliport_t *portp) |
1427 | { | 1332 | { |
1428 | stlibrd_t *brdp; | 1333 | stlibrd_t *brdp; |
1429 | asyport_t aport; | 1334 | asyport_t aport; |
1430 | |||
1431 | #ifdef DEBUG | ||
1432 | printk("stli_setport(portp=%x)\n", (int) portp); | ||
1433 | #endif | ||
1434 | 1335 | ||
1435 | if (portp == (stliport_t *) NULL) | 1336 | if (portp == NULL) |
1436 | return(-ENODEV); | 1337 | return -ENODEV; |
1437 | if (portp->tty == (struct tty_struct *) NULL) | 1338 | if (portp->tty == NULL) |
1438 | return(-ENODEV); | 1339 | return -ENODEV; |
1439 | if ((portp->brdnr < 0) && (portp->brdnr >= stli_nrbrds)) | 1340 | if (portp->brdnr < 0 && portp->brdnr >= stli_nrbrds) |
1440 | return(-ENODEV); | 1341 | return -ENODEV; |
1441 | brdp = stli_brds[portp->brdnr]; | 1342 | brdp = stli_brds[portp->brdnr]; |
1442 | if (brdp == (stlibrd_t *) NULL) | 1343 | if (brdp == NULL) |
1443 | return(-ENODEV); | 1344 | return -ENODEV; |
1444 | 1345 | ||
1445 | stli_mkasyport(portp, &aport, portp->tty->termios); | 1346 | stli_mkasyport(portp, &aport, portp->tty->termios); |
1446 | return(stli_cmdwait(brdp, portp, A_SETPORT, &aport, sizeof(asyport_t), 0)); | 1347 | return(stli_cmdwait(brdp, portp, A_SETPORT, &aport, sizeof(asyport_t), 0)); |
@@ -1455,13 +1356,8 @@ static int stli_setport(stliport_t *portp) | |||
1455 | 1356 | ||
1456 | static int stli_waitcarrier(stlibrd_t *brdp, stliport_t *portp, struct file *filp) | 1357 | static int stli_waitcarrier(stlibrd_t *brdp, stliport_t *portp, struct file *filp) |
1457 | { | 1358 | { |
1458 | unsigned long flags; | 1359 | unsigned long flags; |
1459 | int rc, doclocal; | 1360 | int rc, doclocal; |
1460 | |||
1461 | #ifdef DEBUG | ||
1462 | printk("stli_waitcarrier(brdp=%x,portp=%x,filp=%x)\n", | ||
1463 | (int) brdp, (int) portp, (int) filp); | ||
1464 | #endif | ||
1465 | 1361 | ||
1466 | rc = 0; | 1362 | rc = 0; |
1467 | doclocal = 0; | 1363 | doclocal = 0; |
@@ -1469,11 +1365,11 @@ static int stli_waitcarrier(stlibrd_t *brdp, stliport_t *portp, struct file *fil | |||
1469 | if (portp->tty->termios->c_cflag & CLOCAL) | 1365 | if (portp->tty->termios->c_cflag & CLOCAL) |
1470 | doclocal++; | 1366 | doclocal++; |
1471 | 1367 | ||
1472 | save_flags(flags); | 1368 | spin_lock_irqsave(&stli_lock, flags); |
1473 | cli(); | ||
1474 | portp->openwaitcnt++; | 1369 | portp->openwaitcnt++; |
1475 | if (! tty_hung_up_p(filp)) | 1370 | if (! tty_hung_up_p(filp)) |
1476 | portp->refcount--; | 1371 | portp->refcount--; |
1372 | spin_unlock_irqrestore(&stli_lock, flags); | ||
1477 | 1373 | ||
1478 | for (;;) { | 1374 | for (;;) { |
1479 | stli_mkasysigs(&portp->asig, 1, 1); | 1375 | stli_mkasysigs(&portp->asig, 1, 1); |
@@ -1499,12 +1395,13 @@ static int stli_waitcarrier(stlibrd_t *brdp, stliport_t *portp, struct file *fil | |||
1499 | interruptible_sleep_on(&portp->open_wait); | 1395 | interruptible_sleep_on(&portp->open_wait); |
1500 | } | 1396 | } |
1501 | 1397 | ||
1398 | spin_lock_irqsave(&stli_lock, flags); | ||
1502 | if (! tty_hung_up_p(filp)) | 1399 | if (! tty_hung_up_p(filp)) |
1503 | portp->refcount++; | 1400 | portp->refcount++; |
1504 | portp->openwaitcnt--; | 1401 | portp->openwaitcnt--; |
1505 | restore_flags(flags); | 1402 | spin_unlock_irqrestore(&stli_lock, flags); |
1506 | 1403 | ||
1507 | return(rc); | 1404 | return rc; |
1508 | } | 1405 | } |
1509 | 1406 | ||
1510 | /*****************************************************************************/ | 1407 | /*****************************************************************************/ |
@@ -1517,46 +1414,38 @@ static int stli_waitcarrier(stlibrd_t *brdp, stliport_t *portp, struct file *fil | |||
1517 | 1414 | ||
1518 | static int stli_write(struct tty_struct *tty, const unsigned char *buf, int count) | 1415 | static int stli_write(struct tty_struct *tty, const unsigned char *buf, int count) |
1519 | { | 1416 | { |
1520 | volatile cdkasy_t *ap; | 1417 | cdkasy_t __iomem *ap; |
1521 | volatile cdkhdr_t *hdrp; | 1418 | cdkhdr_t __iomem *hdrp; |
1522 | volatile unsigned char *bits; | 1419 | unsigned char __iomem *bits; |
1523 | unsigned char *shbuf, *chbuf; | 1420 | unsigned char __iomem *shbuf; |
1524 | stliport_t *portp; | 1421 | unsigned char *chbuf; |
1525 | stlibrd_t *brdp; | 1422 | stliport_t *portp; |
1526 | unsigned int len, stlen, head, tail, size; | 1423 | stlibrd_t *brdp; |
1527 | unsigned long flags; | 1424 | unsigned int len, stlen, head, tail, size; |
1528 | 1425 | unsigned long flags; | |
1529 | #ifdef DEBUG | ||
1530 | printk("stli_write(tty=%x,buf=%x,count=%d)\n", | ||
1531 | (int) tty, (int) buf, count); | ||
1532 | #endif | ||
1533 | 1426 | ||
1534 | if ((tty == (struct tty_struct *) NULL) || | ||
1535 | (stli_tmpwritebuf == (char *) NULL)) | ||
1536 | return(0); | ||
1537 | if (tty == stli_txcooktty) | 1427 | if (tty == stli_txcooktty) |
1538 | stli_flushchars(tty); | 1428 | stli_flushchars(tty); |
1539 | portp = tty->driver_data; | 1429 | portp = tty->driver_data; |
1540 | if (portp == (stliport_t *) NULL) | 1430 | if (portp == NULL) |
1541 | return(0); | 1431 | return 0; |
1542 | if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds)) | 1432 | if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds)) |
1543 | return(0); | 1433 | return 0; |
1544 | brdp = stli_brds[portp->brdnr]; | 1434 | brdp = stli_brds[portp->brdnr]; |
1545 | if (brdp == (stlibrd_t *) NULL) | 1435 | if (brdp == NULL) |
1546 | return(0); | 1436 | return 0; |
1547 | chbuf = (unsigned char *) buf; | 1437 | chbuf = (unsigned char *) buf; |
1548 | 1438 | ||
1549 | /* | 1439 | /* |
1550 | * All data is now local, shove as much as possible into shared memory. | 1440 | * All data is now local, shove as much as possible into shared memory. |
1551 | */ | 1441 | */ |
1552 | save_flags(flags); | 1442 | spin_lock_irqsave(&brd_lock, flags); |
1553 | cli(); | ||
1554 | EBRDENABLE(brdp); | 1443 | EBRDENABLE(brdp); |
1555 | ap = (volatile cdkasy_t *) EBRDGETMEMPTR(brdp, portp->addr); | 1444 | ap = (cdkasy_t __iomem *) EBRDGETMEMPTR(brdp, portp->addr); |
1556 | head = (unsigned int) ap->txq.head; | 1445 | head = (unsigned int) readw(&ap->txq.head); |
1557 | tail = (unsigned int) ap->txq.tail; | 1446 | tail = (unsigned int) readw(&ap->txq.tail); |
1558 | if (tail != ((unsigned int) ap->txq.tail)) | 1447 | if (tail != ((unsigned int) readw(&ap->txq.tail))) |
1559 | tail = (unsigned int) ap->txq.tail; | 1448 | tail = (unsigned int) readw(&ap->txq.tail); |
1560 | size = portp->txsize; | 1449 | size = portp->txsize; |
1561 | if (head >= tail) { | 1450 | if (head >= tail) { |
1562 | len = size - (head - tail) - 1; | 1451 | len = size - (head - tail) - 1; |
@@ -1568,11 +1457,11 @@ static int stli_write(struct tty_struct *tty, const unsigned char *buf, int coun | |||
1568 | 1457 | ||
1569 | len = MIN(len, count); | 1458 | len = MIN(len, count); |
1570 | count = 0; | 1459 | count = 0; |
1571 | shbuf = (char *) EBRDGETMEMPTR(brdp, portp->txoffset); | 1460 | shbuf = (char __iomem *) EBRDGETMEMPTR(brdp, portp->txoffset); |
1572 | 1461 | ||
1573 | while (len > 0) { | 1462 | while (len > 0) { |
1574 | stlen = MIN(len, stlen); | 1463 | stlen = MIN(len, stlen); |
1575 | memcpy((shbuf + head), chbuf, stlen); | 1464 | memcpy_toio(shbuf + head, chbuf, stlen); |
1576 | chbuf += stlen; | 1465 | chbuf += stlen; |
1577 | len -= stlen; | 1466 | len -= stlen; |
1578 | count += stlen; | 1467 | count += stlen; |
@@ -1583,20 +1472,19 @@ static int stli_write(struct tty_struct *tty, const unsigned char *buf, int coun | |||
1583 | } | 1472 | } |
1584 | } | 1473 | } |
1585 | 1474 | ||
1586 | ap = (volatile cdkasy_t *) EBRDGETMEMPTR(brdp, portp->addr); | 1475 | ap = (cdkasy_t __iomem *) EBRDGETMEMPTR(brdp, portp->addr); |
1587 | ap->txq.head = head; | 1476 | writew(head, &ap->txq.head); |
1588 | if (test_bit(ST_TXBUSY, &portp->state)) { | 1477 | if (test_bit(ST_TXBUSY, &portp->state)) { |
1589 | if (ap->changed.data & DT_TXEMPTY) | 1478 | if (readl(&ap->changed.data) & DT_TXEMPTY) |
1590 | ap->changed.data &= ~DT_TXEMPTY; | 1479 | writel(readl(&ap->changed.data) & ~DT_TXEMPTY, &ap->changed.data); |
1591 | } | 1480 | } |
1592 | hdrp = (volatile cdkhdr_t *) EBRDGETMEMPTR(brdp, CDK_CDKADDR); | 1481 | hdrp = (cdkhdr_t __iomem *) EBRDGETMEMPTR(brdp, CDK_CDKADDR); |
1593 | bits = ((volatile unsigned char *) hdrp) + brdp->slaveoffset + | 1482 | bits = ((unsigned char __iomem *) hdrp) + brdp->slaveoffset + |
1594 | portp->portidx; | 1483 | portp->portidx; |
1595 | *bits |= portp->portbit; | 1484 | writeb(readb(bits) | portp->portbit, bits); |
1596 | set_bit(ST_TXBUSY, &portp->state); | 1485 | set_bit(ST_TXBUSY, &portp->state); |
1597 | EBRDDISABLE(brdp); | 1486 | EBRDDISABLE(brdp); |
1598 | 1487 | spin_unlock_irqrestore(&brd_lock, flags); | |
1599 | restore_flags(flags); | ||
1600 | 1488 | ||
1601 | return(count); | 1489 | return(count); |
1602 | } | 1490 | } |
@@ -1613,14 +1501,8 @@ static int stli_write(struct tty_struct *tty, const unsigned char *buf, int coun | |||
1613 | 1501 | ||
1614 | static void stli_putchar(struct tty_struct *tty, unsigned char ch) | 1502 | static void stli_putchar(struct tty_struct *tty, unsigned char ch) |
1615 | { | 1503 | { |
1616 | #ifdef DEBUG | ||
1617 | printk("stli_putchar(tty=%x,ch=%x)\n", (int) tty, (int) ch); | ||
1618 | #endif | ||
1619 | |||
1620 | if (tty == (struct tty_struct *) NULL) | ||
1621 | return; | ||
1622 | if (tty != stli_txcooktty) { | 1504 | if (tty != stli_txcooktty) { |
1623 | if (stli_txcooktty != (struct tty_struct *) NULL) | 1505 | if (stli_txcooktty != NULL) |
1624 | stli_flushchars(stli_txcooktty); | 1506 | stli_flushchars(stli_txcooktty); |
1625 | stli_txcooktty = tty; | 1507 | stli_txcooktty = tty; |
1626 | } | 1508 | } |
@@ -1640,29 +1522,26 @@ static void stli_putchar(struct tty_struct *tty, unsigned char ch) | |||
1640 | 1522 | ||
1641 | static void stli_flushchars(struct tty_struct *tty) | 1523 | static void stli_flushchars(struct tty_struct *tty) |
1642 | { | 1524 | { |
1643 | volatile cdkhdr_t *hdrp; | 1525 | cdkhdr_t __iomem *hdrp; |
1644 | volatile unsigned char *bits; | 1526 | unsigned char __iomem *bits; |
1645 | volatile cdkasy_t *ap; | 1527 | cdkasy_t __iomem *ap; |
1646 | struct tty_struct *cooktty; | 1528 | struct tty_struct *cooktty; |
1647 | stliport_t *portp; | 1529 | stliport_t *portp; |
1648 | stlibrd_t *brdp; | 1530 | stlibrd_t *brdp; |
1649 | unsigned int len, stlen, head, tail, size, count, cooksize; | 1531 | unsigned int len, stlen, head, tail, size, count, cooksize; |
1650 | unsigned char *buf, *shbuf; | 1532 | unsigned char *buf; |
1651 | unsigned long flags; | 1533 | unsigned char __iomem *shbuf; |
1652 | 1534 | unsigned long flags; | |
1653 | #ifdef DEBUG | ||
1654 | printk("stli_flushchars(tty=%x)\n", (int) tty); | ||
1655 | #endif | ||
1656 | 1535 | ||
1657 | cooksize = stli_txcooksize; | 1536 | cooksize = stli_txcooksize; |
1658 | cooktty = stli_txcooktty; | 1537 | cooktty = stli_txcooktty; |
1659 | stli_txcooksize = 0; | 1538 | stli_txcooksize = 0; |
1660 | stli_txcookrealsize = 0; | 1539 | stli_txcookrealsize = 0; |
1661 | stli_txcooktty = (struct tty_struct *) NULL; | 1540 | stli_txcooktty = NULL; |
1662 | 1541 | ||
1663 | if (tty == (struct tty_struct *) NULL) | 1542 | if (tty == NULL) |
1664 | return; | 1543 | return; |
1665 | if (cooktty == (struct tty_struct *) NULL) | 1544 | if (cooktty == NULL) |
1666 | return; | 1545 | return; |
1667 | if (tty != cooktty) | 1546 | if (tty != cooktty) |
1668 | tty = cooktty; | 1547 | tty = cooktty; |
@@ -1670,23 +1549,22 @@ static void stli_flushchars(struct tty_struct *tty) | |||
1670 | return; | 1549 | return; |
1671 | 1550 | ||
1672 | portp = tty->driver_data; | 1551 | portp = tty->driver_data; |
1673 | if (portp == (stliport_t *) NULL) | 1552 | if (portp == NULL) |
1674 | return; | 1553 | return; |
1675 | if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds)) | 1554 | if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds)) |
1676 | return; | 1555 | return; |
1677 | brdp = stli_brds[portp->brdnr]; | 1556 | brdp = stli_brds[portp->brdnr]; |
1678 | if (brdp == (stlibrd_t *) NULL) | 1557 | if (brdp == NULL) |
1679 | return; | 1558 | return; |
1680 | 1559 | ||
1681 | save_flags(flags); | 1560 | spin_lock_irqsave(&brd_lock, flags); |
1682 | cli(); | ||
1683 | EBRDENABLE(brdp); | 1561 | EBRDENABLE(brdp); |
1684 | 1562 | ||
1685 | ap = (volatile cdkasy_t *) EBRDGETMEMPTR(brdp, portp->addr); | 1563 | ap = (cdkasy_t __iomem *) EBRDGETMEMPTR(brdp, portp->addr); |
1686 | head = (unsigned int) ap->txq.head; | 1564 | head = (unsigned int) readw(&ap->txq.head); |
1687 | tail = (unsigned int) ap->txq.tail; | 1565 | tail = (unsigned int) readw(&ap->txq.tail); |
1688 | if (tail != ((unsigned int) ap->txq.tail)) | 1566 | if (tail != ((unsigned int) readw(&ap->txq.tail))) |
1689 | tail = (unsigned int) ap->txq.tail; | 1567 | tail = (unsigned int) readw(&ap->txq.tail); |
1690 | size = portp->txsize; | 1568 | size = portp->txsize; |
1691 | if (head >= tail) { | 1569 | if (head >= tail) { |
1692 | len = size - (head - tail) - 1; | 1570 | len = size - (head - tail) - 1; |
@@ -1703,7 +1581,7 @@ static void stli_flushchars(struct tty_struct *tty) | |||
1703 | 1581 | ||
1704 | while (len > 0) { | 1582 | while (len > 0) { |
1705 | stlen = MIN(len, stlen); | 1583 | stlen = MIN(len, stlen); |
1706 | memcpy((shbuf + head), buf, stlen); | 1584 | memcpy_toio(shbuf + head, buf, stlen); |
1707 | buf += stlen; | 1585 | buf += stlen; |
1708 | len -= stlen; | 1586 | len -= stlen; |
1709 | count += stlen; | 1587 | count += stlen; |
@@ -1714,73 +1592,66 @@ static void stli_flushchars(struct tty_struct *tty) | |||
1714 | } | 1592 | } |
1715 | } | 1593 | } |
1716 | 1594 | ||
1717 | ap = (volatile cdkasy_t *) EBRDGETMEMPTR(brdp, portp->addr); | 1595 | ap = (cdkasy_t __iomem *) EBRDGETMEMPTR(brdp, portp->addr); |
1718 | ap->txq.head = head; | 1596 | writew(head, &ap->txq.head); |
1719 | 1597 | ||
1720 | if (test_bit(ST_TXBUSY, &portp->state)) { | 1598 | if (test_bit(ST_TXBUSY, &portp->state)) { |
1721 | if (ap->changed.data & DT_TXEMPTY) | 1599 | if (readl(&ap->changed.data) & DT_TXEMPTY) |
1722 | ap->changed.data &= ~DT_TXEMPTY; | 1600 | writel(readl(&ap->changed.data) & ~DT_TXEMPTY, &ap->changed.data); |
1723 | } | 1601 | } |
1724 | hdrp = (volatile cdkhdr_t *) EBRDGETMEMPTR(brdp, CDK_CDKADDR); | 1602 | hdrp = (cdkhdr_t __iomem *) EBRDGETMEMPTR(brdp, CDK_CDKADDR); |
1725 | bits = ((volatile unsigned char *) hdrp) + brdp->slaveoffset + | 1603 | bits = ((unsigned char __iomem *) hdrp) + brdp->slaveoffset + |
1726 | portp->portidx; | 1604 | portp->portidx; |
1727 | *bits |= portp->portbit; | 1605 | writeb(readb(bits) | portp->portbit, bits); |
1728 | set_bit(ST_TXBUSY, &portp->state); | 1606 | set_bit(ST_TXBUSY, &portp->state); |
1729 | 1607 | ||
1730 | EBRDDISABLE(brdp); | 1608 | EBRDDISABLE(brdp); |
1731 | restore_flags(flags); | 1609 | spin_unlock_irqrestore(&brd_lock, flags); |
1732 | } | 1610 | } |
1733 | 1611 | ||
1734 | /*****************************************************************************/ | 1612 | /*****************************************************************************/ |
1735 | 1613 | ||
1736 | static int stli_writeroom(struct tty_struct *tty) | 1614 | static int stli_writeroom(struct tty_struct *tty) |
1737 | { | 1615 | { |
1738 | volatile cdkasyrq_t *rp; | 1616 | cdkasyrq_t __iomem *rp; |
1739 | stliport_t *portp; | 1617 | stliport_t *portp; |
1740 | stlibrd_t *brdp; | 1618 | stlibrd_t *brdp; |
1741 | unsigned int head, tail, len; | 1619 | unsigned int head, tail, len; |
1742 | unsigned long flags; | 1620 | unsigned long flags; |
1743 | |||
1744 | #ifdef DEBUG | ||
1745 | printk("stli_writeroom(tty=%x)\n", (int) tty); | ||
1746 | #endif | ||
1747 | 1621 | ||
1748 | if (tty == (struct tty_struct *) NULL) | ||
1749 | return(0); | ||
1750 | if (tty == stli_txcooktty) { | 1622 | if (tty == stli_txcooktty) { |
1751 | if (stli_txcookrealsize != 0) { | 1623 | if (stli_txcookrealsize != 0) { |
1752 | len = stli_txcookrealsize - stli_txcooksize; | 1624 | len = stli_txcookrealsize - stli_txcooksize; |
1753 | return(len); | 1625 | return len; |
1754 | } | 1626 | } |
1755 | } | 1627 | } |
1756 | 1628 | ||
1757 | portp = tty->driver_data; | 1629 | portp = tty->driver_data; |
1758 | if (portp == (stliport_t *) NULL) | 1630 | if (portp == NULL) |
1759 | return(0); | 1631 | return 0; |
1760 | if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds)) | 1632 | if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds)) |
1761 | return(0); | 1633 | return 0; |
1762 | brdp = stli_brds[portp->brdnr]; | 1634 | brdp = stli_brds[portp->brdnr]; |
1763 | if (brdp == (stlibrd_t *) NULL) | 1635 | if (brdp == NULL) |
1764 | return(0); | 1636 | return 0; |
1765 | 1637 | ||
1766 | save_flags(flags); | 1638 | spin_lock_irqsave(&brd_lock, flags); |
1767 | cli(); | ||
1768 | EBRDENABLE(brdp); | 1639 | EBRDENABLE(brdp); |
1769 | rp = &((volatile cdkasy_t *) EBRDGETMEMPTR(brdp, portp->addr))->txq; | 1640 | rp = &((cdkasy_t __iomem *) EBRDGETMEMPTR(brdp, portp->addr))->txq; |
1770 | head = (unsigned int) rp->head; | 1641 | head = (unsigned int) readw(&rp->head); |
1771 | tail = (unsigned int) rp->tail; | 1642 | tail = (unsigned int) readw(&rp->tail); |
1772 | if (tail != ((unsigned int) rp->tail)) | 1643 | if (tail != ((unsigned int) readw(&rp->tail))) |
1773 | tail = (unsigned int) rp->tail; | 1644 | tail = (unsigned int) readw(&rp->tail); |
1774 | len = (head >= tail) ? (portp->txsize - (head - tail)) : (tail - head); | 1645 | len = (head >= tail) ? (portp->txsize - (head - tail)) : (tail - head); |
1775 | len--; | 1646 | len--; |
1776 | EBRDDISABLE(brdp); | 1647 | EBRDDISABLE(brdp); |
1777 | restore_flags(flags); | 1648 | spin_unlock_irqrestore(&brd_lock, flags); |
1778 | 1649 | ||
1779 | if (tty == stli_txcooktty) { | 1650 | if (tty == stli_txcooktty) { |
1780 | stli_txcookrealsize = len; | 1651 | stli_txcookrealsize = len; |
1781 | len -= stli_txcooksize; | 1652 | len -= stli_txcooksize; |
1782 | } | 1653 | } |
1783 | return(len); | 1654 | return len; |
1784 | } | 1655 | } |
1785 | 1656 | ||
1786 | /*****************************************************************************/ | 1657 | /*****************************************************************************/ |
@@ -1795,44 +1666,37 @@ static int stli_writeroom(struct tty_struct *tty) | |||
1795 | 1666 | ||
1796 | static int stli_charsinbuffer(struct tty_struct *tty) | 1667 | static int stli_charsinbuffer(struct tty_struct *tty) |
1797 | { | 1668 | { |
1798 | volatile cdkasyrq_t *rp; | 1669 | cdkasyrq_t __iomem *rp; |
1799 | stliport_t *portp; | 1670 | stliport_t *portp; |
1800 | stlibrd_t *brdp; | 1671 | stlibrd_t *brdp; |
1801 | unsigned int head, tail, len; | 1672 | unsigned int head, tail, len; |
1802 | unsigned long flags; | 1673 | unsigned long flags; |
1803 | |||
1804 | #ifdef DEBUG | ||
1805 | printk("stli_charsinbuffer(tty=%x)\n", (int) tty); | ||
1806 | #endif | ||
1807 | 1674 | ||
1808 | if (tty == (struct tty_struct *) NULL) | ||
1809 | return(0); | ||
1810 | if (tty == stli_txcooktty) | 1675 | if (tty == stli_txcooktty) |
1811 | stli_flushchars(tty); | 1676 | stli_flushchars(tty); |
1812 | portp = tty->driver_data; | 1677 | portp = tty->driver_data; |
1813 | if (portp == (stliport_t *) NULL) | 1678 | if (portp == NULL) |
1814 | return(0); | 1679 | return 0; |
1815 | if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds)) | 1680 | if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds)) |
1816 | return(0); | 1681 | return 0; |
1817 | brdp = stli_brds[portp->brdnr]; | 1682 | brdp = stli_brds[portp->brdnr]; |
1818 | if (brdp == (stlibrd_t *) NULL) | 1683 | if (brdp == NULL) |
1819 | return(0); | 1684 | return 0; |
1820 | 1685 | ||
1821 | save_flags(flags); | 1686 | spin_lock_irqsave(&brd_lock, flags); |
1822 | cli(); | ||
1823 | EBRDENABLE(brdp); | 1687 | EBRDENABLE(brdp); |
1824 | rp = &((volatile cdkasy_t *) EBRDGETMEMPTR(brdp, portp->addr))->txq; | 1688 | rp = &((cdkasy_t __iomem *) EBRDGETMEMPTR(brdp, portp->addr))->txq; |
1825 | head = (unsigned int) rp->head; | 1689 | head = (unsigned int) readw(&rp->head); |
1826 | tail = (unsigned int) rp->tail; | 1690 | tail = (unsigned int) readw(&rp->tail); |
1827 | if (tail != ((unsigned int) rp->tail)) | 1691 | if (tail != ((unsigned int) readw(&rp->tail))) |
1828 | tail = (unsigned int) rp->tail; | 1692 | tail = (unsigned int) readw(&rp->tail); |
1829 | len = (head >= tail) ? (head - tail) : (portp->txsize - (tail - head)); | 1693 | len = (head >= tail) ? (head - tail) : (portp->txsize - (tail - head)); |
1830 | if ((len == 0) && test_bit(ST_TXBUSY, &portp->state)) | 1694 | if ((len == 0) && test_bit(ST_TXBUSY, &portp->state)) |
1831 | len = 1; | 1695 | len = 1; |
1832 | EBRDDISABLE(brdp); | 1696 | EBRDDISABLE(brdp); |
1833 | restore_flags(flags); | 1697 | spin_unlock_irqrestore(&brd_lock, flags); |
1834 | 1698 | ||
1835 | return(len); | 1699 | return len; |
1836 | } | 1700 | } |
1837 | 1701 | ||
1838 | /*****************************************************************************/ | 1702 | /*****************************************************************************/ |
@@ -1843,12 +1707,8 @@ static int stli_charsinbuffer(struct tty_struct *tty) | |||
1843 | 1707 | ||
1844 | static int stli_getserial(stliport_t *portp, struct serial_struct __user *sp) | 1708 | static int stli_getserial(stliport_t *portp, struct serial_struct __user *sp) |
1845 | { | 1709 | { |
1846 | struct serial_struct sio; | 1710 | struct serial_struct sio; |
1847 | stlibrd_t *brdp; | 1711 | stlibrd_t *brdp; |
1848 | |||
1849 | #ifdef DEBUG | ||
1850 | printk("stli_getserial(portp=%x,sp=%x)\n", (int) portp, (int) sp); | ||
1851 | #endif | ||
1852 | 1712 | ||
1853 | memset(&sio, 0, sizeof(struct serial_struct)); | 1713 | memset(&sio, 0, sizeof(struct serial_struct)); |
1854 | sio.type = PORT_UNKNOWN; | 1714 | sio.type = PORT_UNKNOWN; |
@@ -1863,7 +1723,7 @@ static int stli_getserial(stliport_t *portp, struct serial_struct __user *sp) | |||
1863 | sio.hub6 = 0; | 1723 | sio.hub6 = 0; |
1864 | 1724 | ||
1865 | brdp = stli_brds[portp->brdnr]; | 1725 | brdp = stli_brds[portp->brdnr]; |
1866 | if (brdp != (stlibrd_t *) NULL) | 1726 | if (brdp != NULL) |
1867 | sio.port = brdp->iobase; | 1727 | sio.port = brdp->iobase; |
1868 | 1728 | ||
1869 | return copy_to_user(sp, &sio, sizeof(struct serial_struct)) ? | 1729 | return copy_to_user(sp, &sio, sizeof(struct serial_struct)) ? |
@@ -1880,12 +1740,8 @@ static int stli_getserial(stliport_t *portp, struct serial_struct __user *sp) | |||
1880 | 1740 | ||
1881 | static int stli_setserial(stliport_t *portp, struct serial_struct __user *sp) | 1741 | static int stli_setserial(stliport_t *portp, struct serial_struct __user *sp) |
1882 | { | 1742 | { |
1883 | struct serial_struct sio; | 1743 | struct serial_struct sio; |
1884 | int rc; | 1744 | int rc; |
1885 | |||
1886 | #ifdef DEBUG | ||
1887 | printk("stli_setserial(portp=%p,sp=%p)\n", portp, sp); | ||
1888 | #endif | ||
1889 | 1745 | ||
1890 | if (copy_from_user(&sio, sp, sizeof(struct serial_struct))) | 1746 | if (copy_from_user(&sio, sp, sizeof(struct serial_struct))) |
1891 | return -EFAULT; | 1747 | return -EFAULT; |
@@ -1894,7 +1750,7 @@ static int stli_setserial(stliport_t *portp, struct serial_struct __user *sp) | |||
1894 | (sio.close_delay != portp->close_delay) || | 1750 | (sio.close_delay != portp->close_delay) || |
1895 | ((sio.flags & ~ASYNC_USR_MASK) != | 1751 | ((sio.flags & ~ASYNC_USR_MASK) != |
1896 | (portp->flags & ~ASYNC_USR_MASK))) | 1752 | (portp->flags & ~ASYNC_USR_MASK))) |
1897 | return(-EPERM); | 1753 | return -EPERM; |
1898 | } | 1754 | } |
1899 | 1755 | ||
1900 | portp->flags = (portp->flags & ~ASYNC_USR_MASK) | | 1756 | portp->flags = (portp->flags & ~ASYNC_USR_MASK) | |
@@ -1905,8 +1761,8 @@ static int stli_setserial(stliport_t *portp, struct serial_struct __user *sp) | |||
1905 | portp->custom_divisor = sio.custom_divisor; | 1761 | portp->custom_divisor = sio.custom_divisor; |
1906 | 1762 | ||
1907 | if ((rc = stli_setport(portp)) < 0) | 1763 | if ((rc = stli_setport(portp)) < 0) |
1908 | return(rc); | 1764 | return rc; |
1909 | return(0); | 1765 | return 0; |
1910 | } | 1766 | } |
1911 | 1767 | ||
1912 | /*****************************************************************************/ | 1768 | /*****************************************************************************/ |
@@ -1917,19 +1773,19 @@ static int stli_tiocmget(struct tty_struct *tty, struct file *file) | |||
1917 | stlibrd_t *brdp; | 1773 | stlibrd_t *brdp; |
1918 | int rc; | 1774 | int rc; |
1919 | 1775 | ||
1920 | if (portp == (stliport_t *) NULL) | 1776 | if (portp == NULL) |
1921 | return(-ENODEV); | 1777 | return -ENODEV; |
1922 | if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds)) | 1778 | if (portp->brdnr < 0 || portp->brdnr >= stli_nrbrds) |
1923 | return(0); | 1779 | return 0; |
1924 | brdp = stli_brds[portp->brdnr]; | 1780 | brdp = stli_brds[portp->brdnr]; |
1925 | if (brdp == (stlibrd_t *) NULL) | 1781 | if (brdp == NULL) |
1926 | return(0); | 1782 | return 0; |
1927 | if (tty->flags & (1 << TTY_IO_ERROR)) | 1783 | if (tty->flags & (1 << TTY_IO_ERROR)) |
1928 | return(-EIO); | 1784 | return -EIO; |
1929 | 1785 | ||
1930 | if ((rc = stli_cmdwait(brdp, portp, A_GETSIGNALS, | 1786 | if ((rc = stli_cmdwait(brdp, portp, A_GETSIGNALS, |
1931 | &portp->asig, sizeof(asysigs_t), 1)) < 0) | 1787 | &portp->asig, sizeof(asysigs_t), 1)) < 0) |
1932 | return(rc); | 1788 | return rc; |
1933 | 1789 | ||
1934 | return stli_mktiocm(portp->asig.sigvalue); | 1790 | return stli_mktiocm(portp->asig.sigvalue); |
1935 | } | 1791 | } |
@@ -1941,15 +1797,15 @@ static int stli_tiocmset(struct tty_struct *tty, struct file *file, | |||
1941 | stlibrd_t *brdp; | 1797 | stlibrd_t *brdp; |
1942 | int rts = -1, dtr = -1; | 1798 | int rts = -1, dtr = -1; |
1943 | 1799 | ||
1944 | if (portp == (stliport_t *) NULL) | 1800 | if (portp == NULL) |
1945 | return(-ENODEV); | 1801 | return -ENODEV; |
1946 | if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds)) | 1802 | if (portp->brdnr < 0 || portp->brdnr >= stli_nrbrds) |
1947 | return(0); | 1803 | return 0; |
1948 | brdp = stli_brds[portp->brdnr]; | 1804 | brdp = stli_brds[portp->brdnr]; |
1949 | if (brdp == (stlibrd_t *) NULL) | 1805 | if (brdp == NULL) |
1950 | return(0); | 1806 | return 0; |
1951 | if (tty->flags & (1 << TTY_IO_ERROR)) | 1807 | if (tty->flags & (1 << TTY_IO_ERROR)) |
1952 | return(-EIO); | 1808 | return -EIO; |
1953 | 1809 | ||
1954 | if (set & TIOCM_RTS) | 1810 | if (set & TIOCM_RTS) |
1955 | rts = 1; | 1811 | rts = 1; |
@@ -1968,32 +1824,25 @@ static int stli_tiocmset(struct tty_struct *tty, struct file *file, | |||
1968 | 1824 | ||
1969 | static int stli_ioctl(struct tty_struct *tty, struct file *file, unsigned int cmd, unsigned long arg) | 1825 | static int stli_ioctl(struct tty_struct *tty, struct file *file, unsigned int cmd, unsigned long arg) |
1970 | { | 1826 | { |
1971 | stliport_t *portp; | 1827 | stliport_t *portp; |
1972 | stlibrd_t *brdp; | 1828 | stlibrd_t *brdp; |
1973 | unsigned int ival; | 1829 | unsigned int ival; |
1974 | int rc; | 1830 | int rc; |
1975 | void __user *argp = (void __user *)arg; | 1831 | void __user *argp = (void __user *)arg; |
1976 | 1832 | ||
1977 | #ifdef DEBUG | ||
1978 | printk("stli_ioctl(tty=%x,file=%x,cmd=%x,arg=%x)\n", | ||
1979 | (int) tty, (int) file, cmd, (int) arg); | ||
1980 | #endif | ||
1981 | |||
1982 | if (tty == (struct tty_struct *) NULL) | ||
1983 | return(-ENODEV); | ||
1984 | portp = tty->driver_data; | 1833 | portp = tty->driver_data; |
1985 | if (portp == (stliport_t *) NULL) | 1834 | if (portp == NULL) |
1986 | return(-ENODEV); | 1835 | return -ENODEV; |
1987 | if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds)) | 1836 | if (portp->brdnr < 0 || portp->brdnr >= stli_nrbrds) |
1988 | return(0); | 1837 | return 0; |
1989 | brdp = stli_brds[portp->brdnr]; | 1838 | brdp = stli_brds[portp->brdnr]; |
1990 | if (brdp == (stlibrd_t *) NULL) | 1839 | if (brdp == NULL) |
1991 | return(0); | 1840 | return 0; |
1992 | 1841 | ||
1993 | if ((cmd != TIOCGSERIAL) && (cmd != TIOCSSERIAL) && | 1842 | if ((cmd != TIOCGSERIAL) && (cmd != TIOCSSERIAL) && |
1994 | (cmd != COM_GETPORTSTATS) && (cmd != COM_CLRPORTSTATS)) { | 1843 | (cmd != COM_GETPORTSTATS) && (cmd != COM_CLRPORTSTATS)) { |
1995 | if (tty->flags & (1 << TTY_IO_ERROR)) | 1844 | if (tty->flags & (1 << TTY_IO_ERROR)) |
1996 | return(-EIO); | 1845 | return -EIO; |
1997 | } | 1846 | } |
1998 | 1847 | ||
1999 | rc = 0; | 1848 | rc = 0; |
@@ -2040,7 +1889,7 @@ static int stli_ioctl(struct tty_struct *tty, struct file *file, unsigned int cm | |||
2040 | break; | 1889 | break; |
2041 | } | 1890 | } |
2042 | 1891 | ||
2043 | return(rc); | 1892 | return rc; |
2044 | } | 1893 | } |
2045 | 1894 | ||
2046 | /*****************************************************************************/ | 1895 | /*****************************************************************************/ |
@@ -2052,24 +1901,20 @@ static int stli_ioctl(struct tty_struct *tty, struct file *file, unsigned int cm | |||
2052 | 1901 | ||
2053 | static void stli_settermios(struct tty_struct *tty, struct termios *old) | 1902 | static void stli_settermios(struct tty_struct *tty, struct termios *old) |
2054 | { | 1903 | { |
2055 | stliport_t *portp; | 1904 | stliport_t *portp; |
2056 | stlibrd_t *brdp; | 1905 | stlibrd_t *brdp; |
2057 | struct termios *tiosp; | 1906 | struct termios *tiosp; |
2058 | asyport_t aport; | 1907 | asyport_t aport; |
2059 | |||
2060 | #ifdef DEBUG | ||
2061 | printk("stli_settermios(tty=%x,old=%x)\n", (int) tty, (int) old); | ||
2062 | #endif | ||
2063 | 1908 | ||
2064 | if (tty == (struct tty_struct *) NULL) | 1909 | if (tty == NULL) |
2065 | return; | 1910 | return; |
2066 | portp = tty->driver_data; | 1911 | portp = tty->driver_data; |
2067 | if (portp == (stliport_t *) NULL) | 1912 | if (portp == NULL) |
2068 | return; | 1913 | return; |
2069 | if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds)) | 1914 | if (portp->brdnr < 0 || portp->brdnr >= stli_nrbrds) |
2070 | return; | 1915 | return; |
2071 | brdp = stli_brds[portp->brdnr]; | 1916 | brdp = stli_brds[portp->brdnr]; |
2072 | if (brdp == (stlibrd_t *) NULL) | 1917 | if (brdp == NULL) |
2073 | return; | 1918 | return; |
2074 | 1919 | ||
2075 | tiosp = tty->termios; | 1920 | tiosp = tty->termios; |
@@ -2102,18 +1947,9 @@ static void stli_settermios(struct tty_struct *tty, struct termios *old) | |||
2102 | 1947 | ||
2103 | static void stli_throttle(struct tty_struct *tty) | 1948 | static void stli_throttle(struct tty_struct *tty) |
2104 | { | 1949 | { |
2105 | stliport_t *portp; | 1950 | stliport_t *portp = tty->driver_data; |
2106 | 1951 | if (portp == NULL) | |
2107 | #ifdef DEBUG | ||
2108 | printk("stli_throttle(tty=%x)\n", (int) tty); | ||
2109 | #endif | ||
2110 | |||
2111 | if (tty == (struct tty_struct *) NULL) | ||
2112 | return; | ||
2113 | portp = tty->driver_data; | ||
2114 | if (portp == (stliport_t *) NULL) | ||
2115 | return; | 1952 | return; |
2116 | |||
2117 | set_bit(ST_RXSTOP, &portp->state); | 1953 | set_bit(ST_RXSTOP, &portp->state); |
2118 | } | 1954 | } |
2119 | 1955 | ||
@@ -2127,88 +1963,30 @@ static void stli_throttle(struct tty_struct *tty) | |||
2127 | 1963 | ||
2128 | static void stli_unthrottle(struct tty_struct *tty) | 1964 | static void stli_unthrottle(struct tty_struct *tty) |
2129 | { | 1965 | { |
2130 | stliport_t *portp; | 1966 | stliport_t *portp = tty->driver_data; |
2131 | 1967 | if (portp == NULL) | |
2132 | #ifdef DEBUG | ||
2133 | printk("stli_unthrottle(tty=%x)\n", (int) tty); | ||
2134 | #endif | ||
2135 | |||
2136 | if (tty == (struct tty_struct *) NULL) | ||
2137 | return; | ||
2138 | portp = tty->driver_data; | ||
2139 | if (portp == (stliport_t *) NULL) | ||
2140 | return; | 1968 | return; |
2141 | |||
2142 | clear_bit(ST_RXSTOP, &portp->state); | 1969 | clear_bit(ST_RXSTOP, &portp->state); |
2143 | } | 1970 | } |
2144 | 1971 | ||
2145 | /*****************************************************************************/ | 1972 | /*****************************************************************************/ |
2146 | 1973 | ||
2147 | /* | 1974 | /* |
2148 | * Stop the transmitter. Basically to do this we will just turn TX | 1975 | * Stop the transmitter. |
2149 | * interrupts off. | ||
2150 | */ | 1976 | */ |
2151 | 1977 | ||
2152 | static void stli_stop(struct tty_struct *tty) | 1978 | static void stli_stop(struct tty_struct *tty) |
2153 | { | 1979 | { |
2154 | stlibrd_t *brdp; | ||
2155 | stliport_t *portp; | ||
2156 | asyctrl_t actrl; | ||
2157 | |||
2158 | #ifdef DEBUG | ||
2159 | printk("stli_stop(tty=%x)\n", (int) tty); | ||
2160 | #endif | ||
2161 | |||
2162 | if (tty == (struct tty_struct *) NULL) | ||
2163 | return; | ||
2164 | portp = tty->driver_data; | ||
2165 | if (portp == (stliport_t *) NULL) | ||
2166 | return; | ||
2167 | if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds)) | ||
2168 | return; | ||
2169 | brdp = stli_brds[portp->brdnr]; | ||
2170 | if (brdp == (stlibrd_t *) NULL) | ||
2171 | return; | ||
2172 | |||
2173 | memset(&actrl, 0, sizeof(asyctrl_t)); | ||
2174 | actrl.txctrl = CT_STOPFLOW; | ||
2175 | #if 0 | ||
2176 | stli_cmdwait(brdp, portp, A_PORTCTRL, &actrl, sizeof(asyctrl_t), 0); | ||
2177 | #endif | ||
2178 | } | 1980 | } |
2179 | 1981 | ||
2180 | /*****************************************************************************/ | 1982 | /*****************************************************************************/ |
2181 | 1983 | ||
2182 | /* | 1984 | /* |
2183 | * Start the transmitter again. Just turn TX interrupts back on. | 1985 | * Start the transmitter again. |
2184 | */ | 1986 | */ |
2185 | 1987 | ||
2186 | static void stli_start(struct tty_struct *tty) | 1988 | static void stli_start(struct tty_struct *tty) |
2187 | { | 1989 | { |
2188 | stliport_t *portp; | ||
2189 | stlibrd_t *brdp; | ||
2190 | asyctrl_t actrl; | ||
2191 | |||
2192 | #ifdef DEBUG | ||
2193 | printk("stli_start(tty=%x)\n", (int) tty); | ||
2194 | #endif | ||
2195 | |||
2196 | if (tty == (struct tty_struct *) NULL) | ||
2197 | return; | ||
2198 | portp = tty->driver_data; | ||
2199 | if (portp == (stliport_t *) NULL) | ||
2200 | return; | ||
2201 | if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds)) | ||
2202 | return; | ||
2203 | brdp = stli_brds[portp->brdnr]; | ||
2204 | if (brdp == (stlibrd_t *) NULL) | ||
2205 | return; | ||
2206 | |||
2207 | memset(&actrl, 0, sizeof(asyctrl_t)); | ||
2208 | actrl.txctrl = CT_STARTFLOW; | ||
2209 | #if 0 | ||
2210 | stli_cmdwait(brdp, portp, A_PORTCTRL, &actrl, sizeof(asyctrl_t), 0); | ||
2211 | #endif | ||
2212 | } | 1990 | } |
2213 | 1991 | ||
2214 | /*****************************************************************************/ | 1992 | /*****************************************************************************/ |
@@ -2224,22 +2002,9 @@ static void stli_start(struct tty_struct *tty) | |||
2224 | 2002 | ||
2225 | static void stli_dohangup(void *arg) | 2003 | static void stli_dohangup(void *arg) |
2226 | { | 2004 | { |
2227 | stliport_t *portp; | 2005 | stliport_t *portp = (stliport_t *) arg; |
2228 | 2006 | if (portp->tty != NULL) { | |
2229 | #ifdef DEBUG | 2007 | tty_hangup(portp->tty); |
2230 | printk(KERN_DEBUG "stli_dohangup(portp=%x)\n", (int) arg); | ||
2231 | #endif | ||
2232 | |||
2233 | /* | ||
2234 | * FIXME: There's a module removal race here: tty_hangup | ||
2235 | * calls schedule_work which will call into this | ||
2236 | * driver later. | ||
2237 | */ | ||
2238 | portp = (stliport_t *) arg; | ||
2239 | if (portp != (stliport_t *) NULL) { | ||
2240 | if (portp->tty != (struct tty_struct *) NULL) { | ||
2241 | tty_hangup(portp->tty); | ||
2242 | } | ||
2243 | } | 2008 | } |
2244 | } | 2009 | } |
2245 | 2010 | ||
@@ -2254,31 +2019,25 @@ static void stli_dohangup(void *arg) | |||
2254 | 2019 | ||
2255 | static void stli_hangup(struct tty_struct *tty) | 2020 | static void stli_hangup(struct tty_struct *tty) |
2256 | { | 2021 | { |
2257 | stliport_t *portp; | 2022 | stliport_t *portp; |
2258 | stlibrd_t *brdp; | 2023 | stlibrd_t *brdp; |
2259 | unsigned long flags; | 2024 | unsigned long flags; |
2260 | |||
2261 | #ifdef DEBUG | ||
2262 | printk(KERN_DEBUG "stli_hangup(tty=%x)\n", (int) tty); | ||
2263 | #endif | ||
2264 | 2025 | ||
2265 | if (tty == (struct tty_struct *) NULL) | ||
2266 | return; | ||
2267 | portp = tty->driver_data; | 2026 | portp = tty->driver_data; |
2268 | if (portp == (stliport_t *) NULL) | 2027 | if (portp == NULL) |
2269 | return; | 2028 | return; |
2270 | if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds)) | 2029 | if (portp->brdnr < 0 || portp->brdnr >= stli_nrbrds) |
2271 | return; | 2030 | return; |
2272 | brdp = stli_brds[portp->brdnr]; | 2031 | brdp = stli_brds[portp->brdnr]; |
2273 | if (brdp == (stlibrd_t *) NULL) | 2032 | if (brdp == NULL) |
2274 | return; | 2033 | return; |
2275 | 2034 | ||
2276 | portp->flags &= ~ASYNC_INITIALIZED; | 2035 | portp->flags &= ~ASYNC_INITIALIZED; |
2277 | 2036 | ||
2278 | save_flags(flags); | 2037 | if (!test_bit(ST_CLOSING, &portp->state)) |
2279 | cli(); | ||
2280 | if (! test_bit(ST_CLOSING, &portp->state)) | ||
2281 | stli_rawclose(brdp, portp, 0, 0); | 2038 | stli_rawclose(brdp, portp, 0, 0); |
2039 | |||
2040 | spin_lock_irqsave(&stli_lock, flags); | ||
2282 | if (tty->termios->c_cflag & HUPCL) { | 2041 | if (tty->termios->c_cflag & HUPCL) { |
2283 | stli_mkasysigs(&portp->asig, 0, 0); | 2042 | stli_mkasysigs(&portp->asig, 0, 0); |
2284 | if (test_bit(ST_CMDING, &portp->state)) { | 2043 | if (test_bit(ST_CMDING, &portp->state)) { |
@@ -2290,14 +2049,15 @@ static void stli_hangup(struct tty_struct *tty) | |||
2290 | &portp->asig, sizeof(asysigs_t), 0); | 2049 | &portp->asig, sizeof(asysigs_t), 0); |
2291 | } | 2050 | } |
2292 | } | 2051 | } |
2293 | restore_flags(flags); | ||
2294 | 2052 | ||
2295 | clear_bit(ST_TXBUSY, &portp->state); | 2053 | clear_bit(ST_TXBUSY, &portp->state); |
2296 | clear_bit(ST_RXSTOP, &portp->state); | 2054 | clear_bit(ST_RXSTOP, &portp->state); |
2297 | set_bit(TTY_IO_ERROR, &tty->flags); | 2055 | set_bit(TTY_IO_ERROR, &tty->flags); |
2298 | portp->tty = (struct tty_struct *) NULL; | 2056 | portp->tty = NULL; |
2299 | portp->flags &= ~ASYNC_NORMAL_ACTIVE; | 2057 | portp->flags &= ~ASYNC_NORMAL_ACTIVE; |
2300 | portp->refcount = 0; | 2058 | portp->refcount = 0; |
2059 | spin_unlock_irqrestore(&stli_lock, flags); | ||
2060 | |||
2301 | wake_up_interruptible(&portp->open_wait); | 2061 | wake_up_interruptible(&portp->open_wait); |
2302 | } | 2062 | } |
2303 | 2063 | ||
@@ -2312,29 +2072,22 @@ static void stli_hangup(struct tty_struct *tty) | |||
2312 | 2072 | ||
2313 | static void stli_flushbuffer(struct tty_struct *tty) | 2073 | static void stli_flushbuffer(struct tty_struct *tty) |
2314 | { | 2074 | { |
2315 | stliport_t *portp; | 2075 | stliport_t *portp; |
2316 | stlibrd_t *brdp; | 2076 | stlibrd_t *brdp; |
2317 | unsigned long ftype, flags; | 2077 | unsigned long ftype, flags; |
2318 | |||
2319 | #ifdef DEBUG | ||
2320 | printk(KERN_DEBUG "stli_flushbuffer(tty=%x)\n", (int) tty); | ||
2321 | #endif | ||
2322 | 2078 | ||
2323 | if (tty == (struct tty_struct *) NULL) | ||
2324 | return; | ||
2325 | portp = tty->driver_data; | 2079 | portp = tty->driver_data; |
2326 | if (portp == (stliport_t *) NULL) | 2080 | if (portp == NULL) |
2327 | return; | 2081 | return; |
2328 | if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds)) | 2082 | if (portp->brdnr < 0 || portp->brdnr >= stli_nrbrds) |
2329 | return; | 2083 | return; |
2330 | brdp = stli_brds[portp->brdnr]; | 2084 | brdp = stli_brds[portp->brdnr]; |
2331 | if (brdp == (stlibrd_t *) NULL) | 2085 | if (brdp == NULL) |
2332 | return; | 2086 | return; |
2333 | 2087 | ||
2334 | save_flags(flags); | 2088 | spin_lock_irqsave(&brd_lock, flags); |
2335 | cli(); | ||
2336 | if (tty == stli_txcooktty) { | 2089 | if (tty == stli_txcooktty) { |
2337 | stli_txcooktty = (struct tty_struct *) NULL; | 2090 | stli_txcooktty = NULL; |
2338 | stli_txcooksize = 0; | 2091 | stli_txcooksize = 0; |
2339 | stli_txcookrealsize = 0; | 2092 | stli_txcookrealsize = 0; |
2340 | } | 2093 | } |
@@ -2346,15 +2099,10 @@ static void stli_flushbuffer(struct tty_struct *tty) | |||
2346 | ftype |= FLUSHRX; | 2099 | ftype |= FLUSHRX; |
2347 | clear_bit(ST_DOFLUSHRX, &portp->state); | 2100 | clear_bit(ST_DOFLUSHRX, &portp->state); |
2348 | } | 2101 | } |
2349 | stli_sendcmd(brdp, portp, A_FLUSH, &ftype, | 2102 | __stli_sendcmd(brdp, portp, A_FLUSH, &ftype, sizeof(u32), 0); |
2350 | sizeof(unsigned long), 0); | ||
2351 | } | 2103 | } |
2352 | restore_flags(flags); | 2104 | spin_unlock_irqrestore(&brd_lock, flags); |
2353 | 2105 | tty_wakeup(tty); | |
2354 | wake_up_interruptible(&tty->write_wait); | ||
2355 | if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) && | ||
2356 | tty->ldisc.write_wakeup) | ||
2357 | (tty->ldisc.write_wakeup)(tty); | ||
2358 | } | 2106 | } |
2359 | 2107 | ||
2360 | /*****************************************************************************/ | 2108 | /*****************************************************************************/ |
@@ -2364,55 +2112,31 @@ static void stli_breakctl(struct tty_struct *tty, int state) | |||
2364 | stlibrd_t *brdp; | 2112 | stlibrd_t *brdp; |
2365 | stliport_t *portp; | 2113 | stliport_t *portp; |
2366 | long arg; | 2114 | long arg; |
2367 | /* long savestate, savetime; */ | ||
2368 | |||
2369 | #ifdef DEBUG | ||
2370 | printk(KERN_DEBUG "stli_breakctl(tty=%x,state=%d)\n", (int) tty, state); | ||
2371 | #endif | ||
2372 | 2115 | ||
2373 | if (tty == (struct tty_struct *) NULL) | ||
2374 | return; | ||
2375 | portp = tty->driver_data; | 2116 | portp = tty->driver_data; |
2376 | if (portp == (stliport_t *) NULL) | 2117 | if (portp == NULL) |
2377 | return; | 2118 | return; |
2378 | if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds)) | 2119 | if (portp->brdnr < 0 || portp->brdnr >= stli_nrbrds) |
2379 | return; | 2120 | return; |
2380 | brdp = stli_brds[portp->brdnr]; | 2121 | brdp = stli_brds[portp->brdnr]; |
2381 | if (brdp == (stlibrd_t *) NULL) | 2122 | if (brdp == NULL) |
2382 | return; | 2123 | return; |
2383 | 2124 | ||
2384 | /* | ||
2385 | * Due to a bug in the tty send_break() code we need to preserve | ||
2386 | * the current process state and timeout... | ||
2387 | savetime = current->timeout; | ||
2388 | savestate = current->state; | ||
2389 | */ | ||
2390 | |||
2391 | arg = (state == -1) ? BREAKON : BREAKOFF; | 2125 | arg = (state == -1) ? BREAKON : BREAKOFF; |
2392 | stli_cmdwait(brdp, portp, A_BREAK, &arg, sizeof(long), 0); | 2126 | stli_cmdwait(brdp, portp, A_BREAK, &arg, sizeof(long), 0); |
2393 | |||
2394 | /* | ||
2395 | * | ||
2396 | current->timeout = savetime; | ||
2397 | current->state = savestate; | ||
2398 | */ | ||
2399 | } | 2127 | } |
2400 | 2128 | ||
2401 | /*****************************************************************************/ | 2129 | /*****************************************************************************/ |
2402 | 2130 | ||
2403 | static void stli_waituntilsent(struct tty_struct *tty, int timeout) | 2131 | static void stli_waituntilsent(struct tty_struct *tty, int timeout) |
2404 | { | 2132 | { |
2405 | stliport_t *portp; | 2133 | stliport_t *portp; |
2406 | unsigned long tend; | 2134 | unsigned long tend; |
2407 | |||
2408 | #ifdef DEBUG | ||
2409 | printk(KERN_DEBUG "stli_waituntilsent(tty=%x,timeout=%x)\n", (int) tty, timeout); | ||
2410 | #endif | ||
2411 | 2135 | ||
2412 | if (tty == (struct tty_struct *) NULL) | 2136 | if (tty == NULL) |
2413 | return; | 2137 | return; |
2414 | portp = tty->driver_data; | 2138 | portp = tty->driver_data; |
2415 | if (portp == (stliport_t *) NULL) | 2139 | if (portp == NULL) |
2416 | return; | 2140 | return; |
2417 | 2141 | ||
2418 | if (timeout == 0) | 2142 | if (timeout == 0) |
@@ -2436,19 +2160,13 @@ static void stli_sendxchar(struct tty_struct *tty, char ch) | |||
2436 | stliport_t *portp; | 2160 | stliport_t *portp; |
2437 | asyctrl_t actrl; | 2161 | asyctrl_t actrl; |
2438 | 2162 | ||
2439 | #ifdef DEBUG | ||
2440 | printk(KERN_DEBUG "stli_sendxchar(tty=%x,ch=%x)\n", (int) tty, ch); | ||
2441 | #endif | ||
2442 | |||
2443 | if (tty == (struct tty_struct *) NULL) | ||
2444 | return; | ||
2445 | portp = tty->driver_data; | 2163 | portp = tty->driver_data; |
2446 | if (portp == (stliport_t *) NULL) | 2164 | if (portp == NULL) |
2447 | return; | 2165 | return; |
2448 | if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds)) | 2166 | if (portp->brdnr < 0 || portp->brdnr >= stli_nrbrds) |
2449 | return; | 2167 | return; |
2450 | brdp = stli_brds[portp->brdnr]; | 2168 | brdp = stli_brds[portp->brdnr]; |
2451 | if (brdp == (stlibrd_t *) NULL) | 2169 | if (brdp == NULL) |
2452 | return; | 2170 | return; |
2453 | 2171 | ||
2454 | memset(&actrl, 0, sizeof(asyctrl_t)); | 2172 | memset(&actrl, 0, sizeof(asyctrl_t)); |
@@ -2460,7 +2178,6 @@ static void stli_sendxchar(struct tty_struct *tty, char ch) | |||
2460 | actrl.txctrl = CT_SENDCHR; | 2178 | actrl.txctrl = CT_SENDCHR; |
2461 | actrl.tximdch = ch; | 2179 | actrl.tximdch = ch; |
2462 | } | 2180 | } |
2463 | |||
2464 | stli_cmdwait(brdp, portp, A_PORTCTRL, &actrl, sizeof(asyctrl_t), 0); | 2181 | stli_cmdwait(brdp, portp, A_PORTCTRL, &actrl, sizeof(asyctrl_t), 0); |
2465 | } | 2182 | } |
2466 | 2183 | ||
@@ -2476,17 +2193,17 @@ static void stli_sendxchar(struct tty_struct *tty, char ch) | |||
2476 | 2193 | ||
2477 | static int stli_portinfo(stlibrd_t *brdp, stliport_t *portp, int portnr, char *pos) | 2194 | static int stli_portinfo(stlibrd_t *brdp, stliport_t *portp, int portnr, char *pos) |
2478 | { | 2195 | { |
2479 | char *sp, *uart; | 2196 | char *sp, *uart; |
2480 | int rc, cnt; | 2197 | int rc, cnt; |
2481 | 2198 | ||
2482 | rc = stli_portcmdstats(portp); | 2199 | rc = stli_portcmdstats(portp); |
2483 | 2200 | ||
2484 | uart = "UNKNOWN"; | 2201 | uart = "UNKNOWN"; |
2485 | if (brdp->state & BST_STARTED) { | 2202 | if (brdp->state & BST_STARTED) { |
2486 | switch (stli_comstats.hwid) { | 2203 | switch (stli_comstats.hwid) { |
2487 | case 0: uart = "2681"; break; | 2204 | case 0: uart = "2681"; break; |
2488 | case 1: uart = "SC26198"; break; | 2205 | case 1: uart = "SC26198"; break; |
2489 | default: uart = "CD1400"; break; | 2206 | default:uart = "CD1400"; break; |
2490 | } | 2207 | } |
2491 | } | 2208 | } |
2492 | 2209 | ||
@@ -2537,17 +2254,11 @@ static int stli_portinfo(stlibrd_t *brdp, stliport_t *portp, int portnr, char *p | |||
2537 | 2254 | ||
2538 | static int stli_readproc(char *page, char **start, off_t off, int count, int *eof, void *data) | 2255 | static int stli_readproc(char *page, char **start, off_t off, int count, int *eof, void *data) |
2539 | { | 2256 | { |
2540 | stlibrd_t *brdp; | 2257 | stlibrd_t *brdp; |
2541 | stliport_t *portp; | 2258 | stliport_t *portp; |
2542 | int brdnr, portnr, totalport; | 2259 | int brdnr, portnr, totalport; |
2543 | int curoff, maxoff; | 2260 | int curoff, maxoff; |
2544 | char *pos; | 2261 | char *pos; |
2545 | |||
2546 | #ifdef DEBUG | ||
2547 | printk(KERN_DEBUG "stli_readproc(page=%x,start=%x,off=%x,count=%d,eof=%x," | ||
2548 | "data=%x\n", (int) page, (int) start, (int) off, count, | ||
2549 | (int) eof, (int) data); | ||
2550 | #endif | ||
2551 | 2262 | ||
2552 | pos = page; | 2263 | pos = page; |
2553 | totalport = 0; | 2264 | totalport = 0; |
@@ -2568,7 +2279,7 @@ static int stli_readproc(char *page, char **start, off_t off, int count, int *eo | |||
2568 | */ | 2279 | */ |
2569 | for (brdnr = 0; (brdnr < stli_nrbrds); brdnr++) { | 2280 | for (brdnr = 0; (brdnr < stli_nrbrds); brdnr++) { |
2570 | brdp = stli_brds[brdnr]; | 2281 | brdp = stli_brds[brdnr]; |
2571 | if (brdp == (stlibrd_t *) NULL) | 2282 | if (brdp == NULL) |
2572 | continue; | 2283 | continue; |
2573 | if (brdp->state == 0) | 2284 | if (brdp->state == 0) |
2574 | continue; | 2285 | continue; |
@@ -2583,7 +2294,7 @@ static int stli_readproc(char *page, char **start, off_t off, int count, int *eo | |||
2583 | for (portnr = 0; (portnr < brdp->nrports); portnr++, | 2294 | for (portnr = 0; (portnr < brdp->nrports); portnr++, |
2584 | totalport++) { | 2295 | totalport++) { |
2585 | portp = brdp->ports[portnr]; | 2296 | portp = brdp->ports[portnr]; |
2586 | if (portp == (stliport_t *) NULL) | 2297 | if (portp == NULL) |
2587 | continue; | 2298 | continue; |
2588 | if (off >= (curoff += MAXLINE)) | 2299 | if (off >= (curoff += MAXLINE)) |
2589 | continue; | 2300 | continue; |
@@ -2610,49 +2321,54 @@ stli_readdone: | |||
2610 | * a poll routine that does not have user context. Therefore you cannot | 2321 | * a poll routine that does not have user context. Therefore you cannot |
2611 | * copy back directly into user space, or to the kernel stack of a | 2322 | * copy back directly into user space, or to the kernel stack of a |
2612 | * process. This routine does not sleep, so can be called from anywhere. | 2323 | * process. This routine does not sleep, so can be called from anywhere. |
2324 | * | ||
2325 | * The caller must hold the brd_lock (see also stli_sendcmd the usual | ||
2326 | * entry point) | ||
2613 | */ | 2327 | */ |
2614 | 2328 | ||
2615 | static void stli_sendcmd(stlibrd_t *brdp, stliport_t *portp, unsigned long cmd, void *arg, int size, int copyback) | 2329 | static void __stli_sendcmd(stlibrd_t *brdp, stliport_t *portp, unsigned long cmd, void *arg, int size, int copyback) |
2616 | { | 2330 | { |
2617 | volatile cdkhdr_t *hdrp; | 2331 | cdkhdr_t __iomem *hdrp; |
2618 | volatile cdkctrl_t *cp; | 2332 | cdkctrl_t __iomem *cp; |
2619 | volatile unsigned char *bits; | 2333 | unsigned char __iomem *bits; |
2620 | unsigned long flags; | 2334 | unsigned long flags; |
2621 | |||
2622 | #ifdef DEBUG | ||
2623 | printk(KERN_DEBUG "stli_sendcmd(brdp=%x,portp=%x,cmd=%x,arg=%x,size=%d," | ||
2624 | "copyback=%d)\n", (int) brdp, (int) portp, (int) cmd, | ||
2625 | (int) arg, size, copyback); | ||
2626 | #endif | ||
2627 | 2335 | ||
2628 | save_flags(flags); | 2336 | spin_lock_irqsave(&brd_lock, flags); |
2629 | cli(); | ||
2630 | 2337 | ||
2631 | if (test_bit(ST_CMDING, &portp->state)) { | 2338 | if (test_bit(ST_CMDING, &portp->state)) { |
2632 | printk(KERN_ERR "STALLION: command already busy, cmd=%x!\n", | 2339 | printk(KERN_ERR "STALLION: command already busy, cmd=%x!\n", |
2633 | (int) cmd); | 2340 | (int) cmd); |
2634 | restore_flags(flags); | 2341 | spin_unlock_irqrestore(&brd_lock, flags); |
2635 | return; | 2342 | return; |
2636 | } | 2343 | } |
2637 | 2344 | ||
2638 | EBRDENABLE(brdp); | 2345 | EBRDENABLE(brdp); |
2639 | cp = &((volatile cdkasy_t *) EBRDGETMEMPTR(brdp, portp->addr))->ctrl; | 2346 | cp = &((cdkasy_t __iomem *) EBRDGETMEMPTR(brdp, portp->addr))->ctrl; |
2640 | if (size > 0) { | 2347 | if (size > 0) { |
2641 | memcpy((void *) &(cp->args[0]), arg, size); | 2348 | memcpy_toio((void __iomem *) &(cp->args[0]), arg, size); |
2642 | if (copyback) { | 2349 | if (copyback) { |
2643 | portp->argp = arg; | 2350 | portp->argp = arg; |
2644 | portp->argsize = size; | 2351 | portp->argsize = size; |
2645 | } | 2352 | } |
2646 | } | 2353 | } |
2647 | cp->status = 0; | 2354 | writel(0, &cp->status); |
2648 | cp->cmd = cmd; | 2355 | writel(cmd, &cp->cmd); |
2649 | hdrp = (volatile cdkhdr_t *) EBRDGETMEMPTR(brdp, CDK_CDKADDR); | 2356 | hdrp = (cdkhdr_t __iomem *) EBRDGETMEMPTR(brdp, CDK_CDKADDR); |
2650 | bits = ((volatile unsigned char *) hdrp) + brdp->slaveoffset + | 2357 | bits = ((unsigned char __iomem *) hdrp) + brdp->slaveoffset + |
2651 | portp->portidx; | 2358 | portp->portidx; |
2652 | *bits |= portp->portbit; | 2359 | writeb(readb(bits) | portp->portbit, bits); |
2653 | set_bit(ST_CMDING, &portp->state); | 2360 | set_bit(ST_CMDING, &portp->state); |
2654 | EBRDDISABLE(brdp); | 2361 | EBRDDISABLE(brdp); |
2655 | restore_flags(flags); | 2362 | spin_unlock_irqrestore(&brd_lock, flags); |
2363 | } | ||
2364 | |||
2365 | static void stli_sendcmd(stlibrd_t *brdp, stliport_t *portp, unsigned long cmd, void *arg, int size, int copyback) | ||
2366 | { | ||
2367 | unsigned long flags; | ||
2368 | |||
2369 | spin_lock_irqsave(&brd_lock, flags); | ||
2370 | __stli_sendcmd(brdp, portp, cmd, arg, size, copyback); | ||
2371 | spin_unlock_irqrestore(&brd_lock, flags); | ||
2656 | } | 2372 | } |
2657 | 2373 | ||
2658 | /*****************************************************************************/ | 2374 | /*****************************************************************************/ |
@@ -2667,28 +2383,23 @@ static void stli_sendcmd(stlibrd_t *brdp, stliport_t *portp, unsigned long cmd, | |||
2667 | 2383 | ||
2668 | static void stli_read(stlibrd_t *brdp, stliport_t *portp) | 2384 | static void stli_read(stlibrd_t *brdp, stliport_t *portp) |
2669 | { | 2385 | { |
2670 | volatile cdkasyrq_t *rp; | 2386 | cdkasyrq_t __iomem *rp; |
2671 | volatile char *shbuf; | 2387 | char __iomem *shbuf; |
2672 | struct tty_struct *tty; | 2388 | struct tty_struct *tty; |
2673 | unsigned int head, tail, size; | 2389 | unsigned int head, tail, size; |
2674 | unsigned int len, stlen; | 2390 | unsigned int len, stlen; |
2675 | |||
2676 | #ifdef DEBUG | ||
2677 | printk(KERN_DEBUG "stli_read(brdp=%x,portp=%d)\n", | ||
2678 | (int) brdp, (int) portp); | ||
2679 | #endif | ||
2680 | 2391 | ||
2681 | if (test_bit(ST_RXSTOP, &portp->state)) | 2392 | if (test_bit(ST_RXSTOP, &portp->state)) |
2682 | return; | 2393 | return; |
2683 | tty = portp->tty; | 2394 | tty = portp->tty; |
2684 | if (tty == (struct tty_struct *) NULL) | 2395 | if (tty == NULL) |
2685 | return; | 2396 | return; |
2686 | 2397 | ||
2687 | rp = &((volatile cdkasy_t *) EBRDGETMEMPTR(brdp, portp->addr))->rxq; | 2398 | rp = &((cdkasy_t __iomem *) EBRDGETMEMPTR(brdp, portp->addr))->rxq; |
2688 | head = (unsigned int) rp->head; | 2399 | head = (unsigned int) readw(&rp->head); |
2689 | if (head != ((unsigned int) rp->head)) | 2400 | if (head != ((unsigned int) readw(&rp->head))) |
2690 | head = (unsigned int) rp->head; | 2401 | head = (unsigned int) readw(&rp->head); |
2691 | tail = (unsigned int) rp->tail; | 2402 | tail = (unsigned int) readw(&rp->tail); |
2692 | size = portp->rxsize; | 2403 | size = portp->rxsize; |
2693 | if (head >= tail) { | 2404 | if (head >= tail) { |
2694 | len = head - tail; | 2405 | len = head - tail; |
@@ -2699,12 +2410,15 @@ static void stli_read(stlibrd_t *brdp, stliport_t *portp) | |||
2699 | } | 2410 | } |
2700 | 2411 | ||
2701 | len = tty_buffer_request_room(tty, len); | 2412 | len = tty_buffer_request_room(tty, len); |
2702 | /* FIXME : iomap ? */ | 2413 | |
2703 | shbuf = (volatile char *) EBRDGETMEMPTR(brdp, portp->rxoffset); | 2414 | shbuf = (char __iomem *) EBRDGETMEMPTR(brdp, portp->rxoffset); |
2704 | 2415 | ||
2705 | while (len > 0) { | 2416 | while (len > 0) { |
2417 | unsigned char *cptr; | ||
2418 | |||
2706 | stlen = MIN(len, stlen); | 2419 | stlen = MIN(len, stlen); |
2707 | tty_insert_flip_string(tty, (char *)(shbuf + tail), stlen); | 2420 | tty_prepare_flip_string(tty, &cptr, stlen); |
2421 | memcpy_fromio(cptr, shbuf + tail, stlen); | ||
2708 | len -= stlen; | 2422 | len -= stlen; |
2709 | tail += stlen; | 2423 | tail += stlen; |
2710 | if (tail >= size) { | 2424 | if (tail >= size) { |
@@ -2712,8 +2426,8 @@ static void stli_read(stlibrd_t *brdp, stliport_t *portp) | |||
2712 | stlen = head; | 2426 | stlen = head; |
2713 | } | 2427 | } |
2714 | } | 2428 | } |
2715 | rp = &((volatile cdkasy_t *) EBRDGETMEMPTR(brdp, portp->addr))->rxq; | 2429 | rp = &((cdkasy_t __iomem *) EBRDGETMEMPTR(brdp, portp->addr))->rxq; |
2716 | rp->tail = tail; | 2430 | writew(tail, &rp->tail); |
2717 | 2431 | ||
2718 | if (head != tail) | 2432 | if (head != tail) |
2719 | set_bit(ST_RXING, &portp->state); | 2433 | set_bit(ST_RXING, &portp->state); |
@@ -2729,9 +2443,9 @@ static void stli_read(stlibrd_t *brdp, stliport_t *portp) | |||
2729 | * difficult to deal with them here. | 2443 | * difficult to deal with them here. |
2730 | */ | 2444 | */ |
2731 | 2445 | ||
2732 | static void stli_dodelaycmd(stliport_t *portp, volatile cdkctrl_t *cp) | 2446 | static void stli_dodelaycmd(stliport_t *portp, cdkctrl_t __iomem *cp) |
2733 | { | 2447 | { |
2734 | int cmd; | 2448 | int cmd; |
2735 | 2449 | ||
2736 | if (test_bit(ST_DOSIGS, &portp->state)) { | 2450 | if (test_bit(ST_DOSIGS, &portp->state)) { |
2737 | if (test_bit(ST_DOFLUSHTX, &portp->state) && | 2451 | if (test_bit(ST_DOFLUSHTX, &portp->state) && |
@@ -2746,10 +2460,10 @@ static void stli_dodelaycmd(stliport_t *portp, volatile cdkctrl_t *cp) | |||
2746 | clear_bit(ST_DOFLUSHTX, &portp->state); | 2460 | clear_bit(ST_DOFLUSHTX, &portp->state); |
2747 | clear_bit(ST_DOFLUSHRX, &portp->state); | 2461 | clear_bit(ST_DOFLUSHRX, &portp->state); |
2748 | clear_bit(ST_DOSIGS, &portp->state); | 2462 | clear_bit(ST_DOSIGS, &portp->state); |
2749 | memcpy((void *) &(cp->args[0]), (void *) &portp->asig, | 2463 | memcpy_toio((void __iomem *) &(cp->args[0]), (void *) &portp->asig, |
2750 | sizeof(asysigs_t)); | 2464 | sizeof(asysigs_t)); |
2751 | cp->status = 0; | 2465 | writel(0, &cp->status); |
2752 | cp->cmd = cmd; | 2466 | writel(cmd, &cp->cmd); |
2753 | set_bit(ST_CMDING, &portp->state); | 2467 | set_bit(ST_CMDING, &portp->state); |
2754 | } else if (test_bit(ST_DOFLUSHTX, &portp->state) || | 2468 | } else if (test_bit(ST_DOFLUSHTX, &portp->state) || |
2755 | test_bit(ST_DOFLUSHRX, &portp->state)) { | 2469 | test_bit(ST_DOFLUSHRX, &portp->state)) { |
@@ -2757,9 +2471,9 @@ static void stli_dodelaycmd(stliport_t *portp, volatile cdkctrl_t *cp) | |||
2757 | cmd |= ((test_bit(ST_DOFLUSHRX, &portp->state)) ? FLUSHRX : 0); | 2471 | cmd |= ((test_bit(ST_DOFLUSHRX, &portp->state)) ? FLUSHRX : 0); |
2758 | clear_bit(ST_DOFLUSHTX, &portp->state); | 2472 | clear_bit(ST_DOFLUSHTX, &portp->state); |
2759 | clear_bit(ST_DOFLUSHRX, &portp->state); | 2473 | clear_bit(ST_DOFLUSHRX, &portp->state); |
2760 | memcpy((void *) &(cp->args[0]), (void *) &cmd, sizeof(int)); | 2474 | memcpy_toio((void __iomem *) &(cp->args[0]), (void *) &cmd, sizeof(int)); |
2761 | cp->status = 0; | 2475 | writel(0, &cp->status); |
2762 | cp->cmd = A_FLUSH; | 2476 | writel(A_FLUSH, &cp->cmd); |
2763 | set_bit(ST_CMDING, &portp->state); | 2477 | set_bit(ST_CMDING, &portp->state); |
2764 | } | 2478 | } |
2765 | } | 2479 | } |
@@ -2779,30 +2493,25 @@ static void stli_dodelaycmd(stliport_t *portp, volatile cdkctrl_t *cp) | |||
2779 | 2493 | ||
2780 | static int stli_hostcmd(stlibrd_t *brdp, stliport_t *portp) | 2494 | static int stli_hostcmd(stlibrd_t *brdp, stliport_t *portp) |
2781 | { | 2495 | { |
2782 | volatile cdkasy_t *ap; | 2496 | cdkasy_t __iomem *ap; |
2783 | volatile cdkctrl_t *cp; | 2497 | cdkctrl_t __iomem *cp; |
2784 | struct tty_struct *tty; | 2498 | struct tty_struct *tty; |
2785 | asynotify_t nt; | 2499 | asynotify_t nt; |
2786 | unsigned long oldsigs; | 2500 | unsigned long oldsigs; |
2787 | int rc, donerx; | 2501 | int rc, donerx; |
2788 | 2502 | ||
2789 | #ifdef DEBUG | 2503 | ap = (cdkasy_t __iomem *) EBRDGETMEMPTR(brdp, portp->addr); |
2790 | printk(KERN_DEBUG "stli_hostcmd(brdp=%x,channr=%d)\n", | ||
2791 | (int) brdp, channr); | ||
2792 | #endif | ||
2793 | |||
2794 | ap = (volatile cdkasy_t *) EBRDGETMEMPTR(brdp, portp->addr); | ||
2795 | cp = &ap->ctrl; | 2504 | cp = &ap->ctrl; |
2796 | 2505 | ||
2797 | /* | 2506 | /* |
2798 | * Check if we are waiting for an open completion message. | 2507 | * Check if we are waiting for an open completion message. |
2799 | */ | 2508 | */ |
2800 | if (test_bit(ST_OPENING, &portp->state)) { | 2509 | if (test_bit(ST_OPENING, &portp->state)) { |
2801 | rc = (int) cp->openarg; | 2510 | rc = readl(&cp->openarg); |
2802 | if ((cp->open == 0) && (rc != 0)) { | 2511 | if (readb(&cp->open) == 0 && rc != 0) { |
2803 | if (rc > 0) | 2512 | if (rc > 0) |
2804 | rc--; | 2513 | rc--; |
2805 | cp->openarg = 0; | 2514 | writel(0, &cp->openarg); |
2806 | portp->rc = rc; | 2515 | portp->rc = rc; |
2807 | clear_bit(ST_OPENING, &portp->state); | 2516 | clear_bit(ST_OPENING, &portp->state); |
2808 | wake_up_interruptible(&portp->raw_wait); | 2517 | wake_up_interruptible(&portp->raw_wait); |
@@ -2813,11 +2522,11 @@ static int stli_hostcmd(stlibrd_t *brdp, stliport_t *portp) | |||
2813 | * Check if we are waiting for a close completion message. | 2522 | * Check if we are waiting for a close completion message. |
2814 | */ | 2523 | */ |
2815 | if (test_bit(ST_CLOSING, &portp->state)) { | 2524 | if (test_bit(ST_CLOSING, &portp->state)) { |
2816 | rc = (int) cp->closearg; | 2525 | rc = (int) readl(&cp->closearg); |
2817 | if ((cp->close == 0) && (rc != 0)) { | 2526 | if (readb(&cp->close) == 0 && rc != 0) { |
2818 | if (rc > 0) | 2527 | if (rc > 0) |
2819 | rc--; | 2528 | rc--; |
2820 | cp->closearg = 0; | 2529 | writel(0, &cp->closearg); |
2821 | portp->rc = rc; | 2530 | portp->rc = rc; |
2822 | clear_bit(ST_CLOSING, &portp->state); | 2531 | clear_bit(ST_CLOSING, &portp->state); |
2823 | wake_up_interruptible(&portp->raw_wait); | 2532 | wake_up_interruptible(&portp->raw_wait); |
@@ -2829,16 +2538,16 @@ static int stli_hostcmd(stlibrd_t *brdp, stliport_t *portp) | |||
2829 | * need to copy out the command results associated with this command. | 2538 | * need to copy out the command results associated with this command. |
2830 | */ | 2539 | */ |
2831 | if (test_bit(ST_CMDING, &portp->state)) { | 2540 | if (test_bit(ST_CMDING, &portp->state)) { |
2832 | rc = cp->status; | 2541 | rc = readl(&cp->status); |
2833 | if ((cp->cmd == 0) && (rc != 0)) { | 2542 | if (readl(&cp->cmd) == 0 && rc != 0) { |
2834 | if (rc > 0) | 2543 | if (rc > 0) |
2835 | rc--; | 2544 | rc--; |
2836 | if (portp->argp != (void *) NULL) { | 2545 | if (portp->argp != NULL) { |
2837 | memcpy(portp->argp, (void *) &(cp->args[0]), | 2546 | memcpy_fromio(portp->argp, (void __iomem *) &(cp->args[0]), |
2838 | portp->argsize); | 2547 | portp->argsize); |
2839 | portp->argp = (void *) NULL; | 2548 | portp->argp = NULL; |
2840 | } | 2549 | } |
2841 | cp->status = 0; | 2550 | writel(0, &cp->status); |
2842 | portp->rc = rc; | 2551 | portp->rc = rc; |
2843 | clear_bit(ST_CMDING, &portp->state); | 2552 | clear_bit(ST_CMDING, &portp->state); |
2844 | stli_dodelaycmd(portp, cp); | 2553 | stli_dodelaycmd(portp, cp); |
@@ -2877,18 +2586,15 @@ static int stli_hostcmd(stlibrd_t *brdp, stliport_t *portp) | |||
2877 | if (nt.data & DT_TXEMPTY) | 2586 | if (nt.data & DT_TXEMPTY) |
2878 | clear_bit(ST_TXBUSY, &portp->state); | 2587 | clear_bit(ST_TXBUSY, &portp->state); |
2879 | if (nt.data & (DT_TXEMPTY | DT_TXLOW)) { | 2588 | if (nt.data & (DT_TXEMPTY | DT_TXLOW)) { |
2880 | if (tty != (struct tty_struct *) NULL) { | 2589 | if (tty != NULL) { |
2881 | if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) && | 2590 | tty_wakeup(tty); |
2882 | tty->ldisc.write_wakeup) { | 2591 | EBRDENABLE(brdp); |
2883 | (tty->ldisc.write_wakeup)(tty); | ||
2884 | EBRDENABLE(brdp); | ||
2885 | } | ||
2886 | wake_up_interruptible(&tty->write_wait); | 2592 | wake_up_interruptible(&tty->write_wait); |
2887 | } | 2593 | } |
2888 | } | 2594 | } |
2889 | 2595 | ||
2890 | if ((nt.data & DT_RXBREAK) && (portp->rxmarkmsk & BRKINT)) { | 2596 | if ((nt.data & DT_RXBREAK) && (portp->rxmarkmsk & BRKINT)) { |
2891 | if (tty != (struct tty_struct *) NULL) { | 2597 | if (tty != NULL) { |
2892 | tty_insert_flip_char(tty, 0, TTY_BREAK); | 2598 | tty_insert_flip_char(tty, 0, TTY_BREAK); |
2893 | if (portp->flags & ASYNC_SAK) { | 2599 | if (portp->flags & ASYNC_SAK) { |
2894 | do_SAK(tty); | 2600 | do_SAK(tty); |
@@ -2932,14 +2638,14 @@ static int stli_hostcmd(stlibrd_t *brdp, stliport_t *portp) | |||
2932 | * at the cdk header structure. | 2638 | * at the cdk header structure. |
2933 | */ | 2639 | */ |
2934 | 2640 | ||
2935 | static void stli_brdpoll(stlibrd_t *brdp, volatile cdkhdr_t *hdrp) | 2641 | static void stli_brdpoll(stlibrd_t *brdp, cdkhdr_t __iomem *hdrp) |
2936 | { | 2642 | { |
2937 | stliport_t *portp; | 2643 | stliport_t *portp; |
2938 | unsigned char hostbits[(STL_MAXCHANS / 8) + 1]; | 2644 | unsigned char hostbits[(STL_MAXCHANS / 8) + 1]; |
2939 | unsigned char slavebits[(STL_MAXCHANS / 8) + 1]; | 2645 | unsigned char slavebits[(STL_MAXCHANS / 8) + 1]; |
2940 | unsigned char *slavep; | 2646 | unsigned char __iomem *slavep; |
2941 | int bitpos, bitat, bitsize; | 2647 | int bitpos, bitat, bitsize; |
2942 | int channr, nrdevs, slavebitchange; | 2648 | int channr, nrdevs, slavebitchange; |
2943 | 2649 | ||
2944 | bitsize = brdp->bitsize; | 2650 | bitsize = brdp->bitsize; |
2945 | nrdevs = brdp->nrdevs; | 2651 | nrdevs = brdp->nrdevs; |
@@ -2951,7 +2657,7 @@ static void stli_brdpoll(stlibrd_t *brdp, volatile cdkhdr_t *hdrp) | |||
2951 | * 8 service bits at a time in the inner loop, so we can bypass | 2657 | * 8 service bits at a time in the inner loop, so we can bypass |
2952 | * the lot if none of them want service. | 2658 | * the lot if none of them want service. |
2953 | */ | 2659 | */ |
2954 | memcpy(&hostbits[0], (((unsigned char *) hdrp) + brdp->hostoffset), | 2660 | memcpy_fromio(&hostbits[0], (((unsigned char __iomem *) hdrp) + brdp->hostoffset), |
2955 | bitsize); | 2661 | bitsize); |
2956 | 2662 | ||
2957 | memset(&slavebits[0], 0, bitsize); | 2663 | memset(&slavebits[0], 0, bitsize); |
@@ -2978,11 +2684,11 @@ static void stli_brdpoll(stlibrd_t *brdp, volatile cdkhdr_t *hdrp) | |||
2978 | * service may initiate more slave requests. | 2684 | * service may initiate more slave requests. |
2979 | */ | 2685 | */ |
2980 | if (slavebitchange) { | 2686 | if (slavebitchange) { |
2981 | hdrp = (volatile cdkhdr_t *) EBRDGETMEMPTR(brdp, CDK_CDKADDR); | 2687 | hdrp = (cdkhdr_t __iomem *) EBRDGETMEMPTR(brdp, CDK_CDKADDR); |
2982 | slavep = ((unsigned char *) hdrp) + brdp->slaveoffset; | 2688 | slavep = ((unsigned char __iomem *) hdrp) + brdp->slaveoffset; |
2983 | for (bitpos = 0; (bitpos < bitsize); bitpos++) { | 2689 | for (bitpos = 0; (bitpos < bitsize); bitpos++) { |
2984 | if (slavebits[bitpos]) | 2690 | if (readb(slavebits + bitpos)) |
2985 | slavep[bitpos] &= ~slavebits[bitpos]; | 2691 | writeb(readb(slavep + bitpos) & ~slavebits[bitpos], slavebits + bitpos); |
2986 | } | 2692 | } |
2987 | } | 2693 | } |
2988 | } | 2694 | } |
@@ -3000,9 +2706,9 @@ static void stli_brdpoll(stlibrd_t *brdp, volatile cdkhdr_t *hdrp) | |||
3000 | 2706 | ||
3001 | static void stli_poll(unsigned long arg) | 2707 | static void stli_poll(unsigned long arg) |
3002 | { | 2708 | { |
3003 | volatile cdkhdr_t *hdrp; | 2709 | cdkhdr_t __iomem *hdrp; |
3004 | stlibrd_t *brdp; | 2710 | stlibrd_t *brdp; |
3005 | int brdnr; | 2711 | int brdnr; |
3006 | 2712 | ||
3007 | stli_timerlist.expires = STLI_TIMEOUT; | 2713 | stli_timerlist.expires = STLI_TIMEOUT; |
3008 | add_timer(&stli_timerlist); | 2714 | add_timer(&stli_timerlist); |
@@ -3012,16 +2718,18 @@ static void stli_poll(unsigned long arg) | |||
3012 | */ | 2718 | */ |
3013 | for (brdnr = 0; (brdnr < stli_nrbrds); brdnr++) { | 2719 | for (brdnr = 0; (brdnr < stli_nrbrds); brdnr++) { |
3014 | brdp = stli_brds[brdnr]; | 2720 | brdp = stli_brds[brdnr]; |
3015 | if (brdp == (stlibrd_t *) NULL) | 2721 | if (brdp == NULL) |
3016 | continue; | 2722 | continue; |
3017 | if ((brdp->state & BST_STARTED) == 0) | 2723 | if ((brdp->state & BST_STARTED) == 0) |
3018 | continue; | 2724 | continue; |
3019 | 2725 | ||
2726 | spin_lock(&brd_lock); | ||
3020 | EBRDENABLE(brdp); | 2727 | EBRDENABLE(brdp); |
3021 | hdrp = (volatile cdkhdr_t *) EBRDGETMEMPTR(brdp, CDK_CDKADDR); | 2728 | hdrp = (cdkhdr_t __iomem *) EBRDGETMEMPTR(brdp, CDK_CDKADDR); |
3022 | if (hdrp->hostreq) | 2729 | if (readb(&hdrp->hostreq)) |
3023 | stli_brdpoll(brdp, hdrp); | 2730 | stli_brdpoll(brdp, hdrp); |
3024 | EBRDDISABLE(brdp); | 2731 | EBRDDISABLE(brdp); |
2732 | spin_unlock(&brd_lock); | ||
3025 | } | 2733 | } |
3026 | } | 2734 | } |
3027 | 2735 | ||
@@ -3034,11 +2742,6 @@ static void stli_poll(unsigned long arg) | |||
3034 | 2742 | ||
3035 | static void stli_mkasyport(stliport_t *portp, asyport_t *pp, struct termios *tiosp) | 2743 | static void stli_mkasyport(stliport_t *portp, asyport_t *pp, struct termios *tiosp) |
3036 | { | 2744 | { |
3037 | #ifdef DEBUG | ||
3038 | printk(KERN_DEBUG "stli_mkasyport(portp=%x,pp=%x,tiosp=%d)\n", | ||
3039 | (int) portp, (int) pp, (int) tiosp); | ||
3040 | #endif | ||
3041 | |||
3042 | memset(pp, 0, sizeof(asyport_t)); | 2745 | memset(pp, 0, sizeof(asyport_t)); |
3043 | 2746 | ||
3044 | /* | 2747 | /* |
@@ -3157,11 +2860,6 @@ static void stli_mkasyport(stliport_t *portp, asyport_t *pp, struct termios *tio | |||
3157 | 2860 | ||
3158 | static void stli_mkasysigs(asysigs_t *sp, int dtr, int rts) | 2861 | static void stli_mkasysigs(asysigs_t *sp, int dtr, int rts) |
3159 | { | 2862 | { |
3160 | #ifdef DEBUG | ||
3161 | printk(KERN_DEBUG "stli_mkasysigs(sp=%x,dtr=%d,rts=%d)\n", | ||
3162 | (int) sp, dtr, rts); | ||
3163 | #endif | ||
3164 | |||
3165 | memset(sp, 0, sizeof(asysigs_t)); | 2863 | memset(sp, 0, sizeof(asysigs_t)); |
3166 | if (dtr >= 0) { | 2864 | if (dtr >= 0) { |
3167 | sp->signal |= SG_DTR; | 2865 | sp->signal |= SG_DTR; |
@@ -3182,13 +2880,7 @@ static void stli_mkasysigs(asysigs_t *sp, int dtr, int rts) | |||
3182 | 2880 | ||
3183 | static long stli_mktiocm(unsigned long sigvalue) | 2881 | static long stli_mktiocm(unsigned long sigvalue) |
3184 | { | 2882 | { |
3185 | long tiocm; | 2883 | long tiocm = 0; |
3186 | |||
3187 | #ifdef DEBUG | ||
3188 | printk(KERN_DEBUG "stli_mktiocm(sigvalue=%x)\n", (int) sigvalue); | ||
3189 | #endif | ||
3190 | |||
3191 | tiocm = 0; | ||
3192 | tiocm |= ((sigvalue & SG_DCD) ? TIOCM_CD : 0); | 2884 | tiocm |= ((sigvalue & SG_DCD) ? TIOCM_CD : 0); |
3193 | tiocm |= ((sigvalue & SG_CTS) ? TIOCM_CTS : 0); | 2885 | tiocm |= ((sigvalue & SG_CTS) ? TIOCM_CTS : 0); |
3194 | tiocm |= ((sigvalue & SG_RI) ? TIOCM_RI : 0); | 2886 | tiocm |= ((sigvalue & SG_RI) ? TIOCM_RI : 0); |
@@ -3210,10 +2902,6 @@ static int stli_initports(stlibrd_t *brdp) | |||
3210 | stliport_t *portp; | 2902 | stliport_t *portp; |
3211 | int i, panelnr, panelport; | 2903 | int i, panelnr, panelport; |
3212 | 2904 | ||
3213 | #ifdef DEBUG | ||
3214 | printk(KERN_DEBUG "stli_initports(brdp=%x)\n", (int) brdp); | ||
3215 | #endif | ||
3216 | |||
3217 | for (i = 0, panelnr = 0, panelport = 0; (i < brdp->nrports); i++) { | 2905 | for (i = 0, panelnr = 0, panelport = 0; (i < brdp->nrports); i++) { |
3218 | portp = kzalloc(sizeof(stliport_t), GFP_KERNEL); | 2906 | portp = kzalloc(sizeof(stliport_t), GFP_KERNEL); |
3219 | if (!portp) { | 2907 | if (!portp) { |
@@ -3240,7 +2928,7 @@ static int stli_initports(stlibrd_t *brdp) | |||
3240 | brdp->ports[i] = portp; | 2928 | brdp->ports[i] = portp; |
3241 | } | 2929 | } |
3242 | 2930 | ||
3243 | return(0); | 2931 | return 0; |
3244 | } | 2932 | } |
3245 | 2933 | ||
3246 | /*****************************************************************************/ | 2934 | /*****************************************************************************/ |
@@ -3253,10 +2941,6 @@ static void stli_ecpinit(stlibrd_t *brdp) | |||
3253 | { | 2941 | { |
3254 | unsigned long memconf; | 2942 | unsigned long memconf; |
3255 | 2943 | ||
3256 | #ifdef DEBUG | ||
3257 | printk(KERN_DEBUG "stli_ecpinit(brdp=%d)\n", (int) brdp); | ||
3258 | #endif | ||
3259 | |||
3260 | outb(ECP_ATSTOP, (brdp->iobase + ECP_ATCONFR)); | 2944 | outb(ECP_ATSTOP, (brdp->iobase + ECP_ATCONFR)); |
3261 | udelay(10); | 2945 | udelay(10); |
3262 | outb(ECP_ATDISABLE, (brdp->iobase + ECP_ATCONFR)); | 2946 | outb(ECP_ATDISABLE, (brdp->iobase + ECP_ATCONFR)); |
@@ -3270,9 +2954,6 @@ static void stli_ecpinit(stlibrd_t *brdp) | |||
3270 | 2954 | ||
3271 | static void stli_ecpenable(stlibrd_t *brdp) | 2955 | static void stli_ecpenable(stlibrd_t *brdp) |
3272 | { | 2956 | { |
3273 | #ifdef DEBUG | ||
3274 | printk(KERN_DEBUG "stli_ecpenable(brdp=%x)\n", (int) brdp); | ||
3275 | #endif | ||
3276 | outb(ECP_ATENABLE, (brdp->iobase + ECP_ATCONFR)); | 2957 | outb(ECP_ATENABLE, (brdp->iobase + ECP_ATCONFR)); |
3277 | } | 2958 | } |
3278 | 2959 | ||
@@ -3280,9 +2961,6 @@ static void stli_ecpenable(stlibrd_t *brdp) | |||
3280 | 2961 | ||
3281 | static void stli_ecpdisable(stlibrd_t *brdp) | 2962 | static void stli_ecpdisable(stlibrd_t *brdp) |
3282 | { | 2963 | { |
3283 | #ifdef DEBUG | ||
3284 | printk(KERN_DEBUG "stli_ecpdisable(brdp=%x)\n", (int) brdp); | ||
3285 | #endif | ||
3286 | outb(ECP_ATDISABLE, (brdp->iobase + ECP_ATCONFR)); | 2964 | outb(ECP_ATDISABLE, (brdp->iobase + ECP_ATCONFR)); |
3287 | } | 2965 | } |
3288 | 2966 | ||
@@ -3290,13 +2968,8 @@ static void stli_ecpdisable(stlibrd_t *brdp) | |||
3290 | 2968 | ||
3291 | static char *stli_ecpgetmemptr(stlibrd_t *brdp, unsigned long offset, int line) | 2969 | static char *stli_ecpgetmemptr(stlibrd_t *brdp, unsigned long offset, int line) |
3292 | { | 2970 | { |
3293 | void *ptr; | 2971 | void *ptr; |
3294 | unsigned char val; | 2972 | unsigned char val; |
3295 | |||
3296 | #ifdef DEBUG | ||
3297 | printk(KERN_DEBUG "stli_ecpgetmemptr(brdp=%x,offset=%x)\n", (int) brdp, | ||
3298 | (int) offset); | ||
3299 | #endif | ||
3300 | 2973 | ||
3301 | if (offset > brdp->memsize) { | 2974 | if (offset > brdp->memsize) { |
3302 | printk(KERN_ERR "STALLION: shared memory pointer=%x out of " | 2975 | printk(KERN_ERR "STALLION: shared memory pointer=%x out of " |
@@ -3316,10 +2989,6 @@ static char *stli_ecpgetmemptr(stlibrd_t *brdp, unsigned long offset, int line) | |||
3316 | 2989 | ||
3317 | static void stli_ecpreset(stlibrd_t *brdp) | 2990 | static void stli_ecpreset(stlibrd_t *brdp) |
3318 | { | 2991 | { |
3319 | #ifdef DEBUG | ||
3320 | printk(KERN_DEBUG "stli_ecpreset(brdp=%x)\n", (int) brdp); | ||
3321 | #endif | ||
3322 | |||
3323 | outb(ECP_ATSTOP, (brdp->iobase + ECP_ATCONFR)); | 2992 | outb(ECP_ATSTOP, (brdp->iobase + ECP_ATCONFR)); |
3324 | udelay(10); | 2993 | udelay(10); |
3325 | outb(ECP_ATDISABLE, (brdp->iobase + ECP_ATCONFR)); | 2994 | outb(ECP_ATDISABLE, (brdp->iobase + ECP_ATCONFR)); |
@@ -3330,9 +2999,6 @@ static void stli_ecpreset(stlibrd_t *brdp) | |||
3330 | 2999 | ||
3331 | static void stli_ecpintr(stlibrd_t *brdp) | 3000 | static void stli_ecpintr(stlibrd_t *brdp) |
3332 | { | 3001 | { |
3333 | #ifdef DEBUG | ||
3334 | printk(KERN_DEBUG "stli_ecpintr(brdp=%x)\n", (int) brdp); | ||
3335 | #endif | ||
3336 | outb(0x1, brdp->iobase); | 3002 | outb(0x1, brdp->iobase); |
3337 | } | 3003 | } |
3338 | 3004 | ||
@@ -3346,10 +3012,6 @@ static void stli_ecpeiinit(stlibrd_t *brdp) | |||
3346 | { | 3012 | { |
3347 | unsigned long memconf; | 3013 | unsigned long memconf; |
3348 | 3014 | ||
3349 | #ifdef DEBUG | ||
3350 | printk(KERN_DEBUG "stli_ecpeiinit(brdp=%x)\n", (int) brdp); | ||
3351 | #endif | ||
3352 | |||
3353 | outb(0x1, (brdp->iobase + ECP_EIBRDENAB)); | 3015 | outb(0x1, (brdp->iobase + ECP_EIBRDENAB)); |
3354 | outb(ECP_EISTOP, (brdp->iobase + ECP_EICONFR)); | 3016 | outb(ECP_EISTOP, (brdp->iobase + ECP_EICONFR)); |
3355 | udelay(10); | 3017 | udelay(10); |
@@ -3383,11 +3045,6 @@ static char *stli_ecpeigetmemptr(stlibrd_t *brdp, unsigned long offset, int line | |||
3383 | void *ptr; | 3045 | void *ptr; |
3384 | unsigned char val; | 3046 | unsigned char val; |
3385 | 3047 | ||
3386 | #ifdef DEBUG | ||
3387 | printk(KERN_DEBUG "stli_ecpeigetmemptr(brdp=%x,offset=%x,line=%d)\n", | ||
3388 | (int) brdp, (int) offset, line); | ||
3389 | #endif | ||
3390 | |||
3391 | if (offset > brdp->memsize) { | 3048 | if (offset > brdp->memsize) { |
3392 | printk(KERN_ERR "STALLION: shared memory pointer=%x out of " | 3049 | printk(KERN_ERR "STALLION: shared memory pointer=%x out of " |
3393 | "range at line=%d(%d), brd=%d\n", | 3050 | "range at line=%d(%d), brd=%d\n", |
@@ -3437,8 +3094,8 @@ static void stli_ecpmcdisable(stlibrd_t *brdp) | |||
3437 | 3094 | ||
3438 | static char *stli_ecpmcgetmemptr(stlibrd_t *brdp, unsigned long offset, int line) | 3095 | static char *stli_ecpmcgetmemptr(stlibrd_t *brdp, unsigned long offset, int line) |
3439 | { | 3096 | { |
3440 | void *ptr; | 3097 | void *ptr; |
3441 | unsigned char val; | 3098 | unsigned char val; |
3442 | 3099 | ||
3443 | if (offset > brdp->memsize) { | 3100 | if (offset > brdp->memsize) { |
3444 | printk(KERN_ERR "STALLION: shared memory pointer=%x out of " | 3101 | printk(KERN_ERR "STALLION: shared memory pointer=%x out of " |
@@ -3472,10 +3129,6 @@ static void stli_ecpmcreset(stlibrd_t *brdp) | |||
3472 | 3129 | ||
3473 | static void stli_ecppciinit(stlibrd_t *brdp) | 3130 | static void stli_ecppciinit(stlibrd_t *brdp) |
3474 | { | 3131 | { |
3475 | #ifdef DEBUG | ||
3476 | printk(KERN_DEBUG "stli_ecppciinit(brdp=%x)\n", (int) brdp); | ||
3477 | #endif | ||
3478 | |||
3479 | outb(ECP_PCISTOP, (brdp->iobase + ECP_PCICONFR)); | 3132 | outb(ECP_PCISTOP, (brdp->iobase + ECP_PCICONFR)); |
3480 | udelay(10); | 3133 | udelay(10); |
3481 | outb(0, (brdp->iobase + ECP_PCICONFR)); | 3134 | outb(0, (brdp->iobase + ECP_PCICONFR)); |
@@ -3489,11 +3142,6 @@ static char *stli_ecppcigetmemptr(stlibrd_t *brdp, unsigned long offset, int lin | |||
3489 | void *ptr; | 3142 | void *ptr; |
3490 | unsigned char val; | 3143 | unsigned char val; |
3491 | 3144 | ||
3492 | #ifdef DEBUG | ||
3493 | printk(KERN_DEBUG "stli_ecppcigetmemptr(brdp=%x,offset=%x,line=%d)\n", | ||
3494 | (int) brdp, (int) offset, line); | ||
3495 | #endif | ||
3496 | |||
3497 | if (offset > brdp->memsize) { | 3145 | if (offset > brdp->memsize) { |
3498 | printk(KERN_ERR "STALLION: shared memory pointer=%x out of " | 3146 | printk(KERN_ERR "STALLION: shared memory pointer=%x out of " |
3499 | "range at line=%d(%d), board=%d\n", | 3147 | "range at line=%d(%d), board=%d\n", |
@@ -3528,10 +3176,6 @@ static void stli_onbinit(stlibrd_t *brdp) | |||
3528 | { | 3176 | { |
3529 | unsigned long memconf; | 3177 | unsigned long memconf; |
3530 | 3178 | ||
3531 | #ifdef DEBUG | ||
3532 | printk(KERN_DEBUG "stli_onbinit(brdp=%d)\n", (int) brdp); | ||
3533 | #endif | ||
3534 | |||
3535 | outb(ONB_ATSTOP, (brdp->iobase + ONB_ATCONFR)); | 3179 | outb(ONB_ATSTOP, (brdp->iobase + ONB_ATCONFR)); |
3536 | udelay(10); | 3180 | udelay(10); |
3537 | outb(ONB_ATDISABLE, (brdp->iobase + ONB_ATCONFR)); | 3181 | outb(ONB_ATDISABLE, (brdp->iobase + ONB_ATCONFR)); |
@@ -3547,9 +3191,6 @@ static void stli_onbinit(stlibrd_t *brdp) | |||
3547 | 3191 | ||
3548 | static void stli_onbenable(stlibrd_t *brdp) | 3192 | static void stli_onbenable(stlibrd_t *brdp) |
3549 | { | 3193 | { |
3550 | #ifdef DEBUG | ||
3551 | printk(KERN_DEBUG "stli_onbenable(brdp=%x)\n", (int) brdp); | ||
3552 | #endif | ||
3553 | outb((brdp->enabval | ONB_ATENABLE), (brdp->iobase + ONB_ATCONFR)); | 3194 | outb((brdp->enabval | ONB_ATENABLE), (brdp->iobase + ONB_ATCONFR)); |
3554 | } | 3195 | } |
3555 | 3196 | ||
@@ -3557,9 +3198,6 @@ static void stli_onbenable(stlibrd_t *brdp) | |||
3557 | 3198 | ||
3558 | static void stli_onbdisable(stlibrd_t *brdp) | 3199 | static void stli_onbdisable(stlibrd_t *brdp) |
3559 | { | 3200 | { |
3560 | #ifdef DEBUG | ||
3561 | printk(KERN_DEBUG "stli_onbdisable(brdp=%x)\n", (int) brdp); | ||
3562 | #endif | ||
3563 | outb((brdp->enabval | ONB_ATDISABLE), (brdp->iobase + ONB_ATCONFR)); | 3201 | outb((brdp->enabval | ONB_ATDISABLE), (brdp->iobase + ONB_ATCONFR)); |
3564 | } | 3202 | } |
3565 | 3203 | ||
@@ -3569,11 +3207,6 @@ static char *stli_onbgetmemptr(stlibrd_t *brdp, unsigned long offset, int line) | |||
3569 | { | 3207 | { |
3570 | void *ptr; | 3208 | void *ptr; |
3571 | 3209 | ||
3572 | #ifdef DEBUG | ||
3573 | printk(KERN_DEBUG "stli_onbgetmemptr(brdp=%x,offset=%x)\n", (int) brdp, | ||
3574 | (int) offset); | ||
3575 | #endif | ||
3576 | |||
3577 | if (offset > brdp->memsize) { | 3210 | if (offset > brdp->memsize) { |
3578 | printk(KERN_ERR "STALLION: shared memory pointer=%x out of " | 3211 | printk(KERN_ERR "STALLION: shared memory pointer=%x out of " |
3579 | "range at line=%d(%d), brd=%d\n", | 3212 | "range at line=%d(%d), brd=%d\n", |
@@ -3589,11 +3222,6 @@ static char *stli_onbgetmemptr(stlibrd_t *brdp, unsigned long offset, int line) | |||
3589 | 3222 | ||
3590 | static void stli_onbreset(stlibrd_t *brdp) | 3223 | static void stli_onbreset(stlibrd_t *brdp) |
3591 | { | 3224 | { |
3592 | |||
3593 | #ifdef DEBUG | ||
3594 | printk(KERN_DEBUG "stli_onbreset(brdp=%x)\n", (int) brdp); | ||
3595 | #endif | ||
3596 | |||
3597 | outb(ONB_ATSTOP, (brdp->iobase + ONB_ATCONFR)); | 3225 | outb(ONB_ATSTOP, (brdp->iobase + ONB_ATCONFR)); |
3598 | udelay(10); | 3226 | udelay(10); |
3599 | outb(ONB_ATDISABLE, (brdp->iobase + ONB_ATCONFR)); | 3227 | outb(ONB_ATDISABLE, (brdp->iobase + ONB_ATCONFR)); |
@@ -3610,10 +3238,6 @@ static void stli_onbeinit(stlibrd_t *brdp) | |||
3610 | { | 3238 | { |
3611 | unsigned long memconf; | 3239 | unsigned long memconf; |
3612 | 3240 | ||
3613 | #ifdef DEBUG | ||
3614 | printk(KERN_DEBUG "stli_onbeinit(brdp=%d)\n", (int) brdp); | ||
3615 | #endif | ||
3616 | |||
3617 | outb(0x1, (brdp->iobase + ONB_EIBRDENAB)); | 3241 | outb(0x1, (brdp->iobase + ONB_EIBRDENAB)); |
3618 | outb(ONB_EISTOP, (brdp->iobase + ONB_EICONFR)); | 3242 | outb(ONB_EISTOP, (brdp->iobase + ONB_EICONFR)); |
3619 | udelay(10); | 3243 | udelay(10); |
@@ -3632,9 +3256,6 @@ static void stli_onbeinit(stlibrd_t *brdp) | |||
3632 | 3256 | ||
3633 | static void stli_onbeenable(stlibrd_t *brdp) | 3257 | static void stli_onbeenable(stlibrd_t *brdp) |
3634 | { | 3258 | { |
3635 | #ifdef DEBUG | ||
3636 | printk(KERN_DEBUG "stli_onbeenable(brdp=%x)\n", (int) brdp); | ||
3637 | #endif | ||
3638 | outb(ONB_EIENABLE, (brdp->iobase + ONB_EICONFR)); | 3259 | outb(ONB_EIENABLE, (brdp->iobase + ONB_EICONFR)); |
3639 | } | 3260 | } |
3640 | 3261 | ||
@@ -3642,9 +3263,6 @@ static void stli_onbeenable(stlibrd_t *brdp) | |||
3642 | 3263 | ||
3643 | static void stli_onbedisable(stlibrd_t *brdp) | 3264 | static void stli_onbedisable(stlibrd_t *brdp) |
3644 | { | 3265 | { |
3645 | #ifdef DEBUG | ||
3646 | printk(KERN_DEBUG "stli_onbedisable(brdp=%x)\n", (int) brdp); | ||
3647 | #endif | ||
3648 | outb(ONB_EIDISABLE, (brdp->iobase + ONB_EICONFR)); | 3266 | outb(ONB_EIDISABLE, (brdp->iobase + ONB_EICONFR)); |
3649 | } | 3267 | } |
3650 | 3268 | ||
@@ -3652,13 +3270,8 @@ static void stli_onbedisable(stlibrd_t *brdp) | |||
3652 | 3270 | ||
3653 | static char *stli_onbegetmemptr(stlibrd_t *brdp, unsigned long offset, int line) | 3271 | static char *stli_onbegetmemptr(stlibrd_t *brdp, unsigned long offset, int line) |
3654 | { | 3272 | { |
3655 | void *ptr; | 3273 | void *ptr; |
3656 | unsigned char val; | 3274 | unsigned char val; |
3657 | |||
3658 | #ifdef DEBUG | ||
3659 | printk(KERN_DEBUG "stli_onbegetmemptr(brdp=%x,offset=%x,line=%d)\n", | ||
3660 | (int) brdp, (int) offset, line); | ||
3661 | #endif | ||
3662 | 3275 | ||
3663 | if (offset > brdp->memsize) { | 3276 | if (offset > brdp->memsize) { |
3664 | printk(KERN_ERR "STALLION: shared memory pointer=%x out of " | 3277 | printk(KERN_ERR "STALLION: shared memory pointer=%x out of " |
@@ -3681,11 +3294,6 @@ static char *stli_onbegetmemptr(stlibrd_t *brdp, unsigned long offset, int line) | |||
3681 | 3294 | ||
3682 | static void stli_onbereset(stlibrd_t *brdp) | 3295 | static void stli_onbereset(stlibrd_t *brdp) |
3683 | { | 3296 | { |
3684 | |||
3685 | #ifdef DEBUG | ||
3686 | printk(KERN_ERR "stli_onbereset(brdp=%x)\n", (int) brdp); | ||
3687 | #endif | ||
3688 | |||
3689 | outb(ONB_EISTOP, (brdp->iobase + ONB_EICONFR)); | 3297 | outb(ONB_EISTOP, (brdp->iobase + ONB_EICONFR)); |
3690 | udelay(10); | 3298 | udelay(10); |
3691 | outb(ONB_EIDISABLE, (brdp->iobase + ONB_EICONFR)); | 3299 | outb(ONB_EIDISABLE, (brdp->iobase + ONB_EICONFR)); |
@@ -3700,11 +3308,6 @@ static void stli_onbereset(stlibrd_t *brdp) | |||
3700 | 3308 | ||
3701 | static void stli_bbyinit(stlibrd_t *brdp) | 3309 | static void stli_bbyinit(stlibrd_t *brdp) |
3702 | { | 3310 | { |
3703 | |||
3704 | #ifdef DEBUG | ||
3705 | printk(KERN_ERR "stli_bbyinit(brdp=%d)\n", (int) brdp); | ||
3706 | #endif | ||
3707 | |||
3708 | outb(BBY_ATSTOP, (brdp->iobase + BBY_ATCONFR)); | 3311 | outb(BBY_ATSTOP, (brdp->iobase + BBY_ATCONFR)); |
3709 | udelay(10); | 3312 | udelay(10); |
3710 | outb(0, (brdp->iobase + BBY_ATCONFR)); | 3313 | outb(0, (brdp->iobase + BBY_ATCONFR)); |
@@ -3717,24 +3320,13 @@ static void stli_bbyinit(stlibrd_t *brdp) | |||
3717 | 3320 | ||
3718 | static char *stli_bbygetmemptr(stlibrd_t *brdp, unsigned long offset, int line) | 3321 | static char *stli_bbygetmemptr(stlibrd_t *brdp, unsigned long offset, int line) |
3719 | { | 3322 | { |
3720 | void *ptr; | 3323 | void *ptr; |
3721 | unsigned char val; | 3324 | unsigned char val; |
3722 | 3325 | ||
3723 | #ifdef DEBUG | 3326 | BUG_ON(offset > brdp->memsize); |
3724 | printk(KERN_ERR "stli_bbygetmemptr(brdp=%x,offset=%x)\n", (int) brdp, | ||
3725 | (int) offset); | ||
3726 | #endif | ||
3727 | 3327 | ||
3728 | if (offset > brdp->memsize) { | 3328 | ptr = brdp->membase + (offset % BBY_PAGESIZE); |
3729 | printk(KERN_ERR "STALLION: shared memory pointer=%x out of " | 3329 | val = (unsigned char) (offset / BBY_PAGESIZE); |
3730 | "range at line=%d(%d), brd=%d\n", | ||
3731 | (int) offset, line, __LINE__, brdp->brdnr); | ||
3732 | ptr = NULL; | ||
3733 | val = 0; | ||
3734 | } else { | ||
3735 | ptr = brdp->membase + (offset % BBY_PAGESIZE); | ||
3736 | val = (unsigned char) (offset / BBY_PAGESIZE); | ||
3737 | } | ||
3738 | outb(val, (brdp->iobase + BBY_ATCONFR)); | 3330 | outb(val, (brdp->iobase + BBY_ATCONFR)); |
3739 | return(ptr); | 3331 | return(ptr); |
3740 | } | 3332 | } |
@@ -3743,11 +3335,6 @@ static char *stli_bbygetmemptr(stlibrd_t *brdp, unsigned long offset, int line) | |||
3743 | 3335 | ||
3744 | static void stli_bbyreset(stlibrd_t *brdp) | 3336 | static void stli_bbyreset(stlibrd_t *brdp) |
3745 | { | 3337 | { |
3746 | |||
3747 | #ifdef DEBUG | ||
3748 | printk(KERN_DEBUG "stli_bbyreset(brdp=%x)\n", (int) brdp); | ||
3749 | #endif | ||
3750 | |||
3751 | outb(BBY_ATSTOP, (brdp->iobase + BBY_ATCONFR)); | 3338 | outb(BBY_ATSTOP, (brdp->iobase + BBY_ATCONFR)); |
3752 | udelay(10); | 3339 | udelay(10); |
3753 | outb(0, (brdp->iobase + BBY_ATCONFR)); | 3340 | outb(0, (brdp->iobase + BBY_ATCONFR)); |
@@ -3762,11 +3349,6 @@ static void stli_bbyreset(stlibrd_t *brdp) | |||
3762 | 3349 | ||
3763 | static void stli_stalinit(stlibrd_t *brdp) | 3350 | static void stli_stalinit(stlibrd_t *brdp) |
3764 | { | 3351 | { |
3765 | |||
3766 | #ifdef DEBUG | ||
3767 | printk(KERN_DEBUG "stli_stalinit(brdp=%d)\n", (int) brdp); | ||
3768 | #endif | ||
3769 | |||
3770 | outb(0x1, brdp->iobase); | 3352 | outb(0x1, brdp->iobase); |
3771 | mdelay(1000); | 3353 | mdelay(1000); |
3772 | } | 3354 | } |
@@ -3775,36 +3357,18 @@ static void stli_stalinit(stlibrd_t *brdp) | |||
3775 | 3357 | ||
3776 | static char *stli_stalgetmemptr(stlibrd_t *brdp, unsigned long offset, int line) | 3358 | static char *stli_stalgetmemptr(stlibrd_t *brdp, unsigned long offset, int line) |
3777 | { | 3359 | { |
3778 | void *ptr; | 3360 | BUG_ON(offset > brdp->memsize); |
3779 | 3361 | return brdp->membase + (offset % STAL_PAGESIZE); | |
3780 | #ifdef DEBUG | ||
3781 | printk(KERN_DEBUG "stli_stalgetmemptr(brdp=%x,offset=%x)\n", (int) brdp, | ||
3782 | (int) offset); | ||
3783 | #endif | ||
3784 | |||
3785 | if (offset > brdp->memsize) { | ||
3786 | printk(KERN_ERR "STALLION: shared memory pointer=%x out of " | ||
3787 | "range at line=%d(%d), brd=%d\n", | ||
3788 | (int) offset, line, __LINE__, brdp->brdnr); | ||
3789 | ptr = NULL; | ||
3790 | } else { | ||
3791 | ptr = brdp->membase + (offset % STAL_PAGESIZE); | ||
3792 | } | ||
3793 | return(ptr); | ||
3794 | } | 3362 | } |
3795 | 3363 | ||
3796 | /*****************************************************************************/ | 3364 | /*****************************************************************************/ |
3797 | 3365 | ||
3798 | static void stli_stalreset(stlibrd_t *brdp) | 3366 | static void stli_stalreset(stlibrd_t *brdp) |
3799 | { | 3367 | { |
3800 | volatile unsigned long *vecp; | 3368 | u32 __iomem *vecp; |
3801 | 3369 | ||
3802 | #ifdef DEBUG | 3370 | vecp = (u32 __iomem *) (brdp->membase + 0x30); |
3803 | printk(KERN_DEBUG "stli_stalreset(brdp=%x)\n", (int) brdp); | 3371 | writel(0xffff0000, vecp); |
3804 | #endif | ||
3805 | |||
3806 | vecp = (volatile unsigned long *) (brdp->membase + 0x30); | ||
3807 | *vecp = 0xffff0000; | ||
3808 | outb(0, brdp->iobase); | 3372 | outb(0, brdp->iobase); |
3809 | mdelay(1000); | 3373 | mdelay(1000); |
3810 | } | 3374 | } |
@@ -3818,15 +3382,11 @@ static void stli_stalreset(stlibrd_t *brdp) | |||
3818 | 3382 | ||
3819 | static int stli_initecp(stlibrd_t *brdp) | 3383 | static int stli_initecp(stlibrd_t *brdp) |
3820 | { | 3384 | { |
3821 | cdkecpsig_t sig; | 3385 | cdkecpsig_t sig; |
3822 | cdkecpsig_t *sigsp; | 3386 | cdkecpsig_t __iomem *sigsp; |
3823 | unsigned int status, nxtid; | 3387 | unsigned int status, nxtid; |
3824 | char *name; | 3388 | char *name; |
3825 | int panelnr, nrports; | 3389 | int panelnr, nrports; |
3826 | |||
3827 | #ifdef DEBUG | ||
3828 | printk(KERN_DEBUG "stli_initecp(brdp=%x)\n", (int) brdp); | ||
3829 | #endif | ||
3830 | 3390 | ||
3831 | if (!request_region(brdp->iobase, brdp->iosize, "istallion")) | 3391 | if (!request_region(brdp->iobase, brdp->iosize, "istallion")) |
3832 | return -EIO; | 3392 | return -EIO; |
@@ -3834,7 +3394,7 @@ static int stli_initecp(stlibrd_t *brdp) | |||
3834 | if ((brdp->iobase == 0) || (brdp->memaddr == 0)) | 3394 | if ((brdp->iobase == 0) || (brdp->memaddr == 0)) |
3835 | { | 3395 | { |
3836 | release_region(brdp->iobase, brdp->iosize); | 3396 | release_region(brdp->iobase, brdp->iosize); |
3837 | return(-ENODEV); | 3397 | return -ENODEV; |
3838 | } | 3398 | } |
3839 | 3399 | ||
3840 | brdp->iosize = ECP_IOSIZE; | 3400 | brdp->iosize = ECP_IOSIZE; |
@@ -3903,7 +3463,7 @@ static int stli_initecp(stlibrd_t *brdp) | |||
3903 | 3463 | ||
3904 | default: | 3464 | default: |
3905 | release_region(brdp->iobase, brdp->iosize); | 3465 | release_region(brdp->iobase, brdp->iosize); |
3906 | return(-EINVAL); | 3466 | return -EINVAL; |
3907 | } | 3467 | } |
3908 | 3468 | ||
3909 | /* | 3469 | /* |
@@ -3915,10 +3475,10 @@ static int stli_initecp(stlibrd_t *brdp) | |||
3915 | EBRDINIT(brdp); | 3475 | EBRDINIT(brdp); |
3916 | 3476 | ||
3917 | brdp->membase = ioremap(brdp->memaddr, brdp->memsize); | 3477 | brdp->membase = ioremap(brdp->memaddr, brdp->memsize); |
3918 | if (brdp->membase == (void *) NULL) | 3478 | if (brdp->membase == NULL) |
3919 | { | 3479 | { |
3920 | release_region(brdp->iobase, brdp->iosize); | 3480 | release_region(brdp->iobase, brdp->iosize); |
3921 | return(-ENOMEM); | 3481 | return -ENOMEM; |
3922 | } | 3482 | } |
3923 | 3483 | ||
3924 | /* | 3484 | /* |
@@ -3927,23 +3487,14 @@ static int stli_initecp(stlibrd_t *brdp) | |||
3927 | * this is, and what it is connected to it. | 3487 | * this is, and what it is connected to it. |
3928 | */ | 3488 | */ |
3929 | EBRDENABLE(brdp); | 3489 | EBRDENABLE(brdp); |
3930 | sigsp = (cdkecpsig_t *) EBRDGETMEMPTR(brdp, CDK_SIGADDR); | 3490 | sigsp = (cdkecpsig_t __iomem *) EBRDGETMEMPTR(brdp, CDK_SIGADDR); |
3931 | memcpy(&sig, sigsp, sizeof(cdkecpsig_t)); | 3491 | memcpy(&sig, sigsp, sizeof(cdkecpsig_t)); |
3932 | EBRDDISABLE(brdp); | 3492 | EBRDDISABLE(brdp); |
3933 | 3493 | ||
3934 | #if 0 | 3494 | if (sig.magic != cpu_to_le32(ECP_MAGIC)) |
3935 | printk("%s(%d): sig-> magic=%x rom=%x panel=%x,%x,%x,%x,%x,%x,%x,%x\n", | ||
3936 | __FILE__, __LINE__, (int) sig.magic, sig.romver, sig.panelid[0], | ||
3937 | (int) sig.panelid[1], (int) sig.panelid[2], | ||
3938 | (int) sig.panelid[3], (int) sig.panelid[4], | ||
3939 | (int) sig.panelid[5], (int) sig.panelid[6], | ||
3940 | (int) sig.panelid[7]); | ||
3941 | #endif | ||
3942 | |||
3943 | if (sig.magic != ECP_MAGIC) | ||
3944 | { | 3495 | { |
3945 | release_region(brdp->iobase, brdp->iosize); | 3496 | release_region(brdp->iobase, brdp->iosize); |
3946 | return(-ENODEV); | 3497 | return -ENODEV; |
3947 | } | 3498 | } |
3948 | 3499 | ||
3949 | /* | 3500 | /* |
@@ -3967,7 +3518,7 @@ static int stli_initecp(stlibrd_t *brdp) | |||
3967 | 3518 | ||
3968 | 3519 | ||
3969 | brdp->state |= BST_FOUND; | 3520 | brdp->state |= BST_FOUND; |
3970 | return(0); | 3521 | return 0; |
3971 | } | 3522 | } |
3972 | 3523 | ||
3973 | /*****************************************************************************/ | 3524 | /*****************************************************************************/ |
@@ -3979,20 +3530,16 @@ static int stli_initecp(stlibrd_t *brdp) | |||
3979 | 3530 | ||
3980 | static int stli_initonb(stlibrd_t *brdp) | 3531 | static int stli_initonb(stlibrd_t *brdp) |
3981 | { | 3532 | { |
3982 | cdkonbsig_t sig; | 3533 | cdkonbsig_t sig; |
3983 | cdkonbsig_t *sigsp; | 3534 | cdkonbsig_t __iomem *sigsp; |
3984 | char *name; | 3535 | char *name; |
3985 | int i; | 3536 | int i; |
3986 | |||
3987 | #ifdef DEBUG | ||
3988 | printk(KERN_DEBUG "stli_initonb(brdp=%x)\n", (int) brdp); | ||
3989 | #endif | ||
3990 | 3537 | ||
3991 | /* | 3538 | /* |
3992 | * Do a basic sanity check on the IO and memory addresses. | 3539 | * Do a basic sanity check on the IO and memory addresses. |
3993 | */ | 3540 | */ |
3994 | if ((brdp->iobase == 0) || (brdp->memaddr == 0)) | 3541 | if (brdp->iobase == 0 || brdp->memaddr == 0) |
3995 | return(-ENODEV); | 3542 | return -ENODEV; |
3996 | 3543 | ||
3997 | brdp->iosize = ONB_IOSIZE; | 3544 | brdp->iosize = ONB_IOSIZE; |
3998 | 3545 | ||
@@ -4010,7 +3557,6 @@ static int stli_initonb(stlibrd_t *brdp) | |||
4010 | case BRD_ONBOARD2: | 3557 | case BRD_ONBOARD2: |
4011 | case BRD_ONBOARD2_32: | 3558 | case BRD_ONBOARD2_32: |
4012 | case BRD_ONBOARDRS: | 3559 | case BRD_ONBOARDRS: |
4013 | brdp->membase = (void *) brdp->memaddr; | ||
4014 | brdp->memsize = ONB_MEMSIZE; | 3560 | brdp->memsize = ONB_MEMSIZE; |
4015 | brdp->pagesize = ONB_ATPAGESIZE; | 3561 | brdp->pagesize = ONB_ATPAGESIZE; |
4016 | brdp->init = stli_onbinit; | 3562 | brdp->init = stli_onbinit; |
@@ -4028,7 +3574,6 @@ static int stli_initonb(stlibrd_t *brdp) | |||
4028 | break; | 3574 | break; |
4029 | 3575 | ||
4030 | case BRD_ONBOARDE: | 3576 | case BRD_ONBOARDE: |
4031 | brdp->membase = (void *) brdp->memaddr; | ||
4032 | brdp->memsize = ONB_EIMEMSIZE; | 3577 | brdp->memsize = ONB_EIMEMSIZE; |
4033 | brdp->pagesize = ONB_EIPAGESIZE; | 3578 | brdp->pagesize = ONB_EIPAGESIZE; |
4034 | brdp->init = stli_onbeinit; | 3579 | brdp->init = stli_onbeinit; |
@@ -4044,7 +3589,6 @@ static int stli_initonb(stlibrd_t *brdp) | |||
4044 | case BRD_BRUMBY4: | 3589 | case BRD_BRUMBY4: |
4045 | case BRD_BRUMBY8: | 3590 | case BRD_BRUMBY8: |
4046 | case BRD_BRUMBY16: | 3591 | case BRD_BRUMBY16: |
4047 | brdp->membase = (void *) brdp->memaddr; | ||
4048 | brdp->memsize = BBY_MEMSIZE; | 3592 | brdp->memsize = BBY_MEMSIZE; |
4049 | brdp->pagesize = BBY_PAGESIZE; | 3593 | brdp->pagesize = BBY_PAGESIZE; |
4050 | brdp->init = stli_bbyinit; | 3594 | brdp->init = stli_bbyinit; |
@@ -4058,7 +3602,6 @@ static int stli_initonb(stlibrd_t *brdp) | |||
4058 | break; | 3602 | break; |
4059 | 3603 | ||
4060 | case BRD_STALLION: | 3604 | case BRD_STALLION: |
4061 | brdp->membase = (void *) brdp->memaddr; | ||
4062 | brdp->memsize = STAL_MEMSIZE; | 3605 | brdp->memsize = STAL_MEMSIZE; |
4063 | brdp->pagesize = STAL_PAGESIZE; | 3606 | brdp->pagesize = STAL_PAGESIZE; |
4064 | brdp->init = stli_stalinit; | 3607 | brdp->init = stli_stalinit; |
@@ -4073,7 +3616,7 @@ static int stli_initonb(stlibrd_t *brdp) | |||
4073 | 3616 | ||
4074 | default: | 3617 | default: |
4075 | release_region(brdp->iobase, brdp->iosize); | 3618 | release_region(brdp->iobase, brdp->iosize); |
4076 | return(-EINVAL); | 3619 | return -EINVAL; |
4077 | } | 3620 | } |
4078 | 3621 | ||
4079 | /* | 3622 | /* |
@@ -4085,10 +3628,10 @@ static int stli_initonb(stlibrd_t *brdp) | |||
4085 | EBRDINIT(brdp); | 3628 | EBRDINIT(brdp); |
4086 | 3629 | ||
4087 | brdp->membase = ioremap(brdp->memaddr, brdp->memsize); | 3630 | brdp->membase = ioremap(brdp->memaddr, brdp->memsize); |
4088 | if (brdp->membase == (void *) NULL) | 3631 | if (brdp->membase == NULL) |
4089 | { | 3632 | { |
4090 | release_region(brdp->iobase, brdp->iosize); | 3633 | release_region(brdp->iobase, brdp->iosize); |
4091 | return(-ENOMEM); | 3634 | return -ENOMEM; |
4092 | } | 3635 | } |
4093 | 3636 | ||
4094 | /* | 3637 | /* |
@@ -4097,21 +3640,17 @@ static int stli_initonb(stlibrd_t *brdp) | |||
4097 | * this is, and how many ports. | 3640 | * this is, and how many ports. |
4098 | */ | 3641 | */ |
4099 | EBRDENABLE(brdp); | 3642 | EBRDENABLE(brdp); |
4100 | sigsp = (cdkonbsig_t *) EBRDGETMEMPTR(brdp, CDK_SIGADDR); | 3643 | sigsp = (cdkonbsig_t __iomem *) EBRDGETMEMPTR(brdp, CDK_SIGADDR); |
4101 | memcpy(&sig, sigsp, sizeof(cdkonbsig_t)); | 3644 | memcpy_fromio(&sig, sigsp, sizeof(cdkonbsig_t)); |
4102 | EBRDDISABLE(brdp); | 3645 | EBRDDISABLE(brdp); |
4103 | 3646 | ||
4104 | #if 0 | 3647 | if (sig.magic0 != cpu_to_le16(ONB_MAGIC0) || |
4105 | printk("%s(%d): sig-> magic=%x:%x:%x:%x romver=%x amask=%x:%x:%x\n", | 3648 | sig.magic1 != cpu_to_le16(ONB_MAGIC1) || |
4106 | __FILE__, __LINE__, sig.magic0, sig.magic1, sig.magic2, | 3649 | sig.magic2 != cpu_to_le16(ONB_MAGIC2) || |
4107 | sig.magic3, sig.romver, sig.amask0, sig.amask1, sig.amask2); | 3650 | sig.magic3 != cpu_to_le16(ONB_MAGIC3)) |
4108 | #endif | ||
4109 | |||
4110 | if ((sig.magic0 != ONB_MAGIC0) || (sig.magic1 != ONB_MAGIC1) || | ||
4111 | (sig.magic2 != ONB_MAGIC2) || (sig.magic3 != ONB_MAGIC3)) | ||
4112 | { | 3651 | { |
4113 | release_region(brdp->iobase, brdp->iosize); | 3652 | release_region(brdp->iobase, brdp->iosize); |
4114 | return(-ENODEV); | 3653 | return -ENODEV; |
4115 | } | 3654 | } |
4116 | 3655 | ||
4117 | /* | 3656 | /* |
@@ -4132,7 +3671,7 @@ static int stli_initonb(stlibrd_t *brdp) | |||
4132 | 3671 | ||
4133 | 3672 | ||
4134 | brdp->state |= BST_FOUND; | 3673 | brdp->state |= BST_FOUND; |
4135 | return(0); | 3674 | return 0; |
4136 | } | 3675 | } |
4137 | 3676 | ||
4138 | /*****************************************************************************/ | 3677 | /*****************************************************************************/ |
@@ -4145,31 +3684,25 @@ static int stli_initonb(stlibrd_t *brdp) | |||
4145 | 3684 | ||
4146 | static int stli_startbrd(stlibrd_t *brdp) | 3685 | static int stli_startbrd(stlibrd_t *brdp) |
4147 | { | 3686 | { |
4148 | volatile cdkhdr_t *hdrp; | 3687 | cdkhdr_t __iomem *hdrp; |
4149 | volatile cdkmem_t *memp; | 3688 | cdkmem_t __iomem *memp; |
4150 | volatile cdkasy_t *ap; | 3689 | cdkasy_t __iomem *ap; |
4151 | unsigned long flags; | 3690 | unsigned long flags; |
4152 | stliport_t *portp; | 3691 | stliport_t *portp; |
4153 | int portnr, nrdevs, i, rc; | 3692 | int portnr, nrdevs, i, rc = 0; |
4154 | 3693 | u32 memoff; | |
4155 | #ifdef DEBUG | 3694 | |
4156 | printk(KERN_DEBUG "stli_startbrd(brdp=%x)\n", (int) brdp); | 3695 | spin_lock_irqsave(&brd_lock, flags); |
4157 | #endif | ||
4158 | |||
4159 | rc = 0; | ||
4160 | |||
4161 | save_flags(flags); | ||
4162 | cli(); | ||
4163 | EBRDENABLE(brdp); | 3696 | EBRDENABLE(brdp); |
4164 | hdrp = (volatile cdkhdr_t *) EBRDGETMEMPTR(brdp, CDK_CDKADDR); | 3697 | hdrp = (cdkhdr_t __iomem *) EBRDGETMEMPTR(brdp, CDK_CDKADDR); |
4165 | nrdevs = hdrp->nrdevs; | 3698 | nrdevs = hdrp->nrdevs; |
4166 | 3699 | ||
4167 | #if 0 | 3700 | #if 0 |
4168 | printk("%s(%d): CDK version %d.%d.%d --> " | 3701 | printk("%s(%d): CDK version %d.%d.%d --> " |
4169 | "nrdevs=%d memp=%x hostp=%x slavep=%x\n", | 3702 | "nrdevs=%d memp=%x hostp=%x slavep=%x\n", |
4170 | __FILE__, __LINE__, hdrp->ver_release, hdrp->ver_modification, | 3703 | __FILE__, __LINE__, readb(&hdrp->ver_release), readb(&hdrp->ver_modification), |
4171 | hdrp->ver_fix, nrdevs, (int) hdrp->memp, (int) hdrp->hostp, | 3704 | readb(&hdrp->ver_fix), nrdevs, (int) readl(&hdrp->memp), readl(&hdrp->hostp), |
4172 | (int) hdrp->slavep); | 3705 | readl(&hdrp->slavep)); |
4173 | #endif | 3706 | #endif |
4174 | 3707 | ||
4175 | if (nrdevs < (brdp->nrports + 1)) { | 3708 | if (nrdevs < (brdp->nrports + 1)) { |
@@ -4181,14 +3714,14 @@ static int stli_startbrd(stlibrd_t *brdp) | |||
4181 | brdp->hostoffset = hdrp->hostp - CDK_CDKADDR; | 3714 | brdp->hostoffset = hdrp->hostp - CDK_CDKADDR; |
4182 | brdp->slaveoffset = hdrp->slavep - CDK_CDKADDR; | 3715 | brdp->slaveoffset = hdrp->slavep - CDK_CDKADDR; |
4183 | brdp->bitsize = (nrdevs + 7) / 8; | 3716 | brdp->bitsize = (nrdevs + 7) / 8; |
4184 | memp = (volatile cdkmem_t *) hdrp->memp; | 3717 | memoff = readl(&hdrp->memp); |
4185 | if (((unsigned long) memp) > brdp->memsize) { | 3718 | if (memoff > brdp->memsize) { |
4186 | printk(KERN_ERR "STALLION: corrupted shared memory region?\n"); | 3719 | printk(KERN_ERR "STALLION: corrupted shared memory region?\n"); |
4187 | rc = -EIO; | 3720 | rc = -EIO; |
4188 | goto stli_donestartup; | 3721 | goto stli_donestartup; |
4189 | } | 3722 | } |
4190 | memp = (volatile cdkmem_t *) EBRDGETMEMPTR(brdp, (unsigned long) memp); | 3723 | memp = (cdkmem_t __iomem *) EBRDGETMEMPTR(brdp, memoff); |
4191 | if (memp->dtype != TYP_ASYNCTRL) { | 3724 | if (readw(&memp->dtype) != TYP_ASYNCTRL) { |
4192 | printk(KERN_ERR "STALLION: no slave control device found\n"); | 3725 | printk(KERN_ERR "STALLION: no slave control device found\n"); |
4193 | goto stli_donestartup; | 3726 | goto stli_donestartup; |
4194 | } | 3727 | } |
@@ -4200,19 +3733,19 @@ static int stli_startbrd(stlibrd_t *brdp) | |||
4200 | * change pages while reading memory map. | 3733 | * change pages while reading memory map. |
4201 | */ | 3734 | */ |
4202 | for (i = 1, portnr = 0; (i < nrdevs); i++, portnr++, memp++) { | 3735 | for (i = 1, portnr = 0; (i < nrdevs); i++, portnr++, memp++) { |
4203 | if (memp->dtype != TYP_ASYNC) | 3736 | if (readw(&memp->dtype) != TYP_ASYNC) |
4204 | break; | 3737 | break; |
4205 | portp = brdp->ports[portnr]; | 3738 | portp = brdp->ports[portnr]; |
4206 | if (portp == (stliport_t *) NULL) | 3739 | if (portp == NULL) |
4207 | break; | 3740 | break; |
4208 | portp->devnr = i; | 3741 | portp->devnr = i; |
4209 | portp->addr = memp->offset; | 3742 | portp->addr = readl(&memp->offset); |
4210 | portp->reqbit = (unsigned char) (0x1 << (i * 8 / nrdevs)); | 3743 | portp->reqbit = (unsigned char) (0x1 << (i * 8 / nrdevs)); |
4211 | portp->portidx = (unsigned char) (i / 8); | 3744 | portp->portidx = (unsigned char) (i / 8); |
4212 | portp->portbit = (unsigned char) (0x1 << (i % 8)); | 3745 | portp->portbit = (unsigned char) (0x1 << (i % 8)); |
4213 | } | 3746 | } |
4214 | 3747 | ||
4215 | hdrp->slavereq = 0xff; | 3748 | writeb(0xff, &hdrp->slavereq); |
4216 | 3749 | ||
4217 | /* | 3750 | /* |
4218 | * For each port setup a local copy of the RX and TX buffer offsets | 3751 | * For each port setup a local copy of the RX and TX buffer offsets |
@@ -4221,22 +3754,22 @@ static int stli_startbrd(stlibrd_t *brdp) | |||
4221 | */ | 3754 | */ |
4222 | for (i = 1, portnr = 0; (i < nrdevs); i++, portnr++) { | 3755 | for (i = 1, portnr = 0; (i < nrdevs); i++, portnr++) { |
4223 | portp = brdp->ports[portnr]; | 3756 | portp = brdp->ports[portnr]; |
4224 | if (portp == (stliport_t *) NULL) | 3757 | if (portp == NULL) |
4225 | break; | 3758 | break; |
4226 | if (portp->addr == 0) | 3759 | if (portp->addr == 0) |
4227 | break; | 3760 | break; |
4228 | ap = (volatile cdkasy_t *) EBRDGETMEMPTR(brdp, portp->addr); | 3761 | ap = (cdkasy_t __iomem *) EBRDGETMEMPTR(brdp, portp->addr); |
4229 | if (ap != (volatile cdkasy_t *) NULL) { | 3762 | if (ap != NULL) { |
4230 | portp->rxsize = ap->rxq.size; | 3763 | portp->rxsize = readw(&ap->rxq.size); |
4231 | portp->txsize = ap->txq.size; | 3764 | portp->txsize = readw(&ap->txq.size); |
4232 | portp->rxoffset = ap->rxq.offset; | 3765 | portp->rxoffset = readl(&ap->rxq.offset); |
4233 | portp->txoffset = ap->txq.offset; | 3766 | portp->txoffset = readl(&ap->txq.offset); |
4234 | } | 3767 | } |
4235 | } | 3768 | } |
4236 | 3769 | ||
4237 | stli_donestartup: | 3770 | stli_donestartup: |
4238 | EBRDDISABLE(brdp); | 3771 | EBRDDISABLE(brdp); |
4239 | restore_flags(flags); | 3772 | spin_unlock_irqrestore(&brd_lock, flags); |
4240 | 3773 | ||
4241 | if (rc == 0) | 3774 | if (rc == 0) |
4242 | brdp->state |= BST_STARTED; | 3775 | brdp->state |= BST_STARTED; |
@@ -4247,7 +3780,7 @@ stli_donestartup: | |||
4247 | add_timer(&stli_timerlist); | 3780 | add_timer(&stli_timerlist); |
4248 | } | 3781 | } |
4249 | 3782 | ||
4250 | return(rc); | 3783 | return rc; |
4251 | } | 3784 | } |
4252 | 3785 | ||
4253 | /*****************************************************************************/ | 3786 | /*****************************************************************************/ |
@@ -4258,10 +3791,6 @@ stli_donestartup: | |||
4258 | 3791 | ||
4259 | static int __init stli_brdinit(stlibrd_t *brdp) | 3792 | static int __init stli_brdinit(stlibrd_t *brdp) |
4260 | { | 3793 | { |
4261 | #ifdef DEBUG | ||
4262 | printk(KERN_DEBUG "stli_brdinit(brdp=%x)\n", (int) brdp); | ||
4263 | #endif | ||
4264 | |||
4265 | stli_brds[brdp->brdnr] = brdp; | 3794 | stli_brds[brdp->brdnr] = brdp; |
4266 | 3795 | ||
4267 | switch (brdp->brdtype) { | 3796 | switch (brdp->brdtype) { |
@@ -4289,11 +3818,11 @@ static int __init stli_brdinit(stlibrd_t *brdp) | |||
4289 | case BRD_ECHPCI: | 3818 | case BRD_ECHPCI: |
4290 | printk(KERN_ERR "STALLION: %s board type not supported in " | 3819 | printk(KERN_ERR "STALLION: %s board type not supported in " |
4291 | "this driver\n", stli_brdnames[brdp->brdtype]); | 3820 | "this driver\n", stli_brdnames[brdp->brdtype]); |
4292 | return(ENODEV); | 3821 | return -ENODEV; |
4293 | default: | 3822 | default: |
4294 | printk(KERN_ERR "STALLION: board=%d is unknown board " | 3823 | printk(KERN_ERR "STALLION: board=%d is unknown board " |
4295 | "type=%d\n", brdp->brdnr, brdp->brdtype); | 3824 | "type=%d\n", brdp->brdnr, brdp->brdtype); |
4296 | return(ENODEV); | 3825 | return -ENODEV; |
4297 | } | 3826 | } |
4298 | 3827 | ||
4299 | if ((brdp->state & BST_FOUND) == 0) { | 3828 | if ((brdp->state & BST_FOUND) == 0) { |
@@ -4301,7 +3830,7 @@ static int __init stli_brdinit(stlibrd_t *brdp) | |||
4301 | "io=%x mem=%x\n", | 3830 | "io=%x mem=%x\n", |
4302 | stli_brdnames[brdp->brdtype], brdp->brdnr, | 3831 | stli_brdnames[brdp->brdtype], brdp->brdnr, |
4303 | brdp->iobase, (int) brdp->memaddr); | 3832 | brdp->iobase, (int) brdp->memaddr); |
4304 | return(ENODEV); | 3833 | return -ENODEV; |
4305 | } | 3834 | } |
4306 | 3835 | ||
4307 | stli_initports(brdp); | 3836 | stli_initports(brdp); |
@@ -4309,7 +3838,7 @@ static int __init stli_brdinit(stlibrd_t *brdp) | |||
4309 | "nrpanels=%d nrports=%d\n", stli_brdnames[brdp->brdtype], | 3838 | "nrpanels=%d nrports=%d\n", stli_brdnames[brdp->brdtype], |
4310 | brdp->brdnr, brdp->iobase, (int) brdp->memaddr, | 3839 | brdp->brdnr, brdp->iobase, (int) brdp->memaddr, |
4311 | brdp->nrpanels, brdp->nrports); | 3840 | brdp->nrpanels, brdp->nrports); |
4312 | return(0); | 3841 | return 0; |
4313 | } | 3842 | } |
4314 | 3843 | ||
4315 | /*****************************************************************************/ | 3844 | /*****************************************************************************/ |
@@ -4321,14 +3850,10 @@ static int __init stli_brdinit(stlibrd_t *brdp) | |||
4321 | 3850 | ||
4322 | static int stli_eisamemprobe(stlibrd_t *brdp) | 3851 | static int stli_eisamemprobe(stlibrd_t *brdp) |
4323 | { | 3852 | { |
4324 | cdkecpsig_t ecpsig, *ecpsigp; | 3853 | cdkecpsig_t ecpsig, __iomem *ecpsigp; |
4325 | cdkonbsig_t onbsig, *onbsigp; | 3854 | cdkonbsig_t onbsig, __iomem *onbsigp; |
4326 | int i, foundit; | 3855 | int i, foundit; |
4327 | 3856 | ||
4328 | #ifdef DEBUG | ||
4329 | printk(KERN_DEBUG "stli_eisamemprobe(brdp=%x)\n", (int) brdp); | ||
4330 | #endif | ||
4331 | |||
4332 | /* | 3857 | /* |
4333 | * First up we reset the board, to get it into a known state. There | 3858 | * First up we reset the board, to get it into a known state. There |
4334 | * is only 2 board types here we need to worry about. Don;t use the | 3859 | * is only 2 board types here we need to worry about. Don;t use the |
@@ -4352,7 +3877,7 @@ static int stli_eisamemprobe(stlibrd_t *brdp) | |||
4352 | mdelay(1); | 3877 | mdelay(1); |
4353 | stli_onbeenable(brdp); | 3878 | stli_onbeenable(brdp); |
4354 | } else { | 3879 | } else { |
4355 | return(-ENODEV); | 3880 | return -ENODEV; |
4356 | } | 3881 | } |
4357 | 3882 | ||
4358 | foundit = 0; | 3883 | foundit = 0; |
@@ -4364,25 +3889,24 @@ static int stli_eisamemprobe(stlibrd_t *brdp) | |||
4364 | */ | 3889 | */ |
4365 | for (i = 0; (i < stli_eisamempsize); i++) { | 3890 | for (i = 0; (i < stli_eisamempsize); i++) { |
4366 | brdp->memaddr = stli_eisamemprobeaddrs[i]; | 3891 | brdp->memaddr = stli_eisamemprobeaddrs[i]; |
4367 | brdp->membase = (void *) brdp->memaddr; | ||
4368 | brdp->membase = ioremap(brdp->memaddr, brdp->memsize); | 3892 | brdp->membase = ioremap(brdp->memaddr, brdp->memsize); |
4369 | if (brdp->membase == (void *) NULL) | 3893 | if (brdp->membase == NULL) |
4370 | continue; | 3894 | continue; |
4371 | 3895 | ||
4372 | if (brdp->brdtype == BRD_ECPE) { | 3896 | if (brdp->brdtype == BRD_ECPE) { |
4373 | ecpsigp = (cdkecpsig_t *) stli_ecpeigetmemptr(brdp, | 3897 | ecpsigp = (cdkecpsig_t __iomem *) stli_ecpeigetmemptr(brdp, |
4374 | CDK_SIGADDR, __LINE__); | 3898 | CDK_SIGADDR, __LINE__); |
4375 | memcpy(&ecpsig, ecpsigp, sizeof(cdkecpsig_t)); | 3899 | memcpy_fromio(&ecpsig, ecpsigp, sizeof(cdkecpsig_t)); |
4376 | if (ecpsig.magic == ECP_MAGIC) | 3900 | if (ecpsig.magic == cpu_to_le32(ECP_MAGIC)) |
4377 | foundit = 1; | 3901 | foundit = 1; |
4378 | } else { | 3902 | } else { |
4379 | onbsigp = (cdkonbsig_t *) stli_onbegetmemptr(brdp, | 3903 | onbsigp = (cdkonbsig_t __iomem *) stli_onbegetmemptr(brdp, |
4380 | CDK_SIGADDR, __LINE__); | 3904 | CDK_SIGADDR, __LINE__); |
4381 | memcpy(&onbsig, onbsigp, sizeof(cdkonbsig_t)); | 3905 | memcpy_fromio(&onbsig, onbsigp, sizeof(cdkonbsig_t)); |
4382 | if ((onbsig.magic0 == ONB_MAGIC0) && | 3906 | if ((onbsig.magic0 == cpu_to_le16(ONB_MAGIC0)) && |
4383 | (onbsig.magic1 == ONB_MAGIC1) && | 3907 | (onbsig.magic1 == cpu_to_le16(ONB_MAGIC1)) && |
4384 | (onbsig.magic2 == ONB_MAGIC2) && | 3908 | (onbsig.magic2 == cpu_to_le16(ONB_MAGIC2)) && |
4385 | (onbsig.magic3 == ONB_MAGIC3)) | 3909 | (onbsig.magic3 == cpu_to_le16(ONB_MAGIC3))) |
4386 | foundit = 1; | 3910 | foundit = 1; |
4387 | } | 3911 | } |
4388 | 3912 | ||
@@ -4406,9 +3930,9 @@ static int stli_eisamemprobe(stlibrd_t *brdp) | |||
4406 | printk(KERN_ERR "STALLION: failed to probe shared memory " | 3930 | printk(KERN_ERR "STALLION: failed to probe shared memory " |
4407 | "region for %s in EISA slot=%d\n", | 3931 | "region for %s in EISA slot=%d\n", |
4408 | stli_brdnames[brdp->brdtype], (brdp->iobase >> 12)); | 3932 | stli_brdnames[brdp->brdtype], (brdp->iobase >> 12)); |
4409 | return(-ENODEV); | 3933 | return -ENODEV; |
4410 | } | 3934 | } |
4411 | return(0); | 3935 | return 0; |
4412 | } | 3936 | } |
4413 | 3937 | ||
4414 | static int stli_getbrdnr(void) | 3938 | static int stli_getbrdnr(void) |
@@ -4439,22 +3963,16 @@ static int stli_getbrdnr(void) | |||
4439 | 3963 | ||
4440 | static int stli_findeisabrds(void) | 3964 | static int stli_findeisabrds(void) |
4441 | { | 3965 | { |
4442 | stlibrd_t *brdp; | 3966 | stlibrd_t *brdp; |
4443 | unsigned int iobase, eid; | 3967 | unsigned int iobase, eid; |
4444 | int i; | 3968 | int i; |
4445 | |||
4446 | #ifdef DEBUG | ||
4447 | printk(KERN_DEBUG "stli_findeisabrds()\n"); | ||
4448 | #endif | ||
4449 | 3969 | ||
4450 | /* | 3970 | /* |
4451 | * Firstly check if this is an EISA system. Do this by probing for | 3971 | * Firstly check if this is an EISA system. If this is not an EISA system then |
4452 | * the system board EISA ID. If this is not an EISA system then | ||
4453 | * don't bother going any further! | 3972 | * don't bother going any further! |
4454 | */ | 3973 | */ |
4455 | outb(0xff, 0xc80); | 3974 | if (EISA_bus) |
4456 | if (inb(0xc80) == 0xff) | 3975 | return 0; |
4457 | return(0); | ||
4458 | 3976 | ||
4459 | /* | 3977 | /* |
4460 | * Looks like an EISA system, so go searching for EISA boards. | 3978 | * Looks like an EISA system, so go searching for EISA boards. |
@@ -4472,7 +3990,7 @@ static int stli_findeisabrds(void) | |||
4472 | */ | 3990 | */ |
4473 | for (i = 0; (i < STL_MAXBRDS); i++) { | 3991 | for (i = 0; (i < STL_MAXBRDS); i++) { |
4474 | brdp = stli_brds[i]; | 3992 | brdp = stli_brds[i]; |
4475 | if (brdp == (stlibrd_t *) NULL) | 3993 | if (brdp == NULL) |
4476 | continue; | 3994 | continue; |
4477 | if (brdp->iobase == iobase) | 3995 | if (brdp->iobase == iobase) |
4478 | break; | 3996 | break; |
@@ -4484,10 +4002,10 @@ static int stli_findeisabrds(void) | |||
4484 | * We have found a Stallion board and it is not configured already. | 4002 | * We have found a Stallion board and it is not configured already. |
4485 | * Allocate a board structure and initialize it. | 4003 | * Allocate a board structure and initialize it. |
4486 | */ | 4004 | */ |
4487 | if ((brdp = stli_allocbrd()) == (stlibrd_t *) NULL) | 4005 | if ((brdp = stli_allocbrd()) == NULL) |
4488 | return(-ENOMEM); | 4006 | return -ENOMEM; |
4489 | if ((brdp->brdnr = stli_getbrdnr()) < 0) | 4007 | if ((brdp->brdnr = stli_getbrdnr()) < 0) |
4490 | return(-ENOMEM); | 4008 | return -ENOMEM; |
4491 | eid = inb(iobase + 0xc82); | 4009 | eid = inb(iobase + 0xc82); |
4492 | if (eid == ECP_EISAID) | 4010 | if (eid == ECP_EISAID) |
4493 | brdp->brdtype = BRD_ECPE; | 4011 | brdp->brdtype = BRD_ECPE; |
@@ -4502,7 +4020,7 @@ static int stli_findeisabrds(void) | |||
4502 | stli_brdinit(brdp); | 4020 | stli_brdinit(brdp); |
4503 | } | 4021 | } |
4504 | 4022 | ||
4505 | return(0); | 4023 | return 0; |
4506 | } | 4024 | } |
4507 | 4025 | ||
4508 | /*****************************************************************************/ | 4026 | /*****************************************************************************/ |
@@ -4523,32 +4041,18 @@ static int stli_findeisabrds(void) | |||
4523 | 4041 | ||
4524 | static int stli_initpcibrd(int brdtype, struct pci_dev *devp) | 4042 | static int stli_initpcibrd(int brdtype, struct pci_dev *devp) |
4525 | { | 4043 | { |
4526 | stlibrd_t *brdp; | 4044 | stlibrd_t *brdp; |
4527 | |||
4528 | #ifdef DEBUG | ||
4529 | printk(KERN_DEBUG "stli_initpcibrd(brdtype=%d,busnr=%x,devnr=%x)\n", | ||
4530 | brdtype, dev->bus->number, dev->devfn); | ||
4531 | #endif | ||
4532 | 4045 | ||
4533 | if (pci_enable_device(devp)) | 4046 | if (pci_enable_device(devp)) |
4534 | return(-EIO); | 4047 | return -EIO; |
4535 | if ((brdp = stli_allocbrd()) == (stlibrd_t *) NULL) | 4048 | if ((brdp = stli_allocbrd()) == NULL) |
4536 | return(-ENOMEM); | 4049 | return -ENOMEM; |
4537 | if ((brdp->brdnr = stli_getbrdnr()) < 0) { | 4050 | if ((brdp->brdnr = stli_getbrdnr()) < 0) { |
4538 | printk(KERN_INFO "STALLION: too many boards found, " | 4051 | printk(KERN_INFO "STALLION: too many boards found, " |
4539 | "maximum supported %d\n", STL_MAXBRDS); | 4052 | "maximum supported %d\n", STL_MAXBRDS); |
4540 | return(0); | 4053 | return 0; |
4541 | } | 4054 | } |
4542 | brdp->brdtype = brdtype; | 4055 | brdp->brdtype = brdtype; |
4543 | |||
4544 | #ifdef DEBUG | ||
4545 | printk(KERN_DEBUG "%s(%d): BAR[]=%lx,%lx,%lx,%lx\n", __FILE__, __LINE__, | ||
4546 | pci_resource_start(devp, 0), | ||
4547 | pci_resource_start(devp, 1), | ||
4548 | pci_resource_start(devp, 2), | ||
4549 | pci_resource_start(devp, 3)); | ||
4550 | #endif | ||
4551 | |||
4552 | /* | 4056 | /* |
4553 | * We have all resources from the board, so lets setup the actual | 4057 | * We have all resources from the board, so lets setup the actual |
4554 | * board structure now. | 4058 | * board structure now. |
@@ -4557,7 +4061,7 @@ static int stli_initpcibrd(int brdtype, struct pci_dev *devp) | |||
4557 | brdp->memaddr = pci_resource_start(devp, 2); | 4061 | brdp->memaddr = pci_resource_start(devp, 2); |
4558 | stli_brdinit(brdp); | 4062 | stli_brdinit(brdp); |
4559 | 4063 | ||
4560 | return(0); | 4064 | return 0; |
4561 | } | 4065 | } |
4562 | 4066 | ||
4563 | /*****************************************************************************/ | 4067 | /*****************************************************************************/ |
@@ -4569,20 +4073,12 @@ static int stli_initpcibrd(int brdtype, struct pci_dev *devp) | |||
4569 | 4073 | ||
4570 | static int stli_findpcibrds(void) | 4074 | static int stli_findpcibrds(void) |
4571 | { | 4075 | { |
4572 | struct pci_dev *dev = NULL; | 4076 | struct pci_dev *dev = NULL; |
4573 | int rc; | ||
4574 | 4077 | ||
4575 | #ifdef DEBUG | 4078 | while ((dev = pci_get_device(PCI_VENDOR_ID_STALLION, PCI_DEVICE_ID_ECRA, dev))) { |
4576 | printk("stli_findpcibrds()\n"); | 4079 | stli_initpcibrd(BRD_ECPPCI, dev); |
4577 | #endif | ||
4578 | |||
4579 | while ((dev = pci_find_device(PCI_VENDOR_ID_STALLION, | ||
4580 | PCI_DEVICE_ID_ECRA, dev))) { | ||
4581 | if ((rc = stli_initpcibrd(BRD_ECPPCI, dev))) | ||
4582 | return(rc); | ||
4583 | } | 4080 | } |
4584 | 4081 | return 0; | |
4585 | return(0); | ||
4586 | } | 4082 | } |
4587 | 4083 | ||
4588 | #endif | 4084 | #endif |
@@ -4595,17 +4091,16 @@ static int stli_findpcibrds(void) | |||
4595 | 4091 | ||
4596 | static stlibrd_t *stli_allocbrd(void) | 4092 | static stlibrd_t *stli_allocbrd(void) |
4597 | { | 4093 | { |
4598 | stlibrd_t *brdp; | 4094 | stlibrd_t *brdp; |
4599 | 4095 | ||
4600 | brdp = kzalloc(sizeof(stlibrd_t), GFP_KERNEL); | 4096 | brdp = kzalloc(sizeof(stlibrd_t), GFP_KERNEL); |
4601 | if (!brdp) { | 4097 | if (!brdp) { |
4602 | printk(KERN_ERR "STALLION: failed to allocate memory " | 4098 | printk(KERN_ERR "STALLION: failed to allocate memory " |
4603 | "(size=%d)\n", sizeof(stlibrd_t)); | 4099 | "(size=%Zd)\n", sizeof(stlibrd_t)); |
4604 | return NULL; | 4100 | return NULL; |
4605 | } | 4101 | } |
4606 | |||
4607 | brdp->magic = STLI_BOARDMAGIC; | 4102 | brdp->magic = STLI_BOARDMAGIC; |
4608 | return(brdp); | 4103 | return brdp; |
4609 | } | 4104 | } |
4610 | 4105 | ||
4611 | /*****************************************************************************/ | 4106 | /*****************************************************************************/ |
@@ -4617,13 +4112,9 @@ static stlibrd_t *stli_allocbrd(void) | |||
4617 | 4112 | ||
4618 | static int stli_initbrds(void) | 4113 | static int stli_initbrds(void) |
4619 | { | 4114 | { |
4620 | stlibrd_t *brdp, *nxtbrdp; | 4115 | stlibrd_t *brdp, *nxtbrdp; |
4621 | stlconf_t *confp; | 4116 | stlconf_t *confp; |
4622 | int i, j; | 4117 | int i, j; |
4623 | |||
4624 | #ifdef DEBUG | ||
4625 | printk(KERN_DEBUG "stli_initbrds()\n"); | ||
4626 | #endif | ||
4627 | 4118 | ||
4628 | if (stli_nrbrds > STL_MAXBRDS) { | 4119 | if (stli_nrbrds > STL_MAXBRDS) { |
4629 | printk(KERN_INFO "STALLION: too many boards in configuration " | 4120 | printk(KERN_INFO "STALLION: too many boards in configuration " |
@@ -4638,11 +4129,9 @@ static int stli_initbrds(void) | |||
4638 | */ | 4129 | */ |
4639 | for (i = 0; (i < stli_nrbrds); i++) { | 4130 | for (i = 0; (i < stli_nrbrds); i++) { |
4640 | confp = &stli_brdconf[i]; | 4131 | confp = &stli_brdconf[i]; |
4641 | #ifdef MODULE | ||
4642 | stli_parsebrd(confp, stli_brdsp[i]); | 4132 | stli_parsebrd(confp, stli_brdsp[i]); |
4643 | #endif | 4133 | if ((brdp = stli_allocbrd()) == NULL) |
4644 | if ((brdp = stli_allocbrd()) == (stlibrd_t *) NULL) | 4134 | return -ENOMEM; |
4645 | return(-ENOMEM); | ||
4646 | brdp->brdnr = i; | 4135 | brdp->brdnr = i; |
4647 | brdp->brdtype = confp->brdtype; | 4136 | brdp->brdtype = confp->brdtype; |
4648 | brdp->iobase = confp->ioaddr1; | 4137 | brdp->iobase = confp->ioaddr1; |
@@ -4654,9 +4143,7 @@ static int stli_initbrds(void) | |||
4654 | * Static configuration table done, so now use dynamic methods to | 4143 | * Static configuration table done, so now use dynamic methods to |
4655 | * see if any more boards should be configured. | 4144 | * see if any more boards should be configured. |
4656 | */ | 4145 | */ |
4657 | #ifdef MODULE | ||
4658 | stli_argbrds(); | 4146 | stli_argbrds(); |
4659 | #endif | ||
4660 | if (STLI_EISAPROBE) | 4147 | if (STLI_EISAPROBE) |
4661 | stli_findeisabrds(); | 4148 | stli_findeisabrds(); |
4662 | #ifdef CONFIG_PCI | 4149 | #ifdef CONFIG_PCI |
@@ -4672,11 +4159,11 @@ static int stli_initbrds(void) | |||
4672 | if (stli_nrbrds > 1) { | 4159 | if (stli_nrbrds > 1) { |
4673 | for (i = 0; (i < stli_nrbrds); i++) { | 4160 | for (i = 0; (i < stli_nrbrds); i++) { |
4674 | brdp = stli_brds[i]; | 4161 | brdp = stli_brds[i]; |
4675 | if (brdp == (stlibrd_t *) NULL) | 4162 | if (brdp == NULL) |
4676 | continue; | 4163 | continue; |
4677 | for (j = i + 1; (j < stli_nrbrds); j++) { | 4164 | for (j = i + 1; (j < stli_nrbrds); j++) { |
4678 | nxtbrdp = stli_brds[j]; | 4165 | nxtbrdp = stli_brds[j]; |
4679 | if (nxtbrdp == (stlibrd_t *) NULL) | 4166 | if (nxtbrdp == NULL) |
4680 | continue; | 4167 | continue; |
4681 | if ((brdp->membase >= nxtbrdp->membase) && | 4168 | if ((brdp->membase >= nxtbrdp->membase) && |
4682 | (brdp->membase <= (nxtbrdp->membase + | 4169 | (brdp->membase <= (nxtbrdp->membase + |
@@ -4691,7 +4178,7 @@ static int stli_initbrds(void) | |||
4691 | if (stli_shared == 0) { | 4178 | if (stli_shared == 0) { |
4692 | for (i = 0; (i < stli_nrbrds); i++) { | 4179 | for (i = 0; (i < stli_nrbrds); i++) { |
4693 | brdp = stli_brds[i]; | 4180 | brdp = stli_brds[i]; |
4694 | if (brdp == (stlibrd_t *) NULL) | 4181 | if (brdp == NULL) |
4695 | continue; | 4182 | continue; |
4696 | if (brdp->state & BST_FOUND) { | 4183 | if (brdp->state & BST_FOUND) { |
4697 | EBRDENABLE(brdp); | 4184 | EBRDENABLE(brdp); |
@@ -4701,7 +4188,7 @@ static int stli_initbrds(void) | |||
4701 | } | 4188 | } |
4702 | } | 4189 | } |
4703 | 4190 | ||
4704 | return(0); | 4191 | return 0; |
4705 | } | 4192 | } |
4706 | 4193 | ||
4707 | /*****************************************************************************/ | 4194 | /*****************************************************************************/ |
@@ -4714,48 +4201,55 @@ static int stli_initbrds(void) | |||
4714 | 4201 | ||
4715 | static ssize_t stli_memread(struct file *fp, char __user *buf, size_t count, loff_t *offp) | 4202 | static ssize_t stli_memread(struct file *fp, char __user *buf, size_t count, loff_t *offp) |
4716 | { | 4203 | { |
4717 | unsigned long flags; | 4204 | unsigned long flags; |
4718 | void *memptr; | 4205 | void *memptr; |
4719 | stlibrd_t *brdp; | 4206 | stlibrd_t *brdp; |
4720 | int brdnr, size, n; | 4207 | int brdnr, size, n; |
4721 | 4208 | void *p; | |
4722 | #ifdef DEBUG | 4209 | loff_t off = *offp; |
4723 | printk(KERN_DEBUG "stli_memread(fp=%x,buf=%x,count=%x,offp=%x)\n", | ||
4724 | (int) fp, (int) buf, count, (int) offp); | ||
4725 | #endif | ||
4726 | 4210 | ||
4727 | brdnr = iminor(fp->f_dentry->d_inode); | 4211 | brdnr = iminor(fp->f_dentry->d_inode); |
4728 | if (brdnr >= stli_nrbrds) | 4212 | if (brdnr >= stli_nrbrds) |
4729 | return(-ENODEV); | 4213 | return -ENODEV; |
4730 | brdp = stli_brds[brdnr]; | 4214 | brdp = stli_brds[brdnr]; |
4731 | if (brdp == (stlibrd_t *) NULL) | 4215 | if (brdp == NULL) |
4732 | return(-ENODEV); | 4216 | return -ENODEV; |
4733 | if (brdp->state == 0) | 4217 | if (brdp->state == 0) |
4734 | return(-ENODEV); | 4218 | return -ENODEV; |
4735 | if (fp->f_pos >= brdp->memsize) | 4219 | if (off >= brdp->memsize || off + count < off) |
4736 | return(0); | 4220 | return 0; |
4737 | 4221 | ||
4738 | size = MIN(count, (brdp->memsize - fp->f_pos)); | 4222 | size = MIN(count, (brdp->memsize - off)); |
4223 | |||
4224 | /* | ||
4225 | * Copy the data a page at a time | ||
4226 | */ | ||
4227 | |||
4228 | p = (void *)__get_free_page(GFP_KERNEL); | ||
4229 | if(p == NULL) | ||
4230 | return -ENOMEM; | ||
4739 | 4231 | ||
4740 | save_flags(flags); | ||
4741 | cli(); | ||
4742 | EBRDENABLE(brdp); | ||
4743 | while (size > 0) { | 4232 | while (size > 0) { |
4744 | memptr = (void *) EBRDGETMEMPTR(brdp, fp->f_pos); | 4233 | spin_lock_irqsave(&brd_lock, flags); |
4745 | n = MIN(size, (brdp->pagesize - (((unsigned long) fp->f_pos) % brdp->pagesize))); | 4234 | EBRDENABLE(brdp); |
4746 | if (copy_to_user(buf, memptr, n)) { | 4235 | memptr = (void *) EBRDGETMEMPTR(brdp, off); |
4236 | n = MIN(size, (brdp->pagesize - (((unsigned long) off) % brdp->pagesize))); | ||
4237 | n = MIN(n, PAGE_SIZE); | ||
4238 | memcpy_fromio(p, memptr, n); | ||
4239 | EBRDDISABLE(brdp); | ||
4240 | spin_unlock_irqrestore(&brd_lock, flags); | ||
4241 | if (copy_to_user(buf, p, n)) { | ||
4747 | count = -EFAULT; | 4242 | count = -EFAULT; |
4748 | goto out; | 4243 | goto out; |
4749 | } | 4244 | } |
4750 | fp->f_pos += n; | 4245 | off += n; |
4751 | buf += n; | 4246 | buf += n; |
4752 | size -= n; | 4247 | size -= n; |
4753 | } | 4248 | } |
4754 | out: | 4249 | out: |
4755 | EBRDDISABLE(brdp); | 4250 | *offp = off; |
4756 | restore_flags(flags); | 4251 | free_page((unsigned long)p); |
4757 | 4252 | return count; | |
4758 | return(count); | ||
4759 | } | 4253 | } |
4760 | 4254 | ||
4761 | /*****************************************************************************/ | 4255 | /*****************************************************************************/ |
@@ -4764,54 +4258,65 @@ out: | |||
4764 | * Code to handle an "staliomem" write operation. This device is the | 4258 | * Code to handle an "staliomem" write operation. This device is the |
4765 | * contents of the board shared memory. It is used for down loading | 4259 | * contents of the board shared memory. It is used for down loading |
4766 | * the slave image (and debugging :-) | 4260 | * the slave image (and debugging :-) |
4261 | * | ||
4262 | * FIXME: copy under lock | ||
4767 | */ | 4263 | */ |
4768 | 4264 | ||
4769 | static ssize_t stli_memwrite(struct file *fp, const char __user *buf, size_t count, loff_t *offp) | 4265 | static ssize_t stli_memwrite(struct file *fp, const char __user *buf, size_t count, loff_t *offp) |
4770 | { | 4266 | { |
4771 | unsigned long flags; | 4267 | unsigned long flags; |
4772 | void *memptr; | 4268 | void *memptr; |
4773 | stlibrd_t *brdp; | 4269 | stlibrd_t *brdp; |
4774 | char __user *chbuf; | 4270 | char __user *chbuf; |
4775 | int brdnr, size, n; | 4271 | int brdnr, size, n; |
4776 | 4272 | void *p; | |
4777 | #ifdef DEBUG | 4273 | loff_t off = *offp; |
4778 | printk(KERN_DEBUG "stli_memwrite(fp=%x,buf=%x,count=%x,offp=%x)\n", | ||
4779 | (int) fp, (int) buf, count, (int) offp); | ||
4780 | #endif | ||
4781 | 4274 | ||
4782 | brdnr = iminor(fp->f_dentry->d_inode); | 4275 | brdnr = iminor(fp->f_dentry->d_inode); |
4276 | |||
4783 | if (brdnr >= stli_nrbrds) | 4277 | if (brdnr >= stli_nrbrds) |
4784 | return(-ENODEV); | 4278 | return -ENODEV; |
4785 | brdp = stli_brds[brdnr]; | 4279 | brdp = stli_brds[brdnr]; |
4786 | if (brdp == (stlibrd_t *) NULL) | 4280 | if (brdp == NULL) |
4787 | return(-ENODEV); | 4281 | return -ENODEV; |
4788 | if (brdp->state == 0) | 4282 | if (brdp->state == 0) |
4789 | return(-ENODEV); | 4283 | return -ENODEV; |
4790 | if (fp->f_pos >= brdp->memsize) | 4284 | if (off >= brdp->memsize || off + count < off) |
4791 | return(0); | 4285 | return 0; |
4792 | 4286 | ||
4793 | chbuf = (char __user *) buf; | 4287 | chbuf = (char __user *) buf; |
4794 | size = MIN(count, (brdp->memsize - fp->f_pos)); | 4288 | size = MIN(count, (brdp->memsize - off)); |
4289 | |||
4290 | /* | ||
4291 | * Copy the data a page at a time | ||
4292 | */ | ||
4293 | |||
4294 | p = (void *)__get_free_page(GFP_KERNEL); | ||
4295 | if(p == NULL) | ||
4296 | return -ENOMEM; | ||
4795 | 4297 | ||
4796 | save_flags(flags); | ||
4797 | cli(); | ||
4798 | EBRDENABLE(brdp); | ||
4799 | while (size > 0) { | 4298 | while (size > 0) { |
4800 | memptr = (void *) EBRDGETMEMPTR(brdp, fp->f_pos); | 4299 | n = MIN(size, (brdp->pagesize - (((unsigned long) off) % brdp->pagesize))); |
4801 | n = MIN(size, (brdp->pagesize - (((unsigned long) fp->f_pos) % brdp->pagesize))); | 4300 | n = MIN(n, PAGE_SIZE); |
4802 | if (copy_from_user(memptr, chbuf, n)) { | 4301 | if (copy_from_user(p, chbuf, n)) { |
4803 | count = -EFAULT; | 4302 | if (count == 0) |
4303 | count = -EFAULT; | ||
4804 | goto out; | 4304 | goto out; |
4805 | } | 4305 | } |
4806 | fp->f_pos += n; | 4306 | spin_lock_irqsave(&brd_lock, flags); |
4307 | EBRDENABLE(brdp); | ||
4308 | memptr = (void *) EBRDGETMEMPTR(brdp, off); | ||
4309 | memcpy_toio(memptr, p, n); | ||
4310 | EBRDDISABLE(brdp); | ||
4311 | spin_unlock_irqrestore(&brd_lock, flags); | ||
4312 | off += n; | ||
4807 | chbuf += n; | 4313 | chbuf += n; |
4808 | size -= n; | 4314 | size -= n; |
4809 | } | 4315 | } |
4810 | out: | 4316 | out: |
4811 | EBRDDISABLE(brdp); | 4317 | free_page((unsigned long) p); |
4812 | restore_flags(flags); | 4318 | *offp = off; |
4813 | 4319 | return count; | |
4814 | return(count); | ||
4815 | } | 4320 | } |
4816 | 4321 | ||
4817 | /*****************************************************************************/ | 4322 | /*****************************************************************************/ |
@@ -4822,16 +4327,16 @@ out: | |||
4822 | 4327 | ||
4823 | static int stli_getbrdstats(combrd_t __user *bp) | 4328 | static int stli_getbrdstats(combrd_t __user *bp) |
4824 | { | 4329 | { |
4825 | stlibrd_t *brdp; | 4330 | stlibrd_t *brdp; |
4826 | int i; | 4331 | int i; |
4827 | 4332 | ||
4828 | if (copy_from_user(&stli_brdstats, bp, sizeof(combrd_t))) | 4333 | if (copy_from_user(&stli_brdstats, bp, sizeof(combrd_t))) |
4829 | return -EFAULT; | 4334 | return -EFAULT; |
4830 | if (stli_brdstats.brd >= STL_MAXBRDS) | 4335 | if (stli_brdstats.brd >= STL_MAXBRDS) |
4831 | return(-ENODEV); | 4336 | return -ENODEV; |
4832 | brdp = stli_brds[stli_brdstats.brd]; | 4337 | brdp = stli_brds[stli_brdstats.brd]; |
4833 | if (brdp == (stlibrd_t *) NULL) | 4338 | if (brdp == NULL) |
4834 | return(-ENODEV); | 4339 | return -ENODEV; |
4835 | 4340 | ||
4836 | memset(&stli_brdstats, 0, sizeof(combrd_t)); | 4341 | memset(&stli_brdstats, 0, sizeof(combrd_t)); |
4837 | stli_brdstats.brd = brdp->brdnr; | 4342 | stli_brdstats.brd = brdp->brdnr; |
@@ -4850,7 +4355,7 @@ static int stli_getbrdstats(combrd_t __user *bp) | |||
4850 | 4355 | ||
4851 | if (copy_to_user(bp, &stli_brdstats, sizeof(combrd_t))) | 4356 | if (copy_to_user(bp, &stli_brdstats, sizeof(combrd_t))) |
4852 | return -EFAULT; | 4357 | return -EFAULT; |
4853 | return(0); | 4358 | return 0; |
4854 | } | 4359 | } |
4855 | 4360 | ||
4856 | /*****************************************************************************/ | 4361 | /*****************************************************************************/ |
@@ -4861,19 +4366,19 @@ static int stli_getbrdstats(combrd_t __user *bp) | |||
4861 | 4366 | ||
4862 | static stliport_t *stli_getport(int brdnr, int panelnr, int portnr) | 4367 | static stliport_t *stli_getport(int brdnr, int panelnr, int portnr) |
4863 | { | 4368 | { |
4864 | stlibrd_t *brdp; | 4369 | stlibrd_t *brdp; |
4865 | int i; | 4370 | int i; |
4866 | 4371 | ||
4867 | if ((brdnr < 0) || (brdnr >= STL_MAXBRDS)) | 4372 | if (brdnr < 0 || brdnr >= STL_MAXBRDS) |
4868 | return((stliport_t *) NULL); | 4373 | return NULL; |
4869 | brdp = stli_brds[brdnr]; | 4374 | brdp = stli_brds[brdnr]; |
4870 | if (brdp == (stlibrd_t *) NULL) | 4375 | if (brdp == NULL) |
4871 | return((stliport_t *) NULL); | 4376 | return NULL; |
4872 | for (i = 0; (i < panelnr); i++) | 4377 | for (i = 0; (i < panelnr); i++) |
4873 | portnr += brdp->panels[i]; | 4378 | portnr += brdp->panels[i]; |
4874 | if ((portnr < 0) || (portnr >= brdp->nrports)) | 4379 | if ((portnr < 0) || (portnr >= brdp->nrports)) |
4875 | return((stliport_t *) NULL); | 4380 | return NULL; |
4876 | return(brdp->ports[portnr]); | 4381 | return brdp->ports[portnr]; |
4877 | } | 4382 | } |
4878 | 4383 | ||
4879 | /*****************************************************************************/ | 4384 | /*****************************************************************************/ |
@@ -4892,16 +4397,16 @@ static int stli_portcmdstats(stliport_t *portp) | |||
4892 | 4397 | ||
4893 | memset(&stli_comstats, 0, sizeof(comstats_t)); | 4398 | memset(&stli_comstats, 0, sizeof(comstats_t)); |
4894 | 4399 | ||
4895 | if (portp == (stliport_t *) NULL) | 4400 | if (portp == NULL) |
4896 | return(-ENODEV); | 4401 | return -ENODEV; |
4897 | brdp = stli_brds[portp->brdnr]; | 4402 | brdp = stli_brds[portp->brdnr]; |
4898 | if (brdp == (stlibrd_t *) NULL) | 4403 | if (brdp == NULL) |
4899 | return(-ENODEV); | 4404 | return -ENODEV; |
4900 | 4405 | ||
4901 | if (brdp->state & BST_STARTED) { | 4406 | if (brdp->state & BST_STARTED) { |
4902 | if ((rc = stli_cmdwait(brdp, portp, A_GETSTATS, | 4407 | if ((rc = stli_cmdwait(brdp, portp, A_GETSTATS, |
4903 | &stli_cdkstats, sizeof(asystats_t), 1)) < 0) | 4408 | &stli_cdkstats, sizeof(asystats_t), 1)) < 0) |
4904 | return(rc); | 4409 | return rc; |
4905 | } else { | 4410 | } else { |
4906 | memset(&stli_cdkstats, 0, sizeof(asystats_t)); | 4411 | memset(&stli_cdkstats, 0, sizeof(asystats_t)); |
4907 | } | 4412 | } |
@@ -4912,13 +4417,12 @@ static int stli_portcmdstats(stliport_t *portp) | |||
4912 | stli_comstats.state = portp->state; | 4417 | stli_comstats.state = portp->state; |
4913 | stli_comstats.flags = portp->flags; | 4418 | stli_comstats.flags = portp->flags; |
4914 | 4419 | ||
4915 | save_flags(flags); | 4420 | spin_lock_irqsave(&brd_lock, flags); |
4916 | cli(); | 4421 | if (portp->tty != NULL) { |
4917 | if (portp->tty != (struct tty_struct *) NULL) { | ||
4918 | if (portp->tty->driver_data == portp) { | 4422 | if (portp->tty->driver_data == portp) { |
4919 | stli_comstats.ttystate = portp->tty->flags; | 4423 | stli_comstats.ttystate = portp->tty->flags; |
4920 | stli_comstats.rxbuffered = -1 /*portp->tty->flip.count*/; | 4424 | stli_comstats.rxbuffered = -1; |
4921 | if (portp->tty->termios != (struct termios *) NULL) { | 4425 | if (portp->tty->termios != NULL) { |
4922 | stli_comstats.cflags = portp->tty->termios->c_cflag; | 4426 | stli_comstats.cflags = portp->tty->termios->c_cflag; |
4923 | stli_comstats.iflags = portp->tty->termios->c_iflag; | 4427 | stli_comstats.iflags = portp->tty->termios->c_iflag; |
4924 | stli_comstats.oflags = portp->tty->termios->c_oflag; | 4428 | stli_comstats.oflags = portp->tty->termios->c_oflag; |
@@ -4926,7 +4430,7 @@ static int stli_portcmdstats(stliport_t *portp) | |||
4926 | } | 4430 | } |
4927 | } | 4431 | } |
4928 | } | 4432 | } |
4929 | restore_flags(flags); | 4433 | spin_unlock_irqrestore(&brd_lock, flags); |
4930 | 4434 | ||
4931 | stli_comstats.txtotal = stli_cdkstats.txchars; | 4435 | stli_comstats.txtotal = stli_cdkstats.txchars; |
4932 | stli_comstats.rxtotal = stli_cdkstats.rxchars + stli_cdkstats.ringover; | 4436 | stli_comstats.rxtotal = stli_cdkstats.rxchars + stli_cdkstats.ringover; |
@@ -4948,7 +4452,7 @@ static int stli_portcmdstats(stliport_t *portp) | |||
4948 | stli_comstats.hwid = stli_cdkstats.hwid; | 4452 | stli_comstats.hwid = stli_cdkstats.hwid; |
4949 | stli_comstats.signals = stli_mktiocm(stli_cdkstats.signals); | 4453 | stli_comstats.signals = stli_mktiocm(stli_cdkstats.signals); |
4950 | 4454 | ||
4951 | return(0); | 4455 | return 0; |
4952 | } | 4456 | } |
4953 | 4457 | ||
4954 | /*****************************************************************************/ | 4458 | /*****************************************************************************/ |
@@ -4961,8 +4465,8 @@ static int stli_portcmdstats(stliport_t *portp) | |||
4961 | 4465 | ||
4962 | static int stli_getportstats(stliport_t *portp, comstats_t __user *cp) | 4466 | static int stli_getportstats(stliport_t *portp, comstats_t __user *cp) |
4963 | { | 4467 | { |
4964 | stlibrd_t *brdp; | 4468 | stlibrd_t *brdp; |
4965 | int rc; | 4469 | int rc; |
4966 | 4470 | ||
4967 | if (!portp) { | 4471 | if (!portp) { |
4968 | if (copy_from_user(&stli_comstats, cp, sizeof(comstats_t))) | 4472 | if (copy_from_user(&stli_comstats, cp, sizeof(comstats_t))) |
@@ -4992,8 +4496,8 @@ static int stli_getportstats(stliport_t *portp, comstats_t __user *cp) | |||
4992 | 4496 | ||
4993 | static int stli_clrportstats(stliport_t *portp, comstats_t __user *cp) | 4497 | static int stli_clrportstats(stliport_t *portp, comstats_t __user *cp) |
4994 | { | 4498 | { |
4995 | stlibrd_t *brdp; | 4499 | stlibrd_t *brdp; |
4996 | int rc; | 4500 | int rc; |
4997 | 4501 | ||
4998 | if (!portp) { | 4502 | if (!portp) { |
4999 | if (copy_from_user(&stli_comstats, cp, sizeof(comstats_t))) | 4503 | if (copy_from_user(&stli_comstats, cp, sizeof(comstats_t))) |
@@ -5031,7 +4535,7 @@ static int stli_clrportstats(stliport_t *portp, comstats_t __user *cp) | |||
5031 | 4535 | ||
5032 | static int stli_getportstruct(stliport_t __user *arg) | 4536 | static int stli_getportstruct(stliport_t __user *arg) |
5033 | { | 4537 | { |
5034 | stliport_t *portp; | 4538 | stliport_t *portp; |
5035 | 4539 | ||
5036 | if (copy_from_user(&stli_dummyport, arg, sizeof(stliport_t))) | 4540 | if (copy_from_user(&stli_dummyport, arg, sizeof(stliport_t))) |
5037 | return -EFAULT; | 4541 | return -EFAULT; |
@@ -5052,7 +4556,7 @@ static int stli_getportstruct(stliport_t __user *arg) | |||
5052 | 4556 | ||
5053 | static int stli_getbrdstruct(stlibrd_t __user *arg) | 4557 | static int stli_getbrdstruct(stlibrd_t __user *arg) |
5054 | { | 4558 | { |
5055 | stlibrd_t *brdp; | 4559 | stlibrd_t *brdp; |
5056 | 4560 | ||
5057 | if (copy_from_user(&stli_dummybrd, arg, sizeof(stlibrd_t))) | 4561 | if (copy_from_user(&stli_dummybrd, arg, sizeof(stlibrd_t))) |
5058 | return -EFAULT; | 4562 | return -EFAULT; |
@@ -5076,15 +4580,10 @@ static int stli_getbrdstruct(stlibrd_t __user *arg) | |||
5076 | 4580 | ||
5077 | static int stli_memioctl(struct inode *ip, struct file *fp, unsigned int cmd, unsigned long arg) | 4581 | static int stli_memioctl(struct inode *ip, struct file *fp, unsigned int cmd, unsigned long arg) |
5078 | { | 4582 | { |
5079 | stlibrd_t *brdp; | 4583 | stlibrd_t *brdp; |
5080 | int brdnr, rc, done; | 4584 | int brdnr, rc, done; |
5081 | void __user *argp = (void __user *)arg; | 4585 | void __user *argp = (void __user *)arg; |
5082 | 4586 | ||
5083 | #ifdef DEBUG | ||
5084 | printk(KERN_DEBUG "stli_memioctl(ip=%x,fp=%x,cmd=%x,arg=%x)\n", | ||
5085 | (int) ip, (int) fp, cmd, (int) arg); | ||
5086 | #endif | ||
5087 | |||
5088 | /* | 4587 | /* |
5089 | * First up handle the board independent ioctls. | 4588 | * First up handle the board independent ioctls. |
5090 | */ | 4589 | */ |
@@ -5115,7 +4614,7 @@ static int stli_memioctl(struct inode *ip, struct file *fp, unsigned int cmd, un | |||
5115 | } | 4614 | } |
5116 | 4615 | ||
5117 | if (done) | 4616 | if (done) |
5118 | return(rc); | 4617 | return rc; |
5119 | 4618 | ||
5120 | /* | 4619 | /* |
5121 | * Now handle the board specific ioctls. These all depend on the | 4620 | * Now handle the board specific ioctls. These all depend on the |
@@ -5123,12 +4622,12 @@ static int stli_memioctl(struct inode *ip, struct file *fp, unsigned int cmd, un | |||
5123 | */ | 4622 | */ |
5124 | brdnr = iminor(ip); | 4623 | brdnr = iminor(ip); |
5125 | if (brdnr >= STL_MAXBRDS) | 4624 | if (brdnr >= STL_MAXBRDS) |
5126 | return(-ENODEV); | 4625 | return -ENODEV; |
5127 | brdp = stli_brds[brdnr]; | 4626 | brdp = stli_brds[brdnr]; |
5128 | if (!brdp) | 4627 | if (!brdp) |
5129 | return(-ENODEV); | 4628 | return -ENODEV; |
5130 | if (brdp->state == 0) | 4629 | if (brdp->state == 0) |
5131 | return(-ENODEV); | 4630 | return -ENODEV; |
5132 | 4631 | ||
5133 | switch (cmd) { | 4632 | switch (cmd) { |
5134 | case STL_BINTR: | 4633 | case STL_BINTR: |
@@ -5152,8 +4651,7 @@ static int stli_memioctl(struct inode *ip, struct file *fp, unsigned int cmd, un | |||
5152 | rc = -ENOIOCTLCMD; | 4651 | rc = -ENOIOCTLCMD; |
5153 | break; | 4652 | break; |
5154 | } | 4653 | } |
5155 | 4654 | return rc; | |
5156 | return(rc); | ||
5157 | } | 4655 | } |
5158 | 4656 | ||
5159 | static struct tty_operations stli_ops = { | 4657 | static struct tty_operations stli_ops = { |
@@ -5182,11 +4680,14 @@ static struct tty_operations stli_ops = { | |||
5182 | 4680 | ||
5183 | /*****************************************************************************/ | 4681 | /*****************************************************************************/ |
5184 | 4682 | ||
5185 | int __init stli_init(void) | 4683 | static int __init stli_init(void) |
5186 | { | 4684 | { |
5187 | int i; | 4685 | int i; |
5188 | printk(KERN_INFO "%s: version %s\n", stli_drvtitle, stli_drvversion); | 4686 | printk(KERN_INFO "%s: version %s\n", stli_drvtitle, stli_drvversion); |
5189 | 4687 | ||
4688 | spin_lock_init(&stli_lock); | ||
4689 | spin_lock_init(&brd_lock); | ||
4690 | |||
5190 | stli_initbrds(); | 4691 | stli_initbrds(); |
5191 | 4692 | ||
5192 | stli_serial = alloc_tty_driver(STL_MAXBRDS * STL_MAXPORTS); | 4693 | stli_serial = alloc_tty_driver(STL_MAXBRDS * STL_MAXPORTS); |
@@ -5196,10 +4697,6 @@ int __init stli_init(void) | |||
5196 | /* | 4697 | /* |
5197 | * Allocate a temporary write buffer. | 4698 | * Allocate a temporary write buffer. |
5198 | */ | 4699 | */ |
5199 | stli_tmpwritebuf = kmalloc(STLI_TXBUFSIZE, GFP_KERNEL); | ||
5200 | if (!stli_tmpwritebuf) | ||
5201 | printk(KERN_ERR "STALLION: failed to allocate memory " | ||
5202 | "(size=%d)\n", STLI_TXBUFSIZE); | ||
5203 | stli_txcookbuf = kmalloc(STLI_TXBUFSIZE, GFP_KERNEL); | 4700 | stli_txcookbuf = kmalloc(STLI_TXBUFSIZE, GFP_KERNEL); |
5204 | if (!stli_txcookbuf) | 4701 | if (!stli_txcookbuf) |
5205 | printk(KERN_ERR "STALLION: failed to allocate memory " | 4702 | printk(KERN_ERR "STALLION: failed to allocate memory " |
@@ -5213,16 +4710,11 @@ int __init stli_init(void) | |||
5213 | printk(KERN_ERR "STALLION: failed to register serial memory " | 4710 | printk(KERN_ERR "STALLION: failed to register serial memory " |
5214 | "device\n"); | 4711 | "device\n"); |
5215 | 4712 | ||
5216 | devfs_mk_dir("staliomem"); | ||
5217 | istallion_class = class_create(THIS_MODULE, "staliomem"); | 4713 | istallion_class = class_create(THIS_MODULE, "staliomem"); |
5218 | for (i = 0; i < 4; i++) { | 4714 | for (i = 0; i < 4; i++) |
5219 | devfs_mk_cdev(MKDEV(STL_SIOMEMMAJOR, i), | ||
5220 | S_IFCHR | S_IRUSR | S_IWUSR, | ||
5221 | "staliomem/%d", i); | ||
5222 | class_device_create(istallion_class, NULL, | 4715 | class_device_create(istallion_class, NULL, |
5223 | MKDEV(STL_SIOMEMMAJOR, i), | 4716 | MKDEV(STL_SIOMEMMAJOR, i), |
5224 | NULL, "staliomem%d", i); | 4717 | NULL, "staliomem%d", i); |
5225 | } | ||
5226 | 4718 | ||
5227 | /* | 4719 | /* |
5228 | * Set up the tty driver structure and register us as a driver. | 4720 | * Set up the tty driver structure and register us as a driver. |
@@ -5243,7 +4735,7 @@ int __init stli_init(void) | |||
5243 | printk(KERN_ERR "STALLION: failed to register serial driver\n"); | 4735 | printk(KERN_ERR "STALLION: failed to register serial driver\n"); |
5244 | return -EBUSY; | 4736 | return -EBUSY; |
5245 | } | 4737 | } |
5246 | return(0); | 4738 | return 0; |
5247 | } | 4739 | } |
5248 | 4740 | ||
5249 | /*****************************************************************************/ | 4741 | /*****************************************************************************/ |
diff --git a/drivers/char/ite_gpio.c b/drivers/char/ite_gpio.c index d1ed6ac950d1..cde562d70c4f 100644 --- a/drivers/char/ite_gpio.c +++ b/drivers/char/ite_gpio.c | |||
@@ -357,7 +357,7 @@ DEB(printk("interrupt 0x%x %d\n",ITE_GPAISR, i)); | |||
357 | } | 357 | } |
358 | } | 358 | } |
359 | 359 | ||
360 | static struct file_operations ite_gpio_fops = { | 360 | static const struct file_operations ite_gpio_fops = { |
361 | .owner = THIS_MODULE, | 361 | .owner = THIS_MODULE, |
362 | .ioctl = ite_gpio_ioctl, | 362 | .ioctl = ite_gpio_ioctl, |
363 | .open = ite_gpio_open, | 363 | .open = ite_gpio_open, |
@@ -397,7 +397,7 @@ int __init ite_gpio_init(void) | |||
397 | init_waitqueue_head(&ite_gpio_wait[i]); | 397 | init_waitqueue_head(&ite_gpio_wait[i]); |
398 | } | 398 | } |
399 | 399 | ||
400 | if (request_irq(ite_gpio_irq, ite_gpio_irq_handler, SA_SHIRQ, "gpio", 0) < 0) { | 400 | if (request_irq(ite_gpio_irq, ite_gpio_irq_handler, IRQF_SHARED, "gpio", 0) < 0) { |
401 | misc_deregister(&ite_gpio_miscdev); | 401 | misc_deregister(&ite_gpio_miscdev); |
402 | release_region(ite_gpio_base, 0x1c); | 402 | release_region(ite_gpio_base, 0x1c); |
403 | return 0; | 403 | return 0; |
diff --git a/drivers/char/keyboard.c b/drivers/char/keyboard.c index 5755b7e5f187..056ebe84b81d 100644 --- a/drivers/char/keyboard.c +++ b/drivers/char/keyboard.c | |||
@@ -24,7 +24,6 @@ | |||
24 | * 21-08-02: Converted to input API, major cleanup. (Vojtech Pavlik) | 24 | * 21-08-02: Converted to input API, major cleanup. (Vojtech Pavlik) |
25 | */ | 25 | */ |
26 | 26 | ||
27 | #include <linux/config.h> | ||
28 | #include <linux/module.h> | 27 | #include <linux/module.h> |
29 | #include <linux/sched.h> | 28 | #include <linux/sched.h> |
30 | #include <linux/tty.h> | 29 | #include <linux/tty.h> |
@@ -39,6 +38,7 @@ | |||
39 | #include <linux/vt_kern.h> | 38 | #include <linux/vt_kern.h> |
40 | #include <linux/sysrq.h> | 39 | #include <linux/sysrq.h> |
41 | #include <linux/input.h> | 40 | #include <linux/input.h> |
41 | #include <linux/reboot.h> | ||
42 | 42 | ||
43 | static void kbd_disconnect(struct input_handle *handle); | 43 | static void kbd_disconnect(struct input_handle *handle); |
44 | extern void ctrl_alt_del(void); | 44 | extern void ctrl_alt_del(void); |
@@ -150,6 +150,7 @@ unsigned char kbd_sysrq_xlate[KEY_MAX + 1] = | |||
150 | "230\177\000\000\213\214\000\000\000\000\000\000\000\000\000\000" /* 0x50 - 0x5f */ | 150 | "230\177\000\000\213\214\000\000\000\000\000\000\000\000\000\000" /* 0x50 - 0x5f */ |
151 | "\r\000/"; /* 0x60 - 0x6f */ | 151 | "\r\000/"; /* 0x60 - 0x6f */ |
152 | static int sysrq_down; | 152 | static int sysrq_down; |
153 | static int sysrq_alt_use; | ||
153 | #endif | 154 | #endif |
154 | static int sysrq_alt; | 155 | static int sysrq_alt; |
155 | 156 | ||
@@ -672,7 +673,7 @@ static void k_dead2(struct vc_data *vc, unsigned char value, char up_flag, struc | |||
672 | */ | 673 | */ |
673 | static void k_dead(struct vc_data *vc, unsigned char value, char up_flag, struct pt_regs *regs) | 674 | static void k_dead(struct vc_data *vc, unsigned char value, char up_flag, struct pt_regs *regs) |
674 | { | 675 | { |
675 | static unsigned char ret_diacr[NR_DEAD] = {'`', '\'', '^', '~', '"', ',' }; | 676 | static const unsigned char ret_diacr[NR_DEAD] = {'`', '\'', '^', '~', '"', ',' }; |
676 | value = ret_diacr[value]; | 677 | value = ret_diacr[value]; |
677 | k_deadunicode(vc, value, up_flag, regs); | 678 | k_deadunicode(vc, value, up_flag, regs); |
678 | } | 679 | } |
@@ -709,8 +710,8 @@ static void k_cur(struct vc_data *vc, unsigned char value, char up_flag, struct | |||
709 | 710 | ||
710 | static void k_pad(struct vc_data *vc, unsigned char value, char up_flag, struct pt_regs *regs) | 711 | static void k_pad(struct vc_data *vc, unsigned char value, char up_flag, struct pt_regs *regs) |
711 | { | 712 | { |
712 | static const char *pad_chars = "0123456789+-*/\015,.?()#"; | 713 | static const char pad_chars[] = "0123456789+-*/\015,.?()#"; |
713 | static const char *app_map = "pqrstuvwxylSRQMnnmPQS"; | 714 | static const char app_map[] = "pqrstuvwxylSRQMnnmPQS"; |
714 | 715 | ||
715 | if (up_flag) | 716 | if (up_flag) |
716 | return; /* no action, if this is a key release */ | 717 | return; /* no action, if this is a key release */ |
@@ -1035,7 +1036,7 @@ static void kbd_refresh_leds(struct input_handle *handle) | |||
1035 | #define HW_RAW(dev) (test_bit(EV_MSC, dev->evbit) && test_bit(MSC_RAW, dev->mscbit) &&\ | 1036 | #define HW_RAW(dev) (test_bit(EV_MSC, dev->evbit) && test_bit(MSC_RAW, dev->mscbit) &&\ |
1036 | ((dev)->id.bustype == BUS_I8042) && ((dev)->id.vendor == 0x0001) && ((dev)->id.product == 0x0001)) | 1037 | ((dev)->id.bustype == BUS_I8042) && ((dev)->id.vendor == 0x0001) && ((dev)->id.product == 0x0001)) |
1037 | 1038 | ||
1038 | static unsigned short x86_keycodes[256] = | 1039 | static const unsigned short x86_keycodes[256] = |
1039 | { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, | 1040 | { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, |
1040 | 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, | 1041 | 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, |
1041 | 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, | 1042 | 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, |
@@ -1073,11 +1074,13 @@ static int emulate_raw(struct vc_data *vc, unsigned int keycode, | |||
1073 | put_queue(vc, 0x1d | up_flag); | 1074 | put_queue(vc, 0x1d | up_flag); |
1074 | put_queue(vc, 0x45 | up_flag); | 1075 | put_queue(vc, 0x45 | up_flag); |
1075 | return 0; | 1076 | return 0; |
1076 | case KEY_HANGUEL: | 1077 | case KEY_HANGEUL: |
1077 | if (!up_flag) put_queue(vc, 0xf1); | 1078 | if (!up_flag) |
1079 | put_queue(vc, 0xf2); | ||
1078 | return 0; | 1080 | return 0; |
1079 | case KEY_HANJA: | 1081 | case KEY_HANJA: |
1080 | if (!up_flag) put_queue(vc, 0xf2); | 1082 | if (!up_flag) |
1083 | put_queue(vc, 0xf1); | ||
1081 | return 0; | 1084 | return 0; |
1082 | } | 1085 | } |
1083 | 1086 | ||
@@ -1142,7 +1145,7 @@ static void kbd_keycode(unsigned int keycode, int down, | |||
1142 | kbd = kbd_table + fg_console; | 1145 | kbd = kbd_table + fg_console; |
1143 | 1146 | ||
1144 | if (keycode == KEY_LEFTALT || keycode == KEY_RIGHTALT) | 1147 | if (keycode == KEY_LEFTALT || keycode == KEY_RIGHTALT) |
1145 | sysrq_alt = down; | 1148 | sysrq_alt = down ? keycode : 0; |
1146 | #ifdef CONFIG_SPARC | 1149 | #ifdef CONFIG_SPARC |
1147 | if (keycode == KEY_STOP) | 1150 | if (keycode == KEY_STOP) |
1148 | sparc_l1_a_state = down; | 1151 | sparc_l1_a_state = down; |
@@ -1162,9 +1165,14 @@ static void kbd_keycode(unsigned int keycode, int down, | |||
1162 | 1165 | ||
1163 | #ifdef CONFIG_MAGIC_SYSRQ /* Handle the SysRq Hack */ | 1166 | #ifdef CONFIG_MAGIC_SYSRQ /* Handle the SysRq Hack */ |
1164 | if (keycode == KEY_SYSRQ && (sysrq_down || (down == 1 && sysrq_alt))) { | 1167 | if (keycode == KEY_SYSRQ && (sysrq_down || (down == 1 && sysrq_alt))) { |
1165 | sysrq_down = down; | 1168 | if (!sysrq_down) { |
1169 | sysrq_down = down; | ||
1170 | sysrq_alt_use = sysrq_alt; | ||
1171 | } | ||
1166 | return; | 1172 | return; |
1167 | } | 1173 | } |
1174 | if (sysrq_down && !down && keycode == sysrq_alt_use) | ||
1175 | sysrq_down = 0; | ||
1168 | if (sysrq_down && down && !rep) { | 1176 | if (sysrq_down && down && !rep) { |
1169 | handle_sysrq(kbd_sysrq_xlate[keycode], regs, tty); | 1177 | handle_sysrq(kbd_sysrq_xlate[keycode], regs, tty); |
1170 | return; | 1178 | return; |
diff --git a/drivers/char/lcd.c b/drivers/char/lcd.c index 29963d8be667..da601fd6c07a 100644 --- a/drivers/char/lcd.c +++ b/drivers/char/lcd.c | |||
@@ -14,7 +14,6 @@ | |||
14 | 14 | ||
15 | #define RTC_IO_EXTENT 0x10 /*Only really two ports, but... */ | 15 | #define RTC_IO_EXTENT 0x10 /*Only really two ports, but... */ |
16 | 16 | ||
17 | #include <linux/config.h> | ||
18 | #include <linux/types.h> | 17 | #include <linux/types.h> |
19 | #include <linux/errno.h> | 18 | #include <linux/errno.h> |
20 | #include <linux/miscdevice.h> | 19 | #include <linux/miscdevice.h> |
@@ -599,7 +598,7 @@ static ssize_t lcd_read(struct file *file, char *buf, | |||
599 | * The various file operations we support. | 598 | * The various file operations we support. |
600 | */ | 599 | */ |
601 | 600 | ||
602 | static struct file_operations lcd_fops = { | 601 | static const struct file_operations lcd_fops = { |
603 | .read = lcd_read, | 602 | .read = lcd_read, |
604 | .ioctl = lcd_ioctl, | 603 | .ioctl = lcd_ioctl, |
605 | .open = lcd_open, | 604 | .open = lcd_open, |
diff --git a/drivers/char/lp.c b/drivers/char/lp.c index e57260525293..f875fda3b089 100644 --- a/drivers/char/lp.c +++ b/drivers/char/lp.c | |||
@@ -114,13 +114,11 @@ | |||
114 | #include <linux/module.h> | 114 | #include <linux/module.h> |
115 | #include <linux/init.h> | 115 | #include <linux/init.h> |
116 | 116 | ||
117 | #include <linux/config.h> | ||
118 | #include <linux/errno.h> | 117 | #include <linux/errno.h> |
119 | #include <linux/kernel.h> | 118 | #include <linux/kernel.h> |
120 | #include <linux/major.h> | 119 | #include <linux/major.h> |
121 | #include <linux/sched.h> | 120 | #include <linux/sched.h> |
122 | #include <linux/smp_lock.h> | 121 | #include <linux/smp_lock.h> |
123 | #include <linux/devfs_fs_kernel.h> | ||
124 | #include <linux/slab.h> | 122 | #include <linux/slab.h> |
125 | #include <linux/fcntl.h> | 123 | #include <linux/fcntl.h> |
126 | #include <linux/delay.h> | 124 | #include <linux/delay.h> |
@@ -668,7 +666,7 @@ static int lp_ioctl(struct inode *inode, struct file *file, | |||
668 | return retval; | 666 | return retval; |
669 | } | 667 | } |
670 | 668 | ||
671 | static struct file_operations lp_fops = { | 669 | static const struct file_operations lp_fops = { |
672 | .owner = THIS_MODULE, | 670 | .owner = THIS_MODULE, |
673 | .write = lp_write, | 671 | .write = lp_write, |
674 | .ioctl = lp_ioctl, | 672 | .ioctl = lp_ioctl, |
@@ -807,8 +805,6 @@ static int lp_register(int nr, struct parport *port) | |||
807 | 805 | ||
808 | class_device_create(lp_class, NULL, MKDEV(LP_MAJOR, nr), NULL, | 806 | class_device_create(lp_class, NULL, MKDEV(LP_MAJOR, nr), NULL, |
809 | "lp%d", nr); | 807 | "lp%d", nr); |
810 | devfs_mk_cdev(MKDEV(LP_MAJOR, nr), S_IFCHR | S_IRUGO | S_IWUGO, | ||
811 | "printers/%d", nr); | ||
812 | 808 | ||
813 | printk(KERN_INFO "lp%d: using %s (%s).\n", nr, port->name, | 809 | printk(KERN_INFO "lp%d: using %s (%s).\n", nr, port->name, |
814 | (port->irq == PARPORT_IRQ_NONE)?"polling":"interrupt-driven"); | 810 | (port->irq == PARPORT_IRQ_NONE)?"polling":"interrupt-driven"); |
@@ -907,7 +903,6 @@ static int __init lp_init (void) | |||
907 | return -EIO; | 903 | return -EIO; |
908 | } | 904 | } |
909 | 905 | ||
910 | devfs_mk_dir("printers"); | ||
911 | lp_class = class_create(THIS_MODULE, "printer"); | 906 | lp_class = class_create(THIS_MODULE, "printer"); |
912 | if (IS_ERR(lp_class)) { | 907 | if (IS_ERR(lp_class)) { |
913 | err = PTR_ERR(lp_class); | 908 | err = PTR_ERR(lp_class); |
@@ -933,7 +928,6 @@ static int __init lp_init (void) | |||
933 | out_class: | 928 | out_class: |
934 | class_destroy(lp_class); | 929 | class_destroy(lp_class); |
935 | out_devfs: | 930 | out_devfs: |
936 | devfs_remove("printers"); | ||
937 | unregister_chrdev(LP_MAJOR, "lp"); | 931 | unregister_chrdev(LP_MAJOR, "lp"); |
938 | return err; | 932 | return err; |
939 | } | 933 | } |
@@ -981,10 +975,8 @@ static void lp_cleanup_module (void) | |||
981 | if (lp_table[offset].dev == NULL) | 975 | if (lp_table[offset].dev == NULL) |
982 | continue; | 976 | continue; |
983 | parport_unregister_device(lp_table[offset].dev); | 977 | parport_unregister_device(lp_table[offset].dev); |
984 | devfs_remove("printers/%d", offset); | ||
985 | class_device_destroy(lp_class, MKDEV(LP_MAJOR, offset)); | 978 | class_device_destroy(lp_class, MKDEV(LP_MAJOR, offset)); |
986 | } | 979 | } |
987 | devfs_remove("printers"); | ||
988 | class_destroy(lp_class); | 980 | class_destroy(lp_class); |
989 | } | 981 | } |
990 | 982 | ||
diff --git a/drivers/char/mbcs.c b/drivers/char/mbcs.c index c268ee04b2aa..0385650f6077 100644 --- a/drivers/char/mbcs.c +++ b/drivers/char/mbcs.c | |||
@@ -10,7 +10,6 @@ | |||
10 | * MOATB Core Services driver. | 10 | * MOATB Core Services driver. |
11 | */ | 11 | */ |
12 | 12 | ||
13 | #include <linux/config.h> | ||
14 | #include <linux/interrupt.h> | 13 | #include <linux/interrupt.h> |
15 | #include <linux/module.h> | 14 | #include <linux/module.h> |
16 | #include <linux/moduleparam.h> | 15 | #include <linux/moduleparam.h> |
@@ -593,7 +592,7 @@ static int mbcs_intr_alloc(struct cx_dev *dev) | |||
593 | getdma->intrHostDest = sn_irq->irq_xtalkaddr; | 592 | getdma->intrHostDest = sn_irq->irq_xtalkaddr; |
594 | getdma->intrVector = sn_irq->irq_irq; | 593 | getdma->intrVector = sn_irq->irq_irq; |
595 | if (request_irq(sn_irq->irq_irq, | 594 | if (request_irq(sn_irq->irq_irq, |
596 | (void *)mbcs_completion_intr_handler, SA_SHIRQ, | 595 | (void *)mbcs_completion_intr_handler, IRQF_SHARED, |
597 | "MBCS get intr", (void *)soft)) { | 596 | "MBCS get intr", (void *)soft)) { |
598 | tiocx_irq_free(soft->get_sn_irq); | 597 | tiocx_irq_free(soft->get_sn_irq); |
599 | return -EAGAIN; | 598 | return -EAGAIN; |
@@ -609,7 +608,7 @@ static int mbcs_intr_alloc(struct cx_dev *dev) | |||
609 | putdma->intrHostDest = sn_irq->irq_xtalkaddr; | 608 | putdma->intrHostDest = sn_irq->irq_xtalkaddr; |
610 | putdma->intrVector = sn_irq->irq_irq; | 609 | putdma->intrVector = sn_irq->irq_irq; |
611 | if (request_irq(sn_irq->irq_irq, | 610 | if (request_irq(sn_irq->irq_irq, |
612 | (void *)mbcs_completion_intr_handler, SA_SHIRQ, | 611 | (void *)mbcs_completion_intr_handler, IRQF_SHARED, |
613 | "MBCS put intr", (void *)soft)) { | 612 | "MBCS put intr", (void *)soft)) { |
614 | tiocx_irq_free(soft->put_sn_irq); | 613 | tiocx_irq_free(soft->put_sn_irq); |
615 | free_irq(soft->get_sn_irq->irq_irq, soft); | 614 | free_irq(soft->get_sn_irq->irq_irq, soft); |
@@ -629,7 +628,7 @@ static int mbcs_intr_alloc(struct cx_dev *dev) | |||
629 | algo->intrHostDest = sn_irq->irq_xtalkaddr; | 628 | algo->intrHostDest = sn_irq->irq_xtalkaddr; |
630 | algo->intrVector = sn_irq->irq_irq; | 629 | algo->intrVector = sn_irq->irq_irq; |
631 | if (request_irq(sn_irq->irq_irq, | 630 | if (request_irq(sn_irq->irq_irq, |
632 | (void *)mbcs_completion_intr_handler, SA_SHIRQ, | 631 | (void *)mbcs_completion_intr_handler, IRQF_SHARED, |
633 | "MBCS algo intr", (void *)soft)) { | 632 | "MBCS algo intr", (void *)soft)) { |
634 | tiocx_irq_free(soft->algo_sn_irq); | 633 | tiocx_irq_free(soft->algo_sn_irq); |
635 | free_irq(soft->put_sn_irq->irq_irq, soft); | 634 | free_irq(soft->put_sn_irq->irq_irq, soft); |
diff --git a/drivers/char/mem.c b/drivers/char/mem.c index 1fa9fa157c12..e97c32ceb796 100644 --- a/drivers/char/mem.c +++ b/drivers/char/mem.c | |||
@@ -8,7 +8,6 @@ | |||
8 | * Shared /dev/zero mmaping support, Feb 2000, Kanoj Sarcar <kanoj@sgi.com> | 8 | * Shared /dev/zero mmaping support, Feb 2000, Kanoj Sarcar <kanoj@sgi.com> |
9 | */ | 9 | */ |
10 | 10 | ||
11 | #include <linux/config.h> | ||
12 | #include <linux/mm.h> | 11 | #include <linux/mm.h> |
13 | #include <linux/miscdevice.h> | 12 | #include <linux/miscdevice.h> |
14 | #include <linux/slab.h> | 13 | #include <linux/slab.h> |
@@ -20,7 +19,6 @@ | |||
20 | #include <linux/tty.h> | 19 | #include <linux/tty.h> |
21 | #include <linux/capability.h> | 20 | #include <linux/capability.h> |
22 | #include <linux/smp_lock.h> | 21 | #include <linux/smp_lock.h> |
23 | #include <linux/devfs_fs_kernel.h> | ||
24 | #include <linux/ptrace.h> | 22 | #include <linux/ptrace.h> |
25 | #include <linux/device.h> | 23 | #include <linux/device.h> |
26 | #include <linux/highmem.h> | 24 | #include <linux/highmem.h> |
@@ -778,7 +776,7 @@ static int open_port(struct inode * inode, struct file * filp) | |||
778 | #define open_kmem open_mem | 776 | #define open_kmem open_mem |
779 | #define open_oldmem open_mem | 777 | #define open_oldmem open_mem |
780 | 778 | ||
781 | static struct file_operations mem_fops = { | 779 | static const struct file_operations mem_fops = { |
782 | .llseek = memory_lseek, | 780 | .llseek = memory_lseek, |
783 | .read = read_mem, | 781 | .read = read_mem, |
784 | .write = write_mem, | 782 | .write = write_mem, |
@@ -786,7 +784,7 @@ static struct file_operations mem_fops = { | |||
786 | .open = open_mem, | 784 | .open = open_mem, |
787 | }; | 785 | }; |
788 | 786 | ||
789 | static struct file_operations kmem_fops = { | 787 | static const struct file_operations kmem_fops = { |
790 | .llseek = memory_lseek, | 788 | .llseek = memory_lseek, |
791 | .read = read_kmem, | 789 | .read = read_kmem, |
792 | .write = write_kmem, | 790 | .write = write_kmem, |
@@ -794,7 +792,7 @@ static struct file_operations kmem_fops = { | |||
794 | .open = open_kmem, | 792 | .open = open_kmem, |
795 | }; | 793 | }; |
796 | 794 | ||
797 | static struct file_operations null_fops = { | 795 | static const struct file_operations null_fops = { |
798 | .llseek = null_lseek, | 796 | .llseek = null_lseek, |
799 | .read = read_null, | 797 | .read = read_null, |
800 | .write = write_null, | 798 | .write = write_null, |
@@ -802,7 +800,7 @@ static struct file_operations null_fops = { | |||
802 | }; | 800 | }; |
803 | 801 | ||
804 | #if defined(CONFIG_ISA) || !defined(__mc68000__) | 802 | #if defined(CONFIG_ISA) || !defined(__mc68000__) |
805 | static struct file_operations port_fops = { | 803 | static const struct file_operations port_fops = { |
806 | .llseek = memory_lseek, | 804 | .llseek = memory_lseek, |
807 | .read = read_port, | 805 | .read = read_port, |
808 | .write = write_port, | 806 | .write = write_port, |
@@ -810,7 +808,7 @@ static struct file_operations port_fops = { | |||
810 | }; | 808 | }; |
811 | #endif | 809 | #endif |
812 | 810 | ||
813 | static struct file_operations zero_fops = { | 811 | static const struct file_operations zero_fops = { |
814 | .llseek = zero_lseek, | 812 | .llseek = zero_lseek, |
815 | .read = read_zero, | 813 | .read = read_zero, |
816 | .write = write_zero, | 814 | .write = write_zero, |
@@ -821,14 +819,14 @@ static struct backing_dev_info zero_bdi = { | |||
821 | .capabilities = BDI_CAP_MAP_COPY, | 819 | .capabilities = BDI_CAP_MAP_COPY, |
822 | }; | 820 | }; |
823 | 821 | ||
824 | static struct file_operations full_fops = { | 822 | static const struct file_operations full_fops = { |
825 | .llseek = full_lseek, | 823 | .llseek = full_lseek, |
826 | .read = read_full, | 824 | .read = read_full, |
827 | .write = write_full, | 825 | .write = write_full, |
828 | }; | 826 | }; |
829 | 827 | ||
830 | #ifdef CONFIG_CRASH_DUMP | 828 | #ifdef CONFIG_CRASH_DUMP |
831 | static struct file_operations oldmem_fops = { | 829 | static const struct file_operations oldmem_fops = { |
832 | .read = read_oldmem, | 830 | .read = read_oldmem, |
833 | .open = open_oldmem, | 831 | .open = open_oldmem, |
834 | }; | 832 | }; |
@@ -855,7 +853,7 @@ static ssize_t kmsg_write(struct file * file, const char __user * buf, | |||
855 | return ret; | 853 | return ret; |
856 | } | 854 | } |
857 | 855 | ||
858 | static struct file_operations kmsg_fops = { | 856 | static const struct file_operations kmsg_fops = { |
859 | .write = kmsg_write, | 857 | .write = kmsg_write, |
860 | }; | 858 | }; |
861 | 859 | ||
@@ -905,7 +903,7 @@ static int memory_open(struct inode * inode, struct file * filp) | |||
905 | return 0; | 903 | return 0; |
906 | } | 904 | } |
907 | 905 | ||
908 | static struct file_operations memory_fops = { | 906 | static const struct file_operations memory_fops = { |
909 | .open = memory_open, /* just a selector for the real open */ | 907 | .open = memory_open, /* just a selector for the real open */ |
910 | }; | 908 | }; |
911 | 909 | ||
@@ -941,13 +939,10 @@ static int __init chr_dev_init(void) | |||
941 | printk("unable to get major %d for memory devs\n", MEM_MAJOR); | 939 | printk("unable to get major %d for memory devs\n", MEM_MAJOR); |
942 | 940 | ||
943 | mem_class = class_create(THIS_MODULE, "mem"); | 941 | mem_class = class_create(THIS_MODULE, "mem"); |
944 | for (i = 0; i < ARRAY_SIZE(devlist); i++) { | 942 | for (i = 0; i < ARRAY_SIZE(devlist); i++) |
945 | class_device_create(mem_class, NULL, | 943 | class_device_create(mem_class, NULL, |
946 | MKDEV(MEM_MAJOR, devlist[i].minor), | 944 | MKDEV(MEM_MAJOR, devlist[i].minor), |
947 | NULL, devlist[i].name); | 945 | NULL, devlist[i].name); |
948 | devfs_mk_cdev(MKDEV(MEM_MAJOR, devlist[i].minor), | ||
949 | S_IFCHR | devlist[i].mode, devlist[i].name); | ||
950 | } | ||
951 | 946 | ||
952 | return 0; | 947 | return 0; |
953 | } | 948 | } |
diff --git a/drivers/char/misc.c b/drivers/char/misc.c index 96eb2a709e21..62ebe09656e3 100644 --- a/drivers/char/misc.c +++ b/drivers/char/misc.c | |||
@@ -34,7 +34,6 @@ | |||
34 | */ | 34 | */ |
35 | 35 | ||
36 | #include <linux/module.h> | 36 | #include <linux/module.h> |
37 | #include <linux/config.h> | ||
38 | 37 | ||
39 | #include <linux/fs.h> | 38 | #include <linux/fs.h> |
40 | #include <linux/errno.h> | 39 | #include <linux/errno.h> |
@@ -44,7 +43,6 @@ | |||
44 | #include <linux/slab.h> | 43 | #include <linux/slab.h> |
45 | #include <linux/proc_fs.h> | 44 | #include <linux/proc_fs.h> |
46 | #include <linux/seq_file.h> | 45 | #include <linux/seq_file.h> |
47 | #include <linux/devfs_fs_kernel.h> | ||
48 | #include <linux/stat.h> | 46 | #include <linux/stat.h> |
49 | #include <linux/init.h> | 47 | #include <linux/init.h> |
50 | #include <linux/device.h> | 48 | #include <linux/device.h> |
@@ -115,7 +113,7 @@ static int misc_seq_open(struct inode *inode, struct file *file) | |||
115 | return seq_open(file, &misc_seq_ops); | 113 | return seq_open(file, &misc_seq_ops); |
116 | } | 114 | } |
117 | 115 | ||
118 | static struct file_operations misc_proc_fops = { | 116 | static const struct file_operations misc_proc_fops = { |
119 | .owner = THIS_MODULE, | 117 | .owner = THIS_MODULE, |
120 | .open = misc_seq_open, | 118 | .open = misc_seq_open, |
121 | .read = seq_read, | 119 | .read = seq_read, |
@@ -178,7 +176,7 @@ fail: | |||
178 | */ | 176 | */ |
179 | static struct class *misc_class; | 177 | static struct class *misc_class; |
180 | 178 | ||
181 | static struct file_operations misc_fops = { | 179 | static const struct file_operations misc_fops = { |
182 | .owner = THIS_MODULE, | 180 | .owner = THIS_MODULE, |
183 | .open = misc_open, | 181 | .open = misc_open, |
184 | }; | 182 | }; |
@@ -204,7 +202,7 @@ int misc_register(struct miscdevice * misc) | |||
204 | { | 202 | { |
205 | struct miscdevice *c; | 203 | struct miscdevice *c; |
206 | dev_t dev; | 204 | dev_t dev; |
207 | int err; | 205 | int err = 0; |
208 | 206 | ||
209 | down(&misc_sem); | 207 | down(&misc_sem); |
210 | list_for_each_entry(c, &misc_list, list) { | 208 | list_for_each_entry(c, &misc_list, list) { |
@@ -228,10 +226,6 @@ int misc_register(struct miscdevice * misc) | |||
228 | 226 | ||
229 | if (misc->minor < DYNAMIC_MINORS) | 227 | if (misc->minor < DYNAMIC_MINORS) |
230 | misc_minors[misc->minor >> 3] |= 1 << (misc->minor & 7); | 228 | misc_minors[misc->minor >> 3] |= 1 << (misc->minor & 7); |
231 | if (misc->devfs_name[0] == '\0') { | ||
232 | snprintf(misc->devfs_name, sizeof(misc->devfs_name), | ||
233 | "misc/%s", misc->name); | ||
234 | } | ||
235 | dev = MKDEV(MISC_MAJOR, misc->minor); | 229 | dev = MKDEV(MISC_MAJOR, misc->minor); |
236 | 230 | ||
237 | misc->class = class_device_create(misc_class, NULL, dev, misc->dev, | 231 | misc->class = class_device_create(misc_class, NULL, dev, misc->dev, |
@@ -241,13 +235,6 @@ int misc_register(struct miscdevice * misc) | |||
241 | goto out; | 235 | goto out; |
242 | } | 236 | } |
243 | 237 | ||
244 | err = devfs_mk_cdev(dev, S_IFCHR|S_IRUSR|S_IWUSR|S_IRGRP, | ||
245 | misc->devfs_name); | ||
246 | if (err) { | ||
247 | class_device_destroy(misc_class, dev); | ||
248 | goto out; | ||
249 | } | ||
250 | |||
251 | /* | 238 | /* |
252 | * Add it to the front, so that later devices can "override" | 239 | * Add it to the front, so that later devices can "override" |
253 | * earlier defaults | 240 | * earlier defaults |
@@ -278,7 +265,6 @@ int misc_deregister(struct miscdevice * misc) | |||
278 | down(&misc_sem); | 265 | down(&misc_sem); |
279 | list_del(&misc->list); | 266 | list_del(&misc->list); |
280 | class_device_destroy(misc_class, MKDEV(MISC_MAJOR, misc->minor)); | 267 | class_device_destroy(misc_class, MKDEV(MISC_MAJOR, misc->minor)); |
281 | devfs_remove(misc->devfs_name); | ||
282 | if (i < DYNAMIC_MINORS && i>0) { | 268 | if (i < DYNAMIC_MINORS && i>0) { |
283 | misc_minors[i>>3] &= ~(1 << (misc->minor & 7)); | 269 | misc_minors[i>>3] &= ~(1 << (misc->minor & 7)); |
284 | } | 270 | } |
diff --git a/drivers/char/mmtimer.c b/drivers/char/mmtimer.c index 1b05fa688996..1f0f2b6dae26 100644 --- a/drivers/char/mmtimer.c +++ b/drivers/char/mmtimer.c | |||
@@ -25,7 +25,6 @@ | |||
25 | #include <linux/init.h> | 25 | #include <linux/init.h> |
26 | #include <linux/errno.h> | 26 | #include <linux/errno.h> |
27 | #include <linux/mm.h> | 27 | #include <linux/mm.h> |
28 | #include <linux/devfs_fs_kernel.h> | ||
29 | #include <linux/mmtimer.h> | 28 | #include <linux/mmtimer.h> |
30 | #include <linux/miscdevice.h> | 29 | #include <linux/miscdevice.h> |
31 | #include <linux/posix-timers.h> | 30 | #include <linux/posix-timers.h> |
@@ -64,7 +63,7 @@ static int mmtimer_mmap(struct file *file, struct vm_area_struct *vma); | |||
64 | */ | 63 | */ |
65 | static unsigned long mmtimer_femtoperiod = 0; | 64 | static unsigned long mmtimer_femtoperiod = 0; |
66 | 65 | ||
67 | static struct file_operations mmtimer_fops = { | 66 | static const struct file_operations mmtimer_fops = { |
68 | .owner = THIS_MODULE, | 67 | .owner = THIS_MODULE, |
69 | .mmap = mmtimer_mmap, | 68 | .mmap = mmtimer_mmap, |
70 | .ioctl = mmtimer_ioctl, | 69 | .ioctl = mmtimer_ioctl, |
@@ -329,7 +328,6 @@ static int mmtimer_mmap(struct file *file, struct vm_area_struct *vma) | |||
329 | if (PAGE_SIZE > (1 << 16)) | 328 | if (PAGE_SIZE > (1 << 16)) |
330 | return -ENOSYS; | 329 | return -ENOSYS; |
331 | 330 | ||
332 | vma->vm_flags |= (VM_IO | VM_SHM | VM_LOCKED ); | ||
333 | vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); | 331 | vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); |
334 | 332 | ||
335 | mmtimer_addr = __pa(RTC_COUNTER_ADDR); | 333 | mmtimer_addr = __pa(RTC_COUNTER_ADDR); |
@@ -689,13 +687,12 @@ static int __init mmtimer_init(void) | |||
689 | mmtimer_femtoperiod = ((unsigned long)1E15 + sn_rtc_cycles_per_second / | 687 | mmtimer_femtoperiod = ((unsigned long)1E15 + sn_rtc_cycles_per_second / |
690 | 2) / sn_rtc_cycles_per_second; | 688 | 2) / sn_rtc_cycles_per_second; |
691 | 689 | ||
692 | if (request_irq(SGI_MMTIMER_VECTOR, mmtimer_interrupt, SA_PERCPU_IRQ, MMTIMER_NAME, NULL)) { | 690 | if (request_irq(SGI_MMTIMER_VECTOR, mmtimer_interrupt, IRQF_PERCPU, MMTIMER_NAME, NULL)) { |
693 | printk(KERN_WARNING "%s: unable to allocate interrupt.", | 691 | printk(KERN_WARNING "%s: unable to allocate interrupt.", |
694 | MMTIMER_NAME); | 692 | MMTIMER_NAME); |
695 | return -1; | 693 | return -1; |
696 | } | 694 | } |
697 | 695 | ||
698 | strcpy(mmtimer_miscdev.devfs_name, MMTIMER_NAME); | ||
699 | if (misc_register(&mmtimer_miscdev)) { | 696 | if (misc_register(&mmtimer_miscdev)) { |
700 | printk(KERN_ERR "%s: failed to register device\n", | 697 | printk(KERN_ERR "%s: failed to register device\n", |
701 | MMTIMER_NAME); | 698 | MMTIMER_NAME); |
diff --git a/drivers/char/moxa.c b/drivers/char/moxa.c index f43c2e04eadd..4ea7bd5f4f56 100644 --- a/drivers/char/moxa.c +++ b/drivers/char/moxa.c | |||
@@ -29,7 +29,6 @@ | |||
29 | * version : 5.1 | 29 | * version : 5.1 |
30 | */ | 30 | */ |
31 | 31 | ||
32 | #include <linux/config.h> | ||
33 | #include <linux/module.h> | 32 | #include <linux/module.h> |
34 | #include <linux/types.h> | 33 | #include <linux/types.h> |
35 | #include <linux/mm.h> | 34 | #include <linux/mm.h> |
@@ -301,7 +300,7 @@ static struct tty_operations moxa_ops = { | |||
301 | .tiocmset = moxa_tiocmset, | 300 | .tiocmset = moxa_tiocmset, |
302 | }; | 301 | }; |
303 | 302 | ||
304 | static spinlock_t moxa_lock = SPIN_LOCK_UNLOCKED; | 303 | static DEFINE_SPINLOCK(moxa_lock); |
305 | 304 | ||
306 | #ifdef CONFIG_PCI | 305 | #ifdef CONFIG_PCI |
307 | static int moxa_get_PCI_conf(struct pci_dev *p, int board_type, moxa_board_conf * board) | 306 | static int moxa_get_PCI_conf(struct pci_dev *p, int board_type, moxa_board_conf * board) |
@@ -342,7 +341,6 @@ static int __init moxa_init(void) | |||
342 | init_MUTEX(&moxaBuffSem); | 341 | init_MUTEX(&moxaBuffSem); |
343 | moxaDriver->owner = THIS_MODULE; | 342 | moxaDriver->owner = THIS_MODULE; |
344 | moxaDriver->name = "ttyMX"; | 343 | moxaDriver->name = "ttyMX"; |
345 | moxaDriver->devfs_name = "tts/a"; | ||
346 | moxaDriver->major = ttymajor; | 344 | moxaDriver->major = ttymajor; |
347 | moxaDriver->minor_start = 0; | 345 | moxaDriver->minor_start = 0; |
348 | moxaDriver->type = TTY_DRIVER_TYPE_SERIAL; | 346 | moxaDriver->type = TTY_DRIVER_TYPE_SERIAL; |
diff --git a/drivers/char/mwave/3780i.c b/drivers/char/mwave/3780i.c index d1fe05e83882..4e4865e90e50 100644 --- a/drivers/char/mwave/3780i.c +++ b/drivers/char/mwave/3780i.c | |||
@@ -46,7 +46,6 @@ | |||
46 | * First release to the public | 46 | * First release to the public |
47 | */ | 47 | */ |
48 | 48 | ||
49 | #include <linux/config.h> | ||
50 | #include <linux/kernel.h> | 49 | #include <linux/kernel.h> |
51 | #include <linux/unistd.h> | 50 | #include <linux/unistd.h> |
52 | #include <linux/delay.h> | 51 | #include <linux/delay.h> |
diff --git a/drivers/char/mwave/mwavedd.c b/drivers/char/mwave/mwavedd.c index d3ba2f860ef0..39a2e661ff55 100644 --- a/drivers/char/mwave/mwavedd.c +++ b/drivers/char/mwave/mwavedd.c | |||
@@ -454,7 +454,7 @@ static int register_serial_portandirq(unsigned int port, int irq) | |||
454 | } | 454 | } |
455 | 455 | ||
456 | 456 | ||
457 | static struct file_operations mwave_fops = { | 457 | static const struct file_operations mwave_fops = { |
458 | .owner = THIS_MODULE, | 458 | .owner = THIS_MODULE, |
459 | .read = mwave_read, | 459 | .read = mwave_read, |
460 | .write = mwave_write, | 460 | .write = mwave_write, |
diff --git a/drivers/char/mxser.c b/drivers/char/mxser.c index 0fb2fb9fb024..556abd3e0d07 100644 --- a/drivers/char/mxser.c +++ b/drivers/char/mxser.c | |||
@@ -9,7 +9,7 @@ | |||
9 | * This program is free software; you can redistribute it and/or modify | 9 | * This program is free software; you can redistribute it and/or modify |
10 | * it under the terms of the GNU General Public License as published by | 10 | * it under the terms of the GNU General Public License as published by |
11 | * the Free Software Foundation; either version 2 of the License, or | 11 | * the Free Software Foundation; either version 2 of the License, or |
12 | * (at your option) any later version. | 12 | * (at your option) any later version. |
13 | * | 13 | * |
14 | * This program is distributed in the hope that it will be useful, | 14 | * This program is distributed in the hope that it will be useful, |
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
@@ -36,7 +36,6 @@ | |||
36 | */ | 36 | */ |
37 | 37 | ||
38 | 38 | ||
39 | #include <linux/config.h> | ||
40 | #include <linux/module.h> | 39 | #include <linux/module.h> |
41 | #include <linux/autoconf.h> | 40 | #include <linux/autoconf.h> |
42 | #include <linux/errno.h> | 41 | #include <linux/errno.h> |
@@ -71,8 +70,8 @@ | |||
71 | #define MXSERMAJOR 174 | 70 | #define MXSERMAJOR 174 |
72 | #define MXSERCUMAJOR 175 | 71 | #define MXSERCUMAJOR 175 |
73 | 72 | ||
74 | #define MXSER_EVENT_TXLOW 1 | 73 | #define MXSER_EVENT_TXLOW 1 |
75 | #define MXSER_EVENT_HANGUP 2 | 74 | #define MXSER_EVENT_HANGUP 2 |
76 | 75 | ||
77 | #define MXSER_BOARDS 4 /* Max. boards */ | 76 | #define MXSER_BOARDS 4 /* Max. boards */ |
78 | #define MXSER_PORTS 32 /* Max. ports */ | 77 | #define MXSER_PORTS 32 /* Max. ports */ |
@@ -92,9 +91,10 @@ | |||
92 | #define UART_MCR_AFE 0x20 | 91 | #define UART_MCR_AFE 0x20 |
93 | #define UART_LSR_SPECIAL 0x1E | 92 | #define UART_LSR_SPECIAL 0x1E |
94 | 93 | ||
95 | #define RELEVANT_IFLAG(iflag) (iflag & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK|IXON|IXOFF)) | 94 | #define RELEVANT_IFLAG(iflag) (iflag & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK|\ |
95 | IXON|IXOFF)) | ||
96 | 96 | ||
97 | #define IRQ_T(info) ((info->flags & ASYNC_SHARE_IRQ) ? SA_SHIRQ : SA_INTERRUPT) | 97 | #define IRQ_T(info) ((info->flags & ASYNC_SHARE_IRQ) ? IRQF_SHARED : IRQF_DISABLED) |
98 | 98 | ||
99 | #define C168_ASIC_ID 1 | 99 | #define C168_ASIC_ID 1 |
100 | #define C104_ASIC_ID 2 | 100 | #define C104_ASIC_ID 2 |
@@ -152,27 +152,27 @@ static char *mxser_brdname[] = { | |||
152 | }; | 152 | }; |
153 | 153 | ||
154 | static int mxser_numports[] = { | 154 | static int mxser_numports[] = { |
155 | 8, // C168-ISA | 155 | 8, /* C168-ISA */ |
156 | 4, // C104-ISA | 156 | 4, /* C104-ISA */ |
157 | 4, // CI104J | 157 | 4, /* CI104J */ |
158 | 8, // C168-PCI | 158 | 8, /* C168-PCI */ |
159 | 4, // C104-PCI | 159 | 4, /* C104-PCI */ |
160 | 2, // C102-ISA | 160 | 2, /* C102-ISA */ |
161 | 2, // CI132 | 161 | 2, /* CI132 */ |
162 | 4, // CI134 | 162 | 4, /* CI134 */ |
163 | 2, // CP132 | 163 | 2, /* CP132 */ |
164 | 4, // CP114 | 164 | 4, /* CP114 */ |
165 | 4, // CT114 | 165 | 4, /* CT114 */ |
166 | 2, // CP102 | 166 | 2, /* CP102 */ |
167 | 4, // CP104U | 167 | 4, /* CP104U */ |
168 | 8, // CP168U | 168 | 8, /* CP168U */ |
169 | 2, // CP132U | 169 | 2, /* CP132U */ |
170 | 4, // CP134U | 170 | 4, /* CP134U */ |
171 | 4, // CP104JU | 171 | 4, /* CP104JU */ |
172 | 8, // RC7000 | 172 | 8, /* RC7000 */ |
173 | 8, // CP118U | 173 | 8, /* CP118U */ |
174 | 2, // CP102UL | 174 | 2, /* CP102UL */ |
175 | 2, // CP102U | 175 | 2, /* CP102U */ |
176 | }; | 176 | }; |
177 | 177 | ||
178 | #define UART_TYPE_NUM 2 | 178 | #define UART_TYPE_NUM 2 |
@@ -182,7 +182,7 @@ static const unsigned int Gmoxa_uart_id[UART_TYPE_NUM] = { | |||
182 | MOXA_MUST_MU860_HWID | 182 | MOXA_MUST_MU860_HWID |
183 | }; | 183 | }; |
184 | 184 | ||
185 | // This is only for PCI | 185 | /* This is only for PCI */ |
186 | #define UART_INFO_NUM 3 | 186 | #define UART_INFO_NUM 3 |
187 | struct mxpciuart_info { | 187 | struct mxpciuart_info { |
188 | int type; | 188 | int type; |
@@ -231,7 +231,7 @@ MODULE_DEVICE_TABLE(pci, mxser_pcibrds); | |||
231 | typedef struct _moxa_pci_info { | 231 | typedef struct _moxa_pci_info { |
232 | unsigned short busNum; | 232 | unsigned short busNum; |
233 | unsigned short devNum; | 233 | unsigned short devNum; |
234 | struct pci_dev *pdev; // add by Victor Yu. 06-23-2003 | 234 | struct pci_dev *pdev; /* add by Victor Yu. 06-23-2003 */ |
235 | } moxa_pci_info; | 235 | } moxa_pci_info; |
236 | 236 | ||
237 | static int ioaddr[MXSER_BOARDS] = { 0, 0, 0, 0 }; | 237 | static int ioaddr[MXSER_BOARDS] = { 0, 0, 0, 0 }; |
@@ -280,6 +280,7 @@ struct mxser_mon_ext { | |||
280 | int fifo[32]; | 280 | int fifo[32]; |
281 | int iftype[32]; | 281 | int iftype[32]; |
282 | }; | 282 | }; |
283 | |||
283 | struct mxser_hwconf { | 284 | struct mxser_hwconf { |
284 | int board_type; | 285 | int board_type; |
285 | int ports; | 286 | int ports; |
@@ -290,9 +291,9 @@ struct mxser_hwconf { | |||
290 | int ioaddr[MXSER_PORTS_PER_BOARD]; | 291 | int ioaddr[MXSER_PORTS_PER_BOARD]; |
291 | int baud_base[MXSER_PORTS_PER_BOARD]; | 292 | int baud_base[MXSER_PORTS_PER_BOARD]; |
292 | moxa_pci_info pciInfo; | 293 | moxa_pci_info pciInfo; |
293 | int IsMoxaMustChipFlag; // add by Victor Yu. 08-30-2002 | 294 | int IsMoxaMustChipFlag; /* add by Victor Yu. 08-30-2002 */ |
294 | int MaxCanSetBaudRate[MXSER_PORTS_PER_BOARD]; // add by Victor Yu. 09-04-2002 | 295 | int MaxCanSetBaudRate[MXSER_PORTS_PER_BOARD]; /* add by Victor Yu. 09-04-2002 */ |
295 | int opmode_ioaddr[MXSER_PORTS_PER_BOARD]; // add by Victor Yu. 01-05-2004 | 296 | int opmode_ioaddr[MXSER_PORTS_PER_BOARD]; /* add by Victor Yu. 01-05-2004 */ |
296 | }; | 297 | }; |
297 | 298 | ||
298 | struct mxser_struct { | 299 | struct mxser_struct { |
@@ -334,9 +335,9 @@ struct mxser_struct { | |||
334 | wait_queue_head_t delta_msr_wait; | 335 | wait_queue_head_t delta_msr_wait; |
335 | struct async_icount icount; /* kernel counters for the 4 input interrupts */ | 336 | struct async_icount icount; /* kernel counters for the 4 input interrupts */ |
336 | int timeout; | 337 | int timeout; |
337 | int IsMoxaMustChipFlag; // add by Victor Yu. 08-30-2002 | 338 | int IsMoxaMustChipFlag; /* add by Victor Yu. 08-30-2002 */ |
338 | int MaxCanSetBaudRate; // add by Victor Yu. 09-04-2002 | 339 | int MaxCanSetBaudRate; /* add by Victor Yu. 09-04-2002 */ |
339 | int opmode_ioaddr; // add by Victor Yu. 01-05-2004 | 340 | int opmode_ioaddr; /* add by Victor Yu. 01-05-2004 */ |
340 | unsigned char stop_rx; | 341 | unsigned char stop_rx; |
341 | unsigned char ldisc_stop_rx; | 342 | unsigned char ldisc_stop_rx; |
342 | long realbaud; | 343 | long realbaud; |
@@ -345,7 +346,6 @@ struct mxser_struct { | |||
345 | spinlock_t slock; | 346 | spinlock_t slock; |
346 | }; | 347 | }; |
347 | 348 | ||
348 | |||
349 | struct mxser_mstatus { | 349 | struct mxser_mstatus { |
350 | tcflag_t cflag; | 350 | tcflag_t cflag; |
351 | int cts; | 351 | int cts; |
@@ -358,7 +358,7 @@ static struct mxser_mstatus GMStatus[MXSER_PORTS]; | |||
358 | 358 | ||
359 | static int mxserBoardCAP[MXSER_BOARDS] = { | 359 | static int mxserBoardCAP[MXSER_BOARDS] = { |
360 | 0, 0, 0, 0 | 360 | 0, 0, 0, 0 |
361 | /* 0x180, 0x280, 0x200, 0x320 */ | 361 | /* 0x180, 0x280, 0x200, 0x320 */ |
362 | }; | 362 | }; |
363 | 363 | ||
364 | static struct tty_driver *mxvar_sdriver; | 364 | static struct tty_driver *mxvar_sdriver; |
@@ -386,7 +386,7 @@ static struct mxser_hwconf mxsercfg[MXSER_BOARDS]; | |||
386 | static void mxser_getcfg(int board, struct mxser_hwconf *hwconf); | 386 | static void mxser_getcfg(int board, struct mxser_hwconf *hwconf); |
387 | static int mxser_init(void); | 387 | static int mxser_init(void); |
388 | 388 | ||
389 | //static void mxser_poll(unsigned long); | 389 | /* static void mxser_poll(unsigned long); */ |
390 | static int mxser_get_ISA_conf(int, struct mxser_hwconf *); | 390 | static int mxser_get_ISA_conf(int, struct mxser_hwconf *); |
391 | static int mxser_get_PCI_conf(int, int, int, struct mxser_hwconf *); | 391 | static int mxser_get_PCI_conf(int, int, int, struct mxser_hwconf *); |
392 | static void mxser_do_softint(void *); | 392 | static void mxser_do_softint(void *); |
@@ -440,18 +440,18 @@ static int CheckIsMoxaMust(int io) | |||
440 | SET_MOXA_MUST_XON1_VALUE(io, 0x11); | 440 | SET_MOXA_MUST_XON1_VALUE(io, 0x11); |
441 | if ((hwid = inb(io + UART_MCR)) != 0) { | 441 | if ((hwid = inb(io + UART_MCR)) != 0) { |
442 | outb(oldmcr, io + UART_MCR); | 442 | outb(oldmcr, io + UART_MCR); |
443 | return (MOXA_OTHER_UART); | 443 | return MOXA_OTHER_UART; |
444 | } | 444 | } |
445 | 445 | ||
446 | GET_MOXA_MUST_HARDWARE_ID(io, &hwid); | 446 | GET_MOXA_MUST_HARDWARE_ID(io, &hwid); |
447 | for (i = 0; i < UART_TYPE_NUM; i++) { | 447 | for (i = 0; i < UART_TYPE_NUM; i++) { |
448 | if (hwid == Gmoxa_uart_id[i]) | 448 | if (hwid == Gmoxa_uart_id[i]) |
449 | return (int) hwid; | 449 | return (int)hwid; |
450 | } | 450 | } |
451 | return MOXA_OTHER_UART; | 451 | return MOXA_OTHER_UART; |
452 | } | 452 | } |
453 | 453 | ||
454 | // above is modified by Victor Yu. 08-15-2002 | 454 | /* above is modified by Victor Yu. 08-15-2002 */ |
455 | 455 | ||
456 | static struct tty_operations mxser_ops = { | 456 | static struct tty_operations mxser_ops = { |
457 | .open = mxser_open, | 457 | .open = mxser_open, |
@@ -504,7 +504,6 @@ static void __exit mxser_module_exit(void) | |||
504 | else | 504 | else |
505 | printk(KERN_ERR "Couldn't unregister MOXA Smartio/Industio family serial driver\n"); | 505 | printk(KERN_ERR "Couldn't unregister MOXA Smartio/Industio family serial driver\n"); |
506 | 506 | ||
507 | |||
508 | for (i = 0; i < MXSER_BOARDS; i++) { | 507 | for (i = 0; i < MXSER_BOARDS; i++) { |
509 | struct pci_dev *pdev; | 508 | struct pci_dev *pdev; |
510 | 509 | ||
@@ -513,7 +512,7 @@ static void __exit mxser_module_exit(void) | |||
513 | else { | 512 | else { |
514 | pdev = mxsercfg[i].pciInfo.pdev; | 513 | pdev = mxsercfg[i].pciInfo.pdev; |
515 | free_irq(mxsercfg[i].irq, &mxvar_table[i * MXSER_PORTS_PER_BOARD]); | 514 | free_irq(mxsercfg[i].irq, &mxvar_table[i * MXSER_PORTS_PER_BOARD]); |
516 | if (pdev != NULL) { //PCI | 515 | if (pdev != NULL) { /* PCI */ |
517 | release_region(pci_resource_start(pdev, 2), pci_resource_len(pdev, 2)); | 516 | release_region(pci_resource_start(pdev, 2), pci_resource_len(pdev, 2)); |
518 | release_region(pci_resource_start(pdev, 3), pci_resource_len(pdev, 3)); | 517 | release_region(pci_resource_start(pdev, 3), pci_resource_len(pdev, 3)); |
519 | } else { | 518 | } else { |
@@ -524,7 +523,6 @@ static void __exit mxser_module_exit(void) | |||
524 | } | 523 | } |
525 | if (verbose) | 524 | if (verbose) |
526 | printk(KERN_DEBUG "Done.\n"); | 525 | printk(KERN_DEBUG "Done.\n"); |
527 | |||
528 | } | 526 | } |
529 | 527 | ||
530 | static void process_txrx_fifo(struct mxser_struct *info) | 528 | static void process_txrx_fifo(struct mxser_struct *info) |
@@ -558,8 +556,10 @@ static int mxser_initbrd(int board, struct mxser_hwconf *hwconf) | |||
558 | n = board * MXSER_PORTS_PER_BOARD; | 556 | n = board * MXSER_PORTS_PER_BOARD; |
559 | info = &mxvar_table[n]; | 557 | info = &mxvar_table[n]; |
560 | /*if (verbose) */ { | 558 | /*if (verbose) */ { |
561 | printk(KERN_DEBUG " ttyM%d - ttyM%d ", n, n + hwconf->ports - 1); | 559 | printk(KERN_DEBUG " ttyM%d - ttyM%d ", |
562 | printk(" max. baud rate = %d bps.\n", hwconf->MaxCanSetBaudRate[0]); | 560 | n, n + hwconf->ports - 1); |
561 | printk(" max. baud rate = %d bps.\n", | ||
562 | hwconf->MaxCanSetBaudRate[0]); | ||
563 | } | 563 | } |
564 | 564 | ||
565 | for (i = 0; i < hwconf->ports; i++, n++, info++) { | 565 | for (i = 0; i < hwconf->ports; i++, n++, info++) { |
@@ -568,12 +568,12 @@ static int mxser_initbrd(int board, struct mxser_hwconf *hwconf) | |||
568 | info->irq = hwconf->irq; | 568 | info->irq = hwconf->irq; |
569 | info->vector = hwconf->vector; | 569 | info->vector = hwconf->vector; |
570 | info->vectormask = hwconf->vector_mask; | 570 | info->vectormask = hwconf->vector_mask; |
571 | info->opmode_ioaddr = hwconf->opmode_ioaddr[i]; // add by Victor Yu. 01-05-2004 | 571 | info->opmode_ioaddr = hwconf->opmode_ioaddr[i]; /* add by Victor Yu. 01-05-2004 */ |
572 | info->stop_rx = 0; | 572 | info->stop_rx = 0; |
573 | info->ldisc_stop_rx = 0; | 573 | info->ldisc_stop_rx = 0; |
574 | 574 | ||
575 | info->IsMoxaMustChipFlag = hwconf->IsMoxaMustChipFlag; | 575 | info->IsMoxaMustChipFlag = hwconf->IsMoxaMustChipFlag; |
576 | //Enhance mode enabled here | 576 | /* Enhance mode enabled here */ |
577 | if (info->IsMoxaMustChipFlag != MOXA_OTHER_UART) { | 577 | if (info->IsMoxaMustChipFlag != MOXA_OTHER_UART) { |
578 | ENABLE_MOXA_MUST_ENCHANCE_MODE(info->base); | 578 | ENABLE_MOXA_MUST_ENCHANCE_MODE(info->base); |
579 | } | 579 | } |
@@ -606,22 +606,25 @@ static int mxser_initbrd(int board, struct mxser_hwconf *hwconf) | |||
606 | 606 | ||
607 | /* before set INT ISR, disable all int */ | 607 | /* before set INT ISR, disable all int */ |
608 | for (i = 0; i < hwconf->ports; i++) { | 608 | for (i = 0; i < hwconf->ports; i++) { |
609 | outb(inb(hwconf->ioaddr[i] + UART_IER) & 0xf0, hwconf->ioaddr[i] + UART_IER); | 609 | outb(inb(hwconf->ioaddr[i] + UART_IER) & 0xf0, |
610 | hwconf->ioaddr[i] + UART_IER); | ||
610 | } | 611 | } |
611 | 612 | ||
612 | n = board * MXSER_PORTS_PER_BOARD; | 613 | n = board * MXSER_PORTS_PER_BOARD; |
613 | info = &mxvar_table[n]; | 614 | info = &mxvar_table[n]; |
614 | 615 | ||
615 | retval = request_irq(hwconf->irq, mxser_interrupt, IRQ_T(info), "mxser", info); | 616 | retval = request_irq(hwconf->irq, mxser_interrupt, IRQ_T(info), |
617 | "mxser", info); | ||
616 | if (retval) { | 618 | if (retval) { |
617 | printk(KERN_ERR "Board %d: %s", board, mxser_brdname[hwconf->board_type - 1]); | 619 | printk(KERN_ERR "Board %d: %s", |
618 | printk(" Request irq fail,IRQ (%d) may be conflit with another device.\n", info->irq); | 620 | board, mxser_brdname[hwconf->board_type - 1]); |
621 | printk(" Request irq failed, IRQ (%d) may conflict with" | ||
622 | " another device.\n", info->irq); | ||
619 | return retval; | 623 | return retval; |
620 | } | 624 | } |
621 | return 0; | 625 | return 0; |
622 | } | 626 | } |
623 | 627 | ||
624 | |||
625 | static void mxser_getcfg(int board, struct mxser_hwconf *hwconf) | 628 | static void mxser_getcfg(int board, struct mxser_hwconf *hwconf) |
626 | { | 629 | { |
627 | mxsercfg[board] = *hwconf; | 630 | mxsercfg[board] = *hwconf; |
@@ -631,26 +634,27 @@ static void mxser_getcfg(int board, struct mxser_hwconf *hwconf) | |||
631 | static int mxser_get_PCI_conf(int busnum, int devnum, int board_type, struct mxser_hwconf *hwconf) | 634 | static int mxser_get_PCI_conf(int busnum, int devnum, int board_type, struct mxser_hwconf *hwconf) |
632 | { | 635 | { |
633 | int i, j; | 636 | int i, j; |
634 | // unsigned int val; | 637 | /* unsigned int val; */ |
635 | unsigned int ioaddress; | 638 | unsigned int ioaddress; |
636 | struct pci_dev *pdev = hwconf->pciInfo.pdev; | 639 | struct pci_dev *pdev = hwconf->pciInfo.pdev; |
637 | 640 | ||
638 | //io address | 641 | /* io address */ |
639 | hwconf->board_type = board_type; | 642 | hwconf->board_type = board_type; |
640 | hwconf->ports = mxser_numports[board_type - 1]; | 643 | hwconf->ports = mxser_numports[board_type - 1]; |
641 | ioaddress = pci_resource_start(pdev, 2); | 644 | ioaddress = pci_resource_start(pdev, 2); |
642 | request_region(pci_resource_start(pdev, 2), pci_resource_len(pdev, 2), "mxser(IO)"); | 645 | request_region(pci_resource_start(pdev, 2), pci_resource_len(pdev, 2), |
646 | "mxser(IO)"); | ||
643 | 647 | ||
644 | for (i = 0; i < hwconf->ports; i++) { | 648 | for (i = 0; i < hwconf->ports; i++) |
645 | hwconf->ioaddr[i] = ioaddress + 8 * i; | 649 | hwconf->ioaddr[i] = ioaddress + 8 * i; |
646 | } | ||
647 | 650 | ||
648 | //vector | 651 | /* vector */ |
649 | ioaddress = pci_resource_start(pdev, 3); | 652 | ioaddress = pci_resource_start(pdev, 3); |
650 | request_region(pci_resource_start(pdev, 3), pci_resource_len(pdev, 3), "mxser(vector)"); | 653 | request_region(pci_resource_start(pdev, 3), pci_resource_len(pdev, 3), |
654 | "mxser(vector)"); | ||
651 | hwconf->vector = ioaddress; | 655 | hwconf->vector = ioaddress; |
652 | 656 | ||
653 | //irq | 657 | /* irq */ |
654 | hwconf->irq = hwconf->pciInfo.pdev->irq; | 658 | hwconf->irq = hwconf->pciInfo.pdev->irq; |
655 | 659 | ||
656 | hwconf->IsMoxaMustChipFlag = CheckIsMoxaMust(hwconf->ioaddr[0]); | 660 | hwconf->IsMoxaMustChipFlag = CheckIsMoxaMust(hwconf->ioaddr[0]); |
@@ -663,7 +667,7 @@ static int mxser_get_PCI_conf(int busnum, int devnum, int board_type, struct mxs | |||
663 | if (Gpci_uart_info[j].type == hwconf->IsMoxaMustChipFlag) { | 667 | if (Gpci_uart_info[j].type == hwconf->IsMoxaMustChipFlag) { |
664 | hwconf->MaxCanSetBaudRate[i] = Gpci_uart_info[j].max_baud; | 668 | hwconf->MaxCanSetBaudRate[i] = Gpci_uart_info[j].max_baud; |
665 | 669 | ||
666 | //exception....CP-102 | 670 | /* exception....CP-102 */ |
667 | if (board_type == MXSER_BOARD_CP102) | 671 | if (board_type == MXSER_BOARD_CP102) |
668 | hwconf->MaxCanSetBaudRate[i] = 921600; | 672 | hwconf->MaxCanSetBaudRate[i] = 921600; |
669 | break; | 673 | break; |
@@ -678,15 +682,15 @@ static int mxser_get_PCI_conf(int busnum, int devnum, int board_type, struct mxs | |||
678 | else | 682 | else |
679 | hwconf->opmode_ioaddr[i] = ioaddress + 0x0c; | 683 | hwconf->opmode_ioaddr[i] = ioaddress + 0x0c; |
680 | } | 684 | } |
681 | outb(0, ioaddress + 4); // default set to RS232 mode | 685 | outb(0, ioaddress + 4); /* default set to RS232 mode */ |
682 | outb(0, ioaddress + 0x0c); //default set to RS232 mode | 686 | outb(0, ioaddress + 0x0c); /* default set to RS232 mode */ |
683 | } | 687 | } |
684 | 688 | ||
685 | for (i = 0; i < hwconf->ports; i++) { | 689 | for (i = 0; i < hwconf->ports; i++) { |
686 | hwconf->vector_mask |= (1 << i); | 690 | hwconf->vector_mask |= (1 << i); |
687 | hwconf->baud_base[i] = 921600; | 691 | hwconf->baud_base[i] = 921600; |
688 | } | 692 | } |
689 | return (0); | 693 | return 0; |
690 | } | 694 | } |
691 | #endif | 695 | #endif |
692 | 696 | ||
@@ -707,7 +711,8 @@ static int mxser_init(void) | |||
707 | mxsercfg[i].board_type = -1; | 711 | mxsercfg[i].board_type = -1; |
708 | } | 712 | } |
709 | 713 | ||
710 | printk(KERN_INFO "MOXA Smartio/Industio family driver version %s\n", MXSER_VERSION); | 714 | printk(KERN_INFO "MOXA Smartio/Industio family driver version %s\n", |
715 | MXSER_VERSION); | ||
711 | 716 | ||
712 | /* Initialize the tty_driver structure */ | 717 | /* Initialize the tty_driver structure */ |
713 | memset(mxvar_sdriver, 0, sizeof(struct tty_driver)); | 718 | memset(mxvar_sdriver, 0, sizeof(struct tty_driver)); |
@@ -719,7 +724,7 @@ static int mxser_init(void) | |||
719 | mxvar_sdriver->type = TTY_DRIVER_TYPE_SERIAL; | 724 | mxvar_sdriver->type = TTY_DRIVER_TYPE_SERIAL; |
720 | mxvar_sdriver->subtype = SERIAL_TYPE_NORMAL; | 725 | mxvar_sdriver->subtype = SERIAL_TYPE_NORMAL; |
721 | mxvar_sdriver->init_termios = tty_std_termios; | 726 | mxvar_sdriver->init_termios = tty_std_termios; |
722 | mxvar_sdriver->init_termios.c_cflag = B9600 | CS8 | CREAD | HUPCL | CLOCAL; | 727 | mxvar_sdriver->init_termios.c_cflag = B9600|CS8|CREAD|HUPCL|CLOCAL; |
723 | mxvar_sdriver->flags = TTY_DRIVER_REAL_RAW; | 728 | mxvar_sdriver->flags = TTY_DRIVER_REAL_RAW; |
724 | tty_set_operations(mxvar_sdriver, &mxser_ops); | 729 | tty_set_operations(mxvar_sdriver, &mxser_ops); |
725 | mxvar_sdriver->ttys = mxvar_tty; | 730 | mxvar_sdriver->ttys = mxvar_tty; |
@@ -739,23 +744,29 @@ static int mxser_init(void) | |||
739 | /* Start finding ISA boards here */ | 744 | /* Start finding ISA boards here */ |
740 | for (b = 0; b < MXSER_BOARDS && m < MXSER_BOARDS; b++) { | 745 | for (b = 0; b < MXSER_BOARDS && m < MXSER_BOARDS; b++) { |
741 | int cap; | 746 | int cap; |
747 | |||
742 | if (!(cap = mxserBoardCAP[b])) | 748 | if (!(cap = mxserBoardCAP[b])) |
743 | continue; | 749 | continue; |
744 | 750 | ||
745 | retval = mxser_get_ISA_conf(cap, &hwconf); | 751 | retval = mxser_get_ISA_conf(cap, &hwconf); |
746 | 752 | ||
747 | if (retval != 0) | 753 | if (retval != 0) |
748 | printk(KERN_INFO "Found MOXA %s board (CAP=0x%x)\n", mxser_brdname[hwconf.board_type - 1], ioaddr[b]); | 754 | printk(KERN_INFO "Found MOXA %s board (CAP=0x%x)\n", |
755 | mxser_brdname[hwconf.board_type - 1], ioaddr[b]); | ||
749 | 756 | ||
750 | if (retval <= 0) { | 757 | if (retval <= 0) { |
751 | if (retval == MXSER_ERR_IRQ) | 758 | if (retval == MXSER_ERR_IRQ) |
752 | printk(KERN_ERR "Invalid interrupt number,board not configured\n"); | 759 | printk(KERN_ERR "Invalid interrupt number, " |
760 | "board not configured\n"); | ||
753 | else if (retval == MXSER_ERR_IRQ_CONFLIT) | 761 | else if (retval == MXSER_ERR_IRQ_CONFLIT) |
754 | printk(KERN_ERR "Invalid interrupt number,board not configured\n"); | 762 | printk(KERN_ERR "Invalid interrupt number, " |
763 | "board not configured\n"); | ||
755 | else if (retval == MXSER_ERR_VECTOR) | 764 | else if (retval == MXSER_ERR_VECTOR) |
756 | printk(KERN_ERR "Invalid interrupt vector,board not configured\n"); | 765 | printk(KERN_ERR "Invalid interrupt vector, " |
766 | "board not configured\n"); | ||
757 | else if (retval == MXSER_ERR_IOADDR) | 767 | else if (retval == MXSER_ERR_IOADDR) |
758 | printk(KERN_ERR "Invalid I/O address,board not configured\n"); | 768 | printk(KERN_ERR "Invalid I/O address, " |
769 | "board not configured\n"); | ||
759 | 770 | ||
760 | continue; | 771 | continue; |
761 | } | 772 | } |
@@ -765,35 +776,43 @@ static int mxser_init(void) | |||
765 | hwconf.pciInfo.pdev = NULL; | 776 | hwconf.pciInfo.pdev = NULL; |
766 | 777 | ||
767 | mxser_getcfg(m, &hwconf); | 778 | mxser_getcfg(m, &hwconf); |
768 | //init mxsercfg first, or mxsercfg data is not correct on ISR. | 779 | /* |
769 | //mxser_initbrd will hook ISR. | 780 | * init mxsercfg first, |
781 | * or mxsercfg data is not correct on ISR. | ||
782 | */ | ||
783 | /* mxser_initbrd will hook ISR. */ | ||
770 | if (mxser_initbrd(m, &hwconf) < 0) | 784 | if (mxser_initbrd(m, &hwconf) < 0) |
771 | continue; | 785 | continue; |
772 | 786 | ||
773 | |||
774 | m++; | 787 | m++; |
775 | } | 788 | } |
776 | 789 | ||
777 | /* Start finding ISA boards from module arg */ | 790 | /* Start finding ISA boards from module arg */ |
778 | for (b = 0; b < MXSER_BOARDS && m < MXSER_BOARDS; b++) { | 791 | for (b = 0; b < MXSER_BOARDS && m < MXSER_BOARDS; b++) { |
779 | int cap; | 792 | int cap; |
793 | |||
780 | if (!(cap = ioaddr[b])) | 794 | if (!(cap = ioaddr[b])) |
781 | continue; | 795 | continue; |
782 | 796 | ||
783 | retval = mxser_get_ISA_conf(cap, &hwconf); | 797 | retval = mxser_get_ISA_conf(cap, &hwconf); |
784 | 798 | ||
785 | if (retval != 0) | 799 | if (retval != 0) |
786 | printk(KERN_INFO "Found MOXA %s board (CAP=0x%x)\n", mxser_brdname[hwconf.board_type - 1], ioaddr[b]); | 800 | printk(KERN_INFO "Found MOXA %s board (CAP=0x%x)\n", |
801 | mxser_brdname[hwconf.board_type - 1], ioaddr[b]); | ||
787 | 802 | ||
788 | if (retval <= 0) { | 803 | if (retval <= 0) { |
789 | if (retval == MXSER_ERR_IRQ) | 804 | if (retval == MXSER_ERR_IRQ) |
790 | printk(KERN_ERR "Invalid interrupt number,board not configured\n"); | 805 | printk(KERN_ERR "Invalid interrupt number, " |
806 | "board not configured\n"); | ||
791 | else if (retval == MXSER_ERR_IRQ_CONFLIT) | 807 | else if (retval == MXSER_ERR_IRQ_CONFLIT) |
792 | printk(KERN_ERR "Invalid interrupt number,board not configured\n"); | 808 | printk(KERN_ERR "Invalid interrupt number, " |
809 | "board not configured\n"); | ||
793 | else if (retval == MXSER_ERR_VECTOR) | 810 | else if (retval == MXSER_ERR_VECTOR) |
794 | printk(KERN_ERR "Invalid interrupt vector,board not configured\n"); | 811 | printk(KERN_ERR "Invalid interrupt vector, " |
812 | "board not configured\n"); | ||
795 | else if (retval == MXSER_ERR_IOADDR) | 813 | else if (retval == MXSER_ERR_IOADDR) |
796 | printk(KERN_ERR "Invalid I/O address,board not configured\n"); | 814 | printk(KERN_ERR "Invalid I/O address, " |
815 | "board not configured\n"); | ||
797 | 816 | ||
798 | continue; | 817 | continue; |
799 | } | 818 | } |
@@ -803,8 +822,11 @@ static int mxser_init(void) | |||
803 | hwconf.pciInfo.pdev = NULL; | 822 | hwconf.pciInfo.pdev = NULL; |
804 | 823 | ||
805 | mxser_getcfg(m, &hwconf); | 824 | mxser_getcfg(m, &hwconf); |
806 | //init mxsercfg first, or mxsercfg data is not correct on ISR. | 825 | /* |
807 | //mxser_initbrd will hook ISR. | 826 | * init mxsercfg first, |
827 | * or mxsercfg data is not correct on ISR. | ||
828 | */ | ||
829 | /* mxser_initbrd will hook ISR. */ | ||
808 | if (mxser_initbrd(m, &hwconf) < 0) | 830 | if (mxser_initbrd(m, &hwconf) < 0) |
809 | continue; | 831 | continue; |
810 | 832 | ||
@@ -817,7 +839,8 @@ static int mxser_init(void) | |||
817 | index = 0; | 839 | index = 0; |
818 | b = 0; | 840 | b = 0; |
819 | while (b < n) { | 841 | while (b < n) { |
820 | pdev = pci_find_device(mxser_pcibrds[b].vendor, mxser_pcibrds[b].device, pdev); | 842 | pdev = pci_find_device(mxser_pcibrds[b].vendor, |
843 | mxser_pcibrds[b].device, pdev); | ||
821 | if (pdev == NULL) { | 844 | if (pdev == NULL) { |
822 | b++; | 845 | b++; |
823 | continue; | 846 | continue; |
@@ -825,30 +848,48 @@ static int mxser_init(void) | |||
825 | hwconf.pciInfo.busNum = busnum = pdev->bus->number; | 848 | hwconf.pciInfo.busNum = busnum = pdev->bus->number; |
826 | hwconf.pciInfo.devNum = devnum = PCI_SLOT(pdev->devfn) << 3; | 849 | hwconf.pciInfo.devNum = devnum = PCI_SLOT(pdev->devfn) << 3; |
827 | hwconf.pciInfo.pdev = pdev; | 850 | hwconf.pciInfo.pdev = pdev; |
828 | printk(KERN_INFO "Found MOXA %s board(BusNo=%d,DevNo=%d)\n", mxser_brdname[(int) (mxser_pcibrds[b].driver_data) - 1], busnum, devnum >> 3); | 851 | printk(KERN_INFO "Found MOXA %s board(BusNo=%d,DevNo=%d)\n", |
852 | mxser_brdname[(int) (mxser_pcibrds[b].driver_data) - 1], | ||
853 | busnum, devnum >> 3); | ||
829 | index++; | 854 | index++; |
830 | if (m >= MXSER_BOARDS) { | 855 | if (m >= MXSER_BOARDS) |
831 | printk(KERN_ERR "Too many Smartio/Industio family boards find (maximum %d),board not configured\n", MXSER_BOARDS); | 856 | printk(KERN_ERR |
832 | } else { | 857 | "Too many Smartio/Industio family boards find " |
858 | "(maximum %d), board not configured\n", | ||
859 | MXSER_BOARDS); | ||
860 | else { | ||
833 | if (pci_enable_device(pdev)) { | 861 | if (pci_enable_device(pdev)) { |
834 | printk(KERN_ERR "Moxa SmartI/O PCI enable fail !\n"); | 862 | printk(KERN_ERR "Moxa SmartI/O PCI enable " |
863 | "fail !\n"); | ||
835 | continue; | 864 | continue; |
836 | } | 865 | } |
837 | retval = mxser_get_PCI_conf(busnum, devnum, (int) mxser_pcibrds[b].driver_data, &hwconf); | 866 | retval = mxser_get_PCI_conf(busnum, devnum, |
867 | (int)mxser_pcibrds[b].driver_data, | ||
868 | &hwconf); | ||
838 | if (retval < 0) { | 869 | if (retval < 0) { |
839 | if (retval == MXSER_ERR_IRQ) | 870 | if (retval == MXSER_ERR_IRQ) |
840 | printk(KERN_ERR "Invalid interrupt number,board not configured\n"); | 871 | printk(KERN_ERR |
872 | "Invalid interrupt number, " | ||
873 | "board not configured\n"); | ||
841 | else if (retval == MXSER_ERR_IRQ_CONFLIT) | 874 | else if (retval == MXSER_ERR_IRQ_CONFLIT) |
842 | printk(KERN_ERR "Invalid interrupt number,board not configured\n"); | 875 | printk(KERN_ERR |
876 | "Invalid interrupt number, " | ||
877 | "board not configured\n"); | ||
843 | else if (retval == MXSER_ERR_VECTOR) | 878 | else if (retval == MXSER_ERR_VECTOR) |
844 | printk(KERN_ERR "Invalid interrupt vector,board not configured\n"); | 879 | printk(KERN_ERR |
880 | "Invalid interrupt vector, " | ||
881 | "board not configured\n"); | ||
845 | else if (retval == MXSER_ERR_IOADDR) | 882 | else if (retval == MXSER_ERR_IOADDR) |
846 | printk(KERN_ERR "Invalid I/O address,board not configured\n"); | 883 | printk(KERN_ERR |
884 | "Invalid I/O address, " | ||
885 | "board not configured\n"); | ||
847 | continue; | 886 | continue; |
848 | } | 887 | } |
849 | mxser_getcfg(m, &hwconf); | 888 | mxser_getcfg(m, &hwconf); |
850 | //init mxsercfg first, or mxsercfg data is not correct on ISR. | 889 | /* init mxsercfg first, |
851 | //mxser_initbrd will hook ISR. | 890 | * or mxsercfg data is not correct on ISR. |
891 | */ | ||
892 | /* mxser_initbrd will hook ISR. */ | ||
852 | if (mxser_initbrd(m, &hwconf) < 0) | 893 | if (mxser_initbrd(m, &hwconf) < 0) |
853 | continue; | 894 | continue; |
854 | m++; | 895 | m++; |
@@ -858,7 +899,8 @@ static int mxser_init(void) | |||
858 | 899 | ||
859 | retval = tty_register_driver(mxvar_sdriver); | 900 | retval = tty_register_driver(mxvar_sdriver); |
860 | if (retval) { | 901 | if (retval) { |
861 | printk(KERN_ERR "Couldn't install MOXA Smartio/Industio family driver !\n"); | 902 | printk(KERN_ERR "Couldn't install MOXA Smartio/Industio family" |
903 | " driver !\n"); | ||
862 | put_tty_driver(mxvar_sdriver); | 904 | put_tty_driver(mxvar_sdriver); |
863 | 905 | ||
864 | for (i = 0; i < MXSER_BOARDS; i++) { | 906 | for (i = 0; i < MXSER_BOARDS; i++) { |
@@ -866,7 +908,7 @@ static int mxser_init(void) | |||
866 | continue; | 908 | continue; |
867 | else { | 909 | else { |
868 | free_irq(mxsercfg[i].irq, &mxvar_table[i * MXSER_PORTS_PER_BOARD]); | 910 | free_irq(mxsercfg[i].irq, &mxvar_table[i * MXSER_PORTS_PER_BOARD]); |
869 | //todo: release io, vector | 911 | /* todo: release io, vector */ |
870 | } | 912 | } |
871 | } | 913 | } |
872 | return retval; | 914 | return retval; |
@@ -877,7 +919,7 @@ static int mxser_init(void) | |||
877 | 919 | ||
878 | static void mxser_do_softint(void *private_) | 920 | static void mxser_do_softint(void *private_) |
879 | { | 921 | { |
880 | struct mxser_struct *info = (struct mxser_struct *) private_; | 922 | struct mxser_struct *info = private_; |
881 | struct tty_struct *tty; | 923 | struct tty_struct *tty; |
882 | 924 | ||
883 | tty = info->tty; | 925 | tty = info->tty; |
@@ -926,7 +968,7 @@ static int mxser_open(struct tty_struct *tty, struct file *filp) | |||
926 | return -ENODEV; | 968 | return -ENODEV; |
927 | info = mxvar_table + line; | 969 | info = mxvar_table + line; |
928 | if (!info->base) | 970 | if (!info->base) |
929 | return (-ENODEV); | 971 | return -ENODEV; |
930 | 972 | ||
931 | tty->driver_data = info; | 973 | tty->driver_data = info; |
932 | info->tty = tty; | 974 | info->tty = tty; |
@@ -935,11 +977,11 @@ static int mxser_open(struct tty_struct *tty, struct file *filp) | |||
935 | */ | 977 | */ |
936 | retval = mxser_startup(info); | 978 | retval = mxser_startup(info); |
937 | if (retval) | 979 | if (retval) |
938 | return (retval); | 980 | return retval; |
939 | 981 | ||
940 | retval = mxser_block_til_ready(tty, filp, info); | 982 | retval = mxser_block_til_ready(tty, filp, info); |
941 | if (retval) | 983 | if (retval) |
942 | return (retval); | 984 | return retval; |
943 | 985 | ||
944 | info->count++; | 986 | info->count++; |
945 | 987 | ||
@@ -953,13 +995,13 @@ static int mxser_open(struct tty_struct *tty, struct file *filp) | |||
953 | 995 | ||
954 | info->session = current->signal->session; | 996 | info->session = current->signal->session; |
955 | info->pgrp = process_group(current); | 997 | info->pgrp = process_group(current); |
956 | clear_bit(TTY_DONT_FLIP, &tty->flags); | ||
957 | 998 | ||
958 | //status = mxser_get_msr(info->base, 0, info->port); | 999 | /* |
959 | //mxser_check_modem_status(info, status); | 1000 | status = mxser_get_msr(info->base, 0, info->port); |
1001 | mxser_check_modem_status(info, status); | ||
1002 | */ | ||
960 | 1003 | ||
961 | /* unmark here for very high baud rate (ex. 921600 bps) used | 1004 | /* unmark here for very high baud rate (ex. 921600 bps) used */ |
962 | */ | ||
963 | tty->low_latency = 1; | 1005 | tty->low_latency = 1; |
964 | return 0; | 1006 | return 0; |
965 | } | 1007 | } |
@@ -972,7 +1014,7 @@ static int mxser_open(struct tty_struct *tty, struct file *filp) | |||
972 | */ | 1014 | */ |
973 | static void mxser_close(struct tty_struct *tty, struct file *filp) | 1015 | static void mxser_close(struct tty_struct *tty, struct file *filp) |
974 | { | 1016 | { |
975 | struct mxser_struct *info = (struct mxser_struct *) tty->driver_data; | 1017 | struct mxser_struct *info = tty->driver_data; |
976 | 1018 | ||
977 | unsigned long timeout; | 1019 | unsigned long timeout; |
978 | unsigned long flags; | 1020 | unsigned long flags; |
@@ -997,11 +1039,13 @@ static void mxser_close(struct tty_struct *tty, struct file *filp) | |||
997 | * one, we've got real problems, since it means the | 1039 | * one, we've got real problems, since it means the |
998 | * serial port won't be shutdown. | 1040 | * serial port won't be shutdown. |
999 | */ | 1041 | */ |
1000 | printk(KERN_ERR "mxser_close: bad serial port count; tty->count is 1, " "info->count is %d\n", info->count); | 1042 | printk(KERN_ERR "mxser_close: bad serial port count; " |
1043 | "tty->count is 1, info->count is %d\n", info->count); | ||
1001 | info->count = 1; | 1044 | info->count = 1; |
1002 | } | 1045 | } |
1003 | if (--info->count < 0) { | 1046 | if (--info->count < 0) { |
1004 | printk(KERN_ERR "mxser_close: bad serial port count for ttys%d: %d\n", info->port, info->count); | 1047 | printk(KERN_ERR "mxser_close: bad serial port count for " |
1048 | "ttys%d: %d\n", info->port, info->count); | ||
1005 | info->count = 0; | 1049 | info->count = 0; |
1006 | } | 1050 | } |
1007 | if (info->count) { | 1051 | if (info->count) { |
@@ -1056,7 +1100,7 @@ static void mxser_close(struct tty_struct *tty, struct file *filp) | |||
1056 | 1100 | ||
1057 | ld = tty_ldisc_ref(tty); | 1101 | ld = tty_ldisc_ref(tty); |
1058 | if (ld) { | 1102 | if (ld) { |
1059 | if(ld->flush_buffer) | 1103 | if (ld->flush_buffer) |
1060 | ld->flush_buffer(tty); | 1104 | ld->flush_buffer(tty); |
1061 | tty_ldisc_deref(ld); | 1105 | tty_ldisc_deref(ld); |
1062 | } | 1106 | } |
@@ -1078,31 +1122,34 @@ static void mxser_close(struct tty_struct *tty, struct file *filp) | |||
1078 | static int mxser_write(struct tty_struct *tty, const unsigned char *buf, int count) | 1122 | static int mxser_write(struct tty_struct *tty, const unsigned char *buf, int count) |
1079 | { | 1123 | { |
1080 | int c, total = 0; | 1124 | int c, total = 0; |
1081 | struct mxser_struct *info = (struct mxser_struct *) tty->driver_data; | 1125 | struct mxser_struct *info = tty->driver_data; |
1082 | unsigned long flags; | 1126 | unsigned long flags; |
1083 | 1127 | ||
1084 | if (!tty || !info->xmit_buf) | 1128 | if (!info->xmit_buf) |
1085 | return (0); | 1129 | return 0; |
1086 | 1130 | ||
1087 | while (1) { | 1131 | while (1) { |
1088 | c = min_t(int, count, min(SERIAL_XMIT_SIZE - info->xmit_cnt - 1, SERIAL_XMIT_SIZE - info->xmit_head)); | 1132 | c = min_t(int, count, min(SERIAL_XMIT_SIZE - info->xmit_cnt - 1, |
1133 | SERIAL_XMIT_SIZE - info->xmit_head)); | ||
1089 | if (c <= 0) | 1134 | if (c <= 0) |
1090 | break; | 1135 | break; |
1091 | 1136 | ||
1092 | memcpy(info->xmit_buf + info->xmit_head, buf, c); | 1137 | memcpy(info->xmit_buf + info->xmit_head, buf, c); |
1093 | spin_lock_irqsave(&info->slock, flags); | 1138 | spin_lock_irqsave(&info->slock, flags); |
1094 | info->xmit_head = (info->xmit_head + c) & (SERIAL_XMIT_SIZE - 1); | 1139 | info->xmit_head = (info->xmit_head + c) & |
1140 | (SERIAL_XMIT_SIZE - 1); | ||
1095 | info->xmit_cnt += c; | 1141 | info->xmit_cnt += c; |
1096 | spin_unlock_irqrestore(&info->slock, flags); | 1142 | spin_unlock_irqrestore(&info->slock, flags); |
1097 | 1143 | ||
1098 | buf += c; | 1144 | buf += c; |
1099 | count -= c; | 1145 | count -= c; |
1100 | total += c; | 1146 | total += c; |
1101 | |||
1102 | } | 1147 | } |
1103 | 1148 | ||
1104 | if (info->xmit_cnt && !tty->stopped && !(info->IER & UART_IER_THRI)) { | 1149 | if (info->xmit_cnt && !tty->stopped && !(info->IER & UART_IER_THRI)) { |
1105 | if (!tty->hw_stopped || (info->type == PORT_16550A) || (info->IsMoxaMustChipFlag)) { | 1150 | if (!tty->hw_stopped || |
1151 | (info->type == PORT_16550A) || | ||
1152 | (info->IsMoxaMustChipFlag)) { | ||
1106 | spin_lock_irqsave(&info->slock, flags); | 1153 | spin_lock_irqsave(&info->slock, flags); |
1107 | info->IER |= UART_IER_THRI; | 1154 | info->IER |= UART_IER_THRI; |
1108 | outb(info->IER, info->base + UART_IER); | 1155 | outb(info->IER, info->base + UART_IER); |
@@ -1114,10 +1161,10 @@ static int mxser_write(struct tty_struct *tty, const unsigned char *buf, int cou | |||
1114 | 1161 | ||
1115 | static void mxser_put_char(struct tty_struct *tty, unsigned char ch) | 1162 | static void mxser_put_char(struct tty_struct *tty, unsigned char ch) |
1116 | { | 1163 | { |
1117 | struct mxser_struct *info = (struct mxser_struct *) tty->driver_data; | 1164 | struct mxser_struct *info = tty->driver_data; |
1118 | unsigned long flags; | 1165 | unsigned long flags; |
1119 | 1166 | ||
1120 | if (!tty || !info->xmit_buf) | 1167 | if (!info->xmit_buf) |
1121 | return; | 1168 | return; |
1122 | 1169 | ||
1123 | if (info->xmit_cnt >= SERIAL_XMIT_SIZE - 1) | 1170 | if (info->xmit_cnt >= SERIAL_XMIT_SIZE - 1) |
@@ -1129,7 +1176,9 @@ static void mxser_put_char(struct tty_struct *tty, unsigned char ch) | |||
1129 | info->xmit_cnt++; | 1176 | info->xmit_cnt++; |
1130 | spin_unlock_irqrestore(&info->slock, flags); | 1177 | spin_unlock_irqrestore(&info->slock, flags); |
1131 | if (!tty->stopped && !(info->IER & UART_IER_THRI)) { | 1178 | if (!tty->stopped && !(info->IER & UART_IER_THRI)) { |
1132 | if (!tty->hw_stopped || (info->type == PORT_16550A) || info->IsMoxaMustChipFlag) { | 1179 | if (!tty->hw_stopped || |
1180 | (info->type == PORT_16550A) || | ||
1181 | info->IsMoxaMustChipFlag) { | ||
1133 | spin_lock_irqsave(&info->slock, flags); | 1182 | spin_lock_irqsave(&info->slock, flags); |
1134 | info->IER |= UART_IER_THRI; | 1183 | info->IER |= UART_IER_THRI; |
1135 | outb(info->IER, info->base + UART_IER); | 1184 | outb(info->IER, info->base + UART_IER); |
@@ -1141,10 +1190,16 @@ static void mxser_put_char(struct tty_struct *tty, unsigned char ch) | |||
1141 | 1190 | ||
1142 | static void mxser_flush_chars(struct tty_struct *tty) | 1191 | static void mxser_flush_chars(struct tty_struct *tty) |
1143 | { | 1192 | { |
1144 | struct mxser_struct *info = (struct mxser_struct *) tty->driver_data; | 1193 | struct mxser_struct *info = tty->driver_data; |
1145 | unsigned long flags; | 1194 | unsigned long flags; |
1146 | 1195 | ||
1147 | if (info->xmit_cnt <= 0 || tty->stopped || !info->xmit_buf || (tty->hw_stopped && (info->type != PORT_16550A) && (!info->IsMoxaMustChipFlag))) | 1196 | if (info->xmit_cnt <= 0 || |
1197 | tty->stopped || | ||
1198 | !info->xmit_buf || | ||
1199 | (tty->hw_stopped && | ||
1200 | (info->type != PORT_16550A) && | ||
1201 | (!info->IsMoxaMustChipFlag) | ||
1202 | )) | ||
1148 | return; | 1203 | return; |
1149 | 1204 | ||
1150 | spin_lock_irqsave(&info->slock, flags); | 1205 | spin_lock_irqsave(&info->slock, flags); |
@@ -1157,24 +1212,24 @@ static void mxser_flush_chars(struct tty_struct *tty) | |||
1157 | 1212 | ||
1158 | static int mxser_write_room(struct tty_struct *tty) | 1213 | static int mxser_write_room(struct tty_struct *tty) |
1159 | { | 1214 | { |
1160 | struct mxser_struct *info = (struct mxser_struct *) tty->driver_data; | 1215 | struct mxser_struct *info = tty->driver_data; |
1161 | int ret; | 1216 | int ret; |
1162 | 1217 | ||
1163 | ret = SERIAL_XMIT_SIZE - info->xmit_cnt - 1; | 1218 | ret = SERIAL_XMIT_SIZE - info->xmit_cnt - 1; |
1164 | if (ret < 0) | 1219 | if (ret < 0) |
1165 | ret = 0; | 1220 | ret = 0; |
1166 | return (ret); | 1221 | return ret; |
1167 | } | 1222 | } |
1168 | 1223 | ||
1169 | static int mxser_chars_in_buffer(struct tty_struct *tty) | 1224 | static int mxser_chars_in_buffer(struct tty_struct *tty) |
1170 | { | 1225 | { |
1171 | struct mxser_struct *info = (struct mxser_struct *) tty->driver_data; | 1226 | struct mxser_struct *info = tty->driver_data; |
1172 | return info->xmit_cnt; | 1227 | return info->xmit_cnt; |
1173 | } | 1228 | } |
1174 | 1229 | ||
1175 | static void mxser_flush_buffer(struct tty_struct *tty) | 1230 | static void mxser_flush_buffer(struct tty_struct *tty) |
1176 | { | 1231 | { |
1177 | struct mxser_struct *info = (struct mxser_struct *) tty->driver_data; | 1232 | struct mxser_struct *info = tty->driver_data; |
1178 | char fcr; | 1233 | char fcr; |
1179 | unsigned long flags; | 1234 | unsigned long flags; |
1180 | 1235 | ||
@@ -1184,7 +1239,8 @@ static void mxser_flush_buffer(struct tty_struct *tty) | |||
1184 | 1239 | ||
1185 | /* below added by shinhay */ | 1240 | /* below added by shinhay */ |
1186 | fcr = inb(info->base + UART_FCR); | 1241 | fcr = inb(info->base + UART_FCR); |
1187 | outb((fcr | UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT), info->base + UART_FCR); | 1242 | outb((fcr | UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT), |
1243 | info->base + UART_FCR); | ||
1188 | outb(fcr, info->base + UART_FCR); | 1244 | outb(fcr, info->base + UART_FCR); |
1189 | 1245 | ||
1190 | spin_unlock_irqrestore(&info->slock, flags); | 1246 | spin_unlock_irqrestore(&info->slock, flags); |
@@ -1197,7 +1253,7 @@ static void mxser_flush_buffer(struct tty_struct *tty) | |||
1197 | 1253 | ||
1198 | static int mxser_ioctl(struct tty_struct *tty, struct file *file, unsigned int cmd, unsigned long arg) | 1254 | static int mxser_ioctl(struct tty_struct *tty, struct file *file, unsigned int cmd, unsigned long arg) |
1199 | { | 1255 | { |
1200 | struct mxser_struct *info = (struct mxser_struct *) tty->driver_data; | 1256 | struct mxser_struct *info = tty->driver_data; |
1201 | int retval; | 1257 | int retval; |
1202 | struct async_icount cprev, cnow; /* kernel counter temps */ | 1258 | struct async_icount cprev, cnow; /* kernel counter temps */ |
1203 | struct serial_icounter_struct __user *p_cuser; | 1259 | struct serial_icounter_struct __user *p_cuser; |
@@ -1206,9 +1262,9 @@ static int mxser_ioctl(struct tty_struct *tty, struct file *file, unsigned int c | |||
1206 | void __user *argp = (void __user *)arg; | 1262 | void __user *argp = (void __user *)arg; |
1207 | 1263 | ||
1208 | if (tty->index == MXSER_PORTS) | 1264 | if (tty->index == MXSER_PORTS) |
1209 | return (mxser_ioctl_special(cmd, argp)); | 1265 | return mxser_ioctl_special(cmd, argp); |
1210 | 1266 | ||
1211 | // following add by Victor Yu. 01-05-2004 | 1267 | /* following add by Victor Yu. 01-05-2004 */ |
1212 | if (cmd == MOXA_SET_OP_MODE || cmd == MOXA_GET_OP_MODE) { | 1268 | if (cmd == MOXA_SET_OP_MODE || cmd == MOXA_GET_OP_MODE) { |
1213 | int opmode, p; | 1269 | int opmode, p; |
1214 | static unsigned char ModeMask[] = { 0xfc, 0xf3, 0xcf, 0x3f }; | 1270 | static unsigned char ModeMask[] = { 0xfc, 0xf3, 0xcf, 0x3f }; |
@@ -1219,7 +1275,10 @@ static int mxser_ioctl(struct tty_struct *tty, struct file *file, unsigned int c | |||
1219 | if (cmd == MOXA_SET_OP_MODE) { | 1275 | if (cmd == MOXA_SET_OP_MODE) { |
1220 | if (get_user(opmode, (int __user *) argp)) | 1276 | if (get_user(opmode, (int __user *) argp)) |
1221 | return -EFAULT; | 1277 | return -EFAULT; |
1222 | if (opmode != RS232_MODE && opmode != RS485_2WIRE_MODE && opmode != RS422_MODE && opmode != RS485_4WIRE_MODE) | 1278 | if (opmode != RS232_MODE && |
1279 | opmode != RS485_2WIRE_MODE && | ||
1280 | opmode != RS422_MODE && | ||
1281 | opmode != RS485_4WIRE_MODE) | ||
1223 | return -EFAULT; | 1282 | return -EFAULT; |
1224 | mask = ModeMask[p]; | 1283 | mask = ModeMask[p]; |
1225 | shiftbit = p * 2; | 1284 | shiftbit = p * 2; |
@@ -1236,36 +1295,36 @@ static int mxser_ioctl(struct tty_struct *tty, struct file *file, unsigned int c | |||
1236 | } | 1295 | } |
1237 | return 0; | 1296 | return 0; |
1238 | } | 1297 | } |
1239 | // above add by Victor Yu. 01-05-2004 | 1298 | /* above add by Victor Yu. 01-05-2004 */ |
1240 | 1299 | ||
1241 | if ((cmd != TIOCGSERIAL) && (cmd != TIOCMIWAIT) && (cmd != TIOCGICOUNT)) { | 1300 | if ((cmd != TIOCGSERIAL) && (cmd != TIOCMIWAIT) && (cmd != TIOCGICOUNT)) { |
1242 | if (tty->flags & (1 << TTY_IO_ERROR)) | 1301 | if (tty->flags & (1 << TTY_IO_ERROR)) |
1243 | return (-EIO); | 1302 | return -EIO; |
1244 | } | 1303 | } |
1245 | switch (cmd) { | 1304 | switch (cmd) { |
1246 | case TCSBRK: /* SVID version: non-zero arg --> no break */ | 1305 | case TCSBRK: /* SVID version: non-zero arg --> no break */ |
1247 | retval = tty_check_change(tty); | 1306 | retval = tty_check_change(tty); |
1248 | if (retval) | 1307 | if (retval) |
1249 | return (retval); | 1308 | return retval; |
1250 | tty_wait_until_sent(tty, 0); | 1309 | tty_wait_until_sent(tty, 0); |
1251 | if (!arg) | 1310 | if (!arg) |
1252 | mxser_send_break(info, HZ / 4); /* 1/4 second */ | 1311 | mxser_send_break(info, HZ / 4); /* 1/4 second */ |
1253 | return (0); | 1312 | return 0; |
1254 | case TCSBRKP: /* support for POSIX tcsendbreak() */ | 1313 | case TCSBRKP: /* support for POSIX tcsendbreak() */ |
1255 | retval = tty_check_change(tty); | 1314 | retval = tty_check_change(tty); |
1256 | if (retval) | 1315 | if (retval) |
1257 | return (retval); | 1316 | return retval; |
1258 | tty_wait_until_sent(tty, 0); | 1317 | tty_wait_until_sent(tty, 0); |
1259 | mxser_send_break(info, arg ? arg * (HZ / 10) : HZ / 4); | 1318 | mxser_send_break(info, arg ? arg * (HZ / 10) : HZ / 4); |
1260 | return (0); | 1319 | return 0; |
1261 | case TIOCGSOFTCAR: | 1320 | case TIOCGSOFTCAR: |
1262 | return put_user(C_CLOCAL(tty) ? 1 : 0, (unsigned long __user *) argp); | 1321 | return put_user(C_CLOCAL(tty) ? 1 : 0, (unsigned long __user *)argp); |
1263 | case TIOCSSOFTCAR: | 1322 | case TIOCSSOFTCAR: |
1264 | if (get_user(templ, (unsigned long __user *) argp)) | 1323 | if (get_user(templ, (unsigned long __user *) argp)) |
1265 | return -EFAULT; | 1324 | return -EFAULT; |
1266 | arg = templ; | 1325 | arg = templ; |
1267 | tty->termios->c_cflag = ((tty->termios->c_cflag & ~CLOCAL) | (arg ? CLOCAL : 0)); | 1326 | tty->termios->c_cflag = ((tty->termios->c_cflag & ~CLOCAL) | (arg ? CLOCAL : 0)); |
1268 | return (0); | 1327 | return 0; |
1269 | case TIOCGSERIAL: | 1328 | case TIOCGSERIAL: |
1270 | return mxser_get_serial_info(info, argp); | 1329 | return mxser_get_serial_info(info, argp); |
1271 | case TIOCSSERIAL: | 1330 | case TIOCSSERIAL: |
@@ -1278,7 +1337,7 @@ static int mxser_ioctl(struct tty_struct *tty, struct file *file, unsigned int c | |||
1278 | * (use |'ed TIOCM_RNG/DSR/CD/CTS for masking) | 1337 | * (use |'ed TIOCM_RNG/DSR/CD/CTS for masking) |
1279 | * Caller should use TIOCGICOUNT to see which one it was | 1338 | * Caller should use TIOCGICOUNT to see which one it was |
1280 | */ | 1339 | */ |
1281 | case TIOCMIWAIT:{ | 1340 | case TIOCMIWAIT: { |
1282 | DECLARE_WAITQUEUE(wait, current); | 1341 | DECLARE_WAITQUEUE(wait, current); |
1283 | int ret; | 1342 | int ret; |
1284 | spin_lock_irqsave(&info->slock, flags); | 1343 | spin_lock_irqsave(&info->slock, flags); |
@@ -1292,7 +1351,14 @@ static int mxser_ioctl(struct tty_struct *tty, struct file *file, unsigned int c | |||
1292 | spin_unlock_irqrestore(&info->slock, flags); | 1351 | spin_unlock_irqrestore(&info->slock, flags); |
1293 | 1352 | ||
1294 | set_current_state(TASK_INTERRUPTIBLE); | 1353 | set_current_state(TASK_INTERRUPTIBLE); |
1295 | if (((arg & TIOCM_RNG) && (cnow.rng != cprev.rng)) || ((arg & TIOCM_DSR) && (cnow.dsr != cprev.dsr)) || ((arg & TIOCM_CD) && (cnow.dcd != cprev.dcd)) || ((arg & TIOCM_CTS) && (cnow.cts != cprev.cts))) { | 1354 | if (((arg & TIOCM_RNG) && |
1355 | (cnow.rng != cprev.rng)) || | ||
1356 | ((arg & TIOCM_DSR) && | ||
1357 | (cnow.dsr != cprev.dsr)) || | ||
1358 | ((arg & TIOCM_CD) && | ||
1359 | (cnow.dcd != cprev.dcd)) || | ||
1360 | ((arg & TIOCM_CTS) && | ||
1361 | (cnow.cts != cprev.cts))) { | ||
1296 | ret = 0; | 1362 | ret = 0; |
1297 | break; | 1363 | break; |
1298 | } | 1364 | } |
@@ -1338,21 +1404,18 @@ static int mxser_ioctl(struct tty_struct *tty, struct file *file, unsigned int c | |||
1338 | put_user(cnow.dsr, &p_cuser->dsr); | 1404 | put_user(cnow.dsr, &p_cuser->dsr); |
1339 | put_user(cnow.rng, &p_cuser->rng); | 1405 | put_user(cnow.rng, &p_cuser->rng); |
1340 | put_user(cnow.dcd, &p_cuser->dcd); | 1406 | put_user(cnow.dcd, &p_cuser->dcd); |
1341 | |||
1342 | /* */ | ||
1343 | return 0; | 1407 | return 0; |
1344 | case MOXA_HighSpeedOn: | 1408 | case MOXA_HighSpeedOn: |
1345 | return put_user(info->baud_base != 115200 ? 1 : 0, (int __user *) argp); | 1409 | return put_user(info->baud_base != 115200 ? 1 : 0, (int __user *)argp); |
1346 | 1410 | case MOXA_SDS_RSTICOUNTER: { | |
1347 | case MOXA_SDS_RSTICOUNTER:{ | ||
1348 | info->mon_data.rxcnt = 0; | 1411 | info->mon_data.rxcnt = 0; |
1349 | info->mon_data.txcnt = 0; | 1412 | info->mon_data.txcnt = 0; |
1350 | return 0; | 1413 | return 0; |
1351 | } | 1414 | } |
1352 | // (above) added by James. | 1415 | /* (above) added by James. */ |
1353 | case MOXA_ASPP_SETBAUD:{ | 1416 | case MOXA_ASPP_SETBAUD:{ |
1354 | long baud; | 1417 | long baud; |
1355 | if (get_user(baud, (long __user *) argp)) | 1418 | if (get_user(baud, (long __user *)argp)) |
1356 | return -EFAULT; | 1419 | return -EFAULT; |
1357 | mxser_set_baud(info, baud); | 1420 | mxser_set_baud(info, baud); |
1358 | return 0; | 1421 | return 0; |
@@ -1377,9 +1440,10 @@ static int mxser_ioctl(struct tty_struct *tty, struct file *file, unsigned int c | |||
1377 | 1440 | ||
1378 | return 0; | 1441 | return 0; |
1379 | } | 1442 | } |
1380 | case MOXA_ASPP_MON:{ | 1443 | case MOXA_ASPP_MON: { |
1381 | int mcr, status; | 1444 | int mcr, status; |
1382 | // info->mon_data.ser_param = tty->termios->c_cflag; | 1445 | |
1446 | /* info->mon_data.ser_param = tty->termios->c_cflag; */ | ||
1383 | 1447 | ||
1384 | status = mxser_get_msr(info->base, 1, info->port, info); | 1448 | status = mxser_get_msr(info->base, 1, info->port, info); |
1385 | mxser_check_modem_status(info, status); | 1449 | mxser_check_modem_status(info, status); |
@@ -1400,25 +1464,25 @@ static int mxser_ioctl(struct tty_struct *tty, struct file *file, unsigned int c | |||
1400 | else | 1464 | else |
1401 | info->mon_data.hold_reason &= ~NPPI_NOTIFY_CTSHOLD; | 1465 | info->mon_data.hold_reason &= ~NPPI_NOTIFY_CTSHOLD; |
1402 | 1466 | ||
1403 | 1467 | if (copy_to_user(argp, &info->mon_data, | |
1404 | if (copy_to_user(argp, &info->mon_data, sizeof(struct mxser_mon))) | 1468 | sizeof(struct mxser_mon))) |
1405 | return -EFAULT; | 1469 | return -EFAULT; |
1406 | 1470 | ||
1407 | return 0; | 1471 | return 0; |
1408 | |||
1409 | } | 1472 | } |
1410 | 1473 | ||
1411 | case MOXA_ASPP_LSTATUS:{ | 1474 | case MOXA_ASPP_LSTATUS: { |
1412 | if (copy_to_user(argp, &info->err_shadow, sizeof(unsigned char))) | 1475 | if (copy_to_user(argp, &info->err_shadow, |
1476 | sizeof(unsigned char))) | ||
1413 | return -EFAULT; | 1477 | return -EFAULT; |
1414 | 1478 | ||
1415 | info->err_shadow = 0; | 1479 | info->err_shadow = 0; |
1416 | return 0; | 1480 | return 0; |
1417 | |||
1418 | } | 1481 | } |
1419 | case MOXA_SET_BAUD_METHOD:{ | 1482 | case MOXA_SET_BAUD_METHOD: { |
1420 | int method; | 1483 | int method; |
1421 | if (get_user(method, (int __user *) argp)) | 1484 | |
1485 | if (get_user(method, (int __user *)argp)) | ||
1422 | return -EFAULT; | 1486 | return -EFAULT; |
1423 | mxser_set_baud_method[info->port] = method; | 1487 | mxser_set_baud_method[info->port] = method; |
1424 | if (copy_to_user(argp, &method, sizeof(int))) | 1488 | if (copy_to_user(argp, &method, sizeof(int))) |
@@ -1442,7 +1506,8 @@ static int mxser_ioctl_special(unsigned int cmd, void __user *argp) | |||
1442 | 1506 | ||
1443 | switch (cmd) { | 1507 | switch (cmd) { |
1444 | case MOXA_GET_CONF: | 1508 | case MOXA_GET_CONF: |
1445 | if (copy_to_user(argp, mxsercfg, sizeof(struct mxser_hwconf) * 4)) | 1509 | if (copy_to_user(argp, mxsercfg, |
1510 | sizeof(struct mxser_hwconf) * 4)) | ||
1446 | return -EFAULT; | 1511 | return -EFAULT; |
1447 | return 0; | 1512 | return 0; |
1448 | case MOXA_GET_MAJOR: | 1513 | case MOXA_GET_MAJOR: |
@@ -1461,11 +1526,11 @@ static int mxser_ioctl_special(unsigned int cmd, void __user *argp) | |||
1461 | if (mxvar_table[i].base) | 1526 | if (mxvar_table[i].base) |
1462 | result |= (1 << i); | 1527 | result |= (1 << i); |
1463 | } | 1528 | } |
1464 | return put_user(result, (unsigned long __user *) argp); | 1529 | return put_user(result, (unsigned long __user *)argp); |
1465 | case MOXA_GETDATACOUNT: | 1530 | case MOXA_GETDATACOUNT: |
1466 | if (copy_to_user(argp, &mxvar_log, sizeof(mxvar_log))) | 1531 | if (copy_to_user(argp, &mxvar_log, sizeof(mxvar_log))) |
1467 | return -EFAULT; | 1532 | return -EFAULT; |
1468 | return (0); | 1533 | return 0; |
1469 | case MOXA_GETMSTATUS: | 1534 | case MOXA_GETMSTATUS: |
1470 | for (i = 0; i < MXSER_PORTS; i++) { | 1535 | for (i = 0; i < MXSER_PORTS; i++) { |
1471 | GMStatus[i].ri = 0; | 1536 | GMStatus[i].ri = 0; |
@@ -1498,22 +1563,26 @@ static int mxser_ioctl_special(unsigned int cmd, void __user *argp) | |||
1498 | else | 1563 | else |
1499 | GMStatus[i].cts = 0; | 1564 | GMStatus[i].cts = 0; |
1500 | } | 1565 | } |
1501 | if (copy_to_user(argp, GMStatus, sizeof(struct mxser_mstatus) * MXSER_PORTS)) | 1566 | if (copy_to_user(argp, GMStatus, |
1567 | sizeof(struct mxser_mstatus) * MXSER_PORTS)) | ||
1502 | return -EFAULT; | 1568 | return -EFAULT; |
1503 | return 0; | 1569 | return 0; |
1504 | case MOXA_ASPP_MON_EXT:{ | 1570 | case MOXA_ASPP_MON_EXT: { |
1505 | int status; | 1571 | int status; |
1506 | int opmode, p; | 1572 | int opmode, p; |
1507 | int shiftbit; | 1573 | int shiftbit; |
1508 | unsigned cflag, iflag; | 1574 | unsigned cflag, iflag; |
1509 | 1575 | ||
1510 | for (i = 0; i < MXSER_PORTS; i++) { | 1576 | for (i = 0; i < MXSER_PORTS; i++) { |
1511 | |||
1512 | if (!mxvar_table[i].base) | 1577 | if (!mxvar_table[i].base) |
1513 | continue; | 1578 | continue; |
1514 | 1579 | ||
1515 | status = mxser_get_msr(mxvar_table[i].base, 0, i, &(mxvar_table[i])); | 1580 | status = mxser_get_msr(mxvar_table[i].base, 0, |
1516 | // mxser_check_modem_status(&mxvar_table[i], status); | 1581 | i, &(mxvar_table[i])); |
1582 | /* | ||
1583 | mxser_check_modem_status(&mxvar_table[i], | ||
1584 | status); | ||
1585 | */ | ||
1517 | if (status & UART_MSR_TERI) | 1586 | if (status & UART_MSR_TERI) |
1518 | mxvar_table[i].icount.rng++; | 1587 | mxvar_table[i].icount.rng++; |
1519 | if (status & UART_MSR_DDSR) | 1588 | if (status & UART_MSR_DDSR) |
@@ -1578,75 +1647,76 @@ static int mxser_ioctl_special(unsigned int cmd, void __user *argp) | |||
1578 | return 0; | 1647 | return 0; |
1579 | } | 1648 | } |
1580 | 1649 | ||
1581 | |||
1582 | static void mxser_stoprx(struct tty_struct *tty) | 1650 | static void mxser_stoprx(struct tty_struct *tty) |
1583 | { | 1651 | { |
1584 | struct mxser_struct *info = (struct mxser_struct *) tty->driver_data; | 1652 | struct mxser_struct *info = tty->driver_data; |
1585 | //unsigned long flags; | 1653 | /* unsigned long flags; */ |
1586 | |||
1587 | 1654 | ||
1588 | info->ldisc_stop_rx = 1; | 1655 | info->ldisc_stop_rx = 1; |
1589 | if (I_IXOFF(tty)) { | 1656 | if (I_IXOFF(tty)) { |
1590 | 1657 | /* MX_LOCK(&info->slock); */ | |
1591 | //MX_LOCK(&info->slock); | 1658 | /* following add by Victor Yu. 09-02-2002 */ |
1592 | // following add by Victor Yu. 09-02-2002 | ||
1593 | if (info->IsMoxaMustChipFlag) { | 1659 | if (info->IsMoxaMustChipFlag) { |
1594 | info->IER &= ~MOXA_MUST_RECV_ISR; | 1660 | info->IER &= ~MOXA_MUST_RECV_ISR; |
1595 | outb(info->IER, info->base + UART_IER); | 1661 | outb(info->IER, info->base + UART_IER); |
1596 | } else { | 1662 | } else { |
1597 | // above add by Victor Yu. 09-02-2002 | 1663 | /* above add by Victor Yu. 09-02-2002 */ |
1598 | |||
1599 | info->x_char = STOP_CHAR(tty); | 1664 | info->x_char = STOP_CHAR(tty); |
1600 | // outb(info->IER, 0); // mask by Victor Yu. 09-02-2002 | 1665 | /* mask by Victor Yu. 09-02-2002 */ |
1666 | /* outb(info->IER, 0); */ | ||
1601 | outb(0, info->base + UART_IER); | 1667 | outb(0, info->base + UART_IER); |
1602 | info->IER |= UART_IER_THRI; | 1668 | info->IER |= UART_IER_THRI; |
1603 | outb(info->IER, info->base + UART_IER); /* force Tx interrupt */ | 1669 | /* force Tx interrupt */ |
1604 | } // add by Victor Yu. 09-02-2002 | 1670 | outb(info->IER, info->base + UART_IER); |
1605 | //MX_UNLOCK(&info->slock); | 1671 | } /* add by Victor Yu. 09-02-2002 */ |
1672 | /* MX_UNLOCK(&info->slock); */ | ||
1606 | } | 1673 | } |
1607 | 1674 | ||
1608 | if (info->tty->termios->c_cflag & CRTSCTS) { | 1675 | if (info->tty->termios->c_cflag & CRTSCTS) { |
1609 | //MX_LOCK(&info->slock); | 1676 | /* MX_LOCK(&info->slock); */ |
1610 | info->MCR &= ~UART_MCR_RTS; | 1677 | info->MCR &= ~UART_MCR_RTS; |
1611 | outb(info->MCR, info->base + UART_MCR); | 1678 | outb(info->MCR, info->base + UART_MCR); |
1612 | //MX_UNLOCK(&info->slock); | 1679 | /* MX_UNLOCK(&info->slock); */ |
1613 | } | 1680 | } |
1614 | } | 1681 | } |
1615 | 1682 | ||
1616 | static void mxser_startrx(struct tty_struct *tty) | 1683 | static void mxser_startrx(struct tty_struct *tty) |
1617 | { | 1684 | { |
1618 | struct mxser_struct *info = (struct mxser_struct *) tty->driver_data; | 1685 | struct mxser_struct *info = tty->driver_data; |
1619 | //unsigned long flags; | 1686 | /* unsigned long flags; */ |
1620 | 1687 | ||
1621 | info->ldisc_stop_rx = 0; | 1688 | info->ldisc_stop_rx = 0; |
1622 | if (I_IXOFF(tty)) { | 1689 | if (I_IXOFF(tty)) { |
1623 | if (info->x_char) | 1690 | if (info->x_char) |
1624 | info->x_char = 0; | 1691 | info->x_char = 0; |
1625 | else { | 1692 | else { |
1626 | //MX_LOCK(&info->slock); | 1693 | /* MX_LOCK(&info->slock); */ |
1627 | 1694 | ||
1628 | // following add by Victor Yu. 09-02-2002 | 1695 | /* following add by Victor Yu. 09-02-2002 */ |
1629 | if (info->IsMoxaMustChipFlag) { | 1696 | if (info->IsMoxaMustChipFlag) { |
1630 | info->IER |= MOXA_MUST_RECV_ISR; | 1697 | info->IER |= MOXA_MUST_RECV_ISR; |
1631 | outb(info->IER, info->base + UART_IER); | 1698 | outb(info->IER, info->base + UART_IER); |
1632 | } else { | 1699 | } else { |
1633 | // above add by Victor Yu. 09-02-2002 | 1700 | /* above add by Victor Yu. 09-02-2002 */ |
1634 | 1701 | ||
1635 | info->x_char = START_CHAR(tty); | 1702 | info->x_char = START_CHAR(tty); |
1636 | // outb(info->IER, 0); // mask by Victor Yu. 09-02-2002 | 1703 | /* mask by Victor Yu. 09-02-2002 */ |
1637 | outb(0, info->base + UART_IER); // add by Victor Yu. 09-02-2002 | 1704 | /* outb(info->IER, 0); */ |
1638 | info->IER |= UART_IER_THRI; /* force Tx interrupt */ | 1705 | /* add by Victor Yu. 09-02-2002 */ |
1706 | outb(0, info->base + UART_IER); | ||
1707 | /* force Tx interrupt */ | ||
1708 | info->IER |= UART_IER_THRI; | ||
1639 | outb(info->IER, info->base + UART_IER); | 1709 | outb(info->IER, info->base + UART_IER); |
1640 | } // add by Victor Yu. 09-02-2002 | 1710 | } /* add by Victor Yu. 09-02-2002 */ |
1641 | //MX_UNLOCK(&info->slock); | 1711 | /* MX_UNLOCK(&info->slock); */ |
1642 | } | 1712 | } |
1643 | } | 1713 | } |
1644 | 1714 | ||
1645 | if (info->tty->termios->c_cflag & CRTSCTS) { | 1715 | if (info->tty->termios->c_cflag & CRTSCTS) { |
1646 | //MX_LOCK(&info->slock); | 1716 | /* MX_LOCK(&info->slock); */ |
1647 | info->MCR |= UART_MCR_RTS; | 1717 | info->MCR |= UART_MCR_RTS; |
1648 | outb(info->MCR, info->base + UART_MCR); | 1718 | outb(info->MCR, info->base + UART_MCR); |
1649 | //MX_UNLOCK(&info->slock); | 1719 | /* MX_UNLOCK(&info->slock); */ |
1650 | } | 1720 | } |
1651 | } | 1721 | } |
1652 | 1722 | ||
@@ -1656,48 +1726,53 @@ static void mxser_startrx(struct tty_struct *tty) | |||
1656 | */ | 1726 | */ |
1657 | static void mxser_throttle(struct tty_struct *tty) | 1727 | static void mxser_throttle(struct tty_struct *tty) |
1658 | { | 1728 | { |
1659 | //struct mxser_struct *info = (struct mxser_struct *)tty->driver_data; | 1729 | /* struct mxser_struct *info = tty->driver_data; */ |
1660 | //unsigned long flags; | 1730 | /* unsigned long flags; */ |
1661 | //MX_LOCK(&info->slock); | 1731 | |
1732 | /* MX_LOCK(&info->slock); */ | ||
1662 | mxser_stoprx(tty); | 1733 | mxser_stoprx(tty); |
1663 | //MX_UNLOCK(&info->slock); | 1734 | /* MX_UNLOCK(&info->slock); */ |
1664 | } | 1735 | } |
1665 | 1736 | ||
1666 | static void mxser_unthrottle(struct tty_struct *tty) | 1737 | static void mxser_unthrottle(struct tty_struct *tty) |
1667 | { | 1738 | { |
1668 | //struct mxser_struct *info = (struct mxser_struct *)tty->driver_data; | 1739 | /* struct mxser_struct *info = tty->driver_data; */ |
1669 | //unsigned long flags; | 1740 | /* unsigned long flags; */ |
1670 | //MX_LOCK(&info->slock); | 1741 | |
1742 | /* MX_LOCK(&info->slock); */ | ||
1671 | mxser_startrx(tty); | 1743 | mxser_startrx(tty); |
1672 | //MX_UNLOCK(&info->slock); | 1744 | /* MX_UNLOCK(&info->slock); */ |
1673 | } | 1745 | } |
1674 | 1746 | ||
1675 | static void mxser_set_termios(struct tty_struct *tty, struct termios *old_termios) | 1747 | static void mxser_set_termios(struct tty_struct *tty, struct termios *old_termios) |
1676 | { | 1748 | { |
1677 | struct mxser_struct *info = (struct mxser_struct *) tty->driver_data; | 1749 | struct mxser_struct *info = tty->driver_data; |
1678 | unsigned long flags; | 1750 | unsigned long flags; |
1679 | 1751 | ||
1680 | if ((tty->termios->c_cflag != old_termios->c_cflag) || (RELEVANT_IFLAG(tty->termios->c_iflag) != RELEVANT_IFLAG(old_termios->c_iflag))) { | 1752 | if ((tty->termios->c_cflag != old_termios->c_cflag) || |
1753 | (RELEVANT_IFLAG(tty->termios->c_iflag) != RELEVANT_IFLAG(old_termios->c_iflag))) { | ||
1681 | 1754 | ||
1682 | mxser_change_speed(info, old_termios); | 1755 | mxser_change_speed(info, old_termios); |
1683 | 1756 | ||
1684 | if ((old_termios->c_cflag & CRTSCTS) && !(tty->termios->c_cflag & CRTSCTS)) { | 1757 | if ((old_termios->c_cflag & CRTSCTS) && |
1758 | !(tty->termios->c_cflag & CRTSCTS)) { | ||
1685 | tty->hw_stopped = 0; | 1759 | tty->hw_stopped = 0; |
1686 | mxser_start(tty); | 1760 | mxser_start(tty); |
1687 | } | 1761 | } |
1688 | } | 1762 | } |
1689 | 1763 | ||
1690 | /* Handle sw stopped */ | 1764 | /* Handle sw stopped */ |
1691 | if ((old_termios->c_iflag & IXON) && !(tty->termios->c_iflag & IXON)) { | 1765 | if ((old_termios->c_iflag & IXON) && |
1766 | !(tty->termios->c_iflag & IXON)) { | ||
1692 | tty->stopped = 0; | 1767 | tty->stopped = 0; |
1693 | 1768 | ||
1694 | // following add by Victor Yu. 09-02-2002 | 1769 | /* following add by Victor Yu. 09-02-2002 */ |
1695 | if (info->IsMoxaMustChipFlag) { | 1770 | if (info->IsMoxaMustChipFlag) { |
1696 | spin_lock_irqsave(&info->slock, flags); | 1771 | spin_lock_irqsave(&info->slock, flags); |
1697 | DISABLE_MOXA_MUST_RX_SOFTWARE_FLOW_CONTROL(info->base); | 1772 | DISABLE_MOXA_MUST_RX_SOFTWARE_FLOW_CONTROL(info->base); |
1698 | spin_unlock_irqrestore(&info->slock, flags); | 1773 | spin_unlock_irqrestore(&info->slock, flags); |
1699 | } | 1774 | } |
1700 | // above add by Victor Yu. 09-02-2002 | 1775 | /* above add by Victor Yu. 09-02-2002 */ |
1701 | 1776 | ||
1702 | mxser_start(tty); | 1777 | mxser_start(tty); |
1703 | } | 1778 | } |
@@ -1711,7 +1786,7 @@ static void mxser_set_termios(struct tty_struct *tty, struct termios *old_termio | |||
1711 | */ | 1786 | */ |
1712 | static void mxser_stop(struct tty_struct *tty) | 1787 | static void mxser_stop(struct tty_struct *tty) |
1713 | { | 1788 | { |
1714 | struct mxser_struct *info = (struct mxser_struct *) tty->driver_data; | 1789 | struct mxser_struct *info = tty->driver_data; |
1715 | unsigned long flags; | 1790 | unsigned long flags; |
1716 | 1791 | ||
1717 | spin_lock_irqsave(&info->slock, flags); | 1792 | spin_lock_irqsave(&info->slock, flags); |
@@ -1724,7 +1799,7 @@ static void mxser_stop(struct tty_struct *tty) | |||
1724 | 1799 | ||
1725 | static void mxser_start(struct tty_struct *tty) | 1800 | static void mxser_start(struct tty_struct *tty) |
1726 | { | 1801 | { |
1727 | struct mxser_struct *info = (struct mxser_struct *) tty->driver_data; | 1802 | struct mxser_struct *info = tty->driver_data; |
1728 | unsigned long flags; | 1803 | unsigned long flags; |
1729 | 1804 | ||
1730 | spin_lock_irqsave(&info->slock, flags); | 1805 | spin_lock_irqsave(&info->slock, flags); |
@@ -1740,7 +1815,7 @@ static void mxser_start(struct tty_struct *tty) | |||
1740 | */ | 1815 | */ |
1741 | static void mxser_wait_until_sent(struct tty_struct *tty, int timeout) | 1816 | static void mxser_wait_until_sent(struct tty_struct *tty, int timeout) |
1742 | { | 1817 | { |
1743 | struct mxser_struct *info = (struct mxser_struct *) tty->driver_data; | 1818 | struct mxser_struct *info = tty->driver_data; |
1744 | unsigned long orig_jiffies, char_time; | 1819 | unsigned long orig_jiffies, char_time; |
1745 | int lsr; | 1820 | int lsr; |
1746 | 1821 | ||
@@ -1777,7 +1852,8 @@ static void mxser_wait_until_sent(struct tty_struct *tty, int timeout) | |||
1777 | if (!timeout || timeout > 2 * info->timeout) | 1852 | if (!timeout || timeout > 2 * info->timeout) |
1778 | timeout = 2 * info->timeout; | 1853 | timeout = 2 * info->timeout; |
1779 | #ifdef SERIAL_DEBUG_RS_WAIT_UNTIL_SENT | 1854 | #ifdef SERIAL_DEBUG_RS_WAIT_UNTIL_SENT |
1780 | printk(KERN_DEBUG "In rs_wait_until_sent(%d) check=%lu...", timeout, char_time); | 1855 | printk(KERN_DEBUG "In rs_wait_until_sent(%d) check=%lu...", |
1856 | timeout, char_time); | ||
1781 | printk("jiff=%lu...", jiffies); | 1857 | printk("jiff=%lu...", jiffies); |
1782 | #endif | 1858 | #endif |
1783 | while (!((lsr = inb(info->base + UART_LSR)) & UART_LSR_TEMT)) { | 1859 | while (!((lsr = inb(info->base + UART_LSR)) & UART_LSR_TEMT)) { |
@@ -1803,7 +1879,7 @@ static void mxser_wait_until_sent(struct tty_struct *tty, int timeout) | |||
1803 | */ | 1879 | */ |
1804 | void mxser_hangup(struct tty_struct *tty) | 1880 | void mxser_hangup(struct tty_struct *tty) |
1805 | { | 1881 | { |
1806 | struct mxser_struct *info = (struct mxser_struct *) tty->driver_data; | 1882 | struct mxser_struct *info = tty->driver_data; |
1807 | 1883 | ||
1808 | mxser_flush_buffer(tty); | 1884 | mxser_flush_buffer(tty); |
1809 | mxser_shutdown(info); | 1885 | mxser_shutdown(info); |
@@ -1815,24 +1891,26 @@ void mxser_hangup(struct tty_struct *tty) | |||
1815 | } | 1891 | } |
1816 | 1892 | ||
1817 | 1893 | ||
1818 | // added by James 03-12-2004. | 1894 | /* added by James 03-12-2004. */ |
1819 | /* | 1895 | /* |
1820 | * mxser_rs_break() --- routine which turns the break handling on or off | 1896 | * mxser_rs_break() --- routine which turns the break handling on or off |
1821 | */ | 1897 | */ |
1822 | static void mxser_rs_break(struct tty_struct *tty, int break_state) | 1898 | static void mxser_rs_break(struct tty_struct *tty, int break_state) |
1823 | { | 1899 | { |
1824 | struct mxser_struct *info = (struct mxser_struct *) tty->driver_data; | 1900 | struct mxser_struct *info = tty->driver_data; |
1825 | unsigned long flags; | 1901 | unsigned long flags; |
1826 | 1902 | ||
1827 | spin_lock_irqsave(&info->slock, flags); | 1903 | spin_lock_irqsave(&info->slock, flags); |
1828 | if (break_state == -1) | 1904 | if (break_state == -1) |
1829 | outb(inb(info->base + UART_LCR) | UART_LCR_SBC, info->base + UART_LCR); | 1905 | outb(inb(info->base + UART_LCR) | UART_LCR_SBC, |
1906 | info->base + UART_LCR); | ||
1830 | else | 1907 | else |
1831 | outb(inb(info->base + UART_LCR) & ~UART_LCR_SBC, info->base + UART_LCR); | 1908 | outb(inb(info->base + UART_LCR) & ~UART_LCR_SBC, |
1909 | info->base + UART_LCR); | ||
1832 | spin_unlock_irqrestore(&info->slock, flags); | 1910 | spin_unlock_irqrestore(&info->slock, flags); |
1833 | } | 1911 | } |
1834 | 1912 | ||
1835 | // (above) added by James. | 1913 | /* (above) added by James. */ |
1836 | 1914 | ||
1837 | 1915 | ||
1838 | /* | 1916 | /* |
@@ -1848,7 +1926,7 @@ static irqreturn_t mxser_interrupt(int irq, void *dev_id, struct pt_regs *regs) | |||
1848 | int handled = IRQ_NONE; | 1926 | int handled = IRQ_NONE; |
1849 | 1927 | ||
1850 | port = NULL; | 1928 | port = NULL; |
1851 | //spin_lock(&gm_lock); | 1929 | /* spin_lock(&gm_lock); */ |
1852 | 1930 | ||
1853 | for (i = 0; i < MXSER_BOARDS; i++) { | 1931 | for (i = 0; i < MXSER_BOARDS; i++) { |
1854 | if (dev_id == &(mxvar_table[i * MXSER_PORTS_PER_BOARD])) { | 1932 | if (dev_id == &(mxvar_table[i * MXSER_PORTS_PER_BOARD])) { |
@@ -1857,29 +1935,25 @@ static irqreturn_t mxser_interrupt(int irq, void *dev_id, struct pt_regs *regs) | |||
1857 | } | 1935 | } |
1858 | } | 1936 | } |
1859 | 1937 | ||
1860 | if (i == MXSER_BOARDS) { | 1938 | if (i == MXSER_BOARDS) |
1861 | goto irq_stop; | 1939 | goto irq_stop; |
1862 | } | 1940 | if (port == 0) |
1863 | if (port == 0) { | ||
1864 | goto irq_stop; | 1941 | goto irq_stop; |
1865 | } | ||
1866 | max = mxser_numports[mxsercfg[i].board_type - 1]; | 1942 | max = mxser_numports[mxsercfg[i].board_type - 1]; |
1867 | while (1) { | 1943 | while (1) { |
1868 | irqbits = inb(port->vector) & port->vectormask; | 1944 | irqbits = inb(port->vector) & port->vectormask; |
1869 | if (irqbits == port->vectormask) { | 1945 | if (irqbits == port->vectormask) |
1870 | break; | 1946 | break; |
1871 | } | ||
1872 | 1947 | ||
1873 | handled = IRQ_HANDLED; | 1948 | handled = IRQ_HANDLED; |
1874 | for (i = 0, bits = 1; i < max; i++, irqbits |= bits, bits <<= 1) { | 1949 | for (i = 0, bits = 1; i < max; i++, irqbits |= bits, bits <<= 1) { |
1875 | if (irqbits == port->vectormask) { | 1950 | if (irqbits == port->vectormask) |
1876 | break; | 1951 | break; |
1877 | } | ||
1878 | if (bits & irqbits) | 1952 | if (bits & irqbits) |
1879 | continue; | 1953 | continue; |
1880 | info = port + i; | 1954 | info = port + i; |
1881 | 1955 | ||
1882 | // following add by Victor Yu. 09-13-2002 | 1956 | /* following add by Victor Yu. 09-13-2002 */ |
1883 | iir = inb(info->base + UART_IIR); | 1957 | iir = inb(info->base + UART_IIR); |
1884 | if (iir & UART_IIR_NO_INT) | 1958 | if (iir & UART_IIR_NO_INT) |
1885 | continue; | 1959 | continue; |
@@ -1890,9 +1964,9 @@ static irqreturn_t mxser_interrupt(int irq, void *dev_id, struct pt_regs *regs) | |||
1890 | inb(info->base + UART_MSR); | 1964 | inb(info->base + UART_MSR); |
1891 | continue; | 1965 | continue; |
1892 | } | 1966 | } |
1893 | // above add by Victor Yu. 09-13-2002 | 1967 | /* above add by Victor Yu. 09-13-2002 */ |
1894 | /* | 1968 | /* |
1895 | if ( info->tty->flip.count < TTY_FLIPBUF_SIZE/4 ){ | 1969 | if (info->tty->flip.count < TTY_FLIPBUF_SIZE / 4) { |
1896 | info->IER |= MOXA_MUST_RECV_ISR; | 1970 | info->IER |= MOXA_MUST_RECV_ISR; |
1897 | outb(info->IER, info->base + UART_IER); | 1971 | outb(info->IER, info->base + UART_IER); |
1898 | } | 1972 | } |
@@ -1908,18 +1982,15 @@ static irqreturn_t mxser_interrupt(int irq, void *dev_id, struct pt_regs *regs) | |||
1908 | status = inb(info->base + UART_LSR) & info->read_status_mask; | 1982 | status = inb(info->base + UART_LSR) & info->read_status_mask; |
1909 | */ | 1983 | */ |
1910 | 1984 | ||
1911 | // following add by Victor Yu. 09-02-2002 | 1985 | /* following add by Victor Yu. 09-02-2002 */ |
1912 | status = inb(info->base + UART_LSR); | 1986 | status = inb(info->base + UART_LSR); |
1913 | 1987 | ||
1914 | if (status & UART_LSR_PE) { | 1988 | if (status & UART_LSR_PE) |
1915 | info->err_shadow |= NPPI_NOTIFY_PARITY; | 1989 | info->err_shadow |= NPPI_NOTIFY_PARITY; |
1916 | } | 1990 | if (status & UART_LSR_FE) |
1917 | if (status & UART_LSR_FE) { | ||
1918 | info->err_shadow |= NPPI_NOTIFY_FRAMING; | 1991 | info->err_shadow |= NPPI_NOTIFY_FRAMING; |
1919 | } | 1992 | if (status & UART_LSR_OE) |
1920 | if (status & UART_LSR_OE) { | ||
1921 | info->err_shadow |= NPPI_NOTIFY_HW_OVERRUN; | 1993 | info->err_shadow |= NPPI_NOTIFY_HW_OVERRUN; |
1922 | } | ||
1923 | if (status & UART_LSR_BI) | 1994 | if (status & UART_LSR_BI) |
1924 | info->err_shadow |= NPPI_NOTIFY_BREAK; | 1995 | info->err_shadow |= NPPI_NOTIFY_BREAK; |
1925 | 1996 | ||
@@ -1930,11 +2001,14 @@ static irqreturn_t mxser_interrupt(int irq, void *dev_id, struct pt_regs *regs) | |||
1930 | continue; | 2001 | continue; |
1931 | } | 2002 | } |
1932 | */ | 2003 | */ |
1933 | if (iir == MOXA_MUST_IIR_GDA || iir == MOXA_MUST_IIR_RDA || iir == MOXA_MUST_IIR_RTO || iir == MOXA_MUST_IIR_LSR) | 2004 | if (iir == MOXA_MUST_IIR_GDA || |
2005 | iir == MOXA_MUST_IIR_RDA || | ||
2006 | iir == MOXA_MUST_IIR_RTO || | ||
2007 | iir == MOXA_MUST_IIR_LSR) | ||
1934 | mxser_receive_chars(info, &status); | 2008 | mxser_receive_chars(info, &status); |
1935 | 2009 | ||
1936 | } else { | 2010 | } else { |
1937 | // above add by Victor Yu. 09-02-2002 | 2011 | /* above add by Victor Yu. 09-02-2002 */ |
1938 | 2012 | ||
1939 | status &= info->read_status_mask; | 2013 | status &= info->read_status_mask; |
1940 | if (status & UART_LSR_DR) | 2014 | if (status & UART_LSR_DR) |
@@ -1944,13 +2018,13 @@ static irqreturn_t mxser_interrupt(int irq, void *dev_id, struct pt_regs *regs) | |||
1944 | if (msr & UART_MSR_ANY_DELTA) { | 2018 | if (msr & UART_MSR_ANY_DELTA) { |
1945 | mxser_check_modem_status(info, msr); | 2019 | mxser_check_modem_status(info, msr); |
1946 | } | 2020 | } |
1947 | // following add by Victor Yu. 09-13-2002 | 2021 | /* following add by Victor Yu. 09-13-2002 */ |
1948 | if (info->IsMoxaMustChipFlag) { | 2022 | if (info->IsMoxaMustChipFlag) { |
1949 | if ((iir == 0x02) && (status & UART_LSR_THRE)) { | 2023 | if ((iir == 0x02) && (status & UART_LSR_THRE)) { |
1950 | mxser_transmit_chars(info); | 2024 | mxser_transmit_chars(info); |
1951 | } | 2025 | } |
1952 | } else { | 2026 | } else { |
1953 | // above add by Victor Yu. 09-13-2002 | 2027 | /* above add by Victor Yu. 09-13-2002 */ |
1954 | 2028 | ||
1955 | if (status & UART_LSR_THRE) { | 2029 | if (status & UART_LSR_THRE) { |
1956 | /* 8-2-99 by William | 2030 | /* 8-2-99 by William |
@@ -1966,7 +2040,7 @@ static irqreturn_t mxser_interrupt(int irq, void *dev_id, struct pt_regs *regs) | |||
1966 | } | 2040 | } |
1967 | 2041 | ||
1968 | irq_stop: | 2042 | irq_stop: |
1969 | //spin_unlock(&gm_lock); | 2043 | /* spin_unlock(&gm_lock); */ |
1970 | return handled; | 2044 | return handled; |
1971 | } | 2045 | } |
1972 | 2046 | ||
@@ -1984,56 +2058,58 @@ static void mxser_receive_chars(struct mxser_struct *info, int *status) | |||
1984 | 2058 | ||
1985 | recv_room = tty->receive_room; | 2059 | recv_room = tty->receive_room; |
1986 | if ((recv_room == 0) && (!info->ldisc_stop_rx)) { | 2060 | if ((recv_room == 0) && (!info->ldisc_stop_rx)) { |
1987 | //mxser_throttle(tty); | 2061 | /* mxser_throttle(tty); */ |
1988 | mxser_stoprx(tty); | 2062 | mxser_stoprx(tty); |
1989 | //return; | 2063 | /* return; */ |
1990 | } | 2064 | } |
1991 | 2065 | ||
1992 | // following add by Victor Yu. 09-02-2002 | 2066 | /* following add by Victor Yu. 09-02-2002 */ |
1993 | if (info->IsMoxaMustChipFlag != MOXA_OTHER_UART) { | 2067 | if (info->IsMoxaMustChipFlag != MOXA_OTHER_UART) { |
1994 | 2068 | ||
1995 | if (*status & UART_LSR_SPECIAL) { | 2069 | if (*status & UART_LSR_SPECIAL) { |
1996 | goto intr_old; | 2070 | goto intr_old; |
1997 | } | 2071 | } |
1998 | // following add by Victor Yu. 02-11-2004 | 2072 | /* following add by Victor Yu. 02-11-2004 */ |
1999 | if (info->IsMoxaMustChipFlag == MOXA_MUST_MU860_HWID && (*status & MOXA_MUST_LSR_RERR)) | 2073 | if (info->IsMoxaMustChipFlag == MOXA_MUST_MU860_HWID && |
2074 | (*status & MOXA_MUST_LSR_RERR)) | ||
2000 | goto intr_old; | 2075 | goto intr_old; |
2001 | // above add by Victor Yu. 02-14-2004 | 2076 | /* above add by Victor Yu. 02-14-2004 */ |
2002 | if (*status & MOXA_MUST_LSR_RERR) | 2077 | if (*status & MOXA_MUST_LSR_RERR) |
2003 | goto intr_old; | 2078 | goto intr_old; |
2004 | 2079 | ||
2005 | gdl = inb(info->base + MOXA_MUST_GDL_REGISTER); | 2080 | gdl = inb(info->base + MOXA_MUST_GDL_REGISTER); |
2006 | 2081 | ||
2007 | if (info->IsMoxaMustChipFlag == MOXA_MUST_MU150_HWID) // add by Victor Yu. 02-11-2004 | 2082 | /* add by Victor Yu. 02-11-2004 */ |
2083 | if (info->IsMoxaMustChipFlag == MOXA_MUST_MU150_HWID) | ||
2008 | gdl &= MOXA_MUST_GDL_MASK; | 2084 | gdl &= MOXA_MUST_GDL_MASK; |
2009 | if (gdl >= recv_room) { | 2085 | if (gdl >= recv_room) { |
2010 | if (!info->ldisc_stop_rx) { | 2086 | if (!info->ldisc_stop_rx) { |
2011 | //mxser_throttle(tty); | 2087 | /* mxser_throttle(tty); */ |
2012 | mxser_stoprx(tty); | 2088 | mxser_stoprx(tty); |
2013 | } | 2089 | } |
2014 | //return; | 2090 | /* return; */ |
2015 | } | 2091 | } |
2016 | while (gdl--) { | 2092 | while (gdl--) { |
2017 | ch = inb(info->base + UART_RX); | 2093 | ch = inb(info->base + UART_RX); |
2018 | tty_insert_flip_char(tty, ch, 0); | 2094 | tty_insert_flip_char(tty, ch, 0); |
2019 | cnt++; | 2095 | cnt++; |
2020 | /* | 2096 | /* |
2021 | if((cnt>=HI_WATER) && (info->stop_rx==0)){ | 2097 | if ((cnt >= HI_WATER) && (info->stop_rx == 0)) { |
2022 | mxser_stoprx(tty); | 2098 | mxser_stoprx(tty); |
2023 | info->stop_rx=1; | 2099 | info->stop_rx = 1; |
2024 | break; | 2100 | break; |
2025 | } */ | 2101 | } */ |
2026 | } | 2102 | } |
2027 | goto end_intr; | 2103 | goto end_intr; |
2028 | } | 2104 | } |
2029 | intr_old: | 2105 | intr_old: |
2030 | // above add by Victor Yu. 09-02-2002 | 2106 | /* above add by Victor Yu. 09-02-2002 */ |
2031 | 2107 | ||
2032 | do { | 2108 | do { |
2033 | if (max-- < 0) | 2109 | if (max-- < 0) |
2034 | break; | 2110 | break; |
2035 | /* | 2111 | /* |
2036 | if((cnt>=HI_WATER) && (info->stop_rx==0)){ | 2112 | if ((cnt >= HI_WATER) && (info->stop_rx == 0)) { |
2037 | mxser_stoprx(tty); | 2113 | mxser_stoprx(tty); |
2038 | info->stop_rx=1; | 2114 | info->stop_rx=1; |
2039 | break; | 2115 | break; |
@@ -2041,11 +2117,11 @@ intr_old: | |||
2041 | */ | 2117 | */ |
2042 | 2118 | ||
2043 | ch = inb(info->base + UART_RX); | 2119 | ch = inb(info->base + UART_RX); |
2044 | // following add by Victor Yu. 09-02-2002 | 2120 | /* following add by Victor Yu. 09-02-2002 */ |
2045 | if (info->IsMoxaMustChipFlag && (*status & UART_LSR_OE) /*&& !(*status&UART_LSR_DR) */ ) | 2121 | if (info->IsMoxaMustChipFlag && (*status & UART_LSR_OE) /*&& !(*status&UART_LSR_DR) */ ) |
2046 | outb(0x23, info->base + UART_FCR); | 2122 | outb(0x23, info->base + UART_FCR); |
2047 | *status &= info->read_status_mask; | 2123 | *status &= info->read_status_mask; |
2048 | // above add by Victor Yu. 09-02-2002 | 2124 | /* above add by Victor Yu. 09-02-2002 */ |
2049 | if (*status & info->ignore_status_mask) { | 2125 | if (*status & info->ignore_status_mask) { |
2050 | if (++ignored > 100) | 2126 | if (++ignored > 100) |
2051 | break; | 2127 | break; |
@@ -2080,7 +2156,7 @@ intr_old: | |||
2080 | cnt++; | 2156 | cnt++; |
2081 | if (cnt >= recv_room) { | 2157 | if (cnt >= recv_room) { |
2082 | if (!info->ldisc_stop_rx) { | 2158 | if (!info->ldisc_stop_rx) { |
2083 | //mxser_throttle(tty); | 2159 | /* mxser_throttle(tty); */ |
2084 | mxser_stoprx(tty); | 2160 | mxser_stoprx(tty); |
2085 | } | 2161 | } |
2086 | break; | 2162 | break; |
@@ -2088,21 +2164,20 @@ intr_old: | |||
2088 | 2164 | ||
2089 | } | 2165 | } |
2090 | 2166 | ||
2091 | // following add by Victor Yu. 09-02-2002 | 2167 | /* following add by Victor Yu. 09-02-2002 */ |
2092 | if (info->IsMoxaMustChipFlag) | 2168 | if (info->IsMoxaMustChipFlag) |
2093 | break; | 2169 | break; |
2094 | // above add by Victor Yu. 09-02-2002 | 2170 | /* above add by Victor Yu. 09-02-2002 */ |
2095 | 2171 | ||
2096 | /* mask by Victor Yu. 09-02-2002 | 2172 | /* mask by Victor Yu. 09-02-2002 |
2097 | *status = inb(info->base + UART_LSR) & info->read_status_mask; | 2173 | *status = inb(info->base + UART_LSR) & info->read_status_mask; |
2098 | */ | 2174 | */ |
2099 | // following add by Victor Yu. 09-02-2002 | 2175 | /* following add by Victor Yu. 09-02-2002 */ |
2100 | *status = inb(info->base + UART_LSR); | 2176 | *status = inb(info->base + UART_LSR); |
2101 | // above add by Victor Yu. 09-02-2002 | 2177 | /* above add by Victor Yu. 09-02-2002 */ |
2102 | } while (*status & UART_LSR_DR); | 2178 | } while (*status & UART_LSR_DR); |
2103 | 2179 | ||
2104 | end_intr: // add by Victor Yu. 09-02-2002 | 2180 | end_intr: /* add by Victor Yu. 09-02-2002 */ |
2105 | |||
2106 | mxvar_log.rxcnt[info->port] += cnt; | 2181 | mxvar_log.rxcnt[info->port] += cnt; |
2107 | info->mon_data.rxcnt += cnt; | 2182 | info->mon_data.rxcnt += cnt; |
2108 | info->mon_data.up_rxcnt += cnt; | 2183 | info->mon_data.up_rxcnt += cnt; |
@@ -2137,7 +2212,10 @@ static void mxser_transmit_chars(struct mxser_struct *info) | |||
2137 | return; | 2212 | return; |
2138 | } | 2213 | } |
2139 | 2214 | ||
2140 | if ((info->xmit_cnt <= 0) || info->tty->stopped || (info->tty->hw_stopped && (info->type != PORT_16550A) && (!info->IsMoxaMustChipFlag))) { | 2215 | if ((info->xmit_cnt <= 0) || info->tty->stopped || |
2216 | (info->tty->hw_stopped && | ||
2217 | (info->type != PORT_16550A) && | ||
2218 | (!info->IsMoxaMustChipFlag))) { | ||
2141 | info->IER &= ~UART_IER_THRI; | 2219 | info->IER &= ~UART_IER_THRI; |
2142 | outb(info->IER, info->base + UART_IER); | 2220 | outb(info->IER, info->base + UART_IER); |
2143 | spin_unlock_irqrestore(&info->slock, flags); | 2221 | spin_unlock_irqrestore(&info->slock, flags); |
@@ -2147,17 +2225,18 @@ static void mxser_transmit_chars(struct mxser_struct *info) | |||
2147 | cnt = info->xmit_cnt; | 2225 | cnt = info->xmit_cnt; |
2148 | count = info->xmit_fifo_size; | 2226 | count = info->xmit_fifo_size; |
2149 | do { | 2227 | do { |
2150 | outb(info->xmit_buf[info->xmit_tail++], info->base + UART_TX); | 2228 | outb(info->xmit_buf[info->xmit_tail++], |
2229 | info->base + UART_TX); | ||
2151 | info->xmit_tail = info->xmit_tail & (SERIAL_XMIT_SIZE - 1); | 2230 | info->xmit_tail = info->xmit_tail & (SERIAL_XMIT_SIZE - 1); |
2152 | if (--info->xmit_cnt <= 0) | 2231 | if (--info->xmit_cnt <= 0) |
2153 | break; | 2232 | break; |
2154 | } while (--count > 0); | 2233 | } while (--count > 0); |
2155 | mxvar_log.txcnt[info->port] += (cnt - info->xmit_cnt); | 2234 | mxvar_log.txcnt[info->port] += (cnt - info->xmit_cnt); |
2156 | 2235 | ||
2157 | // added by James 03-12-2004. | 2236 | /* added by James 03-12-2004. */ |
2158 | info->mon_data.txcnt += (cnt - info->xmit_cnt); | 2237 | info->mon_data.txcnt += (cnt - info->xmit_cnt); |
2159 | info->mon_data.up_txcnt += (cnt - info->xmit_cnt); | 2238 | info->mon_data.up_txcnt += (cnt - info->xmit_cnt); |
2160 | // (above) added by James. | 2239 | /* (above) added by James. */ |
2161 | 2240 | ||
2162 | /* added by casper 1/11/2000 */ | 2241 | /* added by casper 1/11/2000 */ |
2163 | info->icount.tx += (cnt - info->xmit_cnt); | 2242 | info->icount.tx += (cnt - info->xmit_cnt); |
@@ -2188,7 +2267,6 @@ static void mxser_check_modem_status(struct mxser_struct *info, int status) | |||
2188 | info->mon_data.modem_status = status; | 2267 | info->mon_data.modem_status = status; |
2189 | wake_up_interruptible(&info->delta_msr_wait); | 2268 | wake_up_interruptible(&info->delta_msr_wait); |
2190 | 2269 | ||
2191 | |||
2192 | if ((info->flags & ASYNC_CHECK_CD) && (status & UART_MSR_DDCD)) { | 2270 | if ((info->flags & ASYNC_CHECK_CD) && (status & UART_MSR_DDCD)) { |
2193 | if (status & UART_MSR_DCD) | 2271 | if (status & UART_MSR_DCD) |
2194 | wake_up_interruptible(&info->open_wait); | 2272 | wake_up_interruptible(&info->open_wait); |
@@ -2200,7 +2278,8 @@ static void mxser_check_modem_status(struct mxser_struct *info, int status) | |||
2200 | if (status & UART_MSR_CTS) { | 2278 | if (status & UART_MSR_CTS) { |
2201 | info->tty->hw_stopped = 0; | 2279 | info->tty->hw_stopped = 0; |
2202 | 2280 | ||
2203 | if ((info->type != PORT_16550A) && (!info->IsMoxaMustChipFlag)) { | 2281 | if ((info->type != PORT_16550A) && |
2282 | (!info->IsMoxaMustChipFlag)) { | ||
2204 | info->IER |= UART_IER_THRI; | 2283 | info->IER |= UART_IER_THRI; |
2205 | outb(info->IER, info->base + UART_IER); | 2284 | outb(info->IER, info->base + UART_IER); |
2206 | } | 2285 | } |
@@ -2209,7 +2288,8 @@ static void mxser_check_modem_status(struct mxser_struct *info, int status) | |||
2209 | } else { | 2288 | } else { |
2210 | if (!(status & UART_MSR_CTS)) { | 2289 | if (!(status & UART_MSR_CTS)) { |
2211 | info->tty->hw_stopped = 1; | 2290 | info->tty->hw_stopped = 1; |
2212 | if ((info->type != PORT_16550A) && (!info->IsMoxaMustChipFlag)) { | 2291 | if ((info->type != PORT_16550A) && |
2292 | (!info->IsMoxaMustChipFlag)) { | ||
2213 | info->IER &= ~UART_IER_THRI; | 2293 | info->IER &= ~UART_IER_THRI; |
2214 | outb(info->IER, info->base + UART_IER); | 2294 | outb(info->IER, info->base + UART_IER); |
2215 | } | 2295 | } |
@@ -2231,7 +2311,7 @@ static int mxser_block_til_ready(struct tty_struct *tty, struct file *filp, stru | |||
2231 | */ | 2311 | */ |
2232 | if ((filp->f_flags & O_NONBLOCK) || (tty->flags & (1 << TTY_IO_ERROR))) { | 2312 | if ((filp->f_flags & O_NONBLOCK) || (tty->flags & (1 << TTY_IO_ERROR))) { |
2233 | info->flags |= ASYNC_NORMAL_ACTIVE; | 2313 | info->flags |= ASYNC_NORMAL_ACTIVE; |
2234 | return (0); | 2314 | return 0; |
2235 | } | 2315 | } |
2236 | 2316 | ||
2237 | if (tty->termios->c_cflag & CLOCAL) | 2317 | if (tty->termios->c_cflag & CLOCAL) |
@@ -2254,7 +2334,8 @@ static int mxser_block_til_ready(struct tty_struct *tty, struct file *filp, stru | |||
2254 | info->blocked_open++; | 2334 | info->blocked_open++; |
2255 | while (1) { | 2335 | while (1) { |
2256 | spin_lock_irqsave(&info->slock, flags); | 2336 | spin_lock_irqsave(&info->slock, flags); |
2257 | outb(inb(info->base + UART_MCR) | UART_MCR_DTR | UART_MCR_RTS, info->base + UART_MCR); | 2337 | outb(inb(info->base + UART_MCR) | |
2338 | UART_MCR_DTR | UART_MCR_RTS, info->base + UART_MCR); | ||
2258 | spin_unlock_irqrestore(&info->slock, flags); | 2339 | spin_unlock_irqrestore(&info->slock, flags); |
2259 | set_current_state(TASK_INTERRUPTIBLE); | 2340 | set_current_state(TASK_INTERRUPTIBLE); |
2260 | if (tty_hung_up_p(filp) || !(info->flags & ASYNC_INITIALIZED)) { | 2341 | if (tty_hung_up_p(filp) || !(info->flags & ASYNC_INITIALIZED)) { |
@@ -2264,7 +2345,9 @@ static int mxser_block_til_ready(struct tty_struct *tty, struct file *filp, stru | |||
2264 | retval = -ERESTARTSYS; | 2345 | retval = -ERESTARTSYS; |
2265 | break; | 2346 | break; |
2266 | } | 2347 | } |
2267 | if (!(info->flags & ASYNC_CLOSING) && (do_clocal || (inb(info->base + UART_MSR) & UART_MSR_DCD))) | 2348 | if (!(info->flags & ASYNC_CLOSING) && |
2349 | (do_clocal || | ||
2350 | (inb(info->base + UART_MSR) & UART_MSR_DCD))) | ||
2268 | break; | 2351 | break; |
2269 | if (signal_pending(current)) { | 2352 | if (signal_pending(current)) { |
2270 | retval = -ERESTARTSYS; | 2353 | retval = -ERESTARTSYS; |
@@ -2278,27 +2361,26 @@ static int mxser_block_til_ready(struct tty_struct *tty, struct file *filp, stru | |||
2278 | info->count++; | 2361 | info->count++; |
2279 | info->blocked_open--; | 2362 | info->blocked_open--; |
2280 | if (retval) | 2363 | if (retval) |
2281 | return (retval); | 2364 | return retval; |
2282 | info->flags |= ASYNC_NORMAL_ACTIVE; | 2365 | info->flags |= ASYNC_NORMAL_ACTIVE; |
2283 | return (0); | 2366 | return 0; |
2284 | } | 2367 | } |
2285 | 2368 | ||
2286 | static int mxser_startup(struct mxser_struct *info) | 2369 | static int mxser_startup(struct mxser_struct *info) |
2287 | { | 2370 | { |
2288 | |||
2289 | unsigned long page; | 2371 | unsigned long page; |
2290 | unsigned long flags; | 2372 | unsigned long flags; |
2291 | 2373 | ||
2292 | page = __get_free_page(GFP_KERNEL); | 2374 | page = __get_free_page(GFP_KERNEL); |
2293 | if (!page) | 2375 | if (!page) |
2294 | return (-ENOMEM); | 2376 | return -ENOMEM; |
2295 | 2377 | ||
2296 | spin_lock_irqsave(&info->slock, flags); | 2378 | spin_lock_irqsave(&info->slock, flags); |
2297 | 2379 | ||
2298 | if (info->flags & ASYNC_INITIALIZED) { | 2380 | if (info->flags & ASYNC_INITIALIZED) { |
2299 | free_page(page); | 2381 | free_page(page); |
2300 | spin_unlock_irqrestore(&info->slock, flags); | 2382 | spin_unlock_irqrestore(&info->slock, flags); |
2301 | return (0); | 2383 | return 0; |
2302 | } | 2384 | } |
2303 | 2385 | ||
2304 | if (!info->base || !info->type) { | 2386 | if (!info->base || !info->type) { |
@@ -2306,7 +2388,7 @@ static int mxser_startup(struct mxser_struct *info) | |||
2306 | set_bit(TTY_IO_ERROR, &info->tty->flags); | 2388 | set_bit(TTY_IO_ERROR, &info->tty->flags); |
2307 | free_page(page); | 2389 | free_page(page); |
2308 | spin_unlock_irqrestore(&info->slock, flags); | 2390 | spin_unlock_irqrestore(&info->slock, flags); |
2309 | return (0); | 2391 | return 0; |
2310 | } | 2392 | } |
2311 | if (info->xmit_buf) | 2393 | if (info->xmit_buf) |
2312 | free_page(page); | 2394 | free_page(page); |
@@ -2318,9 +2400,12 @@ static int mxser_startup(struct mxser_struct *info) | |||
2318 | * (they will be reenabled in mxser_change_speed()) | 2400 | * (they will be reenabled in mxser_change_speed()) |
2319 | */ | 2401 | */ |
2320 | if (info->IsMoxaMustChipFlag) | 2402 | if (info->IsMoxaMustChipFlag) |
2321 | outb((UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT | MOXA_MUST_FCR_GDA_MODE_ENABLE), info->base + UART_FCR); | 2403 | outb((UART_FCR_CLEAR_RCVR | |
2404 | UART_FCR_CLEAR_XMIT | | ||
2405 | MOXA_MUST_FCR_GDA_MODE_ENABLE), info->base + UART_FCR); | ||
2322 | else | 2406 | else |
2323 | outb((UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT), info->base + UART_FCR); | 2407 | outb((UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT), |
2408 | info->base + UART_FCR); | ||
2324 | 2409 | ||
2325 | /* | 2410 | /* |
2326 | * At this point there's no way the LSR could still be 0xFF; | 2411 | * At this point there's no way the LSR could still be 0xFF; |
@@ -2332,9 +2417,9 @@ static int mxser_startup(struct mxser_struct *info) | |||
2332 | if (capable(CAP_SYS_ADMIN)) { | 2417 | if (capable(CAP_SYS_ADMIN)) { |
2333 | if (info->tty) | 2418 | if (info->tty) |
2334 | set_bit(TTY_IO_ERROR, &info->tty->flags); | 2419 | set_bit(TTY_IO_ERROR, &info->tty->flags); |
2335 | return (0); | 2420 | return 0; |
2336 | } else | 2421 | } else |
2337 | return (-ENODEV); | 2422 | return -ENODEV; |
2338 | } | 2423 | } |
2339 | 2424 | ||
2340 | /* | 2425 | /* |
@@ -2356,12 +2441,12 @@ static int mxser_startup(struct mxser_struct *info) | |||
2356 | * Finally, enable interrupts | 2441 | * Finally, enable interrupts |
2357 | */ | 2442 | */ |
2358 | info->IER = UART_IER_MSI | UART_IER_RLSI | UART_IER_RDI; | 2443 | info->IER = UART_IER_MSI | UART_IER_RLSI | UART_IER_RDI; |
2359 | // info->IER = UART_IER_RLSI | UART_IER_RDI; | 2444 | /* info->IER = UART_IER_RLSI | UART_IER_RDI; */ |
2360 | 2445 | ||
2361 | // following add by Victor Yu. 08-30-2002 | 2446 | /* following add by Victor Yu. 08-30-2002 */ |
2362 | if (info->IsMoxaMustChipFlag) | 2447 | if (info->IsMoxaMustChipFlag) |
2363 | info->IER |= MOXA_MUST_IER_EGDAI; | 2448 | info->IER |= MOXA_MUST_IER_EGDAI; |
2364 | // above add by Victor Yu. 08-30-2002 | 2449 | /* above add by Victor Yu. 08-30-2002 */ |
2365 | outb(info->IER, info->base + UART_IER); /* enable interrupts */ | 2450 | outb(info->IER, info->base + UART_IER); /* enable interrupts */ |
2366 | 2451 | ||
2367 | /* | 2452 | /* |
@@ -2383,7 +2468,7 @@ static int mxser_startup(struct mxser_struct *info) | |||
2383 | mxser_change_speed(info, NULL); | 2468 | mxser_change_speed(info, NULL); |
2384 | 2469 | ||
2385 | info->flags |= ASYNC_INITIALIZED; | 2470 | info->flags |= ASYNC_INITIALIZED; |
2386 | return (0); | 2471 | return 0; |
2387 | } | 2472 | } |
2388 | 2473 | ||
2389 | /* | 2474 | /* |
@@ -2421,12 +2506,15 @@ static void mxser_shutdown(struct mxser_struct *info) | |||
2421 | outb(info->MCR, info->base + UART_MCR); | 2506 | outb(info->MCR, info->base + UART_MCR); |
2422 | 2507 | ||
2423 | /* clear Rx/Tx FIFO's */ | 2508 | /* clear Rx/Tx FIFO's */ |
2424 | // following add by Victor Yu. 08-30-2002 | 2509 | /* following add by Victor Yu. 08-30-2002 */ |
2425 | if (info->IsMoxaMustChipFlag) | 2510 | if (info->IsMoxaMustChipFlag) |
2426 | outb((UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT | MOXA_MUST_FCR_GDA_MODE_ENABLE), info->base + UART_FCR); | 2511 | outb((UART_FCR_CLEAR_RCVR | |
2512 | UART_FCR_CLEAR_XMIT | | ||
2513 | MOXA_MUST_FCR_GDA_MODE_ENABLE), info->base + UART_FCR); | ||
2427 | else | 2514 | else |
2428 | // above add by Victor Yu. 08-30-2002 | 2515 | /* above add by Victor Yu. 08-30-2002 */ |
2429 | outb((UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT), info->base + UART_FCR); | 2516 | outb((UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT), |
2517 | info->base + UART_FCR); | ||
2430 | 2518 | ||
2431 | /* read data port to reset things */ | 2519 | /* read data port to reset things */ |
2432 | (void) inb(info->base + UART_RX); | 2520 | (void) inb(info->base + UART_RX); |
@@ -2436,11 +2524,10 @@ static void mxser_shutdown(struct mxser_struct *info) | |||
2436 | 2524 | ||
2437 | info->flags &= ~ASYNC_INITIALIZED; | 2525 | info->flags &= ~ASYNC_INITIALIZED; |
2438 | 2526 | ||
2439 | // following add by Victor Yu. 09-23-2002 | 2527 | /* following add by Victor Yu. 09-23-2002 */ |
2440 | if (info->IsMoxaMustChipFlag) { | 2528 | if (info->IsMoxaMustChipFlag) |
2441 | SET_MOXA_MUST_NO_SOFTWARE_FLOW_CONTROL(info->base); | 2529 | SET_MOXA_MUST_NO_SOFTWARE_FLOW_CONTROL(info->base); |
2442 | } | 2530 | /* above add by Victor Yu. 09-23-2002 */ |
2443 | // above add by Victor Yu. 09-23-2002 | ||
2444 | 2531 | ||
2445 | spin_unlock_irqrestore(&info->slock, flags); | 2532 | spin_unlock_irqrestore(&info->slock, flags); |
2446 | } | 2533 | } |
@@ -2457,14 +2544,12 @@ static int mxser_change_speed(struct mxser_struct *info, struct termios *old_ter | |||
2457 | long baud; | 2544 | long baud; |
2458 | unsigned long flags; | 2545 | unsigned long flags; |
2459 | 2546 | ||
2460 | |||
2461 | if (!info->tty || !info->tty->termios) | 2547 | if (!info->tty || !info->tty->termios) |
2462 | return ret; | 2548 | return ret; |
2463 | cflag = info->tty->termios->c_cflag; | 2549 | cflag = info->tty->termios->c_cflag; |
2464 | if (!(info->base)) | 2550 | if (!(info->base)) |
2465 | return ret; | 2551 | return ret; |
2466 | 2552 | ||
2467 | |||
2468 | #ifndef B921600 | 2553 | #ifndef B921600 |
2469 | #define B921600 (B460800 +1) | 2554 | #define B921600 (B460800 +1) |
2470 | #endif | 2555 | #endif |
@@ -2559,9 +2644,8 @@ static int mxser_change_speed(struct mxser_struct *info, struct termios *old_ter | |||
2559 | cval |= 0x04; | 2644 | cval |= 0x04; |
2560 | if (cflag & PARENB) | 2645 | if (cflag & PARENB) |
2561 | cval |= UART_LCR_PARITY; | 2646 | cval |= UART_LCR_PARITY; |
2562 | if (!(cflag & PARODD)) { | 2647 | if (!(cflag & PARODD)) |
2563 | cval |= UART_LCR_EPAR; | 2648 | cval |= UART_LCR_EPAR; |
2564 | } | ||
2565 | if (cflag & CMSPAR) | 2649 | if (cflag & CMSPAR) |
2566 | cval |= UART_LCR_SPAR; | 2650 | cval |= UART_LCR_SPAR; |
2567 | 2651 | ||
@@ -2574,13 +2658,12 @@ static int mxser_change_speed(struct mxser_struct *info, struct termios *old_ter | |||
2574 | fcr = 0; | 2658 | fcr = 0; |
2575 | } else { | 2659 | } else { |
2576 | fcr = UART_FCR_ENABLE_FIFO; | 2660 | fcr = UART_FCR_ENABLE_FIFO; |
2577 | // following add by Victor Yu. 08-30-2002 | 2661 | /* following add by Victor Yu. 08-30-2002 */ |
2578 | if (info->IsMoxaMustChipFlag) { | 2662 | if (info->IsMoxaMustChipFlag) { |
2579 | fcr |= MOXA_MUST_FCR_GDA_MODE_ENABLE; | 2663 | fcr |= MOXA_MUST_FCR_GDA_MODE_ENABLE; |
2580 | SET_MOXA_MUST_FIFO_VALUE(info); | 2664 | SET_MOXA_MUST_FIFO_VALUE(info); |
2581 | } else { | 2665 | } else { |
2582 | // above add by Victor Yu. 08-30-2002 | 2666 | /* above add by Victor Yu. 08-30-2002 */ |
2583 | |||
2584 | switch (info->rx_trigger) { | 2667 | switch (info->rx_trigger) { |
2585 | case 1: | 2668 | case 1: |
2586 | fcr |= UART_FCR_TRIGGER_1; | 2669 | fcr |= UART_FCR_TRIGGER_1; |
@@ -2606,22 +2689,24 @@ static int mxser_change_speed(struct mxser_struct *info, struct termios *old_ter | |||
2606 | info->IER |= UART_IER_MSI; | 2689 | info->IER |= UART_IER_MSI; |
2607 | if ((info->type == PORT_16550A) || (info->IsMoxaMustChipFlag)) { | 2690 | if ((info->type == PORT_16550A) || (info->IsMoxaMustChipFlag)) { |
2608 | info->MCR |= UART_MCR_AFE; | 2691 | info->MCR |= UART_MCR_AFE; |
2609 | //status = mxser_get_msr(info->base, 0, info->port); | 2692 | /* status = mxser_get_msr(info->base, 0, info->port); */ |
2610 | /* save_flags(flags); | 2693 | /* |
2694 | save_flags(flags); | ||
2611 | cli(); | 2695 | cli(); |
2612 | status = inb(baseaddr + UART_MSR); | 2696 | status = inb(baseaddr + UART_MSR); |
2613 | restore_flags(flags);*/ | 2697 | restore_flags(flags); |
2614 | //mxser_check_modem_status(info, status); | 2698 | */ |
2699 | /* mxser_check_modem_status(info, status); */ | ||
2615 | } else { | 2700 | } else { |
2616 | //status = mxser_get_msr(info->base, 0, info->port); | 2701 | /* status = mxser_get_msr(info->base, 0, info->port); */ |
2617 | 2702 | /* MX_LOCK(&info->slock); */ | |
2618 | //MX_LOCK(&info->slock); | ||
2619 | status = inb(info->base + UART_MSR); | 2703 | status = inb(info->base + UART_MSR); |
2620 | //MX_UNLOCK(&info->slock); | 2704 | /* MX_UNLOCK(&info->slock); */ |
2621 | if (info->tty->hw_stopped) { | 2705 | if (info->tty->hw_stopped) { |
2622 | if (status & UART_MSR_CTS) { | 2706 | if (status & UART_MSR_CTS) { |
2623 | info->tty->hw_stopped = 0; | 2707 | info->tty->hw_stopped = 0; |
2624 | if ((info->type != PORT_16550A) && (!info->IsMoxaMustChipFlag)) { | 2708 | if ((info->type != PORT_16550A) && |
2709 | (!info->IsMoxaMustChipFlag)) { | ||
2625 | info->IER |= UART_IER_THRI; | 2710 | info->IER |= UART_IER_THRI; |
2626 | outb(info->IER, info->base + UART_IER); | 2711 | outb(info->IER, info->base + UART_IER); |
2627 | } | 2712 | } |
@@ -2630,7 +2715,8 @@ static int mxser_change_speed(struct mxser_struct *info, struct termios *old_ter | |||
2630 | } else { | 2715 | } else { |
2631 | if (!(status & UART_MSR_CTS)) { | 2716 | if (!(status & UART_MSR_CTS)) { |
2632 | info->tty->hw_stopped = 1; | 2717 | info->tty->hw_stopped = 1; |
2633 | if ((info->type != PORT_16550A) && (!info->IsMoxaMustChipFlag)) { | 2718 | if ((info->type != PORT_16550A) && |
2719 | (!info->IsMoxaMustChipFlag)) { | ||
2634 | info->IER &= ~UART_IER_THRI; | 2720 | info->IER &= ~UART_IER_THRI; |
2635 | outb(info->IER, info->base + UART_IER); | 2721 | outb(info->IER, info->base + UART_IER); |
2636 | } | 2722 | } |
@@ -2668,11 +2754,17 @@ static int mxser_change_speed(struct mxser_struct *info, struct termios *old_ter | |||
2668 | * overruns too. (For real raw support). | 2754 | * overruns too. (For real raw support). |
2669 | */ | 2755 | */ |
2670 | if (I_IGNPAR(info->tty)) { | 2756 | if (I_IGNPAR(info->tty)) { |
2671 | info->ignore_status_mask |= UART_LSR_OE | UART_LSR_PE | UART_LSR_FE; | 2757 | info->ignore_status_mask |= |
2672 | info->read_status_mask |= UART_LSR_OE | UART_LSR_PE | UART_LSR_FE; | 2758 | UART_LSR_OE | |
2759 | UART_LSR_PE | | ||
2760 | UART_LSR_FE; | ||
2761 | info->read_status_mask |= | ||
2762 | UART_LSR_OE | | ||
2763 | UART_LSR_PE | | ||
2764 | UART_LSR_FE; | ||
2673 | } | 2765 | } |
2674 | } | 2766 | } |
2675 | // following add by Victor Yu. 09-02-2002 | 2767 | /* following add by Victor Yu. 09-02-2002 */ |
2676 | if (info->IsMoxaMustChipFlag) { | 2768 | if (info->IsMoxaMustChipFlag) { |
2677 | spin_lock_irqsave(&info->slock, flags); | 2769 | spin_lock_irqsave(&info->slock, flags); |
2678 | SET_MOXA_MUST_XON1_VALUE(info->base, START_CHAR(info->tty)); | 2770 | SET_MOXA_MUST_XON1_VALUE(info->base, START_CHAR(info->tty)); |
@@ -2698,7 +2790,7 @@ static int mxser_change_speed(struct mxser_struct *info, struct termios *old_ter | |||
2698 | */ | 2790 | */ |
2699 | spin_unlock_irqrestore(&info->slock, flags); | 2791 | spin_unlock_irqrestore(&info->slock, flags); |
2700 | } | 2792 | } |
2701 | // above add by Victor Yu. 09-02-2002 | 2793 | /* above add by Victor Yu. 09-02-2002 */ |
2702 | 2794 | ||
2703 | 2795 | ||
2704 | outb(fcr, info->base + UART_FCR); /* set fcr */ | 2796 | outb(fcr, info->base + UART_FCR); /* set fcr */ |
@@ -2729,10 +2821,8 @@ static int mxser_set_baud(struct mxser_struct *info, long newspd) | |||
2729 | quot = (2 * info->baud_base / 269); | 2821 | quot = (2 * info->baud_base / 269); |
2730 | } else if (newspd) { | 2822 | } else if (newspd) { |
2731 | quot = info->baud_base / newspd; | 2823 | quot = info->baud_base / newspd; |
2732 | |||
2733 | if (quot == 0) | 2824 | if (quot == 0) |
2734 | quot = 1; | 2825 | quot = 1; |
2735 | |||
2736 | } else { | 2826 | } else { |
2737 | quot = 0; | 2827 | quot = 0; |
2738 | } | 2828 | } |
@@ -2765,8 +2855,6 @@ static int mxser_set_baud(struct mxser_struct *info, long newspd) | |||
2765 | return ret; | 2855 | return ret; |
2766 | } | 2856 | } |
2767 | 2857 | ||
2768 | |||
2769 | |||
2770 | /* | 2858 | /* |
2771 | * ------------------------------------------------------------ | 2859 | * ------------------------------------------------------------ |
2772 | * friends of mxser_ioctl() | 2860 | * friends of mxser_ioctl() |
@@ -2777,7 +2865,7 @@ static int mxser_get_serial_info(struct mxser_struct *info, struct serial_struct | |||
2777 | struct serial_struct tmp; | 2865 | struct serial_struct tmp; |
2778 | 2866 | ||
2779 | if (!retinfo) | 2867 | if (!retinfo) |
2780 | return (-EFAULT); | 2868 | return -EFAULT; |
2781 | memset(&tmp, 0, sizeof(tmp)); | 2869 | memset(&tmp, 0, sizeof(tmp)); |
2782 | tmp.type = info->type; | 2870 | tmp.type = info->type; |
2783 | tmp.line = info->port; | 2871 | tmp.line = info->port; |
@@ -2791,7 +2879,7 @@ static int mxser_get_serial_info(struct mxser_struct *info, struct serial_struct | |||
2791 | tmp.hub6 = 0; | 2879 | tmp.hub6 = 0; |
2792 | if (copy_to_user(retinfo, &tmp, sizeof(*retinfo))) | 2880 | if (copy_to_user(retinfo, &tmp, sizeof(*retinfo))) |
2793 | return -EFAULT; | 2881 | return -EFAULT; |
2794 | return (0); | 2882 | return 0; |
2795 | } | 2883 | } |
2796 | 2884 | ||
2797 | static int mxser_set_serial_info(struct mxser_struct *info, struct serial_struct __user *new_info) | 2885 | static int mxser_set_serial_info(struct mxser_struct *info, struct serial_struct __user *new_info) |
@@ -2801,29 +2889,37 @@ static int mxser_set_serial_info(struct mxser_struct *info, struct serial_struct | |||
2801 | int retval = 0; | 2889 | int retval = 0; |
2802 | 2890 | ||
2803 | if (!new_info || !info->base) | 2891 | if (!new_info || !info->base) |
2804 | return (-EFAULT); | 2892 | return -EFAULT; |
2805 | if (copy_from_user(&new_serial, new_info, sizeof(new_serial))) | 2893 | if (copy_from_user(&new_serial, new_info, sizeof(new_serial))) |
2806 | return -EFAULT; | 2894 | return -EFAULT; |
2807 | 2895 | ||
2808 | if ((new_serial.irq != info->irq) || (new_serial.port != info->base) || (new_serial.custom_divisor != info->custom_divisor) || (new_serial.baud_base != info->baud_base)) | 2896 | if ((new_serial.irq != info->irq) || |
2809 | return (-EPERM); | 2897 | (new_serial.port != info->base) || |
2898 | (new_serial.custom_divisor != info->custom_divisor) || | ||
2899 | (new_serial.baud_base != info->baud_base)) | ||
2900 | return -EPERM; | ||
2810 | 2901 | ||
2811 | flags = info->flags & ASYNC_SPD_MASK; | 2902 | flags = info->flags & ASYNC_SPD_MASK; |
2812 | 2903 | ||
2813 | if (!capable(CAP_SYS_ADMIN)) { | 2904 | if (!capable(CAP_SYS_ADMIN)) { |
2814 | if ((new_serial.baud_base != info->baud_base) || (new_serial.close_delay != info->close_delay) || ((new_serial.flags & ~ASYNC_USR_MASK) != (info->flags & ~ASYNC_USR_MASK))) | 2905 | if ((new_serial.baud_base != info->baud_base) || |
2815 | return (-EPERM); | 2906 | (new_serial.close_delay != info->close_delay) || |
2816 | info->flags = ((info->flags & ~ASYNC_USR_MASK) | (new_serial.flags & ASYNC_USR_MASK)); | 2907 | ((new_serial.flags & ~ASYNC_USR_MASK) != (info->flags & ~ASYNC_USR_MASK))) |
2908 | return -EPERM; | ||
2909 | info->flags = ((info->flags & ~ASYNC_USR_MASK) | | ||
2910 | (new_serial.flags & ASYNC_USR_MASK)); | ||
2817 | } else { | 2911 | } else { |
2818 | /* | 2912 | /* |
2819 | * OK, past this point, all the error checking has been done. | 2913 | * OK, past this point, all the error checking has been done. |
2820 | * At this point, we start making changes..... | 2914 | * At this point, we start making changes..... |
2821 | */ | 2915 | */ |
2822 | info->flags = ((info->flags & ~ASYNC_FLAGS) | (new_serial.flags & ASYNC_FLAGS)); | 2916 | info->flags = ((info->flags & ~ASYNC_FLAGS) | |
2917 | (new_serial.flags & ASYNC_FLAGS)); | ||
2823 | info->close_delay = new_serial.close_delay * HZ / 100; | 2918 | info->close_delay = new_serial.close_delay * HZ / 100; |
2824 | info->closing_wait = new_serial.closing_wait * HZ / 100; | 2919 | info->closing_wait = new_serial.closing_wait * HZ / 100; |
2825 | info->tty->low_latency = (info->flags & ASYNC_LOW_LATENCY) ? 1 : 0; | 2920 | info->tty->low_latency = |
2826 | info->tty->low_latency = 0; //(info->flags & ASYNC_LOW_LATENCY) ? 1 : 0; | 2921 | (info->flags & ASYNC_LOW_LATENCY) ? 1 : 0; |
2922 | info->tty->low_latency = 0; /* (info->flags & ASYNC_LOW_LATENCY) ? 1 : 0; */ | ||
2827 | } | 2923 | } |
2828 | 2924 | ||
2829 | /* added by casper, 3/17/2000, for mouse */ | 2925 | /* added by casper, 3/17/2000, for mouse */ |
@@ -2831,7 +2927,6 @@ static int mxser_set_serial_info(struct mxser_struct *info, struct serial_struct | |||
2831 | 2927 | ||
2832 | process_txrx_fifo(info); | 2928 | process_txrx_fifo(info); |
2833 | 2929 | ||
2834 | /* */ | ||
2835 | if (info->flags & ASYNC_INITIALIZED) { | 2930 | if (info->flags & ASYNC_INITIALIZED) { |
2836 | if (flags != (info->flags & ASYNC_SPD_MASK)) { | 2931 | if (flags != (info->flags & ASYNC_SPD_MASK)) { |
2837 | mxser_change_speed(info, NULL); | 2932 | mxser_change_speed(info, NULL); |
@@ -2839,7 +2934,7 @@ static int mxser_set_serial_info(struct mxser_struct *info, struct serial_struct | |||
2839 | } else { | 2934 | } else { |
2840 | retval = mxser_startup(info); | 2935 | retval = mxser_startup(info); |
2841 | } | 2936 | } |
2842 | return (retval); | 2937 | return retval; |
2843 | } | 2938 | } |
2844 | 2939 | ||
2845 | /* | 2940 | /* |
@@ -2876,25 +2971,27 @@ static void mxser_send_break(struct mxser_struct *info, int duration) | |||
2876 | return; | 2971 | return; |
2877 | set_current_state(TASK_INTERRUPTIBLE); | 2972 | set_current_state(TASK_INTERRUPTIBLE); |
2878 | spin_lock_irqsave(&info->slock, flags); | 2973 | spin_lock_irqsave(&info->slock, flags); |
2879 | outb(inb(info->base + UART_LCR) | UART_LCR_SBC, info->base + UART_LCR); | 2974 | outb(inb(info->base + UART_LCR) | UART_LCR_SBC, |
2975 | info->base + UART_LCR); | ||
2880 | spin_unlock_irqrestore(&info->slock, flags); | 2976 | spin_unlock_irqrestore(&info->slock, flags); |
2881 | schedule_timeout(duration); | 2977 | schedule_timeout(duration); |
2882 | spin_lock_irqsave(&info->slock, flags); | 2978 | spin_lock_irqsave(&info->slock, flags); |
2883 | outb(inb(info->base + UART_LCR) & ~UART_LCR_SBC, info->base + UART_LCR); | 2979 | outb(inb(info->base + UART_LCR) & ~UART_LCR_SBC, |
2980 | info->base + UART_LCR); | ||
2884 | spin_unlock_irqrestore(&info->slock, flags); | 2981 | spin_unlock_irqrestore(&info->slock, flags); |
2885 | } | 2982 | } |
2886 | 2983 | ||
2887 | static int mxser_tiocmget(struct tty_struct *tty, struct file *file) | 2984 | static int mxser_tiocmget(struct tty_struct *tty, struct file *file) |
2888 | { | 2985 | { |
2889 | struct mxser_struct *info = (struct mxser_struct *) tty->driver_data; | 2986 | struct mxser_struct *info = tty->driver_data; |
2890 | unsigned char control, status; | 2987 | unsigned char control, status; |
2891 | unsigned long flags; | 2988 | unsigned long flags; |
2892 | 2989 | ||
2893 | 2990 | ||
2894 | if (tty->index == MXSER_PORTS) | 2991 | if (tty->index == MXSER_PORTS) |
2895 | return (-ENOIOCTLCMD); | 2992 | return -ENOIOCTLCMD; |
2896 | if (tty->flags & (1 << TTY_IO_ERROR)) | 2993 | if (tty->flags & (1 << TTY_IO_ERROR)) |
2897 | return (-EIO); | 2994 | return -EIO; |
2898 | 2995 | ||
2899 | control = info->MCR; | 2996 | control = info->MCR; |
2900 | 2997 | ||
@@ -2904,12 +3001,16 @@ static int mxser_tiocmget(struct tty_struct *tty, struct file *file) | |||
2904 | mxser_check_modem_status(info, status); | 3001 | mxser_check_modem_status(info, status); |
2905 | spin_unlock_irqrestore(&info->slock, flags); | 3002 | spin_unlock_irqrestore(&info->slock, flags); |
2906 | return ((control & UART_MCR_RTS) ? TIOCM_RTS : 0) | | 3003 | return ((control & UART_MCR_RTS) ? TIOCM_RTS : 0) | |
2907 | ((control & UART_MCR_DTR) ? TIOCM_DTR : 0) | ((status & UART_MSR_DCD) ? TIOCM_CAR : 0) | ((status & UART_MSR_RI) ? TIOCM_RNG : 0) | ((status & UART_MSR_DSR) ? TIOCM_DSR : 0) | ((status & UART_MSR_CTS) ? TIOCM_CTS : 0); | 3004 | ((control & UART_MCR_DTR) ? TIOCM_DTR : 0) | |
3005 | ((status & UART_MSR_DCD) ? TIOCM_CAR : 0) | | ||
3006 | ((status & UART_MSR_RI) ? TIOCM_RNG : 0) | | ||
3007 | ((status & UART_MSR_DSR) ? TIOCM_DSR : 0) | | ||
3008 | ((status & UART_MSR_CTS) ? TIOCM_CTS : 0); | ||
2908 | } | 3009 | } |
2909 | 3010 | ||
2910 | static int mxser_tiocmset(struct tty_struct *tty, struct file *file, unsigned int set, unsigned int clear) | 3011 | static int mxser_tiocmset(struct tty_struct *tty, struct file *file, unsigned int set, unsigned int clear) |
2911 | { | 3012 | { |
2912 | struct mxser_struct *info = (struct mxser_struct *) tty->driver_data; | 3013 | struct mxser_struct *info = tty->driver_data; |
2913 | unsigned long flags; | 3014 | unsigned long flags; |
2914 | 3015 | ||
2915 | 3016 | ||
@@ -2968,38 +3069,36 @@ static int mxser_get_ISA_conf(int cap, struct mxser_hwconf *hwconf) | |||
2968 | hwconf->board_type = MXSER_BOARD_CI104J; | 3069 | hwconf->board_type = MXSER_BOARD_CI104J; |
2969 | hwconf->ports = 4; | 3070 | hwconf->ports = 4; |
2970 | } else | 3071 | } else |
2971 | return (0); | 3072 | return 0; |
2972 | 3073 | ||
2973 | irq = 0; | 3074 | irq = 0; |
2974 | if (hwconf->ports == 2) { | 3075 | if (hwconf->ports == 2) { |
2975 | irq = regs[9] & 0xF000; | 3076 | irq = regs[9] & 0xF000; |
2976 | irq = irq | (irq >> 4); | 3077 | irq = irq | (irq >> 4); |
2977 | if (irq != (regs[9] & 0xFF00)) | 3078 | if (irq != (regs[9] & 0xFF00)) |
2978 | return (MXSER_ERR_IRQ_CONFLIT); | 3079 | return MXSER_ERR_IRQ_CONFLIT; |
2979 | } else if (hwconf->ports == 4) { | 3080 | } else if (hwconf->ports == 4) { |
2980 | irq = regs[9] & 0xF000; | 3081 | irq = regs[9] & 0xF000; |
2981 | irq = irq | (irq >> 4); | 3082 | irq = irq | (irq >> 4); |
2982 | irq = irq | (irq >> 8); | 3083 | irq = irq | (irq >> 8); |
2983 | if (irq != regs[9]) | 3084 | if (irq != regs[9]) |
2984 | return (MXSER_ERR_IRQ_CONFLIT); | 3085 | return MXSER_ERR_IRQ_CONFLIT; |
2985 | } else if (hwconf->ports == 8) { | 3086 | } else if (hwconf->ports == 8) { |
2986 | irq = regs[9] & 0xF000; | 3087 | irq = regs[9] & 0xF000; |
2987 | irq = irq | (irq >> 4); | 3088 | irq = irq | (irq >> 4); |
2988 | irq = irq | (irq >> 8); | 3089 | irq = irq | (irq >> 8); |
2989 | if ((irq != regs[9]) || (irq != regs[10])) | 3090 | if ((irq != regs[9]) || (irq != regs[10])) |
2990 | return (MXSER_ERR_IRQ_CONFLIT); | 3091 | return MXSER_ERR_IRQ_CONFLIT; |
2991 | } | 3092 | } |
2992 | 3093 | ||
2993 | if (!irq) { | 3094 | if (!irq) |
2994 | return (MXSER_ERR_IRQ); | 3095 | return MXSER_ERR_IRQ; |
2995 | } | 3096 | hwconf->irq = ((int)(irq & 0xF000) >> 12); |
2996 | hwconf->irq = ((int) (irq & 0xF000) >> 12); | ||
2997 | for (i = 0; i < 8; i++) | 3097 | for (i = 0; i < 8; i++) |
2998 | hwconf->ioaddr[i] = (int) regs[i + 1] & 0xFFF8; | 3098 | hwconf->ioaddr[i] = (int) regs[i + 1] & 0xFFF8; |
2999 | if ((regs[12] & 0x80) == 0) { | 3099 | if ((regs[12] & 0x80) == 0) |
3000 | return (MXSER_ERR_VECTOR); | 3100 | return MXSER_ERR_VECTOR; |
3001 | } | 3101 | hwconf->vector = (int)regs[11]; /* interrupt vector */ |
3002 | hwconf->vector = (int) regs[11]; /* interrupt vector */ | ||
3003 | if (id == 1) | 3102 | if (id == 1) |
3004 | hwconf->vector_mask = 0x00FF; | 3103 | hwconf->vector_mask = 0x00FF; |
3005 | else | 3104 | else |
@@ -3007,10 +3106,10 @@ static int mxser_get_ISA_conf(int cap, struct mxser_hwconf *hwconf) | |||
3007 | for (i = 7, bits = 0x0100; i >= 0; i--, bits <<= 1) { | 3106 | for (i = 7, bits = 0x0100; i >= 0; i--, bits <<= 1) { |
3008 | if (regs[12] & bits) { | 3107 | if (regs[12] & bits) { |
3009 | hwconf->baud_base[i] = 921600; | 3108 | hwconf->baud_base[i] = 921600; |
3010 | hwconf->MaxCanSetBaudRate[i] = 921600; // add by Victor Yu. 09-04-2002 | 3109 | hwconf->MaxCanSetBaudRate[i] = 921600; /* add by Victor Yu. 09-04-2002 */ |
3011 | } else { | 3110 | } else { |
3012 | hwconf->baud_base[i] = 115200; | 3111 | hwconf->baud_base[i] = 115200; |
3013 | hwconf->MaxCanSetBaudRate[i] = 115200; // add by Victor Yu. 09-04-2002 | 3112 | hwconf->MaxCanSetBaudRate[i] = 115200; /* add by Victor Yu. 09-04-2002 */ |
3014 | } | 3113 | } |
3015 | } | 3114 | } |
3016 | scratch2 = inb(cap + UART_LCR) & (~UART_LCR_DLAB); | 3115 | scratch2 = inb(cap + UART_LCR) & (~UART_LCR_DLAB); |
@@ -3030,7 +3129,7 @@ static int mxser_get_ISA_conf(int cap, struct mxser_hwconf *hwconf) | |||
3030 | hwconf->ports = 4; | 3129 | hwconf->ports = 4; |
3031 | request_region(hwconf->ioaddr[0], 8 * hwconf->ports, "mxser(IO)"); | 3130 | request_region(hwconf->ioaddr[0], 8 * hwconf->ports, "mxser(IO)"); |
3032 | request_region(hwconf->vector, 1, "mxser(vector)"); | 3131 | request_region(hwconf->vector, 1, "mxser(vector)"); |
3033 | return (hwconf->ports); | 3132 | return hwconf->ports; |
3034 | } | 3133 | } |
3035 | 3134 | ||
3036 | #define CHIP_SK 0x01 /* Serial Data Clock in Eprom */ | 3135 | #define CHIP_SK 0x01 /* Serial Data Clock in Eprom */ |
@@ -3053,7 +3152,7 @@ static int mxser_read_register(int port, unsigned short *regs) | |||
3053 | 3152 | ||
3054 | id = mxser_program_mode(port); | 3153 | id = mxser_program_mode(port); |
3055 | if (id < 0) | 3154 | if (id < 0) |
3056 | return (id); | 3155 | return id; |
3057 | for (i = 0; i < 14; i++) { | 3156 | for (i = 0; i < 14; i++) { |
3058 | k = (i & 0x3F) | 0x180; | 3157 | k = (i & 0x3F) | 0x180; |
3059 | for (j = 0x100; j > 0; j >>= 1) { | 3158 | for (j = 0x100; j > 0; j >>= 1) { |
@@ -3066,7 +3165,7 @@ static int mxser_read_register(int port, unsigned short *regs) | |||
3066 | outb(CHIP_CS | CHIP_SK, port); /* A? bit of read */ | 3165 | outb(CHIP_CS | CHIP_SK, port); /* A? bit of read */ |
3067 | } | 3166 | } |
3068 | } | 3167 | } |
3069 | (void) inb(port); | 3168 | (void)inb(port); |
3070 | value = 0; | 3169 | value = 0; |
3071 | for (k = 0, j = 0x8000; k < 16; k++, j >>= 1) { | 3170 | for (k = 0, j = 0x8000; k < 16; k++, j >>= 1) { |
3072 | outb(CHIP_CS, port); | 3171 | outb(CHIP_CS, port); |
@@ -3078,28 +3177,33 @@ static int mxser_read_register(int port, unsigned short *regs) | |||
3078 | outb(0, port); | 3177 | outb(0, port); |
3079 | } | 3178 | } |
3080 | mxser_normal_mode(port); | 3179 | mxser_normal_mode(port); |
3081 | return (id); | 3180 | return id; |
3082 | } | 3181 | } |
3083 | 3182 | ||
3084 | static int mxser_program_mode(int port) | 3183 | static int mxser_program_mode(int port) |
3085 | { | 3184 | { |
3086 | int id, i, j, n; | 3185 | int id, i, j, n; |
3087 | //unsigned long flags; | 3186 | /* unsigned long flags; */ |
3088 | 3187 | ||
3089 | spin_lock(&gm_lock); | 3188 | spin_lock(&gm_lock); |
3090 | outb(0, port); | 3189 | outb(0, port); |
3091 | outb(0, port); | 3190 | outb(0, port); |
3092 | outb(0, port); | 3191 | outb(0, port); |
3093 | (void) inb(port); | 3192 | (void)inb(port); |
3094 | (void) inb(port); | 3193 | (void)inb(port); |
3095 | outb(0, port); | 3194 | outb(0, port); |
3096 | (void) inb(port); | 3195 | (void)inb(port); |
3097 | //restore_flags(flags); | 3196 | /* restore_flags(flags); */ |
3098 | spin_unlock(&gm_lock); | 3197 | spin_unlock(&gm_lock); |
3099 | 3198 | ||
3100 | id = inb(port + 1) & 0x1F; | 3199 | id = inb(port + 1) & 0x1F; |
3101 | if ((id != C168_ASIC_ID) && (id != C104_ASIC_ID) && (id != C102_ASIC_ID) && (id != CI132_ASIC_ID) && (id != CI134_ASIC_ID) && (id != CI104J_ASIC_ID)) | 3200 | if ((id != C168_ASIC_ID) && |
3102 | return (-1); | 3201 | (id != C104_ASIC_ID) && |
3202 | (id != C102_ASIC_ID) && | ||
3203 | (id != CI132_ASIC_ID) && | ||
3204 | (id != CI134_ASIC_ID) && | ||
3205 | (id != CI104J_ASIC_ID)) | ||
3206 | return -1; | ||
3103 | for (i = 0, j = 0; i < 4; i++) { | 3207 | for (i = 0, j = 0; i < 4; i++) { |
3104 | n = inb(port + 2); | 3208 | n = inb(port + 2); |
3105 | if (n == 'M') { | 3209 | if (n == 'M') { |
@@ -3112,7 +3216,7 @@ static int mxser_program_mode(int port) | |||
3112 | } | 3216 | } |
3113 | if (j != 2) | 3217 | if (j != 2) |
3114 | id = -2; | 3218 | id = -2; |
3115 | return (id); | 3219 | return id; |
3116 | } | 3220 | } |
3117 | 3221 | ||
3118 | static void mxser_normal_mode(int port) | 3222 | static void mxser_normal_mode(int port) |
@@ -3130,7 +3234,7 @@ static void mxser_normal_mode(int port) | |||
3130 | if ((n & 0x61) == 0x60) | 3234 | if ((n & 0x61) == 0x60) |
3131 | break; | 3235 | break; |
3132 | if ((n & 1) == 1) | 3236 | if ((n & 1) == 1) |
3133 | (void) inb(port); | 3237 | (void)inb(port); |
3134 | } | 3238 | } |
3135 | outb(0x00, port + 4); | 3239 | outb(0x00, port + 4); |
3136 | } | 3240 | } |
diff --git a/drivers/char/n_hdlc.c b/drivers/char/n_hdlc.c index 9f54733f1623..337a87f86a3b 100644 --- a/drivers/char/n_hdlc.c +++ b/drivers/char/n_hdlc.c | |||
@@ -81,7 +81,6 @@ | |||
81 | #define HDLC_MAGIC 0x239e | 81 | #define HDLC_MAGIC 0x239e |
82 | #define HDLC_VERSION "$Revision: 4.8 $" | 82 | #define HDLC_VERSION "$Revision: 4.8 $" |
83 | 83 | ||
84 | #include <linux/config.h> | ||
85 | #include <linux/module.h> | 84 | #include <linux/module.h> |
86 | #include <linux/init.h> | 85 | #include <linux/init.h> |
87 | #include <linux/kernel.h> | 86 | #include <linux/kernel.h> |
diff --git a/drivers/char/n_r3964.c b/drivers/char/n_r3964.c index c48de09d68f0..203dc2b661d5 100644 --- a/drivers/char/n_r3964.c +++ b/drivers/char/n_r3964.c | |||
@@ -951,7 +951,8 @@ static void add_msg(struct r3964_client_info *pClient, int msg_id, int arg, | |||
951 | { | 951 | { |
952 | queue_the_message: | 952 | queue_the_message: |
953 | 953 | ||
954 | pMsg = kmalloc(sizeof(struct r3964_message), GFP_KERNEL); | 954 | pMsg = kmalloc(sizeof(struct r3964_message), |
955 | error_code?GFP_ATOMIC:GFP_KERNEL); | ||
955 | TRACE_M("add_msg - kmalloc %p",pMsg); | 956 | TRACE_M("add_msg - kmalloc %p",pMsg); |
956 | if(pMsg==NULL) { | 957 | if(pMsg==NULL) { |
957 | return; | 958 | return; |
diff --git a/drivers/char/n_tty.c b/drivers/char/n_tty.c index b9371d5bf790..603b9ade5eb0 100644 --- a/drivers/char/n_tty.c +++ b/drivers/char/n_tty.c | |||
@@ -1132,7 +1132,7 @@ static inline int input_available_p(struct tty_struct *tty, int amt) | |||
1132 | * buffer, and once to drain the space from the (physical) beginning of | 1132 | * buffer, and once to drain the space from the (physical) beginning of |
1133 | * the buffer to head pointer. | 1133 | * the buffer to head pointer. |
1134 | * | 1134 | * |
1135 | * Called under the tty->atomic_read_lock sem and with TTY_DONT_FLIP set | 1135 | * Called under the tty->atomic_read_lock sem |
1136 | * | 1136 | * |
1137 | */ | 1137 | */ |
1138 | 1138 | ||
@@ -1271,7 +1271,6 @@ do_it_again: | |||
1271 | } | 1271 | } |
1272 | 1272 | ||
1273 | add_wait_queue(&tty->read_wait, &wait); | 1273 | add_wait_queue(&tty->read_wait, &wait); |
1274 | set_bit(TTY_DONT_FLIP, &tty->flags); | ||
1275 | while (nr) { | 1274 | while (nr) { |
1276 | /* First test for status change. */ | 1275 | /* First test for status change. */ |
1277 | if (tty->packet && tty->link->ctrl_status) { | 1276 | if (tty->packet && tty->link->ctrl_status) { |
@@ -1315,9 +1314,7 @@ do_it_again: | |||
1315 | break; | 1314 | break; |
1316 | } | 1315 | } |
1317 | n_tty_set_room(tty); | 1316 | n_tty_set_room(tty); |
1318 | clear_bit(TTY_DONT_FLIP, &tty->flags); | ||
1319 | timeout = schedule_timeout(timeout); | 1317 | timeout = schedule_timeout(timeout); |
1320 | set_bit(TTY_DONT_FLIP, &tty->flags); | ||
1321 | continue; | 1318 | continue; |
1322 | } | 1319 | } |
1323 | __set_current_state(TASK_RUNNING); | 1320 | __set_current_state(TASK_RUNNING); |
@@ -1394,7 +1391,6 @@ do_it_again: | |||
1394 | if (time) | 1391 | if (time) |
1395 | timeout = time; | 1392 | timeout = time; |
1396 | } | 1393 | } |
1397 | clear_bit(TTY_DONT_FLIP, &tty->flags); | ||
1398 | mutex_unlock(&tty->atomic_read_lock); | 1394 | mutex_unlock(&tty->atomic_read_lock); |
1399 | remove_wait_queue(&tty->read_wait, &wait); | 1395 | remove_wait_queue(&tty->read_wait, &wait); |
1400 | 1396 | ||
diff --git a/drivers/char/nsc_gpio.c b/drivers/char/nsc_gpio.c new file mode 100644 index 000000000000..5b91e4e25641 --- /dev/null +++ b/drivers/char/nsc_gpio.c | |||
@@ -0,0 +1,142 @@ | |||
1 | /* linux/drivers/char/nsc_gpio.c | ||
2 | |||
3 | National Semiconductor common GPIO device-file/VFS methods. | ||
4 | Allows a user space process to control the GPIO pins. | ||
5 | |||
6 | Copyright (c) 2001,2002 Christer Weinigel <wingel@nano-system.com> | ||
7 | Copyright (c) 2005 Jim Cromie <jim.cromie@gmail.com> | ||
8 | */ | ||
9 | |||
10 | #include <linux/config.h> | ||
11 | #include <linux/fs.h> | ||
12 | #include <linux/module.h> | ||
13 | #include <linux/errno.h> | ||
14 | #include <linux/kernel.h> | ||
15 | #include <linux/init.h> | ||
16 | #include <linux/nsc_gpio.h> | ||
17 | #include <linux/platform_device.h> | ||
18 | #include <asm/uaccess.h> | ||
19 | #include <asm/io.h> | ||
20 | |||
21 | #define NAME "nsc_gpio" | ||
22 | |||
23 | void nsc_gpio_dump(struct nsc_gpio_ops *amp, unsigned index) | ||
24 | { | ||
25 | /* retrieve current config w/o changing it */ | ||
26 | u32 config = amp->gpio_config(index, ~0, 0); | ||
27 | |||
28 | /* user requested via 'v' command, so its INFO */ | ||
29 | dev_info(amp->dev, "io%02u: 0x%04x %s %s %s %s %s %s %s\tio:%d/%d\n", | ||
30 | index, config, | ||
31 | (config & 1) ? "OE" : "TS", /* output-enabled/tristate */ | ||
32 | (config & 2) ? "PP" : "OD", /* push pull / open drain */ | ||
33 | (config & 4) ? "PUE" : "PUD", /* pull up enabled/disabled */ | ||
34 | (config & 8) ? "LOCKED" : "", /* locked / unlocked */ | ||
35 | (config & 16) ? "LEVEL" : "EDGE",/* level/edge input */ | ||
36 | (config & 32) ? "HI" : "LO", /* trigger on rise/fall edge */ | ||
37 | (config & 64) ? "DEBOUNCE" : "", /* debounce */ | ||
38 | |||
39 | amp->gpio_get(index), amp->gpio_current(index)); | ||
40 | } | ||
41 | |||
42 | ssize_t nsc_gpio_write(struct file *file, const char __user *data, | ||
43 | size_t len, loff_t *ppos) | ||
44 | { | ||
45 | unsigned m = iminor(file->f_dentry->d_inode); | ||
46 | struct nsc_gpio_ops *amp = file->private_data; | ||
47 | struct device *dev = amp->dev; | ||
48 | size_t i; | ||
49 | int err = 0; | ||
50 | |||
51 | for (i = 0; i < len; ++i) { | ||
52 | char c; | ||
53 | if (get_user(c, data + i)) | ||
54 | return -EFAULT; | ||
55 | switch (c) { | ||
56 | case '0': | ||
57 | amp->gpio_set(m, 0); | ||
58 | break; | ||
59 | case '1': | ||
60 | amp->gpio_set(m, 1); | ||
61 | break; | ||
62 | case 'O': | ||
63 | dev_dbg(dev, "GPIO%d output enabled\n", m); | ||
64 | amp->gpio_config(m, ~1, 1); | ||
65 | break; | ||
66 | case 'o': | ||
67 | dev_dbg(dev, "GPIO%d output disabled\n", m); | ||
68 | amp->gpio_config(m, ~1, 0); | ||
69 | break; | ||
70 | case 'T': | ||
71 | dev_dbg(dev, "GPIO%d output is push pull\n", | ||
72 | m); | ||
73 | amp->gpio_config(m, ~2, 2); | ||
74 | break; | ||
75 | case 't': | ||
76 | dev_dbg(dev, "GPIO%d output is open drain\n", | ||
77 | m); | ||
78 | amp->gpio_config(m, ~2, 0); | ||
79 | break; | ||
80 | case 'P': | ||
81 | dev_dbg(dev, "GPIO%d pull up enabled\n", m); | ||
82 | amp->gpio_config(m, ~4, 4); | ||
83 | break; | ||
84 | case 'p': | ||
85 | dev_dbg(dev, "GPIO%d pull up disabled\n", m); | ||
86 | amp->gpio_config(m, ~4, 0); | ||
87 | break; | ||
88 | case 'v': | ||
89 | /* View Current pin settings */ | ||
90 | amp->gpio_dump(amp, m); | ||
91 | break; | ||
92 | case '\n': | ||
93 | /* end of settings string, do nothing */ | ||
94 | break; | ||
95 | default: | ||
96 | dev_err(dev, "io%2d bad setting: chr<0x%2x>\n", | ||
97 | m, (int)c); | ||
98 | err++; | ||
99 | } | ||
100 | } | ||
101 | if (err) | ||
102 | return -EINVAL; /* full string handled, report error */ | ||
103 | |||
104 | return len; | ||
105 | } | ||
106 | |||
107 | ssize_t nsc_gpio_read(struct file *file, char __user * buf, | ||
108 | size_t len, loff_t * ppos) | ||
109 | { | ||
110 | unsigned m = iminor(file->f_dentry->d_inode); | ||
111 | int value; | ||
112 | struct nsc_gpio_ops *amp = file->private_data; | ||
113 | |||
114 | value = amp->gpio_get(m); | ||
115 | if (put_user(value ? '1' : '0', buf)) | ||
116 | return -EFAULT; | ||
117 | |||
118 | return 1; | ||
119 | } | ||
120 | |||
121 | /* common file-ops routines for both scx200_gpio and pc87360_gpio */ | ||
122 | EXPORT_SYMBOL(nsc_gpio_write); | ||
123 | EXPORT_SYMBOL(nsc_gpio_read); | ||
124 | EXPORT_SYMBOL(nsc_gpio_dump); | ||
125 | |||
126 | static int __init nsc_gpio_init(void) | ||
127 | { | ||
128 | printk(KERN_DEBUG NAME " initializing\n"); | ||
129 | return 0; | ||
130 | } | ||
131 | |||
132 | static void __exit nsc_gpio_cleanup(void) | ||
133 | { | ||
134 | printk(KERN_DEBUG NAME " cleanup\n"); | ||
135 | } | ||
136 | |||
137 | module_init(nsc_gpio_init); | ||
138 | module_exit(nsc_gpio_cleanup); | ||
139 | |||
140 | MODULE_AUTHOR("Jim Cromie <jim.cromie@gmail.com>"); | ||
141 | MODULE_DESCRIPTION("NatSemi GPIO Common Methods"); | ||
142 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/char/nvram.c b/drivers/char/nvram.c index 3556ccd77570..a39f19c35a6a 100644 --- a/drivers/char/nvram.c +++ b/drivers/char/nvram.c | |||
@@ -37,7 +37,6 @@ | |||
37 | #define NVRAM_VERSION "1.2" | 37 | #define NVRAM_VERSION "1.2" |
38 | 38 | ||
39 | #include <linux/module.h> | 39 | #include <linux/module.h> |
40 | #include <linux/config.h> | ||
41 | #include <linux/sched.h> | 40 | #include <linux/sched.h> |
42 | #include <linux/smp_lock.h> | 41 | #include <linux/smp_lock.h> |
43 | #include <linux/nvram.h> | 42 | #include <linux/nvram.h> |
@@ -438,7 +437,7 @@ nvram_read_proc(char *buffer, char **start, off_t offset, | |||
438 | 437 | ||
439 | #endif /* CONFIG_PROC_FS */ | 438 | #endif /* CONFIG_PROC_FS */ |
440 | 439 | ||
441 | static struct file_operations nvram_fops = { | 440 | static const struct file_operations nvram_fops = { |
442 | .owner = THIS_MODULE, | 441 | .owner = THIS_MODULE, |
443 | .llseek = nvram_llseek, | 442 | .llseek = nvram_llseek, |
444 | .read = nvram_read, | 443 | .read = nvram_read, |
diff --git a/drivers/char/nwbutton.c b/drivers/char/nwbutton.c index 4083b781adbf..7c57ebfa8640 100644 --- a/drivers/char/nwbutton.c +++ b/drivers/char/nwbutton.c | |||
@@ -4,7 +4,6 @@ | |||
4 | * | 4 | * |
5 | */ | 5 | */ |
6 | 6 | ||
7 | #include <linux/config.h> | ||
8 | #include <linux/module.h> | 7 | #include <linux/module.h> |
9 | #include <linux/kernel.h> | 8 | #include <linux/kernel.h> |
10 | #include <linux/sched.h> | 9 | #include <linux/sched.h> |
@@ -184,7 +183,7 @@ static int button_read (struct file *filp, char __user *buffer, | |||
184 | * attempts to perform these operations on the device. | 183 | * attempts to perform these operations on the device. |
185 | */ | 184 | */ |
186 | 185 | ||
187 | static struct file_operations button_fops = { | 186 | static const struct file_operations button_fops = { |
188 | .owner = THIS_MODULE, | 187 | .owner = THIS_MODULE, |
189 | .read = button_read, | 188 | .read = button_read, |
190 | }; | 189 | }; |
@@ -224,7 +223,7 @@ static int __init nwbutton_init(void) | |||
224 | return -EBUSY; | 223 | return -EBUSY; |
225 | } | 224 | } |
226 | 225 | ||
227 | if (request_irq (IRQ_NETWINDER_BUTTON, button_handler, SA_INTERRUPT, | 226 | if (request_irq (IRQ_NETWINDER_BUTTON, button_handler, IRQF_DISABLED, |
228 | "nwbutton", NULL)) { | 227 | "nwbutton", NULL)) { |
229 | printk (KERN_WARNING "nwbutton: IRQ %d is not free.\n", | 228 | printk (KERN_WARNING "nwbutton: IRQ %d is not free.\n", |
230 | IRQ_NETWINDER_BUTTON); | 229 | IRQ_NETWINDER_BUTTON); |
diff --git a/drivers/char/nwflash.c b/drivers/char/nwflash.c index 8865387d3448..206cf6f50695 100644 --- a/drivers/char/nwflash.c +++ b/drivers/char/nwflash.c | |||
@@ -642,7 +642,7 @@ static void kick_open(void) | |||
642 | udelay(25); | 642 | udelay(25); |
643 | } | 643 | } |
644 | 644 | ||
645 | static struct file_operations flash_fops = | 645 | static const struct file_operations flash_fops = |
646 | { | 646 | { |
647 | .owner = THIS_MODULE, | 647 | .owner = THIS_MODULE, |
648 | .llseek = flash_llseek, | 648 | .llseek = flash_llseek, |
diff --git a/drivers/char/pc8736x_gpio.c b/drivers/char/pc8736x_gpio.c new file mode 100644 index 000000000000..4005ee0aa11e --- /dev/null +++ b/drivers/char/pc8736x_gpio.c | |||
@@ -0,0 +1,341 @@ | |||
1 | /* linux/drivers/char/pc8736x_gpio.c | ||
2 | |||
3 | National Semiconductor PC8736x GPIO driver. Allows a user space | ||
4 | process to play with the GPIO pins. | ||
5 | |||
6 | Copyright (c) 2005 Jim Cromie <jim.cromie@gmail.com> | ||
7 | |||
8 | adapted from linux/drivers/char/scx200_gpio.c | ||
9 | Copyright (c) 2001,2002 Christer Weinigel <wingel@nano-system.com>, | ||
10 | */ | ||
11 | |||
12 | #include <linux/config.h> | ||
13 | #include <linux/fs.h> | ||
14 | #include <linux/module.h> | ||
15 | #include <linux/errno.h> | ||
16 | #include <linux/kernel.h> | ||
17 | #include <linux/init.h> | ||
18 | #include <linux/io.h> | ||
19 | #include <linux/ioport.h> | ||
20 | #include <linux/mutex.h> | ||
21 | #include <linux/nsc_gpio.h> | ||
22 | #include <linux/platform_device.h> | ||
23 | #include <asm/uaccess.h> | ||
24 | |||
25 | #define DEVNAME "pc8736x_gpio" | ||
26 | |||
27 | MODULE_AUTHOR("Jim Cromie <jim.cromie@gmail.com>"); | ||
28 | MODULE_DESCRIPTION("NatSemi PC-8736x GPIO Pin Driver"); | ||
29 | MODULE_LICENSE("GPL"); | ||
30 | |||
31 | static int major; /* default to dynamic major */ | ||
32 | module_param(major, int, 0); | ||
33 | MODULE_PARM_DESC(major, "Major device number"); | ||
34 | |||
35 | static DEFINE_MUTEX(pc8736x_gpio_config_lock); | ||
36 | static unsigned pc8736x_gpio_base; | ||
37 | static u8 pc8736x_gpio_shadow[4]; | ||
38 | |||
39 | #define SIO_BASE1 0x2E /* 1st command-reg to check */ | ||
40 | #define SIO_BASE2 0x4E /* alt command-reg to check */ | ||
41 | #define SIO_BASE_OFFSET 0x20 | ||
42 | |||
43 | #define SIO_SID 0x20 /* SuperI/O ID Register */ | ||
44 | #define SIO_SID_VALUE 0xe9 /* Expected value in SuperI/O ID Register */ | ||
45 | |||
46 | #define SIO_CF1 0x21 /* chip config, bit0 is chip enable */ | ||
47 | |||
48 | #define PC8736X_GPIO_SIZE 16 | ||
49 | |||
50 | #define SIO_UNIT_SEL 0x7 /* unit select reg */ | ||
51 | #define SIO_UNIT_ACT 0x30 /* unit enable */ | ||
52 | #define SIO_GPIO_UNIT 0x7 /* unit number of GPIO */ | ||
53 | #define SIO_VLM_UNIT 0x0D | ||
54 | #define SIO_TMS_UNIT 0x0E | ||
55 | |||
56 | /* config-space addrs to read/write each unit's runtime addr */ | ||
57 | #define SIO_BASE_HADDR 0x60 | ||
58 | #define SIO_BASE_LADDR 0x61 | ||
59 | |||
60 | /* GPIO config-space pin-control addresses */ | ||
61 | #define SIO_GPIO_PIN_SELECT 0xF0 | ||
62 | #define SIO_GPIO_PIN_CONFIG 0xF1 | ||
63 | #define SIO_GPIO_PIN_EVENT 0xF2 | ||
64 | |||
65 | static unsigned char superio_cmd = 0; | ||
66 | static unsigned char selected_device = 0xFF; /* bogus start val */ | ||
67 | |||
68 | /* GPIO port runtime access, functionality */ | ||
69 | static int port_offset[] = { 0, 4, 8, 10 }; /* non-uniform offsets ! */ | ||
70 | /* static int event_capable[] = { 1, 1, 0, 0 }; ports 2,3 are hobbled */ | ||
71 | |||
72 | #define PORT_OUT 0 | ||
73 | #define PORT_IN 1 | ||
74 | #define PORT_EVT_EN 2 | ||
75 | #define PORT_EVT_STST 3 | ||
76 | |||
77 | static struct platform_device *pdev; /* use in dev_*() */ | ||
78 | |||
79 | static inline void superio_outb(int addr, int val) | ||
80 | { | ||
81 | outb_p(addr, superio_cmd); | ||
82 | outb_p(val, superio_cmd + 1); | ||
83 | } | ||
84 | |||
85 | static inline int superio_inb(int addr) | ||
86 | { | ||
87 | outb_p(addr, superio_cmd); | ||
88 | return inb_p(superio_cmd + 1); | ||
89 | } | ||
90 | |||
91 | static int pc8736x_superio_present(void) | ||
92 | { | ||
93 | /* try the 2 possible values, read a hardware reg to verify */ | ||
94 | superio_cmd = SIO_BASE1; | ||
95 | if (superio_inb(SIO_SID) == SIO_SID_VALUE) | ||
96 | return superio_cmd; | ||
97 | |||
98 | superio_cmd = SIO_BASE2; | ||
99 | if (superio_inb(SIO_SID) == SIO_SID_VALUE) | ||
100 | return superio_cmd; | ||
101 | |||
102 | return 0; | ||
103 | } | ||
104 | |||
105 | static void device_select(unsigned devldn) | ||
106 | { | ||
107 | superio_outb(SIO_UNIT_SEL, devldn); | ||
108 | selected_device = devldn; | ||
109 | } | ||
110 | |||
111 | static void select_pin(unsigned iminor) | ||
112 | { | ||
113 | /* select GPIO port/pin from device minor number */ | ||
114 | device_select(SIO_GPIO_UNIT); | ||
115 | superio_outb(SIO_GPIO_PIN_SELECT, | ||
116 | ((iminor << 1) & 0xF0) | (iminor & 0x7)); | ||
117 | } | ||
118 | |||
119 | static inline u32 pc8736x_gpio_configure_fn(unsigned index, u32 mask, u32 bits, | ||
120 | u32 func_slct) | ||
121 | { | ||
122 | u32 config, new_config; | ||
123 | |||
124 | mutex_lock(&pc8736x_gpio_config_lock); | ||
125 | |||
126 | device_select(SIO_GPIO_UNIT); | ||
127 | select_pin(index); | ||
128 | |||
129 | /* read current config value */ | ||
130 | config = superio_inb(func_slct); | ||
131 | |||
132 | /* set new config */ | ||
133 | new_config = (config & mask) | bits; | ||
134 | superio_outb(func_slct, new_config); | ||
135 | |||
136 | mutex_unlock(&pc8736x_gpio_config_lock); | ||
137 | |||
138 | return config; | ||
139 | } | ||
140 | |||
141 | static u32 pc8736x_gpio_configure(unsigned index, u32 mask, u32 bits) | ||
142 | { | ||
143 | return pc8736x_gpio_configure_fn(index, mask, bits, | ||
144 | SIO_GPIO_PIN_CONFIG); | ||
145 | } | ||
146 | |||
147 | static int pc8736x_gpio_get(unsigned minor) | ||
148 | { | ||
149 | int port, bit, val; | ||
150 | |||
151 | port = minor >> 3; | ||
152 | bit = minor & 7; | ||
153 | val = inb_p(pc8736x_gpio_base + port_offset[port] + PORT_IN); | ||
154 | val >>= bit; | ||
155 | val &= 1; | ||
156 | |||
157 | dev_dbg(&pdev->dev, "_gpio_get(%d from %x bit %d) == val %d\n", | ||
158 | minor, pc8736x_gpio_base + port_offset[port] + PORT_IN, bit, | ||
159 | val); | ||
160 | |||
161 | return val; | ||
162 | } | ||
163 | |||
164 | static void pc8736x_gpio_set(unsigned minor, int val) | ||
165 | { | ||
166 | int port, bit, curval; | ||
167 | |||
168 | minor &= 0x1f; | ||
169 | port = minor >> 3; | ||
170 | bit = minor & 7; | ||
171 | curval = inb_p(pc8736x_gpio_base + port_offset[port] + PORT_OUT); | ||
172 | |||
173 | dev_dbg(&pdev->dev, "addr:%x cur:%x bit-pos:%d cur-bit:%x + new:%d -> bit-new:%d\n", | ||
174 | pc8736x_gpio_base + port_offset[port] + PORT_OUT, | ||
175 | curval, bit, (curval & ~(1 << bit)), val, (val << bit)); | ||
176 | |||
177 | val = (curval & ~(1 << bit)) | (val << bit); | ||
178 | |||
179 | dev_dbg(&pdev->dev, "gpio_set(minor:%d port:%d bit:%d)" | ||
180 | " %2x -> %2x\n", minor, port, bit, curval, val); | ||
181 | |||
182 | outb_p(val, pc8736x_gpio_base + port_offset[port] + PORT_OUT); | ||
183 | |||
184 | curval = inb_p(pc8736x_gpio_base + port_offset[port] + PORT_OUT); | ||
185 | val = inb_p(pc8736x_gpio_base + port_offset[port] + PORT_IN); | ||
186 | |||
187 | dev_dbg(&pdev->dev, "wrote %x, read: %x\n", curval, val); | ||
188 | pc8736x_gpio_shadow[port] = val; | ||
189 | } | ||
190 | |||
191 | static void pc8736x_gpio_set_high(unsigned index) | ||
192 | { | ||
193 | pc8736x_gpio_set(index, 1); | ||
194 | } | ||
195 | |||
196 | static void pc8736x_gpio_set_low(unsigned index) | ||
197 | { | ||
198 | pc8736x_gpio_set(index, 0); | ||
199 | } | ||
200 | |||
201 | static int pc8736x_gpio_current(unsigned minor) | ||
202 | { | ||
203 | int port, bit; | ||
204 | minor &= 0x1f; | ||
205 | port = minor >> 3; | ||
206 | bit = minor & 7; | ||
207 | return ((pc8736x_gpio_shadow[port] >> bit) & 0x01); | ||
208 | } | ||
209 | |||
210 | static void pc8736x_gpio_change(unsigned index) | ||
211 | { | ||
212 | pc8736x_gpio_set(index, !pc8736x_gpio_current(index)); | ||
213 | } | ||
214 | |||
215 | static struct nsc_gpio_ops pc8736x_access = { | ||
216 | .owner = THIS_MODULE, | ||
217 | .gpio_config = pc8736x_gpio_configure, | ||
218 | .gpio_dump = nsc_gpio_dump, | ||
219 | .gpio_get = pc8736x_gpio_get, | ||
220 | .gpio_set = pc8736x_gpio_set, | ||
221 | .gpio_set_high = pc8736x_gpio_set_high, | ||
222 | .gpio_set_low = pc8736x_gpio_set_low, | ||
223 | .gpio_change = pc8736x_gpio_change, | ||
224 | .gpio_current = pc8736x_gpio_current | ||
225 | }; | ||
226 | |||
227 | static int pc8736x_gpio_open(struct inode *inode, struct file *file) | ||
228 | { | ||
229 | unsigned m = iminor(inode); | ||
230 | file->private_data = &pc8736x_access; | ||
231 | |||
232 | dev_dbg(&pdev->dev, "open %d\n", m); | ||
233 | |||
234 | if (m > 63) | ||
235 | return -EINVAL; | ||
236 | return nonseekable_open(inode, file); | ||
237 | } | ||
238 | |||
239 | static const struct file_operations pc8736x_gpio_fops = { | ||
240 | .owner = THIS_MODULE, | ||
241 | .open = pc8736x_gpio_open, | ||
242 | .write = nsc_gpio_write, | ||
243 | .read = nsc_gpio_read, | ||
244 | }; | ||
245 | |||
246 | static void __init pc8736x_init_shadow(void) | ||
247 | { | ||
248 | int port; | ||
249 | |||
250 | /* read the current values driven on the GPIO signals */ | ||
251 | for (port = 0; port < 4; ++port) | ||
252 | pc8736x_gpio_shadow[port] | ||
253 | = inb_p(pc8736x_gpio_base + port_offset[port] | ||
254 | + PORT_OUT); | ||
255 | |||
256 | } | ||
257 | |||
258 | static int __init pc8736x_gpio_init(void) | ||
259 | { | ||
260 | int rc = 0; | ||
261 | |||
262 | pdev = platform_device_alloc(DEVNAME, 0); | ||
263 | if (!pdev) | ||
264 | return -ENOMEM; | ||
265 | |||
266 | rc = platform_device_add(pdev); | ||
267 | if (rc) { | ||
268 | rc = -ENODEV; | ||
269 | goto undo_platform_dev_alloc; | ||
270 | } | ||
271 | dev_info(&pdev->dev, "NatSemi pc8736x GPIO Driver Initializing\n"); | ||
272 | |||
273 | if (!pc8736x_superio_present()) { | ||
274 | rc = -ENODEV; | ||
275 | dev_err(&pdev->dev, "no device found\n"); | ||
276 | goto undo_platform_dev_add; | ||
277 | } | ||
278 | pc8736x_access.dev = &pdev->dev; | ||
279 | |||
280 | /* Verify that chip and it's GPIO unit are both enabled. | ||
281 | My BIOS does this, so I take minimum action here | ||
282 | */ | ||
283 | rc = superio_inb(SIO_CF1); | ||
284 | if (!(rc & 0x01)) { | ||
285 | rc = -ENODEV; | ||
286 | dev_err(&pdev->dev, "device not enabled\n"); | ||
287 | goto undo_platform_dev_add; | ||
288 | } | ||
289 | device_select(SIO_GPIO_UNIT); | ||
290 | if (!superio_inb(SIO_UNIT_ACT)) { | ||
291 | rc = -ENODEV; | ||
292 | dev_err(&pdev->dev, "GPIO unit not enabled\n"); | ||
293 | goto undo_platform_dev_add; | ||
294 | } | ||
295 | |||
296 | /* read the GPIO unit base addr that chip responds to */ | ||
297 | pc8736x_gpio_base = (superio_inb(SIO_BASE_HADDR) << 8 | ||
298 | | superio_inb(SIO_BASE_LADDR)); | ||
299 | |||
300 | if (!request_region(pc8736x_gpio_base, 16, DEVNAME)) { | ||
301 | rc = -ENODEV; | ||
302 | dev_err(&pdev->dev, "GPIO ioport %x busy\n", | ||
303 | pc8736x_gpio_base); | ||
304 | goto undo_platform_dev_add; | ||
305 | } | ||
306 | dev_info(&pdev->dev, "GPIO ioport %x reserved\n", pc8736x_gpio_base); | ||
307 | |||
308 | rc = register_chrdev(major, DEVNAME, &pc8736x_gpio_fops); | ||
309 | if (rc < 0) { | ||
310 | dev_err(&pdev->dev, "register-chrdev failed: %d\n", rc); | ||
311 | goto undo_platform_dev_add; | ||
312 | } | ||
313 | if (!major) { | ||
314 | major = rc; | ||
315 | dev_dbg(&pdev->dev, "got dynamic major %d\n", major); | ||
316 | } | ||
317 | |||
318 | pc8736x_init_shadow(); | ||
319 | return 0; | ||
320 | |||
321 | undo_platform_dev_add: | ||
322 | platform_device_del(pdev); | ||
323 | undo_platform_dev_alloc: | ||
324 | platform_device_put(pdev); | ||
325 | |||
326 | return rc; | ||
327 | } | ||
328 | |||
329 | static void __exit pc8736x_gpio_cleanup(void) | ||
330 | { | ||
331 | dev_dbg(&pdev->dev, " cleanup\n"); | ||
332 | |||
333 | release_region(pc8736x_gpio_base, 16); | ||
334 | |||
335 | unregister_chrdev(major, DEVNAME); | ||
336 | } | ||
337 | |||
338 | EXPORT_SYMBOL(pc8736x_access); | ||
339 | |||
340 | module_init(pc8736x_gpio_init); | ||
341 | module_exit(pc8736x_gpio_cleanup); | ||
diff --git a/drivers/char/pcmcia/cm4000_cs.c b/drivers/char/pcmcia/cm4000_cs.c index eab5394da666..50d20aafeb18 100644 --- a/drivers/char/pcmcia/cm4000_cs.c +++ b/drivers/char/pcmcia/cm4000_cs.c | |||
@@ -149,12 +149,7 @@ struct cm4000_dev { | |||
149 | #define ZERO_DEV(dev) \ | 149 | #define ZERO_DEV(dev) \ |
150 | memset(&dev->atr_csum,0, \ | 150 | memset(&dev->atr_csum,0, \ |
151 | sizeof(struct cm4000_dev) - \ | 151 | sizeof(struct cm4000_dev) - \ |
152 | /*link*/ sizeof(struct pcmcia_device *) - \ | 152 | offsetof(struct cm4000_dev, atr_csum)) |
153 | /*node*/ sizeof(dev_node_t) - \ | ||
154 | /*atr*/ MAX_ATR*sizeof(char) - \ | ||
155 | /*rbuf*/ 512*sizeof(char) - \ | ||
156 | /*sbuf*/ 512*sizeof(char) - \ | ||
157 | /*queue*/ 4*sizeof(wait_queue_head_t)) | ||
158 | 153 | ||
159 | static struct pcmcia_device *dev_table[CM4000_MAX_DEV]; | 154 | static struct pcmcia_device *dev_table[CM4000_MAX_DEV]; |
160 | static struct class *cmm_class; | 155 | static struct class *cmm_class; |
@@ -1943,7 +1938,7 @@ static void cm4000_detach(struct pcmcia_device *link) | |||
1943 | return; | 1938 | return; |
1944 | } | 1939 | } |
1945 | 1940 | ||
1946 | static struct file_operations cm4000_fops = { | 1941 | static const struct file_operations cm4000_fops = { |
1947 | .owner = THIS_MODULE, | 1942 | .owner = THIS_MODULE, |
1948 | .read = cmm_read, | 1943 | .read = cmm_read, |
1949 | .write = cmm_write, | 1944 | .write = cmm_write, |
diff --git a/drivers/char/pcmcia/cm4040_cs.c b/drivers/char/pcmcia/cm4040_cs.c index 47a8465bf95b..55cf4be42976 100644 --- a/drivers/char/pcmcia/cm4040_cs.c +++ b/drivers/char/pcmcia/cm4040_cs.c | |||
@@ -688,7 +688,7 @@ static void reader_detach(struct pcmcia_device *link) | |||
688 | return; | 688 | return; |
689 | } | 689 | } |
690 | 690 | ||
691 | static struct file_operations reader_fops = { | 691 | static const struct file_operations reader_fops = { |
692 | .owner = THIS_MODULE, | 692 | .owner = THIS_MODULE, |
693 | .read = cm4040_read, | 693 | .read = cm4040_read, |
694 | .write = cm4040_write, | 694 | .write = cm4040_write, |
diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c index 07213454c458..17bc8abd5df5 100644 --- a/drivers/char/pcmcia/synclink_cs.c +++ b/drivers/char/pcmcia/synclink_cs.c | |||
@@ -844,7 +844,7 @@ static int bh_action(MGSLPC_INFO *info) | |||
844 | return rc; | 844 | return rc; |
845 | } | 845 | } |
846 | 846 | ||
847 | void bh_handler(void* Context) | 847 | static void bh_handler(void* Context) |
848 | { | 848 | { |
849 | MGSLPC_INFO *info = (MGSLPC_INFO*)Context; | 849 | MGSLPC_INFO *info = (MGSLPC_INFO*)Context; |
850 | int action; | 850 | int action; |
@@ -888,7 +888,7 @@ void bh_handler(void* Context) | |||
888 | __FILE__,__LINE__,info->device_name); | 888 | __FILE__,__LINE__,info->device_name); |
889 | } | 889 | } |
890 | 890 | ||
891 | void bh_transmit(MGSLPC_INFO *info) | 891 | static void bh_transmit(MGSLPC_INFO *info) |
892 | { | 892 | { |
893 | struct tty_struct *tty = info->tty; | 893 | struct tty_struct *tty = info->tty; |
894 | if (debug_level >= DEBUG_LEVEL_BH) | 894 | if (debug_level >= DEBUG_LEVEL_BH) |
@@ -900,7 +900,7 @@ void bh_transmit(MGSLPC_INFO *info) | |||
900 | } | 900 | } |
901 | } | 901 | } |
902 | 902 | ||
903 | void bh_status(MGSLPC_INFO *info) | 903 | static void bh_status(MGSLPC_INFO *info) |
904 | { | 904 | { |
905 | info->ri_chkcount = 0; | 905 | info->ri_chkcount = 0; |
906 | info->dsr_chkcount = 0; | 906 | info->dsr_chkcount = 0; |
@@ -1582,7 +1582,7 @@ static void mgslpc_put_char(struct tty_struct *tty, unsigned char ch) | |||
1582 | if (mgslpc_paranoia_check(info, tty->name, "mgslpc_put_char")) | 1582 | if (mgslpc_paranoia_check(info, tty->name, "mgslpc_put_char")) |
1583 | return; | 1583 | return; |
1584 | 1584 | ||
1585 | if (!tty || !info->tx_buf) | 1585 | if (!info->tx_buf) |
1586 | return; | 1586 | return; |
1587 | 1587 | ||
1588 | spin_lock_irqsave(&info->lock,flags); | 1588 | spin_lock_irqsave(&info->lock,flags); |
@@ -1649,7 +1649,7 @@ static int mgslpc_write(struct tty_struct * tty, | |||
1649 | __FILE__,__LINE__,info->device_name,count); | 1649 | __FILE__,__LINE__,info->device_name,count); |
1650 | 1650 | ||
1651 | if (mgslpc_paranoia_check(info, tty->name, "mgslpc_write") || | 1651 | if (mgslpc_paranoia_check(info, tty->name, "mgslpc_write") || |
1652 | !tty || !info->tx_buf) | 1652 | !info->tx_buf) |
1653 | goto cleanup; | 1653 | goto cleanup; |
1654 | 1654 | ||
1655 | if (info->params.mode == MGSL_MODE_HDLC) { | 1655 | if (info->params.mode == MGSL_MODE_HDLC) { |
@@ -2305,7 +2305,7 @@ static int mgslpc_ioctl(struct tty_struct *tty, struct file * file, | |||
2305 | return ioctl_common(info, cmd, arg); | 2305 | return ioctl_common(info, cmd, arg); |
2306 | } | 2306 | } |
2307 | 2307 | ||
2308 | int ioctl_common(MGSLPC_INFO *info, unsigned int cmd, unsigned long arg) | 2308 | static int ioctl_common(MGSLPC_INFO *info, unsigned int cmd, unsigned long arg) |
2309 | { | 2309 | { |
2310 | int error; | 2310 | int error; |
2311 | struct mgsl_icount cnow; /* kernel counter temps */ | 2311 | struct mgsl_icount cnow; /* kernel counter temps */ |
@@ -2877,7 +2877,7 @@ done: | |||
2877 | return ((count < begin+len-off) ? count : begin+len-off); | 2877 | return ((count < begin+len-off) ? count : begin+len-off); |
2878 | } | 2878 | } |
2879 | 2879 | ||
2880 | int rx_alloc_buffers(MGSLPC_INFO *info) | 2880 | static int rx_alloc_buffers(MGSLPC_INFO *info) |
2881 | { | 2881 | { |
2882 | /* each buffer has header and data */ | 2882 | /* each buffer has header and data */ |
2883 | info->rx_buf_size = sizeof(RXBUF) + info->max_frame_size; | 2883 | info->rx_buf_size = sizeof(RXBUF) + info->max_frame_size; |
@@ -2900,13 +2900,13 @@ int rx_alloc_buffers(MGSLPC_INFO *info) | |||
2900 | return 0; | 2900 | return 0; |
2901 | } | 2901 | } |
2902 | 2902 | ||
2903 | void rx_free_buffers(MGSLPC_INFO *info) | 2903 | static void rx_free_buffers(MGSLPC_INFO *info) |
2904 | { | 2904 | { |
2905 | kfree(info->rx_buf); | 2905 | kfree(info->rx_buf); |
2906 | info->rx_buf = NULL; | 2906 | info->rx_buf = NULL; |
2907 | } | 2907 | } |
2908 | 2908 | ||
2909 | int claim_resources(MGSLPC_INFO *info) | 2909 | static int claim_resources(MGSLPC_INFO *info) |
2910 | { | 2910 | { |
2911 | if (rx_alloc_buffers(info) < 0 ) { | 2911 | if (rx_alloc_buffers(info) < 0 ) { |
2912 | printk( "Cant allocate rx buffer %s\n", info->device_name); | 2912 | printk( "Cant allocate rx buffer %s\n", info->device_name); |
@@ -2916,7 +2916,7 @@ int claim_resources(MGSLPC_INFO *info) | |||
2916 | return 0; | 2916 | return 0; |
2917 | } | 2917 | } |
2918 | 2918 | ||
2919 | void release_resources(MGSLPC_INFO *info) | 2919 | static void release_resources(MGSLPC_INFO *info) |
2920 | { | 2920 | { |
2921 | if (debug_level >= DEBUG_LEVEL_INFO) | 2921 | if (debug_level >= DEBUG_LEVEL_INFO) |
2922 | printk("release_resources(%s)\n", info->device_name); | 2922 | printk("release_resources(%s)\n", info->device_name); |
@@ -2928,7 +2928,7 @@ void release_resources(MGSLPC_INFO *info) | |||
2928 | * | 2928 | * |
2929 | * Arguments: info pointer to device instance data | 2929 | * Arguments: info pointer to device instance data |
2930 | */ | 2930 | */ |
2931 | void mgslpc_add_device(MGSLPC_INFO *info) | 2931 | static void mgslpc_add_device(MGSLPC_INFO *info) |
2932 | { | 2932 | { |
2933 | info->next_device = NULL; | 2933 | info->next_device = NULL; |
2934 | info->line = mgslpc_device_count; | 2934 | info->line = mgslpc_device_count; |
@@ -2964,7 +2964,7 @@ void mgslpc_add_device(MGSLPC_INFO *info) | |||
2964 | #endif | 2964 | #endif |
2965 | } | 2965 | } |
2966 | 2966 | ||
2967 | void mgslpc_remove_device(MGSLPC_INFO *remove_info) | 2967 | static void mgslpc_remove_device(MGSLPC_INFO *remove_info) |
2968 | { | 2968 | { |
2969 | MGSLPC_INFO *info = mgslpc_device_list; | 2969 | MGSLPC_INFO *info = mgslpc_device_list; |
2970 | MGSLPC_INFO *last = NULL; | 2970 | MGSLPC_INFO *last = NULL; |
@@ -3257,7 +3257,7 @@ static void loopback_enable(MGSLPC_INFO *info) | |||
3257 | write_reg(info, CHA + MODE, val); | 3257 | write_reg(info, CHA + MODE, val); |
3258 | } | 3258 | } |
3259 | 3259 | ||
3260 | void hdlc_mode(MGSLPC_INFO *info) | 3260 | static void hdlc_mode(MGSLPC_INFO *info) |
3261 | { | 3261 | { |
3262 | unsigned char val; | 3262 | unsigned char val; |
3263 | unsigned char clkmode, clksubmode; | 3263 | unsigned char clkmode, clksubmode; |
@@ -3497,7 +3497,7 @@ void hdlc_mode(MGSLPC_INFO *info) | |||
3497 | rx_stop(info); | 3497 | rx_stop(info); |
3498 | } | 3498 | } |
3499 | 3499 | ||
3500 | void rx_stop(MGSLPC_INFO *info) | 3500 | static void rx_stop(MGSLPC_INFO *info) |
3501 | { | 3501 | { |
3502 | if (debug_level >= DEBUG_LEVEL_ISR) | 3502 | if (debug_level >= DEBUG_LEVEL_ISR) |
3503 | printk("%s(%d):rx_stop(%s)\n", | 3503 | printk("%s(%d):rx_stop(%s)\n", |
@@ -3510,7 +3510,7 @@ void rx_stop(MGSLPC_INFO *info) | |||
3510 | info->rx_overflow = 0; | 3510 | info->rx_overflow = 0; |
3511 | } | 3511 | } |
3512 | 3512 | ||
3513 | void rx_start(MGSLPC_INFO *info) | 3513 | static void rx_start(MGSLPC_INFO *info) |
3514 | { | 3514 | { |
3515 | if (debug_level >= DEBUG_LEVEL_ISR) | 3515 | if (debug_level >= DEBUG_LEVEL_ISR) |
3516 | printk("%s(%d):rx_start(%s)\n", | 3516 | printk("%s(%d):rx_start(%s)\n", |
@@ -3526,7 +3526,7 @@ void rx_start(MGSLPC_INFO *info) | |||
3526 | info->rx_enabled = 1; | 3526 | info->rx_enabled = 1; |
3527 | } | 3527 | } |
3528 | 3528 | ||
3529 | void tx_start(MGSLPC_INFO *info) | 3529 | static void tx_start(MGSLPC_INFO *info) |
3530 | { | 3530 | { |
3531 | if (debug_level >= DEBUG_LEVEL_ISR) | 3531 | if (debug_level >= DEBUG_LEVEL_ISR) |
3532 | printk("%s(%d):tx_start(%s)\n", | 3532 | printk("%s(%d):tx_start(%s)\n", |
@@ -3564,7 +3564,7 @@ void tx_start(MGSLPC_INFO *info) | |||
3564 | info->tx_enabled = 1; | 3564 | info->tx_enabled = 1; |
3565 | } | 3565 | } |
3566 | 3566 | ||
3567 | void tx_stop(MGSLPC_INFO *info) | 3567 | static void tx_stop(MGSLPC_INFO *info) |
3568 | { | 3568 | { |
3569 | if (debug_level >= DEBUG_LEVEL_ISR) | 3569 | if (debug_level >= DEBUG_LEVEL_ISR) |
3570 | printk("%s(%d):tx_stop(%s)\n", | 3570 | printk("%s(%d):tx_stop(%s)\n", |
@@ -3578,7 +3578,7 @@ void tx_stop(MGSLPC_INFO *info) | |||
3578 | 3578 | ||
3579 | /* Reset the adapter to a known state and prepare it for further use. | 3579 | /* Reset the adapter to a known state and prepare it for further use. |
3580 | */ | 3580 | */ |
3581 | void reset_device(MGSLPC_INFO *info) | 3581 | static void reset_device(MGSLPC_INFO *info) |
3582 | { | 3582 | { |
3583 | /* power up both channels (set BIT7) */ | 3583 | /* power up both channels (set BIT7) */ |
3584 | write_reg(info, CHA + CCR0, 0x80); | 3584 | write_reg(info, CHA + CCR0, 0x80); |
@@ -3628,7 +3628,7 @@ void reset_device(MGSLPC_INFO *info) | |||
3628 | write_reg(info, IPC, 0x05); | 3628 | write_reg(info, IPC, 0x05); |
3629 | } | 3629 | } |
3630 | 3630 | ||
3631 | void async_mode(MGSLPC_INFO *info) | 3631 | static void async_mode(MGSLPC_INFO *info) |
3632 | { | 3632 | { |
3633 | unsigned char val; | 3633 | unsigned char val; |
3634 | 3634 | ||
@@ -3799,7 +3799,7 @@ void async_mode(MGSLPC_INFO *info) | |||
3799 | 3799 | ||
3800 | /* Set the HDLC idle mode for the transmitter. | 3800 | /* Set the HDLC idle mode for the transmitter. |
3801 | */ | 3801 | */ |
3802 | void tx_set_idle(MGSLPC_INFO *info) | 3802 | static void tx_set_idle(MGSLPC_INFO *info) |
3803 | { | 3803 | { |
3804 | /* Note: ESCC2 only supports flags and one idle modes */ | 3804 | /* Note: ESCC2 only supports flags and one idle modes */ |
3805 | if (info->idle_mode == HDLC_TXIDLE_FLAGS) | 3805 | if (info->idle_mode == HDLC_TXIDLE_FLAGS) |
@@ -3810,7 +3810,7 @@ void tx_set_idle(MGSLPC_INFO *info) | |||
3810 | 3810 | ||
3811 | /* get state of the V24 status (input) signals. | 3811 | /* get state of the V24 status (input) signals. |
3812 | */ | 3812 | */ |
3813 | void get_signals(MGSLPC_INFO *info) | 3813 | static void get_signals(MGSLPC_INFO *info) |
3814 | { | 3814 | { |
3815 | unsigned char status = 0; | 3815 | unsigned char status = 0; |
3816 | 3816 | ||
@@ -3832,7 +3832,7 @@ void get_signals(MGSLPC_INFO *info) | |||
3832 | /* Set the state of DTR and RTS based on contents of | 3832 | /* Set the state of DTR and RTS based on contents of |
3833 | * serial_signals member of device extension. | 3833 | * serial_signals member of device extension. |
3834 | */ | 3834 | */ |
3835 | void set_signals(MGSLPC_INFO *info) | 3835 | static void set_signals(MGSLPC_INFO *info) |
3836 | { | 3836 | { |
3837 | unsigned char val; | 3837 | unsigned char val; |
3838 | 3838 | ||
@@ -3856,7 +3856,7 @@ void set_signals(MGSLPC_INFO *info) | |||
3856 | set_reg_bits(info, CHA + PVR, PVR_DTR); | 3856 | set_reg_bits(info, CHA + PVR, PVR_DTR); |
3857 | } | 3857 | } |
3858 | 3858 | ||
3859 | void rx_reset_buffers(MGSLPC_INFO *info) | 3859 | static void rx_reset_buffers(MGSLPC_INFO *info) |
3860 | { | 3860 | { |
3861 | RXBUF *buf; | 3861 | RXBUF *buf; |
3862 | int i; | 3862 | int i; |
@@ -3875,7 +3875,7 @@ void rx_reset_buffers(MGSLPC_INFO *info) | |||
3875 | * | 3875 | * |
3876 | * Returns 1 if frame returned, otherwise 0 | 3876 | * Returns 1 if frame returned, otherwise 0 |
3877 | */ | 3877 | */ |
3878 | int rx_get_frame(MGSLPC_INFO *info) | 3878 | static int rx_get_frame(MGSLPC_INFO *info) |
3879 | { | 3879 | { |
3880 | unsigned short status; | 3880 | unsigned short status; |
3881 | RXBUF *buf; | 3881 | RXBUF *buf; |
@@ -3961,7 +3961,7 @@ int rx_get_frame(MGSLPC_INFO *info) | |||
3961 | return 1; | 3961 | return 1; |
3962 | } | 3962 | } |
3963 | 3963 | ||
3964 | BOOLEAN register_test(MGSLPC_INFO *info) | 3964 | static BOOLEAN register_test(MGSLPC_INFO *info) |
3965 | { | 3965 | { |
3966 | static unsigned char patterns[] = | 3966 | static unsigned char patterns[] = |
3967 | { 0x00, 0xff, 0xaa, 0x55, 0x69, 0x96, 0x0f }; | 3967 | { 0x00, 0xff, 0xaa, 0x55, 0x69, 0x96, 0x0f }; |
@@ -3987,7 +3987,7 @@ BOOLEAN register_test(MGSLPC_INFO *info) | |||
3987 | return rc; | 3987 | return rc; |
3988 | } | 3988 | } |
3989 | 3989 | ||
3990 | BOOLEAN irq_test(MGSLPC_INFO *info) | 3990 | static BOOLEAN irq_test(MGSLPC_INFO *info) |
3991 | { | 3991 | { |
3992 | unsigned long end_time; | 3992 | unsigned long end_time; |
3993 | unsigned long flags; | 3993 | unsigned long flags; |
@@ -4022,7 +4022,7 @@ BOOLEAN irq_test(MGSLPC_INFO *info) | |||
4022 | return info->irq_occurred ? TRUE : FALSE; | 4022 | return info->irq_occurred ? TRUE : FALSE; |
4023 | } | 4023 | } |
4024 | 4024 | ||
4025 | int adapter_test(MGSLPC_INFO *info) | 4025 | static int adapter_test(MGSLPC_INFO *info) |
4026 | { | 4026 | { |
4027 | if (!register_test(info)) { | 4027 | if (!register_test(info)) { |
4028 | info->init_error = DiagStatus_AddressFailure; | 4028 | info->init_error = DiagStatus_AddressFailure; |
@@ -4044,7 +4044,7 @@ int adapter_test(MGSLPC_INFO *info) | |||
4044 | return 0; | 4044 | return 0; |
4045 | } | 4045 | } |
4046 | 4046 | ||
4047 | void trace_block(MGSLPC_INFO *info,const char* data, int count, int xmit) | 4047 | static void trace_block(MGSLPC_INFO *info,const char* data, int count, int xmit) |
4048 | { | 4048 | { |
4049 | int i; | 4049 | int i; |
4050 | int linecount; | 4050 | int linecount; |
@@ -4079,7 +4079,7 @@ void trace_block(MGSLPC_INFO *info,const char* data, int count, int xmit) | |||
4079 | /* HDLC frame time out | 4079 | /* HDLC frame time out |
4080 | * update stats and do tx completion processing | 4080 | * update stats and do tx completion processing |
4081 | */ | 4081 | */ |
4082 | void tx_timeout(unsigned long context) | 4082 | static void tx_timeout(unsigned long context) |
4083 | { | 4083 | { |
4084 | MGSLPC_INFO *info = (MGSLPC_INFO*)context; | 4084 | MGSLPC_INFO *info = (MGSLPC_INFO*)context; |
4085 | unsigned long flags; | 4085 | unsigned long flags; |
diff --git a/drivers/char/ppdev.c b/drivers/char/ppdev.c index bee6c47b45bd..520d2cf82bc0 100644 --- a/drivers/char/ppdev.c +++ b/drivers/char/ppdev.c | |||
@@ -60,7 +60,6 @@ | |||
60 | #include <linux/init.h> | 60 | #include <linux/init.h> |
61 | #include <linux/sched.h> | 61 | #include <linux/sched.h> |
62 | #include <linux/device.h> | 62 | #include <linux/device.h> |
63 | #include <linux/devfs_fs_kernel.h> | ||
64 | #include <linux/ioctl.h> | 63 | #include <linux/ioctl.h> |
65 | #include <linux/parport.h> | 64 | #include <linux/parport.h> |
66 | #include <linux/ctype.h> | 65 | #include <linux/ctype.h> |
@@ -740,7 +739,7 @@ static unsigned int pp_poll (struct file * file, poll_table * wait) | |||
740 | 739 | ||
741 | static struct class *ppdev_class; | 740 | static struct class *ppdev_class; |
742 | 741 | ||
743 | static struct file_operations pp_fops = { | 742 | static const struct file_operations pp_fops = { |
744 | .owner = THIS_MODULE, | 743 | .owner = THIS_MODULE, |
745 | .llseek = no_llseek, | 744 | .llseek = no_llseek, |
746 | .read = pp_read, | 745 | .read = pp_read, |
@@ -770,7 +769,7 @@ static struct parport_driver pp_driver = { | |||
770 | 769 | ||
771 | static int __init ppdev_init (void) | 770 | static int __init ppdev_init (void) |
772 | { | 771 | { |
773 | int i, err = 0; | 772 | int err = 0; |
774 | 773 | ||
775 | if (register_chrdev (PP_MAJOR, CHRDEV, &pp_fops)) { | 774 | if (register_chrdev (PP_MAJOR, CHRDEV, &pp_fops)) { |
776 | printk (KERN_WARNING CHRDEV ": unable to get major %d\n", | 775 | printk (KERN_WARNING CHRDEV ": unable to get major %d\n", |
@@ -782,11 +781,6 @@ static int __init ppdev_init (void) | |||
782 | err = PTR_ERR(ppdev_class); | 781 | err = PTR_ERR(ppdev_class); |
783 | goto out_chrdev; | 782 | goto out_chrdev; |
784 | } | 783 | } |
785 | devfs_mk_dir("parports"); | ||
786 | for (i = 0; i < PARPORT_MAX; i++) { | ||
787 | devfs_mk_cdev(MKDEV(PP_MAJOR, i), | ||
788 | S_IFCHR | S_IRUGO | S_IWUGO, "parports/%d", i); | ||
789 | } | ||
790 | if (parport_register_driver(&pp_driver)) { | 784 | if (parport_register_driver(&pp_driver)) { |
791 | printk (KERN_WARNING CHRDEV ": unable to register with parport\n"); | 785 | printk (KERN_WARNING CHRDEV ": unable to register with parport\n"); |
792 | goto out_class; | 786 | goto out_class; |
@@ -796,9 +790,6 @@ static int __init ppdev_init (void) | |||
796 | goto out; | 790 | goto out; |
797 | 791 | ||
798 | out_class: | 792 | out_class: |
799 | for (i = 0; i < PARPORT_MAX; i++) | ||
800 | devfs_remove("parports/%d", i); | ||
801 | devfs_remove("parports"); | ||
802 | class_destroy(ppdev_class); | 793 | class_destroy(ppdev_class); |
803 | out_chrdev: | 794 | out_chrdev: |
804 | unregister_chrdev(PP_MAJOR, CHRDEV); | 795 | unregister_chrdev(PP_MAJOR, CHRDEV); |
@@ -808,12 +799,8 @@ out: | |||
808 | 799 | ||
809 | static void __exit ppdev_cleanup (void) | 800 | static void __exit ppdev_cleanup (void) |
810 | { | 801 | { |
811 | int i; | ||
812 | /* Clean up all parport stuff */ | 802 | /* Clean up all parport stuff */ |
813 | for (i = 0; i < PARPORT_MAX; i++) | ||
814 | devfs_remove("parports/%d", i); | ||
815 | parport_unregister_driver(&pp_driver); | 803 | parport_unregister_driver(&pp_driver); |
816 | devfs_remove("parports"); | ||
817 | class_destroy(ppdev_class); | 804 | class_destroy(ppdev_class); |
818 | unregister_chrdev (PP_MAJOR, CHRDEV); | 805 | unregister_chrdev (PP_MAJOR, CHRDEV); |
819 | } | 806 | } |
diff --git a/drivers/char/pty.c b/drivers/char/pty.c index 9b5a2c0e7008..34dd4c38110e 100644 --- a/drivers/char/pty.c +++ b/drivers/char/pty.c | |||
@@ -11,7 +11,6 @@ | |||
11 | * | 11 | * |
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include <linux/config.h> | ||
15 | #include <linux/module.h> /* For EXPORT_SYMBOL */ | 14 | #include <linux/module.h> /* For EXPORT_SYMBOL */ |
16 | 15 | ||
17 | #include <linux/errno.h> | 16 | #include <linux/errno.h> |
@@ -24,7 +23,6 @@ | |||
24 | #include <linux/major.h> | 23 | #include <linux/major.h> |
25 | #include <linux/mm.h> | 24 | #include <linux/mm.h> |
26 | #include <linux/init.h> | 25 | #include <linux/init.h> |
27 | #include <linux/devfs_fs_kernel.h> | ||
28 | #include <linux/sysctl.h> | 26 | #include <linux/sysctl.h> |
29 | 27 | ||
30 | #include <asm/uaccess.h> | 28 | #include <asm/uaccess.h> |
@@ -101,7 +99,7 @@ static void pty_unthrottle(struct tty_struct * tty) | |||
101 | * | 99 | * |
102 | * FIXME: Our pty_write method is called with our ldisc lock held but | 100 | * FIXME: Our pty_write method is called with our ldisc lock held but |
103 | * not our partners. We can't just take the other one blindly without | 101 | * not our partners. We can't just take the other one blindly without |
104 | * risking deadlocks. There is also the small matter of TTY_DONT_FLIP | 102 | * risking deadlocks. |
105 | */ | 103 | */ |
106 | static int pty_write(struct tty_struct * tty, const unsigned char *buf, int count) | 104 | static int pty_write(struct tty_struct * tty, const unsigned char *buf, int count) |
107 | { | 105 | { |
@@ -265,7 +263,6 @@ static void __init legacy_pty_init(void) | |||
265 | pty_driver->owner = THIS_MODULE; | 263 | pty_driver->owner = THIS_MODULE; |
266 | pty_driver->driver_name = "pty_master"; | 264 | pty_driver->driver_name = "pty_master"; |
267 | pty_driver->name = "pty"; | 265 | pty_driver->name = "pty"; |
268 | pty_driver->devfs_name = "pty/m"; | ||
269 | pty_driver->major = PTY_MASTER_MAJOR; | 266 | pty_driver->major = PTY_MASTER_MAJOR; |
270 | pty_driver->minor_start = 0; | 267 | pty_driver->minor_start = 0; |
271 | pty_driver->type = TTY_DRIVER_TYPE_PTY; | 268 | pty_driver->type = TTY_DRIVER_TYPE_PTY; |
@@ -283,7 +280,6 @@ static void __init legacy_pty_init(void) | |||
283 | pty_slave_driver->owner = THIS_MODULE; | 280 | pty_slave_driver->owner = THIS_MODULE; |
284 | pty_slave_driver->driver_name = "pty_slave"; | 281 | pty_slave_driver->driver_name = "pty_slave"; |
285 | pty_slave_driver->name = "ttyp"; | 282 | pty_slave_driver->name = "ttyp"; |
286 | pty_slave_driver->devfs_name = "pty/s"; | ||
287 | pty_slave_driver->major = PTY_SLAVE_MAJOR; | 283 | pty_slave_driver->major = PTY_SLAVE_MAJOR; |
288 | pty_slave_driver->minor_start = 0; | 284 | pty_slave_driver->minor_start = 0; |
289 | pty_slave_driver->type = TTY_DRIVER_TYPE_PTY; | 285 | pty_slave_driver->type = TTY_DRIVER_TYPE_PTY; |
@@ -351,7 +347,6 @@ static int pty_unix98_ioctl(struct tty_struct *tty, struct file *file, | |||
351 | 347 | ||
352 | static void __init unix98_pty_init(void) | 348 | static void __init unix98_pty_init(void) |
353 | { | 349 | { |
354 | devfs_mk_dir("pts"); | ||
355 | ptm_driver = alloc_tty_driver(NR_UNIX98_PTY_MAX); | 350 | ptm_driver = alloc_tty_driver(NR_UNIX98_PTY_MAX); |
356 | if (!ptm_driver) | 351 | if (!ptm_driver) |
357 | panic("Couldn't allocate Unix98 ptm driver"); | 352 | panic("Couldn't allocate Unix98 ptm driver"); |
@@ -372,7 +367,7 @@ static void __init unix98_pty_init(void) | |||
372 | ptm_driver->init_termios.c_cflag = B38400 | CS8 | CREAD; | 367 | ptm_driver->init_termios.c_cflag = B38400 | CS8 | CREAD; |
373 | ptm_driver->init_termios.c_lflag = 0; | 368 | ptm_driver->init_termios.c_lflag = 0; |
374 | ptm_driver->flags = TTY_DRIVER_RESET_TERMIOS | TTY_DRIVER_REAL_RAW | | 369 | ptm_driver->flags = TTY_DRIVER_RESET_TERMIOS | TTY_DRIVER_REAL_RAW | |
375 | TTY_DRIVER_NO_DEVFS | TTY_DRIVER_DEVPTS_MEM; | 370 | TTY_DRIVER_DYNAMIC_DEV | TTY_DRIVER_DEVPTS_MEM; |
376 | ptm_driver->other = pts_driver; | 371 | ptm_driver->other = pts_driver; |
377 | tty_set_operations(ptm_driver, &pty_ops); | 372 | tty_set_operations(ptm_driver, &pty_ops); |
378 | ptm_driver->ioctl = pty_unix98_ioctl; | 373 | ptm_driver->ioctl = pty_unix98_ioctl; |
@@ -387,7 +382,7 @@ static void __init unix98_pty_init(void) | |||
387 | pts_driver->init_termios = tty_std_termios; | 382 | pts_driver->init_termios = tty_std_termios; |
388 | pts_driver->init_termios.c_cflag = B38400 | CS8 | CREAD; | 383 | pts_driver->init_termios.c_cflag = B38400 | CS8 | CREAD; |
389 | pts_driver->flags = TTY_DRIVER_RESET_TERMIOS | TTY_DRIVER_REAL_RAW | | 384 | pts_driver->flags = TTY_DRIVER_RESET_TERMIOS | TTY_DRIVER_REAL_RAW | |
390 | TTY_DRIVER_NO_DEVFS | TTY_DRIVER_DEVPTS_MEM; | 385 | TTY_DRIVER_DYNAMIC_DEV | TTY_DRIVER_DEVPTS_MEM; |
391 | pts_driver->other = ptm_driver; | 386 | pts_driver->other = ptm_driver; |
392 | tty_set_operations(pts_driver, &pty_ops); | 387 | tty_set_operations(pts_driver, &pty_ops); |
393 | 388 | ||
diff --git a/drivers/char/qtronix.c b/drivers/char/qtronix.c index 601d09baf9d7..9d134e98d2a0 100644 --- a/drivers/char/qtronix.c +++ b/drivers/char/qtronix.c | |||
@@ -33,7 +33,6 @@ | |||
33 | * 675 Mass Ave, Cambridge, MA 02139, USA. | 33 | * 675 Mass Ave, Cambridge, MA 02139, USA. |
34 | */ | 34 | */ |
35 | 35 | ||
36 | #include <linux/config.h> | ||
37 | 36 | ||
38 | /* | 37 | /* |
39 | * NOTE: | 38 | * NOTE: |
@@ -145,7 +144,7 @@ void __init init_qtronix_990P_kbd(void) | |||
145 | cir_port_init(cir); | 144 | cir_port_init(cir); |
146 | 145 | ||
147 | retval = request_irq(IT8172_CIR0_IRQ, kbd_int_handler, | 146 | retval = request_irq(IT8172_CIR0_IRQ, kbd_int_handler, |
148 | (unsigned long )(SA_INTERRUPT|SA_SHIRQ), | 147 | (unsigned long )(IRQF_DISABLED|IRQF_SHARED), |
149 | (const char *)"Qtronix IR Keyboard", (void *)cir); | 148 | (const char *)"Qtronix IR Keyboard", (void *)cir); |
150 | 149 | ||
151 | if (retval) { | 150 | if (retval) { |
diff --git a/drivers/char/random.c b/drivers/char/random.c index 58f3512c52e1..4c3a5ca9d8f7 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c | |||
@@ -224,7 +224,6 @@ | |||
224 | */ | 224 | */ |
225 | 225 | ||
226 | #include <linux/utsname.h> | 226 | #include <linux/utsname.h> |
227 | #include <linux/config.h> | ||
228 | #include <linux/module.h> | 227 | #include <linux/module.h> |
229 | #include <linux/kernel.h> | 228 | #include <linux/kernel.h> |
230 | #include <linux/major.h> | 229 | #include <linux/major.h> |
@@ -417,7 +416,7 @@ static struct entropy_store input_pool = { | |||
417 | .poolinfo = &poolinfo_table[0], | 416 | .poolinfo = &poolinfo_table[0], |
418 | .name = "input", | 417 | .name = "input", |
419 | .limit = 1, | 418 | .limit = 1, |
420 | .lock = SPIN_LOCK_UNLOCKED, | 419 | .lock = __SPIN_LOCK_UNLOCKED(&input_pool.lock), |
421 | .pool = input_pool_data | 420 | .pool = input_pool_data |
422 | }; | 421 | }; |
423 | 422 | ||
@@ -426,7 +425,7 @@ static struct entropy_store blocking_pool = { | |||
426 | .name = "blocking", | 425 | .name = "blocking", |
427 | .limit = 1, | 426 | .limit = 1, |
428 | .pull = &input_pool, | 427 | .pull = &input_pool, |
429 | .lock = SPIN_LOCK_UNLOCKED, | 428 | .lock = __SPIN_LOCK_UNLOCKED(&blocking_pool.lock), |
430 | .pool = blocking_pool_data | 429 | .pool = blocking_pool_data |
431 | }; | 430 | }; |
432 | 431 | ||
@@ -434,7 +433,7 @@ static struct entropy_store nonblocking_pool = { | |||
434 | .poolinfo = &poolinfo_table[1], | 433 | .poolinfo = &poolinfo_table[1], |
435 | .name = "nonblocking", | 434 | .name = "nonblocking", |
436 | .pull = &input_pool, | 435 | .pull = &input_pool, |
437 | .lock = SPIN_LOCK_UNLOCKED, | 436 | .lock = __SPIN_LOCK_UNLOCKED(&nonblocking_pool.lock), |
438 | .pool = nonblocking_pool_data | 437 | .pool = nonblocking_pool_data |
439 | }; | 438 | }; |
440 | 439 | ||
diff --git a/drivers/char/raw.c b/drivers/char/raw.c index 15a7b4086524..579868af4a54 100644 --- a/drivers/char/raw.c +++ b/drivers/char/raw.c | |||
@@ -10,7 +10,6 @@ | |||
10 | 10 | ||
11 | #include <linux/init.h> | 11 | #include <linux/init.h> |
12 | #include <linux/fs.h> | 12 | #include <linux/fs.h> |
13 | #include <linux/devfs_fs_kernel.h> | ||
14 | #include <linux/major.h> | 13 | #include <linux/major.h> |
15 | #include <linux/blkdev.h> | 14 | #include <linux/blkdev.h> |
16 | #include <linux/module.h> | 15 | #include <linux/module.h> |
@@ -31,7 +30,7 @@ struct raw_device_data { | |||
31 | static struct class *raw_class; | 30 | static struct class *raw_class; |
32 | static struct raw_device_data raw_devices[MAX_RAW_MINORS]; | 31 | static struct raw_device_data raw_devices[MAX_RAW_MINORS]; |
33 | static DEFINE_MUTEX(raw_mutex); | 32 | static DEFINE_MUTEX(raw_mutex); |
34 | static struct file_operations raw_ctl_fops; /* forward declaration */ | 33 | static const struct file_operations raw_ctl_fops; /* forward declaration */ |
35 | 34 | ||
36 | /* | 35 | /* |
37 | * Open/close code for raw IO. | 36 | * Open/close code for raw IO. |
@@ -262,7 +261,7 @@ static ssize_t raw_file_aio_write(struct kiocb *iocb, const char __user *buf, | |||
262 | } | 261 | } |
263 | 262 | ||
264 | 263 | ||
265 | static struct file_operations raw_fops = { | 264 | static const struct file_operations raw_fops = { |
266 | .read = generic_file_read, | 265 | .read = generic_file_read, |
267 | .aio_read = generic_file_aio_read, | 266 | .aio_read = generic_file_aio_read, |
268 | .write = raw_file_write, | 267 | .write = raw_file_write, |
@@ -275,7 +274,7 @@ static struct file_operations raw_fops = { | |||
275 | .owner = THIS_MODULE, | 274 | .owner = THIS_MODULE, |
276 | }; | 275 | }; |
277 | 276 | ||
278 | static struct file_operations raw_ctl_fops = { | 277 | static const struct file_operations raw_ctl_fops = { |
279 | .ioctl = raw_ctl_ioctl, | 278 | .ioctl = raw_ctl_ioctl, |
280 | .open = raw_open, | 279 | .open = raw_open, |
281 | .owner = THIS_MODULE, | 280 | .owner = THIS_MODULE, |
@@ -288,7 +287,6 @@ static struct cdev raw_cdev = { | |||
288 | 287 | ||
289 | static int __init raw_init(void) | 288 | static int __init raw_init(void) |
290 | { | 289 | { |
291 | int i; | ||
292 | dev_t dev = MKDEV(RAW_MAJOR, 0); | 290 | dev_t dev = MKDEV(RAW_MAJOR, 0); |
293 | 291 | ||
294 | if (register_chrdev_region(dev, MAX_RAW_MINORS, "raw")) | 292 | if (register_chrdev_region(dev, MAX_RAW_MINORS, "raw")) |
@@ -310,13 +308,6 @@ static int __init raw_init(void) | |||
310 | } | 308 | } |
311 | class_device_create(raw_class, NULL, MKDEV(RAW_MAJOR, 0), NULL, "rawctl"); | 309 | class_device_create(raw_class, NULL, MKDEV(RAW_MAJOR, 0), NULL, "rawctl"); |
312 | 310 | ||
313 | devfs_mk_cdev(MKDEV(RAW_MAJOR, 0), | ||
314 | S_IFCHR | S_IRUGO | S_IWUGO, | ||
315 | "raw/rawctl"); | ||
316 | for (i = 1; i < MAX_RAW_MINORS; i++) | ||
317 | devfs_mk_cdev(MKDEV(RAW_MAJOR, i), | ||
318 | S_IFCHR | S_IRUGO | S_IWUGO, | ||
319 | "raw/raw%d", i); | ||
320 | return 0; | 311 | return 0; |
321 | 312 | ||
322 | error: | 313 | error: |
@@ -326,12 +317,6 @@ error: | |||
326 | 317 | ||
327 | static void __exit raw_exit(void) | 318 | static void __exit raw_exit(void) |
328 | { | 319 | { |
329 | int i; | ||
330 | |||
331 | for (i = 1; i < MAX_RAW_MINORS; i++) | ||
332 | devfs_remove("raw/raw%d", i); | ||
333 | devfs_remove("raw/rawctl"); | ||
334 | devfs_remove("raw"); | ||
335 | class_device_destroy(raw_class, MKDEV(RAW_MAJOR, 0)); | 320 | class_device_destroy(raw_class, MKDEV(RAW_MAJOR, 0)); |
336 | class_destroy(raw_class); | 321 | class_destroy(raw_class); |
337 | cdev_del(&raw_cdev); | 322 | cdev_del(&raw_cdev); |
diff --git a/drivers/char/rio/daemon.h b/drivers/char/rio/daemon.h index 5818a8aa46e0..6e63f8b2c479 100644 --- a/drivers/char/rio/daemon.h +++ b/drivers/char/rio/daemon.h | |||
@@ -51,7 +51,7 @@ struct Error { | |||
51 | }; | 51 | }; |
52 | 52 | ||
53 | struct DownLoad { | 53 | struct DownLoad { |
54 | char *DataP; | 54 | char __user *DataP; |
55 | unsigned int Count; | 55 | unsigned int Count; |
56 | unsigned int ProductCode; | 56 | unsigned int ProductCode; |
57 | }; | 57 | }; |
@@ -83,18 +83,18 @@ struct PortSetup { | |||
83 | struct LpbReq { | 83 | struct LpbReq { |
84 | unsigned int Host; | 84 | unsigned int Host; |
85 | unsigned int Link; | 85 | unsigned int Link; |
86 | struct LPB *LpbP; | 86 | struct LPB __user *LpbP; |
87 | }; | 87 | }; |
88 | 88 | ||
89 | struct RupReq { | 89 | struct RupReq { |
90 | unsigned int HostNum; | 90 | unsigned int HostNum; |
91 | unsigned int RupNum; | 91 | unsigned int RupNum; |
92 | struct RUP *RupP; | 92 | struct RUP __user *RupP; |
93 | }; | 93 | }; |
94 | 94 | ||
95 | struct PortReq { | 95 | struct PortReq { |
96 | unsigned int SysPort; | 96 | unsigned int SysPort; |
97 | struct Port *PortP; | 97 | struct Port __user *PortP; |
98 | }; | 98 | }; |
99 | 99 | ||
100 | struct StreamInfo { | 100 | struct StreamInfo { |
@@ -105,12 +105,12 @@ struct StreamInfo { | |||
105 | 105 | ||
106 | struct HostReq { | 106 | struct HostReq { |
107 | unsigned int HostNum; | 107 | unsigned int HostNum; |
108 | struct Host *HostP; | 108 | struct Host __user *HostP; |
109 | }; | 109 | }; |
110 | 110 | ||
111 | struct HostDpRam { | 111 | struct HostDpRam { |
112 | unsigned int HostNum; | 112 | unsigned int HostNum; |
113 | struct DpRam *DpRamP; | 113 | struct DpRam __user *DpRamP; |
114 | }; | 114 | }; |
115 | 115 | ||
116 | struct DebugCtrl { | 116 | struct DebugCtrl { |
diff --git a/drivers/char/rio/func.h b/drivers/char/rio/func.h index e64fe9912394..6b039186856d 100644 --- a/drivers/char/rio/func.h +++ b/drivers/char/rio/func.h | |||
@@ -46,7 +46,7 @@ int RIOBootCodeRTA(struct rio_info *, struct DownLoad *); | |||
46 | int RIOBootCodeHOST(struct rio_info *, struct DownLoad *); | 46 | int RIOBootCodeHOST(struct rio_info *, struct DownLoad *); |
47 | int RIOBootCodeUNKNOWN(struct rio_info *, struct DownLoad *); | 47 | int RIOBootCodeUNKNOWN(struct rio_info *, struct DownLoad *); |
48 | void msec_timeout(struct Host *); | 48 | void msec_timeout(struct Host *); |
49 | int RIOBootRup(struct rio_info *, unsigned int, struct Host *, struct PKT *); | 49 | int RIOBootRup(struct rio_info *, unsigned int, struct Host *, struct PKT __iomem *); |
50 | int RIOBootOk(struct rio_info *, struct Host *, unsigned long); | 50 | int RIOBootOk(struct rio_info *, struct Host *, unsigned long); |
51 | int RIORtaBound(struct rio_info *, unsigned int); | 51 | int RIORtaBound(struct rio_info *, unsigned int); |
52 | void rio_fill_host_slot(int, int, unsigned int, struct Host *); | 52 | void rio_fill_host_slot(int, int, unsigned int, struct Host *); |
@@ -55,8 +55,8 @@ void rio_fill_host_slot(int, int, unsigned int, struct Host *); | |||
55 | int RIOFoadRta(struct Host *, struct Map *); | 55 | int RIOFoadRta(struct Host *, struct Map *); |
56 | int RIOZombieRta(struct Host *, struct Map *); | 56 | int RIOZombieRta(struct Host *, struct Map *); |
57 | int RIOCommandRta(struct rio_info *, unsigned long, int (*func) (struct Host *, struct Map *)); | 57 | int RIOCommandRta(struct rio_info *, unsigned long, int (*func) (struct Host *, struct Map *)); |
58 | int RIOIdentifyRta(struct rio_info *, void *); | 58 | int RIOIdentifyRta(struct rio_info *, void __user *); |
59 | int RIOKillNeighbour(struct rio_info *, void *); | 59 | int RIOKillNeighbour(struct rio_info *, void __user *); |
60 | int RIOSuspendBootRta(struct Host *, int, int); | 60 | int RIOSuspendBootRta(struct Host *, int, int); |
61 | int RIOFoadWakeup(struct rio_info *); | 61 | int RIOFoadWakeup(struct rio_info *); |
62 | struct CmdBlk *RIOGetCmdBlk(void); | 62 | struct CmdBlk *RIOGetCmdBlk(void); |
@@ -68,7 +68,8 @@ int RIORFlushEnable(unsigned long, struct CmdBlk *); | |||
68 | int RIOUnUse(unsigned long, struct CmdBlk *); | 68 | int RIOUnUse(unsigned long, struct CmdBlk *); |
69 | 69 | ||
70 | /* rioctrl.c */ | 70 | /* rioctrl.c */ |
71 | int riocontrol(struct rio_info *, dev_t, int, caddr_t, int); | 71 | int riocontrol(struct rio_info *, dev_t, int, unsigned long, int); |
72 | |||
72 | int RIOPreemptiveCmd(struct rio_info *, struct Port *, unsigned char); | 73 | int RIOPreemptiveCmd(struct rio_info *, struct Port *, unsigned char); |
73 | 74 | ||
74 | /* rioinit.c */ | 75 | /* rioinit.c */ |
@@ -77,13 +78,13 @@ void RIOInitHosts(struct rio_info *, struct RioHostInfo *); | |||
77 | void RIOISAinit(struct rio_info *, int); | 78 | void RIOISAinit(struct rio_info *, int); |
78 | int RIODoAT(struct rio_info *, int, int); | 79 | int RIODoAT(struct rio_info *, int, int); |
79 | caddr_t RIOCheckForATCard(int); | 80 | caddr_t RIOCheckForATCard(int); |
80 | int RIOAssignAT(struct rio_info *, int, caddr_t, int); | 81 | int RIOAssignAT(struct rio_info *, int, void __iomem *, int); |
81 | int RIOBoardTest(unsigned long, caddr_t, unsigned char, int); | 82 | int RIOBoardTest(unsigned long, void __iomem *, unsigned char, int); |
82 | void RIOAllocDataStructs(struct rio_info *); | 83 | void RIOAllocDataStructs(struct rio_info *); |
83 | void RIOSetupDataStructs(struct rio_info *); | 84 | void RIOSetupDataStructs(struct rio_info *); |
84 | int RIODefaultName(struct rio_info *, struct Host *, unsigned int); | 85 | int RIODefaultName(struct rio_info *, struct Host *, unsigned int); |
85 | struct rioVersion *RIOVersid(void); | 86 | struct rioVersion *RIOVersid(void); |
86 | void RIOHostReset(unsigned int, struct DpRam *, unsigned int); | 87 | void RIOHostReset(unsigned int, struct DpRam __iomem *, unsigned int); |
87 | 88 | ||
88 | /* riointr.c */ | 89 | /* riointr.c */ |
89 | void RIOTxEnable(char *); | 90 | void RIOTxEnable(char *); |
@@ -95,14 +96,14 @@ int RIOParam(struct Port *, int, int, int); | |||
95 | int RIODelay(struct Port *PortP, int); | 96 | int RIODelay(struct Port *PortP, int); |
96 | int RIODelay_ni(struct Port *PortP, int); | 97 | int RIODelay_ni(struct Port *PortP, int); |
97 | void ms_timeout(struct Port *); | 98 | void ms_timeout(struct Port *); |
98 | int can_add_transmit(struct PKT **, struct Port *); | 99 | int can_add_transmit(struct PKT __iomem **, struct Port *); |
99 | void add_transmit(struct Port *); | 100 | void add_transmit(struct Port *); |
100 | void put_free_end(struct Host *, struct PKT *); | 101 | void put_free_end(struct Host *, struct PKT __iomem *); |
101 | int can_remove_receive(struct PKT **, struct Port *); | 102 | int can_remove_receive(struct PKT __iomem **, struct Port *); |
102 | void remove_receive(struct Port *); | 103 | void remove_receive(struct Port *); |
103 | 104 | ||
104 | /* rioroute.c */ | 105 | /* rioroute.c */ |
105 | int RIORouteRup(struct rio_info *, unsigned int, struct Host *, struct PKT *); | 106 | int RIORouteRup(struct rio_info *, unsigned int, struct Host *, struct PKT __iomem *); |
106 | void RIOFixPhbs(struct rio_info *, struct Host *, unsigned int); | 107 | void RIOFixPhbs(struct rio_info *, struct Host *, unsigned int); |
107 | unsigned int GetUnitType(unsigned int); | 108 | unsigned int GetUnitType(unsigned int); |
108 | int RIOSetChange(struct rio_info *); | 109 | int RIOSetChange(struct rio_info *); |
@@ -139,7 +140,7 @@ int rio_isr_thread(char *); | |||
139 | struct rio_info *rio_info_store(int cmd, struct rio_info *p); | 140 | struct rio_info *rio_info_store(int cmd, struct rio_info *p); |
140 | #endif | 141 | #endif |
141 | 142 | ||
142 | extern void rio_copy_to_card(void *to, void *from, int len); | 143 | extern void rio_copy_to_card(void *from, void __iomem *to, int len); |
143 | extern int rio_minor(struct tty_struct *tty); | 144 | extern int rio_minor(struct tty_struct *tty); |
144 | extern int rio_ismodem(struct tty_struct *tty); | 145 | extern int rio_ismodem(struct tty_struct *tty); |
145 | 146 | ||
diff --git a/drivers/char/rio/host.h b/drivers/char/rio/host.h index 179cdbea712b..ee2ddea7a63a 100644 --- a/drivers/char/rio/host.h +++ b/drivers/char/rio/host.h | |||
@@ -48,8 +48,8 @@ struct Host { | |||
48 | unsigned char Ivec; /* POLLED or ivec number */ | 48 | unsigned char Ivec; /* POLLED or ivec number */ |
49 | unsigned char Mode; /* Control stuff */ | 49 | unsigned char Mode; /* Control stuff */ |
50 | unsigned char Slot; /* Slot */ | 50 | unsigned char Slot; /* Slot */ |
51 | caddr_t Caddr; /* KV address of DPRAM */ | 51 | void __iomem *Caddr; /* KV address of DPRAM */ |
52 | struct DpRam *CardP; /* KV address of DPRAM, with overlay */ | 52 | struct DpRam __iomem *CardP; /* KV address of DPRAM, with overlay */ |
53 | unsigned long PaddrP; /* Phys. address of DPRAM */ | 53 | unsigned long PaddrP; /* Phys. address of DPRAM */ |
54 | char Name[MAX_NAME_LEN]; /* The name of the host */ | 54 | char Name[MAX_NAME_LEN]; /* The name of the host */ |
55 | unsigned int UniqueNum; /* host unique number */ | 55 | unsigned int UniqueNum; /* host unique number */ |
@@ -57,7 +57,7 @@ struct Host { | |||
57 | unsigned int WorkToBeDone; /* set to true each interrupt */ | 57 | unsigned int WorkToBeDone; /* set to true each interrupt */ |
58 | unsigned int InIntr; /* Being serviced? */ | 58 | unsigned int InIntr; /* Being serviced? */ |
59 | unsigned int IntSrvDone; /* host's interrupt has been serviced */ | 59 | unsigned int IntSrvDone; /* host's interrupt has been serviced */ |
60 | void (*Copy) (void *, void *, int); /* copy func */ | 60 | void (*Copy) (void *, void __iomem *, int); /* copy func */ |
61 | struct timer_list timer; | 61 | struct timer_list timer; |
62 | /* | 62 | /* |
63 | ** I M P O R T A N T ! | 63 | ** I M P O R T A N T ! |
@@ -83,11 +83,11 @@ struct Host { | |||
83 | 83 | ||
84 | struct Top Topology[LINKS_PER_UNIT]; /* one per link */ | 84 | struct Top Topology[LINKS_PER_UNIT]; /* one per link */ |
85 | struct Map Mapping[MAX_RUP]; /* Mappings for host */ | 85 | struct Map Mapping[MAX_RUP]; /* Mappings for host */ |
86 | struct PHB *PhbP; /* Pointer to the PHB array */ | 86 | struct PHB __iomem *PhbP; /* Pointer to the PHB array */ |
87 | unsigned short *PhbNumP; /* Ptr to Number of PHB's */ | 87 | unsigned short __iomem *PhbNumP; /* Ptr to Number of PHB's */ |
88 | struct LPB *LinkStrP; /* Link Structure Array */ | 88 | struct LPB __iomem *LinkStrP; /* Link Structure Array */ |
89 | struct RUP *RupP; /* Sixteen real rups here */ | 89 | struct RUP __iomem *RupP; /* Sixteen real rups here */ |
90 | struct PARM_MAP *ParmMapP; /* points to the parmmap */ | 90 | struct PARM_MAP __iomem *ParmMapP; /* points to the parmmap */ |
91 | unsigned int ExtraUnits[MAX_EXTRA_UNITS]; /* unknown things */ | 91 | unsigned int ExtraUnits[MAX_EXTRA_UNITS]; /* unknown things */ |
92 | unsigned int NumExtraBooted; /* how many of the above */ | 92 | unsigned int NumExtraBooted; /* how many of the above */ |
93 | /* | 93 | /* |
diff --git a/drivers/char/rio/port.h b/drivers/char/rio/port.h index 9b5fa3eb0402..49cf6d15ee54 100644 --- a/drivers/char/rio/port.h +++ b/drivers/char/rio/port.h | |||
@@ -40,7 +40,7 @@ struct Port { | |||
40 | struct gs_port gs; | 40 | struct gs_port gs; |
41 | int PortNum; /* RIO port no., 0-511 */ | 41 | int PortNum; /* RIO port no., 0-511 */ |
42 | struct Host *HostP; | 42 | struct Host *HostP; |
43 | caddr_t Caddr; | 43 | void __iomem *Caddr; |
44 | unsigned short HostPort; /* Port number on host card */ | 44 | unsigned short HostPort; /* Port number on host card */ |
45 | unsigned char RupNum; /* Number of RUP for port */ | 45 | unsigned char RupNum; /* Number of RUP for port */ |
46 | unsigned char ID2; /* Second ID of RTA for port */ | 46 | unsigned char ID2; /* Second ID of RTA for port */ |
@@ -92,13 +92,13 @@ struct Port { | |||
92 | #define RIO_RTSFLOW 0x0400 /* RIO's own RTSFLOW flag */ | 92 | #define RIO_RTSFLOW 0x0400 /* RIO's own RTSFLOW flag */ |
93 | 93 | ||
94 | 94 | ||
95 | struct PHB *PhbP; /* pointer to PHB for port */ | 95 | struct PHB __iomem *PhbP; /* pointer to PHB for port */ |
96 | u16 *TxAdd; /* Add packets here */ | 96 | u16 __iomem *TxAdd; /* Add packets here */ |
97 | u16 *TxStart; /* Start of add array */ | 97 | u16 __iomem *TxStart; /* Start of add array */ |
98 | u16 *TxEnd; /* End of add array */ | 98 | u16 __iomem *TxEnd; /* End of add array */ |
99 | u16 *RxRemove; /* Remove packets here */ | 99 | u16 __iomem *RxRemove; /* Remove packets here */ |
100 | u16 *RxStart; /* Start of remove array */ | 100 | u16 __iomem *RxStart; /* Start of remove array */ |
101 | u16 *RxEnd; /* End of remove array */ | 101 | u16 __iomem *RxEnd; /* End of remove array */ |
102 | unsigned int RtaUniqueNum; /* Unique number of RTA */ | 102 | unsigned int RtaUniqueNum; /* Unique number of RTA */ |
103 | unsigned short PortState; /* status of port */ | 103 | unsigned short PortState; /* status of port */ |
104 | unsigned short ModemState; /* status of modem lines */ | 104 | unsigned short ModemState; /* status of modem lines */ |
diff --git a/drivers/char/rio/rio.h b/drivers/char/rio/rio.h index b4c91871ba28..1bf36223a4e8 100644 --- a/drivers/char/rio/rio.h +++ b/drivers/char/rio/rio.h | |||
@@ -129,8 +129,8 @@ | |||
129 | ** RIO_OBJ takes hostp->Caddr and a UNIX pointer to an object and | 129 | ** RIO_OBJ takes hostp->Caddr and a UNIX pointer to an object and |
130 | ** returns the offset into the DP RAM area. | 130 | ** returns the offset into the DP RAM area. |
131 | */ | 131 | */ |
132 | #define RIO_PTR(C,O) (((unsigned char *)(C))+(0xFFFF&(O))) | 132 | #define RIO_PTR(C,O) (((unsigned char __iomem *)(C))+(0xFFFF&(O))) |
133 | #define RIO_OFF(C,O) ((long)(O)-(long)(C)) | 133 | #define RIO_OFF(C,O) ((unsigned char __iomem *)(O)-(unsigned char __iomem *)(C)) |
134 | 134 | ||
135 | /* | 135 | /* |
136 | ** How to convert from various different device number formats: | 136 | ** How to convert from various different device number formats: |
diff --git a/drivers/char/rio/rio_linux.c b/drivers/char/rio/rio_linux.c index 78dd856534ce..3fa80aaf4527 100644 --- a/drivers/char/rio/rio_linux.c +++ b/drivers/char/rio/rio_linux.c | |||
@@ -33,7 +33,6 @@ | |||
33 | * */ | 33 | * */ |
34 | 34 | ||
35 | #include <linux/module.h> | 35 | #include <linux/module.h> |
36 | #include <linux/config.h> | ||
37 | #include <linux/kdev_t.h> | 36 | #include <linux/kdev_t.h> |
38 | #include <asm/io.h> | 37 | #include <asm/io.h> |
39 | #include <linux/kernel.h> | 38 | #include <linux/kernel.h> |
@@ -244,7 +243,7 @@ static struct real_driver rio_real_driver = { | |||
244 | * | 243 | * |
245 | */ | 244 | */ |
246 | 245 | ||
247 | static struct file_operations rio_fw_fops = { | 246 | static const struct file_operations rio_fw_fops = { |
248 | .owner = THIS_MODULE, | 247 | .owner = THIS_MODULE, |
249 | .ioctl = rio_fw_ioctl, | 248 | .ioctl = rio_fw_ioctl, |
250 | }; | 249 | }; |
@@ -333,9 +332,9 @@ int RIODelay_ni(struct Port *PortP, int njiffies) | |||
333 | return !RIO_FAIL; | 332 | return !RIO_FAIL; |
334 | } | 333 | } |
335 | 334 | ||
336 | void rio_copy_to_card(void *to, void *from, int len) | 335 | void rio_copy_to_card(void *from, void __iomem *to, int len) |
337 | { | 336 | { |
338 | rio_memcpy_toio(NULL, to, from, len); | 337 | rio_copy_toio(to, from, len); |
339 | } | 338 | } |
340 | 339 | ||
341 | int rio_minor(struct tty_struct *tty) | 340 | int rio_minor(struct tty_struct *tty) |
@@ -573,7 +572,7 @@ static int rio_fw_ioctl(struct inode *inode, struct file *filp, unsigned int cmd | |||
573 | func_enter(); | 572 | func_enter(); |
574 | 573 | ||
575 | /* The "dev" argument isn't used. */ | 574 | /* The "dev" argument isn't used. */ |
576 | rc = riocontrol(p, 0, cmd, (void *) arg, capable(CAP_SYS_ADMIN)); | 575 | rc = riocontrol(p, 0, cmd, arg, capable(CAP_SYS_ADMIN)); |
577 | 576 | ||
578 | func_exit(); | 577 | func_exit(); |
579 | return rc; | 578 | return rc; |
@@ -583,6 +582,7 @@ extern int RIOShortCommand(struct rio_info *p, struct Port *PortP, int command, | |||
583 | 582 | ||
584 | static int rio_ioctl(struct tty_struct *tty, struct file *filp, unsigned int cmd, unsigned long arg) | 583 | static int rio_ioctl(struct tty_struct *tty, struct file *filp, unsigned int cmd, unsigned long arg) |
585 | { | 584 | { |
585 | void __user *argp = (void __user *)arg; | ||
586 | int rc; | 586 | int rc; |
587 | struct Port *PortP; | 587 | struct Port *PortP; |
588 | int ival; | 588 | int ival; |
@@ -594,14 +594,14 @@ static int rio_ioctl(struct tty_struct *tty, struct file *filp, unsigned int cmd | |||
594 | rc = 0; | 594 | rc = 0; |
595 | switch (cmd) { | 595 | switch (cmd) { |
596 | case TIOCSSOFTCAR: | 596 | case TIOCSSOFTCAR: |
597 | if ((rc = get_user(ival, (unsigned int *) arg)) == 0) { | 597 | if ((rc = get_user(ival, (unsigned __user *) argp)) == 0) { |
598 | tty->termios->c_cflag = (tty->termios->c_cflag & ~CLOCAL) | (ival ? CLOCAL : 0); | 598 | tty->termios->c_cflag = (tty->termios->c_cflag & ~CLOCAL) | (ival ? CLOCAL : 0); |
599 | } | 599 | } |
600 | break; | 600 | break; |
601 | case TIOCGSERIAL: | 601 | case TIOCGSERIAL: |
602 | rc = -EFAULT; | 602 | rc = -EFAULT; |
603 | if (access_ok(VERIFY_WRITE, (void *) arg, sizeof(struct serial_struct))) | 603 | if (access_ok(VERIFY_WRITE, argp, sizeof(struct serial_struct))) |
604 | rc = gs_getserial(&PortP->gs, (struct serial_struct *) arg); | 604 | rc = gs_getserial(&PortP->gs, argp); |
605 | break; | 605 | break; |
606 | case TCSBRK: | 606 | case TCSBRK: |
607 | if (PortP->State & RIO_DELETED) { | 607 | if (PortP->State & RIO_DELETED) { |
@@ -631,8 +631,8 @@ static int rio_ioctl(struct tty_struct *tty, struct file *filp, unsigned int cmd | |||
631 | break; | 631 | break; |
632 | case TIOCSSERIAL: | 632 | case TIOCSSERIAL: |
633 | rc = -EFAULT; | 633 | rc = -EFAULT; |
634 | if (access_ok(VERIFY_READ, (void *) arg, sizeof(struct serial_struct))) | 634 | if (access_ok(VERIFY_READ, argp, sizeof(struct serial_struct))) |
635 | rc = gs_setserial(&PortP->gs, (struct serial_struct *) arg); | 635 | rc = gs_setserial(&PortP->gs, argp); |
636 | break; | 636 | break; |
637 | default: | 637 | default: |
638 | rc = -ENOIOCTLCMD; | 638 | rc = -ENOIOCTLCMD; |
@@ -919,7 +919,7 @@ static void __exit rio_release_drivers(void) | |||
919 | static void fix_rio_pci(struct pci_dev *pdev) | 919 | static void fix_rio_pci(struct pci_dev *pdev) |
920 | { | 920 | { |
921 | unsigned long hwbase; | 921 | unsigned long hwbase; |
922 | unsigned char *rebase; | 922 | unsigned char __iomem *rebase; |
923 | unsigned int t; | 923 | unsigned int t; |
924 | 924 | ||
925 | #define CNTRL_REG_OFFSET 0x50 | 925 | #define CNTRL_REG_OFFSET 0x50 |
@@ -999,7 +999,7 @@ static int __init rio_init(void) | |||
999 | if (((1 << hp->Ivec) & rio_irqmask) == 0) | 999 | if (((1 << hp->Ivec) & rio_irqmask) == 0) |
1000 | hp->Ivec = 0; | 1000 | hp->Ivec = 0; |
1001 | hp->Caddr = ioremap(p->RIOHosts[p->RIONumHosts].PaddrP, RIO_WINDOW_LEN); | 1001 | hp->Caddr = ioremap(p->RIOHosts[p->RIONumHosts].PaddrP, RIO_WINDOW_LEN); |
1002 | hp->CardP = (struct DpRam *) hp->Caddr; | 1002 | hp->CardP = (struct DpRam __iomem *) hp->Caddr; |
1003 | hp->Type = RIO_PCI; | 1003 | hp->Type = RIO_PCI; |
1004 | hp->Copy = rio_copy_to_card; | 1004 | hp->Copy = rio_copy_to_card; |
1005 | hp->Mode = RIO_PCI_BOOT_FROM_RAM; | 1005 | hp->Mode = RIO_PCI_BOOT_FROM_RAM; |
@@ -1021,7 +1021,7 @@ static int __init rio_init(void) | |||
1021 | p->RIONumHosts++; | 1021 | p->RIONumHosts++; |
1022 | found++; | 1022 | found++; |
1023 | } else { | 1023 | } else { |
1024 | iounmap((char *) (p->RIOHosts[p->RIONumHosts].Caddr)); | 1024 | iounmap(p->RIOHosts[p->RIONumHosts].Caddr); |
1025 | } | 1025 | } |
1026 | } | 1026 | } |
1027 | 1027 | ||
@@ -1047,7 +1047,7 @@ static int __init rio_init(void) | |||
1047 | hp->Ivec = 0; | 1047 | hp->Ivec = 0; |
1048 | hp->Ivec |= 0x8000; /* Mark as non-sharable */ | 1048 | hp->Ivec |= 0x8000; /* Mark as non-sharable */ |
1049 | hp->Caddr = ioremap(p->RIOHosts[p->RIONumHosts].PaddrP, RIO_WINDOW_LEN); | 1049 | hp->Caddr = ioremap(p->RIOHosts[p->RIONumHosts].PaddrP, RIO_WINDOW_LEN); |
1050 | hp->CardP = (struct DpRam *) hp->Caddr; | 1050 | hp->CardP = (struct DpRam __iomem *) hp->Caddr; |
1051 | hp->Type = RIO_PCI; | 1051 | hp->Type = RIO_PCI; |
1052 | hp->Copy = rio_copy_to_card; | 1052 | hp->Copy = rio_copy_to_card; |
1053 | hp->Mode = RIO_PCI_BOOT_FROM_RAM; | 1053 | hp->Mode = RIO_PCI_BOOT_FROM_RAM; |
@@ -1070,7 +1070,7 @@ static int __init rio_init(void) | |||
1070 | p->RIONumHosts++; | 1070 | p->RIONumHosts++; |
1071 | found++; | 1071 | found++; |
1072 | } else { | 1072 | } else { |
1073 | iounmap((char *) (p->RIOHosts[p->RIONumHosts].Caddr)); | 1073 | iounmap(p->RIOHosts[p->RIONumHosts].Caddr); |
1074 | } | 1074 | } |
1075 | #else | 1075 | #else |
1076 | printk(KERN_ERR "Found an older RIO PCI card, but the driver is not " "compiled to support it.\n"); | 1076 | printk(KERN_ERR "Found an older RIO PCI card, but the driver is not " "compiled to support it.\n"); |
@@ -1085,7 +1085,7 @@ static int __init rio_init(void) | |||
1085 | /* There was something about the IRQs of these cards. 'Forget what.--REW */ | 1085 | /* There was something about the IRQs of these cards. 'Forget what.--REW */ |
1086 | hp->Ivec = 0; | 1086 | hp->Ivec = 0; |
1087 | hp->Caddr = ioremap(p->RIOHosts[p->RIONumHosts].PaddrP, RIO_WINDOW_LEN); | 1087 | hp->Caddr = ioremap(p->RIOHosts[p->RIONumHosts].PaddrP, RIO_WINDOW_LEN); |
1088 | hp->CardP = (struct DpRam *) hp->Caddr; | 1088 | hp->CardP = (struct DpRam __iomem *) hp->Caddr; |
1089 | hp->Type = RIO_AT; | 1089 | hp->Type = RIO_AT; |
1090 | hp->Copy = rio_copy_to_card; /* AT card PCI???? - PVDL | 1090 | hp->Copy = rio_copy_to_card; /* AT card PCI???? - PVDL |
1091 | * -- YES! this is now a normal copy. Only the | 1091 | * -- YES! this is now a normal copy. Only the |
@@ -1111,7 +1111,7 @@ static int __init rio_init(void) | |||
1111 | } | 1111 | } |
1112 | 1112 | ||
1113 | if (!okboard) | 1113 | if (!okboard) |
1114 | iounmap((char *) (hp->Caddr)); | 1114 | iounmap(hp->Caddr); |
1115 | } | 1115 | } |
1116 | } | 1116 | } |
1117 | 1117 | ||
@@ -1119,7 +1119,7 @@ static int __init rio_init(void) | |||
1119 | for (i = 0; i < p->RIONumHosts; i++) { | 1119 | for (i = 0; i < p->RIONumHosts; i++) { |
1120 | hp = &p->RIOHosts[i]; | 1120 | hp = &p->RIOHosts[i]; |
1121 | if (hp->Ivec) { | 1121 | if (hp->Ivec) { |
1122 | int mode = SA_SHIRQ; | 1122 | int mode = IRQF_SHARED; |
1123 | if (hp->Ivec & 0x8000) { | 1123 | if (hp->Ivec & 0x8000) { |
1124 | mode = 0; | 1124 | mode = 0; |
1125 | hp->Ivec &= 0x7fff; | 1125 | hp->Ivec &= 0x7fff; |
diff --git a/drivers/char/rio/rio_linux.h b/drivers/char/rio/rio_linux.h index 4ce77fb1fae5..dc3f005614a3 100644 --- a/drivers/char/rio/rio_linux.h +++ b/drivers/char/rio/rio_linux.h | |||
@@ -23,7 +23,6 @@ | |||
23 | * Version 1.0 -- July, 1999. | 23 | * Version 1.0 -- July, 1999. |
24 | * | 24 | * |
25 | */ | 25 | */ |
26 | #include <linux/config.h> | ||
27 | 26 | ||
28 | #define RIO_NBOARDS 4 | 27 | #define RIO_NBOARDS 4 |
29 | #define RIO_PORTSPERBOARD 128 | 28 | #define RIO_PORTSPERBOARD 128 |
@@ -131,9 +130,9 @@ struct vpd_prom { | |||
131 | 130 | ||
132 | 131 | ||
133 | #ifdef CONFIG_RIO_OLDPCI | 132 | #ifdef CONFIG_RIO_OLDPCI |
134 | static inline void *rio_memcpy_toio(void *dummy, void *dest, void *source, int n) | 133 | static inline void __iomem *rio_memcpy_toio(void __iomem *dummy, void __iomem *dest, void *source, int n) |
135 | { | 134 | { |
136 | char *dst = dest; | 135 | char __iomem *dst = dest; |
137 | char *src = source; | 136 | char *src = source; |
138 | 137 | ||
139 | while (n--) { | 138 | while (n--) { |
@@ -144,11 +143,22 @@ static inline void *rio_memcpy_toio(void *dummy, void *dest, void *source, int n | |||
144 | return dest; | 143 | return dest; |
145 | } | 144 | } |
146 | 145 | ||
146 | static inline void __iomem *rio_copy_toio(void __iomem *dest, void *source, int n) | ||
147 | { | ||
148 | char __iomem *dst = dest; | ||
149 | char *src = source; | ||
150 | |||
151 | while (n--) | ||
152 | writeb(*src++, dst++); | ||
147 | 153 | ||
148 | static inline void *rio_memcpy_fromio(void *dest, void *source, int n) | 154 | return dest; |
155 | } | ||
156 | |||
157 | |||
158 | static inline void *rio_memcpy_fromio(void *dest, void __iomem *source, int n) | ||
149 | { | 159 | { |
150 | char *dst = dest; | 160 | char *dst = dest; |
151 | char *src = source; | 161 | char __iomem *src = source; |
152 | 162 | ||
153 | while (n--) | 163 | while (n--) |
154 | *dst++ = readb(src++); | 164 | *dst++ = readb(src++); |
@@ -158,6 +168,7 @@ static inline void *rio_memcpy_fromio(void *dest, void *source, int n) | |||
158 | 168 | ||
159 | #else | 169 | #else |
160 | #define rio_memcpy_toio(dummy,dest,source,n) memcpy_toio(dest, source, n) | 170 | #define rio_memcpy_toio(dummy,dest,source,n) memcpy_toio(dest, source, n) |
171 | #define rio_copy_toio memcpy_toio | ||
161 | #define rio_memcpy_fromio memcpy_fromio | 172 | #define rio_memcpy_fromio memcpy_fromio |
162 | #endif | 173 | #endif |
163 | 174 | ||
diff --git a/drivers/char/rio/rioboot.c b/drivers/char/rio/rioboot.c index 290143addd34..eca2b95343e2 100644 --- a/drivers/char/rio/rioboot.c +++ b/drivers/char/rio/rioboot.c | |||
@@ -71,7 +71,7 @@ | |||
71 | #include "cmdblk.h" | 71 | #include "cmdblk.h" |
72 | #include "route.h" | 72 | #include "route.h" |
73 | 73 | ||
74 | static int RIOBootComplete(struct rio_info *p, struct Host *HostP, unsigned int Rup, struct PktCmd *PktCmdP); | 74 | static int RIOBootComplete(struct rio_info *p, struct Host *HostP, unsigned int Rup, struct PktCmd __iomem *PktCmdP); |
75 | 75 | ||
76 | static const unsigned char RIOAtVec2Ctrl[] = { | 76 | static const unsigned char RIOAtVec2Ctrl[] = { |
77 | /* 0 */ INTERRUPT_DISABLE, | 77 | /* 0 */ INTERRUPT_DISABLE, |
@@ -204,13 +204,13 @@ void rio_start_card_running(struct Host *HostP) | |||
204 | int RIOBootCodeHOST(struct rio_info *p, struct DownLoad *rbp) | 204 | int RIOBootCodeHOST(struct rio_info *p, struct DownLoad *rbp) |
205 | { | 205 | { |
206 | struct Host *HostP; | 206 | struct Host *HostP; |
207 | u8 *Cad; | 207 | u8 __iomem *Cad; |
208 | PARM_MAP *ParmMapP; | 208 | PARM_MAP __iomem *ParmMapP; |
209 | int RupN; | 209 | int RupN; |
210 | int PortN; | 210 | int PortN; |
211 | unsigned int host; | 211 | unsigned int host; |
212 | u8 *StartP; | 212 | u8 __iomem *StartP; |
213 | u8 *DestP; | 213 | u8 __iomem *DestP; |
214 | int wait_count; | 214 | int wait_count; |
215 | u16 OldParmMap; | 215 | u16 OldParmMap; |
216 | u16 offset; /* It is very important that this is a u16 */ | 216 | u16 offset; /* It is very important that this is a u16 */ |
@@ -262,7 +262,7 @@ int RIOBootCodeHOST(struct rio_info *p, struct DownLoad *rbp) | |||
262 | ** Ensure that the host really is stopped. | 262 | ** Ensure that the host really is stopped. |
263 | ** Disable it's external bus & twang its reset line. | 263 | ** Disable it's external bus & twang its reset line. |
264 | */ | 264 | */ |
265 | RIOHostReset(HostP->Type, (struct DpRam *) HostP->CardP, HostP->Slot); | 265 | RIOHostReset(HostP->Type, HostP->CardP, HostP->Slot); |
266 | 266 | ||
267 | /* | 267 | /* |
268 | ** Copy the data directly from user space to the SRAM. | 268 | ** Copy the data directly from user space to the SRAM. |
@@ -280,7 +280,7 @@ int RIOBootCodeHOST(struct rio_info *p, struct DownLoad *rbp) | |||
280 | func_exit(); | 280 | func_exit(); |
281 | return -ENOMEM; | 281 | return -ENOMEM; |
282 | } | 282 | } |
283 | if (copy_from_user(rbp->DataP, DownCode, rbp->Count)) { | 283 | if (copy_from_user(DownCode, rbp->DataP, rbp->Count)) { |
284 | kfree(DownCode); | 284 | kfree(DownCode); |
285 | p->RIOError.Error = COPYIN_FAILED; | 285 | p->RIOError.Error = COPYIN_FAILED; |
286 | func_exit(); | 286 | func_exit(); |
@@ -366,7 +366,7 @@ int RIOBootCodeHOST(struct rio_info *p, struct DownLoad *rbp) | |||
366 | ** a short branch to 0x7FF8, where a long branch is coded. | 366 | ** a short branch to 0x7FF8, where a long branch is coded. |
367 | */ | 367 | */ |
368 | 368 | ||
369 | DestP = (u8 *) &Cad[0x7FF8]; /* <<<---- READ THE ABOVE COMMENTS */ | 369 | DestP = &Cad[0x7FF8]; /* <<<---- READ THE ABOVE COMMENTS */ |
370 | 370 | ||
371 | #define NFIX(N) (0x60 | (N)) /* .O = (~(.O + N))<<4 */ | 371 | #define NFIX(N) (0x60 | (N)) /* .O = (~(.O + N))<<4 */ |
372 | #define PFIX(N) (0x20 | (N)) /* .O = (.O + N)<<4 */ | 372 | #define PFIX(N) (0x20 | (N)) /* .O = (.O + N)<<4 */ |
@@ -438,7 +438,7 @@ int RIOBootCodeHOST(struct rio_info *p, struct DownLoad *rbp) | |||
438 | rio_dprintk(RIO_DEBUG_BOOT, "RIO Mesg Run Fail\n"); | 438 | rio_dprintk(RIO_DEBUG_BOOT, "RIO Mesg Run Fail\n"); |
439 | HostP->Flags &= ~RUN_STATE; | 439 | HostP->Flags &= ~RUN_STATE; |
440 | HostP->Flags |= RC_STUFFED; | 440 | HostP->Flags |= RC_STUFFED; |
441 | RIOHostReset( HostP->Type, (struct DpRam *)HostP->CardP, HostP->Slot ); | 441 | RIOHostReset( HostP->Type, HostP->CardP, HostP->Slot ); |
442 | continue; | 442 | continue; |
443 | } | 443 | } |
444 | 444 | ||
@@ -453,9 +453,9 @@ int RIOBootCodeHOST(struct rio_info *p, struct DownLoad *rbp) | |||
453 | /* | 453 | /* |
454 | ** Grab a 32 bit pointer to the parmmap structure | 454 | ** Grab a 32 bit pointer to the parmmap structure |
455 | */ | 455 | */ |
456 | ParmMapP = (PARM_MAP *) RIO_PTR(Cad, readw(&HostP->__ParmMapR)); | 456 | ParmMapP = (PARM_MAP __iomem *) RIO_PTR(Cad, readw(&HostP->__ParmMapR)); |
457 | rio_dprintk(RIO_DEBUG_BOOT, "ParmMapP : %p\n", ParmMapP); | 457 | rio_dprintk(RIO_DEBUG_BOOT, "ParmMapP : %p\n", ParmMapP); |
458 | ParmMapP = (PARM_MAP *) ((unsigned long) Cad + readw(&HostP->__ParmMapR)); | 458 | ParmMapP = (PARM_MAP __iomem *)(Cad + readw(&HostP->__ParmMapR)); |
459 | rio_dprintk(RIO_DEBUG_BOOT, "ParmMapP : %p\n", ParmMapP); | 459 | rio_dprintk(RIO_DEBUG_BOOT, "ParmMapP : %p\n", ParmMapP); |
460 | 460 | ||
461 | /* | 461 | /* |
@@ -468,7 +468,7 @@ int RIOBootCodeHOST(struct rio_info *p, struct DownLoad *rbp) | |||
468 | rio_dprintk(RIO_DEBUG_BOOT, "Links = 0x%x\n", readw(&ParmMapP->links)); | 468 | rio_dprintk(RIO_DEBUG_BOOT, "Links = 0x%x\n", readw(&ParmMapP->links)); |
469 | HostP->Flags &= ~RUN_STATE; | 469 | HostP->Flags &= ~RUN_STATE; |
470 | HostP->Flags |= RC_STUFFED; | 470 | HostP->Flags |= RC_STUFFED; |
471 | RIOHostReset( HostP->Type, (struct DpRam *)HostP->CardP, HostP->Slot ); | 471 | RIOHostReset( HostP->Type, HostP->CardP, HostP->Slot ); |
472 | continue; | 472 | continue; |
473 | } | 473 | } |
474 | 474 | ||
@@ -491,7 +491,7 @@ int RIOBootCodeHOST(struct rio_info *p, struct DownLoad *rbp) | |||
491 | rio_dprintk(RIO_DEBUG_BOOT, "Timedout waiting for init_done\n"); | 491 | rio_dprintk(RIO_DEBUG_BOOT, "Timedout waiting for init_done\n"); |
492 | HostP->Flags &= ~RUN_STATE; | 492 | HostP->Flags &= ~RUN_STATE; |
493 | HostP->Flags |= RC_STUFFED; | 493 | HostP->Flags |= RC_STUFFED; |
494 | RIOHostReset( HostP->Type, (struct DpRam *)HostP->CardP, HostP->Slot ); | 494 | RIOHostReset( HostP->Type, HostP->CardP, HostP->Slot ); |
495 | continue; | 495 | continue; |
496 | } | 496 | } |
497 | 497 | ||
@@ -512,10 +512,10 @@ int RIOBootCodeHOST(struct rio_info *p, struct DownLoad *rbp) | |||
512 | ** 32 bit pointers for the driver in ioremap space. | 512 | ** 32 bit pointers for the driver in ioremap space. |
513 | */ | 513 | */ |
514 | HostP->ParmMapP = ParmMapP; | 514 | HostP->ParmMapP = ParmMapP; |
515 | HostP->PhbP = (struct PHB *) RIO_PTR(Cad, readw(&ParmMapP->phb_ptr)); | 515 | HostP->PhbP = (struct PHB __iomem *) RIO_PTR(Cad, readw(&ParmMapP->phb_ptr)); |
516 | HostP->RupP = (struct RUP *) RIO_PTR(Cad, readw(&ParmMapP->rups)); | 516 | HostP->RupP = (struct RUP __iomem *) RIO_PTR(Cad, readw(&ParmMapP->rups)); |
517 | HostP->PhbNumP = (unsigned short *) RIO_PTR(Cad, readw(&ParmMapP->phb_num_ptr)); | 517 | HostP->PhbNumP = (unsigned short __iomem *) RIO_PTR(Cad, readw(&ParmMapP->phb_num_ptr)); |
518 | HostP->LinkStrP = (struct LPB *) RIO_PTR(Cad, readw(&ParmMapP->link_str_ptr)); | 518 | HostP->LinkStrP = (struct LPB __iomem *) RIO_PTR(Cad, readw(&ParmMapP->link_str_ptr)); |
519 | 519 | ||
520 | /* | 520 | /* |
521 | ** point the UnixRups at the real Rups | 521 | ** point the UnixRups at the real Rups |
@@ -540,7 +540,7 @@ int RIOBootCodeHOST(struct rio_info *p, struct DownLoad *rbp) | |||
540 | for (PortN = p->RIOFirstPortsMapped; PortN < p->RIOLastPortsMapped + PORTS_PER_RTA; PortN++) { | 540 | for (PortN = p->RIOFirstPortsMapped; PortN < p->RIOLastPortsMapped + PORTS_PER_RTA; PortN++) { |
541 | if (p->RIOPortp[PortN]->HostP == HostP) { | 541 | if (p->RIOPortp[PortN]->HostP == HostP) { |
542 | struct Port *PortP = p->RIOPortp[PortN]; | 542 | struct Port *PortP = p->RIOPortp[PortN]; |
543 | struct PHB *PhbP; | 543 | struct PHB __iomem *PhbP; |
544 | /* int oldspl; */ | 544 | /* int oldspl; */ |
545 | 545 | ||
546 | if (!PortP->Mapped) | 546 | if (!PortP->Mapped) |
@@ -551,12 +551,12 @@ int RIOBootCodeHOST(struct rio_info *p, struct DownLoad *rbp) | |||
551 | 551 | ||
552 | PortP->PhbP = PhbP; | 552 | PortP->PhbP = PhbP; |
553 | 553 | ||
554 | PortP->TxAdd = (u16 *) RIO_PTR(Cad, readw(&PhbP->tx_add)); | 554 | PortP->TxAdd = (u16 __iomem *) RIO_PTR(Cad, readw(&PhbP->tx_add)); |
555 | PortP->TxStart = (u16 *) RIO_PTR(Cad, readw(&PhbP->tx_start)); | 555 | PortP->TxStart = (u16 __iomem *) RIO_PTR(Cad, readw(&PhbP->tx_start)); |
556 | PortP->TxEnd = (u16 *) RIO_PTR(Cad, readw(&PhbP->tx_end)); | 556 | PortP->TxEnd = (u16 __iomem *) RIO_PTR(Cad, readw(&PhbP->tx_end)); |
557 | PortP->RxRemove = (u16 *) RIO_PTR(Cad, readw(&PhbP->rx_remove)); | 557 | PortP->RxRemove = (u16 __iomem *) RIO_PTR(Cad, readw(&PhbP->rx_remove)); |
558 | PortP->RxStart = (u16 *) RIO_PTR(Cad, readw(&PhbP->rx_start)); | 558 | PortP->RxStart = (u16 __iomem *) RIO_PTR(Cad, readw(&PhbP->rx_start)); |
559 | PortP->RxEnd = (u16 *) RIO_PTR(Cad, readw(&PhbP->rx_end)); | 559 | PortP->RxEnd = (u16 __iomem *) RIO_PTR(Cad, readw(&PhbP->rx_end)); |
560 | 560 | ||
561 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 561 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
562 | /* | 562 | /* |
@@ -601,9 +601,9 @@ int RIOBootCodeHOST(struct rio_info *p, struct DownLoad *rbp) | |||
601 | * return 1. If we havent, then return 0. | 601 | * return 1. If we havent, then return 0. |
602 | */ | 602 | */ |
603 | 603 | ||
604 | int RIOBootRup(struct rio_info *p, unsigned int Rup, struct Host *HostP, struct PKT *PacketP) | 604 | int RIOBootRup(struct rio_info *p, unsigned int Rup, struct Host *HostP, struct PKT __iomem *PacketP) |
605 | { | 605 | { |
606 | struct PktCmd *PktCmdP = (struct PktCmd *) PacketP->data; | 606 | struct PktCmd __iomem *PktCmdP = (struct PktCmd __iomem *) PacketP->data; |
607 | struct PktCmd_M *PktReplyP; | 607 | struct PktCmd_M *PktReplyP; |
608 | struct CmdBlk *CmdBlkP; | 608 | struct CmdBlk *CmdBlkP; |
609 | unsigned int sequence; | 609 | unsigned int sequence; |
@@ -722,7 +722,7 @@ int RIOBootRup(struct rio_info *p, unsigned int Rup, struct Host *HostP, struct | |||
722 | * RtaUniq is the booted RTA. | 722 | * RtaUniq is the booted RTA. |
723 | */ | 723 | */ |
724 | 724 | ||
725 | static int RIOBootComplete(struct rio_info *p, struct Host *HostP, unsigned int Rup, struct PktCmd *PktCmdP) | 725 | static int RIOBootComplete(struct rio_info *p, struct Host *HostP, unsigned int Rup, struct PktCmd __iomem *PktCmdP) |
726 | { | 726 | { |
727 | struct Map *MapP = NULL; | 727 | struct Map *MapP = NULL; |
728 | struct Map *MapP2 = NULL; | 728 | struct Map *MapP2 = NULL; |
diff --git a/drivers/char/rio/riocmd.c b/drivers/char/rio/riocmd.c index e6d2b14b5e65..4df6ab2206a1 100644 --- a/drivers/char/rio/riocmd.c +++ b/drivers/char/rio/riocmd.c | |||
@@ -180,7 +180,7 @@ int RIOCommandRta(struct rio_info *p, unsigned long RtaUnique, int (*func) (stru | |||
180 | } | 180 | } |
181 | 181 | ||
182 | 182 | ||
183 | int RIOIdentifyRta(struct rio_info *p, void * arg) | 183 | int RIOIdentifyRta(struct rio_info *p, void __user * arg) |
184 | { | 184 | { |
185 | unsigned int Host; | 185 | unsigned int Host; |
186 | 186 | ||
@@ -245,7 +245,7 @@ int RIOIdentifyRta(struct rio_info *p, void * arg) | |||
245 | } | 245 | } |
246 | 246 | ||
247 | 247 | ||
248 | int RIOKillNeighbour(struct rio_info *p, void * arg) | 248 | int RIOKillNeighbour(struct rio_info *p, void __user * arg) |
249 | { | 249 | { |
250 | uint Host; | 250 | uint Host; |
251 | uint ID; | 251 | uint ID; |
@@ -370,9 +370,9 @@ int RIOFoadWakeup(struct rio_info *p) | |||
370 | /* | 370 | /* |
371 | ** Incoming command on the COMMAND_RUP to be processed. | 371 | ** Incoming command on the COMMAND_RUP to be processed. |
372 | */ | 372 | */ |
373 | static int RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, struct PKT * PacketP) | 373 | static int RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, struct PKT __iomem *PacketP) |
374 | { | 374 | { |
375 | struct PktCmd *PktCmdP = (struct PktCmd *) PacketP->data; | 375 | struct PktCmd __iomem *PktCmdP = (struct PktCmd __iomem *)PacketP->data; |
376 | struct Port *PortP; | 376 | struct Port *PortP; |
377 | struct UnixRup *UnixRupP; | 377 | struct UnixRup *UnixRupP; |
378 | unsigned short SysPort; | 378 | unsigned short SysPort; |
@@ -407,12 +407,12 @@ static int RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, struc | |||
407 | } else | 407 | } else |
408 | rio_dprintk(RIO_DEBUG_CMD, "CONTROL information: This is the RUP for link ``%c'' of host ``%s''\n", ('A' + Rup - MAX_RUP), HostP->Name); | 408 | rio_dprintk(RIO_DEBUG_CMD, "CONTROL information: This is the RUP for link ``%c'' of host ``%s''\n", ('A' + Rup - MAX_RUP), HostP->Name); |
409 | 409 | ||
410 | rio_dprintk(RIO_DEBUG_CMD, "PACKET information: Destination 0x%x:0x%x\n", PacketP->dest_unit, PacketP->dest_port); | 410 | rio_dprintk(RIO_DEBUG_CMD, "PACKET information: Destination 0x%x:0x%x\n", readb(&PacketP->dest_unit), readb(&PacketP->dest_port)); |
411 | rio_dprintk(RIO_DEBUG_CMD, "PACKET information: Source 0x%x:0x%x\n", PacketP->src_unit, PacketP->src_port); | 411 | rio_dprintk(RIO_DEBUG_CMD, "PACKET information: Source 0x%x:0x%x\n", readb(&PacketP->src_unit), readb(&PacketP->src_port)); |
412 | rio_dprintk(RIO_DEBUG_CMD, "PACKET information: Length 0x%x (%d)\n", PacketP->len, PacketP->len); | 412 | rio_dprintk(RIO_DEBUG_CMD, "PACKET information: Length 0x%x (%d)\n", readb(&PacketP->len), readb(&PacketP->len)); |
413 | rio_dprintk(RIO_DEBUG_CMD, "PACKET information: Control 0x%x (%d)\n", PacketP->control, PacketP->control); | 413 | rio_dprintk(RIO_DEBUG_CMD, "PACKET information: Control 0x%x (%d)\n", readb(&PacketP->control), readb(&PacketP->control)); |
414 | rio_dprintk(RIO_DEBUG_CMD, "PACKET information: Check 0x%x (%d)\n", PacketP->csum, PacketP->csum); | 414 | rio_dprintk(RIO_DEBUG_CMD, "PACKET information: Check 0x%x (%d)\n", readw(&PacketP->csum), readw(&PacketP->csum)); |
415 | rio_dprintk(RIO_DEBUG_CMD, "COMMAND information: Host Port Number 0x%x, " "Command Code 0x%x\n", PktCmdP->PhbNum, PktCmdP->Command); | 415 | rio_dprintk(RIO_DEBUG_CMD, "COMMAND information: Host Port Number 0x%x, " "Command Code 0x%x\n", readb(&PktCmdP->PhbNum), readb(&PktCmdP->Command)); |
416 | return 1; | 416 | return 1; |
417 | } | 417 | } |
418 | PortP = p->RIOPortp[SysPort]; | 418 | PortP = p->RIOPortp[SysPort]; |
@@ -601,7 +601,7 @@ int RIOQueueCmdBlk(struct Host *HostP, uint Rup, struct CmdBlk *CmdBlkP) | |||
601 | /* | 601 | /* |
602 | ** Whammy! blat that pack! | 602 | ** Whammy! blat that pack! |
603 | */ | 603 | */ |
604 | HostP->Copy((caddr_t) & CmdBlkP->Packet, RIO_PTR(HostP->Caddr, UnixRupP->RupP->txpkt), sizeof(struct PKT)); | 604 | HostP->Copy(&CmdBlkP->Packet, RIO_PTR(HostP->Caddr, readw(&UnixRupP->RupP->txpkt)), sizeof(struct PKT)); |
605 | 605 | ||
606 | /* | 606 | /* |
607 | ** place command packet on the pending position. | 607 | ** place command packet on the pending position. |
@@ -655,7 +655,7 @@ void RIOPollHostCommands(struct rio_info *p, struct Host *HostP) | |||
655 | { | 655 | { |
656 | struct CmdBlk *CmdBlkP; | 656 | struct CmdBlk *CmdBlkP; |
657 | struct UnixRup *UnixRupP; | 657 | struct UnixRup *UnixRupP; |
658 | struct PKT *PacketP; | 658 | struct PKT __iomem *PacketP; |
659 | unsigned short Rup; | 659 | unsigned short Rup; |
660 | unsigned long flags; | 660 | unsigned long flags; |
661 | 661 | ||
@@ -676,7 +676,7 @@ void RIOPollHostCommands(struct rio_info *p, struct Host *HostP) | |||
676 | if (readw(&UnixRupP->RupP->rxcontrol) != RX_RUP_INACTIVE) { | 676 | if (readw(&UnixRupP->RupP->rxcontrol) != RX_RUP_INACTIVE) { |
677 | int FreeMe; | 677 | int FreeMe; |
678 | 678 | ||
679 | PacketP = (struct PKT *) RIO_PTR(HostP->Caddr, readw(&UnixRupP->RupP->rxpkt)); | 679 | PacketP = (struct PKT __iomem *) RIO_PTR(HostP->Caddr, readw(&UnixRupP->RupP->rxpkt)); |
680 | 680 | ||
681 | switch (readb(&PacketP->dest_port)) { | 681 | switch (readb(&PacketP->dest_port)) { |
682 | case BOOT_RUP: | 682 | case BOOT_RUP: |
@@ -694,9 +694,9 @@ void RIOPollHostCommands(struct rio_info *p, struct Host *HostP) | |||
694 | */ | 694 | */ |
695 | rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags); | 695 | rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags); |
696 | FreeMe = RIOCommandRup(p, Rup, HostP, PacketP); | 696 | FreeMe = RIOCommandRup(p, Rup, HostP, PacketP); |
697 | if (PacketP->data[5] == MEMDUMP) { | 697 | if (readb(&PacketP->data[5]) == MEMDUMP) { |
698 | rio_dprintk(RIO_DEBUG_CMD, "Memdump from 0x%x complete\n", *(unsigned short *) & (PacketP->data[6])); | 698 | rio_dprintk(RIO_DEBUG_CMD, "Memdump from 0x%x complete\n", readw(&(PacketP->data[6]))); |
699 | HostP->Copy((caddr_t) & (PacketP->data[8]), (caddr_t) p->RIOMemDump, 32); | 699 | rio_memcpy_fromio(p->RIOMemDump, &(PacketP->data[8]), 32); |
700 | } | 700 | } |
701 | rio_spin_lock_irqsave(&UnixRupP->RupLock, flags); | 701 | rio_spin_lock_irqsave(&UnixRupP->RupLock, flags); |
702 | break; | 702 | break; |
@@ -782,7 +782,7 @@ void RIOPollHostCommands(struct rio_info *p, struct Host *HostP) | |||
782 | /* | 782 | /* |
783 | ** Whammy! blat that pack! | 783 | ** Whammy! blat that pack! |
784 | */ | 784 | */ |
785 | HostP->Copy((caddr_t) & CmdBlkP->Packet, RIO_PTR(HostP->Caddr, UnixRupP->RupP->txpkt), sizeof(struct PKT)); | 785 | HostP->Copy(&CmdBlkP->Packet, RIO_PTR(HostP->Caddr, readw(&UnixRupP->RupP->txpkt)), sizeof(struct PKT)); |
786 | 786 | ||
787 | /* | 787 | /* |
788 | ** remove the command from the rup command queue... | 788 | ** remove the command from the rup command queue... |
@@ -824,7 +824,7 @@ int RIOWFlushMark(unsigned long iPortP, struct CmdBlk *CmdBlkP) | |||
824 | int RIORFlushEnable(unsigned long iPortP, struct CmdBlk *CmdBlkP) | 824 | int RIORFlushEnable(unsigned long iPortP, struct CmdBlk *CmdBlkP) |
825 | { | 825 | { |
826 | struct Port *PortP = (struct Port *) iPortP; | 826 | struct Port *PortP = (struct Port *) iPortP; |
827 | struct PKT *PacketP; | 827 | struct PKT __iomem *PacketP; |
828 | unsigned long flags; | 828 | unsigned long flags; |
829 | 829 | ||
830 | rio_spin_lock_irqsave(&PortP->portSem, flags); | 830 | rio_spin_lock_irqsave(&PortP->portSem, flags); |
diff --git a/drivers/char/rio/rioctrl.c b/drivers/char/rio/rioctrl.c index 75b2557c37ec..052e8120a471 100644 --- a/drivers/char/rio/rioctrl.c +++ b/drivers/char/rio/rioctrl.c | |||
@@ -80,7 +80,7 @@ static char *_rioctrl_c_sccs_ = "@(#)rioctrl.c 1.3"; | |||
80 | static struct LpbReq LpbReq; | 80 | static struct LpbReq LpbReq; |
81 | static struct RupReq RupReq; | 81 | static struct RupReq RupReq; |
82 | static struct PortReq PortReq; | 82 | static struct PortReq PortReq; |
83 | static struct HostReq HostReq; | 83 | static struct HostReq HostReq; /* oh really? global? and no locking? */ |
84 | static struct HostDpRam HostDpRam; | 84 | static struct HostDpRam HostDpRam; |
85 | static struct DebugCtrl DebugCtrl; | 85 | static struct DebugCtrl DebugCtrl; |
86 | static struct Map MapEnt; | 86 | static struct Map MapEnt; |
@@ -126,12 +126,19 @@ static int | |||
126 | 126 | ||
127 | #define drv_makedev(maj, min) ((((uint) maj & 0xff) << 8) | ((uint) min & 0xff)) | 127 | #define drv_makedev(maj, min) ((((uint) maj & 0xff) << 8) | ((uint) min & 0xff)) |
128 | 128 | ||
129 | int riocontrol(p, dev, cmd, arg, su) | 129 | static int copy_from_io(void __user *to, void __iomem *from, size_t size) |
130 | struct rio_info *p; | 130 | { |
131 | dev_t dev; | 131 | void *buf = kmalloc(size, GFP_KERNEL); |
132 | int cmd; | 132 | int res = -ENOMEM; |
133 | caddr_t arg; | 133 | if (buf) { |
134 | int su; | 134 | rio_memcpy_fromio(buf, from, size); |
135 | res = copy_to_user(to, buf, size); | ||
136 | kfree(buf); | ||
137 | } | ||
138 | return res; | ||
139 | } | ||
140 | |||
141 | int riocontrol(struct rio_info *p, dev_t dev, int cmd, unsigned long arg, int su) | ||
135 | { | 142 | { |
136 | uint Host; /* leave me unsigned! */ | 143 | uint Host; /* leave me unsigned! */ |
137 | uint port; /* and me! */ | 144 | uint port; /* and me! */ |
@@ -139,9 +146,10 @@ int su; | |||
139 | ushort loop; | 146 | ushort loop; |
140 | int Entry; | 147 | int Entry; |
141 | struct Port *PortP; | 148 | struct Port *PortP; |
142 | struct PKT *PacketP; | 149 | struct PKT __iomem *PacketP; |
143 | int retval = 0; | 150 | int retval = 0; |
144 | unsigned long flags; | 151 | unsigned long flags; |
152 | void __user *argp = (void __user *)arg; | ||
145 | 153 | ||
146 | func_enter(); | 154 | func_enter(); |
147 | 155 | ||
@@ -149,7 +157,7 @@ int su; | |||
149 | Host = 0; | 157 | Host = 0; |
150 | PortP = NULL; | 158 | PortP = NULL; |
151 | 159 | ||
152 | rio_dprintk(RIO_DEBUG_CTRL, "control ioctl cmd: 0x%x arg: %p\n", cmd, arg); | 160 | rio_dprintk(RIO_DEBUG_CTRL, "control ioctl cmd: 0x%x arg: %p\n", cmd, argp); |
153 | 161 | ||
154 | switch (cmd) { | 162 | switch (cmd) { |
155 | /* | 163 | /* |
@@ -160,11 +168,11 @@ int su; | |||
160 | ** otherwise just the specified host card will be changed. | 168 | ** otherwise just the specified host card will be changed. |
161 | */ | 169 | */ |
162 | case RIO_SET_TIMER: | 170 | case RIO_SET_TIMER: |
163 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_SET_TIMER to %ldms\n", (unsigned long)arg); | 171 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_SET_TIMER to %ldms\n", arg); |
164 | { | 172 | { |
165 | int host, value; | 173 | int host, value; |
166 | host = ((unsigned long) arg >> 16) & 0x0000FFFF; | 174 | host = (arg >> 16) & 0x0000FFFF; |
167 | value = (unsigned long) arg & 0x0000ffff; | 175 | value = arg & 0x0000ffff; |
168 | if (host == -1) { | 176 | if (host == -1) { |
169 | for (host = 0; host < p->RIONumHosts; host++) { | 177 | for (host = 0; host < p->RIONumHosts; host++) { |
170 | if (p->RIOHosts[host].Flags == RC_RUNNING) { | 178 | if (p->RIOHosts[host].Flags == RC_RUNNING) { |
@@ -183,26 +191,26 @@ int su; | |||
183 | 191 | ||
184 | case RIO_FOAD_RTA: | 192 | case RIO_FOAD_RTA: |
185 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_FOAD_RTA\n"); | 193 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_FOAD_RTA\n"); |
186 | return RIOCommandRta(p, (unsigned long)arg, RIOFoadRta); | 194 | return RIOCommandRta(p, arg, RIOFoadRta); |
187 | 195 | ||
188 | case RIO_ZOMBIE_RTA: | 196 | case RIO_ZOMBIE_RTA: |
189 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_ZOMBIE_RTA\n"); | 197 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_ZOMBIE_RTA\n"); |
190 | return RIOCommandRta(p, (unsigned long)arg, RIOZombieRta); | 198 | return RIOCommandRta(p, arg, RIOZombieRta); |
191 | 199 | ||
192 | case RIO_IDENTIFY_RTA: | 200 | case RIO_IDENTIFY_RTA: |
193 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_IDENTIFY_RTA\n"); | 201 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_IDENTIFY_RTA\n"); |
194 | return RIOIdentifyRta(p, arg); | 202 | return RIOIdentifyRta(p, argp); |
195 | 203 | ||
196 | case RIO_KILL_NEIGHBOUR: | 204 | case RIO_KILL_NEIGHBOUR: |
197 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_KILL_NEIGHBOUR\n"); | 205 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_KILL_NEIGHBOUR\n"); |
198 | return RIOKillNeighbour(p, arg); | 206 | return RIOKillNeighbour(p, argp); |
199 | 207 | ||
200 | case SPECIAL_RUP_CMD: | 208 | case SPECIAL_RUP_CMD: |
201 | { | 209 | { |
202 | struct CmdBlk *CmdBlkP; | 210 | struct CmdBlk *CmdBlkP; |
203 | 211 | ||
204 | rio_dprintk(RIO_DEBUG_CTRL, "SPECIAL_RUP_CMD\n"); | 212 | rio_dprintk(RIO_DEBUG_CTRL, "SPECIAL_RUP_CMD\n"); |
205 | if (copy_from_user(&SpecialRupCmd, arg, sizeof(SpecialRupCmd))) { | 213 | if (copy_from_user(&SpecialRupCmd, argp, sizeof(SpecialRupCmd))) { |
206 | rio_dprintk(RIO_DEBUG_CTRL, "SPECIAL_RUP_CMD copy failed\n"); | 214 | rio_dprintk(RIO_DEBUG_CTRL, "SPECIAL_RUP_CMD copy failed\n"); |
207 | p->RIOError.Error = COPYIN_FAILED; | 215 | p->RIOError.Error = COPYIN_FAILED; |
208 | return -EFAULT; | 216 | return -EFAULT; |
@@ -239,7 +247,7 @@ int su; | |||
239 | if ((retval = RIOApel(p)) != 0) | 247 | if ((retval = RIOApel(p)) != 0) |
240 | return retval; | 248 | return retval; |
241 | 249 | ||
242 | if (copy_to_user(arg, p->RIOConnectTable, TOTAL_MAP_ENTRIES * sizeof(struct Map))) { | 250 | if (copy_to_user(argp, p->RIOConnectTable, TOTAL_MAP_ENTRIES * sizeof(struct Map))) { |
243 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_TABLE copy failed\n"); | 251 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_TABLE copy failed\n"); |
244 | p->RIOError.Error = COPYOUT_FAILED; | 252 | p->RIOError.Error = COPYOUT_FAILED; |
245 | return -EFAULT; | 253 | return -EFAULT; |
@@ -284,7 +292,7 @@ int su; | |||
284 | p->RIOError.Error = NOT_SUPER_USER; | 292 | p->RIOError.Error = NOT_SUPER_USER; |
285 | return -EPERM; | 293 | return -EPERM; |
286 | } | 294 | } |
287 | if (copy_from_user(&p->RIOConnectTable[0], arg, TOTAL_MAP_ENTRIES * sizeof(struct Map))) { | 295 | if (copy_from_user(&p->RIOConnectTable[0], argp, TOTAL_MAP_ENTRIES * sizeof(struct Map))) { |
288 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_PUT_TABLE copy failed\n"); | 296 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_PUT_TABLE copy failed\n"); |
289 | p->RIOError.Error = COPYIN_FAILED; | 297 | p->RIOError.Error = COPYIN_FAILED; |
290 | return -EFAULT; | 298 | return -EFAULT; |
@@ -330,7 +338,7 @@ int su; | |||
330 | p->RIOError.Error = NOT_SUPER_USER; | 338 | p->RIOError.Error = NOT_SUPER_USER; |
331 | return -EPERM; | 339 | return -EPERM; |
332 | } | 340 | } |
333 | if (copy_to_user(arg, p->RIOBindTab, (sizeof(ulong) * MAX_RTA_BINDINGS))) { | 341 | if (copy_to_user(argp, p->RIOBindTab, (sizeof(ulong) * MAX_RTA_BINDINGS))) { |
334 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_BINDINGS copy failed\n"); | 342 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_BINDINGS copy failed\n"); |
335 | p->RIOError.Error = COPYOUT_FAILED; | 343 | p->RIOError.Error = COPYOUT_FAILED; |
336 | return -EFAULT; | 344 | return -EFAULT; |
@@ -349,7 +357,7 @@ int su; | |||
349 | p->RIOError.Error = NOT_SUPER_USER; | 357 | p->RIOError.Error = NOT_SUPER_USER; |
350 | return -EPERM; | 358 | return -EPERM; |
351 | } | 359 | } |
352 | if (copy_from_user(&p->RIOBindTab[0], arg, (sizeof(ulong) * MAX_RTA_BINDINGS))) { | 360 | if (copy_from_user(&p->RIOBindTab[0], argp, (sizeof(ulong) * MAX_RTA_BINDINGS))) { |
353 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_PUT_BINDINGS copy failed\n"); | 361 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_PUT_BINDINGS copy failed\n"); |
354 | p->RIOError.Error = COPYIN_FAILED; | 362 | p->RIOError.Error = COPYIN_FAILED; |
355 | return -EFAULT; | 363 | return -EFAULT; |
@@ -373,12 +381,12 @@ int su; | |||
373 | for (Entry = 0; Entry < MAX_RTA_BINDINGS; Entry++) { | 381 | for (Entry = 0; Entry < MAX_RTA_BINDINGS; Entry++) { |
374 | if ((EmptySlot == -1) && (p->RIOBindTab[Entry] == 0L)) | 382 | if ((EmptySlot == -1) && (p->RIOBindTab[Entry] == 0L)) |
375 | EmptySlot = Entry; | 383 | EmptySlot = Entry; |
376 | else if (p->RIOBindTab[Entry] == (long)arg) { | 384 | else if (p->RIOBindTab[Entry] == arg) { |
377 | /* | 385 | /* |
378 | ** Already exists - delete | 386 | ** Already exists - delete |
379 | */ | 387 | */ |
380 | p->RIOBindTab[Entry] = 0L; | 388 | p->RIOBindTab[Entry] = 0L; |
381 | rio_dprintk(RIO_DEBUG_CTRL, "Removing Rta %ld from p->RIOBindTab\n", (unsigned long)arg); | 389 | rio_dprintk(RIO_DEBUG_CTRL, "Removing Rta %ld from p->RIOBindTab\n", arg); |
382 | return 0; | 390 | return 0; |
383 | } | 391 | } |
384 | } | 392 | } |
@@ -386,10 +394,10 @@ int su; | |||
386 | ** Dosen't exist - add | 394 | ** Dosen't exist - add |
387 | */ | 395 | */ |
388 | if (EmptySlot != -1) { | 396 | if (EmptySlot != -1) { |
389 | p->RIOBindTab[EmptySlot] = (unsigned long)arg; | 397 | p->RIOBindTab[EmptySlot] = arg; |
390 | rio_dprintk(RIO_DEBUG_CTRL, "Adding Rta %lx to p->RIOBindTab\n", (unsigned long) arg); | 398 | rio_dprintk(RIO_DEBUG_CTRL, "Adding Rta %lx to p->RIOBindTab\n", arg); |
391 | } else { | 399 | } else { |
392 | rio_dprintk(RIO_DEBUG_CTRL, "p->RIOBindTab full! - Rta %lx not added\n", (unsigned long) arg); | 400 | rio_dprintk(RIO_DEBUG_CTRL, "p->RIOBindTab full! - Rta %lx not added\n", arg); |
393 | return -ENOMEM; | 401 | return -ENOMEM; |
394 | } | 402 | } |
395 | return 0; | 403 | return 0; |
@@ -397,7 +405,7 @@ int su; | |||
397 | 405 | ||
398 | case RIO_RESUME: | 406 | case RIO_RESUME: |
399 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_RESUME\n"); | 407 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_RESUME\n"); |
400 | port = (unsigned long) arg; | 408 | port = arg; |
401 | if ((port < 0) || (port > 511)) { | 409 | if ((port < 0) || (port > 511)) { |
402 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_RESUME: Bad port number %d\n", port); | 410 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_RESUME: Bad port number %d\n", port); |
403 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; | 411 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; |
@@ -433,7 +441,7 @@ int su; | |||
433 | p->RIOError.Error = NOT_SUPER_USER; | 441 | p->RIOError.Error = NOT_SUPER_USER; |
434 | return -EPERM; | 442 | return -EPERM; |
435 | } | 443 | } |
436 | if (copy_from_user(&MapEnt, arg, sizeof(MapEnt))) { | 444 | if (copy_from_user(&MapEnt, argp, sizeof(MapEnt))) { |
437 | rio_dprintk(RIO_DEBUG_CTRL, "Copy from user space failed\n"); | 445 | rio_dprintk(RIO_DEBUG_CTRL, "Copy from user space failed\n"); |
438 | p->RIOError.Error = COPYIN_FAILED; | 446 | p->RIOError.Error = COPYIN_FAILED; |
439 | return -EFAULT; | 447 | return -EFAULT; |
@@ -447,7 +455,7 @@ int su; | |||
447 | p->RIOError.Error = NOT_SUPER_USER; | 455 | p->RIOError.Error = NOT_SUPER_USER; |
448 | return -EPERM; | 456 | return -EPERM; |
449 | } | 457 | } |
450 | if (copy_from_user(&MapEnt, arg, sizeof(MapEnt))) { | 458 | if (copy_from_user(&MapEnt, argp, sizeof(MapEnt))) { |
451 | rio_dprintk(RIO_DEBUG_CTRL, "Copy from user space failed\n"); | 459 | rio_dprintk(RIO_DEBUG_CTRL, "Copy from user space failed\n"); |
452 | p->RIOError.Error = COPYIN_FAILED; | 460 | p->RIOError.Error = COPYIN_FAILED; |
453 | return -EFAULT; | 461 | return -EFAULT; |
@@ -461,7 +469,7 @@ int su; | |||
461 | p->RIOError.Error = NOT_SUPER_USER; | 469 | p->RIOError.Error = NOT_SUPER_USER; |
462 | return -EPERM; | 470 | return -EPERM; |
463 | } | 471 | } |
464 | if (copy_from_user(&MapEnt, arg, sizeof(MapEnt))) { | 472 | if (copy_from_user(&MapEnt, argp, sizeof(MapEnt))) { |
465 | rio_dprintk(RIO_DEBUG_CTRL, "Copy from data space failed\n"); | 473 | rio_dprintk(RIO_DEBUG_CTRL, "Copy from data space failed\n"); |
466 | p->RIOError.Error = COPYIN_FAILED; | 474 | p->RIOError.Error = COPYIN_FAILED; |
467 | return -EFAULT; | 475 | return -EFAULT; |
@@ -469,14 +477,14 @@ int su; | |||
469 | return RIODeleteRta(p, &MapEnt); | 477 | return RIODeleteRta(p, &MapEnt); |
470 | 478 | ||
471 | case RIO_QUICK_CHECK: | 479 | case RIO_QUICK_CHECK: |
472 | if (copy_to_user(arg, &p->RIORtaDisCons, sizeof(unsigned int))) { | 480 | if (copy_to_user(argp, &p->RIORtaDisCons, sizeof(unsigned int))) { |
473 | p->RIOError.Error = COPYOUT_FAILED; | 481 | p->RIOError.Error = COPYOUT_FAILED; |
474 | return -EFAULT; | 482 | return -EFAULT; |
475 | } | 483 | } |
476 | return 0; | 484 | return 0; |
477 | 485 | ||
478 | case RIO_LAST_ERROR: | 486 | case RIO_LAST_ERROR: |
479 | if (copy_to_user(arg, &p->RIOError, sizeof(struct Error))) | 487 | if (copy_to_user(argp, &p->RIOError, sizeof(struct Error))) |
480 | return -EFAULT; | 488 | return -EFAULT; |
481 | return 0; | 489 | return 0; |
482 | 490 | ||
@@ -485,7 +493,7 @@ int su; | |||
485 | return -EINVAL; | 493 | return -EINVAL; |
486 | 494 | ||
487 | case RIO_GET_MODTYPE: | 495 | case RIO_GET_MODTYPE: |
488 | if (copy_from_user(&port, arg, sizeof(unsigned int))) { | 496 | if (copy_from_user(&port, argp, sizeof(unsigned int))) { |
489 | p->RIOError.Error = COPYIN_FAILED; | 497 | p->RIOError.Error = COPYIN_FAILED; |
490 | return -EFAULT; | 498 | return -EFAULT; |
491 | } | 499 | } |
@@ -505,7 +513,7 @@ int su; | |||
505 | ** Return module type of port | 513 | ** Return module type of port |
506 | */ | 514 | */ |
507 | port = PortP->HostP->UnixRups[PortP->RupNum].ModTypes; | 515 | port = PortP->HostP->UnixRups[PortP->RupNum].ModTypes; |
508 | if (copy_to_user(arg, &port, sizeof(unsigned int))) { | 516 | if (copy_to_user(argp, &port, sizeof(unsigned int))) { |
509 | p->RIOError.Error = COPYOUT_FAILED; | 517 | p->RIOError.Error = COPYOUT_FAILED; |
510 | return -EFAULT; | 518 | return -EFAULT; |
511 | } | 519 | } |
@@ -521,7 +529,7 @@ int su; | |||
521 | 529 | ||
522 | case RIO_SETUP_PORTS: | 530 | case RIO_SETUP_PORTS: |
523 | rio_dprintk(RIO_DEBUG_CTRL, "Setup ports\n"); | 531 | rio_dprintk(RIO_DEBUG_CTRL, "Setup ports\n"); |
524 | if (copy_from_user(&PortSetup, arg, sizeof(PortSetup))) { | 532 | if (copy_from_user(&PortSetup, argp, sizeof(PortSetup))) { |
525 | p->RIOError.Error = COPYIN_FAILED; | 533 | p->RIOError.Error = COPYIN_FAILED; |
526 | rio_dprintk(RIO_DEBUG_CTRL, "EFAULT"); | 534 | rio_dprintk(RIO_DEBUG_CTRL, "EFAULT"); |
527 | return -EFAULT; | 535 | return -EFAULT; |
@@ -551,7 +559,7 @@ int su; | |||
551 | 559 | ||
552 | case RIO_GET_PORT_SETUP: | 560 | case RIO_GET_PORT_SETUP: |
553 | rio_dprintk(RIO_DEBUG_CTRL, "Get port setup\n"); | 561 | rio_dprintk(RIO_DEBUG_CTRL, "Get port setup\n"); |
554 | if (copy_from_user(&PortSetup, arg, sizeof(PortSetup))) { | 562 | if (copy_from_user(&PortSetup, argp, sizeof(PortSetup))) { |
555 | p->RIOError.Error = COPYIN_FAILED; | 563 | p->RIOError.Error = COPYIN_FAILED; |
556 | return -EFAULT; | 564 | return -EFAULT; |
557 | } | 565 | } |
@@ -572,7 +580,7 @@ int su; | |||
572 | PortSetup.XpOn[MAX_XP_CTRL_LEN - 1] = '\0'; | 580 | PortSetup.XpOn[MAX_XP_CTRL_LEN - 1] = '\0'; |
573 | PortSetup.XpOff[MAX_XP_CTRL_LEN - 1] = '\0'; | 581 | PortSetup.XpOff[MAX_XP_CTRL_LEN - 1] = '\0'; |
574 | 582 | ||
575 | if (copy_to_user(arg, &PortSetup, sizeof(PortSetup))) { | 583 | if (copy_to_user(argp, &PortSetup, sizeof(PortSetup))) { |
576 | p->RIOError.Error = COPYOUT_FAILED; | 584 | p->RIOError.Error = COPYOUT_FAILED; |
577 | return -EFAULT; | 585 | return -EFAULT; |
578 | } | 586 | } |
@@ -580,7 +588,7 @@ int su; | |||
580 | 588 | ||
581 | case RIO_GET_PORT_PARAMS: | 589 | case RIO_GET_PORT_PARAMS: |
582 | rio_dprintk(RIO_DEBUG_CTRL, "Get port params\n"); | 590 | rio_dprintk(RIO_DEBUG_CTRL, "Get port params\n"); |
583 | if (copy_from_user(&PortParams, arg, sizeof(struct PortParams))) { | 591 | if (copy_from_user(&PortParams, argp, sizeof(struct PortParams))) { |
584 | p->RIOError.Error = COPYIN_FAILED; | 592 | p->RIOError.Error = COPYIN_FAILED; |
585 | return -EFAULT; | 593 | return -EFAULT; |
586 | } | 594 | } |
@@ -593,7 +601,7 @@ int su; | |||
593 | PortParams.State = PortP->State; | 601 | PortParams.State = PortP->State; |
594 | rio_dprintk(RIO_DEBUG_CTRL, "Port %d\n", PortParams.Port); | 602 | rio_dprintk(RIO_DEBUG_CTRL, "Port %d\n", PortParams.Port); |
595 | 603 | ||
596 | if (copy_to_user(arg, &PortParams, sizeof(struct PortParams))) { | 604 | if (copy_to_user(argp, &PortParams, sizeof(struct PortParams))) { |
597 | p->RIOError.Error = COPYOUT_FAILED; | 605 | p->RIOError.Error = COPYOUT_FAILED; |
598 | return -EFAULT; | 606 | return -EFAULT; |
599 | } | 607 | } |
@@ -601,7 +609,7 @@ int su; | |||
601 | 609 | ||
602 | case RIO_GET_PORT_TTY: | 610 | case RIO_GET_PORT_TTY: |
603 | rio_dprintk(RIO_DEBUG_CTRL, "Get port tty\n"); | 611 | rio_dprintk(RIO_DEBUG_CTRL, "Get port tty\n"); |
604 | if (copy_from_user(&PortTty, arg, sizeof(struct PortTty))) { | 612 | if (copy_from_user(&PortTty, argp, sizeof(struct PortTty))) { |
605 | p->RIOError.Error = COPYIN_FAILED; | 613 | p->RIOError.Error = COPYIN_FAILED; |
606 | return -EFAULT; | 614 | return -EFAULT; |
607 | } | 615 | } |
@@ -612,14 +620,14 @@ int su; | |||
612 | 620 | ||
613 | rio_dprintk(RIO_DEBUG_CTRL, "Port %d\n", PortTty.port); | 621 | rio_dprintk(RIO_DEBUG_CTRL, "Port %d\n", PortTty.port); |
614 | PortP = (p->RIOPortp[PortTty.port]); | 622 | PortP = (p->RIOPortp[PortTty.port]); |
615 | if (copy_to_user(arg, &PortTty, sizeof(struct PortTty))) { | 623 | if (copy_to_user(argp, &PortTty, sizeof(struct PortTty))) { |
616 | p->RIOError.Error = COPYOUT_FAILED; | 624 | p->RIOError.Error = COPYOUT_FAILED; |
617 | return -EFAULT; | 625 | return -EFAULT; |
618 | } | 626 | } |
619 | return retval; | 627 | return retval; |
620 | 628 | ||
621 | case RIO_SET_PORT_TTY: | 629 | case RIO_SET_PORT_TTY: |
622 | if (copy_from_user(&PortTty, arg, sizeof(struct PortTty))) { | 630 | if (copy_from_user(&PortTty, argp, sizeof(struct PortTty))) { |
623 | p->RIOError.Error = COPYIN_FAILED; | 631 | p->RIOError.Error = COPYIN_FAILED; |
624 | return -EFAULT; | 632 | return -EFAULT; |
625 | } | 633 | } |
@@ -634,7 +642,7 @@ int su; | |||
634 | 642 | ||
635 | case RIO_SET_PORT_PARAMS: | 643 | case RIO_SET_PORT_PARAMS: |
636 | rio_dprintk(RIO_DEBUG_CTRL, "Set port params\n"); | 644 | rio_dprintk(RIO_DEBUG_CTRL, "Set port params\n"); |
637 | if (copy_from_user(&PortParams, arg, sizeof(PortParams))) { | 645 | if (copy_from_user(&PortParams, argp, sizeof(PortParams))) { |
638 | p->RIOError.Error = COPYIN_FAILED; | 646 | p->RIOError.Error = COPYIN_FAILED; |
639 | return -EFAULT; | 647 | return -EFAULT; |
640 | } | 648 | } |
@@ -650,7 +658,7 @@ int su; | |||
650 | 658 | ||
651 | case RIO_GET_PORT_STATS: | 659 | case RIO_GET_PORT_STATS: |
652 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_PORT_STATS\n"); | 660 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_PORT_STATS\n"); |
653 | if (copy_from_user(&portStats, arg, sizeof(struct portStats))) { | 661 | if (copy_from_user(&portStats, argp, sizeof(struct portStats))) { |
654 | p->RIOError.Error = COPYIN_FAILED; | 662 | p->RIOError.Error = COPYIN_FAILED; |
655 | return -EFAULT; | 663 | return -EFAULT; |
656 | } | 664 | } |
@@ -665,14 +673,14 @@ int su; | |||
665 | portStats.opens = PortP->opens; | 673 | portStats.opens = PortP->opens; |
666 | portStats.closes = PortP->closes; | 674 | portStats.closes = PortP->closes; |
667 | portStats.ioctls = PortP->ioctls; | 675 | portStats.ioctls = PortP->ioctls; |
668 | if (copy_to_user(arg, &portStats, sizeof(struct portStats))) { | 676 | if (copy_to_user(argp, &portStats, sizeof(struct portStats))) { |
669 | p->RIOError.Error = COPYOUT_FAILED; | 677 | p->RIOError.Error = COPYOUT_FAILED; |
670 | return -EFAULT; | 678 | return -EFAULT; |
671 | } | 679 | } |
672 | return retval; | 680 | return retval; |
673 | 681 | ||
674 | case RIO_RESET_PORT_STATS: | 682 | case RIO_RESET_PORT_STATS: |
675 | port = (unsigned long) arg; | 683 | port = arg; |
676 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_RESET_PORT_STATS\n"); | 684 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_RESET_PORT_STATS\n"); |
677 | if (port >= RIO_PORTS) { | 685 | if (port >= RIO_PORTS) { |
678 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; | 686 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; |
@@ -690,7 +698,7 @@ int su; | |||
690 | 698 | ||
691 | case RIO_GATHER_PORT_STATS: | 699 | case RIO_GATHER_PORT_STATS: |
692 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_GATHER_PORT_STATS\n"); | 700 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_GATHER_PORT_STATS\n"); |
693 | if (copy_from_user(&portStats, arg, sizeof(struct portStats))) { | 701 | if (copy_from_user(&portStats, argp, sizeof(struct portStats))) { |
694 | p->RIOError.Error = COPYIN_FAILED; | 702 | p->RIOError.Error = COPYIN_FAILED; |
695 | return -EFAULT; | 703 | return -EFAULT; |
696 | } | 704 | } |
@@ -706,7 +714,7 @@ int su; | |||
706 | 714 | ||
707 | case RIO_READ_CONFIG: | 715 | case RIO_READ_CONFIG: |
708 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_READ_CONFIG\n"); | 716 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_READ_CONFIG\n"); |
709 | if (copy_to_user(arg, &p->RIOConf, sizeof(struct Conf))) { | 717 | if (copy_to_user(argp, &p->RIOConf, sizeof(struct Conf))) { |
710 | p->RIOError.Error = COPYOUT_FAILED; | 718 | p->RIOError.Error = COPYOUT_FAILED; |
711 | return -EFAULT; | 719 | return -EFAULT; |
712 | } | 720 | } |
@@ -718,7 +726,7 @@ int su; | |||
718 | p->RIOError.Error = NOT_SUPER_USER; | 726 | p->RIOError.Error = NOT_SUPER_USER; |
719 | return -EPERM; | 727 | return -EPERM; |
720 | } | 728 | } |
721 | if (copy_from_user(&p->RIOConf, arg, sizeof(struct Conf))) { | 729 | if (copy_from_user(&p->RIOConf, argp, sizeof(struct Conf))) { |
722 | p->RIOError.Error = COPYIN_FAILED; | 730 | p->RIOError.Error = COPYIN_FAILED; |
723 | return -EFAULT; | 731 | return -EFAULT; |
724 | } | 732 | } |
@@ -746,7 +754,7 @@ int su; | |||
746 | case RIO_SETDEBUG: | 754 | case RIO_SETDEBUG: |
747 | case RIO_GETDEBUG: | 755 | case RIO_GETDEBUG: |
748 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_SETDEBUG/RIO_GETDEBUG\n"); | 756 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_SETDEBUG/RIO_GETDEBUG\n"); |
749 | if (copy_from_user(&DebugCtrl, arg, sizeof(DebugCtrl))) { | 757 | if (copy_from_user(&DebugCtrl, argp, sizeof(DebugCtrl))) { |
750 | p->RIOError.Error = COPYIN_FAILED; | 758 | p->RIOError.Error = COPYIN_FAILED; |
751 | return -EFAULT; | 759 | return -EFAULT; |
752 | } | 760 | } |
@@ -763,7 +771,7 @@ int su; | |||
763 | rio_dprintk(RIO_DEBUG_CTRL, "Get global debug 0x%x wait 0x%x\n", p->rio_debug, p->RIODebugWait); | 771 | rio_dprintk(RIO_DEBUG_CTRL, "Get global debug 0x%x wait 0x%x\n", p->rio_debug, p->RIODebugWait); |
764 | DebugCtrl.Debug = p->rio_debug; | 772 | DebugCtrl.Debug = p->rio_debug; |
765 | DebugCtrl.Wait = p->RIODebugWait; | 773 | DebugCtrl.Wait = p->RIODebugWait; |
766 | if (copy_to_user(arg, &DebugCtrl, sizeof(DebugCtrl))) { | 774 | if (copy_to_user(argp, &DebugCtrl, sizeof(DebugCtrl))) { |
767 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_SET/GET DEBUG: bad port number %d\n", DebugCtrl.SysPort); | 775 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_SET/GET DEBUG: bad port number %d\n", DebugCtrl.SysPort); |
768 | p->RIOError.Error = COPYOUT_FAILED; | 776 | p->RIOError.Error = COPYOUT_FAILED; |
769 | return -EFAULT; | 777 | return -EFAULT; |
@@ -785,7 +793,7 @@ int su; | |||
785 | } else { | 793 | } else { |
786 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_GETDEBUG 0x%x\n", p->RIOPortp[DebugCtrl.SysPort]->Debug); | 794 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_GETDEBUG 0x%x\n", p->RIOPortp[DebugCtrl.SysPort]->Debug); |
787 | DebugCtrl.Debug = p->RIOPortp[DebugCtrl.SysPort]->Debug; | 795 | DebugCtrl.Debug = p->RIOPortp[DebugCtrl.SysPort]->Debug; |
788 | if (copy_to_user(arg, &DebugCtrl, sizeof(DebugCtrl))) { | 796 | if (copy_to_user(argp, &DebugCtrl, sizeof(DebugCtrl))) { |
789 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_GETDEBUG: Bad copy to user space\n"); | 797 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_GETDEBUG: Bad copy to user space\n"); |
790 | p->RIOError.Error = COPYOUT_FAILED; | 798 | p->RIOError.Error = COPYOUT_FAILED; |
791 | return -EFAULT; | 799 | return -EFAULT; |
@@ -800,7 +808,7 @@ int su; | |||
800 | ** textual null terminated string. | 808 | ** textual null terminated string. |
801 | */ | 809 | */ |
802 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_VERSID\n"); | 810 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_VERSID\n"); |
803 | if (copy_to_user(arg, RIOVersid(), sizeof(struct rioVersion))) { | 811 | if (copy_to_user(argp, RIOVersid(), sizeof(struct rioVersion))) { |
804 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_VERSID: Bad copy to user space (host=%d)\n", Host); | 812 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_VERSID: Bad copy to user space (host=%d)\n", Host); |
805 | p->RIOError.Error = COPYOUT_FAILED; | 813 | p->RIOError.Error = COPYOUT_FAILED; |
806 | return -EFAULT; | 814 | return -EFAULT; |
@@ -813,7 +821,7 @@ int su; | |||
813 | ** at init time. | 821 | ** at init time. |
814 | */ | 822 | */ |
815 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_NUM_HOSTS\n"); | 823 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_NUM_HOSTS\n"); |
816 | if (copy_to_user(arg, &p->RIONumHosts, sizeof(p->RIONumHosts))) { | 824 | if (copy_to_user(argp, &p->RIONumHosts, sizeof(p->RIONumHosts))) { |
817 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_NUM_HOSTS: Bad copy to user space\n"); | 825 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_NUM_HOSTS: Bad copy to user space\n"); |
818 | p->RIOError.Error = COPYOUT_FAILED; | 826 | p->RIOError.Error = COPYOUT_FAILED; |
819 | return -EFAULT; | 827 | return -EFAULT; |
@@ -824,7 +832,7 @@ int su; | |||
824 | /* | 832 | /* |
825 | ** Kill host. This may not be in the final version... | 833 | ** Kill host. This may not be in the final version... |
826 | */ | 834 | */ |
827 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_FOAD %ld\n", (unsigned long) arg); | 835 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_FOAD %ld\n", arg); |
828 | if (!su) { | 836 | if (!su) { |
829 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_FOAD: Not super user\n"); | 837 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_FOAD: Not super user\n"); |
830 | p->RIOError.Error = NOT_SUPER_USER; | 838 | p->RIOError.Error = NOT_SUPER_USER; |
@@ -858,7 +866,7 @@ int su; | |||
858 | p->RIOError.Error = NOT_SUPER_USER; | 866 | p->RIOError.Error = NOT_SUPER_USER; |
859 | return -EPERM; | 867 | return -EPERM; |
860 | } | 868 | } |
861 | if (copy_from_user(&DownLoad, arg, sizeof(DownLoad))) { | 869 | if (copy_from_user(&DownLoad, argp, sizeof(DownLoad))) { |
862 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_DOWNLOAD: Copy in from user space failed\n"); | 870 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_DOWNLOAD: Copy in from user space failed\n"); |
863 | p->RIOError.Error = COPYIN_FAILED; | 871 | p->RIOError.Error = COPYIN_FAILED; |
864 | return -EFAULT; | 872 | return -EFAULT; |
@@ -888,7 +896,7 @@ int su; | |||
888 | { | 896 | { |
889 | unsigned int host; | 897 | unsigned int host; |
890 | 898 | ||
891 | if (copy_from_user(&host, arg, sizeof(host))) { | 899 | if (copy_from_user(&host, argp, sizeof(host))) { |
892 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_REQ: Copy in from user space failed\n"); | 900 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_REQ: Copy in from user space failed\n"); |
893 | p->RIOError.Error = COPYIN_FAILED; | 901 | p->RIOError.Error = COPYIN_FAILED; |
894 | return -EFAULT; | 902 | return -EFAULT; |
@@ -897,7 +905,7 @@ int su; | |||
897 | ** Fetch the parmmap | 905 | ** Fetch the parmmap |
898 | */ | 906 | */ |
899 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_PARMS\n"); | 907 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_PARMS\n"); |
900 | if (copy_to_user(arg, p->RIOHosts[host].ParmMapP, sizeof(PARM_MAP))) { | 908 | if (copy_from_io(argp, p->RIOHosts[host].ParmMapP, sizeof(PARM_MAP))) { |
901 | p->RIOError.Error = COPYOUT_FAILED; | 909 | p->RIOError.Error = COPYOUT_FAILED; |
902 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_PARMS: Copy out to user space failed\n"); | 910 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_PARMS: Copy out to user space failed\n"); |
903 | return -EFAULT; | 911 | return -EFAULT; |
@@ -907,7 +915,7 @@ int su; | |||
907 | 915 | ||
908 | case RIO_HOST_REQ: | 916 | case RIO_HOST_REQ: |
909 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_REQ\n"); | 917 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_REQ\n"); |
910 | if (copy_from_user(&HostReq, arg, sizeof(HostReq))) { | 918 | if (copy_from_user(&HostReq, argp, sizeof(HostReq))) { |
911 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_REQ: Copy in from user space failed\n"); | 919 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_REQ: Copy in from user space failed\n"); |
912 | p->RIOError.Error = COPYIN_FAILED; | 920 | p->RIOError.Error = COPYIN_FAILED; |
913 | return -EFAULT; | 921 | return -EFAULT; |
@@ -928,7 +936,7 @@ int su; | |||
928 | 936 | ||
929 | case RIO_HOST_DPRAM: | 937 | case RIO_HOST_DPRAM: |
930 | rio_dprintk(RIO_DEBUG_CTRL, "Request for DPRAM\n"); | 938 | rio_dprintk(RIO_DEBUG_CTRL, "Request for DPRAM\n"); |
931 | if (copy_from_user(&HostDpRam, arg, sizeof(HostDpRam))) { | 939 | if (copy_from_user(&HostDpRam, argp, sizeof(HostDpRam))) { |
932 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_DPRAM: Copy in from user space failed\n"); | 940 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_DPRAM: Copy in from user space failed\n"); |
933 | p->RIOError.Error = COPYIN_FAILED; | 941 | p->RIOError.Error = COPYIN_FAILED; |
934 | return -EFAULT; | 942 | return -EFAULT; |
@@ -945,13 +953,13 @@ int su; | |||
945 | /* It's hardware like this that really gets on my tits. */ | 953 | /* It's hardware like this that really gets on my tits. */ |
946 | static unsigned char copy[sizeof(struct DpRam)]; | 954 | static unsigned char copy[sizeof(struct DpRam)]; |
947 | for (off = 0; off < sizeof(struct DpRam); off++) | 955 | for (off = 0; off < sizeof(struct DpRam); off++) |
948 | copy[off] = readb(&p->RIOHosts[HostDpRam.HostNum].Caddr[off]); | 956 | copy[off] = readb(p->RIOHosts[HostDpRam.HostNum].Caddr + off); |
949 | if (copy_to_user(HostDpRam.DpRamP, copy, sizeof(struct DpRam))) { | 957 | if (copy_to_user(HostDpRam.DpRamP, copy, sizeof(struct DpRam))) { |
950 | p->RIOError.Error = COPYOUT_FAILED; | 958 | p->RIOError.Error = COPYOUT_FAILED; |
951 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_DPRAM: Bad copy to user space\n"); | 959 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_DPRAM: Bad copy to user space\n"); |
952 | return -EFAULT; | 960 | return -EFAULT; |
953 | } | 961 | } |
954 | } else if (copy_to_user(HostDpRam.DpRamP, p->RIOHosts[HostDpRam.HostNum].Caddr, sizeof(struct DpRam))) { | 962 | } else if (copy_from_io(HostDpRam.DpRamP, p->RIOHosts[HostDpRam.HostNum].Caddr, sizeof(struct DpRam))) { |
955 | p->RIOError.Error = COPYOUT_FAILED; | 963 | p->RIOError.Error = COPYOUT_FAILED; |
956 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_DPRAM: Bad copy to user space\n"); | 964 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_DPRAM: Bad copy to user space\n"); |
957 | return -EFAULT; | 965 | return -EFAULT; |
@@ -960,13 +968,13 @@ int su; | |||
960 | 968 | ||
961 | case RIO_SET_BUSY: | 969 | case RIO_SET_BUSY: |
962 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_SET_BUSY\n"); | 970 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_SET_BUSY\n"); |
963 | if ((unsigned long) arg > 511) { | 971 | if (arg > 511) { |
964 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_SET_BUSY: Bad port number %ld\n", (unsigned long) arg); | 972 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_SET_BUSY: Bad port number %ld\n", arg); |
965 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; | 973 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; |
966 | return -EINVAL; | 974 | return -EINVAL; |
967 | } | 975 | } |
968 | rio_spin_lock_irqsave(&PortP->portSem, flags); | 976 | rio_spin_lock_irqsave(&PortP->portSem, flags); |
969 | p->RIOPortp[(unsigned long) arg]->State |= RIO_BUSY; | 977 | p->RIOPortp[arg]->State |= RIO_BUSY; |
970 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 978 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
971 | return retval; | 979 | return retval; |
972 | 980 | ||
@@ -976,7 +984,7 @@ int su; | |||
976 | ** (probably for debug reasons) | 984 | ** (probably for debug reasons) |
977 | */ | 985 | */ |
978 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_PORT\n"); | 986 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_PORT\n"); |
979 | if (copy_from_user(&PortReq, arg, sizeof(PortReq))) { | 987 | if (copy_from_user(&PortReq, argp, sizeof(PortReq))) { |
980 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_PORT: Copy in from user space failed\n"); | 988 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_PORT: Copy in from user space failed\n"); |
981 | p->RIOError.Error = COPYIN_FAILED; | 989 | p->RIOError.Error = COPYIN_FAILED; |
982 | return -EFAULT; | 990 | return -EFAULT; |
@@ -1001,7 +1009,7 @@ int su; | |||
1001 | ** (probably for debug reasons) | 1009 | ** (probably for debug reasons) |
1002 | */ | 1010 | */ |
1003 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_RUP\n"); | 1011 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_RUP\n"); |
1004 | if (copy_from_user(&RupReq, arg, sizeof(RupReq))) { | 1012 | if (copy_from_user(&RupReq, argp, sizeof(RupReq))) { |
1005 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_RUP: Copy in from user space failed\n"); | 1013 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_RUP: Copy in from user space failed\n"); |
1006 | p->RIOError.Error = COPYIN_FAILED; | 1014 | p->RIOError.Error = COPYIN_FAILED; |
1007 | return -EFAULT; | 1015 | return -EFAULT; |
@@ -1025,7 +1033,7 @@ int su; | |||
1025 | } | 1033 | } |
1026 | rio_dprintk(RIO_DEBUG_CTRL, "Request for rup %d from host %d\n", RupReq.RupNum, RupReq.HostNum); | 1034 | rio_dprintk(RIO_DEBUG_CTRL, "Request for rup %d from host %d\n", RupReq.RupNum, RupReq.HostNum); |
1027 | 1035 | ||
1028 | if (copy_to_user(HostP->UnixRups[RupReq.RupNum].RupP, RupReq.RupP, sizeof(struct RUP))) { | 1036 | if (copy_from_io(RupReq.RupP, HostP->UnixRups[RupReq.RupNum].RupP, sizeof(struct RUP))) { |
1029 | p->RIOError.Error = COPYOUT_FAILED; | 1037 | p->RIOError.Error = COPYOUT_FAILED; |
1030 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_RUP: Bad copy to user space\n"); | 1038 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_RUP: Bad copy to user space\n"); |
1031 | return -EFAULT; | 1039 | return -EFAULT; |
@@ -1038,7 +1046,7 @@ int su; | |||
1038 | ** (probably for debug reasons) | 1046 | ** (probably for debug reasons) |
1039 | */ | 1047 | */ |
1040 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_LPB\n"); | 1048 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_LPB\n"); |
1041 | if (copy_from_user(&LpbReq, arg, sizeof(LpbReq))) { | 1049 | if (copy_from_user(&LpbReq, argp, sizeof(LpbReq))) { |
1042 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_LPB: Bad copy from user space\n"); | 1050 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_LPB: Bad copy from user space\n"); |
1043 | p->RIOError.Error = COPYIN_FAILED; | 1051 | p->RIOError.Error = COPYIN_FAILED; |
1044 | return -EFAULT; | 1052 | return -EFAULT; |
@@ -1062,7 +1070,7 @@ int su; | |||
1062 | } | 1070 | } |
1063 | rio_dprintk(RIO_DEBUG_CTRL, "Request for lpb %d from host %d\n", LpbReq.Link, LpbReq.Host); | 1071 | rio_dprintk(RIO_DEBUG_CTRL, "Request for lpb %d from host %d\n", LpbReq.Link, LpbReq.Host); |
1064 | 1072 | ||
1065 | if (copy_to_user(LpbReq.LpbP, &HostP->LinkStrP[LpbReq.Link], sizeof(struct LPB))) { | 1073 | if (copy_from_io(LpbReq.LpbP, &HostP->LinkStrP[LpbReq.Link], sizeof(struct LPB))) { |
1066 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_LPB: Bad copy to user space\n"); | 1074 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_LPB: Bad copy to user space\n"); |
1067 | p->RIOError.Error = COPYOUT_FAILED; | 1075 | p->RIOError.Error = COPYOUT_FAILED; |
1068 | return -EFAULT; | 1076 | return -EFAULT; |
@@ -1136,7 +1144,7 @@ int su; | |||
1136 | case RIO_MAP_B110_TO_110: | 1144 | case RIO_MAP_B110_TO_110: |
1137 | case RIO_MAP_B110_TO_115200: | 1145 | case RIO_MAP_B110_TO_115200: |
1138 | rio_dprintk(RIO_DEBUG_CTRL, "Baud rate mapping\n"); | 1146 | rio_dprintk(RIO_DEBUG_CTRL, "Baud rate mapping\n"); |
1139 | port = (unsigned long) arg; | 1147 | port = arg; |
1140 | if (port < 0 || port > 511) { | 1148 | if (port < 0 || port > 511) { |
1141 | rio_dprintk(RIO_DEBUG_CTRL, "Baud rate mapping: Bad port number %d\n", port); | 1149 | rio_dprintk(RIO_DEBUG_CTRL, "Baud rate mapping: Bad port number %d\n", port); |
1142 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; | 1150 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; |
@@ -1166,7 +1174,7 @@ int su; | |||
1166 | 1174 | ||
1167 | case RIO_SEND_PACKET: | 1175 | case RIO_SEND_PACKET: |
1168 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_SEND_PACKET\n"); | 1176 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_SEND_PACKET\n"); |
1169 | if (copy_from_user(&SendPack, arg, sizeof(SendPack))) { | 1177 | if (copy_from_user(&SendPack, argp, sizeof(SendPack))) { |
1170 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_SEND_PACKET: Bad copy from user space\n"); | 1178 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_SEND_PACKET: Bad copy from user space\n"); |
1171 | p->RIOError.Error = COPYIN_FAILED; | 1179 | p->RIOError.Error = COPYIN_FAILED; |
1172 | return -EFAULT; | 1180 | return -EFAULT; |
@@ -1210,7 +1218,7 @@ int su; | |||
1210 | return su ? 0 : -EPERM; | 1218 | return su ? 0 : -EPERM; |
1211 | 1219 | ||
1212 | case RIO_WHAT_MESG: | 1220 | case RIO_WHAT_MESG: |
1213 | if (copy_to_user(arg, &p->RIONoMessage, sizeof(p->RIONoMessage))) { | 1221 | if (copy_to_user(argp, &p->RIONoMessage, sizeof(p->RIONoMessage))) { |
1214 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_WHAT_MESG: Bad copy to user space\n"); | 1222 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_WHAT_MESG: Bad copy to user space\n"); |
1215 | p->RIOError.Error = COPYOUT_FAILED; | 1223 | p->RIOError.Error = COPYOUT_FAILED; |
1216 | return -EFAULT; | 1224 | return -EFAULT; |
@@ -1218,7 +1226,7 @@ int su; | |||
1218 | return 0; | 1226 | return 0; |
1219 | 1227 | ||
1220 | case RIO_MEM_DUMP: | 1228 | case RIO_MEM_DUMP: |
1221 | if (copy_from_user(&SubCmd, arg, sizeof(struct SubCmdStruct))) { | 1229 | if (copy_from_user(&SubCmd, argp, sizeof(struct SubCmdStruct))) { |
1222 | p->RIOError.Error = COPYIN_FAILED; | 1230 | p->RIOError.Error = COPYIN_FAILED; |
1223 | return -EFAULT; | 1231 | return -EFAULT; |
1224 | } | 1232 | } |
@@ -1248,7 +1256,7 @@ int su; | |||
1248 | PortP->State |= RIO_BUSY; | 1256 | PortP->State |= RIO_BUSY; |
1249 | 1257 | ||
1250 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 1258 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
1251 | if (copy_to_user(arg, p->RIOMemDump, MEMDUMP_SIZE)) { | 1259 | if (copy_to_user(argp, p->RIOMemDump, MEMDUMP_SIZE)) { |
1252 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_MEM_DUMP copy failed\n"); | 1260 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_MEM_DUMP copy failed\n"); |
1253 | p->RIOError.Error = COPYOUT_FAILED; | 1261 | p->RIOError.Error = COPYOUT_FAILED; |
1254 | return -EFAULT; | 1262 | return -EFAULT; |
@@ -1256,30 +1264,30 @@ int su; | |||
1256 | return 0; | 1264 | return 0; |
1257 | 1265 | ||
1258 | case RIO_TICK: | 1266 | case RIO_TICK: |
1259 | if ((unsigned long) arg >= p->RIONumHosts) | 1267 | if (arg >= p->RIONumHosts) |
1260 | return -EINVAL; | 1268 | return -EINVAL; |
1261 | rio_dprintk(RIO_DEBUG_CTRL, "Set interrupt for host %ld\n", (unsigned long) arg); | 1269 | rio_dprintk(RIO_DEBUG_CTRL, "Set interrupt for host %ld\n", arg); |
1262 | writeb(0xFF, &p->RIOHosts[(unsigned long) arg].SetInt); | 1270 | writeb(0xFF, &p->RIOHosts[arg].SetInt); |
1263 | return 0; | 1271 | return 0; |
1264 | 1272 | ||
1265 | case RIO_TOCK: | 1273 | case RIO_TOCK: |
1266 | if ((unsigned long) arg >= p->RIONumHosts) | 1274 | if (arg >= p->RIONumHosts) |
1267 | return -EINVAL; | 1275 | return -EINVAL; |
1268 | rio_dprintk(RIO_DEBUG_CTRL, "Clear interrupt for host %ld\n", (unsigned long) arg); | 1276 | rio_dprintk(RIO_DEBUG_CTRL, "Clear interrupt for host %ld\n", arg); |
1269 | writeb(0xFF, &p->RIOHosts[(unsigned long) arg].ResetInt); | 1277 | writeb(0xFF, &p->RIOHosts[arg].ResetInt); |
1270 | return 0; | 1278 | return 0; |
1271 | 1279 | ||
1272 | case RIO_READ_CHECK: | 1280 | case RIO_READ_CHECK: |
1273 | /* Check reads for pkts with data[0] the same */ | 1281 | /* Check reads for pkts with data[0] the same */ |
1274 | p->RIOReadCheck = !p->RIOReadCheck; | 1282 | p->RIOReadCheck = !p->RIOReadCheck; |
1275 | if (copy_to_user(arg, &p->RIOReadCheck, sizeof(unsigned int))) { | 1283 | if (copy_to_user(argp, &p->RIOReadCheck, sizeof(unsigned int))) { |
1276 | p->RIOError.Error = COPYOUT_FAILED; | 1284 | p->RIOError.Error = COPYOUT_FAILED; |
1277 | return -EFAULT; | 1285 | return -EFAULT; |
1278 | } | 1286 | } |
1279 | return 0; | 1287 | return 0; |
1280 | 1288 | ||
1281 | case RIO_READ_REGISTER: | 1289 | case RIO_READ_REGISTER: |
1282 | if (copy_from_user(&SubCmd, arg, sizeof(struct SubCmdStruct))) { | 1290 | if (copy_from_user(&SubCmd, argp, sizeof(struct SubCmdStruct))) { |
1283 | p->RIOError.Error = COPYIN_FAILED; | 1291 | p->RIOError.Error = COPYIN_FAILED; |
1284 | return -EFAULT; | 1292 | return -EFAULT; |
1285 | } | 1293 | } |
@@ -1314,7 +1322,7 @@ int su; | |||
1314 | PortP->State |= RIO_BUSY; | 1322 | PortP->State |= RIO_BUSY; |
1315 | 1323 | ||
1316 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 1324 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
1317 | if (copy_to_user(arg, &p->CdRegister, sizeof(unsigned int))) { | 1325 | if (copy_to_user(argp, &p->CdRegister, sizeof(unsigned int))) { |
1318 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_READ_REGISTER copy failed\n"); | 1326 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_READ_REGISTER copy failed\n"); |
1319 | p->RIOError.Error = COPYOUT_FAILED; | 1327 | p->RIOError.Error = COPYOUT_FAILED; |
1320 | return -EFAULT; | 1328 | return -EFAULT; |
@@ -1327,10 +1335,10 @@ int su; | |||
1327 | */ | 1335 | */ |
1328 | case RIO_MAKE_DEV: | 1336 | case RIO_MAKE_DEV: |
1329 | { | 1337 | { |
1330 | unsigned int port = (unsigned long) arg & RIO_MODEM_MASK; | 1338 | unsigned int port = arg & RIO_MODEM_MASK; |
1331 | unsigned int ret; | 1339 | unsigned int ret; |
1332 | 1340 | ||
1333 | switch ((unsigned long) arg & RIO_DEV_MASK) { | 1341 | switch (arg & RIO_DEV_MASK) { |
1334 | case RIO_DEV_DIRECT: | 1342 | case RIO_DEV_DIRECT: |
1335 | ret = drv_makedev(MAJOR(dev), port); | 1343 | ret = drv_makedev(MAJOR(dev), port); |
1336 | rio_dprintk(RIO_DEBUG_CTRL, "Makedev direct 0x%x is 0x%x\n", port, ret); | 1344 | rio_dprintk(RIO_DEBUG_CTRL, "Makedev direct 0x%x is 0x%x\n", port, ret); |
@@ -1358,7 +1366,7 @@ int su; | |||
1358 | int mino; | 1366 | int mino; |
1359 | unsigned long ret; | 1367 | unsigned long ret; |
1360 | 1368 | ||
1361 | dv = (dev_t) ((unsigned long) arg); | 1369 | dv = (dev_t) (arg); |
1362 | mino = RIO_UNMODEM(dv); | 1370 | mino = RIO_UNMODEM(dv); |
1363 | 1371 | ||
1364 | if (RIO_ISMODEM(dv)) { | 1372 | if (RIO_ISMODEM(dv)) { |
diff --git a/drivers/char/rio/rioinit.c b/drivers/char/rio/rioinit.c index 24d2992154cc..99f3df02b61c 100644 --- a/drivers/char/rio/rioinit.c +++ b/drivers/char/rio/rioinit.c | |||
@@ -33,7 +33,6 @@ | |||
33 | static char *_rioinit_c_sccs_ = "@(#)rioinit.c 1.3"; | 33 | static char *_rioinit_c_sccs_ = "@(#)rioinit.c 1.3"; |
34 | #endif | 34 | #endif |
35 | 35 | ||
36 | #include <linux/config.h> | ||
37 | #include <linux/module.h> | 36 | #include <linux/module.h> |
38 | #include <linux/slab.h> | 37 | #include <linux/slab.h> |
39 | #include <linux/errno.h> | 38 | #include <linux/errno.h> |
@@ -79,7 +78,7 @@ static char *_rioinit_c_sccs_ = "@(#)rioinit.c 1.3"; | |||
79 | 78 | ||
80 | int RIOPCIinit(struct rio_info *p, int Mode); | 79 | int RIOPCIinit(struct rio_info *p, int Mode); |
81 | 80 | ||
82 | static int RIOScrub(int, u8 *, int); | 81 | static int RIOScrub(int, u8 __iomem *, int); |
83 | 82 | ||
84 | 83 | ||
85 | /** | 84 | /** |
@@ -92,10 +91,10 @@ static int RIOScrub(int, u8 *, int); | |||
92 | ** bits > 0 indicates 16 bit operation. | 91 | ** bits > 0 indicates 16 bit operation. |
93 | */ | 92 | */ |
94 | 93 | ||
95 | int RIOAssignAT(struct rio_info *p, int Base, caddr_t virtAddr, int mode) | 94 | int RIOAssignAT(struct rio_info *p, int Base, void __iomem *virtAddr, int mode) |
96 | { | 95 | { |
97 | int bits; | 96 | int bits; |
98 | struct DpRam *cardp = (struct DpRam *)virtAddr; | 97 | struct DpRam __iomem *cardp = (struct DpRam __iomem *)virtAddr; |
99 | 98 | ||
100 | if ((Base < ONE_MEG) || (mode & BYTE_ACCESS_MODE)) | 99 | if ((Base < ONE_MEG) || (mode & BYTE_ACCESS_MODE)) |
101 | bits = BYTE_OPERATION; | 100 | bits = BYTE_OPERATION; |
@@ -107,7 +106,7 @@ int RIOAssignAT(struct rio_info *p, int Base, caddr_t virtAddr, int mode) | |||
107 | ** transient stuff. | 106 | ** transient stuff. |
108 | */ | 107 | */ |
109 | p->RIOHosts[p->RIONumHosts].Caddr = virtAddr; | 108 | p->RIOHosts[p->RIONumHosts].Caddr = virtAddr; |
110 | p->RIOHosts[p->RIONumHosts].CardP = (struct DpRam *)virtAddr; | 109 | p->RIOHosts[p->RIONumHosts].CardP = virtAddr; |
111 | 110 | ||
112 | /* | 111 | /* |
113 | ** Revision 01 AT host cards don't support WORD operations, | 112 | ** Revision 01 AT host cards don't support WORD operations, |
@@ -151,10 +150,10 @@ static u8 val[] = { | |||
151 | ** RAM test a board. | 150 | ** RAM test a board. |
152 | ** Nothing too complicated, just enough to check it out. | 151 | ** Nothing too complicated, just enough to check it out. |
153 | */ | 152 | */ |
154 | int RIOBoardTest(unsigned long paddr, caddr_t caddr, unsigned char type, int slot) | 153 | int RIOBoardTest(unsigned long paddr, void __iomem *caddr, unsigned char type, int slot) |
155 | { | 154 | { |
156 | struct DpRam *DpRam = (struct DpRam *)caddr; | 155 | struct DpRam __iomem *DpRam = caddr; |
157 | char *ram[4]; | 156 | void __iomem *ram[4]; |
158 | int size[4]; | 157 | int size[4]; |
159 | int op, bank; | 158 | int op, bank; |
160 | int nbanks; | 159 | int nbanks; |
@@ -179,12 +178,12 @@ int RIOBoardTest(unsigned long paddr, caddr_t caddr, unsigned char type, int slo | |||
179 | size[2] = DP_SRAM3_SIZE; | 178 | size[2] = DP_SRAM3_SIZE; |
180 | size[3] = DP_SCRATCH_SIZE; | 179 | size[3] = DP_SCRATCH_SIZE; |
181 | 180 | ||
182 | ram[0] = (char *)&DpRam->DpSram1[0]; | 181 | ram[0] = DpRam->DpSram1; |
183 | ram[1] = (char *)&DpRam->DpSram2[0]; | 182 | ram[1] = DpRam->DpSram2; |
184 | ram[2] = (char *)&DpRam->DpSram3[0]; | 183 | ram[2] = DpRam->DpSram3; |
185 | nbanks = (type == RIO_PCI) ? 3 : 4; | 184 | nbanks = (type == RIO_PCI) ? 3 : 4; |
186 | if (nbanks == 4) | 185 | if (nbanks == 4) |
187 | ram[3] = (char *)&DpRam->DpScratch[0]; | 186 | ram[3] = DpRam->DpScratch; |
188 | 187 | ||
189 | 188 | ||
190 | if (nbanks == 3) { | 189 | if (nbanks == 3) { |
@@ -202,7 +201,7 @@ int RIOBoardTest(unsigned long paddr, caddr_t caddr, unsigned char type, int slo | |||
202 | */ | 201 | */ |
203 | for (op=0; op<TEST_END; op++) { | 202 | for (op=0; op<TEST_END; op++) { |
204 | for (bank=0; bank<nbanks; bank++) { | 203 | for (bank=0; bank<nbanks; bank++) { |
205 | if (RIOScrub(op, (u8 *)ram[bank], size[bank]) == RIO_FAIL) { | 204 | if (RIOScrub(op, ram[bank], size[bank]) == RIO_FAIL) { |
206 | rio_dprintk (RIO_DEBUG_INIT, "RIO-init: RIOScrub band %d, op %d failed\n", | 205 | rio_dprintk (RIO_DEBUG_INIT, "RIO-init: RIOScrub band %d, op %d failed\n", |
207 | bank, op); | 206 | bank, op); |
208 | return RIO_FAIL; | 207 | return RIO_FAIL; |
@@ -227,7 +226,7 @@ int RIOBoardTest(unsigned long paddr, caddr_t caddr, unsigned char type, int slo | |||
227 | ** to check that the data from the previous phase was retained. | 226 | ** to check that the data from the previous phase was retained. |
228 | */ | 227 | */ |
229 | 228 | ||
230 | static int RIOScrub(int op, u8 *ram, int size) | 229 | static int RIOScrub(int op, u8 __iomem *ram, int size) |
231 | { | 230 | { |
232 | int off; | 231 | int off; |
233 | unsigned char oldbyte; | 232 | unsigned char oldbyte; |
@@ -393,7 +392,7 @@ struct rioVersion *RIOVersid(void) | |||
393 | return &stVersion; | 392 | return &stVersion; |
394 | } | 393 | } |
395 | 394 | ||
396 | void RIOHostReset(unsigned int Type, struct DpRam *DpRamP, unsigned int Slot) | 395 | void RIOHostReset(unsigned int Type, struct DpRam __iomem *DpRamP, unsigned int Slot) |
397 | { | 396 | { |
398 | /* | 397 | /* |
399 | ** Reset the Tpu | 398 | ** Reset the Tpu |
diff --git a/drivers/char/rio/riointr.c b/drivers/char/rio/riointr.c index 97f0fa550652..0bd09040a5c0 100644 --- a/drivers/char/rio/riointr.c +++ b/drivers/char/rio/riointr.c | |||
@@ -102,7 +102,7 @@ void RIOTxEnable(char *en) | |||
102 | struct rio_info *p; | 102 | struct rio_info *p; |
103 | struct tty_struct *tty; | 103 | struct tty_struct *tty; |
104 | int c; | 104 | int c; |
105 | struct PKT *PacketP; | 105 | struct PKT __iomem *PacketP; |
106 | unsigned long flags; | 106 | unsigned long flags; |
107 | 107 | ||
108 | PortP = (struct Port *) en; | 108 | PortP = (struct Port *) en; |
@@ -144,7 +144,7 @@ void RIOTxEnable(char *en) | |||
144 | if (c == 0) | 144 | if (c == 0) |
145 | break; | 145 | break; |
146 | 146 | ||
147 | rio_memcpy_toio(PortP->HostP->Caddr, (caddr_t) PacketP->data, PortP->gs.xmit_buf + PortP->gs.xmit_tail, c); | 147 | rio_memcpy_toio(PortP->HostP->Caddr, PacketP->data, PortP->gs.xmit_buf + PortP->gs.xmit_tail, c); |
148 | /* udelay (1); */ | 148 | /* udelay (1); */ |
149 | 149 | ||
150 | writeb(c, &(PacketP->len)); | 150 | writeb(c, &(PacketP->len)); |
@@ -219,7 +219,7 @@ void RIOServiceHost(struct rio_info *p, struct Host *HostP, int From) | |||
219 | for (port = p->RIOFirstPortsBooted; port < p->RIOLastPortsBooted + PORTS_PER_RTA; port++) { | 219 | for (port = p->RIOFirstPortsBooted; port < p->RIOLastPortsBooted + PORTS_PER_RTA; port++) { |
220 | struct Port *PortP = p->RIOPortp[port]; | 220 | struct Port *PortP = p->RIOPortp[port]; |
221 | struct tty_struct *ttyP; | 221 | struct tty_struct *ttyP; |
222 | struct PKT *PacketP; | 222 | struct PKT __iomem *PacketP; |
223 | 223 | ||
224 | /* | 224 | /* |
225 | ** not mapped in - most of the RIOPortp[] information | 225 | ** not mapped in - most of the RIOPortp[] information |
@@ -298,7 +298,7 @@ void RIOServiceHost(struct rio_info *p, struct Host *HostP, int From) | |||
298 | for (port = p->RIOFirstPortsBooted; port < p->RIOLastPortsBooted + PORTS_PER_RTA; port++) { | 298 | for (port = p->RIOFirstPortsBooted; port < p->RIOLastPortsBooted + PORTS_PER_RTA; port++) { |
299 | struct Port *PortP = p->RIOPortp[port]; | 299 | struct Port *PortP = p->RIOPortp[port]; |
300 | struct tty_struct *ttyP; | 300 | struct tty_struct *ttyP; |
301 | struct PKT *PacketP; | 301 | struct PKT __iomem *PacketP; |
302 | 302 | ||
303 | /* | 303 | /* |
304 | ** not mapped in - most of the RIOPortp[] information | 304 | ** not mapped in - most of the RIOPortp[] information |
@@ -427,13 +427,13 @@ void RIOServiceHost(struct rio_info *p, struct Host *HostP, int From) | |||
427 | 427 | ||
428 | while (PortP->WflushFlag && can_add_transmit(&PacketP, PortP) && (PortP->InUse == NOT_INUSE)) { | 428 | while (PortP->WflushFlag && can_add_transmit(&PacketP, PortP) && (PortP->InUse == NOT_INUSE)) { |
429 | int p; | 429 | int p; |
430 | struct PktCmd *PktCmdP; | 430 | struct PktCmd __iomem *PktCmdP; |
431 | 431 | ||
432 | rio_dprintk(RIO_DEBUG_INTR, "Add WFLUSH marker to data queue\n"); | 432 | rio_dprintk(RIO_DEBUG_INTR, "Add WFLUSH marker to data queue\n"); |
433 | /* | 433 | /* |
434 | ** make it look just like a WFLUSH command | 434 | ** make it look just like a WFLUSH command |
435 | */ | 435 | */ |
436 | PktCmdP = (struct PktCmd *) &PacketP->data[0]; | 436 | PktCmdP = (struct PktCmd __iomem *) &PacketP->data[0]; |
437 | 437 | ||
438 | writeb(WFLUSH, &PktCmdP->Command); | 438 | writeb(WFLUSH, &PktCmdP->Command); |
439 | 439 | ||
@@ -525,9 +525,9 @@ static void RIOReceive(struct rio_info *p, struct Port *PortP) | |||
525 | { | 525 | { |
526 | struct tty_struct *TtyP; | 526 | struct tty_struct *TtyP; |
527 | unsigned short transCount; | 527 | unsigned short transCount; |
528 | struct PKT *PacketP; | 528 | struct PKT __iomem *PacketP; |
529 | register unsigned int DataCnt; | 529 | register unsigned int DataCnt; |
530 | unsigned char *ptr; | 530 | unsigned char __iomem *ptr; |
531 | unsigned char *buf; | 531 | unsigned char *buf; |
532 | int copied = 0; | 532 | int copied = 0; |
533 | 533 | ||
@@ -546,7 +546,7 @@ static void RIOReceive(struct rio_info *p, struct Port *PortP) | |||
546 | ** run out of space it will be set to the offset of the | 546 | ** run out of space it will be set to the offset of the |
547 | ** next byte to copy from the packet data area. The packet | 547 | ** next byte to copy from the packet data area. The packet |
548 | ** length field is decremented by the number of bytes that | 548 | ** length field is decremented by the number of bytes that |
549 | ** we succesfully removed from the packet. When this reaches | 549 | ** we successfully removed from the packet. When this reaches |
550 | ** zero, we reset the offset pointer to be zero, and free | 550 | ** zero, we reset the offset pointer to be zero, and free |
551 | ** the packet from the front of the queue. | 551 | ** the packet from the front of the queue. |
552 | */ | 552 | */ |
@@ -585,19 +585,19 @@ static void RIOReceive(struct rio_info *p, struct Port *PortP) | |||
585 | /* | 585 | /* |
586 | ** check that it is not a command! | 586 | ** check that it is not a command! |
587 | */ | 587 | */ |
588 | if (PacketP->len & PKT_CMD_BIT) { | 588 | if (readb(&PacketP->len) & PKT_CMD_BIT) { |
589 | rio_dprintk(RIO_DEBUG_INTR, "RIO: unexpected command packet received on PHB\n"); | 589 | rio_dprintk(RIO_DEBUG_INTR, "RIO: unexpected command packet received on PHB\n"); |
590 | /* rio_dprint(RIO_DEBUG_INTR, (" sysport = %d\n", p->RIOPortp->PortNum)); */ | 590 | /* rio_dprint(RIO_DEBUG_INTR, (" sysport = %d\n", p->RIOPortp->PortNum)); */ |
591 | rio_dprintk(RIO_DEBUG_INTR, " dest_unit = %d\n", PacketP->dest_unit); | 591 | rio_dprintk(RIO_DEBUG_INTR, " dest_unit = %d\n", readb(&PacketP->dest_unit)); |
592 | rio_dprintk(RIO_DEBUG_INTR, " dest_port = %d\n", PacketP->dest_port); | 592 | rio_dprintk(RIO_DEBUG_INTR, " dest_port = %d\n", readb(&PacketP->dest_port)); |
593 | rio_dprintk(RIO_DEBUG_INTR, " src_unit = %d\n", PacketP->src_unit); | 593 | rio_dprintk(RIO_DEBUG_INTR, " src_unit = %d\n", readb(&PacketP->src_unit)); |
594 | rio_dprintk(RIO_DEBUG_INTR, " src_port = %d\n", PacketP->src_port); | 594 | rio_dprintk(RIO_DEBUG_INTR, " src_port = %d\n", readb(&PacketP->src_port)); |
595 | rio_dprintk(RIO_DEBUG_INTR, " len = %d\n", PacketP->len); | 595 | rio_dprintk(RIO_DEBUG_INTR, " len = %d\n", readb(&PacketP->len)); |
596 | rio_dprintk(RIO_DEBUG_INTR, " control = %d\n", PacketP->control); | 596 | rio_dprintk(RIO_DEBUG_INTR, " control = %d\n", readb(&PacketP->control)); |
597 | rio_dprintk(RIO_DEBUG_INTR, " csum = %d\n", PacketP->csum); | 597 | rio_dprintk(RIO_DEBUG_INTR, " csum = %d\n", readw(&PacketP->csum)); |
598 | rio_dprintk(RIO_DEBUG_INTR, " data bytes: "); | 598 | rio_dprintk(RIO_DEBUG_INTR, " data bytes: "); |
599 | for (DataCnt = 0; DataCnt < PKT_MAX_DATA_LEN; DataCnt++) | 599 | for (DataCnt = 0; DataCnt < PKT_MAX_DATA_LEN; DataCnt++) |
600 | rio_dprintk(RIO_DEBUG_INTR, "%d\n", PacketP->data[DataCnt]); | 600 | rio_dprintk(RIO_DEBUG_INTR, "%d\n", readb(&PacketP->data[DataCnt])); |
601 | remove_receive(PortP); | 601 | remove_receive(PortP); |
602 | put_free_end(PortP->HostP, PacketP); | 602 | put_free_end(PortP->HostP, PacketP); |
603 | continue; /* with next packet */ | 603 | continue; /* with next packet */ |
@@ -618,24 +618,24 @@ static void RIOReceive(struct rio_info *p, struct Port *PortP) | |||
618 | ** and available space. | 618 | ** and available space. |
619 | */ | 619 | */ |
620 | 620 | ||
621 | transCount = tty_buffer_request_room(TtyP, PacketP->len & PKT_LEN_MASK); | 621 | transCount = tty_buffer_request_room(TtyP, readb(&PacketP->len) & PKT_LEN_MASK); |
622 | rio_dprintk(RIO_DEBUG_REC, "port %d: Copy %d bytes\n", PortP->PortNum, transCount); | 622 | rio_dprintk(RIO_DEBUG_REC, "port %d: Copy %d bytes\n", PortP->PortNum, transCount); |
623 | /* | 623 | /* |
624 | ** To use the following 'kkprintfs' for debugging - change the '#undef' | 624 | ** To use the following 'kkprintfs' for debugging - change the '#undef' |
625 | ** to '#define', (this is the only place ___DEBUG_IT___ occurs in the | 625 | ** to '#define', (this is the only place ___DEBUG_IT___ occurs in the |
626 | ** driver). | 626 | ** driver). |
627 | */ | 627 | */ |
628 | ptr = (unsigned char *) PacketP->data + PortP->RxDataStart; | 628 | ptr = (unsigned char __iomem *) PacketP->data + PortP->RxDataStart; |
629 | 629 | ||
630 | tty_prepare_flip_string(TtyP, &buf, transCount); | 630 | tty_prepare_flip_string(TtyP, &buf, transCount); |
631 | rio_memcpy_fromio(buf, ptr, transCount); | 631 | rio_memcpy_fromio(buf, ptr, transCount); |
632 | PortP->RxDataStart += transCount; | 632 | PortP->RxDataStart += transCount; |
633 | PacketP->len -= transCount; | 633 | writeb(readb(&PacketP->len)-transCount, &PacketP->len); |
634 | copied += transCount; | 634 | copied += transCount; |
635 | 635 | ||
636 | 636 | ||
637 | 637 | ||
638 | if (PacketP->len == 0) { | 638 | if (readb(&PacketP->len) == 0) { |
639 | /* | 639 | /* |
640 | ** If we have emptied the packet, then we can | 640 | ** If we have emptied the packet, then we can |
641 | ** free it, and reset the start pointer for | 641 | ** free it, and reset the start pointer for |
diff --git a/drivers/char/rio/rioparam.c b/drivers/char/rio/rioparam.c index d2e8092cdb29..1066d9760704 100644 --- a/drivers/char/rio/rioparam.c +++ b/drivers/char/rio/rioparam.c | |||
@@ -154,8 +154,8 @@ int RIOParam(struct Port *PortP, int cmd, int Modem, int SleepFlag) | |||
154 | { | 154 | { |
155 | struct tty_struct *TtyP; | 155 | struct tty_struct *TtyP; |
156 | int retval; | 156 | int retval; |
157 | struct phb_param *phb_param_ptr; | 157 | struct phb_param __iomem *phb_param_ptr; |
158 | struct PKT *PacketP; | 158 | struct PKT __iomem *PacketP; |
159 | int res; | 159 | int res; |
160 | u8 Cor1 = 0, Cor2 = 0, Cor4 = 0, Cor5 = 0; | 160 | u8 Cor1 = 0, Cor2 = 0, Cor4 = 0, Cor5 = 0; |
161 | u8 TxXon = 0, TxXoff = 0, RxXon = 0, RxXoff = 0; | 161 | u8 TxXon = 0, TxXoff = 0, RxXon = 0, RxXoff = 0; |
@@ -235,7 +235,7 @@ int RIOParam(struct Port *PortP, int cmd, int Modem, int SleepFlag) | |||
235 | rio_dprintk(RIO_DEBUG_PARAM, "can_add_transmit() returns %x\n", res); | 235 | rio_dprintk(RIO_DEBUG_PARAM, "can_add_transmit() returns %x\n", res); |
236 | rio_dprintk(RIO_DEBUG_PARAM, "Packet is %p\n", PacketP); | 236 | rio_dprintk(RIO_DEBUG_PARAM, "Packet is %p\n", PacketP); |
237 | 237 | ||
238 | phb_param_ptr = (struct phb_param *) PacketP->data; | 238 | phb_param_ptr = (struct phb_param __iomem *) PacketP->data; |
239 | 239 | ||
240 | 240 | ||
241 | switch (TtyP->termios->c_cflag & CSIZE) { | 241 | switch (TtyP->termios->c_cflag & CSIZE) { |
@@ -580,11 +580,11 @@ int RIOParam(struct Port *PortP, int cmd, int Modem, int SleepFlag) | |||
580 | ** We can add another packet to a transmit queue if the packet pointer pointed | 580 | ** We can add another packet to a transmit queue if the packet pointer pointed |
581 | ** to by the TxAdd pointer has PKT_IN_USE clear in its address. | 581 | ** to by the TxAdd pointer has PKT_IN_USE clear in its address. |
582 | */ | 582 | */ |
583 | int can_add_transmit(struct PKT **PktP, struct Port *PortP) | 583 | int can_add_transmit(struct PKT __iomem **PktP, struct Port *PortP) |
584 | { | 584 | { |
585 | struct PKT *tp; | 585 | struct PKT __iomem *tp; |
586 | 586 | ||
587 | *PktP = tp = (struct PKT *) RIO_PTR(PortP->Caddr, readw(PortP->TxAdd)); | 587 | *PktP = tp = (struct PKT __iomem *) RIO_PTR(PortP->Caddr, readw(PortP->TxAdd)); |
588 | 588 | ||
589 | return !((unsigned long) tp & PKT_IN_USE); | 589 | return !((unsigned long) tp & PKT_IN_USE); |
590 | } | 590 | } |
@@ -608,9 +608,9 @@ void add_transmit(struct Port *PortP) | |||
608 | * Put a packet onto the end of the | 608 | * Put a packet onto the end of the |
609 | * free list | 609 | * free list |
610 | ****************************************/ | 610 | ****************************************/ |
611 | void put_free_end(struct Host *HostP, struct PKT *PktP) | 611 | void put_free_end(struct Host *HostP, struct PKT __iomem *PktP) |
612 | { | 612 | { |
613 | struct rio_free_list *tmp_pointer; | 613 | struct rio_free_list __iomem *tmp_pointer; |
614 | unsigned short old_end, new_end; | 614 | unsigned short old_end, new_end; |
615 | unsigned long flags; | 615 | unsigned long flags; |
616 | 616 | ||
@@ -625,15 +625,15 @@ void put_free_end(struct Host *HostP, struct PKT *PktP) | |||
625 | 625 | ||
626 | if ((old_end = readw(&HostP->ParmMapP->free_list_end)) != TPNULL) { | 626 | if ((old_end = readw(&HostP->ParmMapP->free_list_end)) != TPNULL) { |
627 | new_end = RIO_OFF(HostP->Caddr, PktP); | 627 | new_end = RIO_OFF(HostP->Caddr, PktP); |
628 | tmp_pointer = (struct rio_free_list *) RIO_PTR(HostP->Caddr, old_end); | 628 | tmp_pointer = (struct rio_free_list __iomem *) RIO_PTR(HostP->Caddr, old_end); |
629 | writew(new_end, &tmp_pointer->next); | 629 | writew(new_end, &tmp_pointer->next); |
630 | writew(old_end, &((struct rio_free_list *) PktP)->prev); | 630 | writew(old_end, &((struct rio_free_list __iomem *) PktP)->prev); |
631 | writew(TPNULL, &((struct rio_free_list *) PktP)->next); | 631 | writew(TPNULL, &((struct rio_free_list __iomem *) PktP)->next); |
632 | writew(new_end, &HostP->ParmMapP->free_list_end); | 632 | writew(new_end, &HostP->ParmMapP->free_list_end); |
633 | } else { /* First packet on the free list this should never happen! */ | 633 | } else { /* First packet on the free list this should never happen! */ |
634 | rio_dprintk(RIO_DEBUG_PFE, "put_free_end(): This should never happen\n"); | 634 | rio_dprintk(RIO_DEBUG_PFE, "put_free_end(): This should never happen\n"); |
635 | writew(RIO_OFF(HostP->Caddr, PktP), &HostP->ParmMapP->free_list_end); | 635 | writew(RIO_OFF(HostP->Caddr, PktP), &HostP->ParmMapP->free_list_end); |
636 | tmp_pointer = (struct rio_free_list *) PktP; | 636 | tmp_pointer = (struct rio_free_list __iomem *) PktP; |
637 | writew(TPNULL, &tmp_pointer->prev); | 637 | writew(TPNULL, &tmp_pointer->prev); |
638 | writew(TPNULL, &tmp_pointer->next); | 638 | writew(TPNULL, &tmp_pointer->next); |
639 | } | 639 | } |
@@ -647,10 +647,10 @@ void put_free_end(struct Host *HostP, struct PKT *PktP) | |||
647 | ** relevant packet, [having cleared the PKT_IN_USE bit]. If PKT_IN_USE is clear, | 647 | ** relevant packet, [having cleared the PKT_IN_USE bit]. If PKT_IN_USE is clear, |
648 | ** then can_remove_receive() returns 0. | 648 | ** then can_remove_receive() returns 0. |
649 | */ | 649 | */ |
650 | int can_remove_receive(struct PKT **PktP, struct Port *PortP) | 650 | int can_remove_receive(struct PKT __iomem **PktP, struct Port *PortP) |
651 | { | 651 | { |
652 | if (readw(PortP->RxRemove) & PKT_IN_USE) { | 652 | if (readw(PortP->RxRemove) & PKT_IN_USE) { |
653 | *PktP = (struct PKT *) RIO_PTR(PortP->Caddr, readw(PortP->RxRemove) & ~PKT_IN_USE); | 653 | *PktP = (struct PKT __iomem *) RIO_PTR(PortP->Caddr, readw(PortP->RxRemove) & ~PKT_IN_USE); |
654 | return 1; | 654 | return 1; |
655 | } | 655 | } |
656 | return 0; | 656 | return 0; |
diff --git a/drivers/char/rio/rioroute.c b/drivers/char/rio/rioroute.c index 357085337942..a99f3d9d7d65 100644 --- a/drivers/char/rio/rioroute.c +++ b/drivers/char/rio/rioroute.c | |||
@@ -86,9 +86,9 @@ static void RIOConCon(struct rio_info *, struct Host *, unsigned int, unsigned i | |||
86 | ** Incoming on the ROUTE_RUP | 86 | ** Incoming on the ROUTE_RUP |
87 | ** I wrote this while I was tired. Forgive me. | 87 | ** I wrote this while I was tired. Forgive me. |
88 | */ | 88 | */ |
89 | int RIORouteRup(struct rio_info *p, unsigned int Rup, struct Host *HostP, struct PKT * PacketP) | 89 | int RIORouteRup(struct rio_info *p, unsigned int Rup, struct Host *HostP, struct PKT __iomem * PacketP) |
90 | { | 90 | { |
91 | struct PktCmd *PktCmdP = (struct PktCmd *) PacketP->data; | 91 | struct PktCmd __iomem *PktCmdP = (struct PktCmd __iomem *) PacketP->data; |
92 | struct PktCmd_M *PktReplyP; | 92 | struct PktCmd_M *PktReplyP; |
93 | struct CmdBlk *CmdBlkP; | 93 | struct CmdBlk *CmdBlkP; |
94 | struct Port *PortP; | 94 | struct Port *PortP; |
@@ -307,7 +307,7 @@ int RIORouteRup(struct rio_info *p, unsigned int Rup, struct Host *HostP, struct | |||
307 | if (!RIOBootOk(p, HostP, RtaUniq)) { | 307 | if (!RIOBootOk(p, HostP, RtaUniq)) { |
308 | rio_dprintk(RIO_DEBUG_ROUTE, "RTA %x tried to get an ID, but does not belong - FOAD it!\n", RtaUniq); | 308 | rio_dprintk(RIO_DEBUG_ROUTE, "RTA %x tried to get an ID, but does not belong - FOAD it!\n", RtaUniq); |
309 | PktReplyP->Command = ROUTE_FOAD; | 309 | PktReplyP->Command = ROUTE_FOAD; |
310 | HostP->Copy("RT_FOAD", PktReplyP->CommandText, 7); | 310 | memcpy(PktReplyP->CommandText, "RT_FOAD", 7); |
311 | RIOQueueCmdBlk(HostP, Rup, CmdBlkP); | 311 | RIOQueueCmdBlk(HostP, Rup, CmdBlkP); |
312 | return 1; | 312 | return 1; |
313 | } | 313 | } |
@@ -341,7 +341,7 @@ int RIORouteRup(struct rio_info *p, unsigned int Rup, struct Host *HostP, struct | |||
341 | HostP->Mapping[ThisUnit].Flags |= MSG_DONE; | 341 | HostP->Mapping[ThisUnit].Flags |= MSG_DONE; |
342 | } | 342 | } |
343 | PktReplyP->Command = ROUTE_FOAD; | 343 | PktReplyP->Command = ROUTE_FOAD; |
344 | HostP->Copy("RT_FOAD", PktReplyP->CommandText, 7); | 344 | memcpy(PktReplyP->CommandText, "RT_FOAD", 7); |
345 | RIOQueueCmdBlk(HostP, Rup, CmdBlkP); | 345 | RIOQueueCmdBlk(HostP, Rup, CmdBlkP); |
346 | return 1; | 346 | return 1; |
347 | } | 347 | } |
@@ -367,7 +367,7 @@ int RIORouteRup(struct rio_info *p, unsigned int Rup, struct Host *HostP, struct | |||
367 | PktReplyP->IDNum2 = ROUTE_NO_ID; | 367 | PktReplyP->IDNum2 = ROUTE_NO_ID; |
368 | rio_dprintk(RIO_DEBUG_ROUTE, "RTA '%s' has been allocated ID %d\n", HostP->Mapping[ThisUnit].Name, PktReplyP->IDNum); | 368 | rio_dprintk(RIO_DEBUG_ROUTE, "RTA '%s' has been allocated ID %d\n", HostP->Mapping[ThisUnit].Name, PktReplyP->IDNum); |
369 | } | 369 | } |
370 | HostP->Copy("RT_ALLOCAT", PktReplyP->CommandText, 10); | 370 | memcpy(PktReplyP->CommandText, "RT_ALLOCAT", 10); |
371 | 371 | ||
372 | RIOQueueCmdBlk(HostP, Rup, CmdBlkP); | 372 | RIOQueueCmdBlk(HostP, Rup, CmdBlkP); |
373 | 373 | ||
@@ -469,7 +469,7 @@ int RIORouteRup(struct rio_info *p, unsigned int Rup, struct Host *HostP, struct | |||
469 | } | 469 | } |
470 | 470 | ||
471 | PktReplyP->Command = ROUTE_FOAD; | 471 | PktReplyP->Command = ROUTE_FOAD; |
472 | HostP->Copy("RT_FOAD", PktReplyP->CommandText, 7); | 472 | memcpy(PktReplyP->CommandText, "RT_FOAD", 7); |
473 | } else { | 473 | } else { |
474 | /* | 474 | /* |
475 | ** we did boot it (as an extra), and there may now be a table | 475 | ** we did boot it (as an extra), and there may now be a table |
@@ -489,7 +489,7 @@ int RIORouteRup(struct rio_info *p, unsigned int Rup, struct Host *HostP, struct | |||
489 | } | 489 | } |
490 | } | 490 | } |
491 | PktReplyP->Command = ROUTE_USED; | 491 | PktReplyP->Command = ROUTE_USED; |
492 | HostP->Copy("RT_USED", PktReplyP->CommandText, 7); | 492 | memcpy(PktReplyP->CommandText, "RT_USED", 7); |
493 | } | 493 | } |
494 | RIOQueueCmdBlk(HostP, Rup, CmdBlkP); | 494 | RIOQueueCmdBlk(HostP, Rup, CmdBlkP); |
495 | return 1; | 495 | return 1; |
@@ -517,8 +517,8 @@ void RIOFixPhbs(struct rio_info *p, struct Host *HostP, unsigned int unit) | |||
517 | 517 | ||
518 | for (port = 0; port < PORTS_PER_RTA; port++, PortN++) { | 518 | for (port = 0; port < PORTS_PER_RTA; port++, PortN++) { |
519 | unsigned short dest_port = port + 8; | 519 | unsigned short dest_port = port + 8; |
520 | u16 *TxPktP; | 520 | u16 __iomem *TxPktP; |
521 | struct PKT *Pkt; | 521 | struct PKT __iomem *Pkt; |
522 | 522 | ||
523 | PortP = p->RIOPortp[PortN]; | 523 | PortP = p->RIOPortp[PortN]; |
524 | 524 | ||
@@ -555,12 +555,12 @@ void RIOFixPhbs(struct rio_info *p, struct Host *HostP, unsigned int unit) | |||
555 | ** card. This needs to be translated into a 32 bit pointer | 555 | ** card. This needs to be translated into a 32 bit pointer |
556 | ** so it can be accessed from the driver. | 556 | ** so it can be accessed from the driver. |
557 | */ | 557 | */ |
558 | Pkt = (struct PKT *) RIO_PTR(HostP->Caddr, readw(TxPktP)); | 558 | Pkt = (struct PKT __iomem *) RIO_PTR(HostP->Caddr, readw(TxPktP)); |
559 | 559 | ||
560 | /* | 560 | /* |
561 | ** If the packet is used, reset it. | 561 | ** If the packet is used, reset it. |
562 | */ | 562 | */ |
563 | Pkt = (struct PKT *) ((unsigned long) Pkt & ~PKT_IN_USE); | 563 | Pkt = (struct PKT __iomem *) ((unsigned long) Pkt & ~PKT_IN_USE); |
564 | writeb(dest_unit, &Pkt->dest_unit); | 564 | writeb(dest_unit, &Pkt->dest_unit); |
565 | writeb(dest_port, &Pkt->dest_port); | 565 | writeb(dest_port, &Pkt->dest_port); |
566 | } | 566 | } |
diff --git a/drivers/char/rio/riotable.c b/drivers/char/rio/riotable.c index d3abe0d37d64..7e988357326e 100644 --- a/drivers/char/rio/riotable.c +++ b/drivers/char/rio/riotable.c | |||
@@ -534,8 +534,8 @@ int RIODeleteRta(struct rio_info *p, struct Map *MapP) | |||
534 | if (PortP->SecondBlock) { | 534 | if (PortP->SecondBlock) { |
535 | u16 dest_unit = HostMapP->ID; | 535 | u16 dest_unit = HostMapP->ID; |
536 | u16 dest_port = port - SysPort; | 536 | u16 dest_port = port - SysPort; |
537 | u16 *TxPktP; | 537 | u16 __iomem *TxPktP; |
538 | struct PKT *Pkt; | 538 | struct PKT __iomem *Pkt; |
539 | 539 | ||
540 | for (TxPktP = PortP->TxStart; TxPktP <= PortP->TxEnd; TxPktP++) { | 540 | for (TxPktP = PortP->TxStart; TxPktP <= PortP->TxEnd; TxPktP++) { |
541 | /* | 541 | /* |
@@ -545,12 +545,12 @@ int RIODeleteRta(struct rio_info *p, struct Map *MapP) | |||
545 | ** a 32 bit pointer so it can be | 545 | ** a 32 bit pointer so it can be |
546 | ** accessed from the driver. | 546 | ** accessed from the driver. |
547 | */ | 547 | */ |
548 | Pkt = (struct PKT *) RIO_PTR(HostP->Caddr, readw(&*TxPktP)); | 548 | Pkt = (struct PKT __iomem *) RIO_PTR(HostP->Caddr, readw(&*TxPktP)); |
549 | rio_dprintk(RIO_DEBUG_TABLE, "Tx packet (%x) destination: Old %x:%x New %x:%x\n", *TxPktP, Pkt->dest_unit, Pkt->dest_port, dest_unit, dest_port); | 549 | rio_dprintk(RIO_DEBUG_TABLE, "Tx packet (%x) destination: Old %x:%x New %x:%x\n", readw(TxPktP), readb(&Pkt->dest_unit), readb(&Pkt->dest_port), dest_unit, dest_port); |
550 | writew(dest_unit, &Pkt->dest_unit); | 550 | writew(dest_unit, &Pkt->dest_unit); |
551 | writew(dest_port, &Pkt->dest_port); | 551 | writew(dest_port, &Pkt->dest_port); |
552 | } | 552 | } |
553 | rio_dprintk(RIO_DEBUG_TABLE, "Port %d phb destination: Old %x:%x New %x:%x\n", port, PortP->PhbP->destination & 0xff, (PortP->PhbP->destination >> 8) & 0xff, dest_unit, dest_port); | 553 | rio_dprintk(RIO_DEBUG_TABLE, "Port %d phb destination: Old %x:%x New %x:%x\n", port, readb(&PortP->PhbP->destination) & 0xff, (readb(&PortP->PhbP->destination) >> 8) & 0xff, dest_unit, dest_port); |
554 | writew(dest_unit + (dest_port << 8), &PortP->PhbP->destination); | 554 | writew(dest_unit + (dest_port << 8), &PortP->PhbP->destination); |
555 | } | 555 | } |
556 | rio_spin_unlock_irqrestore(&PortP->portSem, sem_flags); | 556 | rio_spin_unlock_irqrestore(&PortP->portSem, sem_flags); |
@@ -781,13 +781,13 @@ int RIOReMapPorts(struct rio_info *p, struct Host *HostP, struct Map *HostMapP) | |||
781 | ** unless the host has been booted | 781 | ** unless the host has been booted |
782 | */ | 782 | */ |
783 | if ((HostP->Flags & RUN_STATE) == RC_RUNNING) { | 783 | if ((HostP->Flags & RUN_STATE) == RC_RUNNING) { |
784 | struct PHB *PhbP = PortP->PhbP = &HostP->PhbP[HostPort]; | 784 | struct PHB __iomem *PhbP = PortP->PhbP = &HostP->PhbP[HostPort]; |
785 | PortP->TxAdd = (u16 *) RIO_PTR(HostP->Caddr, readw(&PhbP->tx_add)); | 785 | PortP->TxAdd = (u16 __iomem *) RIO_PTR(HostP->Caddr, readw(&PhbP->tx_add)); |
786 | PortP->TxStart = (u16 *) RIO_PTR(HostP->Caddr, readw(&PhbP->tx_start)); | 786 | PortP->TxStart = (u16 __iomem *) RIO_PTR(HostP->Caddr, readw(&PhbP->tx_start)); |
787 | PortP->TxEnd = (u16 *) RIO_PTR(HostP->Caddr, readw(&PhbP->tx_end)); | 787 | PortP->TxEnd = (u16 __iomem *) RIO_PTR(HostP->Caddr, readw(&PhbP->tx_end)); |
788 | PortP->RxRemove = (u16 *) RIO_PTR(HostP->Caddr, readw(&PhbP->rx_remove)); | 788 | PortP->RxRemove = (u16 __iomem *) RIO_PTR(HostP->Caddr, readw(&PhbP->rx_remove)); |
789 | PortP->RxStart = (u16 *) RIO_PTR(HostP->Caddr, readw(&PhbP->rx_start)); | 789 | PortP->RxStart = (u16 __iomem *) RIO_PTR(HostP->Caddr, readw(&PhbP->rx_start)); |
790 | PortP->RxEnd = (u16 *) RIO_PTR(HostP->Caddr, readw(&PhbP->rx_end)); | 790 | PortP->RxEnd = (u16 __iomem *) RIO_PTR(HostP->Caddr, readw(&PhbP->rx_end)); |
791 | } else | 791 | } else |
792 | PortP->PhbP = NULL; | 792 | PortP->PhbP = NULL; |
793 | 793 | ||
diff --git a/drivers/char/rio/riotty.c b/drivers/char/rio/riotty.c index 204267613c9c..a4f0b1e3e7fa 100644 --- a/drivers/char/rio/riotty.c +++ b/drivers/char/rio/riotty.c | |||
@@ -576,7 +576,7 @@ static void RIOClearUp(struct Port *PortP) | |||
576 | */ | 576 | */ |
577 | int RIOShortCommand(struct rio_info *p, struct Port *PortP, int command, int len, int arg) | 577 | int RIOShortCommand(struct rio_info *p, struct Port *PortP, int command, int len, int arg) |
578 | { | 578 | { |
579 | struct PKT *PacketP; | 579 | struct PKT __iomem *PacketP; |
580 | int retries = 20; /* at 10 per second -> 2 seconds */ | 580 | int retries = 20; /* at 10 per second -> 2 seconds */ |
581 | unsigned long flags; | 581 | unsigned long flags; |
582 | 582 | ||
diff --git a/drivers/char/rio/unixrup.h b/drivers/char/rio/unixrup.h index 4306e01dbf01..46bd532f7746 100644 --- a/drivers/char/rio/unixrup.h +++ b/drivers/char/rio/unixrup.h | |||
@@ -44,7 +44,7 @@ static char *_unixrup_h_sccs_ = "@(#)unixrup.h 1.2"; | |||
44 | struct UnixRup { | 44 | struct UnixRup { |
45 | struct CmdBlk *CmdsWaitingP; /* Commands waiting to be done */ | 45 | struct CmdBlk *CmdsWaitingP; /* Commands waiting to be done */ |
46 | struct CmdBlk *CmdPendingP; /* The command currently being sent */ | 46 | struct CmdBlk *CmdPendingP; /* The command currently being sent */ |
47 | struct RUP *RupP; /* the Rup to send it to */ | 47 | struct RUP __iomem *RupP; /* the Rup to send it to */ |
48 | unsigned int Id; /* Id number */ | 48 | unsigned int Id; /* Id number */ |
49 | unsigned int BaseSysPort; /* SysPort of first tty on this RTA */ | 49 | unsigned int BaseSysPort; /* SysPort of first tty on this RTA */ |
50 | unsigned int ModTypes; /* Modules on this RTA */ | 50 | unsigned int ModTypes; /* Modules on this RTA */ |
diff --git a/drivers/char/riscom8.c b/drivers/char/riscom8.c index 657c0d88f48c..f1c94f771af5 100644 --- a/drivers/char/riscom8.c +++ b/drivers/char/riscom8.c | |||
@@ -625,7 +625,7 @@ static inline int rc_setup_board(struct riscom_board * bp) | |||
625 | if (bp->flags & RC_BOARD_ACTIVE) | 625 | if (bp->flags & RC_BOARD_ACTIVE) |
626 | return 0; | 626 | return 0; |
627 | 627 | ||
628 | error = request_irq(bp->irq, rc_interrupt, SA_INTERRUPT, | 628 | error = request_irq(bp->irq, rc_interrupt, IRQF_DISABLED, |
629 | "RISCom/8", NULL); | 629 | "RISCom/8", NULL); |
630 | if (error) | 630 | if (error) |
631 | return error; | 631 | return error; |
@@ -1634,7 +1634,6 @@ static inline int rc_init_drivers(void) | |||
1634 | memset(IRQ_to_board, 0, sizeof(IRQ_to_board)); | 1634 | memset(IRQ_to_board, 0, sizeof(IRQ_to_board)); |
1635 | riscom_driver->owner = THIS_MODULE; | 1635 | riscom_driver->owner = THIS_MODULE; |
1636 | riscom_driver->name = "ttyL"; | 1636 | riscom_driver->name = "ttyL"; |
1637 | riscom_driver->devfs_name = "tts/L"; | ||
1638 | riscom_driver->major = RISCOM8_NORMAL_MAJOR; | 1637 | riscom_driver->major = RISCOM8_NORMAL_MAJOR; |
1639 | riscom_driver->type = TTY_DRIVER_TYPE_SERIAL; | 1638 | riscom_driver->type = TTY_DRIVER_TYPE_SERIAL; |
1640 | riscom_driver->subtype = SERIAL_TYPE_NORMAL; | 1639 | riscom_driver->subtype = SERIAL_TYPE_NORMAL; |
diff --git a/drivers/char/rocket.c b/drivers/char/rocket.c index 7edc6a4dbdc4..0ac131881322 100644 --- a/drivers/char/rocket.c +++ b/drivers/char/rocket.c | |||
@@ -324,35 +324,15 @@ static void rp_do_receive(struct r_port *info, | |||
324 | CHANNEL_t * cp, unsigned int ChanStatus) | 324 | CHANNEL_t * cp, unsigned int ChanStatus) |
325 | { | 325 | { |
326 | unsigned int CharNStat; | 326 | unsigned int CharNStat; |
327 | int ToRecv, wRecv, space = 0, count; | 327 | int ToRecv, wRecv, space; |
328 | unsigned char *cbuf, *chead; | 328 | unsigned char *cbuf; |
329 | char *fbuf, *fhead; | ||
330 | struct tty_ldisc *ld; | ||
331 | |||
332 | ld = tty_ldisc_ref(tty); | ||
333 | 329 | ||
334 | ToRecv = sGetRxCnt(cp); | 330 | ToRecv = sGetRxCnt(cp); |
335 | space = tty->receive_room; | ||
336 | if (space > 2 * TTY_FLIPBUF_SIZE) | ||
337 | space = 2 * TTY_FLIPBUF_SIZE; | ||
338 | count = 0; | ||
339 | #ifdef ROCKET_DEBUG_INTR | 331 | #ifdef ROCKET_DEBUG_INTR |
340 | printk(KERN_INFO "rp_do_receive(%d, %d)...", ToRecv, space); | 332 | printk(KERN_INFO "rp_do_receive(%d)...", ToRecv); |
341 | #endif | 333 | #endif |
342 | 334 | if (ToRecv == 0) | |
343 | /* | 335 | return; |
344 | * determine how many we can actually read in. If we can't | ||
345 | * read any in then we have a software overrun condition. | ||
346 | */ | ||
347 | if (ToRecv > space) | ||
348 | ToRecv = space; | ||
349 | |||
350 | ToRecv = tty_prepare_flip_string_flags(tty, &chead, &fhead, ToRecv); | ||
351 | if (ToRecv <= 0) | ||
352 | goto done; | ||
353 | |||
354 | cbuf = chead; | ||
355 | fbuf = fhead; | ||
356 | 336 | ||
357 | /* | 337 | /* |
358 | * if status indicates there are errored characters in the | 338 | * if status indicates there are errored characters in the |
@@ -380,6 +360,8 @@ static void rp_do_receive(struct r_port *info, | |||
380 | info->read_status_mask); | 360 | info->read_status_mask); |
381 | #endif | 361 | #endif |
382 | while (ToRecv) { | 362 | while (ToRecv) { |
363 | char flag; | ||
364 | |||
383 | CharNStat = sInW(sGetTxRxDataIO(cp)); | 365 | CharNStat = sInW(sGetTxRxDataIO(cp)); |
384 | #ifdef ROCKET_DEBUG_RECEIVE | 366 | #ifdef ROCKET_DEBUG_RECEIVE |
385 | printk(KERN_INFO "%x...", CharNStat); | 367 | printk(KERN_INFO "%x...", CharNStat); |
@@ -392,17 +374,16 @@ static void rp_do_receive(struct r_port *info, | |||
392 | } | 374 | } |
393 | CharNStat &= info->read_status_mask; | 375 | CharNStat &= info->read_status_mask; |
394 | if (CharNStat & STMBREAKH) | 376 | if (CharNStat & STMBREAKH) |
395 | *fbuf++ = TTY_BREAK; | 377 | flag = TTY_BREAK; |
396 | else if (CharNStat & STMPARITYH) | 378 | else if (CharNStat & STMPARITYH) |
397 | *fbuf++ = TTY_PARITY; | 379 | flag = TTY_PARITY; |
398 | else if (CharNStat & STMFRAMEH) | 380 | else if (CharNStat & STMFRAMEH) |
399 | *fbuf++ = TTY_FRAME; | 381 | flag = TTY_FRAME; |
400 | else if (CharNStat & STMRCVROVRH) | 382 | else if (CharNStat & STMRCVROVRH) |
401 | *fbuf++ = TTY_OVERRUN; | 383 | flag = TTY_OVERRUN; |
402 | else | 384 | else |
403 | *fbuf++ = TTY_NORMAL; | 385 | flag = TTY_NORMAL; |
404 | *cbuf++ = CharNStat & 0xff; | 386 | tty_insert_flip_char(tty, CharNStat & 0xff, flag); |
405 | count++; | ||
406 | ToRecv--; | 387 | ToRecv--; |
407 | } | 388 | } |
408 | 389 | ||
@@ -422,20 +403,23 @@ static void rp_do_receive(struct r_port *info, | |||
422 | * characters at time by doing repeated word IO | 403 | * characters at time by doing repeated word IO |
423 | * transfer. | 404 | * transfer. |
424 | */ | 405 | */ |
406 | space = tty_prepare_flip_string(tty, &cbuf, ToRecv); | ||
407 | if (space < ToRecv) { | ||
408 | #ifdef ROCKET_DEBUG_RECEIVE | ||
409 | printk(KERN_INFO "rp_do_receive:insufficient space ToRecv=%d space=%d\n", ToRecv, space); | ||
410 | #endif | ||
411 | if (space <= 0) | ||
412 | return; | ||
413 | ToRecv = space; | ||
414 | } | ||
425 | wRecv = ToRecv >> 1; | 415 | wRecv = ToRecv >> 1; |
426 | if (wRecv) | 416 | if (wRecv) |
427 | sInStrW(sGetTxRxDataIO(cp), (unsigned short *) cbuf, wRecv); | 417 | sInStrW(sGetTxRxDataIO(cp), (unsigned short *) cbuf, wRecv); |
428 | if (ToRecv & 1) | 418 | if (ToRecv & 1) |
429 | cbuf[ToRecv - 1] = sInB(sGetTxRxDataIO(cp)); | 419 | cbuf[ToRecv - 1] = sInB(sGetTxRxDataIO(cp)); |
430 | memset(fbuf, TTY_NORMAL, ToRecv); | ||
431 | cbuf += ToRecv; | ||
432 | fbuf += ToRecv; | ||
433 | count += ToRecv; | ||
434 | } | 420 | } |
435 | /* Push the data up to the tty layer */ | 421 | /* Push the data up to the tty layer */ |
436 | ld->receive_buf(tty, chead, fhead, count); | 422 | tty_flip_buffer_push(tty); |
437 | done: | ||
438 | tty_ldisc_deref(ld); | ||
439 | } | 423 | } |
440 | 424 | ||
441 | /* | 425 | /* |
@@ -2442,8 +2426,7 @@ static int __init rp_init(void) | |||
2442 | */ | 2426 | */ |
2443 | 2427 | ||
2444 | rocket_driver->owner = THIS_MODULE; | 2428 | rocket_driver->owner = THIS_MODULE; |
2445 | rocket_driver->flags = TTY_DRIVER_NO_DEVFS; | 2429 | rocket_driver->flags = TTY_DRIVER_DYNAMIC_DEV; |
2446 | rocket_driver->devfs_name = "tts/R"; | ||
2447 | rocket_driver->name = "ttyR"; | 2430 | rocket_driver->name = "ttyR"; |
2448 | rocket_driver->driver_name = "Comtrol RocketPort"; | 2431 | rocket_driver->driver_name = "Comtrol RocketPort"; |
2449 | rocket_driver->major = TTY_ROCKET_MAJOR; | 2432 | rocket_driver->major = TTY_ROCKET_MAJOR; |
@@ -2454,7 +2437,7 @@ static int __init rp_init(void) | |||
2454 | rocket_driver->init_termios.c_cflag = | 2437 | rocket_driver->init_termios.c_cflag = |
2455 | B9600 | CS8 | CREAD | HUPCL | CLOCAL; | 2438 | B9600 | CS8 | CREAD | HUPCL | CLOCAL; |
2456 | #ifdef ROCKET_SOFT_FLOW | 2439 | #ifdef ROCKET_SOFT_FLOW |
2457 | rocket_driver->flags |= TTY_DRIVER_REAL_RAW | TTY_DRIVER_NO_DEVFS; | 2440 | rocket_driver->flags |= TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV; |
2458 | #endif | 2441 | #endif |
2459 | tty_set_operations(rocket_driver, &rocket_ops); | 2442 | tty_set_operations(rocket_driver, &rocket_ops); |
2460 | 2443 | ||
diff --git a/drivers/char/rtc.c b/drivers/char/rtc.c index 7cac6d05d723..cc7bd1a3095b 100644 --- a/drivers/char/rtc.c +++ b/drivers/char/rtc.c | |||
@@ -61,7 +61,6 @@ | |||
61 | * this driver.) | 61 | * this driver.) |
62 | */ | 62 | */ |
63 | 63 | ||
64 | #include <linux/config.h> | ||
65 | #include <linux/interrupt.h> | 64 | #include <linux/interrupt.h> |
66 | #include <linux/module.h> | 65 | #include <linux/module.h> |
67 | #include <linux/kernel.h> | 66 | #include <linux/kernel.h> |
@@ -221,7 +220,7 @@ static inline unsigned char rtc_is_updating(void) | |||
221 | 220 | ||
222 | #ifdef RTC_IRQ | 221 | #ifdef RTC_IRQ |
223 | /* | 222 | /* |
224 | * A very tiny interrupt handler. It runs with SA_INTERRUPT set, | 223 | * A very tiny interrupt handler. It runs with IRQF_DISABLED set, |
225 | * but there is possibility of conflicting with the set_rtc_mmss() | 224 | * but there is possibility of conflicting with the set_rtc_mmss() |
226 | * call (the rtc irq and the timer irq can easily run at the same | 225 | * call (the rtc irq and the timer irq can easily run at the same |
227 | * time in two different CPUs). So we need to serialize | 226 | * time in two different CPUs). So we need to serialize |
@@ -878,7 +877,7 @@ int rtc_control(rtc_task_t *task, unsigned int cmd, unsigned long arg) | |||
878 | * The various file operations we support. | 877 | * The various file operations we support. |
879 | */ | 878 | */ |
880 | 879 | ||
881 | static struct file_operations rtc_fops = { | 880 | static const struct file_operations rtc_fops = { |
882 | .owner = THIS_MODULE, | 881 | .owner = THIS_MODULE, |
883 | .llseek = no_llseek, | 882 | .llseek = no_llseek, |
884 | .read = rtc_read, | 883 | .read = rtc_read, |
@@ -897,7 +896,7 @@ static struct miscdevice rtc_dev = { | |||
897 | .fops = &rtc_fops, | 896 | .fops = &rtc_fops, |
898 | }; | 897 | }; |
899 | 898 | ||
900 | static struct file_operations rtc_proc_fops = { | 899 | static const struct file_operations rtc_proc_fops = { |
901 | .owner = THIS_MODULE, | 900 | .owner = THIS_MODULE, |
902 | .open = rtc_proc_open, | 901 | .open = rtc_proc_open, |
903 | .read = seq_read, | 902 | .read = seq_read, |
@@ -928,7 +927,7 @@ static int __init rtc_init(void) | |||
928 | #ifdef __sparc__ | 927 | #ifdef __sparc__ |
929 | for_each_ebus(ebus) { | 928 | for_each_ebus(ebus) { |
930 | for_each_ebusdev(edev, ebus) { | 929 | for_each_ebusdev(edev, ebus) { |
931 | if(strcmp(edev->prom_name, "rtc") == 0) { | 930 | if(strcmp(edev->prom_node->name, "rtc") == 0) { |
932 | rtc_port = edev->resource[0].start; | 931 | rtc_port = edev->resource[0].start; |
933 | rtc_irq = edev->irqs[0]; | 932 | rtc_irq = edev->irqs[0]; |
934 | goto found; | 933 | goto found; |
@@ -938,7 +937,7 @@ static int __init rtc_init(void) | |||
938 | #ifdef __sparc_v9__ | 937 | #ifdef __sparc_v9__ |
939 | for_each_isa(isa_br) { | 938 | for_each_isa(isa_br) { |
940 | for_each_isadev(isa_dev, isa_br) { | 939 | for_each_isadev(isa_dev, isa_br) { |
941 | if (strcmp(isa_dev->prom_name, "rtc") == 0) { | 940 | if (strcmp(isa_dev->prom_node->name, "rtc") == 0) { |
942 | rtc_port = isa_dev->resource.start; | 941 | rtc_port = isa_dev->resource.start; |
943 | rtc_irq = isa_dev->irq; | 942 | rtc_irq = isa_dev->irq; |
944 | goto found; | 943 | goto found; |
@@ -959,11 +958,7 @@ found: | |||
959 | * XXX Interrupt pin #7 in Espresso is shared between RTC and | 958 | * XXX Interrupt pin #7 in Espresso is shared between RTC and |
960 | * PCI Slot 2 INTA# (and some INTx# in Slot 1). | 959 | * PCI Slot 2 INTA# (and some INTx# in Slot 1). |
961 | */ | 960 | */ |
962 | if (request_irq(rtc_irq, rtc_interrupt, SA_SHIRQ, "rtc", (void *)&rtc_port)) { | 961 | if (request_irq(rtc_irq, rtc_interrupt, IRQF_SHARED, "rtc", (void *)&rtc_port)) { |
963 | /* | ||
964 | * Standard way for sparc to print irq's is to use | ||
965 | * __irq_itoa(). I think for EBus it's ok to use %d. | ||
966 | */ | ||
967 | printk(KERN_ERR "rtc: cannot register IRQ %d\n", rtc_irq); | 962 | printk(KERN_ERR "rtc: cannot register IRQ %d\n", rtc_irq); |
968 | return -EIO; | 963 | return -EIO; |
969 | } | 964 | } |
@@ -981,7 +976,7 @@ no_irq: | |||
981 | rtc_int_handler_ptr = rtc_interrupt; | 976 | rtc_int_handler_ptr = rtc_interrupt; |
982 | } | 977 | } |
983 | 978 | ||
984 | if(request_irq(RTC_IRQ, rtc_int_handler_ptr, SA_INTERRUPT, "rtc", NULL)) { | 979 | if(request_irq(RTC_IRQ, rtc_int_handler_ptr, IRQF_DISABLED, "rtc", NULL)) { |
985 | /* Yeah right, seeing as irq 8 doesn't even hit the bus. */ | 980 | /* Yeah right, seeing as irq 8 doesn't even hit the bus. */ |
986 | printk(KERN_ERR "rtc: IRQ %d is not free.\n", RTC_IRQ); | 981 | printk(KERN_ERR "rtc: IRQ %d is not free.\n", RTC_IRQ); |
987 | release_region(RTC_PORT(0), RTC_IO_EXTENT); | 982 | release_region(RTC_PORT(0), RTC_IO_EXTENT); |
diff --git a/drivers/char/s3c2410-rtc.c b/drivers/char/s3c2410-rtc.c index b0038b19b505..5458ef1634e5 100644 --- a/drivers/char/s3c2410-rtc.c +++ b/drivers/char/s3c2410-rtc.c | |||
@@ -341,13 +341,13 @@ static int s3c2410_rtc_open(void) | |||
341 | int ret; | 341 | int ret; |
342 | 342 | ||
343 | ret = request_irq(s3c2410_rtc_alarmno, s3c2410_rtc_alarmirq, | 343 | ret = request_irq(s3c2410_rtc_alarmno, s3c2410_rtc_alarmirq, |
344 | SA_INTERRUPT, "s3c2410-rtc alarm", NULL); | 344 | IRQF_DISABLED, "s3c2410-rtc alarm", NULL); |
345 | 345 | ||
346 | if (ret) | 346 | if (ret) |
347 | printk(KERN_ERR "IRQ%d already in use\n", s3c2410_rtc_alarmno); | 347 | printk(KERN_ERR "IRQ%d already in use\n", s3c2410_rtc_alarmno); |
348 | 348 | ||
349 | ret = request_irq(s3c2410_rtc_tickno, s3c2410_rtc_tickirq, | 349 | ret = request_irq(s3c2410_rtc_tickno, s3c2410_rtc_tickirq, |
350 | SA_INTERRUPT, "s3c2410-rtc tick", NULL); | 350 | IRQF_DISABLED, "s3c2410-rtc tick", NULL); |
351 | 351 | ||
352 | if (ret) { | 352 | if (ret) { |
353 | printk(KERN_ERR "IRQ%d already in use\n", s3c2410_rtc_tickno); | 353 | printk(KERN_ERR "IRQ%d already in use\n", s3c2410_rtc_tickno); |
diff --git a/drivers/char/scx200_gpio.c b/drivers/char/scx200_gpio.c index 664a6e97eb1a..425c58719db6 100644 --- a/drivers/char/scx200_gpio.c +++ b/drivers/char/scx200_gpio.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* linux/drivers/char/scx200_gpio.c | 1 | /* linux/drivers/char/scx200_gpio.c |
2 | 2 | ||
3 | National Semiconductor SCx200 GPIO driver. Allows a user space | 3 | National Semiconductor SCx200 GPIO driver. Allows a user space |
4 | process to play with the GPIO pins. | 4 | process to play with the GPIO pins. |
@@ -6,17 +6,26 @@ | |||
6 | Copyright (c) 2001,2002 Christer Weinigel <wingel@nano-system.com> */ | 6 | Copyright (c) 2001,2002 Christer Weinigel <wingel@nano-system.com> */ |
7 | 7 | ||
8 | #include <linux/config.h> | 8 | #include <linux/config.h> |
9 | #include <linux/device.h> | ||
9 | #include <linux/fs.h> | 10 | #include <linux/fs.h> |
10 | #include <linux/module.h> | 11 | #include <linux/module.h> |
11 | #include <linux/errno.h> | 12 | #include <linux/errno.h> |
12 | #include <linux/kernel.h> | 13 | #include <linux/kernel.h> |
13 | #include <linux/init.h> | 14 | #include <linux/init.h> |
15 | #include <linux/platform_device.h> | ||
14 | #include <asm/uaccess.h> | 16 | #include <asm/uaccess.h> |
15 | #include <asm/io.h> | 17 | #include <asm/io.h> |
16 | 18 | ||
19 | #include <linux/types.h> | ||
20 | #include <linux/cdev.h> | ||
21 | |||
17 | #include <linux/scx200_gpio.h> | 22 | #include <linux/scx200_gpio.h> |
23 | #include <linux/nsc_gpio.h> | ||
18 | 24 | ||
19 | #define NAME "scx200_gpio" | 25 | #define NAME "scx200_gpio" |
26 | #define DEVNAME NAME | ||
27 | |||
28 | static struct platform_device *pdev; | ||
20 | 29 | ||
21 | MODULE_AUTHOR("Christer Weinigel <wingel@nano-system.com>"); | 30 | MODULE_AUTHOR("Christer Weinigel <wingel@nano-system.com>"); |
22 | MODULE_DESCRIPTION("NatSemi SCx200 GPIO Pin Driver"); | 31 | MODULE_DESCRIPTION("NatSemi SCx200 GPIO Pin Driver"); |
@@ -26,70 +35,23 @@ static int major = 0; /* default to dynamic major */ | |||
26 | module_param(major, int, 0); | 35 | module_param(major, int, 0); |
27 | MODULE_PARM_DESC(major, "Major device number"); | 36 | MODULE_PARM_DESC(major, "Major device number"); |
28 | 37 | ||
29 | static ssize_t scx200_gpio_write(struct file *file, const char __user *data, | 38 | struct nsc_gpio_ops scx200_access = { |
30 | size_t len, loff_t *ppos) | 39 | .owner = THIS_MODULE, |
31 | { | 40 | .gpio_config = scx200_gpio_configure, |
32 | unsigned m = iminor(file->f_dentry->d_inode); | 41 | .gpio_dump = nsc_gpio_dump, |
33 | size_t i; | 42 | .gpio_get = scx200_gpio_get, |
34 | 43 | .gpio_set = scx200_gpio_set, | |
35 | for (i = 0; i < len; ++i) { | 44 | .gpio_set_high = scx200_gpio_set_high, |
36 | char c; | 45 | .gpio_set_low = scx200_gpio_set_low, |
37 | if (get_user(c, data+i)) | 46 | .gpio_change = scx200_gpio_change, |
38 | return -EFAULT; | 47 | .gpio_current = scx200_gpio_current |
39 | switch (c) | 48 | }; |
40 | { | ||
41 | case '0': | ||
42 | scx200_gpio_set(m, 0); | ||
43 | break; | ||
44 | case '1': | ||
45 | scx200_gpio_set(m, 1); | ||
46 | break; | ||
47 | case 'O': | ||
48 | printk(KERN_INFO NAME ": GPIO%d output enabled\n", m); | ||
49 | scx200_gpio_configure(m, ~1, 1); | ||
50 | break; | ||
51 | case 'o': | ||
52 | printk(KERN_INFO NAME ": GPIO%d output disabled\n", m); | ||
53 | scx200_gpio_configure(m, ~1, 0); | ||
54 | break; | ||
55 | case 'T': | ||
56 | printk(KERN_INFO NAME ": GPIO%d output is push pull\n", m); | ||
57 | scx200_gpio_configure(m, ~2, 2); | ||
58 | break; | ||
59 | case 't': | ||
60 | printk(KERN_INFO NAME ": GPIO%d output is open drain\n", m); | ||
61 | scx200_gpio_configure(m, ~2, 0); | ||
62 | break; | ||
63 | case 'P': | ||
64 | printk(KERN_INFO NAME ": GPIO%d pull up enabled\n", m); | ||
65 | scx200_gpio_configure(m, ~4, 4); | ||
66 | break; | ||
67 | case 'p': | ||
68 | printk(KERN_INFO NAME ": GPIO%d pull up disabled\n", m); | ||
69 | scx200_gpio_configure(m, ~4, 0); | ||
70 | break; | ||
71 | } | ||
72 | } | ||
73 | |||
74 | return len; | ||
75 | } | ||
76 | |||
77 | static ssize_t scx200_gpio_read(struct file *file, char __user *buf, | ||
78 | size_t len, loff_t *ppos) | ||
79 | { | ||
80 | unsigned m = iminor(file->f_dentry->d_inode); | ||
81 | int value; | ||
82 | |||
83 | value = scx200_gpio_get(m); | ||
84 | if (put_user(value ? '1' : '0', buf)) | ||
85 | return -EFAULT; | ||
86 | |||
87 | return 1; | ||
88 | } | ||
89 | 49 | ||
90 | static int scx200_gpio_open(struct inode *inode, struct file *file) | 50 | static int scx200_gpio_open(struct inode *inode, struct file *file) |
91 | { | 51 | { |
92 | unsigned m = iminor(inode); | 52 | unsigned m = iminor(inode); |
53 | file->private_data = &scx200_access; | ||
54 | |||
93 | if (m > 63) | 55 | if (m > 63) |
94 | return -EINVAL; | 56 | return -EINVAL; |
95 | return nonseekable_open(inode, file); | 57 | return nonseekable_open(inode, file); |
@@ -101,49 +63,83 @@ static int scx200_gpio_release(struct inode *inode, struct file *file) | |||
101 | } | 63 | } |
102 | 64 | ||
103 | 65 | ||
104 | static struct file_operations scx200_gpio_fops = { | 66 | static const struct file_operations scx200_gpio_fops = { |
105 | .owner = THIS_MODULE, | 67 | .owner = THIS_MODULE, |
106 | .write = scx200_gpio_write, | 68 | .write = nsc_gpio_write, |
107 | .read = scx200_gpio_read, | 69 | .read = nsc_gpio_read, |
108 | .open = scx200_gpio_open, | 70 | .open = scx200_gpio_open, |
109 | .release = scx200_gpio_release, | 71 | .release = scx200_gpio_release, |
110 | }; | 72 | }; |
111 | 73 | ||
74 | struct cdev *scx200_devices; | ||
75 | static int num_pins = 32; | ||
76 | |||
112 | static int __init scx200_gpio_init(void) | 77 | static int __init scx200_gpio_init(void) |
113 | { | 78 | { |
114 | int r; | 79 | int rc, i; |
115 | 80 | dev_t dev = MKDEV(major, 0); | |
116 | printk(KERN_DEBUG NAME ": NatSemi SCx200 GPIO Driver\n"); | ||
117 | 81 | ||
118 | if (!scx200_gpio_present()) { | 82 | if (!scx200_gpio_present()) { |
119 | printk(KERN_ERR NAME ": no SCx200 gpio pins available\n"); | 83 | printk(KERN_ERR NAME ": no SCx200 gpio present\n"); |
120 | return -ENODEV; | 84 | return -ENODEV; |
121 | } | 85 | } |
122 | 86 | ||
123 | r = register_chrdev(major, NAME, &scx200_gpio_fops); | 87 | /* support dev_dbg() with pdev->dev */ |
124 | if (r < 0) { | 88 | pdev = platform_device_alloc(DEVNAME, 0); |
125 | printk(KERN_ERR NAME ": unable to register character device\n"); | 89 | if (!pdev) |
126 | return r; | 90 | return -ENOMEM; |
91 | |||
92 | rc = platform_device_add(pdev); | ||
93 | if (rc) | ||
94 | goto undo_malloc; | ||
95 | |||
96 | /* nsc_gpio uses dev_dbg(), so needs this */ | ||
97 | scx200_access.dev = &pdev->dev; | ||
98 | |||
99 | if (major) | ||
100 | rc = register_chrdev_region(dev, num_pins, "scx200_gpio"); | ||
101 | else { | ||
102 | rc = alloc_chrdev_region(&dev, 0, num_pins, "scx200_gpio"); | ||
103 | major = MAJOR(dev); | ||
104 | } | ||
105 | if (rc < 0) { | ||
106 | dev_err(&pdev->dev, "SCx200 chrdev_region err: %d\n", rc); | ||
107 | goto undo_platform_device_add; | ||
127 | } | 108 | } |
128 | if (!major) { | 109 | scx200_devices = kzalloc(num_pins * sizeof(struct cdev), GFP_KERNEL); |
129 | major = r; | 110 | if (!scx200_devices) { |
130 | printk(KERN_DEBUG NAME ": got dynamic major %d\n", major); | 111 | rc = -ENOMEM; |
112 | goto undo_chrdev_region; | ||
113 | } | ||
114 | for (i = 0; i < num_pins; i++) { | ||
115 | struct cdev *cdev = &scx200_devices[i]; | ||
116 | cdev_init(cdev, &scx200_gpio_fops); | ||
117 | cdev->owner = THIS_MODULE; | ||
118 | rc = cdev_add(cdev, MKDEV(major, i), 1); | ||
119 | /* tolerate 'minor' errors */ | ||
120 | if (rc) | ||
121 | dev_err(&pdev->dev, "Error %d on minor %d", rc, i); | ||
131 | } | 122 | } |
132 | 123 | ||
133 | return 0; | 124 | return 0; /* succeed */ |
125 | |||
126 | undo_chrdev_region: | ||
127 | unregister_chrdev_region(dev, num_pins); | ||
128 | undo_platform_device_add: | ||
129 | platform_device_del(pdev); | ||
130 | undo_malloc: | ||
131 | platform_device_put(pdev); | ||
132 | |||
133 | return rc; | ||
134 | } | 134 | } |
135 | 135 | ||
136 | static void __exit scx200_gpio_cleanup(void) | 136 | static void __exit scx200_gpio_cleanup(void) |
137 | { | 137 | { |
138 | unregister_chrdev(major, NAME); | 138 | kfree(scx200_devices); |
139 | unregister_chrdev_region(MKDEV(major, 0), num_pins); | ||
140 | platform_device_unregister(pdev); | ||
141 | /* kfree(pdev); */ | ||
139 | } | 142 | } |
140 | 143 | ||
141 | module_init(scx200_gpio_init); | 144 | module_init(scx200_gpio_init); |
142 | module_exit(scx200_gpio_cleanup); | 145 | module_exit(scx200_gpio_cleanup); |
143 | |||
144 | /* | ||
145 | Local variables: | ||
146 | compile-command: "make -k -C ../.. SUBDIRS=drivers/char modules" | ||
147 | c-basic-offset: 8 | ||
148 | End: | ||
149 | */ | ||
diff --git a/drivers/char/serial167.c b/drivers/char/serial167.c index 037c940ac71b..21a710cb4bba 100644 --- a/drivers/char/serial167.c +++ b/drivers/char/serial167.c | |||
@@ -44,7 +44,6 @@ | |||
44 | * - replace bottom half handler with task queue handler | 44 | * - replace bottom half handler with task queue handler |
45 | */ | 45 | */ |
46 | 46 | ||
47 | #include <linux/config.h> | ||
48 | #include <linux/errno.h> | 47 | #include <linux/errno.h> |
49 | #include <linux/signal.h> | 48 | #include <linux/signal.h> |
50 | #include <linux/sched.h> | 49 | #include <linux/sched.h> |
@@ -2235,7 +2234,6 @@ scrn[1] = '\0'; | |||
2235 | /* Initialize the tty_driver structure */ | 2234 | /* Initialize the tty_driver structure */ |
2236 | 2235 | ||
2237 | cy_serial_driver->owner = THIS_MODULE; | 2236 | cy_serial_driver->owner = THIS_MODULE; |
2238 | cy_serial_driver->devfs_name = "tts/"; | ||
2239 | cy_serial_driver->name = "ttyS"; | 2237 | cy_serial_driver->name = "ttyS"; |
2240 | cy_serial_driver->major = TTY_MAJOR; | 2238 | cy_serial_driver->major = TTY_MAJOR; |
2241 | cy_serial_driver->minor_start = 64; | 2239 | cy_serial_driver->minor_start = 64; |
diff --git a/drivers/char/snsc.c b/drivers/char/snsc.c index 56c8243cdb73..afc6eda602f7 100644 --- a/drivers/char/snsc.c +++ b/drivers/char/snsc.c | |||
@@ -105,7 +105,7 @@ scdrv_open(struct inode *inode, struct file *file) | |||
105 | 105 | ||
106 | /* hook this subchannel up to the system controller interrupt */ | 106 | /* hook this subchannel up to the system controller interrupt */ |
107 | rv = request_irq(SGI_UART_VECTOR, scdrv_interrupt, | 107 | rv = request_irq(SGI_UART_VECTOR, scdrv_interrupt, |
108 | SA_SHIRQ | SA_INTERRUPT, | 108 | IRQF_SHARED | IRQF_DISABLED, |
109 | SYSCTL_BASENAME, sd); | 109 | SYSCTL_BASENAME, sd); |
110 | if (rv) { | 110 | if (rv) { |
111 | ia64_sn_irtr_close(sd->sd_nasid, sd->sd_subch); | 111 | ia64_sn_irtr_close(sd->sd_nasid, sd->sd_subch); |
@@ -347,7 +347,7 @@ scdrv_poll(struct file *file, struct poll_table_struct *wait) | |||
347 | return mask; | 347 | return mask; |
348 | } | 348 | } |
349 | 349 | ||
350 | static struct file_operations scdrv_fops = { | 350 | static const struct file_operations scdrv_fops = { |
351 | .owner = THIS_MODULE, | 351 | .owner = THIS_MODULE, |
352 | .read = scdrv_read, | 352 | .read = scdrv_read, |
353 | .write = scdrv_write, | 353 | .write = scdrv_write, |
diff --git a/drivers/char/snsc_event.c b/drivers/char/snsc_event.c index e234d50e142a..8b2210b633df 100644 --- a/drivers/char/snsc_event.c +++ b/drivers/char/snsc_event.c | |||
@@ -310,7 +310,7 @@ scdrv_event_init(struct sysctl_data_s *scd) | |||
310 | 310 | ||
311 | /* hook event subchannel up to the system controller interrupt */ | 311 | /* hook event subchannel up to the system controller interrupt */ |
312 | rv = request_irq(SGI_UART_VECTOR, scdrv_event_interrupt, | 312 | rv = request_irq(SGI_UART_VECTOR, scdrv_event_interrupt, |
313 | SA_SHIRQ | SA_INTERRUPT, | 313 | IRQF_SHARED | IRQF_DISABLED, |
314 | "system controller events", event_sd); | 314 | "system controller events", event_sd); |
315 | if (rv) { | 315 | if (rv) { |
316 | printk(KERN_WARNING "%s: irq request failed (%d)\n", | 316 | printk(KERN_WARNING "%s: irq request failed (%d)\n", |
diff --git a/drivers/char/sonypi.c b/drivers/char/sonypi.c index a90f5d97df35..d4e434d694b7 100644 --- a/drivers/char/sonypi.c +++ b/drivers/char/sonypi.c | |||
@@ -33,7 +33,6 @@ | |||
33 | * | 33 | * |
34 | */ | 34 | */ |
35 | 35 | ||
36 | #include <linux/config.h> | ||
37 | #include <linux/module.h> | 36 | #include <linux/module.h> |
38 | #include <linux/input.h> | 37 | #include <linux/input.h> |
39 | #include <linux/pci.h> | 38 | #include <linux/pci.h> |
@@ -512,7 +511,7 @@ static struct sonypi_device { | |||
512 | 511 | ||
513 | #ifdef CONFIG_ACPI | 512 | #ifdef CONFIG_ACPI |
514 | static struct acpi_device *sonypi_acpi_device; | 513 | static struct acpi_device *sonypi_acpi_device; |
515 | static int acpi_enabled; | 514 | static int acpi_driver_registered; |
516 | #endif | 515 | #endif |
517 | 516 | ||
518 | static int sonypi_ec_write(u8 addr, u8 value) | 517 | static int sonypi_ec_write(u8 addr, u8 value) |
@@ -869,7 +868,7 @@ found: | |||
869 | sonypi_report_input_event(event); | 868 | sonypi_report_input_event(event); |
870 | 869 | ||
871 | #ifdef CONFIG_ACPI | 870 | #ifdef CONFIG_ACPI |
872 | if (acpi_enabled) | 871 | if (sonypi_acpi_device) |
873 | acpi_bus_generate_event(sonypi_acpi_device, 1, event); | 872 | acpi_bus_generate_event(sonypi_acpi_device, 1, event); |
874 | #endif | 873 | #endif |
875 | 874 | ||
@@ -1107,7 +1106,7 @@ static int sonypi_misc_ioctl(struct inode *ip, struct file *fp, | |||
1107 | return ret; | 1106 | return ret; |
1108 | } | 1107 | } |
1109 | 1108 | ||
1110 | static struct file_operations sonypi_misc_fops = { | 1109 | static const struct file_operations sonypi_misc_fops = { |
1111 | .owner = THIS_MODULE, | 1110 | .owner = THIS_MODULE, |
1112 | .read = sonypi_misc_read, | 1111 | .read = sonypi_misc_read, |
1113 | .poll = sonypi_misc_poll, | 1112 | .poll = sonypi_misc_poll, |
@@ -1283,7 +1282,7 @@ static int __devinit sonypi_setup_irq(struct sonypi_device *dev, | |||
1283 | while (irq_list->irq) { | 1282 | while (irq_list->irq) { |
1284 | 1283 | ||
1285 | if (!request_irq(irq_list->irq, sonypi_irq, | 1284 | if (!request_irq(irq_list->irq, sonypi_irq, |
1286 | SA_SHIRQ, "sonypi", sonypi_irq)) { | 1285 | IRQF_SHARED, "sonypi", sonypi_irq)) { |
1287 | dev->irq = irq_list->irq; | 1286 | dev->irq = irq_list->irq; |
1288 | dev->bits = irq_list->bits; | 1287 | dev->bits = irq_list->bits; |
1289 | return 0; | 1288 | return 0; |
@@ -1551,8 +1550,8 @@ static int __init sonypi_init(void) | |||
1551 | goto err_free_device; | 1550 | goto err_free_device; |
1552 | 1551 | ||
1553 | #ifdef CONFIG_ACPI | 1552 | #ifdef CONFIG_ACPI |
1554 | if (acpi_bus_register_driver(&sonypi_acpi_driver) > 0) | 1553 | if (acpi_bus_register_driver(&sonypi_acpi_driver) >= 0) |
1555 | acpi_enabled = 1; | 1554 | acpi_driver_registered = 1; |
1556 | #endif | 1555 | #endif |
1557 | 1556 | ||
1558 | return 0; | 1557 | return 0; |
@@ -1567,7 +1566,7 @@ static int __init sonypi_init(void) | |||
1567 | static void __exit sonypi_exit(void) | 1566 | static void __exit sonypi_exit(void) |
1568 | { | 1567 | { |
1569 | #ifdef CONFIG_ACPI | 1568 | #ifdef CONFIG_ACPI |
1570 | if (acpi_enabled) | 1569 | if (acpi_driver_registered) |
1571 | acpi_bus_unregister_driver(&sonypi_acpi_driver); | 1570 | acpi_bus_unregister_driver(&sonypi_acpi_driver); |
1572 | #endif | 1571 | #endif |
1573 | platform_device_unregister(sonypi_platform_device); | 1572 | platform_device_unregister(sonypi_platform_device); |
diff --git a/drivers/char/specialix.c b/drivers/char/specialix.c index 5343e9fc6ab7..cb2859249d49 100644 --- a/drivers/char/specialix.c +++ b/drivers/char/specialix.c | |||
@@ -75,7 +75,6 @@ | |||
75 | * Documentation/specialix.txt | 75 | * Documentation/specialix.txt |
76 | */ | 76 | */ |
77 | 77 | ||
78 | #include <linux/config.h> | ||
79 | #include <linux/module.h> | 78 | #include <linux/module.h> |
80 | 79 | ||
81 | #include <asm/io.h> | 80 | #include <asm/io.h> |
@@ -1016,9 +1015,9 @@ static inline int sx_setup_board(struct specialix_board * bp) | |||
1016 | return 0; | 1015 | return 0; |
1017 | 1016 | ||
1018 | if (bp->flags & SX_BOARD_IS_PCI) | 1017 | if (bp->flags & SX_BOARD_IS_PCI) |
1019 | error = request_irq(bp->irq, sx_interrupt, SA_INTERRUPT | SA_SHIRQ, "specialix IO8+", bp); | 1018 | error = request_irq(bp->irq, sx_interrupt, IRQF_DISABLED | IRQF_SHARED, "specialix IO8+", bp); |
1020 | else | 1019 | else |
1021 | error = request_irq(bp->irq, sx_interrupt, SA_INTERRUPT, "specialix IO8+", bp); | 1020 | error = request_irq(bp->irq, sx_interrupt, IRQF_DISABLED, "specialix IO8+", bp); |
1022 | 1021 | ||
1023 | if (error) | 1022 | if (error) |
1024 | return error; | 1023 | return error; |
@@ -1683,7 +1682,7 @@ static int sx_write(struct tty_struct * tty, | |||
1683 | 1682 | ||
1684 | bp = port_Board(port); | 1683 | bp = port_Board(port); |
1685 | 1684 | ||
1686 | if (!tty || !port->xmit_buf || !tmp_buf) { | 1685 | if (!port->xmit_buf || !tmp_buf) { |
1687 | func_exit(); | 1686 | func_exit(); |
1688 | return 0; | 1687 | return 0; |
1689 | } | 1688 | } |
@@ -1733,7 +1732,7 @@ static void sx_put_char(struct tty_struct * tty, unsigned char ch) | |||
1733 | return; | 1732 | return; |
1734 | } | 1733 | } |
1735 | dprintk (SX_DEBUG_TX, "check tty: %p %p\n", tty, port->xmit_buf); | 1734 | dprintk (SX_DEBUG_TX, "check tty: %p %p\n", tty, port->xmit_buf); |
1736 | if (!tty || !port->xmit_buf) { | 1735 | if (!port->xmit_buf) { |
1737 | func_exit(); | 1736 | func_exit(); |
1738 | return; | 1737 | return; |
1739 | } | 1738 | } |
@@ -2477,7 +2476,7 @@ static int __init specialix_init(void) | |||
2477 | #endif | 2476 | #endif |
2478 | 2477 | ||
2479 | for (i = 0; i < SX_NBOARD; i++) | 2478 | for (i = 0; i < SX_NBOARD; i++) |
2480 | sx_board[i].lock = SPIN_LOCK_UNLOCKED; | 2479 | spin_lock_init(&sx_board[i].lock); |
2481 | 2480 | ||
2482 | if (sx_init_drivers()) { | 2481 | if (sx_init_drivers()) { |
2483 | func_exit(); | 2482 | func_exit(); |
diff --git a/drivers/char/stallion.c b/drivers/char/stallion.c index a9c5a7230f89..3beb2203d24b 100644 --- a/drivers/char/stallion.c +++ b/drivers/char/stallion.c | |||
@@ -26,7 +26,6 @@ | |||
26 | 26 | ||
27 | /*****************************************************************************/ | 27 | /*****************************************************************************/ |
28 | 28 | ||
29 | #include <linux/config.h> | ||
30 | #include <linux/module.h> | 29 | #include <linux/module.h> |
31 | #include <linux/slab.h> | 30 | #include <linux/slab.h> |
32 | #include <linux/interrupt.h> | 31 | #include <linux/interrupt.h> |
@@ -40,7 +39,6 @@ | |||
40 | #include <linux/ioport.h> | 39 | #include <linux/ioport.h> |
41 | #include <linux/init.h> | 40 | #include <linux/init.h> |
42 | #include <linux/smp_lock.h> | 41 | #include <linux/smp_lock.h> |
43 | #include <linux/devfs_fs_kernel.h> | ||
44 | #include <linux/device.h> | 42 | #include <linux/device.h> |
45 | #include <linux/delay.h> | 43 | #include <linux/delay.h> |
46 | 44 | ||
@@ -141,15 +139,6 @@ static char *stl_drvversion = "5.6.0"; | |||
141 | static struct tty_driver *stl_serial; | 139 | static struct tty_driver *stl_serial; |
142 | 140 | ||
143 | /* | 141 | /* |
144 | * We will need to allocate a temporary write buffer for chars that | ||
145 | * come direct from user space. The problem is that a copy from user | ||
146 | * space might cause a page fault (typically on a system that is | ||
147 | * swapping!). All ports will share one buffer - since if the system | ||
148 | * is already swapping a shared buffer won't make things any worse. | ||
149 | */ | ||
150 | static char *stl_tmpwritebuf; | ||
151 | |||
152 | /* | ||
153 | * Define a local default termios struct. All ports will be created | 142 | * Define a local default termios struct. All ports will be created |
154 | * with this termios initially. Basically all it defines is a raw port | 143 | * with this termios initially. Basically all it defines is a raw port |
155 | * at 9600, 8 data bits, 1 stop bit. | 144 | * at 9600, 8 data bits, 1 stop bit. |
@@ -363,6 +352,14 @@ static unsigned char stl_vecmap[] = { | |||
363 | }; | 352 | }; |
364 | 353 | ||
365 | /* | 354 | /* |
355 | * Lock ordering is that you may not take stallion_lock holding | ||
356 | * brd_lock. | ||
357 | */ | ||
358 | |||
359 | static spinlock_t brd_lock; /* Guard the board mapping */ | ||
360 | static spinlock_t stallion_lock; /* Guard the tty driver */ | ||
361 | |||
362 | /* | ||
366 | * Set up enable and disable macros for the ECH boards. They require | 363 | * Set up enable and disable macros for the ECH boards. They require |
367 | * the secondary io address space to be activated and deactivated. | 364 | * the secondary io address space to be activated and deactivated. |
368 | * This way all ECH boards can share their secondary io region. | 365 | * This way all ECH boards can share their secondary io region. |
@@ -710,7 +707,7 @@ static unsigned int sc26198_baudtable[] = { | |||
710 | * Define the driver info for a user level control device. Used mainly | 707 | * Define the driver info for a user level control device. Used mainly |
711 | * to get at port stats - only not using the port device itself. | 708 | * to get at port stats - only not using the port device itself. |
712 | */ | 709 | */ |
713 | static struct file_operations stl_fsiomem = { | 710 | static const struct file_operations stl_fsiomem = { |
714 | .owner = THIS_MODULE, | 711 | .owner = THIS_MODULE, |
715 | .ioctl = stl_memioctl, | 712 | .ioctl = stl_memioctl, |
716 | }; | 713 | }; |
@@ -725,17 +722,7 @@ static struct class *stallion_class; | |||
725 | 722 | ||
726 | static int __init stallion_module_init(void) | 723 | static int __init stallion_module_init(void) |
727 | { | 724 | { |
728 | unsigned long flags; | ||
729 | |||
730 | #ifdef DEBUG | ||
731 | printk("init_module()\n"); | ||
732 | #endif | ||
733 | |||
734 | save_flags(flags); | ||
735 | cli(); | ||
736 | stl_init(); | 725 | stl_init(); |
737 | restore_flags(flags); | ||
738 | |||
739 | return 0; | 726 | return 0; |
740 | } | 727 | } |
741 | 728 | ||
@@ -746,7 +733,6 @@ static void __exit stallion_module_exit(void) | |||
746 | stlbrd_t *brdp; | 733 | stlbrd_t *brdp; |
747 | stlpanel_t *panelp; | 734 | stlpanel_t *panelp; |
748 | stlport_t *portp; | 735 | stlport_t *portp; |
749 | unsigned long flags; | ||
750 | int i, j, k; | 736 | int i, j, k; |
751 | 737 | ||
752 | #ifdef DEBUG | 738 | #ifdef DEBUG |
@@ -756,9 +742,6 @@ static void __exit stallion_module_exit(void) | |||
756 | printk(KERN_INFO "Unloading %s: version %s\n", stl_drvtitle, | 742 | printk(KERN_INFO "Unloading %s: version %s\n", stl_drvtitle, |
757 | stl_drvversion); | 743 | stl_drvversion); |
758 | 744 | ||
759 | save_flags(flags); | ||
760 | cli(); | ||
761 | |||
762 | /* | 745 | /* |
763 | * Free up all allocated resources used by the ports. This includes | 746 | * Free up all allocated resources used by the ports. This includes |
764 | * memory and interrupts. As part of this process we will also do | 747 | * memory and interrupts. As part of this process we will also do |
@@ -770,21 +753,15 @@ static void __exit stallion_module_exit(void) | |||
770 | if (i) { | 753 | if (i) { |
771 | printk("STALLION: failed to un-register tty driver, " | 754 | printk("STALLION: failed to un-register tty driver, " |
772 | "errno=%d\n", -i); | 755 | "errno=%d\n", -i); |
773 | restore_flags(flags); | ||
774 | return; | 756 | return; |
775 | } | 757 | } |
776 | for (i = 0; i < 4; i++) { | 758 | for (i = 0; i < 4; i++) |
777 | devfs_remove("staliomem/%d", i); | ||
778 | class_device_destroy(stallion_class, MKDEV(STL_SIOMEMMAJOR, i)); | 759 | class_device_destroy(stallion_class, MKDEV(STL_SIOMEMMAJOR, i)); |
779 | } | ||
780 | devfs_remove("staliomem"); | ||
781 | if ((i = unregister_chrdev(STL_SIOMEMMAJOR, "staliomem"))) | 760 | if ((i = unregister_chrdev(STL_SIOMEMMAJOR, "staliomem"))) |
782 | printk("STALLION: failed to un-register serial memory device, " | 761 | printk("STALLION: failed to un-register serial memory device, " |
783 | "errno=%d\n", -i); | 762 | "errno=%d\n", -i); |
784 | class_destroy(stallion_class); | 763 | class_destroy(stallion_class); |
785 | 764 | ||
786 | kfree(stl_tmpwritebuf); | ||
787 | |||
788 | for (i = 0; (i < stl_nrbrds); i++) { | 765 | for (i = 0; (i < stl_nrbrds); i++) { |
789 | if ((brdp = stl_brds[i]) == (stlbrd_t *) NULL) | 766 | if ((brdp = stl_brds[i]) == (stlbrd_t *) NULL) |
790 | continue; | 767 | continue; |
@@ -814,8 +791,6 @@ static void __exit stallion_module_exit(void) | |||
814 | kfree(brdp); | 791 | kfree(brdp); |
815 | stl_brds[i] = (stlbrd_t *) NULL; | 792 | stl_brds[i] = (stlbrd_t *) NULL; |
816 | } | 793 | } |
817 | |||
818 | restore_flags(flags); | ||
819 | } | 794 | } |
820 | 795 | ||
821 | module_init(stallion_module_init); | 796 | module_init(stallion_module_init); |
@@ -948,7 +923,7 @@ static stlbrd_t *stl_allocbrd(void) | |||
948 | 923 | ||
949 | brdp = kzalloc(sizeof(stlbrd_t), GFP_KERNEL); | 924 | brdp = kzalloc(sizeof(stlbrd_t), GFP_KERNEL); |
950 | if (!brdp) { | 925 | if (!brdp) { |
951 | printk("STALLION: failed to allocate memory (size=%d)\n", | 926 | printk("STALLION: failed to allocate memory (size=%Zd)\n", |
952 | sizeof(stlbrd_t)); | 927 | sizeof(stlbrd_t)); |
953 | return NULL; | 928 | return NULL; |
954 | } | 929 | } |
@@ -1066,16 +1041,17 @@ static int stl_waitcarrier(stlport_t *portp, struct file *filp) | |||
1066 | rc = 0; | 1041 | rc = 0; |
1067 | doclocal = 0; | 1042 | doclocal = 0; |
1068 | 1043 | ||
1044 | spin_lock_irqsave(&stallion_lock, flags); | ||
1045 | |||
1069 | if (portp->tty->termios->c_cflag & CLOCAL) | 1046 | if (portp->tty->termios->c_cflag & CLOCAL) |
1070 | doclocal++; | 1047 | doclocal++; |
1071 | 1048 | ||
1072 | save_flags(flags); | ||
1073 | cli(); | ||
1074 | portp->openwaitcnt++; | 1049 | portp->openwaitcnt++; |
1075 | if (! tty_hung_up_p(filp)) | 1050 | if (! tty_hung_up_p(filp)) |
1076 | portp->refcount--; | 1051 | portp->refcount--; |
1077 | 1052 | ||
1078 | for (;;) { | 1053 | for (;;) { |
1054 | /* Takes brd_lock internally */ | ||
1079 | stl_setsignals(portp, 1, 1); | 1055 | stl_setsignals(portp, 1, 1); |
1080 | if (tty_hung_up_p(filp) || | 1056 | if (tty_hung_up_p(filp) || |
1081 | ((portp->flags & ASYNC_INITIALIZED) == 0)) { | 1057 | ((portp->flags & ASYNC_INITIALIZED) == 0)) { |
@@ -1093,13 +1069,14 @@ static int stl_waitcarrier(stlport_t *portp, struct file *filp) | |||
1093 | rc = -ERESTARTSYS; | 1069 | rc = -ERESTARTSYS; |
1094 | break; | 1070 | break; |
1095 | } | 1071 | } |
1072 | /* FIXME */ | ||
1096 | interruptible_sleep_on(&portp->open_wait); | 1073 | interruptible_sleep_on(&portp->open_wait); |
1097 | } | 1074 | } |
1098 | 1075 | ||
1099 | if (! tty_hung_up_p(filp)) | 1076 | if (! tty_hung_up_p(filp)) |
1100 | portp->refcount++; | 1077 | portp->refcount++; |
1101 | portp->openwaitcnt--; | 1078 | portp->openwaitcnt--; |
1102 | restore_flags(flags); | 1079 | spin_unlock_irqrestore(&stallion_lock, flags); |
1103 | 1080 | ||
1104 | return rc; | 1081 | return rc; |
1105 | } | 1082 | } |
@@ -1119,16 +1096,15 @@ static void stl_close(struct tty_struct *tty, struct file *filp) | |||
1119 | if (portp == (stlport_t *) NULL) | 1096 | if (portp == (stlport_t *) NULL) |
1120 | return; | 1097 | return; |
1121 | 1098 | ||
1122 | save_flags(flags); | 1099 | spin_lock_irqsave(&stallion_lock, flags); |
1123 | cli(); | ||
1124 | if (tty_hung_up_p(filp)) { | 1100 | if (tty_hung_up_p(filp)) { |
1125 | restore_flags(flags); | 1101 | spin_unlock_irqrestore(&stallion_lock, flags); |
1126 | return; | 1102 | return; |
1127 | } | 1103 | } |
1128 | if ((tty->count == 1) && (portp->refcount != 1)) | 1104 | if ((tty->count == 1) && (portp->refcount != 1)) |
1129 | portp->refcount = 1; | 1105 | portp->refcount = 1; |
1130 | if (portp->refcount-- > 1) { | 1106 | if (portp->refcount-- > 1) { |
1131 | restore_flags(flags); | 1107 | spin_unlock_irqrestore(&stallion_lock, flags); |
1132 | return; | 1108 | return; |
1133 | } | 1109 | } |
1134 | 1110 | ||
@@ -1142,11 +1118,18 @@ static void stl_close(struct tty_struct *tty, struct file *filp) | |||
1142 | * (The sc26198 has no "end-of-data" interrupt only empty FIFO) | 1118 | * (The sc26198 has no "end-of-data" interrupt only empty FIFO) |
1143 | */ | 1119 | */ |
1144 | tty->closing = 1; | 1120 | tty->closing = 1; |
1121 | |||
1122 | spin_unlock_irqrestore(&stallion_lock, flags); | ||
1123 | |||
1145 | if (portp->closing_wait != ASYNC_CLOSING_WAIT_NONE) | 1124 | if (portp->closing_wait != ASYNC_CLOSING_WAIT_NONE) |
1146 | tty_wait_until_sent(tty, portp->closing_wait); | 1125 | tty_wait_until_sent(tty, portp->closing_wait); |
1147 | stl_waituntilsent(tty, (HZ / 2)); | 1126 | stl_waituntilsent(tty, (HZ / 2)); |
1148 | 1127 | ||
1128 | |||
1129 | spin_lock_irqsave(&stallion_lock, flags); | ||
1149 | portp->flags &= ~ASYNC_INITIALIZED; | 1130 | portp->flags &= ~ASYNC_INITIALIZED; |
1131 | spin_unlock_irqrestore(&stallion_lock, flags); | ||
1132 | |||
1150 | stl_disableintrs(portp); | 1133 | stl_disableintrs(portp); |
1151 | if (tty->termios->c_cflag & HUPCL) | 1134 | if (tty->termios->c_cflag & HUPCL) |
1152 | stl_setsignals(portp, 0, 0); | 1135 | stl_setsignals(portp, 0, 0); |
@@ -1173,7 +1156,6 @@ static void stl_close(struct tty_struct *tty, struct file *filp) | |||
1173 | 1156 | ||
1174 | portp->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING); | 1157 | portp->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING); |
1175 | wake_up_interruptible(&portp->close_wait); | 1158 | wake_up_interruptible(&portp->close_wait); |
1176 | restore_flags(flags); | ||
1177 | } | 1159 | } |
1178 | 1160 | ||
1179 | /*****************************************************************************/ | 1161 | /*****************************************************************************/ |
@@ -1195,9 +1177,6 @@ static int stl_write(struct tty_struct *tty, const unsigned char *buf, int count | |||
1195 | (int) tty, (int) buf, count); | 1177 | (int) tty, (int) buf, count); |
1196 | #endif | 1178 | #endif |
1197 | 1179 | ||
1198 | if ((tty == (struct tty_struct *) NULL) || | ||
1199 | (stl_tmpwritebuf == (char *) NULL)) | ||
1200 | return 0; | ||
1201 | portp = tty->driver_data; | 1180 | portp = tty->driver_data; |
1202 | if (portp == (stlport_t *) NULL) | 1181 | if (portp == (stlport_t *) NULL) |
1203 | return 0; | 1182 | return 0; |
@@ -1302,11 +1281,6 @@ static void stl_flushchars(struct tty_struct *tty) | |||
1302 | if (portp->tx.buf == (char *) NULL) | 1281 | if (portp->tx.buf == (char *) NULL) |
1303 | return; | 1282 | return; |
1304 | 1283 | ||
1305 | #if 0 | ||
1306 | if (tty->stopped || tty->hw_stopped || | ||
1307 | (portp->tx.head == portp->tx.tail)) | ||
1308 | return; | ||
1309 | #endif | ||
1310 | stl_startrxtx(portp, -1, 1); | 1284 | stl_startrxtx(portp, -1, 1); |
1311 | } | 1285 | } |
1312 | 1286 | ||
@@ -1977,12 +1951,14 @@ static int stl_eiointr(stlbrd_t *brdp) | |||
1977 | unsigned int iobase; | 1951 | unsigned int iobase; |
1978 | int handled = 0; | 1952 | int handled = 0; |
1979 | 1953 | ||
1954 | spin_lock(&brd_lock); | ||
1980 | panelp = brdp->panels[0]; | 1955 | panelp = brdp->panels[0]; |
1981 | iobase = panelp->iobase; | 1956 | iobase = panelp->iobase; |
1982 | while (inb(brdp->iostatus) & EIO_INTRPEND) { | 1957 | while (inb(brdp->iostatus) & EIO_INTRPEND) { |
1983 | handled = 1; | 1958 | handled = 1; |
1984 | (* panelp->isr)(panelp, iobase); | 1959 | (* panelp->isr)(panelp, iobase); |
1985 | } | 1960 | } |
1961 | spin_unlock(&brd_lock); | ||
1986 | return handled; | 1962 | return handled; |
1987 | } | 1963 | } |
1988 | 1964 | ||
@@ -2168,7 +2144,7 @@ static int __init stl_initports(stlbrd_t *brdp, stlpanel_t *panelp) | |||
2168 | portp = kzalloc(sizeof(stlport_t), GFP_KERNEL); | 2144 | portp = kzalloc(sizeof(stlport_t), GFP_KERNEL); |
2169 | if (!portp) { | 2145 | if (!portp) { |
2170 | printk("STALLION: failed to allocate memory " | 2146 | printk("STALLION: failed to allocate memory " |
2171 | "(size=%d)\n", sizeof(stlport_t)); | 2147 | "(size=%Zd)\n", sizeof(stlport_t)); |
2172 | break; | 2148 | break; |
2173 | } | 2149 | } |
2174 | 2150 | ||
@@ -2304,7 +2280,7 @@ static inline int stl_initeio(stlbrd_t *brdp) | |||
2304 | panelp = kzalloc(sizeof(stlpanel_t), GFP_KERNEL); | 2280 | panelp = kzalloc(sizeof(stlpanel_t), GFP_KERNEL); |
2305 | if (!panelp) { | 2281 | if (!panelp) { |
2306 | printk(KERN_WARNING "STALLION: failed to allocate memory " | 2282 | printk(KERN_WARNING "STALLION: failed to allocate memory " |
2307 | "(size=%d)\n", sizeof(stlpanel_t)); | 2283 | "(size=%Zd)\n", sizeof(stlpanel_t)); |
2308 | return -ENOMEM; | 2284 | return -ENOMEM; |
2309 | } | 2285 | } |
2310 | 2286 | ||
@@ -2326,7 +2302,7 @@ static inline int stl_initeio(stlbrd_t *brdp) | |||
2326 | brdp->nrpanels = 1; | 2302 | brdp->nrpanels = 1; |
2327 | brdp->state |= BRD_FOUND; | 2303 | brdp->state |= BRD_FOUND; |
2328 | brdp->hwid = status; | 2304 | brdp->hwid = status; |
2329 | if (request_irq(brdp->irq, stl_intr, SA_SHIRQ, name, brdp) != 0) { | 2305 | if (request_irq(brdp->irq, stl_intr, IRQF_SHARED, name, brdp) != 0) { |
2330 | printk("STALLION: failed to register interrupt " | 2306 | printk("STALLION: failed to register interrupt " |
2331 | "routine for %s irq=%d\n", name, brdp->irq); | 2307 | "routine for %s irq=%d\n", name, brdp->irq); |
2332 | rc = -ENODEV; | 2308 | rc = -ENODEV; |
@@ -2478,7 +2454,7 @@ static inline int stl_initech(stlbrd_t *brdp) | |||
2478 | panelp = kzalloc(sizeof(stlpanel_t), GFP_KERNEL); | 2454 | panelp = kzalloc(sizeof(stlpanel_t), GFP_KERNEL); |
2479 | if (!panelp) { | 2455 | if (!panelp) { |
2480 | printk("STALLION: failed to allocate memory " | 2456 | printk("STALLION: failed to allocate memory " |
2481 | "(size=%d)\n", sizeof(stlpanel_t)); | 2457 | "(size=%Zd)\n", sizeof(stlpanel_t)); |
2482 | break; | 2458 | break; |
2483 | } | 2459 | } |
2484 | panelp->magic = STL_PANELMAGIC; | 2460 | panelp->magic = STL_PANELMAGIC; |
@@ -2536,7 +2512,7 @@ static inline int stl_initech(stlbrd_t *brdp) | |||
2536 | outb((brdp->ioctrlval | ECH_BRDDISABLE), brdp->ioctrl); | 2512 | outb((brdp->ioctrlval | ECH_BRDDISABLE), brdp->ioctrl); |
2537 | 2513 | ||
2538 | brdp->state |= BRD_FOUND; | 2514 | brdp->state |= BRD_FOUND; |
2539 | if (request_irq(brdp->irq, stl_intr, SA_SHIRQ, name, brdp) != 0) { | 2515 | if (request_irq(brdp->irq, stl_intr, IRQF_SHARED, name, brdp) != 0) { |
2540 | printk("STALLION: failed to register interrupt " | 2516 | printk("STALLION: failed to register interrupt " |
2541 | "routine for %s irq=%d\n", name, brdp->irq); | 2517 | "routine for %s irq=%d\n", name, brdp->irq); |
2542 | i = -ENODEV; | 2518 | i = -ENODEV; |
@@ -2879,8 +2855,7 @@ static int stl_getportstats(stlport_t *portp, comstats_t __user *cp) | |||
2879 | portp->stats.lflags = 0; | 2855 | portp->stats.lflags = 0; |
2880 | portp->stats.rxbuffered = 0; | 2856 | portp->stats.rxbuffered = 0; |
2881 | 2857 | ||
2882 | save_flags(flags); | 2858 | spin_lock_irqsave(&stallion_lock, flags); |
2883 | cli(); | ||
2884 | if (portp->tty != (struct tty_struct *) NULL) { | 2859 | if (portp->tty != (struct tty_struct *) NULL) { |
2885 | if (portp->tty->driver_data == portp) { | 2860 | if (portp->tty->driver_data == portp) { |
2886 | portp->stats.ttystate = portp->tty->flags; | 2861 | portp->stats.ttystate = portp->tty->flags; |
@@ -2894,7 +2869,7 @@ static int stl_getportstats(stlport_t *portp, comstats_t __user *cp) | |||
2894 | } | 2869 | } |
2895 | } | 2870 | } |
2896 | } | 2871 | } |
2897 | restore_flags(flags); | 2872 | spin_unlock_irqrestore(&stallion_lock, flags); |
2898 | 2873 | ||
2899 | head = portp->tx.head; | 2874 | head = portp->tx.head; |
2900 | tail = portp->tx.tail; | 2875 | tail = portp->tx.tail; |
@@ -3049,6 +3024,9 @@ static int __init stl_init(void) | |||
3049 | int i; | 3024 | int i; |
3050 | printk(KERN_INFO "%s: version %s\n", stl_drvtitle, stl_drvversion); | 3025 | printk(KERN_INFO "%s: version %s\n", stl_drvtitle, stl_drvversion); |
3051 | 3026 | ||
3027 | spin_lock_init(&stallion_lock); | ||
3028 | spin_lock_init(&brd_lock); | ||
3029 | |||
3052 | stl_initbrds(); | 3030 | stl_initbrds(); |
3053 | 3031 | ||
3054 | stl_serial = alloc_tty_driver(STL_MAXBRDS * STL_MAXPORTS); | 3032 | stl_serial = alloc_tty_driver(STL_MAXBRDS * STL_MAXPORTS); |
@@ -3056,35 +3034,21 @@ static int __init stl_init(void) | |||
3056 | return -1; | 3034 | return -1; |
3057 | 3035 | ||
3058 | /* | 3036 | /* |
3059 | * Allocate a temporary write buffer. | ||
3060 | */ | ||
3061 | stl_tmpwritebuf = kmalloc(STL_TXBUFSIZE, GFP_KERNEL); | ||
3062 | if (!stl_tmpwritebuf) | ||
3063 | printk("STALLION: failed to allocate memory (size=%d)\n", | ||
3064 | STL_TXBUFSIZE); | ||
3065 | |||
3066 | /* | ||
3067 | * Set up a character driver for per board stuff. This is mainly used | 3037 | * Set up a character driver for per board stuff. This is mainly used |
3068 | * to do stats ioctls on the ports. | 3038 | * to do stats ioctls on the ports. |
3069 | */ | 3039 | */ |
3070 | if (register_chrdev(STL_SIOMEMMAJOR, "staliomem", &stl_fsiomem)) | 3040 | if (register_chrdev(STL_SIOMEMMAJOR, "staliomem", &stl_fsiomem)) |
3071 | printk("STALLION: failed to register serial board device\n"); | 3041 | printk("STALLION: failed to register serial board device\n"); |
3072 | devfs_mk_dir("staliomem"); | ||
3073 | 3042 | ||
3074 | stallion_class = class_create(THIS_MODULE, "staliomem"); | 3043 | stallion_class = class_create(THIS_MODULE, "staliomem"); |
3075 | for (i = 0; i < 4; i++) { | 3044 | for (i = 0; i < 4; i++) |
3076 | devfs_mk_cdev(MKDEV(STL_SIOMEMMAJOR, i), | ||
3077 | S_IFCHR|S_IRUSR|S_IWUSR, | ||
3078 | "staliomem/%d", i); | ||
3079 | class_device_create(stallion_class, NULL, | 3045 | class_device_create(stallion_class, NULL, |
3080 | MKDEV(STL_SIOMEMMAJOR, i), NULL, | 3046 | MKDEV(STL_SIOMEMMAJOR, i), NULL, |
3081 | "staliomem%d", i); | 3047 | "staliomem%d", i); |
3082 | } | ||
3083 | 3048 | ||
3084 | stl_serial->owner = THIS_MODULE; | 3049 | stl_serial->owner = THIS_MODULE; |
3085 | stl_serial->driver_name = stl_drvname; | 3050 | stl_serial->driver_name = stl_drvname; |
3086 | stl_serial->name = "ttyE"; | 3051 | stl_serial->name = "ttyE"; |
3087 | stl_serial->devfs_name = "tts/E"; | ||
3088 | stl_serial->major = STL_SERIALMAJOR; | 3052 | stl_serial->major = STL_SERIALMAJOR; |
3089 | stl_serial->minor_start = 0; | 3053 | stl_serial->minor_start = 0; |
3090 | stl_serial->type = TTY_DRIVER_TYPE_SERIAL; | 3054 | stl_serial->type = TTY_DRIVER_TYPE_SERIAL; |
@@ -3147,11 +3111,13 @@ static int stl_cd1400panelinit(stlbrd_t *brdp, stlpanel_t *panelp) | |||
3147 | unsigned int gfrcr; | 3111 | unsigned int gfrcr; |
3148 | int chipmask, i, j; | 3112 | int chipmask, i, j; |
3149 | int nrchips, uartaddr, ioaddr; | 3113 | int nrchips, uartaddr, ioaddr; |
3114 | unsigned long flags; | ||
3150 | 3115 | ||
3151 | #ifdef DEBUG | 3116 | #ifdef DEBUG |
3152 | printk("stl_panelinit(brdp=%x,panelp=%x)\n", (int) brdp, (int) panelp); | 3117 | printk("stl_panelinit(brdp=%x,panelp=%x)\n", (int) brdp, (int) panelp); |
3153 | #endif | 3118 | #endif |
3154 | 3119 | ||
3120 | spin_lock_irqsave(&brd_lock, flags); | ||
3155 | BRDENABLE(panelp->brdnr, panelp->pagenr); | 3121 | BRDENABLE(panelp->brdnr, panelp->pagenr); |
3156 | 3122 | ||
3157 | /* | 3123 | /* |
@@ -3189,6 +3155,7 @@ static int stl_cd1400panelinit(stlbrd_t *brdp, stlpanel_t *panelp) | |||
3189 | } | 3155 | } |
3190 | 3156 | ||
3191 | BRDDISABLE(panelp->brdnr); | 3157 | BRDDISABLE(panelp->brdnr); |
3158 | spin_unlock_irqrestore(&brd_lock, flags); | ||
3192 | return chipmask; | 3159 | return chipmask; |
3193 | } | 3160 | } |
3194 | 3161 | ||
@@ -3200,6 +3167,7 @@ static int stl_cd1400panelinit(stlbrd_t *brdp, stlpanel_t *panelp) | |||
3200 | 3167 | ||
3201 | static void stl_cd1400portinit(stlbrd_t *brdp, stlpanel_t *panelp, stlport_t *portp) | 3168 | static void stl_cd1400portinit(stlbrd_t *brdp, stlpanel_t *panelp, stlport_t *portp) |
3202 | { | 3169 | { |
3170 | unsigned long flags; | ||
3203 | #ifdef DEBUG | 3171 | #ifdef DEBUG |
3204 | printk("stl_cd1400portinit(brdp=%x,panelp=%x,portp=%x)\n", | 3172 | printk("stl_cd1400portinit(brdp=%x,panelp=%x,portp=%x)\n", |
3205 | (int) brdp, (int) panelp, (int) portp); | 3173 | (int) brdp, (int) panelp, (int) portp); |
@@ -3209,6 +3177,7 @@ static void stl_cd1400portinit(stlbrd_t *brdp, stlpanel_t *panelp, stlport_t *po | |||
3209 | (portp == (stlport_t *) NULL)) | 3177 | (portp == (stlport_t *) NULL)) |
3210 | return; | 3178 | return; |
3211 | 3179 | ||
3180 | spin_lock_irqsave(&brd_lock, flags); | ||
3212 | portp->ioaddr = panelp->iobase + (((brdp->brdtype == BRD_ECHPCI) || | 3181 | portp->ioaddr = panelp->iobase + (((brdp->brdtype == BRD_ECHPCI) || |
3213 | (portp->portnr < 8)) ? 0 : EREG_BANKSIZE); | 3182 | (portp->portnr < 8)) ? 0 : EREG_BANKSIZE); |
3214 | portp->uartaddr = (portp->portnr & 0x04) << 5; | 3183 | portp->uartaddr = (portp->portnr & 0x04) << 5; |
@@ -3219,6 +3188,7 @@ static void stl_cd1400portinit(stlbrd_t *brdp, stlpanel_t *panelp, stlport_t *po | |||
3219 | stl_cd1400setreg(portp, LIVR, (portp->portnr << 3)); | 3188 | stl_cd1400setreg(portp, LIVR, (portp->portnr << 3)); |
3220 | portp->hwid = stl_cd1400getreg(portp, GFRCR); | 3189 | portp->hwid = stl_cd1400getreg(portp, GFRCR); |
3221 | BRDDISABLE(portp->brdnr); | 3190 | BRDDISABLE(portp->brdnr); |
3191 | spin_unlock_irqrestore(&brd_lock, flags); | ||
3222 | } | 3192 | } |
3223 | 3193 | ||
3224 | /*****************************************************************************/ | 3194 | /*****************************************************************************/ |
@@ -3428,8 +3398,7 @@ static void stl_cd1400setport(stlport_t *portp, struct termios *tiosp) | |||
3428 | tiosp->c_cc[VSTART], tiosp->c_cc[VSTOP]); | 3398 | tiosp->c_cc[VSTART], tiosp->c_cc[VSTOP]); |
3429 | #endif | 3399 | #endif |
3430 | 3400 | ||
3431 | save_flags(flags); | 3401 | spin_lock_irqsave(&brd_lock, flags); |
3432 | cli(); | ||
3433 | BRDENABLE(portp->brdnr, portp->pagenr); | 3402 | BRDENABLE(portp->brdnr, portp->pagenr); |
3434 | stl_cd1400setreg(portp, CAR, (portp->portnr & 0x3)); | 3403 | stl_cd1400setreg(portp, CAR, (portp->portnr & 0x3)); |
3435 | srer = stl_cd1400getreg(portp, SRER); | 3404 | srer = stl_cd1400getreg(portp, SRER); |
@@ -3466,7 +3435,7 @@ static void stl_cd1400setport(stlport_t *portp, struct termios *tiosp) | |||
3466 | portp->sigs &= ~TIOCM_CD; | 3435 | portp->sigs &= ~TIOCM_CD; |
3467 | stl_cd1400setreg(portp, SRER, ((srer & ~sreroff) | sreron)); | 3436 | stl_cd1400setreg(portp, SRER, ((srer & ~sreroff) | sreron)); |
3468 | BRDDISABLE(portp->brdnr); | 3437 | BRDDISABLE(portp->brdnr); |
3469 | restore_flags(flags); | 3438 | spin_unlock_irqrestore(&brd_lock, flags); |
3470 | } | 3439 | } |
3471 | 3440 | ||
3472 | /*****************************************************************************/ | 3441 | /*****************************************************************************/ |
@@ -3492,8 +3461,7 @@ static void stl_cd1400setsignals(stlport_t *portp, int dtr, int rts) | |||
3492 | if (rts > 0) | 3461 | if (rts > 0) |
3493 | msvr2 = MSVR2_RTS; | 3462 | msvr2 = MSVR2_RTS; |
3494 | 3463 | ||
3495 | save_flags(flags); | 3464 | spin_lock_irqsave(&brd_lock, flags); |
3496 | cli(); | ||
3497 | BRDENABLE(portp->brdnr, portp->pagenr); | 3465 | BRDENABLE(portp->brdnr, portp->pagenr); |
3498 | stl_cd1400setreg(portp, CAR, (portp->portnr & 0x03)); | 3466 | stl_cd1400setreg(portp, CAR, (portp->portnr & 0x03)); |
3499 | if (rts >= 0) | 3467 | if (rts >= 0) |
@@ -3501,7 +3469,7 @@ static void stl_cd1400setsignals(stlport_t *portp, int dtr, int rts) | |||
3501 | if (dtr >= 0) | 3469 | if (dtr >= 0) |
3502 | stl_cd1400setreg(portp, MSVR1, msvr1); | 3470 | stl_cd1400setreg(portp, MSVR1, msvr1); |
3503 | BRDDISABLE(portp->brdnr); | 3471 | BRDDISABLE(portp->brdnr); |
3504 | restore_flags(flags); | 3472 | spin_unlock_irqrestore(&brd_lock, flags); |
3505 | } | 3473 | } |
3506 | 3474 | ||
3507 | /*****************************************************************************/ | 3475 | /*****************************************************************************/ |
@@ -3520,14 +3488,13 @@ static int stl_cd1400getsignals(stlport_t *portp) | |||
3520 | printk("stl_cd1400getsignals(portp=%x)\n", (int) portp); | 3488 | printk("stl_cd1400getsignals(portp=%x)\n", (int) portp); |
3521 | #endif | 3489 | #endif |
3522 | 3490 | ||
3523 | save_flags(flags); | 3491 | spin_lock_irqsave(&brd_lock, flags); |
3524 | cli(); | ||
3525 | BRDENABLE(portp->brdnr, portp->pagenr); | 3492 | BRDENABLE(portp->brdnr, portp->pagenr); |
3526 | stl_cd1400setreg(portp, CAR, (portp->portnr & 0x03)); | 3493 | stl_cd1400setreg(portp, CAR, (portp->portnr & 0x03)); |
3527 | msvr1 = stl_cd1400getreg(portp, MSVR1); | 3494 | msvr1 = stl_cd1400getreg(portp, MSVR1); |
3528 | msvr2 = stl_cd1400getreg(portp, MSVR2); | 3495 | msvr2 = stl_cd1400getreg(portp, MSVR2); |
3529 | BRDDISABLE(portp->brdnr); | 3496 | BRDDISABLE(portp->brdnr); |
3530 | restore_flags(flags); | 3497 | spin_unlock_irqrestore(&brd_lock, flags); |
3531 | 3498 | ||
3532 | sigs = 0; | 3499 | sigs = 0; |
3533 | sigs |= (msvr1 & MSVR1_DCD) ? TIOCM_CD : 0; | 3500 | sigs |= (msvr1 & MSVR1_DCD) ? TIOCM_CD : 0; |
@@ -3569,15 +3536,14 @@ static void stl_cd1400enablerxtx(stlport_t *portp, int rx, int tx) | |||
3569 | else if (rx > 0) | 3536 | else if (rx > 0) |
3570 | ccr |= CCR_RXENABLE; | 3537 | ccr |= CCR_RXENABLE; |
3571 | 3538 | ||
3572 | save_flags(flags); | 3539 | spin_lock_irqsave(&brd_lock, flags); |
3573 | cli(); | ||
3574 | BRDENABLE(portp->brdnr, portp->pagenr); | 3540 | BRDENABLE(portp->brdnr, portp->pagenr); |
3575 | stl_cd1400setreg(portp, CAR, (portp->portnr & 0x03)); | 3541 | stl_cd1400setreg(portp, CAR, (portp->portnr & 0x03)); |
3576 | stl_cd1400ccrwait(portp); | 3542 | stl_cd1400ccrwait(portp); |
3577 | stl_cd1400setreg(portp, CCR, ccr); | 3543 | stl_cd1400setreg(portp, CCR, ccr); |
3578 | stl_cd1400ccrwait(portp); | 3544 | stl_cd1400ccrwait(portp); |
3579 | BRDDISABLE(portp->brdnr); | 3545 | BRDDISABLE(portp->brdnr); |
3580 | restore_flags(flags); | 3546 | spin_unlock_irqrestore(&brd_lock, flags); |
3581 | } | 3547 | } |
3582 | 3548 | ||
3583 | /*****************************************************************************/ | 3549 | /*****************************************************************************/ |
@@ -3609,8 +3575,7 @@ static void stl_cd1400startrxtx(stlport_t *portp, int rx, int tx) | |||
3609 | else if (rx > 0) | 3575 | else if (rx > 0) |
3610 | sreron |= SRER_RXDATA; | 3576 | sreron |= SRER_RXDATA; |
3611 | 3577 | ||
3612 | save_flags(flags); | 3578 | spin_lock_irqsave(&brd_lock, flags); |
3613 | cli(); | ||
3614 | BRDENABLE(portp->brdnr, portp->pagenr); | 3579 | BRDENABLE(portp->brdnr, portp->pagenr); |
3615 | stl_cd1400setreg(portp, CAR, (portp->portnr & 0x03)); | 3580 | stl_cd1400setreg(portp, CAR, (portp->portnr & 0x03)); |
3616 | stl_cd1400setreg(portp, SRER, | 3581 | stl_cd1400setreg(portp, SRER, |
@@ -3618,7 +3583,7 @@ static void stl_cd1400startrxtx(stlport_t *portp, int rx, int tx) | |||
3618 | BRDDISABLE(portp->brdnr); | 3583 | BRDDISABLE(portp->brdnr); |
3619 | if (tx > 0) | 3584 | if (tx > 0) |
3620 | set_bit(ASYI_TXBUSY, &portp->istate); | 3585 | set_bit(ASYI_TXBUSY, &portp->istate); |
3621 | restore_flags(flags); | 3586 | spin_unlock_irqrestore(&brd_lock, flags); |
3622 | } | 3587 | } |
3623 | 3588 | ||
3624 | /*****************************************************************************/ | 3589 | /*****************************************************************************/ |
@@ -3634,13 +3599,12 @@ static void stl_cd1400disableintrs(stlport_t *portp) | |||
3634 | #ifdef DEBUG | 3599 | #ifdef DEBUG |
3635 | printk("stl_cd1400disableintrs(portp=%x)\n", (int) portp); | 3600 | printk("stl_cd1400disableintrs(portp=%x)\n", (int) portp); |
3636 | #endif | 3601 | #endif |
3637 | save_flags(flags); | 3602 | spin_lock_irqsave(&brd_lock, flags); |
3638 | cli(); | ||
3639 | BRDENABLE(portp->brdnr, portp->pagenr); | 3603 | BRDENABLE(portp->brdnr, portp->pagenr); |
3640 | stl_cd1400setreg(portp, CAR, (portp->portnr & 0x03)); | 3604 | stl_cd1400setreg(portp, CAR, (portp->portnr & 0x03)); |
3641 | stl_cd1400setreg(portp, SRER, 0); | 3605 | stl_cd1400setreg(portp, SRER, 0); |
3642 | BRDDISABLE(portp->brdnr); | 3606 | BRDDISABLE(portp->brdnr); |
3643 | restore_flags(flags); | 3607 | spin_unlock_irqrestore(&brd_lock, flags); |
3644 | } | 3608 | } |
3645 | 3609 | ||
3646 | /*****************************************************************************/ | 3610 | /*****************************************************************************/ |
@@ -3653,8 +3617,7 @@ static void stl_cd1400sendbreak(stlport_t *portp, int len) | |||
3653 | printk("stl_cd1400sendbreak(portp=%x,len=%d)\n", (int) portp, len); | 3617 | printk("stl_cd1400sendbreak(portp=%x,len=%d)\n", (int) portp, len); |
3654 | #endif | 3618 | #endif |
3655 | 3619 | ||
3656 | save_flags(flags); | 3620 | spin_lock_irqsave(&brd_lock, flags); |
3657 | cli(); | ||
3658 | BRDENABLE(portp->brdnr, portp->pagenr); | 3621 | BRDENABLE(portp->brdnr, portp->pagenr); |
3659 | stl_cd1400setreg(portp, CAR, (portp->portnr & 0x03)); | 3622 | stl_cd1400setreg(portp, CAR, (portp->portnr & 0x03)); |
3660 | stl_cd1400setreg(portp, SRER, | 3623 | stl_cd1400setreg(portp, SRER, |
@@ -3664,7 +3627,7 @@ static void stl_cd1400sendbreak(stlport_t *portp, int len) | |||
3664 | portp->brklen = len; | 3627 | portp->brklen = len; |
3665 | if (len == 1) | 3628 | if (len == 1) |
3666 | portp->stats.txbreaks++; | 3629 | portp->stats.txbreaks++; |
3667 | restore_flags(flags); | 3630 | spin_unlock_irqrestore(&brd_lock, flags); |
3668 | } | 3631 | } |
3669 | 3632 | ||
3670 | /*****************************************************************************/ | 3633 | /*****************************************************************************/ |
@@ -3688,8 +3651,7 @@ static void stl_cd1400flowctrl(stlport_t *portp, int state) | |||
3688 | if (tty == (struct tty_struct *) NULL) | 3651 | if (tty == (struct tty_struct *) NULL) |
3689 | return; | 3652 | return; |
3690 | 3653 | ||
3691 | save_flags(flags); | 3654 | spin_lock_irqsave(&brd_lock, flags); |
3692 | cli(); | ||
3693 | BRDENABLE(portp->brdnr, portp->pagenr); | 3655 | BRDENABLE(portp->brdnr, portp->pagenr); |
3694 | stl_cd1400setreg(portp, CAR, (portp->portnr & 0x03)); | 3656 | stl_cd1400setreg(portp, CAR, (portp->portnr & 0x03)); |
3695 | 3657 | ||
@@ -3729,7 +3691,7 @@ static void stl_cd1400flowctrl(stlport_t *portp, int state) | |||
3729 | } | 3691 | } |
3730 | 3692 | ||
3731 | BRDDISABLE(portp->brdnr); | 3693 | BRDDISABLE(portp->brdnr); |
3732 | restore_flags(flags); | 3694 | spin_unlock_irqrestore(&brd_lock, flags); |
3733 | } | 3695 | } |
3734 | 3696 | ||
3735 | /*****************************************************************************/ | 3697 | /*****************************************************************************/ |
@@ -3753,8 +3715,7 @@ static void stl_cd1400sendflow(stlport_t *portp, int state) | |||
3753 | if (tty == (struct tty_struct *) NULL) | 3715 | if (tty == (struct tty_struct *) NULL) |
3754 | return; | 3716 | return; |
3755 | 3717 | ||
3756 | save_flags(flags); | 3718 | spin_lock_irqsave(&brd_lock, flags); |
3757 | cli(); | ||
3758 | BRDENABLE(portp->brdnr, portp->pagenr); | 3719 | BRDENABLE(portp->brdnr, portp->pagenr); |
3759 | stl_cd1400setreg(portp, CAR, (portp->portnr & 0x03)); | 3720 | stl_cd1400setreg(portp, CAR, (portp->portnr & 0x03)); |
3760 | if (state) { | 3721 | if (state) { |
@@ -3769,7 +3730,7 @@ static void stl_cd1400sendflow(stlport_t *portp, int state) | |||
3769 | stl_cd1400ccrwait(portp); | 3730 | stl_cd1400ccrwait(portp); |
3770 | } | 3731 | } |
3771 | BRDDISABLE(portp->brdnr); | 3732 | BRDDISABLE(portp->brdnr); |
3772 | restore_flags(flags); | 3733 | spin_unlock_irqrestore(&brd_lock, flags); |
3773 | } | 3734 | } |
3774 | 3735 | ||
3775 | /*****************************************************************************/ | 3736 | /*****************************************************************************/ |
@@ -3785,8 +3746,7 @@ static void stl_cd1400flush(stlport_t *portp) | |||
3785 | if (portp == (stlport_t *) NULL) | 3746 | if (portp == (stlport_t *) NULL) |
3786 | return; | 3747 | return; |
3787 | 3748 | ||
3788 | save_flags(flags); | 3749 | spin_lock_irqsave(&brd_lock, flags); |
3789 | cli(); | ||
3790 | BRDENABLE(portp->brdnr, portp->pagenr); | 3750 | BRDENABLE(portp->brdnr, portp->pagenr); |
3791 | stl_cd1400setreg(portp, CAR, (portp->portnr & 0x03)); | 3751 | stl_cd1400setreg(portp, CAR, (portp->portnr & 0x03)); |
3792 | stl_cd1400ccrwait(portp); | 3752 | stl_cd1400ccrwait(portp); |
@@ -3794,7 +3754,7 @@ static void stl_cd1400flush(stlport_t *portp) | |||
3794 | stl_cd1400ccrwait(portp); | 3754 | stl_cd1400ccrwait(portp); |
3795 | portp->tx.tail = portp->tx.head; | 3755 | portp->tx.tail = portp->tx.head; |
3796 | BRDDISABLE(portp->brdnr); | 3756 | BRDDISABLE(portp->brdnr); |
3797 | restore_flags(flags); | 3757 | spin_unlock_irqrestore(&brd_lock, flags); |
3798 | } | 3758 | } |
3799 | 3759 | ||
3800 | /*****************************************************************************/ | 3760 | /*****************************************************************************/ |
@@ -3833,6 +3793,7 @@ static void stl_cd1400eiointr(stlpanel_t *panelp, unsigned int iobase) | |||
3833 | (int) panelp, iobase); | 3793 | (int) panelp, iobase); |
3834 | #endif | 3794 | #endif |
3835 | 3795 | ||
3796 | spin_lock(&brd_lock); | ||
3836 | outb(SVRR, iobase); | 3797 | outb(SVRR, iobase); |
3837 | svrtype = inb(iobase + EREG_DATA); | 3798 | svrtype = inb(iobase + EREG_DATA); |
3838 | if (panelp->nrports > 4) { | 3799 | if (panelp->nrports > 4) { |
@@ -3846,6 +3807,8 @@ static void stl_cd1400eiointr(stlpanel_t *panelp, unsigned int iobase) | |||
3846 | stl_cd1400txisr(panelp, iobase); | 3807 | stl_cd1400txisr(panelp, iobase); |
3847 | else if (svrtype & SVRR_MDM) | 3808 | else if (svrtype & SVRR_MDM) |
3848 | stl_cd1400mdmisr(panelp, iobase); | 3809 | stl_cd1400mdmisr(panelp, iobase); |
3810 | |||
3811 | spin_unlock(&brd_lock); | ||
3849 | } | 3812 | } |
3850 | 3813 | ||
3851 | /*****************************************************************************/ | 3814 | /*****************************************************************************/ |
@@ -4433,8 +4396,7 @@ static void stl_sc26198setport(stlport_t *portp, struct termios *tiosp) | |||
4433 | tiosp->c_cc[VSTART], tiosp->c_cc[VSTOP]); | 4396 | tiosp->c_cc[VSTART], tiosp->c_cc[VSTOP]); |
4434 | #endif | 4397 | #endif |
4435 | 4398 | ||
4436 | save_flags(flags); | 4399 | spin_lock_irqsave(&brd_lock, flags); |
4437 | cli(); | ||
4438 | BRDENABLE(portp->brdnr, portp->pagenr); | 4400 | BRDENABLE(portp->brdnr, portp->pagenr); |
4439 | stl_sc26198setreg(portp, IMR, 0); | 4401 | stl_sc26198setreg(portp, IMR, 0); |
4440 | stl_sc26198updatereg(portp, MR0, mr0); | 4402 | stl_sc26198updatereg(portp, MR0, mr0); |
@@ -4461,7 +4423,7 @@ static void stl_sc26198setport(stlport_t *portp, struct termios *tiosp) | |||
4461 | portp->imr = (portp->imr & ~imroff) | imron; | 4423 | portp->imr = (portp->imr & ~imroff) | imron; |
4462 | stl_sc26198setreg(portp, IMR, portp->imr); | 4424 | stl_sc26198setreg(portp, IMR, portp->imr); |
4463 | BRDDISABLE(portp->brdnr); | 4425 | BRDDISABLE(portp->brdnr); |
4464 | restore_flags(flags); | 4426 | spin_unlock_irqrestore(&brd_lock, flags); |
4465 | } | 4427 | } |
4466 | 4428 | ||
4467 | /*****************************************************************************/ | 4429 | /*****************************************************************************/ |
@@ -4491,13 +4453,12 @@ static void stl_sc26198setsignals(stlport_t *portp, int dtr, int rts) | |||
4491 | else if (rts > 0) | 4453 | else if (rts > 0) |
4492 | iopioron |= IPR_RTS; | 4454 | iopioron |= IPR_RTS; |
4493 | 4455 | ||
4494 | save_flags(flags); | 4456 | spin_lock_irqsave(&brd_lock, flags); |
4495 | cli(); | ||
4496 | BRDENABLE(portp->brdnr, portp->pagenr); | 4457 | BRDENABLE(portp->brdnr, portp->pagenr); |
4497 | stl_sc26198setreg(portp, IOPIOR, | 4458 | stl_sc26198setreg(portp, IOPIOR, |
4498 | ((stl_sc26198getreg(portp, IOPIOR) & ~iopioroff) | iopioron)); | 4459 | ((stl_sc26198getreg(portp, IOPIOR) & ~iopioroff) | iopioron)); |
4499 | BRDDISABLE(portp->brdnr); | 4460 | BRDDISABLE(portp->brdnr); |
4500 | restore_flags(flags); | 4461 | spin_unlock_irqrestore(&brd_lock, flags); |
4501 | } | 4462 | } |
4502 | 4463 | ||
4503 | /*****************************************************************************/ | 4464 | /*****************************************************************************/ |
@@ -4516,12 +4477,11 @@ static int stl_sc26198getsignals(stlport_t *portp) | |||
4516 | printk("stl_sc26198getsignals(portp=%x)\n", (int) portp); | 4477 | printk("stl_sc26198getsignals(portp=%x)\n", (int) portp); |
4517 | #endif | 4478 | #endif |
4518 | 4479 | ||
4519 | save_flags(flags); | 4480 | spin_lock_irqsave(&brd_lock, flags); |
4520 | cli(); | ||
4521 | BRDENABLE(portp->brdnr, portp->pagenr); | 4481 | BRDENABLE(portp->brdnr, portp->pagenr); |
4522 | ipr = stl_sc26198getreg(portp, IPR); | 4482 | ipr = stl_sc26198getreg(portp, IPR); |
4523 | BRDDISABLE(portp->brdnr); | 4483 | BRDDISABLE(portp->brdnr); |
4524 | restore_flags(flags); | 4484 | spin_unlock_irqrestore(&brd_lock, flags); |
4525 | 4485 | ||
4526 | sigs = 0; | 4486 | sigs = 0; |
4527 | sigs |= (ipr & IPR_DCD) ? 0 : TIOCM_CD; | 4487 | sigs |= (ipr & IPR_DCD) ? 0 : TIOCM_CD; |
@@ -4558,13 +4518,12 @@ static void stl_sc26198enablerxtx(stlport_t *portp, int rx, int tx) | |||
4558 | else if (rx > 0) | 4518 | else if (rx > 0) |
4559 | ccr |= CR_RXENABLE; | 4519 | ccr |= CR_RXENABLE; |
4560 | 4520 | ||
4561 | save_flags(flags); | 4521 | spin_lock_irqsave(&brd_lock, flags); |
4562 | cli(); | ||
4563 | BRDENABLE(portp->brdnr, portp->pagenr); | 4522 | BRDENABLE(portp->brdnr, portp->pagenr); |
4564 | stl_sc26198setreg(portp, SCCR, ccr); | 4523 | stl_sc26198setreg(portp, SCCR, ccr); |
4565 | BRDDISABLE(portp->brdnr); | 4524 | BRDDISABLE(portp->brdnr); |
4566 | portp->crenable = ccr; | 4525 | portp->crenable = ccr; |
4567 | restore_flags(flags); | 4526 | spin_unlock_irqrestore(&brd_lock, flags); |
4568 | } | 4527 | } |
4569 | 4528 | ||
4570 | /*****************************************************************************/ | 4529 | /*****************************************************************************/ |
@@ -4593,15 +4552,14 @@ static void stl_sc26198startrxtx(stlport_t *portp, int rx, int tx) | |||
4593 | else if (rx > 0) | 4552 | else if (rx > 0) |
4594 | imr |= IR_RXRDY | IR_RXBREAK | IR_RXWATCHDOG; | 4553 | imr |= IR_RXRDY | IR_RXBREAK | IR_RXWATCHDOG; |
4595 | 4554 | ||
4596 | save_flags(flags); | 4555 | spin_lock_irqsave(&brd_lock, flags); |
4597 | cli(); | ||
4598 | BRDENABLE(portp->brdnr, portp->pagenr); | 4556 | BRDENABLE(portp->brdnr, portp->pagenr); |
4599 | stl_sc26198setreg(portp, IMR, imr); | 4557 | stl_sc26198setreg(portp, IMR, imr); |
4600 | BRDDISABLE(portp->brdnr); | 4558 | BRDDISABLE(portp->brdnr); |
4601 | portp->imr = imr; | 4559 | portp->imr = imr; |
4602 | if (tx > 0) | 4560 | if (tx > 0) |
4603 | set_bit(ASYI_TXBUSY, &portp->istate); | 4561 | set_bit(ASYI_TXBUSY, &portp->istate); |
4604 | restore_flags(flags); | 4562 | spin_unlock_irqrestore(&brd_lock, flags); |
4605 | } | 4563 | } |
4606 | 4564 | ||
4607 | /*****************************************************************************/ | 4565 | /*****************************************************************************/ |
@@ -4618,13 +4576,12 @@ static void stl_sc26198disableintrs(stlport_t *portp) | |||
4618 | printk("stl_sc26198disableintrs(portp=%x)\n", (int) portp); | 4576 | printk("stl_sc26198disableintrs(portp=%x)\n", (int) portp); |
4619 | #endif | 4577 | #endif |
4620 | 4578 | ||
4621 | save_flags(flags); | 4579 | spin_lock_irqsave(&brd_lock, flags); |
4622 | cli(); | ||
4623 | BRDENABLE(portp->brdnr, portp->pagenr); | 4580 | BRDENABLE(portp->brdnr, portp->pagenr); |
4624 | portp->imr = 0; | 4581 | portp->imr = 0; |
4625 | stl_sc26198setreg(portp, IMR, 0); | 4582 | stl_sc26198setreg(portp, IMR, 0); |
4626 | BRDDISABLE(portp->brdnr); | 4583 | BRDDISABLE(portp->brdnr); |
4627 | restore_flags(flags); | 4584 | spin_unlock_irqrestore(&brd_lock, flags); |
4628 | } | 4585 | } |
4629 | 4586 | ||
4630 | /*****************************************************************************/ | 4587 | /*****************************************************************************/ |
@@ -4637,8 +4594,7 @@ static void stl_sc26198sendbreak(stlport_t *portp, int len) | |||
4637 | printk("stl_sc26198sendbreak(portp=%x,len=%d)\n", (int) portp, len); | 4594 | printk("stl_sc26198sendbreak(portp=%x,len=%d)\n", (int) portp, len); |
4638 | #endif | 4595 | #endif |
4639 | 4596 | ||
4640 | save_flags(flags); | 4597 | spin_lock_irqsave(&brd_lock, flags); |
4641 | cli(); | ||
4642 | BRDENABLE(portp->brdnr, portp->pagenr); | 4598 | BRDENABLE(portp->brdnr, portp->pagenr); |
4643 | if (len == 1) { | 4599 | if (len == 1) { |
4644 | stl_sc26198setreg(portp, SCCR, CR_TXSTARTBREAK); | 4600 | stl_sc26198setreg(portp, SCCR, CR_TXSTARTBREAK); |
@@ -4647,7 +4603,7 @@ static void stl_sc26198sendbreak(stlport_t *portp, int len) | |||
4647 | stl_sc26198setreg(portp, SCCR, CR_TXSTOPBREAK); | 4603 | stl_sc26198setreg(portp, SCCR, CR_TXSTOPBREAK); |
4648 | } | 4604 | } |
4649 | BRDDISABLE(portp->brdnr); | 4605 | BRDDISABLE(portp->brdnr); |
4650 | restore_flags(flags); | 4606 | spin_unlock_irqrestore(&brd_lock, flags); |
4651 | } | 4607 | } |
4652 | 4608 | ||
4653 | /*****************************************************************************/ | 4609 | /*****************************************************************************/ |
@@ -4672,8 +4628,7 @@ static void stl_sc26198flowctrl(stlport_t *portp, int state) | |||
4672 | if (tty == (struct tty_struct *) NULL) | 4628 | if (tty == (struct tty_struct *) NULL) |
4673 | return; | 4629 | return; |
4674 | 4630 | ||
4675 | save_flags(flags); | 4631 | spin_lock_irqsave(&brd_lock, flags); |
4676 | cli(); | ||
4677 | BRDENABLE(portp->brdnr, portp->pagenr); | 4632 | BRDENABLE(portp->brdnr, portp->pagenr); |
4678 | 4633 | ||
4679 | if (state) { | 4634 | if (state) { |
@@ -4719,7 +4674,7 @@ static void stl_sc26198flowctrl(stlport_t *portp, int state) | |||
4719 | } | 4674 | } |
4720 | 4675 | ||
4721 | BRDDISABLE(portp->brdnr); | 4676 | BRDDISABLE(portp->brdnr); |
4722 | restore_flags(flags); | 4677 | spin_unlock_irqrestore(&brd_lock, flags); |
4723 | } | 4678 | } |
4724 | 4679 | ||
4725 | /*****************************************************************************/ | 4680 | /*****************************************************************************/ |
@@ -4744,8 +4699,7 @@ static void stl_sc26198sendflow(stlport_t *portp, int state) | |||
4744 | if (tty == (struct tty_struct *) NULL) | 4699 | if (tty == (struct tty_struct *) NULL) |
4745 | return; | 4700 | return; |
4746 | 4701 | ||
4747 | save_flags(flags); | 4702 | spin_lock_irqsave(&brd_lock, flags); |
4748 | cli(); | ||
4749 | BRDENABLE(portp->brdnr, portp->pagenr); | 4703 | BRDENABLE(portp->brdnr, portp->pagenr); |
4750 | if (state) { | 4704 | if (state) { |
4751 | mr0 = stl_sc26198getreg(portp, MR0); | 4705 | mr0 = stl_sc26198getreg(portp, MR0); |
@@ -4765,7 +4719,7 @@ static void stl_sc26198sendflow(stlport_t *portp, int state) | |||
4765 | stl_sc26198setreg(portp, MR0, mr0); | 4719 | stl_sc26198setreg(portp, MR0, mr0); |
4766 | } | 4720 | } |
4767 | BRDDISABLE(portp->brdnr); | 4721 | BRDDISABLE(portp->brdnr); |
4768 | restore_flags(flags); | 4722 | spin_unlock_irqrestore(&brd_lock, flags); |
4769 | } | 4723 | } |
4770 | 4724 | ||
4771 | /*****************************************************************************/ | 4725 | /*****************************************************************************/ |
@@ -4781,14 +4735,13 @@ static void stl_sc26198flush(stlport_t *portp) | |||
4781 | if (portp == (stlport_t *) NULL) | 4735 | if (portp == (stlport_t *) NULL) |
4782 | return; | 4736 | return; |
4783 | 4737 | ||
4784 | save_flags(flags); | 4738 | spin_lock_irqsave(&brd_lock, flags); |
4785 | cli(); | ||
4786 | BRDENABLE(portp->brdnr, portp->pagenr); | 4739 | BRDENABLE(portp->brdnr, portp->pagenr); |
4787 | stl_sc26198setreg(portp, SCCR, CR_TXRESET); | 4740 | stl_sc26198setreg(portp, SCCR, CR_TXRESET); |
4788 | stl_sc26198setreg(portp, SCCR, portp->crenable); | 4741 | stl_sc26198setreg(portp, SCCR, portp->crenable); |
4789 | BRDDISABLE(portp->brdnr); | 4742 | BRDDISABLE(portp->brdnr); |
4790 | portp->tx.tail = portp->tx.head; | 4743 | portp->tx.tail = portp->tx.head; |
4791 | restore_flags(flags); | 4744 | spin_unlock_irqrestore(&brd_lock, flags); |
4792 | } | 4745 | } |
4793 | 4746 | ||
4794 | /*****************************************************************************/ | 4747 | /*****************************************************************************/ |
@@ -4815,12 +4768,11 @@ static int stl_sc26198datastate(stlport_t *portp) | |||
4815 | if (test_bit(ASYI_TXBUSY, &portp->istate)) | 4768 | if (test_bit(ASYI_TXBUSY, &portp->istate)) |
4816 | return 1; | 4769 | return 1; |
4817 | 4770 | ||
4818 | save_flags(flags); | 4771 | spin_lock_irqsave(&brd_lock, flags); |
4819 | cli(); | ||
4820 | BRDENABLE(portp->brdnr, portp->pagenr); | 4772 | BRDENABLE(portp->brdnr, portp->pagenr); |
4821 | sr = stl_sc26198getreg(portp, SR); | 4773 | sr = stl_sc26198getreg(portp, SR); |
4822 | BRDDISABLE(portp->brdnr); | 4774 | BRDDISABLE(portp->brdnr); |
4823 | restore_flags(flags); | 4775 | spin_unlock_irqrestore(&brd_lock, flags); |
4824 | 4776 | ||
4825 | return (sr & SR_TXEMPTY) ? 0 : 1; | 4777 | return (sr & SR_TXEMPTY) ? 0 : 1; |
4826 | } | 4778 | } |
@@ -4878,6 +4830,8 @@ static void stl_sc26198intr(stlpanel_t *panelp, unsigned int iobase) | |||
4878 | stlport_t *portp; | 4830 | stlport_t *portp; |
4879 | unsigned int iack; | 4831 | unsigned int iack; |
4880 | 4832 | ||
4833 | spin_lock(&brd_lock); | ||
4834 | |||
4881 | /* | 4835 | /* |
4882 | * Work around bug in sc26198 chip... Cannot have A6 address | 4836 | * Work around bug in sc26198 chip... Cannot have A6 address |
4883 | * line of UART high, else iack will be returned as 0. | 4837 | * line of UART high, else iack will be returned as 0. |
@@ -4893,6 +4847,8 @@ static void stl_sc26198intr(stlpanel_t *panelp, unsigned int iobase) | |||
4893 | stl_sc26198txisr(portp); | 4847 | stl_sc26198txisr(portp); |
4894 | else | 4848 | else |
4895 | stl_sc26198otherisr(portp, iack); | 4849 | stl_sc26198otherisr(portp, iack); |
4850 | |||
4851 | spin_unlock(&brd_lock); | ||
4896 | } | 4852 | } |
4897 | 4853 | ||
4898 | /*****************************************************************************/ | 4854 | /*****************************************************************************/ |
diff --git a/drivers/char/sx.c b/drivers/char/sx.c index 3b4747230270..e1cd2bc4b1e4 100644 --- a/drivers/char/sx.c +++ b/drivers/char/sx.c | |||
@@ -410,7 +410,7 @@ static struct real_driver sx_real_driver = { | |||
410 | * | 410 | * |
411 | */ | 411 | */ |
412 | 412 | ||
413 | static struct file_operations sx_fw_fops = { | 413 | static const struct file_operations sx_fw_fops = { |
414 | .owner = THIS_MODULE, | 414 | .owner = THIS_MODULE, |
415 | .ioctl = sx_fw_ioctl, | 415 | .ioctl = sx_fw_ioctl, |
416 | }; | 416 | }; |
@@ -1993,7 +1993,7 @@ static int sx_init_board (struct sx_board *board) | |||
1993 | if(board->irq > 0) { | 1993 | if(board->irq > 0) { |
1994 | /* fixed irq, probably PCI */ | 1994 | /* fixed irq, probably PCI */ |
1995 | if(sx_irqmask & (1 << board->irq)) { /* may we use this irq? */ | 1995 | if(sx_irqmask & (1 << board->irq)) { /* may we use this irq? */ |
1996 | if(request_irq(board->irq, sx_interrupt, SA_SHIRQ | SA_INTERRUPT, "sx", board)) { | 1996 | if(request_irq(board->irq, sx_interrupt, IRQF_SHARED | IRQF_DISABLED, "sx", board)) { |
1997 | printk(KERN_ERR "sx: Cannot allocate irq %d.\n", board->irq); | 1997 | printk(KERN_ERR "sx: Cannot allocate irq %d.\n", board->irq); |
1998 | board->irq = 0; | 1998 | board->irq = 0; |
1999 | } | 1999 | } |
@@ -2005,7 +2005,7 @@ static int sx_init_board (struct sx_board *board) | |||
2005 | int irqmask = sx_irqmask & (IS_SX_BOARD(board) ? SX_ISA_IRQ_MASK : SI2_ISA_IRQ_MASK); | 2005 | int irqmask = sx_irqmask & (IS_SX_BOARD(board) ? SX_ISA_IRQ_MASK : SI2_ISA_IRQ_MASK); |
2006 | for(irqnr = 15; irqnr > 0; irqnr--) | 2006 | for(irqnr = 15; irqnr > 0; irqnr--) |
2007 | if(irqmask & (1 << irqnr)) | 2007 | if(irqmask & (1 << irqnr)) |
2008 | if(! request_irq(irqnr, sx_interrupt, SA_SHIRQ | SA_INTERRUPT, "sx", board)) | 2008 | if(! request_irq(irqnr, sx_interrupt, IRQF_SHARED | IRQF_DISABLED, "sx", board)) |
2009 | break; | 2009 | break; |
2010 | if(! irqnr) | 2010 | if(! irqnr) |
2011 | printk(KERN_ERR "sx: Cannot allocate IRQ.\n"); | 2011 | printk(KERN_ERR "sx: Cannot allocate IRQ.\n"); |
@@ -2320,7 +2320,7 @@ static int sx_init_portstructs (int nboards, int nports) | |||
2320 | #ifdef NEW_WRITE_LOCKING | 2320 | #ifdef NEW_WRITE_LOCKING |
2321 | port->gs.port_write_mutex = MUTEX; | 2321 | port->gs.port_write_mutex = MUTEX; |
2322 | #endif | 2322 | #endif |
2323 | port->gs.driver_lock = SPIN_LOCK_UNLOCKED; | 2323 | spin_lock_init(&port->gs.driver_lock); |
2324 | /* | 2324 | /* |
2325 | * Initializing wait queue | 2325 | * Initializing wait queue |
2326 | */ | 2326 | */ |
diff --git a/drivers/char/synclink.c b/drivers/char/synclink.c index fee2aca3f6a5..df782dd1098c 100644 --- a/drivers/char/synclink.c +++ b/drivers/char/synclink.c | |||
@@ -8150,7 +8150,7 @@ static int __devinit synclink_init_one (struct pci_dev *dev, | |||
8150 | 8150 | ||
8151 | info->bus_type = MGSL_BUS_TYPE_PCI; | 8151 | info->bus_type = MGSL_BUS_TYPE_PCI; |
8152 | info->io_addr_size = 8; | 8152 | info->io_addr_size = 8; |
8153 | info->irq_flags = SA_SHIRQ; | 8153 | info->irq_flags = IRQF_SHARED; |
8154 | 8154 | ||
8155 | if (dev->device == 0x0210) { | 8155 | if (dev->device == 0x0210) { |
8156 | /* Version 1 PCI9030 based universal PCI adapter */ | 8156 | /* Version 1 PCI9030 based universal PCI adapter */ |
diff --git a/drivers/char/synclink_gt.c b/drivers/char/synclink_gt.c index b4d1f4eea435..e829594195c1 100644 --- a/drivers/char/synclink_gt.c +++ b/drivers/char/synclink_gt.c | |||
@@ -46,7 +46,6 @@ | |||
46 | //#define DBGRBUF(info) dump_rbufs(info) | 46 | //#define DBGRBUF(info) dump_rbufs(info) |
47 | 47 | ||
48 | 48 | ||
49 | #include <linux/config.h> | ||
50 | #include <linux/module.h> | 49 | #include <linux/module.h> |
51 | #include <linux/version.h> | 50 | #include <linux/version.h> |
52 | #include <linux/errno.h> | 51 | #include <linux/errno.h> |
@@ -101,6 +100,7 @@ MODULE_LICENSE("GPL"); | |||
101 | 100 | ||
102 | static struct pci_device_id pci_table[] = { | 101 | static struct pci_device_id pci_table[] = { |
103 | {PCI_VENDOR_ID_MICROGATE, SYNCLINK_GT_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,}, | 102 | {PCI_VENDOR_ID_MICROGATE, SYNCLINK_GT_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,}, |
103 | {PCI_VENDOR_ID_MICROGATE, SYNCLINK_GT2_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,}, | ||
104 | {PCI_VENDOR_ID_MICROGATE, SYNCLINK_GT4_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,}, | 104 | {PCI_VENDOR_ID_MICROGATE, SYNCLINK_GT4_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,}, |
105 | {PCI_VENDOR_ID_MICROGATE, SYNCLINK_AC_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,}, | 105 | {PCI_VENDOR_ID_MICROGATE, SYNCLINK_AC_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,}, |
106 | {0,}, /* terminate list */ | 106 | {0,}, /* terminate list */ |
@@ -870,7 +870,7 @@ static int write(struct tty_struct *tty, | |||
870 | goto cleanup; | 870 | goto cleanup; |
871 | DBGINFO(("%s write count=%d\n", info->device_name, count)); | 871 | DBGINFO(("%s write count=%d\n", info->device_name, count)); |
872 | 872 | ||
873 | if (!tty || !info->tx_buf) | 873 | if (!info->tx_buf) |
874 | goto cleanup; | 874 | goto cleanup; |
875 | 875 | ||
876 | if (count > info->max_frame_size) { | 876 | if (count > info->max_frame_size) { |
@@ -924,7 +924,7 @@ static void put_char(struct tty_struct *tty, unsigned char ch) | |||
924 | if (sanity_check(info, tty->name, "put_char")) | 924 | if (sanity_check(info, tty->name, "put_char")) |
925 | return; | 925 | return; |
926 | DBGINFO(("%s put_char(%d)\n", info->device_name, ch)); | 926 | DBGINFO(("%s put_char(%d)\n", info->device_name, ch)); |
927 | if (!tty || !info->tx_buf) | 927 | if (!info->tx_buf) |
928 | return; | 928 | return; |
929 | spin_lock_irqsave(&info->lock,flags); | 929 | spin_lock_irqsave(&info->lock,flags); |
930 | if (!info->tx_active && (info->tx_count < info->max_frame_size)) | 930 | if (!info->tx_active && (info->tx_count < info->max_frame_size)) |
@@ -2515,7 +2515,8 @@ static int set_txidle(struct slgt_info *info, int idle_mode) | |||
2515 | DBGINFO(("%s set_txidle(%d)\n", info->device_name, idle_mode)); | 2515 | DBGINFO(("%s set_txidle(%d)\n", info->device_name, idle_mode)); |
2516 | spin_lock_irqsave(&info->lock,flags); | 2516 | spin_lock_irqsave(&info->lock,flags); |
2517 | info->idle_mode = idle_mode; | 2517 | info->idle_mode = idle_mode; |
2518 | tx_set_idle(info); | 2518 | if (info->params.mode != MGSL_MODE_ASYNC) |
2519 | tx_set_idle(info); | ||
2519 | spin_unlock_irqrestore(&info->lock,flags); | 2520 | spin_unlock_irqrestore(&info->lock,flags); |
2520 | return 0; | 2521 | return 0; |
2521 | } | 2522 | } |
@@ -3076,7 +3077,7 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp, | |||
3076 | 3077 | ||
3077 | static int alloc_tmp_rbuf(struct slgt_info *info) | 3078 | static int alloc_tmp_rbuf(struct slgt_info *info) |
3078 | { | 3079 | { |
3079 | info->tmp_rbuf = kmalloc(info->max_frame_size, GFP_KERNEL); | 3080 | info->tmp_rbuf = kmalloc(info->max_frame_size + 5, GFP_KERNEL); |
3080 | if (info->tmp_rbuf == NULL) | 3081 | if (info->tmp_rbuf == NULL) |
3081 | return -ENOMEM; | 3082 | return -ENOMEM; |
3082 | return 0; | 3083 | return 0; |
@@ -3276,6 +3277,9 @@ static void add_device(struct slgt_info *info) | |||
3276 | case SYNCLINK_GT_DEVICE_ID: | 3277 | case SYNCLINK_GT_DEVICE_ID: |
3277 | devstr = "GT"; | 3278 | devstr = "GT"; |
3278 | break; | 3279 | break; |
3280 | case SYNCLINK_GT2_DEVICE_ID: | ||
3281 | devstr = "GT2"; | ||
3282 | break; | ||
3279 | case SYNCLINK_GT4_DEVICE_ID: | 3283 | case SYNCLINK_GT4_DEVICE_ID: |
3280 | devstr = "GT4"; | 3284 | devstr = "GT4"; |
3281 | break; | 3285 | break; |
@@ -3339,7 +3343,7 @@ static struct slgt_info *alloc_dev(int adapter_num, int port_num, struct pci_dev | |||
3339 | info->phys_reg_addr = pci_resource_start(pdev,0); | 3343 | info->phys_reg_addr = pci_resource_start(pdev,0); |
3340 | 3344 | ||
3341 | info->bus_type = MGSL_BUS_TYPE_PCI; | 3345 | info->bus_type = MGSL_BUS_TYPE_PCI; |
3342 | info->irq_flags = SA_SHIRQ; | 3346 | info->irq_flags = IRQF_SHARED; |
3343 | 3347 | ||
3344 | info->init_error = -1; /* assume error, set to 0 on successful init */ | 3348 | info->init_error = -1; /* assume error, set to 0 on successful init */ |
3345 | } | 3349 | } |
@@ -3353,7 +3357,9 @@ static void device_init(int adapter_num, struct pci_dev *pdev) | |||
3353 | int i; | 3357 | int i; |
3354 | int port_count = 1; | 3358 | int port_count = 1; |
3355 | 3359 | ||
3356 | if (pdev->device == SYNCLINK_GT4_DEVICE_ID) | 3360 | if (pdev->device == SYNCLINK_GT2_DEVICE_ID) |
3361 | port_count = 2; | ||
3362 | else if (pdev->device == SYNCLINK_GT4_DEVICE_ID) | ||
3357 | port_count = 4; | 3363 | port_count = 4; |
3358 | 3364 | ||
3359 | /* allocate device instances for all ports */ | 3365 | /* allocate device instances for all ports */ |
@@ -3940,8 +3946,6 @@ static void async_mode(struct slgt_info *info) | |||
3940 | 3946 | ||
3941 | msc_set_vcr(info); | 3947 | msc_set_vcr(info); |
3942 | 3948 | ||
3943 | tx_set_idle(info); | ||
3944 | |||
3945 | /* SCR (serial control) | 3949 | /* SCR (serial control) |
3946 | * | 3950 | * |
3947 | * 15 1=tx req on FIFO half empty | 3951 | * 15 1=tx req on FIFO half empty |
@@ -4012,7 +4016,7 @@ static void hdlc_mode(struct slgt_info *info) | |||
4012 | case HDLC_ENCODING_DIFF_BIPHASE_LEVEL: val |= BIT12 + BIT11 + BIT10; break; | 4016 | case HDLC_ENCODING_DIFF_BIPHASE_LEVEL: val |= BIT12 + BIT11 + BIT10; break; |
4013 | } | 4017 | } |
4014 | 4018 | ||
4015 | switch (info->params.crc_type) | 4019 | switch (info->params.crc_type & HDLC_CRC_MASK) |
4016 | { | 4020 | { |
4017 | case HDLC_CRC_16_CCITT: val |= BIT9; break; | 4021 | case HDLC_CRC_16_CCITT: val |= BIT9; break; |
4018 | case HDLC_CRC_32_CCITT: val |= BIT9 + BIT8; break; | 4022 | case HDLC_CRC_32_CCITT: val |= BIT9 + BIT8; break; |
@@ -4073,7 +4077,7 @@ static void hdlc_mode(struct slgt_info *info) | |||
4073 | case HDLC_ENCODING_DIFF_BIPHASE_LEVEL: val |= BIT12 + BIT11 + BIT10; break; | 4077 | case HDLC_ENCODING_DIFF_BIPHASE_LEVEL: val |= BIT12 + BIT11 + BIT10; break; |
4074 | } | 4078 | } |
4075 | 4079 | ||
4076 | switch (info->params.crc_type) | 4080 | switch (info->params.crc_type & HDLC_CRC_MASK) |
4077 | { | 4081 | { |
4078 | case HDLC_CRC_16_CCITT: val |= BIT9; break; | 4082 | case HDLC_CRC_16_CCITT: val |= BIT9; break; |
4079 | case HDLC_CRC_32_CCITT: val |= BIT9 + BIT8; break; | 4083 | case HDLC_CRC_32_CCITT: val |= BIT9 + BIT8; break; |
@@ -4175,17 +4179,38 @@ static void hdlc_mode(struct slgt_info *info) | |||
4175 | */ | 4179 | */ |
4176 | static void tx_set_idle(struct slgt_info *info) | 4180 | static void tx_set_idle(struct slgt_info *info) |
4177 | { | 4181 | { |
4178 | unsigned char val = 0xff; | 4182 | unsigned char val; |
4183 | unsigned short tcr; | ||
4179 | 4184 | ||
4180 | switch(info->idle_mode) | 4185 | /* if preamble enabled (tcr[6] == 1) then tx idle size = 8 bits |
4181 | { | 4186 | * else tcr[5:4] = tx idle size: 00 = 8 bits, 01 = 16 bits |
4182 | case HDLC_TXIDLE_FLAGS: val = 0x7e; break; | 4187 | */ |
4183 | case HDLC_TXIDLE_ALT_ZEROS_ONES: val = 0xaa; break; | 4188 | tcr = rd_reg16(info, TCR); |
4184 | case HDLC_TXIDLE_ZEROS: val = 0x00; break; | 4189 | if (info->idle_mode & HDLC_TXIDLE_CUSTOM_16) { |
4185 | case HDLC_TXIDLE_ONES: val = 0xff; break; | 4190 | /* disable preamble, set idle size to 16 bits */ |
4186 | case HDLC_TXIDLE_ALT_MARK_SPACE: val = 0xaa; break; | 4191 | tcr = (tcr & ~(BIT6 + BIT5)) | BIT4; |
4187 | case HDLC_TXIDLE_SPACE: val = 0x00; break; | 4192 | /* MSB of 16 bit idle specified in tx preamble register (TPR) */ |
4188 | case HDLC_TXIDLE_MARK: val = 0xff; break; | 4193 | wr_reg8(info, TPR, (unsigned char)((info->idle_mode >> 8) & 0xff)); |
4194 | } else if (!(tcr & BIT6)) { | ||
4195 | /* preamble is disabled, set idle size to 8 bits */ | ||
4196 | tcr &= ~(BIT5 + BIT4); | ||
4197 | } | ||
4198 | wr_reg16(info, TCR, tcr); | ||
4199 | |||
4200 | if (info->idle_mode & (HDLC_TXIDLE_CUSTOM_8 | HDLC_TXIDLE_CUSTOM_16)) { | ||
4201 | /* LSB of custom tx idle specified in tx idle register */ | ||
4202 | val = (unsigned char)(info->idle_mode & 0xff); | ||
4203 | } else { | ||
4204 | /* standard 8 bit idle patterns */ | ||
4205 | switch(info->idle_mode) | ||
4206 | { | ||
4207 | case HDLC_TXIDLE_FLAGS: val = 0x7e; break; | ||
4208 | case HDLC_TXIDLE_ALT_ZEROS_ONES: | ||
4209 | case HDLC_TXIDLE_ALT_MARK_SPACE: val = 0xaa; break; | ||
4210 | case HDLC_TXIDLE_ZEROS: | ||
4211 | case HDLC_TXIDLE_SPACE: val = 0x00; break; | ||
4212 | default: val = 0xff; | ||
4213 | } | ||
4189 | } | 4214 | } |
4190 | 4215 | ||
4191 | wr_reg8(info, TIR, val); | 4216 | wr_reg8(info, TIR, val); |
@@ -4313,6 +4338,12 @@ static int rx_get_frame(struct slgt_info *info) | |||
4313 | unsigned long flags; | 4338 | unsigned long flags; |
4314 | struct tty_struct *tty = info->tty; | 4339 | struct tty_struct *tty = info->tty; |
4315 | unsigned char addr_field = 0xff; | 4340 | unsigned char addr_field = 0xff; |
4341 | unsigned int crc_size = 0; | ||
4342 | |||
4343 | switch (info->params.crc_type & HDLC_CRC_MASK) { | ||
4344 | case HDLC_CRC_16_CCITT: crc_size = 2; break; | ||
4345 | case HDLC_CRC_32_CCITT: crc_size = 4; break; | ||
4346 | } | ||
4316 | 4347 | ||
4317 | check_again: | 4348 | check_again: |
4318 | 4349 | ||
@@ -4357,7 +4388,7 @@ check_again: | |||
4357 | status = desc_status(info->rbufs[end]); | 4388 | status = desc_status(info->rbufs[end]); |
4358 | 4389 | ||
4359 | /* ignore CRC bit if not using CRC (bit is undefined) */ | 4390 | /* ignore CRC bit if not using CRC (bit is undefined) */ |
4360 | if (info->params.crc_type == HDLC_CRC_NONE) | 4391 | if ((info->params.crc_type & HDLC_CRC_MASK) == HDLC_CRC_NONE) |
4361 | status &= ~BIT1; | 4392 | status &= ~BIT1; |
4362 | 4393 | ||
4363 | if (framesize == 0 || | 4394 | if (framesize == 0 || |
@@ -4366,34 +4397,34 @@ check_again: | |||
4366 | goto check_again; | 4397 | goto check_again; |
4367 | } | 4398 | } |
4368 | 4399 | ||
4369 | if (framesize < 2 || status & (BIT1+BIT0)) { | 4400 | if (framesize < (2 + crc_size) || status & BIT0) { |
4370 | if (framesize < 2 || (status & BIT0)) | 4401 | info->icount.rxshort++; |
4371 | info->icount.rxshort++; | ||
4372 | else | ||
4373 | info->icount.rxcrc++; | ||
4374 | framesize = 0; | 4402 | framesize = 0; |
4403 | } else if (status & BIT1) { | ||
4404 | info->icount.rxcrc++; | ||
4405 | if (!(info->params.crc_type & HDLC_CRC_RETURN_EX)) | ||
4406 | framesize = 0; | ||
4407 | } | ||
4375 | 4408 | ||
4376 | #ifdef CONFIG_HDLC | 4409 | #ifdef CONFIG_HDLC |
4377 | { | 4410 | if (framesize == 0) { |
4378 | struct net_device_stats *stats = hdlc_stats(info->netdev); | 4411 | struct net_device_stats *stats = hdlc_stats(info->netdev); |
4379 | stats->rx_errors++; | 4412 | stats->rx_errors++; |
4380 | stats->rx_frame_errors++; | 4413 | stats->rx_frame_errors++; |
4381 | } | ||
4382 | #endif | ||
4383 | } else { | ||
4384 | /* adjust frame size for CRC, if any */ | ||
4385 | if (info->params.crc_type == HDLC_CRC_16_CCITT) | ||
4386 | framesize -= 2; | ||
4387 | else if (info->params.crc_type == HDLC_CRC_32_CCITT) | ||
4388 | framesize -= 4; | ||
4389 | } | 4414 | } |
4415 | #endif | ||
4390 | 4416 | ||
4391 | DBGBH(("%s rx frame status=%04X size=%d\n", | 4417 | DBGBH(("%s rx frame status=%04X size=%d\n", |
4392 | info->device_name, status, framesize)); | 4418 | info->device_name, status, framesize)); |
4393 | DBGDATA(info, info->rbufs[start].buf, min_t(int, framesize, DMABUFSIZE), "rx"); | 4419 | DBGDATA(info, info->rbufs[start].buf, min_t(int, framesize, DMABUFSIZE), "rx"); |
4394 | 4420 | ||
4395 | if (framesize) { | 4421 | if (framesize) { |
4396 | if (framesize > info->max_frame_size) | 4422 | if (!(info->params.crc_type & HDLC_CRC_RETURN_EX)) { |
4423 | framesize -= crc_size; | ||
4424 | crc_size = 0; | ||
4425 | } | ||
4426 | |||
4427 | if (framesize > info->max_frame_size + crc_size) | ||
4397 | info->icount.rxlong++; | 4428 | info->icount.rxlong++; |
4398 | else { | 4429 | else { |
4399 | /* copy dma buffer(s) to contiguous temp buffer */ | 4430 | /* copy dma buffer(s) to contiguous temp buffer */ |
@@ -4413,6 +4444,11 @@ check_again: | |||
4413 | i = 0; | 4444 | i = 0; |
4414 | } | 4445 | } |
4415 | 4446 | ||
4447 | if (info->params.crc_type & HDLC_CRC_RETURN_EX) { | ||
4448 | *p = (status & BIT1) ? RX_CRC_ERROR : RX_OK; | ||
4449 | framesize++; | ||
4450 | } | ||
4451 | |||
4416 | #ifdef CONFIG_HDLC | 4452 | #ifdef CONFIG_HDLC |
4417 | if (info->netcount) | 4453 | if (info->netcount) |
4418 | hdlcdev_rx(info,info->tmp_rbuf, framesize); | 4454 | hdlcdev_rx(info,info->tmp_rbuf, framesize); |
@@ -4671,13 +4707,13 @@ static int loopback_test(struct slgt_info *info) | |||
4671 | static int adapter_test(struct slgt_info *info) | 4707 | static int adapter_test(struct slgt_info *info) |
4672 | { | 4708 | { |
4673 | DBGINFO(("testing %s\n", info->device_name)); | 4709 | DBGINFO(("testing %s\n", info->device_name)); |
4674 | if ((info->init_error = register_test(info)) < 0) { | 4710 | if (register_test(info) < 0) { |
4675 | printk("register test failure %s addr=%08X\n", | 4711 | printk("register test failure %s addr=%08X\n", |
4676 | info->device_name, info->phys_reg_addr); | 4712 | info->device_name, info->phys_reg_addr); |
4677 | } else if ((info->init_error = irq_test(info)) < 0) { | 4713 | } else if (irq_test(info) < 0) { |
4678 | printk("IRQ test failure %s IRQ=%d\n", | 4714 | printk("IRQ test failure %s IRQ=%d\n", |
4679 | info->device_name, info->irq_level); | 4715 | info->device_name, info->irq_level); |
4680 | } else if ((info->init_error = loopback_test(info)) < 0) { | 4716 | } else if (loopback_test(info) < 0) { |
4681 | printk("loopback test failure %s\n", info->device_name); | 4717 | printk("loopback test failure %s\n", info->device_name); |
4682 | } | 4718 | } |
4683 | return info->init_error; | 4719 | return info->init_error; |
diff --git a/drivers/char/synclinkmp.c b/drivers/char/synclinkmp.c index 858740131115..1e443a233f51 100644 --- a/drivers/char/synclinkmp.c +++ b/drivers/char/synclinkmp.c | |||
@@ -34,7 +34,6 @@ | |||
34 | 34 | ||
35 | #define MAX_DEVICES 12 | 35 | #define MAX_DEVICES 12 |
36 | 36 | ||
37 | #include <linux/config.h> | ||
38 | #include <linux/module.h> | 37 | #include <linux/module.h> |
39 | #include <linux/errno.h> | 38 | #include <linux/errno.h> |
40 | #include <linux/signal.h> | 39 | #include <linux/signal.h> |
@@ -988,7 +987,7 @@ static int write(struct tty_struct *tty, | |||
988 | if (sanity_check(info, tty->name, "write")) | 987 | if (sanity_check(info, tty->name, "write")) |
989 | goto cleanup; | 988 | goto cleanup; |
990 | 989 | ||
991 | if (!tty || !info->tx_buf) | 990 | if (!info->tx_buf) |
992 | goto cleanup; | 991 | goto cleanup; |
993 | 992 | ||
994 | if (info->params.mode == MGSL_MODE_HDLC) { | 993 | if (info->params.mode == MGSL_MODE_HDLC) { |
@@ -1067,7 +1066,7 @@ static void put_char(struct tty_struct *tty, unsigned char ch) | |||
1067 | if (sanity_check(info, tty->name, "put_char")) | 1066 | if (sanity_check(info, tty->name, "put_char")) |
1068 | return; | 1067 | return; |
1069 | 1068 | ||
1070 | if (!tty || !info->tx_buf) | 1069 | if (!info->tx_buf) |
1071 | return; | 1070 | return; |
1072 | 1071 | ||
1073 | spin_lock_irqsave(&info->lock,flags); | 1072 | spin_lock_irqsave(&info->lock,flags); |
@@ -3836,7 +3835,7 @@ static SLMP_INFO *alloc_dev(int adapter_num, int port_num, struct pci_dev *pdev) | |||
3836 | info->phys_statctrl_base &= ~(PAGE_SIZE-1); | 3835 | info->phys_statctrl_base &= ~(PAGE_SIZE-1); |
3837 | 3836 | ||
3838 | info->bus_type = MGSL_BUS_TYPE_PCI; | 3837 | info->bus_type = MGSL_BUS_TYPE_PCI; |
3839 | info->irq_flags = SA_SHIRQ; | 3838 | info->irq_flags = IRQF_SHARED; |
3840 | 3839 | ||
3841 | init_timer(&info->tx_timer); | 3840 | init_timer(&info->tx_timer); |
3842 | info->tx_timer.data = (unsigned long)info; | 3841 | info->tx_timer.data = (unsigned long)info; |
diff --git a/drivers/char/sysrq.c b/drivers/char/sysrq.c index 35082dc12eae..ee3ca8f1768e 100644 --- a/drivers/char/sysrq.c +++ b/drivers/char/sysrq.c | |||
@@ -12,7 +12,6 @@ | |||
12 | * based upon discusions in irc://irc.openprojects.net/#kernelnewbies | 12 | * based upon discusions in irc://irc.openprojects.net/#kernelnewbies |
13 | */ | 13 | */ |
14 | 14 | ||
15 | #include <linux/config.h> | ||
16 | #include <linux/sched.h> | 15 | #include <linux/sched.h> |
17 | #include <linux/interrupt.h> | 16 | #include <linux/interrupt.h> |
18 | #include <linux/mm.h> | 17 | #include <linux/mm.h> |
@@ -148,12 +147,13 @@ static struct sysrq_key_op sysrq_mountro_op = { | |||
148 | .enable_mask = SYSRQ_ENABLE_REMOUNT, | 147 | .enable_mask = SYSRQ_ENABLE_REMOUNT, |
149 | }; | 148 | }; |
150 | 149 | ||
151 | #ifdef CONFIG_DEBUG_MUTEXES | 150 | #ifdef CONFIG_LOCKDEP |
152 | static void sysrq_handle_showlocks(int key, struct pt_regs *pt_regs, | 151 | static void sysrq_handle_showlocks(int key, struct pt_regs *pt_regs, |
153 | struct tty_struct *tty) | 152 | struct tty_struct *tty) |
154 | { | 153 | { |
155 | mutex_debug_show_all_locks(); | 154 | debug_show_all_locks(); |
156 | } | 155 | } |
156 | |||
157 | static struct sysrq_key_op sysrq_showlocks_op = { | 157 | static struct sysrq_key_op sysrq_showlocks_op = { |
158 | .handler = sysrq_handle_showlocks, | 158 | .handler = sysrq_handle_showlocks, |
159 | .help_msg = "show-all-locks(D)", | 159 | .help_msg = "show-all-locks(D)", |
diff --git a/drivers/char/tb0219.c b/drivers/char/tb0219.c index a80c83210872..bb1bad4c18f9 100644 --- a/drivers/char/tb0219.c +++ b/drivers/char/tb0219.c | |||
@@ -255,7 +255,7 @@ static int tanbac_tb0219_release(struct inode *inode, struct file *file) | |||
255 | return 0; | 255 | return 0; |
256 | } | 256 | } |
257 | 257 | ||
258 | static struct file_operations tb0219_fops = { | 258 | static const struct file_operations tb0219_fops = { |
259 | .owner = THIS_MODULE, | 259 | .owner = THIS_MODULE, |
260 | .read = tanbac_tb0219_read, | 260 | .read = tanbac_tb0219_read, |
261 | .write = tanbac_tb0219_write, | 261 | .write = tanbac_tb0219_write, |
diff --git a/drivers/char/tipar.c b/drivers/char/tipar.c index 079db5a935a1..d30dc09dbbc9 100644 --- a/drivers/char/tipar.c +++ b/drivers/char/tipar.c | |||
@@ -42,7 +42,6 @@ | |||
42 | */ | 42 | */ |
43 | #undef DEBUG /* change to #define to get debugging | 43 | #undef DEBUG /* change to #define to get debugging |
44 | * output - for pr_debug() */ | 44 | * output - for pr_debug() */ |
45 | #include <linux/config.h> | ||
46 | #include <linux/module.h> | 45 | #include <linux/module.h> |
47 | #include <linux/types.h> | 46 | #include <linux/types.h> |
48 | #include <linux/errno.h> | 47 | #include <linux/errno.h> |
@@ -56,7 +55,6 @@ | |||
56 | #include <linux/ioport.h> | 55 | #include <linux/ioport.h> |
57 | #include <asm/io.h> | 56 | #include <asm/io.h> |
58 | #include <linux/bitops.h> | 57 | #include <linux/bitops.h> |
59 | #include <linux/devfs_fs_kernel.h> /* DevFs support */ | ||
60 | #include <linux/parport.h> /* Our code depend on parport */ | 58 | #include <linux/parport.h> /* Our code depend on parport */ |
61 | #include <linux/device.h> | 59 | #include <linux/device.h> |
62 | 60 | ||
@@ -383,7 +381,7 @@ tipar_ioctl(struct inode *inode, struct file *file, | |||
383 | 381 | ||
384 | /* ----- kernel module registering ------------------------------------ */ | 382 | /* ----- kernel module registering ------------------------------------ */ |
385 | 383 | ||
386 | static struct file_operations tipar_fops = { | 384 | static const struct file_operations tipar_fops = { |
387 | .owner = THIS_MODULE, | 385 | .owner = THIS_MODULE, |
388 | .llseek = no_llseek, | 386 | .llseek = no_llseek, |
389 | .read = tipar_read, | 387 | .read = tipar_read, |
@@ -443,12 +441,6 @@ tipar_register(int nr, struct parport *port) | |||
443 | 441 | ||
444 | class_device_create(tipar_class, NULL, MKDEV(TIPAR_MAJOR, | 442 | class_device_create(tipar_class, NULL, MKDEV(TIPAR_MAJOR, |
445 | TIPAR_MINOR + nr), NULL, "par%d", nr); | 443 | TIPAR_MINOR + nr), NULL, "par%d", nr); |
446 | /* Use devfs, tree: /dev/ticables/par/[0..2] */ | ||
447 | err = devfs_mk_cdev(MKDEV(TIPAR_MAJOR, TIPAR_MINOR + nr), | ||
448 | S_IFCHR | S_IRUGO | S_IWUGO, | ||
449 | "ticables/par/%d", nr); | ||
450 | if (err) | ||
451 | goto out_class; | ||
452 | 444 | ||
453 | /* Display informations */ | 445 | /* Display informations */ |
454 | pr_info("tipar%d: using %s (%s)\n", nr, port->name, (port->irq == | 446 | pr_info("tipar%d: using %s (%s)\n", nr, port->name, (port->irq == |
@@ -460,11 +452,7 @@ tipar_register(int nr, struct parport *port) | |||
460 | pr_info("tipar%d: link cable not found\n", nr); | 452 | pr_info("tipar%d: link cable not found\n", nr); |
461 | 453 | ||
462 | err = 0; | 454 | err = 0; |
463 | goto out; | ||
464 | 455 | ||
465 | out_class: | ||
466 | class_device_destroy(tipar_class, MKDEV(TIPAR_MAJOR, TIPAR_MINOR + nr)); | ||
467 | class_destroy(tipar_class); | ||
468 | out: | 456 | out: |
469 | return err; | 457 | return err; |
470 | } | 458 | } |
@@ -507,9 +495,6 @@ tipar_init_module(void) | |||
507 | goto out; | 495 | goto out; |
508 | } | 496 | } |
509 | 497 | ||
510 | /* Use devfs with tree: /dev/ticables/par/[0..2] */ | ||
511 | devfs_mk_dir("ticables/par"); | ||
512 | |||
513 | tipar_class = class_create(THIS_MODULE, "ticables"); | 498 | tipar_class = class_create(THIS_MODULE, "ticables"); |
514 | if (IS_ERR(tipar_class)) { | 499 | if (IS_ERR(tipar_class)) { |
515 | err = PTR_ERR(tipar_class); | 500 | err = PTR_ERR(tipar_class); |
@@ -528,7 +513,6 @@ out_class: | |||
528 | class_destroy(tipar_class); | 513 | class_destroy(tipar_class); |
529 | 514 | ||
530 | out_chrdev: | 515 | out_chrdev: |
531 | devfs_remove("ticables/par"); | ||
532 | unregister_chrdev(TIPAR_MAJOR, "tipar"); | 516 | unregister_chrdev(TIPAR_MAJOR, "tipar"); |
533 | out: | 517 | out: |
534 | return err; | 518 | return err; |
@@ -549,10 +533,8 @@ tipar_cleanup_module(void) | |||
549 | continue; | 533 | continue; |
550 | parport_unregister_device(table[i].dev); | 534 | parport_unregister_device(table[i].dev); |
551 | class_device_destroy(tipar_class, MKDEV(TIPAR_MAJOR, i)); | 535 | class_device_destroy(tipar_class, MKDEV(TIPAR_MAJOR, i)); |
552 | devfs_remove("ticables/par/%d", i); | ||
553 | } | 536 | } |
554 | class_destroy(tipar_class); | 537 | class_destroy(tipar_class); |
555 | devfs_remove("ticables/par"); | ||
556 | 538 | ||
557 | pr_info("tipar: module unloaded\n"); | 539 | pr_info("tipar: module unloaded\n"); |
558 | } | 540 | } |
diff --git a/drivers/char/tlclk.c b/drivers/char/tlclk.c index f58ad7f68267..d2c5ba4e83b8 100644 --- a/drivers/char/tlclk.c +++ b/drivers/char/tlclk.c | |||
@@ -27,7 +27,6 @@ | |||
27 | * MPCBL0010 ATCA computer. | 27 | * MPCBL0010 ATCA computer. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include <linux/config.h> | ||
31 | #include <linux/module.h> | 30 | #include <linux/module.h> |
32 | #include <linux/init.h> | 31 | #include <linux/init.h> |
33 | #include <linux/sched.h> | 32 | #include <linux/sched.h> |
@@ -209,7 +208,7 @@ static int tlclk_open(struct inode *inode, struct file *filp) | |||
209 | /* This device is wired through the FPGA IO space of the ATCA blade | 208 | /* This device is wired through the FPGA IO space of the ATCA blade |
210 | * we can't share this IRQ */ | 209 | * we can't share this IRQ */ |
211 | result = request_irq(telclk_interrupt, &tlclk_interrupt, | 210 | result = request_irq(telclk_interrupt, &tlclk_interrupt, |
212 | SA_INTERRUPT, "telco_clock", tlclk_interrupt); | 211 | IRQF_DISABLED, "telco_clock", tlclk_interrupt); |
213 | if (result == -EBUSY) { | 212 | if (result == -EBUSY) { |
214 | printk(KERN_ERR "tlclk: Interrupt can't be reserved.\n"); | 213 | printk(KERN_ERR "tlclk: Interrupt can't be reserved.\n"); |
215 | return -EBUSY; | 214 | return -EBUSY; |
@@ -248,7 +247,7 @@ static ssize_t tlclk_write(struct file *filp, const char __user *buf, size_t cou | |||
248 | return 0; | 247 | return 0; |
249 | } | 248 | } |
250 | 249 | ||
251 | static struct file_operations tlclk_fops = { | 250 | static const struct file_operations tlclk_fops = { |
252 | .read = tlclk_read, | 251 | .read = tlclk_read, |
253 | .write = tlclk_write, | 252 | .write = tlclk_write, |
254 | .open = tlclk_open, | 253 | .open = tlclk_open, |
@@ -343,7 +342,7 @@ static ssize_t store_received_ref_clk3b(struct device *d, | |||
343 | 342 | ||
344 | val = (unsigned char)tmp; | 343 | val = (unsigned char)tmp; |
345 | spin_lock_irqsave(&event_lock, flags); | 344 | spin_lock_irqsave(&event_lock, flags); |
346 | SET_PORT_BITS(TLCLK_REG1, 0xef, val << 1); | 345 | SET_PORT_BITS(TLCLK_REG1, 0xdf, val << 1); |
347 | spin_unlock_irqrestore(&event_lock, flags); | 346 | spin_unlock_irqrestore(&event_lock, flags); |
348 | 347 | ||
349 | return strnlen(buf, count); | 348 | return strnlen(buf, count); |
diff --git a/drivers/char/toshiba.c b/drivers/char/toshiba.c index e2fb234dee40..dd36fd04a842 100644 --- a/drivers/char/toshiba.c +++ b/drivers/char/toshiba.c | |||
@@ -92,7 +92,7 @@ static int tosh_ioctl(struct inode *, struct file *, unsigned int, | |||
92 | unsigned long); | 92 | unsigned long); |
93 | 93 | ||
94 | 94 | ||
95 | static struct file_operations tosh_fops = { | 95 | static const struct file_operations tosh_fops = { |
96 | .owner = THIS_MODULE, | 96 | .owner = THIS_MODULE, |
97 | .ioctl = tosh_ioctl, | 97 | .ioctl = tosh_ioctl, |
98 | }; | 98 | }; |
diff --git a/drivers/char/tpm/tpm_atmel.c b/drivers/char/tpm/tpm_atmel.c index 58a258cec153..ad8ffe49256f 100644 --- a/drivers/char/tpm/tpm_atmel.c +++ b/drivers/char/tpm/tpm_atmel.c | |||
@@ -116,7 +116,7 @@ static u8 tpm_atml_status(struct tpm_chip *chip) | |||
116 | return ioread8(chip->vendor.iobase + 1); | 116 | return ioread8(chip->vendor.iobase + 1); |
117 | } | 117 | } |
118 | 118 | ||
119 | static struct file_operations atmel_ops = { | 119 | static const struct file_operations atmel_ops = { |
120 | .owner = THIS_MODULE, | 120 | .owner = THIS_MODULE, |
121 | .llseek = no_llseek, | 121 | .llseek = no_llseek, |
122 | .open = tpm_open, | 122 | .open = tpm_open, |
diff --git a/drivers/char/tpm/tpm_infineon.c b/drivers/char/tpm/tpm_infineon.c index adfff21beb21..1353b5a6bae8 100644 --- a/drivers/char/tpm/tpm_infineon.c +++ b/drivers/char/tpm/tpm_infineon.c | |||
@@ -338,7 +338,7 @@ static struct attribute *inf_attrs[] = { | |||
338 | 338 | ||
339 | static struct attribute_group inf_attr_grp = {.attrs = inf_attrs }; | 339 | static struct attribute_group inf_attr_grp = {.attrs = inf_attrs }; |
340 | 340 | ||
341 | static struct file_operations inf_ops = { | 341 | static const struct file_operations inf_ops = { |
342 | .owner = THIS_MODULE, | 342 | .owner = THIS_MODULE, |
343 | .llseek = no_llseek, | 343 | .llseek = no_llseek, |
344 | .open = tpm_open, | 344 | .open = tpm_open, |
diff --git a/drivers/char/tpm/tpm_nsc.c b/drivers/char/tpm/tpm_nsc.c index 4c8bc06c7d95..26287aace87d 100644 --- a/drivers/char/tpm/tpm_nsc.c +++ b/drivers/char/tpm/tpm_nsc.c | |||
@@ -226,7 +226,7 @@ static u8 tpm_nsc_status(struct tpm_chip *chip) | |||
226 | return inb(chip->vendor.base + NSC_STATUS); | 226 | return inb(chip->vendor.base + NSC_STATUS); |
227 | } | 227 | } |
228 | 228 | ||
229 | static struct file_operations nsc_ops = { | 229 | static const struct file_operations nsc_ops = { |
230 | .owner = THIS_MODULE, | 230 | .owner = THIS_MODULE, |
231 | .llseek = no_llseek, | 231 | .llseek = no_llseek, |
232 | .open = tpm_open, | 232 | .open = tpm_open, |
diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c index 8ea70625f7ea..3232b1932597 100644 --- a/drivers/char/tpm/tpm_tis.c +++ b/drivers/char/tpm/tpm_tis.c | |||
@@ -330,7 +330,7 @@ out_err: | |||
330 | return rc; | 330 | return rc; |
331 | } | 331 | } |
332 | 332 | ||
333 | static struct file_operations tis_ops = { | 333 | static const struct file_operations tis_ops = { |
334 | .owner = THIS_MODULE, | 334 | .owner = THIS_MODULE, |
335 | .llseek = no_llseek, | 335 | .llseek = no_llseek, |
336 | .open = tpm_open, | 336 | .open = tpm_open, |
@@ -522,7 +522,7 @@ static int __devinit tpm_tis_pnp_init(struct pnp_dev *pnp_dev, | |||
522 | iowrite8(i, chip->vendor.iobase + | 522 | iowrite8(i, chip->vendor.iobase + |
523 | TPM_INT_VECTOR(chip->vendor.locality)); | 523 | TPM_INT_VECTOR(chip->vendor.locality)); |
524 | if (request_irq | 524 | if (request_irq |
525 | (i, tis_int_probe, SA_SHIRQ, | 525 | (i, tis_int_probe, IRQF_SHARED, |
526 | chip->vendor.miscdev.name, chip) != 0) { | 526 | chip->vendor.miscdev.name, chip) != 0) { |
527 | dev_info(chip->dev, | 527 | dev_info(chip->dev, |
528 | "Unable to request irq: %d for probe\n", | 528 | "Unable to request irq: %d for probe\n", |
@@ -557,7 +557,7 @@ static int __devinit tpm_tis_pnp_init(struct pnp_dev *pnp_dev, | |||
557 | chip->vendor.iobase + | 557 | chip->vendor.iobase + |
558 | TPM_INT_VECTOR(chip->vendor.locality)); | 558 | TPM_INT_VECTOR(chip->vendor.locality)); |
559 | if (request_irq | 559 | if (request_irq |
560 | (chip->vendor.irq, tis_int_handler, SA_SHIRQ, | 560 | (chip->vendor.irq, tis_int_handler, IRQF_SHARED, |
561 | chip->vendor.miscdev.name, chip) != 0) { | 561 | chip->vendor.miscdev.name, chip) != 0) { |
562 | dev_info(chip->dev, | 562 | dev_info(chip->dev, |
563 | "Unable to request irq: %d for use\n", | 563 | "Unable to request irq: %d for use\n", |
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c index a88b94a82b14..bfdb90242a90 100644 --- a/drivers/char/tty_io.c +++ b/drivers/char/tty_io.c | |||
@@ -65,7 +65,6 @@ | |||
65 | * alloc_tty_struct() always uses kmalloc() -- Andrew Morton <andrewm@uow.edu.eu> 17Mar01 | 65 | * alloc_tty_struct() always uses kmalloc() -- Andrew Morton <andrewm@uow.edu.eu> 17Mar01 |
66 | */ | 66 | */ |
67 | 67 | ||
68 | #include <linux/config.h> | ||
69 | #include <linux/types.h> | 68 | #include <linux/types.h> |
70 | #include <linux/major.h> | 69 | #include <linux/major.h> |
71 | #include <linux/errno.h> | 70 | #include <linux/errno.h> |
@@ -102,7 +101,6 @@ | |||
102 | #include <linux/kbd_kern.h> | 101 | #include <linux/kbd_kern.h> |
103 | #include <linux/vt_kern.h> | 102 | #include <linux/vt_kern.h> |
104 | #include <linux/selection.h> | 103 | #include <linux/selection.h> |
105 | #include <linux/devfs_fs_kernel.h> | ||
106 | 104 | ||
107 | #include <linux/kmod.h> | 105 | #include <linux/kmod.h> |
108 | 106 | ||
@@ -267,7 +265,6 @@ static struct tty_buffer *tty_buffer_alloc(size_t size) | |||
267 | p->used = 0; | 265 | p->used = 0; |
268 | p->size = size; | 266 | p->size = size; |
269 | p->next = NULL; | 267 | p->next = NULL; |
270 | p->active = 0; | ||
271 | p->commit = 0; | 268 | p->commit = 0; |
272 | p->read = 0; | 269 | p->read = 0; |
273 | p->char_buf_ptr = (char *)(p->data); | 270 | p->char_buf_ptr = (char *)(p->data); |
@@ -327,10 +324,9 @@ int tty_buffer_request_room(struct tty_struct *tty, size_t size) | |||
327 | /* OPTIMISATION: We could keep a per tty "zero" sized buffer to | 324 | /* OPTIMISATION: We could keep a per tty "zero" sized buffer to |
328 | remove this conditional if its worth it. This would be invisible | 325 | remove this conditional if its worth it. This would be invisible |
329 | to the callers */ | 326 | to the callers */ |
330 | if ((b = tty->buf.tail) != NULL) { | 327 | if ((b = tty->buf.tail) != NULL) |
331 | left = b->size - b->used; | 328 | left = b->size - b->used; |
332 | b->active = 1; | 329 | else |
333 | } else | ||
334 | left = 0; | 330 | left = 0; |
335 | 331 | ||
336 | if (left < size) { | 332 | if (left < size) { |
@@ -338,12 +334,10 @@ int tty_buffer_request_room(struct tty_struct *tty, size_t size) | |||
338 | if ((n = tty_buffer_find(tty, size)) != NULL) { | 334 | if ((n = tty_buffer_find(tty, size)) != NULL) { |
339 | if (b != NULL) { | 335 | if (b != NULL) { |
340 | b->next = n; | 336 | b->next = n; |
341 | b->active = 0; | ||
342 | b->commit = b->used; | 337 | b->commit = b->used; |
343 | } else | 338 | } else |
344 | tty->buf.head = n; | 339 | tty->buf.head = n; |
345 | tty->buf.tail = n; | 340 | tty->buf.tail = n; |
346 | n->active = 1; | ||
347 | } else | 341 | } else |
348 | size = left; | 342 | size = left; |
349 | } | 343 | } |
@@ -404,10 +398,8 @@ void tty_schedule_flip(struct tty_struct *tty) | |||
404 | { | 398 | { |
405 | unsigned long flags; | 399 | unsigned long flags; |
406 | spin_lock_irqsave(&tty->buf.lock, flags); | 400 | spin_lock_irqsave(&tty->buf.lock, flags); |
407 | if (tty->buf.tail != NULL) { | 401 | if (tty->buf.tail != NULL) |
408 | tty->buf.tail->active = 0; | ||
409 | tty->buf.tail->commit = tty->buf.tail->used; | 402 | tty->buf.tail->commit = tty->buf.tail->used; |
410 | } | ||
411 | spin_unlock_irqrestore(&tty->buf.lock, flags); | 403 | spin_unlock_irqrestore(&tty->buf.lock, flags); |
412 | schedule_delayed_work(&tty->buf.work, 1); | 404 | schedule_delayed_work(&tty->buf.work, 1); |
413 | } | 405 | } |
@@ -784,11 +776,8 @@ restart: | |||
784 | } | 776 | } |
785 | 777 | ||
786 | clear_bit(TTY_LDISC, &tty->flags); | 778 | clear_bit(TTY_LDISC, &tty->flags); |
787 | clear_bit(TTY_DONT_FLIP, &tty->flags); | 779 | if (o_tty) |
788 | if (o_tty) { | ||
789 | clear_bit(TTY_LDISC, &o_tty->flags); | 780 | clear_bit(TTY_LDISC, &o_tty->flags); |
790 | clear_bit(TTY_DONT_FLIP, &o_tty->flags); | ||
791 | } | ||
792 | spin_unlock_irqrestore(&tty_ldisc_lock, flags); | 781 | spin_unlock_irqrestore(&tty_ldisc_lock, flags); |
793 | 782 | ||
794 | /* | 783 | /* |
@@ -923,7 +912,7 @@ static int hung_up_tty_ioctl(struct inode * inode, struct file * file, | |||
923 | return cmd == TIOCSPGRP ? -ENOTTY : -EIO; | 912 | return cmd == TIOCSPGRP ? -ENOTTY : -EIO; |
924 | } | 913 | } |
925 | 914 | ||
926 | static struct file_operations tty_fops = { | 915 | static const struct file_operations tty_fops = { |
927 | .llseek = no_llseek, | 916 | .llseek = no_llseek, |
928 | .read = tty_read, | 917 | .read = tty_read, |
929 | .write = tty_write, | 918 | .write = tty_write, |
@@ -935,7 +924,7 @@ static struct file_operations tty_fops = { | |||
935 | }; | 924 | }; |
936 | 925 | ||
937 | #ifdef CONFIG_UNIX98_PTYS | 926 | #ifdef CONFIG_UNIX98_PTYS |
938 | static struct file_operations ptmx_fops = { | 927 | static const struct file_operations ptmx_fops = { |
939 | .llseek = no_llseek, | 928 | .llseek = no_llseek, |
940 | .read = tty_read, | 929 | .read = tty_read, |
941 | .write = tty_write, | 930 | .write = tty_write, |
@@ -947,7 +936,7 @@ static struct file_operations ptmx_fops = { | |||
947 | }; | 936 | }; |
948 | #endif | 937 | #endif |
949 | 938 | ||
950 | static struct file_operations console_fops = { | 939 | static const struct file_operations console_fops = { |
951 | .llseek = no_llseek, | 940 | .llseek = no_llseek, |
952 | .read = tty_read, | 941 | .read = tty_read, |
953 | .write = redirected_tty_write, | 942 | .write = redirected_tty_write, |
@@ -958,7 +947,7 @@ static struct file_operations console_fops = { | |||
958 | .fasync = tty_fasync, | 947 | .fasync = tty_fasync, |
959 | }; | 948 | }; |
960 | 949 | ||
961 | static struct file_operations hung_up_tty_fops = { | 950 | static const struct file_operations hung_up_tty_fops = { |
962 | .llseek = no_llseek, | 951 | .llseek = no_llseek, |
963 | .read = hung_up_tty_read, | 952 | .read = hung_up_tty_read, |
964 | .write = hung_up_tty_write, | 953 | .write = hung_up_tty_write, |
@@ -1955,7 +1944,6 @@ static void release_dev(struct file * filp) | |||
1955 | * race with the set_ldisc code path. | 1944 | * race with the set_ldisc code path. |
1956 | */ | 1945 | */ |
1957 | clear_bit(TTY_LDISC, &tty->flags); | 1946 | clear_bit(TTY_LDISC, &tty->flags); |
1958 | clear_bit(TTY_DONT_FLIP, &tty->flags); | ||
1959 | cancel_delayed_work(&tty->buf.work); | 1947 | cancel_delayed_work(&tty->buf.work); |
1960 | 1948 | ||
1961 | /* | 1949 | /* |
@@ -2348,7 +2336,7 @@ static int fionbio(struct file *file, int __user *p) | |||
2348 | 2336 | ||
2349 | static int tiocsctty(struct tty_struct *tty, int arg) | 2337 | static int tiocsctty(struct tty_struct *tty, int arg) |
2350 | { | 2338 | { |
2351 | task_t *p; | 2339 | struct task_struct *p; |
2352 | 2340 | ||
2353 | if (current->signal->leader && | 2341 | if (current->signal->leader && |
2354 | (current->signal->session == tty->session)) | 2342 | (current->signal->session == tty->session)) |
@@ -2621,10 +2609,9 @@ int tty_ioctl(struct inode * inode, struct file * file, | |||
2621 | tty->driver->break_ctl(tty, 0); | 2609 | tty->driver->break_ctl(tty, 0); |
2622 | return 0; | 2610 | return 0; |
2623 | case TCSBRK: /* SVID version: non-zero arg --> no break */ | 2611 | case TCSBRK: /* SVID version: non-zero arg --> no break */ |
2624 | /* | 2612 | /* non-zero arg means wait for all output data |
2625 | * XXX is the above comment correct, or the | 2613 | * to be sent (performed above) but don't send break. |
2626 | * code below correct? Is this ioctl used at | 2614 | * This is used by the tcdrain() termios function. |
2627 | * all by anyone? | ||
2628 | */ | 2615 | */ |
2629 | if (!arg) | 2616 | if (!arg) |
2630 | return send_break(tty, 250); | 2617 | return send_break(tty, 250); |
@@ -2776,8 +2763,7 @@ static void flush_to_ldisc(void *private_) | |||
2776 | struct tty_struct *tty = (struct tty_struct *) private_; | 2763 | struct tty_struct *tty = (struct tty_struct *) private_; |
2777 | unsigned long flags; | 2764 | unsigned long flags; |
2778 | struct tty_ldisc *disc; | 2765 | struct tty_ldisc *disc; |
2779 | struct tty_buffer *tbuf; | 2766 | struct tty_buffer *tbuf, *head; |
2780 | int count; | ||
2781 | char *char_buf; | 2767 | char *char_buf; |
2782 | unsigned char *flag_buf; | 2768 | unsigned char *flag_buf; |
2783 | 2769 | ||
@@ -2785,32 +2771,37 @@ static void flush_to_ldisc(void *private_) | |||
2785 | if (disc == NULL) /* !TTY_LDISC */ | 2771 | if (disc == NULL) /* !TTY_LDISC */ |
2786 | return; | 2772 | return; |
2787 | 2773 | ||
2788 | if (test_bit(TTY_DONT_FLIP, &tty->flags)) { | ||
2789 | /* | ||
2790 | * Do it after the next timer tick: | ||
2791 | */ | ||
2792 | schedule_delayed_work(&tty->buf.work, 1); | ||
2793 | goto out; | ||
2794 | } | ||
2795 | spin_lock_irqsave(&tty->buf.lock, flags); | 2774 | spin_lock_irqsave(&tty->buf.lock, flags); |
2796 | while((tbuf = tty->buf.head) != NULL) { | 2775 | head = tty->buf.head; |
2797 | while ((count = tbuf->commit - tbuf->read) != 0) { | 2776 | if (head != NULL) { |
2798 | char_buf = tbuf->char_buf_ptr + tbuf->read; | 2777 | tty->buf.head = NULL; |
2799 | flag_buf = tbuf->flag_buf_ptr + tbuf->read; | 2778 | for (;;) { |
2800 | tbuf->read += count; | 2779 | int count = head->commit - head->read; |
2780 | if (!count) { | ||
2781 | if (head->next == NULL) | ||
2782 | break; | ||
2783 | tbuf = head; | ||
2784 | head = head->next; | ||
2785 | tty_buffer_free(tty, tbuf); | ||
2786 | continue; | ||
2787 | } | ||
2788 | if (!tty->receive_room) { | ||
2789 | schedule_delayed_work(&tty->buf.work, 1); | ||
2790 | break; | ||
2791 | } | ||
2792 | if (count > tty->receive_room) | ||
2793 | count = tty->receive_room; | ||
2794 | char_buf = head->char_buf_ptr + head->read; | ||
2795 | flag_buf = head->flag_buf_ptr + head->read; | ||
2796 | head->read += count; | ||
2801 | spin_unlock_irqrestore(&tty->buf.lock, flags); | 2797 | spin_unlock_irqrestore(&tty->buf.lock, flags); |
2802 | disc->receive_buf(tty, char_buf, flag_buf, count); | 2798 | disc->receive_buf(tty, char_buf, flag_buf, count); |
2803 | spin_lock_irqsave(&tty->buf.lock, flags); | 2799 | spin_lock_irqsave(&tty->buf.lock, flags); |
2804 | } | 2800 | } |
2805 | if (tbuf->active) | 2801 | tty->buf.head = head; |
2806 | break; | ||
2807 | tty->buf.head = tbuf->next; | ||
2808 | if (tty->buf.head == NULL) | ||
2809 | tty->buf.tail = NULL; | ||
2810 | tty_buffer_free(tty, tbuf); | ||
2811 | } | 2802 | } |
2812 | spin_unlock_irqrestore(&tty->buf.lock, flags); | 2803 | spin_unlock_irqrestore(&tty->buf.lock, flags); |
2813 | out: | 2804 | |
2814 | tty_ldisc_deref(disc); | 2805 | tty_ldisc_deref(disc); |
2815 | } | 2806 | } |
2816 | 2807 | ||
@@ -2903,10 +2894,8 @@ void tty_flip_buffer_push(struct tty_struct *tty) | |||
2903 | { | 2894 | { |
2904 | unsigned long flags; | 2895 | unsigned long flags; |
2905 | spin_lock_irqsave(&tty->buf.lock, flags); | 2896 | spin_lock_irqsave(&tty->buf.lock, flags); |
2906 | if (tty->buf.tail != NULL) { | 2897 | if (tty->buf.tail != NULL) |
2907 | tty->buf.tail->active = 0; | ||
2908 | tty->buf.tail->commit = tty->buf.tail->used; | 2898 | tty->buf.tail->commit = tty->buf.tail->used; |
2909 | } | ||
2910 | spin_unlock_irqrestore(&tty->buf.lock, flags); | 2899 | spin_unlock_irqrestore(&tty->buf.lock, flags); |
2911 | 2900 | ||
2912 | if (tty->low_latency) | 2901 | if (tty->low_latency) |
@@ -2961,12 +2950,14 @@ static struct class *tty_class; | |||
2961 | * This field is optional, if there is no known struct device for this | 2950 | * This field is optional, if there is no known struct device for this |
2962 | * tty device it can be set to NULL safely. | 2951 | * tty device it can be set to NULL safely. |
2963 | * | 2952 | * |
2953 | * Returns a pointer to the class device (or ERR_PTR(-EFOO) on error). | ||
2954 | * | ||
2964 | * This call is required to be made to register an individual tty device if | 2955 | * This call is required to be made to register an individual tty device if |
2965 | * the tty driver's flags have the TTY_DRIVER_NO_DEVFS bit set. If that | 2956 | * the tty driver's flags have the TTY_DRIVER_DYNAMIC_DEV bit set. If that |
2966 | * bit is not set, this function should not be called. | 2957 | * bit is not set, this function should not be called by a tty driver. |
2967 | */ | 2958 | */ |
2968 | void tty_register_device(struct tty_driver *driver, unsigned index, | 2959 | struct class_device *tty_register_device(struct tty_driver *driver, |
2969 | struct device *device) | 2960 | unsigned index, struct device *device) |
2970 | { | 2961 | { |
2971 | char name[64]; | 2962 | char name[64]; |
2972 | dev_t dev = MKDEV(driver->major, driver->minor_start) + index; | 2963 | dev_t dev = MKDEV(driver->major, driver->minor_start) + index; |
@@ -2974,17 +2965,15 @@ void tty_register_device(struct tty_driver *driver, unsigned index, | |||
2974 | if (index >= driver->num) { | 2965 | if (index >= driver->num) { |
2975 | printk(KERN_ERR "Attempt to register invalid tty line number " | 2966 | printk(KERN_ERR "Attempt to register invalid tty line number " |
2976 | " (%d).\n", index); | 2967 | " (%d).\n", index); |
2977 | return; | 2968 | return ERR_PTR(-EINVAL); |
2978 | } | 2969 | } |
2979 | 2970 | ||
2980 | devfs_mk_cdev(dev, S_IFCHR | S_IRUSR | S_IWUSR, | ||
2981 | "%s%d", driver->devfs_name, index + driver->name_base); | ||
2982 | |||
2983 | if (driver->type == TTY_DRIVER_TYPE_PTY) | 2971 | if (driver->type == TTY_DRIVER_TYPE_PTY) |
2984 | pty_line_name(driver, index, name); | 2972 | pty_line_name(driver, index, name); |
2985 | else | 2973 | else |
2986 | tty_line_name(driver, index, name); | 2974 | tty_line_name(driver, index, name); |
2987 | class_device_create(tty_class, NULL, dev, device, "%s", name); | 2975 | |
2976 | return class_device_create(tty_class, NULL, dev, device, "%s", name); | ||
2988 | } | 2977 | } |
2989 | 2978 | ||
2990 | /** | 2979 | /** |
@@ -2997,7 +2986,6 @@ void tty_register_device(struct tty_driver *driver, unsigned index, | |||
2997 | */ | 2986 | */ |
2998 | void tty_unregister_device(struct tty_driver *driver, unsigned index) | 2987 | void tty_unregister_device(struct tty_driver *driver, unsigned index) |
2999 | { | 2988 | { |
3000 | devfs_remove("%s%d", driver->devfs_name, index + driver->name_base); | ||
3001 | class_device_destroy(tty_class, MKDEV(driver->major, driver->minor_start) + index); | 2989 | class_device_destroy(tty_class, MKDEV(driver->major, driver->minor_start) + index); |
3002 | } | 2990 | } |
3003 | 2991 | ||
@@ -3119,7 +3107,7 @@ int tty_register_driver(struct tty_driver *driver) | |||
3119 | 3107 | ||
3120 | list_add(&driver->tty_drivers, &tty_drivers); | 3108 | list_add(&driver->tty_drivers, &tty_drivers); |
3121 | 3109 | ||
3122 | if ( !(driver->flags & TTY_DRIVER_NO_DEVFS) ) { | 3110 | if ( !(driver->flags & TTY_DRIVER_DYNAMIC_DEV) ) { |
3123 | for(i = 0; i < driver->num; i++) | 3111 | for(i = 0; i < driver->num; i++) |
3124 | tty_register_device(driver, i, NULL); | 3112 | tty_register_device(driver, i, NULL); |
3125 | } | 3113 | } |
@@ -3162,7 +3150,7 @@ int tty_unregister_driver(struct tty_driver *driver) | |||
3162 | driver->termios_locked[i] = NULL; | 3150 | driver->termios_locked[i] = NULL; |
3163 | kfree(tp); | 3151 | kfree(tp); |
3164 | } | 3152 | } |
3165 | if (!(driver->flags & TTY_DRIVER_NO_DEVFS)) | 3153 | if (!(driver->flags & TTY_DRIVER_DYNAMIC_DEV)) |
3166 | tty_unregister_device(driver, i); | 3154 | tty_unregister_device(driver, i); |
3167 | } | 3155 | } |
3168 | p = driver->ttys; | 3156 | p = driver->ttys; |
@@ -3238,14 +3226,12 @@ static int __init tty_init(void) | |||
3238 | if (cdev_add(&tty_cdev, MKDEV(TTYAUX_MAJOR, 0), 1) || | 3226 | if (cdev_add(&tty_cdev, MKDEV(TTYAUX_MAJOR, 0), 1) || |
3239 | register_chrdev_region(MKDEV(TTYAUX_MAJOR, 0), 1, "/dev/tty") < 0) | 3227 | register_chrdev_region(MKDEV(TTYAUX_MAJOR, 0), 1, "/dev/tty") < 0) |
3240 | panic("Couldn't register /dev/tty driver\n"); | 3228 | panic("Couldn't register /dev/tty driver\n"); |
3241 | devfs_mk_cdev(MKDEV(TTYAUX_MAJOR, 0), S_IFCHR|S_IRUGO|S_IWUGO, "tty"); | ||
3242 | class_device_create(tty_class, NULL, MKDEV(TTYAUX_MAJOR, 0), NULL, "tty"); | 3229 | class_device_create(tty_class, NULL, MKDEV(TTYAUX_MAJOR, 0), NULL, "tty"); |
3243 | 3230 | ||
3244 | cdev_init(&console_cdev, &console_fops); | 3231 | cdev_init(&console_cdev, &console_fops); |
3245 | if (cdev_add(&console_cdev, MKDEV(TTYAUX_MAJOR, 1), 1) || | 3232 | if (cdev_add(&console_cdev, MKDEV(TTYAUX_MAJOR, 1), 1) || |
3246 | register_chrdev_region(MKDEV(TTYAUX_MAJOR, 1), 1, "/dev/console") < 0) | 3233 | register_chrdev_region(MKDEV(TTYAUX_MAJOR, 1), 1, "/dev/console") < 0) |
3247 | panic("Couldn't register /dev/console driver\n"); | 3234 | panic("Couldn't register /dev/console driver\n"); |
3248 | devfs_mk_cdev(MKDEV(TTYAUX_MAJOR, 1), S_IFCHR|S_IRUSR|S_IWUSR, "console"); | ||
3249 | class_device_create(tty_class, NULL, MKDEV(TTYAUX_MAJOR, 1), NULL, "console"); | 3235 | class_device_create(tty_class, NULL, MKDEV(TTYAUX_MAJOR, 1), NULL, "console"); |
3250 | 3236 | ||
3251 | #ifdef CONFIG_UNIX98_PTYS | 3237 | #ifdef CONFIG_UNIX98_PTYS |
@@ -3253,7 +3239,6 @@ static int __init tty_init(void) | |||
3253 | if (cdev_add(&ptmx_cdev, MKDEV(TTYAUX_MAJOR, 2), 1) || | 3239 | if (cdev_add(&ptmx_cdev, MKDEV(TTYAUX_MAJOR, 2), 1) || |
3254 | register_chrdev_region(MKDEV(TTYAUX_MAJOR, 2), 1, "/dev/ptmx") < 0) | 3240 | register_chrdev_region(MKDEV(TTYAUX_MAJOR, 2), 1, "/dev/ptmx") < 0) |
3255 | panic("Couldn't register /dev/ptmx driver\n"); | 3241 | panic("Couldn't register /dev/ptmx driver\n"); |
3256 | devfs_mk_cdev(MKDEV(TTYAUX_MAJOR, 2), S_IFCHR|S_IRUGO|S_IWUGO, "ptmx"); | ||
3257 | class_device_create(tty_class, NULL, MKDEV(TTYAUX_MAJOR, 2), NULL, "ptmx"); | 3242 | class_device_create(tty_class, NULL, MKDEV(TTYAUX_MAJOR, 2), NULL, "ptmx"); |
3258 | #endif | 3243 | #endif |
3259 | 3244 | ||
@@ -3262,7 +3247,6 @@ static int __init tty_init(void) | |||
3262 | if (cdev_add(&vc0_cdev, MKDEV(TTY_MAJOR, 0), 1) || | 3247 | if (cdev_add(&vc0_cdev, MKDEV(TTY_MAJOR, 0), 1) || |
3263 | register_chrdev_region(MKDEV(TTY_MAJOR, 0), 1, "/dev/vc/0") < 0) | 3248 | register_chrdev_region(MKDEV(TTY_MAJOR, 0), 1, "/dev/vc/0") < 0) |
3264 | panic("Couldn't register /dev/tty0 driver\n"); | 3249 | panic("Couldn't register /dev/tty0 driver\n"); |
3265 | devfs_mk_cdev(MKDEV(TTY_MAJOR, 0), S_IFCHR|S_IRUSR|S_IWUSR, "vc/0"); | ||
3266 | class_device_create(tty_class, NULL, MKDEV(TTY_MAJOR, 0), NULL, "tty0"); | 3250 | class_device_create(tty_class, NULL, MKDEV(TTY_MAJOR, 0), NULL, "tty0"); |
3267 | 3251 | ||
3268 | vty_init(); | 3252 | vty_init(); |
diff --git a/drivers/char/vc_screen.c b/drivers/char/vc_screen.c index 3c1dafaa3441..a9247b5213d5 100644 --- a/drivers/char/vc_screen.c +++ b/drivers/char/vc_screen.c | |||
@@ -21,12 +21,10 @@ | |||
21 | * - making it shorter - scr_readw are macros which expand in PRETTY long code | 21 | * - making it shorter - scr_readw are macros which expand in PRETTY long code |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <linux/config.h> | ||
25 | #include <linux/kernel.h> | 24 | #include <linux/kernel.h> |
26 | #include <linux/major.h> | 25 | #include <linux/major.h> |
27 | #include <linux/errno.h> | 26 | #include <linux/errno.h> |
28 | #include <linux/tty.h> | 27 | #include <linux/tty.h> |
29 | #include <linux/devfs_fs_kernel.h> | ||
30 | #include <linux/sched.h> | 28 | #include <linux/sched.h> |
31 | #include <linux/interrupt.h> | 29 | #include <linux/interrupt.h> |
32 | #include <linux/mm.h> | 30 | #include <linux/mm.h> |
@@ -467,7 +465,7 @@ vcs_open(struct inode *inode, struct file *filp) | |||
467 | return 0; | 465 | return 0; |
468 | } | 466 | } |
469 | 467 | ||
470 | static struct file_operations vcs_fops = { | 468 | static const struct file_operations vcs_fops = { |
471 | .llseek = vcs_lseek, | 469 | .llseek = vcs_lseek, |
472 | .read = vcs_read, | 470 | .read = vcs_read, |
473 | .write = vcs_write, | 471 | .write = vcs_write, |
@@ -478,12 +476,6 @@ static struct class *vc_class; | |||
478 | 476 | ||
479 | void vcs_make_devfs(struct tty_struct *tty) | 477 | void vcs_make_devfs(struct tty_struct *tty) |
480 | { | 478 | { |
481 | devfs_mk_cdev(MKDEV(VCS_MAJOR, tty->index + 1), | ||
482 | S_IFCHR|S_IRUSR|S_IWUSR, | ||
483 | "vcc/%u", tty->index + 1); | ||
484 | devfs_mk_cdev(MKDEV(VCS_MAJOR, tty->index + 129), | ||
485 | S_IFCHR|S_IRUSR|S_IWUSR, | ||
486 | "vcc/a%u", tty->index + 1); | ||
487 | class_device_create(vc_class, NULL, MKDEV(VCS_MAJOR, tty->index + 1), | 479 | class_device_create(vc_class, NULL, MKDEV(VCS_MAJOR, tty->index + 1), |
488 | NULL, "vcs%u", tty->index + 1); | 480 | NULL, "vcs%u", tty->index + 1); |
489 | class_device_create(vc_class, NULL, MKDEV(VCS_MAJOR, tty->index + 129), | 481 | class_device_create(vc_class, NULL, MKDEV(VCS_MAJOR, tty->index + 129), |
@@ -491,8 +483,6 @@ void vcs_make_devfs(struct tty_struct *tty) | |||
491 | } | 483 | } |
492 | void vcs_remove_devfs(struct tty_struct *tty) | 484 | void vcs_remove_devfs(struct tty_struct *tty) |
493 | { | 485 | { |
494 | devfs_remove("vcc/%u", tty->index + 1); | ||
495 | devfs_remove("vcc/a%u", tty->index + 1); | ||
496 | class_device_destroy(vc_class, MKDEV(VCS_MAJOR, tty->index + 1)); | 486 | class_device_destroy(vc_class, MKDEV(VCS_MAJOR, tty->index + 1)); |
497 | class_device_destroy(vc_class, MKDEV(VCS_MAJOR, tty->index + 129)); | 487 | class_device_destroy(vc_class, MKDEV(VCS_MAJOR, tty->index + 129)); |
498 | } | 488 | } |
@@ -503,8 +493,6 @@ int __init vcs_init(void) | |||
503 | panic("unable to get major %d for vcs device", VCS_MAJOR); | 493 | panic("unable to get major %d for vcs device", VCS_MAJOR); |
504 | vc_class = class_create(THIS_MODULE, "vc"); | 494 | vc_class = class_create(THIS_MODULE, "vc"); |
505 | 495 | ||
506 | devfs_mk_cdev(MKDEV(VCS_MAJOR, 0), S_IFCHR|S_IRUSR|S_IWUSR, "vcc/0"); | ||
507 | devfs_mk_cdev(MKDEV(VCS_MAJOR, 128), S_IFCHR|S_IRUSR|S_IWUSR, "vcc/a0"); | ||
508 | class_device_create(vc_class, NULL, MKDEV(VCS_MAJOR, 0), NULL, "vcs"); | 496 | class_device_create(vc_class, NULL, MKDEV(VCS_MAJOR, 0), NULL, "vcs"); |
509 | class_device_create(vc_class, NULL, MKDEV(VCS_MAJOR, 128), NULL, "vcsa"); | 497 | class_device_create(vc_class, NULL, MKDEV(VCS_MAJOR, 128), NULL, "vcsa"); |
510 | return 0; | 498 | return 0; |
diff --git a/drivers/char/viocons.c b/drivers/char/viocons.c index 4e5360388748..766f7864c6c6 100644 --- a/drivers/char/viocons.c +++ b/drivers/char/viocons.c | |||
@@ -25,7 +25,6 @@ | |||
25 | * along with this program; if not, write to the Free Software Foundation, | 25 | * along with this program; if not, write to the Free Software Foundation, |
26 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 26 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
27 | */ | 27 | */ |
28 | #include <linux/config.h> | ||
29 | #include <linux/kernel.h> | 28 | #include <linux/kernel.h> |
30 | #include <linux/proc_fs.h> | 29 | #include <linux/proc_fs.h> |
31 | #include <linux/errno.h> | 30 | #include <linux/errno.h> |
@@ -1152,7 +1151,6 @@ static int __init viocons_init2(void) | |||
1152 | viotty_driver = alloc_tty_driver(VTTY_PORTS); | 1151 | viotty_driver = alloc_tty_driver(VTTY_PORTS); |
1153 | viotty_driver->owner = THIS_MODULE; | 1152 | viotty_driver->owner = THIS_MODULE; |
1154 | viotty_driver->driver_name = "vioconsole"; | 1153 | viotty_driver->driver_name = "vioconsole"; |
1155 | viotty_driver->devfs_name = "vcs/"; | ||
1156 | viotty_driver->name = "tty"; | 1154 | viotty_driver->name = "tty"; |
1157 | viotty_driver->name_base = 1; | 1155 | viotty_driver->name_base = 1; |
1158 | viotty_driver->major = TTY_MAJOR; | 1156 | viotty_driver->major = TTY_MAJOR; |
diff --git a/drivers/char/viotape.c b/drivers/char/viotape.c index 60aabdb4a046..b72b2049aaae 100644 --- a/drivers/char/viotape.c +++ b/drivers/char/viotape.c | |||
@@ -31,7 +31,6 @@ | |||
31 | * the OS/400 partition. The format of the messages is defined in | 31 | * the OS/400 partition. The format of the messages is defined in |
32 | * iseries/vio.h | 32 | * iseries/vio.h |
33 | */ | 33 | */ |
34 | #include <linux/config.h> | ||
35 | #include <linux/module.h> | 34 | #include <linux/module.h> |
36 | #include <linux/kernel.h> | 35 | #include <linux/kernel.h> |
37 | #include <linux/errno.h> | 36 | #include <linux/errno.h> |
@@ -43,7 +42,6 @@ | |||
43 | #include <linux/dma-mapping.h> | 42 | #include <linux/dma-mapping.h> |
44 | #include <linux/fs.h> | 43 | #include <linux/fs.h> |
45 | #include <linux/cdev.h> | 44 | #include <linux/cdev.h> |
46 | #include <linux/devfs_fs_kernel.h> | ||
47 | #include <linux/major.h> | 45 | #include <linux/major.h> |
48 | #include <linux/completion.h> | 46 | #include <linux/completion.h> |
49 | #include <linux/proc_fs.h> | 47 | #include <linux/proc_fs.h> |
@@ -246,7 +244,6 @@ static struct device *tape_device[VIOTAPE_MAX_TAPE]; | |||
246 | */ | 244 | */ |
247 | static struct { | 245 | static struct { |
248 | unsigned char cur_part; | 246 | unsigned char cur_part; |
249 | int dev_handle; | ||
250 | unsigned char part_stat_rwi[MAX_PARTITIONS]; | 247 | unsigned char part_stat_rwi[MAX_PARTITIONS]; |
251 | } state[VIOTAPE_MAX_TAPE]; | 248 | } state[VIOTAPE_MAX_TAPE]; |
252 | 249 | ||
@@ -295,7 +292,7 @@ static int proc_viotape_open(struct inode *inode, struct file *file) | |||
295 | return single_open(file, proc_viotape_show, NULL); | 292 | return single_open(file, proc_viotape_show, NULL); |
296 | } | 293 | } |
297 | 294 | ||
298 | static struct file_operations proc_viotape_operations = { | 295 | static const struct file_operations proc_viotape_operations = { |
299 | .open = proc_viotape_open, | 296 | .open = proc_viotape_open, |
300 | .read = seq_read, | 297 | .read = seq_read, |
301 | .llseek = seq_lseek, | 298 | .llseek = seq_lseek, |
@@ -959,12 +956,7 @@ static int viotape_probe(struct vio_dev *vdev, const struct vio_device_id *id) | |||
959 | "iseries!vt%d", i); | 956 | "iseries!vt%d", i); |
960 | class_device_create(tape_class, NULL, MKDEV(VIOTAPE_MAJOR, i | 0x80), | 957 | class_device_create(tape_class, NULL, MKDEV(VIOTAPE_MAJOR, i | 0x80), |
961 | NULL, "iseries!nvt%d", i); | 958 | NULL, "iseries!nvt%d", i); |
962 | devfs_mk_cdev(MKDEV(VIOTAPE_MAJOR, i), S_IFCHR | S_IRUSR | S_IWUSR, | ||
963 | "iseries/vt%d", i); | ||
964 | devfs_mk_cdev(MKDEV(VIOTAPE_MAJOR, i | 0x80), | ||
965 | S_IFCHR | S_IRUSR | S_IWUSR, "iseries/nvt%d", i); | ||
966 | sprintf(tapename, "iseries/vt%d", i); | 959 | sprintf(tapename, "iseries/vt%d", i); |
967 | state[i].dev_handle = devfs_register_tape(tapename); | ||
968 | printk(VIOTAPE_KERN_INFO "tape %s is iSeries " | 960 | printk(VIOTAPE_KERN_INFO "tape %s is iSeries " |
969 | "resource %10.10s type %4.4s, model %3.3s\n", | 961 | "resource %10.10s type %4.4s, model %3.3s\n", |
970 | tapename, viotape_unitinfo[i].rsrcname, | 962 | tapename, viotape_unitinfo[i].rsrcname, |
@@ -976,9 +968,6 @@ static int viotape_remove(struct vio_dev *vdev) | |||
976 | { | 968 | { |
977 | int i = vdev->unit_address; | 969 | int i = vdev->unit_address; |
978 | 970 | ||
979 | devfs_remove("iseries/nvt%d", i); | ||
980 | devfs_remove("iseries/vt%d", i); | ||
981 | devfs_unregister_tape(state[i].dev_handle); | ||
982 | class_device_destroy(tape_class, MKDEV(VIOTAPE_MAJOR, i | 0x80)); | 971 | class_device_destroy(tape_class, MKDEV(VIOTAPE_MAJOR, i | 0x80)); |
983 | class_device_destroy(tape_class, MKDEV(VIOTAPE_MAJOR, i)); | 972 | class_device_destroy(tape_class, MKDEV(VIOTAPE_MAJOR, i)); |
984 | return 0; | 973 | return 0; |
@@ -989,7 +978,7 @@ static int viotape_remove(struct vio_dev *vdev) | |||
989 | * support. | 978 | * support. |
990 | */ | 979 | */ |
991 | static struct vio_device_id viotape_device_table[] __devinitdata = { | 980 | static struct vio_device_id viotape_device_table[] __devinitdata = { |
992 | { "viotape", "" }, | 981 | { "byte", "IBM,iSeries-viotape" }, |
993 | { "", "" } | 982 | { "", "" } |
994 | }; | 983 | }; |
995 | MODULE_DEVICE_TABLE(vio, viotape_device_table); | 984 | MODULE_DEVICE_TABLE(vio, viotape_device_table); |
diff --git a/drivers/char/vme_scc.c b/drivers/char/vme_scc.c index fd00822ac145..bfe5ea948f6a 100644 --- a/drivers/char/vme_scc.c +++ b/drivers/char/vme_scc.c | |||
@@ -14,7 +14,6 @@ | |||
14 | */ | 14 | */ |
15 | 15 | ||
16 | #include <linux/module.h> | 16 | #include <linux/module.h> |
17 | #include <linux/config.h> | ||
18 | #include <linux/kdev_t.h> | 17 | #include <linux/kdev_t.h> |
19 | #include <asm/io.h> | 18 | #include <asm/io.h> |
20 | #include <linux/kernel.h> | 19 | #include <linux/kernel.h> |
@@ -147,7 +146,6 @@ static int scc_init_drivers(void) | |||
147 | scc_driver->owner = THIS_MODULE; | 146 | scc_driver->owner = THIS_MODULE; |
148 | scc_driver->driver_name = "scc"; | 147 | scc_driver->driver_name = "scc"; |
149 | scc_driver->name = "ttyS"; | 148 | scc_driver->name = "ttyS"; |
150 | scc_driver->devfs_name = "tts/"; | ||
151 | scc_driver->major = TTY_MAJOR; | 149 | scc_driver->major = TTY_MAJOR; |
152 | scc_driver->minor_start = SCC_MINOR_BASE; | 150 | scc_driver->minor_start = SCC_MINOR_BASE; |
153 | scc_driver->type = TTY_DRIVER_TYPE_SERIAL; | 151 | scc_driver->type = TTY_DRIVER_TYPE_SERIAL; |
@@ -205,13 +203,13 @@ static int mvme147_scc_init(void) | |||
205 | port->datap = port->ctrlp + 1; | 203 | port->datap = port->ctrlp + 1; |
206 | port->port_a = &scc_ports[0]; | 204 | port->port_a = &scc_ports[0]; |
207 | port->port_b = &scc_ports[1]; | 205 | port->port_b = &scc_ports[1]; |
208 | request_irq(MVME147_IRQ_SCCA_TX, scc_tx_int, SA_INTERRUPT, | 206 | request_irq(MVME147_IRQ_SCCA_TX, scc_tx_int, IRQF_DISABLED, |
209 | "SCC-A TX", port); | 207 | "SCC-A TX", port); |
210 | request_irq(MVME147_IRQ_SCCA_STAT, scc_stat_int, SA_INTERRUPT, | 208 | request_irq(MVME147_IRQ_SCCA_STAT, scc_stat_int, IRQF_DISABLED, |
211 | "SCC-A status", port); | 209 | "SCC-A status", port); |
212 | request_irq(MVME147_IRQ_SCCA_RX, scc_rx_int, SA_INTERRUPT, | 210 | request_irq(MVME147_IRQ_SCCA_RX, scc_rx_int, IRQF_DISABLED, |
213 | "SCC-A RX", port); | 211 | "SCC-A RX", port); |
214 | request_irq(MVME147_IRQ_SCCA_SPCOND, scc_spcond_int, SA_INTERRUPT, | 212 | request_irq(MVME147_IRQ_SCCA_SPCOND, scc_spcond_int, IRQF_DISABLED, |
215 | "SCC-A special cond", port); | 213 | "SCC-A special cond", port); |
216 | { | 214 | { |
217 | SCC_ACCESS_INIT(port); | 215 | SCC_ACCESS_INIT(port); |
@@ -232,13 +230,13 @@ static int mvme147_scc_init(void) | |||
232 | port->datap = port->ctrlp + 1; | 230 | port->datap = port->ctrlp + 1; |
233 | port->port_a = &scc_ports[0]; | 231 | port->port_a = &scc_ports[0]; |
234 | port->port_b = &scc_ports[1]; | 232 | port->port_b = &scc_ports[1]; |
235 | request_irq(MVME147_IRQ_SCCB_TX, scc_tx_int, SA_INTERRUPT, | 233 | request_irq(MVME147_IRQ_SCCB_TX, scc_tx_int, IRQF_DISABLED, |
236 | "SCC-B TX", port); | 234 | "SCC-B TX", port); |
237 | request_irq(MVME147_IRQ_SCCB_STAT, scc_stat_int, SA_INTERRUPT, | 235 | request_irq(MVME147_IRQ_SCCB_STAT, scc_stat_int, IRQF_DISABLED, |
238 | "SCC-B status", port); | 236 | "SCC-B status", port); |
239 | request_irq(MVME147_IRQ_SCCB_RX, scc_rx_int, SA_INTERRUPT, | 237 | request_irq(MVME147_IRQ_SCCB_RX, scc_rx_int, IRQF_DISABLED, |
240 | "SCC-B RX", port); | 238 | "SCC-B RX", port); |
241 | request_irq(MVME147_IRQ_SCCB_SPCOND, scc_spcond_int, SA_INTERRUPT, | 239 | request_irq(MVME147_IRQ_SCCB_SPCOND, scc_spcond_int, IRQF_DISABLED, |
242 | "SCC-B special cond", port); | 240 | "SCC-B special cond", port); |
243 | { | 241 | { |
244 | SCC_ACCESS_INIT(port); | 242 | SCC_ACCESS_INIT(port); |
@@ -275,13 +273,13 @@ static int mvme162_scc_init(void) | |||
275 | port->datap = port->ctrlp + 2; | 273 | port->datap = port->ctrlp + 2; |
276 | port->port_a = &scc_ports[0]; | 274 | port->port_a = &scc_ports[0]; |
277 | port->port_b = &scc_ports[1]; | 275 | port->port_b = &scc_ports[1]; |
278 | request_irq(MVME162_IRQ_SCCA_TX, scc_tx_int, SA_INTERRUPT, | 276 | request_irq(MVME162_IRQ_SCCA_TX, scc_tx_int, IRQF_DISABLED, |
279 | "SCC-A TX", port); | 277 | "SCC-A TX", port); |
280 | request_irq(MVME162_IRQ_SCCA_STAT, scc_stat_int, SA_INTERRUPT, | 278 | request_irq(MVME162_IRQ_SCCA_STAT, scc_stat_int, IRQF_DISABLED, |
281 | "SCC-A status", port); | 279 | "SCC-A status", port); |
282 | request_irq(MVME162_IRQ_SCCA_RX, scc_rx_int, SA_INTERRUPT, | 280 | request_irq(MVME162_IRQ_SCCA_RX, scc_rx_int, IRQF_DISABLED, |
283 | "SCC-A RX", port); | 281 | "SCC-A RX", port); |
284 | request_irq(MVME162_IRQ_SCCA_SPCOND, scc_spcond_int, SA_INTERRUPT, | 282 | request_irq(MVME162_IRQ_SCCA_SPCOND, scc_spcond_int, IRQF_DISABLED, |
285 | "SCC-A special cond", port); | 283 | "SCC-A special cond", port); |
286 | { | 284 | { |
287 | SCC_ACCESS_INIT(port); | 285 | SCC_ACCESS_INIT(port); |
@@ -302,13 +300,13 @@ static int mvme162_scc_init(void) | |||
302 | port->datap = port->ctrlp + 2; | 300 | port->datap = port->ctrlp + 2; |
303 | port->port_a = &scc_ports[0]; | 301 | port->port_a = &scc_ports[0]; |
304 | port->port_b = &scc_ports[1]; | 302 | port->port_b = &scc_ports[1]; |
305 | request_irq(MVME162_IRQ_SCCB_TX, scc_tx_int, SA_INTERRUPT, | 303 | request_irq(MVME162_IRQ_SCCB_TX, scc_tx_int, IRQF_DISABLED, |
306 | "SCC-B TX", port); | 304 | "SCC-B TX", port); |
307 | request_irq(MVME162_IRQ_SCCB_STAT, scc_stat_int, SA_INTERRUPT, | 305 | request_irq(MVME162_IRQ_SCCB_STAT, scc_stat_int, IRQF_DISABLED, |
308 | "SCC-B status", port); | 306 | "SCC-B status", port); |
309 | request_irq(MVME162_IRQ_SCCB_RX, scc_rx_int, SA_INTERRUPT, | 307 | request_irq(MVME162_IRQ_SCCB_RX, scc_rx_int, IRQF_DISABLED, |
310 | "SCC-B RX", port); | 308 | "SCC-B RX", port); |
311 | request_irq(MVME162_IRQ_SCCB_SPCOND, scc_spcond_int, SA_INTERRUPT, | 309 | request_irq(MVME162_IRQ_SCCB_SPCOND, scc_spcond_int, IRQF_DISABLED, |
312 | "SCC-B special cond", port); | 310 | "SCC-B special cond", port); |
313 | 311 | ||
314 | { | 312 | { |
@@ -343,13 +341,13 @@ static int bvme6000_scc_init(void) | |||
343 | port->datap = port->ctrlp + 4; | 341 | port->datap = port->ctrlp + 4; |
344 | port->port_a = &scc_ports[0]; | 342 | port->port_a = &scc_ports[0]; |
345 | port->port_b = &scc_ports[1]; | 343 | port->port_b = &scc_ports[1]; |
346 | request_irq(BVME_IRQ_SCCA_TX, scc_tx_int, SA_INTERRUPT, | 344 | request_irq(BVME_IRQ_SCCA_TX, scc_tx_int, IRQF_DISABLED, |
347 | "SCC-A TX", port); | 345 | "SCC-A TX", port); |
348 | request_irq(BVME_IRQ_SCCA_STAT, scc_stat_int, SA_INTERRUPT, | 346 | request_irq(BVME_IRQ_SCCA_STAT, scc_stat_int, IRQF_DISABLED, |
349 | "SCC-A status", port); | 347 | "SCC-A status", port); |
350 | request_irq(BVME_IRQ_SCCA_RX, scc_rx_int, SA_INTERRUPT, | 348 | request_irq(BVME_IRQ_SCCA_RX, scc_rx_int, IRQF_DISABLED, |
351 | "SCC-A RX", port); | 349 | "SCC-A RX", port); |
352 | request_irq(BVME_IRQ_SCCA_SPCOND, scc_spcond_int, SA_INTERRUPT, | 350 | request_irq(BVME_IRQ_SCCA_SPCOND, scc_spcond_int, IRQF_DISABLED, |
353 | "SCC-A special cond", port); | 351 | "SCC-A special cond", port); |
354 | { | 352 | { |
355 | SCC_ACCESS_INIT(port); | 353 | SCC_ACCESS_INIT(port); |
@@ -370,13 +368,13 @@ static int bvme6000_scc_init(void) | |||
370 | port->datap = port->ctrlp + 4; | 368 | port->datap = port->ctrlp + 4; |
371 | port->port_a = &scc_ports[0]; | 369 | port->port_a = &scc_ports[0]; |
372 | port->port_b = &scc_ports[1]; | 370 | port->port_b = &scc_ports[1]; |
373 | request_irq(BVME_IRQ_SCCB_TX, scc_tx_int, SA_INTERRUPT, | 371 | request_irq(BVME_IRQ_SCCB_TX, scc_tx_int, IRQF_DISABLED, |
374 | "SCC-B TX", port); | 372 | "SCC-B TX", port); |
375 | request_irq(BVME_IRQ_SCCB_STAT, scc_stat_int, SA_INTERRUPT, | 373 | request_irq(BVME_IRQ_SCCB_STAT, scc_stat_int, IRQF_DISABLED, |
376 | "SCC-B status", port); | 374 | "SCC-B status", port); |
377 | request_irq(BVME_IRQ_SCCB_RX, scc_rx_int, SA_INTERRUPT, | 375 | request_irq(BVME_IRQ_SCCB_RX, scc_rx_int, IRQF_DISABLED, |
378 | "SCC-B RX", port); | 376 | "SCC-B RX", port); |
379 | request_irq(BVME_IRQ_SCCB_SPCOND, scc_spcond_int, SA_INTERRUPT, | 377 | request_irq(BVME_IRQ_SCCB_SPCOND, scc_spcond_int, IRQF_DISABLED, |
380 | "SCC-B special cond", port); | 378 | "SCC-B special cond", port); |
381 | 379 | ||
382 | { | 380 | { |
diff --git a/drivers/char/vr41xx_giu.c b/drivers/char/vr41xx_giu.c index 05e6e814d86f..1b9b1f1d4c49 100644 --- a/drivers/char/vr41xx_giu.c +++ b/drivers/char/vr41xx_giu.c | |||
@@ -605,7 +605,7 @@ static int gpio_release(struct inode *inode, struct file *file) | |||
605 | return 0; | 605 | return 0; |
606 | } | 606 | } |
607 | 607 | ||
608 | static struct file_operations gpio_fops = { | 608 | static const struct file_operations gpio_fops = { |
609 | .owner = THIS_MODULE, | 609 | .owner = THIS_MODULE, |
610 | .read = gpio_read, | 610 | .read = gpio_read, |
611 | .write = gpio_write, | 611 | .write = gpio_write, |
@@ -689,9 +689,9 @@ static int __devinit giu_probe(struct platform_device *dev) | |||
689 | 689 | ||
690 | for (i = GIU_IRQ_BASE; i <= GIU_IRQ_LAST; i++) { | 690 | for (i = GIU_IRQ_BASE; i <= GIU_IRQ_LAST; i++) { |
691 | if (i < GIU_IRQ(GIUINT_HIGH_OFFSET)) | 691 | if (i < GIU_IRQ(GIUINT_HIGH_OFFSET)) |
692 | irq_desc[i].handler = &giuint_low_irq_type; | 692 | irq_desc[i].chip = &giuint_low_irq_type; |
693 | else | 693 | else |
694 | irq_desc[i].handler = &giuint_high_irq_type; | 694 | irq_desc[i].chip = &giuint_high_irq_type; |
695 | } | 695 | } |
696 | 696 | ||
697 | return cascade_irq(GIUINT_IRQ, giu_get_irq); | 697 | return cascade_irq(GIUINT_IRQ, giu_get_irq); |
diff --git a/drivers/char/vt.c b/drivers/char/vt.c index 6c94879e0b99..da7e66a2a38b 100644 --- a/drivers/char/vt.c +++ b/drivers/char/vt.c | |||
@@ -79,7 +79,6 @@ | |||
79 | #include <linux/mm.h> | 79 | #include <linux/mm.h> |
80 | #include <linux/console.h> | 80 | #include <linux/console.h> |
81 | #include <linux/init.h> | 81 | #include <linux/init.h> |
82 | #include <linux/devfs_fs_kernel.h> | ||
83 | #include <linux/vt_kern.h> | 82 | #include <linux/vt_kern.h> |
84 | #include <linux/selection.h> | 83 | #include <linux/selection.h> |
85 | #include <linux/tiocl.h> | 84 | #include <linux/tiocl.h> |
@@ -87,7 +86,6 @@ | |||
87 | #include <linux/consolemap.h> | 86 | #include <linux/consolemap.h> |
88 | #include <linux/timer.h> | 87 | #include <linux/timer.h> |
89 | #include <linux/interrupt.h> | 88 | #include <linux/interrupt.h> |
90 | #include <linux/config.h> | ||
91 | #include <linux/workqueue.h> | 89 | #include <linux/workqueue.h> |
92 | #include <linux/bootmem.h> | 90 | #include <linux/bootmem.h> |
93 | #include <linux/pm.h> | 91 | #include <linux/pm.h> |
@@ -98,7 +96,22 @@ | |||
98 | #include <asm/system.h> | 96 | #include <asm/system.h> |
99 | #include <asm/uaccess.h> | 97 | #include <asm/uaccess.h> |
100 | 98 | ||
99 | #define MAX_NR_CON_DRIVER 16 | ||
101 | 100 | ||
101 | #define CON_DRIVER_FLAG_MODULE 1 | ||
102 | #define CON_DRIVER_FLAG_INIT 2 | ||
103 | |||
104 | struct con_driver { | ||
105 | const struct consw *con; | ||
106 | const char *desc; | ||
107 | struct class_device *class_dev; | ||
108 | int node; | ||
109 | int first; | ||
110 | int last; | ||
111 | int flag; | ||
112 | }; | ||
113 | |||
114 | static struct con_driver registered_con_driver[MAX_NR_CON_DRIVER]; | ||
102 | const struct consw *conswitchp; | 115 | const struct consw *conswitchp; |
103 | 116 | ||
104 | /* A bitmap for codes <32. A bit of 1 indicates that the code | 117 | /* A bitmap for codes <32. A bit of 1 indicates that the code |
@@ -873,6 +886,7 @@ void vc_disallocate(unsigned int currcons) | |||
873 | if (vc_cons_allocated(currcons)) { | 886 | if (vc_cons_allocated(currcons)) { |
874 | struct vc_data *vc = vc_cons[currcons].d; | 887 | struct vc_data *vc = vc_cons[currcons].d; |
875 | vc->vc_sw->con_deinit(vc); | 888 | vc->vc_sw->con_deinit(vc); |
889 | module_put(vc->vc_sw->owner); | ||
876 | if (vc->vc_kmalloced) | 890 | if (vc->vc_kmalloced) |
877 | kfree(vc->vc_screenbuf); | 891 | kfree(vc->vc_screenbuf); |
878 | if (currcons >= MIN_NR_CONSOLES) | 892 | if (currcons >= MIN_NR_CONSOLES) |
@@ -2557,7 +2571,7 @@ static int __init con_init(void) | |||
2557 | { | 2571 | { |
2558 | const char *display_desc = NULL; | 2572 | const char *display_desc = NULL; |
2559 | struct vc_data *vc; | 2573 | struct vc_data *vc; |
2560 | unsigned int currcons = 0; | 2574 | unsigned int currcons = 0, i; |
2561 | 2575 | ||
2562 | acquire_console_sem(); | 2576 | acquire_console_sem(); |
2563 | 2577 | ||
@@ -2569,6 +2583,22 @@ static int __init con_init(void) | |||
2569 | return 0; | 2583 | return 0; |
2570 | } | 2584 | } |
2571 | 2585 | ||
2586 | for (i = 0; i < MAX_NR_CON_DRIVER; i++) { | ||
2587 | struct con_driver *con_driver = ®istered_con_driver[i]; | ||
2588 | |||
2589 | if (con_driver->con == NULL) { | ||
2590 | con_driver->con = conswitchp; | ||
2591 | con_driver->desc = display_desc; | ||
2592 | con_driver->flag = CON_DRIVER_FLAG_INIT; | ||
2593 | con_driver->first = 0; | ||
2594 | con_driver->last = MAX_NR_CONSOLES - 1; | ||
2595 | break; | ||
2596 | } | ||
2597 | } | ||
2598 | |||
2599 | for (i = 0; i < MAX_NR_CONSOLES; i++) | ||
2600 | con_driver_map[i] = conswitchp; | ||
2601 | |||
2572 | init_timer(&console_timer); | 2602 | init_timer(&console_timer); |
2573 | console_timer.function = blank_screen_t; | 2603 | console_timer.function = blank_screen_t; |
2574 | if (blankinterval) { | 2604 | if (blankinterval) { |
@@ -2632,7 +2662,6 @@ int __init vty_init(void) | |||
2632 | if (!console_driver) | 2662 | if (!console_driver) |
2633 | panic("Couldn't allocate console driver\n"); | 2663 | panic("Couldn't allocate console driver\n"); |
2634 | console_driver->owner = THIS_MODULE; | 2664 | console_driver->owner = THIS_MODULE; |
2635 | console_driver->devfs_name = "vc/"; | ||
2636 | console_driver->name = "tty"; | 2665 | console_driver->name = "tty"; |
2637 | console_driver->name_base = 1; | 2666 | console_driver->name_base = 1; |
2638 | console_driver->major = TTY_MAJOR; | 2667 | console_driver->major = TTY_MAJOR; |
@@ -2656,38 +2685,53 @@ int __init vty_init(void) | |||
2656 | } | 2685 | } |
2657 | 2686 | ||
2658 | #ifndef VT_SINGLE_DRIVER | 2687 | #ifndef VT_SINGLE_DRIVER |
2688 | #include <linux/device.h> | ||
2659 | 2689 | ||
2660 | /* | 2690 | static struct class *vtconsole_class; |
2661 | * If we support more console drivers, this function is used | ||
2662 | * when a driver wants to take over some existing consoles | ||
2663 | * and become default driver for newly opened ones. | ||
2664 | */ | ||
2665 | 2691 | ||
2666 | int take_over_console(const struct consw *csw, int first, int last, int deflt) | 2692 | static int bind_con_driver(const struct consw *csw, int first, int last, |
2693 | int deflt) | ||
2667 | { | 2694 | { |
2668 | int i, j = -1; | 2695 | struct module *owner = csw->owner; |
2669 | const char *desc; | 2696 | const char *desc = NULL; |
2670 | struct module *owner; | 2697 | struct con_driver *con_driver; |
2698 | int i, j = -1, k = -1, retval = -ENODEV; | ||
2671 | 2699 | ||
2672 | owner = csw->owner; | ||
2673 | if (!try_module_get(owner)) | 2700 | if (!try_module_get(owner)) |
2674 | return -ENODEV; | 2701 | return -ENODEV; |
2675 | 2702 | ||
2676 | acquire_console_sem(); | 2703 | acquire_console_sem(); |
2677 | 2704 | ||
2678 | desc = csw->con_startup(); | 2705 | /* check if driver is registered */ |
2679 | if (!desc) { | 2706 | for (i = 0; i < MAX_NR_CON_DRIVER; i++) { |
2680 | release_console_sem(); | 2707 | con_driver = ®istered_con_driver[i]; |
2681 | module_put(owner); | 2708 | |
2682 | return -ENODEV; | 2709 | if (con_driver->con == csw) { |
2710 | desc = con_driver->desc; | ||
2711 | retval = 0; | ||
2712 | break; | ||
2713 | } | ||
2683 | } | 2714 | } |
2715 | |||
2716 | if (retval) | ||
2717 | goto err; | ||
2718 | |||
2719 | if (!(con_driver->flag & CON_DRIVER_FLAG_INIT)) { | ||
2720 | csw->con_startup(); | ||
2721 | con_driver->flag |= CON_DRIVER_FLAG_INIT; | ||
2722 | } | ||
2723 | |||
2684 | if (deflt) { | 2724 | if (deflt) { |
2685 | if (conswitchp) | 2725 | if (conswitchp) |
2686 | module_put(conswitchp->owner); | 2726 | module_put(conswitchp->owner); |
2727 | |||
2687 | __module_get(owner); | 2728 | __module_get(owner); |
2688 | conswitchp = csw; | 2729 | conswitchp = csw; |
2689 | } | 2730 | } |
2690 | 2731 | ||
2732 | first = max(first, con_driver->first); | ||
2733 | last = min(last, con_driver->last); | ||
2734 | |||
2691 | for (i = first; i <= last; i++) { | 2735 | for (i = first; i <= last; i++) { |
2692 | int old_was_color; | 2736 | int old_was_color; |
2693 | struct vc_data *vc = vc_cons[i].d; | 2737 | struct vc_data *vc = vc_cons[i].d; |
@@ -2701,15 +2745,17 @@ int take_over_console(const struct consw *csw, int first, int last, int deflt) | |||
2701 | continue; | 2745 | continue; |
2702 | 2746 | ||
2703 | j = i; | 2747 | j = i; |
2704 | if (CON_IS_VISIBLE(vc)) | 2748 | |
2749 | if (CON_IS_VISIBLE(vc)) { | ||
2750 | k = i; | ||
2705 | save_screen(vc); | 2751 | save_screen(vc); |
2752 | } | ||
2753 | |||
2706 | old_was_color = vc->vc_can_do_color; | 2754 | old_was_color = vc->vc_can_do_color; |
2707 | vc->vc_sw->con_deinit(vc); | 2755 | vc->vc_sw->con_deinit(vc); |
2708 | vc->vc_origin = (unsigned long)vc->vc_screenbuf; | 2756 | vc->vc_origin = (unsigned long)vc->vc_screenbuf; |
2709 | vc->vc_visible_origin = vc->vc_origin; | ||
2710 | vc->vc_scr_end = vc->vc_origin + vc->vc_screenbuf_size; | ||
2711 | vc->vc_pos = vc->vc_origin + vc->vc_size_row * vc->vc_y + 2 * vc->vc_x; | ||
2712 | visual_init(vc, i, 0); | 2757 | visual_init(vc, i, 0); |
2758 | set_origin(vc); | ||
2713 | update_attr(vc); | 2759 | update_attr(vc); |
2714 | 2760 | ||
2715 | /* If the console changed between mono <-> color, then | 2761 | /* If the console changed between mono <-> color, then |
@@ -2718,36 +2764,506 @@ int take_over_console(const struct consw *csw, int first, int last, int deflt) | |||
2718 | */ | 2764 | */ |
2719 | if (old_was_color != vc->vc_can_do_color) | 2765 | if (old_was_color != vc->vc_can_do_color) |
2720 | clear_buffer_attributes(vc); | 2766 | clear_buffer_attributes(vc); |
2721 | |||
2722 | if (CON_IS_VISIBLE(vc)) | ||
2723 | update_screen(vc); | ||
2724 | } | 2767 | } |
2768 | |||
2725 | printk("Console: switching "); | 2769 | printk("Console: switching "); |
2726 | if (!deflt) | 2770 | if (!deflt) |
2727 | printk("consoles %d-%d ", first+1, last+1); | 2771 | printk("consoles %d-%d ", first+1, last+1); |
2728 | if (j >= 0) | 2772 | if (j >= 0) { |
2773 | struct vc_data *vc = vc_cons[j].d; | ||
2774 | |||
2729 | printk("to %s %s %dx%d\n", | 2775 | printk("to %s %s %dx%d\n", |
2730 | vc_cons[j].d->vc_can_do_color ? "colour" : "mono", | 2776 | vc->vc_can_do_color ? "colour" : "mono", |
2731 | desc, vc_cons[j].d->vc_cols, vc_cons[j].d->vc_rows); | 2777 | desc, vc->vc_cols, vc->vc_rows); |
2732 | else | 2778 | |
2779 | if (k >= 0) { | ||
2780 | vc = vc_cons[k].d; | ||
2781 | update_screen(vc); | ||
2782 | } | ||
2783 | } else | ||
2733 | printk("to %s\n", desc); | 2784 | printk("to %s\n", desc); |
2734 | 2785 | ||
2786 | retval = 0; | ||
2787 | err: | ||
2735 | release_console_sem(); | 2788 | release_console_sem(); |
2789 | module_put(owner); | ||
2790 | return retval; | ||
2791 | }; | ||
2792 | |||
2793 | #ifdef CONFIG_VT_HW_CONSOLE_BINDING | ||
2794 | static int con_is_graphics(const struct consw *csw, int first, int last) | ||
2795 | { | ||
2796 | int i, retval = 0; | ||
2736 | 2797 | ||
2798 | for (i = first; i <= last; i++) { | ||
2799 | struct vc_data *vc = vc_cons[i].d; | ||
2800 | |||
2801 | if (vc && vc->vc_mode == KD_GRAPHICS) { | ||
2802 | retval = 1; | ||
2803 | break; | ||
2804 | } | ||
2805 | } | ||
2806 | |||
2807 | return retval; | ||
2808 | } | ||
2809 | |||
2810 | static int unbind_con_driver(const struct consw *csw, int first, int last, | ||
2811 | int deflt) | ||
2812 | { | ||
2813 | struct module *owner = csw->owner; | ||
2814 | const struct consw *defcsw = NULL; | ||
2815 | struct con_driver *con_driver = NULL, *con_back = NULL; | ||
2816 | int i, retval = -ENODEV; | ||
2817 | |||
2818 | if (!try_module_get(owner)) | ||
2819 | return -ENODEV; | ||
2820 | |||
2821 | acquire_console_sem(); | ||
2822 | |||
2823 | /* check if driver is registered and if it is unbindable */ | ||
2824 | for (i = 0; i < MAX_NR_CON_DRIVER; i++) { | ||
2825 | con_driver = ®istered_con_driver[i]; | ||
2826 | |||
2827 | if (con_driver->con == csw && | ||
2828 | con_driver->flag & CON_DRIVER_FLAG_MODULE) { | ||
2829 | retval = 0; | ||
2830 | break; | ||
2831 | } | ||
2832 | } | ||
2833 | |||
2834 | if (retval) { | ||
2835 | release_console_sem(); | ||
2836 | goto err; | ||
2837 | } | ||
2838 | |||
2839 | retval = -ENODEV; | ||
2840 | |||
2841 | /* check if backup driver exists */ | ||
2842 | for (i = 0; i < MAX_NR_CON_DRIVER; i++) { | ||
2843 | con_back = ®istered_con_driver[i]; | ||
2844 | |||
2845 | if (con_back->con && | ||
2846 | !(con_back->flag & CON_DRIVER_FLAG_MODULE)) { | ||
2847 | defcsw = con_back->con; | ||
2848 | retval = 0; | ||
2849 | break; | ||
2850 | } | ||
2851 | } | ||
2852 | |||
2853 | if (retval) { | ||
2854 | release_console_sem(); | ||
2855 | goto err; | ||
2856 | } | ||
2857 | |||
2858 | if (!con_is_bound(csw)) { | ||
2859 | release_console_sem(); | ||
2860 | goto err; | ||
2861 | } | ||
2862 | |||
2863 | first = max(first, con_driver->first); | ||
2864 | last = min(last, con_driver->last); | ||
2865 | |||
2866 | for (i = first; i <= last; i++) { | ||
2867 | if (con_driver_map[i] == csw) { | ||
2868 | module_put(csw->owner); | ||
2869 | con_driver_map[i] = NULL; | ||
2870 | } | ||
2871 | } | ||
2872 | |||
2873 | if (!con_is_bound(defcsw)) { | ||
2874 | const struct consw *defconsw = conswitchp; | ||
2875 | |||
2876 | defcsw->con_startup(); | ||
2877 | con_back->flag |= CON_DRIVER_FLAG_INIT; | ||
2878 | /* | ||
2879 | * vgacon may change the default driver to point | ||
2880 | * to dummycon, we restore it here... | ||
2881 | */ | ||
2882 | conswitchp = defconsw; | ||
2883 | } | ||
2884 | |||
2885 | if (!con_is_bound(csw)) | ||
2886 | con_driver->flag &= ~CON_DRIVER_FLAG_INIT; | ||
2887 | |||
2888 | release_console_sem(); | ||
2889 | /* ignore return value, binding should not fail */ | ||
2890 | bind_con_driver(defcsw, first, last, deflt); | ||
2891 | err: | ||
2737 | module_put(owner); | 2892 | module_put(owner); |
2893 | return retval; | ||
2894 | |||
2895 | } | ||
2896 | |||
2897 | static int vt_bind(struct con_driver *con) | ||
2898 | { | ||
2899 | const struct consw *defcsw = NULL, *csw = NULL; | ||
2900 | int i, more = 1, first = -1, last = -1, deflt = 0; | ||
2901 | |||
2902 | if (!con->con || !(con->flag & CON_DRIVER_FLAG_MODULE) || | ||
2903 | con_is_graphics(con->con, con->first, con->last)) | ||
2904 | goto err; | ||
2905 | |||
2906 | csw = con->con; | ||
2907 | |||
2908 | for (i = 0; i < MAX_NR_CON_DRIVER; i++) { | ||
2909 | struct con_driver *con = ®istered_con_driver[i]; | ||
2910 | |||
2911 | if (con->con && !(con->flag & CON_DRIVER_FLAG_MODULE)) { | ||
2912 | defcsw = con->con; | ||
2913 | break; | ||
2914 | } | ||
2915 | } | ||
2916 | |||
2917 | if (!defcsw) | ||
2918 | goto err; | ||
2919 | |||
2920 | while (more) { | ||
2921 | more = 0; | ||
2922 | |||
2923 | for (i = con->first; i <= con->last; i++) { | ||
2924 | if (con_driver_map[i] == defcsw) { | ||
2925 | if (first == -1) | ||
2926 | first = i; | ||
2927 | last = i; | ||
2928 | more = 1; | ||
2929 | } else if (first != -1) | ||
2930 | break; | ||
2931 | } | ||
2932 | |||
2933 | if (first == 0 && last == MAX_NR_CONSOLES -1) | ||
2934 | deflt = 1; | ||
2935 | |||
2936 | if (first != -1) | ||
2937 | bind_con_driver(csw, first, last, deflt); | ||
2938 | |||
2939 | first = -1; | ||
2940 | last = -1; | ||
2941 | deflt = 0; | ||
2942 | } | ||
2943 | |||
2944 | err: | ||
2738 | return 0; | 2945 | return 0; |
2739 | } | 2946 | } |
2740 | 2947 | ||
2741 | void give_up_console(const struct consw *csw) | 2948 | static int vt_unbind(struct con_driver *con) |
2949 | { | ||
2950 | const struct consw *csw = NULL; | ||
2951 | int i, more = 1, first = -1, last = -1, deflt = 0; | ||
2952 | |||
2953 | if (!con->con || !(con->flag & CON_DRIVER_FLAG_MODULE) || | ||
2954 | con_is_graphics(con->con, con->first, con->last)) | ||
2955 | goto err; | ||
2956 | |||
2957 | csw = con->con; | ||
2958 | |||
2959 | while (more) { | ||
2960 | more = 0; | ||
2961 | |||
2962 | for (i = con->first; i <= con->last; i++) { | ||
2963 | if (con_driver_map[i] == csw) { | ||
2964 | if (first == -1) | ||
2965 | first = i; | ||
2966 | last = i; | ||
2967 | more = 1; | ||
2968 | } else if (first != -1) | ||
2969 | break; | ||
2970 | } | ||
2971 | |||
2972 | if (first == 0 && last == MAX_NR_CONSOLES -1) | ||
2973 | deflt = 1; | ||
2974 | |||
2975 | if (first != -1) | ||
2976 | unbind_con_driver(csw, first, last, deflt); | ||
2977 | |||
2978 | first = -1; | ||
2979 | last = -1; | ||
2980 | deflt = 0; | ||
2981 | } | ||
2982 | |||
2983 | err: | ||
2984 | return 0; | ||
2985 | } | ||
2986 | #else | ||
2987 | static inline int vt_bind(struct con_driver *con) | ||
2988 | { | ||
2989 | return 0; | ||
2990 | } | ||
2991 | static inline int vt_unbind(struct con_driver *con) | ||
2992 | { | ||
2993 | return 0; | ||
2994 | } | ||
2995 | #endif /* CONFIG_VT_HW_CONSOLE_BINDING */ | ||
2996 | |||
2997 | static ssize_t store_bind(struct class_device *class_device, | ||
2998 | const char *buf, size_t count) | ||
2999 | { | ||
3000 | struct con_driver *con = class_get_devdata(class_device); | ||
3001 | int bind = simple_strtoul(buf, NULL, 0); | ||
3002 | |||
3003 | if (bind) | ||
3004 | vt_bind(con); | ||
3005 | else | ||
3006 | vt_unbind(con); | ||
3007 | |||
3008 | return count; | ||
3009 | } | ||
3010 | |||
3011 | static ssize_t show_bind(struct class_device *class_device, char *buf) | ||
3012 | { | ||
3013 | struct con_driver *con = class_get_devdata(class_device); | ||
3014 | int bind = con_is_bound(con->con); | ||
3015 | |||
3016 | return snprintf(buf, PAGE_SIZE, "%i\n", bind); | ||
3017 | } | ||
3018 | |||
3019 | static ssize_t show_name(struct class_device *class_device, char *buf) | ||
3020 | { | ||
3021 | struct con_driver *con = class_get_devdata(class_device); | ||
3022 | |||
3023 | return snprintf(buf, PAGE_SIZE, "%s %s\n", | ||
3024 | (con->flag & CON_DRIVER_FLAG_MODULE) ? "(M)" : "(S)", | ||
3025 | con->desc); | ||
3026 | |||
3027 | } | ||
3028 | |||
3029 | static struct class_device_attribute class_device_attrs[] = { | ||
3030 | __ATTR(bind, S_IRUGO|S_IWUSR, show_bind, store_bind), | ||
3031 | __ATTR(name, S_IRUGO, show_name, NULL), | ||
3032 | }; | ||
3033 | |||
3034 | static int vtconsole_init_class_device(struct con_driver *con) | ||
3035 | { | ||
3036 | int i; | ||
3037 | |||
3038 | class_set_devdata(con->class_dev, con); | ||
3039 | for (i = 0; i < ARRAY_SIZE(class_device_attrs); i++) | ||
3040 | class_device_create_file(con->class_dev, | ||
3041 | &class_device_attrs[i]); | ||
3042 | |||
3043 | return 0; | ||
3044 | } | ||
3045 | |||
3046 | static void vtconsole_deinit_class_device(struct con_driver *con) | ||
2742 | { | 3047 | { |
2743 | int i; | 3048 | int i; |
2744 | 3049 | ||
2745 | for(i = 0; i < MAX_NR_CONSOLES; i++) | 3050 | for (i = 0; i < ARRAY_SIZE(class_device_attrs); i++) |
3051 | class_device_remove_file(con->class_dev, | ||
3052 | &class_device_attrs[i]); | ||
3053 | } | ||
3054 | |||
3055 | /** | ||
3056 | * con_is_bound - checks if driver is bound to the console | ||
3057 | * @csw: console driver | ||
3058 | * | ||
3059 | * RETURNS: zero if unbound, nonzero if bound | ||
3060 | * | ||
3061 | * Drivers can call this and if zero, they should release | ||
3062 | * all resources allocated on con_startup() | ||
3063 | */ | ||
3064 | int con_is_bound(const struct consw *csw) | ||
3065 | { | ||
3066 | int i, bound = 0; | ||
3067 | |||
3068 | for (i = 0; i < MAX_NR_CONSOLES; i++) { | ||
2746 | if (con_driver_map[i] == csw) { | 3069 | if (con_driver_map[i] == csw) { |
2747 | module_put(csw->owner); | 3070 | bound = 1; |
2748 | con_driver_map[i] = NULL; | 3071 | break; |
3072 | } | ||
3073 | } | ||
3074 | |||
3075 | return bound; | ||
3076 | } | ||
3077 | EXPORT_SYMBOL(con_is_bound); | ||
3078 | |||
3079 | /** | ||
3080 | * register_con_driver - register console driver to console layer | ||
3081 | * @csw: console driver | ||
3082 | * @first: the first console to take over, minimum value is 0 | ||
3083 | * @last: the last console to take over, maximum value is MAX_NR_CONSOLES -1 | ||
3084 | * | ||
3085 | * DESCRIPTION: This function registers a console driver which can later | ||
3086 | * bind to a range of consoles specified by @first and @last. It will | ||
3087 | * also initialize the console driver by calling con_startup(). | ||
3088 | */ | ||
3089 | int register_con_driver(const struct consw *csw, int first, int last) | ||
3090 | { | ||
3091 | struct module *owner = csw->owner; | ||
3092 | struct con_driver *con_driver; | ||
3093 | const char *desc; | ||
3094 | int i, retval = 0; | ||
3095 | |||
3096 | if (!try_module_get(owner)) | ||
3097 | return -ENODEV; | ||
3098 | |||
3099 | acquire_console_sem(); | ||
3100 | |||
3101 | for (i = 0; i < MAX_NR_CON_DRIVER; i++) { | ||
3102 | con_driver = ®istered_con_driver[i]; | ||
3103 | |||
3104 | /* already registered */ | ||
3105 | if (con_driver->con == csw) | ||
3106 | retval = -EINVAL; | ||
3107 | } | ||
3108 | |||
3109 | if (retval) | ||
3110 | goto err; | ||
3111 | |||
3112 | desc = csw->con_startup(); | ||
3113 | |||
3114 | if (!desc) | ||
3115 | goto err; | ||
3116 | |||
3117 | retval = -EINVAL; | ||
3118 | |||
3119 | for (i = 0; i < MAX_NR_CON_DRIVER; i++) { | ||
3120 | con_driver = ®istered_con_driver[i]; | ||
3121 | |||
3122 | if (con_driver->con == NULL) { | ||
3123 | con_driver->con = csw; | ||
3124 | con_driver->desc = desc; | ||
3125 | con_driver->node = i; | ||
3126 | con_driver->flag = CON_DRIVER_FLAG_MODULE | | ||
3127 | CON_DRIVER_FLAG_INIT; | ||
3128 | con_driver->first = first; | ||
3129 | con_driver->last = last; | ||
3130 | retval = 0; | ||
3131 | break; | ||
3132 | } | ||
3133 | } | ||
3134 | |||
3135 | if (retval) | ||
3136 | goto err; | ||
3137 | |||
3138 | con_driver->class_dev = class_device_create(vtconsole_class, NULL, | ||
3139 | MKDEV(0, con_driver->node), | ||
3140 | NULL, "vtcon%i", | ||
3141 | con_driver->node); | ||
3142 | |||
3143 | if (IS_ERR(con_driver->class_dev)) { | ||
3144 | printk(KERN_WARNING "Unable to create class_device for %s; " | ||
3145 | "errno = %ld\n", con_driver->desc, | ||
3146 | PTR_ERR(con_driver->class_dev)); | ||
3147 | con_driver->class_dev = NULL; | ||
3148 | } else { | ||
3149 | vtconsole_init_class_device(con_driver); | ||
3150 | } | ||
3151 | err: | ||
3152 | release_console_sem(); | ||
3153 | module_put(owner); | ||
3154 | return retval; | ||
3155 | } | ||
3156 | EXPORT_SYMBOL(register_con_driver); | ||
3157 | |||
3158 | /** | ||
3159 | * unregister_con_driver - unregister console driver from console layer | ||
3160 | * @csw: console driver | ||
3161 | * | ||
3162 | * DESCRIPTION: All drivers that registers to the console layer must | ||
3163 | * call this function upon exit, or if the console driver is in a state | ||
3164 | * where it won't be able to handle console services, such as the | ||
3165 | * framebuffer console without loaded framebuffer drivers. | ||
3166 | * | ||
3167 | * The driver must unbind first prior to unregistration. | ||
3168 | */ | ||
3169 | int unregister_con_driver(const struct consw *csw) | ||
3170 | { | ||
3171 | int i, retval = -ENODEV; | ||
3172 | |||
3173 | acquire_console_sem(); | ||
3174 | |||
3175 | /* cannot unregister a bound driver */ | ||
3176 | if (con_is_bound(csw)) | ||
3177 | goto err; | ||
3178 | |||
3179 | for (i = 0; i < MAX_NR_CON_DRIVER; i++) { | ||
3180 | struct con_driver *con_driver = ®istered_con_driver[i]; | ||
3181 | |||
3182 | if (con_driver->con == csw && | ||
3183 | con_driver->flag & CON_DRIVER_FLAG_MODULE) { | ||
3184 | vtconsole_deinit_class_device(con_driver); | ||
3185 | class_device_destroy(vtconsole_class, | ||
3186 | MKDEV(0, con_driver->node)); | ||
3187 | con_driver->con = NULL; | ||
3188 | con_driver->desc = NULL; | ||
3189 | con_driver->class_dev = NULL; | ||
3190 | con_driver->node = 0; | ||
3191 | con_driver->flag = 0; | ||
3192 | con_driver->first = 0; | ||
3193 | con_driver->last = 0; | ||
3194 | retval = 0; | ||
3195 | break; | ||
3196 | } | ||
3197 | } | ||
3198 | err: | ||
3199 | release_console_sem(); | ||
3200 | return retval; | ||
3201 | } | ||
3202 | EXPORT_SYMBOL(unregister_con_driver); | ||
3203 | |||
3204 | /* | ||
3205 | * If we support more console drivers, this function is used | ||
3206 | * when a driver wants to take over some existing consoles | ||
3207 | * and become default driver for newly opened ones. | ||
3208 | * | ||
3209 | * take_over_console is basically a register followed by unbind | ||
3210 | */ | ||
3211 | int take_over_console(const struct consw *csw, int first, int last, int deflt) | ||
3212 | { | ||
3213 | int err; | ||
3214 | |||
3215 | err = register_con_driver(csw, first, last); | ||
3216 | |||
3217 | if (!err) | ||
3218 | bind_con_driver(csw, first, last, deflt); | ||
3219 | |||
3220 | return err; | ||
3221 | } | ||
3222 | |||
3223 | /* | ||
3224 | * give_up_console is a wrapper to unregister_con_driver. It will only | ||
3225 | * work if driver is fully unbound. | ||
3226 | */ | ||
3227 | void give_up_console(const struct consw *csw) | ||
3228 | { | ||
3229 | unregister_con_driver(csw); | ||
3230 | } | ||
3231 | |||
3232 | static int __init vtconsole_class_init(void) | ||
3233 | { | ||
3234 | int i; | ||
3235 | |||
3236 | vtconsole_class = class_create(THIS_MODULE, "vtconsole"); | ||
3237 | if (IS_ERR(vtconsole_class)) { | ||
3238 | printk(KERN_WARNING "Unable to create vt console class; " | ||
3239 | "errno = %ld\n", PTR_ERR(vtconsole_class)); | ||
3240 | vtconsole_class = NULL; | ||
3241 | } | ||
3242 | |||
3243 | /* Add system drivers to sysfs */ | ||
3244 | for (i = 0; i < MAX_NR_CON_DRIVER; i++) { | ||
3245 | struct con_driver *con = ®istered_con_driver[i]; | ||
3246 | |||
3247 | if (con->con && !con->class_dev) { | ||
3248 | con->class_dev = | ||
3249 | class_device_create(vtconsole_class, NULL, | ||
3250 | MKDEV(0, con->node), NULL, | ||
3251 | "vtcon%i", con->node); | ||
3252 | |||
3253 | if (IS_ERR(con->class_dev)) { | ||
3254 | printk(KERN_WARNING "Unable to create " | ||
3255 | "class_device for %s; errno = %ld\n", | ||
3256 | con->desc, PTR_ERR(con->class_dev)); | ||
3257 | con->class_dev = NULL; | ||
3258 | } else { | ||
3259 | vtconsole_init_class_device(con); | ||
3260 | } | ||
2749 | } | 3261 | } |
3262 | } | ||
3263 | |||
3264 | return 0; | ||
2750 | } | 3265 | } |
3266 | postcore_initcall(vtconsole_class_init); | ||
2751 | 3267 | ||
2752 | #endif | 3268 | #endif |
2753 | 3269 | ||
diff --git a/drivers/char/vt_ioctl.c b/drivers/char/vt_ioctl.c index 24011e7c81ff..eccffaf26faa 100644 --- a/drivers/char/vt_ioctl.c +++ b/drivers/char/vt_ioctl.c | |||
@@ -10,7 +10,6 @@ | |||
10 | * Check put/get_user, cleanups - acme@conectiva.com.br - Jun 2001 | 10 | * Check put/get_user, cleanups - acme@conectiva.com.br - Jun 2001 |
11 | */ | 11 | */ |
12 | 12 | ||
13 | #include <linux/config.h> | ||
14 | #include <linux/types.h> | 13 | #include <linux/types.h> |
15 | #include <linux/errno.h> | 14 | #include <linux/errno.h> |
16 | #include <linux/sched.h> | 15 | #include <linux/sched.h> |
diff --git a/drivers/char/watchdog/acquirewdt.c b/drivers/char/watchdog/acquirewdt.c index 7289f4af93d0..c77fe3cf2852 100644 --- a/drivers/char/watchdog/acquirewdt.c +++ b/drivers/char/watchdog/acquirewdt.c | |||
@@ -231,7 +231,7 @@ static int acq_notify_sys(struct notifier_block *this, unsigned long code, | |||
231 | * Kernel Interfaces | 231 | * Kernel Interfaces |
232 | */ | 232 | */ |
233 | 233 | ||
234 | static struct file_operations acq_fops = { | 234 | static const struct file_operations acq_fops = { |
235 | .owner = THIS_MODULE, | 235 | .owner = THIS_MODULE, |
236 | .llseek = no_llseek, | 236 | .llseek = no_llseek, |
237 | .write = acq_write, | 237 | .write = acq_write, |
diff --git a/drivers/char/watchdog/advantechwdt.c b/drivers/char/watchdog/advantechwdt.c index 194a3fd36b91..8069be445edc 100644 --- a/drivers/char/watchdog/advantechwdt.c +++ b/drivers/char/watchdog/advantechwdt.c | |||
@@ -227,7 +227,7 @@ advwdt_notify_sys(struct notifier_block *this, unsigned long code, | |||
227 | * Kernel Interfaces | 227 | * Kernel Interfaces |
228 | */ | 228 | */ |
229 | 229 | ||
230 | static struct file_operations advwdt_fops = { | 230 | static const struct file_operations advwdt_fops = { |
231 | .owner = THIS_MODULE, | 231 | .owner = THIS_MODULE, |
232 | .llseek = no_llseek, | 232 | .llseek = no_llseek, |
233 | .write = advwdt_write, | 233 | .write = advwdt_write, |
diff --git a/drivers/char/watchdog/alim1535_wdt.c b/drivers/char/watchdog/alim1535_wdt.c index 8338ca300e2e..c5c94e4c9495 100644 --- a/drivers/char/watchdog/alim1535_wdt.c +++ b/drivers/char/watchdog/alim1535_wdt.c | |||
@@ -362,7 +362,7 @@ static int __init ali_find_watchdog(void) | |||
362 | * Kernel Interfaces | 362 | * Kernel Interfaces |
363 | */ | 363 | */ |
364 | 364 | ||
365 | static struct file_operations ali_fops = { | 365 | static const struct file_operations ali_fops = { |
366 | .owner = THIS_MODULE, | 366 | .owner = THIS_MODULE, |
367 | .llseek = no_llseek, | 367 | .llseek = no_llseek, |
368 | .write = ali_write, | 368 | .write = ali_write, |
diff --git a/drivers/char/watchdog/alim7101_wdt.c b/drivers/char/watchdog/alim7101_wdt.c index c05ac188a4d7..ffd7684f999b 100644 --- a/drivers/char/watchdog/alim7101_wdt.c +++ b/drivers/char/watchdog/alim7101_wdt.c | |||
@@ -281,7 +281,7 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u | |||
281 | } | 281 | } |
282 | } | 282 | } |
283 | 283 | ||
284 | static struct file_operations wdt_fops = { | 284 | static const struct file_operations wdt_fops = { |
285 | .owner= THIS_MODULE, | 285 | .owner= THIS_MODULE, |
286 | .llseek= no_llseek, | 286 | .llseek= no_llseek, |
287 | .write= fop_write, | 287 | .write= fop_write, |
diff --git a/drivers/char/watchdog/at91_wdt.c b/drivers/char/watchdog/at91_wdt.c index ac83bc4b019a..cc266715ea32 100644 --- a/drivers/char/watchdog/at91_wdt.c +++ b/drivers/char/watchdog/at91_wdt.c | |||
@@ -9,7 +9,6 @@ | |||
9 | * 2 of the License, or (at your option) any later version. | 9 | * 2 of the License, or (at your option) any later version. |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <linux/config.h> | ||
13 | #include <linux/errno.h> | 12 | #include <linux/errno.h> |
14 | #include <linux/fs.h> | 13 | #include <linux/fs.h> |
15 | #include <linux/init.h> | 14 | #include <linux/init.h> |
@@ -17,14 +16,15 @@ | |||
17 | #include <linux/miscdevice.h> | 16 | #include <linux/miscdevice.h> |
18 | #include <linux/module.h> | 17 | #include <linux/module.h> |
19 | #include <linux/moduleparam.h> | 18 | #include <linux/moduleparam.h> |
19 | #include <linux/platform_device.h> | ||
20 | #include <linux/types.h> | 20 | #include <linux/types.h> |
21 | #include <linux/watchdog.h> | 21 | #include <linux/watchdog.h> |
22 | #include <asm/bitops.h> | 22 | #include <asm/bitops.h> |
23 | #include <asm/uaccess.h> | 23 | #include <asm/uaccess.h> |
24 | 24 | ||
25 | 25 | ||
26 | #define WDT_DEFAULT_TIME 5 /* 5 seconds */ | 26 | #define WDT_DEFAULT_TIME 5 /* seconds */ |
27 | #define WDT_MAX_TIME 256 /* 256 seconds */ | 27 | #define WDT_MAX_TIME 256 /* seconds */ |
28 | 28 | ||
29 | static int wdt_time = WDT_DEFAULT_TIME; | 29 | static int wdt_time = WDT_DEFAULT_TIME; |
30 | static int nowayout = WATCHDOG_NOWAYOUT; | 30 | static int nowayout = WATCHDOG_NOWAYOUT; |
@@ -32,8 +32,10 @@ static int nowayout = WATCHDOG_NOWAYOUT; | |||
32 | module_param(wdt_time, int, 0); | 32 | module_param(wdt_time, int, 0); |
33 | MODULE_PARM_DESC(wdt_time, "Watchdog time in seconds. (default="__MODULE_STRING(WDT_DEFAULT_TIME) ")"); | 33 | MODULE_PARM_DESC(wdt_time, "Watchdog time in seconds. (default="__MODULE_STRING(WDT_DEFAULT_TIME) ")"); |
34 | 34 | ||
35 | #ifdef CONFIG_WATCHDOG_NOWAYOUT | ||
35 | module_param(nowayout, int, 0); | 36 | module_param(nowayout, int, 0); |
36 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | 37 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
38 | #endif | ||
37 | 39 | ||
38 | 40 | ||
39 | static unsigned long at91wdt_busy; | 41 | static unsigned long at91wdt_busy; |
@@ -138,7 +140,7 @@ static int at91_wdt_ioctl(struct inode *inode, struct file *file, | |||
138 | case WDIOC_SETTIMEOUT: | 140 | case WDIOC_SETTIMEOUT: |
139 | if (get_user(new_value, p)) | 141 | if (get_user(new_value, p)) |
140 | return -EFAULT; | 142 | return -EFAULT; |
141 | 143 | ||
142 | if (at91_wdt_settimeout(new_value)) | 144 | if (at91_wdt_settimeout(new_value)) |
143 | return -EINVAL; | 145 | return -EINVAL; |
144 | 146 | ||
@@ -181,7 +183,7 @@ static ssize_t at91_wdt_write(struct file *file, const char *data, size_t len, l | |||
181 | 183 | ||
182 | /* ......................................................................... */ | 184 | /* ......................................................................... */ |
183 | 185 | ||
184 | static struct file_operations at91wdt_fops = { | 186 | static const struct file_operations at91wdt_fops = { |
185 | .owner = THIS_MODULE, | 187 | .owner = THIS_MODULE, |
186 | .llseek = no_llseek, | 188 | .llseek = no_llseek, |
187 | .ioctl = at91_wdt_ioctl, | 189 | .ioctl = at91_wdt_ioctl, |
@@ -196,27 +198,84 @@ static struct miscdevice at91wdt_miscdev = { | |||
196 | .fops = &at91wdt_fops, | 198 | .fops = &at91wdt_fops, |
197 | }; | 199 | }; |
198 | 200 | ||
199 | static int __init at91_wdt_init(void) | 201 | static int __init at91wdt_probe(struct platform_device *pdev) |
200 | { | 202 | { |
201 | int res; | 203 | int res; |
202 | 204 | ||
203 | /* Check that the heartbeat value is within range; if not reset to the default */ | 205 | if (at91wdt_miscdev.dev) |
204 | if (at91_wdt_settimeout(wdt_time)) { | 206 | return -EBUSY; |
205 | at91_wdt_settimeout(WDT_DEFAULT_TIME); | 207 | at91wdt_miscdev.dev = &pdev->dev; |
206 | printk(KERN_INFO "at91_wdt: wdt_time value must be 1 <= wdt_time <= 256, using %d\n", wdt_time); | ||
207 | } | ||
208 | 208 | ||
209 | res = misc_register(&at91wdt_miscdev); | 209 | res = misc_register(&at91wdt_miscdev); |
210 | if (res) | 210 | if (res) |
211 | return res; | 211 | return res; |
212 | 212 | ||
213 | printk("AT91 Watchdog Timer enabled (%d seconds, nowayout=%d)\n", wdt_time, nowayout); | 213 | printk("AT91 Watchdog Timer enabled (%d seconds%s)\n", wdt_time, nowayout ? ", nowayout" : ""); |
214 | return 0; | 214 | return 0; |
215 | } | 215 | } |
216 | 216 | ||
217 | static int __exit at91wdt_remove(struct platform_device *pdev) | ||
218 | { | ||
219 | int res; | ||
220 | |||
221 | res = misc_deregister(&at91wdt_miscdev); | ||
222 | if (!res) | ||
223 | at91wdt_miscdev.dev = NULL; | ||
224 | |||
225 | return res; | ||
226 | } | ||
227 | |||
228 | static void at91wdt_shutdown(struct platform_device *pdev) | ||
229 | { | ||
230 | at91_wdt_stop(); | ||
231 | } | ||
232 | |||
233 | #ifdef CONFIG_PM | ||
234 | |||
235 | static int at91wdt_suspend(struct platform_device *pdev, pm_message_t message) | ||
236 | { | ||
237 | at91_wdt_stop(); | ||
238 | return 0; | ||
239 | } | ||
240 | |||
241 | static int at91wdt_resume(struct platform_device *pdev) | ||
242 | { | ||
243 | if (at91wdt_busy) | ||
244 | at91_wdt_start(); | ||
245 | return 0; | ||
246 | } | ||
247 | |||
248 | #else | ||
249 | #define at91wdt_suspend NULL | ||
250 | #define at91wdt_resume NULL | ||
251 | #endif | ||
252 | |||
253 | static struct platform_driver at91wdt_driver = { | ||
254 | .probe = at91wdt_probe, | ||
255 | .remove = __exit_p(at91wdt_remove), | ||
256 | .shutdown = at91wdt_shutdown, | ||
257 | .suspend = at91wdt_suspend, | ||
258 | .resume = at91wdt_resume, | ||
259 | .driver = { | ||
260 | .name = "at91_wdt", | ||
261 | .owner = THIS_MODULE, | ||
262 | }, | ||
263 | }; | ||
264 | |||
265 | static int __init at91_wdt_init(void) | ||
266 | { | ||
267 | /* Check that the heartbeat value is within range; if not reset to the default */ | ||
268 | if (at91_wdt_settimeout(wdt_time)) { | ||
269 | at91_wdt_settimeout(WDT_DEFAULT_TIME); | ||
270 | pr_info("at91_wdt: wdt_time value must be 1 <= wdt_time <= 256, using %d\n", wdt_time); | ||
271 | } | ||
272 | |||
273 | return platform_driver_register(&at91wdt_driver); | ||
274 | } | ||
275 | |||
217 | static void __exit at91_wdt_exit(void) | 276 | static void __exit at91_wdt_exit(void) |
218 | { | 277 | { |
219 | misc_deregister(&at91wdt_miscdev); | 278 | platform_driver_unregister(&at91wdt_driver); |
220 | } | 279 | } |
221 | 280 | ||
222 | module_init(at91_wdt_init); | 281 | module_init(at91_wdt_init); |
diff --git a/drivers/char/watchdog/booke_wdt.c b/drivers/char/watchdog/booke_wdt.c index b6640606b44d..e3cefc538b40 100644 --- a/drivers/char/watchdog/booke_wdt.c +++ b/drivers/char/watchdog/booke_wdt.c | |||
@@ -14,7 +14,6 @@ | |||
14 | * option) any later version. | 14 | * option) any later version. |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include <linux/config.h> | ||
18 | #include <linux/module.h> | 17 | #include <linux/module.h> |
19 | #include <linux/fs.h> | 18 | #include <linux/fs.h> |
20 | #include <linux/miscdevice.h> | 19 | #include <linux/miscdevice.h> |
@@ -146,7 +145,7 @@ static int booke_wdt_open (struct inode *inode, struct file *file) | |||
146 | return 0; | 145 | return 0; |
147 | } | 146 | } |
148 | 147 | ||
149 | static struct file_operations booke_wdt_fops = { | 148 | static const struct file_operations booke_wdt_fops = { |
150 | .owner = THIS_MODULE, | 149 | .owner = THIS_MODULE, |
151 | .llseek = no_llseek, | 150 | .llseek = no_llseek, |
152 | .write = booke_wdt_write, | 151 | .write = booke_wdt_write, |
diff --git a/drivers/char/watchdog/cpu5wdt.c b/drivers/char/watchdog/cpu5wdt.c index 3e8410b5a65e..04c7e49918db 100644 --- a/drivers/char/watchdog/cpu5wdt.c +++ b/drivers/char/watchdog/cpu5wdt.c | |||
@@ -198,7 +198,7 @@ static ssize_t cpu5wdt_write(struct file *file, const char __user *buf, size_t c | |||
198 | return count; | 198 | return count; |
199 | } | 199 | } |
200 | 200 | ||
201 | static struct file_operations cpu5wdt_fops = { | 201 | static const struct file_operations cpu5wdt_fops = { |
202 | .owner = THIS_MODULE, | 202 | .owner = THIS_MODULE, |
203 | .llseek = no_llseek, | 203 | .llseek = no_llseek, |
204 | .ioctl = cpu5wdt_ioctl, | 204 | .ioctl = cpu5wdt_ioctl, |
diff --git a/drivers/char/watchdog/ep93xx_wdt.c b/drivers/char/watchdog/ep93xx_wdt.c index 9021dbb78299..77c8a955ae9e 100644 --- a/drivers/char/watchdog/ep93xx_wdt.c +++ b/drivers/char/watchdog/ep93xx_wdt.c | |||
@@ -187,7 +187,7 @@ static int ep93xx_wdt_release(struct inode *inode, struct file *file) | |||
187 | return 0; | 187 | return 0; |
188 | } | 188 | } |
189 | 189 | ||
190 | static struct file_operations ep93xx_wdt_fops = { | 190 | static const struct file_operations ep93xx_wdt_fops = { |
191 | .owner = THIS_MODULE, | 191 | .owner = THIS_MODULE, |
192 | .write = ep93xx_wdt_write, | 192 | .write = ep93xx_wdt_write, |
193 | .ioctl = ep93xx_wdt_ioctl, | 193 | .ioctl = ep93xx_wdt_ioctl, |
diff --git a/drivers/char/watchdog/eurotechwdt.c b/drivers/char/watchdog/eurotechwdt.c index 25c2f2575611..62dbccb2f6df 100644 --- a/drivers/char/watchdog/eurotechwdt.c +++ b/drivers/char/watchdog/eurotechwdt.c | |||
@@ -40,7 +40,6 @@ | |||
40 | * Added Matt Domsch's nowayout module option. | 40 | * Added Matt Domsch's nowayout module option. |
41 | */ | 41 | */ |
42 | 42 | ||
43 | #include <linux/config.h> | ||
44 | #include <linux/interrupt.h> | 43 | #include <linux/interrupt.h> |
45 | #include <linux/module.h> | 44 | #include <linux/module.h> |
46 | #include <linux/moduleparam.h> | 45 | #include <linux/moduleparam.h> |
@@ -357,7 +356,7 @@ static int eurwdt_notify_sys(struct notifier_block *this, unsigned long code, | |||
357 | */ | 356 | */ |
358 | 357 | ||
359 | 358 | ||
360 | static struct file_operations eurwdt_fops = { | 359 | static const struct file_operations eurwdt_fops = { |
361 | .owner = THIS_MODULE, | 360 | .owner = THIS_MODULE, |
362 | .llseek = no_llseek, | 361 | .llseek = no_llseek, |
363 | .write = eurwdt_write, | 362 | .write = eurwdt_write, |
@@ -421,7 +420,7 @@ static int __init eurwdt_init(void) | |||
421 | goto out; | 420 | goto out; |
422 | } | 421 | } |
423 | 422 | ||
424 | ret = request_irq(irq, eurwdt_interrupt, SA_INTERRUPT, "eurwdt", NULL); | 423 | ret = request_irq(irq, eurwdt_interrupt, IRQF_DISABLED, "eurwdt", NULL); |
425 | if(ret) { | 424 | if(ret) { |
426 | printk(KERN_ERR "eurwdt: IRQ %d is not free.\n", irq); | 425 | printk(KERN_ERR "eurwdt: IRQ %d is not free.\n", irq); |
427 | goto outmisc; | 426 | goto outmisc; |
diff --git a/drivers/char/watchdog/i6300esb.c b/drivers/char/watchdog/i6300esb.c index 93785f13242e..870539eabbf3 100644 --- a/drivers/char/watchdog/i6300esb.c +++ b/drivers/char/watchdog/i6300esb.c | |||
@@ -337,7 +337,7 @@ static int esb_notify_sys (struct notifier_block *this, unsigned long code, void | |||
337 | * Kernel Interfaces | 337 | * Kernel Interfaces |
338 | */ | 338 | */ |
339 | 339 | ||
340 | static struct file_operations esb_fops = { | 340 | static const struct file_operations esb_fops = { |
341 | .owner = THIS_MODULE, | 341 | .owner = THIS_MODULE, |
342 | .llseek = no_llseek, | 342 | .llseek = no_llseek, |
343 | .write = esb_write, | 343 | .write = esb_write, |
diff --git a/drivers/char/watchdog/i8xx_tco.c b/drivers/char/watchdog/i8xx_tco.c index fa2ba9ebe42a..8385dd36eefe 100644 --- a/drivers/char/watchdog/i8xx_tco.c +++ b/drivers/char/watchdog/i8xx_tco.c | |||
@@ -205,6 +205,23 @@ static int tco_timer_set_heartbeat (int t) | |||
205 | return 0; | 205 | return 0; |
206 | } | 206 | } |
207 | 207 | ||
208 | static int tco_timer_get_timeleft (int *time_left) | ||
209 | { | ||
210 | unsigned char val; | ||
211 | |||
212 | spin_lock(&tco_lock); | ||
213 | |||
214 | /* read the TCO Timer */ | ||
215 | val = inb (TCO1_RLD); | ||
216 | val &= 0x3f; | ||
217 | |||
218 | spin_unlock(&tco_lock); | ||
219 | |||
220 | *time_left = (int)((val * 6) / 10); | ||
221 | |||
222 | return 0; | ||
223 | } | ||
224 | |||
208 | /* | 225 | /* |
209 | * /dev/watchdog handling | 226 | * /dev/watchdog handling |
210 | */ | 227 | */ |
@@ -272,6 +289,7 @@ static int i8xx_tco_ioctl (struct inode *inode, struct file *file, | |||
272 | { | 289 | { |
273 | int new_options, retval = -EINVAL; | 290 | int new_options, retval = -EINVAL; |
274 | int new_heartbeat; | 291 | int new_heartbeat; |
292 | int time_left; | ||
275 | void __user *argp = (void __user *)arg; | 293 | void __user *argp = (void __user *)arg; |
276 | int __user *p = argp; | 294 | int __user *p = argp; |
277 | static struct watchdog_info ident = { | 295 | static struct watchdog_info ident = { |
@@ -320,7 +338,7 @@ static int i8xx_tco_ioctl (struct inode *inode, struct file *file, | |||
320 | return -EFAULT; | 338 | return -EFAULT; |
321 | 339 | ||
322 | if (tco_timer_set_heartbeat(new_heartbeat)) | 340 | if (tco_timer_set_heartbeat(new_heartbeat)) |
323 | return -EINVAL; | 341 | return -EINVAL; |
324 | 342 | ||
325 | tco_timer_keepalive (); | 343 | tco_timer_keepalive (); |
326 | /* Fall */ | 344 | /* Fall */ |
@@ -329,6 +347,14 @@ static int i8xx_tco_ioctl (struct inode *inode, struct file *file, | |||
329 | case WDIOC_GETTIMEOUT: | 347 | case WDIOC_GETTIMEOUT: |
330 | return put_user(heartbeat, p); | 348 | return put_user(heartbeat, p); |
331 | 349 | ||
350 | case WDIOC_GETTIMELEFT: | ||
351 | { | ||
352 | if (tco_timer_get_timeleft(&time_left)) | ||
353 | return -EINVAL; | ||
354 | |||
355 | return put_user(time_left, p); | ||
356 | } | ||
357 | |||
332 | default: | 358 | default: |
333 | return -ENOIOCTLCMD; | 359 | return -ENOIOCTLCMD; |
334 | } | 360 | } |
@@ -352,7 +378,7 @@ static int i8xx_tco_notify_sys (struct notifier_block *this, unsigned long code, | |||
352 | * Kernel Interfaces | 378 | * Kernel Interfaces |
353 | */ | 379 | */ |
354 | 380 | ||
355 | static struct file_operations i8xx_tco_fops = { | 381 | static const struct file_operations i8xx_tco_fops = { |
356 | .owner = THIS_MODULE, | 382 | .owner = THIS_MODULE, |
357 | .llseek = no_llseek, | 383 | .llseek = no_llseek, |
358 | .write = i8xx_tco_write, | 384 | .write = i8xx_tco_write, |
diff --git a/drivers/char/watchdog/ib700wdt.c b/drivers/char/watchdog/ib700wdt.c index cf60329eec85..fd95f7327798 100644 --- a/drivers/char/watchdog/ib700wdt.c +++ b/drivers/char/watchdog/ib700wdt.c | |||
@@ -31,7 +31,6 @@ | |||
31 | * | 31 | * |
32 | */ | 32 | */ |
33 | 33 | ||
34 | #include <linux/config.h> | ||
35 | #include <linux/module.h> | 34 | #include <linux/module.h> |
36 | #include <linux/types.h> | 35 | #include <linux/types.h> |
37 | #include <linux/miscdevice.h> | 36 | #include <linux/miscdevice.h> |
@@ -256,7 +255,7 @@ ibwdt_notify_sys(struct notifier_block *this, unsigned long code, | |||
256 | * Kernel Interfaces | 255 | * Kernel Interfaces |
257 | */ | 256 | */ |
258 | 257 | ||
259 | static struct file_operations ibwdt_fops = { | 258 | static const struct file_operations ibwdt_fops = { |
260 | .owner = THIS_MODULE, | 259 | .owner = THIS_MODULE, |
261 | .llseek = no_llseek, | 260 | .llseek = no_llseek, |
262 | .write = ibwdt_write, | 261 | .write = ibwdt_write, |
diff --git a/drivers/char/watchdog/ibmasr.c b/drivers/char/watchdog/ibmasr.c index 294c474ae485..26ceee7a4df0 100644 --- a/drivers/char/watchdog/ibmasr.c +++ b/drivers/char/watchdog/ibmasr.c | |||
@@ -10,7 +10,6 @@ | |||
10 | * of the GNU Public License, incorporated herein by reference. | 10 | * of the GNU Public License, incorporated herein by reference. |
11 | */ | 11 | */ |
12 | 12 | ||
13 | #include <linux/config.h> | ||
14 | #include <linux/fs.h> | 13 | #include <linux/fs.h> |
15 | #include <linux/kernel.h> | 14 | #include <linux/kernel.h> |
16 | #include <linux/slab.h> | 15 | #include <linux/slab.h> |
@@ -323,7 +322,7 @@ static int asr_release(struct inode *inode, struct file *file) | |||
323 | return 0; | 322 | return 0; |
324 | } | 323 | } |
325 | 324 | ||
326 | static struct file_operations asr_fops = { | 325 | static const struct file_operations asr_fops = { |
327 | .owner = THIS_MODULE, | 326 | .owner = THIS_MODULE, |
328 | .llseek = no_llseek, | 327 | .llseek = no_llseek, |
329 | .write = asr_write, | 328 | .write = asr_write, |
diff --git a/drivers/char/watchdog/indydog.c b/drivers/char/watchdog/indydog.c index b4b94daba67e..dacc1c20a310 100644 --- a/drivers/char/watchdog/indydog.c +++ b/drivers/char/watchdog/indydog.c | |||
@@ -13,7 +13,6 @@ | |||
13 | 13 | ||
14 | #include <linux/module.h> | 14 | #include <linux/module.h> |
15 | #include <linux/moduleparam.h> | 15 | #include <linux/moduleparam.h> |
16 | #include <linux/config.h> | ||
17 | #include <linux/types.h> | 16 | #include <linux/types.h> |
18 | #include <linux/kernel.h> | 17 | #include <linux/kernel.h> |
19 | #include <linux/fs.h> | 18 | #include <linux/fs.h> |
@@ -155,7 +154,7 @@ static int indydog_notify_sys(struct notifier_block *this, unsigned long code, v | |||
155 | return NOTIFY_DONE; | 154 | return NOTIFY_DONE; |
156 | } | 155 | } |
157 | 156 | ||
158 | static struct file_operations indydog_fops = { | 157 | static const struct file_operations indydog_fops = { |
159 | .owner = THIS_MODULE, | 158 | .owner = THIS_MODULE, |
160 | .llseek = no_llseek, | 159 | .llseek = no_llseek, |
161 | .write = indydog_write, | 160 | .write = indydog_write, |
diff --git a/drivers/char/watchdog/ixp2000_wdt.c b/drivers/char/watchdog/ixp2000_wdt.c index 0cfb9b9c4a4b..692908819e26 100644 --- a/drivers/char/watchdog/ixp2000_wdt.c +++ b/drivers/char/watchdog/ixp2000_wdt.c | |||
@@ -16,7 +16,6 @@ | |||
16 | * warranty of any kind, whether express or implied. | 16 | * warranty of any kind, whether express or implied. |
17 | */ | 17 | */ |
18 | 18 | ||
19 | #include <linux/config.h> | ||
20 | #include <linux/module.h> | 19 | #include <linux/module.h> |
21 | #include <linux/moduleparam.h> | 20 | #include <linux/moduleparam.h> |
22 | #include <linux/types.h> | 21 | #include <linux/types.h> |
@@ -169,7 +168,7 @@ ixp2000_wdt_release(struct inode *inode, struct file *file) | |||
169 | } | 168 | } |
170 | 169 | ||
171 | 170 | ||
172 | static struct file_operations ixp2000_wdt_fops = | 171 | static const struct file_operations ixp2000_wdt_fops = |
173 | { | 172 | { |
174 | .owner = THIS_MODULE, | 173 | .owner = THIS_MODULE, |
175 | .llseek = no_llseek, | 174 | .llseek = no_llseek, |
diff --git a/drivers/char/watchdog/ixp4xx_wdt.c b/drivers/char/watchdog/ixp4xx_wdt.c index 3800835ca8f3..9db5cf2c38c3 100644 --- a/drivers/char/watchdog/ixp4xx_wdt.c +++ b/drivers/char/watchdog/ixp4xx_wdt.c | |||
@@ -13,7 +13,6 @@ | |||
13 | * warranty of any kind, whether express or implied. | 13 | * warranty of any kind, whether express or implied. |
14 | */ | 14 | */ |
15 | 15 | ||
16 | #include <linux/config.h> | ||
17 | #include <linux/module.h> | 16 | #include <linux/module.h> |
18 | #include <linux/moduleparam.h> | 17 | #include <linux/moduleparam.h> |
19 | #include <linux/types.h> | 18 | #include <linux/types.h> |
@@ -163,7 +162,7 @@ ixp4xx_wdt_release(struct inode *inode, struct file *file) | |||
163 | } | 162 | } |
164 | 163 | ||
165 | 164 | ||
166 | static struct file_operations ixp4xx_wdt_fops = | 165 | static const struct file_operations ixp4xx_wdt_fops = |
167 | { | 166 | { |
168 | .owner = THIS_MODULE, | 167 | .owner = THIS_MODULE, |
169 | .llseek = no_llseek, | 168 | .llseek = no_llseek, |
diff --git a/drivers/char/watchdog/machzwd.c b/drivers/char/watchdog/machzwd.c index a9a20aad61e7..23734e07fb22 100644 --- a/drivers/char/watchdog/machzwd.c +++ b/drivers/char/watchdog/machzwd.c | |||
@@ -28,7 +28,6 @@ | |||
28 | * Added nowayout module option to override CONFIG_WATCHDOG_NOWAYOUT | 28 | * Added nowayout module option to override CONFIG_WATCHDOG_NOWAYOUT |
29 | */ | 29 | */ |
30 | 30 | ||
31 | #include <linux/config.h> | ||
32 | #include <linux/module.h> | 31 | #include <linux/module.h> |
33 | #include <linux/moduleparam.h> | 32 | #include <linux/moduleparam.h> |
34 | #include <linux/types.h> | 33 | #include <linux/types.h> |
@@ -389,7 +388,7 @@ static int zf_notify_sys(struct notifier_block *this, unsigned long code, | |||
389 | 388 | ||
390 | 389 | ||
391 | 390 | ||
392 | static struct file_operations zf_fops = { | 391 | static const struct file_operations zf_fops = { |
393 | .owner = THIS_MODULE, | 392 | .owner = THIS_MODULE, |
394 | .llseek = no_llseek, | 393 | .llseek = no_llseek, |
395 | .write = zf_write, | 394 | .write = zf_write, |
diff --git a/drivers/char/watchdog/mixcomwd.c b/drivers/char/watchdog/mixcomwd.c index d8dede575402..ae943324d251 100644 --- a/drivers/char/watchdog/mixcomwd.c +++ b/drivers/char/watchdog/mixcomwd.c | |||
@@ -37,7 +37,6 @@ | |||
37 | 37 | ||
38 | #include <linux/module.h> | 38 | #include <linux/module.h> |
39 | #include <linux/moduleparam.h> | 39 | #include <linux/moduleparam.h> |
40 | #include <linux/config.h> | ||
41 | #include <linux/types.h> | 40 | #include <linux/types.h> |
42 | #include <linux/miscdevice.h> | 41 | #include <linux/miscdevice.h> |
43 | #include <linux/ioport.h> | 42 | #include <linux/ioport.h> |
@@ -191,7 +190,7 @@ static int mixcomwd_ioctl(struct inode *inode, struct file *file, | |||
191 | return 0; | 190 | return 0; |
192 | } | 191 | } |
193 | 192 | ||
194 | static struct file_operations mixcomwd_fops= | 193 | static const struct file_operations mixcomwd_fops= |
195 | { | 194 | { |
196 | .owner = THIS_MODULE, | 195 | .owner = THIS_MODULE, |
197 | .llseek = no_llseek, | 196 | .llseek = no_llseek, |
diff --git a/drivers/char/watchdog/mpc83xx_wdt.c b/drivers/char/watchdog/mpc83xx_wdt.c index 5d6f5061603a..a480903ee1a5 100644 --- a/drivers/char/watchdog/mpc83xx_wdt.c +++ b/drivers/char/watchdog/mpc83xx_wdt.c | |||
@@ -15,7 +15,6 @@ | |||
15 | * option) any later version. | 15 | * option) any later version. |
16 | */ | 16 | */ |
17 | 17 | ||
18 | #include <linux/config.h> | ||
19 | #include <linux/fs.h> | 18 | #include <linux/fs.h> |
20 | #include <linux/init.h> | 19 | #include <linux/init.h> |
21 | #include <linux/kernel.h> | 20 | #include <linux/kernel.h> |
@@ -130,7 +129,7 @@ static int mpc83xx_wdt_ioctl(struct inode *inode, struct file *file, | |||
130 | } | 129 | } |
131 | } | 130 | } |
132 | 131 | ||
133 | static struct file_operations mpc83xx_wdt_fops = { | 132 | static const struct file_operations mpc83xx_wdt_fops = { |
134 | .owner = THIS_MODULE, | 133 | .owner = THIS_MODULE, |
135 | .llseek = no_llseek, | 134 | .llseek = no_llseek, |
136 | .write = mpc83xx_wdt_write, | 135 | .write = mpc83xx_wdt_write, |
diff --git a/drivers/char/watchdog/mpc8xx_wdt.c b/drivers/char/watchdog/mpc8xx_wdt.c index b2fc71e20850..35dd9e6e1140 100644 --- a/drivers/char/watchdog/mpc8xx_wdt.c +++ b/drivers/char/watchdog/mpc8xx_wdt.c | |||
@@ -9,7 +9,6 @@ | |||
9 | * or implied. | 9 | * or implied. |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <linux/config.h> | ||
13 | #include <linux/fs.h> | 12 | #include <linux/fs.h> |
14 | #include <linux/init.h> | 13 | #include <linux/init.h> |
15 | #include <linux/kernel.h> | 14 | #include <linux/kernel.h> |
@@ -133,7 +132,7 @@ static int mpc8xx_wdt_ioctl(struct inode *inode, struct file *file, | |||
133 | return 0; | 132 | return 0; |
134 | } | 133 | } |
135 | 134 | ||
136 | static struct file_operations mpc8xx_wdt_fops = { | 135 | static const struct file_operations mpc8xx_wdt_fops = { |
137 | .owner = THIS_MODULE, | 136 | .owner = THIS_MODULE, |
138 | .llseek = no_llseek, | 137 | .llseek = no_llseek, |
139 | .write = mpc8xx_wdt_write, | 138 | .write = mpc8xx_wdt_write, |
diff --git a/drivers/char/watchdog/mpcore_wdt.c b/drivers/char/watchdog/mpcore_wdt.c index 2c2c51773200..54b3c56ead0d 100644 --- a/drivers/char/watchdog/mpcore_wdt.c +++ b/drivers/char/watchdog/mpcore_wdt.c | |||
@@ -21,7 +21,6 @@ | |||
21 | */ | 21 | */ |
22 | #include <linux/module.h> | 22 | #include <linux/module.h> |
23 | #include <linux/moduleparam.h> | 23 | #include <linux/moduleparam.h> |
24 | #include <linux/config.h> | ||
25 | #include <linux/types.h> | 24 | #include <linux/types.h> |
26 | #include <linux/miscdevice.h> | 25 | #include <linux/miscdevice.h> |
27 | #include <linux/watchdog.h> | 26 | #include <linux/watchdog.h> |
@@ -298,7 +297,7 @@ static void mpcore_wdt_shutdown(struct platform_device *dev) | |||
298 | /* | 297 | /* |
299 | * Kernel Interfaces | 298 | * Kernel Interfaces |
300 | */ | 299 | */ |
301 | static struct file_operations mpcore_wdt_fops = { | 300 | static const struct file_operations mpcore_wdt_fops = { |
302 | .owner = THIS_MODULE, | 301 | .owner = THIS_MODULE, |
303 | .llseek = no_llseek, | 302 | .llseek = no_llseek, |
304 | .write = mpcore_wdt_write, | 303 | .write = mpcore_wdt_write, |
@@ -356,7 +355,7 @@ static int __devinit mpcore_wdt_probe(struct platform_device *dev) | |||
356 | goto err_misc; | 355 | goto err_misc; |
357 | } | 356 | } |
358 | 357 | ||
359 | ret = request_irq(wdt->irq, mpcore_wdt_fire, SA_INTERRUPT, "mpcore_wdt", wdt); | 358 | ret = request_irq(wdt->irq, mpcore_wdt_fire, IRQF_DISABLED, "mpcore_wdt", wdt); |
360 | if (ret) { | 359 | if (ret) { |
361 | dev_printk(KERN_ERR, _dev, "cannot register IRQ%d for watchdog\n", wdt->irq); | 360 | dev_printk(KERN_ERR, _dev, "cannot register IRQ%d for watchdog\n", wdt->irq); |
362 | goto err_irq; | 361 | goto err_irq; |
diff --git a/drivers/char/watchdog/mv64x60_wdt.c b/drivers/char/watchdog/mv64x60_wdt.c index f1b9cf89f153..5c8fab345b40 100644 --- a/drivers/char/watchdog/mv64x60_wdt.c +++ b/drivers/char/watchdog/mv64x60_wdt.c | |||
@@ -15,7 +15,6 @@ | |||
15 | * or implied. | 15 | * or implied. |
16 | */ | 16 | */ |
17 | 17 | ||
18 | #include <linux/config.h> | ||
19 | #include <linux/fs.h> | 18 | #include <linux/fs.h> |
20 | #include <linux/init.h> | 19 | #include <linux/init.h> |
21 | #include <linux/kernel.h> | 20 | #include <linux/kernel.h> |
@@ -167,7 +166,7 @@ static int mv64x60_wdt_ioctl(struct inode *inode, struct file *file, | |||
167 | return 0; | 166 | return 0; |
168 | } | 167 | } |
169 | 168 | ||
170 | static struct file_operations mv64x60_wdt_fops = { | 169 | static const struct file_operations mv64x60_wdt_fops = { |
171 | .owner = THIS_MODULE, | 170 | .owner = THIS_MODULE, |
172 | .llseek = no_llseek, | 171 | .llseek = no_llseek, |
173 | .write = mv64x60_wdt_write, | 172 | .write = mv64x60_wdt_write, |
diff --git a/drivers/char/watchdog/pcwd.c b/drivers/char/watchdog/pcwd.c index 6d44ca68312d..cd7d1b6a5d9f 100644 --- a/drivers/char/watchdog/pcwd.c +++ b/drivers/char/watchdog/pcwd.c | |||
@@ -740,7 +740,7 @@ static int pcwd_notify_sys(struct notifier_block *this, unsigned long code, void | |||
740 | * Kernel Interfaces | 740 | * Kernel Interfaces |
741 | */ | 741 | */ |
742 | 742 | ||
743 | static struct file_operations pcwd_fops = { | 743 | static const struct file_operations pcwd_fops = { |
744 | .owner = THIS_MODULE, | 744 | .owner = THIS_MODULE, |
745 | .llseek = no_llseek, | 745 | .llseek = no_llseek, |
746 | .write = pcwd_write, | 746 | .write = pcwd_write, |
@@ -755,7 +755,7 @@ static struct miscdevice pcwd_miscdev = { | |||
755 | .fops = &pcwd_fops, | 755 | .fops = &pcwd_fops, |
756 | }; | 756 | }; |
757 | 757 | ||
758 | static struct file_operations pcwd_temp_fops = { | 758 | static const struct file_operations pcwd_temp_fops = { |
759 | .owner = THIS_MODULE, | 759 | .owner = THIS_MODULE, |
760 | .llseek = no_llseek, | 760 | .llseek = no_llseek, |
761 | .read = pcwd_temp_read, | 761 | .read = pcwd_temp_read, |
diff --git a/drivers/char/watchdog/pcwd_pci.c b/drivers/char/watchdog/pcwd_pci.c index 2451edbefece..c7cfd6dbfe1b 100644 --- a/drivers/char/watchdog/pcwd_pci.c +++ b/drivers/char/watchdog/pcwd_pci.c | |||
@@ -21,7 +21,7 @@ | |||
21 | */ | 21 | */ |
22 | 22 | ||
23 | /* | 23 | /* |
24 | * A bells and whistles driver is available from: | 24 | * A bells and whistles driver is available from: |
25 | * http://www.kernel.org/pub/linux/kernel/people/wim/pcwd/pcwd_pci/ | 25 | * http://www.kernel.org/pub/linux/kernel/people/wim/pcwd/pcwd_pci/ |
26 | * | 26 | * |
27 | * More info available at http://www.berkprod.com/ or http://www.pcwatchdog.com/ | 27 | * More info available at http://www.berkprod.com/ or http://www.pcwatchdog.com/ |
@@ -390,6 +390,24 @@ static int pcipcwd_get_temperature(int *temperature) | |||
390 | return 0; | 390 | return 0; |
391 | } | 391 | } |
392 | 392 | ||
393 | static int pcipcwd_get_timeleft(int *time_left) | ||
394 | { | ||
395 | int msb; | ||
396 | int lsb; | ||
397 | |||
398 | /* Read the time that's left before rebooting */ | ||
399 | /* Note: if the board is not yet armed then we will read 0xFFFF */ | ||
400 | send_command(CMD_READ_WATCHDOG_TIMEOUT, &msb, &lsb); | ||
401 | |||
402 | *time_left = (msb << 8) + lsb; | ||
403 | |||
404 | if (debug >= VERBOSE) | ||
405 | printk(KERN_DEBUG PFX "Time left before next reboot: %d\n", | ||
406 | *time_left); | ||
407 | |||
408 | return 0; | ||
409 | } | ||
410 | |||
393 | /* | 411 | /* |
394 | * /dev/watchdog handling | 412 | * /dev/watchdog handling |
395 | */ | 413 | */ |
@@ -512,6 +530,16 @@ static int pcipcwd_ioctl(struct inode *inode, struct file *file, | |||
512 | case WDIOC_GETTIMEOUT: | 530 | case WDIOC_GETTIMEOUT: |
513 | return put_user(heartbeat, p); | 531 | return put_user(heartbeat, p); |
514 | 532 | ||
533 | case WDIOC_GETTIMELEFT: | ||
534 | { | ||
535 | int time_left; | ||
536 | |||
537 | if (pcipcwd_get_timeleft(&time_left)) | ||
538 | return -EFAULT; | ||
539 | |||
540 | return put_user(time_left, p); | ||
541 | } | ||
542 | |||
515 | default: | 543 | default: |
516 | return -ENOIOCTLCMD; | 544 | return -ENOIOCTLCMD; |
517 | } | 545 | } |
@@ -597,7 +625,7 @@ static int pcipcwd_notify_sys(struct notifier_block *this, unsigned long code, v | |||
597 | * Kernel Interfaces | 625 | * Kernel Interfaces |
598 | */ | 626 | */ |
599 | 627 | ||
600 | static struct file_operations pcipcwd_fops = { | 628 | static const struct file_operations pcipcwd_fops = { |
601 | .owner = THIS_MODULE, | 629 | .owner = THIS_MODULE, |
602 | .llseek = no_llseek, | 630 | .llseek = no_llseek, |
603 | .write = pcipcwd_write, | 631 | .write = pcipcwd_write, |
@@ -612,7 +640,7 @@ static struct miscdevice pcipcwd_miscdev = { | |||
612 | .fops = &pcipcwd_fops, | 640 | .fops = &pcipcwd_fops, |
613 | }; | 641 | }; |
614 | 642 | ||
615 | static struct file_operations pcipcwd_temp_fops = { | 643 | static const struct file_operations pcipcwd_temp_fops = { |
616 | .owner = THIS_MODULE, | 644 | .owner = THIS_MODULE, |
617 | .llseek = no_llseek, | 645 | .llseek = no_llseek, |
618 | .read = pcipcwd_temp_read, | 646 | .read = pcipcwd_temp_read, |
diff --git a/drivers/char/watchdog/pcwd_usb.c b/drivers/char/watchdog/pcwd_usb.c index 3fdfda9324fa..b7ae73dcdd08 100644 --- a/drivers/char/watchdog/pcwd_usb.c +++ b/drivers/char/watchdog/pcwd_usb.c | |||
@@ -24,7 +24,6 @@ | |||
24 | * http://www.berkprod.com/ or http://www.pcwatchdog.com/ | 24 | * http://www.berkprod.com/ or http://www.pcwatchdog.com/ |
25 | */ | 25 | */ |
26 | 26 | ||
27 | #include <linux/config.h> | ||
28 | #include <linux/kernel.h> | 27 | #include <linux/kernel.h> |
29 | #include <linux/errno.h> | 28 | #include <linux/errno.h> |
30 | #include <linux/init.h> | 29 | #include <linux/init.h> |
@@ -317,6 +316,19 @@ static int usb_pcwd_get_temperature(struct usb_pcwd_private *usb_pcwd, int *temp | |||
317 | return 0; | 316 | return 0; |
318 | } | 317 | } |
319 | 318 | ||
319 | static int usb_pcwd_get_timeleft(struct usb_pcwd_private *usb_pcwd, int *time_left) | ||
320 | { | ||
321 | unsigned char msb, lsb; | ||
322 | |||
323 | /* Read the time that's left before rebooting */ | ||
324 | /* Note: if the board is not yet armed then we will read 0xFFFF */ | ||
325 | usb_pcwd_send_command(usb_pcwd, CMD_READ_WATCHDOG_TIMEOUT, &msb, &lsb); | ||
326 | |||
327 | *time_left = (msb << 8) + lsb; | ||
328 | |||
329 | return 0; | ||
330 | } | ||
331 | |||
320 | /* | 332 | /* |
321 | * /dev/watchdog handling | 333 | * /dev/watchdog handling |
322 | */ | 334 | */ |
@@ -422,6 +434,16 @@ static int usb_pcwd_ioctl(struct inode *inode, struct file *file, | |||
422 | case WDIOC_GETTIMEOUT: | 434 | case WDIOC_GETTIMEOUT: |
423 | return put_user(heartbeat, p); | 435 | return put_user(heartbeat, p); |
424 | 436 | ||
437 | case WDIOC_GETTIMELEFT: | ||
438 | { | ||
439 | int time_left; | ||
440 | |||
441 | if (usb_pcwd_get_timeleft(usb_pcwd_device, &time_left)) | ||
442 | return -EFAULT; | ||
443 | |||
444 | return put_user(time_left, p); | ||
445 | } | ||
446 | |||
425 | default: | 447 | default: |
426 | return -ENOIOCTLCMD; | 448 | return -ENOIOCTLCMD; |
427 | } | 449 | } |
@@ -501,7 +523,7 @@ static int usb_pcwd_notify_sys(struct notifier_block *this, unsigned long code, | |||
501 | * Kernel Interfaces | 523 | * Kernel Interfaces |
502 | */ | 524 | */ |
503 | 525 | ||
504 | static struct file_operations usb_pcwd_fops = { | 526 | static const struct file_operations usb_pcwd_fops = { |
505 | .owner = THIS_MODULE, | 527 | .owner = THIS_MODULE, |
506 | .llseek = no_llseek, | 528 | .llseek = no_llseek, |
507 | .write = usb_pcwd_write, | 529 | .write = usb_pcwd_write, |
@@ -516,7 +538,7 @@ static struct miscdevice usb_pcwd_miscdev = { | |||
516 | .fops = &usb_pcwd_fops, | 538 | .fops = &usb_pcwd_fops, |
517 | }; | 539 | }; |
518 | 540 | ||
519 | static struct file_operations usb_pcwd_temperature_fops = { | 541 | static const struct file_operations usb_pcwd_temperature_fops = { |
520 | .owner = THIS_MODULE, | 542 | .owner = THIS_MODULE, |
521 | .llseek = no_llseek, | 543 | .llseek = no_llseek, |
522 | .read = usb_pcwd_temperature_read, | 544 | .read = usb_pcwd_temperature_read, |
diff --git a/drivers/char/watchdog/s3c2410_wdt.c b/drivers/char/watchdog/s3c2410_wdt.c index 1ea04e9b2b0b..be978e8ed754 100644 --- a/drivers/char/watchdog/s3c2410_wdt.c +++ b/drivers/char/watchdog/s3c2410_wdt.c | |||
@@ -37,7 +37,6 @@ | |||
37 | 37 | ||
38 | #include <linux/module.h> | 38 | #include <linux/module.h> |
39 | #include <linux/moduleparam.h> | 39 | #include <linux/moduleparam.h> |
40 | #include <linux/config.h> | ||
41 | #include <linux/types.h> | 40 | #include <linux/types.h> |
42 | #include <linux/timer.h> | 41 | #include <linux/timer.h> |
43 | #include <linux/miscdevice.h> | 42 | #include <linux/miscdevice.h> |
@@ -320,7 +319,7 @@ static int s3c2410wdt_ioctl(struct inode *inode, struct file *file, | |||
320 | 319 | ||
321 | /* kernel interface */ | 320 | /* kernel interface */ |
322 | 321 | ||
323 | static struct file_operations s3c2410wdt_fops = { | 322 | static const struct file_operations s3c2410wdt_fops = { |
324 | .owner = THIS_MODULE, | 323 | .owner = THIS_MODULE, |
325 | .llseek = no_llseek, | 324 | .llseek = no_llseek, |
326 | .write = s3c2410wdt_write, | 325 | .write = s3c2410wdt_write, |
diff --git a/drivers/char/watchdog/sa1100_wdt.c b/drivers/char/watchdog/sa1100_wdt.c index 522a9370db94..1fc16d995788 100644 --- a/drivers/char/watchdog/sa1100_wdt.c +++ b/drivers/char/watchdog/sa1100_wdt.c | |||
@@ -17,7 +17,6 @@ | |||
17 | * | 17 | * |
18 | * 27/11/2000 Initial release | 18 | * 27/11/2000 Initial release |
19 | */ | 19 | */ |
20 | #include <linux/config.h> | ||
21 | #include <linux/module.h> | 20 | #include <linux/module.h> |
22 | #include <linux/moduleparam.h> | 21 | #include <linux/moduleparam.h> |
23 | #include <linux/types.h> | 22 | #include <linux/types.h> |
@@ -136,7 +135,7 @@ static int sa1100dog_ioctl(struct inode *inode, struct file *file, | |||
136 | return ret; | 135 | return ret; |
137 | } | 136 | } |
138 | 137 | ||
139 | static struct file_operations sa1100dog_fops = | 138 | static const struct file_operations sa1100dog_fops = |
140 | { | 139 | { |
141 | .owner = THIS_MODULE, | 140 | .owner = THIS_MODULE, |
142 | .llseek = no_llseek, | 141 | .llseek = no_llseek, |
diff --git a/drivers/char/watchdog/sbc60xxwdt.c b/drivers/char/watchdog/sbc60xxwdt.c index ed0bd55fbfc1..4663c2fd53cd 100644 --- a/drivers/char/watchdog/sbc60xxwdt.c +++ b/drivers/char/watchdog/sbc60xxwdt.c | |||
@@ -282,7 +282,7 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd, | |||
282 | } | 282 | } |
283 | } | 283 | } |
284 | 284 | ||
285 | static struct file_operations wdt_fops = { | 285 | static const struct file_operations wdt_fops = { |
286 | .owner = THIS_MODULE, | 286 | .owner = THIS_MODULE, |
287 | .llseek = no_llseek, | 287 | .llseek = no_llseek, |
288 | .write = fop_write, | 288 | .write = fop_write, |
diff --git a/drivers/char/watchdog/sbc8360.c b/drivers/char/watchdog/sbc8360.c index c6cbf808d8c2..1035be5b5019 100644 --- a/drivers/char/watchdog/sbc8360.c +++ b/drivers/char/watchdog/sbc8360.c | |||
@@ -36,7 +36,6 @@ | |||
36 | * | 36 | * |
37 | */ | 37 | */ |
38 | 38 | ||
39 | #include <linux/config.h> | ||
40 | #include <linux/module.h> | 39 | #include <linux/module.h> |
41 | #include <linux/types.h> | 40 | #include <linux/types.h> |
42 | #include <linux/miscdevice.h> | 41 | #include <linux/miscdevice.h> |
@@ -306,7 +305,7 @@ static int sbc8360_notify_sys(struct notifier_block *this, unsigned long code, | |||
306 | * Kernel Interfaces | 305 | * Kernel Interfaces |
307 | */ | 306 | */ |
308 | 307 | ||
309 | static struct file_operations sbc8360_fops = { | 308 | static const struct file_operations sbc8360_fops = { |
310 | .owner = THIS_MODULE, | 309 | .owner = THIS_MODULE, |
311 | .llseek = no_llseek, | 310 | .llseek = no_llseek, |
312 | .write = sbc8360_write, | 311 | .write = sbc8360_write, |
diff --git a/drivers/char/watchdog/sbc_epx_c3.c b/drivers/char/watchdog/sbc_epx_c3.c index 837b1ec3ffe3..bfc475dabe6d 100644 --- a/drivers/char/watchdog/sbc_epx_c3.c +++ b/drivers/char/watchdog/sbc_epx_c3.c | |||
@@ -15,7 +15,6 @@ | |||
15 | 15 | ||
16 | #include <linux/module.h> | 16 | #include <linux/module.h> |
17 | #include <linux/moduleparam.h> | 17 | #include <linux/moduleparam.h> |
18 | #include <linux/config.h> | ||
19 | #include <linux/types.h> | 18 | #include <linux/types.h> |
20 | #include <linux/kernel.h> | 19 | #include <linux/kernel.h> |
21 | #include <linux/fs.h> | 20 | #include <linux/fs.h> |
@@ -155,7 +154,7 @@ static int epx_c3_notify_sys(struct notifier_block *this, unsigned long code, | |||
155 | return NOTIFY_DONE; | 154 | return NOTIFY_DONE; |
156 | } | 155 | } |
157 | 156 | ||
158 | static struct file_operations epx_c3_fops = { | 157 | static const struct file_operations epx_c3_fops = { |
159 | .owner = THIS_MODULE, | 158 | .owner = THIS_MODULE, |
160 | .llseek = no_llseek, | 159 | .llseek = no_llseek, |
161 | .write = epx_c3_write, | 160 | .write = epx_c3_write, |
diff --git a/drivers/char/watchdog/sc1200wdt.c b/drivers/char/watchdog/sc1200wdt.c index 20b88f9b7be2..7c3cf293a5af 100644 --- a/drivers/char/watchdog/sc1200wdt.c +++ b/drivers/char/watchdog/sc1200wdt.c | |||
@@ -27,7 +27,6 @@ | |||
27 | * | 27 | * |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include <linux/config.h> | ||
31 | #include <linux/module.h> | 30 | #include <linux/module.h> |
32 | #include <linux/moduleparam.h> | 31 | #include <linux/moduleparam.h> |
33 | #include <linux/miscdevice.h> | 32 | #include <linux/miscdevice.h> |
@@ -293,7 +292,7 @@ static struct notifier_block sc1200wdt_notifier = | |||
293 | .notifier_call = sc1200wdt_notify_sys, | 292 | .notifier_call = sc1200wdt_notify_sys, |
294 | }; | 293 | }; |
295 | 294 | ||
296 | static struct file_operations sc1200wdt_fops = | 295 | static const struct file_operations sc1200wdt_fops = |
297 | { | 296 | { |
298 | .owner = THIS_MODULE, | 297 | .owner = THIS_MODULE, |
299 | .llseek = no_llseek, | 298 | .llseek = no_llseek, |
diff --git a/drivers/char/watchdog/sc520_wdt.c b/drivers/char/watchdog/sc520_wdt.c index 4ee9974ad8cb..2c7c9db71be8 100644 --- a/drivers/char/watchdog/sc520_wdt.c +++ b/drivers/char/watchdog/sc520_wdt.c | |||
@@ -336,7 +336,7 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd, | |||
336 | } | 336 | } |
337 | } | 337 | } |
338 | 338 | ||
339 | static struct file_operations wdt_fops = { | 339 | static const struct file_operations wdt_fops = { |
340 | .owner = THIS_MODULE, | 340 | .owner = THIS_MODULE, |
341 | .llseek = no_llseek, | 341 | .llseek = no_llseek, |
342 | .write = fop_write, | 342 | .write = fop_write, |
diff --git a/drivers/char/watchdog/scx200_wdt.c b/drivers/char/watchdog/scx200_wdt.c index b4a102a2d7e3..c561299a5537 100644 --- a/drivers/char/watchdog/scx200_wdt.c +++ b/drivers/char/watchdog/scx200_wdt.c | |||
@@ -17,7 +17,6 @@ | |||
17 | of any nature resulting due to the use of this software. This | 17 | of any nature resulting due to the use of this software. This |
18 | software is provided AS-IS with no warranties. */ | 18 | software is provided AS-IS with no warranties. */ |
19 | 19 | ||
20 | #include <linux/config.h> | ||
21 | #include <linux/module.h> | 20 | #include <linux/module.h> |
22 | #include <linux/moduleparam.h> | 21 | #include <linux/moduleparam.h> |
23 | #include <linux/init.h> | 22 | #include <linux/init.h> |
@@ -195,7 +194,7 @@ static int scx200_wdt_ioctl(struct inode *inode, struct file *file, | |||
195 | } | 194 | } |
196 | } | 195 | } |
197 | 196 | ||
198 | static struct file_operations scx200_wdt_fops = { | 197 | static const struct file_operations scx200_wdt_fops = { |
199 | .owner = THIS_MODULE, | 198 | .owner = THIS_MODULE, |
200 | .llseek = no_llseek, | 199 | .llseek = no_llseek, |
201 | .write = scx200_wdt_write, | 200 | .write = scx200_wdt_write, |
diff --git a/drivers/char/watchdog/shwdt.c b/drivers/char/watchdog/shwdt.c index 1f4cab55b2ef..1355038f1044 100644 --- a/drivers/char/watchdog/shwdt.c +++ b/drivers/char/watchdog/shwdt.c | |||
@@ -17,7 +17,6 @@ | |||
17 | * Added expect close support, made emulated timeout runtime changeable | 17 | * Added expect close support, made emulated timeout runtime changeable |
18 | * general cleanups, add some ioctls | 18 | * general cleanups, add some ioctls |
19 | */ | 19 | */ |
20 | #include <linux/config.h> | ||
21 | #include <linux/module.h> | 20 | #include <linux/module.h> |
22 | #include <linux/moduleparam.h> | 21 | #include <linux/moduleparam.h> |
23 | #include <linux/init.h> | 22 | #include <linux/init.h> |
@@ -345,7 +344,7 @@ static int sh_wdt_notify_sys(struct notifier_block *this, | |||
345 | return NOTIFY_DONE; | 344 | return NOTIFY_DONE; |
346 | } | 345 | } |
347 | 346 | ||
348 | static struct file_operations sh_wdt_fops = { | 347 | static const struct file_operations sh_wdt_fops = { |
349 | .owner = THIS_MODULE, | 348 | .owner = THIS_MODULE, |
350 | .llseek = no_llseek, | 349 | .llseek = no_llseek, |
351 | .write = sh_wdt_write, | 350 | .write = sh_wdt_write, |
diff --git a/drivers/char/watchdog/softdog.c b/drivers/char/watchdog/softdog.c index a91edaf3a350..ef8da517545a 100644 --- a/drivers/char/watchdog/softdog.c +++ b/drivers/char/watchdog/softdog.c | |||
@@ -38,7 +38,6 @@ | |||
38 | 38 | ||
39 | #include <linux/module.h> | 39 | #include <linux/module.h> |
40 | #include <linux/moduleparam.h> | 40 | #include <linux/moduleparam.h> |
41 | #include <linux/config.h> | ||
42 | #include <linux/types.h> | 41 | #include <linux/types.h> |
43 | #include <linux/timer.h> | 42 | #include <linux/timer.h> |
44 | #include <linux/miscdevice.h> | 43 | #include <linux/miscdevice.h> |
@@ -244,7 +243,7 @@ static int softdog_notify_sys(struct notifier_block *this, unsigned long code, | |||
244 | * Kernel Interfaces | 243 | * Kernel Interfaces |
245 | */ | 244 | */ |
246 | 245 | ||
247 | static struct file_operations softdog_fops = { | 246 | static const struct file_operations softdog_fops = { |
248 | .owner = THIS_MODULE, | 247 | .owner = THIS_MODULE, |
249 | .llseek = no_llseek, | 248 | .llseek = no_llseek, |
250 | .write = softdog_write, | 249 | .write = softdog_write, |
diff --git a/drivers/char/watchdog/w83627hf_wdt.c b/drivers/char/watchdog/w83627hf_wdt.c index d15ca9a3986f..13f16d41c2fd 100644 --- a/drivers/char/watchdog/w83627hf_wdt.c +++ b/drivers/char/watchdog/w83627hf_wdt.c | |||
@@ -274,7 +274,7 @@ wdt_notify_sys(struct notifier_block *this, unsigned long code, | |||
274 | * Kernel Interfaces | 274 | * Kernel Interfaces |
275 | */ | 275 | */ |
276 | 276 | ||
277 | static struct file_operations wdt_fops = { | 277 | static const struct file_operations wdt_fops = { |
278 | .owner = THIS_MODULE, | 278 | .owner = THIS_MODULE, |
279 | .llseek = no_llseek, | 279 | .llseek = no_llseek, |
280 | .write = wdt_write, | 280 | .write = wdt_write, |
diff --git a/drivers/char/watchdog/w83877f_wdt.c b/drivers/char/watchdog/w83877f_wdt.c index 52a8bd0a5988..ccf6c0915945 100644 --- a/drivers/char/watchdog/w83877f_wdt.c +++ b/drivers/char/watchdog/w83877f_wdt.c | |||
@@ -299,7 +299,7 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd, | |||
299 | } | 299 | } |
300 | } | 300 | } |
301 | 301 | ||
302 | static struct file_operations wdt_fops = { | 302 | static const struct file_operations wdt_fops = { |
303 | .owner = THIS_MODULE, | 303 | .owner = THIS_MODULE, |
304 | .llseek = no_llseek, | 304 | .llseek = no_llseek, |
305 | .write = fop_write, | 305 | .write = fop_write, |
diff --git a/drivers/char/watchdog/w83977f_wdt.c b/drivers/char/watchdog/w83977f_wdt.c index a7ff64c8921f..98f4e17db70a 100644 --- a/drivers/char/watchdog/w83977f_wdt.c +++ b/drivers/char/watchdog/w83977f_wdt.c | |||
@@ -17,7 +17,6 @@ | |||
17 | 17 | ||
18 | #include <linux/module.h> | 18 | #include <linux/module.h> |
19 | #include <linux/moduleparam.h> | 19 | #include <linux/moduleparam.h> |
20 | #include <linux/config.h> | ||
21 | #include <linux/types.h> | 20 | #include <linux/types.h> |
22 | #include <linux/kernel.h> | 21 | #include <linux/kernel.h> |
23 | #include <linux/fs.h> | 22 | #include <linux/fs.h> |
@@ -450,7 +449,7 @@ static int wdt_notify_sys(struct notifier_block *this, unsigned long code, | |||
450 | return NOTIFY_DONE; | 449 | return NOTIFY_DONE; |
451 | } | 450 | } |
452 | 451 | ||
453 | static struct file_operations wdt_fops= | 452 | static const struct file_operations wdt_fops= |
454 | { | 453 | { |
455 | .owner = THIS_MODULE, | 454 | .owner = THIS_MODULE, |
456 | .llseek = no_llseek, | 455 | .llseek = no_llseek, |
diff --git a/drivers/char/watchdog/wafer5823wdt.c b/drivers/char/watchdog/wafer5823wdt.c index 7cf6c9bbf486..2bb6a9d6ad28 100644 --- a/drivers/char/watchdog/wafer5823wdt.c +++ b/drivers/char/watchdog/wafer5823wdt.c | |||
@@ -222,7 +222,7 @@ static int wafwdt_notify_sys(struct notifier_block *this, unsigned long code, vo | |||
222 | * Kernel Interfaces | 222 | * Kernel Interfaces |
223 | */ | 223 | */ |
224 | 224 | ||
225 | static struct file_operations wafwdt_fops = { | 225 | static const struct file_operations wafwdt_fops = { |
226 | .owner = THIS_MODULE, | 226 | .owner = THIS_MODULE, |
227 | .llseek = no_llseek, | 227 | .llseek = no_llseek, |
228 | .write = wafwdt_write, | 228 | .write = wafwdt_write, |
diff --git a/drivers/char/watchdog/wd501p.h b/drivers/char/watchdog/wd501p.h index 84e60eb74337..a4504f40394d 100644 --- a/drivers/char/watchdog/wd501p.h +++ b/drivers/char/watchdog/wd501p.h | |||
@@ -19,7 +19,6 @@ | |||
19 | * | 19 | * |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include <linux/config.h> | ||
23 | 22 | ||
24 | #define WDT_COUNT0 (io+0) | 23 | #define WDT_COUNT0 (io+0) |
25 | #define WDT_COUNT1 (io+1) | 24 | #define WDT_COUNT1 (io+1) |
diff --git a/drivers/char/watchdog/wdrtas.c b/drivers/char/watchdog/wdrtas.c index dacfe31caccf..5c38cdf41731 100644 --- a/drivers/char/watchdog/wdrtas.c +++ b/drivers/char/watchdog/wdrtas.c | |||
@@ -26,7 +26,6 @@ | |||
26 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 26 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include <linux/config.h> | ||
30 | #include <linux/fs.h> | 29 | #include <linux/fs.h> |
31 | #include <linux/init.h> | 30 | #include <linux/init.h> |
32 | #include <linux/kernel.h> | 31 | #include <linux/kernel.h> |
@@ -521,7 +520,7 @@ wdrtas_reboot(struct notifier_block *this, unsigned long code, void *ptr) | |||
521 | 520 | ||
522 | /*** initialization stuff */ | 521 | /*** initialization stuff */ |
523 | 522 | ||
524 | static struct file_operations wdrtas_fops = { | 523 | static const struct file_operations wdrtas_fops = { |
525 | .owner = THIS_MODULE, | 524 | .owner = THIS_MODULE, |
526 | .llseek = no_llseek, | 525 | .llseek = no_llseek, |
527 | .write = wdrtas_write, | 526 | .write = wdrtas_write, |
@@ -536,7 +535,7 @@ static struct miscdevice wdrtas_miscdev = { | |||
536 | .fops = &wdrtas_fops, | 535 | .fops = &wdrtas_fops, |
537 | }; | 536 | }; |
538 | 537 | ||
539 | static struct file_operations wdrtas_temp_fops = { | 538 | static const struct file_operations wdrtas_temp_fops = { |
540 | .owner = THIS_MODULE, | 539 | .owner = THIS_MODULE, |
541 | .llseek = no_llseek, | 540 | .llseek = no_llseek, |
542 | .read = wdrtas_temp_read, | 541 | .read = wdrtas_temp_read, |
diff --git a/drivers/char/watchdog/wdt.c b/drivers/char/watchdog/wdt.c index ec7e401228ee..70be81e39a61 100644 --- a/drivers/char/watchdog/wdt.c +++ b/drivers/char/watchdog/wdt.c | |||
@@ -31,7 +31,6 @@ | |||
31 | * Matt Domsch : Added nowayout module option | 31 | * Matt Domsch : Added nowayout module option |
32 | */ | 32 | */ |
33 | 33 | ||
34 | #include <linux/config.h> | ||
35 | #include <linux/interrupt.h> | 34 | #include <linux/interrupt.h> |
36 | #include <linux/module.h> | 35 | #include <linux/module.h> |
37 | #include <linux/moduleparam.h> | 36 | #include <linux/moduleparam.h> |
@@ -495,7 +494,7 @@ static int wdt_notify_sys(struct notifier_block *this, unsigned long code, | |||
495 | */ | 494 | */ |
496 | 495 | ||
497 | 496 | ||
498 | static struct file_operations wdt_fops = { | 497 | static const struct file_operations wdt_fops = { |
499 | .owner = THIS_MODULE, | 498 | .owner = THIS_MODULE, |
500 | .llseek = no_llseek, | 499 | .llseek = no_llseek, |
501 | .write = wdt_write, | 500 | .write = wdt_write, |
@@ -511,7 +510,7 @@ static struct miscdevice wdt_miscdev = { | |||
511 | }; | 510 | }; |
512 | 511 | ||
513 | #ifdef CONFIG_WDT_501 | 512 | #ifdef CONFIG_WDT_501 |
514 | static struct file_operations wdt_temp_fops = { | 513 | static const struct file_operations wdt_temp_fops = { |
515 | .owner = THIS_MODULE, | 514 | .owner = THIS_MODULE, |
516 | .llseek = no_llseek, | 515 | .llseek = no_llseek, |
517 | .read = wdt_temp_read, | 516 | .read = wdt_temp_read, |
@@ -581,7 +580,7 @@ static int __init wdt_init(void) | |||
581 | goto out; | 580 | goto out; |
582 | } | 581 | } |
583 | 582 | ||
584 | ret = request_irq(irq, wdt_interrupt, SA_INTERRUPT, "wdt501p", NULL); | 583 | ret = request_irq(irq, wdt_interrupt, IRQF_DISABLED, "wdt501p", NULL); |
585 | if(ret) { | 584 | if(ret) { |
586 | printk(KERN_ERR "wdt: IRQ %d is not free.\n", irq); | 585 | printk(KERN_ERR "wdt: IRQ %d is not free.\n", irq); |
587 | goto outreg; | 586 | goto outreg; |
diff --git a/drivers/char/watchdog/wdt285.c b/drivers/char/watchdog/wdt285.c index 52825a1f1779..6555fb844f23 100644 --- a/drivers/char/watchdog/wdt285.c +++ b/drivers/char/watchdog/wdt285.c | |||
@@ -178,7 +178,7 @@ watchdog_ioctl(struct inode *inode, struct file *file, unsigned int cmd, | |||
178 | return ret; | 178 | return ret; |
179 | } | 179 | } |
180 | 180 | ||
181 | static struct file_operations watchdog_fops = { | 181 | static const struct file_operations watchdog_fops = { |
182 | .owner = THIS_MODULE, | 182 | .owner = THIS_MODULE, |
183 | .llseek = no_llseek, | 183 | .llseek = no_llseek, |
184 | .write = watchdog_write, | 184 | .write = watchdog_write, |
diff --git a/drivers/char/watchdog/wdt977.c b/drivers/char/watchdog/wdt977.c index 3843900e94c4..a0935bc775f8 100644 --- a/drivers/char/watchdog/wdt977.c +++ b/drivers/char/watchdog/wdt977.c | |||
@@ -24,7 +24,6 @@ | |||
24 | 24 | ||
25 | #include <linux/module.h> | 25 | #include <linux/module.h> |
26 | #include <linux/moduleparam.h> | 26 | #include <linux/moduleparam.h> |
27 | #include <linux/config.h> | ||
28 | #include <linux/types.h> | 27 | #include <linux/types.h> |
29 | #include <linux/kernel.h> | 28 | #include <linux/kernel.h> |
30 | #include <linux/fs.h> | 29 | #include <linux/fs.h> |
@@ -419,7 +418,7 @@ static int wdt977_notify_sys(struct notifier_block *this, unsigned long code, | |||
419 | return NOTIFY_DONE; | 418 | return NOTIFY_DONE; |
420 | } | 419 | } |
421 | 420 | ||
422 | static struct file_operations wdt977_fops= | 421 | static const struct file_operations wdt977_fops= |
423 | { | 422 | { |
424 | .owner = THIS_MODULE, | 423 | .owner = THIS_MODULE, |
425 | .llseek = no_llseek, | 424 | .llseek = no_llseek, |
diff --git a/drivers/char/watchdog/wdt_pci.c b/drivers/char/watchdog/wdt_pci.c index 4b3311993d48..5918ca2c9c35 100644 --- a/drivers/char/watchdog/wdt_pci.c +++ b/drivers/char/watchdog/wdt_pci.c | |||
@@ -35,7 +35,6 @@ | |||
35 | * Matt Domsch : nowayout module option | 35 | * Matt Domsch : nowayout module option |
36 | */ | 36 | */ |
37 | 37 | ||
38 | #include <linux/config.h> | ||
39 | #include <linux/interrupt.h> | 38 | #include <linux/interrupt.h> |
40 | #include <linux/module.h> | 39 | #include <linux/module.h> |
41 | #include <linux/moduleparam.h> | 40 | #include <linux/moduleparam.h> |
@@ -544,7 +543,7 @@ static int wdtpci_notify_sys(struct notifier_block *this, unsigned long code, | |||
544 | */ | 543 | */ |
545 | 544 | ||
546 | 545 | ||
547 | static struct file_operations wdtpci_fops = { | 546 | static const struct file_operations wdtpci_fops = { |
548 | .owner = THIS_MODULE, | 547 | .owner = THIS_MODULE, |
549 | .llseek = no_llseek, | 548 | .llseek = no_llseek, |
550 | .write = wdtpci_write, | 549 | .write = wdtpci_write, |
@@ -560,7 +559,7 @@ static struct miscdevice wdtpci_miscdev = { | |||
560 | }; | 559 | }; |
561 | 560 | ||
562 | #ifdef CONFIG_WDT_501_PCI | 561 | #ifdef CONFIG_WDT_501_PCI |
563 | static struct file_operations wdtpci_temp_fops = { | 562 | static const struct file_operations wdtpci_temp_fops = { |
564 | .owner = THIS_MODULE, | 563 | .owner = THIS_MODULE, |
565 | .llseek = no_llseek, | 564 | .llseek = no_llseek, |
566 | .read = wdtpci_temp_read, | 565 | .read = wdtpci_temp_read, |
@@ -618,7 +617,7 @@ static int __devinit wdtpci_init_one (struct pci_dev *dev, | |||
618 | goto out_pci; | 617 | goto out_pci; |
619 | } | 618 | } |
620 | 619 | ||
621 | if (request_irq (irq, wdtpci_interrupt, SA_INTERRUPT | SA_SHIRQ, | 620 | if (request_irq (irq, wdtpci_interrupt, IRQF_DISABLED | IRQF_SHARED, |
622 | "wdt_pci", &wdtpci_miscdev)) { | 621 | "wdt_pci", &wdtpci_miscdev)) { |
623 | printk (KERN_ERR PFX "IRQ %d is not free\n", irq); | 622 | printk (KERN_ERR PFX "IRQ %d is not free\n", irq); |
624 | goto out_reg; | 623 | goto out_reg; |