···177177178178---------------------------179179180180+What: Unused EXPORT_SYMBOL/EXPORT_SYMBOL_GPL exports181181+ (temporary transition config option provided until then)182182+ The transition config option will also be removed at the same time.183183+When: before 2.6.19184184+Why: Unused symbols are both increasing the size of the kernel binary185185+ and are often a sign of "wrong API"186186+Who: Arjan van de Ven <arjan@linux.intel.com>187187+188188+---------------------------189189+180190What: remove EXPORT_SYMBOL(tasklist_lock)181191When: August 2006182192Files: kernel/fork.c
+2-71
Documentation/watchdog/pcwd-watchdog.txt
···2222 to run the program with an "&" to run it in the background!)23232424 If you want to write a program to be compatible with the PC Watchdog2525- driver, simply do the following:2525+ driver, simply use of modify the watchdog test program:2626+ Documentation/watchdog/src/watchdog-test.c26272727--- Snippet of code --2828-/*2929- * Watchdog Driver Test Program3030- */3131-3232-#include <stdio.h>3333-#include <stdlib.h>3434-#include <string.h>3535-#include <unistd.h>3636-#include <fcntl.h>3737-#include <sys/ioctl.h>3838-#include <linux/types.h>3939-#include <linux/watchdog.h>4040-4141-int fd;4242-4343-/*4444- * This function simply sends an IOCTL to the driver, which in turn ticks4545- * the PC Watchdog card to reset its internal timer so it doesn't trigger4646- * a computer reset.4747- */4848-void keep_alive(void)4949-{5050- int dummy;5151-5252- ioctl(fd, WDIOC_KEEPALIVE, &dummy);5353-}5454-5555-/*5656- * The main program. Run the program with "-d" to disable the card,5757- * or "-e" to enable the card.5858- */5959-int main(int argc, char *argv[])6060-{6161- fd = open("/dev/watchdog", O_WRONLY);6262-6363- if (fd == -1) {6464- fprintf(stderr, "Watchdog device not enabled.\n");6565- fflush(stderr);6666- exit(-1);6767- }6868-6969- if (argc > 1) {7070- if (!strncasecmp(argv[1], "-d", 2)) {7171- ioctl(fd, WDIOC_SETOPTIONS, WDIOS_DISABLECARD);7272- fprintf(stderr, "Watchdog card disabled.\n");7373- fflush(stderr);7474- exit(0);7575- } else if (!strncasecmp(argv[1], "-e", 2)) {7676- ioctl(fd, WDIOC_SETOPTIONS, WDIOS_ENABLECARD);7777- fprintf(stderr, "Watchdog card enabled.\n");7878- fflush(stderr);7979- exit(0);8080- } else {8181- fprintf(stderr, "-d to disable, -e to enable.\n");8282- fprintf(stderr, "run by itself to tick the card.\n");8383- fflush(stderr);8484- exit(0);8585- }8686- } else {8787- fprintf(stderr, "Watchdog Ticking Away!\n");8888- fflush(stderr);8989- }9090-9191- while(1) {9292- keep_alive();9393- sleep(1);9494- }9595-}9696--- End snippet --97289829 Other IOCTL functions include:9930
···11+/*22+ * Watchdog Driver Test Program33+ */44+55+#include <stdio.h>66+#include <stdlib.h>77+#include <string.h>88+#include <unistd.h>99+#include <fcntl.h>1010+#include <sys/ioctl.h>1111+#include <linux/types.h>1212+#include <linux/watchdog.h>1313+1414+int fd;1515+1616+/*1717+ * This function simply sends an IOCTL to the driver, which in turn ticks1818+ * the PC Watchdog card to reset its internal timer so it doesn't trigger1919+ * a computer reset.2020+ */2121+void keep_alive(void)2222+{2323+ int dummy;2424+2525+ ioctl(fd, WDIOC_KEEPALIVE, &dummy);2626+}2727+2828+/*2929+ * The main program. Run the program with "-d" to disable the card,3030+ * or "-e" to enable the card.3131+ */3232+int main(int argc, char *argv[])3333+{3434+ fd = open("/dev/watchdog", O_WRONLY);3535+3636+ if (fd == -1) {3737+ fprintf(stderr, "Watchdog device not enabled.\n");3838+ fflush(stderr);3939+ exit(-1);4040+ }4141+4242+ if (argc > 1) {4343+ if (!strncasecmp(argv[1], "-d", 2)) {4444+ ioctl(fd, WDIOC_SETOPTIONS, WDIOS_DISABLECARD);4545+ fprintf(stderr, "Watchdog card disabled.\n");4646+ fflush(stderr);4747+ exit(0);4848+ } else if (!strncasecmp(argv[1], "-e", 2)) {4949+ ioctl(fd, WDIOC_SETOPTIONS, WDIOS_ENABLECARD);5050+ fprintf(stderr, "Watchdog card enabled.\n");5151+ fflush(stderr);5252+ exit(0);5353+ } else {5454+ fprintf(stderr, "-d to disable, -e to enable.\n");5555+ fprintf(stderr, "run by itself to tick the card.\n");5656+ fflush(stderr);5757+ exit(0);5858+ }5959+ } else {6060+ fprintf(stderr, "Watchdog Ticking Away!\n");6161+ fflush(stderr);6262+ }6363+6464+ while(1) {6565+ keep_alive();6666+ sleep(1);6767+ }6868+}
+39-17
Documentation/watchdog/watchdog-api.txt
···3434the watchdog is pinged within a certain time, this time is called the3535timeout or margin. The simplest way to ping the watchdog is to write3636some data to the device. So a very simple watchdog daemon would look3737-like this:3838-3939-#include <stdlib.h>4040-#include <fcntl.h>4141-4242-int main(int argc, const char *argv[]) {4343- int fd=open("/dev/watchdog",O_WRONLY);4444- if (fd==-1) {4545- perror("watchdog");4646- exit(1);4747- }4848- while(1) {4949- write(fd, "\0", 1);5050- sleep(10);5151- }5252-}3737+like this source file: see Documentation/watchdog/src/watchdog-simple.c53385439A more advanced driver could for example check that a HTTP server is5540still responding before doing the write call to ping the watchdog.···95110 ioctl(fd, WDIOC_GETTIMEOUT, &timeout);96111 printf("The timeout was is %d seconds\n", timeout);971129898-Envinronmental monitoring:113113+Pretimeouts:114114+115115+Some watchdog timers can be set to have a trigger go off before the116116+actual time they will reset the system. This can be done with an NMI,117117+interrupt, or other mechanism. This allows Linux to record useful118118+information (like panic information and kernel coredumps) before it119119+resets.120120+121121+ pretimeout = 10;122122+ ioctl(fd, WDIOC_SETPRETIMEOUT, &pretimeout);123123+124124+Note that the pretimeout is the number of seconds before the time125125+when the timeout will go off. It is not the number of seconds until126126+the pretimeout. So, for instance, if you set the timeout to 60 seconds127127+and the pretimeout to 10 seconds, the pretimout will go of in 50128128+seconds. Setting a pretimeout to zero disables it.129129+130130+There is also a get function for getting the pretimeout:131131+132132+ ioctl(fd, WDIOC_GETPRETIMEOUT, &timeout);133133+ printf("The pretimeout was is %d seconds\n", timeout);134134+135135+Not all watchdog drivers will support a pretimeout.136136+137137+Get the number of seconds before reboot:138138+139139+Some watchdog drivers have the ability to report the remaining time140140+before the system will reboot. The WDIOC_GETTIMELEFT is the ioctl141141+that returns the number of seconds before reboot.142142+143143+ ioctl(fd, WDIOC_GETTIMELEFT, &timeleft);144144+ printf("The timeout was is %d seconds\n", timeleft);145145+146146+Environmental monitoring:99147100148All watchdog drivers are required return more information about the system,101149some do temperature, fan and power level monitoring, some can tell you···186168The watchdog saw a keepalive ping since it was last queried.187169188170 WDIOF_SETTIMEOUT Can set/get the timeout171171+172172+The watchdog can do pretimeouts.173173+174174+ WDIOF_PRETIMEOUT Pretimeout (in seconds), get/set189175190176191177For those drivers that return any bits set in the option field, the
+1-22
Documentation/watchdog/watchdog.txt
···6565Minor numbers are however allocated for it.666667676868-Example Watchdog Driver6969------------------------7070-7171-#include <stdio.h>7272-#include <unistd.h>7373-#include <fcntl.h>7474-7575-int main(int argc, const char *argv[])7676-{7777- int fd=open("/dev/watchdog",O_WRONLY);7878- if(fd==-1)7979- {8080- perror("watchdog");8181- exit(1);8282- }8383- while(1)8484- {8585- write(fd,"\0",1);8686- fsync(fd);8787- sleep(10);8888- }8989-}6868+Example Watchdog Driver: see Documentation/watchdog/src/watchdog-simple.c906991709271Contact Information
+9
arch/arm/Kconfig
···188188189189config ARCH_IOP3XX190190 bool "IOP3xx-based"191191+ depends on MMU191192 select PCI192193 help193194 Support for Intel's IOP3XX (XScale) family of processors.194195195196config ARCH_IXP4XX196197 bool "IXP4xx-based"198198+ depends on MMU197199 help198200 Support for Intel's IXP4XX (XScale) family of processors.199201200202config ARCH_IXP2000201203 bool "IXP2400/2800-based"204204+ depends on MMU202205 select PCI203206 help204207 Support for Intel's IXP2400/2800 (XScale) family of processors.205208206209config ARCH_IXP23XX207210 bool "IXP23XX-based"211211+ depends on MMU208212 select PCI209213 help210214 Support for Intel's IXP23xx (XScale) family of processors.···233229234230config ARCH_PXA235231 bool "PXA2xx-based"232232+ depends on MMU236233 select ARCH_MTD_XIP237234 help238235 Support for Intel's PXA2XX processor line.···343338 bool344339 depends on CPU_XSCALE && !XSCALE_PMU_TIMER345340 default y341341+342342+if !MMU343343+source "arch/arm/Kconfig-nommu"344344+endif346345347346endmenu348347
···9797 b 1007f98989999/*100100- * Fixup for LDMDB100100+ * Fixup for LDMDB. Note that this must not be in the fixup section.101101 */102102- .section .fixup,"ax"103103- .align 01041021007: ldr r0, =.Lbad105103 mov r1, frame106104 bl printk107105 ldmfd sp!, {r4 - r8, pc}108106 .ltorg109109- .previous110107111108 .section __ex_table,"a"112109 .align 3
+2-2
arch/arm/lib/clear_user.S
···12121313 .text14141515-/* Prototype: int __arch_clear_user(void *addr, size_t sz)1515+/* Prototype: int __clear_user(void *addr, size_t sz)1616 * Purpose : clear some user memory1717 * Params : addr - user memory address to clear1818 * : sz - number of bytes to clear1919 * Returns : number of bytes NOT cleared2020 */2121-ENTRY(__arch_clear_user)2121+ENTRY(__clear_user)2222 stmfd sp!, {r1, lr}2323 mov r2, #02424 cmp r1, #4
···2020 * returns the number of characters copied (strlen of copied string),2121 * -EFAULT on exception, or "len" if we fill the whole buffer2222 */2323-ENTRY(__arch_strncpy_from_user)2323+ENTRY(__strncpy_from_user)2424 mov ip, r125251: subs r2, r2, #12626USER( ldrplbt r3, [r1], #1)
+2-2
arch/arm/lib/strnlen_user.S
···1414 .text1515 .align 516161717-/* Prototype: unsigned long __arch_strnlen_user(const char *str, long n)1717+/* Prototype: unsigned long __strnlen_user(const char *str, long n)1818 * Purpose : get length of a string in user memory1919 * Params : str - address of string in user memory2020 * Returns : length of string *including terminator*2121 * or zero on exception, or n + 1 if too long2222 */2323-ENTRY(__arch_strnlen_user)2323+ENTRY(__strnlen_user)2424 mov r2, r025251:2626USER( ldrbt r3, [r0], #1)
+4-4
arch/arm/lib/uaccess.S
···19192020#define PAGE_SHIFT 1221212222-/* Prototype: int __arch_copy_to_user(void *to, const char *from, size_t n)2222+/* Prototype: int __copy_to_user(void *to, const char *from, size_t n)2323 * Purpose : copy a block to user memory from kernel memory2424 * Params : to - user memory2525 * : from - kernel memory···3939 sub r2, r2, ip4040 b .Lc2u_dest_aligned41414242-ENTRY(__arch_copy_to_user)4242+ENTRY(__copy_to_user)4343 stmfd sp!, {r2, r4 - r7, lr}4444 cmp r2, #44545 blt .Lc2u_not_enough···2832839001: ldmfd sp!, {r0, r4 - r7, pc}284284 .previous285285286286-/* Prototype: unsigned long __arch_copy_from_user(void *to,const void *from,unsigned long n);286286+/* Prototype: unsigned long __copy_from_user(void *to,const void *from,unsigned long n);287287 * Purpose : copy a block from user memory to kernel memory288288 * Params : to - kernel memory289289 * : from - user memory···302302 sub r2, r2, ip303303 b .Lcfu_dest_aligned304304305305-ENTRY(__arch_copy_from_user)305305+ENTRY(__copy_from_user)306306 stmfd sp!, {r0, r2, r4 - r7, lr}307307 cmp r2, #4308308 blt .Lcfu_not_enough
+11
arch/arm/mach-ep93xx/Kconfig
···2233menu "Cirrus EP93xx Implementation Options"4455+config CRUNCH66+ bool "Support for MaverickCrunch"77+ help88+ Enable kernel support for MaverickCrunch.99+510comment "EP93xx Platforms"1111+1212+config MACH_EDB93151313+ bool "Support Cirrus Logic EDB9315"1414+ help1515+ Say 'Y' here if you want your kernel to support the Cirrus1616+ Logic EDB9315 Evaluation Board.617718config MACH_GESBC9312819 bool "Support Glomation GESBC-9312-sx"
···88888989 if (type == IRQT_PROBE) {9090 /* Don't mess with enabled GPIOs using preconfigured edges or9191- GPIOs set to alternate function during probe */9292- if ((GPIO_IRQ_rising_edge[idx] | GPIO_IRQ_falling_edge[idx]) &9191+ GPIOs set to alternate function or to output during probe */9292+ if ((GPIO_IRQ_rising_edge[idx] | GPIO_IRQ_falling_edge[idx] | GPDR(gpio)) &9393 GPIO_bit(gpio))9494 return 0;9595 if (GAFR(gpio) & (0x3 << (((gpio) & 0xf)*2)))
···1515 select CPU_32v31616 select CPU_CACHE_V31717 select CPU_CACHE_VIVT1818- select CPU_COPY_V31919- select CPU_TLB_V31818+ select CPU_COPY_V3 if MMU1919+ select CPU_TLB_V3 if MMU2020 help2121 The ARM610 is the successor to the ARM3 processor2222 and was produced by VLSI Technology Inc.···3131 select CPU_32v33232 select CPU_CACHE_V33333 select CPU_CACHE_VIVT3434- select CPU_COPY_V33535- select CPU_TLB_V33434+ select CPU_COPY_V3 if MMU3535+ select CPU_TLB_V3 if MMU3636 help3737 A 32-bit RISC microprocessor based on the ARM7 processor core3838 designed by Advanced RISC Machines Ltd. The ARM710 is the···5050 select CPU_ABRT_LV4T5151 select CPU_CACHE_V45252 select CPU_CACHE_VIVT5353- select CPU_COPY_V4WT5454- select CPU_TLB_V4WT5353+ select CPU_COPY_V4WT if MMU5454+ select CPU_TLB_V4WT if MMU5555 help5656 A 32-bit RISC processor with 8kByte Cache, Write Buffer and5757 MMU built around an ARM7TDMI core.···6868 select CPU_ABRT_EV4T6969 select CPU_CACHE_V4WT7070 select CPU_CACHE_VIVT7171- select CPU_COPY_V4WB7272- select CPU_TLB_V4WBI7171+ select CPU_COPY_V4WB if MMU7272+ select CPU_TLB_V4WBI if MMU7373 help7474 The ARM920T is licensed to be produced by numerous vendors,7575 and is used in the Maverick EP9312 and the Samsung S3C2410.···8989 select CPU_ABRT_EV4T9090 select CPU_CACHE_V4WT9191 select CPU_CACHE_VIVT9292- select CPU_COPY_V4WB9393- select CPU_TLB_V4WBI9292+ select CPU_COPY_V4WB if MMU9393+ select CPU_TLB_V4WBI if MMU9494 help9595 The ARM922T is a version of the ARM920T, but with smaller9696 instruction and data caches. It is used in Altera's···108108 select CPU_ABRT_EV4T109109 select CPU_CACHE_V4WT110110 select CPU_CACHE_VIVT111111- select CPU_COPY_V4WB112112- select CPU_TLB_V4WBI111111+ select CPU_COPY_V4WB if MMU112112+ select CPU_TLB_V4WBI if MMU113113 help114114 The ARM925T is a mix between the ARM920T and ARM926T, but with115115 different instruction and data caches. It is used in TI's OMAP···126126 select CPU_32v5127127 select CPU_ABRT_EV5TJ128128 select CPU_CACHE_VIVT129129- select CPU_COPY_V4WB130130- select CPU_TLB_V4WBI129129+ select CPU_COPY_V4WB if MMU130130+ select CPU_TLB_V4WBI if MMU131131 help132132 This is a variant of the ARM920. It has slightly different133133 instruction sequences for cache and TLB operations. Curiously,···144144 select CPU_ABRT_EV4T145145 select CPU_CACHE_V4WT146146 select CPU_CACHE_VIVT147147- select CPU_COPY_V4WB148148- select CPU_TLB_V4WBI147147+ select CPU_COPY_V4WB if MMU148148+ select CPU_TLB_V4WBI if MMU149149 help150150 The ARM1020 is the 32K cached version of the ARM10 processor,151151 with an addition of a floating-point unit.···161161 select CPU_ABRT_EV4T162162 select CPU_CACHE_V4WT163163 select CPU_CACHE_VIVT164164- select CPU_COPY_V4WB165165- select CPU_TLB_V4WBI164164+ select CPU_COPY_V4WB if MMU165165+ select CPU_TLB_V4WBI if MMU166166 depends on n167167168168# ARM1022E···172172 select CPU_32v5173173 select CPU_ABRT_EV4T174174 select CPU_CACHE_VIVT175175- select CPU_COPY_V4WB # can probably do better176176- select CPU_TLB_V4WBI175175+ select CPU_COPY_V4WB if MMU # can probably do better176176+ select CPU_TLB_V4WBI if MMU177177 help178178 The ARM1022E is an implementation of the ARMv5TE architecture179179 based upon the ARM10 integer core with a 16KiB L1 Harvard cache,···189189 select CPU_32v5190190 select CPU_ABRT_EV5T # But need Jazelle, but EV5TJ ignores bit 10191191 select CPU_CACHE_VIVT192192- select CPU_COPY_V4WB # can probably do better193193- select CPU_TLB_V4WBI192192+ select CPU_COPY_V4WB if MMU # can probably do better193193+ select CPU_TLB_V4WBI if MMU194194 help195195 The ARM1026EJ-S is an implementation of the ARMv5TEJ architecture196196 based upon the ARM10 integer core.···207207 select CPU_ABRT_EV4208208 select CPU_CACHE_V4WB209209 select CPU_CACHE_VIVT210210- select CPU_COPY_V4WB211211- select CPU_TLB_V4WB210210+ select CPU_COPY_V4WB if MMU211211+ select CPU_TLB_V4WB if MMU212212 help213213 The Intel StrongARM(R) SA-110 is a 32-bit microprocessor and214214 is available at five speeds ranging from 100 MHz to 233 MHz.···227227 select CPU_ABRT_EV4228228 select CPU_CACHE_V4WB229229 select CPU_CACHE_VIVT230230- select CPU_TLB_V4WB230230+ select CPU_TLB_V4WB if MMU231231232232# XScale233233config CPU_XSCALE···237237 select CPU_32v5238238 select CPU_ABRT_EV5T239239 select CPU_CACHE_VIVT240240- select CPU_TLB_V4WBI240240+ select CPU_TLB_V4WBI if MMU241241242242# XScale Core Version 3243243config CPU_XSC3···247247 select CPU_32v5248248 select CPU_ABRT_EV5T249249 select CPU_CACHE_VIVT250250- select CPU_TLB_V4WBI250250+ select CPU_TLB_V4WBI if MMU251251 select IO_36252252253253# ARMv6···258258 select CPU_ABRT_EV6259259 select CPU_CACHE_V6260260 select CPU_CACHE_VIPT261261- select CPU_COPY_V6262262- select CPU_TLB_V6261261+ select CPU_COPY_V6 if MMU262262+ select CPU_TLB_V6 if MMU263263264264# ARMv6k265265config CPU_32v6K···277277# This defines the compiler instruction set which depends on the machine type.278278config CPU_32v3279279 bool280280- select TLS_REG_EMUL if SMP280280+ select TLS_REG_EMUL if SMP || !MMU281281 select NEEDS_SYSCALL_FOR_CMPXCHG if SMP282282283283config CPU_32v4284284 bool285285- select TLS_REG_EMUL if SMP285285+ select TLS_REG_EMUL if SMP || !MMU286286 select NEEDS_SYSCALL_FOR_CMPXCHG if SMP287287288288config CPU_32v5289289 bool290290- select TLS_REG_EMUL if SMP290290+ select TLS_REG_EMUL if SMP || !MMU291291 select NEEDS_SYSCALL_FOR_CMPXCHG if SMP292292293293config CPU_32v6···334334config CPU_CACHE_VIPT335335 bool336336337337+if MMU337338# The copy-page model338339config CPU_COPY_V3339340 bool···372371373372config CPU_TLB_V6374373 bool374374+375375+endif375376376377#377378# CPU supports 36-bit I/O
+8-2
arch/arm/mm/Makefile
···22# Makefile for the linux arm-specific parts of the memory manager.33#4455-obj-y := consistent.o extable.o fault-armv.o \66- fault.o flush.o init.o ioremap.o mmap.o \55+obj-y := consistent.o extable.o fault.o init.o \66+ iomap.o77+88+obj-$(CONFIG_MMU) += fault-armv.o flush.o ioremap.o mmap.o \79 mm-armv.o1010+1111+ifneq ($(CONFIG_MMU),y)1212+obj-y += nommu.o1313+endif814915obj-$(CONFIG_MODULES) += proc-syms.o1016
···998998 }99999910001000 /* Register for future delivery via notify registration */10011001- register_cpu_notifier(&palinfo_cpu_notifier);10011001+ register_hotcpu_notifier(&palinfo_cpu_notifier);1002100210031003 return 0;10041004}
+9-3
arch/ia64/sn/kernel/setup.c
···458458 * support here so we don't have to listen to failed keyboard probe459459 * messages.460460 */461461- if (version <= 0x0209 && acpi_kbd_controller_present) {461461+ if (is_shub1() && version <= 0x0209 && acpi_kbd_controller_present) {462462 printk(KERN_INFO "Disabling legacy keyboard support as prom "463463 "is too old and doesn't provide FADT\n");464464 acpi_kbd_controller_present = 0;···577577 int i;578578 static int wars_have_been_checked;579579580580- if (smp_processor_id() == 0 && IS_MEDUSA()) {580580+ cpuid = smp_processor_id();581581+ if (cpuid == 0 && IS_MEDUSA()) {581582 if (ia64_sn_is_fake_prom())582583 sn_prom_type = 2;583584 else···598597 sn_hub_info->as_shift = sn_hub_info->nasid_shift - 2;599598600599 /*600600+ * Don't check status. The SAL call is not supported on all PROMs601601+ * but a failure is harmless.602602+ */603603+ (void) ia64_sn_set_cpu_number(cpuid);604604+605605+ /*601606 * The boot cpu makes this call again after platform initialization is602607 * complete.603608 */···614607 if (ia64_sn_get_prom_feature_set(i, &sn_prom_features[i]) != 0)615608 break;616609617617- cpuid = smp_processor_id();618610 cpuphyid = get_sapicid();619611620612 if (ia64_sn_get_sapic_info(cpuphyid, &nasid, &subnode, &slice))
···540540541541endchoice542542543543+comment "ROM configuration"544544+545545+config ROM546546+ bool "Specify ROM linker regions"547547+ default n548548+ help549549+ Define a ROM region for the linker script. This creates a kernel550550+ that can be stored in flash, with possibly the text, and data551551+ regions being copied out to RAM at startup.552552+553553+config ROMBASE554554+ hex "Address of the base of ROM device"555555+ default "0"556556+ depends on ROM557557+ help558558+ Define the address that the ROM region starts at. Some platforms559559+ use this to set their chip select region accordingly for the boot560560+ device.561561+562562+config ROMVEC563563+ hex "Address of the base of the ROM vectors"564564+ default "0"565565+ depends on ROM566566+ help567567+ This is almost always the same as the base of the ROM. Since on all568568+ 68000 type varients the vectors are at the base of the boot device569569+ on system startup.570570+571571+config ROMVECSIZE572572+ hex "Size of ROM vector region (in bytes)"573573+ default "0x400"574574+ depends on ROM575575+ help576576+ Define the size of the vector region in ROM. For most 68000577577+ varients this would be 0x400 bytes in size. Set to 0 if you do578578+ not want a vector region at the start of the ROM.579579+580580+config ROMSTART581581+ hex "Address of the base of system image in ROM"582582+ default "0x400"583583+ depends on ROM584584+ help585585+ Define the start address of the system image in ROM. Commonly this586586+ is strait after the ROM vectors.587587+588588+config ROMSIZE589589+ hex "Size of the ROM device"590590+ default "0x100000"591591+ depends on ROM592592+ help593593+ Size of the ROM device. On some platforms this is used to setup594594+ the chip select that controls the boot ROM device.595595+543596choice544597 prompt "Kernel executes from"545598 ---help---
+6-60
arch/m68knommu/kernel/vmlinux.lds.S
···33 *44 * (C) Copyright 2002-2006, Greg Ungerer <gerg@snapgear.com>55 *66- * This ends up looking compilcated, because of the number of77- * address variations for ram and rom/flash layouts. The real88- * work of the linker script is all at the end, and reasonably99- * strait forward.66+ * This linker script is equiped to build either ROM loaded or RAM77+ * run kernels.108 */1191210#include <linux/config.h>1311#include <asm-generic/vmlinux.lds.h>1414-1515-/*1616- * Original Palm pilot (same for Xcopilot).1717- * There is really only a rom target for this.1818- */1919-#ifdef CONFIG_PILOT32020-#define ROMVEC_START 0x10c000002121-#define ROMVEC_LENGTH 0x104002222-#define ROM_START 0x10c104002323-#define ROM_LENGTH 0xfec002424-#define ROM_END 0x10d000002525-#define DATA_ADDR CONFIG_KERNELBASE2626-#endif2727-2828-/*2929- * Same setup on both the uCsimm and uCdimm.3030- */3131-#if defined(CONFIG_UCSIMM) || defined(CONFIG_UCDIMM)3232-#ifdef CONFIG_RAMKERNEL3333-#define ROMVEC_START 0x10c100003434-#define ROMVEC_LENGTH 0x4003535-#define ROM_START 0x10c104003636-#define ROM_LENGTH 0x1efc003737-#define ROM_END 0x10e000003838-#endif3939-#ifdef CONFIG_ROMKERNEL4040-#define ROMVEC_START 0x10c100004141-#define ROMVEC_LENGTH 0x4004242-#define ROM_START 0x10c104004343-#define ROM_LENGTH 0x1efc004444-#define ROM_END 0x10e000004545-#endif4646-#ifdef CONFIG_HIMEMKERNEL4747-#define ROMVEC_START 0x006000004848-#define ROMVEC_LENGTH 0x4004949-#define ROM_START 0x006004005050-#define ROM_LENGTH 0x1efc005151-#define ROM_END 0x007f00005252-#endif5353-#endif5454-5555-#ifdef CONFIG_UCQUICC5656-#define ROMVEC_START 0x000000005757-#define ROMVEC_LENGTH 0x4045858-#define ROM_START 0x000004045959-#define ROM_LENGTH 0x1ff6fc6060-#define ROM_END 0x002000006161-#endif62126313#if defined(CONFIG_RAMKERNEL)6414#define RAM_START CONFIG_KERNELBASE···2171#if defined(CONFIG_ROMKERNEL) || defined(CONFIG_HIMEMKERNEL)2272#define RAM_START CONFIG_RAMBASE2373#define RAM_LENGTH CONFIG_RAMSIZE7474+#define ROMVEC_START CONFIG_ROMVEC7575+#define ROMVEC_LENGTH CONFIG_ROMVECSIZE7676+#define ROM_START CONFIG_ROMSTART7777+#define ROM_LENGTH CONFIG_ROMSIZE2478#define TEXT rom2579#define DATA ram2680#define INIT ram···4490#ifdef ROM_START4591 romvec : ORIGIN = ROMVEC_START, LENGTH = ROMVEC_LENGTH4692 rom : ORIGIN = ROM_START, LENGTH = ROM_LENGTH4747- erom : ORIGIN = ROM_END, LENGTH = 04893#endif4994}5095···119166 . = ALIGN(4) ;120167 _etext = . ;121168 } > TEXT122122-123123-#ifdef ROM_END124124- . = ROM_END ;125125- .erom : {126126- __rom_end = . ;127127- } > erom128128-#endif129169130170 .data DATA_ADDR : {131171 . = ALIGN(4);
···5555#include <linux/mutex.h>5656#include <linux/kthread.h>5757#include <asm/irq.h>5858-#ifdef CONFIG_HIGH_RES_TIMERS5959-#include <linux/hrtime.h>6060-# if defined(schedule_next_int)6161-/* Old high-res timer code, do translations. */6262-# define get_arch_cycles(a) quick_update_jiffies_sub(a)6363-# define arch_cycles_per_jiffy cycles_per_jiffies6464-# endif6565-static inline void add_usec_to_timer(struct timer_list *t, long v)6666-{6767- t->arch_cycle_expires += nsec_to_arch_cycle(v * 1000);6868- while (t->arch_cycle_expires >= arch_cycles_per_jiffy)6969- {7070- t->expires++;7171- t->arch_cycle_expires -= arch_cycles_per_jiffy;7272- }7373-}7474-#endif7558#include <linux/interrupt.h>7659#include <linux/rcupdate.h>7760#include <linux/ipmi_smi.h>···225242{226243 return atomic_notifier_chain_register(&xaction_notifier_list, nb);227244}228228-229229-static void si_restart_short_timer(struct smi_info *smi_info);230245231246static void deliver_recv_msg(struct smi_info *smi_info,232247 struct ipmi_smi_msg *msg)···749768 && (smi_info->curr_msg == NULL))750769 {751770 start_next_msg(smi_info);752752- si_restart_short_timer(smi_info);753771 }754772 spin_unlock_irqrestore(&(smi_info->si_lock), flags);755773}···813833814834static int initialized = 0;815835816816-/* Must be called with interrupts off and with the si_lock held. */817817-static void si_restart_short_timer(struct smi_info *smi_info)818818-{819819-#if defined(CONFIG_HIGH_RES_TIMERS)820820- unsigned long flags;821821- unsigned long jiffies_now;822822- unsigned long seq;823823-824824- if (del_timer(&(smi_info->si_timer))) {825825- /* If we don't delete the timer, then it will go off826826- immediately, anyway. So we only process if we827827- actually delete the timer. */828828-829829- do {830830- seq = read_seqbegin_irqsave(&xtime_lock, flags);831831- jiffies_now = jiffies;832832- smi_info->si_timer.expires = jiffies_now;833833- smi_info->si_timer.arch_cycle_expires834834- = get_arch_cycles(jiffies_now);835835- } while (read_seqretry_irqrestore(&xtime_lock, seq, flags));836836-837837- add_usec_to_timer(&smi_info->si_timer, SI_SHORT_TIMEOUT_USEC);838838-839839- add_timer(&(smi_info->si_timer));840840- spin_lock_irqsave(&smi_info->count_lock, flags);841841- smi_info->timeout_restarts++;842842- spin_unlock_irqrestore(&smi_info->count_lock, flags);843843- }844844-#endif845845-}846846-847836static void smi_timeout(unsigned long data)848837{849838 struct smi_info *smi_info = (struct smi_info *) data;···853904 /* If the state machine asks for a short delay, then shorten854905 the timer timeout. */855906 if (smi_result == SI_SM_CALL_WITH_DELAY) {856856-#if defined(CONFIG_HIGH_RES_TIMERS)857857- unsigned long seq;858858-#endif859907 spin_lock_irqsave(&smi_info->count_lock, flags);860908 smi_info->short_timeouts++;861909 spin_unlock_irqrestore(&smi_info->count_lock, flags);862862-#if defined(CONFIG_HIGH_RES_TIMERS)863863- do {864864- seq = read_seqbegin_irqsave(&xtime_lock, flags);865865- smi_info->si_timer.expires = jiffies;866866- smi_info->si_timer.arch_cycle_expires867867- = get_arch_cycles(smi_info->si_timer.expires);868868- } while (read_seqretry_irqrestore(&xtime_lock, seq, flags));869869- add_usec_to_timer(&smi_info->si_timer, SI_SHORT_TIMEOUT_USEC);870870-#else871910 smi_info->si_timer.expires = jiffies + 1;872872-#endif873911 } else {874912 spin_lock_irqsave(&smi_info->count_lock, flags);875913 smi_info->long_timeouts++;876914 spin_unlock_irqrestore(&smi_info->count_lock, flags);877915 smi_info->si_timer.expires = jiffies + SI_TIMEOUT_JIFFIES;878878-#if defined(CONFIG_HIGH_RES_TIMERS)879879- smi_info->si_timer.arch_cycle_expires = 0;880880-#endif881916 }882917883918 do_add_timer:
+10-8
drivers/char/ipmi/ipmi_watchdog.c
···949949 /* Disable the WDT if we are shutting down. */950950 ipmi_watchdog_state = WDOG_TIMEOUT_NONE;951951 panic_halt_ipmi_set_timeout();952952- } else {952952+ } else if (ipmi_watchdog_state != WDOG_TIMEOUT_NONE) {953953 /* Set a long timer to let the reboot happens, but954954- reboot if it hangs. */954954+ reboot if it hangs, but only if the watchdog955955+ timer was already running. */955956 timeout = 120;956957 pretimeout = 0;957958 ipmi_watchdog_state = WDOG_TIMEOUT_RESET;···974973{975974 static int panic_event_handled = 0;976975977977- /* On a panic, if we have a panic timeout, make sure that the thing978978- reboots, even if it hangs during that panic. */979979- if (watchdog_user && !panic_event_handled) {980980- /* Make sure the panic doesn't hang, and make sure we981981- do this only once. */976976+ /* On a panic, if we have a panic timeout, make sure to extend977977+ the watchdog timer to a reasonable value to complete the978978+ panic, if the watchdog timer is running. Plus the979979+ pretimeout is meaningless at panic time. */980980+ if (watchdog_user && !panic_event_handled &&981981+ ipmi_watchdog_state != WDOG_TIMEOUT_NONE) {982982+ /* Make sure we do this only once. */982983 panic_event_handled = 1;983984984985 timeout = 255;985986 pretimeout = 0;986986- ipmi_watchdog_state = WDOG_TIMEOUT_RESET;987987 panic_halt_ipmi_set_timeout();988988 }989989
+665-1150
drivers/char/istallion.c
···4242#include <linux/devfs_fs_kernel.h>4343#include <linux/device.h>4444#include <linux/wait.h>4545+#include <linux/eisa.h>45464647#include <asm/io.h>4748#include <asm/uaccess.h>48494949-#ifdef CONFIG_PCI5050#include <linux/pci.h>5151-#endif52515352/*****************************************************************************/5453···136137137138static int stli_nrbrds = ARRAY_SIZE(stli_brdconf);138139140140+/* stli_lock must NOT be taken holding brd_lock */141141+static spinlock_t stli_lock; /* TTY logic lock */142142+static spinlock_t brd_lock; /* Board logic lock */143143+139144/*140145 * There is some experimental EISA board detection code in this driver.141146 * By default it is disabled, but for those that want to try it out,···176173177174static struct tty_driver *stli_serial;178175179179-/*180180- * We will need to allocate a temporary write buffer for chars that181181- * come direct from user space. The problem is that a copy from user182182- * space might cause a page fault (typically on a system that is183183- * swapping!). All ports will share one buffer - since if the system184184- * is already swapping a shared buffer won't make things any worse.185185- */186186-static char *stli_tmpwritebuf;187176188177#define STLI_TXBUFSIZE 4096189178···414419#endif415420416421static struct pci_device_id istallion_pci_tbl[] = {417417- { PCI_VENDOR_ID_STALLION, PCI_DEVICE_ID_ECRA, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },422422+ { PCI_DEVICE(PCI_VENDOR_ID_STALLION, PCI_DEVICE_ID_ECRA), },418423 { 0 }419424};420425MODULE_DEVICE_TABLE(pci, istallion_pci_tbl);···677682static ssize_t stli_memread(struct file *fp, char __user *buf, size_t count, loff_t *offp);678683static ssize_t stli_memwrite(struct file *fp, const char __user *buf, size_t count, loff_t *offp);679684static int stli_memioctl(struct inode *ip, struct file *fp, unsigned int cmd, unsigned long arg);680680-static void stli_brdpoll(stlibrd_t *brdp, volatile cdkhdr_t *hdrp);685685+static void stli_brdpoll(stlibrd_t *brdp, cdkhdr_t __iomem *hdrp);681686static void stli_poll(unsigned long arg);682687static int stli_hostcmd(stlibrd_t *brdp, stliport_t *portp);683688static int stli_initopen(stlibrd_t *brdp, stliport_t *portp);···688693static int stli_setport(stliport_t *portp);689694static int stli_cmdwait(stlibrd_t *brdp, stliport_t *portp, unsigned long cmd, void *arg, int size, int copyback);690695static void stli_sendcmd(stlibrd_t *brdp, stliport_t *portp, unsigned long cmd, void *arg, int size, int copyback);691691-static void stli_dodelaycmd(stliport_t *portp, volatile cdkctrl_t *cp);696696+static void __stli_sendcmd(stlibrd_t *brdp, stliport_t *portp, unsigned long cmd, void *arg, int size, int copyback);697697+static void stli_dodelaycmd(stliport_t *portp, cdkctrl_t __iomem *cp);692698static void stli_mkasyport(stliport_t *portp, asyport_t *pp, struct termios *tiosp);693699static void stli_mkasysigs(asysigs_t *sp, int dtr, int rts);694700static long stli_mktiocm(unsigned long sigvalue);···795799796800static int __init istallion_module_init(void)797801{798798- unsigned long flags;799799-800800-#ifdef DEBUG801801- printk("init_module()\n");802802-#endif803803-804804- save_flags(flags);805805- cli();806802 stli_init();807807- restore_flags(flags);808808-809809- return(0);803803+ return 0;810804}811805812806/*****************************************************************************/···805819{806820 stlibrd_t *brdp;807821 stliport_t *portp;808808- unsigned long flags;809822 int i, j;810810-811811-#ifdef DEBUG812812- printk("cleanup_module()\n");813813-#endif814823815824 printk(KERN_INFO "Unloading %s: version %s\n", stli_drvtitle,816825 stli_drvversion);817826818818- save_flags(flags);819819- cli();820820-821821-/*822822- * Free up all allocated resources used by the ports. This includes823823- * memory and interrupts.824824- */827827+ /*828828+ * Free up all allocated resources used by the ports. This includes829829+ * memory and interrupts.830830+ */825831 if (stli_timeron) {826832 stli_timeron = 0;827827- del_timer(&stli_timerlist);833833+ del_timer_sync(&stli_timerlist);828834 }829835830836 i = tty_unregister_driver(stli_serial);831837 if (i) {832838 printk("STALLION: failed to un-register tty driver, "833839 "errno=%d\n", -i);834834- restore_flags(flags);835840 return;836841 }837842 put_tty_driver(stli_serial);···836859 printk("STALLION: failed to un-register serial memory device, "837860 "errno=%d\n", -i);838861839839- kfree(stli_tmpwritebuf);840862 kfree(stli_txcookbuf);841863842864 for (i = 0; (i < stli_nrbrds); i++) {843843- if ((brdp = stli_brds[i]) == (stlibrd_t *) NULL)865865+ if ((brdp = stli_brds[i]) == NULL)844866 continue;845867 for (j = 0; (j < STL_MAXPORTS); j++) {846868 portp = brdp->ports[j];847847- if (portp != (stliport_t *) NULL) {848848- if (portp->tty != (struct tty_struct *) NULL)869869+ if (portp != NULL) {870870+ if (portp->tty != NULL)849871 tty_hangup(portp->tty);850872 kfree(portp);851873 }···854878 if (brdp->iosize > 0)855879 release_region(brdp->iobase, brdp->iosize);856880 kfree(brdp);857857- stli_brds[i] = (stlibrd_t *) NULL;881881+ stli_brds[i] = NULL;858882 }859859-860860- restore_flags(flags);861883}862884863885module_init(istallion_module_init);···869895870896static void stli_argbrds(void)871897{872872- stlconf_t conf;873873- stlibrd_t *brdp;874874- int i;875875-876876-#ifdef DEBUG877877- printk("stli_argbrds()\n");878878-#endif898898+ stlconf_t conf;899899+ stlibrd_t *brdp;900900+ int i;879901880902 for (i = stli_nrbrds; i < ARRAY_SIZE(stli_brdsp); i++) {881903 memset(&conf, 0, sizeof(conf));882904 if (stli_parsebrd(&conf, stli_brdsp[i]) == 0)883905 continue;884884- if ((brdp = stli_allocbrd()) == (stlibrd_t *) NULL)906906+ if ((brdp = stli_allocbrd()) == NULL)885907 continue;886908 stli_nrbrds = i + 1;887909 brdp->brdnr = i;···896926897927static unsigned long stli_atol(char *str)898928{899899- unsigned long val;900900- int base, c;901901- char *sp;929929+ unsigned long val;930930+ int base, c;931931+ char *sp;902932903933 val = 0;904934 sp = str;···932962933963static int stli_parsebrd(stlconf_t *confp, char **argp)934964{935935- char *sp;936936- int i;965965+ char *sp;966966+ int i;937967938938-#ifdef DEBUG939939- printk("stli_parsebrd(confp=%x,argp=%x)\n", (int) confp, (int) argp);940940-#endif941941-942942- if ((argp[0] == (char *) NULL) || (*argp[0] == 0))943943- return(0);968968+ if (argp[0] == NULL || *argp[0] == 0)969969+ return 0;944970945971 for (sp = argp[0], i = 0; ((*sp != 0) && (i < 25)); sp++, i++)946972 *sp = TOLOWER(*sp);···951985 }952986953987 confp->brdtype = stli_brdstr[i].type;954954- if ((argp[1] != (char *) NULL) && (*argp[1] != 0))988988+ if (argp[1] != NULL && *argp[1] != 0)955989 confp->ioaddr1 = stli_atol(argp[1]);956956- if ((argp[2] != (char *) NULL) && (*argp[2] != 0))990990+ if (argp[2] != NULL && *argp[2] != 0)957991 confp->memaddr = stli_atol(argp[2]);958992 return(1);959993}···964998965999static int stli_open(struct tty_struct *tty, struct file *filp)9661000{967967- stlibrd_t *brdp;968968- stliport_t *portp;969969- unsigned int minordev;970970- int brdnr, portnr, rc;971971-972972-#ifdef DEBUG973973- printk("stli_open(tty=%x,filp=%x): device=%s\n", (int) tty,974974- (int) filp, tty->name);975975-#endif10011001+ stlibrd_t *brdp;10021002+ stliport_t *portp;10031003+ unsigned int minordev;10041004+ int brdnr, portnr, rc;97610059771006 minordev = tty->index;9781007 brdnr = MINOR2BRD(minordev);9791008 if (brdnr >= stli_nrbrds)980980- return(-ENODEV);10091009+ return -ENODEV;9811010 brdp = stli_brds[brdnr];982982- if (brdp == (stlibrd_t *) NULL)983983- return(-ENODEV);10111011+ if (brdp == NULL)10121012+ return -ENODEV;9841013 if ((brdp->state & BST_STARTED) == 0)985985- return(-ENODEV);10141014+ return -ENODEV;9861015 portnr = MINOR2PORT(minordev);9871016 if ((portnr < 0) || (portnr > brdp->nrports))988988- return(-ENODEV);10171017+ return -ENODEV;98910189901019 portp = brdp->ports[portnr];991991- if (portp == (stliport_t *) NULL)992992- return(-ENODEV);10201020+ if (portp == NULL)10211021+ return -ENODEV;9931022 if (portp->devnr < 1)994994- return(-ENODEV);10231023+ return -ENODEV;995102499610259971026/*···9981037 if (portp->flags & ASYNC_CLOSING) {9991038 interruptible_sleep_on(&portp->close_wait);10001039 if (portp->flags & ASYNC_HUP_NOTIFY)10011001- return(-EAGAIN);10021002- return(-ERESTARTSYS);10401040+ return -EAGAIN;10411041+ return -ERESTARTSYS;10031042 }1004104310051044/*···10151054 wait_event_interruptible(portp->raw_wait,10161055 !test_bit(ST_INITIALIZING, &portp->state));10171056 if (signal_pending(current))10181018- return(-ERESTARTSYS);10571057+ return -ERESTARTSYS;1019105810201059 if ((portp->flags & ASYNC_INITIALIZED) == 0) {10211060 set_bit(ST_INITIALIZING, &portp->state);···10261065 clear_bit(ST_INITIALIZING, &portp->state);10271066 wake_up_interruptible(&portp->raw_wait);10281067 if (rc < 0)10291029- return(rc);10681068+ return rc;10301069 }1031107010321071/*···10381077 if (portp->flags & ASYNC_CLOSING) {10391078 interruptible_sleep_on(&portp->close_wait);10401079 if (portp->flags & ASYNC_HUP_NOTIFY)10411041- return(-EAGAIN);10421042- return(-ERESTARTSYS);10801080+ return -EAGAIN;10811081+ return -ERESTARTSYS;10431082 }1044108310451084/*···10491088 */10501089 if (!(filp->f_flags & O_NONBLOCK)) {10511090 if ((rc = stli_waitcarrier(brdp, portp, filp)) != 0)10521052- return(rc);10911091+ return rc;10531092 }10541093 portp->flags |= ASYNC_NORMAL_ACTIVE;10551055- return(0);10941094+ return 0;10561095}1057109610581097/*****************************************************************************/1059109810601099static void stli_close(struct tty_struct *tty, struct file *filp)10611100{10621062- stlibrd_t *brdp;10631063- stliport_t *portp;10641064- unsigned long flags;10651065-10661066-#ifdef DEBUG10671067- printk("stli_close(tty=%x,filp=%x)\n", (int) tty, (int) filp);10681068-#endif11011101+ stlibrd_t *brdp;11021102+ stliport_t *portp;11031103+ unsigned long flags;1069110410701105 portp = tty->driver_data;10711071- if (portp == (stliport_t *) NULL)11061106+ if (portp == NULL)10721107 return;1073110810741074- save_flags(flags);10751075- cli();11091109+ spin_lock_irqsave(&stli_lock, flags);10761110 if (tty_hung_up_p(filp)) {10771077- restore_flags(flags);11111111+ spin_unlock_irqrestore(&stli_lock, flags);10781112 return;10791113 }10801114 if ((tty->count == 1) && (portp->refcount != 1))10811115 portp->refcount = 1;10821116 if (portp->refcount-- > 1) {10831083- restore_flags(flags);11171117+ spin_unlock_irqrestore(&stli_lock, flags);10841118 return;10851119 }10861120···10901134 if (tty == stli_txcooktty)10911135 stli_flushchars(tty);10921136 tty->closing = 1;11371137+ spin_unlock_irqrestore(&stli_lock, flags);11381138+10931139 if (portp->closing_wait != ASYNC_CLOSING_WAIT_NONE)10941140 tty_wait_until_sent(tty, portp->closing_wait);10951141···11151157 stli_flushbuffer(tty);1116115811171159 tty->closing = 0;11181118- portp->tty = (struct tty_struct *) NULL;11601160+ portp->tty = NULL;1119116111201162 if (portp->openwaitcnt) {11211163 if (portp->close_delay)···1125116711261168 portp->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING);11271169 wake_up_interruptible(&portp->close_wait);11281128- restore_flags(flags);11291170}1130117111311172/*****************************************************************************/···1139118211401183static int stli_initopen(stlibrd_t *brdp, stliport_t *portp)11411184{11421142- struct tty_struct *tty;11431143- asynotify_t nt;11441144- asyport_t aport;11451145- int rc;11461146-11471147-#ifdef DEBUG11481148- printk("stli_initopen(brdp=%x,portp=%x)\n", (int) brdp, (int) portp);11491149-#endif11851185+ struct tty_struct *tty;11861186+ asynotify_t nt;11871187+ asyport_t aport;11881188+ int rc;1150118911511190 if ((rc = stli_rawopen(brdp, portp, 0, 1)) < 0)11521152- return(rc);11911191+ return rc;1153119211541193 memset(&nt, 0, sizeof(asynotify_t));11551194 nt.data = (DT_TXLOW | DT_TXEMPTY | DT_RXBUSY | DT_RXBREAK);11561195 nt.signal = SG_DCD;11571196 if ((rc = stli_cmdwait(brdp, portp, A_SETNOTIFY, &nt,11581197 sizeof(asynotify_t), 0)) < 0)11591159- return(rc);11981198+ return rc;1160119911611200 tty = portp->tty;11621162- if (tty == (struct tty_struct *) NULL)11631163- return(-ENODEV);12011201+ if (tty == NULL)12021202+ return -ENODEV;11641203 stli_mkasyport(portp, &aport, tty->termios);11651204 if ((rc = stli_cmdwait(brdp, portp, A_SETPORT, &aport,11661205 sizeof(asyport_t), 0)) < 0)11671167- return(rc);12061206+ return rc;1168120711691208 set_bit(ST_GETSIGS, &portp->state);11701209 if ((rc = stli_cmdwait(brdp, portp, A_GETSIGNALS, &portp->asig,11711210 sizeof(asysigs_t), 1)) < 0)11721172- return(rc);12111211+ return rc;11731212 if (test_and_clear_bit(ST_GETSIGS, &portp->state))11741213 portp->sigs = stli_mktiocm(portp->asig.sigvalue);11751214 stli_mkasysigs(&portp->asig, 1, 1);11761215 if ((rc = stli_cmdwait(brdp, portp, A_SETSIGNALS, &portp->asig,11771216 sizeof(asysigs_t), 0)) < 0)11781178- return(rc);12171217+ return rc;1179121811801180- return(0);12191219+ return 0;11811220}1182122111831222/*****************************************************************************/···1187123411881235static int stli_rawopen(stlibrd_t *brdp, stliport_t *portp, unsigned long arg, int wait)11891236{11901190- volatile cdkhdr_t *hdrp;11911191- volatile cdkctrl_t *cp;11921192- volatile unsigned char *bits;11931193- unsigned long flags;11941194- int rc;11951195-11961196-#ifdef DEBUG11971197- printk("stli_rawopen(brdp=%x,portp=%x,arg=%x,wait=%d)\n",11981198- (int) brdp, (int) portp, (int) arg, wait);11991199-#endif12371237+ cdkhdr_t __iomem *hdrp;12381238+ cdkctrl_t __iomem *cp;12391239+ unsigned char __iomem *bits;12401240+ unsigned long flags;12411241+ int rc;1200124212011243/*12021244 * Send a message to the slave to open this port.12031245 */12041204- save_flags(flags);12051205- cli();1206124612071247/*12081248 * Slave is already closing this port. This can happen if a hangup···12061260 wait_event_interruptible(portp->raw_wait,12071261 !test_bit(ST_CLOSING, &portp->state));12081262 if (signal_pending(current)) {12091209- restore_flags(flags);12101263 return -ERESTARTSYS;12111264 }12121265···12141269 * memory. Once the message is in set the service bits to say that12151270 * this port wants service.12161271 */12721272+ spin_lock_irqsave(&brd_lock, flags);12171273 EBRDENABLE(brdp);12181218- cp = &((volatile cdkasy_t *) EBRDGETMEMPTR(brdp, portp->addr))->ctrl;12191219- cp->openarg = arg;12201220- cp->open = 1;12211221- hdrp = (volatile cdkhdr_t *) EBRDGETMEMPTR(brdp, CDK_CDKADDR);12221222- bits = ((volatile unsigned char *) hdrp) + brdp->slaveoffset +12741274+ cp = &((cdkasy_t __iomem *) EBRDGETMEMPTR(brdp, portp->addr))->ctrl;12751275+ writel(arg, &cp->openarg);12761276+ writeb(1, &cp->open);12771277+ hdrp = (cdkhdr_t __iomem *) EBRDGETMEMPTR(brdp, CDK_CDKADDR);12781278+ bits = ((unsigned char __iomem *) hdrp) + brdp->slaveoffset +12231279 portp->portidx;12241224- *bits |= portp->portbit;12801280+ writeb(readb(bits) | portp->portbit, bits);12251281 EBRDDISABLE(brdp);1226128212271283 if (wait == 0) {12281228- restore_flags(flags);12291229- return(0);12841284+ spin_unlock_irqrestore(&brd_lock, flags);12851285+ return 0;12301286 }1231128712321288/*···12361290 */12371291 rc = 0;12381292 set_bit(ST_OPENING, &portp->state);12931293+ spin_unlock_irqrestore(&brd_lock, flags);12941294+12391295 wait_event_interruptible(portp->raw_wait,12401296 !test_bit(ST_OPENING, &portp->state));12411297 if (signal_pending(current))12421298 rc = -ERESTARTSYS;12431243- restore_flags(flags);1244129912451300 if ((rc == 0) && (portp->rc != 0))12461301 rc = -EIO;12471247- return(rc);13021302+ return rc;12481303}1249130412501305/*****************************************************************************/···1258131112591312static int stli_rawclose(stlibrd_t *brdp, stliport_t *portp, unsigned long arg, int wait)12601313{12611261- volatile cdkhdr_t *hdrp;12621262- volatile cdkctrl_t *cp;12631263- volatile unsigned char *bits;12641264- unsigned long flags;12651265- int rc;12661266-12671267-#ifdef DEBUG12681268- printk("stli_rawclose(brdp=%x,portp=%x,arg=%x,wait=%d)\n",12691269- (int) brdp, (int) portp, (int) arg, wait);12701270-#endif12711271-12721272- save_flags(flags);12731273- cli();13141314+ cdkhdr_t __iomem *hdrp;13151315+ cdkctrl_t __iomem *cp;13161316+ unsigned char __iomem *bits;13171317+ unsigned long flags;13181318+ int rc;1274131912751320/*12761321 * Slave is already closing this port. This can happen if a hangup···12721333 wait_event_interruptible(portp->raw_wait,12731334 !test_bit(ST_CLOSING, &portp->state));12741335 if (signal_pending(current)) {12751275- restore_flags(flags);12761336 return -ERESTARTSYS;12771337 }12781338 }···12791341/*12801342 * Write the close command into shared memory.12811343 */13441344+ spin_lock_irqsave(&brd_lock, flags);12821345 EBRDENABLE(brdp);12831283- cp = &((volatile cdkasy_t *) EBRDGETMEMPTR(brdp, portp->addr))->ctrl;12841284- cp->closearg = arg;12851285- cp->close = 1;12861286- hdrp = (volatile cdkhdr_t *) EBRDGETMEMPTR(brdp, CDK_CDKADDR);12871287- bits = ((volatile unsigned char *) hdrp) + brdp->slaveoffset +13461346+ cp = &((cdkasy_t __iomem *) EBRDGETMEMPTR(brdp, portp->addr))->ctrl;13471347+ writel(arg, &cp->closearg);13481348+ writeb(1, &cp->close);13491349+ hdrp = (cdkhdr_t __iomem *) EBRDGETMEMPTR(brdp, CDK_CDKADDR);13501350+ bits = ((unsigned char __iomem *) hdrp) + brdp->slaveoffset +12881351 portp->portidx;12891289- *bits |= portp->portbit;13521352+ writeb(readb(bits) |portp->portbit, bits);12901353 EBRDDISABLE(brdp);1291135412921355 set_bit(ST_CLOSING, &portp->state);12931293- if (wait == 0) {12941294- restore_flags(flags);12951295- return(0);12961296- }13561356+ spin_unlock_irqrestore(&brd_lock, flags);13571357+13581358+ if (wait == 0)13591359+ return 0;1297136012981361/*12991362 * Slave is in action, so now we must wait for the open acknowledgment···13051366 !test_bit(ST_CLOSING, &portp->state));13061367 if (signal_pending(current))13071368 rc = -ERESTARTSYS;13081308- restore_flags(flags);1309136913101370 if ((rc == 0) && (portp->rc != 0))13111371 rc = -EIO;13121312- return(rc);13721372+ return rc;13131373}1314137413151375/*****************************************************************************/···1322138413231385static int stli_cmdwait(stlibrd_t *brdp, stliport_t *portp, unsigned long cmd, void *arg, int size, int copyback)13241386{13251325- unsigned long flags;13261326-13271327-#ifdef DEBUG13281328- printk("stli_cmdwait(brdp=%x,portp=%x,cmd=%x,arg=%x,size=%d,"13291329- "copyback=%d)\n", (int) brdp, (int) portp, (int) cmd,13301330- (int) arg, size, copyback);13311331-#endif13321332-13331333- save_flags(flags);13341334- cli();13351387 wait_event_interruptible(portp->raw_wait,13361388 !test_bit(ST_CMDING, &portp->state));13371337- if (signal_pending(current)) {13381338- restore_flags(flags);13891389+ if (signal_pending(current))13391390 return -ERESTARTSYS;13401340- }1341139113421392 stli_sendcmd(brdp, portp, cmd, arg, size, copyback);1343139313441394 wait_event_interruptible(portp->raw_wait,13451395 !test_bit(ST_CMDING, &portp->state));13461346- if (signal_pending(current)) {13471347- restore_flags(flags);13961396+ if (signal_pending(current))13481397 return -ERESTARTSYS;13491349- }13501350- restore_flags(flags);1351139813521399 if (portp->rc != 0)13531353- return(-EIO);13541354- return(0);14001400+ return -EIO;14011401+ return 0;13551402}1356140313571404/*****************************************************************************/···1348142513491426static int stli_setport(stliport_t *portp)13501427{13511351- stlibrd_t *brdp;13521352- asyport_t aport;14281428+ stlibrd_t *brdp;14291429+ asyport_t aport;1353143013541354-#ifdef DEBUG13551355- printk("stli_setport(portp=%x)\n", (int) portp);13561356-#endif13571357-13581358- if (portp == (stliport_t *) NULL)13591359- return(-ENODEV);13601360- if (portp->tty == (struct tty_struct *) NULL)13611361- return(-ENODEV);13621362- if ((portp->brdnr < 0) && (portp->brdnr >= stli_nrbrds))13631363- return(-ENODEV);14311431+ if (portp == NULL)14321432+ return -ENODEV;14331433+ if (portp->tty == NULL)14341434+ return -ENODEV;14351435+ if (portp->brdnr < 0 && portp->brdnr >= stli_nrbrds)14361436+ return -ENODEV;13641437 brdp = stli_brds[portp->brdnr];13651365- if (brdp == (stlibrd_t *) NULL)13661366- return(-ENODEV);14381438+ if (brdp == NULL)14391439+ return -ENODEV;1367144013681441 stli_mkasyport(portp, &aport, portp->tty->termios);13691442 return(stli_cmdwait(brdp, portp, A_SETPORT, &aport, sizeof(asyport_t), 0));···1374145513751456static int stli_waitcarrier(stlibrd_t *brdp, stliport_t *portp, struct file *filp)13761457{13771377- unsigned long flags;13781378- int rc, doclocal;13791379-13801380-#ifdef DEBUG13811381- printk("stli_waitcarrier(brdp=%x,portp=%x,filp=%x)\n",13821382- (int) brdp, (int) portp, (int) filp);13831383-#endif14581458+ unsigned long flags;14591459+ int rc, doclocal;1384146013851461 rc = 0;13861462 doclocal = 0;···13831469 if (portp->tty->termios->c_cflag & CLOCAL)13841470 doclocal++;1385147113861386- save_flags(flags);13871387- cli();14721472+ spin_lock_irqsave(&stli_lock, flags);13881473 portp->openwaitcnt++;13891474 if (! tty_hung_up_p(filp))13901475 portp->refcount--;14761476+ spin_unlock_irqrestore(&stli_lock, flags);1391147713921478 for (;;) {13931479 stli_mkasysigs(&portp->asig, 1, 1);···14131499 interruptible_sleep_on(&portp->open_wait);14141500 }1415150115021502+ spin_lock_irqsave(&stli_lock, flags);14161503 if (! tty_hung_up_p(filp))14171504 portp->refcount++;14181505 portp->openwaitcnt--;14191419- restore_flags(flags);15061506+ spin_unlock_irqrestore(&stli_lock, flags);1420150714211421- return(rc);15081508+ return rc;14221509}1423151014241511/*****************************************************************************/···1432151714331518static int stli_write(struct tty_struct *tty, const unsigned char *buf, int count)14341519{14351435- volatile cdkasy_t *ap;14361436- volatile cdkhdr_t *hdrp;14371437- volatile unsigned char *bits;14381438- unsigned char *shbuf, *chbuf;14391439- stliport_t *portp;14401440- stlibrd_t *brdp;14411441- unsigned int len, stlen, head, tail, size;14421442- unsigned long flags;15201520+ cdkasy_t __iomem *ap;15211521+ cdkhdr_t __iomem *hdrp;15221522+ unsigned char __iomem *bits;15231523+ unsigned char __iomem *shbuf;15241524+ unsigned char *chbuf;15251525+ stliport_t *portp;15261526+ stlibrd_t *brdp;15271527+ unsigned int len, stlen, head, tail, size;15281528+ unsigned long flags;1443152914441444-#ifdef DEBUG14451445- printk("stli_write(tty=%x,buf=%x,count=%d)\n",14461446- (int) tty, (int) buf, count);14471447-#endif14481448-14491449- if ((tty == (struct tty_struct *) NULL) ||14501450- (stli_tmpwritebuf == (char *) NULL))14511451- return(0);14521530 if (tty == stli_txcooktty)14531531 stli_flushchars(tty);14541532 portp = tty->driver_data;14551455- if (portp == (stliport_t *) NULL)14561456- return(0);15331533+ if (portp == NULL)15341534+ return 0;14571535 if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds))14581458- return(0);15361536+ return 0;14591537 brdp = stli_brds[portp->brdnr];14601460- if (brdp == (stlibrd_t *) NULL)14611461- return(0);15381538+ if (brdp == NULL)15391539+ return 0;14621540 chbuf = (unsigned char *) buf;1463154114641542/*14651543 * All data is now local, shove as much as possible into shared memory.14661544 */14671467- save_flags(flags);14681468- cli();15451545+ spin_lock_irqsave(&brd_lock, flags);14691546 EBRDENABLE(brdp);14701470- ap = (volatile cdkasy_t *) EBRDGETMEMPTR(brdp, portp->addr);14711471- head = (unsigned int) ap->txq.head;14721472- tail = (unsigned int) ap->txq.tail;14731473- if (tail != ((unsigned int) ap->txq.tail))14741474- tail = (unsigned int) ap->txq.tail;15471547+ ap = (cdkasy_t __iomem *) EBRDGETMEMPTR(brdp, portp->addr);15481548+ head = (unsigned int) readw(&ap->txq.head);15491549+ tail = (unsigned int) readw(&ap->txq.tail);15501550+ if (tail != ((unsigned int) readw(&ap->txq.tail)))15511551+ tail = (unsigned int) readw(&ap->txq.tail);14751552 size = portp->txsize;14761553 if (head >= tail) {14771554 len = size - (head - tail) - 1;···1475156814761569 len = MIN(len, count);14771570 count = 0;14781478- shbuf = (char *) EBRDGETMEMPTR(brdp, portp->txoffset);15711571+ shbuf = (char __iomem *) EBRDGETMEMPTR(brdp, portp->txoffset);1479157214801573 while (len > 0) {14811574 stlen = MIN(len, stlen);14821482- memcpy((shbuf + head), chbuf, stlen);15751575+ memcpy_toio(shbuf + head, chbuf, stlen);14831576 chbuf += stlen;14841577 len -= stlen;14851578 count += stlen;···14901583 }14911584 }1492158514931493- ap = (volatile cdkasy_t *) EBRDGETMEMPTR(brdp, portp->addr);14941494- ap->txq.head = head;15861586+ ap = (cdkasy_t __iomem *) EBRDGETMEMPTR(brdp, portp->addr);15871587+ writew(head, &ap->txq.head);14951588 if (test_bit(ST_TXBUSY, &portp->state)) {14961496- if (ap->changed.data & DT_TXEMPTY)14971497- ap->changed.data &= ~DT_TXEMPTY;15891589+ if (readl(&ap->changed.data) & DT_TXEMPTY)15901590+ writel(readl(&ap->changed.data) & ~DT_TXEMPTY, &ap->changed.data);14981591 }14991499- hdrp = (volatile cdkhdr_t *) EBRDGETMEMPTR(brdp, CDK_CDKADDR);15001500- bits = ((volatile unsigned char *) hdrp) + brdp->slaveoffset +15921592+ hdrp = (cdkhdr_t __iomem *) EBRDGETMEMPTR(brdp, CDK_CDKADDR);15931593+ bits = ((unsigned char __iomem *) hdrp) + brdp->slaveoffset +15011594 portp->portidx;15021502- *bits |= portp->portbit;15951595+ writeb(readb(bits) | portp->portbit, bits);15031596 set_bit(ST_TXBUSY, &portp->state);15041597 EBRDDISABLE(brdp);15051505-15061506- restore_flags(flags);15981598+ spin_unlock_irqrestore(&brd_lock, flags);1507159915081600 return(count);15091601}···1519161315201614static void stli_putchar(struct tty_struct *tty, unsigned char ch)15211615{15221522-#ifdef DEBUG15231523- printk("stli_putchar(tty=%x,ch=%x)\n", (int) tty, (int) ch);15241524-#endif15251525-15261526- if (tty == (struct tty_struct *) NULL)15271527- return;15281616 if (tty != stli_txcooktty) {15291529- if (stli_txcooktty != (struct tty_struct *) NULL)16171617+ if (stli_txcooktty != NULL)15301618 stli_flushchars(stli_txcooktty);15311619 stli_txcooktty = tty;15321620 }···1540164015411641static void stli_flushchars(struct tty_struct *tty)15421642{15431543- volatile cdkhdr_t *hdrp;15441544- volatile unsigned char *bits;15451545- volatile cdkasy_t *ap;15461546- struct tty_struct *cooktty;15471547- stliport_t *portp;15481548- stlibrd_t *brdp;15491549- unsigned int len, stlen, head, tail, size, count, cooksize;15501550- unsigned char *buf, *shbuf;15511551- unsigned long flags;15521552-15531553-#ifdef DEBUG15541554- printk("stli_flushchars(tty=%x)\n", (int) tty);15551555-#endif16431643+ cdkhdr_t __iomem *hdrp;16441644+ unsigned char __iomem *bits;16451645+ cdkasy_t __iomem *ap;16461646+ struct tty_struct *cooktty;16471647+ stliport_t *portp;16481648+ stlibrd_t *brdp;16491649+ unsigned int len, stlen, head, tail, size, count, cooksize;16501650+ unsigned char *buf;16511651+ unsigned char __iomem *shbuf;16521652+ unsigned long flags;1556165315571654 cooksize = stli_txcooksize;15581655 cooktty = stli_txcooktty;15591656 stli_txcooksize = 0;15601657 stli_txcookrealsize = 0;15611561- stli_txcooktty = (struct tty_struct *) NULL;16581658+ stli_txcooktty = NULL;1562165915631563- if (tty == (struct tty_struct *) NULL)16601660+ if (tty == NULL)15641661 return;15651565- if (cooktty == (struct tty_struct *) NULL)16621662+ if (cooktty == NULL)15661663 return;15671664 if (tty != cooktty)15681665 tty = cooktty;···15671670 return;1568167115691672 portp = tty->driver_data;15701570- if (portp == (stliport_t *) NULL)16731673+ if (portp == NULL)15711674 return;15721675 if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds))15731676 return;15741677 brdp = stli_brds[portp->brdnr];15751575- if (brdp == (stlibrd_t *) NULL)16781678+ if (brdp == NULL)15761679 return;1577168015781578- save_flags(flags);15791579- cli();16811681+ spin_lock_irqsave(&brd_lock, flags);15801682 EBRDENABLE(brdp);1581168315821582- ap = (volatile cdkasy_t *) EBRDGETMEMPTR(brdp, portp->addr);15831583- head = (unsigned int) ap->txq.head;15841584- tail = (unsigned int) ap->txq.tail;15851585- if (tail != ((unsigned int) ap->txq.tail))15861586- tail = (unsigned int) ap->txq.tail;16841684+ ap = (cdkasy_t __iomem *) EBRDGETMEMPTR(brdp, portp->addr);16851685+ head = (unsigned int) readw(&ap->txq.head);16861686+ tail = (unsigned int) readw(&ap->txq.tail);16871687+ if (tail != ((unsigned int) readw(&ap->txq.tail)))16881688+ tail = (unsigned int) readw(&ap->txq.tail);15871689 size = portp->txsize;15881690 if (head >= tail) {15891691 len = size - (head - tail) - 1;···1599170316001704 while (len > 0) {16011705 stlen = MIN(len, stlen);16021602- memcpy((shbuf + head), buf, stlen);17061706+ memcpy_toio(shbuf + head, buf, stlen);16031707 buf += stlen;16041708 len -= stlen;16051709 count += stlen;···16101714 }16111715 }1612171616131613- ap = (volatile cdkasy_t *) EBRDGETMEMPTR(brdp, portp->addr);16141614- ap->txq.head = head;17171717+ ap = (cdkasy_t __iomem *) EBRDGETMEMPTR(brdp, portp->addr);17181718+ writew(head, &ap->txq.head);1615171916161720 if (test_bit(ST_TXBUSY, &portp->state)) {16171617- if (ap->changed.data & DT_TXEMPTY)16181618- ap->changed.data &= ~DT_TXEMPTY;17211721+ if (readl(&ap->changed.data) & DT_TXEMPTY)17221722+ writel(readl(&ap->changed.data) & ~DT_TXEMPTY, &ap->changed.data);16191723 }16201620- hdrp = (volatile cdkhdr_t *) EBRDGETMEMPTR(brdp, CDK_CDKADDR);16211621- bits = ((volatile unsigned char *) hdrp) + brdp->slaveoffset +17241724+ hdrp = (cdkhdr_t __iomem *) EBRDGETMEMPTR(brdp, CDK_CDKADDR);17251725+ bits = ((unsigned char __iomem *) hdrp) + brdp->slaveoffset +16221726 portp->portidx;16231623- *bits |= portp->portbit;17271727+ writeb(readb(bits) | portp->portbit, bits);16241728 set_bit(ST_TXBUSY, &portp->state);1625172916261730 EBRDDISABLE(brdp);16271627- restore_flags(flags);17311731+ spin_unlock_irqrestore(&brd_lock, flags);16281732}1629173316301734/*****************************************************************************/1631173516321736static int stli_writeroom(struct tty_struct *tty)16331737{16341634- volatile cdkasyrq_t *rp;16351635- stliport_t *portp;16361636- stlibrd_t *brdp;16371637- unsigned int head, tail, len;16381638- unsigned long flags;17381738+ cdkasyrq_t __iomem *rp;17391739+ stliport_t *portp;17401740+ stlibrd_t *brdp;17411741+ unsigned int head, tail, len;17421742+ unsigned long flags;1639174316401640-#ifdef DEBUG16411641- printk("stli_writeroom(tty=%x)\n", (int) tty);16421642-#endif16431643-16441644- if (tty == (struct tty_struct *) NULL)16451645- return(0);16461744 if (tty == stli_txcooktty) {16471745 if (stli_txcookrealsize != 0) {16481746 len = stli_txcookrealsize - stli_txcooksize;16491649- return(len);17471747+ return len;16501748 }16511749 }1652175016531751 portp = tty->driver_data;16541654- if (portp == (stliport_t *) NULL)16551655- return(0);17521752+ if (portp == NULL)17531753+ return 0;16561754 if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds))16571657- return(0);17551755+ return 0;16581756 brdp = stli_brds[portp->brdnr];16591659- if (brdp == (stlibrd_t *) NULL)16601660- return(0);17571757+ if (brdp == NULL)17581758+ return 0;1661175916621662- save_flags(flags);16631663- cli();17601760+ spin_lock_irqsave(&brd_lock, flags);16641761 EBRDENABLE(brdp);16651665- rp = &((volatile cdkasy_t *) EBRDGETMEMPTR(brdp, portp->addr))->txq;16661666- head = (unsigned int) rp->head;16671667- tail = (unsigned int) rp->tail;16681668- if (tail != ((unsigned int) rp->tail))16691669- tail = (unsigned int) rp->tail;17621762+ rp = &((cdkasy_t __iomem *) EBRDGETMEMPTR(brdp, portp->addr))->txq;17631763+ head = (unsigned int) readw(&rp->head);17641764+ tail = (unsigned int) readw(&rp->tail);17651765+ if (tail != ((unsigned int) readw(&rp->tail)))17661766+ tail = (unsigned int) readw(&rp->tail);16701767 len = (head >= tail) ? (portp->txsize - (head - tail)) : (tail - head);16711768 len--;16721769 EBRDDISABLE(brdp);16731673- restore_flags(flags);17701770+ spin_unlock_irqrestore(&brd_lock, flags);1674177116751772 if (tty == stli_txcooktty) {16761773 stli_txcookrealsize = len;16771774 len -= stli_txcooksize;16781775 }16791679- return(len);17761776+ return len;16801777}1681177816821779/*****************************************************************************/···1684179516851796static int stli_charsinbuffer(struct tty_struct *tty)16861797{16871687- volatile cdkasyrq_t *rp;16881688- stliport_t *portp;16891689- stlibrd_t *brdp;16901690- unsigned int head, tail, len;16911691- unsigned long flags;17981798+ cdkasyrq_t __iomem *rp;17991799+ stliport_t *portp;18001800+ stlibrd_t *brdp;18011801+ unsigned int head, tail, len;18021802+ unsigned long flags;1692180316931693-#ifdef DEBUG16941694- printk("stli_charsinbuffer(tty=%x)\n", (int) tty);16951695-#endif16961696-16971697- if (tty == (struct tty_struct *) NULL)16981698- return(0);16991804 if (tty == stli_txcooktty)17001805 stli_flushchars(tty);17011806 portp = tty->driver_data;17021702- if (portp == (stliport_t *) NULL)17031703- return(0);18071807+ if (portp == NULL)18081808+ return 0;17041809 if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds))17051705- return(0);18101810+ return 0;17061811 brdp = stli_brds[portp->brdnr];17071707- if (brdp == (stlibrd_t *) NULL)17081708- return(0);18121812+ if (brdp == NULL)18131813+ return 0;1709181417101710- save_flags(flags);17111711- cli();18151815+ spin_lock_irqsave(&brd_lock, flags);17121816 EBRDENABLE(brdp);17131713- rp = &((volatile cdkasy_t *) EBRDGETMEMPTR(brdp, portp->addr))->txq;17141714- head = (unsigned int) rp->head;17151715- tail = (unsigned int) rp->tail;17161716- if (tail != ((unsigned int) rp->tail))17171717- tail = (unsigned int) rp->tail;18171817+ rp = &((cdkasy_t __iomem *) EBRDGETMEMPTR(brdp, portp->addr))->txq;18181818+ head = (unsigned int) readw(&rp->head);18191819+ tail = (unsigned int) readw(&rp->tail);18201820+ if (tail != ((unsigned int) readw(&rp->tail)))18211821+ tail = (unsigned int) readw(&rp->tail);17181822 len = (head >= tail) ? (head - tail) : (portp->txsize - (tail - head));17191823 if ((len == 0) && test_bit(ST_TXBUSY, &portp->state))17201824 len = 1;17211825 EBRDDISABLE(brdp);17221722- restore_flags(flags);18261826+ spin_unlock_irqrestore(&brd_lock, flags);1723182717241724- return(len);18281828+ return len;17251829}1726183017271831/*****************************************************************************/···1725184317261844static int stli_getserial(stliport_t *portp, struct serial_struct __user *sp)17271845{17281728- struct serial_struct sio;17291729- stlibrd_t *brdp;17301730-17311731-#ifdef DEBUG17321732- printk("stli_getserial(portp=%x,sp=%x)\n", (int) portp, (int) sp);17331733-#endif18461846+ struct serial_struct sio;18471847+ stlibrd_t *brdp;1734184817351849 memset(&sio, 0, sizeof(struct serial_struct));17361850 sio.type = PORT_UNKNOWN;···17411863 sio.hub6 = 0;1742186417431865 brdp = stli_brds[portp->brdnr];17441744- if (brdp != (stlibrd_t *) NULL)18661866+ if (brdp != NULL)17451867 sio.port = brdp->iobase;1746186817471869 return copy_to_user(sp, &sio, sizeof(struct serial_struct)) ?···1758188017591881static int stli_setserial(stliport_t *portp, struct serial_struct __user *sp)17601882{17611761- struct serial_struct sio;17621762- int rc;17631763-17641764-#ifdef DEBUG17651765- printk("stli_setserial(portp=%p,sp=%p)\n", portp, sp);17661766-#endif18831883+ struct serial_struct sio;18841884+ int rc;1767188517681886 if (copy_from_user(&sio, sp, sizeof(struct serial_struct)))17691887 return -EFAULT;···17681894 (sio.close_delay != portp->close_delay) ||17691895 ((sio.flags & ~ASYNC_USR_MASK) !=17701896 (portp->flags & ~ASYNC_USR_MASK)))17711771- return(-EPERM);18971897+ return -EPERM;17721898 } 1773189917741900 portp->flags = (portp->flags & ~ASYNC_USR_MASK) |···17791905 portp->custom_divisor = sio.custom_divisor;1780190617811907 if ((rc = stli_setport(portp)) < 0)17821782- return(rc);17831783- return(0);19081908+ return rc;19091909+ return 0;17841910}1785191117861912/*****************************************************************************/···17911917 stlibrd_t *brdp;17921918 int rc;1793191917941794- if (portp == (stliport_t *) NULL)17951795- return(-ENODEV);17961796- if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds))17971797- return(0);19201920+ if (portp == NULL)19211921+ return -ENODEV;19221922+ if (portp->brdnr < 0 || portp->brdnr >= stli_nrbrds)19231923+ return 0;17981924 brdp = stli_brds[portp->brdnr];17991799- if (brdp == (stlibrd_t *) NULL)18001800- return(0);19251925+ if (brdp == NULL)19261926+ return 0;18011927 if (tty->flags & (1 << TTY_IO_ERROR))18021802- return(-EIO);19281928+ return -EIO;1803192918041930 if ((rc = stli_cmdwait(brdp, portp, A_GETSIGNALS,18051931 &portp->asig, sizeof(asysigs_t), 1)) < 0)18061806- return(rc);19321932+ return rc;1807193318081934 return stli_mktiocm(portp->asig.sigvalue);18091935}···18151941 stlibrd_t *brdp;18161942 int rts = -1, dtr = -1;1817194318181818- if (portp == (stliport_t *) NULL)18191819- return(-ENODEV);18201820- if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds))18211821- return(0);19441944+ if (portp == NULL)19451945+ return -ENODEV;19461946+ if (portp->brdnr < 0 || portp->brdnr >= stli_nrbrds)19471947+ return 0;18221948 brdp = stli_brds[portp->brdnr];18231823- if (brdp == (stlibrd_t *) NULL)18241824- return(0);19491949+ if (brdp == NULL)19501950+ return 0;18251951 if (tty->flags & (1 << TTY_IO_ERROR))18261826- return(-EIO);19521952+ return -EIO;1827195318281954 if (set & TIOCM_RTS)18291955 rts = 1;···1842196818431969static int stli_ioctl(struct tty_struct *tty, struct file *file, unsigned int cmd, unsigned long arg)18441970{18451845- stliport_t *portp;18461846- stlibrd_t *brdp;18471847- unsigned int ival;18481848- int rc;19711971+ stliport_t *portp;19721972+ stlibrd_t *brdp;19731973+ unsigned int ival;19741974+ int rc;18491975 void __user *argp = (void __user *)arg;1850197618511851-#ifdef DEBUG18521852- printk("stli_ioctl(tty=%x,file=%x,cmd=%x,arg=%x)\n",18531853- (int) tty, (int) file, cmd, (int) arg);18541854-#endif18551855-18561856- if (tty == (struct tty_struct *) NULL)18571857- return(-ENODEV);18581977 portp = tty->driver_data;18591859- if (portp == (stliport_t *) NULL)18601860- return(-ENODEV);18611861- if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds))18621862- return(0);19781978+ if (portp == NULL)19791979+ return -ENODEV;19801980+ if (portp->brdnr < 0 || portp->brdnr >= stli_nrbrds)19811981+ return 0;18631982 brdp = stli_brds[portp->brdnr];18641864- if (brdp == (stlibrd_t *) NULL)18651865- return(0);19831983+ if (brdp == NULL)19841984+ return 0;1866198518671986 if ((cmd != TIOCGSERIAL) && (cmd != TIOCSSERIAL) &&18681987 (cmd != COM_GETPORTSTATS) && (cmd != COM_CLRPORTSTATS)) {18691988 if (tty->flags & (1 << TTY_IO_ERROR))18701870- return(-EIO);19891989+ return -EIO;18711990 }1872199118731992 rc = 0;···19072040 break;19082041 }1909204219101910- return(rc);20432043+ return rc;19112044}1912204519132046/*****************************************************************************/···1919205219202053static void stli_settermios(struct tty_struct *tty, struct termios *old)19212054{19221922- stliport_t *portp;19231923- stlibrd_t *brdp;19241924- struct termios *tiosp;19251925- asyport_t aport;20552055+ stliport_t *portp;20562056+ stlibrd_t *brdp;20572057+ struct termios *tiosp;20582058+ asyport_t aport;1926205919271927-#ifdef DEBUG19281928- printk("stli_settermios(tty=%x,old=%x)\n", (int) tty, (int) old);19291929-#endif19301930-19311931- if (tty == (struct tty_struct *) NULL)20602060+ if (tty == NULL)19322061 return;19332062 portp = tty->driver_data;19341934- if (portp == (stliport_t *) NULL)20632063+ if (portp == NULL)19352064 return;19361936- if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds))20652065+ if (portp->brdnr < 0 || portp->brdnr >= stli_nrbrds)19372066 return;19382067 brdp = stli_brds[portp->brdnr];19391939- if (brdp == (stlibrd_t *) NULL)20682068+ if (brdp == NULL)19402069 return;1941207019422071 tiosp = tty->termios;···1965210219662103static void stli_throttle(struct tty_struct *tty)19672104{19681968- stliport_t *portp;19691969-19701970-#ifdef DEBUG19711971- printk("stli_throttle(tty=%x)\n", (int) tty);19721972-#endif19731973-19741974- if (tty == (struct tty_struct *) NULL)21052105+ stliport_t *portp = tty->driver_data;21062106+ if (portp == NULL)19752107 return;19761976- portp = tty->driver_data;19771977- if (portp == (stliport_t *) NULL)19781978- return;19791979-19802108 set_bit(ST_RXSTOP, &portp->state);19812109}19822110···1981212719822128static void stli_unthrottle(struct tty_struct *tty)19832129{19841984- stliport_t *portp;19851985-19861986-#ifdef DEBUG19871987- printk("stli_unthrottle(tty=%x)\n", (int) tty);19881988-#endif19891989-19901990- if (tty == (struct tty_struct *) NULL)21302130+ stliport_t *portp = tty->driver_data;21312131+ if (portp == NULL)19912132 return;19921992- portp = tty->driver_data;19931993- if (portp == (stliport_t *) NULL)19941994- return;19951995-19962133 clear_bit(ST_RXSTOP, &portp->state);19972134}1998213519992136/*****************************************************************************/2000213720012138/*20022002- * Stop the transmitter. Basically to do this we will just turn TX20032003- * interrupts off.21392139+ * Stop the transmitter.20042140 */2005214120062142static void stli_stop(struct tty_struct *tty)20072143{20082008- stlibrd_t *brdp;20092009- stliport_t *portp;20102010- asyctrl_t actrl;20112011-20122012-#ifdef DEBUG20132013- printk("stli_stop(tty=%x)\n", (int) tty);20142014-#endif20152015-20162016- if (tty == (struct tty_struct *) NULL)20172017- return;20182018- portp = tty->driver_data;20192019- if (portp == (stliport_t *) NULL)20202020- return;20212021- if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds))20222022- return;20232023- brdp = stli_brds[portp->brdnr];20242024- if (brdp == (stlibrd_t *) NULL)20252025- return;20262026-20272027- memset(&actrl, 0, sizeof(asyctrl_t));20282028- actrl.txctrl = CT_STOPFLOW;20292029-#if 020302030- stli_cmdwait(brdp, portp, A_PORTCTRL, &actrl, sizeof(asyctrl_t), 0);20312031-#endif20322144}2033214520342146/*****************************************************************************/2035214720362148/*20372037- * Start the transmitter again. Just turn TX interrupts back on.21492149+ * Start the transmitter again.20382150 */2039215120402152static void stli_start(struct tty_struct *tty)20412153{20422042- stliport_t *portp;20432043- stlibrd_t *brdp;20442044- asyctrl_t actrl;20452045-20462046-#ifdef DEBUG20472047- printk("stli_start(tty=%x)\n", (int) tty);20482048-#endif20492049-20502050- if (tty == (struct tty_struct *) NULL)20512051- return;20522052- portp = tty->driver_data;20532053- if (portp == (stliport_t *) NULL)20542054- return;20552055- if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds))20562056- return;20572057- brdp = stli_brds[portp->brdnr];20582058- if (brdp == (stlibrd_t *) NULL)20592059- return;20602060-20612061- memset(&actrl, 0, sizeof(asyctrl_t));20622062- actrl.txctrl = CT_STARTFLOW;20632063-#if 020642064- stli_cmdwait(brdp, portp, A_PORTCTRL, &actrl, sizeof(asyctrl_t), 0);20652065-#endif20662154}2067215520682156/*****************************************************************************/···2020222420212225static void stli_dohangup(void *arg)20222226{20232023- stliport_t *portp;20242024-20252025-#ifdef DEBUG20262026- printk(KERN_DEBUG "stli_dohangup(portp=%x)\n", (int) arg);20272027-#endif20282028-20292029- /*20302030- * FIXME: There's a module removal race here: tty_hangup20312031- * calls schedule_work which will call into this20322032- * driver later.20332033- */20342034- portp = (stliport_t *) arg;20352035- if (portp != (stliport_t *) NULL) {20362036- if (portp->tty != (struct tty_struct *) NULL) {20372037- tty_hangup(portp->tty);20382038- }22272227+ stliport_t *portp = (stliport_t *) arg;22282228+ if (portp->tty != NULL) {22292229+ tty_hangup(portp->tty);20392230 }20402231}20412232···2037225420382255static void stli_hangup(struct tty_struct *tty)20392256{20402040- stliport_t *portp;20412041- stlibrd_t *brdp;20422042- unsigned long flags;22572257+ stliport_t *portp;22582258+ stlibrd_t *brdp;22592259+ unsigned long flags;2043226020442044-#ifdef DEBUG20452045- printk(KERN_DEBUG "stli_hangup(tty=%x)\n", (int) tty);20462046-#endif20472047-20482048- if (tty == (struct tty_struct *) NULL)20492049- return;20502261 portp = tty->driver_data;20512051- if (portp == (stliport_t *) NULL)22622262+ if (portp == NULL)20522263 return;20532053- if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds))22642264+ if (portp->brdnr < 0 || portp->brdnr >= stli_nrbrds)20542265 return;20552266 brdp = stli_brds[portp->brdnr];20562056- if (brdp == (stlibrd_t *) NULL)22672267+ if (brdp == NULL)20572268 return;2058226920592270 portp->flags &= ~ASYNC_INITIALIZED;2060227120612061- save_flags(flags);20622062- cli();20632063- if (! test_bit(ST_CLOSING, &portp->state))22722272+ if (!test_bit(ST_CLOSING, &portp->state))20642273 stli_rawclose(brdp, portp, 0, 0);22742274+22752275+ spin_lock_irqsave(&stli_lock, flags);20652276 if (tty->termios->c_cflag & HUPCL) {20662277 stli_mkasysigs(&portp->asig, 0, 0);20672278 if (test_bit(ST_CMDING, &portp->state)) {···20672290 &portp->asig, sizeof(asysigs_t), 0);20682291 }20692292 }20702070- restore_flags(flags);2071229320722294 clear_bit(ST_TXBUSY, &portp->state);20732295 clear_bit(ST_RXSTOP, &portp->state);20742296 set_bit(TTY_IO_ERROR, &tty->flags);20752075- portp->tty = (struct tty_struct *) NULL;22972297+ portp->tty = NULL;20762298 portp->flags &= ~ASYNC_NORMAL_ACTIVE;20772299 portp->refcount = 0;23002300+ spin_unlock_irqrestore(&stli_lock, flags);23012301+20782302 wake_up_interruptible(&portp->open_wait);20792303}20802304···2090231220912313static void stli_flushbuffer(struct tty_struct *tty)20922314{20932093- stliport_t *portp;20942094- stlibrd_t *brdp;20952095- unsigned long ftype, flags;23152315+ stliport_t *portp;23162316+ stlibrd_t *brdp;23172317+ unsigned long ftype, flags;2096231820972097-#ifdef DEBUG20982098- printk(KERN_DEBUG "stli_flushbuffer(tty=%x)\n", (int) tty);20992099-#endif21002100-21012101- if (tty == (struct tty_struct *) NULL)21022102- return;21032319 portp = tty->driver_data;21042104- if (portp == (stliport_t *) NULL)23202320+ if (portp == NULL)21052321 return;21062106- if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds))23222322+ if (portp->brdnr < 0 || portp->brdnr >= stli_nrbrds)21072323 return;21082324 brdp = stli_brds[portp->brdnr];21092109- if (brdp == (stlibrd_t *) NULL)23252325+ if (brdp == NULL)21102326 return;2111232721122112- save_flags(flags);21132113- cli();23282328+ spin_lock_irqsave(&brd_lock, flags);21142329 if (tty == stli_txcooktty) {21152115- stli_txcooktty = (struct tty_struct *) NULL;23302330+ stli_txcooktty = NULL;21162331 stli_txcooksize = 0;21172332 stli_txcookrealsize = 0;21182333 }···21172346 ftype |= FLUSHRX;21182347 clear_bit(ST_DOFLUSHRX, &portp->state);21192348 }21202120- stli_sendcmd(brdp, portp, A_FLUSH, &ftype,21212121- sizeof(unsigned long), 0);23492349+ __stli_sendcmd(brdp, portp, A_FLUSH, &ftype, sizeof(u32), 0);21222350 }21232123- restore_flags(flags);21242124-21252125- wake_up_interruptible(&tty->write_wait);21262126- if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&21272127- tty->ldisc.write_wakeup)21282128- (tty->ldisc.write_wakeup)(tty);23512351+ spin_unlock_irqrestore(&brd_lock, flags);23522352+ tty_wakeup(tty);21292353}2130235421312355/*****************************************************************************/···21302364 stlibrd_t *brdp;21312365 stliport_t *portp;21322366 long arg;21332133- /* long savestate, savetime; */2134236721352135-#ifdef DEBUG21362136- printk(KERN_DEBUG "stli_breakctl(tty=%x,state=%d)\n", (int) tty, state);21372137-#endif21382138-21392139- if (tty == (struct tty_struct *) NULL)21402140- return;21412368 portp = tty->driver_data;21422142- if (portp == (stliport_t *) NULL)23692369+ if (portp == NULL)21432370 return;21442144- if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds))23712371+ if (portp->brdnr < 0 || portp->brdnr >= stli_nrbrds)21452372 return;21462373 brdp = stli_brds[portp->brdnr];21472147- if (brdp == (stlibrd_t *) NULL)23742374+ if (brdp == NULL)21482375 return;21492149-21502150-/*21512151- * Due to a bug in the tty send_break() code we need to preserve21522152- * the current process state and timeout...21532153- savetime = current->timeout;21542154- savestate = current->state;21552155- */2156237621572377 arg = (state == -1) ? BREAKON : BREAKOFF;21582378 stli_cmdwait(brdp, portp, A_BREAK, &arg, sizeof(long), 0);21592159-21602160-/*21612161- *21622162- current->timeout = savetime;21632163- current->state = savestate;21642164- */21652379}2166238021672381/*****************************************************************************/2168238221692383static void stli_waituntilsent(struct tty_struct *tty, int timeout)21702384{21712171- stliport_t *portp;21722172- unsigned long tend;23852385+ stliport_t *portp;23862386+ unsigned long tend;2173238721742174-#ifdef DEBUG21752175- printk(KERN_DEBUG "stli_waituntilsent(tty=%x,timeout=%x)\n", (int) tty, timeout);21762176-#endif21772177-21782178- if (tty == (struct tty_struct *) NULL)23882388+ if (tty == NULL)21792389 return;21802390 portp = tty->driver_data;21812181- if (portp == (stliport_t *) NULL)23912391+ if (portp == NULL)21822392 return;2183239321842394 if (timeout == 0)···21782436 stliport_t *portp;21792437 asyctrl_t actrl;2180243821812181-#ifdef DEBUG21822182- printk(KERN_DEBUG "stli_sendxchar(tty=%x,ch=%x)\n", (int) tty, ch);21832183-#endif21842184-21852185- if (tty == (struct tty_struct *) NULL)21862186- return;21872439 portp = tty->driver_data;21882188- if (portp == (stliport_t *) NULL)24402440+ if (portp == NULL)21892441 return;21902190- if ((portp->brdnr < 0) || (portp->brdnr >= stli_nrbrds))24422442+ if (portp->brdnr < 0 || portp->brdnr >= stli_nrbrds)21912443 return;21922444 brdp = stli_brds[portp->brdnr];21932193- if (brdp == (stlibrd_t *) NULL)24452445+ if (brdp == NULL)21942446 return;2195244721962448 memset(&actrl, 0, sizeof(asyctrl_t));···21962460 actrl.txctrl = CT_SENDCHR;21972461 actrl.tximdch = ch;21982462 }21992199-22002463 stli_cmdwait(brdp, portp, A_PORTCTRL, &actrl, sizeof(asyctrl_t), 0);22012464}22022465···2211247622122477static int stli_portinfo(stlibrd_t *brdp, stliport_t *portp, int portnr, char *pos)22132478{22142214- char *sp, *uart;22152215- int rc, cnt;24792479+ char *sp, *uart;24802480+ int rc, cnt;2216248122172482 rc = stli_portcmdstats(portp);2218248322192484 uart = "UNKNOWN";22202485 if (brdp->state & BST_STARTED) {22212486 switch (stli_comstats.hwid) {22222222- case 0: uart = "2681"; break;22232223- case 1: uart = "SC26198"; break;22242224- default: uart = "CD1400"; break;24872487+ case 0: uart = "2681"; break;24882488+ case 1: uart = "SC26198"; break;24892489+ default:uart = "CD1400"; break;22252490 }22262491 }22272492···2272253722732538static int stli_readproc(char *page, char **start, off_t off, int count, int *eof, void *data)22742539{22752275- stlibrd_t *brdp;22762276- stliport_t *portp;22772277- int brdnr, portnr, totalport;22782278- int curoff, maxoff;22792279- char *pos;22802280-22812281-#ifdef DEBUG22822282- printk(KERN_DEBUG "stli_readproc(page=%x,start=%x,off=%x,count=%d,eof=%x,"22832283- "data=%x\n", (int) page, (int) start, (int) off, count,22842284- (int) eof, (int) data);22852285-#endif25402540+ stlibrd_t *brdp;25412541+ stliport_t *portp;25422542+ int brdnr, portnr, totalport;25432543+ int curoff, maxoff;25442544+ char *pos;2286254522872546 pos = page;22882547 totalport = 0;···22972568 */22982569 for (brdnr = 0; (brdnr < stli_nrbrds); brdnr++) {22992570 brdp = stli_brds[brdnr];23002300- if (brdp == (stlibrd_t *) NULL)25712571+ if (brdp == NULL)23012572 continue;23022573 if (brdp->state == 0)23032574 continue;···23122583 for (portnr = 0; (portnr < brdp->nrports); portnr++,23132584 totalport++) {23142585 portp = brdp->ports[portnr];23152315- if (portp == (stliport_t *) NULL)25862586+ if (portp == NULL)23162587 continue;23172588 if (off >= (curoff += MAXLINE))23182589 continue;···23392610 * a poll routine that does not have user context. Therefore you cannot23402611 * copy back directly into user space, or to the kernel stack of a23412612 * process. This routine does not sleep, so can be called from anywhere.26132613+ *26142614+ * The caller must hold the brd_lock (see also stli_sendcmd the usual26152615+ * entry point)23422616 */2343261723442344-static void stli_sendcmd(stlibrd_t *brdp, stliport_t *portp, unsigned long cmd, void *arg, int size, int copyback)26182618+static void __stli_sendcmd(stlibrd_t *brdp, stliport_t *portp, unsigned long cmd, void *arg, int size, int copyback)23452619{23462346- volatile cdkhdr_t *hdrp;23472347- volatile cdkctrl_t *cp;23482348- volatile unsigned char *bits;23492349- unsigned long flags;26202620+ cdkhdr_t __iomem *hdrp;26212621+ cdkctrl_t __iomem *cp;26222622+ unsigned char __iomem *bits;26232623+ unsigned long flags;2350262423512351-#ifdef DEBUG23522352- printk(KERN_DEBUG "stli_sendcmd(brdp=%x,portp=%x,cmd=%x,arg=%x,size=%d,"23532353- "copyback=%d)\n", (int) brdp, (int) portp, (int) cmd,23542354- (int) arg, size, copyback);23552355-#endif23562356-23572357- save_flags(flags);23582358- cli();26252625+ spin_lock_irqsave(&brd_lock, flags);2359262623602627 if (test_bit(ST_CMDING, &portp->state)) {23612628 printk(KERN_ERR "STALLION: command already busy, cmd=%x!\n",23622629 (int) cmd);23632363- restore_flags(flags);26302630+ spin_unlock_irqrestore(&brd_lock, flags);23642631 return;23652632 }2366263323672634 EBRDENABLE(brdp);23682368- cp = &((volatile cdkasy_t *) EBRDGETMEMPTR(brdp, portp->addr))->ctrl;26352635+ cp = &((cdkasy_t __iomem *) EBRDGETMEMPTR(brdp, portp->addr))->ctrl;23692636 if (size > 0) {23702370- memcpy((void *) &(cp->args[0]), arg, size);26372637+ memcpy_toio((void __iomem *) &(cp->args[0]), arg, size);23712638 if (copyback) {23722639 portp->argp = arg;23732640 portp->argsize = size;23742641 }23752642 }23762376- cp->status = 0;23772377- cp->cmd = cmd;23782378- hdrp = (volatile cdkhdr_t *) EBRDGETMEMPTR(brdp, CDK_CDKADDR);23792379- bits = ((volatile unsigned char *) hdrp) + brdp->slaveoffset +26432643+ writel(0, &cp->status);26442644+ writel(cmd, &cp->cmd);26452645+ hdrp = (cdkhdr_t __iomem *) EBRDGETMEMPTR(brdp, CDK_CDKADDR);26462646+ bits = ((unsigned char __iomem *) hdrp) + brdp->slaveoffset +23802647 portp->portidx;23812381- *bits |= portp->portbit;26482648+ writeb(readb(bits) | portp->portbit, bits);23822649 set_bit(ST_CMDING, &portp->state);23832650 EBRDDISABLE(brdp);23842384- restore_flags(flags);26512651+ spin_unlock_irqrestore(&brd_lock, flags);26522652+}26532653+26542654+static void stli_sendcmd(stlibrd_t *brdp, stliport_t *portp, unsigned long cmd, void *arg, int size, int copyback)26552655+{26562656+ unsigned long flags;26572657+26582658+ spin_lock_irqsave(&brd_lock, flags);26592659+ __stli_sendcmd(brdp, portp, cmd, arg, size, copyback);26602660+ spin_unlock_irqrestore(&brd_lock, flags);23852661}2386266223872663/*****************************************************************************/···2401266724022668static void stli_read(stlibrd_t *brdp, stliport_t *portp)24032669{24042404- volatile cdkasyrq_t *rp;24052405- volatile char *shbuf;26702670+ cdkasyrq_t __iomem *rp;26712671+ char __iomem *shbuf;24062672 struct tty_struct *tty;24072407- unsigned int head, tail, size;24082408- unsigned int len, stlen;24092409-24102410-#ifdef DEBUG24112411- printk(KERN_DEBUG "stli_read(brdp=%x,portp=%d)\n",24122412- (int) brdp, (int) portp);24132413-#endif26732673+ unsigned int head, tail, size;26742674+ unsigned int len, stlen;2414267524152676 if (test_bit(ST_RXSTOP, &portp->state))24162677 return;24172678 tty = portp->tty;24182418- if (tty == (struct tty_struct *) NULL)26792679+ if (tty == NULL)24192680 return;2420268124212421- rp = &((volatile cdkasy_t *) EBRDGETMEMPTR(brdp, portp->addr))->rxq;24222422- head = (unsigned int) rp->head;24232423- if (head != ((unsigned int) rp->head))24242424- head = (unsigned int) rp->head;24252425- tail = (unsigned int) rp->tail;26822682+ rp = &((cdkasy_t __iomem *) EBRDGETMEMPTR(brdp, portp->addr))->rxq;26832683+ head = (unsigned int) readw(&rp->head);26842684+ if (head != ((unsigned int) readw(&rp->head)))26852685+ head = (unsigned int) readw(&rp->head);26862686+ tail = (unsigned int) readw(&rp->tail);24262687 size = portp->rxsize;24272688 if (head >= tail) {24282689 len = head - tail;···24282699 }2429270024302701 len = tty_buffer_request_room(tty, len);24312431- /* FIXME : iomap ? */24322432- shbuf = (volatile char *) EBRDGETMEMPTR(brdp, portp->rxoffset);27022702+27032703+ shbuf = (char __iomem *) EBRDGETMEMPTR(brdp, portp->rxoffset);2433270424342705 while (len > 0) {27062706+ unsigned char *cptr;27072707+24352708 stlen = MIN(len, stlen);24362436- tty_insert_flip_string(tty, (char *)(shbuf + tail), stlen);27092709+ tty_prepare_flip_string(tty, &cptr, stlen);27102710+ memcpy_fromio(cptr, shbuf + tail, stlen);24372711 len -= stlen;24382712 tail += stlen;24392713 if (tail >= size) {···24442712 stlen = head;24452713 }24462714 }24472447- rp = &((volatile cdkasy_t *) EBRDGETMEMPTR(brdp, portp->addr))->rxq;24482448- rp->tail = tail;27152715+ rp = &((cdkasy_t __iomem *) EBRDGETMEMPTR(brdp, portp->addr))->rxq;27162716+ writew(tail, &rp->tail);2449271724502718 if (head != tail)24512719 set_bit(ST_RXING, &portp->state);···24612729 * difficult to deal with them here.24622730 */2463273124642464-static void stli_dodelaycmd(stliport_t *portp, volatile cdkctrl_t *cp)27322732+static void stli_dodelaycmd(stliport_t *portp, cdkctrl_t __iomem *cp)24652733{24662466- int cmd;27342734+ int cmd;2467273524682736 if (test_bit(ST_DOSIGS, &portp->state)) {24692737 if (test_bit(ST_DOFLUSHTX, &portp->state) &&···24782746 clear_bit(ST_DOFLUSHTX, &portp->state);24792747 clear_bit(ST_DOFLUSHRX, &portp->state);24802748 clear_bit(ST_DOSIGS, &portp->state);24812481- memcpy((void *) &(cp->args[0]), (void *) &portp->asig,27492749+ memcpy_toio((void __iomem *) &(cp->args[0]), (void *) &portp->asig,24822750 sizeof(asysigs_t));24832483- cp->status = 0;24842484- cp->cmd = cmd;27512751+ writel(0, &cp->status);27522752+ writel(cmd, &cp->cmd);24852753 set_bit(ST_CMDING, &portp->state);24862754 } else if (test_bit(ST_DOFLUSHTX, &portp->state) ||24872755 test_bit(ST_DOFLUSHRX, &portp->state)) {···24892757 cmd |= ((test_bit(ST_DOFLUSHRX, &portp->state)) ? FLUSHRX : 0);24902758 clear_bit(ST_DOFLUSHTX, &portp->state);24912759 clear_bit(ST_DOFLUSHRX, &portp->state);24922492- memcpy((void *) &(cp->args[0]), (void *) &cmd, sizeof(int));24932493- cp->status = 0;24942494- cp->cmd = A_FLUSH;27602760+ memcpy_toio((void __iomem *) &(cp->args[0]), (void *) &cmd, sizeof(int));27612761+ writel(0, &cp->status);27622762+ writel(A_FLUSH, &cp->cmd);24952763 set_bit(ST_CMDING, &portp->state);24962764 }24972765}···2511277925122780static int stli_hostcmd(stlibrd_t *brdp, stliport_t *portp)25132781{25142514- volatile cdkasy_t *ap;25152515- volatile cdkctrl_t *cp;25162516- struct tty_struct *tty;25172517- asynotify_t nt;25182518- unsigned long oldsigs;25192519- int rc, donerx;27822782+ cdkasy_t __iomem *ap;27832783+ cdkctrl_t __iomem *cp;27842784+ struct tty_struct *tty;27852785+ asynotify_t nt;27862786+ unsigned long oldsigs;27872787+ int rc, donerx;2520278825212521-#ifdef DEBUG25222522- printk(KERN_DEBUG "stli_hostcmd(brdp=%x,channr=%d)\n",25232523- (int) brdp, channr);25242524-#endif25252525-25262526- ap = (volatile cdkasy_t *) EBRDGETMEMPTR(brdp, portp->addr);27892789+ ap = (cdkasy_t __iomem *) EBRDGETMEMPTR(brdp, portp->addr);25272790 cp = &ap->ctrl;2528279125292792/*25302793 * Check if we are waiting for an open completion message.25312794 */25322795 if (test_bit(ST_OPENING, &portp->state)) {25332533- rc = (int) cp->openarg;25342534- if ((cp->open == 0) && (rc != 0)) {27962796+ rc = readl(&cp->openarg);27972797+ if (readb(&cp->open) == 0 && rc != 0) {25352798 if (rc > 0)25362799 rc--;25372537- cp->openarg = 0;28002800+ writel(0, &cp->openarg);25382801 portp->rc = rc;25392802 clear_bit(ST_OPENING, &portp->state);25402803 wake_up_interruptible(&portp->raw_wait);···25402813 * Check if we are waiting for a close completion message.25412814 */25422815 if (test_bit(ST_CLOSING, &portp->state)) {25432543- rc = (int) cp->closearg;25442544- if ((cp->close == 0) && (rc != 0)) {28162816+ rc = (int) readl(&cp->closearg);28172817+ if (readb(&cp->close) == 0 && rc != 0) {25452818 if (rc > 0)25462819 rc--;25472547- cp->closearg = 0;28202820+ writel(0, &cp->closearg);25482821 portp->rc = rc;25492822 clear_bit(ST_CLOSING, &portp->state);25502823 wake_up_interruptible(&portp->raw_wait);···25562829 * need to copy out the command results associated with this command.25572830 */25582831 if (test_bit(ST_CMDING, &portp->state)) {25592559- rc = cp->status;25602560- if ((cp->cmd == 0) && (rc != 0)) {28322832+ rc = readl(&cp->status);28332833+ if (readl(&cp->cmd) == 0 && rc != 0) {25612834 if (rc > 0)25622835 rc--;25632563- if (portp->argp != (void *) NULL) {25642564- memcpy(portp->argp, (void *) &(cp->args[0]),28362836+ if (portp->argp != NULL) {28372837+ memcpy_fromio(portp->argp, (void __iomem *) &(cp->args[0]),25652838 portp->argsize);25662566- portp->argp = (void *) NULL;28392839+ portp->argp = NULL;25672840 }25682568- cp->status = 0;28412841+ writel(0, &cp->status);25692842 portp->rc = rc;25702843 clear_bit(ST_CMDING, &portp->state);25712844 stli_dodelaycmd(portp, cp);···26042877 if (nt.data & DT_TXEMPTY)26052878 clear_bit(ST_TXBUSY, &portp->state);26062879 if (nt.data & (DT_TXEMPTY | DT_TXLOW)) {26072607- if (tty != (struct tty_struct *) NULL) {26082608- if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&26092609- tty->ldisc.write_wakeup) {26102610- (tty->ldisc.write_wakeup)(tty);26112611- EBRDENABLE(brdp);26122612- }28802880+ if (tty != NULL) {28812881+ tty_wakeup(tty);28822882+ EBRDENABLE(brdp);26132883 wake_up_interruptible(&tty->write_wait);26142884 }26152885 }2616288626172887 if ((nt.data & DT_RXBREAK) && (portp->rxmarkmsk & BRKINT)) {26182618- if (tty != (struct tty_struct *) NULL) {28882888+ if (tty != NULL) {26192889 tty_insert_flip_char(tty, 0, TTY_BREAK);26202890 if (portp->flags & ASYNC_SAK) {26212891 do_SAK(tty);···26562932 * at the cdk header structure.26572933 */2658293426592659-static void stli_brdpoll(stlibrd_t *brdp, volatile cdkhdr_t *hdrp)29352935+static void stli_brdpoll(stlibrd_t *brdp, cdkhdr_t __iomem *hdrp)26602936{26612661- stliport_t *portp;26622662- unsigned char hostbits[(STL_MAXCHANS / 8) + 1];26632663- unsigned char slavebits[(STL_MAXCHANS / 8) + 1];26642664- unsigned char *slavep;26652665- int bitpos, bitat, bitsize;26662666- int channr, nrdevs, slavebitchange;29372937+ stliport_t *portp;29382938+ unsigned char hostbits[(STL_MAXCHANS / 8) + 1];29392939+ unsigned char slavebits[(STL_MAXCHANS / 8) + 1];29402940+ unsigned char __iomem *slavep;29412941+ int bitpos, bitat, bitsize;29422942+ int channr, nrdevs, slavebitchange;2667294326682944 bitsize = brdp->bitsize;26692945 nrdevs = brdp->nrdevs;···26752951 * 8 service bits at a time in the inner loop, so we can bypass26762952 * the lot if none of them want service.26772953 */26782678- memcpy(&hostbits[0], (((unsigned char *) hdrp) + brdp->hostoffset),29542954+ memcpy_fromio(&hostbits[0], (((unsigned char __iomem *) hdrp) + brdp->hostoffset),26792955 bitsize);2680295626812957 memset(&slavebits[0], 0, bitsize);···27022978 * service may initiate more slave requests.27032979 */27042980 if (slavebitchange) {27052705- hdrp = (volatile cdkhdr_t *) EBRDGETMEMPTR(brdp, CDK_CDKADDR);27062706- slavep = ((unsigned char *) hdrp) + brdp->slaveoffset;29812981+ hdrp = (cdkhdr_t __iomem *) EBRDGETMEMPTR(brdp, CDK_CDKADDR);29822982+ slavep = ((unsigned char __iomem *) hdrp) + brdp->slaveoffset;27072983 for (bitpos = 0; (bitpos < bitsize); bitpos++) {27082708- if (slavebits[bitpos])27092709- slavep[bitpos] &= ~slavebits[bitpos];29842984+ if (readb(slavebits + bitpos))29852985+ writeb(readb(slavep + bitpos) & ~slavebits[bitpos], slavebits + bitpos);27102986 }27112987 }27122988}···2724300027253001static void stli_poll(unsigned long arg)27263002{27272727- volatile cdkhdr_t *hdrp;27282728- stlibrd_t *brdp;27292729- int brdnr;30033003+ cdkhdr_t __iomem *hdrp;30043004+ stlibrd_t *brdp;30053005+ int brdnr;2730300627313007 stli_timerlist.expires = STLI_TIMEOUT;27323008 add_timer(&stli_timerlist);···27363012 */27373013 for (brdnr = 0; (brdnr < stli_nrbrds); brdnr++) {27383014 brdp = stli_brds[brdnr];27392739- if (brdp == (stlibrd_t *) NULL)30153015+ if (brdp == NULL)27403016 continue;27413017 if ((brdp->state & BST_STARTED) == 0)27423018 continue;2743301930203020+ spin_lock(&brd_lock);27443021 EBRDENABLE(brdp);27452745- hdrp = (volatile cdkhdr_t *) EBRDGETMEMPTR(brdp, CDK_CDKADDR);27462746- if (hdrp->hostreq)30223022+ hdrp = (cdkhdr_t __iomem *) EBRDGETMEMPTR(brdp, CDK_CDKADDR);30233023+ if (readb(&hdrp->hostreq))27473024 stli_brdpoll(brdp, hdrp);27483025 EBRDDISABLE(brdp);30263026+ spin_unlock(&brd_lock);27493027 }27503028}27513029···2760303427613035static void stli_mkasyport(stliport_t *portp, asyport_t *pp, struct termios *tiosp)27623036{27632763-#ifdef DEBUG27642764- printk(KERN_DEBUG "stli_mkasyport(portp=%x,pp=%x,tiosp=%d)\n",27652765- (int) portp, (int) pp, (int) tiosp);27662766-#endif27672767-27683037 memset(pp, 0, sizeof(asyport_t));2769303827703039/*···2878315728793158static void stli_mkasysigs(asysigs_t *sp, int dtr, int rts)28803159{28812881-#ifdef DEBUG28822882- printk(KERN_DEBUG "stli_mkasysigs(sp=%x,dtr=%d,rts=%d)\n",28832883- (int) sp, dtr, rts);28842884-#endif28852885-28863160 memset(sp, 0, sizeof(asysigs_t));28873161 if (dtr >= 0) {28883162 sp->signal |= SG_DTR;···2898318228993183static long stli_mktiocm(unsigned long sigvalue)29003184{29012901- long tiocm;29022902-29032903-#ifdef DEBUG29042904- printk(KERN_DEBUG "stli_mktiocm(sigvalue=%x)\n", (int) sigvalue);29052905-#endif29062906-29072907- tiocm = 0;31853185+ long tiocm = 0;29083186 tiocm |= ((sigvalue & SG_DCD) ? TIOCM_CD : 0);29093187 tiocm |= ((sigvalue & SG_CTS) ? TIOCM_CTS : 0);29103188 tiocm |= ((sigvalue & SG_RI) ? TIOCM_RI : 0);···29193209{29203210 stliport_t *portp;29213211 int i, panelnr, panelport;29222922-29232923-#ifdef DEBUG29242924- printk(KERN_DEBUG "stli_initports(brdp=%x)\n", (int) brdp);29252925-#endif2926321229273213 for (i = 0, panelnr = 0, panelport = 0; (i < brdp->nrports); i++) {29283214 portp = kzalloc(sizeof(stliport_t), GFP_KERNEL);···29463240 brdp->ports[i] = portp;29473241 }2948324229492949- return(0);32433243+ return 0;29503244}2951324529523246/*****************************************************************************/···29583252static void stli_ecpinit(stlibrd_t *brdp)29593253{29603254 unsigned long memconf;29612961-29622962-#ifdef DEBUG29632963- printk(KERN_DEBUG "stli_ecpinit(brdp=%d)\n", (int) brdp);29642964-#endif2965325529663256 outb(ECP_ATSTOP, (brdp->iobase + ECP_ATCONFR));29673257 udelay(10);···2972327029733271static void stli_ecpenable(stlibrd_t *brdp)29743272{ 29752975-#ifdef DEBUG29762976- printk(KERN_DEBUG "stli_ecpenable(brdp=%x)\n", (int) brdp);29772977-#endif29783273 outb(ECP_ATENABLE, (brdp->iobase + ECP_ATCONFR));29793274}29803275···2979328029803281static void stli_ecpdisable(stlibrd_t *brdp)29813282{ 29822982-#ifdef DEBUG29832983- printk(KERN_DEBUG "stli_ecpdisable(brdp=%x)\n", (int) brdp);29842984-#endif29853283 outb(ECP_ATDISABLE, (brdp->iobase + ECP_ATCONFR));29863284}29873285···2986329029873291static char *stli_ecpgetmemptr(stlibrd_t *brdp, unsigned long offset, int line)29883292{ 29892989- void *ptr;29902990- unsigned char val;29912991-29922992-#ifdef DEBUG29932993- printk(KERN_DEBUG "stli_ecpgetmemptr(brdp=%x,offset=%x)\n", (int) brdp,29942994- (int) offset);29952995-#endif32933293+ void *ptr;32943294+ unsigned char val;2996329529973296 if (offset > brdp->memsize) {29983297 printk(KERN_ERR "STALLION: shared memory pointer=%x out of "···3007331630083317static void stli_ecpreset(stlibrd_t *brdp)30093318{ 30103010-#ifdef DEBUG30113011- printk(KERN_DEBUG "stli_ecpreset(brdp=%x)\n", (int) brdp);30123012-#endif30133013-30143319 outb(ECP_ATSTOP, (brdp->iobase + ECP_ATCONFR));30153320 udelay(10);30163321 outb(ECP_ATDISABLE, (brdp->iobase + ECP_ATCONFR));···3017333030183331static void stli_ecpintr(stlibrd_t *brdp)30193332{ 30203020-#ifdef DEBUG30213021- printk(KERN_DEBUG "stli_ecpintr(brdp=%x)\n", (int) brdp);30223022-#endif30233333 outb(0x1, brdp->iobase);30243334}30253335···30293345static void stli_ecpeiinit(stlibrd_t *brdp)30303346{30313347 unsigned long memconf;30323032-30333033-#ifdef DEBUG30343034- printk(KERN_DEBUG "stli_ecpeiinit(brdp=%x)\n", (int) brdp);30353035-#endif3036334830373349 outb(0x1, (brdp->iobase + ECP_EIBRDENAB));30383350 outb(ECP_EISTOP, (brdp->iobase + ECP_EICONFR));···30623382{ 30633383 void *ptr;30643384 unsigned char val;30653065-30663066-#ifdef DEBUG30673067- printk(KERN_DEBUG "stli_ecpeigetmemptr(brdp=%x,offset=%x,line=%d)\n",30683068- (int) brdp, (int) offset, line);30693069-#endif3070338530713386 if (offset > brdp->memsize) {30723387 printk(KERN_ERR "STALLION: shared memory pointer=%x out of "···3112343731133438static char *stli_ecpmcgetmemptr(stlibrd_t *brdp, unsigned long offset, int line)31143439{ 31153115- void *ptr;31163116- unsigned char val;34403440+ void *ptr;34413441+ unsigned char val;3117344231183443 if (offset > brdp->memsize) {31193444 printk(KERN_ERR "STALLION: shared memory pointer=%x out of "···3147347231483473static void stli_ecppciinit(stlibrd_t *brdp)31493474{31503150-#ifdef DEBUG31513151- printk(KERN_DEBUG "stli_ecppciinit(brdp=%x)\n", (int) brdp);31523152-#endif31533153-31543475 outb(ECP_PCISTOP, (brdp->iobase + ECP_PCICONFR));31553476 udelay(10);31563477 outb(0, (brdp->iobase + ECP_PCICONFR));···31593488{ 31603489 void *ptr;31613490 unsigned char val;31623162-31633163-#ifdef DEBUG31643164- printk(KERN_DEBUG "stli_ecppcigetmemptr(brdp=%x,offset=%x,line=%d)\n",31653165- (int) brdp, (int) offset, line);31663166-#endif3167349131683492 if (offset > brdp->memsize) {31693493 printk(KERN_ERR "STALLION: shared memory pointer=%x out of "···31943528{31953529 unsigned long memconf;3196353031973197-#ifdef DEBUG31983198- printk(KERN_DEBUG "stli_onbinit(brdp=%d)\n", (int) brdp);31993199-#endif32003200-32013531 outb(ONB_ATSTOP, (brdp->iobase + ONB_ATCONFR));32023532 udelay(10);32033533 outb(ONB_ATDISABLE, (brdp->iobase + ONB_ATCONFR));···3209354732103548static void stli_onbenable(stlibrd_t *brdp)32113549{ 32123212-#ifdef DEBUG32133213- printk(KERN_DEBUG "stli_onbenable(brdp=%x)\n", (int) brdp);32143214-#endif32153550 outb((brdp->enabval | ONB_ATENABLE), (brdp->iobase + ONB_ATCONFR));32163551}32173552···3216355732173558static void stli_onbdisable(stlibrd_t *brdp)32183559{ 32193219-#ifdef DEBUG32203220- printk(KERN_DEBUG "stli_onbdisable(brdp=%x)\n", (int) brdp);32213221-#endif32223560 outb((brdp->enabval | ONB_ATDISABLE), (brdp->iobase + ONB_ATCONFR));32233561}32243562···32243568static char *stli_onbgetmemptr(stlibrd_t *brdp, unsigned long offset, int line)32253569{ 32263570 void *ptr;32273227-32283228-#ifdef DEBUG32293229- printk(KERN_DEBUG "stli_onbgetmemptr(brdp=%x,offset=%x)\n", (int) brdp,32303230- (int) offset);32313231-#endif3232357132333572 if (offset > brdp->memsize) {32343573 printk(KERN_ERR "STALLION: shared memory pointer=%x out of "···3240358932413590static void stli_onbreset(stlibrd_t *brdp)32423591{ 32433243-32443244-#ifdef DEBUG32453245- printk(KERN_DEBUG "stli_onbreset(brdp=%x)\n", (int) brdp);32463246-#endif32473247-32483592 outb(ONB_ATSTOP, (brdp->iobase + ONB_ATCONFR));32493593 udelay(10);32503594 outb(ONB_ATDISABLE, (brdp->iobase + ONB_ATCONFR));···32553609static void stli_onbeinit(stlibrd_t *brdp)32563610{32573611 unsigned long memconf;32583258-32593259-#ifdef DEBUG32603260- printk(KERN_DEBUG "stli_onbeinit(brdp=%d)\n", (int) brdp);32613261-#endif3262361232633613 outb(0x1, (brdp->iobase + ONB_EIBRDENAB));32643614 outb(ONB_EISTOP, (brdp->iobase + ONB_EICONFR));···3274363232753633static void stli_onbeenable(stlibrd_t *brdp)32763634{ 32773277-#ifdef DEBUG32783278- printk(KERN_DEBUG "stli_onbeenable(brdp=%x)\n", (int) brdp);32793279-#endif32803635 outb(ONB_EIENABLE, (brdp->iobase + ONB_EICONFR));32813636}32823637···3281364232823643static void stli_onbedisable(stlibrd_t *brdp)32833644{ 32843284-#ifdef DEBUG32853285- printk(KERN_DEBUG "stli_onbedisable(brdp=%x)\n", (int) brdp);32863286-#endif32873645 outb(ONB_EIDISABLE, (brdp->iobase + ONB_EICONFR));32883646}32893647···3288365232893653static char *stli_onbegetmemptr(stlibrd_t *brdp, unsigned long offset, int line)32903654{ 32913291- void *ptr;32923292- unsigned char val;32933293-32943294-#ifdef DEBUG32953295- printk(KERN_DEBUG "stli_onbegetmemptr(brdp=%x,offset=%x,line=%d)\n",32963296- (int) brdp, (int) offset, line);32973297-#endif36553655+ void *ptr;36563656+ unsigned char val;3298365732993658 if (offset > brdp->memsize) {33003659 printk(KERN_ERR "STALLION: shared memory pointer=%x out of "···3312368133133682static void stli_onbereset(stlibrd_t *brdp)33143683{ 33153315-33163316-#ifdef DEBUG33173317- printk(KERN_ERR "stli_onbereset(brdp=%x)\n", (int) brdp);33183318-#endif33193319-33203684 outb(ONB_EISTOP, (brdp->iobase + ONB_EICONFR));33213685 udelay(10);33223686 outb(ONB_EIDISABLE, (brdp->iobase + ONB_EICONFR));···3326370033273701static void stli_bbyinit(stlibrd_t *brdp)33283702{33293329-33303330-#ifdef DEBUG33313331- printk(KERN_ERR "stli_bbyinit(brdp=%d)\n", (int) brdp);33323332-#endif33333333-33343703 outb(BBY_ATSTOP, (brdp->iobase + BBY_ATCONFR));33353704 udelay(10);33363705 outb(0, (brdp->iobase + BBY_ATCONFR));···3338371733393718static char *stli_bbygetmemptr(stlibrd_t *brdp, unsigned long offset, int line)33403719{ 33413341- void *ptr;33423342- unsigned char val;37203720+ void *ptr;37213721+ unsigned char val;3343372233443344-#ifdef DEBUG33453345- printk(KERN_ERR "stli_bbygetmemptr(brdp=%x,offset=%x)\n", (int) brdp,33463346- (int) offset);33473347-#endif37233723+ BUG_ON(offset > brdp->memsize);3348372433493349- if (offset > brdp->memsize) {33503350- printk(KERN_ERR "STALLION: shared memory pointer=%x out of "33513351- "range at line=%d(%d), brd=%d\n",33523352- (int) offset, line, __LINE__, brdp->brdnr);33533353- ptr = NULL;33543354- val = 0;33553355- } else {33563356- ptr = brdp->membase + (offset % BBY_PAGESIZE);33573357- val = (unsigned char) (offset / BBY_PAGESIZE);33583358- }37253725+ ptr = brdp->membase + (offset % BBY_PAGESIZE);37263726+ val = (unsigned char) (offset / BBY_PAGESIZE);33593727 outb(val, (brdp->iobase + BBY_ATCONFR));33603728 return(ptr);33613729}···3353374333543744static void stli_bbyreset(stlibrd_t *brdp)33553745{ 33563356-33573357-#ifdef DEBUG33583358- printk(KERN_DEBUG "stli_bbyreset(brdp=%x)\n", (int) brdp);33593359-#endif33603360-33613746 outb(BBY_ATSTOP, (brdp->iobase + BBY_ATCONFR));33623747 udelay(10);33633748 outb(0, (brdp->iobase + BBY_ATCONFR));···3367376233683763static void stli_stalinit(stlibrd_t *brdp)33693764{33703370-33713371-#ifdef DEBUG33723372- printk(KERN_DEBUG "stli_stalinit(brdp=%d)\n", (int) brdp);33733373-#endif33743374-33753765 outb(0x1, brdp->iobase);33763766 mdelay(1000);33773767}···3375377533763776static char *stli_stalgetmemptr(stlibrd_t *brdp, unsigned long offset, int line)33773777{ 33783378- void *ptr;33793379-33803380-#ifdef DEBUG33813381- printk(KERN_DEBUG "stli_stalgetmemptr(brdp=%x,offset=%x)\n", (int) brdp,33823382- (int) offset);33833383-#endif33843384-33853385- if (offset > brdp->memsize) {33863386- printk(KERN_ERR "STALLION: shared memory pointer=%x out of "33873387- "range at line=%d(%d), brd=%d\n",33883388- (int) offset, line, __LINE__, brdp->brdnr);33893389- ptr = NULL;33903390- } else {33913391- ptr = brdp->membase + (offset % STAL_PAGESIZE);33923392- }33933393- return(ptr);37783778+ BUG_ON(offset > brdp->memsize);37793779+ return brdp->membase + (offset % STAL_PAGESIZE);33943780}3395378133963782/*****************************************************************************/3397378333983784static void stli_stalreset(stlibrd_t *brdp)33993785{ 34003400- volatile unsigned long *vecp;37863786+ u32 __iomem *vecp;3401378734023402-#ifdef DEBUG34033403- printk(KERN_DEBUG "stli_stalreset(brdp=%x)\n", (int) brdp);34043404-#endif34053405-34063406- vecp = (volatile unsigned long *) (brdp->membase + 0x30);34073407- *vecp = 0xffff0000;37883788+ vecp = (u32 __iomem *) (brdp->membase + 0x30);37893789+ writel(0xffff0000, vecp);34083790 outb(0, brdp->iobase);34093791 mdelay(1000);34103792}···3400381834013819static int stli_initecp(stlibrd_t *brdp)34023820{34033403- cdkecpsig_t sig;34043404- cdkecpsig_t *sigsp;34053405- unsigned int status, nxtid;34063406- char *name;34073407- int panelnr, nrports;34083408-34093409-#ifdef DEBUG34103410- printk(KERN_DEBUG "stli_initecp(brdp=%x)\n", (int) brdp);34113411-#endif38213821+ cdkecpsig_t sig;38223822+ cdkecpsig_t __iomem *sigsp;38233823+ unsigned int status, nxtid;38243824+ char *name;38253825+ int panelnr, nrports;3412382634133827 if (!request_region(brdp->iobase, brdp->iosize, "istallion"))34143828 return -EIO;···34123834 if ((brdp->iobase == 0) || (brdp->memaddr == 0))34133835 {34143836 release_region(brdp->iobase, brdp->iosize);34153415- return(-ENODEV);38373837+ return -ENODEV;34163838 }3417383934183840 brdp->iosize = ECP_IOSIZE;···3481390334823904 default:34833905 release_region(brdp->iobase, brdp->iosize);34843484- return(-EINVAL);39063906+ return -EINVAL;34853907 }3486390834873909/*···34933915 EBRDINIT(brdp);3494391634953917 brdp->membase = ioremap(brdp->memaddr, brdp->memsize);34963496- if (brdp->membase == (void *) NULL)39183918+ if (brdp->membase == NULL)34973919 {34983920 release_region(brdp->iobase, brdp->iosize);34993499- return(-ENOMEM);39213921+ return -ENOMEM;35003922 }3501392335023924/*···35053927 * this is, and what it is connected to it.35063928 */35073929 EBRDENABLE(brdp);35083508- sigsp = (cdkecpsig_t *) EBRDGETMEMPTR(brdp, CDK_SIGADDR);39303930+ sigsp = (cdkecpsig_t __iomem *) EBRDGETMEMPTR(brdp, CDK_SIGADDR);35093931 memcpy(&sig, sigsp, sizeof(cdkecpsig_t));35103932 EBRDDISABLE(brdp);3511393335123512-#if 035133513- printk("%s(%d): sig-> magic=%x rom=%x panel=%x,%x,%x,%x,%x,%x,%x,%x\n",35143514- __FILE__, __LINE__, (int) sig.magic, sig.romver, sig.panelid[0],35153515- (int) sig.panelid[1], (int) sig.panelid[2],35163516- (int) sig.panelid[3], (int) sig.panelid[4],35173517- (int) sig.panelid[5], (int) sig.panelid[6],35183518- (int) sig.panelid[7]);35193519-#endif35203520-35213521- if (sig.magic != ECP_MAGIC)39343934+ if (sig.magic != cpu_to_le32(ECP_MAGIC))35223935 {35233936 release_region(brdp->iobase, brdp->iosize);35243524- return(-ENODEV);39373937+ return -ENODEV;35253938 }3526393935273940/*···353639673537396835383969 brdp->state |= BST_FOUND;35393539- return(0);39703970+ return 0;35403971}3541397235423973/*****************************************************************************/···3548397935493980static int stli_initonb(stlibrd_t *brdp)35503981{35513551- cdkonbsig_t sig;35523552- cdkonbsig_t *sigsp;35533553- char *name;35543554- int i;35553555-35563556-#ifdef DEBUG35573557- printk(KERN_DEBUG "stli_initonb(brdp=%x)\n", (int) brdp);35583558-#endif39823982+ cdkonbsig_t sig;39833983+ cdkonbsig_t __iomem *sigsp;39843984+ char *name;39853985+ int i;3559398635603987/*35613988 * Do a basic sanity check on the IO and memory addresses.35623989 */35633563- if ((brdp->iobase == 0) || (brdp->memaddr == 0))35643564- return(-ENODEV);39903990+ if (brdp->iobase == 0 || brdp->memaddr == 0)39913991+ return -ENODEV;3565399235663993 brdp->iosize = ONB_IOSIZE;35673994···35754010 case BRD_ONBOARD2:35764011 case BRD_ONBOARD2_32:35774012 case BRD_ONBOARDRS:35783578- brdp->membase = (void *) brdp->memaddr;35794013 brdp->memsize = ONB_MEMSIZE;35804014 brdp->pagesize = ONB_ATPAGESIZE;35814015 brdp->init = stli_onbinit;···35924028 break;3593402935944030 case BRD_ONBOARDE:35953595- brdp->membase = (void *) brdp->memaddr;35964031 brdp->memsize = ONB_EIMEMSIZE;35974032 brdp->pagesize = ONB_EIPAGESIZE;35984033 brdp->init = stli_onbeinit;···36074044 case BRD_BRUMBY4:36084045 case BRD_BRUMBY8:36094046 case BRD_BRUMBY16:36103610- brdp->membase = (void *) brdp->memaddr;36114047 brdp->memsize = BBY_MEMSIZE;36124048 brdp->pagesize = BBY_PAGESIZE;36134049 brdp->init = stli_bbyinit;···36204058 break;3621405936224060 case BRD_STALLION:36233623- brdp->membase = (void *) brdp->memaddr;36244061 brdp->memsize = STAL_MEMSIZE;36254062 brdp->pagesize = STAL_PAGESIZE;36264063 brdp->init = stli_stalinit;···3634407336354074 default:36364075 release_region(brdp->iobase, brdp->iosize);36373637- return(-EINVAL);40764076+ return -EINVAL;36384077 }3639407836404079/*···36464085 EBRDINIT(brdp);3647408636484087 brdp->membase = ioremap(brdp->memaddr, brdp->memsize);36493649- if (brdp->membase == (void *) NULL)40884088+ if (brdp->membase == NULL)36504089 {36514090 release_region(brdp->iobase, brdp->iosize);36523652- return(-ENOMEM);40914091+ return -ENOMEM;36534092 }3654409336554094/*···36584097 * this is, and how many ports.36594098 */36604099 EBRDENABLE(brdp);36613661- sigsp = (cdkonbsig_t *) EBRDGETMEMPTR(brdp, CDK_SIGADDR);36623662- memcpy(&sig, sigsp, sizeof(cdkonbsig_t));41004100+ sigsp = (cdkonbsig_t __iomem *) EBRDGETMEMPTR(brdp, CDK_SIGADDR);41014101+ memcpy_fromio(&sig, sigsp, sizeof(cdkonbsig_t));36634102 EBRDDISABLE(brdp);3664410336653665-#if 036663666- printk("%s(%d): sig-> magic=%x:%x:%x:%x romver=%x amask=%x:%x:%x\n",36673667- __FILE__, __LINE__, sig.magic0, sig.magic1, sig.magic2,36683668- sig.magic3, sig.romver, sig.amask0, sig.amask1, sig.amask2);36693669-#endif36703670-36713671- if ((sig.magic0 != ONB_MAGIC0) || (sig.magic1 != ONB_MAGIC1) ||36723672- (sig.magic2 != ONB_MAGIC2) || (sig.magic3 != ONB_MAGIC3))41044104+ if (sig.magic0 != cpu_to_le16(ONB_MAGIC0) ||41054105+ sig.magic1 != cpu_to_le16(ONB_MAGIC1) ||41064106+ sig.magic2 != cpu_to_le16(ONB_MAGIC2) ||41074107+ sig.magic3 != cpu_to_le16(ONB_MAGIC3))36734108 {36744109 release_region(brdp->iobase, brdp->iosize);36753675- return(-ENODEV);41104110+ return -ENODEV;36764111 }3677411236784113/*···368941323690413336914134 brdp->state |= BST_FOUND;36923692- return(0);41354135+ return 0;36934136}3694413736954138/*****************************************************************************/···3702414537034146static int stli_startbrd(stlibrd_t *brdp)37044147{37053705- volatile cdkhdr_t *hdrp;37063706- volatile cdkmem_t *memp;37073707- volatile cdkasy_t *ap;37083708- unsigned long flags;37093709- stliport_t *portp;37103710- int portnr, nrdevs, i, rc;41484148+ cdkhdr_t __iomem *hdrp;41494149+ cdkmem_t __iomem *memp;41504150+ cdkasy_t __iomem *ap;41514151+ unsigned long flags;41524152+ stliport_t *portp;41534153+ int portnr, nrdevs, i, rc = 0;41544154+ u32 memoff;3711415537123712-#ifdef DEBUG37133713- printk(KERN_DEBUG "stli_startbrd(brdp=%x)\n", (int) brdp);37143714-#endif37153715-37163716- rc = 0;37173717-37183718- save_flags(flags);37193719- cli();41564156+ spin_lock_irqsave(&brd_lock, flags);37204157 EBRDENABLE(brdp);37213721- hdrp = (volatile cdkhdr_t *) EBRDGETMEMPTR(brdp, CDK_CDKADDR);41584158+ hdrp = (cdkhdr_t __iomem *) EBRDGETMEMPTR(brdp, CDK_CDKADDR);37224159 nrdevs = hdrp->nrdevs;3723416037244161#if 037254162 printk("%s(%d): CDK version %d.%d.%d --> "37264163 "nrdevs=%d memp=%x hostp=%x slavep=%x\n",37273727- __FILE__, __LINE__, hdrp->ver_release, hdrp->ver_modification,37283728- hdrp->ver_fix, nrdevs, (int) hdrp->memp, (int) hdrp->hostp,37293729- (int) hdrp->slavep);41644164+ __FILE__, __LINE__, readb(&hdrp->ver_release), readb(&hdrp->ver_modification),41654165+ readb(&hdrp->ver_fix), nrdevs, (int) readl(&hdrp->memp), readl(&hdrp->hostp),41664166+ readl(&hdrp->slavep));37304167#endif3731416837324169 if (nrdevs < (brdp->nrports + 1)) {···37324181 brdp->hostoffset = hdrp->hostp - CDK_CDKADDR;37334182 brdp->slaveoffset = hdrp->slavep - CDK_CDKADDR;37344183 brdp->bitsize = (nrdevs + 7) / 8;37353735- memp = (volatile cdkmem_t *) hdrp->memp;37363736- if (((unsigned long) memp) > brdp->memsize) {41844184+ memoff = readl(&hdrp->memp);41854185+ if (memoff > brdp->memsize) {37374186 printk(KERN_ERR "STALLION: corrupted shared memory region?\n");37384187 rc = -EIO;37394188 goto stli_donestartup;37404189 }37413741- memp = (volatile cdkmem_t *) EBRDGETMEMPTR(brdp, (unsigned long) memp);37423742- if (memp->dtype != TYP_ASYNCTRL) {41904190+ memp = (cdkmem_t __iomem *) EBRDGETMEMPTR(brdp, memoff);41914191+ if (readw(&memp->dtype) != TYP_ASYNCTRL) {37434192 printk(KERN_ERR "STALLION: no slave control device found\n");37444193 goto stli_donestartup;37454194 }···37514200 * change pages while reading memory map.37524201 */37534202 for (i = 1, portnr = 0; (i < nrdevs); i++, portnr++, memp++) {37543754- if (memp->dtype != TYP_ASYNC)42034203+ if (readw(&memp->dtype) != TYP_ASYNC)37554204 break;37564205 portp = brdp->ports[portnr];37573757- if (portp == (stliport_t *) NULL)42064206+ if (portp == NULL)37584207 break;37594208 portp->devnr = i;37603760- portp->addr = memp->offset;42094209+ portp->addr = readl(&memp->offset);37614210 portp->reqbit = (unsigned char) (0x1 << (i * 8 / nrdevs));37624211 portp->portidx = (unsigned char) (i / 8);37634212 portp->portbit = (unsigned char) (0x1 << (i % 8));37644213 }3765421437663766- hdrp->slavereq = 0xff;42154215+ writeb(0xff, &hdrp->slavereq);3767421637684217/*37694218 * For each port setup a local copy of the RX and TX buffer offsets···37724221 */37734222 for (i = 1, portnr = 0; (i < nrdevs); i++, portnr++) {37744223 portp = brdp->ports[portnr];37753775- if (portp == (stliport_t *) NULL)42244224+ if (portp == NULL)37764225 break;37774226 if (portp->addr == 0)37784227 break;37793779- ap = (volatile cdkasy_t *) EBRDGETMEMPTR(brdp, portp->addr);37803780- if (ap != (volatile cdkasy_t *) NULL) {37813781- portp->rxsize = ap->rxq.size;37823782- portp->txsize = ap->txq.size;37833783- portp->rxoffset = ap->rxq.offset;37843784- portp->txoffset = ap->txq.offset;42284228+ ap = (cdkasy_t __iomem *) EBRDGETMEMPTR(brdp, portp->addr);42294229+ if (ap != NULL) {42304230+ portp->rxsize = readw(&ap->rxq.size);42314231+ portp->txsize = readw(&ap->txq.size);42324232+ portp->rxoffset = readl(&ap->rxq.offset);42334233+ portp->txoffset = readl(&ap->txq.offset);37854234 }37864235 }3787423637884237stli_donestartup:37894238 EBRDDISABLE(brdp);37903790- restore_flags(flags);42394239+ spin_unlock_irqrestore(&brd_lock, flags);3791424037924241 if (rc == 0)37934242 brdp->state |= BST_STARTED;···37984247 add_timer(&stli_timerlist);37994248 }3800424938013801- return(rc);42504250+ return rc;38024251}3803425238044253/*****************************************************************************/···3809425838104259static int __init stli_brdinit(stlibrd_t *brdp)38114260{38123812-#ifdef DEBUG38133813- printk(KERN_DEBUG "stli_brdinit(brdp=%x)\n", (int) brdp);38143814-#endif38153815-38164261 stli_brds[brdp->brdnr] = brdp;3817426238184263 switch (brdp->brdtype) {···38364289 case BRD_ECHPCI:38374290 printk(KERN_ERR "STALLION: %s board type not supported in "38384291 "this driver\n", stli_brdnames[brdp->brdtype]);38393839- return(ENODEV);42924292+ return -ENODEV;38404293 default:38414294 printk(KERN_ERR "STALLION: board=%d is unknown board "38424295 "type=%d\n", brdp->brdnr, brdp->brdtype);38433843- return(ENODEV);42964296+ return -ENODEV;38444297 }3845429838464299 if ((brdp->state & BST_FOUND) == 0) {···38484301 "io=%x mem=%x\n",38494302 stli_brdnames[brdp->brdtype], brdp->brdnr,38504303 brdp->iobase, (int) brdp->memaddr);38513851- return(ENODEV);43044304+ return -ENODEV;38524305 }3853430638544307 stli_initports(brdp);···38564309 "nrpanels=%d nrports=%d\n", stli_brdnames[brdp->brdtype],38574310 brdp->brdnr, brdp->iobase, (int) brdp->memaddr,38584311 brdp->nrpanels, brdp->nrports);38593859- return(0);43124312+ return 0;38604313}3861431438624315/*****************************************************************************/···3868432138694322static int stli_eisamemprobe(stlibrd_t *brdp)38704323{38713871- cdkecpsig_t ecpsig, *ecpsigp;38723872- cdkonbsig_t onbsig, *onbsigp;43244324+ cdkecpsig_t ecpsig, __iomem *ecpsigp;43254325+ cdkonbsig_t onbsig, __iomem *onbsigp;38734326 int i, foundit;38743874-38753875-#ifdef DEBUG38763876- printk(KERN_DEBUG "stli_eisamemprobe(brdp=%x)\n", (int) brdp);38773877-#endif3878432738794328/*38804329 * First up we reset the board, to get it into a known state. There···38954352 mdelay(1);38964353 stli_onbeenable(brdp);38974354 } else {38983898- return(-ENODEV);43554355+ return -ENODEV;38994356 }3900435739014358 foundit = 0;···39074364 */39084365 for (i = 0; (i < stli_eisamempsize); i++) {39094366 brdp->memaddr = stli_eisamemprobeaddrs[i];39103910- brdp->membase = (void *) brdp->memaddr;39114367 brdp->membase = ioremap(brdp->memaddr, brdp->memsize);39123912- if (brdp->membase == (void *) NULL)43684368+ if (brdp->membase == NULL)39134369 continue;3914437039154371 if (brdp->brdtype == BRD_ECPE) {39163916- ecpsigp = (cdkecpsig_t *) stli_ecpeigetmemptr(brdp,43724372+ ecpsigp = (cdkecpsig_t __iomem *) stli_ecpeigetmemptr(brdp,39174373 CDK_SIGADDR, __LINE__);39183918- memcpy(&ecpsig, ecpsigp, sizeof(cdkecpsig_t));39193919- if (ecpsig.magic == ECP_MAGIC)43744374+ memcpy_fromio(&ecpsig, ecpsigp, sizeof(cdkecpsig_t));43754375+ if (ecpsig.magic == cpu_to_le32(ECP_MAGIC))39204376 foundit = 1;39214377 } else {39223922- onbsigp = (cdkonbsig_t *) stli_onbegetmemptr(brdp,43784378+ onbsigp = (cdkonbsig_t __iomem *) stli_onbegetmemptr(brdp,39234379 CDK_SIGADDR, __LINE__);39243924- memcpy(&onbsig, onbsigp, sizeof(cdkonbsig_t));39253925- if ((onbsig.magic0 == ONB_MAGIC0) &&39263926- (onbsig.magic1 == ONB_MAGIC1) &&39273927- (onbsig.magic2 == ONB_MAGIC2) &&39283928- (onbsig.magic3 == ONB_MAGIC3))43804380+ memcpy_fromio(&onbsig, onbsigp, sizeof(cdkonbsig_t));43814381+ if ((onbsig.magic0 == cpu_to_le16(ONB_MAGIC0)) &&43824382+ (onbsig.magic1 == cpu_to_le16(ONB_MAGIC1)) &&43834383+ (onbsig.magic2 == cpu_to_le16(ONB_MAGIC2)) &&43844384+ (onbsig.magic3 == cpu_to_le16(ONB_MAGIC3)))39294385 foundit = 1;39304386 }39314387···39484406 printk(KERN_ERR "STALLION: failed to probe shared memory "39494407 "region for %s in EISA slot=%d\n",39504408 stli_brdnames[brdp->brdtype], (brdp->iobase >> 12));39513951- return(-ENODEV);44094409+ return -ENODEV;39524410 }39533953- return(0);44114411+ return 0;39544412}3955441339564414static int stli_getbrdnr(void)···3981443939824440static int stli_findeisabrds(void)39834441{39843984- stlibrd_t *brdp;39853985- unsigned int iobase, eid;39863986- int i;39873987-39883988-#ifdef DEBUG39893989- printk(KERN_DEBUG "stli_findeisabrds()\n");39903990-#endif44424442+ stlibrd_t *brdp;44434443+ unsigned int iobase, eid;44444444+ int i;3991444539924446/*39933993- * Firstly check if this is an EISA system. Do this by probing for39943994- * the system board EISA ID. If this is not an EISA system then44474447+ * Firstly check if this is an EISA system. If this is not an EISA system then39954448 * don't bother going any further!39964449 */39973997- outb(0xff, 0xc80);39983998- if (inb(0xc80) == 0xff)39993999- return(0);44504450+ if (EISA_bus)44514451+ return 0;4000445240014453/*40024454 * Looks like an EISA system, so go searching for EISA boards.···40084472 */40094473 for (i = 0; (i < STL_MAXBRDS); i++) {40104474 brdp = stli_brds[i];40114011- if (brdp == (stlibrd_t *) NULL)44754475+ if (brdp == NULL)40124476 continue;40134477 if (brdp->iobase == iobase)40144478 break;···40204484 * We have found a Stallion board and it is not configured already.40214485 * Allocate a board structure and initialize it.40224486 */40234023- if ((brdp = stli_allocbrd()) == (stlibrd_t *) NULL)40244024- return(-ENOMEM);44874487+ if ((brdp = stli_allocbrd()) == NULL)44884488+ return -ENOMEM;40254489 if ((brdp->brdnr = stli_getbrdnr()) < 0)40264026- return(-ENOMEM);44904490+ return -ENOMEM;40274491 eid = inb(iobase + 0xc82);40284492 if (eid == ECP_EISAID)40294493 brdp->brdtype = BRD_ECPE;···40384502 stli_brdinit(brdp);40394503 }4040450440414041- return(0);45054505+ return 0;40424506}4043450740444508/*****************************************************************************/···4059452340604524static int stli_initpcibrd(int brdtype, struct pci_dev *devp)40614525{40624062- stlibrd_t *brdp;40634063-40644064-#ifdef DEBUG40654065- printk(KERN_DEBUG "stli_initpcibrd(brdtype=%d,busnr=%x,devnr=%x)\n",40664066- brdtype, dev->bus->number, dev->devfn);40674067-#endif45264526+ stlibrd_t *brdp;4068452740694528 if (pci_enable_device(devp))40704070- return(-EIO);40714071- if ((brdp = stli_allocbrd()) == (stlibrd_t *) NULL)40724072- return(-ENOMEM);45294529+ return -EIO;45304530+ if ((brdp = stli_allocbrd()) == NULL)45314531+ return -ENOMEM;40734532 if ((brdp->brdnr = stli_getbrdnr()) < 0) {40744533 printk(KERN_INFO "STALLION: too many boards found, "40754534 "maximum supported %d\n", STL_MAXBRDS);40764076- return(0);45354535+ return 0;40774536 }40784537 brdp->brdtype = brdtype;40794079-40804080-#ifdef DEBUG40814081- printk(KERN_DEBUG "%s(%d): BAR[]=%lx,%lx,%lx,%lx\n", __FILE__, __LINE__,40824082- pci_resource_start(devp, 0),40834083- pci_resource_start(devp, 1),40844084- pci_resource_start(devp, 2),40854085- pci_resource_start(devp, 3));40864086-#endif40874087-40884538/*40894539 * We have all resources from the board, so lets setup the actual40904540 * board structure now.···40794557 brdp->memaddr = pci_resource_start(devp, 2);40804558 stli_brdinit(brdp);4081455940824082- return(0);45604560+ return 0;40834561}4084456240854563/*****************************************************************************/···4091456940924570static int stli_findpcibrds(void)40934571{40944094- struct pci_dev *dev = NULL;40954095- int rc;45724572+ struct pci_dev *dev = NULL;4096457340974097-#ifdef DEBUG40984098- printk("stli_findpcibrds()\n");40994099-#endif41004100-41014101- while ((dev = pci_find_device(PCI_VENDOR_ID_STALLION,41024102- PCI_DEVICE_ID_ECRA, dev))) {41034103- if ((rc = stli_initpcibrd(BRD_ECPPCI, dev)))41044104- return(rc);45744574+ while ((dev = pci_get_device(PCI_VENDOR_ID_STALLION, PCI_DEVICE_ID_ECRA, dev))) {45754575+ stli_initpcibrd(BRD_ECPPCI, dev);41054576 }41064106-41074107- return(0);45774577+ return 0;41084578}4109457941104580#endif···4109459541104596static stlibrd_t *stli_allocbrd(void)41114597{41124112- stlibrd_t *brdp;45984598+ stlibrd_t *brdp;4113459941144600 brdp = kzalloc(sizeof(stlibrd_t), GFP_KERNEL);41154601 if (!brdp) {41164602 printk(KERN_ERR "STALLION: failed to allocate memory "41174117- "(size=%d)\n", sizeof(stlibrd_t));46034603+ "(size=%Zd)\n", sizeof(stlibrd_t));41184604 return NULL;41194605 }41204120-41214606 brdp->magic = STLI_BOARDMAGIC;41224122- return(brdp);46074607+ return brdp;41234608}4124460941254610/*****************************************************************************/···4130461741314618static int stli_initbrds(void)41324619{41334133- stlibrd_t *brdp, *nxtbrdp;41344134- stlconf_t *confp;41354135- int i, j;41364136-41374137-#ifdef DEBUG41384138- printk(KERN_DEBUG "stli_initbrds()\n");41394139-#endif46204620+ stlibrd_t *brdp, *nxtbrdp;46214621+ stlconf_t *confp;46224622+ int i, j;4140462341414624 if (stli_nrbrds > STL_MAXBRDS) {41424625 printk(KERN_INFO "STALLION: too many boards in configuration "···41474638 */41484639 for (i = 0; (i < stli_nrbrds); i++) {41494640 confp = &stli_brdconf[i];41504150-#ifdef MODULE41514641 stli_parsebrd(confp, stli_brdsp[i]);41524152-#endif41534153- if ((brdp = stli_allocbrd()) == (stlibrd_t *) NULL)41544154- return(-ENOMEM);46424642+ if ((brdp = stli_allocbrd()) == NULL)46434643+ return -ENOMEM;41554644 brdp->brdnr = i;41564645 brdp->brdtype = confp->brdtype;41574646 brdp->iobase = confp->ioaddr1;···41614654 * Static configuration table done, so now use dynamic methods to41624655 * see if any more boards should be configured.41634656 */41644164-#ifdef MODULE41654657 stli_argbrds();41664166-#endif41674658 if (STLI_EISAPROBE)41684659 stli_findeisabrds();41694660#ifdef CONFIG_PCI···41774672 if (stli_nrbrds > 1) {41784673 for (i = 0; (i < stli_nrbrds); i++) {41794674 brdp = stli_brds[i];41804180- if (brdp == (stlibrd_t *) NULL)46754675+ if (brdp == NULL)41814676 continue;41824677 for (j = i + 1; (j < stli_nrbrds); j++) {41834678 nxtbrdp = stli_brds[j];41844184- if (nxtbrdp == (stlibrd_t *) NULL)46794679+ if (nxtbrdp == NULL)41854680 continue;41864681 if ((brdp->membase >= nxtbrdp->membase) &&41874682 (brdp->membase <= (nxtbrdp->membase +···41964691 if (stli_shared == 0) {41974692 for (i = 0; (i < stli_nrbrds); i++) {41984693 brdp = stli_brds[i];41994199- if (brdp == (stlibrd_t *) NULL)46944694+ if (brdp == NULL)42004695 continue;42014696 if (brdp->state & BST_FOUND) {42024697 EBRDENABLE(brdp);···42064701 }42074702 }4208470342094209- return(0);47044704+ return 0;42104705}4211470642124707/*****************************************************************************/···4219471442204715static ssize_t stli_memread(struct file *fp, char __user *buf, size_t count, loff_t *offp)42214716{42224222- unsigned long flags;42234223- void *memptr;42244224- stlibrd_t *brdp;42254225- int brdnr, size, n;42264226-42274227-#ifdef DEBUG42284228- printk(KERN_DEBUG "stli_memread(fp=%x,buf=%x,count=%x,offp=%x)\n",42294229- (int) fp, (int) buf, count, (int) offp);42304230-#endif47174717+ unsigned long flags;47184718+ void *memptr;47194719+ stlibrd_t *brdp;47204720+ int brdnr, size, n;47214721+ void *p;47224722+ loff_t off = *offp;4231472342324724 brdnr = iminor(fp->f_dentry->d_inode);42334725 if (brdnr >= stli_nrbrds)42344234- return(-ENODEV);47264726+ return -ENODEV;42354727 brdp = stli_brds[brdnr];42364236- if (brdp == (stlibrd_t *) NULL)42374237- return(-ENODEV);47284728+ if (brdp == NULL)47294729+ return -ENODEV;42384730 if (brdp->state == 0)42394239- return(-ENODEV);42404240- if (fp->f_pos >= brdp->memsize)42414241- return(0);47314731+ return -ENODEV;47324732+ if (off >= brdp->memsize || off + count < off)47334733+ return 0;4242473442434243- size = MIN(count, (brdp->memsize - fp->f_pos));47354735+ size = MIN(count, (brdp->memsize - off));4244473642454245- save_flags(flags);42464246- cli();42474247- EBRDENABLE(brdp);47374737+ /*47384738+ * Copy the data a page at a time47394739+ */47404740+47414741+ p = (void *)__get_free_page(GFP_KERNEL);47424742+ if(p == NULL)47434743+ return -ENOMEM;47444744+42484745 while (size > 0) {42494249- memptr = (void *) EBRDGETMEMPTR(brdp, fp->f_pos);42504250- n = MIN(size, (brdp->pagesize - (((unsigned long) fp->f_pos) % brdp->pagesize)));42514251- if (copy_to_user(buf, memptr, n)) {47464746+ spin_lock_irqsave(&brd_lock, flags);47474747+ EBRDENABLE(brdp);47484748+ memptr = (void *) EBRDGETMEMPTR(brdp, off);47494749+ n = MIN(size, (brdp->pagesize - (((unsigned long) off) % brdp->pagesize)));47504750+ n = MIN(n, PAGE_SIZE);47514751+ memcpy_fromio(p, memptr, n);47524752+ EBRDDISABLE(brdp);47534753+ spin_unlock_irqrestore(&brd_lock, flags);47544754+ if (copy_to_user(buf, p, n)) {42524755 count = -EFAULT;42534756 goto out;42544757 }42554255- fp->f_pos += n;47584758+ off += n;42564759 buf += n;42574760 size -= n;42584761 }42594762out:42604260- EBRDDISABLE(brdp);42614261- restore_flags(flags);42624262-42634263- return(count);47634763+ *offp = off;47644764+ free_page((unsigned long)p);47654765+ return count;42644766}4265476742664768/*****************************************************************************/···42764764 * Code to handle an "staliomem" write operation. This device is the 42774765 * contents of the board shared memory. It is used for down loading42784766 * the slave image (and debugging :-)47674767+ *47684768+ * FIXME: copy under lock42794769 */4280477042814771static ssize_t stli_memwrite(struct file *fp, const char __user *buf, size_t count, loff_t *offp)42824772{42834283- unsigned long flags;42844284- void *memptr;42854285- stlibrd_t *brdp;42864286- char __user *chbuf;42874287- int brdnr, size, n;42884288-42894289-#ifdef DEBUG42904290- printk(KERN_DEBUG "stli_memwrite(fp=%x,buf=%x,count=%x,offp=%x)\n",42914291- (int) fp, (int) buf, count, (int) offp);42924292-#endif47734773+ unsigned long flags;47744774+ void *memptr;47754775+ stlibrd_t *brdp;47764776+ char __user *chbuf;47774777+ int brdnr, size, n;47784778+ void *p;47794779+ loff_t off = *offp;4293478042944781 brdnr = iminor(fp->f_dentry->d_inode);47824782+42954783 if (brdnr >= stli_nrbrds)42964296- return(-ENODEV);47844784+ return -ENODEV;42974785 brdp = stli_brds[brdnr];42984298- if (brdp == (stlibrd_t *) NULL)42994299- return(-ENODEV);47864786+ if (brdp == NULL)47874787+ return -ENODEV;43004788 if (brdp->state == 0)43014301- return(-ENODEV);43024302- if (fp->f_pos >= brdp->memsize)43034303- return(0);47894789+ return -ENODEV;47904790+ if (off >= brdp->memsize || off + count < off)47914791+ return 0;4304479243054793 chbuf = (char __user *) buf;43064306- size = MIN(count, (brdp->memsize - fp->f_pos));47944794+ size = MIN(count, (brdp->memsize - off));4307479543084308- save_flags(flags);43094309- cli();43104310- EBRDENABLE(brdp);47964796+ /*47974797+ * Copy the data a page at a time47984798+ */47994799+48004800+ p = (void *)__get_free_page(GFP_KERNEL);48014801+ if(p == NULL)48024802+ return -ENOMEM;48034803+43114804 while (size > 0) {43124312- memptr = (void *) EBRDGETMEMPTR(brdp, fp->f_pos);43134313- n = MIN(size, (brdp->pagesize - (((unsigned long) fp->f_pos) % brdp->pagesize)));43144314- if (copy_from_user(memptr, chbuf, n)) {43154315- count = -EFAULT;48054805+ n = MIN(size, (brdp->pagesize - (((unsigned long) off) % brdp->pagesize)));48064806+ n = MIN(n, PAGE_SIZE);48074807+ if (copy_from_user(p, chbuf, n)) {48084808+ if (count == 0)48094809+ count = -EFAULT;43164810 goto out;43174811 }43184318- fp->f_pos += n;48124812+ spin_lock_irqsave(&brd_lock, flags);48134813+ EBRDENABLE(brdp);48144814+ memptr = (void *) EBRDGETMEMPTR(brdp, off);48154815+ memcpy_toio(memptr, p, n);48164816+ EBRDDISABLE(brdp);48174817+ spin_unlock_irqrestore(&brd_lock, flags);48184818+ off += n;43194819 chbuf += n;43204820 size -= n;43214821 }43224822out:43234323- EBRDDISABLE(brdp);43244324- restore_flags(flags);43254325-43264326- return(count);48234823+ free_page((unsigned long) p);48244824+ *offp = off;48254825+ return count;43274826}4328482743294828/*****************************************************************************/···4345482243464823static int stli_getbrdstats(combrd_t __user *bp)43474824{43484348- stlibrd_t *brdp;43494349- int i;48254825+ stlibrd_t *brdp;48264826+ int i;4350482743514828 if (copy_from_user(&stli_brdstats, bp, sizeof(combrd_t)))43524829 return -EFAULT;43534830 if (stli_brdstats.brd >= STL_MAXBRDS)43544354- return(-ENODEV);48314831+ return -ENODEV;43554832 brdp = stli_brds[stli_brdstats.brd];43564356- if (brdp == (stlibrd_t *) NULL)43574357- return(-ENODEV);48334833+ if (brdp == NULL)48344834+ return -ENODEV;4358483543594836 memset(&stli_brdstats, 0, sizeof(combrd_t));43604837 stli_brdstats.brd = brdp->brdnr;···4373485043744851 if (copy_to_user(bp, &stli_brdstats, sizeof(combrd_t)))43754852 return -EFAULT;43764376- return(0);48534853+ return 0;43774854}4378485543794856/*****************************************************************************/···4384486143854862static stliport_t *stli_getport(int brdnr, int panelnr, int portnr)43864863{43874387- stlibrd_t *brdp;43884388- int i;48644864+ stlibrd_t *brdp;48654865+ int i;4389486643904390- if ((brdnr < 0) || (brdnr >= STL_MAXBRDS))43914391- return((stliport_t *) NULL);48674867+ if (brdnr < 0 || brdnr >= STL_MAXBRDS)48684868+ return NULL;43924869 brdp = stli_brds[brdnr];43934393- if (brdp == (stlibrd_t *) NULL)43944394- return((stliport_t *) NULL);48704870+ if (brdp == NULL)48714871+ return NULL;43954872 for (i = 0; (i < panelnr); i++)43964873 portnr += brdp->panels[i];43974874 if ((portnr < 0) || (portnr >= brdp->nrports))43984398- return((stliport_t *) NULL);43994399- return(brdp->ports[portnr]);48754875+ return NULL;48764876+ return brdp->ports[portnr];44004877}4401487844024879/*****************************************************************************/···4415489244164893 memset(&stli_comstats, 0, sizeof(comstats_t));4417489444184418- if (portp == (stliport_t *) NULL)44194419- return(-ENODEV);48954895+ if (portp == NULL)48964896+ return -ENODEV;44204897 brdp = stli_brds[portp->brdnr];44214421- if (brdp == (stlibrd_t *) NULL)44224422- return(-ENODEV);48984898+ if (brdp == NULL)48994899+ return -ENODEV;4423490044244901 if (brdp->state & BST_STARTED) {44254902 if ((rc = stli_cmdwait(brdp, portp, A_GETSTATS,44264903 &stli_cdkstats, sizeof(asystats_t), 1)) < 0)44274427- return(rc);49044904+ return rc;44284905 } else {44294906 memset(&stli_cdkstats, 0, sizeof(asystats_t));44304907 }···44354912 stli_comstats.state = portp->state;44364913 stli_comstats.flags = portp->flags;4437491444384438- save_flags(flags);44394439- cli();44404440- if (portp->tty != (struct tty_struct *) NULL) {49154915+ spin_lock_irqsave(&brd_lock, flags);49164916+ if (portp->tty != NULL) {44414917 if (portp->tty->driver_data == portp) {44424918 stli_comstats.ttystate = portp->tty->flags;44434443- stli_comstats.rxbuffered = -1 /*portp->tty->flip.count*/;44444444- if (portp->tty->termios != (struct termios *) NULL) {49194919+ stli_comstats.rxbuffered = -1;49204920+ if (portp->tty->termios != NULL) {44454921 stli_comstats.cflags = portp->tty->termios->c_cflag;44464922 stli_comstats.iflags = portp->tty->termios->c_iflag;44474923 stli_comstats.oflags = portp->tty->termios->c_oflag;···44484926 }44494927 }44504928 }44514451- restore_flags(flags);49294929+ spin_unlock_irqrestore(&brd_lock, flags);4452493044534931 stli_comstats.txtotal = stli_cdkstats.txchars;44544932 stli_comstats.rxtotal = stli_cdkstats.rxchars + stli_cdkstats.ringover;···44704948 stli_comstats.hwid = stli_cdkstats.hwid;44714949 stli_comstats.signals = stli_mktiocm(stli_cdkstats.signals);4472495044734473- return(0);49514951+ return 0;44744952}4475495344764954/*****************************************************************************/···4483496144844962static int stli_getportstats(stliport_t *portp, comstats_t __user *cp)44854963{44864486- stlibrd_t *brdp;44874487- int rc;49644964+ stlibrd_t *brdp;49654965+ int rc;4488496644894967 if (!portp) {44904968 if (copy_from_user(&stli_comstats, cp, sizeof(comstats_t)))···4514499245154993static int stli_clrportstats(stliport_t *portp, comstats_t __user *cp)45164994{45174517- stlibrd_t *brdp;45184518- int rc;49954995+ stlibrd_t *brdp;49964996+ int rc;4519499745204998 if (!portp) {45214999 if (copy_from_user(&stli_comstats, cp, sizeof(comstats_t)))···4553503145545032static int stli_getportstruct(stliport_t __user *arg)45555033{45564556- stliport_t *portp;50345034+ stliport_t *portp;4557503545585036 if (copy_from_user(&stli_dummyport, arg, sizeof(stliport_t)))45595037 return -EFAULT;···4574505245755053static int stli_getbrdstruct(stlibrd_t __user *arg)45765054{45774577- stlibrd_t *brdp;50555055+ stlibrd_t *brdp;4578505645795057 if (copy_from_user(&stli_dummybrd, arg, sizeof(stlibrd_t)))45805058 return -EFAULT;···4598507645995077static int stli_memioctl(struct inode *ip, struct file *fp, unsigned int cmd, unsigned long arg)46005078{46014601- stlibrd_t *brdp;46024602- int brdnr, rc, done;50795079+ stlibrd_t *brdp;50805080+ int brdnr, rc, done;46035081 void __user *argp = (void __user *)arg;46044604-46054605-#ifdef DEBUG46064606- printk(KERN_DEBUG "stli_memioctl(ip=%x,fp=%x,cmd=%x,arg=%x)\n",46074607- (int) ip, (int) fp, cmd, (int) arg);46084608-#endif4609508246105083/*46115084 * First up handle the board independent ioctls.···46325115 }4633511646345117 if (done)46354635- return(rc);51185118+ return rc;4636511946375120/*46385121 * Now handle the board specific ioctls. These all depend on the···46405123 */46415124 brdnr = iminor(ip);46425125 if (brdnr >= STL_MAXBRDS)46434643- return(-ENODEV);51265126+ return -ENODEV;46445127 brdp = stli_brds[brdnr];46455128 if (!brdp)46464646- return(-ENODEV);51295129+ return -ENODEV;46475130 if (brdp->state == 0)46484648- return(-ENODEV);51315131+ return -ENODEV;4649513246505133 switch (cmd) {46515134 case STL_BINTR:···46695152 rc = -ENOIOCTLCMD;46705153 break;46715154 }46724672-46734673- return(rc);51555155+ return rc;46745156}4675515746765158static struct tty_operations stli_ops = {···47035187 int i;47045188 printk(KERN_INFO "%s: version %s\n", stli_drvtitle, stli_drvversion);4705518951905190+ spin_lock_init(&stli_lock);51915191+ spin_lock_init(&brd_lock);51925192+47065193 stli_initbrds();4707519447085195 stli_serial = alloc_tty_driver(STL_MAXBRDS * STL_MAXPORTS);···47155196/*47165197 * Allocate a temporary write buffer.47175198 */47184718- stli_tmpwritebuf = kmalloc(STLI_TXBUFSIZE, GFP_KERNEL);47194719- if (!stli_tmpwritebuf)47204720- printk(KERN_ERR "STALLION: failed to allocate memory "47214721- "(size=%d)\n", STLI_TXBUFSIZE);47225199 stli_txcookbuf = kmalloc(STLI_TXBUFSIZE, GFP_KERNEL);47235200 if (!stli_txcookbuf)47245201 printk(KERN_ERR "STALLION: failed to allocate memory "···47585243 printk(KERN_ERR "STALLION: failed to register serial driver\n");47595244 return -EBUSY;47605245 }47614761- return(0);52465246+ return 0;47625247}4763524847645249/*****************************************************************************/
···11321132 * buffer, and once to drain the space from the (physical) beginning of11331133 * the buffer to head pointer.11341134 *11351135- * Called under the tty->atomic_read_lock sem and with TTY_DONT_FLIP set11351135+ * Called under the tty->atomic_read_lock sem11361136 *11371137 */11381138···12711271 }1272127212731273 add_wait_queue(&tty->read_wait, &wait);12741274- set_bit(TTY_DONT_FLIP, &tty->flags);12751274 while (nr) {12761275 /* First test for status change. */12771276 if (tty->packet && tty->link->ctrl_status) {···13141315 break;13151316 }13161317 n_tty_set_room(tty);13171317- clear_bit(TTY_DONT_FLIP, &tty->flags);13181318 timeout = schedule_timeout(timeout);13191319- set_bit(TTY_DONT_FLIP, &tty->flags);13201319 continue;13211320 }13221321 __set_current_state(TASK_RUNNING);···13911394 if (time)13921395 timeout = time;13931396 }13941394- clear_bit(TTY_DONT_FLIP, &tty->flags);13951397 mutex_unlock(&tty->atomic_read_lock);13961398 remove_wait_queue(&tty->read_wait, &wait);13971399
+1-1
drivers/char/pty.c
···101101 *102102 * FIXME: Our pty_write method is called with our ldisc lock held but103103 * not our partners. We can't just take the other one blindly without104104- * risking deadlocks. There is also the small matter of TTY_DONT_FLIP104104+ * risking deadlocks.105105 */106106static int pty_write(struct tty_struct * tty, const unsigned char *buf, int count)107107{
+3
drivers/char/stallion.c
···30293029 int i;30303030 printk(KERN_INFO "%s: version %s\n", stl_drvtitle, stl_drvversion);3031303130323032+ spin_lock_init(&stallion_lock);30333033+ spin_lock_init(&brd_lock);30343034+30323035 stl_initbrds();3033303630343037 stl_serial = alloc_tty_driver(STL_MAXBRDS * STL_MAXPORTS);
+30-38
drivers/char/tty_io.c
···267267 p->used = 0;268268 p->size = size;269269 p->next = NULL;270270- p->active = 0;271270 p->commit = 0;272271 p->read = 0;273272 p->char_buf_ptr = (char *)(p->data);···326327 /* OPTIMISATION: We could keep a per tty "zero" sized buffer to327328 remove this conditional if its worth it. This would be invisible328329 to the callers */329329- if ((b = tty->buf.tail) != NULL) {330330+ if ((b = tty->buf.tail) != NULL)330331 left = b->size - b->used;331331- b->active = 1;332332- } else332332+ else333333 left = 0;334334335335 if (left < size) {···336338 if ((n = tty_buffer_find(tty, size)) != NULL) {337339 if (b != NULL) {338340 b->next = n;339339- b->active = 0;340341 b->commit = b->used;341342 } else342343 tty->buf.head = n;343344 tty->buf.tail = n;344344- n->active = 1;345345 } else346346 size = left;347347 }···400404{401405 unsigned long flags;402406 spin_lock_irqsave(&tty->buf.lock, flags);403403- if (tty->buf.tail != NULL) {404404- tty->buf.tail->active = 0;407407+ if (tty->buf.tail != NULL)405408 tty->buf.tail->commit = tty->buf.tail->used;406406- }407409 spin_unlock_irqrestore(&tty->buf.lock, flags);408410 schedule_delayed_work(&tty->buf.work, 1);409411}···778784 }779785780786 clear_bit(TTY_LDISC, &tty->flags);781781- clear_bit(TTY_DONT_FLIP, &tty->flags);782782- if (o_tty) {787787+ if (o_tty)783788 clear_bit(TTY_LDISC, &o_tty->flags);784784- clear_bit(TTY_DONT_FLIP, &o_tty->flags);785785- }786789 spin_unlock_irqrestore(&tty_ldisc_lock, flags);787790788791 /*···19461955 * race with the set_ldisc code path.19471956 */19481957 clear_bit(TTY_LDISC, &tty->flags);19491949- clear_bit(TTY_DONT_FLIP, &tty->flags);19501958 cancel_delayed_work(&tty->buf.work);1951195919521960 /*···27652775 struct tty_struct *tty = (struct tty_struct *) private_;27662776 unsigned long flags;27672777 struct tty_ldisc *disc;27682768- struct tty_buffer *tbuf;27692769- int count;27782778+ struct tty_buffer *tbuf, *head;27702779 char *char_buf;27712780 unsigned char *flag_buf;27722781···27732784 if (disc == NULL) /* !TTY_LDISC */27742785 return;2775278627762776- if (test_bit(TTY_DONT_FLIP, &tty->flags)) {27772777- /*27782778- * Do it after the next timer tick:27792779- */27802780- schedule_delayed_work(&tty->buf.work, 1);27812781- goto out;27822782- }27832787 spin_lock_irqsave(&tty->buf.lock, flags);27842784- while((tbuf = tty->buf.head) != NULL) {27852785- while ((count = tbuf->commit - tbuf->read) != 0) {27862786- char_buf = tbuf->char_buf_ptr + tbuf->read;27872787- flag_buf = tbuf->flag_buf_ptr + tbuf->read;27882788- tbuf->read += count;27882788+ head = tty->buf.head;27892789+ if (head != NULL) {27902790+ tty->buf.head = NULL;27912791+ for (;;) {27922792+ int count = head->commit - head->read;27932793+ if (!count) {27942794+ if (head->next == NULL)27952795+ break;27962796+ tbuf = head;27972797+ head = head->next;27982798+ tty_buffer_free(tty, tbuf);27992799+ continue;28002800+ }28012801+ if (!tty->receive_room) {28022802+ schedule_delayed_work(&tty->buf.work, 1);28032803+ break;28042804+ }28052805+ if (count > tty->receive_room)28062806+ count = tty->receive_room;28072807+ char_buf = head->char_buf_ptr + head->read;28082808+ flag_buf = head->flag_buf_ptr + head->read;28092809+ head->read += count;27892810 spin_unlock_irqrestore(&tty->buf.lock, flags);27902811 disc->receive_buf(tty, char_buf, flag_buf, count);27912812 spin_lock_irqsave(&tty->buf.lock, flags);27922813 }27932793- if (tbuf->active)27942794- break;27952795- tty->buf.head = tbuf->next;27962796- if (tty->buf.head == NULL)27972797- tty->buf.tail = NULL;27982798- tty_buffer_free(tty, tbuf);28142814+ tty->buf.head = head;27992815 }28002816 spin_unlock_irqrestore(&tty->buf.lock, flags);28012801-out:28172817+28022818 tty_ldisc_deref(disc);28032819}28042820···28962902{28972903 unsigned long flags;28982904 spin_lock_irqsave(&tty->buf.lock, flags);28992899- if (tty->buf.tail != NULL) {29002900- tty->buf.tail->active = 0;29052905+ if (tty->buf.tail != NULL)29012906 tty->buf.tail->commit = tty->buf.tail->used;29022902- }29032907 spin_unlock_irqrestore(&tty->buf.lock, flags);2904290829052909 if (tty->low_latency)
+71-11
drivers/char/watchdog/at91_wdt.c
···1717#include <linux/miscdevice.h>1818#include <linux/module.h>1919#include <linux/moduleparam.h>2020+#include <linux/platform_device.h>2021#include <linux/types.h>2122#include <linux/watchdog.h>2223#include <asm/bitops.h>2324#include <asm/uaccess.h>242525262626-#define WDT_DEFAULT_TIME 5 /* 5 seconds */2727-#define WDT_MAX_TIME 256 /* 256 seconds */2727+#define WDT_DEFAULT_TIME 5 /* seconds */2828+#define WDT_MAX_TIME 256 /* seconds */28292930static int wdt_time = WDT_DEFAULT_TIME;3031static int nowayout = WATCHDOG_NOWAYOUT;···3332module_param(wdt_time, int, 0);3433MODULE_PARM_DESC(wdt_time, "Watchdog time in seconds. (default="__MODULE_STRING(WDT_DEFAULT_TIME) ")");35343535+#ifdef CONFIG_WATCHDOG_NOWAYOUT3636module_param(nowayout, int, 0);3737MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");3838+#endif383939404041static unsigned long at91wdt_busy;···141138 case WDIOC_SETTIMEOUT:142139 if (get_user(new_value, p))143140 return -EFAULT;144144-141141+145142 if (at91_wdt_settimeout(new_value))146143 return -EINVAL;147144···199196 .fops = &at91wdt_fops,200197};201198202202-static int __init at91_wdt_init(void)199199+static int __init at91wdt_probe(struct platform_device *pdev)203200{204201 int res;205202206206- /* Check that the heartbeat value is within range; if not reset to the default */207207- if (at91_wdt_settimeout(wdt_time)) {208208- at91_wdt_settimeout(WDT_DEFAULT_TIME);209209- printk(KERN_INFO "at91_wdt: wdt_time value must be 1 <= wdt_time <= 256, using %d\n", wdt_time);210210- }203203+ if (at91wdt_miscdev.dev)204204+ return -EBUSY;205205+ at91wdt_miscdev.dev = &pdev->dev;211206212207 res = misc_register(&at91wdt_miscdev);213208 if (res)214209 return res;215210216216- printk("AT91 Watchdog Timer enabled (%d seconds, nowayout=%d)\n", wdt_time, nowayout);211211+ printk("AT91 Watchdog Timer enabled (%d seconds%s)\n", wdt_time, nowayout ? ", nowayout" : "");217212 return 0;213213+}214214+215215+static int __exit at91wdt_remove(struct platform_device *pdev)216216+{217217+ int res;218218+219219+ res = misc_deregister(&at91wdt_miscdev);220220+ if (!res)221221+ at91wdt_miscdev.dev = NULL;222222+223223+ return res;224224+}225225+226226+static void at91wdt_shutdown(struct platform_device *pdev)227227+{228228+ at91_wdt_stop();229229+}230230+231231+#ifdef CONFIG_PM232232+233233+static int at91wdt_suspend(struct platform_device *pdev, pm_message_t message)234234+{235235+ at91_wdt_stop();236236+ return 0;237237+}238238+239239+static int at91wdt_resume(struct platform_device *pdev)240240+{241241+ if (at91wdt_busy)242242+ at91_wdt_start();243243+ return 0;244244+}245245+246246+#else247247+#define at91wdt_suspend NULL248248+#define at91wdt_resume NULL249249+#endif250250+251251+static struct platform_driver at91wdt_driver = {252252+ .probe = at91wdt_probe,253253+ .remove = __exit_p(at91wdt_remove),254254+ .shutdown = at91wdt_shutdown,255255+ .suspend = at91wdt_suspend,256256+ .resume = at91wdt_resume,257257+ .driver = {258258+ .name = "at91_wdt",259259+ .owner = THIS_MODULE,260260+ },261261+};262262+263263+static int __init at91_wdt_init(void)264264+{265265+ /* Check that the heartbeat value is within range; if not reset to the default */266266+ if (at91_wdt_settimeout(wdt_time)) {267267+ at91_wdt_settimeout(WDT_DEFAULT_TIME);268268+ pr_info("at91_wdt: wdt_time value must be 1 <= wdt_time <= 256, using %d\n", wdt_time);269269+ }270270+271271+ return platform_driver_register(&at91wdt_driver);218272}219273220274static void __exit at91_wdt_exit(void)221275{222222- misc_deregister(&at91wdt_miscdev);276276+ platform_driver_unregister(&at91wdt_driver);223277}224278225279module_init(at91_wdt_init);
+27-1
drivers/char/watchdog/i8xx_tco.c
···205205 return 0;206206}207207208208+static int tco_timer_get_timeleft (int *time_left)209209+{210210+ unsigned char val;211211+212212+ spin_lock(&tco_lock);213213+214214+ /* read the TCO Timer */215215+ val = inb (TCO1_RLD);216216+ val &= 0x3f;217217+218218+ spin_unlock(&tco_lock);219219+220220+ *time_left = (int)((val * 6) / 10);221221+222222+ return 0;223223+}224224+208225/*209226 * /dev/watchdog handling210227 */···289272{290273 int new_options, retval = -EINVAL;291274 int new_heartbeat;275275+ int time_left;292276 void __user *argp = (void __user *)arg;293277 int __user *p = argp;294278 static struct watchdog_info ident = {···338320 return -EFAULT;339321340322 if (tco_timer_set_heartbeat(new_heartbeat))341341- return -EINVAL;323323+ return -EINVAL;342324343325 tco_timer_keepalive ();344326 /* Fall */···346328347329 case WDIOC_GETTIMEOUT:348330 return put_user(heartbeat, p);331331+332332+ case WDIOC_GETTIMELEFT:333333+ {334334+ if (tco_timer_get_timeleft(&time_left))335335+ return -EINVAL;336336+337337+ return put_user(time_left, p);338338+ }349339350340 default:351341 return -ENOIOCTLCMD;
+29-1
drivers/char/watchdog/pcwd_pci.c
···2121 */22222323/*2424- * A bells and whistles driver is available from: 2424+ * A bells and whistles driver is available from:2525 * http://www.kernel.org/pub/linux/kernel/people/wim/pcwd/pcwd_pci/2626 *2727 * More info available at http://www.berkprod.com/ or http://www.pcwatchdog.com/···390390 return 0;391391}392392393393+static int pcipcwd_get_timeleft(int *time_left)394394+{395395+ int msb;396396+ int lsb;397397+398398+ /* Read the time that's left before rebooting */399399+ /* Note: if the board is not yet armed then we will read 0xFFFF */400400+ send_command(CMD_READ_WATCHDOG_TIMEOUT, &msb, &lsb);401401+402402+ *time_left = (msb << 8) + lsb;403403+404404+ if (debug >= VERBOSE)405405+ printk(KERN_DEBUG PFX "Time left before next reboot: %d\n",406406+ *time_left);407407+408408+ return 0;409409+}410410+393411/*394412 * /dev/watchdog handling395413 */···529511530512 case WDIOC_GETTIMEOUT:531513 return put_user(heartbeat, p);514514+515515+ case WDIOC_GETTIMELEFT:516516+ {517517+ int time_left;518518+519519+ if (pcipcwd_get_timeleft(&time_left))520520+ return -EFAULT;521521+522522+ return put_user(time_left, p);523523+ }532524533525 default:534526 return -ENOIOCTLCMD;
+23
drivers/char/watchdog/pcwd_usb.c
···317317 return 0;318318}319319320320+static int usb_pcwd_get_timeleft(struct usb_pcwd_private *usb_pcwd, int *time_left)321321+{322322+ unsigned char msb, lsb;323323+324324+ /* Read the time that's left before rebooting */325325+ /* Note: if the board is not yet armed then we will read 0xFFFF */326326+ usb_pcwd_send_command(usb_pcwd, CMD_READ_WATCHDOG_TIMEOUT, &msb, &lsb);327327+328328+ *time_left = (msb << 8) + lsb;329329+330330+ return 0;331331+}332332+320333/*321334 * /dev/watchdog handling322335 */···434421435422 case WDIOC_GETTIMEOUT:436423 return put_user(heartbeat, p);424424+425425+ case WDIOC_GETTIMELEFT:426426+ {427427+ int time_left;428428+429429+ if (usb_pcwd_get_timeleft(usb_pcwd_device, &time_left))430430+ return -EFAULT;431431+432432+ return put_user(time_left, p);433433+ }437434438435 default:439436 return -ENOIOCTLCMD;
+1-1
drivers/ide/ide-io.c
···505505 }506506 }507507508508- if ((stat & DRQ_STAT) && rq_data_dir(rq) == READ)508508+ if ((stat & DRQ_STAT) && rq_data_dir(rq) == READ && hwif->err_stops_fifo == 0)509509 try_to_flush_leftover_data(drive);510510511511 if (hwif->INB(IDE_STATUS_REG) & (BUSY_STAT|DRQ_STAT))
+4
drivers/ide/ide-iops.c
···597597{598598 if(HWIF(drive)->udma_four == 0)599599 return 0;600600+601601+ /* Check for SATA but only if we are ATA5 or higher */602602+ if (drive->id->hw_config == 0 && (drive->id->major_rev_num & 0x7FE0))603603+ return 1;600604 if (!(drive->id->hw_config & 0x6000))601605 return 0;602606#ifndef CONFIG_IDEDMA_IVB
···162162 This driver can also be built as a module. If so, the module163163 will be called rtc-pcf8583.164164165165+config RTC_DRV_RS5C348166166+ tristate "Ricoh RS5C348A/B"167167+ depends on RTC_CLASS && SPI168168+ help169169+ If you say yes here you get support for the170170+ Ricoh RS5C348A and RS5C348B RTC chips.171171+172172+ This driver can also be built as a module. If so, the module173173+ will be called rtc-rs5c348.174174+165175config RTC_DRV_RS5C372166176 tristate "Ricoh RS5C372A/B"167177 depends on RTC_CLASS && I2C
···589589 ld = tty_ldisc_ref(tp);590590591591 /*592592- * If the DONT_FLIP flag is on, don't flush our buffer, and act593593- * like the ld doesn't have any space to put the data right now.594594- */595595- if (test_bit(TTY_DONT_FLIP, &tp->flags))596596- len = 0;597597-598598- /*599592 * If we were unable to get a reference to the ld,600593 * don't flush our buffer, and act like the ld doesn't601594 * have any space to put the data right now.
···453453 tty = port->tty;454454455455 /*456456- * FIXME: must not do this in IRQ context,457457- * must honour TTY_DONT_FLIP456456+ * FIXME: must not do this in IRQ context458457 */459458 tty->ldisc.receive_buf(460459 tty,
+3-3
drivers/video/aty/radeon_backlight.c
···40404141 mutex_unlock(&info->bl_mutex);42424343- if (pdata->negative)4444- rlevel = MAX_RADEON_LEVEL - rlevel;4545-4643 if (rlevel < 0)4744 rlevel = 0;4845 else if (rlevel > MAX_RADEON_LEVEL)4946 rlevel = MAX_RADEON_LEVEL;4747+4848+ if (pdata->negative)4949+ rlevel = MAX_RADEON_LEVEL - rlevel;50505151 return rlevel;5252}
···139139 put_metapage(mp);140140}141141142142-extern struct address_space_operations jfs_metapage_aops;142142+extern const struct address_space_operations jfs_metapage_aops;143143144144/*145145 * This routines invalidate all pages for an extent.
···3333 * bus_to_virt: Used to convert an address for DMA operations3434 * to an address that the kernel can use.3535 */3636-#define __virt_to_bus__is_a_macro3736#define __virt_to_bus(x) __virt_to_phys(x)3838-#define __bus_to_virt__is_a_macro3937#define __bus_to_virt(x) __phys_to_virt(x)40384139#endif
-2
include/asm-arm/arch-h720x/memory.h
···2323 * There is something to do here later !, Mar 2000, Jungjun Kim2424 */25252626-#define __virt_to_bus__is_a_macro2726#define __virt_to_bus(x) __virt_to_phys(x)2828-#define __bus_to_virt__is_a_macro2927#define __bus_to_virt(x) __phys_to_virt(x)30283129#endif
+2-4
include/asm-arm/arch-imx/memory.h
···3030 * bus_to_virt: Used to convert an address for DMA operations3131 * to an address that the kernel can use.3232 */3333-#define __virt_to_bus__is_a_macro3434-#define __virt_to_bus(x) (x - PAGE_OFFSET + PHYS_OFFSET)3535-#define __bus_to_virt__is_a_macro3636-#define __bus_to_virt(x) (x - PHYS_OFFSET + PAGE_OFFSET)3333+#define __virt_to_bus(x) (x - PAGE_OFFSET + PHYS_OFFSET)3434+#define __bus_to_virt(x) (x - PHYS_OFFSET + PAGE_OFFSET)37353836#endif
-11
include/asm-arm/arch-ixp23xx/ixp23xx.h
···295295#define IXP23XX_PCI_CPP_ADDR_BITS IXP23XX_PCI_CSR(0x0160)296296297297298298-#ifndef __ASSEMBLY__299299-/*300300- * Is system memory on the XSI or CPP bus?301301- */302302-static inline unsigned ixp23xx_cpp_boot(void)303303-{304304- return (*IXP23XX_EXP_CFG0 & IXP23XX_EXP_CFG0_XSI_NOT_PRES);305305-}306306-#endif307307-308308-309298#endif
+10
include/asm-arm/arch-ixp23xx/platform.h
···43434444#define IXP23XX_UART_XTAL 1474560045454646+#ifndef __ASSEMBLY__4747+/*4848+ * Is system memory on the XSI or CPP bus?4949+ */5050+static inline unsigned ixp23xx_cpp_boot(void)5151+{5252+ return (*IXP23XX_EXP_CFG0 & IXP23XX_EXP_CFG0_XSI_NOT_PRES);5353+}5454+#endif5555+46564757#endif
···77 * it under the terms of the GNU General Public License version 2 as88 * published by the Free Software Foundation.99 *1010- * S3C2440 Signal Drive Strength Control1111- *1212- * Changelog:1313- * 11-Aug-2004 BJD Created file1414- * 25-Aug-2004 BJD Added the _SELECT_* defs for using with functions1010+ * S3C2440/S3C2412 Signal Drive Strength Control1511*/161217131814#ifndef __ASM_ARCH_REGS_DSC_H1915#define __ASM_ARCH_REGS_DSC_H "2440-dsc"20162121-#ifdef CONFIG_CPU_S3C24401717+#if defined(CONFIG_CPU_S3C2412)1818+#define S3C2412_DSC0 S3C2410_GPIOREG(0xdc)1919+#define S3C2412_DSC1 S3C2410_GPIOREG(0xe0)2020+#endif2121+2222+#if defined(CONFIG_CPU_S3C2440)22232324#define S3C2440_DSC0 S3C2410_GPIOREG(0xc4)2425#define S3C2440_DSC1 S3C2410_GPIOREG(0xc8)2525-2626-#define S3C2412_DSC0 S3C2410_GPIOREG(0xdc)2727-#define S3C2412_DSC1 S3C2410_GPIOREG(0xe0)28262927#define S3C2440_SELECT_DSC0 (0)3028#define S3C2440_SELECT_DSC1 (1<<31)
+4
include/asm-arm/bugs.h
···1010#ifndef __ASM_BUGS_H1111#define __ASM_BUGS_H12121313+#ifdef CONFIG_MMU1314extern void check_writebuffer_bugs(void);14151516#define check_bugs() check_writebuffer_bugs()1717+#else1818+#define check_bugs() do { } while (0)1919+#endif16201721#endif
+7
include/asm-arm/domain.h
···5050#define domain_val(dom,type) ((type) << (2*(dom)))51515252#ifndef __ASSEMBLY__5353+5454+#ifdef CONFIG_MMU5355#define set_domain(x) \5456 do { \5557 __asm__ __volatile__( \···6765 thread->cpu_domain = domain | domain_val(dom, type); \6866 set_domain(thread->cpu_domain); \6967 } while (0)6868+6969+#else7070+#define set_domain(x) do { } while (0)7171+#define modify_domain(dom,type) do { } while (0)7272+#endif70737174#endif7275#endif /* !__ASSEMBLY__ */
+8
include/asm-arm/fpstate.h
···72727373#define FP_SIZE (sizeof(union fp_state) / sizeof(int))74747575+struct crunch_state {7676+ unsigned int mvdx[16][2];7777+ unsigned int mvax[4][3];7878+ unsigned int dspsc[2];7979+};8080+8181+#define CRUNCH_SIZE sizeof(struct crunch_state)8282+7583#endif76847785#endif
···22 * linux/include/asm-arm/memory.h33 *44 * Copyright (C) 2000-2002 Russell King55+ * modification for nommu, Hyok S. Choi, 200456 *67 * This program is free software; you can redistribute it and/or modify78 * it under the terms of the GNU General Public License version 2 as···2726#include <asm/arch/memory.h>2827#include <asm/sizes.h>29282929+#ifdef CONFIG_MMU3030+3031#ifndef TASK_SIZE3132/*3233 * TASK_SIZE - the maximum size of a user space task.···4946#ifndef PAGE_OFFSET5047#define PAGE_OFFSET UL(0xc0000000)5148#endif4949+5050+/*5151+ * The module space lives between the addresses given by TASK_SIZE5252+ * and PAGE_OFFSET - it must be within 32MB of the kernel text.5353+ */5454+#define MODULE_END (PAGE_OFFSET)5555+#define MODULE_START (MODULE_END - 16*1048576)5656+5757+#if TASK_SIZE > MODULE_START5858+#error Top of user space clashes with start of module space5959+#endif6060+6161+/*6262+ * The XIP kernel gets mapped at the bottom of the module vm area.6363+ * Since we use sections to map it, this macro replaces the physical address6464+ * with its virtual address while keeping offset from the base section.6565+ */6666+#define XIP_VIRT_ADDR(physaddr) (MODULE_START + ((physaddr) & 0x000fffff))6767+6868+#else /* CONFIG_MMU */6969+7070+/*7171+ * The limitation of user task size can grow up to the end of free ram region.7272+ * It is difficult to define and perhaps will never meet the original meaning7373+ * of this define that was meant to.7474+ * Fortunately, there is no reference for this in noMMU mode, for now.7575+ */7676+#ifndef TASK_SIZE7777+#define TASK_SIZE (CONFIG_DRAM_SIZE)7878+#endif7979+8080+#ifndef TASK_UNMAPPED_BASE8181+#define TASK_UNMAPPED_BASE UL(0x00000000)8282+#endif8383+8484+#ifndef PHYS_OFFSET8585+#define PHYS_OFFSET (CONFIG_DRAM_BASE)8686+#endif8787+8888+#ifndef END_MEM8989+#define END_MEM (CONFIG_DRAM_BASE + CONFIG_DRAM_SIZE)9090+#endif9191+9292+#ifndef PAGE_OFFSET9393+#define PAGE_OFFSET (PHYS_OFFSET)9494+#endif9595+9696+/*9797+ * The module can be at any place in ram in nommu mode.9898+ */9999+#define MODULE_END (END_MEM)100100+#define MODULE_START (PHYS_OFFSET)101101+102102+#endif /* !CONFIG_MMU */5210353104/*54105 * Size of DMA-consistent memory region. Must be multiple of 2M,···12770 */12871#define __phys_to_pfn(paddr) ((paddr) >> PAGE_SHIFT)12972#define __pfn_to_phys(pfn) ((pfn) << PAGE_SHIFT)130130-131131-/*132132- * The module space lives between the addresses given by TASK_SIZE133133- * and PAGE_OFFSET - it must be within 32MB of the kernel text.134134- */135135-#define MODULE_END (PAGE_OFFSET)136136-#define MODULE_START (MODULE_END - 16*1048576)137137-138138-#if TASK_SIZE > MODULE_START139139-#error Top of user space clashes with start of module space140140-#endif141141-142142-/*143143- * The XIP kernel gets mapped at the bottom of the module vm area.144144- * Since we use sections to map it, this macro replaces the physical address145145- * with its virtual address while keeping offset from the base section.146146- */147147-#define XIP_VIRT_ADDR(physaddr) (MODULE_START + ((physaddr) & 0x000fffff))1487314974#ifndef __ASSEMBLY__15075
+16
include/asm-arm/mmu.h
···11#ifndef __ARM_MMU_H22#define __ARM_MMU_H3344+#ifdef CONFIG_MMU55+46typedef struct {57#if __LINUX_ARM_ARCH__ >= 668 unsigned int id;···1311#define ASID(mm) ((mm)->context.id & 255)1412#else1513#define ASID(mm) (0)1414+#endif1515+1616+#else1717+1818+/*1919+ * From nommu.h:2020+ * Copyright (C) 2002, David McCullough <davidm@snapgear.com>2121+ * modified for 2.6 by Hyok S. Choi <hyok.choi@samsung.com>2222+ */2323+typedef struct {2424+ struct vm_list_struct *vmlist;2525+ unsigned long end_brk;2626+} mm_context_t;2727+1628#endif17291830#endif
+2
include/asm-arm/mmu_context.h
···8282switch_mm(struct mm_struct *prev, struct mm_struct *next,8383 struct task_struct *tsk)8484{8585+#ifdef CONFIG_MMU8586 unsigned int cpu = smp_processor_id();86878788 if (prev != next) {···9291 if (cache_is_vivt())9392 cpu_clear(cpu, prev->cpu_vm_mask);9493 }9494+#endif9595}96969797#define deactivate_mm(tsk,mm) do { } while (0)
+51
include/asm-arm/page-nommu.h
···11+/*22+ * linux/include/asm-arm/page-nommu.h33+ *44+ * Copyright (C) 2004 Hyok S. Choi55+ *66+ * This program is free software; you can redistribute it and/or modify77+ * it under the terms of the GNU General Public License version 2 as88+ * published by the Free Software Foundation.99+ */1010+#ifndef _ASMARM_PAGE_NOMMU_H1111+#define _ASMARM_PAGE_NOMMU_H1212+1313+#if !defined(CONFIG_SMALL_TASKS) && PAGE_SHIFT < 131414+#define KTHREAD_SIZE (8192)1515+#else1616+#define KTHREAD_SIZE PAGE_SIZE1717+#endif1818+1919+#define get_user_page(vaddr) __get_free_page(GFP_KERNEL)2020+#define free_user_page(page, addr) free_page(addr)2121+2222+#define clear_page(page) memset((page), 0, PAGE_SIZE)2323+#define copy_page(to,from) memcpy((to), (from), PAGE_SIZE)2424+2525+#define clear_user_page(page, vaddr, pg) clear_page(page)2626+#define copy_user_page(to, from, vaddr, pg) copy_page(to, from)2727+2828+/*2929+ * These are used to make use of C type-checking..3030+ */3131+typedef unsigned long pte_t;3232+typedef unsigned long pmd_t;3333+typedef unsigned long pgd_t[2];3434+typedef unsigned long pgprot_t;3535+3636+#define pte_val(x) (x)3737+#define pmd_val(x) (x)3838+#define pgd_val(x) ((x)[0])3939+#define pgprot_val(x) (x)4040+4141+#define __pte(x) (x)4242+#define __pmd(x) (x)4343+#define __pgprot(x) (x)4444+4545+/* to align the pointer to the (next) page boundary */4646+#define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)4747+4848+extern unsigned long memory_start;4949+extern unsigned long memory_end;5050+5151+#endif
···1616#include <asm/cacheflush.h>1717#include <asm/tlbflush.h>18181919+#define check_pgt_cache() do { } while (0)2020+2121+#ifdef CONFIG_MMU2222+1923#define _PAGE_USER_TABLE (PMD_TYPE_TABLE | PMD_BIT4 | PMD_DOMAIN(DOMAIN_USER))2024#define _PAGE_KERNEL_TABLE (PMD_TYPE_TABLE | PMD_BIT4 | PMD_DOMAIN(DOMAIN_KERNEL))2125···35313632#define pgd_alloc(mm) get_pgd_slow(mm)3733#define pgd_free(pgd) free_pgd_slow(pgd)3838-3939-#define check_pgt_cache() do { } while (0)40344135/*4236 * Allocate one PTE table.···127125{128126 __pmd_populate(pmdp, page_to_pfn(ptep) << PAGE_SHIFT | _PAGE_USER_TABLE);129127}128128+129129+#endif /* CONFIG_MMU */130130131131#endif
+123
include/asm-arm/pgtable-nommu.h
···11+/*22+ * linux/include/asm-arm/pgtable-nommu.h33+ *44+ * Copyright (C) 1995-2002 Russell King55+ * Copyright (C) 2004 Hyok S. Choi66+ *77+ * This program is free software; you can redistribute it and/or modify88+ * it under the terms of the GNU General Public License version 2 as99+ * published by the Free Software Foundation.1010+ */1111+#ifndef _ASMARM_PGTABLE_NOMMU_H1212+#define _ASMARM_PGTABLE_NOMMU_H1313+1414+#ifndef __ASSEMBLY__1515+1616+#include <linux/config.h>1717+#include <linux/slab.h>1818+#include <asm/processor.h>1919+#include <asm/page.h>2020+#include <asm/io.h>2121+2222+/*2323+ * Trivial page table functions.2424+ */2525+#define pgd_present(pgd) (1)2626+#define pgd_none(pgd) (0)2727+#define pgd_bad(pgd) (0)2828+#define pgd_clear(pgdp)2929+#define kern_addr_valid(addr) (1)3030+#define pmd_offset(a, b) ((void *)0)3131+/* FIXME */3232+/*3333+ * PMD_SHIFT determines the size of the area a second-level page table can map3434+ * PGDIR_SHIFT determines what a third-level page table entry can map3535+ */3636+#define PGDIR_SHIFT 213737+3838+#define PGDIR_SIZE (1UL << PGDIR_SHIFT)3939+#define PGDIR_MASK (~(PGDIR_SIZE-1))4040+/* FIXME */4141+4242+#define PAGE_NONE __pgprot(0)4343+#define PAGE_SHARED __pgprot(0)4444+#define PAGE_COPY __pgprot(0)4545+#define PAGE_READONLY __pgprot(0)4646+#define PAGE_KERNEL __pgprot(0)4747+4848+//extern void paging_init(struct meminfo *, struct machine_desc *);4949+#define swapper_pg_dir ((pgd_t *) 0)5050+5151+#define __swp_type(x) (0)5252+#define __swp_offset(x) (0)5353+#define __swp_entry(typ,off) ((swp_entry_t) { ((typ) | ((off) << 7)) })5454+#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })5555+#define __swp_entry_to_pte(x) ((pte_t) { (x).val })5656+5757+5858+typedef pte_t *pte_addr_t;5959+6060+static inline int pte_file(pte_t pte) { return 0; }6161+6262+/*6363+ * ZERO_PAGE is a global shared page that is always zero: used6464+ * for zero-mapped memory areas etc..6565+ */6666+#define ZERO_PAGE(vaddr) (virt_to_page(0))6767+6868+/*6969+ * Mark the prot value as uncacheable and unbufferable.7070+ */7171+#define pgprot_noncached(prot) __pgprot(0)7272+#define pgprot_writecombine(prot) __pgprot(0)7373+7474+7575+/*7676+ * These would be in other places but having them here reduces the diffs.7777+ */7878+extern unsigned int kobjsize(const void *objp);7979+extern int is_in_rom(unsigned long);8080+8181+/*8282+ * No page table caches to initialise.8383+ */8484+#define pgtable_cache_init() do { } while (0)8585+#define io_remap_page_range remap_page_range8686+#define io_remap_pfn_range remap_pfn_range8787+8888+#define MK_IOSPACE_PFN(space, pfn) (pfn)8989+#define GET_IOSPACE(pfn) 09090+#define GET_PFN(pfn) (pfn)9191+9292+9393+/*9494+ * All 32bit addresses are effectively valid for vmalloc...9595+ * Sort of meaningless for non-VM targets.9696+ */9797+#define VMALLOC_START 09898+#define VMALLOC_END 0xffffffff9999+100100+#define FIRST_USER_ADDRESS (0)101101+102102+#else 103103+104104+/*105105+ * dummy tlb and user structures.106106+ */107107+#define v3_tlb_fns (0)108108+#define v4_tlb_fns (0)109109+#define v4wb_tlb_fns (0)110110+#define v4wbi_tlb_fns (0)111111+#define v6_tlb_fns (0)112112+113113+#define v3_user_fns (0)114114+#define v4_user_fns (0)115115+#define v4_mc_user_fns (0)116116+#define v4wb_user_fns (0)117117+#define v4wt_user_fns (0)118118+#define v6_user_fns (0)119119+#define xscale_mc_user_fns (0)120120+121121+#endif /*__ASSEMBLY__*/122122+123123+#endif /* _ASMARM_PGTABLE_H */
···642642 u16 bus_num;643643 u16 chip_select;644644645645+ /* mode becomes spi_device.mode, and is essential for chips646646+ * where the default of SPI_CS_HIGH = 0 is wrong.647647+ */648648+ u8 mode;649649+645650 /* ... may need additional spi_device chip config data here.646651 * avoid stuff protocol drivers can set; but include stuff647652 * needed to behave without being bound to a driver:648648- * - chipselect polarity649653 * - quirks like clock rate mattering when not selected650654 */651655};
-2
include/linux/tty.h
···5757 unsigned char *flag_buf_ptr;5858 int used;5959 int size;6060- int active;6160 int commit;6261 int read;6362 /* Data points here */···258259#define TTY_DO_WRITE_WAKEUP 5 /* Call write_wakeup after queuing new */259260#define TTY_PUSH 6 /* n_tty private */260261#define TTY_CLOSING 7 /* ->close() in progress */261261-#define TTY_DONT_FLIP 8 /* Defer buffer flip */262262#define TTY_LDISC 9 /* Line discipline attached */263263#define TTY_HW_COOK_OUT 14 /* Hardware can do output cooking */264264#define TTY_HW_COOK_IN 15 /* Hardware can do input cooking */
···2828#define WDIOC_KEEPALIVE _IOR(WATCHDOG_IOCTL_BASE, 5, int)2929#define WDIOC_SETTIMEOUT _IOWR(WATCHDOG_IOCTL_BASE, 6, int)3030#define WDIOC_GETTIMEOUT _IOR(WATCHDOG_IOCTL_BASE, 7, int)3131+#define WDIOC_SETPRETIMEOUT _IOWR(WATCHDOG_IOCTL_BASE, 8, int)3232+#define WDIOC_GETPRETIMEOUT _IOR(WATCHDOG_IOCTL_BASE, 9, int)3333+#define WDIOC_GETTIMELEFT _IOR(WATCHDOG_IOCTL_BASE, 10, int)31343235#define WDIOF_UNKNOWN -1 /* Unknown flag error */3336#define WDIOS_UNKNOWN -1 /* Unknown status error */···4138#define WDIOF_EXTERN2 0x0008 /* External relay 2 */4239#define WDIOF_POWERUNDER 0x0010 /* Power bad/power fault */4340#define WDIOF_CARDRESET 0x0020 /* Card previously reset the CPU */4444-#define WDIOF_POWEROVER 0x0040 /* Power over voltage */4545-#define WDIOF_SETTIMEOUT 0x0080 /* Set timeout (in seconds) */4646-#define WDIOF_MAGICCLOSE 0x0100 /* Supports magic close char */4141+#define WDIOF_POWEROVER 0x0040 /* Power over voltage */4242+#define WDIOF_SETTIMEOUT 0x0080 /* Set timeout (in seconds) */4343+#define WDIOF_MAGICCLOSE 0x0100 /* Supports magic close char */4444+#define WDIOF_PRETIMEOUT 0x0200 /* Pretimeout (in seconds), get/set */4745#define WDIOF_KEEPALIVEPING 0x8000 /* Keep alive ping reply */48464947#define WDIOS_DISABLECARD 0x0001 /* Turn off the watchdog timer */
+95-6
kernel/module.c
···11-/* Rewritten by Rusty Russell, on the backs of many others...11+/*22 Copyright (C) 2002 Richard Henderson33 Copyright (C) 2001 Rusty Russell, 2002 Rusty Russell IBM.44···122122extern const struct kernel_symbol __stop___ksymtab_gpl[];123123extern const struct kernel_symbol __start___ksymtab_gpl_future[];124124extern const struct kernel_symbol __stop___ksymtab_gpl_future[];125125+extern const struct kernel_symbol __start___ksymtab_unused[];126126+extern const struct kernel_symbol __stop___ksymtab_unused[];127127+extern const struct kernel_symbol __start___ksymtab_unused_gpl[];128128+extern const struct kernel_symbol __stop___ksymtab_unused_gpl[];129129+extern const struct kernel_symbol __start___ksymtab_gpl_future[];130130+extern const struct kernel_symbol __stop___ksymtab_gpl_future[];125131extern const unsigned long __start___kcrctab[];126132extern const unsigned long __start___kcrctab_gpl[];127133extern const unsigned long __start___kcrctab_gpl_future[];134134+extern const unsigned long __start___kcrctab_unused[];135135+extern const unsigned long __start___kcrctab_unused_gpl[];128136129137#ifndef CONFIG_MODVERSIONS130138#define symversion(base, idx) NULL···150142 if (strcmp(ks->name, name) == 0)151143 return ks;152144 return NULL;145145+}146146+147147+static void printk_unused_warning(const char *name)148148+{149149+ printk(KERN_WARNING "Symbol %s is marked as UNUSED, "150150+ "however this module is using it.\n", name);151151+ printk(KERN_WARNING "This symbol will go away in the future.\n");152152+ printk(KERN_WARNING "Please evalute if this is the right api to use, "153153+ "and if it really is, submit a report the linux kernel "154154+ "mailinglist together with submitting your code for "155155+ "inclusion.\n");153156}154157155158/* Find a symbol, return value, crc and module which owns it */···205186 return ks->value;206187 }207188189189+ ks = lookup_symbol(name, __start___ksymtab_unused,190190+ __stop___ksymtab_unused);191191+ if (ks) {192192+ printk_unused_warning(name);193193+ *crc = symversion(__start___kcrctab_unused,194194+ (ks - __start___ksymtab_unused));195195+ return ks->value;196196+ }197197+198198+ if (gplok)199199+ ks = lookup_symbol(name, __start___ksymtab_unused_gpl,200200+ __stop___ksymtab_unused_gpl);201201+ if (ks) {202202+ printk_unused_warning(name);203203+ *crc = symversion(__start___kcrctab_unused_gpl,204204+ (ks - __start___ksymtab_unused_gpl));205205+ return ks->value;206206+ }207207+208208 /* Now try modules. */ 209209 list_for_each_entry(mod, &modules, list) {210210 *owner = mod;···239201 if (ks) {240202 *crc = symversion(mod->gpl_crcs,241203 (ks - mod->gpl_syms));204204+ return ks->value;205205+ }206206+ }207207+ ks = lookup_symbol(name, mod->unused_syms, mod->unused_syms + mod->num_unused_syms);208208+ if (ks) {209209+ printk_unused_warning(name);210210+ *crc = symversion(mod->unused_crcs, (ks - mod->unused_syms));211211+ return ks->value;212212+ }213213+214214+ if (gplok) {215215+ ks = lookup_symbol(name, mod->unused_gpl_syms,216216+ mod->unused_gpl_syms + mod->num_unused_gpl_syms);217217+ if (ks) {218218+ printk_unused_warning(name);219219+ *crc = symversion(mod->unused_gpl_crcs,220220+ (ks - mod->unused_gpl_syms));242221 return ks->value;243222 }244223 }···14581403 Elf_Ehdr *hdr;14591404 Elf_Shdr *sechdrs;14601405 char *secstrings, *args, *modmagic, *strtab = NULL;14611461- unsigned int i, symindex = 0, strindex = 0, setupindex, exindex,14621462- exportindex, modindex, obsparmindex, infoindex, gplindex,14631463- crcindex, gplcrcindex, versindex, pcpuindex, gplfutureindex,14641464- gplfuturecrcindex, unwindex = 0;14061406+ unsigned int i;14071407+ unsigned int symindex = 0;14081408+ unsigned int strindex = 0;14091409+ unsigned int setupindex;14101410+ unsigned int exindex;14111411+ unsigned int exportindex;14121412+ unsigned int modindex;14131413+ unsigned int obsparmindex;14141414+ unsigned int infoindex;14151415+ unsigned int gplindex;14161416+ unsigned int crcindex;14171417+ unsigned int gplcrcindex;14181418+ unsigned int versindex;14191419+ unsigned int pcpuindex;14201420+ unsigned int gplfutureindex;14211421+ unsigned int gplfuturecrcindex;14221422+ unsigned int unwindex = 0;14231423+ unsigned int unusedindex;14241424+ unsigned int unusedcrcindex;14251425+ unsigned int unusedgplindex;14261426+ unsigned int unusedgplcrcindex;14651427 struct module *mod;14661428 long err = 0;14671429 void *percpu = NULL, *ptr = NULL; /* Stops spurious gcc warning */···15591487 exportindex = find_sec(hdr, sechdrs, secstrings, "__ksymtab");15601488 gplindex = find_sec(hdr, sechdrs, secstrings, "__ksymtab_gpl");15611489 gplfutureindex = find_sec(hdr, sechdrs, secstrings, "__ksymtab_gpl_future");14901490+ unusedindex = find_sec(hdr, sechdrs, secstrings, "__ksymtab_unused");14911491+ unusedgplindex = find_sec(hdr, sechdrs, secstrings, "__ksymtab_unused_gpl");15621492 crcindex = find_sec(hdr, sechdrs, secstrings, "__kcrctab");15631493 gplcrcindex = find_sec(hdr, sechdrs, secstrings, "__kcrctab_gpl");15641494 gplfuturecrcindex = find_sec(hdr, sechdrs, secstrings, "__kcrctab_gpl_future");14951495+ unusedcrcindex = find_sec(hdr, sechdrs, secstrings, "__kcrctab_unused");14961496+ unusedgplcrcindex = find_sec(hdr, sechdrs, secstrings, "__kcrctab_unused_gpl");15651497 setupindex = find_sec(hdr, sechdrs, secstrings, "__param");15661498 exindex = find_sec(hdr, sechdrs, secstrings, "__ex_table");15671499 obsparmindex = find_sec(hdr, sechdrs, secstrings, "__obsparm");···17141638 mod->gpl_crcs = (void *)sechdrs[gplcrcindex].sh_addr;17151639 mod->num_gpl_future_syms = sechdrs[gplfutureindex].sh_size /17161640 sizeof(*mod->gpl_future_syms);16411641+ mod->num_unused_syms = sechdrs[unusedindex].sh_size /16421642+ sizeof(*mod->unused_syms);16431643+ mod->num_unused_gpl_syms = sechdrs[unusedgplindex].sh_size /16441644+ sizeof(*mod->unused_gpl_syms);17171645 mod->gpl_future_syms = (void *)sechdrs[gplfutureindex].sh_addr;17181646 if (gplfuturecrcindex)17191647 mod->gpl_future_crcs = (void *)sechdrs[gplfuturecrcindex].sh_addr;1720164816491649+ mod->unused_syms = (void *)sechdrs[unusedindex].sh_addr;16501650+ if (unusedcrcindex)16511651+ mod->unused_crcs = (void *)sechdrs[unusedcrcindex].sh_addr;16521652+ mod->unused_gpl_syms = (void *)sechdrs[unusedgplindex].sh_addr;16531653+ if (unusedgplcrcindex)16541654+ mod->unused_crcs = (void *)sechdrs[unusedgplcrcindex].sh_addr;16551655+17211656#ifdef CONFIG_MODVERSIONS17221657 if ((mod->num_syms && !crcindex) || 17231658 (mod->num_gpl_syms && !gplcrcindex) ||17241724- (mod->num_gpl_future_syms && !gplfuturecrcindex)) {16591659+ (mod->num_gpl_future_syms && !gplfuturecrcindex) ||16601660+ (mod->num_unused_syms && !unusedcrcindex) ||16611661+ (mod->num_unused_gpl_syms && !unusedgplcrcindex)) {17251662 printk(KERN_WARNING "%s: No versions for exported symbols."17261663 " Tainting kernel.\n", mod->name);17271664 add_taint(TAINT_FORCED_MODULE);
+16
lib/Kconfig.debug
···2323 keys are documented in <file:Documentation/sysrq.txt>. Don't say Y2424 unless you really know what this hack does.25252626+config UNUSED_SYMBOLS2727+ bool "Enable unused/obsolete exported symbols"2828+ default y if X862929+ help3030+ Unused but exported symbols make the kernel needlessly bigger. For3131+ that reason most of these unused exports will soon be removed. This3232+ option is provided temporarily to provide a transition period in case3333+ some external kernel module needs one of these symbols anyway. If you3434+ encounter such a case in your module, consider if you are actually3535+ using the right API. (rationale: since nobody in the kernel is using3636+ this in a module, there is a pretty good chance it's actually the3737+ wrong interface to use). If you really need the symbol, please send a3838+ mail to the linux kernel mailing list mentioning the symbol and why3939+ you really need it, and what the merge plan to the mainline kernel for4040+ your module is.4141+2642config DEBUG_KERNEL2743 bool "Kernel debugging"2844 help
+1-1
lib/vsprintf.c
···489489 if (str < end)490490 *str = '\0';491491 else492492- *end = '\0';492492+ end[-1] = '\0';493493 }494494 /* the trailing null byte doesn't count towards the total */495495 return str-buf;