diff options
Diffstat (limited to 'drivers/char')
57 files changed, 1625 insertions, 1764 deletions
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig index 3610c5729553..c40e487d9f5c 100644 --- a/drivers/char/Kconfig +++ b/drivers/char/Kconfig | |||
@@ -939,12 +939,36 @@ config MWAVE | |||
939 | config SCx200_GPIO | 939 | config SCx200_GPIO |
940 | tristate "NatSemi SCx200 GPIO Support" | 940 | tristate "NatSemi SCx200 GPIO Support" |
941 | depends on SCx200 | 941 | depends on SCx200 |
942 | select NSC_GPIO | ||
942 | help | 943 | help |
943 | Give userspace access to the GPIO pins on the National | 944 | Give userspace access to the GPIO pins on the National |
944 | Semiconductor SCx200 processors. | 945 | Semiconductor SCx200 processors. |
945 | 946 | ||
946 | If compiled as a module, it will be called scx200_gpio. | 947 | If compiled as a module, it will be called scx200_gpio. |
947 | 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 | |||
948 | config CS5535_GPIO | 972 | config CS5535_GPIO |
949 | tristate "AMD CS5535/CS5536 GPIO (Geode Companion Device)" | 973 | tristate "AMD CS5535/CS5536 GPIO (Geode Companion Device)" |
950 | depends on X86_32 | 974 | depends on X86_32 |
diff --git a/drivers/char/Makefile b/drivers/char/Makefile index 524105597ea7..6e0f4469d8bb 100644 --- a/drivers/char/Makefile +++ b/drivers/char/Makefile | |||
@@ -82,6 +82,8 @@ 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 9826a399fa02..22f8cf218cc6 100644 --- a/drivers/char/agp/Kconfig +++ b/drivers/char/agp/Kconfig | |||
@@ -1,6 +1,7 @@ | |||
1 | config AGP | 1 | config AGP |
2 | tristate "/dev/agpgart (AGP Support)" | 2 | tristate "/dev/agpgart (AGP Support)" |
3 | depends on ALPHA || IA64 || PPC || X86 | 3 | depends on ALPHA || IA64 || PPC || X86 |
4 | depends on PCI | ||
4 | ---help--- | 5 | ---help--- |
5 | AGP (Accelerated Graphics Port) is a bus system mainly used to | 6 | AGP (Accelerated Graphics Port) is a bus system mainly used to |
6 | connect graphics cards to the rest of the system. | 7 | connect graphics cards to the rest of the system. |
diff --git a/drivers/char/agp/amd64-agp.c b/drivers/char/agp/amd64-agp.c index f690ee8cb732..f74eeeb8e377 100644 --- a/drivers/char/agp/amd64-agp.c +++ b/drivers/char/agp/amd64-agp.c | |||
@@ -734,7 +734,7 @@ int __init agp_amd64_init(void) | |||
734 | 734 | ||
735 | if (agp_off) | 735 | if (agp_off) |
736 | return -EINVAL; | 736 | return -EINVAL; |
737 | if (pci_register_driver(&agp_amd64_pci_driver) > 0) { | 737 | if (pci_register_driver(&agp_amd64_pci_driver) < 0) { |
738 | struct pci_dev *dev; | 738 | struct pci_dev *dev; |
739 | if (!agp_try_unsupported && !agp_try_unsupported_boot) { | 739 | if (!agp_try_unsupported && !agp_try_unsupported_boot) { |
740 | printk(KERN_INFO PFX "No supported AGP bridge found.\n"); | 740 | printk(KERN_INFO PFX "No supported AGP bridge found.\n"); |
diff --git a/drivers/char/agp/ati-agp.c b/drivers/char/agp/ati-agp.c index 160564345993..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,18 +245,20 @@ 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 | ||
@@ -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/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/applicom.c b/drivers/char/applicom.c index 9275d5e52e6d..72fb60765c45 100644 --- a/drivers/char/applicom.c +++ b/drivers/char/applicom.c | |||
@@ -209,13 +209,16 @@ static int __init applicom_init(void) | |||
209 | RamIO = ioremap(dev->resource[0].start, LEN_RAM_IO); | 209 | RamIO = ioremap(dev->resource[0].start, LEN_RAM_IO); |
210 | 210 | ||
211 | if (!RamIO) { | 211 | if (!RamIO) { |
212 | 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); | ||
213 | pci_disable_device(dev); | 215 | pci_disable_device(dev); |
214 | return -EIO; | 216 | return -EIO; |
215 | } | 217 | } |
216 | 218 | ||
217 | 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", |
218 | 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, | ||
219 | dev->irq); | 222 | dev->irq); |
220 | 223 | ||
221 | boardno = ac_register_board(dev->resource[0].start, RamIO,0); | 224 | boardno = ac_register_board(dev->resource[0].start, RamIO,0); |
diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c index 122e7a72a4e1..2657eeba7da6 100644 --- a/drivers/char/cyclades.c +++ b/drivers/char/cyclades.c | |||
@@ -5250,7 +5250,6 @@ cy_init(void) | |||
5250 | cy_serial_driver->owner = THIS_MODULE; | 5250 | cy_serial_driver->owner = THIS_MODULE; |
5251 | cy_serial_driver->driver_name = "cyclades"; | 5251 | cy_serial_driver->driver_name = "cyclades"; |
5252 | cy_serial_driver->name = "ttyC"; | 5252 | cy_serial_driver->name = "ttyC"; |
5253 | cy_serial_driver->devfs_name = "tts/C"; | ||
5254 | cy_serial_driver->major = CYCLADES_MAJOR; | 5253 | cy_serial_driver->major = CYCLADES_MAJOR; |
5255 | cy_serial_driver->minor_start = 0; | 5254 | cy_serial_driver->minor_start = 0; |
5256 | cy_serial_driver->type = TTY_DRIVER_TYPE_SERIAL; | 5255 | cy_serial_driver->type = TTY_DRIVER_TYPE_SERIAL; |
diff --git a/drivers/char/drm/drm_memory_debug.h b/drivers/char/drm/drm_memory_debug.h index 6543b9a14c42..d117cc997192 100644 --- a/drivers/char/drm/drm_memory_debug.h +++ b/drivers/char/drm/drm_memory_debug.h | |||
@@ -43,7 +43,7 @@ typedef struct drm_mem_stats { | |||
43 | unsigned long bytes_freed; | 43 | unsigned long bytes_freed; |
44 | } drm_mem_stats_t; | 44 | } drm_mem_stats_t; |
45 | 45 | ||
46 | static spinlock_t drm_mem_lock = SPIN_LOCK_UNLOCKED; | 46 | static DEFINE_SPINLOCK(drm_mem_lock); |
47 | static unsigned long drm_ram_available = 0; /* In pages */ | 47 | static unsigned long drm_ram_available = 0; /* In pages */ |
48 | static unsigned long drm_ram_used = 0; | 48 | static unsigned long drm_ram_used = 0; |
49 | static drm_mem_stats_t drm_mem_stats[] = | 49 | static drm_mem_stats_t drm_mem_stats[] = |
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/dsp56k.c b/drivers/char/dsp56k.c index e233cf280bc0..09b413618b57 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 | ||
@@ -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..da2c89f1b8bc 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 |
@@ -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/epca.c b/drivers/char/epca.c index 9cad8501d62c..d0b3890d9302 100644 --- a/drivers/char/epca.c +++ b/drivers/char/epca.c | |||
@@ -80,7 +80,7 @@ static int invalid_lilo_config; | |||
80 | /* The ISA boards do window flipping into the same spaces so its only sane | 80 | /* The ISA boards do window flipping into the same spaces so its only sane |
81 | with a single lock. It's still pretty efficient */ | 81 | with a single lock. It's still pretty efficient */ |
82 | 82 | ||
83 | static spinlock_t epca_lock = SPIN_LOCK_UNLOCKED; | 83 | static DEFINE_SPINLOCK(epca_lock); |
84 | 84 | ||
85 | /* ----------------------------------------------------------------------- | 85 | /* ----------------------------------------------------------------------- |
86 | MAXBOARDS is typically 12, but ISA and EISA cards are restricted to | 86 | MAXBOARDS is typically 12, but ISA and EISA cards are restricted to |
@@ -1232,7 +1232,6 @@ static int __init pc_init(void) | |||
1232 | 1232 | ||
1233 | pc_driver->owner = THIS_MODULE; | 1233 | pc_driver->owner = THIS_MODULE; |
1234 | pc_driver->name = "ttyD"; | 1234 | pc_driver->name = "ttyD"; |
1235 | pc_driver->devfs_name = "tts/D"; | ||
1236 | pc_driver->major = DIGI_MAJOR; | 1235 | pc_driver->major = DIGI_MAJOR; |
1237 | pc_driver->minor_start = 0; | 1236 | pc_driver->minor_start = 0; |
1238 | pc_driver->type = TTY_DRIVER_TYPE_SERIAL; | 1237 | pc_driver->type = TTY_DRIVER_TYPE_SERIAL; |
diff --git a/drivers/char/esp.c b/drivers/char/esp.c index 922174d527ae..9827d170ca17 100644 --- a/drivers/char/esp.c +++ b/drivers/char/esp.c | |||
@@ -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/zftape/zftape-init.c b/drivers/char/ftape/zftape/zftape-init.c index 821357ce7e0e..3eeb869a9a11 100644 --- a/drivers/char/ftape/zftape/zftape-init.c +++ b/drivers/char/ftape/zftape/zftape-init.c | |||
@@ -33,7 +33,6 @@ | |||
33 | #endif | 33 | #endif |
34 | #include <linux/fcntl.h> | 34 | #include <linux/fcntl.h> |
35 | #include <linux/smp_lock.h> | 35 | #include <linux/smp_lock.h> |
36 | #include <linux/devfs_fs_kernel.h> | ||
37 | 36 | ||
38 | #include <linux/zftape.h> | 37 | #include <linux/zftape.h> |
39 | #include <linux/init.h> | 38 | #include <linux/init.h> |
@@ -332,29 +331,11 @@ KERN_INFO | |||
332 | zft_class = class_create(THIS_MODULE, "zft"); | 331 | zft_class = class_create(THIS_MODULE, "zft"); |
333 | for (i = 0; i < 4; i++) { | 332 | for (i = 0; i < 4; i++) { |
334 | class_device_create(zft_class, NULL, MKDEV(QIC117_TAPE_MAJOR, i), NULL, "qft%i", i); | 333 | 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); | 334 | 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); | 335 | 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); | 336 | 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); | 337 | 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); | 338 | 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 | } | 339 | } |
359 | 340 | ||
360 | #ifdef CONFIG_ZFT_COMPRESSOR | 341 | #ifdef CONFIG_ZFT_COMPRESSOR |
@@ -380,17 +361,11 @@ static void zft_exit(void) | |||
380 | TRACE(ft_t_info, "successful"); | 361 | TRACE(ft_t_info, "successful"); |
381 | } | 362 | } |
382 | for (i = 0; i < 4; i++) { | 363 | for (i = 0; i < 4; i++) { |
383 | devfs_remove("qft%i", i); | ||
384 | class_device_destroy(zft_class, MKDEV(QIC117_TAPE_MAJOR, i)); | 364 | 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)); | 365 | 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)); | 366 | 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)); | 367 | 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)); | 368 | 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)); | 369 | class_device_destroy(zft_class, MKDEV(QIC117_TAPE_MAJOR, i + 36)); |
395 | } | 370 | } |
396 | class_destroy(zft_class); | 371 | class_destroy(zft_class); |
diff --git a/drivers/char/hvc_console.c b/drivers/char/hvc_console.c index a5c6a9d7ff08..6e380aecea6a 100644 --- a/drivers/char/hvc_console.c +++ b/drivers/char/hvc_console.c | |||
@@ -820,7 +820,6 @@ int __init hvc_init(void) | |||
820 | return -ENOMEM; | 820 | return -ENOMEM; |
821 | 821 | ||
822 | drv->owner = THIS_MODULE; | 822 | drv->owner = THIS_MODULE; |
823 | drv->devfs_name = "hvc/"; | ||
824 | drv->driver_name = "hvc"; | 823 | drv->driver_name = "hvc"; |
825 | drv->name = "hvc"; | 824 | drv->name = "hvc"; |
826 | drv->major = HVC_MAJOR; | 825 | drv->major = HVC_MAJOR; |
diff --git a/drivers/char/hvcs.c b/drivers/char/hvcs.c index 8d97b3911293..130dedc37568 100644 --- a/drivers/char/hvcs.c +++ b/drivers/char/hvcs.c | |||
@@ -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 a0370ed752ce..7b04eb153205 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; |
diff --git a/drivers/char/ip2/ip2main.c b/drivers/char/ip2/ip2main.c index 9ab33c3d359f..8619542766cb 100644 --- a/drivers/char/ip2/ip2main.c +++ b/drivers/char/ip2/ip2main.c | |||
@@ -91,7 +91,6 @@ | |||
91 | #include <linux/module.h> | 91 | #include <linux/module.h> |
92 | #include <linux/signal.h> | 92 | #include <linux/signal.h> |
93 | #include <linux/sched.h> | 93 | #include <linux/sched.h> |
94 | #include <linux/devfs_fs_kernel.h> | ||
95 | #include <linux/timer.h> | 94 | #include <linux/timer.h> |
96 | #include <linux/interrupt.h> | 95 | #include <linux/interrupt.h> |
97 | #include <linux/pci.h> | 96 | #include <linux/pci.h> |
@@ -414,9 +413,7 @@ cleanup_module(void) | |||
414 | /* free io addresses and Tibet */ | 413 | /* free io addresses and Tibet */ |
415 | release_region( ip2config.addr[i], 8 ); | 414 | release_region( ip2config.addr[i], 8 ); |
416 | class_device_destroy(ip2_class, MKDEV(IP2_IPL_MAJOR, 4 * i)); | 415 | 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)); | 416 | class_device_destroy(ip2_class, MKDEV(IP2_IPL_MAJOR, 4 * i + 1)); |
419 | devfs_remove("ip2/stat%d", i); | ||
420 | } | 417 | } |
421 | /* Disable and remove interrupt handler. */ | 418 | /* Disable and remove interrupt handler. */ |
422 | if ( (ip2config.irq[i] > 0) && have_requested_irq(ip2config.irq[i]) ) { | 419 | if ( (ip2config.irq[i] > 0) && have_requested_irq(ip2config.irq[i]) ) { |
@@ -425,7 +422,6 @@ cleanup_module(void) | |||
425 | } | 422 | } |
426 | } | 423 | } |
427 | class_destroy(ip2_class); | 424 | class_destroy(ip2_class); |
428 | devfs_remove("ip2"); | ||
429 | if ( ( err = tty_unregister_driver ( ip2_tty_driver ) ) ) { | 425 | if ( ( err = tty_unregister_driver ( ip2_tty_driver ) ) ) { |
430 | printk(KERN_ERR "IP2: failed to unregister tty driver (%d)\n", err); | 426 | printk(KERN_ERR "IP2: failed to unregister tty driver (%d)\n", err); |
431 | } | 427 | } |
@@ -675,7 +671,6 @@ ip2_loadmain(int *iop, int *irqp, unsigned char *firmware, int firmsize) | |||
675 | 671 | ||
676 | ip2_tty_driver->owner = THIS_MODULE; | 672 | ip2_tty_driver->owner = THIS_MODULE; |
677 | ip2_tty_driver->name = "ttyF"; | 673 | ip2_tty_driver->name = "ttyF"; |
678 | ip2_tty_driver->devfs_name = "tts/F"; | ||
679 | ip2_tty_driver->driver_name = pcDriver_name; | 674 | ip2_tty_driver->driver_name = pcDriver_name; |
680 | ip2_tty_driver->major = IP2_TTY_MAJOR; | 675 | ip2_tty_driver->major = IP2_TTY_MAJOR; |
681 | ip2_tty_driver->minor_start = 0; | 676 | ip2_tty_driver->minor_start = 0; |
@@ -683,7 +678,7 @@ ip2_loadmain(int *iop, int *irqp, unsigned char *firmware, int firmsize) | |||
683 | ip2_tty_driver->subtype = SERIAL_TYPE_NORMAL; | 678 | ip2_tty_driver->subtype = SERIAL_TYPE_NORMAL; |
684 | ip2_tty_driver->init_termios = tty_std_termios; | 679 | ip2_tty_driver->init_termios = tty_std_termios; |
685 | ip2_tty_driver->init_termios.c_cflag = B9600|CS8|CREAD|HUPCL|CLOCAL; | 680 | 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; | 681 | ip2_tty_driver->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV; |
687 | tty_set_operations(ip2_tty_driver, &ip2_ops); | 682 | tty_set_operations(ip2_tty_driver, &ip2_ops); |
688 | 683 | ||
689 | ip2trace (ITRC_NO_PORT, ITRC_INIT, 3, 0 ); | 684 | ip2trace (ITRC_NO_PORT, ITRC_INIT, 3, 0 ); |
@@ -724,26 +719,9 @@ ip2_loadmain(int *iop, int *irqp, unsigned char *firmware, int firmsize) | |||
724 | class_device_create(ip2_class, NULL, | 719 | class_device_create(ip2_class, NULL, |
725 | MKDEV(IP2_IPL_MAJOR, 4 * i), | 720 | MKDEV(IP2_IPL_MAJOR, 4 * i), |
726 | NULL, "ipl%d", i); | 721 | 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, | 722 | class_device_create(ip2_class, NULL, |
737 | MKDEV(IP2_IPL_MAJOR, 4 * i + 1), | 723 | MKDEV(IP2_IPL_MAJOR, 4 * i + 1), |
738 | NULL, "stat%d", i); | 724 | 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 | 725 | ||
748 | for ( box = 0; box < ABS_MAX_BOXES; ++box ) | 726 | for ( box = 0; box < ABS_MAX_BOXES; ++box ) |
749 | { | 727 | { |
diff --git a/drivers/char/ipmi/ipmi_devintf.c b/drivers/char/ipmi/ipmi_devintf.c index e1c95374984c..da637adbbfaa 100644 --- a/drivers/char/ipmi/ipmi_devintf.c +++ b/drivers/char/ipmi/ipmi_devintf.c | |||
@@ -40,7 +40,6 @@ | |||
40 | #include <linux/poll.h> | 40 | #include <linux/poll.h> |
41 | #include <linux/spinlock.h> | 41 | #include <linux/spinlock.h> |
42 | #include <linux/slab.h> | 42 | #include <linux/slab.h> |
43 | #include <linux/devfs_fs_kernel.h> | ||
44 | #include <linux/ipmi.h> | 43 | #include <linux/ipmi.h> |
45 | #include <linux/mutex.h> | 44 | #include <linux/mutex.h> |
46 | #include <linux/init.h> | 45 | #include <linux/init.h> |
@@ -804,9 +803,6 @@ static void ipmi_new_smi(int if_num, struct device *device) | |||
804 | dev_t dev = MKDEV(ipmi_major, if_num); | 803 | dev_t dev = MKDEV(ipmi_major, if_num); |
805 | struct ipmi_reg_list *entry; | 804 | struct ipmi_reg_list *entry; |
806 | 805 | ||
807 | devfs_mk_cdev(dev, S_IFCHR | S_IRUSR | S_IWUSR, | ||
808 | "ipmidev/%d", if_num); | ||
809 | |||
810 | entry = kmalloc(sizeof(*entry), GFP_KERNEL); | 806 | entry = kmalloc(sizeof(*entry), GFP_KERNEL); |
811 | if (!entry) { | 807 | if (!entry) { |
812 | printk(KERN_ERR "ipmi_devintf: Unable to create the" | 808 | printk(KERN_ERR "ipmi_devintf: Unable to create the" |
@@ -836,7 +832,6 @@ static void ipmi_smi_gone(int if_num) | |||
836 | } | 832 | } |
837 | class_device_destroy(ipmi_class, dev); | 833 | class_device_destroy(ipmi_class, dev); |
838 | mutex_unlock(®_list_mutex); | 834 | mutex_unlock(®_list_mutex); |
839 | devfs_remove("ipmidev/%d", if_num); | ||
840 | } | 835 | } |
841 | 836 | ||
842 | static struct ipmi_smi_watcher smi_watcher = | 837 | static struct ipmi_smi_watcher smi_watcher = |
@@ -872,8 +867,6 @@ static __init int init_ipmi_devintf(void) | |||
872 | ipmi_major = rv; | 867 | ipmi_major = rv; |
873 | } | 868 | } |
874 | 869 | ||
875 | devfs_mk_dir(DEVICE_NAME); | ||
876 | |||
877 | rv = ipmi_smi_watcher_register(&smi_watcher); | 870 | rv = ipmi_smi_watcher_register(&smi_watcher); |
878 | if (rv) { | 871 | if (rv) { |
879 | unregister_chrdev(ipmi_major, DEVICE_NAME); | 872 | unregister_chrdev(ipmi_major, DEVICE_NAME); |
@@ -898,7 +891,6 @@ static __exit void cleanup_ipmi(void) | |||
898 | mutex_unlock(®_list_mutex); | 891 | mutex_unlock(®_list_mutex); |
899 | class_destroy(ipmi_class); | 892 | class_destroy(ipmi_class); |
900 | ipmi_smi_watcher_unregister(&smi_watcher); | 893 | ipmi_smi_watcher_unregister(&smi_watcher); |
901 | devfs_remove(DEVICE_NAME); | ||
902 | unregister_chrdev(ipmi_major, DEVICE_NAME); | 894 | unregister_chrdev(ipmi_major, DEVICE_NAME); |
903 | } | 895 | } |
904 | module_exit(cleanup_ipmi); | 896 | module_exit(cleanup_ipmi); |
diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c index b03ddab1bef5..ad26f4b997c5 100644 --- a/drivers/char/ipmi/ipmi_msghandler.c +++ b/drivers/char/ipmi/ipmi_msghandler.c | |||
@@ -57,8 +57,7 @@ static int ipmi_init_msghandler(void); | |||
57 | static int initialized = 0; | 57 | static int initialized = 0; |
58 | 58 | ||
59 | #ifdef CONFIG_PROC_FS | 59 | #ifdef CONFIG_PROC_FS |
60 | struct proc_dir_entry *proc_ipmi_root = NULL; | 60 | static struct proc_dir_entry *proc_ipmi_root = NULL; |
61 | EXPORT_SYMBOL(proc_ipmi_root); | ||
62 | #endif /* CONFIG_PROC_FS */ | 61 | #endif /* CONFIG_PROC_FS */ |
63 | 62 | ||
64 | #define MAX_EVENTS_IN_QUEUE 25 | 63 | #define MAX_EVENTS_IN_QUEUE 25 |
@@ -3739,11 +3738,8 @@ static int ipmi_init_msghandler(void) | |||
3739 | proc_ipmi_root->owner = THIS_MODULE; | 3738 | proc_ipmi_root->owner = THIS_MODULE; |
3740 | #endif /* CONFIG_PROC_FS */ | 3739 | #endif /* CONFIG_PROC_FS */ |
3741 | 3740 | ||
3742 | init_timer(&ipmi_timer); | 3741 | setup_timer(&ipmi_timer, ipmi_timeout, 0); |
3743 | ipmi_timer.data = 0; | 3742 | mod_timer(&ipmi_timer, jiffies + IPMI_TIMEOUT_JIFFIES); |
3744 | ipmi_timer.function = ipmi_timeout; | ||
3745 | ipmi_timer.expires = jiffies + IPMI_TIMEOUT_JIFFIES; | ||
3746 | add_timer(&ipmi_timer); | ||
3747 | 3743 | ||
3748 | atomic_notifier_chain_register(&panic_notifier_list, &panic_block); | 3744 | atomic_notifier_chain_register(&panic_notifier_list, &panic_block); |
3749 | 3745 | ||
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c index 02a7dd7a8a55..bd4f2248b758 100644 --- a/drivers/char/ipmi/ipmi_si_intf.c +++ b/drivers/char/ipmi/ipmi_si_intf.c | |||
@@ -55,23 +55,6 @@ | |||
55 | #include <linux/mutex.h> | 55 | #include <linux/mutex.h> |
56 | #include <linux/kthread.h> | 56 | #include <linux/kthread.h> |
57 | #include <asm/irq.h> | 57 | #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> | 58 | #include <linux/interrupt.h> |
76 | #include <linux/rcupdate.h> | 59 | #include <linux/rcupdate.h> |
77 | #include <linux/ipmi_smi.h> | 60 | #include <linux/ipmi_smi.h> |
@@ -243,8 +226,6 @@ static int register_xaction_notifier(struct notifier_block * nb) | |||
243 | return atomic_notifier_chain_register(&xaction_notifier_list, nb); | 226 | return atomic_notifier_chain_register(&xaction_notifier_list, nb); |
244 | } | 227 | } |
245 | 228 | ||
246 | static void si_restart_short_timer(struct smi_info *smi_info); | ||
247 | |||
248 | static void deliver_recv_msg(struct smi_info *smi_info, | 229 | static void deliver_recv_msg(struct smi_info *smi_info, |
249 | struct ipmi_smi_msg *msg) | 230 | struct ipmi_smi_msg *msg) |
250 | { | 231 | { |
@@ -768,7 +749,6 @@ static void sender(void *send_info, | |||
768 | && (smi_info->curr_msg == NULL)) | 749 | && (smi_info->curr_msg == NULL)) |
769 | { | 750 | { |
770 | start_next_msg(smi_info); | 751 | start_next_msg(smi_info); |
771 | si_restart_short_timer(smi_info); | ||
772 | } | 752 | } |
773 | spin_unlock_irqrestore(&(smi_info->si_lock), flags); | 753 | spin_unlock_irqrestore(&(smi_info->si_lock), flags); |
774 | } | 754 | } |
@@ -809,7 +789,7 @@ static int ipmi_thread(void *data) | |||
809 | /* do nothing */ | 789 | /* do nothing */ |
810 | } | 790 | } |
811 | else if (smi_result == SI_SM_CALL_WITH_DELAY) | 791 | else if (smi_result == SI_SM_CALL_WITH_DELAY) |
812 | udelay(1); | 792 | schedule(); |
813 | else | 793 | else |
814 | schedule_timeout_interruptible(1); | 794 | schedule_timeout_interruptible(1); |
815 | } | 795 | } |
@@ -833,37 +813,6 @@ static void request_events(void *send_info) | |||
833 | 813 | ||
834 | static int initialized = 0; | 814 | static int initialized = 0; |
835 | 815 | ||
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) | 816 | static void smi_timeout(unsigned long data) |
868 | { | 817 | { |
869 | struct smi_info *smi_info = (struct smi_info *) data; | 818 | struct smi_info *smi_info = (struct smi_info *) data; |
@@ -904,31 +853,15 @@ static void smi_timeout(unsigned long data) | |||
904 | /* If the state machine asks for a short delay, then shorten | 853 | /* If the state machine asks for a short delay, then shorten |
905 | the timer timeout. */ | 854 | the timer timeout. */ |
906 | if (smi_result == SI_SM_CALL_WITH_DELAY) { | 855 | 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); | 856 | spin_lock_irqsave(&smi_info->count_lock, flags); |
911 | smi_info->short_timeouts++; | 857 | smi_info->short_timeouts++; |
912 | spin_unlock_irqrestore(&smi_info->count_lock, flags); | 858 | 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; | 859 | smi_info->si_timer.expires = jiffies + 1; |
923 | #endif | ||
924 | } else { | 860 | } else { |
925 | spin_lock_irqsave(&smi_info->count_lock, flags); | 861 | spin_lock_irqsave(&smi_info->count_lock, flags); |
926 | smi_info->long_timeouts++; | 862 | smi_info->long_timeouts++; |
927 | spin_unlock_irqrestore(&smi_info->count_lock, flags); | 863 | spin_unlock_irqrestore(&smi_info->count_lock, flags); |
928 | smi_info->si_timer.expires = jiffies + SI_TIMEOUT_JIFFIES; | 864 | 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 | } | 865 | } |
933 | 866 | ||
934 | do_add_timer: | 867 | do_add_timer: |
diff --git a/drivers/char/ipmi/ipmi_watchdog.c b/drivers/char/ipmi/ipmi_watchdog.c index 8f8867170973..1a0a19c53605 100644 --- a/drivers/char/ipmi/ipmi_watchdog.c +++ b/drivers/char/ipmi/ipmi_watchdog.c | |||
@@ -949,9 +949,10 @@ static int wdog_reboot_handler(struct notifier_block *this, | |||
949 | /* Disable the WDT if we are shutting down. */ | 949 | /* Disable the WDT if we are shutting down. */ |
950 | ipmi_watchdog_state = WDOG_TIMEOUT_NONE; | 950 | ipmi_watchdog_state = WDOG_TIMEOUT_NONE; |
951 | panic_halt_ipmi_set_timeout(); | 951 | panic_halt_ipmi_set_timeout(); |
952 | } else { | 952 | } else if (ipmi_watchdog_state != WDOG_TIMEOUT_NONE) { |
953 | /* Set a long timer to let the reboot happens, but | 953 | /* Set a long timer to let the reboot happens, but |
954 | reboot if it hangs. */ | 954 | reboot if it hangs, but only if the watchdog |
955 | timer was already running. */ | ||
955 | timeout = 120; | 956 | timeout = 120; |
956 | pretimeout = 0; | 957 | pretimeout = 0; |
957 | ipmi_watchdog_state = WDOG_TIMEOUT_RESET; | 958 | ipmi_watchdog_state = WDOG_TIMEOUT_RESET; |
@@ -973,16 +974,17 @@ static int wdog_panic_handler(struct notifier_block *this, | |||
973 | { | 974 | { |
974 | static int panic_event_handled = 0; | 975 | static int panic_event_handled = 0; |
975 | 976 | ||
976 | /* On a panic, if we have a panic timeout, make sure that the thing | 977 | /* On a panic, if we have a panic timeout, make sure to extend |
977 | reboots, even if it hangs during that panic. */ | 978 | the watchdog timer to a reasonable value to complete the |
978 | if (watchdog_user && !panic_event_handled) { | 979 | panic, if the watchdog timer is running. Plus the |
979 | /* Make sure the panic doesn't hang, and make sure we | 980 | pretimeout is meaningless at panic time. */ |
980 | do this only once. */ | 981 | if (watchdog_user && !panic_event_handled && |
982 | ipmi_watchdog_state != WDOG_TIMEOUT_NONE) { | ||
983 | /* Make sure we do this only once. */ | ||
981 | panic_event_handled = 1; | 984 | panic_event_handled = 1; |
982 | 985 | ||
983 | timeout = 255; | 986 | timeout = 255; |
984 | pretimeout = 0; | 987 | pretimeout = 0; |
985 | ipmi_watchdog_state = WDOG_TIMEOUT_RESET; | ||
986 | panic_halt_ipmi_set_timeout(); | 988 | panic_halt_ipmi_set_timeout(); |
987 | } | 989 | } |
988 | 990 | ||
diff --git a/drivers/char/isicom.c b/drivers/char/isicom.c index efaaa1937ab6..478bf4d7d065 100644 --- a/drivers/char/isicom.c +++ b/drivers/char/isicom.c | |||
@@ -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; |
diff --git a/drivers/char/istallion.c b/drivers/char/istallion.c index ef20c1fc9c4c..c74e5660a9b7 100644 --- a/drivers/char/istallion.c +++ b/drivers/char/istallion.c | |||
@@ -39,16 +39,14 @@ | |||
39 | #include <linux/ioport.h> | 39 | #include <linux/ioport.h> |
40 | #include <linux/delay.h> | 40 | #include <linux/delay.h> |
41 | #include <linux/init.h> | 41 | #include <linux/init.h> |
42 | #include <linux/devfs_fs_kernel.h> | ||
43 | #include <linux/device.h> | 42 | #include <linux/device.h> |
44 | #include <linux/wait.h> | 43 | #include <linux/wait.h> |
44 | #include <linux/eisa.h> | ||
45 | 45 | ||
46 | #include <asm/io.h> | 46 | #include <asm/io.h> |
47 | #include <asm/uaccess.h> | 47 | #include <asm/uaccess.h> |
48 | 48 | ||
49 | #ifdef CONFIG_PCI | ||
50 | #include <linux/pci.h> | 49 | #include <linux/pci.h> |
51 | #endif | ||
52 | 50 | ||
53 | /*****************************************************************************/ | 51 | /*****************************************************************************/ |
54 | 52 | ||
@@ -137,6 +135,10 @@ static stlconf_t stli_brdconf[] = { | |||
137 | 135 | ||
138 | static int stli_nrbrds = ARRAY_SIZE(stli_brdconf); | 136 | static int stli_nrbrds = ARRAY_SIZE(stli_brdconf); |
139 | 137 | ||
138 | /* stli_lock must NOT be taken holding brd_lock */ | ||
139 | static spinlock_t stli_lock; /* TTY logic lock */ | ||
140 | static spinlock_t brd_lock; /* Board logic lock */ | ||
141 | |||
140 | /* | 142 | /* |
141 | * There is some experimental EISA board detection code in this driver. | 143 | * 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, | 144 | * By default it is disabled, but for those that want to try it out, |
@@ -173,14 +175,6 @@ static char *stli_serialname = "ttyE"; | |||
173 | 175 | ||
174 | static struct tty_driver *stli_serial; | 176 | static struct tty_driver *stli_serial; |
175 | 177 | ||
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 | 178 | ||
185 | #define STLI_TXBUFSIZE 4096 | 179 | #define STLI_TXBUFSIZE 4096 |
186 | 180 | ||
@@ -419,7 +413,7 @@ static int stli_eisamempsize = ARRAY_SIZE(stli_eisamemprobeaddrs); | |||
419 | #endif | 413 | #endif |
420 | 414 | ||
421 | static struct pci_device_id istallion_pci_tbl[] = { | 415 | 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 }, | 416 | { PCI_DEVICE(PCI_VENDOR_ID_STALLION, PCI_DEVICE_ID_ECRA), }, |
423 | { 0 } | 417 | { 0 } |
424 | }; | 418 | }; |
425 | MODULE_DEVICE_TABLE(pci, istallion_pci_tbl); | 419 | MODULE_DEVICE_TABLE(pci, istallion_pci_tbl); |
@@ -682,7 +676,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); | 676 | 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); | 677 | 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); | 678 | 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); | 679 | static void stli_brdpoll(stlibrd_t *brdp, cdkhdr_t __iomem *hdrp); |
686 | static void stli_poll(unsigned long arg); | 680 | static void stli_poll(unsigned long arg); |
687 | static int stli_hostcmd(stlibrd_t *brdp, stliport_t *portp); | 681 | static int stli_hostcmd(stlibrd_t *brdp, stliport_t *portp); |
688 | static int stli_initopen(stlibrd_t *brdp, stliport_t *portp); | 682 | static int stli_initopen(stlibrd_t *brdp, stliport_t *portp); |
@@ -693,7 +687,8 @@ static void stli_dohangup(void *arg); | |||
693 | static int stli_setport(stliport_t *portp); | 687 | 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); | 688 | 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); | 689 | 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); | 690 | static void __stli_sendcmd(stlibrd_t *brdp, stliport_t *portp, unsigned long cmd, void *arg, int size, int copyback); |
691 | 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); | 692 | 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); | 693 | static void stli_mkasysigs(asysigs_t *sp, int dtr, int rts); |
699 | static long stli_mktiocm(unsigned long sigvalue); | 694 | static long stli_mktiocm(unsigned long sigvalue); |
@@ -799,18 +794,8 @@ static struct class *istallion_class; | |||
799 | 794 | ||
800 | static int __init istallion_module_init(void) | 795 | static int __init istallion_module_init(void) |
801 | { | 796 | { |
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(); | 797 | stli_init(); |
811 | restore_flags(flags); | 798 | return 0; |
812 | |||
813 | return(0); | ||
814 | } | 799 | } |
815 | 800 | ||
816 | /*****************************************************************************/ | 801 | /*****************************************************************************/ |
@@ -819,56 +804,43 @@ static void __exit istallion_module_exit(void) | |||
819 | { | 804 | { |
820 | stlibrd_t *brdp; | 805 | stlibrd_t *brdp; |
821 | stliport_t *portp; | 806 | stliport_t *portp; |
822 | unsigned long flags; | ||
823 | int i, j; | 807 | int i, j; |
824 | 808 | ||
825 | #ifdef DEBUG | ||
826 | printk("cleanup_module()\n"); | ||
827 | #endif | ||
828 | |||
829 | printk(KERN_INFO "Unloading %s: version %s\n", stli_drvtitle, | 809 | printk(KERN_INFO "Unloading %s: version %s\n", stli_drvtitle, |
830 | stli_drvversion); | 810 | stli_drvversion); |
831 | 811 | ||
832 | save_flags(flags); | 812 | /* |
833 | cli(); | 813 | * Free up all allocated resources used by the ports. This includes |
834 | 814 | * memory and interrupts. | |
835 | /* | 815 | */ |
836 | * Free up all allocated resources used by the ports. This includes | ||
837 | * memory and interrupts. | ||
838 | */ | ||
839 | if (stli_timeron) { | 816 | if (stli_timeron) { |
840 | stli_timeron = 0; | 817 | stli_timeron = 0; |
841 | del_timer(&stli_timerlist); | 818 | del_timer_sync(&stli_timerlist); |
842 | } | 819 | } |
843 | 820 | ||
844 | i = tty_unregister_driver(stli_serial); | 821 | i = tty_unregister_driver(stli_serial); |
845 | if (i) { | 822 | if (i) { |
846 | printk("STALLION: failed to un-register tty driver, " | 823 | printk("STALLION: failed to un-register tty driver, " |
847 | "errno=%d\n", -i); | 824 | "errno=%d\n", -i); |
848 | restore_flags(flags); | ||
849 | return; | 825 | return; |
850 | } | 826 | } |
851 | put_tty_driver(stli_serial); | 827 | put_tty_driver(stli_serial); |
852 | for (i = 0; i < 4; i++) { | 828 | for (i = 0; i < 4; i++) |
853 | devfs_remove("staliomem/%d", i); | ||
854 | class_device_destroy(istallion_class, MKDEV(STL_SIOMEMMAJOR, i)); | 829 | class_device_destroy(istallion_class, MKDEV(STL_SIOMEMMAJOR, i)); |
855 | } | ||
856 | devfs_remove("staliomem"); | ||
857 | class_destroy(istallion_class); | 830 | class_destroy(istallion_class); |
858 | if ((i = unregister_chrdev(STL_SIOMEMMAJOR, "staliomem"))) | 831 | if ((i = unregister_chrdev(STL_SIOMEMMAJOR, "staliomem"))) |
859 | printk("STALLION: failed to un-register serial memory device, " | 832 | printk("STALLION: failed to un-register serial memory device, " |
860 | "errno=%d\n", -i); | 833 | "errno=%d\n", -i); |
861 | 834 | ||
862 | kfree(stli_tmpwritebuf); | ||
863 | kfree(stli_txcookbuf); | 835 | kfree(stli_txcookbuf); |
864 | 836 | ||
865 | for (i = 0; (i < stli_nrbrds); i++) { | 837 | for (i = 0; (i < stli_nrbrds); i++) { |
866 | if ((brdp = stli_brds[i]) == (stlibrd_t *) NULL) | 838 | if ((brdp = stli_brds[i]) == NULL) |
867 | continue; | 839 | continue; |
868 | for (j = 0; (j < STL_MAXPORTS); j++) { | 840 | for (j = 0; (j < STL_MAXPORTS); j++) { |
869 | portp = brdp->ports[j]; | 841 | portp = brdp->ports[j]; |
870 | if (portp != (stliport_t *) NULL) { | 842 | if (portp != NULL) { |
871 | if (portp->tty != (struct tty_struct *) NULL) | 843 | if (portp->tty != NULL) |
872 | tty_hangup(portp->tty); | 844 | tty_hangup(portp->tty); |
873 | kfree(portp); | 845 | kfree(portp); |
874 | } | 846 | } |
@@ -878,10 +850,8 @@ static void __exit istallion_module_exit(void) | |||
878 | if (brdp->iosize > 0) | 850 | if (brdp->iosize > 0) |
879 | release_region(brdp->iobase, brdp->iosize); | 851 | release_region(brdp->iobase, brdp->iosize); |
880 | kfree(brdp); | 852 | kfree(brdp); |
881 | stli_brds[i] = (stlibrd_t *) NULL; | 853 | stli_brds[i] = NULL; |
882 | } | 854 | } |
883 | |||
884 | restore_flags(flags); | ||
885 | } | 855 | } |
886 | 856 | ||
887 | module_init(istallion_module_init); | 857 | module_init(istallion_module_init); |
@@ -895,19 +865,15 @@ module_exit(istallion_module_exit); | |||
895 | 865 | ||
896 | static void stli_argbrds(void) | 866 | static void stli_argbrds(void) |
897 | { | 867 | { |
898 | stlconf_t conf; | 868 | stlconf_t conf; |
899 | stlibrd_t *brdp; | 869 | stlibrd_t *brdp; |
900 | int i; | 870 | int i; |
901 | |||
902 | #ifdef DEBUG | ||
903 | printk("stli_argbrds()\n"); | ||
904 | #endif | ||
905 | 871 | ||
906 | for (i = stli_nrbrds; i < ARRAY_SIZE(stli_brdsp); i++) { | 872 | for (i = stli_nrbrds; i < ARRAY_SIZE(stli_brdsp); i++) { |
907 | memset(&conf, 0, sizeof(conf)); | 873 | memset(&conf, 0, sizeof(conf)); |
908 | if (stli_parsebrd(&conf, stli_brdsp[i]) == 0) | 874 | if (stli_parsebrd(&conf, stli_brdsp[i]) == 0) |
909 | continue; | 875 | continue; |
910 | if ((brdp = stli_allocbrd()) == (stlibrd_t *) NULL) | 876 | if ((brdp = stli_allocbrd()) == NULL) |
911 | continue; | 877 | continue; |
912 | stli_nrbrds = i + 1; | 878 | stli_nrbrds = i + 1; |
913 | brdp->brdnr = i; | 879 | brdp->brdnr = i; |
@@ -926,9 +892,9 @@ static void stli_argbrds(void) | |||
926 | 892 | ||
927 | static unsigned long stli_atol(char *str) | 893 | static unsigned long stli_atol(char *str) |
928 | { | 894 | { |
929 | unsigned long val; | 895 | unsigned long val; |
930 | int base, c; | 896 | int base, c; |
931 | char *sp; | 897 | char *sp; |
932 | 898 | ||
933 | val = 0; | 899 | val = 0; |
934 | sp = str; | 900 | sp = str; |
@@ -962,15 +928,11 @@ static unsigned long stli_atol(char *str) | |||
962 | 928 | ||
963 | static int stli_parsebrd(stlconf_t *confp, char **argp) | 929 | static int stli_parsebrd(stlconf_t *confp, char **argp) |
964 | { | 930 | { |
965 | char *sp; | 931 | char *sp; |
966 | int i; | 932 | int i; |
967 | |||
968 | #ifdef DEBUG | ||
969 | printk("stli_parsebrd(confp=%x,argp=%x)\n", (int) confp, (int) argp); | ||
970 | #endif | ||
971 | 933 | ||
972 | if ((argp[0] == (char *) NULL) || (*argp[0] == 0)) | 934 | if (argp[0] == NULL || *argp[0] == 0) |
973 | return(0); | 935 | return 0; |
974 | 936 | ||
975 | for (sp = argp[0], i = 0; ((*sp != 0) && (i < 25)); sp++, i++) | 937 | for (sp = argp[0], i = 0; ((*sp != 0) && (i < 25)); sp++, i++) |
976 | *sp = TOLOWER(*sp); | 938 | *sp = TOLOWER(*sp); |
@@ -985,9 +947,9 @@ static int stli_parsebrd(stlconf_t *confp, char **argp) | |||
985 | } | 947 | } |
986 | 948 | ||
987 | confp->brdtype = stli_brdstr[i].type; | 949 | confp->brdtype = stli_brdstr[i].type; |
988 | if ((argp[1] != (char *) NULL) && (*argp[1] != 0)) | 950 | if (argp[1] != NULL && *argp[1] != 0) |
989 | confp->ioaddr1 = stli_atol(argp[1]); | 951 | confp->ioaddr1 = stli_atol(argp[1]); |
990 | if ((argp[2] != (char *) NULL) && (*argp[2] != 0)) | 952 | if (argp[2] != NULL && *argp[2] != 0) |
991 | confp->memaddr = stli_atol(argp[2]); | 953 | confp->memaddr = stli_atol(argp[2]); |
992 | return(1); | 954 | return(1); |
993 | } | 955 | } |
@@ -998,34 +960,29 @@ static int stli_parsebrd(stlconf_t *confp, char **argp) | |||
998 | 960 | ||
999 | static int stli_open(struct tty_struct *tty, struct file *filp) | 961 | static int stli_open(struct tty_struct *tty, struct file *filp) |
1000 | { | 962 | { |
1001 | stlibrd_t *brdp; | 963 | stlibrd_t *brdp; |
1002 | stliport_t *portp; | 964 | stliport_t *portp; |
1003 | unsigned int minordev; | 965 | unsigned int minordev; |
1004 | int brdnr, portnr, rc; | 966 | 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 | 967 | ||
1011 | minordev = tty->index; | 968 | minordev = tty->index; |
1012 | brdnr = MINOR2BRD(minordev); | 969 | brdnr = MINOR2BRD(minordev); |
1013 | if (brdnr >= stli_nrbrds) | 970 | if (brdnr >= stli_nrbrds) |
1014 | return(-ENODEV); | 971 | return -ENODEV; |
1015 | brdp = stli_brds[brdnr]; | 972 | brdp = stli_brds[brdnr]; |
1016 | if (brdp == (stlibrd_t *) NULL) | 973 | if (brdp == NULL) |
1017 | return(-ENODEV); | 974 | return -ENODEV; |
1018 | if ((brdp->state & BST_STARTED) == 0) | 975 | if ((brdp->state & BST_STARTED) == 0) |
1019 | return(-ENODEV); | 976 | return -ENODEV; |
1020 | portnr = MINOR2PORT(minordev); | 977 | portnr = MINOR2PORT(minordev); |
1021 | if ((portnr < 0) || (portnr > brdp->nrports)) | 978 | if ((portnr < 0) || (portnr > brdp->nrports)) |
1022 | return(-ENODEV); | 979 | return -ENODEV; |
1023 | 980 | ||
1024 | portp = brdp->ports[portnr]; | 981 | portp = brdp->ports[portnr]; |
1025 | if (portp == (stliport_t *) NULL) | 982 | if (portp == NULL) |
1026 | return(-ENODEV); | 983 | return -ENODEV; |
1027 | if (portp->devnr < 1) | 984 | if (portp->devnr < 1) |
1028 | return(-ENODEV); | 985 | return -ENODEV; |
1029 | 986 | ||
1030 | 987 | ||
1031 | /* | 988 | /* |
@@ -1037,8 +994,8 @@ static int stli_open(struct tty_struct *tty, struct file *filp) | |||
1037 | if (portp->flags & ASYNC_CLOSING) { | 994 | if (portp->flags & ASYNC_CLOSING) { |
1038 | interruptible_sleep_on(&portp->close_wait); | 995 | interruptible_sleep_on(&portp->close_wait); |
1039 | if (portp->flags & ASYNC_HUP_NOTIFY) | 996 | if (portp->flags & ASYNC_HUP_NOTIFY) |
1040 | return(-EAGAIN); | 997 | return -EAGAIN; |
1041 | return(-ERESTARTSYS); | 998 | return -ERESTARTSYS; |
1042 | } | 999 | } |
1043 | 1000 | ||
1044 | /* | 1001 | /* |
@@ -1054,7 +1011,7 @@ static int stli_open(struct tty_struct *tty, struct file *filp) | |||
1054 | wait_event_interruptible(portp->raw_wait, | 1011 | wait_event_interruptible(portp->raw_wait, |
1055 | !test_bit(ST_INITIALIZING, &portp->state)); | 1012 | !test_bit(ST_INITIALIZING, &portp->state)); |
1056 | if (signal_pending(current)) | 1013 | if (signal_pending(current)) |
1057 | return(-ERESTARTSYS); | 1014 | return -ERESTARTSYS; |
1058 | 1015 | ||
1059 | if ((portp->flags & ASYNC_INITIALIZED) == 0) { | 1016 | if ((portp->flags & ASYNC_INITIALIZED) == 0) { |
1060 | set_bit(ST_INITIALIZING, &portp->state); | 1017 | set_bit(ST_INITIALIZING, &portp->state); |
@@ -1065,7 +1022,7 @@ static int stli_open(struct tty_struct *tty, struct file *filp) | |||
1065 | clear_bit(ST_INITIALIZING, &portp->state); | 1022 | clear_bit(ST_INITIALIZING, &portp->state); |
1066 | wake_up_interruptible(&portp->raw_wait); | 1023 | wake_up_interruptible(&portp->raw_wait); |
1067 | if (rc < 0) | 1024 | if (rc < 0) |
1068 | return(rc); | 1025 | return rc; |
1069 | } | 1026 | } |
1070 | 1027 | ||
1071 | /* | 1028 | /* |
@@ -1077,8 +1034,8 @@ static int stli_open(struct tty_struct *tty, struct file *filp) | |||
1077 | if (portp->flags & ASYNC_CLOSING) { | 1034 | if (portp->flags & ASYNC_CLOSING) { |
1078 | interruptible_sleep_on(&portp->close_wait); | 1035 | interruptible_sleep_on(&portp->close_wait); |
1079 | if (portp->flags & ASYNC_HUP_NOTIFY) | 1036 | if (portp->flags & ASYNC_HUP_NOTIFY) |
1080 | return(-EAGAIN); | 1037 | return -EAGAIN; |
1081 | return(-ERESTARTSYS); | 1038 | return -ERESTARTSYS; |
1082 | } | 1039 | } |
1083 | 1040 | ||
1084 | /* | 1041 | /* |
@@ -1088,38 +1045,33 @@ static int stli_open(struct tty_struct *tty, struct file *filp) | |||
1088 | */ | 1045 | */ |
1089 | if (!(filp->f_flags & O_NONBLOCK)) { | 1046 | if (!(filp->f_flags & O_NONBLOCK)) { |
1090 | if ((rc = stli_waitcarrier(brdp, portp, filp)) != 0) | 1047 | if ((rc = stli_waitcarrier(brdp, portp, filp)) != 0) |
1091 | return(rc); | 1048 | return rc; |
1092 | } | 1049 | } |
1093 | portp->flags |= ASYNC_NORMAL_ACTIVE; | 1050 | portp->flags |= ASYNC_NORMAL_ACTIVE; |
1094 | return(0); | 1051 | return 0; |
1095 | } | 1052 | } |
1096 | 1053 | ||
1097 | /*****************************************************************************/ | 1054 | /*****************************************************************************/ |
1098 | 1055 | ||
1099 | static void stli_close(struct tty_struct *tty, struct file *filp) | 1056 | static void stli_close(struct tty_struct *tty, struct file *filp) |
1100 | { | 1057 | { |
1101 | stlibrd_t *brdp; | 1058 | stlibrd_t *brdp; |
1102 | stliport_t *portp; | 1059 | stliport_t *portp; |
1103 | unsigned long flags; | 1060 | unsigned long flags; |
1104 | |||
1105 | #ifdef DEBUG | ||
1106 | printk("stli_close(tty=%x,filp=%x)\n", (int) tty, (int) filp); | ||
1107 | #endif | ||
1108 | 1061 | ||
1109 | portp = tty->driver_data; | 1062 | portp = tty->driver_data; |
1110 | if (portp == (stliport_t *) NULL) | 1063 | if (portp == NULL) |
1111 | return; | 1064 | return; |
1112 | 1065 | ||
1113 | save_flags(flags); | 1066 | spin_lock_irqsave(&stli_lock, flags); |
1114 | cli(); | ||
1115 | if (tty_hung_up_p(filp)) { | 1067 | if (tty_hung_up_p(filp)) { |
1116 | restore_flags(flags); | 1068 | spin_unlock_irqrestore(&stli_lock, flags); |
1117 | return; | 1069 | return; |
1118 | } | 1070 | } |
1119 | if ((tty->count == 1) && (portp->refcount != 1)) | 1071 | if ((tty->count == 1) && (portp->refcount != 1)) |
1120 | portp->refcount = 1; | 1072 | portp->refcount = 1; |
1121 | if (portp->refcount-- > 1) { | 1073 | if (portp->refcount-- > 1) { |
1122 | restore_flags(flags); | 1074 | spin_unlock_irqrestore(&stli_lock, flags); |
1123 | return; | 1075 | return; |
1124 | } | 1076 | } |
1125 | 1077 | ||
@@ -1134,6 +1086,8 @@ static void stli_close(struct tty_struct *tty, struct file *filp) | |||
1134 | if (tty == stli_txcooktty) | 1086 | if (tty == stli_txcooktty) |
1135 | stli_flushchars(tty); | 1087 | stli_flushchars(tty); |
1136 | tty->closing = 1; | 1088 | tty->closing = 1; |
1089 | spin_unlock_irqrestore(&stli_lock, flags); | ||
1090 | |||
1137 | if (portp->closing_wait != ASYNC_CLOSING_WAIT_NONE) | 1091 | if (portp->closing_wait != ASYNC_CLOSING_WAIT_NONE) |
1138 | tty_wait_until_sent(tty, portp->closing_wait); | 1092 | tty_wait_until_sent(tty, portp->closing_wait); |
1139 | 1093 | ||
@@ -1157,7 +1111,7 @@ static void stli_close(struct tty_struct *tty, struct file *filp) | |||
1157 | stli_flushbuffer(tty); | 1111 | stli_flushbuffer(tty); |
1158 | 1112 | ||
1159 | tty->closing = 0; | 1113 | tty->closing = 0; |
1160 | portp->tty = (struct tty_struct *) NULL; | 1114 | portp->tty = NULL; |
1161 | 1115 | ||
1162 | if (portp->openwaitcnt) { | 1116 | if (portp->openwaitcnt) { |
1163 | if (portp->close_delay) | 1117 | if (portp->close_delay) |
@@ -1167,7 +1121,6 @@ static void stli_close(struct tty_struct *tty, struct file *filp) | |||
1167 | 1121 | ||
1168 | portp->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING); | 1122 | portp->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING); |
1169 | wake_up_interruptible(&portp->close_wait); | 1123 | wake_up_interruptible(&portp->close_wait); |
1170 | restore_flags(flags); | ||
1171 | } | 1124 | } |
1172 | 1125 | ||
1173 | /*****************************************************************************/ | 1126 | /*****************************************************************************/ |
@@ -1182,45 +1135,41 @@ static void stli_close(struct tty_struct *tty, struct file *filp) | |||
1182 | 1135 | ||
1183 | static int stli_initopen(stlibrd_t *brdp, stliport_t *portp) | 1136 | static int stli_initopen(stlibrd_t *brdp, stliport_t *portp) |
1184 | { | 1137 | { |
1185 | struct tty_struct *tty; | 1138 | struct tty_struct *tty; |
1186 | asynotify_t nt; | 1139 | asynotify_t nt; |
1187 | asyport_t aport; | 1140 | asyport_t aport; |
1188 | int rc; | 1141 | int rc; |
1189 | |||
1190 | #ifdef DEBUG | ||
1191 | printk("stli_initopen(brdp=%x,portp=%x)\n", (int) brdp, (int) portp); | ||
1192 | #endif | ||
1193 | 1142 | ||
1194 | if ((rc = stli_rawopen(brdp, portp, 0, 1)) < 0) | 1143 | if ((rc = stli_rawopen(brdp, portp, 0, 1)) < 0) |
1195 | return(rc); | 1144 | return rc; |
1196 | 1145 | ||
1197 | memset(&nt, 0, sizeof(asynotify_t)); | 1146 | memset(&nt, 0, sizeof(asynotify_t)); |
1198 | nt.data = (DT_TXLOW | DT_TXEMPTY | DT_RXBUSY | DT_RXBREAK); | 1147 | nt.data = (DT_TXLOW | DT_TXEMPTY | DT_RXBUSY | DT_RXBREAK); |
1199 | nt.signal = SG_DCD; | 1148 | nt.signal = SG_DCD; |
1200 | if ((rc = stli_cmdwait(brdp, portp, A_SETNOTIFY, &nt, | 1149 | if ((rc = stli_cmdwait(brdp, portp, A_SETNOTIFY, &nt, |
1201 | sizeof(asynotify_t), 0)) < 0) | 1150 | sizeof(asynotify_t), 0)) < 0) |
1202 | return(rc); | 1151 | return rc; |
1203 | 1152 | ||
1204 | tty = portp->tty; | 1153 | tty = portp->tty; |
1205 | if (tty == (struct tty_struct *) NULL) | 1154 | if (tty == NULL) |
1206 | return(-ENODEV); | 1155 | return -ENODEV; |
1207 | stli_mkasyport(portp, &aport, tty->termios); | 1156 | stli_mkasyport(portp, &aport, tty->termios); |
1208 | if ((rc = stli_cmdwait(brdp, portp, A_SETPORT, &aport, | 1157 | if ((rc = stli_cmdwait(brdp, portp, A_SETPORT, &aport, |
1209 | sizeof(asyport_t), 0)) < 0) | 1158 | sizeof(asyport_t), 0)) < 0) |
1210 | return(rc); | 1159 | return rc; |
1211 | 1160 | ||
1212 | set_bit(ST_GETSIGS, &portp->state); | 1161 | set_bit(ST_GETSIGS, &portp->state); |
1213 | if ((rc = stli_cmdwait(brdp, portp, A_GETSIGNALS, &portp->asig, | 1162 | if ((rc = stli_cmdwait(brdp, portp, A_GETSIGNALS, &portp->asig, |
1214 | sizeof(asysigs_t), 1)) < 0) | 1163 | sizeof(asysigs_t), 1)) < 0) |
1215 | return(rc); | 1164 | return rc; |
1216 | if (test_and_clear_bit(ST_GETSIGS, &portp->state)) | 1165 | if (test_and_clear_bit(ST_GETSIGS, &portp->state)) |
1217 | portp->sigs = stli_mktiocm(portp->asig.sigvalue); | 1166 | portp->sigs = stli_mktiocm(portp->asig.sigvalue); |
1218 | stli_mkasysigs(&portp->asig, 1, 1); | 1167 | stli_mkasysigs(&portp->asig, 1, 1); |
1219 | if ((rc = stli_cmdwait(brdp, portp, A_SETSIGNALS, &portp->asig, | 1168 | if ((rc = stli_cmdwait(brdp, portp, A_SETSIGNALS, &portp->asig, |
1220 | sizeof(asysigs_t), 0)) < 0) | 1169 | sizeof(asysigs_t), 0)) < 0) |
1221 | return(rc); | 1170 | return rc; |
1222 | 1171 | ||
1223 | return(0); | 1172 | return 0; |
1224 | } | 1173 | } |
1225 | 1174 | ||
1226 | /*****************************************************************************/ | 1175 | /*****************************************************************************/ |
@@ -1234,22 +1183,15 @@ static int stli_initopen(stlibrd_t *brdp, stliport_t *portp) | |||
1234 | 1183 | ||
1235 | static int stli_rawopen(stlibrd_t *brdp, stliport_t *portp, unsigned long arg, int wait) | 1184 | static int stli_rawopen(stlibrd_t *brdp, stliport_t *portp, unsigned long arg, int wait) |
1236 | { | 1185 | { |
1237 | volatile cdkhdr_t *hdrp; | 1186 | cdkhdr_t __iomem *hdrp; |
1238 | volatile cdkctrl_t *cp; | 1187 | cdkctrl_t __iomem *cp; |
1239 | volatile unsigned char *bits; | 1188 | unsigned char __iomem *bits; |
1240 | unsigned long flags; | 1189 | unsigned long flags; |
1241 | int rc; | 1190 | 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 | 1191 | ||
1248 | /* | 1192 | /* |
1249 | * Send a message to the slave to open this port. | 1193 | * Send a message to the slave to open this port. |
1250 | */ | 1194 | */ |
1251 | save_flags(flags); | ||
1252 | cli(); | ||
1253 | 1195 | ||
1254 | /* | 1196 | /* |
1255 | * Slave is already closing this port. This can happen if a hangup | 1197 | * Slave is already closing this port. This can happen if a hangup |
@@ -1260,7 +1202,6 @@ static int stli_rawopen(stlibrd_t *brdp, stliport_t *portp, unsigned long arg, i | |||
1260 | wait_event_interruptible(portp->raw_wait, | 1202 | wait_event_interruptible(portp->raw_wait, |
1261 | !test_bit(ST_CLOSING, &portp->state)); | 1203 | !test_bit(ST_CLOSING, &portp->state)); |
1262 | if (signal_pending(current)) { | 1204 | if (signal_pending(current)) { |
1263 | restore_flags(flags); | ||
1264 | return -ERESTARTSYS; | 1205 | return -ERESTARTSYS; |
1265 | } | 1206 | } |
1266 | 1207 | ||
@@ -1269,19 +1210,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 | 1210 | * memory. Once the message is in set the service bits to say that |
1270 | * this port wants service. | 1211 | * this port wants service. |
1271 | */ | 1212 | */ |
1213 | spin_lock_irqsave(&brd_lock, flags); | ||
1272 | EBRDENABLE(brdp); | 1214 | EBRDENABLE(brdp); |
1273 | cp = &((volatile cdkasy_t *) EBRDGETMEMPTR(brdp, portp->addr))->ctrl; | 1215 | cp = &((cdkasy_t __iomem *) EBRDGETMEMPTR(brdp, portp->addr))->ctrl; |
1274 | cp->openarg = arg; | 1216 | writel(arg, &cp->openarg); |
1275 | cp->open = 1; | 1217 | writeb(1, &cp->open); |
1276 | hdrp = (volatile cdkhdr_t *) EBRDGETMEMPTR(brdp, CDK_CDKADDR); | 1218 | hdrp = (cdkhdr_t __iomem *) EBRDGETMEMPTR(brdp, CDK_CDKADDR); |
1277 | bits = ((volatile unsigned char *) hdrp) + brdp->slaveoffset + | 1219 | bits = ((unsigned char __iomem *) hdrp) + brdp->slaveoffset + |
1278 | portp->portidx; | 1220 | portp->portidx; |
1279 | *bits |= portp->portbit; | 1221 | writeb(readb(bits) | portp->portbit, bits); |
1280 | EBRDDISABLE(brdp); | 1222 | EBRDDISABLE(brdp); |
1281 | 1223 | ||
1282 | if (wait == 0) { | 1224 | if (wait == 0) { |
1283 | restore_flags(flags); | 1225 | spin_unlock_irqrestore(&brd_lock, flags); |
1284 | return(0); | 1226 | return 0; |
1285 | } | 1227 | } |
1286 | 1228 | ||
1287 | /* | 1229 | /* |
@@ -1290,15 +1232,16 @@ static int stli_rawopen(stlibrd_t *brdp, stliport_t *portp, unsigned long arg, i | |||
1290 | */ | 1232 | */ |
1291 | rc = 0; | 1233 | rc = 0; |
1292 | set_bit(ST_OPENING, &portp->state); | 1234 | set_bit(ST_OPENING, &portp->state); |
1235 | spin_unlock_irqrestore(&brd_lock, flags); | ||
1236 | |||
1293 | wait_event_interruptible(portp->raw_wait, | 1237 | wait_event_interruptible(portp->raw_wait, |
1294 | !test_bit(ST_OPENING, &portp->state)); | 1238 | !test_bit(ST_OPENING, &portp->state)); |
1295 | if (signal_pending(current)) | 1239 | if (signal_pending(current)) |
1296 | rc = -ERESTARTSYS; | 1240 | rc = -ERESTARTSYS; |
1297 | restore_flags(flags); | ||
1298 | 1241 | ||
1299 | if ((rc == 0) && (portp->rc != 0)) | 1242 | if ((rc == 0) && (portp->rc != 0)) |
1300 | rc = -EIO; | 1243 | rc = -EIO; |
1301 | return(rc); | 1244 | return rc; |
1302 | } | 1245 | } |
1303 | 1246 | ||
1304 | /*****************************************************************************/ | 1247 | /*****************************************************************************/ |
@@ -1311,19 +1254,11 @@ static int stli_rawopen(stlibrd_t *brdp, stliport_t *portp, unsigned long arg, i | |||
1311 | 1254 | ||
1312 | static int stli_rawclose(stlibrd_t *brdp, stliport_t *portp, unsigned long arg, int wait) | 1255 | static int stli_rawclose(stlibrd_t *brdp, stliport_t *portp, unsigned long arg, int wait) |
1313 | { | 1256 | { |
1314 | volatile cdkhdr_t *hdrp; | 1257 | cdkhdr_t __iomem *hdrp; |
1315 | volatile cdkctrl_t *cp; | 1258 | cdkctrl_t __iomem *cp; |
1316 | volatile unsigned char *bits; | 1259 | unsigned char __iomem *bits; |
1317 | unsigned long flags; | 1260 | unsigned long flags; |
1318 | int rc; | 1261 | 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 | 1262 | ||
1328 | /* | 1263 | /* |
1329 | * Slave is already closing this port. This can happen if a hangup | 1264 | * Slave is already closing this port. This can happen if a hangup |
@@ -1333,7 +1268,6 @@ static int stli_rawclose(stlibrd_t *brdp, stliport_t *portp, unsigned long arg, | |||
1333 | wait_event_interruptible(portp->raw_wait, | 1268 | wait_event_interruptible(portp->raw_wait, |
1334 | !test_bit(ST_CLOSING, &portp->state)); | 1269 | !test_bit(ST_CLOSING, &portp->state)); |
1335 | if (signal_pending(current)) { | 1270 | if (signal_pending(current)) { |
1336 | restore_flags(flags); | ||
1337 | return -ERESTARTSYS; | 1271 | return -ERESTARTSYS; |
1338 | } | 1272 | } |
1339 | } | 1273 | } |
@@ -1341,21 +1275,22 @@ static int stli_rawclose(stlibrd_t *brdp, stliport_t *portp, unsigned long arg, | |||
1341 | /* | 1275 | /* |
1342 | * Write the close command into shared memory. | 1276 | * Write the close command into shared memory. |
1343 | */ | 1277 | */ |
1278 | spin_lock_irqsave(&brd_lock, flags); | ||
1344 | EBRDENABLE(brdp); | 1279 | EBRDENABLE(brdp); |
1345 | cp = &((volatile cdkasy_t *) EBRDGETMEMPTR(brdp, portp->addr))->ctrl; | 1280 | cp = &((cdkasy_t __iomem *) EBRDGETMEMPTR(brdp, portp->addr))->ctrl; |
1346 | cp->closearg = arg; | 1281 | writel(arg, &cp->closearg); |
1347 | cp->close = 1; | 1282 | writeb(1, &cp->close); |
1348 | hdrp = (volatile cdkhdr_t *) EBRDGETMEMPTR(brdp, CDK_CDKADDR); | 1283 | hdrp = (cdkhdr_t __iomem *) EBRDGETMEMPTR(brdp, CDK_CDKADDR); |
1349 | bits = ((volatile unsigned char *) hdrp) + brdp->slaveoffset + | 1284 | bits = ((unsigned char __iomem *) hdrp) + brdp->slaveoffset + |
1350 | portp->portidx; | 1285 | portp->portidx; |
1351 | *bits |= portp->portbit; | 1286 | writeb(readb(bits) |portp->portbit, bits); |
1352 | EBRDDISABLE(brdp); | 1287 | EBRDDISABLE(brdp); |
1353 | 1288 | ||
1354 | set_bit(ST_CLOSING, &portp->state); | 1289 | set_bit(ST_CLOSING, &portp->state); |
1355 | if (wait == 0) { | 1290 | spin_unlock_irqrestore(&brd_lock, flags); |
1356 | restore_flags(flags); | 1291 | |
1357 | return(0); | 1292 | if (wait == 0) |
1358 | } | 1293 | return 0; |
1359 | 1294 | ||
1360 | /* | 1295 | /* |
1361 | * Slave is in action, so now we must wait for the open acknowledgment | 1296 | * Slave is in action, so now we must wait for the open acknowledgment |
@@ -1366,11 +1301,10 @@ static int stli_rawclose(stlibrd_t *brdp, stliport_t *portp, unsigned long arg, | |||
1366 | !test_bit(ST_CLOSING, &portp->state)); | 1301 | !test_bit(ST_CLOSING, &portp->state)); |
1367 | if (signal_pending(current)) | 1302 | if (signal_pending(current)) |
1368 | rc = -ERESTARTSYS; | 1303 | rc = -ERESTARTSYS; |
1369 | restore_flags(flags); | ||
1370 | 1304 | ||
1371 | if ((rc == 0) && (portp->rc != 0)) | 1305 | if ((rc == 0) && (portp->rc != 0)) |
1372 | rc = -EIO; | 1306 | rc = -EIO; |
1373 | return(rc); | 1307 | return rc; |
1374 | } | 1308 | } |
1375 | 1309 | ||
1376 | /*****************************************************************************/ | 1310 | /*****************************************************************************/ |
@@ -1384,36 +1318,21 @@ static int stli_rawclose(stlibrd_t *brdp, stliport_t *portp, unsigned long arg, | |||
1384 | 1318 | ||
1385 | static int stli_cmdwait(stlibrd_t *brdp, stliport_t *portp, unsigned long cmd, void *arg, int size, int copyback) | 1319 | static int stli_cmdwait(stlibrd_t *brdp, stliport_t *portp, unsigned long cmd, void *arg, int size, int copyback) |
1386 | { | 1320 | { |
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, | 1321 | wait_event_interruptible(portp->raw_wait, |
1398 | !test_bit(ST_CMDING, &portp->state)); | 1322 | !test_bit(ST_CMDING, &portp->state)); |
1399 | if (signal_pending(current)) { | 1323 | if (signal_pending(current)) |
1400 | restore_flags(flags); | ||
1401 | return -ERESTARTSYS; | 1324 | return -ERESTARTSYS; |
1402 | } | ||
1403 | 1325 | ||
1404 | stli_sendcmd(brdp, portp, cmd, arg, size, copyback); | 1326 | stli_sendcmd(brdp, portp, cmd, arg, size, copyback); |
1405 | 1327 | ||
1406 | wait_event_interruptible(portp->raw_wait, | 1328 | wait_event_interruptible(portp->raw_wait, |
1407 | !test_bit(ST_CMDING, &portp->state)); | 1329 | !test_bit(ST_CMDING, &portp->state)); |
1408 | if (signal_pending(current)) { | 1330 | if (signal_pending(current)) |
1409 | restore_flags(flags); | ||
1410 | return -ERESTARTSYS; | 1331 | return -ERESTARTSYS; |
1411 | } | ||
1412 | restore_flags(flags); | ||
1413 | 1332 | ||
1414 | if (portp->rc != 0) | 1333 | if (portp->rc != 0) |
1415 | return(-EIO); | 1334 | return -EIO; |
1416 | return(0); | 1335 | return 0; |
1417 | } | 1336 | } |
1418 | 1337 | ||
1419 | /*****************************************************************************/ | 1338 | /*****************************************************************************/ |
@@ -1425,22 +1344,18 @@ static int stli_cmdwait(stlibrd_t *brdp, stliport_t *portp, unsigned long cmd, v | |||
1425 | 1344 | ||
1426 | static int stli_setport(stliport_t *portp) | 1345 | static int stli_setport(stliport_t *portp) |
1427 | { | 1346 | { |
1428 | stlibrd_t *brdp; | 1347 | stlibrd_t *brdp; |
1429 | asyport_t aport; | 1348 | asyport_t aport; |
1430 | |||
1431 | #ifdef DEBUG | ||
1432 | printk("stli_setport(portp=%x)\n", (int) portp); | ||
1433 | #endif | ||
1434 | 1349 | ||
1435 | if (portp == (stliport_t *) NULL) | 1350 | if (portp == NULL) |
1436 | return(-ENODEV); | 1351 | return -ENODEV; |
1437 | if (portp->tty == (struct tty_struct *) NULL) | 1352 | if (portp->tty == NULL) |
1438 | return(-ENODEV); | 1353 | return -ENODEV; |
1439 | if ((portp->brdnr < 0) && (portp->brdnr >= stli_nrbrds)) | 1354 | if (portp->brdnr < 0 && portp->brdnr >= stli_nrbrds) |
1440 | return(-ENODEV); | 1355 | return -ENODEV; |
1441 | brdp = stli_brds[portp->brdnr]; | 1356 | brdp = stli_brds[portp->brdnr]; |
1442 | if (brdp == (stlibrd_t *) NULL) | 1357 | if (brdp == NULL) |
1443 | return(-ENODEV); | 1358 | return -ENODEV; |
1444 | 1359 | ||
1445 | stli_mkasyport(portp, &aport, portp->tty->termios); | 1360 | stli_mkasyport(portp, &aport, portp->tty->termios); |
1446 | return(stli_cmdwait(brdp, portp, A_SETPORT, &aport, sizeof(asyport_t), 0)); | 1361 | return(stli_cmdwait(brdp, portp, A_SETPORT, &aport, sizeof(asyport_t), 0)); |
@@ -1455,13 +1370,8 @@ static int stli_setport(stliport_t *portp) | |||
1455 | 1370 | ||
1456 | static int stli_waitcarrier(stlibrd_t *brdp, stliport_t *portp, struct file *filp) | 1371 | static int stli_waitcarrier(stlibrd_t *brdp, stliport_t *portp, struct file *filp) |
1457 | { | 1372 | { |
1458 | unsigned long flags; | 1373 | unsigned long flags; |
1459 | int rc, doclocal; | 1374 | 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 | 1375 | ||
1466 | rc = 0; | 1376 | rc = 0; |
1467 | doclocal = 0; | 1377 | doclocal = 0; |
@@ -1469,11 +1379,11 @@ static int stli_waitcarrier(stlibrd_t *brdp, stliport_t *portp, struct file *fil | |||
1469 | if (portp->tty->termios->c_cflag & CLOCAL) | 1379 | if (portp->tty->termios->c_cflag & CLOCAL) |
1470 | doclocal++; | 1380 | doclocal++; |
1471 | 1381 | ||
1472 | save_flags(flags); | 1382 | spin_lock_irqsave(&stli_lock, flags); |
1473 | cli(); | ||
1474 | portp->openwaitcnt++; | 1383 | portp->openwaitcnt++; |
1475 | if (! tty_hung_up_p(filp)) | 1384 | if (! tty_hung_up_p(filp)) |
1476 | portp->refcount--; | 1385 | portp->refcount--; |
1386 | spin_unlock_irqrestore(&stli_lock, flags); | ||
1477 | 1387 | ||
1478 | for (;;) { | 1388 | for (;;) { |
1479 | stli_mkasysigs(&portp->asig, 1, 1); | 1389 | stli_mkasysigs(&portp->asig, 1, 1); |
@@ -1499,12 +1409,13 @@ static int stli_waitcarrier(stlibrd_t *brdp, stliport_t *portp, struct file *fil | |||
1499 | interruptible_sleep_on(&portp->open_wait); | 1409 | interruptible_sleep_on(&portp->open_wait); |
1500 | } | 1410 | } |
1501 | 1411 | ||
1412 | spin_lock_irqsave(&stli_lock, flags); | ||
1502 | if (! tty_hung_up_p(filp)) | 1413 | if (! tty_hung_up_p(filp)) |
1503 | portp->refcount++; | 1414 | portp->refcount++; |
1504 | portp->openwaitcnt--; | 1415 | portp->openwaitcnt--; |
1505 | restore_flags(flags); | 1416 | spin_unlock_irqrestore(&stli_lock, flags); |
1506 | 1417 | ||
1507 | return(rc); | 1418 | return rc; |
1508 | } | 1419 | } |
1509 | 1420 | ||
1510 | /*****************************************************************************/ | 1421 | /*****************************************************************************/ |
@@ -1517,46 +1428,38 @@ static int stli_waitcarrier(stlibrd_t *brdp, stliport_t *portp, struct file *fil | |||
1517 | 1428 | ||
1518 | static int stli_write(struct tty_struct *tty, const unsigned char *buf, int count) | 1429 | static int stli_write(struct tty_struct *tty, const unsigned char *buf, int count) |
1519 | { | 1430 | { |
1520 | volatile cdkasy_t *ap; | 1431 | cdkasy_t __iomem *ap; |
1521 | volatile cdkhdr_t *hdrp; | 1432 | cdkhdr_t __iomem *hdrp; |
1522 | volatile unsigned char *bits; | 1433 | unsigned char __iomem *bits; |
1523 | unsigned char *shbuf, *chbuf; | 1434 | unsigned char __iomem *shbuf; |
1524 | stliport_t *portp; | 1435 | unsigned char *chbuf; |
1525 | stlibrd_t *brdp; | 1436 | stliport_t *portp; |
1526 | unsigned int len, stlen, head, tail, size; | 1437 | stlibrd_t *brdp; |
1527 | unsigned long flags; | 1438 | unsigned int len, stlen, head, tail, size; |
1528 | 1439 | 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 | 1440 | ||
1534 | if ((tty == (struct tty_struct *) NULL) || | ||
1535 | (stli_tmpwritebuf == (char *) NULL)) | ||
1536 | return(0); | ||
1537 | if (tty == stli_txcooktty) | 1441 | if (tty == stli_txcooktty) |
1538 | stli_flushchars(tty); | 1442 | stli_flushchars(tty); |
1539 | portp = tty->driver_data; | 1443 | portp = tty->driver_data; |
1540 | if (portp == (stliport_t *) NULL) | 1444 | if (portp == NULL) |
1541 | return(0); | 1445 | return 0; |
1542 | if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds)) | 1446 | if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds)) |
1543 | return(0); | 1447 | return 0; |
1544 | brdp = stli_brds[portp->brdnr]; | 1448 | brdp = stli_brds[portp->brdnr]; |
1545 | if (brdp == (stlibrd_t *) NULL) | 1449 | if (brdp == NULL) |
1546 | return(0); | 1450 | return 0; |
1547 | chbuf = (unsigned char *) buf; | 1451 | chbuf = (unsigned char *) buf; |
1548 | 1452 | ||
1549 | /* | 1453 | /* |
1550 | * All data is now local, shove as much as possible into shared memory. | 1454 | * All data is now local, shove as much as possible into shared memory. |
1551 | */ | 1455 | */ |
1552 | save_flags(flags); | 1456 | spin_lock_irqsave(&brd_lock, flags); |
1553 | cli(); | ||
1554 | EBRDENABLE(brdp); | 1457 | EBRDENABLE(brdp); |
1555 | ap = (volatile cdkasy_t *) EBRDGETMEMPTR(brdp, portp->addr); | 1458 | ap = (cdkasy_t __iomem *) EBRDGETMEMPTR(brdp, portp->addr); |
1556 | head = (unsigned int) ap->txq.head; | 1459 | head = (unsigned int) readw(&ap->txq.head); |
1557 | tail = (unsigned int) ap->txq.tail; | 1460 | tail = (unsigned int) readw(&ap->txq.tail); |
1558 | if (tail != ((unsigned int) ap->txq.tail)) | 1461 | if (tail != ((unsigned int) readw(&ap->txq.tail))) |
1559 | tail = (unsigned int) ap->txq.tail; | 1462 | tail = (unsigned int) readw(&ap->txq.tail); |
1560 | size = portp->txsize; | 1463 | size = portp->txsize; |
1561 | if (head >= tail) { | 1464 | if (head >= tail) { |
1562 | len = size - (head - tail) - 1; | 1465 | len = size - (head - tail) - 1; |
@@ -1568,11 +1471,11 @@ static int stli_write(struct tty_struct *tty, const unsigned char *buf, int coun | |||
1568 | 1471 | ||
1569 | len = MIN(len, count); | 1472 | len = MIN(len, count); |
1570 | count = 0; | 1473 | count = 0; |
1571 | shbuf = (char *) EBRDGETMEMPTR(brdp, portp->txoffset); | 1474 | shbuf = (char __iomem *) EBRDGETMEMPTR(brdp, portp->txoffset); |
1572 | 1475 | ||
1573 | while (len > 0) { | 1476 | while (len > 0) { |
1574 | stlen = MIN(len, stlen); | 1477 | stlen = MIN(len, stlen); |
1575 | memcpy((shbuf + head), chbuf, stlen); | 1478 | memcpy_toio(shbuf + head, chbuf, stlen); |
1576 | chbuf += stlen; | 1479 | chbuf += stlen; |
1577 | len -= stlen; | 1480 | len -= stlen; |
1578 | count += stlen; | 1481 | count += stlen; |
@@ -1583,20 +1486,19 @@ static int stli_write(struct tty_struct *tty, const unsigned char *buf, int coun | |||
1583 | } | 1486 | } |
1584 | } | 1487 | } |
1585 | 1488 | ||
1586 | ap = (volatile cdkasy_t *) EBRDGETMEMPTR(brdp, portp->addr); | 1489 | ap = (cdkasy_t __iomem *) EBRDGETMEMPTR(brdp, portp->addr); |
1587 | ap->txq.head = head; | 1490 | writew(head, &ap->txq.head); |
1588 | if (test_bit(ST_TXBUSY, &portp->state)) { | 1491 | if (test_bit(ST_TXBUSY, &portp->state)) { |
1589 | if (ap->changed.data & DT_TXEMPTY) | 1492 | if (readl(&ap->changed.data) & DT_TXEMPTY) |
1590 | ap->changed.data &= ~DT_TXEMPTY; | 1493 | writel(readl(&ap->changed.data) & ~DT_TXEMPTY, &ap->changed.data); |
1591 | } | 1494 | } |
1592 | hdrp = (volatile cdkhdr_t *) EBRDGETMEMPTR(brdp, CDK_CDKADDR); | 1495 | hdrp = (cdkhdr_t __iomem *) EBRDGETMEMPTR(brdp, CDK_CDKADDR); |
1593 | bits = ((volatile unsigned char *) hdrp) + brdp->slaveoffset + | 1496 | bits = ((unsigned char __iomem *) hdrp) + brdp->slaveoffset + |
1594 | portp->portidx; | 1497 | portp->portidx; |
1595 | *bits |= portp->portbit; | 1498 | writeb(readb(bits) | portp->portbit, bits); |
1596 | set_bit(ST_TXBUSY, &portp->state); | 1499 | set_bit(ST_TXBUSY, &portp->state); |
1597 | EBRDDISABLE(brdp); | 1500 | EBRDDISABLE(brdp); |
1598 | 1501 | spin_unlock_irqrestore(&brd_lock, flags); | |
1599 | restore_flags(flags); | ||
1600 | 1502 | ||
1601 | return(count); | 1503 | return(count); |
1602 | } | 1504 | } |
@@ -1613,14 +1515,8 @@ static int stli_write(struct tty_struct *tty, const unsigned char *buf, int coun | |||
1613 | 1515 | ||
1614 | static void stli_putchar(struct tty_struct *tty, unsigned char ch) | 1516 | static void stli_putchar(struct tty_struct *tty, unsigned char ch) |
1615 | { | 1517 | { |
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) { | 1518 | if (tty != stli_txcooktty) { |
1623 | if (stli_txcooktty != (struct tty_struct *) NULL) | 1519 | if (stli_txcooktty != NULL) |
1624 | stli_flushchars(stli_txcooktty); | 1520 | stli_flushchars(stli_txcooktty); |
1625 | stli_txcooktty = tty; | 1521 | stli_txcooktty = tty; |
1626 | } | 1522 | } |
@@ -1640,29 +1536,26 @@ static void stli_putchar(struct tty_struct *tty, unsigned char ch) | |||
1640 | 1536 | ||
1641 | static void stli_flushchars(struct tty_struct *tty) | 1537 | static void stli_flushchars(struct tty_struct *tty) |
1642 | { | 1538 | { |
1643 | volatile cdkhdr_t *hdrp; | 1539 | cdkhdr_t __iomem *hdrp; |
1644 | volatile unsigned char *bits; | 1540 | unsigned char __iomem *bits; |
1645 | volatile cdkasy_t *ap; | 1541 | cdkasy_t __iomem *ap; |
1646 | struct tty_struct *cooktty; | 1542 | struct tty_struct *cooktty; |
1647 | stliport_t *portp; | 1543 | stliport_t *portp; |
1648 | stlibrd_t *brdp; | 1544 | stlibrd_t *brdp; |
1649 | unsigned int len, stlen, head, tail, size, count, cooksize; | 1545 | unsigned int len, stlen, head, tail, size, count, cooksize; |
1650 | unsigned char *buf, *shbuf; | 1546 | unsigned char *buf; |
1651 | unsigned long flags; | 1547 | unsigned char __iomem *shbuf; |
1652 | 1548 | unsigned long flags; | |
1653 | #ifdef DEBUG | ||
1654 | printk("stli_flushchars(tty=%x)\n", (int) tty); | ||
1655 | #endif | ||
1656 | 1549 | ||
1657 | cooksize = stli_txcooksize; | 1550 | cooksize = stli_txcooksize; |
1658 | cooktty = stli_txcooktty; | 1551 | cooktty = stli_txcooktty; |
1659 | stli_txcooksize = 0; | 1552 | stli_txcooksize = 0; |
1660 | stli_txcookrealsize = 0; | 1553 | stli_txcookrealsize = 0; |
1661 | stli_txcooktty = (struct tty_struct *) NULL; | 1554 | stli_txcooktty = NULL; |
1662 | 1555 | ||
1663 | if (tty == (struct tty_struct *) NULL) | 1556 | if (tty == NULL) |
1664 | return; | 1557 | return; |
1665 | if (cooktty == (struct tty_struct *) NULL) | 1558 | if (cooktty == NULL) |
1666 | return; | 1559 | return; |
1667 | if (tty != cooktty) | 1560 | if (tty != cooktty) |
1668 | tty = cooktty; | 1561 | tty = cooktty; |
@@ -1670,23 +1563,22 @@ static void stli_flushchars(struct tty_struct *tty) | |||
1670 | return; | 1563 | return; |
1671 | 1564 | ||
1672 | portp = tty->driver_data; | 1565 | portp = tty->driver_data; |
1673 | if (portp == (stliport_t *) NULL) | 1566 | if (portp == NULL) |
1674 | return; | 1567 | return; |
1675 | if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds)) | 1568 | if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds)) |
1676 | return; | 1569 | return; |
1677 | brdp = stli_brds[portp->brdnr]; | 1570 | brdp = stli_brds[portp->brdnr]; |
1678 | if (brdp == (stlibrd_t *) NULL) | 1571 | if (brdp == NULL) |
1679 | return; | 1572 | return; |
1680 | 1573 | ||
1681 | save_flags(flags); | 1574 | spin_lock_irqsave(&brd_lock, flags); |
1682 | cli(); | ||
1683 | EBRDENABLE(brdp); | 1575 | EBRDENABLE(brdp); |
1684 | 1576 | ||
1685 | ap = (volatile cdkasy_t *) EBRDGETMEMPTR(brdp, portp->addr); | 1577 | ap = (cdkasy_t __iomem *) EBRDGETMEMPTR(brdp, portp->addr); |
1686 | head = (unsigned int) ap->txq.head; | 1578 | head = (unsigned int) readw(&ap->txq.head); |
1687 | tail = (unsigned int) ap->txq.tail; | 1579 | tail = (unsigned int) readw(&ap->txq.tail); |
1688 | if (tail != ((unsigned int) ap->txq.tail)) | 1580 | if (tail != ((unsigned int) readw(&ap->txq.tail))) |
1689 | tail = (unsigned int) ap->txq.tail; | 1581 | tail = (unsigned int) readw(&ap->txq.tail); |
1690 | size = portp->txsize; | 1582 | size = portp->txsize; |
1691 | if (head >= tail) { | 1583 | if (head >= tail) { |
1692 | len = size - (head - tail) - 1; | 1584 | len = size - (head - tail) - 1; |
@@ -1703,7 +1595,7 @@ static void stli_flushchars(struct tty_struct *tty) | |||
1703 | 1595 | ||
1704 | while (len > 0) { | 1596 | while (len > 0) { |
1705 | stlen = MIN(len, stlen); | 1597 | stlen = MIN(len, stlen); |
1706 | memcpy((shbuf + head), buf, stlen); | 1598 | memcpy_toio(shbuf + head, buf, stlen); |
1707 | buf += stlen; | 1599 | buf += stlen; |
1708 | len -= stlen; | 1600 | len -= stlen; |
1709 | count += stlen; | 1601 | count += stlen; |
@@ -1714,73 +1606,66 @@ static void stli_flushchars(struct tty_struct *tty) | |||
1714 | } | 1606 | } |
1715 | } | 1607 | } |
1716 | 1608 | ||
1717 | ap = (volatile cdkasy_t *) EBRDGETMEMPTR(brdp, portp->addr); | 1609 | ap = (cdkasy_t __iomem *) EBRDGETMEMPTR(brdp, portp->addr); |
1718 | ap->txq.head = head; | 1610 | writew(head, &ap->txq.head); |
1719 | 1611 | ||
1720 | if (test_bit(ST_TXBUSY, &portp->state)) { | 1612 | if (test_bit(ST_TXBUSY, &portp->state)) { |
1721 | if (ap->changed.data & DT_TXEMPTY) | 1613 | if (readl(&ap->changed.data) & DT_TXEMPTY) |
1722 | ap->changed.data &= ~DT_TXEMPTY; | 1614 | writel(readl(&ap->changed.data) & ~DT_TXEMPTY, &ap->changed.data); |
1723 | } | 1615 | } |
1724 | hdrp = (volatile cdkhdr_t *) EBRDGETMEMPTR(brdp, CDK_CDKADDR); | 1616 | hdrp = (cdkhdr_t __iomem *) EBRDGETMEMPTR(brdp, CDK_CDKADDR); |
1725 | bits = ((volatile unsigned char *) hdrp) + brdp->slaveoffset + | 1617 | bits = ((unsigned char __iomem *) hdrp) + brdp->slaveoffset + |
1726 | portp->portidx; | 1618 | portp->portidx; |
1727 | *bits |= portp->portbit; | 1619 | writeb(readb(bits) | portp->portbit, bits); |
1728 | set_bit(ST_TXBUSY, &portp->state); | 1620 | set_bit(ST_TXBUSY, &portp->state); |
1729 | 1621 | ||
1730 | EBRDDISABLE(brdp); | 1622 | EBRDDISABLE(brdp); |
1731 | restore_flags(flags); | 1623 | spin_unlock_irqrestore(&brd_lock, flags); |
1732 | } | 1624 | } |
1733 | 1625 | ||
1734 | /*****************************************************************************/ | 1626 | /*****************************************************************************/ |
1735 | 1627 | ||
1736 | static int stli_writeroom(struct tty_struct *tty) | 1628 | static int stli_writeroom(struct tty_struct *tty) |
1737 | { | 1629 | { |
1738 | volatile cdkasyrq_t *rp; | 1630 | cdkasyrq_t __iomem *rp; |
1739 | stliport_t *portp; | 1631 | stliport_t *portp; |
1740 | stlibrd_t *brdp; | 1632 | stlibrd_t *brdp; |
1741 | unsigned int head, tail, len; | 1633 | unsigned int head, tail, len; |
1742 | unsigned long flags; | 1634 | unsigned long flags; |
1743 | |||
1744 | #ifdef DEBUG | ||
1745 | printk("stli_writeroom(tty=%x)\n", (int) tty); | ||
1746 | #endif | ||
1747 | 1635 | ||
1748 | if (tty == (struct tty_struct *) NULL) | ||
1749 | return(0); | ||
1750 | if (tty == stli_txcooktty) { | 1636 | if (tty == stli_txcooktty) { |
1751 | if (stli_txcookrealsize != 0) { | 1637 | if (stli_txcookrealsize != 0) { |
1752 | len = stli_txcookrealsize - stli_txcooksize; | 1638 | len = stli_txcookrealsize - stli_txcooksize; |
1753 | return(len); | 1639 | return len; |
1754 | } | 1640 | } |
1755 | } | 1641 | } |
1756 | 1642 | ||
1757 | portp = tty->driver_data; | 1643 | portp = tty->driver_data; |
1758 | if (portp == (stliport_t *) NULL) | 1644 | if (portp == NULL) |
1759 | return(0); | 1645 | return 0; |
1760 | if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds)) | 1646 | if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds)) |
1761 | return(0); | 1647 | return 0; |
1762 | brdp = stli_brds[portp->brdnr]; | 1648 | brdp = stli_brds[portp->brdnr]; |
1763 | if (brdp == (stlibrd_t *) NULL) | 1649 | if (brdp == NULL) |
1764 | return(0); | 1650 | return 0; |
1765 | 1651 | ||
1766 | save_flags(flags); | 1652 | spin_lock_irqsave(&brd_lock, flags); |
1767 | cli(); | ||
1768 | EBRDENABLE(brdp); | 1653 | EBRDENABLE(brdp); |
1769 | rp = &((volatile cdkasy_t *) EBRDGETMEMPTR(brdp, portp->addr))->txq; | 1654 | rp = &((cdkasy_t __iomem *) EBRDGETMEMPTR(brdp, portp->addr))->txq; |
1770 | head = (unsigned int) rp->head; | 1655 | head = (unsigned int) readw(&rp->head); |
1771 | tail = (unsigned int) rp->tail; | 1656 | tail = (unsigned int) readw(&rp->tail); |
1772 | if (tail != ((unsigned int) rp->tail)) | 1657 | if (tail != ((unsigned int) readw(&rp->tail))) |
1773 | tail = (unsigned int) rp->tail; | 1658 | tail = (unsigned int) readw(&rp->tail); |
1774 | len = (head >= tail) ? (portp->txsize - (head - tail)) : (tail - head); | 1659 | len = (head >= tail) ? (portp->txsize - (head - tail)) : (tail - head); |
1775 | len--; | 1660 | len--; |
1776 | EBRDDISABLE(brdp); | 1661 | EBRDDISABLE(brdp); |
1777 | restore_flags(flags); | 1662 | spin_unlock_irqrestore(&brd_lock, flags); |
1778 | 1663 | ||
1779 | if (tty == stli_txcooktty) { | 1664 | if (tty == stli_txcooktty) { |
1780 | stli_txcookrealsize = len; | 1665 | stli_txcookrealsize = len; |
1781 | len -= stli_txcooksize; | 1666 | len -= stli_txcooksize; |
1782 | } | 1667 | } |
1783 | return(len); | 1668 | return len; |
1784 | } | 1669 | } |
1785 | 1670 | ||
1786 | /*****************************************************************************/ | 1671 | /*****************************************************************************/ |
@@ -1795,44 +1680,37 @@ static int stli_writeroom(struct tty_struct *tty) | |||
1795 | 1680 | ||
1796 | static int stli_charsinbuffer(struct tty_struct *tty) | 1681 | static int stli_charsinbuffer(struct tty_struct *tty) |
1797 | { | 1682 | { |
1798 | volatile cdkasyrq_t *rp; | 1683 | cdkasyrq_t __iomem *rp; |
1799 | stliport_t *portp; | 1684 | stliport_t *portp; |
1800 | stlibrd_t *brdp; | 1685 | stlibrd_t *brdp; |
1801 | unsigned int head, tail, len; | 1686 | unsigned int head, tail, len; |
1802 | unsigned long flags; | 1687 | unsigned long flags; |
1803 | |||
1804 | #ifdef DEBUG | ||
1805 | printk("stli_charsinbuffer(tty=%x)\n", (int) tty); | ||
1806 | #endif | ||
1807 | 1688 | ||
1808 | if (tty == (struct tty_struct *) NULL) | ||
1809 | return(0); | ||
1810 | if (tty == stli_txcooktty) | 1689 | if (tty == stli_txcooktty) |
1811 | stli_flushchars(tty); | 1690 | stli_flushchars(tty); |
1812 | portp = tty->driver_data; | 1691 | portp = tty->driver_data; |
1813 | if (portp == (stliport_t *) NULL) | 1692 | if (portp == NULL) |
1814 | return(0); | 1693 | return 0; |
1815 | if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds)) | 1694 | if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds)) |
1816 | return(0); | 1695 | return 0; |
1817 | brdp = stli_brds[portp->brdnr]; | 1696 | brdp = stli_brds[portp->brdnr]; |
1818 | if (brdp == (stlibrd_t *) NULL) | 1697 | if (brdp == NULL) |
1819 | return(0); | 1698 | return 0; |
1820 | 1699 | ||
1821 | save_flags(flags); | 1700 | spin_lock_irqsave(&brd_lock, flags); |
1822 | cli(); | ||
1823 | EBRDENABLE(brdp); | 1701 | EBRDENABLE(brdp); |
1824 | rp = &((volatile cdkasy_t *) EBRDGETMEMPTR(brdp, portp->addr))->txq; | 1702 | rp = &((cdkasy_t __iomem *) EBRDGETMEMPTR(brdp, portp->addr))->txq; |
1825 | head = (unsigned int) rp->head; | 1703 | head = (unsigned int) readw(&rp->head); |
1826 | tail = (unsigned int) rp->tail; | 1704 | tail = (unsigned int) readw(&rp->tail); |
1827 | if (tail != ((unsigned int) rp->tail)) | 1705 | if (tail != ((unsigned int) readw(&rp->tail))) |
1828 | tail = (unsigned int) rp->tail; | 1706 | tail = (unsigned int) readw(&rp->tail); |
1829 | len = (head >= tail) ? (head - tail) : (portp->txsize - (tail - head)); | 1707 | len = (head >= tail) ? (head - tail) : (portp->txsize - (tail - head)); |
1830 | if ((len == 0) && test_bit(ST_TXBUSY, &portp->state)) | 1708 | if ((len == 0) && test_bit(ST_TXBUSY, &portp->state)) |
1831 | len = 1; | 1709 | len = 1; |
1832 | EBRDDISABLE(brdp); | 1710 | EBRDDISABLE(brdp); |
1833 | restore_flags(flags); | 1711 | spin_unlock_irqrestore(&brd_lock, flags); |
1834 | 1712 | ||
1835 | return(len); | 1713 | return len; |
1836 | } | 1714 | } |
1837 | 1715 | ||
1838 | /*****************************************************************************/ | 1716 | /*****************************************************************************/ |
@@ -1843,12 +1721,8 @@ static int stli_charsinbuffer(struct tty_struct *tty) | |||
1843 | 1721 | ||
1844 | static int stli_getserial(stliport_t *portp, struct serial_struct __user *sp) | 1722 | static int stli_getserial(stliport_t *portp, struct serial_struct __user *sp) |
1845 | { | 1723 | { |
1846 | struct serial_struct sio; | 1724 | struct serial_struct sio; |
1847 | stlibrd_t *brdp; | 1725 | stlibrd_t *brdp; |
1848 | |||
1849 | #ifdef DEBUG | ||
1850 | printk("stli_getserial(portp=%x,sp=%x)\n", (int) portp, (int) sp); | ||
1851 | #endif | ||
1852 | 1726 | ||
1853 | memset(&sio, 0, sizeof(struct serial_struct)); | 1727 | memset(&sio, 0, sizeof(struct serial_struct)); |
1854 | sio.type = PORT_UNKNOWN; | 1728 | sio.type = PORT_UNKNOWN; |
@@ -1863,7 +1737,7 @@ static int stli_getserial(stliport_t *portp, struct serial_struct __user *sp) | |||
1863 | sio.hub6 = 0; | 1737 | sio.hub6 = 0; |
1864 | 1738 | ||
1865 | brdp = stli_brds[portp->brdnr]; | 1739 | brdp = stli_brds[portp->brdnr]; |
1866 | if (brdp != (stlibrd_t *) NULL) | 1740 | if (brdp != NULL) |
1867 | sio.port = brdp->iobase; | 1741 | sio.port = brdp->iobase; |
1868 | 1742 | ||
1869 | return copy_to_user(sp, &sio, sizeof(struct serial_struct)) ? | 1743 | return copy_to_user(sp, &sio, sizeof(struct serial_struct)) ? |
@@ -1880,12 +1754,8 @@ static int stli_getserial(stliport_t *portp, struct serial_struct __user *sp) | |||
1880 | 1754 | ||
1881 | static int stli_setserial(stliport_t *portp, struct serial_struct __user *sp) | 1755 | static int stli_setserial(stliport_t *portp, struct serial_struct __user *sp) |
1882 | { | 1756 | { |
1883 | struct serial_struct sio; | 1757 | struct serial_struct sio; |
1884 | int rc; | 1758 | int rc; |
1885 | |||
1886 | #ifdef DEBUG | ||
1887 | printk("stli_setserial(portp=%p,sp=%p)\n", portp, sp); | ||
1888 | #endif | ||
1889 | 1759 | ||
1890 | if (copy_from_user(&sio, sp, sizeof(struct serial_struct))) | 1760 | if (copy_from_user(&sio, sp, sizeof(struct serial_struct))) |
1891 | return -EFAULT; | 1761 | return -EFAULT; |
@@ -1894,7 +1764,7 @@ static int stli_setserial(stliport_t *portp, struct serial_struct __user *sp) | |||
1894 | (sio.close_delay != portp->close_delay) || | 1764 | (sio.close_delay != portp->close_delay) || |
1895 | ((sio.flags & ~ASYNC_USR_MASK) != | 1765 | ((sio.flags & ~ASYNC_USR_MASK) != |
1896 | (portp->flags & ~ASYNC_USR_MASK))) | 1766 | (portp->flags & ~ASYNC_USR_MASK))) |
1897 | return(-EPERM); | 1767 | return -EPERM; |
1898 | } | 1768 | } |
1899 | 1769 | ||
1900 | portp->flags = (portp->flags & ~ASYNC_USR_MASK) | | 1770 | portp->flags = (portp->flags & ~ASYNC_USR_MASK) | |
@@ -1905,8 +1775,8 @@ static int stli_setserial(stliport_t *portp, struct serial_struct __user *sp) | |||
1905 | portp->custom_divisor = sio.custom_divisor; | 1775 | portp->custom_divisor = sio.custom_divisor; |
1906 | 1776 | ||
1907 | if ((rc = stli_setport(portp)) < 0) | 1777 | if ((rc = stli_setport(portp)) < 0) |
1908 | return(rc); | 1778 | return rc; |
1909 | return(0); | 1779 | return 0; |
1910 | } | 1780 | } |
1911 | 1781 | ||
1912 | /*****************************************************************************/ | 1782 | /*****************************************************************************/ |
@@ -1917,19 +1787,19 @@ static int stli_tiocmget(struct tty_struct *tty, struct file *file) | |||
1917 | stlibrd_t *brdp; | 1787 | stlibrd_t *brdp; |
1918 | int rc; | 1788 | int rc; |
1919 | 1789 | ||
1920 | if (portp == (stliport_t *) NULL) | 1790 | if (portp == NULL) |
1921 | return(-ENODEV); | 1791 | return -ENODEV; |
1922 | if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds)) | 1792 | if (portp->brdnr < 0 || portp->brdnr >= stli_nrbrds) |
1923 | return(0); | 1793 | return 0; |
1924 | brdp = stli_brds[portp->brdnr]; | 1794 | brdp = stli_brds[portp->brdnr]; |
1925 | if (brdp == (stlibrd_t *) NULL) | 1795 | if (brdp == NULL) |
1926 | return(0); | 1796 | return 0; |
1927 | if (tty->flags & (1 << TTY_IO_ERROR)) | 1797 | if (tty->flags & (1 << TTY_IO_ERROR)) |
1928 | return(-EIO); | 1798 | return -EIO; |
1929 | 1799 | ||
1930 | if ((rc = stli_cmdwait(brdp, portp, A_GETSIGNALS, | 1800 | if ((rc = stli_cmdwait(brdp, portp, A_GETSIGNALS, |
1931 | &portp->asig, sizeof(asysigs_t), 1)) < 0) | 1801 | &portp->asig, sizeof(asysigs_t), 1)) < 0) |
1932 | return(rc); | 1802 | return rc; |
1933 | 1803 | ||
1934 | return stli_mktiocm(portp->asig.sigvalue); | 1804 | return stli_mktiocm(portp->asig.sigvalue); |
1935 | } | 1805 | } |
@@ -1941,15 +1811,15 @@ static int stli_tiocmset(struct tty_struct *tty, struct file *file, | |||
1941 | stlibrd_t *brdp; | 1811 | stlibrd_t *brdp; |
1942 | int rts = -1, dtr = -1; | 1812 | int rts = -1, dtr = -1; |
1943 | 1813 | ||
1944 | if (portp == (stliport_t *) NULL) | 1814 | if (portp == NULL) |
1945 | return(-ENODEV); | 1815 | return -ENODEV; |
1946 | if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds)) | 1816 | if (portp->brdnr < 0 || portp->brdnr >= stli_nrbrds) |
1947 | return(0); | 1817 | return 0; |
1948 | brdp = stli_brds[portp->brdnr]; | 1818 | brdp = stli_brds[portp->brdnr]; |
1949 | if (brdp == (stlibrd_t *) NULL) | 1819 | if (brdp == NULL) |
1950 | return(0); | 1820 | return 0; |
1951 | if (tty->flags & (1 << TTY_IO_ERROR)) | 1821 | if (tty->flags & (1 << TTY_IO_ERROR)) |
1952 | return(-EIO); | 1822 | return -EIO; |
1953 | 1823 | ||
1954 | if (set & TIOCM_RTS) | 1824 | if (set & TIOCM_RTS) |
1955 | rts = 1; | 1825 | rts = 1; |
@@ -1968,32 +1838,25 @@ static int stli_tiocmset(struct tty_struct *tty, struct file *file, | |||
1968 | 1838 | ||
1969 | static int stli_ioctl(struct tty_struct *tty, struct file *file, unsigned int cmd, unsigned long arg) | 1839 | static int stli_ioctl(struct tty_struct *tty, struct file *file, unsigned int cmd, unsigned long arg) |
1970 | { | 1840 | { |
1971 | stliport_t *portp; | 1841 | stliport_t *portp; |
1972 | stlibrd_t *brdp; | 1842 | stlibrd_t *brdp; |
1973 | unsigned int ival; | 1843 | unsigned int ival; |
1974 | int rc; | 1844 | int rc; |
1975 | void __user *argp = (void __user *)arg; | 1845 | void __user *argp = (void __user *)arg; |
1976 | 1846 | ||
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; | 1847 | portp = tty->driver_data; |
1985 | if (portp == (stliport_t *) NULL) | 1848 | if (portp == NULL) |
1986 | return(-ENODEV); | 1849 | return -ENODEV; |
1987 | if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds)) | 1850 | if (portp->brdnr < 0 || portp->brdnr >= stli_nrbrds) |
1988 | return(0); | 1851 | return 0; |
1989 | brdp = stli_brds[portp->brdnr]; | 1852 | brdp = stli_brds[portp->brdnr]; |
1990 | if (brdp == (stlibrd_t *) NULL) | 1853 | if (brdp == NULL) |
1991 | return(0); | 1854 | return 0; |
1992 | 1855 | ||
1993 | if ((cmd != TIOCGSERIAL) && (cmd != TIOCSSERIAL) && | 1856 | if ((cmd != TIOCGSERIAL) && (cmd != TIOCSSERIAL) && |
1994 | (cmd != COM_GETPORTSTATS) && (cmd != COM_CLRPORTSTATS)) { | 1857 | (cmd != COM_GETPORTSTATS) && (cmd != COM_CLRPORTSTATS)) { |
1995 | if (tty->flags & (1 << TTY_IO_ERROR)) | 1858 | if (tty->flags & (1 << TTY_IO_ERROR)) |
1996 | return(-EIO); | 1859 | return -EIO; |
1997 | } | 1860 | } |
1998 | 1861 | ||
1999 | rc = 0; | 1862 | rc = 0; |
@@ -2040,7 +1903,7 @@ static int stli_ioctl(struct tty_struct *tty, struct file *file, unsigned int cm | |||
2040 | break; | 1903 | break; |
2041 | } | 1904 | } |
2042 | 1905 | ||
2043 | return(rc); | 1906 | return rc; |
2044 | } | 1907 | } |
2045 | 1908 | ||
2046 | /*****************************************************************************/ | 1909 | /*****************************************************************************/ |
@@ -2052,24 +1915,20 @@ static int stli_ioctl(struct tty_struct *tty, struct file *file, unsigned int cm | |||
2052 | 1915 | ||
2053 | static void stli_settermios(struct tty_struct *tty, struct termios *old) | 1916 | static void stli_settermios(struct tty_struct *tty, struct termios *old) |
2054 | { | 1917 | { |
2055 | stliport_t *portp; | 1918 | stliport_t *portp; |
2056 | stlibrd_t *brdp; | 1919 | stlibrd_t *brdp; |
2057 | struct termios *tiosp; | 1920 | struct termios *tiosp; |
2058 | asyport_t aport; | 1921 | asyport_t aport; |
2059 | |||
2060 | #ifdef DEBUG | ||
2061 | printk("stli_settermios(tty=%x,old=%x)\n", (int) tty, (int) old); | ||
2062 | #endif | ||
2063 | 1922 | ||
2064 | if (tty == (struct tty_struct *) NULL) | 1923 | if (tty == NULL) |
2065 | return; | 1924 | return; |
2066 | portp = tty->driver_data; | 1925 | portp = tty->driver_data; |
2067 | if (portp == (stliport_t *) NULL) | 1926 | if (portp == NULL) |
2068 | return; | 1927 | return; |
2069 | if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds)) | 1928 | if (portp->brdnr < 0 || portp->brdnr >= stli_nrbrds) |
2070 | return; | 1929 | return; |
2071 | brdp = stli_brds[portp->brdnr]; | 1930 | brdp = stli_brds[portp->brdnr]; |
2072 | if (brdp == (stlibrd_t *) NULL) | 1931 | if (brdp == NULL) |
2073 | return; | 1932 | return; |
2074 | 1933 | ||
2075 | tiosp = tty->termios; | 1934 | tiosp = tty->termios; |
@@ -2102,18 +1961,9 @@ static void stli_settermios(struct tty_struct *tty, struct termios *old) | |||
2102 | 1961 | ||
2103 | static void stli_throttle(struct tty_struct *tty) | 1962 | static void stli_throttle(struct tty_struct *tty) |
2104 | { | 1963 | { |
2105 | stliport_t *portp; | 1964 | stliport_t *portp = tty->driver_data; |
2106 | 1965 | 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; | 1966 | return; |
2113 | portp = tty->driver_data; | ||
2114 | if (portp == (stliport_t *) NULL) | ||
2115 | return; | ||
2116 | |||
2117 | set_bit(ST_RXSTOP, &portp->state); | 1967 | set_bit(ST_RXSTOP, &portp->state); |
2118 | } | 1968 | } |
2119 | 1969 | ||
@@ -2127,88 +1977,30 @@ static void stli_throttle(struct tty_struct *tty) | |||
2127 | 1977 | ||
2128 | static void stli_unthrottle(struct tty_struct *tty) | 1978 | static void stli_unthrottle(struct tty_struct *tty) |
2129 | { | 1979 | { |
2130 | stliport_t *portp; | 1980 | stliport_t *portp = tty->driver_data; |
2131 | 1981 | 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; | 1982 | return; |
2141 | |||
2142 | clear_bit(ST_RXSTOP, &portp->state); | 1983 | clear_bit(ST_RXSTOP, &portp->state); |
2143 | } | 1984 | } |
2144 | 1985 | ||
2145 | /*****************************************************************************/ | 1986 | /*****************************************************************************/ |
2146 | 1987 | ||
2147 | /* | 1988 | /* |
2148 | * Stop the transmitter. Basically to do this we will just turn TX | 1989 | * Stop the transmitter. |
2149 | * interrupts off. | ||
2150 | */ | 1990 | */ |
2151 | 1991 | ||
2152 | static void stli_stop(struct tty_struct *tty) | 1992 | static void stli_stop(struct tty_struct *tty) |
2153 | { | 1993 | { |
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 | } | 1994 | } |
2179 | 1995 | ||
2180 | /*****************************************************************************/ | 1996 | /*****************************************************************************/ |
2181 | 1997 | ||
2182 | /* | 1998 | /* |
2183 | * Start the transmitter again. Just turn TX interrupts back on. | 1999 | * Start the transmitter again. |
2184 | */ | 2000 | */ |
2185 | 2001 | ||
2186 | static void stli_start(struct tty_struct *tty) | 2002 | static void stli_start(struct tty_struct *tty) |
2187 | { | 2003 | { |
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 | } | 2004 | } |
2213 | 2005 | ||
2214 | /*****************************************************************************/ | 2006 | /*****************************************************************************/ |
@@ -2224,22 +2016,9 @@ static void stli_start(struct tty_struct *tty) | |||
2224 | 2016 | ||
2225 | static void stli_dohangup(void *arg) | 2017 | static void stli_dohangup(void *arg) |
2226 | { | 2018 | { |
2227 | stliport_t *portp; | 2019 | stliport_t *portp = (stliport_t *) arg; |
2228 | 2020 | if (portp->tty != NULL) { | |
2229 | #ifdef DEBUG | 2021 | 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 | } | 2022 | } |
2244 | } | 2023 | } |
2245 | 2024 | ||
@@ -2254,31 +2033,25 @@ static void stli_dohangup(void *arg) | |||
2254 | 2033 | ||
2255 | static void stli_hangup(struct tty_struct *tty) | 2034 | static void stli_hangup(struct tty_struct *tty) |
2256 | { | 2035 | { |
2257 | stliport_t *portp; | 2036 | stliport_t *portp; |
2258 | stlibrd_t *brdp; | 2037 | stlibrd_t *brdp; |
2259 | unsigned long flags; | 2038 | unsigned long flags; |
2260 | |||
2261 | #ifdef DEBUG | ||
2262 | printk(KERN_DEBUG "stli_hangup(tty=%x)\n", (int) tty); | ||
2263 | #endif | ||
2264 | 2039 | ||
2265 | if (tty == (struct tty_struct *) NULL) | ||
2266 | return; | ||
2267 | portp = tty->driver_data; | 2040 | portp = tty->driver_data; |
2268 | if (portp == (stliport_t *) NULL) | 2041 | if (portp == NULL) |
2269 | return; | 2042 | return; |
2270 | if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds)) | 2043 | if (portp->brdnr < 0 || portp->brdnr >= stli_nrbrds) |
2271 | return; | 2044 | return; |
2272 | brdp = stli_brds[portp->brdnr]; | 2045 | brdp = stli_brds[portp->brdnr]; |
2273 | if (brdp == (stlibrd_t *) NULL) | 2046 | if (brdp == NULL) |
2274 | return; | 2047 | return; |
2275 | 2048 | ||
2276 | portp->flags &= ~ASYNC_INITIALIZED; | 2049 | portp->flags &= ~ASYNC_INITIALIZED; |
2277 | 2050 | ||
2278 | save_flags(flags); | 2051 | if (!test_bit(ST_CLOSING, &portp->state)) |
2279 | cli(); | ||
2280 | if (! test_bit(ST_CLOSING, &portp->state)) | ||
2281 | stli_rawclose(brdp, portp, 0, 0); | 2052 | stli_rawclose(brdp, portp, 0, 0); |
2053 | |||
2054 | spin_lock_irqsave(&stli_lock, flags); | ||
2282 | if (tty->termios->c_cflag & HUPCL) { | 2055 | if (tty->termios->c_cflag & HUPCL) { |
2283 | stli_mkasysigs(&portp->asig, 0, 0); | 2056 | stli_mkasysigs(&portp->asig, 0, 0); |
2284 | if (test_bit(ST_CMDING, &portp->state)) { | 2057 | if (test_bit(ST_CMDING, &portp->state)) { |
@@ -2290,14 +2063,15 @@ static void stli_hangup(struct tty_struct *tty) | |||
2290 | &portp->asig, sizeof(asysigs_t), 0); | 2063 | &portp->asig, sizeof(asysigs_t), 0); |
2291 | } | 2064 | } |
2292 | } | 2065 | } |
2293 | restore_flags(flags); | ||
2294 | 2066 | ||
2295 | clear_bit(ST_TXBUSY, &portp->state); | 2067 | clear_bit(ST_TXBUSY, &portp->state); |
2296 | clear_bit(ST_RXSTOP, &portp->state); | 2068 | clear_bit(ST_RXSTOP, &portp->state); |
2297 | set_bit(TTY_IO_ERROR, &tty->flags); | 2069 | set_bit(TTY_IO_ERROR, &tty->flags); |
2298 | portp->tty = (struct tty_struct *) NULL; | 2070 | portp->tty = NULL; |
2299 | portp->flags &= ~ASYNC_NORMAL_ACTIVE; | 2071 | portp->flags &= ~ASYNC_NORMAL_ACTIVE; |
2300 | portp->refcount = 0; | 2072 | portp->refcount = 0; |
2073 | spin_unlock_irqrestore(&stli_lock, flags); | ||
2074 | |||
2301 | wake_up_interruptible(&portp->open_wait); | 2075 | wake_up_interruptible(&portp->open_wait); |
2302 | } | 2076 | } |
2303 | 2077 | ||
@@ -2312,29 +2086,22 @@ static void stli_hangup(struct tty_struct *tty) | |||
2312 | 2086 | ||
2313 | static void stli_flushbuffer(struct tty_struct *tty) | 2087 | static void stli_flushbuffer(struct tty_struct *tty) |
2314 | { | 2088 | { |
2315 | stliport_t *portp; | 2089 | stliport_t *portp; |
2316 | stlibrd_t *brdp; | 2090 | stlibrd_t *brdp; |
2317 | unsigned long ftype, flags; | 2091 | unsigned long ftype, flags; |
2318 | |||
2319 | #ifdef DEBUG | ||
2320 | printk(KERN_DEBUG "stli_flushbuffer(tty=%x)\n", (int) tty); | ||
2321 | #endif | ||
2322 | 2092 | ||
2323 | if (tty == (struct tty_struct *) NULL) | ||
2324 | return; | ||
2325 | portp = tty->driver_data; | 2093 | portp = tty->driver_data; |
2326 | if (portp == (stliport_t *) NULL) | 2094 | if (portp == NULL) |
2327 | return; | 2095 | return; |
2328 | if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds)) | 2096 | if (portp->brdnr < 0 || portp->brdnr >= stli_nrbrds) |
2329 | return; | 2097 | return; |
2330 | brdp = stli_brds[portp->brdnr]; | 2098 | brdp = stli_brds[portp->brdnr]; |
2331 | if (brdp == (stlibrd_t *) NULL) | 2099 | if (brdp == NULL) |
2332 | return; | 2100 | return; |
2333 | 2101 | ||
2334 | save_flags(flags); | 2102 | spin_lock_irqsave(&brd_lock, flags); |
2335 | cli(); | ||
2336 | if (tty == stli_txcooktty) { | 2103 | if (tty == stli_txcooktty) { |
2337 | stli_txcooktty = (struct tty_struct *) NULL; | 2104 | stli_txcooktty = NULL; |
2338 | stli_txcooksize = 0; | 2105 | stli_txcooksize = 0; |
2339 | stli_txcookrealsize = 0; | 2106 | stli_txcookrealsize = 0; |
2340 | } | 2107 | } |
@@ -2346,15 +2113,10 @@ static void stli_flushbuffer(struct tty_struct *tty) | |||
2346 | ftype |= FLUSHRX; | 2113 | ftype |= FLUSHRX; |
2347 | clear_bit(ST_DOFLUSHRX, &portp->state); | 2114 | clear_bit(ST_DOFLUSHRX, &portp->state); |
2348 | } | 2115 | } |
2349 | stli_sendcmd(brdp, portp, A_FLUSH, &ftype, | 2116 | __stli_sendcmd(brdp, portp, A_FLUSH, &ftype, sizeof(u32), 0); |
2350 | sizeof(unsigned long), 0); | ||
2351 | } | 2117 | } |
2352 | restore_flags(flags); | 2118 | spin_unlock_irqrestore(&brd_lock, flags); |
2353 | 2119 | 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 | } | 2120 | } |
2359 | 2121 | ||
2360 | /*****************************************************************************/ | 2122 | /*****************************************************************************/ |
@@ -2364,55 +2126,31 @@ static void stli_breakctl(struct tty_struct *tty, int state) | |||
2364 | stlibrd_t *brdp; | 2126 | stlibrd_t *brdp; |
2365 | stliport_t *portp; | 2127 | stliport_t *portp; |
2366 | long arg; | 2128 | long arg; |
2367 | /* long savestate, savetime; */ | ||
2368 | 2129 | ||
2369 | #ifdef DEBUG | ||
2370 | printk(KERN_DEBUG "stli_breakctl(tty=%x,state=%d)\n", (int) tty, state); | ||
2371 | #endif | ||
2372 | |||
2373 | if (tty == (struct tty_struct *) NULL) | ||
2374 | return; | ||
2375 | portp = tty->driver_data; | 2130 | portp = tty->driver_data; |
2376 | if (portp == (stliport_t *) NULL) | 2131 | if (portp == NULL) |
2377 | return; | 2132 | return; |
2378 | if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds)) | 2133 | if (portp->brdnr < 0 || portp->brdnr >= stli_nrbrds) |
2379 | return; | 2134 | return; |
2380 | brdp = stli_brds[portp->brdnr]; | 2135 | brdp = stli_brds[portp->brdnr]; |
2381 | if (brdp == (stlibrd_t *) NULL) | 2136 | if (brdp == NULL) |
2382 | return; | 2137 | return; |
2383 | 2138 | ||
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; | 2139 | arg = (state == -1) ? BREAKON : BREAKOFF; |
2392 | stli_cmdwait(brdp, portp, A_BREAK, &arg, sizeof(long), 0); | 2140 | stli_cmdwait(brdp, portp, A_BREAK, &arg, sizeof(long), 0); |
2393 | |||
2394 | /* | ||
2395 | * | ||
2396 | current->timeout = savetime; | ||
2397 | current->state = savestate; | ||
2398 | */ | ||
2399 | } | 2141 | } |
2400 | 2142 | ||
2401 | /*****************************************************************************/ | 2143 | /*****************************************************************************/ |
2402 | 2144 | ||
2403 | static void stli_waituntilsent(struct tty_struct *tty, int timeout) | 2145 | static void stli_waituntilsent(struct tty_struct *tty, int timeout) |
2404 | { | 2146 | { |
2405 | stliport_t *portp; | 2147 | stliport_t *portp; |
2406 | unsigned long tend; | 2148 | unsigned long tend; |
2407 | 2149 | ||
2408 | #ifdef DEBUG | 2150 | if (tty == NULL) |
2409 | printk(KERN_DEBUG "stli_waituntilsent(tty=%x,timeout=%x)\n", (int) tty, timeout); | ||
2410 | #endif | ||
2411 | |||
2412 | if (tty == (struct tty_struct *) NULL) | ||
2413 | return; | 2151 | return; |
2414 | portp = tty->driver_data; | 2152 | portp = tty->driver_data; |
2415 | if (portp == (stliport_t *) NULL) | 2153 | if (portp == NULL) |
2416 | return; | 2154 | return; |
2417 | 2155 | ||
2418 | if (timeout == 0) | 2156 | if (timeout == 0) |
@@ -2436,19 +2174,13 @@ static void stli_sendxchar(struct tty_struct *tty, char ch) | |||
2436 | stliport_t *portp; | 2174 | stliport_t *portp; |
2437 | asyctrl_t actrl; | 2175 | asyctrl_t actrl; |
2438 | 2176 | ||
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; | 2177 | portp = tty->driver_data; |
2446 | if (portp == (stliport_t *) NULL) | 2178 | if (portp == NULL) |
2447 | return; | 2179 | return; |
2448 | if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds)) | 2180 | if (portp->brdnr < 0 || portp->brdnr >= stli_nrbrds) |
2449 | return; | 2181 | return; |
2450 | brdp = stli_brds[portp->brdnr]; | 2182 | brdp = stli_brds[portp->brdnr]; |
2451 | if (brdp == (stlibrd_t *) NULL) | 2183 | if (brdp == NULL) |
2452 | return; | 2184 | return; |
2453 | 2185 | ||
2454 | memset(&actrl, 0, sizeof(asyctrl_t)); | 2186 | memset(&actrl, 0, sizeof(asyctrl_t)); |
@@ -2460,7 +2192,6 @@ static void stli_sendxchar(struct tty_struct *tty, char ch) | |||
2460 | actrl.txctrl = CT_SENDCHR; | 2192 | actrl.txctrl = CT_SENDCHR; |
2461 | actrl.tximdch = ch; | 2193 | actrl.tximdch = ch; |
2462 | } | 2194 | } |
2463 | |||
2464 | stli_cmdwait(brdp, portp, A_PORTCTRL, &actrl, sizeof(asyctrl_t), 0); | 2195 | stli_cmdwait(brdp, portp, A_PORTCTRL, &actrl, sizeof(asyctrl_t), 0); |
2465 | } | 2196 | } |
2466 | 2197 | ||
@@ -2476,17 +2207,17 @@ static void stli_sendxchar(struct tty_struct *tty, char ch) | |||
2476 | 2207 | ||
2477 | static int stli_portinfo(stlibrd_t *brdp, stliport_t *portp, int portnr, char *pos) | 2208 | static int stli_portinfo(stlibrd_t *brdp, stliport_t *portp, int portnr, char *pos) |
2478 | { | 2209 | { |
2479 | char *sp, *uart; | 2210 | char *sp, *uart; |
2480 | int rc, cnt; | 2211 | int rc, cnt; |
2481 | 2212 | ||
2482 | rc = stli_portcmdstats(portp); | 2213 | rc = stli_portcmdstats(portp); |
2483 | 2214 | ||
2484 | uart = "UNKNOWN"; | 2215 | uart = "UNKNOWN"; |
2485 | if (brdp->state & BST_STARTED) { | 2216 | if (brdp->state & BST_STARTED) { |
2486 | switch (stli_comstats.hwid) { | 2217 | switch (stli_comstats.hwid) { |
2487 | case 0: uart = "2681"; break; | 2218 | case 0: uart = "2681"; break; |
2488 | case 1: uart = "SC26198"; break; | 2219 | case 1: uart = "SC26198"; break; |
2489 | default: uart = "CD1400"; break; | 2220 | default:uart = "CD1400"; break; |
2490 | } | 2221 | } |
2491 | } | 2222 | } |
2492 | 2223 | ||
@@ -2537,17 +2268,11 @@ static int stli_portinfo(stlibrd_t *brdp, stliport_t *portp, int portnr, char *p | |||
2537 | 2268 | ||
2538 | static int stli_readproc(char *page, char **start, off_t off, int count, int *eof, void *data) | 2269 | static int stli_readproc(char *page, char **start, off_t off, int count, int *eof, void *data) |
2539 | { | 2270 | { |
2540 | stlibrd_t *brdp; | 2271 | stlibrd_t *brdp; |
2541 | stliport_t *portp; | 2272 | stliport_t *portp; |
2542 | int brdnr, portnr, totalport; | 2273 | int brdnr, portnr, totalport; |
2543 | int curoff, maxoff; | 2274 | int curoff, maxoff; |
2544 | char *pos; | 2275 | 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 | 2276 | ||
2552 | pos = page; | 2277 | pos = page; |
2553 | totalport = 0; | 2278 | totalport = 0; |
@@ -2568,7 +2293,7 @@ static int stli_readproc(char *page, char **start, off_t off, int count, int *eo | |||
2568 | */ | 2293 | */ |
2569 | for (brdnr = 0; (brdnr < stli_nrbrds); brdnr++) { | 2294 | for (brdnr = 0; (brdnr < stli_nrbrds); brdnr++) { |
2570 | brdp = stli_brds[brdnr]; | 2295 | brdp = stli_brds[brdnr]; |
2571 | if (brdp == (stlibrd_t *) NULL) | 2296 | if (brdp == NULL) |
2572 | continue; | 2297 | continue; |
2573 | if (brdp->state == 0) | 2298 | if (brdp->state == 0) |
2574 | continue; | 2299 | continue; |
@@ -2583,7 +2308,7 @@ static int stli_readproc(char *page, char **start, off_t off, int count, int *eo | |||
2583 | for (portnr = 0; (portnr < brdp->nrports); portnr++, | 2308 | for (portnr = 0; (portnr < brdp->nrports); portnr++, |
2584 | totalport++) { | 2309 | totalport++) { |
2585 | portp = brdp->ports[portnr]; | 2310 | portp = brdp->ports[portnr]; |
2586 | if (portp == (stliport_t *) NULL) | 2311 | if (portp == NULL) |
2587 | continue; | 2312 | continue; |
2588 | if (off >= (curoff += MAXLINE)) | 2313 | if (off >= (curoff += MAXLINE)) |
2589 | continue; | 2314 | continue; |
@@ -2610,49 +2335,54 @@ stli_readdone: | |||
2610 | * a poll routine that does not have user context. Therefore you cannot | 2335 | * 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 | 2336 | * 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. | 2337 | * process. This routine does not sleep, so can be called from anywhere. |
2338 | * | ||
2339 | * The caller must hold the brd_lock (see also stli_sendcmd the usual | ||
2340 | * entry point) | ||
2613 | */ | 2341 | */ |
2614 | 2342 | ||
2615 | static void stli_sendcmd(stlibrd_t *brdp, stliport_t *portp, unsigned long cmd, void *arg, int size, int copyback) | 2343 | static void __stli_sendcmd(stlibrd_t *brdp, stliport_t *portp, unsigned long cmd, void *arg, int size, int copyback) |
2616 | { | 2344 | { |
2617 | volatile cdkhdr_t *hdrp; | 2345 | cdkhdr_t __iomem *hdrp; |
2618 | volatile cdkctrl_t *cp; | 2346 | cdkctrl_t __iomem *cp; |
2619 | volatile unsigned char *bits; | 2347 | unsigned char __iomem *bits; |
2620 | unsigned long flags; | 2348 | unsigned long flags; |
2621 | 2349 | ||
2622 | #ifdef DEBUG | 2350 | spin_lock_irqsave(&brd_lock, flags); |
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 | |||
2628 | save_flags(flags); | ||
2629 | cli(); | ||
2630 | 2351 | ||
2631 | if (test_bit(ST_CMDING, &portp->state)) { | 2352 | if (test_bit(ST_CMDING, &portp->state)) { |
2632 | printk(KERN_ERR "STALLION: command already busy, cmd=%x!\n", | 2353 | printk(KERN_ERR "STALLION: command already busy, cmd=%x!\n", |
2633 | (int) cmd); | 2354 | (int) cmd); |
2634 | restore_flags(flags); | 2355 | spin_unlock_irqrestore(&brd_lock, flags); |
2635 | return; | 2356 | return; |
2636 | } | 2357 | } |
2637 | 2358 | ||
2638 | EBRDENABLE(brdp); | 2359 | EBRDENABLE(brdp); |
2639 | cp = &((volatile cdkasy_t *) EBRDGETMEMPTR(brdp, portp->addr))->ctrl; | 2360 | cp = &((cdkasy_t __iomem *) EBRDGETMEMPTR(brdp, portp->addr))->ctrl; |
2640 | if (size > 0) { | 2361 | if (size > 0) { |
2641 | memcpy((void *) &(cp->args[0]), arg, size); | 2362 | memcpy_toio((void __iomem *) &(cp->args[0]), arg, size); |
2642 | if (copyback) { | 2363 | if (copyback) { |
2643 | portp->argp = arg; | 2364 | portp->argp = arg; |
2644 | portp->argsize = size; | 2365 | portp->argsize = size; |
2645 | } | 2366 | } |
2646 | } | 2367 | } |
2647 | cp->status = 0; | 2368 | writel(0, &cp->status); |
2648 | cp->cmd = cmd; | 2369 | writel(cmd, &cp->cmd); |
2649 | hdrp = (volatile cdkhdr_t *) EBRDGETMEMPTR(brdp, CDK_CDKADDR); | 2370 | hdrp = (cdkhdr_t __iomem *) EBRDGETMEMPTR(brdp, CDK_CDKADDR); |
2650 | bits = ((volatile unsigned char *) hdrp) + brdp->slaveoffset + | 2371 | bits = ((unsigned char __iomem *) hdrp) + brdp->slaveoffset + |
2651 | portp->portidx; | 2372 | portp->portidx; |
2652 | *bits |= portp->portbit; | 2373 | writeb(readb(bits) | portp->portbit, bits); |
2653 | set_bit(ST_CMDING, &portp->state); | 2374 | set_bit(ST_CMDING, &portp->state); |
2654 | EBRDDISABLE(brdp); | 2375 | EBRDDISABLE(brdp); |
2655 | restore_flags(flags); | 2376 | spin_unlock_irqrestore(&brd_lock, flags); |
2377 | } | ||
2378 | |||
2379 | static void stli_sendcmd(stlibrd_t *brdp, stliport_t *portp, unsigned long cmd, void *arg, int size, int copyback) | ||
2380 | { | ||
2381 | unsigned long flags; | ||
2382 | |||
2383 | spin_lock_irqsave(&brd_lock, flags); | ||
2384 | __stli_sendcmd(brdp, portp, cmd, arg, size, copyback); | ||
2385 | spin_unlock_irqrestore(&brd_lock, flags); | ||
2656 | } | 2386 | } |
2657 | 2387 | ||
2658 | /*****************************************************************************/ | 2388 | /*****************************************************************************/ |
@@ -2667,28 +2397,23 @@ static void stli_sendcmd(stlibrd_t *brdp, stliport_t *portp, unsigned long cmd, | |||
2667 | 2397 | ||
2668 | static void stli_read(stlibrd_t *brdp, stliport_t *portp) | 2398 | static void stli_read(stlibrd_t *brdp, stliport_t *portp) |
2669 | { | 2399 | { |
2670 | volatile cdkasyrq_t *rp; | 2400 | cdkasyrq_t __iomem *rp; |
2671 | volatile char *shbuf; | 2401 | char __iomem *shbuf; |
2672 | struct tty_struct *tty; | 2402 | struct tty_struct *tty; |
2673 | unsigned int head, tail, size; | 2403 | unsigned int head, tail, size; |
2674 | unsigned int len, stlen; | 2404 | 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 | 2405 | ||
2681 | if (test_bit(ST_RXSTOP, &portp->state)) | 2406 | if (test_bit(ST_RXSTOP, &portp->state)) |
2682 | return; | 2407 | return; |
2683 | tty = portp->tty; | 2408 | tty = portp->tty; |
2684 | if (tty == (struct tty_struct *) NULL) | 2409 | if (tty == NULL) |
2685 | return; | 2410 | return; |
2686 | 2411 | ||
2687 | rp = &((volatile cdkasy_t *) EBRDGETMEMPTR(brdp, portp->addr))->rxq; | 2412 | rp = &((cdkasy_t __iomem *) EBRDGETMEMPTR(brdp, portp->addr))->rxq; |
2688 | head = (unsigned int) rp->head; | 2413 | head = (unsigned int) readw(&rp->head); |
2689 | if (head != ((unsigned int) rp->head)) | 2414 | if (head != ((unsigned int) readw(&rp->head))) |
2690 | head = (unsigned int) rp->head; | 2415 | head = (unsigned int) readw(&rp->head); |
2691 | tail = (unsigned int) rp->tail; | 2416 | tail = (unsigned int) readw(&rp->tail); |
2692 | size = portp->rxsize; | 2417 | size = portp->rxsize; |
2693 | if (head >= tail) { | 2418 | if (head >= tail) { |
2694 | len = head - tail; | 2419 | len = head - tail; |
@@ -2699,12 +2424,15 @@ static void stli_read(stlibrd_t *brdp, stliport_t *portp) | |||
2699 | } | 2424 | } |
2700 | 2425 | ||
2701 | len = tty_buffer_request_room(tty, len); | 2426 | len = tty_buffer_request_room(tty, len); |
2702 | /* FIXME : iomap ? */ | 2427 | |
2703 | shbuf = (volatile char *) EBRDGETMEMPTR(brdp, portp->rxoffset); | 2428 | shbuf = (char __iomem *) EBRDGETMEMPTR(brdp, portp->rxoffset); |
2704 | 2429 | ||
2705 | while (len > 0) { | 2430 | while (len > 0) { |
2431 | unsigned char *cptr; | ||
2432 | |||
2706 | stlen = MIN(len, stlen); | 2433 | stlen = MIN(len, stlen); |
2707 | tty_insert_flip_string(tty, (char *)(shbuf + tail), stlen); | 2434 | tty_prepare_flip_string(tty, &cptr, stlen); |
2435 | memcpy_fromio(cptr, shbuf + tail, stlen); | ||
2708 | len -= stlen; | 2436 | len -= stlen; |
2709 | tail += stlen; | 2437 | tail += stlen; |
2710 | if (tail >= size) { | 2438 | if (tail >= size) { |
@@ -2712,8 +2440,8 @@ static void stli_read(stlibrd_t *brdp, stliport_t *portp) | |||
2712 | stlen = head; | 2440 | stlen = head; |
2713 | } | 2441 | } |
2714 | } | 2442 | } |
2715 | rp = &((volatile cdkasy_t *) EBRDGETMEMPTR(brdp, portp->addr))->rxq; | 2443 | rp = &((cdkasy_t __iomem *) EBRDGETMEMPTR(brdp, portp->addr))->rxq; |
2716 | rp->tail = tail; | 2444 | writew(tail, &rp->tail); |
2717 | 2445 | ||
2718 | if (head != tail) | 2446 | if (head != tail) |
2719 | set_bit(ST_RXING, &portp->state); | 2447 | set_bit(ST_RXING, &portp->state); |
@@ -2729,9 +2457,9 @@ static void stli_read(stlibrd_t *brdp, stliport_t *portp) | |||
2729 | * difficult to deal with them here. | 2457 | * difficult to deal with them here. |
2730 | */ | 2458 | */ |
2731 | 2459 | ||
2732 | static void stli_dodelaycmd(stliport_t *portp, volatile cdkctrl_t *cp) | 2460 | static void stli_dodelaycmd(stliport_t *portp, cdkctrl_t __iomem *cp) |
2733 | { | 2461 | { |
2734 | int cmd; | 2462 | int cmd; |
2735 | 2463 | ||
2736 | if (test_bit(ST_DOSIGS, &portp->state)) { | 2464 | if (test_bit(ST_DOSIGS, &portp->state)) { |
2737 | if (test_bit(ST_DOFLUSHTX, &portp->state) && | 2465 | if (test_bit(ST_DOFLUSHTX, &portp->state) && |
@@ -2746,10 +2474,10 @@ static void stli_dodelaycmd(stliport_t *portp, volatile cdkctrl_t *cp) | |||
2746 | clear_bit(ST_DOFLUSHTX, &portp->state); | 2474 | clear_bit(ST_DOFLUSHTX, &portp->state); |
2747 | clear_bit(ST_DOFLUSHRX, &portp->state); | 2475 | clear_bit(ST_DOFLUSHRX, &portp->state); |
2748 | clear_bit(ST_DOSIGS, &portp->state); | 2476 | clear_bit(ST_DOSIGS, &portp->state); |
2749 | memcpy((void *) &(cp->args[0]), (void *) &portp->asig, | 2477 | memcpy_toio((void __iomem *) &(cp->args[0]), (void *) &portp->asig, |
2750 | sizeof(asysigs_t)); | 2478 | sizeof(asysigs_t)); |
2751 | cp->status = 0; | 2479 | writel(0, &cp->status); |
2752 | cp->cmd = cmd; | 2480 | writel(cmd, &cp->cmd); |
2753 | set_bit(ST_CMDING, &portp->state); | 2481 | set_bit(ST_CMDING, &portp->state); |
2754 | } else if (test_bit(ST_DOFLUSHTX, &portp->state) || | 2482 | } else if (test_bit(ST_DOFLUSHTX, &portp->state) || |
2755 | test_bit(ST_DOFLUSHRX, &portp->state)) { | 2483 | test_bit(ST_DOFLUSHRX, &portp->state)) { |
@@ -2757,9 +2485,9 @@ static void stli_dodelaycmd(stliport_t *portp, volatile cdkctrl_t *cp) | |||
2757 | cmd |= ((test_bit(ST_DOFLUSHRX, &portp->state)) ? FLUSHRX : 0); | 2485 | cmd |= ((test_bit(ST_DOFLUSHRX, &portp->state)) ? FLUSHRX : 0); |
2758 | clear_bit(ST_DOFLUSHTX, &portp->state); | 2486 | clear_bit(ST_DOFLUSHTX, &portp->state); |
2759 | clear_bit(ST_DOFLUSHRX, &portp->state); | 2487 | clear_bit(ST_DOFLUSHRX, &portp->state); |
2760 | memcpy((void *) &(cp->args[0]), (void *) &cmd, sizeof(int)); | 2488 | memcpy_toio((void __iomem *) &(cp->args[0]), (void *) &cmd, sizeof(int)); |
2761 | cp->status = 0; | 2489 | writel(0, &cp->status); |
2762 | cp->cmd = A_FLUSH; | 2490 | writel(A_FLUSH, &cp->cmd); |
2763 | set_bit(ST_CMDING, &portp->state); | 2491 | set_bit(ST_CMDING, &portp->state); |
2764 | } | 2492 | } |
2765 | } | 2493 | } |
@@ -2779,30 +2507,25 @@ static void stli_dodelaycmd(stliport_t *portp, volatile cdkctrl_t *cp) | |||
2779 | 2507 | ||
2780 | static int stli_hostcmd(stlibrd_t *brdp, stliport_t *portp) | 2508 | static int stli_hostcmd(stlibrd_t *brdp, stliport_t *portp) |
2781 | { | 2509 | { |
2782 | volatile cdkasy_t *ap; | 2510 | cdkasy_t __iomem *ap; |
2783 | volatile cdkctrl_t *cp; | 2511 | cdkctrl_t __iomem *cp; |
2784 | struct tty_struct *tty; | 2512 | struct tty_struct *tty; |
2785 | asynotify_t nt; | 2513 | asynotify_t nt; |
2786 | unsigned long oldsigs; | 2514 | unsigned long oldsigs; |
2787 | int rc, donerx; | 2515 | int rc, donerx; |
2788 | 2516 | ||
2789 | #ifdef DEBUG | 2517 | 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; | 2518 | cp = &ap->ctrl; |
2796 | 2519 | ||
2797 | /* | 2520 | /* |
2798 | * Check if we are waiting for an open completion message. | 2521 | * Check if we are waiting for an open completion message. |
2799 | */ | 2522 | */ |
2800 | if (test_bit(ST_OPENING, &portp->state)) { | 2523 | if (test_bit(ST_OPENING, &portp->state)) { |
2801 | rc = (int) cp->openarg; | 2524 | rc = readl(&cp->openarg); |
2802 | if ((cp->open == 0) && (rc != 0)) { | 2525 | if (readb(&cp->open) == 0 && rc != 0) { |
2803 | if (rc > 0) | 2526 | if (rc > 0) |
2804 | rc--; | 2527 | rc--; |
2805 | cp->openarg = 0; | 2528 | writel(0, &cp->openarg); |
2806 | portp->rc = rc; | 2529 | portp->rc = rc; |
2807 | clear_bit(ST_OPENING, &portp->state); | 2530 | clear_bit(ST_OPENING, &portp->state); |
2808 | wake_up_interruptible(&portp->raw_wait); | 2531 | wake_up_interruptible(&portp->raw_wait); |
@@ -2813,11 +2536,11 @@ static int stli_hostcmd(stlibrd_t *brdp, stliport_t *portp) | |||
2813 | * Check if we are waiting for a close completion message. | 2536 | * Check if we are waiting for a close completion message. |
2814 | */ | 2537 | */ |
2815 | if (test_bit(ST_CLOSING, &portp->state)) { | 2538 | if (test_bit(ST_CLOSING, &portp->state)) { |
2816 | rc = (int) cp->closearg; | 2539 | rc = (int) readl(&cp->closearg); |
2817 | if ((cp->close == 0) && (rc != 0)) { | 2540 | if (readb(&cp->close) == 0 && rc != 0) { |
2818 | if (rc > 0) | 2541 | if (rc > 0) |
2819 | rc--; | 2542 | rc--; |
2820 | cp->closearg = 0; | 2543 | writel(0, &cp->closearg); |
2821 | portp->rc = rc; | 2544 | portp->rc = rc; |
2822 | clear_bit(ST_CLOSING, &portp->state); | 2545 | clear_bit(ST_CLOSING, &portp->state); |
2823 | wake_up_interruptible(&portp->raw_wait); | 2546 | wake_up_interruptible(&portp->raw_wait); |
@@ -2829,16 +2552,16 @@ static int stli_hostcmd(stlibrd_t *brdp, stliport_t *portp) | |||
2829 | * need to copy out the command results associated with this command. | 2552 | * need to copy out the command results associated with this command. |
2830 | */ | 2553 | */ |
2831 | if (test_bit(ST_CMDING, &portp->state)) { | 2554 | if (test_bit(ST_CMDING, &portp->state)) { |
2832 | rc = cp->status; | 2555 | rc = readl(&cp->status); |
2833 | if ((cp->cmd == 0) && (rc != 0)) { | 2556 | if (readl(&cp->cmd) == 0 && rc != 0) { |
2834 | if (rc > 0) | 2557 | if (rc > 0) |
2835 | rc--; | 2558 | rc--; |
2836 | if (portp->argp != (void *) NULL) { | 2559 | if (portp->argp != NULL) { |
2837 | memcpy(portp->argp, (void *) &(cp->args[0]), | 2560 | memcpy_fromio(portp->argp, (void __iomem *) &(cp->args[0]), |
2838 | portp->argsize); | 2561 | portp->argsize); |
2839 | portp->argp = (void *) NULL; | 2562 | portp->argp = NULL; |
2840 | } | 2563 | } |
2841 | cp->status = 0; | 2564 | writel(0, &cp->status); |
2842 | portp->rc = rc; | 2565 | portp->rc = rc; |
2843 | clear_bit(ST_CMDING, &portp->state); | 2566 | clear_bit(ST_CMDING, &portp->state); |
2844 | stli_dodelaycmd(portp, cp); | 2567 | stli_dodelaycmd(portp, cp); |
@@ -2877,18 +2600,15 @@ static int stli_hostcmd(stlibrd_t *brdp, stliport_t *portp) | |||
2877 | if (nt.data & DT_TXEMPTY) | 2600 | if (nt.data & DT_TXEMPTY) |
2878 | clear_bit(ST_TXBUSY, &portp->state); | 2601 | clear_bit(ST_TXBUSY, &portp->state); |
2879 | if (nt.data & (DT_TXEMPTY | DT_TXLOW)) { | 2602 | if (nt.data & (DT_TXEMPTY | DT_TXLOW)) { |
2880 | if (tty != (struct tty_struct *) NULL) { | 2603 | if (tty != NULL) { |
2881 | if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) && | 2604 | tty_wakeup(tty); |
2882 | tty->ldisc.write_wakeup) { | 2605 | EBRDENABLE(brdp); |
2883 | (tty->ldisc.write_wakeup)(tty); | ||
2884 | EBRDENABLE(brdp); | ||
2885 | } | ||
2886 | wake_up_interruptible(&tty->write_wait); | 2606 | wake_up_interruptible(&tty->write_wait); |
2887 | } | 2607 | } |
2888 | } | 2608 | } |
2889 | 2609 | ||
2890 | if ((nt.data & DT_RXBREAK) && (portp->rxmarkmsk & BRKINT)) { | 2610 | if ((nt.data & DT_RXBREAK) && (portp->rxmarkmsk & BRKINT)) { |
2891 | if (tty != (struct tty_struct *) NULL) { | 2611 | if (tty != NULL) { |
2892 | tty_insert_flip_char(tty, 0, TTY_BREAK); | 2612 | tty_insert_flip_char(tty, 0, TTY_BREAK); |
2893 | if (portp->flags & ASYNC_SAK) { | 2613 | if (portp->flags & ASYNC_SAK) { |
2894 | do_SAK(tty); | 2614 | do_SAK(tty); |
@@ -2932,14 +2652,14 @@ static int stli_hostcmd(stlibrd_t *brdp, stliport_t *portp) | |||
2932 | * at the cdk header structure. | 2652 | * at the cdk header structure. |
2933 | */ | 2653 | */ |
2934 | 2654 | ||
2935 | static void stli_brdpoll(stlibrd_t *brdp, volatile cdkhdr_t *hdrp) | 2655 | static void stli_brdpoll(stlibrd_t *brdp, cdkhdr_t __iomem *hdrp) |
2936 | { | 2656 | { |
2937 | stliport_t *portp; | 2657 | stliport_t *portp; |
2938 | unsigned char hostbits[(STL_MAXCHANS / 8) + 1]; | 2658 | unsigned char hostbits[(STL_MAXCHANS / 8) + 1]; |
2939 | unsigned char slavebits[(STL_MAXCHANS / 8) + 1]; | 2659 | unsigned char slavebits[(STL_MAXCHANS / 8) + 1]; |
2940 | unsigned char *slavep; | 2660 | unsigned char __iomem *slavep; |
2941 | int bitpos, bitat, bitsize; | 2661 | int bitpos, bitat, bitsize; |
2942 | int channr, nrdevs, slavebitchange; | 2662 | int channr, nrdevs, slavebitchange; |
2943 | 2663 | ||
2944 | bitsize = brdp->bitsize; | 2664 | bitsize = brdp->bitsize; |
2945 | nrdevs = brdp->nrdevs; | 2665 | nrdevs = brdp->nrdevs; |
@@ -2951,7 +2671,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 | 2671 | * 8 service bits at a time in the inner loop, so we can bypass |
2952 | * the lot if none of them want service. | 2672 | * the lot if none of them want service. |
2953 | */ | 2673 | */ |
2954 | memcpy(&hostbits[0], (((unsigned char *) hdrp) + brdp->hostoffset), | 2674 | memcpy_fromio(&hostbits[0], (((unsigned char __iomem *) hdrp) + brdp->hostoffset), |
2955 | bitsize); | 2675 | bitsize); |
2956 | 2676 | ||
2957 | memset(&slavebits[0], 0, bitsize); | 2677 | memset(&slavebits[0], 0, bitsize); |
@@ -2978,11 +2698,11 @@ static void stli_brdpoll(stlibrd_t *brdp, volatile cdkhdr_t *hdrp) | |||
2978 | * service may initiate more slave requests. | 2698 | * service may initiate more slave requests. |
2979 | */ | 2699 | */ |
2980 | if (slavebitchange) { | 2700 | if (slavebitchange) { |
2981 | hdrp = (volatile cdkhdr_t *) EBRDGETMEMPTR(brdp, CDK_CDKADDR); | 2701 | hdrp = (cdkhdr_t __iomem *) EBRDGETMEMPTR(brdp, CDK_CDKADDR); |
2982 | slavep = ((unsigned char *) hdrp) + brdp->slaveoffset; | 2702 | slavep = ((unsigned char __iomem *) hdrp) + brdp->slaveoffset; |
2983 | for (bitpos = 0; (bitpos < bitsize); bitpos++) { | 2703 | for (bitpos = 0; (bitpos < bitsize); bitpos++) { |
2984 | if (slavebits[bitpos]) | 2704 | if (readb(slavebits + bitpos)) |
2985 | slavep[bitpos] &= ~slavebits[bitpos]; | 2705 | writeb(readb(slavep + bitpos) & ~slavebits[bitpos], slavebits + bitpos); |
2986 | } | 2706 | } |
2987 | } | 2707 | } |
2988 | } | 2708 | } |
@@ -3000,9 +2720,9 @@ static void stli_brdpoll(stlibrd_t *brdp, volatile cdkhdr_t *hdrp) | |||
3000 | 2720 | ||
3001 | static void stli_poll(unsigned long arg) | 2721 | static void stli_poll(unsigned long arg) |
3002 | { | 2722 | { |
3003 | volatile cdkhdr_t *hdrp; | 2723 | cdkhdr_t __iomem *hdrp; |
3004 | stlibrd_t *brdp; | 2724 | stlibrd_t *brdp; |
3005 | int brdnr; | 2725 | int brdnr; |
3006 | 2726 | ||
3007 | stli_timerlist.expires = STLI_TIMEOUT; | 2727 | stli_timerlist.expires = STLI_TIMEOUT; |
3008 | add_timer(&stli_timerlist); | 2728 | add_timer(&stli_timerlist); |
@@ -3012,16 +2732,18 @@ static void stli_poll(unsigned long arg) | |||
3012 | */ | 2732 | */ |
3013 | for (brdnr = 0; (brdnr < stli_nrbrds); brdnr++) { | 2733 | for (brdnr = 0; (brdnr < stli_nrbrds); brdnr++) { |
3014 | brdp = stli_brds[brdnr]; | 2734 | brdp = stli_brds[brdnr]; |
3015 | if (brdp == (stlibrd_t *) NULL) | 2735 | if (brdp == NULL) |
3016 | continue; | 2736 | continue; |
3017 | if ((brdp->state & BST_STARTED) == 0) | 2737 | if ((brdp->state & BST_STARTED) == 0) |
3018 | continue; | 2738 | continue; |
3019 | 2739 | ||
2740 | spin_lock(&brd_lock); | ||
3020 | EBRDENABLE(brdp); | 2741 | EBRDENABLE(brdp); |
3021 | hdrp = (volatile cdkhdr_t *) EBRDGETMEMPTR(brdp, CDK_CDKADDR); | 2742 | hdrp = (cdkhdr_t __iomem *) EBRDGETMEMPTR(brdp, CDK_CDKADDR); |
3022 | if (hdrp->hostreq) | 2743 | if (readb(&hdrp->hostreq)) |
3023 | stli_brdpoll(brdp, hdrp); | 2744 | stli_brdpoll(brdp, hdrp); |
3024 | EBRDDISABLE(brdp); | 2745 | EBRDDISABLE(brdp); |
2746 | spin_unlock(&brd_lock); | ||
3025 | } | 2747 | } |
3026 | } | 2748 | } |
3027 | 2749 | ||
@@ -3034,11 +2756,6 @@ static void stli_poll(unsigned long arg) | |||
3034 | 2756 | ||
3035 | static void stli_mkasyport(stliport_t *portp, asyport_t *pp, struct termios *tiosp) | 2757 | static void stli_mkasyport(stliport_t *portp, asyport_t *pp, struct termios *tiosp) |
3036 | { | 2758 | { |
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)); | 2759 | memset(pp, 0, sizeof(asyport_t)); |
3043 | 2760 | ||
3044 | /* | 2761 | /* |
@@ -3157,11 +2874,6 @@ static void stli_mkasyport(stliport_t *portp, asyport_t *pp, struct termios *tio | |||
3157 | 2874 | ||
3158 | static void stli_mkasysigs(asysigs_t *sp, int dtr, int rts) | 2875 | static void stli_mkasysigs(asysigs_t *sp, int dtr, int rts) |
3159 | { | 2876 | { |
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)); | 2877 | memset(sp, 0, sizeof(asysigs_t)); |
3166 | if (dtr >= 0) { | 2878 | if (dtr >= 0) { |
3167 | sp->signal |= SG_DTR; | 2879 | sp->signal |= SG_DTR; |
@@ -3182,13 +2894,7 @@ static void stli_mkasysigs(asysigs_t *sp, int dtr, int rts) | |||
3182 | 2894 | ||
3183 | static long stli_mktiocm(unsigned long sigvalue) | 2895 | static long stli_mktiocm(unsigned long sigvalue) |
3184 | { | 2896 | { |
3185 | long tiocm; | 2897 | 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); | 2898 | tiocm |= ((sigvalue & SG_DCD) ? TIOCM_CD : 0); |
3193 | tiocm |= ((sigvalue & SG_CTS) ? TIOCM_CTS : 0); | 2899 | tiocm |= ((sigvalue & SG_CTS) ? TIOCM_CTS : 0); |
3194 | tiocm |= ((sigvalue & SG_RI) ? TIOCM_RI : 0); | 2900 | tiocm |= ((sigvalue & SG_RI) ? TIOCM_RI : 0); |
@@ -3210,10 +2916,6 @@ static int stli_initports(stlibrd_t *brdp) | |||
3210 | stliport_t *portp; | 2916 | stliport_t *portp; |
3211 | int i, panelnr, panelport; | 2917 | int i, panelnr, panelport; |
3212 | 2918 | ||
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++) { | 2919 | for (i = 0, panelnr = 0, panelport = 0; (i < brdp->nrports); i++) { |
3218 | portp = kzalloc(sizeof(stliport_t), GFP_KERNEL); | 2920 | portp = kzalloc(sizeof(stliport_t), GFP_KERNEL); |
3219 | if (!portp) { | 2921 | if (!portp) { |
@@ -3240,7 +2942,7 @@ static int stli_initports(stlibrd_t *brdp) | |||
3240 | brdp->ports[i] = portp; | 2942 | brdp->ports[i] = portp; |
3241 | } | 2943 | } |
3242 | 2944 | ||
3243 | return(0); | 2945 | return 0; |
3244 | } | 2946 | } |
3245 | 2947 | ||
3246 | /*****************************************************************************/ | 2948 | /*****************************************************************************/ |
@@ -3253,10 +2955,6 @@ static void stli_ecpinit(stlibrd_t *brdp) | |||
3253 | { | 2955 | { |
3254 | unsigned long memconf; | 2956 | unsigned long memconf; |
3255 | 2957 | ||
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)); | 2958 | outb(ECP_ATSTOP, (brdp->iobase + ECP_ATCONFR)); |
3261 | udelay(10); | 2959 | udelay(10); |
3262 | outb(ECP_ATDISABLE, (brdp->iobase + ECP_ATCONFR)); | 2960 | outb(ECP_ATDISABLE, (brdp->iobase + ECP_ATCONFR)); |
@@ -3270,9 +2968,6 @@ static void stli_ecpinit(stlibrd_t *brdp) | |||
3270 | 2968 | ||
3271 | static void stli_ecpenable(stlibrd_t *brdp) | 2969 | static void stli_ecpenable(stlibrd_t *brdp) |
3272 | { | 2970 | { |
3273 | #ifdef DEBUG | ||
3274 | printk(KERN_DEBUG "stli_ecpenable(brdp=%x)\n", (int) brdp); | ||
3275 | #endif | ||
3276 | outb(ECP_ATENABLE, (brdp->iobase + ECP_ATCONFR)); | 2971 | outb(ECP_ATENABLE, (brdp->iobase + ECP_ATCONFR)); |
3277 | } | 2972 | } |
3278 | 2973 | ||
@@ -3280,9 +2975,6 @@ static void stli_ecpenable(stlibrd_t *brdp) | |||
3280 | 2975 | ||
3281 | static void stli_ecpdisable(stlibrd_t *brdp) | 2976 | static void stli_ecpdisable(stlibrd_t *brdp) |
3282 | { | 2977 | { |
3283 | #ifdef DEBUG | ||
3284 | printk(KERN_DEBUG "stli_ecpdisable(brdp=%x)\n", (int) brdp); | ||
3285 | #endif | ||
3286 | outb(ECP_ATDISABLE, (brdp->iobase + ECP_ATCONFR)); | 2978 | outb(ECP_ATDISABLE, (brdp->iobase + ECP_ATCONFR)); |
3287 | } | 2979 | } |
3288 | 2980 | ||
@@ -3290,13 +2982,8 @@ static void stli_ecpdisable(stlibrd_t *brdp) | |||
3290 | 2982 | ||
3291 | static char *stli_ecpgetmemptr(stlibrd_t *brdp, unsigned long offset, int line) | 2983 | static char *stli_ecpgetmemptr(stlibrd_t *brdp, unsigned long offset, int line) |
3292 | { | 2984 | { |
3293 | void *ptr; | 2985 | void *ptr; |
3294 | unsigned char val; | 2986 | 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 | 2987 | ||
3301 | if (offset > brdp->memsize) { | 2988 | if (offset > brdp->memsize) { |
3302 | printk(KERN_ERR "STALLION: shared memory pointer=%x out of " | 2989 | printk(KERN_ERR "STALLION: shared memory pointer=%x out of " |
@@ -3316,10 +3003,6 @@ static char *stli_ecpgetmemptr(stlibrd_t *brdp, unsigned long offset, int line) | |||
3316 | 3003 | ||
3317 | static void stli_ecpreset(stlibrd_t *brdp) | 3004 | static void stli_ecpreset(stlibrd_t *brdp) |
3318 | { | 3005 | { |
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)); | 3006 | outb(ECP_ATSTOP, (brdp->iobase + ECP_ATCONFR)); |
3324 | udelay(10); | 3007 | udelay(10); |
3325 | outb(ECP_ATDISABLE, (brdp->iobase + ECP_ATCONFR)); | 3008 | outb(ECP_ATDISABLE, (brdp->iobase + ECP_ATCONFR)); |
@@ -3330,9 +3013,6 @@ static void stli_ecpreset(stlibrd_t *brdp) | |||
3330 | 3013 | ||
3331 | static void stli_ecpintr(stlibrd_t *brdp) | 3014 | static void stli_ecpintr(stlibrd_t *brdp) |
3332 | { | 3015 | { |
3333 | #ifdef DEBUG | ||
3334 | printk(KERN_DEBUG "stli_ecpintr(brdp=%x)\n", (int) brdp); | ||
3335 | #endif | ||
3336 | outb(0x1, brdp->iobase); | 3016 | outb(0x1, brdp->iobase); |
3337 | } | 3017 | } |
3338 | 3018 | ||
@@ -3346,10 +3026,6 @@ static void stli_ecpeiinit(stlibrd_t *brdp) | |||
3346 | { | 3026 | { |
3347 | unsigned long memconf; | 3027 | unsigned long memconf; |
3348 | 3028 | ||
3349 | #ifdef DEBUG | ||
3350 | printk(KERN_DEBUG "stli_ecpeiinit(brdp=%x)\n", (int) brdp); | ||
3351 | #endif | ||
3352 | |||
3353 | outb(0x1, (brdp->iobase + ECP_EIBRDENAB)); | 3029 | outb(0x1, (brdp->iobase + ECP_EIBRDENAB)); |
3354 | outb(ECP_EISTOP, (brdp->iobase + ECP_EICONFR)); | 3030 | outb(ECP_EISTOP, (brdp->iobase + ECP_EICONFR)); |
3355 | udelay(10); | 3031 | udelay(10); |
@@ -3383,11 +3059,6 @@ static char *stli_ecpeigetmemptr(stlibrd_t *brdp, unsigned long offset, int line | |||
3383 | void *ptr; | 3059 | void *ptr; |
3384 | unsigned char val; | 3060 | unsigned char val; |
3385 | 3061 | ||
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) { | 3062 | if (offset > brdp->memsize) { |
3392 | printk(KERN_ERR "STALLION: shared memory pointer=%x out of " | 3063 | printk(KERN_ERR "STALLION: shared memory pointer=%x out of " |
3393 | "range at line=%d(%d), brd=%d\n", | 3064 | "range at line=%d(%d), brd=%d\n", |
@@ -3437,8 +3108,8 @@ static void stli_ecpmcdisable(stlibrd_t *brdp) | |||
3437 | 3108 | ||
3438 | static char *stli_ecpmcgetmemptr(stlibrd_t *brdp, unsigned long offset, int line) | 3109 | static char *stli_ecpmcgetmemptr(stlibrd_t *brdp, unsigned long offset, int line) |
3439 | { | 3110 | { |
3440 | void *ptr; | 3111 | void *ptr; |
3441 | unsigned char val; | 3112 | unsigned char val; |
3442 | 3113 | ||
3443 | if (offset > brdp->memsize) { | 3114 | if (offset > brdp->memsize) { |
3444 | printk(KERN_ERR "STALLION: shared memory pointer=%x out of " | 3115 | printk(KERN_ERR "STALLION: shared memory pointer=%x out of " |
@@ -3472,10 +3143,6 @@ static void stli_ecpmcreset(stlibrd_t *brdp) | |||
3472 | 3143 | ||
3473 | static void stli_ecppciinit(stlibrd_t *brdp) | 3144 | static void stli_ecppciinit(stlibrd_t *brdp) |
3474 | { | 3145 | { |
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)); | 3146 | outb(ECP_PCISTOP, (brdp->iobase + ECP_PCICONFR)); |
3480 | udelay(10); | 3147 | udelay(10); |
3481 | outb(0, (brdp->iobase + ECP_PCICONFR)); | 3148 | outb(0, (brdp->iobase + ECP_PCICONFR)); |
@@ -3489,11 +3156,6 @@ static char *stli_ecppcigetmemptr(stlibrd_t *brdp, unsigned long offset, int lin | |||
3489 | void *ptr; | 3156 | void *ptr; |
3490 | unsigned char val; | 3157 | unsigned char val; |
3491 | 3158 | ||
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) { | 3159 | if (offset > brdp->memsize) { |
3498 | printk(KERN_ERR "STALLION: shared memory pointer=%x out of " | 3160 | printk(KERN_ERR "STALLION: shared memory pointer=%x out of " |
3499 | "range at line=%d(%d), board=%d\n", | 3161 | "range at line=%d(%d), board=%d\n", |
@@ -3528,10 +3190,6 @@ static void stli_onbinit(stlibrd_t *brdp) | |||
3528 | { | 3190 | { |
3529 | unsigned long memconf; | 3191 | unsigned long memconf; |
3530 | 3192 | ||
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)); | 3193 | outb(ONB_ATSTOP, (brdp->iobase + ONB_ATCONFR)); |
3536 | udelay(10); | 3194 | udelay(10); |
3537 | outb(ONB_ATDISABLE, (brdp->iobase + ONB_ATCONFR)); | 3195 | outb(ONB_ATDISABLE, (brdp->iobase + ONB_ATCONFR)); |
@@ -3547,9 +3205,6 @@ static void stli_onbinit(stlibrd_t *brdp) | |||
3547 | 3205 | ||
3548 | static void stli_onbenable(stlibrd_t *brdp) | 3206 | static void stli_onbenable(stlibrd_t *brdp) |
3549 | { | 3207 | { |
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)); | 3208 | outb((brdp->enabval | ONB_ATENABLE), (brdp->iobase + ONB_ATCONFR)); |
3554 | } | 3209 | } |
3555 | 3210 | ||
@@ -3557,9 +3212,6 @@ static void stli_onbenable(stlibrd_t *brdp) | |||
3557 | 3212 | ||
3558 | static void stli_onbdisable(stlibrd_t *brdp) | 3213 | static void stli_onbdisable(stlibrd_t *brdp) |
3559 | { | 3214 | { |
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)); | 3215 | outb((brdp->enabval | ONB_ATDISABLE), (brdp->iobase + ONB_ATCONFR)); |
3564 | } | 3216 | } |
3565 | 3217 | ||
@@ -3569,11 +3221,6 @@ static char *stli_onbgetmemptr(stlibrd_t *brdp, unsigned long offset, int line) | |||
3569 | { | 3221 | { |
3570 | void *ptr; | 3222 | void *ptr; |
3571 | 3223 | ||
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) { | 3224 | if (offset > brdp->memsize) { |
3578 | printk(KERN_ERR "STALLION: shared memory pointer=%x out of " | 3225 | printk(KERN_ERR "STALLION: shared memory pointer=%x out of " |
3579 | "range at line=%d(%d), brd=%d\n", | 3226 | "range at line=%d(%d), brd=%d\n", |
@@ -3589,11 +3236,6 @@ static char *stli_onbgetmemptr(stlibrd_t *brdp, unsigned long offset, int line) | |||
3589 | 3236 | ||
3590 | static void stli_onbreset(stlibrd_t *brdp) | 3237 | static void stli_onbreset(stlibrd_t *brdp) |
3591 | { | 3238 | { |
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)); | 3239 | outb(ONB_ATSTOP, (brdp->iobase + ONB_ATCONFR)); |
3598 | udelay(10); | 3240 | udelay(10); |
3599 | outb(ONB_ATDISABLE, (brdp->iobase + ONB_ATCONFR)); | 3241 | outb(ONB_ATDISABLE, (brdp->iobase + ONB_ATCONFR)); |
@@ -3610,10 +3252,6 @@ static void stli_onbeinit(stlibrd_t *brdp) | |||
3610 | { | 3252 | { |
3611 | unsigned long memconf; | 3253 | unsigned long memconf; |
3612 | 3254 | ||
3613 | #ifdef DEBUG | ||
3614 | printk(KERN_DEBUG "stli_onbeinit(brdp=%d)\n", (int) brdp); | ||
3615 | #endif | ||
3616 | |||
3617 | outb(0x1, (brdp->iobase + ONB_EIBRDENAB)); | 3255 | outb(0x1, (brdp->iobase + ONB_EIBRDENAB)); |
3618 | outb(ONB_EISTOP, (brdp->iobase + ONB_EICONFR)); | 3256 | outb(ONB_EISTOP, (brdp->iobase + ONB_EICONFR)); |
3619 | udelay(10); | 3257 | udelay(10); |
@@ -3632,9 +3270,6 @@ static void stli_onbeinit(stlibrd_t *brdp) | |||
3632 | 3270 | ||
3633 | static void stli_onbeenable(stlibrd_t *brdp) | 3271 | static void stli_onbeenable(stlibrd_t *brdp) |
3634 | { | 3272 | { |
3635 | #ifdef DEBUG | ||
3636 | printk(KERN_DEBUG "stli_onbeenable(brdp=%x)\n", (int) brdp); | ||
3637 | #endif | ||
3638 | outb(ONB_EIENABLE, (brdp->iobase + ONB_EICONFR)); | 3273 | outb(ONB_EIENABLE, (brdp->iobase + ONB_EICONFR)); |
3639 | } | 3274 | } |
3640 | 3275 | ||
@@ -3642,9 +3277,6 @@ static void stli_onbeenable(stlibrd_t *brdp) | |||
3642 | 3277 | ||
3643 | static void stli_onbedisable(stlibrd_t *brdp) | 3278 | static void stli_onbedisable(stlibrd_t *brdp) |
3644 | { | 3279 | { |
3645 | #ifdef DEBUG | ||
3646 | printk(KERN_DEBUG "stli_onbedisable(brdp=%x)\n", (int) brdp); | ||
3647 | #endif | ||
3648 | outb(ONB_EIDISABLE, (brdp->iobase + ONB_EICONFR)); | 3280 | outb(ONB_EIDISABLE, (brdp->iobase + ONB_EICONFR)); |
3649 | } | 3281 | } |
3650 | 3282 | ||
@@ -3652,13 +3284,8 @@ static void stli_onbedisable(stlibrd_t *brdp) | |||
3652 | 3284 | ||
3653 | static char *stli_onbegetmemptr(stlibrd_t *brdp, unsigned long offset, int line) | 3285 | static char *stli_onbegetmemptr(stlibrd_t *brdp, unsigned long offset, int line) |
3654 | { | 3286 | { |
3655 | void *ptr; | 3287 | void *ptr; |
3656 | unsigned char val; | 3288 | 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 | 3289 | ||
3663 | if (offset > brdp->memsize) { | 3290 | if (offset > brdp->memsize) { |
3664 | printk(KERN_ERR "STALLION: shared memory pointer=%x out of " | 3291 | printk(KERN_ERR "STALLION: shared memory pointer=%x out of " |
@@ -3681,11 +3308,6 @@ static char *stli_onbegetmemptr(stlibrd_t *brdp, unsigned long offset, int line) | |||
3681 | 3308 | ||
3682 | static void stli_onbereset(stlibrd_t *brdp) | 3309 | static void stli_onbereset(stlibrd_t *brdp) |
3683 | { | 3310 | { |
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)); | 3311 | outb(ONB_EISTOP, (brdp->iobase + ONB_EICONFR)); |
3690 | udelay(10); | 3312 | udelay(10); |
3691 | outb(ONB_EIDISABLE, (brdp->iobase + ONB_EICONFR)); | 3313 | outb(ONB_EIDISABLE, (brdp->iobase + ONB_EICONFR)); |
@@ -3700,11 +3322,6 @@ static void stli_onbereset(stlibrd_t *brdp) | |||
3700 | 3322 | ||
3701 | static void stli_bbyinit(stlibrd_t *brdp) | 3323 | static void stli_bbyinit(stlibrd_t *brdp) |
3702 | { | 3324 | { |
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)); | 3325 | outb(BBY_ATSTOP, (brdp->iobase + BBY_ATCONFR)); |
3709 | udelay(10); | 3326 | udelay(10); |
3710 | outb(0, (brdp->iobase + BBY_ATCONFR)); | 3327 | outb(0, (brdp->iobase + BBY_ATCONFR)); |
@@ -3717,24 +3334,13 @@ static void stli_bbyinit(stlibrd_t *brdp) | |||
3717 | 3334 | ||
3718 | static char *stli_bbygetmemptr(stlibrd_t *brdp, unsigned long offset, int line) | 3335 | static char *stli_bbygetmemptr(stlibrd_t *brdp, unsigned long offset, int line) |
3719 | { | 3336 | { |
3720 | void *ptr; | 3337 | void *ptr; |
3721 | unsigned char val; | 3338 | unsigned char val; |
3722 | 3339 | ||
3723 | #ifdef DEBUG | 3340 | BUG_ON(offset > brdp->memsize); |
3724 | printk(KERN_ERR "stli_bbygetmemptr(brdp=%x,offset=%x)\n", (int) brdp, | ||
3725 | (int) offset); | ||
3726 | #endif | ||
3727 | 3341 | ||
3728 | if (offset > brdp->memsize) { | 3342 | ptr = brdp->membase + (offset % BBY_PAGESIZE); |
3729 | printk(KERN_ERR "STALLION: shared memory pointer=%x out of " | 3343 | 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)); | 3344 | outb(val, (brdp->iobase + BBY_ATCONFR)); |
3739 | return(ptr); | 3345 | return(ptr); |
3740 | } | 3346 | } |
@@ -3743,11 +3349,6 @@ static char *stli_bbygetmemptr(stlibrd_t *brdp, unsigned long offset, int line) | |||
3743 | 3349 | ||
3744 | static void stli_bbyreset(stlibrd_t *brdp) | 3350 | static void stli_bbyreset(stlibrd_t *brdp) |
3745 | { | 3351 | { |
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)); | 3352 | outb(BBY_ATSTOP, (brdp->iobase + BBY_ATCONFR)); |
3752 | udelay(10); | 3353 | udelay(10); |
3753 | outb(0, (brdp->iobase + BBY_ATCONFR)); | 3354 | outb(0, (brdp->iobase + BBY_ATCONFR)); |
@@ -3762,11 +3363,6 @@ static void stli_bbyreset(stlibrd_t *brdp) | |||
3762 | 3363 | ||
3763 | static void stli_stalinit(stlibrd_t *brdp) | 3364 | static void stli_stalinit(stlibrd_t *brdp) |
3764 | { | 3365 | { |
3765 | |||
3766 | #ifdef DEBUG | ||
3767 | printk(KERN_DEBUG "stli_stalinit(brdp=%d)\n", (int) brdp); | ||
3768 | #endif | ||
3769 | |||
3770 | outb(0x1, brdp->iobase); | 3366 | outb(0x1, brdp->iobase); |
3771 | mdelay(1000); | 3367 | mdelay(1000); |
3772 | } | 3368 | } |
@@ -3775,36 +3371,18 @@ static void stli_stalinit(stlibrd_t *brdp) | |||
3775 | 3371 | ||
3776 | static char *stli_stalgetmemptr(stlibrd_t *brdp, unsigned long offset, int line) | 3372 | static char *stli_stalgetmemptr(stlibrd_t *brdp, unsigned long offset, int line) |
3777 | { | 3373 | { |
3778 | void *ptr; | 3374 | BUG_ON(offset > brdp->memsize); |
3779 | 3375 | 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 | } | 3376 | } |
3795 | 3377 | ||
3796 | /*****************************************************************************/ | 3378 | /*****************************************************************************/ |
3797 | 3379 | ||
3798 | static void stli_stalreset(stlibrd_t *brdp) | 3380 | static void stli_stalreset(stlibrd_t *brdp) |
3799 | { | 3381 | { |
3800 | volatile unsigned long *vecp; | 3382 | u32 __iomem *vecp; |
3801 | 3383 | ||
3802 | #ifdef DEBUG | 3384 | vecp = (u32 __iomem *) (brdp->membase + 0x30); |
3803 | printk(KERN_DEBUG "stli_stalreset(brdp=%x)\n", (int) brdp); | 3385 | writel(0xffff0000, vecp); |
3804 | #endif | ||
3805 | |||
3806 | vecp = (volatile unsigned long *) (brdp->membase + 0x30); | ||
3807 | *vecp = 0xffff0000; | ||
3808 | outb(0, brdp->iobase); | 3386 | outb(0, brdp->iobase); |
3809 | mdelay(1000); | 3387 | mdelay(1000); |
3810 | } | 3388 | } |
@@ -3818,15 +3396,11 @@ static void stli_stalreset(stlibrd_t *brdp) | |||
3818 | 3396 | ||
3819 | static int stli_initecp(stlibrd_t *brdp) | 3397 | static int stli_initecp(stlibrd_t *brdp) |
3820 | { | 3398 | { |
3821 | cdkecpsig_t sig; | 3399 | cdkecpsig_t sig; |
3822 | cdkecpsig_t *sigsp; | 3400 | cdkecpsig_t __iomem *sigsp; |
3823 | unsigned int status, nxtid; | 3401 | unsigned int status, nxtid; |
3824 | char *name; | 3402 | char *name; |
3825 | int panelnr, nrports; | 3403 | int panelnr, nrports; |
3826 | |||
3827 | #ifdef DEBUG | ||
3828 | printk(KERN_DEBUG "stli_initecp(brdp=%x)\n", (int) brdp); | ||
3829 | #endif | ||
3830 | 3404 | ||
3831 | if (!request_region(brdp->iobase, brdp->iosize, "istallion")) | 3405 | if (!request_region(brdp->iobase, brdp->iosize, "istallion")) |
3832 | return -EIO; | 3406 | return -EIO; |
@@ -3834,7 +3408,7 @@ static int stli_initecp(stlibrd_t *brdp) | |||
3834 | if ((brdp->iobase == 0) || (brdp->memaddr == 0)) | 3408 | if ((brdp->iobase == 0) || (brdp->memaddr == 0)) |
3835 | { | 3409 | { |
3836 | release_region(brdp->iobase, brdp->iosize); | 3410 | release_region(brdp->iobase, brdp->iosize); |
3837 | return(-ENODEV); | 3411 | return -ENODEV; |
3838 | } | 3412 | } |
3839 | 3413 | ||
3840 | brdp->iosize = ECP_IOSIZE; | 3414 | brdp->iosize = ECP_IOSIZE; |
@@ -3903,7 +3477,7 @@ static int stli_initecp(stlibrd_t *brdp) | |||
3903 | 3477 | ||
3904 | default: | 3478 | default: |
3905 | release_region(brdp->iobase, brdp->iosize); | 3479 | release_region(brdp->iobase, brdp->iosize); |
3906 | return(-EINVAL); | 3480 | return -EINVAL; |
3907 | } | 3481 | } |
3908 | 3482 | ||
3909 | /* | 3483 | /* |
@@ -3915,10 +3489,10 @@ static int stli_initecp(stlibrd_t *brdp) | |||
3915 | EBRDINIT(brdp); | 3489 | EBRDINIT(brdp); |
3916 | 3490 | ||
3917 | brdp->membase = ioremap(brdp->memaddr, brdp->memsize); | 3491 | brdp->membase = ioremap(brdp->memaddr, brdp->memsize); |
3918 | if (brdp->membase == (void *) NULL) | 3492 | if (brdp->membase == NULL) |
3919 | { | 3493 | { |
3920 | release_region(brdp->iobase, brdp->iosize); | 3494 | release_region(brdp->iobase, brdp->iosize); |
3921 | return(-ENOMEM); | 3495 | return -ENOMEM; |
3922 | } | 3496 | } |
3923 | 3497 | ||
3924 | /* | 3498 | /* |
@@ -3927,23 +3501,14 @@ static int stli_initecp(stlibrd_t *brdp) | |||
3927 | * this is, and what it is connected to it. | 3501 | * this is, and what it is connected to it. |
3928 | */ | 3502 | */ |
3929 | EBRDENABLE(brdp); | 3503 | EBRDENABLE(brdp); |
3930 | sigsp = (cdkecpsig_t *) EBRDGETMEMPTR(brdp, CDK_SIGADDR); | 3504 | sigsp = (cdkecpsig_t __iomem *) EBRDGETMEMPTR(brdp, CDK_SIGADDR); |
3931 | memcpy(&sig, sigsp, sizeof(cdkecpsig_t)); | 3505 | memcpy(&sig, sigsp, sizeof(cdkecpsig_t)); |
3932 | EBRDDISABLE(brdp); | 3506 | EBRDDISABLE(brdp); |
3933 | 3507 | ||
3934 | #if 0 | 3508 | 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 | { | 3509 | { |
3945 | release_region(brdp->iobase, brdp->iosize); | 3510 | release_region(brdp->iobase, brdp->iosize); |
3946 | return(-ENODEV); | 3511 | return -ENODEV; |
3947 | } | 3512 | } |
3948 | 3513 | ||
3949 | /* | 3514 | /* |
@@ -3967,7 +3532,7 @@ static int stli_initecp(stlibrd_t *brdp) | |||
3967 | 3532 | ||
3968 | 3533 | ||
3969 | brdp->state |= BST_FOUND; | 3534 | brdp->state |= BST_FOUND; |
3970 | return(0); | 3535 | return 0; |
3971 | } | 3536 | } |
3972 | 3537 | ||
3973 | /*****************************************************************************/ | 3538 | /*****************************************************************************/ |
@@ -3979,20 +3544,16 @@ static int stli_initecp(stlibrd_t *brdp) | |||
3979 | 3544 | ||
3980 | static int stli_initonb(stlibrd_t *brdp) | 3545 | static int stli_initonb(stlibrd_t *brdp) |
3981 | { | 3546 | { |
3982 | cdkonbsig_t sig; | 3547 | cdkonbsig_t sig; |
3983 | cdkonbsig_t *sigsp; | 3548 | cdkonbsig_t __iomem *sigsp; |
3984 | char *name; | 3549 | char *name; |
3985 | int i; | 3550 | int i; |
3986 | |||
3987 | #ifdef DEBUG | ||
3988 | printk(KERN_DEBUG "stli_initonb(brdp=%x)\n", (int) brdp); | ||
3989 | #endif | ||
3990 | 3551 | ||
3991 | /* | 3552 | /* |
3992 | * Do a basic sanity check on the IO and memory addresses. | 3553 | * Do a basic sanity check on the IO and memory addresses. |
3993 | */ | 3554 | */ |
3994 | if ((brdp->iobase == 0) || (brdp->memaddr == 0)) | 3555 | if (brdp->iobase == 0 || brdp->memaddr == 0) |
3995 | return(-ENODEV); | 3556 | return -ENODEV; |
3996 | 3557 | ||
3997 | brdp->iosize = ONB_IOSIZE; | 3558 | brdp->iosize = ONB_IOSIZE; |
3998 | 3559 | ||
@@ -4010,7 +3571,6 @@ static int stli_initonb(stlibrd_t *brdp) | |||
4010 | case BRD_ONBOARD2: | 3571 | case BRD_ONBOARD2: |
4011 | case BRD_ONBOARD2_32: | 3572 | case BRD_ONBOARD2_32: |
4012 | case BRD_ONBOARDRS: | 3573 | case BRD_ONBOARDRS: |
4013 | brdp->membase = (void *) brdp->memaddr; | ||
4014 | brdp->memsize = ONB_MEMSIZE; | 3574 | brdp->memsize = ONB_MEMSIZE; |
4015 | brdp->pagesize = ONB_ATPAGESIZE; | 3575 | brdp->pagesize = ONB_ATPAGESIZE; |
4016 | brdp->init = stli_onbinit; | 3576 | brdp->init = stli_onbinit; |
@@ -4028,7 +3588,6 @@ static int stli_initonb(stlibrd_t *brdp) | |||
4028 | break; | 3588 | break; |
4029 | 3589 | ||
4030 | case BRD_ONBOARDE: | 3590 | case BRD_ONBOARDE: |
4031 | brdp->membase = (void *) brdp->memaddr; | ||
4032 | brdp->memsize = ONB_EIMEMSIZE; | 3591 | brdp->memsize = ONB_EIMEMSIZE; |
4033 | brdp->pagesize = ONB_EIPAGESIZE; | 3592 | brdp->pagesize = ONB_EIPAGESIZE; |
4034 | brdp->init = stli_onbeinit; | 3593 | brdp->init = stli_onbeinit; |
@@ -4044,7 +3603,6 @@ static int stli_initonb(stlibrd_t *brdp) | |||
4044 | case BRD_BRUMBY4: | 3603 | case BRD_BRUMBY4: |
4045 | case BRD_BRUMBY8: | 3604 | case BRD_BRUMBY8: |
4046 | case BRD_BRUMBY16: | 3605 | case BRD_BRUMBY16: |
4047 | brdp->membase = (void *) brdp->memaddr; | ||
4048 | brdp->memsize = BBY_MEMSIZE; | 3606 | brdp->memsize = BBY_MEMSIZE; |
4049 | brdp->pagesize = BBY_PAGESIZE; | 3607 | brdp->pagesize = BBY_PAGESIZE; |
4050 | brdp->init = stli_bbyinit; | 3608 | brdp->init = stli_bbyinit; |
@@ -4058,7 +3616,6 @@ static int stli_initonb(stlibrd_t *brdp) | |||
4058 | break; | 3616 | break; |
4059 | 3617 | ||
4060 | case BRD_STALLION: | 3618 | case BRD_STALLION: |
4061 | brdp->membase = (void *) brdp->memaddr; | ||
4062 | brdp->memsize = STAL_MEMSIZE; | 3619 | brdp->memsize = STAL_MEMSIZE; |
4063 | brdp->pagesize = STAL_PAGESIZE; | 3620 | brdp->pagesize = STAL_PAGESIZE; |
4064 | brdp->init = stli_stalinit; | 3621 | brdp->init = stli_stalinit; |
@@ -4073,7 +3630,7 @@ static int stli_initonb(stlibrd_t *brdp) | |||
4073 | 3630 | ||
4074 | default: | 3631 | default: |
4075 | release_region(brdp->iobase, brdp->iosize); | 3632 | release_region(brdp->iobase, brdp->iosize); |
4076 | return(-EINVAL); | 3633 | return -EINVAL; |
4077 | } | 3634 | } |
4078 | 3635 | ||
4079 | /* | 3636 | /* |
@@ -4085,10 +3642,10 @@ static int stli_initonb(stlibrd_t *brdp) | |||
4085 | EBRDINIT(brdp); | 3642 | EBRDINIT(brdp); |
4086 | 3643 | ||
4087 | brdp->membase = ioremap(brdp->memaddr, brdp->memsize); | 3644 | brdp->membase = ioremap(brdp->memaddr, brdp->memsize); |
4088 | if (brdp->membase == (void *) NULL) | 3645 | if (brdp->membase == NULL) |
4089 | { | 3646 | { |
4090 | release_region(brdp->iobase, brdp->iosize); | 3647 | release_region(brdp->iobase, brdp->iosize); |
4091 | return(-ENOMEM); | 3648 | return -ENOMEM; |
4092 | } | 3649 | } |
4093 | 3650 | ||
4094 | /* | 3651 | /* |
@@ -4097,21 +3654,17 @@ static int stli_initonb(stlibrd_t *brdp) | |||
4097 | * this is, and how many ports. | 3654 | * this is, and how many ports. |
4098 | */ | 3655 | */ |
4099 | EBRDENABLE(brdp); | 3656 | EBRDENABLE(brdp); |
4100 | sigsp = (cdkonbsig_t *) EBRDGETMEMPTR(brdp, CDK_SIGADDR); | 3657 | sigsp = (cdkonbsig_t __iomem *) EBRDGETMEMPTR(brdp, CDK_SIGADDR); |
4101 | memcpy(&sig, sigsp, sizeof(cdkonbsig_t)); | 3658 | memcpy_fromio(&sig, sigsp, sizeof(cdkonbsig_t)); |
4102 | EBRDDISABLE(brdp); | 3659 | EBRDDISABLE(brdp); |
4103 | 3660 | ||
4104 | #if 0 | 3661 | 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", | 3662 | sig.magic1 != cpu_to_le16(ONB_MAGIC1) || |
4106 | __FILE__, __LINE__, sig.magic0, sig.magic1, sig.magic2, | 3663 | sig.magic2 != cpu_to_le16(ONB_MAGIC2) || |
4107 | sig.magic3, sig.romver, sig.amask0, sig.amask1, sig.amask2); | 3664 | 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 | { | 3665 | { |
4113 | release_region(brdp->iobase, brdp->iosize); | 3666 | release_region(brdp->iobase, brdp->iosize); |
4114 | return(-ENODEV); | 3667 | return -ENODEV; |
4115 | } | 3668 | } |
4116 | 3669 | ||
4117 | /* | 3670 | /* |
@@ -4132,7 +3685,7 @@ static int stli_initonb(stlibrd_t *brdp) | |||
4132 | 3685 | ||
4133 | 3686 | ||
4134 | brdp->state |= BST_FOUND; | 3687 | brdp->state |= BST_FOUND; |
4135 | return(0); | 3688 | return 0; |
4136 | } | 3689 | } |
4137 | 3690 | ||
4138 | /*****************************************************************************/ | 3691 | /*****************************************************************************/ |
@@ -4145,31 +3698,25 @@ static int stli_initonb(stlibrd_t *brdp) | |||
4145 | 3698 | ||
4146 | static int stli_startbrd(stlibrd_t *brdp) | 3699 | static int stli_startbrd(stlibrd_t *brdp) |
4147 | { | 3700 | { |
4148 | volatile cdkhdr_t *hdrp; | 3701 | cdkhdr_t __iomem *hdrp; |
4149 | volatile cdkmem_t *memp; | 3702 | cdkmem_t __iomem *memp; |
4150 | volatile cdkasy_t *ap; | 3703 | cdkasy_t __iomem *ap; |
4151 | unsigned long flags; | 3704 | unsigned long flags; |
4152 | stliport_t *portp; | 3705 | stliport_t *portp; |
4153 | int portnr, nrdevs, i, rc; | 3706 | int portnr, nrdevs, i, rc = 0; |
4154 | 3707 | u32 memoff; | |
4155 | #ifdef DEBUG | 3708 | |
4156 | printk(KERN_DEBUG "stli_startbrd(brdp=%x)\n", (int) brdp); | 3709 | spin_lock_irqsave(&brd_lock, flags); |
4157 | #endif | ||
4158 | |||
4159 | rc = 0; | ||
4160 | |||
4161 | save_flags(flags); | ||
4162 | cli(); | ||
4163 | EBRDENABLE(brdp); | 3710 | EBRDENABLE(brdp); |
4164 | hdrp = (volatile cdkhdr_t *) EBRDGETMEMPTR(brdp, CDK_CDKADDR); | 3711 | hdrp = (cdkhdr_t __iomem *) EBRDGETMEMPTR(brdp, CDK_CDKADDR); |
4165 | nrdevs = hdrp->nrdevs; | 3712 | nrdevs = hdrp->nrdevs; |
4166 | 3713 | ||
4167 | #if 0 | 3714 | #if 0 |
4168 | printk("%s(%d): CDK version %d.%d.%d --> " | 3715 | printk("%s(%d): CDK version %d.%d.%d --> " |
4169 | "nrdevs=%d memp=%x hostp=%x slavep=%x\n", | 3716 | "nrdevs=%d memp=%x hostp=%x slavep=%x\n", |
4170 | __FILE__, __LINE__, hdrp->ver_release, hdrp->ver_modification, | 3717 | __FILE__, __LINE__, readb(&hdrp->ver_release), readb(&hdrp->ver_modification), |
4171 | hdrp->ver_fix, nrdevs, (int) hdrp->memp, (int) hdrp->hostp, | 3718 | readb(&hdrp->ver_fix), nrdevs, (int) readl(&hdrp->memp), readl(&hdrp->hostp), |
4172 | (int) hdrp->slavep); | 3719 | readl(&hdrp->slavep)); |
4173 | #endif | 3720 | #endif |
4174 | 3721 | ||
4175 | if (nrdevs < (brdp->nrports + 1)) { | 3722 | if (nrdevs < (brdp->nrports + 1)) { |
@@ -4181,14 +3728,14 @@ static int stli_startbrd(stlibrd_t *brdp) | |||
4181 | brdp->hostoffset = hdrp->hostp - CDK_CDKADDR; | 3728 | brdp->hostoffset = hdrp->hostp - CDK_CDKADDR; |
4182 | brdp->slaveoffset = hdrp->slavep - CDK_CDKADDR; | 3729 | brdp->slaveoffset = hdrp->slavep - CDK_CDKADDR; |
4183 | brdp->bitsize = (nrdevs + 7) / 8; | 3730 | brdp->bitsize = (nrdevs + 7) / 8; |
4184 | memp = (volatile cdkmem_t *) hdrp->memp; | 3731 | memoff = readl(&hdrp->memp); |
4185 | if (((unsigned long) memp) > brdp->memsize) { | 3732 | if (memoff > brdp->memsize) { |
4186 | printk(KERN_ERR "STALLION: corrupted shared memory region?\n"); | 3733 | printk(KERN_ERR "STALLION: corrupted shared memory region?\n"); |
4187 | rc = -EIO; | 3734 | rc = -EIO; |
4188 | goto stli_donestartup; | 3735 | goto stli_donestartup; |
4189 | } | 3736 | } |
4190 | memp = (volatile cdkmem_t *) EBRDGETMEMPTR(brdp, (unsigned long) memp); | 3737 | memp = (cdkmem_t __iomem *) EBRDGETMEMPTR(brdp, memoff); |
4191 | if (memp->dtype != TYP_ASYNCTRL) { | 3738 | if (readw(&memp->dtype) != TYP_ASYNCTRL) { |
4192 | printk(KERN_ERR "STALLION: no slave control device found\n"); | 3739 | printk(KERN_ERR "STALLION: no slave control device found\n"); |
4193 | goto stli_donestartup; | 3740 | goto stli_donestartup; |
4194 | } | 3741 | } |
@@ -4200,19 +3747,19 @@ static int stli_startbrd(stlibrd_t *brdp) | |||
4200 | * change pages while reading memory map. | 3747 | * change pages while reading memory map. |
4201 | */ | 3748 | */ |
4202 | for (i = 1, portnr = 0; (i < nrdevs); i++, portnr++, memp++) { | 3749 | for (i = 1, portnr = 0; (i < nrdevs); i++, portnr++, memp++) { |
4203 | if (memp->dtype != TYP_ASYNC) | 3750 | if (readw(&memp->dtype) != TYP_ASYNC) |
4204 | break; | 3751 | break; |
4205 | portp = brdp->ports[portnr]; | 3752 | portp = brdp->ports[portnr]; |
4206 | if (portp == (stliport_t *) NULL) | 3753 | if (portp == NULL) |
4207 | break; | 3754 | break; |
4208 | portp->devnr = i; | 3755 | portp->devnr = i; |
4209 | portp->addr = memp->offset; | 3756 | portp->addr = readl(&memp->offset); |
4210 | portp->reqbit = (unsigned char) (0x1 << (i * 8 / nrdevs)); | 3757 | portp->reqbit = (unsigned char) (0x1 << (i * 8 / nrdevs)); |
4211 | portp->portidx = (unsigned char) (i / 8); | 3758 | portp->portidx = (unsigned char) (i / 8); |
4212 | portp->portbit = (unsigned char) (0x1 << (i % 8)); | 3759 | portp->portbit = (unsigned char) (0x1 << (i % 8)); |
4213 | } | 3760 | } |
4214 | 3761 | ||
4215 | hdrp->slavereq = 0xff; | 3762 | writeb(0xff, &hdrp->slavereq); |
4216 | 3763 | ||
4217 | /* | 3764 | /* |
4218 | * For each port setup a local copy of the RX and TX buffer offsets | 3765 | * For each port setup a local copy of the RX and TX buffer offsets |
@@ -4221,22 +3768,22 @@ static int stli_startbrd(stlibrd_t *brdp) | |||
4221 | */ | 3768 | */ |
4222 | for (i = 1, portnr = 0; (i < nrdevs); i++, portnr++) { | 3769 | for (i = 1, portnr = 0; (i < nrdevs); i++, portnr++) { |
4223 | portp = brdp->ports[portnr]; | 3770 | portp = brdp->ports[portnr]; |
4224 | if (portp == (stliport_t *) NULL) | 3771 | if (portp == NULL) |
4225 | break; | 3772 | break; |
4226 | if (portp->addr == 0) | 3773 | if (portp->addr == 0) |
4227 | break; | 3774 | break; |
4228 | ap = (volatile cdkasy_t *) EBRDGETMEMPTR(brdp, portp->addr); | 3775 | ap = (cdkasy_t __iomem *) EBRDGETMEMPTR(brdp, portp->addr); |
4229 | if (ap != (volatile cdkasy_t *) NULL) { | 3776 | if (ap != NULL) { |
4230 | portp->rxsize = ap->rxq.size; | 3777 | portp->rxsize = readw(&ap->rxq.size); |
4231 | portp->txsize = ap->txq.size; | 3778 | portp->txsize = readw(&ap->txq.size); |
4232 | portp->rxoffset = ap->rxq.offset; | 3779 | portp->rxoffset = readl(&ap->rxq.offset); |
4233 | portp->txoffset = ap->txq.offset; | 3780 | portp->txoffset = readl(&ap->txq.offset); |
4234 | } | 3781 | } |
4235 | } | 3782 | } |
4236 | 3783 | ||
4237 | stli_donestartup: | 3784 | stli_donestartup: |
4238 | EBRDDISABLE(brdp); | 3785 | EBRDDISABLE(brdp); |
4239 | restore_flags(flags); | 3786 | spin_unlock_irqrestore(&brd_lock, flags); |
4240 | 3787 | ||
4241 | if (rc == 0) | 3788 | if (rc == 0) |
4242 | brdp->state |= BST_STARTED; | 3789 | brdp->state |= BST_STARTED; |
@@ -4247,7 +3794,7 @@ stli_donestartup: | |||
4247 | add_timer(&stli_timerlist); | 3794 | add_timer(&stli_timerlist); |
4248 | } | 3795 | } |
4249 | 3796 | ||
4250 | return(rc); | 3797 | return rc; |
4251 | } | 3798 | } |
4252 | 3799 | ||
4253 | /*****************************************************************************/ | 3800 | /*****************************************************************************/ |
@@ -4258,10 +3805,6 @@ stli_donestartup: | |||
4258 | 3805 | ||
4259 | static int __init stli_brdinit(stlibrd_t *brdp) | 3806 | static int __init stli_brdinit(stlibrd_t *brdp) |
4260 | { | 3807 | { |
4261 | #ifdef DEBUG | ||
4262 | printk(KERN_DEBUG "stli_brdinit(brdp=%x)\n", (int) brdp); | ||
4263 | #endif | ||
4264 | |||
4265 | stli_brds[brdp->brdnr] = brdp; | 3808 | stli_brds[brdp->brdnr] = brdp; |
4266 | 3809 | ||
4267 | switch (brdp->brdtype) { | 3810 | switch (brdp->brdtype) { |
@@ -4289,11 +3832,11 @@ static int __init stli_brdinit(stlibrd_t *brdp) | |||
4289 | case BRD_ECHPCI: | 3832 | case BRD_ECHPCI: |
4290 | printk(KERN_ERR "STALLION: %s board type not supported in " | 3833 | printk(KERN_ERR "STALLION: %s board type not supported in " |
4291 | "this driver\n", stli_brdnames[brdp->brdtype]); | 3834 | "this driver\n", stli_brdnames[brdp->brdtype]); |
4292 | return(ENODEV); | 3835 | return -ENODEV; |
4293 | default: | 3836 | default: |
4294 | printk(KERN_ERR "STALLION: board=%d is unknown board " | 3837 | printk(KERN_ERR "STALLION: board=%d is unknown board " |
4295 | "type=%d\n", brdp->brdnr, brdp->brdtype); | 3838 | "type=%d\n", brdp->brdnr, brdp->brdtype); |
4296 | return(ENODEV); | 3839 | return -ENODEV; |
4297 | } | 3840 | } |
4298 | 3841 | ||
4299 | if ((brdp->state & BST_FOUND) == 0) { | 3842 | if ((brdp->state & BST_FOUND) == 0) { |
@@ -4301,7 +3844,7 @@ static int __init stli_brdinit(stlibrd_t *brdp) | |||
4301 | "io=%x mem=%x\n", | 3844 | "io=%x mem=%x\n", |
4302 | stli_brdnames[brdp->brdtype], brdp->brdnr, | 3845 | stli_brdnames[brdp->brdtype], brdp->brdnr, |
4303 | brdp->iobase, (int) brdp->memaddr); | 3846 | brdp->iobase, (int) brdp->memaddr); |
4304 | return(ENODEV); | 3847 | return -ENODEV; |
4305 | } | 3848 | } |
4306 | 3849 | ||
4307 | stli_initports(brdp); | 3850 | stli_initports(brdp); |
@@ -4309,7 +3852,7 @@ static int __init stli_brdinit(stlibrd_t *brdp) | |||
4309 | "nrpanels=%d nrports=%d\n", stli_brdnames[brdp->brdtype], | 3852 | "nrpanels=%d nrports=%d\n", stli_brdnames[brdp->brdtype], |
4310 | brdp->brdnr, brdp->iobase, (int) brdp->memaddr, | 3853 | brdp->brdnr, brdp->iobase, (int) brdp->memaddr, |
4311 | brdp->nrpanels, brdp->nrports); | 3854 | brdp->nrpanels, brdp->nrports); |
4312 | return(0); | 3855 | return 0; |
4313 | } | 3856 | } |
4314 | 3857 | ||
4315 | /*****************************************************************************/ | 3858 | /*****************************************************************************/ |
@@ -4321,14 +3864,10 @@ static int __init stli_brdinit(stlibrd_t *brdp) | |||
4321 | 3864 | ||
4322 | static int stli_eisamemprobe(stlibrd_t *brdp) | 3865 | static int stli_eisamemprobe(stlibrd_t *brdp) |
4323 | { | 3866 | { |
4324 | cdkecpsig_t ecpsig, *ecpsigp; | 3867 | cdkecpsig_t ecpsig, __iomem *ecpsigp; |
4325 | cdkonbsig_t onbsig, *onbsigp; | 3868 | cdkonbsig_t onbsig, __iomem *onbsigp; |
4326 | int i, foundit; | 3869 | int i, foundit; |
4327 | 3870 | ||
4328 | #ifdef DEBUG | ||
4329 | printk(KERN_DEBUG "stli_eisamemprobe(brdp=%x)\n", (int) brdp); | ||
4330 | #endif | ||
4331 | |||
4332 | /* | 3871 | /* |
4333 | * First up we reset the board, to get it into a known state. There | 3872 | * 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 | 3873 | * is only 2 board types here we need to worry about. Don;t use the |
@@ -4352,7 +3891,7 @@ static int stli_eisamemprobe(stlibrd_t *brdp) | |||
4352 | mdelay(1); | 3891 | mdelay(1); |
4353 | stli_onbeenable(brdp); | 3892 | stli_onbeenable(brdp); |
4354 | } else { | 3893 | } else { |
4355 | return(-ENODEV); | 3894 | return -ENODEV; |
4356 | } | 3895 | } |
4357 | 3896 | ||
4358 | foundit = 0; | 3897 | foundit = 0; |
@@ -4364,25 +3903,24 @@ static int stli_eisamemprobe(stlibrd_t *brdp) | |||
4364 | */ | 3903 | */ |
4365 | for (i = 0; (i < stli_eisamempsize); i++) { | 3904 | for (i = 0; (i < stli_eisamempsize); i++) { |
4366 | brdp->memaddr = stli_eisamemprobeaddrs[i]; | 3905 | brdp->memaddr = stli_eisamemprobeaddrs[i]; |
4367 | brdp->membase = (void *) brdp->memaddr; | ||
4368 | brdp->membase = ioremap(brdp->memaddr, brdp->memsize); | 3906 | brdp->membase = ioremap(brdp->memaddr, brdp->memsize); |
4369 | if (brdp->membase == (void *) NULL) | 3907 | if (brdp->membase == NULL) |
4370 | continue; | 3908 | continue; |
4371 | 3909 | ||
4372 | if (brdp->brdtype == BRD_ECPE) { | 3910 | if (brdp->brdtype == BRD_ECPE) { |
4373 | ecpsigp = (cdkecpsig_t *) stli_ecpeigetmemptr(brdp, | 3911 | ecpsigp = (cdkecpsig_t __iomem *) stli_ecpeigetmemptr(brdp, |
4374 | CDK_SIGADDR, __LINE__); | 3912 | CDK_SIGADDR, __LINE__); |
4375 | memcpy(&ecpsig, ecpsigp, sizeof(cdkecpsig_t)); | 3913 | memcpy_fromio(&ecpsig, ecpsigp, sizeof(cdkecpsig_t)); |
4376 | if (ecpsig.magic == ECP_MAGIC) | 3914 | if (ecpsig.magic == cpu_to_le32(ECP_MAGIC)) |
4377 | foundit = 1; | 3915 | foundit = 1; |
4378 | } else { | 3916 | } else { |
4379 | onbsigp = (cdkonbsig_t *) stli_onbegetmemptr(brdp, | 3917 | onbsigp = (cdkonbsig_t __iomem *) stli_onbegetmemptr(brdp, |
4380 | CDK_SIGADDR, __LINE__); | 3918 | CDK_SIGADDR, __LINE__); |
4381 | memcpy(&onbsig, onbsigp, sizeof(cdkonbsig_t)); | 3919 | memcpy_fromio(&onbsig, onbsigp, sizeof(cdkonbsig_t)); |
4382 | if ((onbsig.magic0 == ONB_MAGIC0) && | 3920 | if ((onbsig.magic0 == cpu_to_le16(ONB_MAGIC0)) && |
4383 | (onbsig.magic1 == ONB_MAGIC1) && | 3921 | (onbsig.magic1 == cpu_to_le16(ONB_MAGIC1)) && |
4384 | (onbsig.magic2 == ONB_MAGIC2) && | 3922 | (onbsig.magic2 == cpu_to_le16(ONB_MAGIC2)) && |
4385 | (onbsig.magic3 == ONB_MAGIC3)) | 3923 | (onbsig.magic3 == cpu_to_le16(ONB_MAGIC3))) |
4386 | foundit = 1; | 3924 | foundit = 1; |
4387 | } | 3925 | } |
4388 | 3926 | ||
@@ -4406,9 +3944,9 @@ static int stli_eisamemprobe(stlibrd_t *brdp) | |||
4406 | printk(KERN_ERR "STALLION: failed to probe shared memory " | 3944 | printk(KERN_ERR "STALLION: failed to probe shared memory " |
4407 | "region for %s in EISA slot=%d\n", | 3945 | "region for %s in EISA slot=%d\n", |
4408 | stli_brdnames[brdp->brdtype], (brdp->iobase >> 12)); | 3946 | stli_brdnames[brdp->brdtype], (brdp->iobase >> 12)); |
4409 | return(-ENODEV); | 3947 | return -ENODEV; |
4410 | } | 3948 | } |
4411 | return(0); | 3949 | return 0; |
4412 | } | 3950 | } |
4413 | 3951 | ||
4414 | static int stli_getbrdnr(void) | 3952 | static int stli_getbrdnr(void) |
@@ -4439,22 +3977,16 @@ static int stli_getbrdnr(void) | |||
4439 | 3977 | ||
4440 | static int stli_findeisabrds(void) | 3978 | static int stli_findeisabrds(void) |
4441 | { | 3979 | { |
4442 | stlibrd_t *brdp; | 3980 | stlibrd_t *brdp; |
4443 | unsigned int iobase, eid; | 3981 | unsigned int iobase, eid; |
4444 | int i; | 3982 | int i; |
4445 | |||
4446 | #ifdef DEBUG | ||
4447 | printk(KERN_DEBUG "stli_findeisabrds()\n"); | ||
4448 | #endif | ||
4449 | 3983 | ||
4450 | /* | 3984 | /* |
4451 | * Firstly check if this is an EISA system. Do this by probing for | 3985 | * 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! | 3986 | * don't bother going any further! |
4454 | */ | 3987 | */ |
4455 | outb(0xff, 0xc80); | 3988 | if (EISA_bus) |
4456 | if (inb(0xc80) == 0xff) | 3989 | return 0; |
4457 | return(0); | ||
4458 | 3990 | ||
4459 | /* | 3991 | /* |
4460 | * Looks like an EISA system, so go searching for EISA boards. | 3992 | * Looks like an EISA system, so go searching for EISA boards. |
@@ -4472,7 +4004,7 @@ static int stli_findeisabrds(void) | |||
4472 | */ | 4004 | */ |
4473 | for (i = 0; (i < STL_MAXBRDS); i++) { | 4005 | for (i = 0; (i < STL_MAXBRDS); i++) { |
4474 | brdp = stli_brds[i]; | 4006 | brdp = stli_brds[i]; |
4475 | if (brdp == (stlibrd_t *) NULL) | 4007 | if (brdp == NULL) |
4476 | continue; | 4008 | continue; |
4477 | if (brdp->iobase == iobase) | 4009 | if (brdp->iobase == iobase) |
4478 | break; | 4010 | break; |
@@ -4484,10 +4016,10 @@ static int stli_findeisabrds(void) | |||
4484 | * We have found a Stallion board and it is not configured already. | 4016 | * We have found a Stallion board and it is not configured already. |
4485 | * Allocate a board structure and initialize it. | 4017 | * Allocate a board structure and initialize it. |
4486 | */ | 4018 | */ |
4487 | if ((brdp = stli_allocbrd()) == (stlibrd_t *) NULL) | 4019 | if ((brdp = stli_allocbrd()) == NULL) |
4488 | return(-ENOMEM); | 4020 | return -ENOMEM; |
4489 | if ((brdp->brdnr = stli_getbrdnr()) < 0) | 4021 | if ((brdp->brdnr = stli_getbrdnr()) < 0) |
4490 | return(-ENOMEM); | 4022 | return -ENOMEM; |
4491 | eid = inb(iobase + 0xc82); | 4023 | eid = inb(iobase + 0xc82); |
4492 | if (eid == ECP_EISAID) | 4024 | if (eid == ECP_EISAID) |
4493 | brdp->brdtype = BRD_ECPE; | 4025 | brdp->brdtype = BRD_ECPE; |
@@ -4502,7 +4034,7 @@ static int stli_findeisabrds(void) | |||
4502 | stli_brdinit(brdp); | 4034 | stli_brdinit(brdp); |
4503 | } | 4035 | } |
4504 | 4036 | ||
4505 | return(0); | 4037 | return 0; |
4506 | } | 4038 | } |
4507 | 4039 | ||
4508 | /*****************************************************************************/ | 4040 | /*****************************************************************************/ |
@@ -4523,32 +4055,18 @@ static int stli_findeisabrds(void) | |||
4523 | 4055 | ||
4524 | static int stli_initpcibrd(int brdtype, struct pci_dev *devp) | 4056 | static int stli_initpcibrd(int brdtype, struct pci_dev *devp) |
4525 | { | 4057 | { |
4526 | stlibrd_t *brdp; | 4058 | 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 | 4059 | ||
4533 | if (pci_enable_device(devp)) | 4060 | if (pci_enable_device(devp)) |
4534 | return(-EIO); | 4061 | return -EIO; |
4535 | if ((brdp = stli_allocbrd()) == (stlibrd_t *) NULL) | 4062 | if ((brdp = stli_allocbrd()) == NULL) |
4536 | return(-ENOMEM); | 4063 | return -ENOMEM; |
4537 | if ((brdp->brdnr = stli_getbrdnr()) < 0) { | 4064 | if ((brdp->brdnr = stli_getbrdnr()) < 0) { |
4538 | printk(KERN_INFO "STALLION: too many boards found, " | 4065 | printk(KERN_INFO "STALLION: too many boards found, " |
4539 | "maximum supported %d\n", STL_MAXBRDS); | 4066 | "maximum supported %d\n", STL_MAXBRDS); |
4540 | return(0); | 4067 | return 0; |
4541 | } | 4068 | } |
4542 | brdp->brdtype = brdtype; | 4069 | 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 | /* | 4070 | /* |
4553 | * We have all resources from the board, so lets setup the actual | 4071 | * We have all resources from the board, so lets setup the actual |
4554 | * board structure now. | 4072 | * board structure now. |
@@ -4557,7 +4075,7 @@ static int stli_initpcibrd(int brdtype, struct pci_dev *devp) | |||
4557 | brdp->memaddr = pci_resource_start(devp, 2); | 4075 | brdp->memaddr = pci_resource_start(devp, 2); |
4558 | stli_brdinit(brdp); | 4076 | stli_brdinit(brdp); |
4559 | 4077 | ||
4560 | return(0); | 4078 | return 0; |
4561 | } | 4079 | } |
4562 | 4080 | ||
4563 | /*****************************************************************************/ | 4081 | /*****************************************************************************/ |
@@ -4569,20 +4087,12 @@ static int stli_initpcibrd(int brdtype, struct pci_dev *devp) | |||
4569 | 4087 | ||
4570 | static int stli_findpcibrds(void) | 4088 | static int stli_findpcibrds(void) |
4571 | { | 4089 | { |
4572 | struct pci_dev *dev = NULL; | 4090 | struct pci_dev *dev = NULL; |
4573 | int rc; | ||
4574 | 4091 | ||
4575 | #ifdef DEBUG | 4092 | while ((dev = pci_get_device(PCI_VENDOR_ID_STALLION, PCI_DEVICE_ID_ECRA, dev))) { |
4576 | printk("stli_findpcibrds()\n"); | 4093 | 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 | } | 4094 | } |
4584 | 4095 | return 0; | |
4585 | return(0); | ||
4586 | } | 4096 | } |
4587 | 4097 | ||
4588 | #endif | 4098 | #endif |
@@ -4595,17 +4105,16 @@ static int stli_findpcibrds(void) | |||
4595 | 4105 | ||
4596 | static stlibrd_t *stli_allocbrd(void) | 4106 | static stlibrd_t *stli_allocbrd(void) |
4597 | { | 4107 | { |
4598 | stlibrd_t *brdp; | 4108 | stlibrd_t *brdp; |
4599 | 4109 | ||
4600 | brdp = kzalloc(sizeof(stlibrd_t), GFP_KERNEL); | 4110 | brdp = kzalloc(sizeof(stlibrd_t), GFP_KERNEL); |
4601 | if (!brdp) { | 4111 | if (!brdp) { |
4602 | printk(KERN_ERR "STALLION: failed to allocate memory " | 4112 | printk(KERN_ERR "STALLION: failed to allocate memory " |
4603 | "(size=%d)\n", sizeof(stlibrd_t)); | 4113 | "(size=%Zd)\n", sizeof(stlibrd_t)); |
4604 | return NULL; | 4114 | return NULL; |
4605 | } | 4115 | } |
4606 | |||
4607 | brdp->magic = STLI_BOARDMAGIC; | 4116 | brdp->magic = STLI_BOARDMAGIC; |
4608 | return(brdp); | 4117 | return brdp; |
4609 | } | 4118 | } |
4610 | 4119 | ||
4611 | /*****************************************************************************/ | 4120 | /*****************************************************************************/ |
@@ -4617,13 +4126,9 @@ static stlibrd_t *stli_allocbrd(void) | |||
4617 | 4126 | ||
4618 | static int stli_initbrds(void) | 4127 | static int stli_initbrds(void) |
4619 | { | 4128 | { |
4620 | stlibrd_t *brdp, *nxtbrdp; | 4129 | stlibrd_t *brdp, *nxtbrdp; |
4621 | stlconf_t *confp; | 4130 | stlconf_t *confp; |
4622 | int i, j; | 4131 | int i, j; |
4623 | |||
4624 | #ifdef DEBUG | ||
4625 | printk(KERN_DEBUG "stli_initbrds()\n"); | ||
4626 | #endif | ||
4627 | 4132 | ||
4628 | if (stli_nrbrds > STL_MAXBRDS) { | 4133 | if (stli_nrbrds > STL_MAXBRDS) { |
4629 | printk(KERN_INFO "STALLION: too many boards in configuration " | 4134 | printk(KERN_INFO "STALLION: too many boards in configuration " |
@@ -4638,11 +4143,9 @@ static int stli_initbrds(void) | |||
4638 | */ | 4143 | */ |
4639 | for (i = 0; (i < stli_nrbrds); i++) { | 4144 | for (i = 0; (i < stli_nrbrds); i++) { |
4640 | confp = &stli_brdconf[i]; | 4145 | confp = &stli_brdconf[i]; |
4641 | #ifdef MODULE | ||
4642 | stli_parsebrd(confp, stli_brdsp[i]); | 4146 | stli_parsebrd(confp, stli_brdsp[i]); |
4643 | #endif | 4147 | if ((brdp = stli_allocbrd()) == NULL) |
4644 | if ((brdp = stli_allocbrd()) == (stlibrd_t *) NULL) | 4148 | return -ENOMEM; |
4645 | return(-ENOMEM); | ||
4646 | brdp->brdnr = i; | 4149 | brdp->brdnr = i; |
4647 | brdp->brdtype = confp->brdtype; | 4150 | brdp->brdtype = confp->brdtype; |
4648 | brdp->iobase = confp->ioaddr1; | 4151 | brdp->iobase = confp->ioaddr1; |
@@ -4654,9 +4157,7 @@ static int stli_initbrds(void) | |||
4654 | * Static configuration table done, so now use dynamic methods to | 4157 | * Static configuration table done, so now use dynamic methods to |
4655 | * see if any more boards should be configured. | 4158 | * see if any more boards should be configured. |
4656 | */ | 4159 | */ |
4657 | #ifdef MODULE | ||
4658 | stli_argbrds(); | 4160 | stli_argbrds(); |
4659 | #endif | ||
4660 | if (STLI_EISAPROBE) | 4161 | if (STLI_EISAPROBE) |
4661 | stli_findeisabrds(); | 4162 | stli_findeisabrds(); |
4662 | #ifdef CONFIG_PCI | 4163 | #ifdef CONFIG_PCI |
@@ -4672,11 +4173,11 @@ static int stli_initbrds(void) | |||
4672 | if (stli_nrbrds > 1) { | 4173 | if (stli_nrbrds > 1) { |
4673 | for (i = 0; (i < stli_nrbrds); i++) { | 4174 | for (i = 0; (i < stli_nrbrds); i++) { |
4674 | brdp = stli_brds[i]; | 4175 | brdp = stli_brds[i]; |
4675 | if (brdp == (stlibrd_t *) NULL) | 4176 | if (brdp == NULL) |
4676 | continue; | 4177 | continue; |
4677 | for (j = i + 1; (j < stli_nrbrds); j++) { | 4178 | for (j = i + 1; (j < stli_nrbrds); j++) { |
4678 | nxtbrdp = stli_brds[j]; | 4179 | nxtbrdp = stli_brds[j]; |
4679 | if (nxtbrdp == (stlibrd_t *) NULL) | 4180 | if (nxtbrdp == NULL) |
4680 | continue; | 4181 | continue; |
4681 | if ((brdp->membase >= nxtbrdp->membase) && | 4182 | if ((brdp->membase >= nxtbrdp->membase) && |
4682 | (brdp->membase <= (nxtbrdp->membase + | 4183 | (brdp->membase <= (nxtbrdp->membase + |
@@ -4691,7 +4192,7 @@ static int stli_initbrds(void) | |||
4691 | if (stli_shared == 0) { | 4192 | if (stli_shared == 0) { |
4692 | for (i = 0; (i < stli_nrbrds); i++) { | 4193 | for (i = 0; (i < stli_nrbrds); i++) { |
4693 | brdp = stli_brds[i]; | 4194 | brdp = stli_brds[i]; |
4694 | if (brdp == (stlibrd_t *) NULL) | 4195 | if (brdp == NULL) |
4695 | continue; | 4196 | continue; |
4696 | if (brdp->state & BST_FOUND) { | 4197 | if (brdp->state & BST_FOUND) { |
4697 | EBRDENABLE(brdp); | 4198 | EBRDENABLE(brdp); |
@@ -4701,7 +4202,7 @@ static int stli_initbrds(void) | |||
4701 | } | 4202 | } |
4702 | } | 4203 | } |
4703 | 4204 | ||
4704 | return(0); | 4205 | return 0; |
4705 | } | 4206 | } |
4706 | 4207 | ||
4707 | /*****************************************************************************/ | 4208 | /*****************************************************************************/ |
@@ -4714,48 +4215,55 @@ static int stli_initbrds(void) | |||
4714 | 4215 | ||
4715 | static ssize_t stli_memread(struct file *fp, char __user *buf, size_t count, loff_t *offp) | 4216 | static ssize_t stli_memread(struct file *fp, char __user *buf, size_t count, loff_t *offp) |
4716 | { | 4217 | { |
4717 | unsigned long flags; | 4218 | unsigned long flags; |
4718 | void *memptr; | 4219 | void *memptr; |
4719 | stlibrd_t *brdp; | 4220 | stlibrd_t *brdp; |
4720 | int brdnr, size, n; | 4221 | int brdnr, size, n; |
4721 | 4222 | void *p; | |
4722 | #ifdef DEBUG | 4223 | 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 | 4224 | ||
4727 | brdnr = iminor(fp->f_dentry->d_inode); | 4225 | brdnr = iminor(fp->f_dentry->d_inode); |
4728 | if (brdnr >= stli_nrbrds) | 4226 | if (brdnr >= stli_nrbrds) |
4729 | return(-ENODEV); | 4227 | return -ENODEV; |
4730 | brdp = stli_brds[brdnr]; | 4228 | brdp = stli_brds[brdnr]; |
4731 | if (brdp == (stlibrd_t *) NULL) | 4229 | if (brdp == NULL) |
4732 | return(-ENODEV); | 4230 | return -ENODEV; |
4733 | if (brdp->state == 0) | 4231 | if (brdp->state == 0) |
4734 | return(-ENODEV); | 4232 | return -ENODEV; |
4735 | if (fp->f_pos >= brdp->memsize) | 4233 | if (off >= brdp->memsize || off + count < off) |
4736 | return(0); | 4234 | return 0; |
4737 | 4235 | ||
4738 | size = MIN(count, (brdp->memsize - fp->f_pos)); | 4236 | size = MIN(count, (brdp->memsize - off)); |
4237 | |||
4238 | /* | ||
4239 | * Copy the data a page at a time | ||
4240 | */ | ||
4241 | |||
4242 | p = (void *)__get_free_page(GFP_KERNEL); | ||
4243 | if(p == NULL) | ||
4244 | return -ENOMEM; | ||
4739 | 4245 | ||
4740 | save_flags(flags); | ||
4741 | cli(); | ||
4742 | EBRDENABLE(brdp); | ||
4743 | while (size > 0) { | 4246 | while (size > 0) { |
4744 | memptr = (void *) EBRDGETMEMPTR(brdp, fp->f_pos); | 4247 | spin_lock_irqsave(&brd_lock, flags); |
4745 | n = MIN(size, (brdp->pagesize - (((unsigned long) fp->f_pos) % brdp->pagesize))); | 4248 | EBRDENABLE(brdp); |
4746 | if (copy_to_user(buf, memptr, n)) { | 4249 | memptr = (void *) EBRDGETMEMPTR(brdp, off); |
4250 | n = MIN(size, (brdp->pagesize - (((unsigned long) off) % brdp->pagesize))); | ||
4251 | n = MIN(n, PAGE_SIZE); | ||
4252 | memcpy_fromio(p, memptr, n); | ||
4253 | EBRDDISABLE(brdp); | ||
4254 | spin_unlock_irqrestore(&brd_lock, flags); | ||
4255 | if (copy_to_user(buf, p, n)) { | ||
4747 | count = -EFAULT; | 4256 | count = -EFAULT; |
4748 | goto out; | 4257 | goto out; |
4749 | } | 4258 | } |
4750 | fp->f_pos += n; | 4259 | off += n; |
4751 | buf += n; | 4260 | buf += n; |
4752 | size -= n; | 4261 | size -= n; |
4753 | } | 4262 | } |
4754 | out: | 4263 | out: |
4755 | EBRDDISABLE(brdp); | 4264 | *offp = off; |
4756 | restore_flags(flags); | 4265 | free_page((unsigned long)p); |
4757 | 4266 | return count; | |
4758 | return(count); | ||
4759 | } | 4267 | } |
4760 | 4268 | ||
4761 | /*****************************************************************************/ | 4269 | /*****************************************************************************/ |
@@ -4764,54 +4272,65 @@ out: | |||
4764 | * Code to handle an "staliomem" write operation. This device is the | 4272 | * Code to handle an "staliomem" write operation. This device is the |
4765 | * contents of the board shared memory. It is used for down loading | 4273 | * contents of the board shared memory. It is used for down loading |
4766 | * the slave image (and debugging :-) | 4274 | * the slave image (and debugging :-) |
4275 | * | ||
4276 | * FIXME: copy under lock | ||
4767 | */ | 4277 | */ |
4768 | 4278 | ||
4769 | static ssize_t stli_memwrite(struct file *fp, const char __user *buf, size_t count, loff_t *offp) | 4279 | static ssize_t stli_memwrite(struct file *fp, const char __user *buf, size_t count, loff_t *offp) |
4770 | { | 4280 | { |
4771 | unsigned long flags; | 4281 | unsigned long flags; |
4772 | void *memptr; | 4282 | void *memptr; |
4773 | stlibrd_t *brdp; | 4283 | stlibrd_t *brdp; |
4774 | char __user *chbuf; | 4284 | char __user *chbuf; |
4775 | int brdnr, size, n; | 4285 | int brdnr, size, n; |
4776 | 4286 | void *p; | |
4777 | #ifdef DEBUG | 4287 | 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 | 4288 | ||
4782 | brdnr = iminor(fp->f_dentry->d_inode); | 4289 | brdnr = iminor(fp->f_dentry->d_inode); |
4290 | |||
4783 | if (brdnr >= stli_nrbrds) | 4291 | if (brdnr >= stli_nrbrds) |
4784 | return(-ENODEV); | 4292 | return -ENODEV; |
4785 | brdp = stli_brds[brdnr]; | 4293 | brdp = stli_brds[brdnr]; |
4786 | if (brdp == (stlibrd_t *) NULL) | 4294 | if (brdp == NULL) |
4787 | return(-ENODEV); | 4295 | return -ENODEV; |
4788 | if (brdp->state == 0) | 4296 | if (brdp->state == 0) |
4789 | return(-ENODEV); | 4297 | return -ENODEV; |
4790 | if (fp->f_pos >= brdp->memsize) | 4298 | if (off >= brdp->memsize || off + count < off) |
4791 | return(0); | 4299 | return 0; |
4792 | 4300 | ||
4793 | chbuf = (char __user *) buf; | 4301 | chbuf = (char __user *) buf; |
4794 | size = MIN(count, (brdp->memsize - fp->f_pos)); | 4302 | size = MIN(count, (brdp->memsize - off)); |
4303 | |||
4304 | /* | ||
4305 | * Copy the data a page at a time | ||
4306 | */ | ||
4307 | |||
4308 | p = (void *)__get_free_page(GFP_KERNEL); | ||
4309 | if(p == NULL) | ||
4310 | return -ENOMEM; | ||
4795 | 4311 | ||
4796 | save_flags(flags); | ||
4797 | cli(); | ||
4798 | EBRDENABLE(brdp); | ||
4799 | while (size > 0) { | 4312 | while (size > 0) { |
4800 | memptr = (void *) EBRDGETMEMPTR(brdp, fp->f_pos); | 4313 | n = MIN(size, (brdp->pagesize - (((unsigned long) off) % brdp->pagesize))); |
4801 | n = MIN(size, (brdp->pagesize - (((unsigned long) fp->f_pos) % brdp->pagesize))); | 4314 | n = MIN(n, PAGE_SIZE); |
4802 | if (copy_from_user(memptr, chbuf, n)) { | 4315 | if (copy_from_user(p, chbuf, n)) { |
4803 | count = -EFAULT; | 4316 | if (count == 0) |
4317 | count = -EFAULT; | ||
4804 | goto out; | 4318 | goto out; |
4805 | } | 4319 | } |
4806 | fp->f_pos += n; | 4320 | spin_lock_irqsave(&brd_lock, flags); |
4321 | EBRDENABLE(brdp); | ||
4322 | memptr = (void *) EBRDGETMEMPTR(brdp, off); | ||
4323 | memcpy_toio(memptr, p, n); | ||
4324 | EBRDDISABLE(brdp); | ||
4325 | spin_unlock_irqrestore(&brd_lock, flags); | ||
4326 | off += n; | ||
4807 | chbuf += n; | 4327 | chbuf += n; |
4808 | size -= n; | 4328 | size -= n; |
4809 | } | 4329 | } |
4810 | out: | 4330 | out: |
4811 | EBRDDISABLE(brdp); | 4331 | free_page((unsigned long) p); |
4812 | restore_flags(flags); | 4332 | *offp = off; |
4813 | 4333 | return count; | |
4814 | return(count); | ||
4815 | } | 4334 | } |
4816 | 4335 | ||
4817 | /*****************************************************************************/ | 4336 | /*****************************************************************************/ |
@@ -4822,16 +4341,16 @@ out: | |||
4822 | 4341 | ||
4823 | static int stli_getbrdstats(combrd_t __user *bp) | 4342 | static int stli_getbrdstats(combrd_t __user *bp) |
4824 | { | 4343 | { |
4825 | stlibrd_t *brdp; | 4344 | stlibrd_t *brdp; |
4826 | int i; | 4345 | int i; |
4827 | 4346 | ||
4828 | if (copy_from_user(&stli_brdstats, bp, sizeof(combrd_t))) | 4347 | if (copy_from_user(&stli_brdstats, bp, sizeof(combrd_t))) |
4829 | return -EFAULT; | 4348 | return -EFAULT; |
4830 | if (stli_brdstats.brd >= STL_MAXBRDS) | 4349 | if (stli_brdstats.brd >= STL_MAXBRDS) |
4831 | return(-ENODEV); | 4350 | return -ENODEV; |
4832 | brdp = stli_brds[stli_brdstats.brd]; | 4351 | brdp = stli_brds[stli_brdstats.brd]; |
4833 | if (brdp == (stlibrd_t *) NULL) | 4352 | if (brdp == NULL) |
4834 | return(-ENODEV); | 4353 | return -ENODEV; |
4835 | 4354 | ||
4836 | memset(&stli_brdstats, 0, sizeof(combrd_t)); | 4355 | memset(&stli_brdstats, 0, sizeof(combrd_t)); |
4837 | stli_brdstats.brd = brdp->brdnr; | 4356 | stli_brdstats.brd = brdp->brdnr; |
@@ -4850,7 +4369,7 @@ static int stli_getbrdstats(combrd_t __user *bp) | |||
4850 | 4369 | ||
4851 | if (copy_to_user(bp, &stli_brdstats, sizeof(combrd_t))) | 4370 | if (copy_to_user(bp, &stli_brdstats, sizeof(combrd_t))) |
4852 | return -EFAULT; | 4371 | return -EFAULT; |
4853 | return(0); | 4372 | return 0; |
4854 | } | 4373 | } |
4855 | 4374 | ||
4856 | /*****************************************************************************/ | 4375 | /*****************************************************************************/ |
@@ -4861,19 +4380,19 @@ static int stli_getbrdstats(combrd_t __user *bp) | |||
4861 | 4380 | ||
4862 | static stliport_t *stli_getport(int brdnr, int panelnr, int portnr) | 4381 | static stliport_t *stli_getport(int brdnr, int panelnr, int portnr) |
4863 | { | 4382 | { |
4864 | stlibrd_t *brdp; | 4383 | stlibrd_t *brdp; |
4865 | int i; | 4384 | int i; |
4866 | 4385 | ||
4867 | if ((brdnr < 0) || (brdnr >= STL_MAXBRDS)) | 4386 | if (brdnr < 0 || brdnr >= STL_MAXBRDS) |
4868 | return((stliport_t *) NULL); | 4387 | return NULL; |
4869 | brdp = stli_brds[brdnr]; | 4388 | brdp = stli_brds[brdnr]; |
4870 | if (brdp == (stlibrd_t *) NULL) | 4389 | if (brdp == NULL) |
4871 | return((stliport_t *) NULL); | 4390 | return NULL; |
4872 | for (i = 0; (i < panelnr); i++) | 4391 | for (i = 0; (i < panelnr); i++) |
4873 | portnr += brdp->panels[i]; | 4392 | portnr += brdp->panels[i]; |
4874 | if ((portnr < 0) || (portnr >= brdp->nrports)) | 4393 | if ((portnr < 0) || (portnr >= brdp->nrports)) |
4875 | return((stliport_t *) NULL); | 4394 | return NULL; |
4876 | return(brdp->ports[portnr]); | 4395 | return brdp->ports[portnr]; |
4877 | } | 4396 | } |
4878 | 4397 | ||
4879 | /*****************************************************************************/ | 4398 | /*****************************************************************************/ |
@@ -4892,16 +4411,16 @@ static int stli_portcmdstats(stliport_t *portp) | |||
4892 | 4411 | ||
4893 | memset(&stli_comstats, 0, sizeof(comstats_t)); | 4412 | memset(&stli_comstats, 0, sizeof(comstats_t)); |
4894 | 4413 | ||
4895 | if (portp == (stliport_t *) NULL) | 4414 | if (portp == NULL) |
4896 | return(-ENODEV); | 4415 | return -ENODEV; |
4897 | brdp = stli_brds[portp->brdnr]; | 4416 | brdp = stli_brds[portp->brdnr]; |
4898 | if (brdp == (stlibrd_t *) NULL) | 4417 | if (brdp == NULL) |
4899 | return(-ENODEV); | 4418 | return -ENODEV; |
4900 | 4419 | ||
4901 | if (brdp->state & BST_STARTED) { | 4420 | if (brdp->state & BST_STARTED) { |
4902 | if ((rc = stli_cmdwait(brdp, portp, A_GETSTATS, | 4421 | if ((rc = stli_cmdwait(brdp, portp, A_GETSTATS, |
4903 | &stli_cdkstats, sizeof(asystats_t), 1)) < 0) | 4422 | &stli_cdkstats, sizeof(asystats_t), 1)) < 0) |
4904 | return(rc); | 4423 | return rc; |
4905 | } else { | 4424 | } else { |
4906 | memset(&stli_cdkstats, 0, sizeof(asystats_t)); | 4425 | memset(&stli_cdkstats, 0, sizeof(asystats_t)); |
4907 | } | 4426 | } |
@@ -4912,13 +4431,12 @@ static int stli_portcmdstats(stliport_t *portp) | |||
4912 | stli_comstats.state = portp->state; | 4431 | stli_comstats.state = portp->state; |
4913 | stli_comstats.flags = portp->flags; | 4432 | stli_comstats.flags = portp->flags; |
4914 | 4433 | ||
4915 | save_flags(flags); | 4434 | spin_lock_irqsave(&brd_lock, flags); |
4916 | cli(); | 4435 | if (portp->tty != NULL) { |
4917 | if (portp->tty != (struct tty_struct *) NULL) { | ||
4918 | if (portp->tty->driver_data == portp) { | 4436 | if (portp->tty->driver_data == portp) { |
4919 | stli_comstats.ttystate = portp->tty->flags; | 4437 | stli_comstats.ttystate = portp->tty->flags; |
4920 | stli_comstats.rxbuffered = -1 /*portp->tty->flip.count*/; | 4438 | stli_comstats.rxbuffered = -1; |
4921 | if (portp->tty->termios != (struct termios *) NULL) { | 4439 | if (portp->tty->termios != NULL) { |
4922 | stli_comstats.cflags = portp->tty->termios->c_cflag; | 4440 | stli_comstats.cflags = portp->tty->termios->c_cflag; |
4923 | stli_comstats.iflags = portp->tty->termios->c_iflag; | 4441 | stli_comstats.iflags = portp->tty->termios->c_iflag; |
4924 | stli_comstats.oflags = portp->tty->termios->c_oflag; | 4442 | stli_comstats.oflags = portp->tty->termios->c_oflag; |
@@ -4926,7 +4444,7 @@ static int stli_portcmdstats(stliport_t *portp) | |||
4926 | } | 4444 | } |
4927 | } | 4445 | } |
4928 | } | 4446 | } |
4929 | restore_flags(flags); | 4447 | spin_unlock_irqrestore(&brd_lock, flags); |
4930 | 4448 | ||
4931 | stli_comstats.txtotal = stli_cdkstats.txchars; | 4449 | stli_comstats.txtotal = stli_cdkstats.txchars; |
4932 | stli_comstats.rxtotal = stli_cdkstats.rxchars + stli_cdkstats.ringover; | 4450 | stli_comstats.rxtotal = stli_cdkstats.rxchars + stli_cdkstats.ringover; |
@@ -4948,7 +4466,7 @@ static int stli_portcmdstats(stliport_t *portp) | |||
4948 | stli_comstats.hwid = stli_cdkstats.hwid; | 4466 | stli_comstats.hwid = stli_cdkstats.hwid; |
4949 | stli_comstats.signals = stli_mktiocm(stli_cdkstats.signals); | 4467 | stli_comstats.signals = stli_mktiocm(stli_cdkstats.signals); |
4950 | 4468 | ||
4951 | return(0); | 4469 | return 0; |
4952 | } | 4470 | } |
4953 | 4471 | ||
4954 | /*****************************************************************************/ | 4472 | /*****************************************************************************/ |
@@ -4961,8 +4479,8 @@ static int stli_portcmdstats(stliport_t *portp) | |||
4961 | 4479 | ||
4962 | static int stli_getportstats(stliport_t *portp, comstats_t __user *cp) | 4480 | static int stli_getportstats(stliport_t *portp, comstats_t __user *cp) |
4963 | { | 4481 | { |
4964 | stlibrd_t *brdp; | 4482 | stlibrd_t *brdp; |
4965 | int rc; | 4483 | int rc; |
4966 | 4484 | ||
4967 | if (!portp) { | 4485 | if (!portp) { |
4968 | if (copy_from_user(&stli_comstats, cp, sizeof(comstats_t))) | 4486 | if (copy_from_user(&stli_comstats, cp, sizeof(comstats_t))) |
@@ -4992,8 +4510,8 @@ static int stli_getportstats(stliport_t *portp, comstats_t __user *cp) | |||
4992 | 4510 | ||
4993 | static int stli_clrportstats(stliport_t *portp, comstats_t __user *cp) | 4511 | static int stli_clrportstats(stliport_t *portp, comstats_t __user *cp) |
4994 | { | 4512 | { |
4995 | stlibrd_t *brdp; | 4513 | stlibrd_t *brdp; |
4996 | int rc; | 4514 | int rc; |
4997 | 4515 | ||
4998 | if (!portp) { | 4516 | if (!portp) { |
4999 | if (copy_from_user(&stli_comstats, cp, sizeof(comstats_t))) | 4517 | if (copy_from_user(&stli_comstats, cp, sizeof(comstats_t))) |
@@ -5031,7 +4549,7 @@ static int stli_clrportstats(stliport_t *portp, comstats_t __user *cp) | |||
5031 | 4549 | ||
5032 | static int stli_getportstruct(stliport_t __user *arg) | 4550 | static int stli_getportstruct(stliport_t __user *arg) |
5033 | { | 4551 | { |
5034 | stliport_t *portp; | 4552 | stliport_t *portp; |
5035 | 4553 | ||
5036 | if (copy_from_user(&stli_dummyport, arg, sizeof(stliport_t))) | 4554 | if (copy_from_user(&stli_dummyport, arg, sizeof(stliport_t))) |
5037 | return -EFAULT; | 4555 | return -EFAULT; |
@@ -5052,7 +4570,7 @@ static int stli_getportstruct(stliport_t __user *arg) | |||
5052 | 4570 | ||
5053 | static int stli_getbrdstruct(stlibrd_t __user *arg) | 4571 | static int stli_getbrdstruct(stlibrd_t __user *arg) |
5054 | { | 4572 | { |
5055 | stlibrd_t *brdp; | 4573 | stlibrd_t *brdp; |
5056 | 4574 | ||
5057 | if (copy_from_user(&stli_dummybrd, arg, sizeof(stlibrd_t))) | 4575 | if (copy_from_user(&stli_dummybrd, arg, sizeof(stlibrd_t))) |
5058 | return -EFAULT; | 4576 | return -EFAULT; |
@@ -5076,15 +4594,10 @@ static int stli_getbrdstruct(stlibrd_t __user *arg) | |||
5076 | 4594 | ||
5077 | static int stli_memioctl(struct inode *ip, struct file *fp, unsigned int cmd, unsigned long arg) | 4595 | static int stli_memioctl(struct inode *ip, struct file *fp, unsigned int cmd, unsigned long arg) |
5078 | { | 4596 | { |
5079 | stlibrd_t *brdp; | 4597 | stlibrd_t *brdp; |
5080 | int brdnr, rc, done; | 4598 | int brdnr, rc, done; |
5081 | void __user *argp = (void __user *)arg; | 4599 | void __user *argp = (void __user *)arg; |
5082 | 4600 | ||
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 | /* | 4601 | /* |
5089 | * First up handle the board independent ioctls. | 4602 | * First up handle the board independent ioctls. |
5090 | */ | 4603 | */ |
@@ -5115,7 +4628,7 @@ static int stli_memioctl(struct inode *ip, struct file *fp, unsigned int cmd, un | |||
5115 | } | 4628 | } |
5116 | 4629 | ||
5117 | if (done) | 4630 | if (done) |
5118 | return(rc); | 4631 | return rc; |
5119 | 4632 | ||
5120 | /* | 4633 | /* |
5121 | * Now handle the board specific ioctls. These all depend on the | 4634 | * Now handle the board specific ioctls. These all depend on the |
@@ -5123,12 +4636,12 @@ static int stli_memioctl(struct inode *ip, struct file *fp, unsigned int cmd, un | |||
5123 | */ | 4636 | */ |
5124 | brdnr = iminor(ip); | 4637 | brdnr = iminor(ip); |
5125 | if (brdnr >= STL_MAXBRDS) | 4638 | if (brdnr >= STL_MAXBRDS) |
5126 | return(-ENODEV); | 4639 | return -ENODEV; |
5127 | brdp = stli_brds[brdnr]; | 4640 | brdp = stli_brds[brdnr]; |
5128 | if (!brdp) | 4641 | if (!brdp) |
5129 | return(-ENODEV); | 4642 | return -ENODEV; |
5130 | if (brdp->state == 0) | 4643 | if (brdp->state == 0) |
5131 | return(-ENODEV); | 4644 | return -ENODEV; |
5132 | 4645 | ||
5133 | switch (cmd) { | 4646 | switch (cmd) { |
5134 | case STL_BINTR: | 4647 | case STL_BINTR: |
@@ -5152,8 +4665,7 @@ static int stli_memioctl(struct inode *ip, struct file *fp, unsigned int cmd, un | |||
5152 | rc = -ENOIOCTLCMD; | 4665 | rc = -ENOIOCTLCMD; |
5153 | break; | 4666 | break; |
5154 | } | 4667 | } |
5155 | 4668 | return rc; | |
5156 | return(rc); | ||
5157 | } | 4669 | } |
5158 | 4670 | ||
5159 | static struct tty_operations stli_ops = { | 4671 | static struct tty_operations stli_ops = { |
@@ -5187,6 +4699,9 @@ int __init stli_init(void) | |||
5187 | int i; | 4699 | int i; |
5188 | printk(KERN_INFO "%s: version %s\n", stli_drvtitle, stli_drvversion); | 4700 | printk(KERN_INFO "%s: version %s\n", stli_drvtitle, stli_drvversion); |
5189 | 4701 | ||
4702 | spin_lock_init(&stli_lock); | ||
4703 | spin_lock_init(&brd_lock); | ||
4704 | |||
5190 | stli_initbrds(); | 4705 | stli_initbrds(); |
5191 | 4706 | ||
5192 | stli_serial = alloc_tty_driver(STL_MAXBRDS * STL_MAXPORTS); | 4707 | stli_serial = alloc_tty_driver(STL_MAXBRDS * STL_MAXPORTS); |
@@ -5196,10 +4711,6 @@ int __init stli_init(void) | |||
5196 | /* | 4711 | /* |
5197 | * Allocate a temporary write buffer. | 4712 | * Allocate a temporary write buffer. |
5198 | */ | 4713 | */ |
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); | 4714 | stli_txcookbuf = kmalloc(STLI_TXBUFSIZE, GFP_KERNEL); |
5204 | if (!stli_txcookbuf) | 4715 | if (!stli_txcookbuf) |
5205 | printk(KERN_ERR "STALLION: failed to allocate memory " | 4716 | printk(KERN_ERR "STALLION: failed to allocate memory " |
@@ -5213,16 +4724,11 @@ int __init stli_init(void) | |||
5213 | printk(KERN_ERR "STALLION: failed to register serial memory " | 4724 | printk(KERN_ERR "STALLION: failed to register serial memory " |
5214 | "device\n"); | 4725 | "device\n"); |
5215 | 4726 | ||
5216 | devfs_mk_dir("staliomem"); | ||
5217 | istallion_class = class_create(THIS_MODULE, "staliomem"); | 4727 | istallion_class = class_create(THIS_MODULE, "staliomem"); |
5218 | for (i = 0; i < 4; i++) { | 4728 | 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, | 4729 | class_device_create(istallion_class, NULL, |
5223 | MKDEV(STL_SIOMEMMAJOR, i), | 4730 | MKDEV(STL_SIOMEMMAJOR, i), |
5224 | NULL, "staliomem%d", i); | 4731 | NULL, "staliomem%d", i); |
5225 | } | ||
5226 | 4732 | ||
5227 | /* | 4733 | /* |
5228 | * Set up the tty driver structure and register us as a driver. | 4734 | * Set up the tty driver structure and register us as a driver. |
@@ -5243,7 +4749,7 @@ int __init stli_init(void) | |||
5243 | printk(KERN_ERR "STALLION: failed to register serial driver\n"); | 4749 | printk(KERN_ERR "STALLION: failed to register serial driver\n"); |
5244 | return -EBUSY; | 4750 | return -EBUSY; |
5245 | } | 4751 | } |
5246 | return(0); | 4752 | return 0; |
5247 | } | 4753 | } |
5248 | 4754 | ||
5249 | /*****************************************************************************/ | 4755 | /*****************************************************************************/ |
diff --git a/drivers/char/lp.c b/drivers/char/lp.c index e57260525293..b11a390581ba 100644 --- a/drivers/char/lp.c +++ b/drivers/char/lp.c | |||
@@ -120,7 +120,6 @@ | |||
120 | #include <linux/major.h> | 120 | #include <linux/major.h> |
121 | #include <linux/sched.h> | 121 | #include <linux/sched.h> |
122 | #include <linux/smp_lock.h> | 122 | #include <linux/smp_lock.h> |
123 | #include <linux/devfs_fs_kernel.h> | ||
124 | #include <linux/slab.h> | 123 | #include <linux/slab.h> |
125 | #include <linux/fcntl.h> | 124 | #include <linux/fcntl.h> |
126 | #include <linux/delay.h> | 125 | #include <linux/delay.h> |
@@ -807,8 +806,6 @@ static int lp_register(int nr, struct parport *port) | |||
807 | 806 | ||
808 | class_device_create(lp_class, NULL, MKDEV(LP_MAJOR, nr), NULL, | 807 | class_device_create(lp_class, NULL, MKDEV(LP_MAJOR, nr), NULL, |
809 | "lp%d", nr); | 808 | "lp%d", nr); |
810 | devfs_mk_cdev(MKDEV(LP_MAJOR, nr), S_IFCHR | S_IRUGO | S_IWUGO, | ||
811 | "printers/%d", nr); | ||
812 | 809 | ||
813 | printk(KERN_INFO "lp%d: using %s (%s).\n", nr, port->name, | 810 | printk(KERN_INFO "lp%d: using %s (%s).\n", nr, port->name, |
814 | (port->irq == PARPORT_IRQ_NONE)?"polling":"interrupt-driven"); | 811 | (port->irq == PARPORT_IRQ_NONE)?"polling":"interrupt-driven"); |
@@ -907,7 +904,6 @@ static int __init lp_init (void) | |||
907 | return -EIO; | 904 | return -EIO; |
908 | } | 905 | } |
909 | 906 | ||
910 | devfs_mk_dir("printers"); | ||
911 | lp_class = class_create(THIS_MODULE, "printer"); | 907 | lp_class = class_create(THIS_MODULE, "printer"); |
912 | if (IS_ERR(lp_class)) { | 908 | if (IS_ERR(lp_class)) { |
913 | err = PTR_ERR(lp_class); | 909 | err = PTR_ERR(lp_class); |
@@ -933,7 +929,6 @@ static int __init lp_init (void) | |||
933 | out_class: | 929 | out_class: |
934 | class_destroy(lp_class); | 930 | class_destroy(lp_class); |
935 | out_devfs: | 931 | out_devfs: |
936 | devfs_remove("printers"); | ||
937 | unregister_chrdev(LP_MAJOR, "lp"); | 932 | unregister_chrdev(LP_MAJOR, "lp"); |
938 | return err; | 933 | return err; |
939 | } | 934 | } |
@@ -981,10 +976,8 @@ static void lp_cleanup_module (void) | |||
981 | if (lp_table[offset].dev == NULL) | 976 | if (lp_table[offset].dev == NULL) |
982 | continue; | 977 | continue; |
983 | parport_unregister_device(lp_table[offset].dev); | 978 | parport_unregister_device(lp_table[offset].dev); |
984 | devfs_remove("printers/%d", offset); | ||
985 | class_device_destroy(lp_class, MKDEV(LP_MAJOR, offset)); | 979 | class_device_destroy(lp_class, MKDEV(LP_MAJOR, offset)); |
986 | } | 980 | } |
987 | devfs_remove("printers"); | ||
988 | class_destroy(lp_class); | 981 | class_destroy(lp_class); |
989 | } | 982 | } |
990 | 983 | ||
diff --git a/drivers/char/mem.c b/drivers/char/mem.c index 1fa9fa157c12..6fe7b6c6c462 100644 --- a/drivers/char/mem.c +++ b/drivers/char/mem.c | |||
@@ -20,7 +20,6 @@ | |||
20 | #include <linux/tty.h> | 20 | #include <linux/tty.h> |
21 | #include <linux/capability.h> | 21 | #include <linux/capability.h> |
22 | #include <linux/smp_lock.h> | 22 | #include <linux/smp_lock.h> |
23 | #include <linux/devfs_fs_kernel.h> | ||
24 | #include <linux/ptrace.h> | 23 | #include <linux/ptrace.h> |
25 | #include <linux/device.h> | 24 | #include <linux/device.h> |
26 | #include <linux/highmem.h> | 25 | #include <linux/highmem.h> |
@@ -941,13 +940,10 @@ static int __init chr_dev_init(void) | |||
941 | printk("unable to get major %d for memory devs\n", MEM_MAJOR); | 940 | printk("unable to get major %d for memory devs\n", MEM_MAJOR); |
942 | 941 | ||
943 | mem_class = class_create(THIS_MODULE, "mem"); | 942 | mem_class = class_create(THIS_MODULE, "mem"); |
944 | for (i = 0; i < ARRAY_SIZE(devlist); i++) { | 943 | for (i = 0; i < ARRAY_SIZE(devlist); i++) |
945 | class_device_create(mem_class, NULL, | 944 | class_device_create(mem_class, NULL, |
946 | MKDEV(MEM_MAJOR, devlist[i].minor), | 945 | MKDEV(MEM_MAJOR, devlist[i].minor), |
947 | NULL, devlist[i].name); | 946 | 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 | 947 | ||
952 | return 0; | 948 | return 0; |
953 | } | 949 | } |
diff --git a/drivers/char/misc.c b/drivers/char/misc.c index 96eb2a709e21..dfe1cede3916 100644 --- a/drivers/char/misc.c +++ b/drivers/char/misc.c | |||
@@ -44,7 +44,6 @@ | |||
44 | #include <linux/slab.h> | 44 | #include <linux/slab.h> |
45 | #include <linux/proc_fs.h> | 45 | #include <linux/proc_fs.h> |
46 | #include <linux/seq_file.h> | 46 | #include <linux/seq_file.h> |
47 | #include <linux/devfs_fs_kernel.h> | ||
48 | #include <linux/stat.h> | 47 | #include <linux/stat.h> |
49 | #include <linux/init.h> | 48 | #include <linux/init.h> |
50 | #include <linux/device.h> | 49 | #include <linux/device.h> |
@@ -204,7 +203,7 @@ int misc_register(struct miscdevice * misc) | |||
204 | { | 203 | { |
205 | struct miscdevice *c; | 204 | struct miscdevice *c; |
206 | dev_t dev; | 205 | dev_t dev; |
207 | int err; | 206 | int err = 0; |
208 | 207 | ||
209 | down(&misc_sem); | 208 | down(&misc_sem); |
210 | list_for_each_entry(c, &misc_list, list) { | 209 | list_for_each_entry(c, &misc_list, list) { |
@@ -228,10 +227,6 @@ int misc_register(struct miscdevice * misc) | |||
228 | 227 | ||
229 | if (misc->minor < DYNAMIC_MINORS) | 228 | if (misc->minor < DYNAMIC_MINORS) |
230 | misc_minors[misc->minor >> 3] |= 1 << (misc->minor & 7); | 229 | 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); | 230 | dev = MKDEV(MISC_MAJOR, misc->minor); |
236 | 231 | ||
237 | misc->class = class_device_create(misc_class, NULL, dev, misc->dev, | 232 | misc->class = class_device_create(misc_class, NULL, dev, misc->dev, |
@@ -241,13 +236,6 @@ int misc_register(struct miscdevice * misc) | |||
241 | goto out; | 236 | goto out; |
242 | } | 237 | } |
243 | 238 | ||
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 | /* | 239 | /* |
252 | * Add it to the front, so that later devices can "override" | 240 | * Add it to the front, so that later devices can "override" |
253 | * earlier defaults | 241 | * earlier defaults |
@@ -278,7 +266,6 @@ int misc_deregister(struct miscdevice * misc) | |||
278 | down(&misc_sem); | 266 | down(&misc_sem); |
279 | list_del(&misc->list); | 267 | list_del(&misc->list); |
280 | class_device_destroy(misc_class, MKDEV(MISC_MAJOR, misc->minor)); | 268 | class_device_destroy(misc_class, MKDEV(MISC_MAJOR, misc->minor)); |
281 | devfs_remove(misc->devfs_name); | ||
282 | if (i < DYNAMIC_MINORS && i>0) { | 269 | if (i < DYNAMIC_MINORS && i>0) { |
283 | misc_minors[i>>3] &= ~(1 << (misc->minor & 7)); | 270 | misc_minors[i>>3] &= ~(1 << (misc->minor & 7)); |
284 | } | 271 | } |
diff --git a/drivers/char/mmtimer.c b/drivers/char/mmtimer.c index d65b3109318a..95e8122b8068 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> |
@@ -694,7 +693,6 @@ static int __init mmtimer_init(void) | |||
694 | return -1; | 693 | return -1; |
695 | } | 694 | } |
696 | 695 | ||
697 | strcpy(mmtimer_miscdev.devfs_name, MMTIMER_NAME); | ||
698 | if (misc_register(&mmtimer_miscdev)) { | 696 | if (misc_register(&mmtimer_miscdev)) { |
699 | printk(KERN_ERR "%s: failed to register device\n", | 697 | printk(KERN_ERR "%s: failed to register device\n", |
700 | MMTIMER_NAME); | 698 | MMTIMER_NAME); |
diff --git a/drivers/char/moxa.c b/drivers/char/moxa.c index f43c2e04eadd..52ef61f54ba0 100644 --- a/drivers/char/moxa.c +++ b/drivers/char/moxa.c | |||
@@ -301,7 +301,7 @@ static struct tty_operations moxa_ops = { | |||
301 | .tiocmset = moxa_tiocmset, | 301 | .tiocmset = moxa_tiocmset, |
302 | }; | 302 | }; |
303 | 303 | ||
304 | static spinlock_t moxa_lock = SPIN_LOCK_UNLOCKED; | 304 | static DEFINE_SPINLOCK(moxa_lock); |
305 | 305 | ||
306 | #ifdef CONFIG_PCI | 306 | #ifdef CONFIG_PCI |
307 | static int moxa_get_PCI_conf(struct pci_dev *p, int board_type, moxa_board_conf * board) | 307 | static int moxa_get_PCI_conf(struct pci_dev *p, int board_type, moxa_board_conf * board) |
@@ -342,7 +342,6 @@ static int __init moxa_init(void) | |||
342 | init_MUTEX(&moxaBuffSem); | 342 | init_MUTEX(&moxaBuffSem); |
343 | moxaDriver->owner = THIS_MODULE; | 343 | moxaDriver->owner = THIS_MODULE; |
344 | moxaDriver->name = "ttyMX"; | 344 | moxaDriver->name = "ttyMX"; |
345 | moxaDriver->devfs_name = "tts/a"; | ||
346 | moxaDriver->major = ttymajor; | 345 | moxaDriver->major = ttymajor; |
347 | moxaDriver->minor_start = 0; | 346 | moxaDriver->minor_start = 0; |
348 | moxaDriver->type = TTY_DRIVER_TYPE_SERIAL; | 347 | moxaDriver->type = TTY_DRIVER_TYPE_SERIAL; |
diff --git a/drivers/char/mxser.c b/drivers/char/mxser.c index 645d9d713aec..72cfd09091e0 100644 --- a/drivers/char/mxser.c +++ b/drivers/char/mxser.c | |||
@@ -996,7 +996,6 @@ static int mxser_open(struct tty_struct *tty, struct file *filp) | |||
996 | 996 | ||
997 | info->session = current->signal->session; | 997 | info->session = current->signal->session; |
998 | info->pgrp = process_group(current); | 998 | info->pgrp = process_group(current); |
999 | clear_bit(TTY_DONT_FLIP, &tty->flags); | ||
1000 | 999 | ||
1001 | /* | 1000 | /* |
1002 | status = mxser_get_msr(info->base, 0, info->port); | 1001 | status = mxser_get_msr(info->base, 0, info->port); |
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/pc8736x_gpio.c b/drivers/char/pc8736x_gpio.c new file mode 100644 index 000000000000..1c706ccfdbb3 --- /dev/null +++ b/drivers/char/pc8736x_gpio.c | |||
@@ -0,0 +1,340 @@ | |||
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 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_put(pdev); | ||
323 | undo_platform_dev_alloc: | ||
324 | kfree(pdev); | ||
325 | return rc; | ||
326 | } | ||
327 | |||
328 | static void __exit pc8736x_gpio_cleanup(void) | ||
329 | { | ||
330 | dev_dbg(&pdev->dev, " cleanup\n"); | ||
331 | |||
332 | release_region(pc8736x_gpio_base, 16); | ||
333 | |||
334 | unregister_chrdev(major, DEVNAME); | ||
335 | } | ||
336 | |||
337 | EXPORT_SYMBOL(pc8736x_access); | ||
338 | |||
339 | module_init(pc8736x_gpio_init); | ||
340 | module_exit(pc8736x_gpio_cleanup); | ||
diff --git a/drivers/char/ppdev.c b/drivers/char/ppdev.c index bee6c47b45bd..24231d9743dc 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> |
@@ -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..9491e4307566 100644 --- a/drivers/char/pty.c +++ b/drivers/char/pty.c | |||
@@ -24,7 +24,6 @@ | |||
24 | #include <linux/major.h> | 24 | #include <linux/major.h> |
25 | #include <linux/mm.h> | 25 | #include <linux/mm.h> |
26 | #include <linux/init.h> | 26 | #include <linux/init.h> |
27 | #include <linux/devfs_fs_kernel.h> | ||
28 | #include <linux/sysctl.h> | 27 | #include <linux/sysctl.h> |
29 | 28 | ||
30 | #include <asm/uaccess.h> | 29 | #include <asm/uaccess.h> |
@@ -101,7 +100,7 @@ static void pty_unthrottle(struct tty_struct * tty) | |||
101 | * | 100 | * |
102 | * FIXME: Our pty_write method is called with our ldisc lock held but | 101 | * 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 | 102 | * 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 | 103 | * risking deadlocks. |
105 | */ | 104 | */ |
106 | static int pty_write(struct tty_struct * tty, const unsigned char *buf, int count) | 105 | static int pty_write(struct tty_struct * tty, const unsigned char *buf, int count) |
107 | { | 106 | { |
@@ -265,7 +264,6 @@ static void __init legacy_pty_init(void) | |||
265 | pty_driver->owner = THIS_MODULE; | 264 | pty_driver->owner = THIS_MODULE; |
266 | pty_driver->driver_name = "pty_master"; | 265 | pty_driver->driver_name = "pty_master"; |
267 | pty_driver->name = "pty"; | 266 | pty_driver->name = "pty"; |
268 | pty_driver->devfs_name = "pty/m"; | ||
269 | pty_driver->major = PTY_MASTER_MAJOR; | 267 | pty_driver->major = PTY_MASTER_MAJOR; |
270 | pty_driver->minor_start = 0; | 268 | pty_driver->minor_start = 0; |
271 | pty_driver->type = TTY_DRIVER_TYPE_PTY; | 269 | pty_driver->type = TTY_DRIVER_TYPE_PTY; |
@@ -283,7 +281,6 @@ static void __init legacy_pty_init(void) | |||
283 | pty_slave_driver->owner = THIS_MODULE; | 281 | pty_slave_driver->owner = THIS_MODULE; |
284 | pty_slave_driver->driver_name = "pty_slave"; | 282 | pty_slave_driver->driver_name = "pty_slave"; |
285 | pty_slave_driver->name = "ttyp"; | 283 | pty_slave_driver->name = "ttyp"; |
286 | pty_slave_driver->devfs_name = "pty/s"; | ||
287 | pty_slave_driver->major = PTY_SLAVE_MAJOR; | 284 | pty_slave_driver->major = PTY_SLAVE_MAJOR; |
288 | pty_slave_driver->minor_start = 0; | 285 | pty_slave_driver->minor_start = 0; |
289 | pty_slave_driver->type = TTY_DRIVER_TYPE_PTY; | 286 | pty_slave_driver->type = TTY_DRIVER_TYPE_PTY; |
@@ -351,7 +348,6 @@ static int pty_unix98_ioctl(struct tty_struct *tty, struct file *file, | |||
351 | 348 | ||
352 | static void __init unix98_pty_init(void) | 349 | static void __init unix98_pty_init(void) |
353 | { | 350 | { |
354 | devfs_mk_dir("pts"); | ||
355 | ptm_driver = alloc_tty_driver(NR_UNIX98_PTY_MAX); | 351 | ptm_driver = alloc_tty_driver(NR_UNIX98_PTY_MAX); |
356 | if (!ptm_driver) | 352 | if (!ptm_driver) |
357 | panic("Couldn't allocate Unix98 ptm driver"); | 353 | panic("Couldn't allocate Unix98 ptm driver"); |
@@ -372,7 +368,7 @@ static void __init unix98_pty_init(void) | |||
372 | ptm_driver->init_termios.c_cflag = B38400 | CS8 | CREAD; | 368 | ptm_driver->init_termios.c_cflag = B38400 | CS8 | CREAD; |
373 | ptm_driver->init_termios.c_lflag = 0; | 369 | ptm_driver->init_termios.c_lflag = 0; |
374 | ptm_driver->flags = TTY_DRIVER_RESET_TERMIOS | TTY_DRIVER_REAL_RAW | | 370 | ptm_driver->flags = TTY_DRIVER_RESET_TERMIOS | TTY_DRIVER_REAL_RAW | |
375 | TTY_DRIVER_NO_DEVFS | TTY_DRIVER_DEVPTS_MEM; | 371 | TTY_DRIVER_DYNAMIC_DEV | TTY_DRIVER_DEVPTS_MEM; |
376 | ptm_driver->other = pts_driver; | 372 | ptm_driver->other = pts_driver; |
377 | tty_set_operations(ptm_driver, &pty_ops); | 373 | tty_set_operations(ptm_driver, &pty_ops); |
378 | ptm_driver->ioctl = pty_unix98_ioctl; | 374 | ptm_driver->ioctl = pty_unix98_ioctl; |
@@ -387,7 +383,7 @@ static void __init unix98_pty_init(void) | |||
387 | pts_driver->init_termios = tty_std_termios; | 383 | pts_driver->init_termios = tty_std_termios; |
388 | pts_driver->init_termios.c_cflag = B38400 | CS8 | CREAD; | 384 | pts_driver->init_termios.c_cflag = B38400 | CS8 | CREAD; |
389 | pts_driver->flags = TTY_DRIVER_RESET_TERMIOS | TTY_DRIVER_REAL_RAW | | 385 | pts_driver->flags = TTY_DRIVER_RESET_TERMIOS | TTY_DRIVER_REAL_RAW | |
390 | TTY_DRIVER_NO_DEVFS | TTY_DRIVER_DEVPTS_MEM; | 386 | TTY_DRIVER_DYNAMIC_DEV | TTY_DRIVER_DEVPTS_MEM; |
391 | pts_driver->other = ptm_driver; | 387 | pts_driver->other = ptm_driver; |
392 | tty_set_operations(pts_driver, &pty_ops); | 388 | tty_set_operations(pts_driver, &pty_ops); |
393 | 389 | ||
diff --git a/drivers/char/raw.c b/drivers/char/raw.c index 15a7b4086524..9bf97c5e38c0 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> |
@@ -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/riscom8.c b/drivers/char/riscom8.c index 657c0d88f48c..c84c3c3f10c3 100644 --- a/drivers/char/riscom8.c +++ b/drivers/char/riscom8.c | |||
@@ -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 0708c5164c83..0ac131881322 100644 --- a/drivers/char/rocket.c +++ b/drivers/char/rocket.c | |||
@@ -2426,8 +2426,7 @@ static int __init rp_init(void) | |||
2426 | */ | 2426 | */ |
2427 | 2427 | ||
2428 | rocket_driver->owner = THIS_MODULE; | 2428 | rocket_driver->owner = THIS_MODULE; |
2429 | rocket_driver->flags = TTY_DRIVER_NO_DEVFS; | 2429 | rocket_driver->flags = TTY_DRIVER_DYNAMIC_DEV; |
2430 | rocket_driver->devfs_name = "tts/R"; | ||
2431 | rocket_driver->name = "ttyR"; | 2430 | rocket_driver->name = "ttyR"; |
2432 | rocket_driver->driver_name = "Comtrol RocketPort"; | 2431 | rocket_driver->driver_name = "Comtrol RocketPort"; |
2433 | rocket_driver->major = TTY_ROCKET_MAJOR; | 2432 | rocket_driver->major = TTY_ROCKET_MAJOR; |
@@ -2438,7 +2437,7 @@ static int __init rp_init(void) | |||
2438 | rocket_driver->init_termios.c_cflag = | 2437 | rocket_driver->init_termios.c_cflag = |
2439 | B9600 | CS8 | CREAD | HUPCL | CLOCAL; | 2438 | B9600 | CS8 | CREAD | HUPCL | CLOCAL; |
2440 | #ifdef ROCKET_SOFT_FLOW | 2439 | #ifdef ROCKET_SOFT_FLOW |
2441 | rocket_driver->flags |= TTY_DRIVER_REAL_RAW | TTY_DRIVER_NO_DEVFS; | 2440 | rocket_driver->flags |= TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV; |
2442 | #endif | 2441 | #endif |
2443 | tty_set_operations(rocket_driver, &rocket_ops); | 2442 | tty_set_operations(rocket_driver, &rocket_ops); |
2444 | 2443 | ||
diff --git a/drivers/char/scx200_gpio.c b/drivers/char/scx200_gpio.c index 664a6e97eb1a..5a280a330401 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); |
@@ -103,47 +65,81 @@ static int scx200_gpio_release(struct inode *inode, struct file *file) | |||
103 | 65 | ||
104 | static struct file_operations scx200_gpio_fops = { | 66 | static 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); | ||
127 | } | 104 | } |
128 | if (!major) { | 105 | if (rc < 0) { |
129 | major = r; | 106 | dev_err(&pdev->dev, "SCx200 chrdev_region err: %d\n", rc); |
130 | printk(KERN_DEBUG NAME ": got dynamic major %d\n", major); | 107 | goto undo_platform_device_add; |
108 | } | ||
109 | scx200_devices = kzalloc(num_pins * sizeof(struct cdev), GFP_KERNEL); | ||
110 | if (!scx200_devices) { | ||
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_put(pdev); | ||
130 | undo_malloc: | ||
131 | kfree(pdev); | ||
132 | return rc; | ||
134 | } | 133 | } |
135 | 134 | ||
136 | static void __exit scx200_gpio_cleanup(void) | 135 | static void __exit scx200_gpio_cleanup(void) |
137 | { | 136 | { |
138 | unregister_chrdev(major, NAME); | 137 | kfree(scx200_devices); |
138 | unregister_chrdev_region(MKDEV(major, 0), num_pins); | ||
139 | platform_device_put(pdev); | ||
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..c851eeaa4069 100644 --- a/drivers/char/serial167.c +++ b/drivers/char/serial167.c | |||
@@ -2235,7 +2235,6 @@ scrn[1] = '\0'; | |||
2235 | /* Initialize the tty_driver structure */ | 2235 | /* Initialize the tty_driver structure */ |
2236 | 2236 | ||
2237 | cy_serial_driver->owner = THIS_MODULE; | 2237 | cy_serial_driver->owner = THIS_MODULE; |
2238 | cy_serial_driver->devfs_name = "tts/"; | ||
2239 | cy_serial_driver->name = "ttyS"; | 2238 | cy_serial_driver->name = "ttyS"; |
2240 | cy_serial_driver->major = TTY_MAJOR; | 2239 | cy_serial_driver->major = TTY_MAJOR; |
2241 | cy_serial_driver->minor_start = 64; | 2240 | cy_serial_driver->minor_start = 64; |
diff --git a/drivers/char/specialix.c b/drivers/char/specialix.c index 1b5330299e30..d2d6b01dcd05 100644 --- a/drivers/char/specialix.c +++ b/drivers/char/specialix.c | |||
@@ -2477,7 +2477,7 @@ static int __init specialix_init(void) | |||
2477 | #endif | 2477 | #endif |
2478 | 2478 | ||
2479 | for (i = 0; i < SX_NBOARD; i++) | 2479 | for (i = 0; i < SX_NBOARD; i++) |
2480 | sx_board[i].lock = SPIN_LOCK_UNLOCKED; | 2480 | spin_lock_init(&sx_board[i].lock); |
2481 | 2481 | ||
2482 | if (sx_init_drivers()) { | 2482 | if (sx_init_drivers()) { |
2483 | func_exit(); | 2483 | func_exit(); |
diff --git a/drivers/char/stallion.c b/drivers/char/stallion.c index a9c5a7230f89..0f7a542d9041 100644 --- a/drivers/char/stallion.c +++ b/drivers/char/stallion.c | |||
@@ -40,7 +40,6 @@ | |||
40 | #include <linux/ioport.h> | 40 | #include <linux/ioport.h> |
41 | #include <linux/init.h> | 41 | #include <linux/init.h> |
42 | #include <linux/smp_lock.h> | 42 | #include <linux/smp_lock.h> |
43 | #include <linux/devfs_fs_kernel.h> | ||
44 | #include <linux/device.h> | 43 | #include <linux/device.h> |
45 | #include <linux/delay.h> | 44 | #include <linux/delay.h> |
46 | 45 | ||
@@ -141,15 +140,6 @@ static char *stl_drvversion = "5.6.0"; | |||
141 | static struct tty_driver *stl_serial; | 140 | static struct tty_driver *stl_serial; |
142 | 141 | ||
143 | /* | 142 | /* |
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 | 143 | * Define a local default termios struct. All ports will be created |
154 | * with this termios initially. Basically all it defines is a raw port | 144 | * with this termios initially. Basically all it defines is a raw port |
155 | * at 9600, 8 data bits, 1 stop bit. | 145 | * at 9600, 8 data bits, 1 stop bit. |
@@ -363,6 +353,14 @@ static unsigned char stl_vecmap[] = { | |||
363 | }; | 353 | }; |
364 | 354 | ||
365 | /* | 355 | /* |
356 | * Lock ordering is that you may not take stallion_lock holding | ||
357 | * brd_lock. | ||
358 | */ | ||
359 | |||
360 | static spinlock_t brd_lock; /* Guard the board mapping */ | ||
361 | static spinlock_t stallion_lock; /* Guard the tty driver */ | ||
362 | |||
363 | /* | ||
366 | * Set up enable and disable macros for the ECH boards. They require | 364 | * Set up enable and disable macros for the ECH boards. They require |
367 | * the secondary io address space to be activated and deactivated. | 365 | * the secondary io address space to be activated and deactivated. |
368 | * This way all ECH boards can share their secondary io region. | 366 | * This way all ECH boards can share their secondary io region. |
@@ -725,17 +723,7 @@ static struct class *stallion_class; | |||
725 | 723 | ||
726 | static int __init stallion_module_init(void) | 724 | static int __init stallion_module_init(void) |
727 | { | 725 | { |
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(); | 726 | stl_init(); |
737 | restore_flags(flags); | ||
738 | |||
739 | return 0; | 727 | return 0; |
740 | } | 728 | } |
741 | 729 | ||
@@ -746,7 +734,6 @@ static void __exit stallion_module_exit(void) | |||
746 | stlbrd_t *brdp; | 734 | stlbrd_t *brdp; |
747 | stlpanel_t *panelp; | 735 | stlpanel_t *panelp; |
748 | stlport_t *portp; | 736 | stlport_t *portp; |
749 | unsigned long flags; | ||
750 | int i, j, k; | 737 | int i, j, k; |
751 | 738 | ||
752 | #ifdef DEBUG | 739 | #ifdef DEBUG |
@@ -756,9 +743,6 @@ static void __exit stallion_module_exit(void) | |||
756 | printk(KERN_INFO "Unloading %s: version %s\n", stl_drvtitle, | 743 | printk(KERN_INFO "Unloading %s: version %s\n", stl_drvtitle, |
757 | stl_drvversion); | 744 | stl_drvversion); |
758 | 745 | ||
759 | save_flags(flags); | ||
760 | cli(); | ||
761 | |||
762 | /* | 746 | /* |
763 | * Free up all allocated resources used by the ports. This includes | 747 | * Free up all allocated resources used by the ports. This includes |
764 | * memory and interrupts. As part of this process we will also do | 748 | * memory and interrupts. As part of this process we will also do |
@@ -770,21 +754,15 @@ static void __exit stallion_module_exit(void) | |||
770 | if (i) { | 754 | if (i) { |
771 | printk("STALLION: failed to un-register tty driver, " | 755 | printk("STALLION: failed to un-register tty driver, " |
772 | "errno=%d\n", -i); | 756 | "errno=%d\n", -i); |
773 | restore_flags(flags); | ||
774 | return; | 757 | return; |
775 | } | 758 | } |
776 | for (i = 0; i < 4; i++) { | 759 | for (i = 0; i < 4; i++) |
777 | devfs_remove("staliomem/%d", i); | ||
778 | class_device_destroy(stallion_class, MKDEV(STL_SIOMEMMAJOR, i)); | 760 | class_device_destroy(stallion_class, MKDEV(STL_SIOMEMMAJOR, i)); |
779 | } | ||
780 | devfs_remove("staliomem"); | ||
781 | if ((i = unregister_chrdev(STL_SIOMEMMAJOR, "staliomem"))) | 761 | if ((i = unregister_chrdev(STL_SIOMEMMAJOR, "staliomem"))) |
782 | printk("STALLION: failed to un-register serial memory device, " | 762 | printk("STALLION: failed to un-register serial memory device, " |
783 | "errno=%d\n", -i); | 763 | "errno=%d\n", -i); |
784 | class_destroy(stallion_class); | 764 | class_destroy(stallion_class); |
785 | 765 | ||
786 | kfree(stl_tmpwritebuf); | ||
787 | |||
788 | for (i = 0; (i < stl_nrbrds); i++) { | 766 | for (i = 0; (i < stl_nrbrds); i++) { |
789 | if ((brdp = stl_brds[i]) == (stlbrd_t *) NULL) | 767 | if ((brdp = stl_brds[i]) == (stlbrd_t *) NULL) |
790 | continue; | 768 | continue; |
@@ -814,8 +792,6 @@ static void __exit stallion_module_exit(void) | |||
814 | kfree(brdp); | 792 | kfree(brdp); |
815 | stl_brds[i] = (stlbrd_t *) NULL; | 793 | stl_brds[i] = (stlbrd_t *) NULL; |
816 | } | 794 | } |
817 | |||
818 | restore_flags(flags); | ||
819 | } | 795 | } |
820 | 796 | ||
821 | module_init(stallion_module_init); | 797 | module_init(stallion_module_init); |
@@ -948,7 +924,7 @@ static stlbrd_t *stl_allocbrd(void) | |||
948 | 924 | ||
949 | brdp = kzalloc(sizeof(stlbrd_t), GFP_KERNEL); | 925 | brdp = kzalloc(sizeof(stlbrd_t), GFP_KERNEL); |
950 | if (!brdp) { | 926 | if (!brdp) { |
951 | printk("STALLION: failed to allocate memory (size=%d)\n", | 927 | printk("STALLION: failed to allocate memory (size=%Zd)\n", |
952 | sizeof(stlbrd_t)); | 928 | sizeof(stlbrd_t)); |
953 | return NULL; | 929 | return NULL; |
954 | } | 930 | } |
@@ -1066,16 +1042,17 @@ static int stl_waitcarrier(stlport_t *portp, struct file *filp) | |||
1066 | rc = 0; | 1042 | rc = 0; |
1067 | doclocal = 0; | 1043 | doclocal = 0; |
1068 | 1044 | ||
1045 | spin_lock_irqsave(&stallion_lock, flags); | ||
1046 | |||
1069 | if (portp->tty->termios->c_cflag & CLOCAL) | 1047 | if (portp->tty->termios->c_cflag & CLOCAL) |
1070 | doclocal++; | 1048 | doclocal++; |
1071 | 1049 | ||
1072 | save_flags(flags); | ||
1073 | cli(); | ||
1074 | portp->openwaitcnt++; | 1050 | portp->openwaitcnt++; |
1075 | if (! tty_hung_up_p(filp)) | 1051 | if (! tty_hung_up_p(filp)) |
1076 | portp->refcount--; | 1052 | portp->refcount--; |
1077 | 1053 | ||
1078 | for (;;) { | 1054 | for (;;) { |
1055 | /* Takes brd_lock internally */ | ||
1079 | stl_setsignals(portp, 1, 1); | 1056 | stl_setsignals(portp, 1, 1); |
1080 | if (tty_hung_up_p(filp) || | 1057 | if (tty_hung_up_p(filp) || |
1081 | ((portp->flags & ASYNC_INITIALIZED) == 0)) { | 1058 | ((portp->flags & ASYNC_INITIALIZED) == 0)) { |
@@ -1093,13 +1070,14 @@ static int stl_waitcarrier(stlport_t *portp, struct file *filp) | |||
1093 | rc = -ERESTARTSYS; | 1070 | rc = -ERESTARTSYS; |
1094 | break; | 1071 | break; |
1095 | } | 1072 | } |
1073 | /* FIXME */ | ||
1096 | interruptible_sleep_on(&portp->open_wait); | 1074 | interruptible_sleep_on(&portp->open_wait); |
1097 | } | 1075 | } |
1098 | 1076 | ||
1099 | if (! tty_hung_up_p(filp)) | 1077 | if (! tty_hung_up_p(filp)) |
1100 | portp->refcount++; | 1078 | portp->refcount++; |
1101 | portp->openwaitcnt--; | 1079 | portp->openwaitcnt--; |
1102 | restore_flags(flags); | 1080 | spin_unlock_irqrestore(&stallion_lock, flags); |
1103 | 1081 | ||
1104 | return rc; | 1082 | return rc; |
1105 | } | 1083 | } |
@@ -1119,16 +1097,15 @@ static void stl_close(struct tty_struct *tty, struct file *filp) | |||
1119 | if (portp == (stlport_t *) NULL) | 1097 | if (portp == (stlport_t *) NULL) |
1120 | return; | 1098 | return; |
1121 | 1099 | ||
1122 | save_flags(flags); | 1100 | spin_lock_irqsave(&stallion_lock, flags); |
1123 | cli(); | ||
1124 | if (tty_hung_up_p(filp)) { | 1101 | if (tty_hung_up_p(filp)) { |
1125 | restore_flags(flags); | 1102 | spin_unlock_irqrestore(&stallion_lock, flags); |
1126 | return; | 1103 | return; |
1127 | } | 1104 | } |
1128 | if ((tty->count == 1) && (portp->refcount != 1)) | 1105 | if ((tty->count == 1) && (portp->refcount != 1)) |
1129 | portp->refcount = 1; | 1106 | portp->refcount = 1; |
1130 | if (portp->refcount-- > 1) { | 1107 | if (portp->refcount-- > 1) { |
1131 | restore_flags(flags); | 1108 | spin_unlock_irqrestore(&stallion_lock, flags); |
1132 | return; | 1109 | return; |
1133 | } | 1110 | } |
1134 | 1111 | ||
@@ -1142,11 +1119,18 @@ static void stl_close(struct tty_struct *tty, struct file *filp) | |||
1142 | * (The sc26198 has no "end-of-data" interrupt only empty FIFO) | 1119 | * (The sc26198 has no "end-of-data" interrupt only empty FIFO) |
1143 | */ | 1120 | */ |
1144 | tty->closing = 1; | 1121 | tty->closing = 1; |
1122 | |||
1123 | spin_unlock_irqrestore(&stallion_lock, flags); | ||
1124 | |||
1145 | if (portp->closing_wait != ASYNC_CLOSING_WAIT_NONE) | 1125 | if (portp->closing_wait != ASYNC_CLOSING_WAIT_NONE) |
1146 | tty_wait_until_sent(tty, portp->closing_wait); | 1126 | tty_wait_until_sent(tty, portp->closing_wait); |
1147 | stl_waituntilsent(tty, (HZ / 2)); | 1127 | stl_waituntilsent(tty, (HZ / 2)); |
1148 | 1128 | ||
1129 | |||
1130 | spin_lock_irqsave(&stallion_lock, flags); | ||
1149 | portp->flags &= ~ASYNC_INITIALIZED; | 1131 | portp->flags &= ~ASYNC_INITIALIZED; |
1132 | spin_unlock_irqrestore(&stallion_lock, flags); | ||
1133 | |||
1150 | stl_disableintrs(portp); | 1134 | stl_disableintrs(portp); |
1151 | if (tty->termios->c_cflag & HUPCL) | 1135 | if (tty->termios->c_cflag & HUPCL) |
1152 | stl_setsignals(portp, 0, 0); | 1136 | stl_setsignals(portp, 0, 0); |
@@ -1173,7 +1157,6 @@ static void stl_close(struct tty_struct *tty, struct file *filp) | |||
1173 | 1157 | ||
1174 | portp->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING); | 1158 | portp->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING); |
1175 | wake_up_interruptible(&portp->close_wait); | 1159 | wake_up_interruptible(&portp->close_wait); |
1176 | restore_flags(flags); | ||
1177 | } | 1160 | } |
1178 | 1161 | ||
1179 | /*****************************************************************************/ | 1162 | /*****************************************************************************/ |
@@ -1195,9 +1178,6 @@ static int stl_write(struct tty_struct *tty, const unsigned char *buf, int count | |||
1195 | (int) tty, (int) buf, count); | 1178 | (int) tty, (int) buf, count); |
1196 | #endif | 1179 | #endif |
1197 | 1180 | ||
1198 | if ((tty == (struct tty_struct *) NULL) || | ||
1199 | (stl_tmpwritebuf == (char *) NULL)) | ||
1200 | return 0; | ||
1201 | portp = tty->driver_data; | 1181 | portp = tty->driver_data; |
1202 | if (portp == (stlport_t *) NULL) | 1182 | if (portp == (stlport_t *) NULL) |
1203 | return 0; | 1183 | return 0; |
@@ -1302,11 +1282,6 @@ static void stl_flushchars(struct tty_struct *tty) | |||
1302 | if (portp->tx.buf == (char *) NULL) | 1282 | if (portp->tx.buf == (char *) NULL) |
1303 | return; | 1283 | return; |
1304 | 1284 | ||
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); | 1285 | stl_startrxtx(portp, -1, 1); |
1311 | } | 1286 | } |
1312 | 1287 | ||
@@ -1977,12 +1952,14 @@ static int stl_eiointr(stlbrd_t *brdp) | |||
1977 | unsigned int iobase; | 1952 | unsigned int iobase; |
1978 | int handled = 0; | 1953 | int handled = 0; |
1979 | 1954 | ||
1955 | spin_lock(&brd_lock); | ||
1980 | panelp = brdp->panels[0]; | 1956 | panelp = brdp->panels[0]; |
1981 | iobase = panelp->iobase; | 1957 | iobase = panelp->iobase; |
1982 | while (inb(brdp->iostatus) & EIO_INTRPEND) { | 1958 | while (inb(brdp->iostatus) & EIO_INTRPEND) { |
1983 | handled = 1; | 1959 | handled = 1; |
1984 | (* panelp->isr)(panelp, iobase); | 1960 | (* panelp->isr)(panelp, iobase); |
1985 | } | 1961 | } |
1962 | spin_unlock(&brd_lock); | ||
1986 | return handled; | 1963 | return handled; |
1987 | } | 1964 | } |
1988 | 1965 | ||
@@ -2168,7 +2145,7 @@ static int __init stl_initports(stlbrd_t *brdp, stlpanel_t *panelp) | |||
2168 | portp = kzalloc(sizeof(stlport_t), GFP_KERNEL); | 2145 | portp = kzalloc(sizeof(stlport_t), GFP_KERNEL); |
2169 | if (!portp) { | 2146 | if (!portp) { |
2170 | printk("STALLION: failed to allocate memory " | 2147 | printk("STALLION: failed to allocate memory " |
2171 | "(size=%d)\n", sizeof(stlport_t)); | 2148 | "(size=%Zd)\n", sizeof(stlport_t)); |
2172 | break; | 2149 | break; |
2173 | } | 2150 | } |
2174 | 2151 | ||
@@ -2304,7 +2281,7 @@ static inline int stl_initeio(stlbrd_t *brdp) | |||
2304 | panelp = kzalloc(sizeof(stlpanel_t), GFP_KERNEL); | 2281 | panelp = kzalloc(sizeof(stlpanel_t), GFP_KERNEL); |
2305 | if (!panelp) { | 2282 | if (!panelp) { |
2306 | printk(KERN_WARNING "STALLION: failed to allocate memory " | 2283 | printk(KERN_WARNING "STALLION: failed to allocate memory " |
2307 | "(size=%d)\n", sizeof(stlpanel_t)); | 2284 | "(size=%Zd)\n", sizeof(stlpanel_t)); |
2308 | return -ENOMEM; | 2285 | return -ENOMEM; |
2309 | } | 2286 | } |
2310 | 2287 | ||
@@ -2478,7 +2455,7 @@ static inline int stl_initech(stlbrd_t *brdp) | |||
2478 | panelp = kzalloc(sizeof(stlpanel_t), GFP_KERNEL); | 2455 | panelp = kzalloc(sizeof(stlpanel_t), GFP_KERNEL); |
2479 | if (!panelp) { | 2456 | if (!panelp) { |
2480 | printk("STALLION: failed to allocate memory " | 2457 | printk("STALLION: failed to allocate memory " |
2481 | "(size=%d)\n", sizeof(stlpanel_t)); | 2458 | "(size=%Zd)\n", sizeof(stlpanel_t)); |
2482 | break; | 2459 | break; |
2483 | } | 2460 | } |
2484 | panelp->magic = STL_PANELMAGIC; | 2461 | panelp->magic = STL_PANELMAGIC; |
@@ -2879,8 +2856,7 @@ static int stl_getportstats(stlport_t *portp, comstats_t __user *cp) | |||
2879 | portp->stats.lflags = 0; | 2856 | portp->stats.lflags = 0; |
2880 | portp->stats.rxbuffered = 0; | 2857 | portp->stats.rxbuffered = 0; |
2881 | 2858 | ||
2882 | save_flags(flags); | 2859 | spin_lock_irqsave(&stallion_lock, flags); |
2883 | cli(); | ||
2884 | if (portp->tty != (struct tty_struct *) NULL) { | 2860 | if (portp->tty != (struct tty_struct *) NULL) { |
2885 | if (portp->tty->driver_data == portp) { | 2861 | if (portp->tty->driver_data == portp) { |
2886 | portp->stats.ttystate = portp->tty->flags; | 2862 | portp->stats.ttystate = portp->tty->flags; |
@@ -2894,7 +2870,7 @@ static int stl_getportstats(stlport_t *portp, comstats_t __user *cp) | |||
2894 | } | 2870 | } |
2895 | } | 2871 | } |
2896 | } | 2872 | } |
2897 | restore_flags(flags); | 2873 | spin_unlock_irqrestore(&stallion_lock, flags); |
2898 | 2874 | ||
2899 | head = portp->tx.head; | 2875 | head = portp->tx.head; |
2900 | tail = portp->tx.tail; | 2876 | tail = portp->tx.tail; |
@@ -3049,6 +3025,9 @@ static int __init stl_init(void) | |||
3049 | int i; | 3025 | int i; |
3050 | printk(KERN_INFO "%s: version %s\n", stl_drvtitle, stl_drvversion); | 3026 | printk(KERN_INFO "%s: version %s\n", stl_drvtitle, stl_drvversion); |
3051 | 3027 | ||
3028 | spin_lock_init(&stallion_lock); | ||
3029 | spin_lock_init(&brd_lock); | ||
3030 | |||
3052 | stl_initbrds(); | 3031 | stl_initbrds(); |
3053 | 3032 | ||
3054 | stl_serial = alloc_tty_driver(STL_MAXBRDS * STL_MAXPORTS); | 3033 | stl_serial = alloc_tty_driver(STL_MAXBRDS * STL_MAXPORTS); |
@@ -3056,35 +3035,21 @@ static int __init stl_init(void) | |||
3056 | return -1; | 3035 | return -1; |
3057 | 3036 | ||
3058 | /* | 3037 | /* |
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 | 3038 | * Set up a character driver for per board stuff. This is mainly used |
3068 | * to do stats ioctls on the ports. | 3039 | * to do stats ioctls on the ports. |
3069 | */ | 3040 | */ |
3070 | if (register_chrdev(STL_SIOMEMMAJOR, "staliomem", &stl_fsiomem)) | 3041 | if (register_chrdev(STL_SIOMEMMAJOR, "staliomem", &stl_fsiomem)) |
3071 | printk("STALLION: failed to register serial board device\n"); | 3042 | printk("STALLION: failed to register serial board device\n"); |
3072 | devfs_mk_dir("staliomem"); | ||
3073 | 3043 | ||
3074 | stallion_class = class_create(THIS_MODULE, "staliomem"); | 3044 | stallion_class = class_create(THIS_MODULE, "staliomem"); |
3075 | for (i = 0; i < 4; i++) { | 3045 | 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, | 3046 | class_device_create(stallion_class, NULL, |
3080 | MKDEV(STL_SIOMEMMAJOR, i), NULL, | 3047 | MKDEV(STL_SIOMEMMAJOR, i), NULL, |
3081 | "staliomem%d", i); | 3048 | "staliomem%d", i); |
3082 | } | ||
3083 | 3049 | ||
3084 | stl_serial->owner = THIS_MODULE; | 3050 | stl_serial->owner = THIS_MODULE; |
3085 | stl_serial->driver_name = stl_drvname; | 3051 | stl_serial->driver_name = stl_drvname; |
3086 | stl_serial->name = "ttyE"; | 3052 | stl_serial->name = "ttyE"; |
3087 | stl_serial->devfs_name = "tts/E"; | ||
3088 | stl_serial->major = STL_SERIALMAJOR; | 3053 | stl_serial->major = STL_SERIALMAJOR; |
3089 | stl_serial->minor_start = 0; | 3054 | stl_serial->minor_start = 0; |
3090 | stl_serial->type = TTY_DRIVER_TYPE_SERIAL; | 3055 | stl_serial->type = TTY_DRIVER_TYPE_SERIAL; |
@@ -3147,11 +3112,13 @@ static int stl_cd1400panelinit(stlbrd_t *brdp, stlpanel_t *panelp) | |||
3147 | unsigned int gfrcr; | 3112 | unsigned int gfrcr; |
3148 | int chipmask, i, j; | 3113 | int chipmask, i, j; |
3149 | int nrchips, uartaddr, ioaddr; | 3114 | int nrchips, uartaddr, ioaddr; |
3115 | unsigned long flags; | ||
3150 | 3116 | ||
3151 | #ifdef DEBUG | 3117 | #ifdef DEBUG |
3152 | printk("stl_panelinit(brdp=%x,panelp=%x)\n", (int) brdp, (int) panelp); | 3118 | printk("stl_panelinit(brdp=%x,panelp=%x)\n", (int) brdp, (int) panelp); |
3153 | #endif | 3119 | #endif |
3154 | 3120 | ||
3121 | spin_lock_irqsave(&brd_lock, flags); | ||
3155 | BRDENABLE(panelp->brdnr, panelp->pagenr); | 3122 | BRDENABLE(panelp->brdnr, panelp->pagenr); |
3156 | 3123 | ||
3157 | /* | 3124 | /* |
@@ -3189,6 +3156,7 @@ static int stl_cd1400panelinit(stlbrd_t *brdp, stlpanel_t *panelp) | |||
3189 | } | 3156 | } |
3190 | 3157 | ||
3191 | BRDDISABLE(panelp->brdnr); | 3158 | BRDDISABLE(panelp->brdnr); |
3159 | spin_unlock_irqrestore(&brd_lock, flags); | ||
3192 | return chipmask; | 3160 | return chipmask; |
3193 | } | 3161 | } |
3194 | 3162 | ||
@@ -3200,6 +3168,7 @@ static int stl_cd1400panelinit(stlbrd_t *brdp, stlpanel_t *panelp) | |||
3200 | 3168 | ||
3201 | static void stl_cd1400portinit(stlbrd_t *brdp, stlpanel_t *panelp, stlport_t *portp) | 3169 | static void stl_cd1400portinit(stlbrd_t *brdp, stlpanel_t *panelp, stlport_t *portp) |
3202 | { | 3170 | { |
3171 | unsigned long flags; | ||
3203 | #ifdef DEBUG | 3172 | #ifdef DEBUG |
3204 | printk("stl_cd1400portinit(brdp=%x,panelp=%x,portp=%x)\n", | 3173 | printk("stl_cd1400portinit(brdp=%x,panelp=%x,portp=%x)\n", |
3205 | (int) brdp, (int) panelp, (int) portp); | 3174 | (int) brdp, (int) panelp, (int) portp); |
@@ -3209,6 +3178,7 @@ static void stl_cd1400portinit(stlbrd_t *brdp, stlpanel_t *panelp, stlport_t *po | |||
3209 | (portp == (stlport_t *) NULL)) | 3178 | (portp == (stlport_t *) NULL)) |
3210 | return; | 3179 | return; |
3211 | 3180 | ||
3181 | spin_lock_irqsave(&brd_lock, flags); | ||
3212 | portp->ioaddr = panelp->iobase + (((brdp->brdtype == BRD_ECHPCI) || | 3182 | portp->ioaddr = panelp->iobase + (((brdp->brdtype == BRD_ECHPCI) || |
3213 | (portp->portnr < 8)) ? 0 : EREG_BANKSIZE); | 3183 | (portp->portnr < 8)) ? 0 : EREG_BANKSIZE); |
3214 | portp->uartaddr = (portp->portnr & 0x04) << 5; | 3184 | portp->uartaddr = (portp->portnr & 0x04) << 5; |
@@ -3219,6 +3189,7 @@ static void stl_cd1400portinit(stlbrd_t *brdp, stlpanel_t *panelp, stlport_t *po | |||
3219 | stl_cd1400setreg(portp, LIVR, (portp->portnr << 3)); | 3189 | stl_cd1400setreg(portp, LIVR, (portp->portnr << 3)); |
3220 | portp->hwid = stl_cd1400getreg(portp, GFRCR); | 3190 | portp->hwid = stl_cd1400getreg(portp, GFRCR); |
3221 | BRDDISABLE(portp->brdnr); | 3191 | BRDDISABLE(portp->brdnr); |
3192 | spin_unlock_irqrestore(&brd_lock, flags); | ||
3222 | } | 3193 | } |
3223 | 3194 | ||
3224 | /*****************************************************************************/ | 3195 | /*****************************************************************************/ |
@@ -3428,8 +3399,7 @@ static void stl_cd1400setport(stlport_t *portp, struct termios *tiosp) | |||
3428 | tiosp->c_cc[VSTART], tiosp->c_cc[VSTOP]); | 3399 | tiosp->c_cc[VSTART], tiosp->c_cc[VSTOP]); |
3429 | #endif | 3400 | #endif |
3430 | 3401 | ||
3431 | save_flags(flags); | 3402 | spin_lock_irqsave(&brd_lock, flags); |
3432 | cli(); | ||
3433 | BRDENABLE(portp->brdnr, portp->pagenr); | 3403 | BRDENABLE(portp->brdnr, portp->pagenr); |
3434 | stl_cd1400setreg(portp, CAR, (portp->portnr & 0x3)); | 3404 | stl_cd1400setreg(portp, CAR, (portp->portnr & 0x3)); |
3435 | srer = stl_cd1400getreg(portp, SRER); | 3405 | srer = stl_cd1400getreg(portp, SRER); |
@@ -3466,7 +3436,7 @@ static void stl_cd1400setport(stlport_t *portp, struct termios *tiosp) | |||
3466 | portp->sigs &= ~TIOCM_CD; | 3436 | portp->sigs &= ~TIOCM_CD; |
3467 | stl_cd1400setreg(portp, SRER, ((srer & ~sreroff) | sreron)); | 3437 | stl_cd1400setreg(portp, SRER, ((srer & ~sreroff) | sreron)); |
3468 | BRDDISABLE(portp->brdnr); | 3438 | BRDDISABLE(portp->brdnr); |
3469 | restore_flags(flags); | 3439 | spin_unlock_irqrestore(&brd_lock, flags); |
3470 | } | 3440 | } |
3471 | 3441 | ||
3472 | /*****************************************************************************/ | 3442 | /*****************************************************************************/ |
@@ -3492,8 +3462,7 @@ static void stl_cd1400setsignals(stlport_t *portp, int dtr, int rts) | |||
3492 | if (rts > 0) | 3462 | if (rts > 0) |
3493 | msvr2 = MSVR2_RTS; | 3463 | msvr2 = MSVR2_RTS; |
3494 | 3464 | ||
3495 | save_flags(flags); | 3465 | spin_lock_irqsave(&brd_lock, flags); |
3496 | cli(); | ||
3497 | BRDENABLE(portp->brdnr, portp->pagenr); | 3466 | BRDENABLE(portp->brdnr, portp->pagenr); |
3498 | stl_cd1400setreg(portp, CAR, (portp->portnr & 0x03)); | 3467 | stl_cd1400setreg(portp, CAR, (portp->portnr & 0x03)); |
3499 | if (rts >= 0) | 3468 | if (rts >= 0) |
@@ -3501,7 +3470,7 @@ static void stl_cd1400setsignals(stlport_t *portp, int dtr, int rts) | |||
3501 | if (dtr >= 0) | 3470 | if (dtr >= 0) |
3502 | stl_cd1400setreg(portp, MSVR1, msvr1); | 3471 | stl_cd1400setreg(portp, MSVR1, msvr1); |
3503 | BRDDISABLE(portp->brdnr); | 3472 | BRDDISABLE(portp->brdnr); |
3504 | restore_flags(flags); | 3473 | spin_unlock_irqrestore(&brd_lock, flags); |
3505 | } | 3474 | } |
3506 | 3475 | ||
3507 | /*****************************************************************************/ | 3476 | /*****************************************************************************/ |
@@ -3520,14 +3489,13 @@ static int stl_cd1400getsignals(stlport_t *portp) | |||
3520 | printk("stl_cd1400getsignals(portp=%x)\n", (int) portp); | 3489 | printk("stl_cd1400getsignals(portp=%x)\n", (int) portp); |
3521 | #endif | 3490 | #endif |
3522 | 3491 | ||
3523 | save_flags(flags); | 3492 | spin_lock_irqsave(&brd_lock, flags); |
3524 | cli(); | ||
3525 | BRDENABLE(portp->brdnr, portp->pagenr); | 3493 | BRDENABLE(portp->brdnr, portp->pagenr); |
3526 | stl_cd1400setreg(portp, CAR, (portp->portnr & 0x03)); | 3494 | stl_cd1400setreg(portp, CAR, (portp->portnr & 0x03)); |
3527 | msvr1 = stl_cd1400getreg(portp, MSVR1); | 3495 | msvr1 = stl_cd1400getreg(portp, MSVR1); |
3528 | msvr2 = stl_cd1400getreg(portp, MSVR2); | 3496 | msvr2 = stl_cd1400getreg(portp, MSVR2); |
3529 | BRDDISABLE(portp->brdnr); | 3497 | BRDDISABLE(portp->brdnr); |
3530 | restore_flags(flags); | 3498 | spin_unlock_irqrestore(&brd_lock, flags); |
3531 | 3499 | ||
3532 | sigs = 0; | 3500 | sigs = 0; |
3533 | sigs |= (msvr1 & MSVR1_DCD) ? TIOCM_CD : 0; | 3501 | sigs |= (msvr1 & MSVR1_DCD) ? TIOCM_CD : 0; |
@@ -3569,15 +3537,14 @@ static void stl_cd1400enablerxtx(stlport_t *portp, int rx, int tx) | |||
3569 | else if (rx > 0) | 3537 | else if (rx > 0) |
3570 | ccr |= CCR_RXENABLE; | 3538 | ccr |= CCR_RXENABLE; |
3571 | 3539 | ||
3572 | save_flags(flags); | 3540 | spin_lock_irqsave(&brd_lock, flags); |
3573 | cli(); | ||
3574 | BRDENABLE(portp->brdnr, portp->pagenr); | 3541 | BRDENABLE(portp->brdnr, portp->pagenr); |
3575 | stl_cd1400setreg(portp, CAR, (portp->portnr & 0x03)); | 3542 | stl_cd1400setreg(portp, CAR, (portp->portnr & 0x03)); |
3576 | stl_cd1400ccrwait(portp); | 3543 | stl_cd1400ccrwait(portp); |
3577 | stl_cd1400setreg(portp, CCR, ccr); | 3544 | stl_cd1400setreg(portp, CCR, ccr); |
3578 | stl_cd1400ccrwait(portp); | 3545 | stl_cd1400ccrwait(portp); |
3579 | BRDDISABLE(portp->brdnr); | 3546 | BRDDISABLE(portp->brdnr); |
3580 | restore_flags(flags); | 3547 | spin_unlock_irqrestore(&brd_lock, flags); |
3581 | } | 3548 | } |
3582 | 3549 | ||
3583 | /*****************************************************************************/ | 3550 | /*****************************************************************************/ |
@@ -3609,8 +3576,7 @@ static void stl_cd1400startrxtx(stlport_t *portp, int rx, int tx) | |||
3609 | else if (rx > 0) | 3576 | else if (rx > 0) |
3610 | sreron |= SRER_RXDATA; | 3577 | sreron |= SRER_RXDATA; |
3611 | 3578 | ||
3612 | save_flags(flags); | 3579 | spin_lock_irqsave(&brd_lock, flags); |
3613 | cli(); | ||
3614 | BRDENABLE(portp->brdnr, portp->pagenr); | 3580 | BRDENABLE(portp->brdnr, portp->pagenr); |
3615 | stl_cd1400setreg(portp, CAR, (portp->portnr & 0x03)); | 3581 | stl_cd1400setreg(portp, CAR, (portp->portnr & 0x03)); |
3616 | stl_cd1400setreg(portp, SRER, | 3582 | stl_cd1400setreg(portp, SRER, |
@@ -3618,7 +3584,7 @@ static void stl_cd1400startrxtx(stlport_t *portp, int rx, int tx) | |||
3618 | BRDDISABLE(portp->brdnr); | 3584 | BRDDISABLE(portp->brdnr); |
3619 | if (tx > 0) | 3585 | if (tx > 0) |
3620 | set_bit(ASYI_TXBUSY, &portp->istate); | 3586 | set_bit(ASYI_TXBUSY, &portp->istate); |
3621 | restore_flags(flags); | 3587 | spin_unlock_irqrestore(&brd_lock, flags); |
3622 | } | 3588 | } |
3623 | 3589 | ||
3624 | /*****************************************************************************/ | 3590 | /*****************************************************************************/ |
@@ -3634,13 +3600,12 @@ static void stl_cd1400disableintrs(stlport_t *portp) | |||
3634 | #ifdef DEBUG | 3600 | #ifdef DEBUG |
3635 | printk("stl_cd1400disableintrs(portp=%x)\n", (int) portp); | 3601 | printk("stl_cd1400disableintrs(portp=%x)\n", (int) portp); |
3636 | #endif | 3602 | #endif |
3637 | save_flags(flags); | 3603 | spin_lock_irqsave(&brd_lock, flags); |
3638 | cli(); | ||
3639 | BRDENABLE(portp->brdnr, portp->pagenr); | 3604 | BRDENABLE(portp->brdnr, portp->pagenr); |
3640 | stl_cd1400setreg(portp, CAR, (portp->portnr & 0x03)); | 3605 | stl_cd1400setreg(portp, CAR, (portp->portnr & 0x03)); |
3641 | stl_cd1400setreg(portp, SRER, 0); | 3606 | stl_cd1400setreg(portp, SRER, 0); |
3642 | BRDDISABLE(portp->brdnr); | 3607 | BRDDISABLE(portp->brdnr); |
3643 | restore_flags(flags); | 3608 | spin_unlock_irqrestore(&brd_lock, flags); |
3644 | } | 3609 | } |
3645 | 3610 | ||
3646 | /*****************************************************************************/ | 3611 | /*****************************************************************************/ |
@@ -3653,8 +3618,7 @@ static void stl_cd1400sendbreak(stlport_t *portp, int len) | |||
3653 | printk("stl_cd1400sendbreak(portp=%x,len=%d)\n", (int) portp, len); | 3618 | printk("stl_cd1400sendbreak(portp=%x,len=%d)\n", (int) portp, len); |
3654 | #endif | 3619 | #endif |
3655 | 3620 | ||
3656 | save_flags(flags); | 3621 | spin_lock_irqsave(&brd_lock, flags); |
3657 | cli(); | ||
3658 | BRDENABLE(portp->brdnr, portp->pagenr); | 3622 | BRDENABLE(portp->brdnr, portp->pagenr); |
3659 | stl_cd1400setreg(portp, CAR, (portp->portnr & 0x03)); | 3623 | stl_cd1400setreg(portp, CAR, (portp->portnr & 0x03)); |
3660 | stl_cd1400setreg(portp, SRER, | 3624 | stl_cd1400setreg(portp, SRER, |
@@ -3664,7 +3628,7 @@ static void stl_cd1400sendbreak(stlport_t *portp, int len) | |||
3664 | portp->brklen = len; | 3628 | portp->brklen = len; |
3665 | if (len == 1) | 3629 | if (len == 1) |
3666 | portp->stats.txbreaks++; | 3630 | portp->stats.txbreaks++; |
3667 | restore_flags(flags); | 3631 | spin_unlock_irqrestore(&brd_lock, flags); |
3668 | } | 3632 | } |
3669 | 3633 | ||
3670 | /*****************************************************************************/ | 3634 | /*****************************************************************************/ |
@@ -3688,8 +3652,7 @@ static void stl_cd1400flowctrl(stlport_t *portp, int state) | |||
3688 | if (tty == (struct tty_struct *) NULL) | 3652 | if (tty == (struct tty_struct *) NULL) |
3689 | return; | 3653 | return; |
3690 | 3654 | ||
3691 | save_flags(flags); | 3655 | spin_lock_irqsave(&brd_lock, flags); |
3692 | cli(); | ||
3693 | BRDENABLE(portp->brdnr, portp->pagenr); | 3656 | BRDENABLE(portp->brdnr, portp->pagenr); |
3694 | stl_cd1400setreg(portp, CAR, (portp->portnr & 0x03)); | 3657 | stl_cd1400setreg(portp, CAR, (portp->portnr & 0x03)); |
3695 | 3658 | ||
@@ -3729,7 +3692,7 @@ static void stl_cd1400flowctrl(stlport_t *portp, int state) | |||
3729 | } | 3692 | } |
3730 | 3693 | ||
3731 | BRDDISABLE(portp->brdnr); | 3694 | BRDDISABLE(portp->brdnr); |
3732 | restore_flags(flags); | 3695 | spin_unlock_irqrestore(&brd_lock, flags); |
3733 | } | 3696 | } |
3734 | 3697 | ||
3735 | /*****************************************************************************/ | 3698 | /*****************************************************************************/ |
@@ -3753,8 +3716,7 @@ static void stl_cd1400sendflow(stlport_t *portp, int state) | |||
3753 | if (tty == (struct tty_struct *) NULL) | 3716 | if (tty == (struct tty_struct *) NULL) |
3754 | return; | 3717 | return; |
3755 | 3718 | ||
3756 | save_flags(flags); | 3719 | spin_lock_irqsave(&brd_lock, flags); |
3757 | cli(); | ||
3758 | BRDENABLE(portp->brdnr, portp->pagenr); | 3720 | BRDENABLE(portp->brdnr, portp->pagenr); |
3759 | stl_cd1400setreg(portp, CAR, (portp->portnr & 0x03)); | 3721 | stl_cd1400setreg(portp, CAR, (portp->portnr & 0x03)); |
3760 | if (state) { | 3722 | if (state) { |
@@ -3769,7 +3731,7 @@ static void stl_cd1400sendflow(stlport_t *portp, int state) | |||
3769 | stl_cd1400ccrwait(portp); | 3731 | stl_cd1400ccrwait(portp); |
3770 | } | 3732 | } |
3771 | BRDDISABLE(portp->brdnr); | 3733 | BRDDISABLE(portp->brdnr); |
3772 | restore_flags(flags); | 3734 | spin_unlock_irqrestore(&brd_lock, flags); |
3773 | } | 3735 | } |
3774 | 3736 | ||
3775 | /*****************************************************************************/ | 3737 | /*****************************************************************************/ |
@@ -3785,8 +3747,7 @@ static void stl_cd1400flush(stlport_t *portp) | |||
3785 | if (portp == (stlport_t *) NULL) | 3747 | if (portp == (stlport_t *) NULL) |
3786 | return; | 3748 | return; |
3787 | 3749 | ||
3788 | save_flags(flags); | 3750 | spin_lock_irqsave(&brd_lock, flags); |
3789 | cli(); | ||
3790 | BRDENABLE(portp->brdnr, portp->pagenr); | 3751 | BRDENABLE(portp->brdnr, portp->pagenr); |
3791 | stl_cd1400setreg(portp, CAR, (portp->portnr & 0x03)); | 3752 | stl_cd1400setreg(portp, CAR, (portp->portnr & 0x03)); |
3792 | stl_cd1400ccrwait(portp); | 3753 | stl_cd1400ccrwait(portp); |
@@ -3794,7 +3755,7 @@ static void stl_cd1400flush(stlport_t *portp) | |||
3794 | stl_cd1400ccrwait(portp); | 3755 | stl_cd1400ccrwait(portp); |
3795 | portp->tx.tail = portp->tx.head; | 3756 | portp->tx.tail = portp->tx.head; |
3796 | BRDDISABLE(portp->brdnr); | 3757 | BRDDISABLE(portp->brdnr); |
3797 | restore_flags(flags); | 3758 | spin_unlock_irqrestore(&brd_lock, flags); |
3798 | } | 3759 | } |
3799 | 3760 | ||
3800 | /*****************************************************************************/ | 3761 | /*****************************************************************************/ |
@@ -3833,6 +3794,7 @@ static void stl_cd1400eiointr(stlpanel_t *panelp, unsigned int iobase) | |||
3833 | (int) panelp, iobase); | 3794 | (int) panelp, iobase); |
3834 | #endif | 3795 | #endif |
3835 | 3796 | ||
3797 | spin_lock(&brd_lock); | ||
3836 | outb(SVRR, iobase); | 3798 | outb(SVRR, iobase); |
3837 | svrtype = inb(iobase + EREG_DATA); | 3799 | svrtype = inb(iobase + EREG_DATA); |
3838 | if (panelp->nrports > 4) { | 3800 | if (panelp->nrports > 4) { |
@@ -3846,6 +3808,8 @@ static void stl_cd1400eiointr(stlpanel_t *panelp, unsigned int iobase) | |||
3846 | stl_cd1400txisr(panelp, iobase); | 3808 | stl_cd1400txisr(panelp, iobase); |
3847 | else if (svrtype & SVRR_MDM) | 3809 | else if (svrtype & SVRR_MDM) |
3848 | stl_cd1400mdmisr(panelp, iobase); | 3810 | stl_cd1400mdmisr(panelp, iobase); |
3811 | |||
3812 | spin_unlock(&brd_lock); | ||
3849 | } | 3813 | } |
3850 | 3814 | ||
3851 | /*****************************************************************************/ | 3815 | /*****************************************************************************/ |
@@ -4433,8 +4397,7 @@ static void stl_sc26198setport(stlport_t *portp, struct termios *tiosp) | |||
4433 | tiosp->c_cc[VSTART], tiosp->c_cc[VSTOP]); | 4397 | tiosp->c_cc[VSTART], tiosp->c_cc[VSTOP]); |
4434 | #endif | 4398 | #endif |
4435 | 4399 | ||
4436 | save_flags(flags); | 4400 | spin_lock_irqsave(&brd_lock, flags); |
4437 | cli(); | ||
4438 | BRDENABLE(portp->brdnr, portp->pagenr); | 4401 | BRDENABLE(portp->brdnr, portp->pagenr); |
4439 | stl_sc26198setreg(portp, IMR, 0); | 4402 | stl_sc26198setreg(portp, IMR, 0); |
4440 | stl_sc26198updatereg(portp, MR0, mr0); | 4403 | stl_sc26198updatereg(portp, MR0, mr0); |
@@ -4461,7 +4424,7 @@ static void stl_sc26198setport(stlport_t *portp, struct termios *tiosp) | |||
4461 | portp->imr = (portp->imr & ~imroff) | imron; | 4424 | portp->imr = (portp->imr & ~imroff) | imron; |
4462 | stl_sc26198setreg(portp, IMR, portp->imr); | 4425 | stl_sc26198setreg(portp, IMR, portp->imr); |
4463 | BRDDISABLE(portp->brdnr); | 4426 | BRDDISABLE(portp->brdnr); |
4464 | restore_flags(flags); | 4427 | spin_unlock_irqrestore(&brd_lock, flags); |
4465 | } | 4428 | } |
4466 | 4429 | ||
4467 | /*****************************************************************************/ | 4430 | /*****************************************************************************/ |
@@ -4491,13 +4454,12 @@ static void stl_sc26198setsignals(stlport_t *portp, int dtr, int rts) | |||
4491 | else if (rts > 0) | 4454 | else if (rts > 0) |
4492 | iopioron |= IPR_RTS; | 4455 | iopioron |= IPR_RTS; |
4493 | 4456 | ||
4494 | save_flags(flags); | 4457 | spin_lock_irqsave(&brd_lock, flags); |
4495 | cli(); | ||
4496 | BRDENABLE(portp->brdnr, portp->pagenr); | 4458 | BRDENABLE(portp->brdnr, portp->pagenr); |
4497 | stl_sc26198setreg(portp, IOPIOR, | 4459 | stl_sc26198setreg(portp, IOPIOR, |
4498 | ((stl_sc26198getreg(portp, IOPIOR) & ~iopioroff) | iopioron)); | 4460 | ((stl_sc26198getreg(portp, IOPIOR) & ~iopioroff) | iopioron)); |
4499 | BRDDISABLE(portp->brdnr); | 4461 | BRDDISABLE(portp->brdnr); |
4500 | restore_flags(flags); | 4462 | spin_unlock_irqrestore(&brd_lock, flags); |
4501 | } | 4463 | } |
4502 | 4464 | ||
4503 | /*****************************************************************************/ | 4465 | /*****************************************************************************/ |
@@ -4516,12 +4478,11 @@ static int stl_sc26198getsignals(stlport_t *portp) | |||
4516 | printk("stl_sc26198getsignals(portp=%x)\n", (int) portp); | 4478 | printk("stl_sc26198getsignals(portp=%x)\n", (int) portp); |
4517 | #endif | 4479 | #endif |
4518 | 4480 | ||
4519 | save_flags(flags); | 4481 | spin_lock_irqsave(&brd_lock, flags); |
4520 | cli(); | ||
4521 | BRDENABLE(portp->brdnr, portp->pagenr); | 4482 | BRDENABLE(portp->brdnr, portp->pagenr); |
4522 | ipr = stl_sc26198getreg(portp, IPR); | 4483 | ipr = stl_sc26198getreg(portp, IPR); |
4523 | BRDDISABLE(portp->brdnr); | 4484 | BRDDISABLE(portp->brdnr); |
4524 | restore_flags(flags); | 4485 | spin_unlock_irqrestore(&brd_lock, flags); |
4525 | 4486 | ||
4526 | sigs = 0; | 4487 | sigs = 0; |
4527 | sigs |= (ipr & IPR_DCD) ? 0 : TIOCM_CD; | 4488 | sigs |= (ipr & IPR_DCD) ? 0 : TIOCM_CD; |
@@ -4558,13 +4519,12 @@ static void stl_sc26198enablerxtx(stlport_t *portp, int rx, int tx) | |||
4558 | else if (rx > 0) | 4519 | else if (rx > 0) |
4559 | ccr |= CR_RXENABLE; | 4520 | ccr |= CR_RXENABLE; |
4560 | 4521 | ||
4561 | save_flags(flags); | 4522 | spin_lock_irqsave(&brd_lock, flags); |
4562 | cli(); | ||
4563 | BRDENABLE(portp->brdnr, portp->pagenr); | 4523 | BRDENABLE(portp->brdnr, portp->pagenr); |
4564 | stl_sc26198setreg(portp, SCCR, ccr); | 4524 | stl_sc26198setreg(portp, SCCR, ccr); |
4565 | BRDDISABLE(portp->brdnr); | 4525 | BRDDISABLE(portp->brdnr); |
4566 | portp->crenable = ccr; | 4526 | portp->crenable = ccr; |
4567 | restore_flags(flags); | 4527 | spin_unlock_irqrestore(&brd_lock, flags); |
4568 | } | 4528 | } |
4569 | 4529 | ||
4570 | /*****************************************************************************/ | 4530 | /*****************************************************************************/ |
@@ -4593,15 +4553,14 @@ static void stl_sc26198startrxtx(stlport_t *portp, int rx, int tx) | |||
4593 | else if (rx > 0) | 4553 | else if (rx > 0) |
4594 | imr |= IR_RXRDY | IR_RXBREAK | IR_RXWATCHDOG; | 4554 | imr |= IR_RXRDY | IR_RXBREAK | IR_RXWATCHDOG; |
4595 | 4555 | ||
4596 | save_flags(flags); | 4556 | spin_lock_irqsave(&brd_lock, flags); |
4597 | cli(); | ||
4598 | BRDENABLE(portp->brdnr, portp->pagenr); | 4557 | BRDENABLE(portp->brdnr, portp->pagenr); |
4599 | stl_sc26198setreg(portp, IMR, imr); | 4558 | stl_sc26198setreg(portp, IMR, imr); |
4600 | BRDDISABLE(portp->brdnr); | 4559 | BRDDISABLE(portp->brdnr); |
4601 | portp->imr = imr; | 4560 | portp->imr = imr; |
4602 | if (tx > 0) | 4561 | if (tx > 0) |
4603 | set_bit(ASYI_TXBUSY, &portp->istate); | 4562 | set_bit(ASYI_TXBUSY, &portp->istate); |
4604 | restore_flags(flags); | 4563 | spin_unlock_irqrestore(&brd_lock, flags); |
4605 | } | 4564 | } |
4606 | 4565 | ||
4607 | /*****************************************************************************/ | 4566 | /*****************************************************************************/ |
@@ -4618,13 +4577,12 @@ static void stl_sc26198disableintrs(stlport_t *portp) | |||
4618 | printk("stl_sc26198disableintrs(portp=%x)\n", (int) portp); | 4577 | printk("stl_sc26198disableintrs(portp=%x)\n", (int) portp); |
4619 | #endif | 4578 | #endif |
4620 | 4579 | ||
4621 | save_flags(flags); | 4580 | spin_lock_irqsave(&brd_lock, flags); |
4622 | cli(); | ||
4623 | BRDENABLE(portp->brdnr, portp->pagenr); | 4581 | BRDENABLE(portp->brdnr, portp->pagenr); |
4624 | portp->imr = 0; | 4582 | portp->imr = 0; |
4625 | stl_sc26198setreg(portp, IMR, 0); | 4583 | stl_sc26198setreg(portp, IMR, 0); |
4626 | BRDDISABLE(portp->brdnr); | 4584 | BRDDISABLE(portp->brdnr); |
4627 | restore_flags(flags); | 4585 | spin_unlock_irqrestore(&brd_lock, flags); |
4628 | } | 4586 | } |
4629 | 4587 | ||
4630 | /*****************************************************************************/ | 4588 | /*****************************************************************************/ |
@@ -4637,8 +4595,7 @@ static void stl_sc26198sendbreak(stlport_t *portp, int len) | |||
4637 | printk("stl_sc26198sendbreak(portp=%x,len=%d)\n", (int) portp, len); | 4595 | printk("stl_sc26198sendbreak(portp=%x,len=%d)\n", (int) portp, len); |
4638 | #endif | 4596 | #endif |
4639 | 4597 | ||
4640 | save_flags(flags); | 4598 | spin_lock_irqsave(&brd_lock, flags); |
4641 | cli(); | ||
4642 | BRDENABLE(portp->brdnr, portp->pagenr); | 4599 | BRDENABLE(portp->brdnr, portp->pagenr); |
4643 | if (len == 1) { | 4600 | if (len == 1) { |
4644 | stl_sc26198setreg(portp, SCCR, CR_TXSTARTBREAK); | 4601 | stl_sc26198setreg(portp, SCCR, CR_TXSTARTBREAK); |
@@ -4647,7 +4604,7 @@ static void stl_sc26198sendbreak(stlport_t *portp, int len) | |||
4647 | stl_sc26198setreg(portp, SCCR, CR_TXSTOPBREAK); | 4604 | stl_sc26198setreg(portp, SCCR, CR_TXSTOPBREAK); |
4648 | } | 4605 | } |
4649 | BRDDISABLE(portp->brdnr); | 4606 | BRDDISABLE(portp->brdnr); |
4650 | restore_flags(flags); | 4607 | spin_unlock_irqrestore(&brd_lock, flags); |
4651 | } | 4608 | } |
4652 | 4609 | ||
4653 | /*****************************************************************************/ | 4610 | /*****************************************************************************/ |
@@ -4672,8 +4629,7 @@ static void stl_sc26198flowctrl(stlport_t *portp, int state) | |||
4672 | if (tty == (struct tty_struct *) NULL) | 4629 | if (tty == (struct tty_struct *) NULL) |
4673 | return; | 4630 | return; |
4674 | 4631 | ||
4675 | save_flags(flags); | 4632 | spin_lock_irqsave(&brd_lock, flags); |
4676 | cli(); | ||
4677 | BRDENABLE(portp->brdnr, portp->pagenr); | 4633 | BRDENABLE(portp->brdnr, portp->pagenr); |
4678 | 4634 | ||
4679 | if (state) { | 4635 | if (state) { |
@@ -4719,7 +4675,7 @@ static void stl_sc26198flowctrl(stlport_t *portp, int state) | |||
4719 | } | 4675 | } |
4720 | 4676 | ||
4721 | BRDDISABLE(portp->brdnr); | 4677 | BRDDISABLE(portp->brdnr); |
4722 | restore_flags(flags); | 4678 | spin_unlock_irqrestore(&brd_lock, flags); |
4723 | } | 4679 | } |
4724 | 4680 | ||
4725 | /*****************************************************************************/ | 4681 | /*****************************************************************************/ |
@@ -4744,8 +4700,7 @@ static void stl_sc26198sendflow(stlport_t *portp, int state) | |||
4744 | if (tty == (struct tty_struct *) NULL) | 4700 | if (tty == (struct tty_struct *) NULL) |
4745 | return; | 4701 | return; |
4746 | 4702 | ||
4747 | save_flags(flags); | 4703 | spin_lock_irqsave(&brd_lock, flags); |
4748 | cli(); | ||
4749 | BRDENABLE(portp->brdnr, portp->pagenr); | 4704 | BRDENABLE(portp->brdnr, portp->pagenr); |
4750 | if (state) { | 4705 | if (state) { |
4751 | mr0 = stl_sc26198getreg(portp, MR0); | 4706 | mr0 = stl_sc26198getreg(portp, MR0); |
@@ -4765,7 +4720,7 @@ static void stl_sc26198sendflow(stlport_t *portp, int state) | |||
4765 | stl_sc26198setreg(portp, MR0, mr0); | 4720 | stl_sc26198setreg(portp, MR0, mr0); |
4766 | } | 4721 | } |
4767 | BRDDISABLE(portp->brdnr); | 4722 | BRDDISABLE(portp->brdnr); |
4768 | restore_flags(flags); | 4723 | spin_unlock_irqrestore(&brd_lock, flags); |
4769 | } | 4724 | } |
4770 | 4725 | ||
4771 | /*****************************************************************************/ | 4726 | /*****************************************************************************/ |
@@ -4781,14 +4736,13 @@ static void stl_sc26198flush(stlport_t *portp) | |||
4781 | if (portp == (stlport_t *) NULL) | 4736 | if (portp == (stlport_t *) NULL) |
4782 | return; | 4737 | return; |
4783 | 4738 | ||
4784 | save_flags(flags); | 4739 | spin_lock_irqsave(&brd_lock, flags); |
4785 | cli(); | ||
4786 | BRDENABLE(portp->brdnr, portp->pagenr); | 4740 | BRDENABLE(portp->brdnr, portp->pagenr); |
4787 | stl_sc26198setreg(portp, SCCR, CR_TXRESET); | 4741 | stl_sc26198setreg(portp, SCCR, CR_TXRESET); |
4788 | stl_sc26198setreg(portp, SCCR, portp->crenable); | 4742 | stl_sc26198setreg(portp, SCCR, portp->crenable); |
4789 | BRDDISABLE(portp->brdnr); | 4743 | BRDDISABLE(portp->brdnr); |
4790 | portp->tx.tail = portp->tx.head; | 4744 | portp->tx.tail = portp->tx.head; |
4791 | restore_flags(flags); | 4745 | spin_unlock_irqrestore(&brd_lock, flags); |
4792 | } | 4746 | } |
4793 | 4747 | ||
4794 | /*****************************************************************************/ | 4748 | /*****************************************************************************/ |
@@ -4815,12 +4769,11 @@ static int stl_sc26198datastate(stlport_t *portp) | |||
4815 | if (test_bit(ASYI_TXBUSY, &portp->istate)) | 4769 | if (test_bit(ASYI_TXBUSY, &portp->istate)) |
4816 | return 1; | 4770 | return 1; |
4817 | 4771 | ||
4818 | save_flags(flags); | 4772 | spin_lock_irqsave(&brd_lock, flags); |
4819 | cli(); | ||
4820 | BRDENABLE(portp->brdnr, portp->pagenr); | 4773 | BRDENABLE(portp->brdnr, portp->pagenr); |
4821 | sr = stl_sc26198getreg(portp, SR); | 4774 | sr = stl_sc26198getreg(portp, SR); |
4822 | BRDDISABLE(portp->brdnr); | 4775 | BRDDISABLE(portp->brdnr); |
4823 | restore_flags(flags); | 4776 | spin_unlock_irqrestore(&brd_lock, flags); |
4824 | 4777 | ||
4825 | return (sr & SR_TXEMPTY) ? 0 : 1; | 4778 | return (sr & SR_TXEMPTY) ? 0 : 1; |
4826 | } | 4779 | } |
@@ -4878,6 +4831,8 @@ static void stl_sc26198intr(stlpanel_t *panelp, unsigned int iobase) | |||
4878 | stlport_t *portp; | 4831 | stlport_t *portp; |
4879 | unsigned int iack; | 4832 | unsigned int iack; |
4880 | 4833 | ||
4834 | spin_lock(&brd_lock); | ||
4835 | |||
4881 | /* | 4836 | /* |
4882 | * Work around bug in sc26198 chip... Cannot have A6 address | 4837 | * Work around bug in sc26198 chip... Cannot have A6 address |
4883 | * line of UART high, else iack will be returned as 0. | 4838 | * line of UART high, else iack will be returned as 0. |
@@ -4893,6 +4848,8 @@ static void stl_sc26198intr(stlpanel_t *panelp, unsigned int iobase) | |||
4893 | stl_sc26198txisr(portp); | 4848 | stl_sc26198txisr(portp); |
4894 | else | 4849 | else |
4895 | stl_sc26198otherisr(portp, iack); | 4850 | stl_sc26198otherisr(portp, iack); |
4851 | |||
4852 | spin_unlock(&brd_lock); | ||
4896 | } | 4853 | } |
4897 | 4854 | ||
4898 | /*****************************************************************************/ | 4855 | /*****************************************************************************/ |
diff --git a/drivers/char/sx.c b/drivers/char/sx.c index 3b4747230270..76b9107f7f81 100644 --- a/drivers/char/sx.c +++ b/drivers/char/sx.c | |||
@@ -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/tipar.c b/drivers/char/tipar.c index 079db5a935a1..f7802e5bd7ca 100644 --- a/drivers/char/tipar.c +++ b/drivers/char/tipar.c | |||
@@ -56,7 +56,6 @@ | |||
56 | #include <linux/ioport.h> | 56 | #include <linux/ioport.h> |
57 | #include <asm/io.h> | 57 | #include <asm/io.h> |
58 | #include <linux/bitops.h> | 58 | #include <linux/bitops.h> |
59 | #include <linux/devfs_fs_kernel.h> /* DevFs support */ | ||
60 | #include <linux/parport.h> /* Our code depend on parport */ | 59 | #include <linux/parport.h> /* Our code depend on parport */ |
61 | #include <linux/device.h> | 60 | #include <linux/device.h> |
62 | 61 | ||
@@ -443,12 +442,6 @@ tipar_register(int nr, struct parport *port) | |||
443 | 442 | ||
444 | class_device_create(tipar_class, NULL, MKDEV(TIPAR_MAJOR, | 443 | class_device_create(tipar_class, NULL, MKDEV(TIPAR_MAJOR, |
445 | TIPAR_MINOR + nr), NULL, "par%d", nr); | 444 | 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 | 445 | ||
453 | /* Display informations */ | 446 | /* Display informations */ |
454 | pr_info("tipar%d: using %s (%s)\n", nr, port->name, (port->irq == | 447 | pr_info("tipar%d: using %s (%s)\n", nr, port->name, (port->irq == |
@@ -460,11 +453,7 @@ tipar_register(int nr, struct parport *port) | |||
460 | pr_info("tipar%d: link cable not found\n", nr); | 453 | pr_info("tipar%d: link cable not found\n", nr); |
461 | 454 | ||
462 | err = 0; | 455 | err = 0; |
463 | goto out; | ||
464 | 456 | ||
465 | out_class: | ||
466 | class_device_destroy(tipar_class, MKDEV(TIPAR_MAJOR, TIPAR_MINOR + nr)); | ||
467 | class_destroy(tipar_class); | ||
468 | out: | 457 | out: |
469 | return err; | 458 | return err; |
470 | } | 459 | } |
@@ -507,9 +496,6 @@ tipar_init_module(void) | |||
507 | goto out; | 496 | goto out; |
508 | } | 497 | } |
509 | 498 | ||
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"); | 499 | tipar_class = class_create(THIS_MODULE, "ticables"); |
514 | if (IS_ERR(tipar_class)) { | 500 | if (IS_ERR(tipar_class)) { |
515 | err = PTR_ERR(tipar_class); | 501 | err = PTR_ERR(tipar_class); |
@@ -528,7 +514,6 @@ out_class: | |||
528 | class_destroy(tipar_class); | 514 | class_destroy(tipar_class); |
529 | 515 | ||
530 | out_chrdev: | 516 | out_chrdev: |
531 | devfs_remove("ticables/par"); | ||
532 | unregister_chrdev(TIPAR_MAJOR, "tipar"); | 517 | unregister_chrdev(TIPAR_MAJOR, "tipar"); |
533 | out: | 518 | out: |
534 | return err; | 519 | return err; |
@@ -549,10 +534,8 @@ tipar_cleanup_module(void) | |||
549 | continue; | 534 | continue; |
550 | parport_unregister_device(table[i].dev); | 535 | parport_unregister_device(table[i].dev); |
551 | class_device_destroy(tipar_class, MKDEV(TIPAR_MAJOR, i)); | 536 | class_device_destroy(tipar_class, MKDEV(TIPAR_MAJOR, i)); |
552 | devfs_remove("ticables/par/%d", i); | ||
553 | } | 537 | } |
554 | class_destroy(tipar_class); | 538 | class_destroy(tipar_class); |
555 | devfs_remove("ticables/par"); | ||
556 | 539 | ||
557 | pr_info("tipar: module unloaded\n"); | 540 | pr_info("tipar: module unloaded\n"); |
558 | } | 541 | } |
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c index 8b2a59969868..a1143238feca 100644 --- a/drivers/char/tty_io.c +++ b/drivers/char/tty_io.c | |||
@@ -102,7 +102,6 @@ | |||
102 | #include <linux/kbd_kern.h> | 102 | #include <linux/kbd_kern.h> |
103 | #include <linux/vt_kern.h> | 103 | #include <linux/vt_kern.h> |
104 | #include <linux/selection.h> | 104 | #include <linux/selection.h> |
105 | #include <linux/devfs_fs_kernel.h> | ||
106 | 105 | ||
107 | #include <linux/kmod.h> | 106 | #include <linux/kmod.h> |
108 | 107 | ||
@@ -267,7 +266,6 @@ static struct tty_buffer *tty_buffer_alloc(size_t size) | |||
267 | p->used = 0; | 266 | p->used = 0; |
268 | p->size = size; | 267 | p->size = size; |
269 | p->next = NULL; | 268 | p->next = NULL; |
270 | p->active = 0; | ||
271 | p->commit = 0; | 269 | p->commit = 0; |
272 | p->read = 0; | 270 | p->read = 0; |
273 | p->char_buf_ptr = (char *)(p->data); | 271 | p->char_buf_ptr = (char *)(p->data); |
@@ -327,10 +325,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 | 325 | /* OPTIMISATION: We could keep a per tty "zero" sized buffer to |
328 | remove this conditional if its worth it. This would be invisible | 326 | remove this conditional if its worth it. This would be invisible |
329 | to the callers */ | 327 | to the callers */ |
330 | if ((b = tty->buf.tail) != NULL) { | 328 | if ((b = tty->buf.tail) != NULL) |
331 | left = b->size - b->used; | 329 | left = b->size - b->used; |
332 | b->active = 1; | 330 | else |
333 | } else | ||
334 | left = 0; | 331 | left = 0; |
335 | 332 | ||
336 | if (left < size) { | 333 | if (left < size) { |
@@ -338,12 +335,10 @@ int tty_buffer_request_room(struct tty_struct *tty, size_t size) | |||
338 | if ((n = tty_buffer_find(tty, size)) != NULL) { | 335 | if ((n = tty_buffer_find(tty, size)) != NULL) { |
339 | if (b != NULL) { | 336 | if (b != NULL) { |
340 | b->next = n; | 337 | b->next = n; |
341 | b->active = 0; | ||
342 | b->commit = b->used; | 338 | b->commit = b->used; |
343 | } else | 339 | } else |
344 | tty->buf.head = n; | 340 | tty->buf.head = n; |
345 | tty->buf.tail = n; | 341 | tty->buf.tail = n; |
346 | n->active = 1; | ||
347 | } else | 342 | } else |
348 | size = left; | 343 | size = left; |
349 | } | 344 | } |
@@ -404,10 +399,8 @@ void tty_schedule_flip(struct tty_struct *tty) | |||
404 | { | 399 | { |
405 | unsigned long flags; | 400 | unsigned long flags; |
406 | spin_lock_irqsave(&tty->buf.lock, flags); | 401 | spin_lock_irqsave(&tty->buf.lock, flags); |
407 | if (tty->buf.tail != NULL) { | 402 | if (tty->buf.tail != NULL) |
408 | tty->buf.tail->active = 0; | ||
409 | tty->buf.tail->commit = tty->buf.tail->used; | 403 | tty->buf.tail->commit = tty->buf.tail->used; |
410 | } | ||
411 | spin_unlock_irqrestore(&tty->buf.lock, flags); | 404 | spin_unlock_irqrestore(&tty->buf.lock, flags); |
412 | schedule_delayed_work(&tty->buf.work, 1); | 405 | schedule_delayed_work(&tty->buf.work, 1); |
413 | } | 406 | } |
@@ -784,11 +777,8 @@ restart: | |||
784 | } | 777 | } |
785 | 778 | ||
786 | clear_bit(TTY_LDISC, &tty->flags); | 779 | clear_bit(TTY_LDISC, &tty->flags); |
787 | clear_bit(TTY_DONT_FLIP, &tty->flags); | 780 | if (o_tty) |
788 | if (o_tty) { | ||
789 | clear_bit(TTY_LDISC, &o_tty->flags); | 781 | 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); | 782 | spin_unlock_irqrestore(&tty_ldisc_lock, flags); |
793 | 783 | ||
794 | /* | 784 | /* |
@@ -1955,7 +1945,6 @@ static void release_dev(struct file * filp) | |||
1955 | * race with the set_ldisc code path. | 1945 | * race with the set_ldisc code path. |
1956 | */ | 1946 | */ |
1957 | clear_bit(TTY_LDISC, &tty->flags); | 1947 | clear_bit(TTY_LDISC, &tty->flags); |
1958 | clear_bit(TTY_DONT_FLIP, &tty->flags); | ||
1959 | cancel_delayed_work(&tty->buf.work); | 1948 | cancel_delayed_work(&tty->buf.work); |
1960 | 1949 | ||
1961 | /* | 1950 | /* |
@@ -2621,10 +2610,9 @@ int tty_ioctl(struct inode * inode, struct file * file, | |||
2621 | tty->driver->break_ctl(tty, 0); | 2610 | tty->driver->break_ctl(tty, 0); |
2622 | return 0; | 2611 | return 0; |
2623 | case TCSBRK: /* SVID version: non-zero arg --> no break */ | 2612 | case TCSBRK: /* SVID version: non-zero arg --> no break */ |
2624 | /* | 2613 | /* non-zero arg means wait for all output data |
2625 | * XXX is the above comment correct, or the | 2614 | * to be sent (performed above) but don't send break. |
2626 | * code below correct? Is this ioctl used at | 2615 | * This is used by the tcdrain() termios function. |
2627 | * all by anyone? | ||
2628 | */ | 2616 | */ |
2629 | if (!arg) | 2617 | if (!arg) |
2630 | return send_break(tty, 250); | 2618 | return send_break(tty, 250); |
@@ -2776,8 +2764,7 @@ static void flush_to_ldisc(void *private_) | |||
2776 | struct tty_struct *tty = (struct tty_struct *) private_; | 2764 | struct tty_struct *tty = (struct tty_struct *) private_; |
2777 | unsigned long flags; | 2765 | unsigned long flags; |
2778 | struct tty_ldisc *disc; | 2766 | struct tty_ldisc *disc; |
2779 | struct tty_buffer *tbuf; | 2767 | struct tty_buffer *tbuf, *head; |
2780 | int count; | ||
2781 | char *char_buf; | 2768 | char *char_buf; |
2782 | unsigned char *flag_buf; | 2769 | unsigned char *flag_buf; |
2783 | 2770 | ||
@@ -2785,32 +2772,37 @@ static void flush_to_ldisc(void *private_) | |||
2785 | if (disc == NULL) /* !TTY_LDISC */ | 2772 | if (disc == NULL) /* !TTY_LDISC */ |
2786 | return; | 2773 | return; |
2787 | 2774 | ||
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); | 2775 | spin_lock_irqsave(&tty->buf.lock, flags); |
2796 | while((tbuf = tty->buf.head) != NULL) { | 2776 | head = tty->buf.head; |
2797 | while ((count = tbuf->commit - tbuf->read) != 0) { | 2777 | if (head != NULL) { |
2798 | char_buf = tbuf->char_buf_ptr + tbuf->read; | 2778 | tty->buf.head = NULL; |
2799 | flag_buf = tbuf->flag_buf_ptr + tbuf->read; | 2779 | for (;;) { |
2800 | tbuf->read += count; | 2780 | int count = head->commit - head->read; |
2781 | if (!count) { | ||
2782 | if (head->next == NULL) | ||
2783 | break; | ||
2784 | tbuf = head; | ||
2785 | head = head->next; | ||
2786 | tty_buffer_free(tty, tbuf); | ||
2787 | continue; | ||
2788 | } | ||
2789 | if (!tty->receive_room) { | ||
2790 | schedule_delayed_work(&tty->buf.work, 1); | ||
2791 | break; | ||
2792 | } | ||
2793 | if (count > tty->receive_room) | ||
2794 | count = tty->receive_room; | ||
2795 | char_buf = head->char_buf_ptr + head->read; | ||
2796 | flag_buf = head->flag_buf_ptr + head->read; | ||
2797 | head->read += count; | ||
2801 | spin_unlock_irqrestore(&tty->buf.lock, flags); | 2798 | spin_unlock_irqrestore(&tty->buf.lock, flags); |
2802 | disc->receive_buf(tty, char_buf, flag_buf, count); | 2799 | disc->receive_buf(tty, char_buf, flag_buf, count); |
2803 | spin_lock_irqsave(&tty->buf.lock, flags); | 2800 | spin_lock_irqsave(&tty->buf.lock, flags); |
2804 | } | 2801 | } |
2805 | if (tbuf->active) | 2802 | 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 | } | 2803 | } |
2812 | spin_unlock_irqrestore(&tty->buf.lock, flags); | 2804 | spin_unlock_irqrestore(&tty->buf.lock, flags); |
2813 | out: | 2805 | |
2814 | tty_ldisc_deref(disc); | 2806 | tty_ldisc_deref(disc); |
2815 | } | 2807 | } |
2816 | 2808 | ||
@@ -2903,10 +2895,8 @@ void tty_flip_buffer_push(struct tty_struct *tty) | |||
2903 | { | 2895 | { |
2904 | unsigned long flags; | 2896 | unsigned long flags; |
2905 | spin_lock_irqsave(&tty->buf.lock, flags); | 2897 | spin_lock_irqsave(&tty->buf.lock, flags); |
2906 | if (tty->buf.tail != NULL) { | 2898 | if (tty->buf.tail != NULL) |
2907 | tty->buf.tail->active = 0; | ||
2908 | tty->buf.tail->commit = tty->buf.tail->used; | 2899 | tty->buf.tail->commit = tty->buf.tail->used; |
2909 | } | ||
2910 | spin_unlock_irqrestore(&tty->buf.lock, flags); | 2900 | spin_unlock_irqrestore(&tty->buf.lock, flags); |
2911 | 2901 | ||
2912 | if (tty->low_latency) | 2902 | if (tty->low_latency) |
@@ -2964,8 +2954,8 @@ static struct class *tty_class; | |||
2964 | * Returns a pointer to the class device (or ERR_PTR(-EFOO) on error). | 2954 | * Returns a pointer to the class device (or ERR_PTR(-EFOO) on error). |
2965 | * | 2955 | * |
2966 | * This call is required to be made to register an individual tty device if | 2956 | * This call is required to be made to register an individual tty device if |
2967 | * the tty driver's flags have the TTY_DRIVER_NO_DEVFS bit set. If that | 2957 | * the tty driver's flags have the TTY_DRIVER_DYNAMIC_DEV bit set. If that |
2968 | * bit is not set, this function should not be called. | 2958 | * bit is not set, this function should not be called by a tty driver. |
2969 | */ | 2959 | */ |
2970 | struct class_device *tty_register_device(struct tty_driver *driver, | 2960 | struct class_device *tty_register_device(struct tty_driver *driver, |
2971 | unsigned index, struct device *device) | 2961 | unsigned index, struct device *device) |
@@ -2979,9 +2969,6 @@ struct class_device *tty_register_device(struct tty_driver *driver, | |||
2979 | return ERR_PTR(-EINVAL); | 2969 | return ERR_PTR(-EINVAL); |
2980 | } | 2970 | } |
2981 | 2971 | ||
2982 | devfs_mk_cdev(dev, S_IFCHR | S_IRUSR | S_IWUSR, | ||
2983 | "%s%d", driver->devfs_name, index + driver->name_base); | ||
2984 | |||
2985 | if (driver->type == TTY_DRIVER_TYPE_PTY) | 2972 | if (driver->type == TTY_DRIVER_TYPE_PTY) |
2986 | pty_line_name(driver, index, name); | 2973 | pty_line_name(driver, index, name); |
2987 | else | 2974 | else |
@@ -3000,7 +2987,6 @@ struct class_device *tty_register_device(struct tty_driver *driver, | |||
3000 | */ | 2987 | */ |
3001 | void tty_unregister_device(struct tty_driver *driver, unsigned index) | 2988 | void tty_unregister_device(struct tty_driver *driver, unsigned index) |
3002 | { | 2989 | { |
3003 | devfs_remove("%s%d", driver->devfs_name, index + driver->name_base); | ||
3004 | class_device_destroy(tty_class, MKDEV(driver->major, driver->minor_start) + index); | 2990 | class_device_destroy(tty_class, MKDEV(driver->major, driver->minor_start) + index); |
3005 | } | 2991 | } |
3006 | 2992 | ||
@@ -3122,7 +3108,7 @@ int tty_register_driver(struct tty_driver *driver) | |||
3122 | 3108 | ||
3123 | list_add(&driver->tty_drivers, &tty_drivers); | 3109 | list_add(&driver->tty_drivers, &tty_drivers); |
3124 | 3110 | ||
3125 | if ( !(driver->flags & TTY_DRIVER_NO_DEVFS) ) { | 3111 | if ( !(driver->flags & TTY_DRIVER_DYNAMIC_DEV) ) { |
3126 | for(i = 0; i < driver->num; i++) | 3112 | for(i = 0; i < driver->num; i++) |
3127 | tty_register_device(driver, i, NULL); | 3113 | tty_register_device(driver, i, NULL); |
3128 | } | 3114 | } |
@@ -3165,7 +3151,7 @@ int tty_unregister_driver(struct tty_driver *driver) | |||
3165 | driver->termios_locked[i] = NULL; | 3151 | driver->termios_locked[i] = NULL; |
3166 | kfree(tp); | 3152 | kfree(tp); |
3167 | } | 3153 | } |
3168 | if (!(driver->flags & TTY_DRIVER_NO_DEVFS)) | 3154 | if (!(driver->flags & TTY_DRIVER_DYNAMIC_DEV)) |
3169 | tty_unregister_device(driver, i); | 3155 | tty_unregister_device(driver, i); |
3170 | } | 3156 | } |
3171 | p = driver->ttys; | 3157 | p = driver->ttys; |
@@ -3241,14 +3227,12 @@ static int __init tty_init(void) | |||
3241 | if (cdev_add(&tty_cdev, MKDEV(TTYAUX_MAJOR, 0), 1) || | 3227 | if (cdev_add(&tty_cdev, MKDEV(TTYAUX_MAJOR, 0), 1) || |
3242 | register_chrdev_region(MKDEV(TTYAUX_MAJOR, 0), 1, "/dev/tty") < 0) | 3228 | register_chrdev_region(MKDEV(TTYAUX_MAJOR, 0), 1, "/dev/tty") < 0) |
3243 | panic("Couldn't register /dev/tty driver\n"); | 3229 | panic("Couldn't register /dev/tty driver\n"); |
3244 | devfs_mk_cdev(MKDEV(TTYAUX_MAJOR, 0), S_IFCHR|S_IRUGO|S_IWUGO, "tty"); | ||
3245 | class_device_create(tty_class, NULL, MKDEV(TTYAUX_MAJOR, 0), NULL, "tty"); | 3230 | class_device_create(tty_class, NULL, MKDEV(TTYAUX_MAJOR, 0), NULL, "tty"); |
3246 | 3231 | ||
3247 | cdev_init(&console_cdev, &console_fops); | 3232 | cdev_init(&console_cdev, &console_fops); |
3248 | if (cdev_add(&console_cdev, MKDEV(TTYAUX_MAJOR, 1), 1) || | 3233 | if (cdev_add(&console_cdev, MKDEV(TTYAUX_MAJOR, 1), 1) || |
3249 | register_chrdev_region(MKDEV(TTYAUX_MAJOR, 1), 1, "/dev/console") < 0) | 3234 | register_chrdev_region(MKDEV(TTYAUX_MAJOR, 1), 1, "/dev/console") < 0) |
3250 | panic("Couldn't register /dev/console driver\n"); | 3235 | panic("Couldn't register /dev/console driver\n"); |
3251 | devfs_mk_cdev(MKDEV(TTYAUX_MAJOR, 1), S_IFCHR|S_IRUSR|S_IWUSR, "console"); | ||
3252 | class_device_create(tty_class, NULL, MKDEV(TTYAUX_MAJOR, 1), NULL, "console"); | 3236 | class_device_create(tty_class, NULL, MKDEV(TTYAUX_MAJOR, 1), NULL, "console"); |
3253 | 3237 | ||
3254 | #ifdef CONFIG_UNIX98_PTYS | 3238 | #ifdef CONFIG_UNIX98_PTYS |
@@ -3256,7 +3240,6 @@ static int __init tty_init(void) | |||
3256 | if (cdev_add(&ptmx_cdev, MKDEV(TTYAUX_MAJOR, 2), 1) || | 3240 | if (cdev_add(&ptmx_cdev, MKDEV(TTYAUX_MAJOR, 2), 1) || |
3257 | register_chrdev_region(MKDEV(TTYAUX_MAJOR, 2), 1, "/dev/ptmx") < 0) | 3241 | register_chrdev_region(MKDEV(TTYAUX_MAJOR, 2), 1, "/dev/ptmx") < 0) |
3258 | panic("Couldn't register /dev/ptmx driver\n"); | 3242 | panic("Couldn't register /dev/ptmx driver\n"); |
3259 | devfs_mk_cdev(MKDEV(TTYAUX_MAJOR, 2), S_IFCHR|S_IRUGO|S_IWUGO, "ptmx"); | ||
3260 | class_device_create(tty_class, NULL, MKDEV(TTYAUX_MAJOR, 2), NULL, "ptmx"); | 3243 | class_device_create(tty_class, NULL, MKDEV(TTYAUX_MAJOR, 2), NULL, "ptmx"); |
3261 | #endif | 3244 | #endif |
3262 | 3245 | ||
@@ -3265,7 +3248,6 @@ static int __init tty_init(void) | |||
3265 | if (cdev_add(&vc0_cdev, MKDEV(TTY_MAJOR, 0), 1) || | 3248 | if (cdev_add(&vc0_cdev, MKDEV(TTY_MAJOR, 0), 1) || |
3266 | register_chrdev_region(MKDEV(TTY_MAJOR, 0), 1, "/dev/vc/0") < 0) | 3249 | register_chrdev_region(MKDEV(TTY_MAJOR, 0), 1, "/dev/vc/0") < 0) |
3267 | panic("Couldn't register /dev/tty0 driver\n"); | 3250 | panic("Couldn't register /dev/tty0 driver\n"); |
3268 | devfs_mk_cdev(MKDEV(TTY_MAJOR, 0), S_IFCHR|S_IRUSR|S_IWUSR, "vc/0"); | ||
3269 | class_device_create(tty_class, NULL, MKDEV(TTY_MAJOR, 0), NULL, "tty0"); | 3251 | class_device_create(tty_class, NULL, MKDEV(TTY_MAJOR, 0), NULL, "tty0"); |
3270 | 3252 | ||
3271 | vty_init(); | 3253 | vty_init(); |
diff --git a/drivers/char/vc_screen.c b/drivers/char/vc_screen.c index 3c1dafaa3441..234d7f3fb114 100644 --- a/drivers/char/vc_screen.c +++ b/drivers/char/vc_screen.c | |||
@@ -26,7 +26,6 @@ | |||
26 | #include <linux/major.h> | 26 | #include <linux/major.h> |
27 | #include <linux/errno.h> | 27 | #include <linux/errno.h> |
28 | #include <linux/tty.h> | 28 | #include <linux/tty.h> |
29 | #include <linux/devfs_fs_kernel.h> | ||
30 | #include <linux/sched.h> | 29 | #include <linux/sched.h> |
31 | #include <linux/interrupt.h> | 30 | #include <linux/interrupt.h> |
32 | #include <linux/mm.h> | 31 | #include <linux/mm.h> |
@@ -478,12 +477,6 @@ static struct class *vc_class; | |||
478 | 477 | ||
479 | void vcs_make_devfs(struct tty_struct *tty) | 478 | void vcs_make_devfs(struct tty_struct *tty) |
480 | { | 479 | { |
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), | 480 | class_device_create(vc_class, NULL, MKDEV(VCS_MAJOR, tty->index + 1), |
488 | NULL, "vcs%u", tty->index + 1); | 481 | NULL, "vcs%u", tty->index + 1); |
489 | class_device_create(vc_class, NULL, MKDEV(VCS_MAJOR, tty->index + 129), | 482 | class_device_create(vc_class, NULL, MKDEV(VCS_MAJOR, tty->index + 129), |
@@ -491,8 +484,6 @@ void vcs_make_devfs(struct tty_struct *tty) | |||
491 | } | 484 | } |
492 | void vcs_remove_devfs(struct tty_struct *tty) | 485 | void vcs_remove_devfs(struct tty_struct *tty) |
493 | { | 486 | { |
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)); | 487 | class_device_destroy(vc_class, MKDEV(VCS_MAJOR, tty->index + 1)); |
497 | class_device_destroy(vc_class, MKDEV(VCS_MAJOR, tty->index + 129)); | 488 | class_device_destroy(vc_class, MKDEV(VCS_MAJOR, tty->index + 129)); |
498 | } | 489 | } |
@@ -503,8 +494,6 @@ int __init vcs_init(void) | |||
503 | panic("unable to get major %d for vcs device", VCS_MAJOR); | 494 | panic("unable to get major %d for vcs device", VCS_MAJOR); |
504 | vc_class = class_create(THIS_MODULE, "vc"); | 495 | vc_class = class_create(THIS_MODULE, "vc"); |
505 | 496 | ||
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"); | 497 | 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"); | 498 | class_device_create(vc_class, NULL, MKDEV(VCS_MAJOR, 128), NULL, "vcsa"); |
510 | return 0; | 499 | return 0; |
diff --git a/drivers/char/viocons.c b/drivers/char/viocons.c index 4e5360388748..07f5ce4b28e3 100644 --- a/drivers/char/viocons.c +++ b/drivers/char/viocons.c | |||
@@ -1152,7 +1152,6 @@ static int __init viocons_init2(void) | |||
1152 | viotty_driver = alloc_tty_driver(VTTY_PORTS); | 1152 | viotty_driver = alloc_tty_driver(VTTY_PORTS); |
1153 | viotty_driver->owner = THIS_MODULE; | 1153 | viotty_driver->owner = THIS_MODULE; |
1154 | viotty_driver->driver_name = "vioconsole"; | 1154 | viotty_driver->driver_name = "vioconsole"; |
1155 | viotty_driver->devfs_name = "vcs/"; | ||
1156 | viotty_driver->name = "tty"; | 1155 | viotty_driver->name = "tty"; |
1157 | viotty_driver->name_base = 1; | 1156 | viotty_driver->name_base = 1; |
1158 | viotty_driver->major = TTY_MAJOR; | 1157 | viotty_driver->major = TTY_MAJOR; |
diff --git a/drivers/char/viotape.c b/drivers/char/viotape.c index 11c7e9de5958..198f1505ae23 100644 --- a/drivers/char/viotape.c +++ b/drivers/char/viotape.c | |||
@@ -43,7 +43,6 @@ | |||
43 | #include <linux/dma-mapping.h> | 43 | #include <linux/dma-mapping.h> |
44 | #include <linux/fs.h> | 44 | #include <linux/fs.h> |
45 | #include <linux/cdev.h> | 45 | #include <linux/cdev.h> |
46 | #include <linux/devfs_fs_kernel.h> | ||
47 | #include <linux/major.h> | 46 | #include <linux/major.h> |
48 | #include <linux/completion.h> | 47 | #include <linux/completion.h> |
49 | #include <linux/proc_fs.h> | 48 | #include <linux/proc_fs.h> |
@@ -246,7 +245,6 @@ static struct device *tape_device[VIOTAPE_MAX_TAPE]; | |||
246 | */ | 245 | */ |
247 | static struct { | 246 | static struct { |
248 | unsigned char cur_part; | 247 | unsigned char cur_part; |
249 | int dev_handle; | ||
250 | unsigned char part_stat_rwi[MAX_PARTITIONS]; | 248 | unsigned char part_stat_rwi[MAX_PARTITIONS]; |
251 | } state[VIOTAPE_MAX_TAPE]; | 249 | } state[VIOTAPE_MAX_TAPE]; |
252 | 250 | ||
@@ -959,12 +957,7 @@ static int viotape_probe(struct vio_dev *vdev, const struct vio_device_id *id) | |||
959 | "iseries!vt%d", i); | 957 | "iseries!vt%d", i); |
960 | class_device_create(tape_class, NULL, MKDEV(VIOTAPE_MAJOR, i | 0x80), | 958 | class_device_create(tape_class, NULL, MKDEV(VIOTAPE_MAJOR, i | 0x80), |
961 | NULL, "iseries!nvt%d", i); | 959 | 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); | 960 | sprintf(tapename, "iseries/vt%d", i); |
967 | state[i].dev_handle = devfs_register_tape(tapename); | ||
968 | printk(VIOTAPE_KERN_INFO "tape %s is iSeries " | 961 | printk(VIOTAPE_KERN_INFO "tape %s is iSeries " |
969 | "resource %10.10s type %4.4s, model %3.3s\n", | 962 | "resource %10.10s type %4.4s, model %3.3s\n", |
970 | tapename, viotape_unitinfo[i].rsrcname, | 963 | tapename, viotape_unitinfo[i].rsrcname, |
@@ -976,9 +969,6 @@ static int viotape_remove(struct vio_dev *vdev) | |||
976 | { | 969 | { |
977 | int i = vdev->unit_address; | 970 | int i = vdev->unit_address; |
978 | 971 | ||
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)); | 972 | class_device_destroy(tape_class, MKDEV(VIOTAPE_MAJOR, i | 0x80)); |
983 | class_device_destroy(tape_class, MKDEV(VIOTAPE_MAJOR, i)); | 973 | class_device_destroy(tape_class, MKDEV(VIOTAPE_MAJOR, i)); |
984 | return 0; | 974 | return 0; |
diff --git a/drivers/char/vme_scc.c b/drivers/char/vme_scc.c index fd00822ac145..fe99fc1aba45 100644 --- a/drivers/char/vme_scc.c +++ b/drivers/char/vme_scc.c | |||
@@ -147,7 +147,6 @@ static int scc_init_drivers(void) | |||
147 | scc_driver->owner = THIS_MODULE; | 147 | scc_driver->owner = THIS_MODULE; |
148 | scc_driver->driver_name = "scc"; | 148 | scc_driver->driver_name = "scc"; |
149 | scc_driver->name = "ttyS"; | 149 | scc_driver->name = "ttyS"; |
150 | scc_driver->devfs_name = "tts/"; | ||
151 | scc_driver->major = TTY_MAJOR; | 150 | scc_driver->major = TTY_MAJOR; |
152 | scc_driver->minor_start = SCC_MINOR_BASE; | 151 | scc_driver->minor_start = SCC_MINOR_BASE; |
153 | scc_driver->type = TTY_DRIVER_TYPE_SERIAL; | 152 | scc_driver->type = TTY_DRIVER_TYPE_SERIAL; |
diff --git a/drivers/char/vr41xx_giu.c b/drivers/char/vr41xx_giu.c index 05e6e814d86f..073da48c092e 100644 --- a/drivers/char/vr41xx_giu.c +++ b/drivers/char/vr41xx_giu.c | |||
@@ -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 714d95ff2f1e..d6f65032649a 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> |
@@ -2663,7 +2662,6 @@ int __init vty_init(void) | |||
2663 | if (!console_driver) | 2662 | if (!console_driver) |
2664 | panic("Couldn't allocate console driver\n"); | 2663 | panic("Couldn't allocate console driver\n"); |
2665 | console_driver->owner = THIS_MODULE; | 2664 | console_driver->owner = THIS_MODULE; |
2666 | console_driver->devfs_name = "vc/"; | ||
2667 | console_driver->name = "tty"; | 2665 | console_driver->name = "tty"; |
2668 | console_driver->name_base = 1; | 2666 | console_driver->name_base = 1; |
2669 | console_driver->major = TTY_MAJOR; | 2667 | console_driver->major = TTY_MAJOR; |
diff --git a/drivers/char/watchdog/at91_wdt.c b/drivers/char/watchdog/at91_wdt.c index ac83bc4b019a..00080655533d 100644 --- a/drivers/char/watchdog/at91_wdt.c +++ b/drivers/char/watchdog/at91_wdt.c | |||
@@ -17,14 +17,15 @@ | |||
17 | #include <linux/miscdevice.h> | 17 | #include <linux/miscdevice.h> |
18 | #include <linux/module.h> | 18 | #include <linux/module.h> |
19 | #include <linux/moduleparam.h> | 19 | #include <linux/moduleparam.h> |
20 | #include <linux/platform_device.h> | ||
20 | #include <linux/types.h> | 21 | #include <linux/types.h> |
21 | #include <linux/watchdog.h> | 22 | #include <linux/watchdog.h> |
22 | #include <asm/bitops.h> | 23 | #include <asm/bitops.h> |
23 | #include <asm/uaccess.h> | 24 | #include <asm/uaccess.h> |
24 | 25 | ||
25 | 26 | ||
26 | #define WDT_DEFAULT_TIME 5 /* 5 seconds */ | 27 | #define WDT_DEFAULT_TIME 5 /* seconds */ |
27 | #define WDT_MAX_TIME 256 /* 256 seconds */ | 28 | #define WDT_MAX_TIME 256 /* seconds */ |
28 | 29 | ||
29 | static int wdt_time = WDT_DEFAULT_TIME; | 30 | static int wdt_time = WDT_DEFAULT_TIME; |
30 | static int nowayout = WATCHDOG_NOWAYOUT; | 31 | static int nowayout = WATCHDOG_NOWAYOUT; |
@@ -32,8 +33,10 @@ static int nowayout = WATCHDOG_NOWAYOUT; | |||
32 | module_param(wdt_time, int, 0); | 33 | module_param(wdt_time, int, 0); |
33 | MODULE_PARM_DESC(wdt_time, "Watchdog time in seconds. (default="__MODULE_STRING(WDT_DEFAULT_TIME) ")"); | 34 | MODULE_PARM_DESC(wdt_time, "Watchdog time in seconds. (default="__MODULE_STRING(WDT_DEFAULT_TIME) ")"); |
34 | 35 | ||
36 | #ifdef CONFIG_WATCHDOG_NOWAYOUT | ||
35 | module_param(nowayout, int, 0); | 37 | module_param(nowayout, int, 0); |
36 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | 38 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
39 | #endif | ||
37 | 40 | ||
38 | 41 | ||
39 | static unsigned long at91wdt_busy; | 42 | static unsigned long at91wdt_busy; |
@@ -138,7 +141,7 @@ static int at91_wdt_ioctl(struct inode *inode, struct file *file, | |||
138 | case WDIOC_SETTIMEOUT: | 141 | case WDIOC_SETTIMEOUT: |
139 | if (get_user(new_value, p)) | 142 | if (get_user(new_value, p)) |
140 | return -EFAULT; | 143 | return -EFAULT; |
141 | 144 | ||
142 | if (at91_wdt_settimeout(new_value)) | 145 | if (at91_wdt_settimeout(new_value)) |
143 | return -EINVAL; | 146 | return -EINVAL; |
144 | 147 | ||
@@ -196,27 +199,84 @@ static struct miscdevice at91wdt_miscdev = { | |||
196 | .fops = &at91wdt_fops, | 199 | .fops = &at91wdt_fops, |
197 | }; | 200 | }; |
198 | 201 | ||
199 | static int __init at91_wdt_init(void) | 202 | static int __init at91wdt_probe(struct platform_device *pdev) |
200 | { | 203 | { |
201 | int res; | 204 | int res; |
202 | 205 | ||
203 | /* Check that the heartbeat value is within range; if not reset to the default */ | 206 | if (at91wdt_miscdev.dev) |
204 | if (at91_wdt_settimeout(wdt_time)) { | 207 | return -EBUSY; |
205 | at91_wdt_settimeout(WDT_DEFAULT_TIME); | 208 | 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 | 209 | ||
209 | res = misc_register(&at91wdt_miscdev); | 210 | res = misc_register(&at91wdt_miscdev); |
210 | if (res) | 211 | if (res) |
211 | return res; | 212 | return res; |
212 | 213 | ||
213 | printk("AT91 Watchdog Timer enabled (%d seconds, nowayout=%d)\n", wdt_time, nowayout); | 214 | printk("AT91 Watchdog Timer enabled (%d seconds%s)\n", wdt_time, nowayout ? ", nowayout" : ""); |
214 | return 0; | 215 | return 0; |
215 | } | 216 | } |
216 | 217 | ||
218 | static int __exit at91wdt_remove(struct platform_device *pdev) | ||
219 | { | ||
220 | int res; | ||
221 | |||
222 | res = misc_deregister(&at91wdt_miscdev); | ||
223 | if (!res) | ||
224 | at91wdt_miscdev.dev = NULL; | ||
225 | |||
226 | return res; | ||
227 | } | ||
228 | |||
229 | static void at91wdt_shutdown(struct platform_device *pdev) | ||
230 | { | ||
231 | at91_wdt_stop(); | ||
232 | } | ||
233 | |||
234 | #ifdef CONFIG_PM | ||
235 | |||
236 | static int at91wdt_suspend(struct platform_device *pdev, pm_message_t message) | ||
237 | { | ||
238 | at91_wdt_stop(); | ||
239 | return 0; | ||
240 | } | ||
241 | |||
242 | static int at91wdt_resume(struct platform_device *pdev) | ||
243 | { | ||
244 | if (at91wdt_busy) | ||
245 | at91_wdt_start(); | ||
246 | return 0; | ||
247 | } | ||
248 | |||
249 | #else | ||
250 | #define at91wdt_suspend NULL | ||
251 | #define at91wdt_resume NULL | ||
252 | #endif | ||
253 | |||
254 | static struct platform_driver at91wdt_driver = { | ||
255 | .probe = at91wdt_probe, | ||
256 | .remove = __exit_p(at91wdt_remove), | ||
257 | .shutdown = at91wdt_shutdown, | ||
258 | .suspend = at91wdt_suspend, | ||
259 | .resume = at91wdt_resume, | ||
260 | .driver = { | ||
261 | .name = "at91_wdt", | ||
262 | .owner = THIS_MODULE, | ||
263 | }, | ||
264 | }; | ||
265 | |||
266 | static int __init at91_wdt_init(void) | ||
267 | { | ||
268 | /* Check that the heartbeat value is within range; if not reset to the default */ | ||
269 | if (at91_wdt_settimeout(wdt_time)) { | ||
270 | at91_wdt_settimeout(WDT_DEFAULT_TIME); | ||
271 | pr_info("at91_wdt: wdt_time value must be 1 <= wdt_time <= 256, using %d\n", wdt_time); | ||
272 | } | ||
273 | |||
274 | return platform_driver_register(&at91wdt_driver); | ||
275 | } | ||
276 | |||
217 | static void __exit at91_wdt_exit(void) | 277 | static void __exit at91_wdt_exit(void) |
218 | { | 278 | { |
219 | misc_deregister(&at91wdt_miscdev); | 279 | platform_driver_unregister(&at91wdt_driver); |
220 | } | 280 | } |
221 | 281 | ||
222 | module_init(at91_wdt_init); | 282 | module_init(at91_wdt_init); |
diff --git a/drivers/char/watchdog/i8xx_tco.c b/drivers/char/watchdog/i8xx_tco.c index fa2ba9ebe42a..bfbdbbf3c2f2 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 | } |
diff --git a/drivers/char/watchdog/pcwd_pci.c b/drivers/char/watchdog/pcwd_pci.c index 2451edbefece..1f40ecefbf72 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 | } |
diff --git a/drivers/char/watchdog/pcwd_usb.c b/drivers/char/watchdog/pcwd_usb.c index 3fdfda9324fa..0d072bed501d 100644 --- a/drivers/char/watchdog/pcwd_usb.c +++ b/drivers/char/watchdog/pcwd_usb.c | |||
@@ -317,6 +317,19 @@ static int usb_pcwd_get_temperature(struct usb_pcwd_private *usb_pcwd, int *temp | |||
317 | return 0; | 317 | return 0; |
318 | } | 318 | } |
319 | 319 | ||
320 | static int usb_pcwd_get_timeleft(struct usb_pcwd_private *usb_pcwd, int *time_left) | ||
321 | { | ||
322 | unsigned char msb, lsb; | ||
323 | |||
324 | /* Read the time that's left before rebooting */ | ||
325 | /* Note: if the board is not yet armed then we will read 0xFFFF */ | ||
326 | usb_pcwd_send_command(usb_pcwd, CMD_READ_WATCHDOG_TIMEOUT, &msb, &lsb); | ||
327 | |||
328 | *time_left = (msb << 8) + lsb; | ||
329 | |||
330 | return 0; | ||
331 | } | ||
332 | |||
320 | /* | 333 | /* |
321 | * /dev/watchdog handling | 334 | * /dev/watchdog handling |
322 | */ | 335 | */ |
@@ -422,6 +435,16 @@ static int usb_pcwd_ioctl(struct inode *inode, struct file *file, | |||
422 | case WDIOC_GETTIMEOUT: | 435 | case WDIOC_GETTIMEOUT: |
423 | return put_user(heartbeat, p); | 436 | return put_user(heartbeat, p); |
424 | 437 | ||
438 | case WDIOC_GETTIMELEFT: | ||
439 | { | ||
440 | int time_left; | ||
441 | |||
442 | if (usb_pcwd_get_timeleft(usb_pcwd_device, &time_left)) | ||
443 | return -EFAULT; | ||
444 | |||
445 | return put_user(time_left, p); | ||
446 | } | ||
447 | |||
425 | default: | 448 | default: |
426 | return -ENOIOCTLCMD; | 449 | return -ENOIOCTLCMD; |
427 | } | 450 | } |