diff --git a/[refs] b/[refs] index 607f177fc473..b7d7ef7ca0d7 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 1d42a0ecf478962e8aede355a0be41365c117ff0 +refs/heads/master: 7a9bdd8842d0847f3b15068550a3632a2d259057 diff --git a/trunk/Documentation/aoe/aoe.txt b/trunk/Documentation/aoe/aoe.txt index 3a4dbe4663c9..43e50108d0e2 100644 --- a/trunk/Documentation/aoe/aoe.txt +++ b/trunk/Documentation/aoe/aoe.txt @@ -4,16 +4,6 @@ The EtherDrive (R) HOWTO for users of 2.6 kernels is found at ... It has many tips and hints! -The aoetools are userland programs that are designed to work with this -driver. The aoetools are on sourceforge. - - http://aoetools.sourceforge.net/ - -The scripts in this Documentation/aoe directory are intended to -document the use of the driver and are not necessary if you install -the aoetools. - - CREATING DEVICE NODES Users of udev should find the block device nodes created @@ -45,15 +35,14 @@ USING DEVICE NODES "echo eth2 eth4 > /dev/etherd/interfaces" tells the aoe driver to limit ATA over Ethernet traffic to eth2 and eth4. AoE traffic from - untrusted networks should be ignored as a matter of security. See - also the aoe_iflist driver option described below. + untrusted networks should be ignored as a matter of security. "echo > /dev/etherd/discover" tells the driver to find out what AoE devices are available. These character devices may disappear and be replaced by sysfs - counterparts. Using the commands in aoetools insulates users from - these implementation details. + counterparts, so distribution maintainers are encouraged to create + scripts that use these devices. The block devices are named like this: @@ -77,8 +66,7 @@ USING SYSFS through which we are communicating with the remote AoE device. There is a script in this directory that formats this information - in a convenient way. Users with aoetools can use the aoe-stat - command. + in a convenient way. root@makki root# sh Documentation/aoe/status.sh e10.0 eth3 up @@ -101,23 +89,3 @@ USING SYSFS e4.7 eth1 up e4.8 eth1 up e4.9 eth1 up - - Use /sys/module/aoe/parameters/aoe_iflist (or better, the driver - option discussed below) instead of /dev/etherd/interfaces to limit - AoE traffic to the network interfaces in the given - whitespace-separated list. Unlike the old character device, the - sysfs entry can be read from as well as written to. - - It's helpful to trigger discovery after setting the list of allowed - interfaces. The aoetools package provides an aoe-discover script - for this purpose. You can also directly use the - /dev/etherd/discover special file described above. - -DRIVER OPTIONS - - There is a boot option for the built-in aoe driver and a - corresponding module parameter, aoe_iflist. Without this option, - all network interfaces may be used for ATA over Ethernet. Here is a - usage example for the module parameter. - - modprobe aoe_iflist="eth1 eth3" diff --git a/trunk/Documentation/aoe/status.sh b/trunk/Documentation/aoe/status.sh index 751f3be514b8..6628116d4a9f 100644 --- a/trunk/Documentation/aoe/status.sh +++ b/trunk/Documentation/aoe/status.sh @@ -14,6 +14,10 @@ test ! -d "$sysd/block" && { echo "$me Error: sysfs is not mounted" 1>&2 exit 1 } +test -z "`lsmod | grep '^aoe'`" && { + echo "$me Error: aoe module is not loaded" 1>&2 + exit 1 +} for d in `ls -d $sysd/block/etherd* 2>/dev/null | grep -v p` end; do # maybe ls comes up empty, so we use "end" diff --git a/trunk/Documentation/pci.txt b/trunk/Documentation/pci.txt index 62b1dc5d97e2..67514bf87ccd 100644 --- a/trunk/Documentation/pci.txt +++ b/trunk/Documentation/pci.txt @@ -279,7 +279,6 @@ pci_for_each_dev_reverse() Superseded by pci_find_device_reverse() pci_for_each_bus() Superseded by pci_find_next_bus() pci_find_device() Superseded by pci_get_device() pci_find_subsys() Superseded by pci_get_subsys() -pci_find_slot() Superseded by pci_get_slot() pcibios_find_class() Superseded by pci_get_class() pci_find_class() Superseded by pci_get_class() pci_(read|write)_*_nodev() Superseded by pci_bus_(read|write)_*() diff --git a/trunk/Documentation/power/pci.txt b/trunk/Documentation/power/pci.txt index 35b1a7dae342..c85428e7ad92 100644 --- a/trunk/Documentation/power/pci.txt +++ b/trunk/Documentation/power/pci.txt @@ -165,9 +165,40 @@ Description: These functions are intended for use by individual drivers, and are defined in struct pci_driver: - int (*suspend) (struct pci_dev *dev, pm_message_t state); + int (*save_state) (struct pci_dev *dev, u32 state); + int (*suspend) (struct pci_dev *dev, u32 state); int (*resume) (struct pci_dev *dev); - int (*enable_wake) (struct pci_dev *dev, pci_power_t state, int enable); + int (*enable_wake) (struct pci_dev *dev, u32 state, int enable); + + +save_state +---------- + +Usage: + +if (dev->driver && dev->driver->save_state) + dev->driver->save_state(dev,state); + +The driver should use this callback to save device state. It should take into +account the current state of the device and the requested state in order to +avoid any unnecessary operations. + +For example, a video card that supports all 4 states (D0-D3), all controller +context is preserved when entering D1, but the screen is placed into a low power +state (blanked). + +The driver can also interpret this function as a notification that it may be +entering a sleep state in the near future. If it knows that the device cannot +enter the requested state, either because of lack of support for it, or because +the device is middle of some critical operation, then it should fail. + +This function should not be used to set any state in the device or the driver +because the device may not actually enter the sleep state (e.g. another driver +later causes causes a global state transition to fail). + +Note that in intermediate low power states, a device's I/O and memory spaces may +be disabled and may not be available in subsequent transitions to lower power +states. suspend diff --git a/trunk/arch/alpha/Kconfig b/trunk/arch/alpha/Kconfig index f7c96635d3b4..0c79b9d95f74 100644 --- a/trunk/arch/alpha/Kconfig +++ b/trunk/arch/alpha/Kconfig @@ -280,10 +280,6 @@ config ISA (MCA) or VESA. ISA is an older system, now being displaced by PCI; newer boards don't support it. If you have ISA, say Y, otherwise N. -config ISA_DMA_API - bool - default y - config PCI bool depends on !ALPHA_JENSEN diff --git a/trunk/arch/arm/Kconfig b/trunk/arch/arm/Kconfig index 8bfcb37460fa..4055115ae0e2 100644 --- a/trunk/arch/arm/Kconfig +++ b/trunk/arch/arm/Kconfig @@ -266,10 +266,6 @@ config ISA_DMA depends on FOOTBRIDGE_HOST || ARCH_SHARK default y -config ISA_DMA_API - bool - default y - config PCI bool "PCI support" if ARCH_INTEGRATOR_AP default y if ARCH_SHARK || FOOTBRIDGE_HOST || ARCH_IOP3XX || ARCH_IXP4XX || ARCH_IXP2000 diff --git a/trunk/arch/arm/boot/compressed/head.S b/trunk/arch/arm/boot/compressed/head.S index 7c7f475e213e..c0e7aff3dec2 100644 --- a/trunk/arch/arm/boot/compressed/head.S +++ b/trunk/arch/arm/boot/compressed/head.S @@ -18,30 +18,48 @@ * Please select one of the following when turning on debugging. */ #ifdef DEBUG - -#include - -#if defined(CONFIG_DEBUG_ICEDCC) +#if defined(CONFIG_DEBUG_DC21285_PORT) .macro loadsp, rb + mov \rb, #0x42000000 .endm - .macro writeb, ch, rb - mcr p14, 0, \ch, c0, c1, 0 + .macro writeb, rb + str \rb, [r3, #0x160] .endm -#else - .macro writeb, ch, rb - senduart \ch, \rb +#elif defined(CONFIG_DEBUG_ICEDCC) + .macro loadsp, rb .endm - -#if defined(CONFIG_FOOTBRIDGE) || \ - defined(CONFIG_ARCH_RPC) || \ - defined(CONFIG_ARCH_INTEGRATOR) || \ - defined(CONFIG_ARCH_PXA) || \ - defined(CONFIG_ARCH_IXP4XX) || \ - defined(CONFIG_ARCH_IXP2000) || \ - defined(CONFIG_ARCH_LH7A40X) || \ - defined(CONFIG_ARCH_OMAP) + .macro writeb, rb + mcr p14, 0, \rb, c0, c1, 0 + .endm +#elif defined(CONFIG_FOOTBRIDGE) + .macro loadsp, rb + mov \rb, #0x7c000000 + .endm + .macro writeb, rb + strb \rb, [r3, #0x3f8] + .endm +#elif defined(CONFIG_ARCH_RPC) .macro loadsp, rb - addruart \rb + mov \rb, #0x03000000 + orr \rb, \rb, #0x00010000 + .endm + .macro writeb, rb + strb \rb, [r3, #0x3f8 << 2] + .endm +#elif defined(CONFIG_ARCH_INTEGRATOR) + .macro loadsp, rb + mov \rb, #0x16000000 + .endm + .macro writeb, rb + strb \rb, [r3, #0] + .endm +#elif defined(CONFIG_ARCH_PXA) /* Xscale-type */ + .macro loadsp, rb + mov \rb, #0x40000000 + orr \rb, \rb, #0x00100000 + .endm + .macro writeb, rb + strb \rb, [r3, #0] .endm #elif defined(CONFIG_ARCH_SA1100) .macro loadsp, rb @@ -52,21 +70,64 @@ add \rb, \rb, #0x00010000 @ Ser1 # endif .endm + .macro writeb, rb + str \rb, [r3, #0x14] @ UTDR + .endm +#elif defined(CONFIG_ARCH_IXP4XX) + .macro loadsp, rb + mov \rb, #0xc8000000 + .endm + .macro writeb, rb + str \rb, [r3, #0] +#elif defined(CONFIG_ARCH_IXP2000) + .macro loadsp, rb + mov \rb, #0xc0000000 + orr \rb, \rb, #0x00030000 + .endm + .macro writeb, rb + str \rb, [r3, #0] + .endm +#elif defined(CONFIG_ARCH_LH7A40X) + .macro loadsp, rb + ldr \rb, =0x80000700 @ UART2 UARTBASE + .endm + .macro writeb, rb + strb \rb, [r3, #0] + .endm +#elif defined(CONFIG_ARCH_OMAP) + .macro loadsp, rb + mov \rb, #0xff000000 @ physical base address + add \rb, \rb, #0x00fb0000 +#if defined(CONFIG_OMAP_LL_DEBUG_UART2) || defined(CONFIG_OMAP_LL_DEBUG_UART3) + add \rb, \rb, #0x00000800 +#endif +#ifdef CONFIG_OMAP_LL_DEBUG_UART3 + add \rb, \rb, #0x00009000 +#endif + .endm + .macro writeb, rb + strb \rb, [r3] + .endm #elif defined(CONFIG_ARCH_IOP331) .macro loadsp, rb mov \rb, #0xff000000 orr \rb, \rb, #0x00ff0000 orr \rb, \rb, #0x0000f700 @ location of the UART .endm + .macro writeb, rb + str \rb, [r3, #0] + .endm #elif defined(CONFIG_ARCH_S3C2410) - .macro loadsp, rb + .macro loadsp, rb mov \rb, #0x50000000 add \rb, \rb, #0x4000 * CONFIG_S3C2410_LOWLEVEL_UART_PORT .endm + .macro writeb, rb + strb \rb, [r3, #0x20] + .endm #else #error no serial architecture defined #endif -#endif #endif .macro kputc,val @@ -673,7 +734,7 @@ puts: loadsp r3 1: ldrb r2, [r0], #1 teq r2, #0 moveq pc, lr -2: writeb r2, r3 +2: writeb r2 mov r1, #0x00020000 3: subs r1, r1, #1 bne 3b diff --git a/trunk/arch/arm/mach-imx/generic.c b/trunk/arch/arm/mach-imx/generic.c index 41e5849ae8da..54377d0f578c 100644 --- a/trunk/arch/arm/mach-imx/generic.c +++ b/trunk/arch/arm/mach-imx/generic.c @@ -26,7 +26,6 @@ #include #include #include -#include #include #include @@ -229,14 +228,6 @@ static struct platform_device imx_uart2_device = { .resource = imx_uart2_resources, }; -static struct imxfb_mach_info imx_fb_info; - -void __init set_imx_fb_info(struct imxfb_mach_info *hard_imx_fb_info) -{ - memcpy(&imx_fb_info,hard_imx_fb_info,sizeof(struct imxfb_mach_info)); -} -EXPORT_SYMBOL(set_imx_fb_info); - static struct resource imxfb_resources[] = { [0] = { .start = 0x00205000, @@ -250,16 +241,9 @@ static struct resource imxfb_resources[] = { }, }; -static u64 fb_dma_mask = ~(u64)0; - static struct platform_device imxfb_device = { .name = "imx-fb", .id = 0, - .dev = { - .platform_data = &imx_fb_info, - .dma_mask = &fb_dma_mask, - .coherent_dma_mask = 0xffffffff, - }, .num_resources = ARRAY_SIZE(imxfb_resources), .resource = imxfb_resources, }; diff --git a/trunk/arch/arm/mach-integrator/core.c b/trunk/arch/arm/mach-integrator/core.c index bd17b5154311..86c50c3889b7 100644 --- a/trunk/arch/arm/mach-integrator/core.c +++ b/trunk/arch/arm/mach-integrator/core.c @@ -216,9 +216,7 @@ integrator_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) write_seqlock(&xtime_lock); - /* - * clear the interrupt - */ + // ...clear the interrupt timer1->TimerClear = 1; timer_tick(regs); @@ -266,7 +264,7 @@ void __init integrator_time_init(unsigned long reload, unsigned int ctrl) timer1->TimerValue = timer_reload; timer1->TimerControl = timer_ctrl; - /* + /* * Make irqs happen for the system timer */ setup_irq(IRQ_TIMERINT1, &integrator_timer_irq); diff --git a/trunk/arch/arm/mach-integrator/leds.c b/trunk/arch/arm/mach-integrator/leds.c index d2c0ab21150c..9d182b77b312 100644 --- a/trunk/arch/arm/mach-integrator/leds.c +++ b/trunk/arch/arm/mach-integrator/leds.c @@ -37,7 +37,7 @@ static void integrator_leds_event(led_event_t ledevt) unsigned long flags; const unsigned int dbg_base = IO_ADDRESS(INTEGRATOR_DBG_BASE); unsigned int update_alpha_leds; - + // yup, change the LEDs local_irq_save(flags); update_alpha_leds = 0; diff --git a/trunk/arch/arm/mach-ixp4xx/common-pci.c b/trunk/arch/arm/mach-ixp4xx/common-pci.c index aa92e3708838..94bcdb933e41 100644 --- a/trunk/arch/arm/mach-ixp4xx/common-pci.c +++ b/trunk/arch/arm/mach-ixp4xx/common-pci.c @@ -501,6 +501,15 @@ pci_set_dma_mask(struct pci_dev *dev, u64 mask) return -EIO; } +int +pci_dac_set_dma_mask(struct pci_dev *dev, u64 mask) +{ + if (mask >= SZ_64M - 1 ) + return 0; + + return -EIO; +} + int pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask) { @@ -511,6 +520,7 @@ pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask) } EXPORT_SYMBOL(pci_set_dma_mask); +EXPORT_SYMBOL(pci_dac_set_dma_mask); EXPORT_SYMBOL(pci_set_consistent_dma_mask); EXPORT_SYMBOL(ixp4xx_pci_read); EXPORT_SYMBOL(ixp4xx_pci_write); diff --git a/trunk/arch/arm/mm/Kconfig b/trunk/arch/arm/mm/Kconfig index 27892e34b060..007766a0644c 100644 --- a/trunk/arch/arm/mm/Kconfig +++ b/trunk/arch/arm/mm/Kconfig @@ -413,7 +413,6 @@ config CPU_BPREDICT_DISABLE config HAS_TLS_REG bool depends on CPU_32v6 && !CPU_32v5 && !CPU_32v4 && !CPU_32v3 - default y help This selects support for the CP15 thread register. It is defined to be available on ARMv6 or later. However diff --git a/trunk/arch/arm26/Kconfig b/trunk/arch/arm26/Kconfig index 6caed90661fc..3955de5af4c0 100644 --- a/trunk/arch/arm26/Kconfig +++ b/trunk/arch/arm26/Kconfig @@ -89,10 +89,6 @@ config PAGESIZE_16 machine with 4MB of memory. endmenu -config ISA_DMA_API - bool - default y - menu "General setup" # Compressed boot loader in ROM. Yes, we really want to ask about diff --git a/trunk/arch/i386/Kconfig b/trunk/arch/i386/Kconfig index fee589119606..99b4f294a52d 100644 --- a/trunk/arch/i386/Kconfig +++ b/trunk/arch/i386/Kconfig @@ -1173,10 +1173,6 @@ source "drivers/pci/pcie/Kconfig" source "drivers/pci/Kconfig" -config ISA_DMA_API - bool - default y - config ISA bool "ISA support" depends on !(X86_VOYAGER || X86_VISWS) diff --git a/trunk/arch/ia64/Kconfig b/trunk/arch/ia64/Kconfig index 468dbe8a6b9c..cad8346def1d 100644 --- a/trunk/arch/ia64/Kconfig +++ b/trunk/arch/ia64/Kconfig @@ -261,6 +261,15 @@ config HOTPLUG_CPU can be controlled through /sys/devices/system/cpu/cpu#. Say N if you want to disable CPU hotplug. +config SCHED_SMT + bool "SMT scheduler support" + depends on SMP + default off + help + Improves the CPU scheduler's decision making when dealing with + Intel IA64 chips with MultiThreading at a cost of slightly increased + overhead in some places. If unsure say N here. + config PREEMPT bool "Preemptible Kernel" help diff --git a/trunk/arch/m68knommu/Kconfig b/trunk/arch/m68knommu/Kconfig index e729bd280623..fc4615b6d3a9 100644 --- a/trunk/arch/m68knommu/Kconfig +++ b/trunk/arch/m68knommu/Kconfig @@ -534,11 +534,6 @@ endchoice endmenu -config ISA_DMA_API - bool - depends on !M5272 - default y - menu "Bus options (PCI, PCMCIA, EISA, MCA, ISA)" config PCI diff --git a/trunk/arch/mips/Kconfig b/trunk/arch/mips/Kconfig index ab9944693f1f..5e666aad8815 100644 --- a/trunk/arch/mips/Kconfig +++ b/trunk/arch/mips/Kconfig @@ -1656,7 +1656,3 @@ config GENERIC_HARDIRQS config GENERIC_IRQ_PROBE bool default y - -config ISA_DMA_API - bool - default y diff --git a/trunk/arch/parisc/Kconfig b/trunk/arch/parisc/Kconfig index e7e7c56fc212..5b5cd00d98ca 100644 --- a/trunk/arch/parisc/Kconfig +++ b/trunk/arch/parisc/Kconfig @@ -45,10 +45,6 @@ config GENERIC_IRQ_PROBE config PM bool -config ISA_DMA_API - bool - default y - source "init/Kconfig" diff --git a/trunk/arch/ppc/Kconfig b/trunk/arch/ppc/Kconfig index ff04dcd30200..c3d941345e3d 100644 --- a/trunk/arch/ppc/Kconfig +++ b/trunk/arch/ppc/Kconfig @@ -1079,10 +1079,6 @@ source kernel/power/Kconfig endmenu -config ISA_DMA_API - bool - default y - menu "Bus options" config ISA diff --git a/trunk/arch/ppc64/Kconfig b/trunk/arch/ppc64/Kconfig index f5508abf1188..ef1f05e437c4 100644 --- a/trunk/arch/ppc64/Kconfig +++ b/trunk/arch/ppc64/Kconfig @@ -293,9 +293,6 @@ config SECCOMP endmenu -config ISA_DMA_API - bool - default y menu "General setup" diff --git a/trunk/arch/ppc64/Makefile b/trunk/arch/ppc64/Makefile index 691f3008e698..d33e20bcc52f 100644 --- a/trunk/arch/ppc64/Makefile +++ b/trunk/arch/ppc64/Makefile @@ -56,19 +56,12 @@ LDFLAGS_vmlinux := -Bstatic -e $(KERNELLOAD) -Ttext $(KERNELLOAD) CFLAGS += -msoft-float -pipe -mminimal-toc -mtraceback=none \ -mcall-aixdesc -GCC_VERSION := $(call cc-version) -GCC_BROKEN_VEC := $(shell if [ $(GCC_VERSION) -lt 0400 ] ; then echo "y"; fi ;) - ifeq ($(CONFIG_POWER4_ONLY),y) ifeq ($(CONFIG_ALTIVEC),y) -ifeq ($(GCC_BROKEN_VEC),y) CFLAGS += $(call cc-option,-mcpu=970) else CFLAGS += $(call cc-option,-mcpu=power4) endif -else - CFLAGS += $(call cc-option,-mcpu=power4) -endif else CFLAGS += $(call cc-option,-mtune=power4) endif diff --git a/trunk/arch/sh/Kconfig b/trunk/arch/sh/Kconfig index 3468d5127223..722ea1d63c94 100644 --- a/trunk/arch/sh/Kconfig +++ b/trunk/arch/sh/Kconfig @@ -693,10 +693,6 @@ config RTC_9701JE endmenu -config ISA_DMA_API - bool - depends on MPC1211 - default y menu "Bus options (PCI, PCMCIA, EISA, MCA, ISA)" diff --git a/trunk/arch/sparc/prom/memory.c b/trunk/arch/sparc/prom/memory.c index c20e5309f8aa..46aa51afec14 100644 --- a/trunk/arch/sparc/prom/memory.c +++ b/trunk/arch/sparc/prom/memory.c @@ -47,9 +47,9 @@ prom_sortmemlist(struct linux_mlist_v0 *thislist) char *tmpaddr; char *lowest; - for(i=0; thislist[i].theres_more; i++) { + for(i=0; thislist[i].theres_more != 0; i++) { lowest = thislist[i].start_adr; - for(mitr = i+1; thislist[mitr-1].theres_more; mitr++) + for(mitr = i+1; thislist[mitr-1].theres_more != 0; mitr++) if(thislist[mitr].start_adr < lowest) { lowest = thislist[mitr].start_adr; swapi = mitr; @@ -85,7 +85,7 @@ void __init prom_meminit(void) prom_phys_total[iter].num_bytes = mptr->num_bytes; prom_phys_total[iter].theres_more = &prom_phys_total[iter+1]; } - prom_phys_total[iter-1].theres_more = NULL; + prom_phys_total[iter-1].theres_more = 0x0; /* Second, the total prom taken descriptors. */ for(mptr = (*(romvec->pv_v0mem.v0_prommap)), iter=0; mptr; mptr=mptr->theres_more, iter++) { @@ -93,7 +93,7 @@ void __init prom_meminit(void) prom_prom_taken[iter].num_bytes = mptr->num_bytes; prom_prom_taken[iter].theres_more = &prom_prom_taken[iter+1]; } - prom_prom_taken[iter-1].theres_more = NULL; + prom_prom_taken[iter-1].theres_more = 0x0; /* Last, the available physical descriptors. */ for(mptr = (*(romvec->pv_v0mem.v0_available)), iter=0; mptr; mptr=mptr->theres_more, iter++) { @@ -101,7 +101,7 @@ void __init prom_meminit(void) prom_phys_avail[iter].num_bytes = mptr->num_bytes; prom_phys_avail[iter].theres_more = &prom_phys_avail[iter+1]; } - prom_phys_avail[iter-1].theres_more = NULL; + prom_phys_avail[iter-1].theres_more = 0x0; /* Sort all the lists. */ prom_sortmemlist(prom_phys_total); prom_sortmemlist(prom_prom_taken); @@ -124,7 +124,7 @@ void __init prom_meminit(void) prom_phys_avail[iter].theres_more = &prom_phys_avail[iter+1]; } - prom_phys_avail[iter-1].theres_more = NULL; + prom_phys_avail[iter-1].theres_more = 0x0; num_regs = prom_getproperty(node, "reg", (char *) prom_reg_memlist, @@ -138,7 +138,7 @@ void __init prom_meminit(void) prom_phys_total[iter].theres_more = &prom_phys_total[iter+1]; } - prom_phys_total[iter-1].theres_more = NULL; + prom_phys_total[iter-1].theres_more = 0x0; node = prom_getchild(prom_root_node); node = prom_searchsiblings(node, "virtual-memory"); @@ -158,7 +158,7 @@ void __init prom_meminit(void) prom_prom_taken[iter].theres_more = &prom_prom_taken[iter+1]; } - prom_prom_taken[iter-1].theres_more = NULL; + prom_prom_taken[iter-1].theres_more = 0x0; prom_sortmemlist(prom_prom_taken); @@ -182,15 +182,15 @@ void __init prom_meminit(void) case PROM_SUN4: #ifdef CONFIG_SUN4 /* how simple :) */ - prom_phys_total[0].start_adr = NULL; + prom_phys_total[0].start_adr = 0x0; prom_phys_total[0].num_bytes = *(sun4_romvec->memorysize); - prom_phys_total[0].theres_more = NULL; - prom_prom_taken[0].start_adr = NULL; + prom_phys_total[0].theres_more = 0x0; + prom_prom_taken[0].start_adr = 0x0; prom_prom_taken[0].num_bytes = 0x0; - prom_prom_taken[0].theres_more = NULL; - prom_phys_avail[0].start_adr = NULL; + prom_prom_taken[0].theres_more = 0x0; + prom_phys_avail[0].start_adr = 0x0; prom_phys_avail[0].num_bytes = *(sun4_romvec->memoryavail); - prom_phys_avail[0].theres_more = NULL; + prom_phys_avail[0].theres_more = 0x0; #endif break; diff --git a/trunk/arch/sparc/prom/sun4prom.c b/trunk/arch/sparc/prom/sun4prom.c index 00390a2652aa..69ca735f0d4e 100644 --- a/trunk/arch/sparc/prom/sun4prom.c +++ b/trunk/arch/sparc/prom/sun4prom.c @@ -151,7 +151,7 @@ struct linux_romvec * __init sun4_prom_init(void) * have more time, we can teach the penguin to say "By your * command" or "Activating turbo boost, Michael". :-) */ - sun4_romvec->setLEDs(NULL); + sun4_romvec->setLEDs(0x0); printk("PROMLIB: Old Sun4 boot PROM monitor %s, romvec version %d\n", sun4_romvec->monid, diff --git a/trunk/arch/sparc64/kernel/irq.c b/trunk/arch/sparc64/kernel/irq.c index 4dcb8af94090..a38cb5036df0 100644 --- a/trunk/arch/sparc64/kernel/irq.c +++ b/trunk/arch/sparc64/kernel/irq.c @@ -756,7 +756,7 @@ void handler_irq(int irq, struct pt_regs *regs) clear_softint(clr_mask); } #else - int should_forward = 0; + int should_forward = 1; clear_softint(1 << irq); #endif @@ -1007,10 +1007,10 @@ static int retarget_one_irq(struct irqaction *p, int goal_cpu) } upa_writel(tid | IMAP_VALID, imap); - do { + while (!cpu_online(goal_cpu)) { if (++goal_cpu >= NR_CPUS) goal_cpu = 0; - } while (!cpu_online(goal_cpu)); + } return goal_cpu; } diff --git a/trunk/arch/x86_64/Kconfig b/trunk/arch/x86_64/Kconfig index 44ee7f6acf7b..80c38c5d71fe 100644 --- a/trunk/arch/x86_64/Kconfig +++ b/trunk/arch/x86_64/Kconfig @@ -379,11 +379,6 @@ config GENERIC_IRQ_PROBE bool default y -# we have no ISA slots, but we do have ISA-style DMA. -config ISA_DMA_API - bool - default y - menu "Power management options" source kernel/power/Kconfig diff --git a/trunk/drivers/block/Kconfig b/trunk/drivers/block/Kconfig index b594768b0241..e43e02328968 100644 --- a/trunk/drivers/block/Kconfig +++ b/trunk/drivers/block/Kconfig @@ -105,7 +105,7 @@ config ATARI_SLM config BLK_DEV_XD tristate "XT hard disk support" - depends on ISA && ISA_DMA_API + depends on ISA help Very old 8 bit hard disk controllers used in the IBM XT computer will be supported if you say Y here. diff --git a/trunk/drivers/block/aoe/aoe.h b/trunk/drivers/block/aoe/aoe.h index 721ba8086043..aa8b547ffafa 100644 --- a/trunk/drivers/block/aoe/aoe.h +++ b/trunk/drivers/block/aoe/aoe.h @@ -1,5 +1,5 @@ /* Copyright (c) 2004 Coraid, Inc. See COPYING for GPL terms. */ -#define VERSION "10" +#define VERSION "6" #define AOE_MAJOR 152 #define DEVICE_NAME "aoe" diff --git a/trunk/drivers/block/aoe/aoeblk.c b/trunk/drivers/block/aoe/aoeblk.c index 0e97fcb9f3a1..4780f7926d42 100644 --- a/trunk/drivers/block/aoe/aoeblk.c +++ b/trunk/drivers/block/aoe/aoeblk.c @@ -37,13 +37,6 @@ static ssize_t aoedisk_show_netif(struct gendisk * disk, char *page) return snprintf(page, PAGE_SIZE, "%s\n", d->ifp->name); } -/* firmware version */ -static ssize_t aoedisk_show_fwver(struct gendisk * disk, char *page) -{ - struct aoedev *d = disk->private_data; - - return snprintf(page, PAGE_SIZE, "0x%04x\n", (unsigned int) d->fw_ver); -} static struct disk_attribute disk_attr_state = { .attr = {.name = "state", .mode = S_IRUGO }, @@ -57,10 +50,6 @@ static struct disk_attribute disk_attr_netif = { .attr = {.name = "netif", .mode = S_IRUGO }, .show = aoedisk_show_netif }; -static struct disk_attribute disk_attr_fwver = { - .attr = {.name = "firmware-version", .mode = S_IRUGO }, - .show = aoedisk_show_fwver -}; static void aoedisk_add_sysfs(struct aoedev *d) @@ -68,7 +57,6 @@ aoedisk_add_sysfs(struct aoedev *d) sysfs_create_file(&d->gd->kobj, &disk_attr_state.attr); sysfs_create_file(&d->gd->kobj, &disk_attr_mac.attr); sysfs_create_file(&d->gd->kobj, &disk_attr_netif.attr); - sysfs_create_file(&d->gd->kobj, &disk_attr_fwver.attr); } void aoedisk_rm_sysfs(struct aoedev *d) @@ -76,7 +64,6 @@ aoedisk_rm_sysfs(struct aoedev *d) sysfs_remove_link(&d->gd->kobj, "state"); sysfs_remove_link(&d->gd->kobj, "mac"); sysfs_remove_link(&d->gd->kobj, "netif"); - sysfs_remove_link(&d->gd->kobj, "firmware-version"); } static int diff --git a/trunk/drivers/block/aoe/aoedev.c b/trunk/drivers/block/aoe/aoedev.c index 6e231c5a1199..ec16c64dd114 100644 --- a/trunk/drivers/block/aoe/aoedev.c +++ b/trunk/drivers/block/aoe/aoedev.c @@ -109,22 +109,25 @@ aoedev_set(ulong sysminor, unsigned char *addr, struct net_device *ifp, ulong bu spin_lock_irqsave(&devlist_lock, flags); for (d=devlist; d; d=d->next) - if (d->sysminor == sysminor) + if (d->sysminor == sysminor + || memcmp(d->addr, addr, sizeof d->addr) == 0) break; if (d == NULL && (d = aoedev_newdev(bufcnt)) == NULL) { spin_unlock_irqrestore(&devlist_lock, flags); printk(KERN_INFO "aoe: aoedev_set: aoedev_newdev failure.\n"); return NULL; - } /* if newdev, (d->flags & DEVFL_UP) == 0 for below */ + } spin_unlock_irqrestore(&devlist_lock, flags); spin_lock_irqsave(&d->lock, flags); d->ifp = ifp; - memcpy(d->addr, addr, sizeof d->addr); - if ((d->flags & DEVFL_UP) == 0) { + + if (d->sysminor != sysminor + || (d->flags & DEVFL_UP) == 0) { aoedev_downdev(d); /* flushes outstanding frames */ + memcpy(d->addr, addr, sizeof d->addr); d->sysminor = sysminor; d->aoemajor = AOEMAJOR(sysminor); d->aoeminor = AOEMINOR(sysminor); diff --git a/trunk/drivers/block/aoe/aoenet.c b/trunk/drivers/block/aoe/aoenet.c index 9e6f51c528b0..bc92aacb6dad 100644 --- a/trunk/drivers/block/aoe/aoenet.c +++ b/trunk/drivers/block/aoe/aoenet.c @@ -7,7 +7,6 @@ #include #include #include -#include #include "aoe.h" #define NECODES 5 @@ -27,19 +26,6 @@ enum { }; static char aoe_iflist[IFLISTSZ]; -module_param_string(aoe_iflist, aoe_iflist, IFLISTSZ, 0600); -MODULE_PARM_DESC(aoe_iflist, "aoe_iflist=\"dev1 [dev2 ...]\"\n"); - -#ifndef MODULE -static int __init aoe_iflist_setup(char *str) -{ - strncpy(aoe_iflist, str, IFLISTSZ); - aoe_iflist[IFLISTSZ - 1] = '\0'; - return 1; -} - -__setup("aoe_iflist=", aoe_iflist_setup); -#endif int is_aoe_netif(struct net_device *ifp) @@ -50,8 +36,7 @@ is_aoe_netif(struct net_device *ifp) if (aoe_iflist[0] == '\0') return 1; - p = aoe_iflist + strspn(aoe_iflist, WHITESPACE); - for (; *p; p = q + strspn(q, WHITESPACE)) { + for (p = aoe_iflist; *p; p = q + strspn(q, WHITESPACE)) { q = p + strcspn(p, WHITESPACE); if (q != p) len = q - p; diff --git a/trunk/drivers/char/Kconfig b/trunk/drivers/char/Kconfig index 2d5a19f6378d..e162dab64ffd 100644 --- a/trunk/drivers/char/Kconfig +++ b/trunk/drivers/char/Kconfig @@ -153,7 +153,7 @@ config DIGIEPCA config ESPSERIAL tristate "Hayes ESP serial port support" - depends on SERIAL_NONSTANDARD && ISA && BROKEN_ON_SMP && ISA_DMA_API + depends on SERIAL_NONSTANDARD && ISA && BROKEN_ON_SMP help This is a driver which supports Hayes ESP serial ports. Both single port cards and multiport cards are supported. Make sure to read @@ -195,7 +195,7 @@ config ISI config SYNCLINK tristate "Microgate SyncLink card support" - depends on SERIAL_NONSTANDARD && PCI && ISA_DMA_API + depends on SERIAL_NONSTANDARD && PCI help Provides support for the SyncLink ISA and PCI multiprotocol serial adapters. These adapters support asynchronous and HDLC bit diff --git a/trunk/drivers/char/ipmi/ipmi_si_intf.c b/trunk/drivers/char/ipmi/ipmi_si_intf.c index 298574e16061..5419440087fd 100644 --- a/trunk/drivers/char/ipmi/ipmi_si_intf.c +++ b/trunk/drivers/char/ipmi/ipmi_si_intf.c @@ -1617,15 +1617,15 @@ typedef struct dmi_header u16 handle; } dmi_header_t; -static int decode_dmi(dmi_header_t __iomem *dm, int intf_num) +static int decode_dmi(dmi_header_t *dm, int intf_num) { - u8 __iomem *data = (u8 __iomem *)dm; + u8 *data = (u8 *)dm; unsigned long base_addr; u8 reg_spacing; - u8 len = readb(&dm->length); + u8 len = dm->length; dmi_ipmi_data_t *ipmi_data = dmi_data+intf_num; - ipmi_data->type = readb(&data[4]); + ipmi_data->type = data[4]; memcpy(&base_addr, data+8, sizeof(unsigned long)); if (len >= 0x11) { @@ -1640,12 +1640,12 @@ static int decode_dmi(dmi_header_t __iomem *dm, int intf_num) } /* If bit 4 of byte 0x10 is set, then the lsb for the address is odd. */ - ipmi_data->base_addr = base_addr | ((readb(&data[0x10]) & 0x10) >> 4); + ipmi_data->base_addr = base_addr | ((data[0x10] & 0x10) >> 4); - ipmi_data->irq = readb(&data[0x11]); + ipmi_data->irq = data[0x11]; /* The top two bits of byte 0x10 hold the register spacing. */ - reg_spacing = (readb(&data[0x10]) & 0xC0) >> 6; + reg_spacing = (data[0x10] & 0xC0) >> 6; switch(reg_spacing){ case 0x00: /* Byte boundaries */ ipmi_data->offset = 1; @@ -1673,7 +1673,7 @@ static int decode_dmi(dmi_header_t __iomem *dm, int intf_num) ipmi_data->offset = 1; } - ipmi_data->slave_addr = readb(&data[6]); + ipmi_data->slave_addr = data[6]; if (is_new_interface(-1, ipmi_data->addr_space,ipmi_data->base_addr)) { dmi_data_entries++; @@ -1687,9 +1687,9 @@ static int decode_dmi(dmi_header_t __iomem *dm, int intf_num) static int dmi_table(u32 base, int len, int num) { - u8 __iomem *buf; - struct dmi_header __iomem *dm; - u8 __iomem *data; + u8 *buf; + struct dmi_header *dm; + u8 *data; int i=1; int status=-1; int intf_num = 0; @@ -1702,12 +1702,12 @@ static int dmi_table(u32 base, int len, int num) while(ilength)) >= len) + if((data-buf+dm->length) >= len) break; - if (readb(&dm->type) == 38) { + if (dm->type == 38) { if (decode_dmi(dm, intf_num) == 0) { intf_num++; if (intf_num >= SI_MAX_DRIVERS) @@ -1715,8 +1715,8 @@ static int dmi_table(u32 base, int len, int num) } } - data+=readb(&dm->length); - while((data-buf) < len && (readb(data)||readb(data+1))) + data+=dm->length; + while((data-buf) < len && (*data || data[1])) data++; data+=2; i++; diff --git a/trunk/drivers/char/ipmi/ipmi_si_sm.h b/trunk/drivers/char/ipmi/ipmi_si_sm.h index 62791dd42985..a0212b004016 100644 --- a/trunk/drivers/char/ipmi/ipmi_si_sm.h +++ b/trunk/drivers/char/ipmi/ipmi_si_sm.h @@ -51,7 +51,7 @@ struct si_sm_io /* Generic info used by the actual handling routines, the state machine shouldn't touch these. */ void *info; - void __iomem *addr; + void *addr; int regspacing; int regsize; int regshift; diff --git a/trunk/drivers/char/mbcs.c b/trunk/drivers/char/mbcs.c index ac9cfa9701ea..ec7100556c50 100644 --- a/trunk/drivers/char/mbcs.c +++ b/trunk/drivers/char/mbcs.c @@ -394,7 +394,7 @@ int mbcs_open(struct inode *ip, struct file *fp) return -ENODEV; } -ssize_t mbcs_sram_read(struct file * fp, char __user *buf, size_t len, loff_t * off) +ssize_t mbcs_sram_read(struct file * fp, char *buf, size_t len, loff_t * off) { struct cx_dev *cx_dev = fp->private_data; struct mbcs_soft *soft = cx_dev->soft; @@ -419,7 +419,7 @@ ssize_t mbcs_sram_read(struct file * fp, char __user *buf, size_t len, loff_t * } ssize_t -mbcs_sram_write(struct file * fp, const char __user *buf, size_t len, loff_t * off) +mbcs_sram_write(struct file * fp, const char *buf, size_t len, loff_t * off) { struct cx_dev *cx_dev = fp->private_data; struct mbcs_soft *soft = cx_dev->soft; diff --git a/trunk/drivers/char/mbcs.h b/trunk/drivers/char/mbcs.h index e7fd47e43257..844644d201c5 100644 --- a/trunk/drivers/char/mbcs.h +++ b/trunk/drivers/char/mbcs.h @@ -543,9 +543,9 @@ struct mbcs_soft { }; extern int mbcs_open(struct inode *ip, struct file *fp); -extern ssize_t mbcs_sram_read(struct file *fp, char __user *buf, size_t len, +extern ssize_t mbcs_sram_read(struct file *fp, char *buf, size_t len, loff_t * off); -extern ssize_t mbcs_sram_write(struct file *fp, const char __user *buf, size_t len, +extern ssize_t mbcs_sram_write(struct file *fp, const char *buf, size_t len, loff_t * off); extern loff_t mbcs_sram_llseek(struct file *filp, loff_t off, int whence); extern int mbcs_gscr_mmap(struct file *fp, struct vm_area_struct *vma); diff --git a/trunk/drivers/char/sonypi.c b/trunk/drivers/char/sonypi.c index fd042060809a..c812191417c3 100644 --- a/trunk/drivers/char/sonypi.c +++ b/trunk/drivers/char/sonypi.c @@ -1021,11 +1021,11 @@ static int sonypi_misc_ioctl(struct inode *ip, struct file *fp, ret = -EIO; break; } - if (copy_to_user(argp, &val8, sizeof(val8))) + if (copy_to_user((u8 *)arg, &val8, sizeof(val8))) ret = -EFAULT; break; case SONYPI_IOCSFAN: - if (copy_from_user(&val8, argp, sizeof(val8))) { + if (copy_from_user(&val8, (u8 *)arg, sizeof(val8))) { ret = -EFAULT; break; } @@ -1038,7 +1038,7 @@ static int sonypi_misc_ioctl(struct inode *ip, struct file *fp, ret = -EIO; break; } - if (copy_to_user(argp, &val8, sizeof(val8))) + if (copy_to_user((u8 *)arg, &val8, sizeof(val8))) ret = -EFAULT; break; default: diff --git a/trunk/drivers/mmc/Kconfig b/trunk/drivers/mmc/Kconfig index 2e70d74fbdee..72f2b466b816 100644 --- a/trunk/drivers/mmc/Kconfig +++ b/trunk/drivers/mmc/Kconfig @@ -51,7 +51,7 @@ config MMC_PXA config MMC_WBSD tristate "Winbond W83L51xD SD/MMC Card Interface support" - depends on MMC && ISA && ISA_DMA_API + depends on MMC && ISA help This selects the Winbond(R) W83L51xD Secure digital and Multimedia card Interface. diff --git a/trunk/drivers/net/Kconfig b/trunk/drivers/net/Kconfig index 3a0a55b62aaf..68242bda4b9c 100644 --- a/trunk/drivers/net/Kconfig +++ b/trunk/drivers/net/Kconfig @@ -589,7 +589,7 @@ config EL2 config ELPLUS tristate "3c505 \"EtherLink Plus\" support" - depends on NET_VENDOR_3COM && ISA && ISA_DMA_API + depends on NET_VENDOR_3COM && ISA ---help--- Information about this network (Ethernet) card can be found in . If you have a card of @@ -630,7 +630,7 @@ config EL3 config 3C515 tristate "3c515 ISA \"Fast EtherLink\"" - depends on NET_VENDOR_3COM && (ISA || EISA) && ISA_DMA_API + depends on NET_VENDOR_3COM && (ISA || EISA) help If you have a 3Com ISA EtherLink XL "Corkscrew" 3c515 Fast Ethernet network card, say Y and read the Ethernet-HOWTO, available from @@ -708,7 +708,7 @@ config TYPHOON config LANCE tristate "AMD LANCE and PCnet (AT1500 and NE2100) support" - depends on NET_ETHERNET && ISA && ISA_DMA_API + depends on NET_ETHERNET && ISA help If you have a network (Ethernet) card of this type, say Y and read the Ethernet-HOWTO, available from @@ -864,7 +864,7 @@ config NI52 config NI65 tristate "NI6510 support" - depends on NET_VENDOR_RACAL && ISA && ISA_DMA_API + depends on NET_VENDOR_RACAL && ISA help If you have a network (Ethernet) card of this type, say Y and read the Ethernet-HOWTO, available from @@ -1072,7 +1072,7 @@ config NE2000 config ZNET tristate "Zenith Z-Note support (EXPERIMENTAL)" - depends on NET_ISA && EXPERIMENTAL && ISA_DMA_API + depends on NET_ISA && EXPERIMENTAL help The Zenith Z-Note notebook computer has a built-in network (Ethernet) card, and this is the Linux driver for it. Note that the diff --git a/trunk/drivers/net/appletalk/Kconfig b/trunk/drivers/net/appletalk/Kconfig index 69c488d933a2..60b19679ca5c 100644 --- a/trunk/drivers/net/appletalk/Kconfig +++ b/trunk/drivers/net/appletalk/Kconfig @@ -13,7 +13,7 @@ config DEV_APPLETALK config LTPC tristate "Apple/Farallon LocalTalk PC support" - depends on DEV_APPLETALK && (ISA || EISA) && ISA_DMA_API + depends on DEV_APPLETALK && (ISA || EISA) help This allows you to use the AppleTalk PC card to connect to LocalTalk networks. The card is also known as the Farallon PhoneNet PC card. diff --git a/trunk/drivers/net/hamradio/Kconfig b/trunk/drivers/net/hamradio/Kconfig index 7cdebe1a0b61..34068f81d45e 100644 --- a/trunk/drivers/net/hamradio/Kconfig +++ b/trunk/drivers/net/hamradio/Kconfig @@ -45,7 +45,7 @@ config BPQETHER config DMASCC tristate "High-speed (DMA) SCC driver for AX.25" - depends on ISA && AX25 && BROKEN_ON_SMP && ISA_DMA_API + depends on ISA && AX25 && BROKEN_ON_SMP ---help--- This is a driver for high-speed SCC boards, i.e. those supporting DMA on one port. You usually use those boards to connect your @@ -78,7 +78,7 @@ config DMASCC config SCC tristate "Z8530 SCC driver" - depends on ISA && AX25 && ISA_DMA_API + depends on ISA && AX25 ---help--- These cards are used to connect your Linux box to an amateur radio in order to communicate with other computers. If you want to use diff --git a/trunk/drivers/net/irda/Kconfig b/trunk/drivers/net/irda/Kconfig index 1c553d7efdd9..6bf76a444d48 100644 --- a/trunk/drivers/net/irda/Kconfig +++ b/trunk/drivers/net/irda/Kconfig @@ -310,7 +310,7 @@ config SIGMATEL_FIR config NSC_FIR tristate "NSC PC87108/PC87338" - depends on IRDA && ISA_DMA_API + depends on IRDA help Say Y here if you want to build support for the NSC PC87108 and PC87338 IrDA chipsets. This driver supports SIR, @@ -321,7 +321,7 @@ config NSC_FIR config WINBOND_FIR tristate "Winbond W83977AF (IR)" - depends on IRDA && ISA_DMA_API + depends on IRDA help Say Y here if you want to build IrDA support for the Winbond W83977AF super-io chipset. This driver should be used for the IrDA @@ -347,7 +347,7 @@ config AU1000_FIR config SMC_IRCC_FIR tristate "SMSC IrCC (EXPERIMENTAL)" - depends on EXPERIMENTAL && IRDA && ISA_DMA_API + depends on EXPERIMENTAL && IRDA help Say Y here if you want to build support for the SMC Infrared Communications Controller. It is used in a wide variety of @@ -357,7 +357,7 @@ config SMC_IRCC_FIR config ALI_FIR tristate "ALi M5123 FIR (EXPERIMENTAL)" - depends on EXPERIMENTAL && IRDA && ISA_DMA_API + depends on EXPERIMENTAL && IRDA help Say Y here if you want to build support for the ALi M5123 FIR Controller. The ALi M5123 FIR Controller is embedded in ALi M1543C, @@ -385,7 +385,7 @@ config SA1100_FIR config VIA_FIR tristate "VIA VT8231/VT1211 SIR/MIR/FIR" - depends on IRDA && ISA_DMA_API + depends on IRDA help Say Y here if you want to build support for the VIA VT8231 and VIA VT1211 IrDA controllers, found on the motherboards using diff --git a/trunk/drivers/net/ppp_deflate.c b/trunk/drivers/net/ppp_deflate.c index 3872088fdd10..507d6328d4eb 100644 --- a/trunk/drivers/net/ppp_deflate.c +++ b/trunk/drivers/net/ppp_deflate.c @@ -87,7 +87,8 @@ static void z_comp_free(void *arg) if (state) { zlib_deflateEnd(&state->strm); - vfree(state->strm.workspace); + if (state->strm.workspace) + vfree(state->strm.workspace); kfree(state); } } @@ -307,7 +308,8 @@ static void z_decomp_free(void *arg) if (state) { zlib_inflateEnd(&state->strm); - kfree(state->strm.workspace); + if (state->strm.workspace) + kfree(state->strm.workspace); kfree(state); } } diff --git a/trunk/drivers/net/ppp_generic.c b/trunk/drivers/net/ppp_generic.c index 3b377f6cd4a0..c456dc81b873 100644 --- a/trunk/drivers/net/ppp_generic.c +++ b/trunk/drivers/net/ppp_generic.c @@ -2467,10 +2467,14 @@ static void ppp_destroy_interface(struct ppp *ppp) skb_queue_purge(&ppp->mrq); #endif /* CONFIG_PPP_MULTILINK */ #ifdef CONFIG_PPP_FILTER - kfree(ppp->pass_filter); - ppp->pass_filter = NULL; - kfree(ppp->active_filter); - ppp->active_filter = NULL; + if (ppp->pass_filter) { + kfree(ppp->pass_filter); + ppp->pass_filter = NULL; + } + if (ppp->active_filter) { + kfree(ppp->active_filter); + ppp->active_filter = NULL; + } #endif /* CONFIG_PPP_FILTER */ kfree(ppp); diff --git a/trunk/drivers/net/wan/Kconfig b/trunk/drivers/net/wan/Kconfig index 66b94668ddd8..35791934a602 100644 --- a/trunk/drivers/net/wan/Kconfig +++ b/trunk/drivers/net/wan/Kconfig @@ -26,7 +26,7 @@ config WAN # There is no way to detect a comtrol sv11 - force it modular for now. config HOSTESS_SV11 tristate "Comtrol Hostess SV-11 support" - depends on WAN && ISA && m && ISA_DMA_API + depends on WAN && ISA && m help Driver for Comtrol Hostess SV-11 network card which operates on low speed synchronous serial links at up to @@ -38,7 +38,7 @@ config HOSTESS_SV11 # The COSA/SRP driver has not been tested as non-modular yet. config COSA tristate "COSA/SRP sync serial boards support" - depends on WAN && ISA && m && ISA_DMA_API + depends on WAN && ISA && m ---help--- Driver for COSA and SRP synchronous serial boards. @@ -127,7 +127,7 @@ config LANMEDIA # There is no way to detect a Sealevel board. Force it modular config SEALEVEL_4021 tristate "Sealevel Systems 4021 support" - depends on WAN && ISA && m && ISA_DMA_API + depends on WAN && ISA && m help This is a driver for the Sealevel Systems ACB 56 serial I/O adapter. diff --git a/trunk/drivers/net/wan/cycx_x25.c b/trunk/drivers/net/wan/cycx_x25.c index 02d57c0b4243..5b48cd8568f5 100644 --- a/trunk/drivers/net/wan/cycx_x25.c +++ b/trunk/drivers/net/wan/cycx_x25.c @@ -436,7 +436,9 @@ static int cycx_wan_new_if(struct wan_device *wandev, struct net_device *dev, } if (err) { - kfree(chan->local_addr); + if (chan->local_addr) + kfree(chan->local_addr); + kfree(chan); return err; } @@ -456,7 +458,9 @@ static int cycx_wan_del_if(struct wan_device *wandev, struct net_device *dev) struct cycx_x25_channel *chan = dev->priv; if (chan->svc) { - kfree(chan->local_addr); + if (chan->local_addr) + kfree(chan->local_addr); + if (chan->state == WAN_CONNECTED) del_timer(&chan->timer); } diff --git a/trunk/drivers/net/wan/pc300_tty.c b/trunk/drivers/net/wan/pc300_tty.c index 8454bf6caaa7..29f84ad08730 100644 --- a/trunk/drivers/net/wan/pc300_tty.c +++ b/trunk/drivers/net/wan/pc300_tty.c @@ -400,8 +400,10 @@ static void cpc_tty_close(struct tty_struct *tty, struct file *flip) cpc_tty->buf_rx.last = NULL; } - kfree(cpc_tty->buf_tx); - cpc_tty->buf_tx = NULL; + if (cpc_tty->buf_tx) { + kfree(cpc_tty->buf_tx); + cpc_tty->buf_tx = NULL; + } CPC_TTY_DBG("%s: TTY closed\n",cpc_tty->name); @@ -664,7 +666,7 @@ static void cpc_tty_rx_work(void * data) unsigned long port; int i, j; st_cpc_tty_area *cpc_tty; - volatile st_cpc_rx_buf *buf; + volatile st_cpc_rx_buf * buf; char flags=0,flg_rx=1; struct tty_ldisc *ld; @@ -678,9 +680,9 @@ static void cpc_tty_rx_work(void * data) cpc_tty = &cpc_tty_area[port]; if ((buf=cpc_tty->buf_rx.first) != 0) { - if (cpc_tty->tty) { + if(cpc_tty->tty) { ld = tty_ldisc_ref(cpc_tty->tty); - if (ld) { + if(ld) { if (ld->receive_buf) { CPC_TTY_DBG("%s: call line disc. receive_buf\n",cpc_tty->name); ld->receive_buf(cpc_tty->tty, (char *)(buf->data), &flags, buf->size); @@ -689,7 +691,7 @@ static void cpc_tty_rx_work(void * data) } } cpc_tty->buf_rx.first = cpc_tty->buf_rx.first->next; - kfree(buf); + kfree((unsigned char *)buf); buf = cpc_tty->buf_rx.first; flg_rx = 1; } @@ -731,7 +733,7 @@ static void cpc_tty_rx_disc_frame(pc300ch_t *pc300chan) void cpc_tty_receive(pc300dev_t *pc300dev) { - st_cpc_tty_area *cpc_tty; + st_cpc_tty_area *cpc_tty; pc300ch_t *pc300chan = (pc300ch_t *)pc300dev->chan; pc300_t *card = (pc300_t *)pc300chan->card; int ch = pc300chan->channel; @@ -740,7 +742,7 @@ void cpc_tty_receive(pc300dev_t *pc300dev) int rx_len, rx_aux; volatile unsigned char status; unsigned short first_bd = pc300chan->rx_first_bd; - st_cpc_rx_buf *new = NULL; + st_cpc_rx_buf *new=NULL; unsigned char dsr_rx; if (pc300dev->cpc_tty == NULL) { @@ -760,7 +762,7 @@ void cpc_tty_receive(pc300dev_t *pc300dev) if (status & DST_EOM) { break; } - ptdescr = (pcsca_bd_t __iomem *)(card->hw.rambase+cpc_readl(&ptdescr->next)); + ptdescr=(pcsca_bd_t __iomem *)(card->hw.rambase+cpc_readl(&ptdescr->next)); } if (!rx_len) { @@ -769,7 +771,10 @@ void cpc_tty_receive(pc300dev_t *pc300dev) cpc_writel(card->hw.scabase + DRX_REG(EDAL, ch), RX_BD_ADDR(ch, pc300chan->rx_last_bd)); } - kfree(new); + if (new) { + kfree(new); + new = NULL; + } return; } @@ -782,7 +787,7 @@ void cpc_tty_receive(pc300dev_t *pc300dev) continue; } - new = (st_cpc_rx_buf *)kmalloc(rx_len + sizeof(st_cpc_rx_buf), GFP_ATOMIC); + new = (st_cpc_rx_buf *) kmalloc(rx_len + sizeof(st_cpc_rx_buf), GFP_ATOMIC); if (new == 0) { cpc_tty_rx_disc_frame(pc300chan); continue; diff --git a/trunk/drivers/net/wan/sdla_chdlc.c b/trunk/drivers/net/wan/sdla_chdlc.c index 496d29237e92..afbe0024e3e1 100644 --- a/trunk/drivers/net/wan/sdla_chdlc.c +++ b/trunk/drivers/net/wan/sdla_chdlc.c @@ -3664,10 +3664,15 @@ static void wanpipe_tty_close(struct tty_struct *tty, struct file * filp) chdlc_disable_comm_shutdown(card); unlock_adapter_irq(&card->wandev.lock,&smp_flags); - kfree(card->tty_buf); - card->tty_buf = NULL; - kfree(card->tty_rx); - card->tty_rx = NULL; + if (card->tty_buf){ + kfree(card->tty_buf); + card->tty_buf=NULL; + } + + if (card->tty_rx){ + kfree(card->tty_rx); + card->tty_rx=NULL; + } } return; } diff --git a/trunk/drivers/net/wan/x25_asy.c b/trunk/drivers/net/wan/x25_asy.c index 1c540d825551..8c5cfcb55826 100644 --- a/trunk/drivers/net/wan/x25_asy.c +++ b/trunk/drivers/net/wan/x25_asy.c @@ -107,9 +107,13 @@ static struct x25_asy *x25_asy_alloc(void) static void x25_asy_free(struct x25_asy *sl) { /* Free all X.25 frame buffers. */ - kfree(sl->rbuff); + if (sl->rbuff) { + kfree(sl->rbuff); + } sl->rbuff = NULL; - kfree(sl->xbuff); + if (sl->xbuff) { + kfree(sl->xbuff); + } sl->xbuff = NULL; if (!test_and_clear_bit(SLF_INUSE, &sl->flags)) { @@ -130,8 +134,10 @@ static int x25_asy_change_mtu(struct net_device *dev, int newmtu) { printk("%s: unable to grow X.25 buffers, MTU change cancelled.\n", dev->name); - kfree(xbuff); - kfree(rbuff); + if (xbuff != NULL) + kfree(xbuff); + if (rbuff != NULL) + kfree(rbuff); return -ENOMEM; } @@ -163,8 +169,10 @@ static int x25_asy_change_mtu(struct net_device *dev, int newmtu) spin_unlock_bh(&sl->lock); - kfree(xbuff); - kfree(rbuff); + if (xbuff != NULL) + kfree(xbuff); + if (rbuff != NULL) + kfree(rbuff); return 0; } diff --git a/trunk/drivers/parport/Kconfig b/trunk/drivers/parport/Kconfig index 16a2e6ae37f4..731010e0e6f6 100644 --- a/trunk/drivers/parport/Kconfig +++ b/trunk/drivers/parport/Kconfig @@ -34,7 +34,7 @@ config PARPORT config PARPORT_PC tristate "PC-style hardware" - depends on PARPORT && (!SPARC64 || PCI) && !SPARC32 + depends on PARPORT && (!SPARC64 || PCI) && (!SPARC32 || BROKEN) ---help--- You should say Y here if you have a PC-style parallel port. All IBM PC compatible computers and some Alphas have PC-style diff --git a/trunk/drivers/parport/parport_pc.c b/trunk/drivers/parport/parport_pc.c index e7f3bcb79000..c5774e7855d0 100644 --- a/trunk/drivers/parport/parport_pc.c +++ b/trunk/drivers/parport/parport_pc.c @@ -67,10 +67,6 @@ #define PARPORT_PC_MAX_PORTS PARPORT_MAX -#ifdef CONFIG_ISA_DMA_API -#define HAS_DMA -#endif - /* ECR modes */ #define ECR_SPP 00 #define ECR_PS2 01 @@ -614,7 +610,6 @@ dump_parport_state ("leave fifo_write_block_pio", port); return length - left; } -#ifdef HAS_DMA static size_t parport_pc_fifo_write_block_dma (struct parport *port, const void *buf, size_t length) { @@ -737,17 +732,6 @@ dump_parport_state ("enter fifo_write_block_dma", port); dump_parport_state ("leave fifo_write_block_dma", port); return length - left; } -#endif - -static inline size_t parport_pc_fifo_write_block(struct parport *port, - const void *buf, size_t length) -{ -#ifdef HAS_DMA - if (port->dma != PARPORT_DMA_NONE) - return parport_pc_fifo_write_block_dma (port, buf, length); -#endif - return parport_pc_fifo_write_block_pio (port, buf, length); -} /* Parallel Port FIFO mode (ECP chipsets) */ static size_t parport_pc_compat_write_block_pio (struct parport *port, @@ -774,7 +758,10 @@ static size_t parport_pc_compat_write_block_pio (struct parport *port, port->physport->ieee1284.phase = IEEE1284_PH_FWD_DATA; /* Write the data to the FIFO. */ - written = parport_pc_fifo_write_block(port, buf, length); + if (port->dma != PARPORT_DMA_NONE) + written = parport_pc_fifo_write_block_dma (port, buf, length); + else + written = parport_pc_fifo_write_block_pio (port, buf, length); /* Finish up. */ /* For some hardware we don't want to touch the mode until @@ -869,7 +856,10 @@ static size_t parport_pc_ecp_write_block_pio (struct parport *port, port->physport->ieee1284.phase = IEEE1284_PH_FWD_DATA; /* Write the data to the FIFO. */ - written = parport_pc_fifo_write_block(port, buf, length); + if (port->dma != PARPORT_DMA_NONE) + written = parport_pc_fifo_write_block_dma (port, buf, length); + else + written = parport_pc_fifo_write_block_pio (port, buf, length); /* Finish up. */ /* For some hardware we don't want to touch the mode until @@ -2295,7 +2285,6 @@ struct parport *parport_pc_probe_port (unsigned long int base, } #ifdef CONFIG_PARPORT_PC_FIFO -#ifdef HAS_DMA if (p->dma != PARPORT_DMA_NONE) { if (request_dma (p->dma, p->name)) { printk (KERN_WARNING "%s: dma %d in use, " @@ -2317,8 +2306,7 @@ struct parport *parport_pc_probe_port (unsigned long int base, } } } -#endif -#endif +#endif /* CONFIG_PARPORT_PC_FIFO */ } /* Done probing. Now put the port into a sensible start-up state. */ @@ -2379,13 +2367,11 @@ void parport_pc_unregister_port (struct parport *p) if (p->modes & PARPORT_MODE_ECP) release_region(p->base_hi, 3); #ifdef CONFIG_PARPORT_PC_FIFO -#ifdef HAS_DMA if (priv->dma_buf) pci_free_consistent(priv->dev, PAGE_SIZE, priv->dma_buf, priv->dma_handle); -#endif -#endif +#endif /* CONFIG_PARPORT_PC_FIFO */ kfree (p->private_data); parport_put_port(p); kfree (ops); /* hope no-one cached it */ diff --git a/trunk/drivers/pci/hotplug/ibmphp.h b/trunk/drivers/pci/hotplug/ibmphp.h index c22e0284d7b1..5bc039da647f 100644 --- a/trunk/drivers/pci/hotplug/ibmphp.h +++ b/trunk/drivers/pci/hotplug/ibmphp.h @@ -196,7 +196,7 @@ struct ebda_hpc_bus { /******************************************************************** -* THREE TYPE OF HOT PLUG CONTROLLER * +* THREE TYPE OF HOT PLUG CONTROLER * ********************************************************************/ struct isa_ctlr_access { diff --git a/trunk/drivers/pci/hotplug/ibmphp_hpc.c b/trunk/drivers/pci/hotplug/ibmphp_hpc.c index 1a3eb8d3d4cb..6894b548c8ca 100644 --- a/trunk/drivers/pci/hotplug/ibmphp_hpc.c +++ b/trunk/drivers/pci/hotplug/ibmphp_hpc.c @@ -64,7 +64,7 @@ static int to_debug = FALSE; #define WPG_I2C_OR 0x2000 // I2C OR operation //---------------------------------------------------------------------------- -// Command set for I2C Master Operation Setup Register +// Command set for I2C Master Operation Setup Regisetr //---------------------------------------------------------------------------- #define WPG_READATADDR_MASK 0x00010000 // read,bytes,I2C shifted,index #define WPG_WRITEATADDR_MASK 0x40010000 // write,bytes,I2C shifted,index @@ -835,7 +835,7 @@ static void poll_hpc (void) if (ibmphp_shutdown) break; - /* try to get the lock to do some kind of hardware access */ + /* try to get the lock to do some kind of harware access */ down (&semOperations); switch (poll_state) { @@ -906,7 +906,7 @@ static void poll_hpc (void) poll_state = POLL_LATCH_REGISTER; break; } - /* give up the hardware semaphore */ + /* give up the harware semaphore */ up (&semOperations); /* sleep for a short time just for good measure */ msleep(100); diff --git a/trunk/drivers/pci/hotplug/ibmphp_pci.c b/trunk/drivers/pci/hotplug/ibmphp_pci.c index 8122fe734aa7..2335fac65fb4 100644 --- a/trunk/drivers/pci/hotplug/ibmphp_pci.c +++ b/trunk/drivers/pci/hotplug/ibmphp_pci.c @@ -1308,10 +1308,10 @@ static int unconfigure_boot_device (u8 busno, u8 device, u8 function) /* ????????? DO WE NEED TO WRITE ANYTHING INTO THE PCI CONFIG SPACE BACK ?????????? */ } else { /* This is Memory */ + start_address &= PCI_BASE_ADDRESS_MEM_MASK; if (start_address & PCI_BASE_ADDRESS_MEM_PREFETCH) { /* pfmem */ debug ("start address of pfmem is %x\n", start_address); - start_address &= PCI_BASE_ADDRESS_MEM_MASK; if (ibmphp_find_resource (bus, start_address, &pfmem, PFMEM) < 0) { err ("cannot find corresponding PFMEM resource to remove\n"); @@ -1325,8 +1325,6 @@ static int unconfigure_boot_device (u8 busno, u8 device, u8 function) } else { /* regular memory */ debug ("start address of mem is %x\n", start_address); - start_address &= PCI_BASE_ADDRESS_MEM_MASK; - if (ibmphp_find_resource (bus, start_address, &mem, MEM) < 0) { err ("cannot find corresponding MEM resource to remove\n"); return -EIO; @@ -1424,9 +1422,9 @@ static int unconfigure_boot_bridge (u8 busno, u8 device, u8 function) /* ????????? DO WE NEED TO WRITE ANYTHING INTO THE PCI CONFIG SPACE BACK ?????????? */ } else { /* This is Memory */ + start_address &= PCI_BASE_ADDRESS_MEM_MASK; if (start_address & PCI_BASE_ADDRESS_MEM_PREFETCH) { /* pfmem */ - start_address &= PCI_BASE_ADDRESS_MEM_MASK; if (ibmphp_find_resource (bus, start_address, &pfmem, PFMEM) < 0) { err ("cannot find corresponding PFMEM resource to remove\n"); return -EINVAL; @@ -1438,7 +1436,6 @@ static int unconfigure_boot_bridge (u8 busno, u8 device, u8 function) } } else { /* regular memory */ - start_address &= PCI_BASE_ADDRESS_MEM_MASK; if (ibmphp_find_resource (bus, start_address, &mem, MEM) < 0) { err ("cannot find corresponding MEM resource to remove\n"); return -EINVAL; diff --git a/trunk/drivers/pci/hotplug/pci_hotplug.h b/trunk/drivers/pci/hotplug/pci_hotplug.h index 88d44f7fef29..57ace325168d 100644 --- a/trunk/drivers/pci/hotplug/pci_hotplug.h +++ b/trunk/drivers/pci/hotplug/pci_hotplug.h @@ -150,7 +150,7 @@ struct hotplug_slot_info { * @name: the name of the slot being registered. This string must * be unique amoung slots registered on this system. * @ops: pointer to the &struct hotplug_slot_ops to be used for this slot - * @info: pointer to the &struct hotplug_slot_info for the initial values for + * @info: pointer to the &struct hotplug_slot_info for the inital values for * this slot. * @release: called during pci_hp_deregister to free memory allocated in a * hotplug_slot structure. diff --git a/trunk/drivers/pci/hotplug/pciehp_core.c b/trunk/drivers/pci/hotplug/pciehp_core.c index ed1fd8d6178d..72baf749e65e 100644 --- a/trunk/drivers/pci/hotplug/pciehp_core.c +++ b/trunk/drivers/pci/hotplug/pciehp_core.c @@ -90,22 +90,6 @@ static struct hotplug_slot_ops pciehp_hotplug_slot_ops = { .get_cur_bus_speed = get_cur_bus_speed, }; -/** - * release_slot - free up the memory used by a slot - * @hotplug_slot: slot to free - */ -static void release_slot(struct hotplug_slot *hotplug_slot) -{ - struct slot *slot = hotplug_slot->private; - - dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); - - kfree(slot->hotplug_slot->info); - kfree(slot->hotplug_slot->name); - kfree(slot->hotplug_slot); - kfree(slot); -} - static int init_slots(struct controller *ctrl) { struct slot *new_slot; @@ -155,8 +139,7 @@ static int init_slots(struct controller *ctrl) /* register this slot with the hotplug pci core */ new_slot->hotplug_slot->private = new_slot; - new_slot->hotplug_slot->release = &release_slot; - make_slot_name(new_slot->hotplug_slot->name, SLOT_NAME_SIZE, new_slot); + make_slot_name (new_slot->hotplug_slot->name, SLOT_NAME_SIZE, new_slot); new_slot->hotplug_slot->ops = &pciehp_hotplug_slot_ops; new_slot->hpc_ops->get_power_status(new_slot, &(new_slot->hotplug_slot->info->power_status)); @@ -205,6 +188,10 @@ static int cleanup_slots (struct controller * ctrl) while (old_slot) { next_slot = old_slot->next; pci_hp_deregister (old_slot->hotplug_slot); + kfree(old_slot->hotplug_slot->info); + kfree(old_slot->hotplug_slot->name); + kfree(old_slot->hotplug_slot); + kfree(old_slot); old_slot = next_slot; } diff --git a/trunk/drivers/pci/hotplug/pcihp_skeleton.c b/trunk/drivers/pci/hotplug/pcihp_skeleton.c index 3194d51c6ec9..6605d6bda529 100644 --- a/trunk/drivers/pci/hotplug/pcihp_skeleton.c +++ b/trunk/drivers/pci/hotplug/pcihp_skeleton.c @@ -297,7 +297,7 @@ static int __init init_slots(void) hotplug_slot->ops = &skel_hotplug_slot_ops; /* - * Initialize the slot info structure with some known + * Initilize the slot info structure with some known * good values. */ info->power_status = get_power_status(slot); diff --git a/trunk/drivers/pci/msi.c b/trunk/drivers/pci/msi.c index 30206ac43c44..22ecd3b058be 100644 --- a/trunk/drivers/pci/msi.c +++ b/trunk/drivers/pci/msi.c @@ -522,7 +522,7 @@ void pci_scan_msi_device(struct pci_dev *dev) * msi_capability_init - configure device's MSI capability structure * @dev: pointer to the pci_dev data structure of MSI device function * - * Setup the MSI capability structure of device function with a single + * Setup the MSI capability structure of device funtion with a single * MSI vector, regardless of device function is capable of handling * multiple messages. A return of zero indicates the successful setup * of an entry zero with the new MSI vector or non-zero for otherwise. @@ -599,7 +599,7 @@ static int msi_capability_init(struct pci_dev *dev) * msix_capability_init - configure device's MSI-X capability * @dev: pointer to the pci_dev data structure of MSI-X device function * - * Setup the MSI-X capability structure of device function with a + * Setup the MSI-X capability structure of device funtion with a * single MSI-X vector. A return of zero indicates the successful setup of * requested MSI-X entries with allocated vectors or non-zero for otherwise. **/ @@ -1074,7 +1074,7 @@ void pci_disable_msix(struct pci_dev* dev) * msi_remove_pci_irq_vectors - reclaim MSI(X) vectors to unused state * @dev: pointer to the pci_dev data structure of MSI(X) device function * - * Being called during hotplug remove, from which the device function + * Being called during hotplug remove, from which the device funciton * is hot-removed. All previous assigned MSI/MSI-X vectors, if * allocated for this device function, are reclaimed to unused state, * which may be used later on. diff --git a/trunk/drivers/pci/pci-acpi.c b/trunk/drivers/pci/pci-acpi.c index bc01d34e2634..968eb32f292d 100644 --- a/trunk/drivers/pci/pci-acpi.c +++ b/trunk/drivers/pci/pci-acpi.c @@ -19,7 +19,7 @@ static u32 ctrlset_buf[3] = {0, 0, 0}; static u32 global_ctrlsets = 0; -static u8 OSC_UUID[16] = {0x5B, 0x4D, 0xDB, 0x33, 0xF7, 0x1F, 0x1C, 0x40, 0x96, 0x57, 0x74, 0x41, 0xC0, 0x3D, 0xD7, 0x66}; +u8 OSC_UUID[16] = {0x5B, 0x4D, 0xDB, 0x33, 0xF7, 0x1F, 0x1C, 0x40, 0x96, 0x57, 0x74, 0x41, 0xC0, 0x3D, 0xD7, 0x66}; static acpi_status acpi_query_osc ( diff --git a/trunk/drivers/pci/pci-driver.c b/trunk/drivers/pci/pci-driver.c index fe98553c978f..37b7961efc44 100644 --- a/trunk/drivers/pci/pci-driver.c +++ b/trunk/drivers/pci/pci-driver.c @@ -318,14 +318,6 @@ static int pci_device_resume(struct device * dev) return 0; } -static void pci_device_shutdown(struct device *dev) -{ - struct pci_dev *pci_dev = to_pci_dev(dev); - struct pci_driver *drv = pci_dev->driver; - - if (drv && drv->shutdown) - drv->shutdown(pci_dev); -} #define kobj_to_pci_driver(obj) container_of(obj, struct device_driver, kobj) #define attr_to_driver_attribute(obj) container_of(obj, struct driver_attribute, attr) @@ -381,7 +373,7 @@ pci_populate_driver_dir(struct pci_driver *drv) * * Adds the driver structure to the list of registered drivers. * Returns a negative value on error, otherwise 0. - * If no error occurred, the driver remains registered even if + * If no error occured, the driver remains registered even if * no device was claimed during registration. */ int pci_register_driver(struct pci_driver *drv) @@ -393,7 +385,6 @@ int pci_register_driver(struct pci_driver *drv) drv->driver.bus = &pci_bus_type; drv->driver.probe = pci_device_probe; drv->driver.remove = pci_device_remove; - drv->driver.shutdown = pci_device_shutdown, drv->driver.owner = drv->owner; drv->driver.kobj.ktype = &pci_driver_kobj_type; pci_init_dynids(&drv->dynids); diff --git a/trunk/drivers/pci/pci-sysfs.c b/trunk/drivers/pci/pci-sysfs.c index 8568b207f189..d57ae71d32b1 100644 --- a/trunk/drivers/pci/pci-sysfs.c +++ b/trunk/drivers/pci/pci-sysfs.c @@ -91,7 +91,6 @@ pci_read_config(struct kobject *kobj, char *buf, loff_t off, size_t count) struct pci_dev *dev = to_pci_dev(container_of(kobj,struct device,kobj)); unsigned int size = 64; loff_t init_off = off; - u8 *data = (u8*) buf; /* Several chips lock up trying to read undefined config space */ if (capable(CAP_SYS_ADMIN)) { @@ -109,47 +108,30 @@ pci_read_config(struct kobject *kobj, char *buf, loff_t off, size_t count) size = count; } - if ((off & 1) && size) { - u8 val; + while (off & 3) { + unsigned char val; pci_read_config_byte(dev, off, &val); - data[off - init_off] = val; + buf[off - init_off] = val; off++; - size--; - } - - if ((off & 3) && size > 2) { - u16 val; - pci_read_config_word(dev, off, &val); - data[off - init_off] = val & 0xff; - data[off - init_off + 1] = (val >> 8) & 0xff; - off += 2; - size -= 2; + if (--size == 0) + break; } while (size > 3) { - u32 val; + unsigned int val; pci_read_config_dword(dev, off, &val); - data[off - init_off] = val & 0xff; - data[off - init_off + 1] = (val >> 8) & 0xff; - data[off - init_off + 2] = (val >> 16) & 0xff; - data[off - init_off + 3] = (val >> 24) & 0xff; + buf[off - init_off] = val & 0xff; + buf[off - init_off + 1] = (val >> 8) & 0xff; + buf[off - init_off + 2] = (val >> 16) & 0xff; + buf[off - init_off + 3] = (val >> 24) & 0xff; off += 4; size -= 4; } - if (size >= 2) { - u16 val; - pci_read_config_word(dev, off, &val); - data[off - init_off] = val & 0xff; - data[off - init_off + 1] = (val >> 8) & 0xff; - off += 2; - size -= 2; - } - - if (size > 0) { - u8 val; + while (size > 0) { + unsigned char val; pci_read_config_byte(dev, off, &val); - data[off - init_off] = val; + buf[off - init_off] = val; off++; --size; } @@ -163,7 +145,6 @@ pci_write_config(struct kobject *kobj, char *buf, loff_t off, size_t count) struct pci_dev *dev = to_pci_dev(container_of(kobj,struct device,kobj)); unsigned int size = count; loff_t init_off = off; - u8 *data = (u8*) buf; if (off > dev->cfg_size) return 0; @@ -171,41 +152,26 @@ pci_write_config(struct kobject *kobj, char *buf, loff_t off, size_t count) size = dev->cfg_size - off; count = size; } - - if ((off & 1) && size) { - pci_write_config_byte(dev, off, data[off - init_off]); + + while (off & 3) { + pci_write_config_byte(dev, off, buf[off - init_off]); off++; - size--; + if (--size == 0) + break; } - - if ((off & 3) && size > 2) { - u16 val = data[off - init_off]; - val |= (u16) data[off - init_off + 1] << 8; - pci_write_config_word(dev, off, val); - off += 2; - size -= 2; - } while (size > 3) { - u32 val = data[off - init_off]; - val |= (u32) data[off - init_off + 1] << 8; - val |= (u32) data[off - init_off + 2] << 16; - val |= (u32) data[off - init_off + 3] << 24; + unsigned int val = buf[off - init_off]; + val |= (unsigned int) buf[off - init_off + 1] << 8; + val |= (unsigned int) buf[off - init_off + 2] << 16; + val |= (unsigned int) buf[off - init_off + 3] << 24; pci_write_config_dword(dev, off, val); off += 4; size -= 4; } - - if (size >= 2) { - u16 val = data[off - init_off]; - val |= (u16) data[off - init_off + 1] << 8; - pci_write_config_word(dev, off, val); - off += 2; - size -= 2; - } - if (size) { - pci_write_config_byte(dev, off, data[off - init_off]); + while (size > 0) { + pci_write_config_byte(dev, off, buf[off - init_off]); off++; --size; } diff --git a/trunk/drivers/pci/pci.c b/trunk/drivers/pci/pci.c index f04b9ffe4153..bfbff8335268 100644 --- a/trunk/drivers/pci/pci.c +++ b/trunk/drivers/pci/pci.c @@ -16,7 +16,6 @@ #include #include #include /* isa_dma_bridge_buggy */ -#include "pci.h" /** @@ -399,10 +398,10 @@ pci_enable_device(struct pci_dev *dev) { int err; + dev->is_enabled = 1; if ((err = pci_enable_device_bars(dev, (1 << PCI_NUM_RESOURCES) - 1))) return err; pci_fixup_device(pci_fixup_enable, dev); - dev->is_enabled = 1; return 0; } @@ -428,15 +427,16 @@ pci_disable_device(struct pci_dev *dev) { u16 pci_command; + dev->is_enabled = 0; + dev->is_busmaster = 0; + pci_read_config_word(dev, PCI_COMMAND, &pci_command); if (pci_command & PCI_COMMAND_MASTER) { pci_command &= ~PCI_COMMAND_MASTER; pci_write_config_word(dev, PCI_COMMAND, pci_command); } - dev->is_busmaster = 0; pcibios_disable_device(dev); - dev->is_enabled = 0; } /** @@ -748,6 +748,17 @@ pci_set_dma_mask(struct pci_dev *dev, u64 mask) return 0; } +int +pci_dac_set_dma_mask(struct pci_dev *dev, u64 mask) +{ + if (!pci_dac_dma_supported(dev, mask)) + return -EIO; + + dev->dma_mask = mask; + + return 0; +} + int pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask) { @@ -810,6 +821,7 @@ EXPORT_SYMBOL(pci_set_master); EXPORT_SYMBOL(pci_set_mwi); EXPORT_SYMBOL(pci_clear_mwi); EXPORT_SYMBOL(pci_set_dma_mask); +EXPORT_SYMBOL(pci_dac_set_dma_mask); EXPORT_SYMBOL(pci_set_consistent_dma_mask); EXPORT_SYMBOL(pci_assign_resource); EXPORT_SYMBOL(pci_find_parent_resource); diff --git a/trunk/drivers/pci/probe.c b/trunk/drivers/pci/probe.c index b7ae87823c69..6f0edadd132c 100644 --- a/trunk/drivers/pci/probe.c +++ b/trunk/drivers/pci/probe.c @@ -9,7 +9,6 @@ #include #include #include -#include "pci.h" #define CARDBUS_LATENCY_TIMER 176 /* secondary latency timer */ #define CARDBUS_RESERVE_BUSNR 3 diff --git a/trunk/drivers/pci/proc.c b/trunk/drivers/pci/proc.c index e68bbfb1e7c3..84cc4f620d8d 100644 --- a/trunk/drivers/pci/proc.c +++ b/trunk/drivers/pci/proc.c @@ -15,7 +15,6 @@ #include #include -#include "pci.h" static int proc_initialized; /* = 0 */ diff --git a/trunk/drivers/pci/quirks.c b/trunk/drivers/pci/quirks.c index 026aa04669a2..15a398051682 100644 --- a/trunk/drivers/pci/quirks.c +++ b/trunk/drivers/pci/quirks.c @@ -18,7 +18,6 @@ #include #include #include -#include "pci.h" /* Deal with broken BIOS'es that neglect to enable passive release, which can cause problems in combination with the 82441FX/PPro MTRRs */ @@ -329,7 +328,6 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801CA_12, DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_0, quirk_ich4_lpc_acpi ); DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_12, quirk_ich4_lpc_acpi ); DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801EB_0, quirk_ich4_lpc_acpi ); -DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ESB_1, quirk_ich4_lpc_acpi ); /* * VIA ACPI: One IO region pointed to by longword at diff --git a/trunk/drivers/scsi/Kconfig b/trunk/drivers/scsi/Kconfig index 1811cb240315..750b11cefd93 100644 --- a/trunk/drivers/scsi/Kconfig +++ b/trunk/drivers/scsi/Kconfig @@ -260,7 +260,7 @@ config SCSI_3W_9XXX config SCSI_7000FASST tristate "7000FASST SCSI support" - depends on ISA && SCSI && ISA_DMA_API + depends on ISA && SCSI help This driver supports the Western Digital 7000 SCSI host adapter family. Some information is in the source: @@ -295,7 +295,7 @@ config SCSI_AHA152X config SCSI_AHA1542 tristate "Adaptec AHA1542 support" - depends on ISA && SCSI && ISA_DMA_API + depends on ISA && SCSI ---help--- This is support for a SCSI host adapter. It is explained in section 3.4 of the SCSI-HOWTO, available from @@ -515,7 +515,7 @@ config SCSI_SATA_VITESSE config SCSI_BUSLOGIC tristate "BusLogic SCSI support" - depends on (PCI || ISA || MCA) && SCSI && ISA_DMA_API + depends on (PCI || ISA || MCA) && SCSI && (BROKEN || !SPARC64) ---help--- This is support for BusLogic MultiMaster and FlashPoint SCSI Host Adapters. Consult the SCSI-HOWTO, available from @@ -571,7 +571,7 @@ config SCSI_DTC3280 config SCSI_EATA tristate "EATA ISA/EISA/PCI (DPT and generic EATA/DMA-compliant boards) support" - depends on (ISA || EISA || PCI) && SCSI && ISA_DMA_API + depends on (ISA || EISA || PCI) && SCSI && (BROKEN || !SPARC64) ---help--- This driver supports all EATA/DMA-compliant SCSI host adapters. DPT ISA and all EISA I/O addresses are probed looking for the "EATA" @@ -665,7 +665,7 @@ config SCSI_FD_MCS config SCSI_GDTH tristate "Intel/ICP (former GDT SCSI Disk Array) RAID Controller support" - depends on (ISA || EISA || PCI) && SCSI && ISA_DMA_API + depends on (ISA || EISA || PCI) && SCSI && (BROKEN || !SPARC64) ---help--- Formerly called GDT SCSI Disk Array Controller Support. @@ -1416,7 +1416,7 @@ config SCSI_T128 config SCSI_U14_34F tristate "UltraStor 14F/34F support" - depends on ISA && SCSI && ISA_DMA_API + depends on ISA && SCSI ---help--- This is support for the UltraStor 14F and 34F SCSI-2 host adapters. The source at contains some diff --git a/trunk/drivers/usb/core/message.c b/trunk/drivers/usb/core/message.c index f50aaf25c98e..e12c5be1e0a3 100644 --- a/trunk/drivers/usb/core/message.c +++ b/trunk/drivers/usb/core/message.c @@ -431,7 +431,7 @@ int usb_sg_init ( * (2) error, where io->status is a negative errno value. The number * of io->bytes transferred before the error is usually less * than requested, and can be nonzero. - * (3) cancellation, a type of error with status -ECONNRESET that + * (3) cancelation, a type of error with status -ECONNRESET that * is initiated by usb_sg_cancel(). * * When this function returns, all memory allocated through usb_sg_init() or @@ -1282,7 +1282,7 @@ static void release_interface(struct device *dev) * bus rwsem; usb device driver probe() methods cannot use this routine. * * Returns zero on success, or else the status code returned by the - * underlying call that failed. On successful completion, each interface + * underlying call that failed. On succesful completion, each interface * in the original device configuration has been destroyed, and each one * in the new configuration has been probed by all relevant usb device * drivers currently known to the kernel. diff --git a/trunk/drivers/usb/core/urb.c b/trunk/drivers/usb/core/urb.c index 0faf18d511de..16972159a57a 100644 --- a/trunk/drivers/usb/core/urb.c +++ b/trunk/drivers/usb/core/urb.c @@ -121,7 +121,7 @@ struct urb * usb_get_urb(struct urb *urb) * describing that request to the USB subsystem. Request completion will * be indicated later, asynchronously, by calling the completion handler. * The three types of completion are success, error, and unlink - * (a software-induced fault, also called "request cancellation"). + * (a software-induced fault, also called "request cancelation"). * * URBs may be submitted in interrupt context. * @@ -170,7 +170,7 @@ struct urb * usb_get_urb(struct urb *urb) * As of Linux 2.6, all USB endpoint transfer queues support depths greater * than one. This was previously a HCD-specific behavior, except for ISO * transfers. Non-isochronous endpoint queues are inactive during cleanup - * after faults (transfer errors or cancellation). + * after faults (transfer errors or cancelation). * * Reserved Bandwidth Transfers: * @@ -395,7 +395,7 @@ int usb_submit_urb(struct urb *urb, int mem_flags) * * This routine cancels an in-progress request. URBs complete only * once per submission, and may be canceled only once per submission. - * Successful cancellation means the requests's completion handler will + * Successful cancelation means the requests's completion handler will * be called with a status code indicating that the request has been * canceled (rather than any other code) and will quickly be removed * from host controller data structures. diff --git a/trunk/drivers/usb/gadget/ether.c b/trunk/drivers/usb/gadget/ether.c index 3f783cbdc7c3..3993156c2e82 100644 --- a/trunk/drivers/usb/gadget/ether.c +++ b/trunk/drivers/usb/gadget/ether.c @@ -569,7 +569,7 @@ static const struct usb_cdc_ether_desc ether_desc = { /* include the status endpoint if we can, even where it's optional. * use wMaxPacketSize big enough to fit CDC_NOTIFY_SPEED_CHANGE in one - * packet, to simplify cancellation; and a big transfer interval, to + * packet, to simplify cancelation; and a big transfer interval, to * waste less bandwidth. * * some drivers (like Linux 2.4 cdc-ether!) "need" it to exist even diff --git a/trunk/drivers/usb/gadget/inode.c b/trunk/drivers/usb/gadget/inode.c index 1e5e6ddef787..2cff67ccce45 100644 --- a/trunk/drivers/usb/gadget/inode.c +++ b/trunk/drivers/usb/gadget/inode.c @@ -275,7 +275,7 @@ static const char *CHIP; * * After opening, configure non-control endpoints. Then use normal * stream read() and write() requests; and maybe ioctl() to get more - * precise FIFO status when recovering from cancellation. + * precise FIFO status when recovering from cancelation. */ static void epio_complete (struct usb_ep *ep, struct usb_request *req) diff --git a/trunk/drivers/usb/gadget/lh7a40x_udc.c b/trunk/drivers/usb/gadget/lh7a40x_udc.c index df75ab65a5ec..0def9f70e889 100644 --- a/trunk/drivers/usb/gadget/lh7a40x_udc.c +++ b/trunk/drivers/usb/gadget/lh7a40x_udc.c @@ -705,7 +705,7 @@ void nuke(struct lh7a40x_ep *ep, int status) done(ep, req, status); } - /* Disable IRQ if EP is enabled (has descriptor) */ + /* Disable IRQ if EP is enabled (has decriptor) */ if (ep->desc) pio_irq_disable(ep_index(ep)); } diff --git a/trunk/drivers/usb/gadget/serial.c b/trunk/drivers/usb/gadget/serial.c index 4d591c764e38..f1762ed6db63 100644 --- a/trunk/drivers/usb/gadget/serial.c +++ b/trunk/drivers/usb/gadget/serial.c @@ -240,7 +240,7 @@ struct gs_dev { struct usb_ep *dev_notify_ep; /* address of notify endpoint */ struct usb_ep *dev_in_ep; /* address of in endpoint */ struct usb_ep *dev_out_ep; /* address of out endpoint */ - struct usb_endpoint_descriptor /* descriptor of notify ep */ + struct usb_endpoint_descriptor /* desciptor of notify ep */ *dev_notify_ep_desc; struct usb_endpoint_descriptor /* descriptor of in endpoint */ *dev_in_ep_desc; diff --git a/trunk/drivers/usb/host/ehci-hcd.c b/trunk/drivers/usb/host/ehci-hcd.c index bc69bd7acebe..84d2b93aca37 100644 --- a/trunk/drivers/usb/host/ehci-hcd.c +++ b/trunk/drivers/usb/host/ehci-hcd.c @@ -346,22 +346,6 @@ ehci_reboot (struct notifier_block *self, unsigned long code, void *null) return 0; } -static void ehci_port_power (struct ehci_hcd *ehci, int is_on) -{ - unsigned port; - - if (!HCS_PPC (ehci->hcs_params)) - return; - - ehci_dbg (ehci, "...power%s ports...\n", is_on ? "up" : "down"); - for (port = HCS_N_PORTS (ehci->hcs_params); port > 0; ) - (void) ehci_hub_control(ehci_to_hcd(ehci), - is_on ? SetPortFeature : ClearPortFeature, - USB_PORT_FEAT_POWER, - port--, NULL, 0); - msleep(20); -} - /* called by khubd or root hub init threads */ @@ -378,10 +362,8 @@ static int ehci_hc_reset (struct usb_hcd *hcd) dbg_hcs_params (ehci, "reset"); dbg_hcc_params (ehci, "reset"); - /* cache this readonly data; minimize chip reads */ - ehci->hcs_params = readl (&ehci->caps->hcs_params); - #ifdef CONFIG_PCI + /* EHCI 0.96 and later may have "extended capabilities" */ if (hcd->self.controller->bus == &pci_bus_type) { struct pci_dev *pdev = to_pci_dev(hcd->self.controller); @@ -401,30 +383,9 @@ static int ehci_hc_reset (struct usb_hcd *hcd) break; } - /* optional debug port, normally in the first BAR */ - temp = pci_find_capability (pdev, 0x0a); - if (temp) { - pci_read_config_dword(pdev, temp, &temp); - temp >>= 16; - if ((temp & (3 << 13)) == (1 << 13)) { - temp &= 0x1fff; - ehci->debug = hcd->regs + temp; - temp = readl (&ehci->debug->control); - ehci_info (ehci, "debug port %d%s\n", - HCS_DEBUG_PORT(ehci->hcs_params), - (temp & DBGP_ENABLED) - ? " IN USE" - : ""); - if (!(temp & DBGP_ENABLED)) - ehci->debug = NULL; - } - } - temp = HCC_EXT_CAPS (readl (&ehci->caps->hcc_params)); } else temp = 0; - - /* EHCI 0.96 and later may have "extended capabilities" */ while (temp && count--) { u32 cap; @@ -453,7 +414,8 @@ static int ehci_hc_reset (struct usb_hcd *hcd) ehci_reset (ehci); #endif - ehci_port_power (ehci, 0); + /* cache this readonly data; minimize PCI reads */ + ehci->hcs_params = readl (&ehci->caps->hcs_params); /* at least the Genesys GL880S needs fixup here */ temp = HCS_N_CC(ehci->hcs_params) * HCS_N_PCC(ehci->hcs_params); @@ -695,11 +657,16 @@ static int ehci_start (struct usb_hcd *hcd) static void ehci_stop (struct usb_hcd *hcd) { struct ehci_hcd *ehci = hcd_to_ehci (hcd); + u8 rh_ports, port; ehci_dbg (ehci, "stop\n"); /* Turn off port power on all root hub ports. */ - ehci_port_power (ehci, 0); + rh_ports = HCS_N_PORTS (ehci->hcs_params); + for (port = 1; port <= rh_ports; port++) + (void) ehci_hub_control(hcd, + ClearPortFeature, USB_PORT_FEAT_POWER, + port, NULL, 0); /* no more interrupts ... */ del_timer_sync (&ehci->watchdog); @@ -781,6 +748,7 @@ static int ehci_resume (struct usb_hcd *hcd) unsigned port; struct usb_device *root = hcd->self.root_hub; int retval = -EINVAL; + int powerup = 0; // maybe restore (PCI) FLADJ @@ -798,6 +766,8 @@ static int ehci_resume (struct usb_hcd *hcd) up (&hcd->self.root_hub->serialize); break; } + if ((status & PORT_POWER) == 0) + powerup = 1; if (!root->children [port]) continue; dbg_port (ehci, __FUNCTION__, port + 1, status); @@ -824,9 +794,16 @@ static int ehci_resume (struct usb_hcd *hcd) retval = ehci_start (hcd); /* here we "know" root ports should always stay powered; - * but some controllers may lose all power. + * but some controllers may lost all power. */ - ehci_port_power (ehci, 1); + if (powerup) { + ehci_dbg (ehci, "...powerup ports...\n"); + for (port = HCS_N_PORTS (ehci->hcs_params); port > 0; ) + (void) ehci_hub_control(hcd, + SetPortFeature, USB_PORT_FEAT_POWER, + port--, NULL, 0); + msleep(20); + } } return retval; diff --git a/trunk/drivers/usb/host/ehci-hub.c b/trunk/drivers/usb/host/ehci-hub.c index 02fefab3501e..2373537fabed 100644 --- a/trunk/drivers/usb/host/ehci-hub.c +++ b/trunk/drivers/usb/host/ehci-hub.c @@ -281,8 +281,6 @@ ehci_hub_descriptor ( temp = 0x0008; /* per-port overcurrent reporting */ if (HCS_PPC (ehci->hcs_params)) temp |= 0x0001; /* per-port power control */ - else - temp |= 0x0002; /* no power switching */ #if 0 // re-enable when we support USB_PORT_FEAT_INDICATOR below. if (HCS_INDICATOR (ehci->hcs_params)) diff --git a/trunk/drivers/usb/host/ehci.h b/trunk/drivers/usb/host/ehci.h index 4df498231752..e763a8399a75 100644 --- a/trunk/drivers/usb/host/ehci.h +++ b/trunk/drivers/usb/host/ehci.h @@ -47,12 +47,6 @@ struct ehci_stats { #define EHCI_MAX_ROOT_PORTS 15 /* see HCS_N_PORTS */ struct ehci_hcd { /* one per controller */ - /* glue to PCI and HCD framework */ - struct ehci_caps __iomem *caps; - struct ehci_regs __iomem *regs; - struct ehci_dbg_port __iomem *debug; - - __u32 hcs_params; /* cached register copy */ spinlock_t lock; /* async schedule support */ @@ -90,6 +84,11 @@ struct ehci_hcd { /* one per controller */ unsigned is_tdi_rh_tt:1; /* TDI roothub with TT */ + /* glue to PCI and HCD framework */ + struct ehci_caps __iomem *caps; + struct ehci_regs __iomem *regs; + __u32 hcs_params; /* cached register copy */ + /* irq statistics */ #ifdef EHCI_STATS struct ehci_stats stats; @@ -166,7 +165,7 @@ struct ehci_caps { /* these fields are specified as 8 and 16 bit registers, * but some hosts can't perform 8 or 16 bit PCI accesses. */ - u32 hc_capbase; + u32 hc_capbase; #define HC_LENGTH(p) (((p)>>00)&0x00ff) /* bits 7:0 */ #define HC_VERSION(p) (((p)>>16)&0xffff) /* bits 31:16 */ u32 hcs_params; /* HCSPARAMS - offset 0x4 */ @@ -274,7 +273,7 @@ struct ehci_dbg_port { #define DBGP_ENABLED (1<<28) #define DBGP_DONE (1<<16) #define DBGP_INUSE (1<<10) -#define DBGP_ERRCODE(x) (((x)>>7)&0x07) +#define DBGP_ERRCODE(x) (((x)>>7)&0x0f) # define DBGP_ERR_BAD 1 # define DBGP_ERR_SIGNAL 2 #define DBGP_ERROR (1<<6) @@ -283,11 +282,11 @@ struct ehci_dbg_port { #define DBGP_LEN(x) (((x)>>0)&0x0f) u32 pids; #define DBGP_PID_GET(x) (((x)>>16)&0xff) -#define DBGP_PID_SET(data,tok) (((data)<<8)|(tok)) +#define DBGP_PID_SET(data,tok) (((data)<<8)|(tok)); u32 data03; u32 data47; u32 address; -#define DBGP_EPADDR(dev,ep) (((dev)<<8)|(ep)) +#define DBGP_EPADDR(dev,ep) (((dev)<<8)|(ep)); } __attribute__ ((packed)); /*-------------------------------------------------------------------------*/ diff --git a/trunk/drivers/usb/host/hc_crisv10.c b/trunk/drivers/usb/host/hc_crisv10.c index d9883d774d3a..376f8a034f65 100644 --- a/trunk/drivers/usb/host/hc_crisv10.c +++ b/trunk/drivers/usb/host/hc_crisv10.c @@ -4329,7 +4329,7 @@ static int __init etrax_usb_hc_init(void) bus->bus_name="ETRAX 100LX"; bus->hcpriv = hc; - /* Initialize RH to the default address. + /* Initalize RH to the default address. And make sure that we have no status change indication */ hc->rh.numports = 2; /* The RH has two ports */ hc->rh.devnum = 1; diff --git a/trunk/drivers/usb/host/sl811-hcd.c b/trunk/drivers/usb/host/sl811-hcd.c index a374b7692073..d309e292198e 100644 --- a/trunk/drivers/usb/host/sl811-hcd.c +++ b/trunk/drivers/usb/host/sl811-hcd.c @@ -134,7 +134,7 @@ static void port_power(struct sl811 *sl811, int is_on) /* This is a PIO-only HCD. Queueing appends URBs to the endpoint's queue, * and may start I/O. Endpoint queues are scanned during completion irq - * handlers (one per packet: ACK, NAK, faults, etc) and urb cancellation. + * handlers (one per packet: ACK, NAK, faults, etc) and urb cancelation. * * Using an external DMA engine to copy a packet at a time could work, * though setup/teardown costs may be too big to make it worthwhile. @@ -738,7 +738,7 @@ static irqreturn_t sl811h_irq(struct usb_hcd *hcd, struct pt_regs *regs) } #endif - /* port status seems weird until after reset, so + /* port status seems wierd until after reset, so * force the reset and make khubd clean up later. */ sl811->port1 |= (1 << USB_PORT_FEAT_C_CONNECTION) diff --git a/trunk/drivers/usb/image/mdc800.c b/trunk/drivers/usb/image/mdc800.c index a330a4b50e16..5791723e6083 100644 --- a/trunk/drivers/usb/image/mdc800.c +++ b/trunk/drivers/usb/image/mdc800.c @@ -23,7 +23,7 @@ * * * The driver brings the USB functions of the MDC800 to Linux. - * To use the Camera you must support the USB Protocol of the camera + * To use the Camera you must support the USB Protocoll of the camera * to the Kernel Node. * The Driver uses a misc device Node. Create it with : * mknod /dev/mustek c 180 32 diff --git a/trunk/drivers/usb/input/aiptek.c b/trunk/drivers/usb/input/aiptek.c index 94ce2a9ad50f..2d76be62f4e0 100644 --- a/trunk/drivers/usb/input/aiptek.c +++ b/trunk/drivers/usb/input/aiptek.c @@ -386,7 +386,7 @@ static int aiptek_convert_from_2s_complement(unsigned char c) * convention above.) I therefore have taken over REL_MISC and ABS_MISC * (for relative and absolute reports, respectively) for communicating * Proximity. Why two events? I thought it interesting to know if the - * Proximity event occurred while the tablet was in absolute or relative + * Proximity event occured while the tablet was in absolute or relative * mode. * * Other tablets use the notion of a certain minimum stylus pressure diff --git a/trunk/drivers/usb/input/mtouchusb.c b/trunk/drivers/usb/input/mtouchusb.c index ab1a2a30ce7c..6b45a66d58c1 100644 --- a/trunk/drivers/usb/input/mtouchusb.c +++ b/trunk/drivers/usb/input/mtouchusb.c @@ -32,7 +32,7 @@ * Changed reset from standard USB dev reset to vendor reset * Changed data sent to host from compensated to raw coordinates * Eliminated vendor/product module params - * Performed multiple successful tests with an EXII-5010UC + * Performed multiple successfull tests with an EXII-5010UC * * 1.5 02/27/2005 ddstreet@ieee.org * Added module parameter to select raw or hw-calibrated coordinate reporting diff --git a/trunk/drivers/usb/media/ov511.c b/trunk/drivers/usb/media/ov511.c index 036c485d1d1e..d6051822416e 100644 --- a/trunk/drivers/usb/media/ov511.c +++ b/trunk/drivers/usb/media/ov511.c @@ -5041,7 +5041,7 @@ ov6xx0_configure(struct usb_ov511 *ov) { OV511_I2C_BUS, 0x2a, 0x04 }, /* Disable framerate adjust */ // { OV511_I2C_BUS, 0x2b, 0xac }, /* Framerate; Set 2a[7] first */ { OV511_I2C_BUS, 0x2d, 0x99 }, - { OV511_I2C_BUS, 0x33, 0xa0 }, /* Color Processing Parameter */ + { OV511_I2C_BUS, 0x33, 0xa0 }, /* Color Procesing Parameter */ { OV511_I2C_BUS, 0x34, 0xd2 }, /* Max A/D range */ { OV511_I2C_BUS, 0x38, 0x8b }, { OV511_I2C_BUS, 0x39, 0x40 }, diff --git a/trunk/drivers/usb/media/pwc/pwc-ctrl.c b/trunk/drivers/usb/media/pwc/pwc-ctrl.c index 42ec468d52d6..42352f531bc0 100644 --- a/trunk/drivers/usb/media/pwc/pwc-ctrl.c +++ b/trunk/drivers/usb/media/pwc/pwc-ctrl.c @@ -1100,7 +1100,7 @@ static inline int pwc_mpt_set_angle(struct pwc_device *pdev, int pan, int tilt) unsigned char buf[4]; /* set new relative angle; angles are expressed in degrees * 100, - but cam as .5 degree resolution, hence divide by 200. Also + but cam as .5 degree resolution, hence devide by 200. Also the angle must be multiplied by 64 before it's send to the cam (??) */ diff --git a/trunk/drivers/usb/media/pwc/pwc-if.c b/trunk/drivers/usb/media/pwc/pwc-if.c index cca47f480a8b..c53e2263b7fb 100644 --- a/trunk/drivers/usb/media/pwc/pwc-if.c +++ b/trunk/drivers/usb/media/pwc/pwc-if.c @@ -272,7 +272,7 @@ static int pwc_allocate_buffers(struct pwc_device *pdev) return -ENXIO; } #endif - /* Allocate Isochronous pipe buffers */ + /* Allocate Isochronuous pipe buffers */ for (i = 0; i < MAX_ISO_BUFS; i++) { if (pdev->sbuf[i].data == NULL) { kbuf = kmalloc(ISO_BUFFER_SIZE, GFP_KERNEL); @@ -850,7 +850,7 @@ static int pwc_isoc_init(struct pwc_device *pdev) if (pdev->vmax_packet_size < 0 || pdev->vmax_packet_size > ISO_MAX_FRAME_SIZE) { Err("Failed to find packet size for video endpoint in current alternate setting.\n"); - return -ENFILE; /* Odd error, that should be noticeable */ + return -ENFILE; /* Odd error, that should be noticable */ } /* Set alternate interface */ @@ -2128,7 +2128,7 @@ static int __init usb_pwc_init(void) if (leds[1] >= 0) led_off = leds[1]; - /* Big device node whoopla. Basically, it allows you to assign a + /* Big device node whoopla. Basicly, it allows you to assign a device node (/dev/videoX) to a camera, based on its type & serial number. The format is [type[.serialnumber]:]node. diff --git a/trunk/drivers/usb/media/pwc/pwc-ioctl.h b/trunk/drivers/usb/media/pwc/pwc-ioctl.h index 5f9cb08bc02e..65805eaa9a1c 100644 --- a/trunk/drivers/usb/media/pwc/pwc-ioctl.h +++ b/trunk/drivers/usb/media/pwc/pwc-ioctl.h @@ -75,7 +75,7 @@ #define PWC_FPS_SNAPSHOT 0x00400000 -/* structure for transferring x & y coordinates */ +/* structure for transfering x & y coordinates */ struct pwc_coord { int x, y; /* guess what */ diff --git a/trunk/drivers/usb/misc/legousbtower.c b/trunk/drivers/usb/misc/legousbtower.c index 7d06105763d4..dd4580cb57e0 100644 --- a/trunk/drivers/usb/misc/legousbtower.c +++ b/trunk/drivers/usb/misc/legousbtower.c @@ -859,7 +859,7 @@ static int tower_probe (struct usb_interface *interface, const struct usb_device info ("udev is NULL."); } - /* allocate memory for our device state and initialize it */ + /* allocate memory for our device state and intialize it */ dev = kmalloc (sizeof(struct lego_usb_tower), GFP_KERNEL); diff --git a/trunk/drivers/usb/net/usbnet.c b/trunk/drivers/usb/net/usbnet.c index f6bc6b3b333c..a45ea7c97356 100644 --- a/trunk/drivers/usb/net/usbnet.c +++ b/trunk/drivers/usb/net/usbnet.c @@ -4070,9 +4070,6 @@ static const struct usb_device_id products [] = { }, { USB_DEVICE (0x8086, 0x07d3), // "blob" bootloader .driver_info = (unsigned long) &blob_info, -}, { - USB_DEVICE (0x22b8, 0x600c), // USBNET Motorola E680 - .driver_info = (unsigned long) &linuxdev_info, }, { // Linux Ethernet/RNDIS gadget on pxa210/25x/26x // e.g. Gumstix, current OpenZaurus, ... diff --git a/trunk/drivers/usb/net/zd1201.c b/trunk/drivers/usb/net/zd1201.c index 341ae5f732dd..f98cb2af024e 100644 --- a/trunk/drivers/usb/net/zd1201.c +++ b/trunk/drivers/usb/net/zd1201.c @@ -183,7 +183,7 @@ static void zd1201_usbtx(struct urb *urb, struct pt_regs *regs) return; } -/* Incoming data */ +/* Incomming data */ static void zd1201_usbrx(struct urb *urb, struct pt_regs *regs) { struct zd1201 *zd = urb->context; @@ -772,7 +772,7 @@ static int zd1201_net_stop(struct net_device *dev) /* RFC 1042 encapsulates Ethernet frames in 802.11 frames by prefixing them with 0xaa, 0xaa, 0x03) followed by a SNAP OID of 0 - (0x00, 0x00, 0x00). Zd requires an additional padding, copy + (0x00, 0x00, 0x00). Zd requires an additionnal padding, copy of ethernet addresses, length of the standard RFC 1042 packet and a command byte (which is nul for tx). @@ -1098,7 +1098,7 @@ static int zd1201_get_range(struct net_device *dev, /* Little bit of magic here: we only get the quality if we poll * for it, and we never get an actual request to trigger such - * a poll. Therefore we 'assume' that the user will soon ask for + * a poll. Therefore we 'asume' that the user will soon ask for * the stats after asking the bssid. */ static int zd1201_get_wap(struct net_device *dev, @@ -1108,7 +1108,7 @@ static int zd1201_get_wap(struct net_device *dev, unsigned char buffer[6]; if (!zd1201_getconfig(zd, ZD1201_RID_COMMSQUALITY, buffer, 6)) { - /* Unfortunately the quality and noise reported is useless. + /* Unfortunatly the quality and noise reported is useless. they seem to be accumulators that increase until you read them, unless we poll on a fixed interval we can't use them diff --git a/trunk/drivers/usb/serial/Kconfig b/trunk/drivers/usb/serial/Kconfig index bc798edf0358..0c4aa00bb39d 100644 --- a/trunk/drivers/usb/serial/Kconfig +++ b/trunk/drivers/usb/serial/Kconfig @@ -53,15 +53,6 @@ config USB_SERIAL_GENERIC support" be compiled as a module for this driver to be used properly. -config USB_SERIAL_AIRPRIME - tristate "USB AirPrime CDMA Wireless Driver" - depends on USB_SERIAL - help - Say Y here if you want to use a AirPrime CDMA Wireless PC card. - - To compile this driver as a module, choose M here: the - module will be called airprime. - config USB_SERIAL_BELKIN tristate "USB Belkin and Peracom Single Port Serial Driver" depends on USB_SERIAL diff --git a/trunk/drivers/usb/serial/Makefile b/trunk/drivers/usb/serial/Makefile index d56ff6d86cce..b0aac47d1959 100644 --- a/trunk/drivers/usb/serial/Makefile +++ b/trunk/drivers/usb/serial/Makefile @@ -11,7 +11,6 @@ usbserial-obj-$(CONFIG_USB_EZUSB) += ezusb.o usbserial-objs := usb-serial.o generic.o bus.o $(usbserial-obj-y) -obj-$(CONFIG_USB_SERIAL_AIRPRIME) += airprime.o obj-$(CONFIG_USB_SERIAL_BELKIN) += belkin_sa.o obj-$(CONFIG_USB_SERIAL_CP2101) += cp2101.o obj-$(CONFIG_USB_SERIAL_CYBERJACK) += cyberjack.o diff --git a/trunk/drivers/usb/serial/airprime.c b/trunk/drivers/usb/serial/airprime.c deleted file mode 100644 index a4ce0008d69b..000000000000 --- a/trunk/drivers/usb/serial/airprime.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - * AirPrime CDMA Wireless Serial USB driver - * - * Copyright (C) 2005 Greg Kroah-Hartman - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version - * 2 as published by the Free Software Foundation. - */ - -#include -#include -#include -#include -#include -#include "usb-serial.h" - -static struct usb_device_id id_table [] = { - { USB_DEVICE(0xf3d, 0x0112) }, - { }, -}; -MODULE_DEVICE_TABLE(usb, id_table); - -static struct usb_driver airprime_driver = { - .owner = THIS_MODULE, - .name = "airprime", - .probe = usb_serial_probe, - .disconnect = usb_serial_disconnect, - .id_table = id_table, -}; - -static struct usb_serial_device_type airprime_device = { - .owner = THIS_MODULE, - .name = "airprime", - .id_table = id_table, - .num_interrupt_in = NUM_DONT_CARE, - .num_bulk_in = NUM_DONT_CARE, - .num_bulk_out = NUM_DONT_CARE, - .num_ports = 1, -}; - -static int __init airprime_init(void) -{ - int retval; - - retval = usb_serial_register(&airprime_device); - if (retval) - return retval; - retval = usb_register(&airprime_driver); - if (retval) - usb_serial_deregister(&airprime_device); - return retval; -} - -static void __exit airprime_exit(void) -{ - usb_deregister(&airprime_driver); - usb_serial_deregister(&airprime_device); -} - -module_init(airprime_init); -module_exit(airprime_exit); -MODULE_LICENSE("GPL"); diff --git a/trunk/drivers/usb/serial/cypress_m8.c b/trunk/drivers/usb/serial/cypress_m8.c index f34a9bb6a219..d165f42d560d 100644 --- a/trunk/drivers/usb/serial/cypress_m8.c +++ b/trunk/drivers/usb/serial/cypress_m8.c @@ -16,14 +16,6 @@ * See http://geocities.com/i0xox0i for information on this driver and the * earthmate usb device. * - * Lonnie Mendez - * 4-29-2005 - * Fixed problem where setting or retreiving the serial config would fail with - * EPIPE. Removed CRTS toggling so the driver behaves more like other usbserial - * adapters. Issued new interval of 1ms instead of the default 10ms. As a - * result, transfer speed has been substantially increased. From avg. 850bps to - * avg. 3300bps. initial termios has also been modified. Cleaned up code and - * formatting issues so it is more readable. Replaced the C++ style comments. * * Lonnie Mendez * 12-15-2004 @@ -40,6 +32,12 @@ * 10-2003 * Driver first released. * + * + * Long Term TODO: + * Improve transfer speeds - both read/write are somewhat slow + * at this point. + * Improve debugging. Show modem line status with debug output and + * implement filtering for certain data as a module parameter. */ /* Thanks to Neil Whelchel for writing the first cypress m8 implementation for linux. */ @@ -74,12 +72,11 @@ static int debug; #endif static int stats; -static int interval; /* * Version Information */ -#define DRIVER_VERSION "v1.09" +#define DRIVER_VERSION "v1.08" #define DRIVER_AUTHOR "Lonnie Mendez , Neil Whelchel " #define DRIVER_DESC "Cypress USB to Serial Driver" @@ -133,6 +130,7 @@ struct cypress_private { char prev_status, diff_status; /* used for TIOCMIWAIT */ /* we pass a pointer to this as the arguement sent to cypress_set_termios old_termios */ struct termios tmp_termios; /* stores the old termios settings */ + char calledfromopen; /* used when issuing lines on open - fixes rts drop bug */ }; /* write buffer structure */ @@ -170,8 +168,10 @@ static void cypress_buf_free(struct cypress_buf *cb); static void cypress_buf_clear(struct cypress_buf *cb); static unsigned int cypress_buf_data_avail(struct cypress_buf *cb); static unsigned int cypress_buf_space_avail(struct cypress_buf *cb); -static unsigned int cypress_buf_put(struct cypress_buf *cb, const char *buf, unsigned int count); -static unsigned int cypress_buf_get(struct cypress_buf *cb, char *buf, unsigned int count); +static unsigned int cypress_buf_put(struct cypress_buf *cb, const char *buf, + unsigned int count); +static unsigned int cypress_buf_get(struct cypress_buf *cb, char *buf, + unsigned int count); static struct usb_serial_device_type cypress_earthmate_device = { @@ -234,13 +234,14 @@ static struct usb_serial_device_type cypress_hidcom_device = { *****************************************************************************/ -/* This function can either set or retrieve the current serial line settings */ +/* This function can either set or retreive the current serial line settings */ static int cypress_serial_control (struct usb_serial_port *port, unsigned baud_mask, int data_bits, int stop_bits, int parity_enable, int parity_type, int reset, int cypress_request_type) { - int new_baudrate = 0, retval = 0, tries = 0; + int i, n_baud_rate = 0, retval = 0; struct cypress_private *priv; - __u8 feature_buffer[8]; + __u8 feature_buffer[5]; + __u8 config; unsigned long flags; dbg("%s", __FUNCTION__); @@ -255,8 +256,7 @@ static int cypress_serial_control (struct usb_serial_port *port, unsigned baud_m * of 57600bps (I have no idea whether DeLorme chose to use the general purpose * firmware or not), if you need to modify this speed setting for your own * project please add your own chiptype and modify the code likewise. The - * Cypress HID->COM device will work successfully up to 115200bps (but the - * actual throughput is around 3kBps). + * Cypress HID->COM device will work successfully up to 115200bps. */ if (baud_mask != priv->cbr_mask) { dbg("%s - baud rate is changing", __FUNCTION__); @@ -265,114 +265,109 @@ static int cypress_serial_control (struct usb_serial_port *port, unsigned baud_m * but are not used with NMEA and SiRF protocols */ if ( (baud_mask == B300) || (baud_mask == B600) ) { - err("%s - failed setting baud rate, unsupported speed", + err("%s - failed setting baud rate, unsupported speed (default to 4800)", __FUNCTION__); - new_baudrate = priv->baud_rate; - } else if ( (new_baudrate = mask_to_rate(baud_mask)) == -1) { - err("%s - failed setting baud rate, unsupported speed", + n_baud_rate = 4800; + } else if ( (n_baud_rate = mask_to_rate(baud_mask)) == -1) { + err("%s - failed setting baud rate, unsupported speed (default to 4800)", __FUNCTION__); - new_baudrate = priv->baud_rate; + n_baud_rate = 4800; } } else if (priv->chiptype == CT_CYPHIDCOM) { - if ( (new_baudrate = mask_to_rate(baud_mask)) == -1) { - err("%s - failed setting baud rate, unsupported speed", + if ( (n_baud_rate = mask_to_rate(baud_mask)) == -1) { + err("%s - failed setting baud rate, unsupported speed (default to 4800)", __FUNCTION__); - new_baudrate = priv->baud_rate; + n_baud_rate = 4800; } } else if (priv->chiptype == CT_GENERIC) { - if ( (new_baudrate = mask_to_rate(baud_mask)) == -1) { - err("%s - failed setting baud rate, unsupported speed", + if ( (n_baud_rate = mask_to_rate(baud_mask)) == -1) { + err("%s - failed setting baud rate, unsupported speed (default to 4800)", __FUNCTION__); - new_baudrate = priv->baud_rate; + n_baud_rate = 4800; } } else { - info("%s - please define your chiptype", __FUNCTION__); - new_baudrate = priv->baud_rate; + info("%s - please define your chiptype, using 4800bps default", __FUNCTION__); + n_baud_rate = 4800; } } else { /* baud rate not changing, keep the old */ - new_baudrate = priv->baud_rate; + n_baud_rate = priv->baud_rate; } - dbg("%s - baud rate is being sent as %d", __FUNCTION__, new_baudrate); + dbg("%s - baud rate is being sent as %d", __FUNCTION__, n_baud_rate); + - memset(feature_buffer, 0, 8); - /* fill the feature_buffer with new configuration */ - *((u_int32_t *)feature_buffer) = new_baudrate; + /* + * This algorithm accredited to Jiang Jay Zhang... thanks for all the help! + */ + for (i = 0; i < 4; ++i) { + feature_buffer[i] = ( n_baud_rate >> (i*8) & 0xFF ); + } - feature_buffer[4] |= data_bits; /* assign data bits in 2 bit space ( max 3 ) */ + config = 0; // reset config byte + config |= data_bits; // assign data bits in 2 bit space ( max 3 ) /* 1 bit gap */ - feature_buffer[4] |= (stop_bits << 3); /* assign stop bits in 1 bit space */ - feature_buffer[4] |= (parity_enable << 4); /* assign parity flag in 1 bit space */ - feature_buffer[4] |= (parity_type << 5); /* assign parity type in 1 bit space */ + config |= (stop_bits << 3); // assign stop bits in 1 bit space + config |= (parity_enable << 4); // assign parity flag in 1 bit space + config |= (parity_type << 5); // assign parity type in 1 bit space /* 1 bit gap */ - feature_buffer[4] |= (reset << 7); /* assign reset at end of byte, 1 bit space */ + config |= (reset << 7); // assign reset at end of byte, 1 bit space + + feature_buffer[4] = config; dbg("%s - device is being sent this feature report:", __FUNCTION__); dbg("%s - %02X - %02X - %02X - %02X - %02X", __FUNCTION__, feature_buffer[0], feature_buffer[1], feature_buffer[2], feature_buffer[3], feature_buffer[4]); - do { retval = usb_control_msg (port->serial->dev, usb_sndctrlpipe(port->serial->dev, 0), HID_REQ_SET_REPORT, USB_DIR_OUT | USB_RECIP_INTERFACE | USB_TYPE_CLASS, - 0x0300, 0, feature_buffer, 8, 500); - - if (tries++ >= 3) - break; + 0x0300, 0, feature_buffer, 5, 500); - if (retval == EPIPE) - usb_clear_halt(port->serial->dev, 0x00); - } while (retval != 8 && retval != ENODEV); - - if (retval != 8) + if (retval != 5) err("%s - failed sending serial line settings - %d", __FUNCTION__, retval); else { spin_lock_irqsave(&priv->lock, flags); - priv->baud_rate = new_baudrate; + priv->baud_rate = n_baud_rate; priv->cbr_mask = baud_mask; - priv->current_config = feature_buffer[4]; + priv->current_config = config; + ++priv->cmd_count; spin_unlock_irqrestore(&priv->lock, flags); } break; case CYPRESS_GET_CONFIG: dbg("%s - retreiving serial line settings", __FUNCTION__); - /* set initial values in feature buffer */ - memset(feature_buffer, 0, 8); + /* reset values in feature buffer */ + memset(feature_buffer, 0, 5); - do { retval = usb_control_msg (port->serial->dev, usb_rcvctrlpipe(port->serial->dev, 0), HID_REQ_GET_REPORT, USB_DIR_IN | USB_RECIP_INTERFACE | USB_TYPE_CLASS, - 0x0300, 0, feature_buffer, 8, 500); - - if (tries++ >= 3) - break; - - if (retval == EPIPE) - usb_clear_halt(port->serial->dev, 0x00); - } while (retval != 5 && retval != ENODEV); - + 0x0300, 0, feature_buffer, 5, 500); if (retval != 5) { err("%s - failed to retreive serial line settings - %d", __FUNCTION__, retval); return retval; } else { spin_lock_irqsave(&priv->lock, flags); - /* store the config in one byte, and later use bit masks to check values */ priv->current_config = feature_buffer[4]; - priv->baud_rate = *((u_int32_t *)feature_buffer); + /* reverse the process above to get the baud_mask value */ + n_baud_rate = 0; // reset bits + for (i = 0; i < 4; ++i) { + n_baud_rate |= ( feature_buffer[i] << (i*8) ); + } - if ( (priv->cbr_mask = rate_to_mask(priv->baud_rate)) == 0x40) + priv->baud_rate = n_baud_rate; + if ( (priv->cbr_mask = rate_to_mask(n_baud_rate)) == 0x40) dbg("%s - failed setting the baud mask (not defined)", __FUNCTION__); + ++priv->cmd_count; spin_unlock_irqrestore(&priv->lock, flags); } + break; + default: + err("%s - unsupported serial control command issued", __FUNCTION__); } - spin_lock_irqsave(&priv->lock, flags); - ++priv->cmd_count; - spin_unlock_irqrestore(&priv->lock, flags); - return retval; } /* cypress_serial_control */ -/* given a baud mask, it will return integer baud on success */ +/* given a baud mask, it will return speed on success */ static int mask_to_rate (unsigned mask) { int rate; @@ -443,12 +438,11 @@ static int generic_startup (struct usb_serial *serial) usb_reset_configuration (serial->dev); - interval = 1; priv->cmd_ctrl = 0; priv->line_control = 0; priv->termios_initialized = 0; + priv->calledfromopen = 0; priv->rx_flags = 0; - priv->cbr_mask = B300; usb_set_serial_port_data(serial->port[0], priv); return (0); @@ -519,6 +513,7 @@ static int cypress_open (struct usb_serial_port *port, struct file *filp) dbg("%s - port %d", __FUNCTION__, port->number); /* clear halts before open */ + usb_clear_halt(serial->dev, 0x00); usb_clear_halt(serial->dev, 0x81); usb_clear_halt(serial->dev, 0x02); @@ -536,6 +531,7 @@ static int cypress_open (struct usb_serial_port *port, struct file *filp) /* raise both lines and set termios */ spin_lock_irqsave(&priv->lock, flags); priv->line_control = CONTROL_DTR | CONTROL_RTS; + priv->calledfromopen = 1; priv->cmd_ctrl = 1; spin_unlock_irqrestore(&priv->lock, flags); result = cypress_write(port, NULL, 0); @@ -557,7 +553,7 @@ static int cypress_open (struct usb_serial_port *port, struct file *filp) usb_fill_int_urb(port->interrupt_in_urb, serial->dev, usb_rcvintpipe(serial->dev, port->interrupt_in_endpointAddress), port->interrupt_in_urb->transfer_buffer, port->interrupt_in_urb->transfer_buffer_length, - cypress_read_int_callback, port, interval); + cypress_read_int_callback, port, port->interrupt_in_urb->interval); result = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL); if (result){ @@ -684,12 +680,12 @@ static void cypress_send(struct usb_serial_port *port) spin_lock_irqsave(&priv->lock, flags); switch (port->interrupt_out_size) { case 32: - /* this is for the CY7C64013... */ + // this is for the CY7C64013... offset = 2; port->interrupt_out_buffer[0] = priv->line_control; break; case 8: - /* this is for the CY7C63743... */ + // this is for the CY7C63743... offset = 1; port->interrupt_out_buffer[0] = priv->line_control; break; @@ -742,7 +738,6 @@ static void cypress_send(struct usb_serial_port *port) port->interrupt_out_urb->transfer_buffer_length = actual_size; port->interrupt_out_urb->dev = port->serial->dev; - port->interrupt_out_urb->interval = interval; result = usb_submit_urb (port->interrupt_out_urb, GFP_ATOMIC); if (result) { dev_err(&port->dev, "%s - failed submitting write urb, error %d\n", __FUNCTION__, @@ -915,7 +910,7 @@ static void cypress_set_termios (struct usb_serial_port *port, struct termios *o unsigned cflag, iflag, baud_mask; unsigned long flags; __u8 oldlines; - int linechange = 0; + int linechange; dbg("%s - port %d", __FUNCTION__, port->number); @@ -1001,7 +996,15 @@ static void cypress_set_termios (struct usb_serial_port *port, struct termios *o case B115200: dbg("%s - setting baud 115200bps", __FUNCTION__); break; default: dbg("%s - unknown masked baud rate", __FUNCTION__); } - priv->line_control = (CONTROL_DTR | CONTROL_RTS); + priv->line_control |= CONTROL_DTR; + + /* toggle CRTSCTS? - don't do this if being called from cypress_open */ + if (!priv->calledfromopen) { + if (cflag & CRTSCTS) + priv->line_control |= CONTROL_RTS; + else + priv->line_control &= ~CONTROL_RTS; + } } spin_unlock_irqrestore(&priv->lock, flags); @@ -1011,6 +1014,8 @@ static void cypress_set_termios (struct usb_serial_port *port, struct termios *o cypress_serial_control(port, baud_mask, data_bits, stop_bits, parity_enable, parity_type, 0, CYPRESS_SET_CONFIG); + msleep(50); /* give some time between change and read (50ms) */ + /* we perform a CYPRESS_GET_CONFIG so that the current settings are filled into the private structure * this should confirm that all is working if it returns what we just set */ cypress_serial_control(port, 0, 0, 0, 0, 0, 0, CYPRESS_GET_CONFIG); @@ -1026,6 +1031,7 @@ static void cypress_set_termios (struct usb_serial_port *port, struct termios *o dbg("Using custom termios settings for a baud rate of 4800bps."); /* define custom termios settings for NMEA protocol */ + tty->termios->c_iflag /* input modes - */ &= ~(IGNBRK /* disable ignore break */ | BRKINT /* disable break causes interrupt */ @@ -1046,16 +1052,23 @@ static void cypress_set_termios (struct usb_serial_port *port, struct termios *o | ISIG /* disable interrupt, quit, and suspend special characters */ | IEXTEN); /* disable non-POSIX special characters */ - } /* CT_CYPHIDCOM: Application should handle this for device */ + } else if (priv->chiptype == CT_CYPHIDCOM) { + + // Software app handling it for device... + } linechange = (priv->line_control != oldlines); spin_unlock_irqrestore(&priv->lock, flags); /* if necessary, set lines */ - if (linechange) { + if (!priv->calledfromopen && linechange) { priv->cmd_ctrl = 1; cypress_write(port, NULL, 0); } + + if (priv->calledfromopen) + priv->calledfromopen = 0; + } /* cypress_set_termios */ @@ -1151,7 +1164,7 @@ static void cypress_read_int_callback(struct urb *urb, struct pt_regs *regs) spin_lock_irqsave(&priv->lock, flags); switch(urb->actual_length) { case 32: - /* This is for the CY7C64013... */ + // This is for the CY7C64013... priv->current_status = data[0] & 0xF8; bytes = data[1]+2; i=2; @@ -1159,7 +1172,7 @@ static void cypress_read_int_callback(struct urb *urb, struct pt_regs *regs) havedata = 1; break; case 8: - /* This is for the CY7C63743... */ + // This is for the CY7C63743... priv->current_status = data[0] & 0xF8; bytes = (data[0] & 0x07)+1; i=1; @@ -1232,7 +1245,7 @@ static void cypress_read_int_callback(struct urb *urb, struct pt_regs *regs) port->interrupt_in_urb->transfer_buffer, port->interrupt_in_urb->transfer_buffer_length, cypress_read_int_callback, port, - interval); + port->interrupt_in_urb->interval); result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC); if (result) dev_err(&urb->dev->dev, "%s - failed resubmitting read urb, error %d\n", __FUNCTION__, result); @@ -1261,8 +1274,6 @@ static void cypress_write_int_callback(struct urb *urb, struct pt_regs *regs) dbg("%s - urb shutting down with status: %d", __FUNCTION__, urb->status); priv->write_urb_in_use = 0; return; - case -EPIPE: /* no break needed */ - usb_clear_halt(port->serial->dev, 0x02); default: /* error in the urb, so we have to resubmit it */ dbg("%s - Overflow in write", __FUNCTION__); @@ -1524,5 +1535,3 @@ module_param(debug, bool, S_IRUGO | S_IWUSR); MODULE_PARM_DESC(debug, "Debug enabled or not"); module_param(stats, bool, S_IRUGO | S_IWUSR); MODULE_PARM_DESC(stats, "Enable statistics or not"); -module_param(interval, int, S_IRUGO | S_IWUSR); -MODULE_PARM_DESC(interval, "Overrides interrupt interval"); diff --git a/trunk/drivers/usb/serial/ftdi_sio.c b/trunk/drivers/usb/serial/ftdi_sio.c index 52394f08a947..4c788c767a97 100644 --- a/trunk/drivers/usb/serial/ftdi_sio.c +++ b/trunk/drivers/usb/serial/ftdi_sio.c @@ -76,7 +76,7 @@ * Defererence pointers after any paranoid checks, not before. * * (21/Jun/2003) Erik Nygren - * Added support for Home Electronics Tira-1 IR transceiver using FT232BM chip. + * Added support for Home Electronics Tira-1 IR tranceiver using FT232BM chip. * See . Only operates properly * at 100000 and RTS-CTS, so set custom divisor mode on startup. * Also force the Tira-1 and USB-UIRT to only use their custom baud rates. @@ -91,7 +91,7 @@ * Minor whitespace and comment changes. * * (12/Jun/2003) David Norwood - * Added support for USB-UIRT IR transceiver using 8U232AM chip. + * Added support for USB-UIRT IR tranceiver using 8U232AM chip. * See . Only * operates properly at 312500, so set custom divisor mode on startup. * @@ -272,7 +272,6 @@ static int debug; static struct usb_device_id id_table_sio [] = { { USB_DEVICE(FTDI_VID, FTDI_SIO_PID) }, - { USB_DEVICE(MOBILITY_VID, MOBILITY_USB_SERIAL_PID) }, { } /* Terminating entry */ }; @@ -297,6 +296,7 @@ static struct usb_device_id id_table_8U232AM [] = { { USB_DEVICE_VER(FTDI_VID, FTDI_IRTRANS_PID, 0, 0x3ff) }, { USB_DEVICE_VER(FTDI_VID, FTDI_8U232AM_PID, 0, 0x3ff) }, { USB_DEVICE_VER(FTDI_VID, FTDI_8U232AM_ALT_PID, 0, 0x3ff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_8U232AM_ALT_ALT_PID, 0, 0x3ff) }, { USB_DEVICE_VER(FTDI_VID, FTDI_RELAIS_PID, 0, 0x3ff) }, { USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_IOBOARD_PID) }, { USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_MINI_IOBOARD_PID) }, @@ -369,14 +369,11 @@ static struct usb_device_id id_table_8U232AM [] = { { USB_DEVICE_VER(INTREPID_VID, INTREPID_NEOVI_PID, 0, 0x3ff) }, { USB_DEVICE_VER(FALCOM_VID, FALCOM_TWIST_PID, 0, 0x3ff) }, { USB_DEVICE_VER(FTDI_VID, FTDI_SUUNTO_SPORTS_PID, 0, 0x3ff) }, - { USB_DEVICE_VER(FTDI_VID, FTDI_RM_CANVIEW_PID, 0, 0x3ff) }, + { USB_DEVICE_VER(FTDI_RM_VID, FTDI_RMCANVIEW_PID, 0, 0x3ff) }, { USB_DEVICE_VER(BANDB_VID, BANDB_USOTL4_PID, 0, 0x3ff) }, { USB_DEVICE_VER(BANDB_VID, BANDB_USTL4_PID, 0, 0x3ff) }, { USB_DEVICE_VER(BANDB_VID, BANDB_USO9ML2_PID, 0, 0x3ff) }, { USB_DEVICE_VER(FTDI_VID, EVER_ECO_PRO_CDS, 0, 0x3ff) }, - { USB_DEVICE_VER(FTDI_VID, FTDI_4N_GALAXY_DE_0_PID, 0, 0x3ff) }, - { USB_DEVICE_VER(FTDI_VID, FTDI_4N_GALAXY_DE_1_PID, 0, 0x3ff) }, - { USB_DEVICE_VER(FTDI_VID, FTDI_4N_GALAXY_DE_2_PID, 0, 0x3ff) }, { } /* Terminating entry */ }; @@ -385,6 +382,7 @@ static struct usb_device_id id_table_FT232BM [] = { { USB_DEVICE_VER(FTDI_VID, FTDI_IRTRANS_PID, 0x400, 0xffff) }, { USB_DEVICE_VER(FTDI_VID, FTDI_8U232AM_PID, 0x400, 0xffff) }, { USB_DEVICE_VER(FTDI_VID, FTDI_8U232AM_ALT_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(FTDI_VID, FTDI_8U232AM_ALT_ALT_PID, 0x400, 0xffff) }, { USB_DEVICE_VER(FTDI_VID, FTDI_RELAIS_PID, 0x400, 0xffff) }, { USB_DEVICE_VER(FTDI_NF_RIC_VID, FTDI_NF_RIC_PID, 0x400, 0xffff) }, { USB_DEVICE_VER(FTDI_VID, FTDI_XF_632_PID, 0x400, 0xffff) }, @@ -487,15 +485,11 @@ static struct usb_device_id id_table_FT232BM [] = { { USB_DEVICE_VER(INTREPID_VID, INTREPID_NEOVI_PID, 0x400, 0xffff) }, { USB_DEVICE_VER(FALCOM_VID, FALCOM_TWIST_PID, 0x400, 0xffff) }, { USB_DEVICE_VER(FTDI_VID, FTDI_SUUNTO_SPORTS_PID, 0x400, 0xffff) }, - { USB_DEVICE_VER(FTDI_VID, FTDI_RM_CANVIEW_PID, 0x400, 0xffff) }, + { USB_DEVICE_VER(FTDI_RM_VID, FTDI_RMCANVIEW_PID, 0x400, 0xffff) }, { USB_DEVICE_VER(BANDB_VID, BANDB_USOTL4_PID, 0x400, 0xffff) }, { USB_DEVICE_VER(BANDB_VID, BANDB_USTL4_PID, 0x400, 0xffff) }, { USB_DEVICE_VER(BANDB_VID, BANDB_USO9ML2_PID, 0x400, 0xffff) }, { USB_DEVICE_VER(FTDI_VID, EVER_ECO_PRO_CDS, 0x400, 0xffff) }, - { USB_DEVICE_VER(FTDI_VID, FTDI_4N_GALAXY_DE_0_PID, 0x400, 0xffff) }, - { USB_DEVICE_VER(FTDI_VID, FTDI_4N_GALAXY_DE_1_PID, 0x400, 0xffff) }, - { USB_DEVICE_VER(FTDI_VID, FTDI_4N_GALAXY_DE_2_PID, 0x400, 0xffff) }, - { USB_DEVICE_VER(FTDI_VID, FTDI_ACTIVE_ROBOTS_PID, 0x400, 0xffff) }, { } /* Terminating entry */ }; @@ -523,6 +517,7 @@ static struct usb_device_id id_table_combined [] = { { USB_DEVICE(FTDI_VID, FTDI_SIO_PID) }, { USB_DEVICE(FTDI_VID, FTDI_8U232AM_PID) }, { USB_DEVICE(FTDI_VID, FTDI_8U232AM_ALT_PID) }, + { USB_DEVICE(FTDI_VID, FTDI_8U232AM_ALT_ALT_PID) }, { USB_DEVICE(FTDI_VID, FTDI_8U2232C_PID) }, { USB_DEVICE(FTDI_VID, FTDI_RELAIS_PID) }, { USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_IOBOARD_PID) }, @@ -601,22 +596,6 @@ static struct usb_device_id id_table_combined [] = { { USB_DEVICE(FTDI_VID, PROTEGO_R2X0) }, { USB_DEVICE(FTDI_VID, PROTEGO_SPECIAL_3) }, { USB_DEVICE(FTDI_VID, PROTEGO_SPECIAL_4) }, - { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E808_PID, 0x400, 0xffff) }, - { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E809_PID, 0x400, 0xffff) }, - { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E80A_PID, 0x400, 0xffff) }, - { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E80B_PID, 0x400, 0xffff) }, - { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E80C_PID, 0x400, 0xffff) }, - { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E80D_PID, 0x400, 0xffff) }, - { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E80E_PID, 0x400, 0xffff) }, - { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E80F_PID, 0x400, 0xffff) }, - { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E888_PID, 0x400, 0xffff) }, - { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E889_PID, 0x400, 0xffff) }, - { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E88A_PID, 0x400, 0xffff) }, - { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E88B_PID, 0x400, 0xffff) }, - { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E88C_PID, 0x400, 0xffff) }, - { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E88D_PID, 0x400, 0xffff) }, - { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E88E_PID, 0x400, 0xffff) }, - { USB_DEVICE_VER(FTDI_VID, FTDI_GUDEADS_E88F_PID, 0x400, 0xffff) }, { USB_DEVICE(FTDI_VID, FTDI_ELV_UO100_PID) }, { USB_DEVICE_VER(FTDI_VID, LINX_SDMUSBQSS_PID, 0x400, 0xffff) }, { USB_DEVICE_VER(FTDI_VID, LINX_MASTERDEVEL2_PID, 0x400, 0xffff) }, @@ -630,16 +609,11 @@ static struct usb_device_id id_table_combined [] = { { USB_DEVICE(INTREPID_VID, INTREPID_NEOVI_PID) }, { USB_DEVICE(FALCOM_VID, FALCOM_TWIST_PID) }, { USB_DEVICE(FTDI_VID, FTDI_SUUNTO_SPORTS_PID) }, - { USB_DEVICE(FTDI_VID, FTDI_RM_CANVIEW_PID) }, + { USB_DEVICE(FTDI_RM_VID, FTDI_RMCANVIEW_PID) }, { USB_DEVICE(BANDB_VID, BANDB_USOTL4_PID) }, { USB_DEVICE(BANDB_VID, BANDB_USTL4_PID) }, { USB_DEVICE(BANDB_VID, BANDB_USO9ML2_PID) }, { USB_DEVICE(FTDI_VID, EVER_ECO_PRO_CDS) }, - { USB_DEVICE(FTDI_VID, FTDI_4N_GALAXY_DE_0_PID) }, - { USB_DEVICE(FTDI_VID, FTDI_4N_GALAXY_DE_1_PID) }, - { USB_DEVICE(FTDI_VID, FTDI_4N_GALAXY_DE_2_PID) }, - { USB_DEVICE(MOBILITY_VID, MOBILITY_USB_SERIAL_PID) }, - { USB_DEVICE_VER(FTDI_VID, FTDI_ACTIVE_ROBOTS_PID, 0x400, 0xffff) }, { } /* Terminating entry */ }; @@ -1483,10 +1457,10 @@ static int ftdi_FT2232C_startup (struct usb_serial *serial) inter = serial->interface->altsetting->desc.bInterfaceNumber; if (inter) { - priv->interface = PIT_SIOB; + priv->interface = INTERFACE_B; } else { - priv->interface = PIT_SIOA; + priv->interface = INTERFACE_A; } priv->baud_base = 48000000 / 2; /* Would be / 16, but FT2232C supports multiple of 0.125 divisor fractions! */ diff --git a/trunk/drivers/usb/serial/ftdi_sio.h b/trunk/drivers/usb/serial/ftdi_sio.h index a52bb13a9ce4..be5d60bf90b9 100644 --- a/trunk/drivers/usb/serial/ftdi_sio.h +++ b/trunk/drivers/usb/serial/ftdi_sio.h @@ -26,6 +26,7 @@ #define FTDI_SIO_PID 0x8372 /* Product Id SIO application of 8U100AX */ #define FTDI_8U232AM_PID 0x6001 /* Similar device to SIO above */ #define FTDI_8U232AM_ALT_PID 0x6006 /* FTDI's alternate PID for above */ +#define FTDI_8U232AM_ALT_ALT_PID 0xf3c0 /* FTDI's second alternate PID for above */ #define FTDI_8U2232C_PID 0x6010 /* Dual channel device */ #define FTDI_RELAIS_PID 0xFA10 /* Relais device from Rudolf Gugler */ #define FTDI_NF_RIC_VID 0x0DCD /* Vendor Id */ @@ -136,7 +137,7 @@ /* * Home Electronics (www.home-electro.com) USB gadgets */ -#define FTDI_HE_TIRA1_PID 0xFA78 /* Tira-1 IR transceiver */ +#define FTDI_HE_TIRA1_PID 0xFA78 /* Tira-1 IR tranceiver */ /* USB-UIRT - An infrared receiver and transmitter using the 8U232AM chip */ /* http://home.earthlink.net/~jrhees/USBUIRT/index.htm */ @@ -156,8 +157,7 @@ */ #define OCT_VID 0x0B39 /* OCT vendor ID */ /* Note: OCT US101 is also rebadged as Dick Smith Electronics (NZ) XH6381 */ -/* Also rebadged as Dick Smith Electronics (Aus) XH6451 */ -/* Also rebadged as SIIG Inc. model US2308 hardware version 1 */ +/* Also rebadged as SIIG Inc. model US2308 */ #define OCT_US101_PID 0x0421 /* OCT US101 USB to RS-232 */ /* an infrared receiver for user access control with IR tags */ @@ -236,10 +236,10 @@ /* * RM Michaelides CANview USB (http://www.rmcan.com) - * CAN fieldbus interface adapter, added by port GmbH www.port.de) - * Ian Abbott changed the macro names for consistency. + * CAN filedbus interface adapter, addad by port GmbH www.port.de) */ -#define FTDI_RM_CANVIEW_PID 0xfd60 /* Product Id */ +#define FTDI_RM_VID 0x0403 /* Vendor Id */ +#define FTDI_RMCANVIEW_PID 0xfd60 /* Product Id */ /* * EVER Eco Pro UPS (http://www.ever.com.pl/) @@ -247,26 +247,6 @@ #define EVER_ECO_PRO_CDS 0xe520 /* RS-232 converter */ -/* - * 4N-GALAXY.DE PIDs for CAN-USB, USB-RS232, USB-RS422, USB-RS485, - * USB-TTY activ, USB-TTY passiv. Some PIDs are used by several devices - * and I'm not entirely sure which are used by which. - */ -#define FTDI_4N_GALAXY_DE_0_PID 0x8372 -#define FTDI_4N_GALAXY_DE_1_PID 0xF3C0 -#define FTDI_4N_GALAXY_DE_2_PID 0xF3C1 - -/* - * Mobility Electronics products. - */ -#define MOBILITY_VID 0x1342 -#define MOBILITY_USB_SERIAL_PID 0x0202 /* EasiDock USB 200 serial */ - -/* - * Active Robots product ids. - */ -#define FTDI_ACTIVE_ROBOTS_PID 0xE548 /* USB comms board */ - /* Commands */ #define FTDI_SIO_RESET 0 /* Reset the port */ #define FTDI_SIO_MODEM_CTRL 1 /* Set the modem control register */ @@ -279,6 +259,10 @@ #define FTDI_SIO_SET_LATENCY_TIMER 9 /* Set the latency timer */ #define FTDI_SIO_GET_LATENCY_TIMER 10 /* Get the latency timer */ +/* Port interface code for FT2232C */ +#define INTERFACE_A 1 +#define INTERFACE_B 2 + /* * BmRequestType: 1100 0000b diff --git a/trunk/drivers/usb/serial/io_usbvend.h b/trunk/drivers/usb/serial/io_usbvend.h index f1804fd5a3dd..8c1fa5e722b1 100644 --- a/trunk/drivers/usb/serial/io_usbvend.h +++ b/trunk/drivers/usb/serial/io_usbvend.h @@ -289,7 +289,7 @@ // // -// Edgeport Compatibility Descriptor +// Edgeport Compatiblity Descriptor // // This descriptor is only returned by Edgeport-compatible devices // supporting the EPiC spec. True ION devices do not return this diff --git a/trunk/drivers/usb/serial/keyspan_usa90msg.h b/trunk/drivers/usb/serial/keyspan_usa90msg.h index 86708ecd8735..dd935b62c1a8 100644 --- a/trunk/drivers/usb/serial/keyspan_usa90msg.h +++ b/trunk/drivers/usb/serial/keyspan_usa90msg.h @@ -19,7 +19,7 @@ This file is available under a BSD-style copyright - 2. The name of InnoSys Incorporated may not be used to endorse or promote + 2. The name of InnoSys Incorprated may not be used to endorse or promote products derived from this software without specific prior written permission. diff --git a/trunk/drivers/usb/storage/debug.c b/trunk/drivers/usb/storage/debug.c index 5a9321705a74..d76483706bc9 100644 --- a/trunk/drivers/usb/storage/debug.c +++ b/trunk/drivers/usb/storage/debug.c @@ -47,7 +47,6 @@ #include #include #include -#include #include "debug.h" #include "scsi.h" diff --git a/trunk/drivers/usb/storage/shuttle_usbat.c b/trunk/drivers/usb/storage/shuttle_usbat.c index f3b60288696c..7eff03d9b041 100644 --- a/trunk/drivers/usb/storage/shuttle_usbat.c +++ b/trunk/drivers/usb/storage/shuttle_usbat.c @@ -786,7 +786,7 @@ static int usbat_flash_check_media(struct us_data *us, if (rc != USB_STOR_XFER_GOOD) return USB_STOR_TRANSPORT_ERROR; - // Check for media existence + // Check for media existance rc = usbat_flash_check_media_present(uio); if (rc == USBAT_FLASH_MEDIA_NONE) { info->sense_key = 0x02; diff --git a/trunk/drivers/usb/storage/unusual_devs.h b/trunk/drivers/usb/storage/unusual_devs.h index d2891f475793..bbda63c24c4d 100644 --- a/trunk/drivers/usb/storage/unusual_devs.h +++ b/trunk/drivers/usb/storage/unusual_devs.h @@ -1,5 +1,5 @@ /* Driver for USB Mass Storage compliant devices - * Unusual Devices File + * Ununsual Devices File * * $Id: unusual_devs.h,v 1.32 2002/02/25 02:41:24 mdharm Exp $ * @@ -48,14 +48,6 @@ * USB development list . */ -/* patch submitted by Vivian Bregier - */ -UNUSUAL_DEV( 0x03eb, 0x2002, 0x0100, 0x0100, - "ATMEL", - "SND1 Storage", - US_SC_DEVICE, US_PR_DEVICE, NULL, - US_FL_IGNORE_RESIDUE), - UNUSUAL_DEV( 0x03ee, 0x6901, 0x0000, 0x0100, "Mitsumi", "USB FDD", @@ -1002,13 +994,6 @@ UNUSUAL_DEV( 0x1019, 0x0c55, 0x0000, 0x9999, US_SC_DEVICE, US_PR_DEVICE, usb_stor_ucr61s2b_init, 0 ), -/* Reported by Vilius Bilinkevicius */ UNUSUAL_DEV( 0x1370, 0x6828, 0x0110, 0x0110, "SWISSBIT", diff --git a/trunk/drivers/video/cyber2000fb.c b/trunk/drivers/video/cyber2000fb.c index 3894b2a501d6..8b1b7c687a99 100644 --- a/trunk/drivers/video/cyber2000fb.c +++ b/trunk/drivers/video/cyber2000fb.c @@ -90,8 +90,6 @@ struct cfb_info { */ u_char ramdac_ctrl; u_char ramdac_powerdown; - - u32 pseudo_palette[16]; }; static char *default_font = "Acorn8x8"; @@ -1225,7 +1223,9 @@ cyberpro_alloc_fb_info(unsigned int id, char *name) { struct cfb_info *cfb; - cfb = kmalloc(sizeof(struct cfb_info), GFP_KERNEL); + cfb = kmalloc(sizeof(struct cfb_info) + + sizeof(u32) * 16, GFP_KERNEL); + if (!cfb) return NULL; @@ -1281,7 +1281,7 @@ cyberpro_alloc_fb_info(unsigned int id, char *name) cfb->fb.fbops = &cyber2000fb_ops; cfb->fb.flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN; - cfb->fb.pseudo_palette = cfb->pseudo_palette; + cfb->fb.pseudo_palette = (void *)(cfb + 1); fb_alloc_cmap(&cfb->fb.cmap, NR_PALETTE, 0); diff --git a/trunk/drivers/video/i810/i810_main.c b/trunk/drivers/video/i810/i810_main.c index a9a618f2aa6a..e04d3e8b2549 100644 --- a/trunk/drivers/video/i810/i810_main.c +++ b/trunk/drivers/video/i810/i810_main.c @@ -1000,10 +1000,8 @@ static int i810_check_params(struct fb_var_screeninfo *var, if (fb_validate_mode(var, info)) { if (fb_get_mode(FB_MAXTIMINGS, 0, var, info)) { - int default_sync = (info->monspecs.hfmin-HFMIN) - |(info->monspecs.hfmax-HFMAX) - |(info->monspecs.vfmin-VFMIN) - |(info->monspecs.vfmax-VFMAX); + int default_sync = (hsync1-HFMIN)|(hsync2-HFMAX) + |(vsync1-VFMIN)|(vsync2-VFMAX); printk("i810fb: invalid video mode%s\n", default_sync ? "" : ". Specifying vsyncN/hsyncN parameters may help"); diff --git a/trunk/fs/jfs/inode.c b/trunk/fs/jfs/inode.c index 24a689179af2..7bc906677b0d 100644 --- a/trunk/fs/jfs/inode.c +++ b/trunk/fs/jfs/inode.c @@ -175,22 +175,31 @@ jfs_get_blocks(struct inode *ip, sector_t lblock, unsigned long max_blocks, { s64 lblock64 = lblock; int rc = 0; + int take_locks; xad_t xad; s64 xaddr; int xflag; - s32 xlen = max_blocks; + s32 xlen; + + /* + * If this is a special inode (imap, dmap) + * the lock should already be taken + */ + take_locks = (JFS_IP(ip)->fileset != AGGREGATE_I); /* * Take appropriate lock on inode */ - if (create) - IWRITE_LOCK(ip); - else - IREAD_LOCK(ip); + if (take_locks) { + if (create) + IWRITE_LOCK(ip); + else + IREAD_LOCK(ip); + } if (((lblock64 << ip->i_sb->s_blocksize_bits) < ip->i_size) && - (!xtLookup(ip, lblock64, max_blocks, &xflag, &xaddr, &xlen, 0)) && - xaddr) { + (xtLookup(ip, lblock64, max_blocks, &xflag, &xaddr, &xlen, 0) + == 0) && xlen) { if (xflag & XAD_NOTRECORDED) { if (!create) /* @@ -229,7 +238,7 @@ jfs_get_blocks(struct inode *ip, sector_t lblock, unsigned long max_blocks, #ifdef _JFS_4K if ((rc = extHint(ip, lblock64 << ip->i_sb->s_blocksize_bits, &xad))) goto unlock; - rc = extAlloc(ip, xlen, lblock64, &xad, FALSE); + rc = extAlloc(ip, max_blocks, lblock64, &xad, FALSE); if (rc) goto unlock; @@ -249,10 +258,12 @@ jfs_get_blocks(struct inode *ip, sector_t lblock, unsigned long max_blocks, /* * Release lock on inode */ - if (create) - IWRITE_UNLOCK(ip); - else - IREAD_UNLOCK(ip); + if (take_locks) { + if (create) + IWRITE_UNLOCK(ip); + else + IREAD_UNLOCK(ip); + } return rc; } diff --git a/trunk/fs/jfs/jfs_dmap.c b/trunk/fs/jfs/jfs_dmap.c index 69007fd546ef..d86e467c6e42 100644 --- a/trunk/fs/jfs/jfs_dmap.c +++ b/trunk/fs/jfs/jfs_dmap.c @@ -471,7 +471,6 @@ dbUpdatePMap(struct inode *ipbmap, struct metapage *mp; struct jfs_log *log; int lsn, difft, diffp; - unsigned long flags; /* the blocks better be within the mapsize. */ if (blkno + nblocks > bmp->db_mapsize) { @@ -505,7 +504,6 @@ dbUpdatePMap(struct inode *ipbmap, 0); if (mp == NULL) return -EIO; - metapage_wait_for_io(mp); } dp = (struct dmap *) mp->data; @@ -580,32 +578,34 @@ dbUpdatePMap(struct inode *ipbmap, if (mp->lsn != 0) { /* inherit older/smaller lsn */ logdiff(diffp, mp->lsn, log); - LOGSYNC_LOCK(log, flags); if (difft < diffp) { mp->lsn = lsn; /* move bp after tblock in logsync list */ + LOGSYNC_LOCK(log); list_move(&mp->synclist, &tblk->synclist); + LOGSYNC_UNLOCK(log); } /* inherit younger/larger clsn */ + LOGSYNC_LOCK(log); logdiff(difft, tblk->clsn, log); logdiff(diffp, mp->clsn, log); if (difft > diffp) mp->clsn = tblk->clsn; - LOGSYNC_UNLOCK(log, flags); + LOGSYNC_UNLOCK(log); } else { mp->log = log; mp->lsn = lsn; /* insert bp after tblock in logsync list */ - LOGSYNC_LOCK(log, flags); + LOGSYNC_LOCK(log); log->count++; list_add(&mp->synclist, &tblk->synclist); mp->clsn = tblk->clsn; - LOGSYNC_UNLOCK(log, flags); + LOGSYNC_UNLOCK(log); } } diff --git a/trunk/fs/jfs/jfs_dtree.c b/trunk/fs/jfs/jfs_dtree.c index ac41f72d6d50..e357890adfb2 100644 --- a/trunk/fs/jfs/jfs_dtree.c +++ b/trunk/fs/jfs/jfs_dtree.c @@ -212,7 +212,7 @@ static struct metapage *read_index_page(struct inode *inode, s64 blkno) s32 xlen; rc = xtLookup(inode, blkno, 1, &xflag, &xaddr, &xlen, 1); - if (rc || (xaddr == 0)) + if (rc || (xlen == 0)) return NULL; return read_metapage(inode, xaddr, PSIZE, 1); @@ -231,7 +231,7 @@ static struct metapage *get_index_page(struct inode *inode, s64 blkno) s32 xlen; rc = xtLookup(inode, blkno, 1, &xflag, &xaddr, &xlen, 1); - if (rc || (xaddr == 0)) + if (rc || (xlen == 0)) return NULL; return get_metapage(inode, xaddr, PSIZE, 1); @@ -3181,7 +3181,7 @@ int jfs_readdir(struct file *filp, void *dirent, filldir_t filldir) d = (struct ldtentry *) & p->slot[stbl[i]]; if (((long) jfs_dirent + d->namlen + 1) > - (dirent_buf + PAGE_SIZE)) { + (dirent_buf + PSIZE)) { /* DBCS codepages could overrun dirent_buf */ index = i; overflow = 1; diff --git a/trunk/fs/jfs/jfs_imap.c b/trunk/fs/jfs/jfs_imap.c index 7acff2ce3c80..783831301625 100644 --- a/trunk/fs/jfs/jfs_imap.c +++ b/trunk/fs/jfs/jfs_imap.c @@ -502,7 +502,7 @@ struct inode *diReadSpecial(struct super_block *sb, ino_t inum, int secondary) } - ip->i_mapping->a_ops = &jfs_metapage_aops; + ip->i_mapping->a_ops = &jfs_aops; mapping_set_gfp_mask(ip->i_mapping, GFP_NOFS); /* Allocations to metadata inodes should not affect quotas */ @@ -2573,18 +2573,9 @@ diNewIAG(struct inomap * imap, int *iagnop, int agno, struct metapage ** mpp) goto out; } - /* - * start transaction of update of the inode map - * addressing structure pointing to the new iag page; - */ - tid = txBegin(sb, COMMIT_FORCE); - down(&JFS_IP(ipimap)->commit_sem); - - /* update the inode map addressing structure to point to it */ - if ((rc = - xtInsert(tid, ipimap, 0, blkno, xlen, &xaddr, 0))) { - txEnd(tid); - up(&JFS_IP(ipimap)->commit_sem); + /* assign a buffer for the page */ + mp = get_metapage(ipimap, xaddr, PSIZE, 1); + if (!mp) { /* Free the blocks allocated for the iag since it was * not successfully added to the inode map */ @@ -2593,29 +2584,6 @@ diNewIAG(struct inomap * imap, int *iagnop, int agno, struct metapage ** mpp) /* release the inode map lock */ IWRITE_UNLOCK(ipimap); - goto out; - } - - /* update the inode map's inode to reflect the extension */ - ipimap->i_size += PSIZE; - inode_add_bytes(ipimap, PSIZE); - - /* assign a buffer for the page */ - mp = get_metapage(ipimap, blkno, PSIZE, 0); - if (!mp) { - /* - * This is very unlikely since we just created the - * extent, but let's try to handle it correctly - */ - xtTruncate(tid, ipimap, ipimap->i_size - PSIZE, - COMMIT_PWMAP); - - txAbort(tid, 0); - txEnd(tid); - - /* release the inode map lock */ - IWRITE_UNLOCK(ipimap); - rc = -EIO; goto out; } @@ -2637,10 +2605,40 @@ diNewIAG(struct inomap * imap, int *iagnop, int agno, struct metapage ** mpp) iagp->inosmap[i] = cpu_to_le32(ONES); /* - * Write and sync the metapage + * Invalidate the page after writing and syncing it. + * After it's initialized, we access it in a different + * address space */ + set_bit(META_discard, &mp->flag); flush_metapage(mp); + /* + * start tyransaction of update of the inode map + * addressing structure pointing to the new iag page; + */ + tid = txBegin(sb, COMMIT_FORCE); + down(&JFS_IP(ipimap)->commit_sem); + + /* update the inode map addressing structure to point to it */ + if ((rc = + xtInsert(tid, ipimap, 0, blkno, xlen, &xaddr, 0))) { + txEnd(tid); + up(&JFS_IP(ipimap)->commit_sem); + /* Free the blocks allocated for the iag since it was + * not successfully added to the inode map + */ + dbFree(ipimap, xaddr, (s64) xlen); + + /* release the inode map lock */ + IWRITE_UNLOCK(ipimap); + + goto out; + } + + /* update the inode map's inode to reflect the extension */ + ipimap->i_size += PSIZE; + inode_add_bytes(ipimap, PSIZE); + /* * txCommit(COMMIT_FORCE) will synchronously write address * index pages and inode after commit in careful update order @@ -2791,7 +2789,6 @@ diUpdatePMap(struct inode *ipimap, u32 mask; struct jfs_log *log; int lsn, difft, diffp; - unsigned long flags; imap = JFS_IP(ipimap)->i_imap; /* get the iag number containing the inode */ @@ -2808,7 +2805,6 @@ diUpdatePMap(struct inode *ipimap, IREAD_UNLOCK(ipimap); if (rc) return (rc); - metapage_wait_for_io(mp); iagp = (struct iag *) mp->data; /* get the inode number and extent number of the inode within * the iag and the inode number within the extent. @@ -2872,28 +2868,30 @@ diUpdatePMap(struct inode *ipimap, /* inherit older/smaller lsn */ logdiff(difft, lsn, log); logdiff(diffp, mp->lsn, log); - LOGSYNC_LOCK(log, flags); if (difft < diffp) { mp->lsn = lsn; /* move mp after tblock in logsync list */ + LOGSYNC_LOCK(log); list_move(&mp->synclist, &tblk->synclist); + LOGSYNC_UNLOCK(log); } /* inherit younger/larger clsn */ + LOGSYNC_LOCK(log); assert(mp->clsn); logdiff(difft, tblk->clsn, log); logdiff(diffp, mp->clsn, log); if (difft > diffp) mp->clsn = tblk->clsn; - LOGSYNC_UNLOCK(log, flags); + LOGSYNC_UNLOCK(log); } else { mp->log = log; mp->lsn = lsn; /* insert mp after tblock in logsync list */ - LOGSYNC_LOCK(log, flags); + LOGSYNC_LOCK(log); log->count++; list_add(&mp->synclist, &tblk->synclist); mp->clsn = tblk->clsn; - LOGSYNC_UNLOCK(log, flags); + LOGSYNC_UNLOCK(log); } write_metapage(mp); return (0); diff --git a/trunk/fs/jfs/jfs_incore.h b/trunk/fs/jfs/jfs_incore.h index c0fd7b3eadc6..ebd77c1bed66 100644 --- a/trunk/fs/jfs/jfs_incore.h +++ b/trunk/fs/jfs/jfs_incore.h @@ -165,7 +165,6 @@ struct jfs_sb_info { /* Formerly in ipbmap */ struct bmap *bmap; /* incore bmap descriptor */ struct nls_table *nls_tab; /* current codepage */ - struct inode *direct_inode; /* metadata inode */ uint state; /* mount/recovery state */ unsigned long flag; /* mount time flags */ uint p_state; /* state prior to going no integrity */ diff --git a/trunk/fs/jfs/jfs_logmgr.c b/trunk/fs/jfs/jfs_logmgr.c index dfa1200daa61..b6a6869ebb4f 100644 --- a/trunk/fs/jfs/jfs_logmgr.c +++ b/trunk/fs/jfs/jfs_logmgr.c @@ -234,7 +234,6 @@ int lmLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd, int lsn; int diffp, difft; struct metapage *mp = NULL; - unsigned long flags; jfs_info("lmLog: log:0x%p tblk:0x%p, lrd:0x%p tlck:0x%p", log, tblk, lrd, tlck); @@ -255,7 +254,7 @@ int lmLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd, */ lsn = log->lsn; - LOGSYNC_LOCK(log, flags); + LOGSYNC_LOCK(log); /* * initialize page lsn if first log write of the page @@ -311,7 +310,7 @@ int lmLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd, } } - LOGSYNC_UNLOCK(log, flags); + LOGSYNC_UNLOCK(log); /* * write the log record @@ -335,6 +334,7 @@ int lmLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd, return lsn; } + /* * NAME: lmWriteRecord() * @@ -927,8 +927,9 @@ static void lmPostGC(struct lbuf * bp) * calculate new value of i_nextsync which determines when * this code is called again. * - * PARAMETERS: log - log structure - * nosyncwait - 1 if called asynchronously + * this is called only from lmLog(). + * + * PARAMETER: ip - pointer to logs inode. * * RETURN: 0 * @@ -944,15 +945,6 @@ static int lmLogSync(struct jfs_log * log, int nosyncwait) struct lrd lrd; int lsn; struct logsyncblk *lp; - struct jfs_sb_info *sbi; - unsigned long flags; - - /* push dirty metapages out to disk */ - list_for_each_entry(sbi, &log->sb_list, log_list) { - filemap_flush(sbi->ipbmap->i_mapping); - filemap_flush(sbi->ipimap->i_mapping); - filemap_flush(sbi->direct_inode->i_mapping); - } /* * forward syncpt @@ -962,7 +954,10 @@ static int lmLogSync(struct jfs_log * log, int nosyncwait) */ if (log->sync == log->syncpt) { - LOGSYNC_LOCK(log, flags); + LOGSYNC_LOCK(log); + /* ToDo: push dirty metapages out to disk */ +// bmLogSync(log); + if (list_empty(&log->synclist)) log->sync = log->lsn; else { @@ -970,7 +965,7 @@ static int lmLogSync(struct jfs_log * log, int nosyncwait) struct logsyncblk, synclist); log->sync = lp->lsn; } - LOGSYNC_UNLOCK(log, flags); + LOGSYNC_UNLOCK(log); } @@ -979,6 +974,27 @@ static int lmLogSync(struct jfs_log * log, int nosyncwait) * reset syncpt = sync */ if (log->sync != log->syncpt) { + struct jfs_sb_info *sbi; + + /* + * We need to make sure all of the "written" metapages + * actually make it to disk + */ + list_for_each_entry(sbi, &log->sb_list, log_list) { + if (sbi->flag & JFS_NOINTEGRITY) + continue; + filemap_fdatawrite(sbi->ipbmap->i_mapping); + filemap_fdatawrite(sbi->ipimap->i_mapping); + filemap_fdatawrite(sbi->sb->s_bdev->bd_inode->i_mapping); + } + list_for_each_entry(sbi, &log->sb_list, log_list) { + if (sbi->flag & JFS_NOINTEGRITY) + continue; + filemap_fdatawait(sbi->ipbmap->i_mapping); + filemap_fdatawait(sbi->ipimap->i_mapping); + filemap_fdatawait(sbi->sb->s_bdev->bd_inode->i_mapping); + } + lrd.logtid = 0; lrd.backchain = 0; lrd.type = cpu_to_le16(LOG_SYNCPT); @@ -1050,18 +1066,6 @@ static int lmLogSync(struct jfs_log * log, int nosyncwait) return lsn; } -/* - * NAME: jfs_syncpt - * - * FUNCTION: write log SYNCPT record for specified log - * - * PARAMETERS: log - log structure - */ -void jfs_syncpt(struct jfs_log *log) -{ LOG_LOCK(log); - lmLogSync(log, 1); - LOG_UNLOCK(log); -} /* * NAME: lmLogOpen() @@ -1543,7 +1547,6 @@ void jfs_flush_journal(struct jfs_log *log, int wait) { int i; struct tblock *target = NULL; - struct jfs_sb_info *sbi; /* jfs_write_inode may call us during read-only mount */ if (!log) @@ -1605,18 +1608,12 @@ void jfs_flush_journal(struct jfs_log *log, int wait) if (wait < 2) return; - list_for_each_entry(sbi, &log->sb_list, log_list) { - filemap_fdatawrite(sbi->ipbmap->i_mapping); - filemap_fdatawrite(sbi->ipimap->i_mapping); - filemap_fdatawrite(sbi->direct_inode->i_mapping); - } - /* * If there was recent activity, we may need to wait * for the lazycommit thread to catch up */ if ((!list_empty(&log->cqueue)) || !list_empty(&log->synclist)) { - for (i = 0; i < 200; i++) { /* Too much? */ + for (i = 0; i < 800; i++) { /* Too much? */ msleep(250); if (list_empty(&log->cqueue) && list_empty(&log->synclist)) @@ -1624,24 +1621,7 @@ void jfs_flush_journal(struct jfs_log *log, int wait) } } assert(list_empty(&log->cqueue)); - if (!list_empty(&log->synclist)) { - struct logsyncblk *lp; - - list_for_each_entry(lp, &log->synclist, synclist) { - if (lp->xflag & COMMIT_PAGE) { - struct metapage *mp = (struct metapage *)lp; - dump_mem("orphan metapage", lp, - sizeof(struct metapage)); - dump_mem("page", mp->page, sizeof(struct page)); - } - else - dump_mem("orphan tblock", lp, - sizeof(struct tblock)); - } -// current->state = TASK_INTERRUPTIBLE; -// schedule(); - } - //assert(list_empty(&log->synclist)); + assert(list_empty(&log->synclist)); clear_bit(log_FLUSH, &log->flag); } @@ -1689,7 +1669,6 @@ int lmLogShutdown(struct jfs_log * log) lp->h.eor = lp->t.eor = cpu_to_le16(bp->l_eor); lbmWrite(log, log->bp, lbmWRITE | lbmRELEASE | lbmSYNC, 0); lbmIOWait(log->bp, lbmFREE); - log->bp = NULL; /* * synchronous update log superblock @@ -1840,34 +1819,20 @@ static int lbmLogInit(struct jfs_log * log) log->lbuf_free = NULL; - for (i = 0; i < LOGPAGES;) { - char *buffer; - uint offset; - struct page *page; - - buffer = (char *) get_zeroed_page(GFP_KERNEL); - if (buffer == NULL) + for (i = 0; i < LOGPAGES; i++) { + lbuf = kmalloc(sizeof(struct lbuf), GFP_KERNEL); + if (lbuf == 0) + goto error; + lbuf->l_ldata = (char *) get_zeroed_page(GFP_KERNEL); + if (lbuf->l_ldata == 0) { + kfree(lbuf); goto error; - page = virt_to_page(buffer); - for (offset = 0; offset < PAGE_SIZE; offset += LOGPSIZE) { - lbuf = kmalloc(sizeof(struct lbuf), GFP_KERNEL); - if (lbuf == NULL) { - if (offset == 0) - free_page((unsigned long) buffer); - goto error; - } - if (offset) /* we already have one reference */ - get_page(page); - lbuf->l_offset = offset; - lbuf->l_ldata = buffer + offset; - lbuf->l_page = page; - lbuf->l_log = log; - init_waitqueue_head(&lbuf->l_ioevent); - - lbuf->l_freelist = log->lbuf_free; - log->lbuf_free = lbuf; - i++; } + lbuf->l_log = log; + init_waitqueue_head(&lbuf->l_ioevent); + + lbuf->l_freelist = log->lbuf_free; + log->lbuf_free = lbuf; } return (0); @@ -1892,10 +1857,12 @@ static void lbmLogShutdown(struct jfs_log * log) lbuf = log->lbuf_free; while (lbuf) { struct lbuf *next = lbuf->l_freelist; - __free_page(lbuf->l_page); + free_page((unsigned long) lbuf->l_ldata); kfree(lbuf); lbuf = next; } + + log->bp = NULL; } @@ -2007,9 +1974,9 @@ static int lbmRead(struct jfs_log * log, int pn, struct lbuf ** bpp) bio->bi_sector = bp->l_blkno << (log->l2bsize - 9); bio->bi_bdev = log->bdev; - bio->bi_io_vec[0].bv_page = bp->l_page; + bio->bi_io_vec[0].bv_page = virt_to_page(bp->l_ldata); bio->bi_io_vec[0].bv_len = LOGPSIZE; - bio->bi_io_vec[0].bv_offset = bp->l_offset; + bio->bi_io_vec[0].bv_offset = 0; bio->bi_vcnt = 1; bio->bi_idx = 0; @@ -2148,9 +2115,9 @@ static void lbmStartIO(struct lbuf * bp) bio = bio_alloc(GFP_NOFS, 1); bio->bi_sector = bp->l_blkno << (log->l2bsize - 9); bio->bi_bdev = log->bdev; - bio->bi_io_vec[0].bv_page = bp->l_page; + bio->bi_io_vec[0].bv_page = virt_to_page(bp->l_ldata); bio->bi_io_vec[0].bv_len = LOGPSIZE; - bio->bi_io_vec[0].bv_offset = bp->l_offset; + bio->bi_io_vec[0].bv_offset = 0; bio->bi_vcnt = 1; bio->bi_idx = 0; @@ -2160,13 +2127,16 @@ static void lbmStartIO(struct lbuf * bp) bio->bi_private = bp; /* check if journaling to disk has been disabled */ - if (log->no_integrity) { - bio->bi_size = 0; - lbmIODone(bio, 0, 0); - } else { + if (!log->no_integrity) { submit_bio(WRITE_SYNC, bio); INCREMENT(lmStat.submitted); } + else { + bio->bi_size = 0; + lbmIODone(bio, 0, 0); /* 2nd argument appears to not be used => 0 + * 3rd argument appears to not be used => 0 + */ + } } diff --git a/trunk/fs/jfs/jfs_logmgr.h b/trunk/fs/jfs/jfs_logmgr.h index 51291fbc420c..141ad74010c9 100644 --- a/trunk/fs/jfs/jfs_logmgr.h +++ b/trunk/fs/jfs/jfs_logmgr.h @@ -463,10 +463,9 @@ struct lbuf { s64 l_blkno; /* 8: log page block number */ caddr_t l_ldata; /* 4: data page */ - struct page *l_page; /* The page itself */ - uint l_offset; /* Offset of l_ldata within the page */ wait_queue_head_t l_ioevent; /* 4: i/o done event */ + struct page *l_page; /* The page itself */ }; /* Reuse l_freelist for redrive list */ @@ -490,9 +489,8 @@ struct logsyncblk { */ #define LOGSYNC_LOCK_INIT(log) spin_lock_init(&(log)->synclock) -#define LOGSYNC_LOCK(log, flags) spin_lock_irqsave(&(log)->synclock, flags) -#define LOGSYNC_UNLOCK(log, flags) \ - spin_unlock_irqrestore(&(log)->synclock, flags) +#define LOGSYNC_LOCK(log) spin_lock(&(log)->synclock) +#define LOGSYNC_UNLOCK(log) spin_unlock(&(log)->synclock) /* compute the difference in bytes of lsn from sync point */ #define logdiff(diff, lsn, log)\ @@ -508,6 +506,5 @@ extern int lmLogShutdown(struct jfs_log * log); extern int lmLogInit(struct jfs_log * log); extern int lmLogFormat(struct jfs_log *log, s64 logAddress, int logSize); extern void jfs_flush_journal(struct jfs_log * log, int wait); -extern void jfs_syncpt(struct jfs_log *log); #endif /* _H_JFS_LOGMGR */ diff --git a/trunk/fs/jfs/jfs_metapage.c b/trunk/fs/jfs/jfs_metapage.c index 41bf078dce05..4c0a3ac75c08 100644 --- a/trunk/fs/jfs/jfs_metapage.c +++ b/trunk/fs/jfs/jfs_metapage.c @@ -1,5 +1,5 @@ /* - * Copyright (C) International Business Machines Corp., 2000-2005 + * Copyright (C) International Business Machines Corp., 2000-2003 * Portions Copyright (C) Christoph Hellwig, 2001-2002 * * This program is free software; you can redistribute it and/or modify @@ -18,11 +18,10 @@ */ #include -#include -#include #include #include #include +#include #include "jfs_incore.h" #include "jfs_superblock.h" #include "jfs_filsys.h" @@ -30,6 +29,8 @@ #include "jfs_txnmgr.h" #include "jfs_debug.h" +static DEFINE_SPINLOCK(meta_lock); + #ifdef CONFIG_JFS_STATISTICS static struct { uint pagealloc; /* # of page allocations */ @@ -38,8 +39,22 @@ static struct { } mpStat; #endif -#define metapage_locked(mp) test_bit(META_locked, &(mp)->flag) -#define trylock_metapage(mp) test_and_set_bit(META_locked, &(mp)->flag) + +#define HASH_BITS 10 /* This makes hash_table 1 4K page */ +#define HASH_SIZE (1 << HASH_BITS) +static struct metapage **hash_table = NULL; +static unsigned long hash_order; + + +static inline int metapage_locked(struct metapage *mp) +{ + return test_bit(META_locked, &mp->flag); +} + +static inline int trylock_metapage(struct metapage *mp) +{ + return test_and_set_bit(META_locked, &mp->flag); +} static inline void unlock_metapage(struct metapage *mp) { @@ -47,26 +62,26 @@ static inline void unlock_metapage(struct metapage *mp) wake_up(&mp->wait); } -static inline void __lock_metapage(struct metapage *mp) +static void __lock_metapage(struct metapage *mp) { DECLARE_WAITQUEUE(wait, current); + INCREMENT(mpStat.lockwait); + add_wait_queue_exclusive(&mp->wait, &wait); do { set_current_state(TASK_UNINTERRUPTIBLE); if (metapage_locked(mp)) { - unlock_page(mp->page); + spin_unlock(&meta_lock); schedule(); - lock_page(mp->page); + spin_lock(&meta_lock); } } while (trylock_metapage(mp)); __set_current_state(TASK_RUNNING); remove_wait_queue(&mp->wait, &wait); } -/* - * Must have mp->page locked - */ +/* needs meta_lock */ static inline void lock_metapage(struct metapage *mp) { if (trylock_metapage(mp)) @@ -77,110 +92,6 @@ static inline void lock_metapage(struct metapage *mp) static kmem_cache_t *metapage_cache; static mempool_t *metapage_mempool; -#define MPS_PER_PAGE (PAGE_CACHE_SIZE >> L2PSIZE) - -#if MPS_PER_PAGE > 1 - -struct meta_anchor { - int mp_count; - atomic_t io_count; - struct metapage *mp[MPS_PER_PAGE]; -}; -#define mp_anchor(page) ((struct meta_anchor *)page->private) - -static inline struct metapage *page_to_mp(struct page *page, uint offset) -{ - if (!PagePrivate(page)) - return NULL; - return mp_anchor(page)->mp[offset >> L2PSIZE]; -} - -static inline int insert_metapage(struct page *page, struct metapage *mp) -{ - struct meta_anchor *a; - int index; - int l2mp_blocks; /* log2 blocks per metapage */ - - if (PagePrivate(page)) - a = mp_anchor(page); - else { - a = kmalloc(sizeof(struct meta_anchor), GFP_NOFS); - if (!a) - return -ENOMEM; - memset(a, 0, sizeof(struct meta_anchor)); - page->private = (unsigned long)a; - SetPagePrivate(page); - kmap(page); - } - - if (mp) { - l2mp_blocks = L2PSIZE - page->mapping->host->i_blkbits; - index = (mp->index >> l2mp_blocks) & (MPS_PER_PAGE - 1); - a->mp_count++; - a->mp[index] = mp; - } - - return 0; -} - -static inline void remove_metapage(struct page *page, struct metapage *mp) -{ - struct meta_anchor *a = mp_anchor(page); - int l2mp_blocks = L2PSIZE - page->mapping->host->i_blkbits; - int index; - - index = (mp->index >> l2mp_blocks) & (MPS_PER_PAGE - 1); - - BUG_ON(a->mp[index] != mp); - - a->mp[index] = NULL; - if (--a->mp_count == 0) { - kfree(a); - page->private = 0; - ClearPagePrivate(page); - kunmap(page); - } -} - -static inline void inc_io(struct page *page) -{ - atomic_inc(&mp_anchor(page)->io_count); -} - -static inline void dec_io(struct page *page, void (*handler) (struct page *)) -{ - if (atomic_dec_and_test(&mp_anchor(page)->io_count)) - handler(page); -} - -#else -static inline struct metapage *page_to_mp(struct page *page, uint offset) -{ - return PagePrivate(page) ? (struct metapage *)page->private : NULL; -} - -static inline int insert_metapage(struct page *page, struct metapage *mp) -{ - if (mp) { - page->private = (unsigned long)mp; - SetPagePrivate(page); - kmap(page); - } - return 0; -} - -static inline void remove_metapage(struct page *page, struct metapage *mp) -{ - page->private = 0; - ClearPagePrivate(page); - kunmap(page); -} - -#define inc_io(page) do {} while(0) -#define dec_io(page, handler) handler(page) - -#endif - static void init_once(void *foo, kmem_cache_t *cachep, unsigned long flags) { struct metapage *mp = (struct metapage *)foo; @@ -228,6 +139,16 @@ int __init metapage_init(void) kmem_cache_destroy(metapage_cache); return -ENOMEM; } + /* + * Now the hash list + */ + for (hash_order = 0; + ((PAGE_SIZE << hash_order) / sizeof(void *)) < HASH_SIZE; + hash_order++); + hash_table = + (struct metapage **) __get_free_pages(GFP_KERNEL, hash_order); + assert(hash_table); + memset(hash_table, 0, PAGE_SIZE << hash_order); return 0; } @@ -238,388 +159,73 @@ void metapage_exit(void) kmem_cache_destroy(metapage_cache); } -static inline void drop_metapage(struct page *page, struct metapage *mp) -{ - if (mp->count || mp->nohomeok || test_bit(META_dirty, &mp->flag) || - test_bit(META_io, &mp->flag)) - return; - remove_metapage(page, mp); - INCREMENT(mpStat.pagefree); - free_metapage(mp); -} - /* - * Metapage address space operations + * Basically same hash as in pagemap.h, but using our hash table */ - -static sector_t metapage_get_blocks(struct inode *inode, sector_t lblock, - unsigned int *len) -{ - int rc = 0; - int xflag; - s64 xaddr; - sector_t file_blocks = (inode->i_size + inode->i_blksize - 1) >> - inode->i_blkbits; - - if (lblock >= file_blocks) - return 0; - if (lblock + *len > file_blocks) - *len = file_blocks - lblock; - - if (inode->i_ino) { - rc = xtLookup(inode, (s64)lblock, *len, &xflag, &xaddr, len, 0); - if ((rc == 0) && *len) - lblock = (sector_t)xaddr; - else - lblock = 0; - } /* else no mapping */ - - return lblock; -} - -static void last_read_complete(struct page *page) -{ - if (!PageError(page)) - SetPageUptodate(page); - unlock_page(page); -} - -static int metapage_read_end_io(struct bio *bio, unsigned int bytes_done, - int err) +static struct metapage **meta_hash(struct address_space *mapping, + unsigned long index) { - struct page *page = bio->bi_private; - - if (bio->bi_size) - return 1; - - if (!test_bit(BIO_UPTODATE, &bio->bi_flags)) { - printk(KERN_ERR "metapage_read_end_io: I/O error\n"); - SetPageError(page); - } - - dec_io(page, last_read_complete); - bio_put(bio); - - return 0; +#define i (((unsigned long)mapping)/ \ + (sizeof(struct inode) & ~(sizeof(struct inode) -1 ))) +#define s(x) ((x) + ((x) >> HASH_BITS)) + return hash_table + (s(i + index) & (HASH_SIZE - 1)); +#undef i +#undef s } -static void remove_from_logsync(struct metapage *mp) +static struct metapage *search_hash(struct metapage ** hash_ptr, + struct address_space *mapping, + unsigned long index) { - struct jfs_log *log = mp->log; - unsigned long flags; -/* - * This can race. Recheck that log hasn't been set to null, and after - * acquiring logsync lock, recheck lsn - */ - if (!log) - return; - - LOGSYNC_LOCK(log, flags); - if (mp->lsn) { - mp->log = NULL; - mp->lsn = 0; - mp->clsn = 0; - log->count--; - list_del(&mp->synclist); - } - LOGSYNC_UNLOCK(log, flags); -} + struct metapage *ptr; -static void last_write_complete(struct page *page) -{ - struct metapage *mp; - unsigned int offset; - - for (offset = 0; offset < PAGE_CACHE_SIZE; offset += PSIZE) { - mp = page_to_mp(page, offset); - if (mp && test_bit(META_io, &mp->flag)) { - if (mp->lsn) - remove_from_logsync(mp); - clear_bit(META_io, &mp->flag); - } - /* - * I'd like to call drop_metapage here, but I don't think it's - * safe unless I have the page locked - */ + for (ptr = *hash_ptr; ptr; ptr = ptr->hash_next) { + if ((ptr->mapping == mapping) && (ptr->index == index)) + return ptr; } - end_page_writeback(page); -} - -static int metapage_write_end_io(struct bio *bio, unsigned int bytes_done, - int err) -{ - struct page *page = bio->bi_private; - BUG_ON(!PagePrivate(page)); - - if (bio->bi_size) - return 1; - - if (! test_bit(BIO_UPTODATE, &bio->bi_flags)) { - printk(KERN_ERR "metapage_write_end_io: I/O error\n"); - SetPageError(page); - } - dec_io(page, last_write_complete); - bio_put(bio); - return 0; + return NULL; } -static int metapage_writepage(struct page *page, struct writeback_control *wbc) +static void add_to_hash(struct metapage * mp, struct metapage ** hash_ptr) { - struct bio *bio = NULL; - unsigned int block_offset; /* block offset of mp within page */ - struct inode *inode = page->mapping->host; - unsigned int blocks_per_mp = JFS_SBI(inode->i_sb)->nbperpage; - unsigned int len; - unsigned int xlen; - struct metapage *mp; - int redirty = 0; - sector_t lblock; - sector_t pblock; - sector_t next_block = 0; - sector_t page_start; - unsigned long bio_bytes = 0; - unsigned long bio_offset = 0; - unsigned int offset; - - page_start = (sector_t)page->index << - (PAGE_CACHE_SHIFT - inode->i_blkbits); - BUG_ON(!PageLocked(page)); - BUG_ON(PageWriteback(page)); - - for (offset = 0; offset < PAGE_CACHE_SIZE; offset += PSIZE) { - mp = page_to_mp(page, offset); - - if (!mp || !test_bit(META_dirty, &mp->flag)) - continue; - - if (mp->nohomeok && !test_bit(META_forcewrite, &mp->flag)) { - redirty = 1; - continue; - } - - clear_bit(META_dirty, &mp->flag); - block_offset = offset >> inode->i_blkbits; - lblock = page_start + block_offset; - if (bio) { - if (xlen && lblock == next_block) { - /* Contiguous, in memory & on disk */ - len = min(xlen, blocks_per_mp); - xlen -= len; - bio_bytes += len << inode->i_blkbits; - set_bit(META_io, &mp->flag); - continue; - } - /* Not contiguous */ - if (bio_add_page(bio, page, bio_bytes, bio_offset) < - bio_bytes) - goto add_failed; - /* - * Increment counter before submitting i/o to keep - * count from hitting zero before we're through - */ - inc_io(page); - if (!bio->bi_size) - goto dump_bio; - submit_bio(WRITE, bio); - bio = NULL; - } else { - set_page_writeback(page); - inc_io(page); - } - xlen = (PAGE_CACHE_SIZE - offset) >> inode->i_blkbits; - pblock = metapage_get_blocks(inode, lblock, &xlen); - if (!pblock) { - /* Need better error handling */ - printk(KERN_ERR "JFS: metapage_get_blocks failed\n"); - dec_io(page, last_write_complete); - continue; - } - set_bit(META_io, &mp->flag); - len = min(xlen, (uint) JFS_SBI(inode->i_sb)->nbperpage); - - bio = bio_alloc(GFP_NOFS, 1); - bio->bi_bdev = inode->i_sb->s_bdev; - bio->bi_sector = pblock << (inode->i_blkbits - 9); - bio->bi_end_io = metapage_write_end_io; - bio->bi_private = page; - - /* Don't call bio_add_page yet, we may add to this vec */ - bio_offset = offset; - bio_bytes = len << inode->i_blkbits; - - xlen -= len; - next_block = lblock + len; - } - if (bio) { - if (bio_add_page(bio, page, bio_bytes, bio_offset) < bio_bytes) - goto add_failed; - if (!bio->bi_size) - goto dump_bio; - - submit_bio(WRITE, bio); - } - if (redirty) - redirty_page_for_writepage(wbc, page); + if (*hash_ptr) + (*hash_ptr)->hash_prev = mp; - unlock_page(page); - - return 0; -add_failed: - /* We should never reach here, since we're only adding one vec */ - printk(KERN_ERR "JFS: bio_add_page failed unexpectedly\n"); - goto skip; -dump_bio: - dump_mem("bio", bio, sizeof(*bio)); -skip: - bio_put(bio); - unlock_page(page); - dec_io(page, last_write_complete); - - return -EIO; + mp->hash_prev = NULL; + mp->hash_next = *hash_ptr; + *hash_ptr = mp; } -static int metapage_readpage(struct file *fp, struct page *page) +static void remove_from_hash(struct metapage * mp, struct metapage ** hash_ptr) { - struct inode *inode = page->mapping->host; - struct bio *bio = NULL; - unsigned int block_offset; - unsigned int blocks_per_page = PAGE_CACHE_SIZE >> inode->i_blkbits; - sector_t page_start; /* address of page in fs blocks */ - sector_t pblock; - unsigned int xlen; - unsigned int len; - unsigned int offset; - - BUG_ON(!PageLocked(page)); - page_start = (sector_t)page->index << - (PAGE_CACHE_SHIFT - inode->i_blkbits); - - block_offset = 0; - while (block_offset < blocks_per_page) { - xlen = blocks_per_page - block_offset; - pblock = metapage_get_blocks(inode, page_start + block_offset, - &xlen); - if (pblock) { - if (!PagePrivate(page)) - insert_metapage(page, NULL); - inc_io(page); - if (bio) - submit_bio(READ, bio); - - bio = bio_alloc(GFP_NOFS, 1); - bio->bi_bdev = inode->i_sb->s_bdev; - bio->bi_sector = pblock << (inode->i_blkbits - 9); - bio->bi_end_io = metapage_read_end_io; - bio->bi_private = page; - len = xlen << inode->i_blkbits; - offset = block_offset << inode->i_blkbits; - if (bio_add_page(bio, page, len, offset) < len) - goto add_failed; - block_offset += xlen; - } else - block_offset++; - } - if (bio) - submit_bio(READ, bio); - else - unlock_page(page); - - return 0; - -add_failed: - printk(KERN_ERR "JFS: bio_add_page failed unexpectedly\n"); - bio_put(bio); - dec_io(page, last_read_complete); - return -EIO; -} - -static int metapage_releasepage(struct page *page, int gfp_mask) -{ - struct metapage *mp; - int busy = 0; - unsigned int offset; - - for (offset = 0; offset < PAGE_CACHE_SIZE; offset += PSIZE) { - mp = page_to_mp(page, offset); - - if (!mp) - continue; - - jfs_info("metapage_releasepage: mp = 0x%p", mp); - if (mp->count || mp->nohomeok) { - jfs_info("count = %ld, nohomeok = %d", mp->count, - mp->nohomeok); - busy = 1; - continue; - } - wait_on_page_writeback(page); - //WARN_ON(test_bit(META_dirty, &mp->flag)); - if (test_bit(META_dirty, &mp->flag)) { - dump_mem("dirty mp in metapage_releasepage", mp, - sizeof(struct metapage)); - dump_mem("page", page, sizeof(struct page)); - dump_stack(); - } - WARN_ON(mp->lsn); - if (mp->lsn) - remove_from_logsync(mp); - remove_metapage(page, mp); - INCREMENT(mpStat.pagefree); - free_metapage(mp); + if (mp->hash_prev) + mp->hash_prev->hash_next = mp->hash_next; + else { + assert(*hash_ptr == mp); + *hash_ptr = mp->hash_next; } - if (busy) - return -1; - - return 0; -} - -static int metapage_invalidatepage(struct page *page, unsigned long offset) -{ - BUG_ON(offset); - if (PageWriteback(page)) - return 0; - - return metapage_releasepage(page, 0); + if (mp->hash_next) + mp->hash_next->hash_prev = mp->hash_prev; } -struct address_space_operations jfs_metapage_aops = { - .readpage = metapage_readpage, - .writepage = metapage_writepage, - .sync_page = block_sync_page, - .releasepage = metapage_releasepage, - .invalidatepage = metapage_invalidatepage, - .set_page_dirty = __set_page_dirty_nobuffers, -}; - struct metapage *__get_metapage(struct inode *inode, unsigned long lblock, unsigned int size, int absolute, unsigned long new) { + struct metapage **hash_ptr; int l2BlocksPerPage; int l2bsize; struct address_space *mapping; - struct metapage *mp = NULL; - struct page *page; + struct metapage *mp; unsigned long page_index; unsigned long page_offset; - jfs_info("__get_metapage: ino = %ld, lblock = 0x%lx, abs=%d", - inode->i_ino, lblock, absolute); - - l2bsize = inode->i_blkbits; - l2BlocksPerPage = PAGE_CACHE_SHIFT - l2bsize; - page_index = lblock >> l2BlocksPerPage; - page_offset = (lblock - (page_index << l2BlocksPerPage)) << l2bsize; - if ((page_offset + size) > PAGE_CACHE_SIZE) { - jfs_err("MetaData crosses page boundary!!"); - jfs_err("lblock = %lx, size = %d", lblock, size); - dump_stack(); - return NULL; - } + jfs_info("__get_metapage: inode = 0x%p, lblock = 0x%lx", inode, lblock); + if (absolute) - mapping = JFS_SBI(inode->i_sb)->direct_inode->i_mapping; + mapping = inode->i_sb->s_bdev->bd_inode->i_mapping; else { /* * If an nfs client tries to read an inode that is larger @@ -631,212 +237,312 @@ struct metapage *__get_metapage(struct inode *inode, unsigned long lblock, mapping = inode->i_mapping; } - if (new && (PSIZE == PAGE_CACHE_SIZE)) { - page = grab_cache_page(mapping, page_index); - if (!page) { - jfs_err("grab_cache_page failed!"); - return NULL; - } - SetPageUptodate(page); - } else { - page = read_cache_page(mapping, page_index, - (filler_t *)mapping->a_ops->readpage, NULL); - if (IS_ERR(page)) { - jfs_err("read_cache_page failed!"); - return NULL; - } - lock_page(page); - } - - mp = page_to_mp(page, page_offset); + hash_ptr = meta_hash(mapping, lblock); +again: + spin_lock(&meta_lock); + mp = search_hash(hash_ptr, mapping, lblock); if (mp) { - if (mp->logical_size != size) { - jfs_error(inode->i_sb, - "__get_metapage: mp->logical_size != size"); - jfs_err("logical_size = %d, size = %d", - mp->logical_size, size); - dump_stack(); - goto unlock; + page_found: + if (test_bit(META_stale, &mp->flag)) { + spin_unlock(&meta_lock); + msleep(1); + goto again; } mp->count++; lock_metapage(mp); + spin_unlock(&meta_lock); if (test_bit(META_discard, &mp->flag)) { if (!new) { jfs_error(inode->i_sb, "__get_metapage: using a " "discarded metapage"); - discard_metapage(mp); - goto unlock; + release_metapage(mp); + return NULL; } clear_bit(META_discard, &mp->flag); } + jfs_info("__get_metapage: found 0x%p, in hash", mp); + if (mp->logical_size != size) { + jfs_error(inode->i_sb, + "__get_metapage: mp->logical_size != size"); + release_metapage(mp); + return NULL; + } } else { - INCREMENT(mpStat.pagealloc); - mp = alloc_metapage(GFP_NOFS); - mp->page = page; + l2bsize = inode->i_blkbits; + l2BlocksPerPage = PAGE_CACHE_SHIFT - l2bsize; + page_index = lblock >> l2BlocksPerPage; + page_offset = (lblock - (page_index << l2BlocksPerPage)) << + l2bsize; + if ((page_offset + size) > PAGE_CACHE_SIZE) { + spin_unlock(&meta_lock); + jfs_err("MetaData crosses page boundary!!"); + return NULL; + } + + /* + * Locks held on aggregate inode pages are usually + * not held long, and they are taken in critical code + * paths (committing dirty inodes, txCommit thread) + * + * Attempt to get metapage without blocking, tapping into + * reserves if necessary. + */ + mp = NULL; + if (JFS_IP(inode)->fileset == AGGREGATE_I) { + mp = alloc_metapage(GFP_ATOMIC); + if (!mp) { + /* + * mempool is supposed to protect us from + * failing here. We will try a blocking + * call, but a deadlock is possible here + */ + printk(KERN_WARNING + "__get_metapage: atomic call to mempool_alloc failed.\n"); + printk(KERN_WARNING + "Will attempt blocking call\n"); + } + } + if (!mp) { + struct metapage *mp2; + + spin_unlock(&meta_lock); + mp = alloc_metapage(GFP_NOFS); + spin_lock(&meta_lock); + + /* we dropped the meta_lock, we need to search the + * hash again. + */ + mp2 = search_hash(hash_ptr, mapping, lblock); + if (mp2) { + free_metapage(mp); + mp = mp2; + goto page_found; + } + } mp->flag = 0; + lock_metapage(mp); + if (absolute) + set_bit(META_absolute, &mp->flag); mp->xflag = COMMIT_PAGE; mp->count = 1; - mp->nohomeok = 0; - mp->logical_size = size; - mp->data = page_address(page) + page_offset; + atomic_set(&mp->nohomeok,0); + mp->mapping = mapping; mp->index = lblock; - if (unlikely(insert_metapage(page, mp))) { - free_metapage(mp); - goto unlock; + mp->page = NULL; + mp->logical_size = size; + add_to_hash(mp, hash_ptr); + spin_unlock(&meta_lock); + + if (new) { + jfs_info("__get_metapage: Calling grab_cache_page"); + mp->page = grab_cache_page(mapping, page_index); + if (!mp->page) { + jfs_err("grab_cache_page failed!"); + goto freeit; + } else { + INCREMENT(mpStat.pagealloc); + unlock_page(mp->page); + } + } else { + jfs_info("__get_metapage: Calling read_cache_page"); + mp->page = read_cache_page(mapping, lblock, + (filler_t *)mapping->a_ops->readpage, NULL); + if (IS_ERR(mp->page)) { + jfs_err("read_cache_page failed!"); + goto freeit; + } else + INCREMENT(mpStat.pagealloc); } - lock_metapage(mp); + mp->data = kmap(mp->page) + page_offset; } - if (new) { - jfs_info("zeroing mp = 0x%p", mp); + if (new) memset(mp->data, 0, PSIZE); - } - unlock_page(page); - jfs_info("__get_metapage: returning = 0x%p data = 0x%p", mp, mp->data); + jfs_info("__get_metapage: returning = 0x%p", mp); return mp; -unlock: - unlock_page(page); +freeit: + spin_lock(&meta_lock); + remove_from_hash(mp, hash_ptr); + free_metapage(mp); + spin_unlock(&meta_lock); return NULL; } -void grab_metapage(struct metapage * mp) +void hold_metapage(struct metapage * mp, int force) { - jfs_info("grab_metapage: mp = 0x%p", mp); - page_cache_get(mp->page); - lock_page(mp->page); + spin_lock(&meta_lock); + mp->count++; - lock_metapage(mp); - unlock_page(mp->page); -} -void force_metapage(struct metapage *mp) -{ - struct page *page = mp->page; - jfs_info("force_metapage: mp = 0x%p", mp); - set_bit(META_forcewrite, &mp->flag); - clear_bit(META_sync, &mp->flag); - page_cache_get(page); - lock_page(page); - set_page_dirty(page); - write_one_page(page, 1); - clear_bit(META_forcewrite, &mp->flag); - page_cache_release(page); -} + if (force) { + ASSERT (!(test_bit(META_forced, &mp->flag))); + if (trylock_metapage(mp)) + set_bit(META_forced, &mp->flag); + } else + lock_metapage(mp); -extern void hold_metapage(struct metapage *mp) -{ - lock_page(mp->page); + spin_unlock(&meta_lock); } -extern void put_metapage(struct metapage *mp) +static void __write_metapage(struct metapage * mp) { - if (mp->count || mp->nohomeok) { - /* Someone else will release this */ + int l2bsize = mp->mapping->host->i_blkbits; + int l2BlocksPerPage = PAGE_CACHE_SHIFT - l2bsize; + unsigned long page_index; + unsigned long page_offset; + int rc; + + jfs_info("__write_metapage: mp = 0x%p", mp); + + page_index = mp->page->index; + page_offset = + (mp->index - (page_index << l2BlocksPerPage)) << l2bsize; + + lock_page(mp->page); + rc = mp->mapping->a_ops->prepare_write(NULL, mp->page, page_offset, + page_offset + + mp->logical_size); + if (rc) { + jfs_err("prepare_write return %d!", rc); + ClearPageUptodate(mp->page); unlock_page(mp->page); + clear_bit(META_dirty, &mp->flag); return; } - page_cache_get(mp->page); - mp->count++; - lock_metapage(mp); + rc = mp->mapping->a_ops->commit_write(NULL, mp->page, page_offset, + page_offset + + mp->logical_size); + if (rc) { + jfs_err("commit_write returned %d", rc); + } + unlock_page(mp->page); - release_metapage(mp); + clear_bit(META_dirty, &mp->flag); + + jfs_info("__write_metapage done"); } -void release_metapage(struct metapage * mp) +static inline void sync_metapage(struct metapage *mp) { struct page *page = mp->page; - jfs_info("release_metapage: mp = 0x%p, flag = 0x%lx", mp, mp->flag); - - BUG_ON(!page); + page_cache_get(page); lock_page(page); - unlock_metapage(mp); - assert(mp->count); - if (--mp->count || mp->nohomeok) { + /* we're done with this page - no need to check for errors */ + if (page_has_buffers(page)) + write_one_page(page, 1); + else unlock_page(page); - page_cache_release(page); + page_cache_release(page); +} + +void release_metapage(struct metapage * mp) +{ + struct jfs_log *log; + + jfs_info("release_metapage: mp = 0x%p, flag = 0x%lx", mp, mp->flag); + + spin_lock(&meta_lock); + if (test_bit(META_forced, &mp->flag)) { + clear_bit(META_forced, &mp->flag); + mp->count--; + spin_unlock(&meta_lock); return; } - if (test_bit(META_dirty, &mp->flag)) { - set_page_dirty(page); + assert(mp->count); + if (--mp->count || atomic_read(&mp->nohomeok)) { + unlock_metapage(mp); + spin_unlock(&meta_lock); + return; + } + + if (mp->page) { + set_bit(META_stale, &mp->flag); + spin_unlock(&meta_lock); + kunmap(mp->page); + mp->data = NULL; + if (test_bit(META_dirty, &mp->flag)) + __write_metapage(mp); if (test_bit(META_sync, &mp->flag)) { + sync_metapage(mp); clear_bit(META_sync, &mp->flag); - write_one_page(page, 1); - lock_page(page); /* write_one_page unlocks the page */ } - } else if (mp->lsn) /* discard_metapage doesn't remove it */ - remove_from_logsync(mp); -#if MPS_PER_PAGE == 1 - /* - * If we know this is the only thing in the page, we can throw - * the page out of the page cache. If pages are larger, we - * don't want to do this. - */ - - /* Retest mp->count since we may have released page lock */ - if (test_bit(META_discard, &mp->flag) && !mp->count) { - clear_page_dirty(page); - ClearPageUptodate(page); -#ifdef _NOT_YET - if (page->mapping) { - /* Remove from page cache and page cache reference */ - remove_from_page_cache(page); - page_cache_release(page); - metapage_releasepage(page, 0); + if (test_bit(META_discard, &mp->flag)) { + lock_page(mp->page); + block_invalidatepage(mp->page, 0); + unlock_page(mp->page); } -#endif + + page_cache_release(mp->page); + mp->page = NULL; + INCREMENT(mpStat.pagefree); + spin_lock(&meta_lock); } -#else - /* Try to keep metapages from using up too much memory */ - drop_metapage(page, mp); -#endif - unlock_page(page); - page_cache_release(page); + + if (mp->lsn) { + /* + * Remove metapage from logsynclist. + */ + log = mp->log; + LOGSYNC_LOCK(log); + mp->log = NULL; + mp->lsn = 0; + mp->clsn = 0; + log->count--; + list_del(&mp->synclist); + LOGSYNC_UNLOCK(log); + } + remove_from_hash(mp, meta_hash(mp->mapping, mp->index)); + spin_unlock(&meta_lock); + + free_metapage(mp); } void __invalidate_metapages(struct inode *ip, s64 addr, int len) { - sector_t lblock; + struct metapage **hash_ptr; + unsigned long lblock; int l2BlocksPerPage = PAGE_CACHE_SHIFT - ip->i_blkbits; - int BlocksPerPage = 1 << l2BlocksPerPage; /* All callers are interested in block device's mapping */ - struct address_space *mapping = - JFS_SBI(ip->i_sb)->direct_inode->i_mapping; + struct address_space *mapping = ip->i_sb->s_bdev->bd_inode->i_mapping; struct metapage *mp; struct page *page; - unsigned int offset; /* - * Mark metapages to discard. They will eventually be + * First, mark metapages to discard. They will eventually be * released, but should not be written. */ - for (lblock = addr & ~(BlocksPerPage - 1); lblock < addr + len; - lblock += BlocksPerPage) { - page = find_lock_page(mapping, lblock >> l2BlocksPerPage); - if (!page) - continue; - for (offset = 0; offset < PAGE_CACHE_SIZE; offset += PSIZE) { - mp = page_to_mp(page, offset); - if (!mp) - continue; - if (mp->index < addr) - continue; - if (mp->index >= addr + len) - break; + for (lblock = addr; lblock < addr + len; + lblock += 1 << l2BlocksPerPage) { + hash_ptr = meta_hash(mapping, lblock); +again: + spin_lock(&meta_lock); + mp = search_hash(hash_ptr, mapping, lblock); + if (mp) { + if (test_bit(META_stale, &mp->flag)) { + spin_unlock(&meta_lock); + msleep(1); + goto again; + } clear_bit(META_dirty, &mp->flag); set_bit(META_discard, &mp->flag); - if (mp->lsn) - remove_from_logsync(mp); + spin_unlock(&meta_lock); + } else { + spin_unlock(&meta_lock); + page = find_lock_page(mapping, lblock>>l2BlocksPerPage); + if (page) { + block_invalidatepage(page, 0); + unlock_page(page); + page_cache_release(page); + } } - unlock_page(page); - page_cache_release(page); } } diff --git a/trunk/fs/jfs/jfs_metapage.h b/trunk/fs/jfs/jfs_metapage.h index 991e9fb84c75..0e58aba58c37 100644 --- a/trunk/fs/jfs/jfs_metapage.h +++ b/trunk/fs/jfs/jfs_metapage.h @@ -33,27 +33,38 @@ struct metapage { unsigned long flag; /* See Below */ unsigned long count; /* Reference count */ void *data; /* Data pointer */ - sector_t index; /* block address of page */ + + /* list management stuff */ + struct metapage *hash_prev; + struct metapage *hash_next; /* Also used for free list */ + + /* + * mapping & index become redundant, but we need these here to + * add the metapage to the hash before we have the real page + */ + struct address_space *mapping; + unsigned long index; wait_queue_head_t wait; /* implementation */ struct page *page; - unsigned int logical_size; + unsigned long logical_size; /* Journal management */ int clsn; - int nohomeok; + atomic_t nohomeok; struct jfs_log *log; }; /* metapage flag */ #define META_locked 0 -#define META_free 1 -#define META_dirty 2 -#define META_sync 3 -#define META_discard 4 -#define META_forcewrite 5 -#define META_io 6 +#define META_absolute 1 +#define META_free 2 +#define META_dirty 3 +#define META_sync 4 +#define META_discard 5 +#define META_forced 6 +#define META_stale 7 #define mark_metapage_dirty(mp) set_bit(META_dirty, &(mp)->flag) @@ -69,16 +80,7 @@ extern struct metapage *__get_metapage(struct inode *inode, __get_metapage(inode, lblock, size, absolute, TRUE) extern void release_metapage(struct metapage *); -extern void grab_metapage(struct metapage *); -extern void force_metapage(struct metapage *); - -/* - * hold_metapage and put_metapage are used in conjuction. The page lock - * is not dropped between the two, so no other threads can get or release - * the metapage - */ -extern void hold_metapage(struct metapage *); -extern void put_metapage(struct metapage *); +extern void hold_metapage(struct metapage *, int); static inline void write_metapage(struct metapage *mp) { @@ -99,46 +101,6 @@ static inline void discard_metapage(struct metapage *mp) release_metapage(mp); } -static inline void metapage_nohomeok(struct metapage *mp) -{ - struct page *page = mp->page; - lock_page(page); - if (!mp->nohomeok++) { - mark_metapage_dirty(mp); - page_cache_get(page); - wait_on_page_writeback(page); - } - unlock_page(page); -} - -/* - * This serializes access to mp->lsn when metapages are added to logsynclist - * without setting nohomeok. i.e. updating imap & dmap - */ -static inline void metapage_wait_for_io(struct metapage *mp) -{ - if (test_bit(META_io, &mp->flag)) - wait_on_page_writeback(mp->page); -} - -/* - * This is called when already holding the metapage - */ -static inline void _metapage_homeok(struct metapage *mp) -{ - if (!--mp->nohomeok) - page_cache_release(mp->page); -} - -static inline void metapage_homeok(struct metapage *mp) -{ - hold_metapage(mp); - _metapage_homeok(mp); - put_metapage(mp); -} - -extern struct address_space_operations jfs_metapage_aops; - /* * This routines invalidate all pages for an extent. */ diff --git a/trunk/fs/jfs/jfs_mount.c b/trunk/fs/jfs/jfs_mount.c index 032d111bc330..c535ffd638e8 100644 --- a/trunk/fs/jfs/jfs_mount.c +++ b/trunk/fs/jfs/jfs_mount.c @@ -285,6 +285,11 @@ int jfs_mount_rw(struct super_block *sb, int remount) */ logMOUNT(sb); + /* + * Set page cache allocation policy + */ + mapping_set_gfp_mask(sb->s_bdev->bd_inode->i_mapping, GFP_NOFS); + return rc; } diff --git a/trunk/fs/jfs/jfs_txnmgr.c b/trunk/fs/jfs/jfs_txnmgr.c index e93d01aa12c4..f40301d93f74 100644 --- a/trunk/fs/jfs/jfs_txnmgr.c +++ b/trunk/fs/jfs/jfs_txnmgr.c @@ -227,7 +227,6 @@ static lid_t txLockAlloc(void) static void txLockFree(lid_t lid) { - TxLock[lid].tid = 0; TxLock[lid].next = TxAnchor.freelock; TxAnchor.freelock = lid; TxAnchor.tlocksInUse--; @@ -567,6 +566,9 @@ void txEnd(tid_t tid) * synchronize with logsync barrier */ if (test_bit(log_SYNCBARRIER, &log->flag)) { + /* forward log syncpt */ + /* lmSync(log); */ + jfs_info("log barrier off: 0x%x", log->lsn); /* enable new transactions start */ @@ -574,22 +576,15 @@ void txEnd(tid_t tid) /* wakeup all waitors for logsync barrier */ TXN_WAKEUP(&log->syncwait); - - TXN_UNLOCK(); - - /* forward log syncpt */ - jfs_syncpt(log); - - goto wakeup; } } - TXN_UNLOCK(); -wakeup: /* * wakeup all waitors for a free tblock */ TXN_WAKEUP(&TxAnchor.freewait); + + TXN_UNLOCK(); } @@ -638,10 +633,8 @@ struct tlock *txLock(tid_t tid, struct inode *ip, struct metapage * mp, /* is page locked by the requester transaction ? */ tlck = lid_to_tlock(lid); - if ((xtid = tlck->tid) == tid) { - TXN_UNLOCK(); + if ((xtid = tlck->tid) == tid) goto grantLock; - } /* * is page locked by anonymous transaction/lock ? @@ -656,7 +649,6 @@ struct tlock *txLock(tid_t tid, struct inode *ip, struct metapage * mp, */ if (xtid == 0) { tlck->tid = tid; - TXN_UNLOCK(); tblk = tid_to_tblock(tid); /* * The order of the tlocks in the transaction is important @@ -714,18 +706,17 @@ struct tlock *txLock(tid_t tid, struct inode *ip, struct metapage * mp, */ tlck->tid = tid; - TXN_UNLOCK(); - /* mark tlock for meta-data page */ if (mp->xflag & COMMIT_PAGE) { tlck->flag = tlckPAGELOCK; /* mark the page dirty and nohomeok */ - metapage_nohomeok(mp); + mark_metapage_dirty(mp); + atomic_inc(&mp->nohomeok); jfs_info("locking mp = 0x%p, nohomeok = %d tid = %d tlck = 0x%p", - mp, mp->nohomeok, tid, tlck); + mp, atomic_read(&mp->nohomeok), tid, tlck); /* if anonymous transaction, and buffer is on the group * commit synclist, mark inode to show this. This will @@ -771,10 +762,8 @@ struct tlock *txLock(tid_t tid, struct inode *ip, struct metapage * mp, if (tlck->next == 0) { /* This inode's first anonymous transaction */ jfs_ip->atltail = lid; - TXN_LOCK(); list_add_tail(&jfs_ip->anon_inode_list, &TxAnchor.anon_list); - TXN_UNLOCK(); } } @@ -832,6 +821,8 @@ struct tlock *txLock(tid_t tid, struct inode *ip, struct metapage * mp, grantLock: tlck->type |= type; + TXN_UNLOCK(); + return tlck; /* @@ -850,19 +841,11 @@ struct tlock *txLock(tid_t tid, struct inode *ip, struct metapage * mp, BUG(); } INCREMENT(stattx.waitlock); /* statistics */ - TXN_UNLOCK(); release_metapage(mp); - TXN_LOCK(); - xtid = tlck->tid; /* reaquire after dropping TXN_LOCK */ jfs_info("txLock: in waitLock, tid = %d, xtid = %d, lid = %d", tid, xtid, lid); - - /* Recheck everything since dropping TXN_LOCK */ - if (xtid && (tlck->mp == mp) && (mp->lid == lid)) - TXN_SLEEP_DROP_LOCK(&tid_to_tblock(xtid)->waitor); - else - TXN_UNLOCK(); + TXN_SLEEP_DROP_LOCK(&tid_to_tblock(xtid)->waitor); jfs_info("txLock: awakened tid = %d, lid = %d", tid, lid); return NULL; @@ -923,7 +906,6 @@ static void txUnlock(struct tblock * tblk) struct metapage *mp; struct jfs_log *log; int difft, diffp; - unsigned long flags; jfs_info("txUnlock: tblk = 0x%p", tblk); log = JFS_SBI(tblk->sb)->log; @@ -943,14 +925,19 @@ static void txUnlock(struct tblock * tblk) assert(mp->xflag & COMMIT_PAGE); /* hold buffer + * + * It's possible that someone else has the metapage. + * The only things were changing are nohomeok, which + * is handled atomically, and clsn which is protected + * by the LOGSYNC_LOCK. */ - hold_metapage(mp); + hold_metapage(mp, 1); - assert(mp->nohomeok > 0); - _metapage_homeok(mp); + assert(atomic_read(&mp->nohomeok) > 0); + atomic_dec(&mp->nohomeok); /* inherit younger/larger clsn */ - LOGSYNC_LOCK(log, flags); + LOGSYNC_LOCK(log); if (mp->clsn) { logdiff(difft, tblk->clsn, log); logdiff(diffp, mp->clsn, log); @@ -958,11 +945,16 @@ static void txUnlock(struct tblock * tblk) mp->clsn = tblk->clsn; } else mp->clsn = tblk->clsn; - LOGSYNC_UNLOCK(log, flags); + LOGSYNC_UNLOCK(log); assert(!(tlck->flag & tlckFREEPAGE)); - put_metapage(mp); + if (tlck->flag & tlckWRITEPAGE) { + write_metapage(mp); + } else { + /* release page which has been forced */ + release_metapage(mp); + } } /* insert tlock, and linelock(s) of the tlock if any, @@ -989,10 +981,10 @@ static void txUnlock(struct tblock * tblk) * has been inserted in logsync list at txUpdateMap()) */ if (tblk->lsn) { - LOGSYNC_LOCK(log, flags); + LOGSYNC_LOCK(log); log->count--; list_del(&tblk->synclist); - LOGSYNC_UNLOCK(log, flags); + LOGSYNC_UNLOCK(log); } } @@ -1581,8 +1573,8 @@ static int dataLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd, * the last entry, so don't bother logging this */ mp->lid = 0; - grab_metapage(mp); - metapage_homeok(mp); + hold_metapage(mp, 0); + atomic_dec(&mp->nohomeok); discard_metapage(mp); tlck->mp = NULL; return 0; @@ -1720,7 +1712,7 @@ static void xtLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd, struct maplock *maplock; struct xdlistlock *xadlock; struct pxd_lock *pxdlock; - pxd_t *page_pxd; + pxd_t *pxd; int next, lwm, hwm; ip = tlck->ip; @@ -1730,7 +1722,7 @@ static void xtLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd, lrd->log.redopage.type = cpu_to_le16(LOG_XTREE); lrd->log.redopage.l2linesize = cpu_to_le16(L2XTSLOTSIZE); - page_pxd = &lrd->log.redopage.pxd; + pxd = &lrd->log.redopage.pxd; if (tlck->type & tlckBTROOT) { lrd->log.redopage.type |= cpu_to_le16(LOG_BTROOT); @@ -1760,9 +1752,9 @@ static void xtLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd, * applying the after-image to the meta-data page. */ lrd->type = cpu_to_le16(LOG_REDOPAGE); -// *page_pxd = mp->cm_pxd; - PXDaddress(page_pxd, mp->index); - PXDlength(page_pxd, +// *pxd = mp->cm_pxd; + PXDaddress(pxd, mp->index); + PXDlength(pxd, mp->logical_size >> tblk->sb->s_blocksize_bits); lrd->backchain = cpu_to_le32(lmLog(log, tblk, lrd, tlck)); @@ -1784,31 +1776,25 @@ static void xtLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd, tlck->flag |= tlckUPDATEMAP; xadlock->flag = mlckALLOCXADLIST; xadlock->count = next - lwm; - if ((xadlock->count <= 4) && (tblk->xflag & COMMIT_LAZY)) { + if ((xadlock->count <= 2) && (tblk->xflag & COMMIT_LAZY)) { int i; - pxd_t *pxd; /* * Lazy commit may allow xtree to be modified before * txUpdateMap runs. Copy xad into linelock to * preserve correct data. - * - * We can fit twice as may pxd's as xads in the lock */ - xadlock->flag = mlckALLOCPXDLIST; - pxd = xadlock->xdlist = &xtlck->pxdlock; - for (i = 0; i < xadlock->count; i++) { - PXDaddress(pxd, addressXAD(&p->xad[lwm + i])); - PXDlength(pxd, lengthXAD(&p->xad[lwm + i])); + xadlock->xdlist = &xtlck->pxdlock; + memcpy(xadlock->xdlist, &p->xad[lwm], + sizeof(xad_t) * xadlock->count); + + for (i = 0; i < xadlock->count; i++) p->xad[lwm + i].flag &= ~(XAD_NEW | XAD_EXTENDED); - pxd++; - } } else { /* * xdlist will point to into inode's xtree, ensure * that transaction is not committed lazily. */ - xadlock->flag = mlckALLOCXADLIST; xadlock->xdlist = &p->xad[lwm]; tblk->xflag &= ~COMMIT_LAZY; } @@ -1850,8 +1836,8 @@ static void xtLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd, if (tblk->xflag & COMMIT_TRUNCATE) { /* write NOREDOPAGE for the page */ lrd->type = cpu_to_le16(LOG_NOREDOPAGE); - PXDaddress(page_pxd, mp->index); - PXDlength(page_pxd, + PXDaddress(pxd, mp->index); + PXDlength(pxd, mp->logical_size >> tblk->sb-> s_blocksize_bits); lrd->backchain = @@ -1886,32 +1872,22 @@ static void xtLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd, * deleted page itself; */ tlck->flag |= tlckUPDATEMAP; + xadlock->flag = mlckFREEXADLIST; xadlock->count = hwm - XTENTRYSTART + 1; - if ((xadlock->count <= 4) && (tblk->xflag & COMMIT_LAZY)) { - int i; - pxd_t *pxd; + if ((xadlock->count <= 2) && (tblk->xflag & COMMIT_LAZY)) { /* * Lazy commit may allow xtree to be modified before * txUpdateMap runs. Copy xad into linelock to * preserve correct data. - * - * We can fit twice as may pxd's as xads in the lock */ - xadlock->flag = mlckFREEPXDLIST; - pxd = xadlock->xdlist = &xtlck->pxdlock; - for (i = 0; i < xadlock->count; i++) { - PXDaddress(pxd, - addressXAD(&p->xad[XTENTRYSTART + i])); - PXDlength(pxd, - lengthXAD(&p->xad[XTENTRYSTART + i])); - pxd++; - } + xadlock->xdlist = &xtlck->pxdlock; + memcpy(xadlock->xdlist, &p->xad[XTENTRYSTART], + sizeof(xad_t) * xadlock->count); } else { /* * xdlist will point to into inode's xtree, ensure * that transaction is not committed lazily. */ - xadlock->flag = mlckFREEXADLIST; xadlock->xdlist = &p->xad[XTENTRYSTART]; tblk->xflag &= ~COMMIT_LAZY; } @@ -1942,7 +1918,7 @@ static void xtLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd, * header ? */ if (tlck->type & tlckTRUNCATE) { - pxd_t pxd; /* truncated extent of xad */ + pxd_t tpxd; /* truncated extent of xad */ int twm; /* @@ -1971,9 +1947,8 @@ static void xtLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd, * applying the after-image to the meta-data page. */ lrd->type = cpu_to_le16(LOG_REDOPAGE); - PXDaddress(page_pxd, mp->index); - PXDlength(page_pxd, - mp->logical_size >> tblk->sb->s_blocksize_bits); + PXDaddress(pxd, mp->index); + PXDlength(pxd, mp->logical_size >> tblk->sb->s_blocksize_bits); lrd->backchain = cpu_to_le32(lmLog(log, tblk, lrd, tlck)); /* @@ -1991,7 +1966,7 @@ static void xtLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd, lrd->log.updatemap.type = cpu_to_le16(LOG_FREEPXD); lrd->log.updatemap.nxd = cpu_to_le16(1); lrd->log.updatemap.pxd = pxdlock->pxd; - pxd = pxdlock->pxd; /* save to format maplock */ + tpxd = pxdlock->pxd; /* save to format maplock */ lrd->backchain = cpu_to_le32(lmLog(log, tblk, lrd, NULL)); } @@ -2060,7 +2035,7 @@ static void xtLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd, pxdlock = (struct pxd_lock *) xadlock; pxdlock->flag = mlckFREEPXD; pxdlock->count = 1; - pxdlock->pxd = pxd; + pxdlock->pxd = tpxd; jfs_info("xtLog: truncate ip:0x%p mp:0x%p count:%d " "hwm:%d", ip, mp, pxdlock->count, hwm); @@ -2278,8 +2253,7 @@ void txForce(struct tblock * tblk) tlck->flag &= ~tlckWRITEPAGE; /* do not release page to freelist */ - force_metapage(mp); -#if 0 + /* * The "right" thing to do here is to * synchronously write the metadata. @@ -2291,10 +2265,9 @@ void txForce(struct tblock * tblk) * we can get by with synchronously writing * the pages when they are released. */ - assert(mp->nohomeok); + assert(atomic_read(&mp->nohomeok)); set_bit(META_dirty, &mp->flag); set_bit(META_sync, &mp->flag); -#endif } } } @@ -2354,7 +2327,7 @@ static void txUpdateMap(struct tblock * tblk) */ mp = tlck->mp; ASSERT(mp->xflag & COMMIT_PAGE); - grab_metapage(mp); + hold_metapage(mp, 0); } /* @@ -2404,8 +2377,8 @@ static void txUpdateMap(struct tblock * tblk) ASSERT(mp->lid == lid); tlck->mp->lid = 0; } - assert(mp->nohomeok == 1); - metapage_homeok(mp); + assert(atomic_read(&mp->nohomeok) == 1); + atomic_dec(&mp->nohomeok); discard_metapage(mp); tlck->mp = NULL; } @@ -2871,9 +2844,24 @@ static void LogSyncRelease(struct metapage * mp) { struct jfs_log *log = mp->log; - assert(mp->nohomeok); + assert(atomic_read(&mp->nohomeok)); assert(log); - metapage_homeok(mp); + atomic_dec(&mp->nohomeok); + + if (atomic_read(&mp->nohomeok)) + return; + + hold_metapage(mp, 0); + + LOGSYNC_LOCK(log); + mp->log = NULL; + mp->lsn = 0; + mp->clsn = 0; + log->count--; + list_del_init(&mp->synclist); + LOGSYNC_UNLOCK(log); + + release_metapage(mp); } /* diff --git a/trunk/fs/jfs/jfs_umount.c b/trunk/fs/jfs/jfs_umount.c index 5cf91785b541..f31a9e3f3fec 100644 --- a/trunk/fs/jfs/jfs_umount.c +++ b/trunk/fs/jfs/jfs_umount.c @@ -49,6 +49,7 @@ */ int jfs_umount(struct super_block *sb) { + struct address_space *bdev_mapping = sb->s_bdev->bd_inode->i_mapping; struct jfs_sb_info *sbi = JFS_SBI(sb); struct inode *ipbmap = sbi->ipbmap; struct inode *ipimap = sbi->ipimap; @@ -108,8 +109,8 @@ int jfs_umount(struct super_block *sb) * Make sure all metadata makes it to disk before we mark * the superblock as clean */ - filemap_fdatawrite(sbi->direct_inode->i_mapping); - filemap_fdatawait(sbi->direct_inode->i_mapping); + filemap_fdatawrite(bdev_mapping); + filemap_fdatawait(bdev_mapping); /* * ensure all file system file pages are propagated to their @@ -122,6 +123,9 @@ int jfs_umount(struct super_block *sb) if (log) { /* log = NULL if read-only mount */ updateSuper(sb, FM_CLEAN); + /* Restore default gfp_mask for bdev */ + mapping_set_gfp_mask(bdev_mapping, GFP_USER); + /* * close log: * @@ -136,6 +140,7 @@ int jfs_umount(struct super_block *sb) int jfs_umount_rw(struct super_block *sb) { + struct address_space *bdev_mapping = sb->s_bdev->bd_inode->i_mapping; struct jfs_sb_info *sbi = JFS_SBI(sb); struct jfs_log *log = sbi->log; @@ -161,10 +166,13 @@ int jfs_umount_rw(struct super_block *sb) * mark the superblock clean before everything is flushed to * disk. */ - filemap_fdatawrite(sbi->direct_inode->i_mapping); - filemap_fdatawait(sbi->direct_inode->i_mapping); + filemap_fdatawrite(bdev_mapping); + filemap_fdatawait(bdev_mapping); updateSuper(sb, FM_CLEAN); + /* Restore default gfp_mask for bdev */ + mapping_set_gfp_mask(bdev_mapping, GFP_USER); + return lmLogClose(sb); } diff --git a/trunk/fs/jfs/jfs_xtree.c b/trunk/fs/jfs/jfs_xtree.c index 31b34db4519e..11c58c54b818 100644 --- a/trunk/fs/jfs/jfs_xtree.c +++ b/trunk/fs/jfs/jfs_xtree.c @@ -1,5 +1,5 @@ /* - * Copyright (C) International Business Machines Corp., 2000-2005 + * Copyright (C) International Business Machines Corp., 2000-2004 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -111,8 +111,8 @@ static struct { /* * forward references */ -static int xtSearch(struct inode *ip, s64 xoff, s64 *next, int *cmpp, - struct btstack * btstack, int flag); +static int xtSearch(struct inode *ip, + s64 xoff, int *cmpp, struct btstack * btstack, int flag); static int xtSplitUp(tid_t tid, struct inode *ip, @@ -159,12 +159,11 @@ int xtLookup(struct inode *ip, s64 lstart, xtpage_t *p; int index; xad_t *xad; - s64 next, size, xoff, xend; + s64 size, xoff, xend; int xlen; s64 xaddr; - *paddr = 0; - *plen = llen; + *plen = 0; if (!no_check) { /* is lookup offset beyond eof ? */ @@ -181,7 +180,7 @@ int xtLookup(struct inode *ip, s64 lstart, * search for the xad entry covering the logical extent */ //search: - if ((rc = xtSearch(ip, lstart, &next, &cmp, &btstack, 0))) { + if ((rc = xtSearch(ip, lstart, &cmp, &btstack, 0))) { jfs_err("xtLookup: xtSearch returned %d", rc); return rc; } @@ -199,11 +198,8 @@ int xtLookup(struct inode *ip, s64 lstart, * lstart is a page start address, * i.e., lstart cannot start in a hole; */ - if (cmp) { - if (next) - *plen = min(next - lstart, llen); + if (cmp) goto out; - } /* * lxd covered by xad @@ -288,7 +284,7 @@ int xtLookupList(struct inode *ip, struct lxdlist * lxdlist, if (lstart >= size) return 0; - if ((rc = xtSearch(ip, lstart, NULL, &cmp, &btstack, 0))) + if ((rc = xtSearch(ip, lstart, &cmp, &btstack, 0))) return rc; /* @@ -492,7 +488,6 @@ int xtLookupList(struct inode *ip, struct lxdlist * lxdlist, * parameters: * ip - file object; * xoff - extent offset; - * nextp - address of next extent (if any) for search miss * cmpp - comparison result: * btstack - traverse stack; * flag - search process flag (XT_INSERT); @@ -502,7 +497,7 @@ int xtLookupList(struct inode *ip, struct lxdlist * lxdlist, * *cmpp is set to result of comparison with the entry returned. * the page containing the entry is pinned at exit. */ -static int xtSearch(struct inode *ip, s64 xoff, s64 *nextp, +static int xtSearch(struct inode *ip, s64 xoff, /* offset of extent */ int *cmpp, struct btstack * btstack, int flag) { struct jfs_inode_info *jfs_ip = JFS_IP(ip); @@ -516,7 +511,6 @@ static int xtSearch(struct inode *ip, s64 xoff, s64 *nextp, struct btframe *btsp; int nsplit = 0; /* number of pages to split */ s64 t64; - s64 next = 0; INCREMENT(xtStat.search); @@ -585,7 +579,6 @@ static int xtSearch(struct inode *ip, s64 xoff, s64 *nextp, * previous and this entry */ *cmpp = 1; - next = t64; goto out; } @@ -630,9 +623,6 @@ static int xtSearch(struct inode *ip, s64 xoff, s64 *nextp, /* update sequential access heuristics */ jfs_ip->btindex = index; - if (nextp) - *nextp = next; - INCREMENT(xtStat.fastSearch); return 0; } @@ -685,11 +675,10 @@ static int xtSearch(struct inode *ip, s64 xoff, s64 *nextp, return 0; } + /* search hit - internal page: * descend/search its child page */ - if (index < le16_to_cpu(p->header.nextindex)-1) - next = offsetXAD(&p->xad[index + 1]); goto next; } @@ -705,8 +694,6 @@ static int xtSearch(struct inode *ip, s64 xoff, s64 *nextp, * base is the smallest index with key (Kj) greater than * search key (K) and may be zero or maxentry index. */ - if (base < le16_to_cpu(p->header.nextindex)) - next = offsetXAD(&p->xad[base]); /* * search miss - leaf page: * @@ -740,9 +727,6 @@ static int xtSearch(struct inode *ip, s64 xoff, s64 *nextp, jfs_ip->btorder = BT_RANDOM; jfs_ip->btindex = base; - if (nextp) - *nextp = next; - return 0; } @@ -809,7 +793,6 @@ int xtInsert(tid_t tid, /* transaction id */ struct xtsplit split; /* split information */ xad_t *xad; int cmp; - s64 next; struct tlock *tlck; struct xtlock *xtlck; @@ -823,7 +806,7 @@ int xtInsert(tid_t tid, /* transaction id */ * n.b. xtSearch() may return index of maxentry of * the full page. */ - if ((rc = xtSearch(ip, xoff, &next, &cmp, &btstack, XT_INSERT))) + if ((rc = xtSearch(ip, xoff, &cmp, &btstack, XT_INSERT))) return rc; /* retrieve search result */ @@ -831,7 +814,7 @@ int xtInsert(tid_t tid, /* transaction id */ /* This test must follow XT_GETSEARCH since mp must be valid if * we branch to out: */ - if ((cmp == 0) || (next && (xlen > next - xoff))) { + if (cmp == 0) { rc = -EEXIST; goto out; } @@ -1643,7 +1626,7 @@ int xtExtend(tid_t tid, /* transaction id */ jfs_info("xtExtend: nxoff:0x%lx nxlen:0x%x", (ulong) xoff, xlen); /* there must exist extent to be extended */ - if ((rc = xtSearch(ip, xoff - 1, NULL, &cmp, &btstack, XT_INSERT))) + if ((rc = xtSearch(ip, xoff - 1, &cmp, &btstack, XT_INSERT))) return rc; /* retrieve search result */ @@ -1811,7 +1794,7 @@ printf("xtTailgate: nxoff:0x%lx nxlen:0x%x nxaddr:0x%lx\n", */ /* there must exist extent to be tailgated */ - if ((rc = xtSearch(ip, xoff, NULL, &cmp, &btstack, XT_INSERT))) + if ((rc = xtSearch(ip, xoff, &cmp, &btstack, XT_INSERT))) return rc; /* retrieve search result */ @@ -1994,7 +1977,7 @@ int xtUpdate(tid_t tid, struct inode *ip, xad_t * nxad) nxlen = lengthXAD(nxad); nxaddr = addressXAD(nxad); - if ((rc = xtSearch(ip, nxoff, NULL, &cmp, &btstack, XT_INSERT))) + if ((rc = xtSearch(ip, nxoff, &cmp, &btstack, XT_INSERT))) return rc; /* retrieve search result */ @@ -2308,7 +2291,7 @@ int xtUpdate(tid_t tid, struct inode *ip, xad_t * nxad) if (nextindex == le16_to_cpu(p->header.maxentry)) { XT_PUTPAGE(mp); - if ((rc = xtSearch(ip, nxoff, NULL, &cmp, &btstack, XT_INSERT))) + if ((rc = xtSearch(ip, nxoff, &cmp, &btstack, XT_INSERT))) return rc; /* retrieve search result */ @@ -2455,7 +2438,6 @@ int xtAppend(tid_t tid, /* transaction id */ int nsplit, nblocks, xlen; struct pxdlist pxdlist; pxd_t *pxd; - s64 next; xaddr = *xaddrp; xlen = *xlenp; @@ -2470,7 +2452,7 @@ int xtAppend(tid_t tid, /* transaction id */ * n.b. xtSearch() may return index of maxentry of * the full page. */ - if ((rc = xtSearch(ip, xoff, &next, &cmp, &btstack, XT_INSERT))) + if ((rc = xtSearch(ip, xoff, &cmp, &btstack, XT_INSERT))) return rc; /* retrieve search result */ @@ -2480,9 +2462,6 @@ int xtAppend(tid_t tid, /* transaction id */ rc = -EEXIST; goto out; } - - if (next) - xlen = min(xlen, (int)(next - xoff)); //insert: /* * insert entry for new extent @@ -2621,7 +2600,7 @@ int xtDelete(tid_t tid, struct inode *ip, s64 xoff, s32 xlen, int flag) /* * find the matching entry; xtSearch() pins the page */ - if ((rc = xtSearch(ip, xoff, NULL, &cmp, &btstack, 0))) + if ((rc = xtSearch(ip, xoff, &cmp, &btstack, 0))) return rc; XT_GETSEARCH(ip, btstack.top, bn, mp, p, index); @@ -2873,7 +2852,7 @@ xtRelocate(tid_t tid, struct inode * ip, xad_t * oxad, /* old XAD */ */ if (xtype == DATAEXT) { /* search in leaf entry */ - rc = xtSearch(ip, xoff, NULL, &cmp, &btstack, 0); + rc = xtSearch(ip, xoff, &cmp, &btstack, 0); if (rc) return rc; @@ -2979,7 +2958,7 @@ xtRelocate(tid_t tid, struct inode * ip, xad_t * oxad, /* old XAD */ } /* get back parent page */ - if ((rc = xtSearch(ip, xoff, NULL, &cmp, &btstack, 0))) + if ((rc = xtSearch(ip, xoff, &cmp, &btstack, 0))) return rc; XT_GETSEARCH(ip, btstack.top, bn, pmp, pp, index); @@ -4012,7 +3991,7 @@ s64 xtTruncate_pmap(tid_t tid, struct inode *ip, s64 committed_size) if (committed_size) { xoff = (committed_size >> JFS_SBI(ip->i_sb)->l2bsize) - 1; - rc = xtSearch(ip, xoff, NULL, &cmp, &btstack, 0); + rc = xtSearch(ip, xoff, &cmp, &btstack, 0); if (rc) return rc; diff --git a/trunk/fs/jfs/resize.c b/trunk/fs/jfs/resize.c index c6dc254d3253..2eb6869b6e72 100644 --- a/trunk/fs/jfs/resize.c +++ b/trunk/fs/jfs/resize.c @@ -209,9 +209,6 @@ int jfs_extendfs(struct super_block *sb, s64 newLVSize, int newLogSize) */ txQuiesce(sb); - /* Reset size of direct inode */ - sbi->direct_inode->i_size = sb->s_bdev->bd_inode->i_size; - if (sbi->mntflag & JFS_INLINELOG) { /* * deactivate old inline log diff --git a/trunk/fs/jfs/super.c b/trunk/fs/jfs/super.c index 5e774ed7fb64..5856866e24fc 100644 --- a/trunk/fs/jfs/super.c +++ b/trunk/fs/jfs/super.c @@ -210,10 +210,6 @@ static void jfs_put_super(struct super_block *sb) unload_nls(sbi->nls_tab); sbi->nls_tab = NULL; - truncate_inode_pages(sbi->direct_inode->i_mapping, 0); - iput(sbi->direct_inode); - sbi->direct_inode = NULL; - kfree(sbi); } @@ -362,12 +358,6 @@ static int jfs_remount(struct super_block *sb, int *flags, char *data) } if ((sb->s_flags & MS_RDONLY) && !(*flags & MS_RDONLY)) { - /* - * Invalidate any previously read metadata. fsck may have - * changed the on-disk data since we mounted r/o - */ - truncate_inode_pages(JFS_SBI(sb)->direct_inode->i_mapping, 0); - JFS_SBI(sb)->flag = flag; return jfs_mount_rw(sb, 1); } @@ -438,26 +428,12 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent) sb->s_op = &jfs_super_operations; sb->s_export_op = &jfs_export_operations; - /* - * Initialize direct-mapping inode/address-space - */ - inode = new_inode(sb); - if (inode == NULL) - goto out_kfree; - inode->i_ino = 0; - inode->i_nlink = 1; - inode->i_size = sb->s_bdev->bd_inode->i_size; - inode->i_mapping->a_ops = &jfs_metapage_aops; - mapping_set_gfp_mask(inode->i_mapping, GFP_NOFS); - - sbi->direct_inode = inode; - rc = jfs_mount(sb); if (rc) { if (!silent) { jfs_err("jfs_mount failed w/return code = %d", rc); } - goto out_mount_failed; + goto out_kfree; } if (sb->s_flags & MS_RDONLY) sbi->log = NULL; @@ -506,13 +482,6 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent) if (rc) { jfs_err("jfs_umount failed with return code %d", rc); } -out_mount_failed: - filemap_fdatawrite(sbi->direct_inode->i_mapping); - filemap_fdatawait(sbi->direct_inode->i_mapping); - truncate_inode_pages(sbi->direct_inode->i_mapping, 0); - make_bad_inode(sbi->direct_inode); - iput(sbi->direct_inode); - sbi->direct_inode = NULL; out_kfree: if (sbi->nls_tab) unload_nls(sbi->nls_tab); @@ -558,10 +527,8 @@ static int jfs_sync_fs(struct super_block *sb, int wait) struct jfs_log *log = JFS_SBI(sb)->log; /* log == NULL indicates read-only mount */ - if (log) { + if (log) jfs_flush_journal(log, wait); - jfs_syncpt(log); - } return 0; } diff --git a/trunk/include/asm-alpha/signal.h b/trunk/include/asm-alpha/signal.h index 1a2c52a056fb..4e0842b415aa 100644 --- a/trunk/include/asm-alpha/signal.h +++ b/trunk/include/asm-alpha/signal.h @@ -113,7 +113,16 @@ typedef unsigned long sigset_t; #define SIG_UNBLOCK 2 /* for unblocking signals */ #define SIG_SETMASK 3 /* for setting the signal mask */ -#include +/* Type of a signal handler. */ +typedef void __signalfn_t(int); +typedef __signalfn_t __user *__sighandler_t; + +typedef void __restorefn_t(void); +typedef __restorefn_t __user *__sigrestore_t; + +#define SIG_DFL ((__sighandler_t)0) /* default signal handling */ +#define SIG_IGN ((__sighandler_t)1) /* ignore signal */ +#define SIG_ERR ((__sighandler_t)-1) /* error return from signal */ #ifdef __KERNEL__ struct osf_sigaction { diff --git a/trunk/include/asm-arm/arch-cl7500/vmalloc.h b/trunk/include/asm-arm/arch-cl7500/vmalloc.h index ba8d7a84456a..91883def4889 100644 --- a/trunk/include/asm-arm/arch-cl7500/vmalloc.h +++ b/trunk/include/asm-arm/arch-cl7500/vmalloc.h @@ -1,4 +1,15 @@ /* * linux/include/asm-arm/arch-cl7500/vmalloc.h */ + +/* + * Just any arbitrary offset to the start of the vmalloc VM area: the + * current 8MB value just means that there will be a 8MB "hole" after the + * physical memory until the kernel virtual memory starts. That means that + * any out-of-bounds memory accesses will hopefully be caught. + * The vmalloc() routines leaves a hole of 4kB between each vmalloced + * area for the same reason. ;) + */ +#define VMALLOC_OFFSET (8*1024*1024) +#define VMALLOC_START (((unsigned long)high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1)) #define VMALLOC_END (PAGE_OFFSET + 0x1c000000) diff --git a/trunk/include/asm-arm/arch-clps711x/vmalloc.h b/trunk/include/asm-arm/arch-clps711x/vmalloc.h index a5dfe96abc96..42571ed5e493 100644 --- a/trunk/include/asm-arm/arch-clps711x/vmalloc.h +++ b/trunk/include/asm-arm/arch-clps711x/vmalloc.h @@ -17,4 +17,15 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + * Just any arbitrary offset to the start of the vmalloc VM area: the + * current 8MB value just means that there will be a 8MB "hole" after the + * physical memory until the kernel virtual memory starts. That means that + * any out-of-bounds memory accesses will hopefully be caught. + * The vmalloc() routines leaves a hole of 4kB between each vmalloced + * area for the same reason. ;) + */ +#define VMALLOC_OFFSET (8*1024*1024) +#define VMALLOC_START (((unsigned long)high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1)) #define VMALLOC_END (PAGE_OFFSET + 0x10000000) diff --git a/trunk/include/asm-arm/arch-ebsa110/vmalloc.h b/trunk/include/asm-arm/arch-ebsa110/vmalloc.h index 26674ba4683c..759659be109f 100644 --- a/trunk/include/asm-arm/arch-ebsa110/vmalloc.h +++ b/trunk/include/asm-arm/arch-ebsa110/vmalloc.h @@ -7,4 +7,15 @@ * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ + +/* + * Just any arbitrary offset to the start of the vmalloc VM area: the + * current 8MB value just means that there will be a 8MB "hole" after the + * physical memory until the kernel virtual memory starts. That means that + * any out-of-bounds memory accesses will hopefully be caught. + * The vmalloc() routines leaves a hole of 4kB between each vmalloced + * area for the same reason. ;) + */ +#define VMALLOC_OFFSET (8*1024*1024) +#define VMALLOC_START (((unsigned long)high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1)) #define VMALLOC_END (PAGE_OFFSET + 0x1f000000) diff --git a/trunk/include/asm-arm/arch-ebsa285/vmalloc.h b/trunk/include/asm-arm/arch-ebsa285/vmalloc.h index d1ca955ce434..def705a3c209 100644 --- a/trunk/include/asm-arm/arch-ebsa285/vmalloc.h +++ b/trunk/include/asm-arm/arch-ebsa285/vmalloc.h @@ -8,6 +8,17 @@ #include +/* + * Just any arbitrary offset to the start of the vmalloc VM area: the + * current 8MB value just means that there will be a 8MB "hole" after the + * physical memory until the kernel virtual memory starts. That means that + * any out-of-bounds memory accesses will hopefully be caught. + * The vmalloc() routines leaves a hole of 4kB between each vmalloced + * area for the same reason. ;) + */ +#define VMALLOC_OFFSET (8*1024*1024) +#define VMALLOC_START (((unsigned long)high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1)) + #ifdef CONFIG_ARCH_FOOTBRIDGE #define VMALLOC_END (PAGE_OFFSET + 0x30000000) #else diff --git a/trunk/include/asm-arm/arch-epxa10db/vmalloc.h b/trunk/include/asm-arm/arch-epxa10db/vmalloc.h index 546fb7d2b6ad..d31ef8584760 100644 --- a/trunk/include/asm-arm/arch-epxa10db/vmalloc.h +++ b/trunk/include/asm-arm/arch-epxa10db/vmalloc.h @@ -17,4 +17,15 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + * Just any arbitrary offset to the start of the vmalloc VM area: the + * current 8MB value just means that there will be a 8MB "hole" after the + * physical memory until the kernel virtual memory starts. That means that + * any out-of-bounds memory accesses will hopefully be caught. + * The vmalloc() routines leaves a hole of 4kB between each vmalloced + * area for the same reason. ;) + */ +#define VMALLOC_OFFSET (8*1024*1024) +#define VMALLOC_START (((unsigned long)high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1)) #define VMALLOC_END (PAGE_OFFSET + 0x10000000) diff --git a/trunk/include/asm-arm/arch-h720x/vmalloc.h b/trunk/include/asm-arm/arch-h720x/vmalloc.h index b4693cb821ef..4af523a5e189 100644 --- a/trunk/include/asm-arm/arch-h720x/vmalloc.h +++ b/trunk/include/asm-arm/arch-h720x/vmalloc.h @@ -5,6 +5,17 @@ #ifndef __ARCH_ARM_VMALLOC_H #define __ARCH_ARM_VMALLOC_H +/* + * Just any arbitrary offset to the start of the vmalloc VM area: the + * current 8MB value just means that there will be a 8MB "hole" after the + * physical memory until the kernel virtual memory starts. That means that + * any out-of-bounds memory accesses will hopefully be caught. + * The vmalloc() routines leaves a hole of 4kB between each vmalloced + * area for the same reason. ;) + */ +#define VMALLOC_OFFSET (8*1024*1024) +#define VMALLOC_START (((unsigned long)high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1)) +#define VMALLOC_VMADDR(x) ((unsigned long)(x)) #define VMALLOC_END (PAGE_OFFSET + 0x10000000) #endif diff --git a/trunk/include/asm-arm/arch-imx/vmalloc.h b/trunk/include/asm-arm/arch-imx/vmalloc.h index cb6169127068..252038f48163 100644 --- a/trunk/include/asm-arm/arch-imx/vmalloc.h +++ b/trunk/include/asm-arm/arch-imx/vmalloc.h @@ -17,4 +17,16 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + * Just any arbitrary offset to the start of the vmalloc VM area: the + * current 8MB value just means that there will be a 8MB "hole" after the + * physical memory until the kernel virtual memory starts. That means that + * any out-of-bounds memory accesses will hopefully be caught. + * The vmalloc() routines leaves a hole of 4kB between each vmalloced + * area for the same reason. ;) + */ +#define VMALLOC_OFFSET (8*1024*1024) +#define VMALLOC_START (((unsigned long)high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1)) +#define VMALLOC_VMADDR(x) ((unsigned long)(x)) #define VMALLOC_END (PAGE_OFFSET + 0x10000000) diff --git a/trunk/include/asm-arm/arch-integrator/platform.h b/trunk/include/asm-arm/arch-integrator/platform.h index bd364f5a99bc..6b67e41669f4 100644 --- a/trunk/include/asm-arm/arch-integrator/platform.h +++ b/trunk/include/asm-arm/arch-integrator/platform.h @@ -20,14 +20,14 @@ * * Copyright © ARM Limited 1998. All rights reserved. * ***********************************************************************/ /* ************************************************************************ - * + * * Integrator address map - * + * * NOTE: This is a multi-hosted header file for use with uHAL and * supported debuggers. - * + * * $Id: platform.s,v 1.32 2000/02/18 10:51:39 asims Exp $ - * + * * ***********************************************************************/ #ifndef __address_h @@ -40,22 +40,22 @@ * Memory definitions * ------------------------------------------------------------------------ * Integrator memory map - * + * */ #define INTEGRATOR_BOOT_ROM_LO 0x00000000 #define INTEGRATOR_BOOT_ROM_HI 0x20000000 #define INTEGRATOR_BOOT_ROM_BASE INTEGRATOR_BOOT_ROM_HI /* Normal position */ #define INTEGRATOR_BOOT_ROM_SIZE SZ_512K -/* +/* * New Core Modules have different amounts of SSRAM, the amount of SSRAM * fitted can be found in HDR_STAT. - * + * * The symbol INTEGRATOR_SSRAM_SIZE is kept, however this now refers to * the minimum amount of SSRAM fitted on any core module. - * + * * New Core Modules also alias the SSRAM. - * + * */ #define INTEGRATOR_SSRAM_BASE 0x00000000 #define INTEGRATOR_SSRAM_ALIAS_BASE 0x10800000 @@ -67,9 +67,9 @@ #define INTEGRATOR_MBRD_SSRAM_BASE 0x28000000 #define INTEGRATOR_MBRD_SSRAM_SIZE SZ_512K -/* +/* * SDRAM is a SIMM therefore the size is not known. - * + * */ #define INTEGRATOR_SDRAM_BASE 0x00040000 @@ -79,9 +79,9 @@ #define INTEGRATOR_HDR2_SDRAM_BASE 0xA0000000 #define INTEGRATOR_HDR3_SDRAM_BASE 0xB0000000 -/* +/* * Logic expansion modules - * + * */ #define INTEGRATOR_LOGIC_MODULES_BASE 0xC0000000 #define INTEGRATOR_LOGIC_MODULE0_BASE 0xC0000000 @@ -92,7 +92,7 @@ /* ------------------------------------------------------------------------ * Integrator header card registers * ------------------------------------------------------------------------ - * + * */ #define INTEGRATOR_HDR_ID_OFFSET 0x00 #define INTEGRATOR_HDR_PROC_OFFSET 0x04 @@ -185,12 +185,12 @@ /* ------------------------------------------------------------------------ * Integrator system registers * ------------------------------------------------------------------------ - * + * */ -/* +/* * System Controller - * + * */ #define INTEGRATOR_SC_ID_OFFSET 0x00 #define INTEGRATOR_SC_OSC_OFFSET 0x04 @@ -230,11 +230,11 @@ #define INTEGRATOR_SC_CTRL_URTS1 (1 << 6) #define INTEGRATOR_SC_CTRL_UDTR1 (1 << 7) -/* +/* * External Bus Interface - * + * */ -#define INTEGRATOR_EBI_BASE 0x12000000 +#define INTEGRATOR_EBI_BASE 0x12000000 #define INTEGRATOR_EBI_CSR0_OFFSET 0x00 #define INTEGRATOR_EBI_CSR1_OFFSET 0x04 @@ -279,9 +279,9 @@ #define INTEGRATOR_KBD_BASE 0x18000000 /* Keyboard */ #define INTEGRATOR_MOUSE_BASE 0x19000000 /* Mouse */ -/* +/* * LED's & Switches - * + * */ #define INTEGRATOR_DBG_ALPHA_OFFSET 0x00 #define INTEGRATOR_DBG_LEDS_OFFSET 0x04 @@ -300,7 +300,7 @@ * ------------------------------------------------------------------------ */ /* PS2 Keyboard interface */ -#define KMI0_BASE INTEGRATOR_KBD_BASE +#define KMI0_BASE INTEGRATOR_KBD_BASE /* PS2 Mouse interface */ #define KMI1_BASE INTEGRATOR_MOUSE_BASE @@ -313,7 +313,7 @@ * This represents a fairly liberal usage of address space. Even though * the V3 only has two windows (therefore we need to map stuff on the fly), * we maintain the same addresses, even if they're not mapped. - * + * */ #define PHYS_PCI_MEM_BASE 0x40000000 /* 512M to xxx */ /* unused 256M from A0000000-AFFFFFFF might be used for I2O ??? @@ -326,7 +326,7 @@ */ #define PHYS_PCI_V3_BASE 0x62000000 -#define PCI_DRAMSIZE INTEGRATOR_SSRAM_SIZE +#define PCI_DRAMSIZE INTEGRATOR_SSRAM_SIZE /* 'export' these to UHAL */ #define UHAL_PCI_IO PCI_IO_BASE @@ -334,7 +334,7 @@ #define UHAL_PCI_ALLOC_IO_BASE 0x00004000 #define UHAL_PCI_ALLOC_MEM_BASE PCI_MEM_BASE #define UHAL_PCI_MAX_SLOT 20 - + /* ======================================================================== * Start of uHAL definitions * ======================================================================== @@ -343,17 +343,17 @@ /* ------------------------------------------------------------------------ * Integrator Interrupt Controllers * ------------------------------------------------------------------------ - * - * Offsets from interrupt controller base - * + * + * Offsets from interrupt controller base + * * System Controller interrupt controller base is - * + * * INTEGRATOR_IC_BASE + (header_number << 6) - * + * * Core Module interrupt controller base is - * - * INTEGRATOR_HDR_IC - * + * + * INTEGRATOR_HDR_IC + * */ #define IRQ_STATUS 0 #define IRQ_RAW_STATUS 0x04 @@ -374,22 +374,22 @@ /* ------------------------------------------------------------------------ * Interrupts * ------------------------------------------------------------------------ - * - * + * + * * Each Core Module has two interrupts controllers, one on the core module * itself and one in the system controller on the motherboard. The * READ_INT macro in target.s reads both interrupt controllers and returns * a 32 bit bitmask, bits 0 to 23 are interrupts from the system controller * and bits 24 to 31 are from the core module. - * + * * The following definitions relate to the bitmask returned by READ_INT. - * + * */ /* ------------------------------------------------------------------------ * LED's - The header LED is not accessible via the uHAL API * ------------------------------------------------------------------------ - * + * */ #define GREEN_LED 0x01 #define YELLOW_LED 0x02 @@ -399,44 +399,44 @@ #define LED_BANK INTEGRATOR_DBG_LEDS -/* +/* * Memory definitions - run uHAL out of SSRAM. - * + * */ #define uHAL_MEMORY_SIZE INTEGRATOR_SSRAM_SIZE -/* +/* * Application Flash - * + * */ #define FLASH_BASE INTEGRATOR_FLASH_BASE #define FLASH_SIZE INTEGRATOR_FLASH_SIZE #define FLASH_END (FLASH_BASE + FLASH_SIZE - 1) #define FLASH_BLOCK_SIZE SZ_128K -/* +/* * Boot Flash - * + * */ #define EPROM_BASE INTEGRATOR_BOOT_ROM_HI #define EPROM_SIZE INTEGRATOR_BOOT_ROM_SIZE #define EPROM_END (EPROM_BASE + EPROM_SIZE - 1) -/* +/* * Clean base - dummy - * + * */ #define CLEAN_BASE EPROM_BASE -/* +/* * Timer definitions - * + * * Only use timer 1 & 2 * (both run at 24MHz and will need the clock divider set to 16). - * + * * Timer 0 runs at bus frequency and therefore could vary and currently * uHAL can't handle that. - * + * */ #define INTEGRATOR_TIMER0_BASE INTEGRATOR_CT_BASE @@ -447,9 +447,9 @@ #define MAX_PERIOD 699050 #define TICKS_PER_uSEC 24 -/* - * These are useconds NOT ticks. - * +/* + * These are useconds NOT ticks. + * */ #define mSEC_1 1000 #define mSEC_5 (mSEC_1 * 5) diff --git a/trunk/include/asm-arm/arch-integrator/vmalloc.h b/trunk/include/asm-arm/arch-integrator/vmalloc.h index 170cccece523..50e9aee79486 100644 --- a/trunk/include/asm-arm/arch-integrator/vmalloc.h +++ b/trunk/include/asm-arm/arch-integrator/vmalloc.h @@ -17,4 +17,15 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + * Just any arbitrary offset to the start of the vmalloc VM area: the + * current 8MB value just means that there will be a 8MB "hole" after the + * physical memory until the kernel virtual memory starts. That means that + * any out-of-bounds memory accesses will hopefully be caught. + * The vmalloc() routines leaves a hole of 4kB between each vmalloced + * area for the same reason. ;) + */ +#define VMALLOC_OFFSET (8*1024*1024) +#define VMALLOC_START (((unsigned long)high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1)) #define VMALLOC_END (PAGE_OFFSET + 0x10000000) diff --git a/trunk/include/asm-arm/arch-iop3xx/vmalloc.h b/trunk/include/asm-arm/arch-iop3xx/vmalloc.h index 0f2f6847f93c..dc1d2a957164 100644 --- a/trunk/include/asm-arm/arch-iop3xx/vmalloc.h +++ b/trunk/include/asm-arm/arch-iop3xx/vmalloc.h @@ -10,6 +10,9 @@ * The vmalloc() routines leaves a hole of 4kB between each vmalloced * area for the same reason. ;) */ +#define VMALLOC_OFFSET (8*1024*1024) +#define VMALLOC_START (((unsigned long)high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1)) +#define VMALLOC_VMADDR(x) ((unsigned long)(x)) //#define VMALLOC_END (0xe8000000) /* increase usable physical RAM to ~992M per RMK */ #define VMALLOC_END (0xfe000000) diff --git a/trunk/include/asm-arm/arch-ixp2000/vmalloc.h b/trunk/include/asm-arm/arch-ixp2000/vmalloc.h index 473dff4ec561..2e4bcbcf31f0 100644 --- a/trunk/include/asm-arm/arch-ixp2000/vmalloc.h +++ b/trunk/include/asm-arm/arch-ixp2000/vmalloc.h @@ -17,4 +17,7 @@ * The vmalloc() routines leaves a hole of 4kB between each vmalloced * area for the same reason. ;) */ +#define VMALLOC_OFFSET (8*1024*1024) +#define VMALLOC_START (((unsigned long)high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1)) +#define VMALLOC_VMADDR(x) ((unsigned long)(x)) #define VMALLOC_END 0xfaffefff diff --git a/trunk/include/asm-arm/arch-ixp4xx/vmalloc.h b/trunk/include/asm-arm/arch-ixp4xx/vmalloc.h index 050d46e6b126..da46e560ad6f 100644 --- a/trunk/include/asm-arm/arch-ixp4xx/vmalloc.h +++ b/trunk/include/asm-arm/arch-ixp4xx/vmalloc.h @@ -1,5 +1,17 @@ /* * linux/include/asm-arm/arch-ixp4xx/vmalloc.h */ + +/* + * Just any arbitrary offset to the start of the vmalloc VM area: the + * current 8MB value just means that there will be a 8MB "hole" after the + * physical memory until the kernel virtual memory starts. That means that + * any out-of-bounds memory accesses will hopefully be caught. + * The vmalloc() routines leaves a hole of 4kB between each vmalloced + * area for the same reason. ;) + */ +#define VMALLOC_OFFSET (8*1024*1024) +#define VMALLOC_START (((unsigned long)high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1)) +#define VMALLOC_VMADDR(x) ((unsigned long)(x)) #define VMALLOC_END (0xFF000000) diff --git a/trunk/include/asm-arm/arch-l7200/vmalloc.h b/trunk/include/asm-arm/arch-l7200/vmalloc.h index 816231eedaac..edeaebe1f14a 100644 --- a/trunk/include/asm-arm/arch-l7200/vmalloc.h +++ b/trunk/include/asm-arm/arch-l7200/vmalloc.h @@ -1,4 +1,15 @@ /* * linux/include/asm-arm/arch-l7200/vmalloc.h */ + +/* + * Just any arbitrary offset to the start of the vmalloc VM area: the + * current 8MB value just means that there will be a 8MB "hole" after the + * physical memory until the kernel virtual memory starts. That means that + * any out-of-bounds memory accesses will hopefully be caught. + * The vmalloc() routines leaves a hole of 4kB between each vmalloced + * area for the same reason. ;) + */ +#define VMALLOC_OFFSET (8*1024*1024) +#define VMALLOC_START (((unsigned long)high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1)) #define VMALLOC_END (PAGE_OFFSET + 0x10000000) diff --git a/trunk/include/asm-arm/arch-lh7a40x/vmalloc.h b/trunk/include/asm-arm/arch-lh7a40x/vmalloc.h index 8163e45109b9..5ac607925bea 100644 --- a/trunk/include/asm-arm/arch-lh7a40x/vmalloc.h +++ b/trunk/include/asm-arm/arch-lh7a40x/vmalloc.h @@ -7,4 +7,15 @@ * version 2 as published by the Free Software Foundation. * */ + +/* + * Just any arbitrary offset to the start of the vmalloc VM area: the + * current 8MB value just means that there will be a 8MB "hole" after + * the physical memory until the kernel virtual memory starts. That + * means that any out-of-bounds memory accesses will hopefully be + * caught. The vmalloc() routines leaves a hole of 4kB (one page) + * between each vmalloced area for the same reason. ;) + */ +#define VMALLOC_OFFSET (8*1024*1024) +#define VMALLOC_START (((unsigned long)high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1)) #define VMALLOC_END (0xe8000000) diff --git a/trunk/include/asm-arm/arch-omap/vmalloc.h b/trunk/include/asm-arm/arch-omap/vmalloc.h index 5b8bd8dae8be..c6a83581a2fc 100644 --- a/trunk/include/asm-arm/arch-omap/vmalloc.h +++ b/trunk/include/asm-arm/arch-omap/vmalloc.h @@ -17,5 +17,17 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + * Just any arbitrary offset to the start of the vmalloc VM area: the + * current 8MB value just means that there will be a 8MB "hole" after the + * physical memory until the kernel virtual memory starts. That means that + * any out-of-bounds memory accesses will hopefully be caught. + * The vmalloc() routines leaves a hole of 4kB between each vmalloced + * area for the same reason. ;) + */ +#define VMALLOC_OFFSET (8*1024*1024) +#define VMALLOC_START (((unsigned long)high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1)) +#define VMALLOC_VMADDR(x) ((unsigned long)(x)) #define VMALLOC_END (PAGE_OFFSET + 0x10000000) diff --git a/trunk/include/asm-arm/arch-pxa/vmalloc.h b/trunk/include/asm-arm/arch-pxa/vmalloc.h index 5bb450c7aa2c..3381af6ddb0d 100644 --- a/trunk/include/asm-arm/arch-pxa/vmalloc.h +++ b/trunk/include/asm-arm/arch-pxa/vmalloc.h @@ -8,4 +8,15 @@ * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ + +/* + * Just any arbitrary offset to the start of the vmalloc VM area: the + * current 8MB value just means that there will be a 8MB "hole" after the + * physical memory until the kernel virtual memory starts. That means that + * any out-of-bounds memory accesses will hopefully be caught. + * The vmalloc() routines leaves a hole of 4kB between each vmalloced + * area for the same reason. ;) + */ +#define VMALLOC_OFFSET (8*1024*1024) +#define VMALLOC_START (((unsigned long)high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1)) #define VMALLOC_END (0xe8000000) diff --git a/trunk/include/asm-arm/arch-rpc/vmalloc.h b/trunk/include/asm-arm/arch-rpc/vmalloc.h index 077046bb2f36..a13c27f37d71 100644 --- a/trunk/include/asm-arm/arch-rpc/vmalloc.h +++ b/trunk/include/asm-arm/arch-rpc/vmalloc.h @@ -7,4 +7,15 @@ * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ + +/* + * Just any arbitrary offset to the start of the vmalloc VM area: the + * current 8MB value just means that there will be a 8MB "hole" after the + * physical memory until the kernel virtual memory starts. That means that + * any out-of-bounds memory accesses will hopefully be caught. + * The vmalloc() routines leaves a hole of 4kB between each vmalloced + * area for the same reason. ;) + */ +#define VMALLOC_OFFSET (8*1024*1024) +#define VMALLOC_START (((unsigned long)high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1)) #define VMALLOC_END (PAGE_OFFSET + 0x1c000000) diff --git a/trunk/include/asm-arm/arch-s3c2410/vmalloc.h b/trunk/include/asm-arm/arch-s3c2410/vmalloc.h index 33963cd5461b..5fe72ad70904 100644 --- a/trunk/include/asm-arm/arch-s3c2410/vmalloc.h +++ b/trunk/include/asm-arm/arch-s3c2410/vmalloc.h @@ -19,6 +19,18 @@ #ifndef __ASM_ARCH_VMALLOC_H #define __ASM_ARCH_VMALLOC_H +/* + * Just any arbitrary offset to the start of the vmalloc VM area: the + * current 8MB value just means that there will be a 8MB "hole" after the + * physical memory until the kernel virtual memory starts. That means that + * any out-of-bounds memory accesses will hopefully be caught. + * The vmalloc() routines leaves a hole of 4kB between each vmalloced + * area for the same reason. ;) + */ + +#define VMALLOC_OFFSET (8*1024*1024) +#define VMALLOC_START (((unsigned long)high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1)) +#define VMALLOC_VMADDR(x) ((unsigned long)(x)) #define VMALLOC_END (0xE0000000) #endif /* __ASM_ARCH_VMALLOC_H */ diff --git a/trunk/include/asm-arm/arch-sa1100/vmalloc.h b/trunk/include/asm-arm/arch-sa1100/vmalloc.h index 2fb1c6f3aa1b..135bc9493c06 100644 --- a/trunk/include/asm-arm/arch-sa1100/vmalloc.h +++ b/trunk/include/asm-arm/arch-sa1100/vmalloc.h @@ -1,4 +1,15 @@ /* * linux/include/asm-arm/arch-sa1100/vmalloc.h */ + +/* + * Just any arbitrary offset to the start of the vmalloc VM area: the + * current 8MB value just means that there will be a 8MB "hole" after the + * physical memory until the kernel virtual memory starts. That means that + * any out-of-bounds memory accesses will hopefully be caught. + * The vmalloc() routines leaves a hole of 4kB between each vmalloced + * area for the same reason. ;) + */ +#define VMALLOC_OFFSET (8*1024*1024) +#define VMALLOC_START (((unsigned long)high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1)) #define VMALLOC_END (0xe8000000) diff --git a/trunk/include/asm-arm/arch-shark/vmalloc.h b/trunk/include/asm-arm/arch-shark/vmalloc.h index 10db5d188231..1cc20098f690 100644 --- a/trunk/include/asm-arm/arch-shark/vmalloc.h +++ b/trunk/include/asm-arm/arch-shark/vmalloc.h @@ -1,4 +1,15 @@ /* * linux/include/asm-arm/arch-rpc/vmalloc.h */ + +/* + * Just any arbitrary offset to the start of the vmalloc VM area: the + * current 8MB value just means that there will be a 8MB "hole" after the + * physical memory until the kernel virtual memory starts. That means that + * any out-of-bounds memory accesses will hopefully be caught. + * The vmalloc() routines leaves a hole of 4kB between each vmalloced + * area for the same reason. ;) + */ +#define VMALLOC_OFFSET (8*1024*1024) +#define VMALLOC_START (((unsigned long)high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1)) #define VMALLOC_END (PAGE_OFFSET + 0x10000000) diff --git a/trunk/include/asm-arm/arch-versatile/vmalloc.h b/trunk/include/asm-arm/arch-versatile/vmalloc.h index ac780df62156..adfb34829bfc 100644 --- a/trunk/include/asm-arm/arch-versatile/vmalloc.h +++ b/trunk/include/asm-arm/arch-versatile/vmalloc.h @@ -18,4 +18,16 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + * Just any arbitrary offset to the start of the vmalloc VM area: the + * current 8MB value just means that there will be a 8MB "hole" after the + * physical memory until the kernel virtual memory starts. That means that + * any out-of-bounds memory accesses will hopefully be caught. + * The vmalloc() routines leaves a hole of 4kB between each vmalloced + * area for the same reason. ;) + */ +#define VMALLOC_OFFSET (8*1024*1024) +#define VMALLOC_START (((unsigned long)high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1)) +#define VMALLOC_VMADDR(x) ((unsigned long)(x)) #define VMALLOC_END (PAGE_OFFSET + 0x18000000) diff --git a/trunk/include/asm-arm/pgtable.h b/trunk/include/asm-arm/pgtable.h index a9892eb42a23..2df4eacf4fa9 100644 --- a/trunk/include/asm-arm/pgtable.h +++ b/trunk/include/asm-arm/pgtable.h @@ -16,23 +16,6 @@ #include #include -/* - * Just any arbitrary offset to the start of the vmalloc VM area: the - * current 8MB value just means that there will be a 8MB "hole" after the - * physical memory until the kernel virtual memory starts. That means that - * any out-of-bounds memory accesses will hopefully be caught. - * The vmalloc() routines leaves a hole of 4kB between each vmalloced - * area for the same reason. ;) - * - * Note that platforms may override VMALLOC_START, but they must provide - * VMALLOC_END. VMALLOC_END defines the (exclusive) limit of this space, - * which may not overlap IO space. - */ -#ifndef VMALLOC_START -#define VMALLOC_OFFSET (8*1024*1024) -#define VMALLOC_START (((unsigned long)high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1)) -#endif - /* * Hardware-wise, we have a two level page table structure, where the first * level has 4096 entries, and the second level has 256 entries. Each entry diff --git a/trunk/include/asm-arm/signal.h b/trunk/include/asm-arm/signal.h index 46e69ae395af..b860dc3c5dc7 100644 --- a/trunk/include/asm-arm/signal.h +++ b/trunk/include/asm-arm/signal.h @@ -117,7 +117,20 @@ typedef unsigned long sigset_t; #define SA_IRQNOMASK 0x08000000 #endif -#include +#define SIG_BLOCK 0 /* for blocking signals */ +#define SIG_UNBLOCK 1 /* for unblocking signals */ +#define SIG_SETMASK 2 /* for setting the signal mask */ + +/* Type of a signal handler. */ +typedef void __signalfn_t(int); +typedef __signalfn_t __user *__sighandler_t; + +typedef void __restorefn_t(void); +typedef __restorefn_t __user *__sigrestore_t; + +#define SIG_DFL ((__sighandler_t)0) /* default signal handling */ +#define SIG_IGN ((__sighandler_t)1) /* ignore signal */ +#define SIG_ERR ((__sighandler_t)-1) /* error return from signal */ #ifdef __KERNEL__ struct old_sigaction { diff --git a/trunk/include/asm-arm26/signal.h b/trunk/include/asm-arm26/signal.h index dedb29280303..a1aacefa6562 100644 --- a/trunk/include/asm-arm26/signal.h +++ b/trunk/include/asm-arm26/signal.h @@ -117,7 +117,16 @@ typedef unsigned long sigset_t; #define SA_IRQNOMASK 0x08000000 #endif -#include +#define SIG_BLOCK 0 /* for blocking signals */ +#define SIG_UNBLOCK 1 /* for unblocking signals */ +#define SIG_SETMASK 2 /* for setting the signal mask */ + +/* Type of a signal handler. */ +typedef void (*__sighandler_t)(int); + +#define SIG_DFL ((__sighandler_t)0) /* default signal handling */ +#define SIG_IGN ((__sighandler_t)1) /* ignore signal */ +#define SIG_ERR ((__sighandler_t)-1) /* error return from signal */ #ifdef __KERNEL__ struct old_sigaction { diff --git a/trunk/include/asm-cris/signal.h b/trunk/include/asm-cris/signal.h index dfe039593a78..2330769ba55d 100644 --- a/trunk/include/asm-cris/signal.h +++ b/trunk/include/asm-cris/signal.h @@ -108,7 +108,16 @@ typedef unsigned long sigset_t; #define MINSIGSTKSZ 2048 #define SIGSTKSZ 8192 -#include +#define SIG_BLOCK 0 /* for blocking signals */ +#define SIG_UNBLOCK 1 /* for unblocking signals */ +#define SIG_SETMASK 2 /* for setting the signal mask */ + +/* Type of a signal handler. */ +typedef void (*__sighandler_t)(int); + +#define SIG_DFL ((__sighandler_t)0) /* default signal handling */ +#define SIG_IGN ((__sighandler_t)1) /* ignore signal */ +#define SIG_ERR ((__sighandler_t)-1) /* error return from signal */ #ifdef __KERNEL__ struct old_sigaction { diff --git a/trunk/include/asm-frv/signal.h b/trunk/include/asm-frv/signal.h index d407bde57eca..c930bb176875 100644 --- a/trunk/include/asm-frv/signal.h +++ b/trunk/include/asm-frv/signal.h @@ -107,7 +107,16 @@ typedef unsigned long sigset_t; #define MINSIGSTKSZ 2048 #define SIGSTKSZ 8192 -#include +#define SIG_BLOCK 0 /* for blocking signals */ +#define SIG_UNBLOCK 1 /* for unblocking signals */ +#define SIG_SETMASK 2 /* for setting the signal mask */ + +/* Type of a signal handler. */ +typedef void (*__sighandler_t)(int); + +#define SIG_DFL ((__sighandler_t)0) /* default signal handling */ +#define SIG_IGN ((__sighandler_t)1) /* ignore signal */ +#define SIG_ERR ((__sighandler_t)-1) /* error return from signal */ #ifdef __KERNEL__ struct old_sigaction { diff --git a/trunk/include/asm-generic/signal.h b/trunk/include/asm-generic/signal.h deleted file mode 100644 index 9418d6e9b8cd..000000000000 --- a/trunk/include/asm-generic/signal.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef SIG_BLOCK -#define SIG_BLOCK 0 /* for blocking signals */ -#endif -#ifndef SIG_UNBLOCK -#define SIG_UNBLOCK 1 /* for unblocking signals */ -#endif -#ifndef SIG_SETMASK -#define SIG_SETMASK 2 /* for setting the signal mask */ -#endif - -#ifndef __ASSEMBLY__ -typedef void __signalfn_t(int); -typedef __signalfn_t __user *__sighandler_t; - -typedef void __restorefn_t(void); -typedef __restorefn_t __user *__sigrestore_t; - -#define SIG_DFL ((__force __sighandler_t)0) /* default signal handling */ -#define SIG_IGN ((__force __sighandler_t)1) /* ignore signal */ -#define SIG_ERR ((__force __sighandler_t)-1) /* error return from signal */ -#endif diff --git a/trunk/include/asm-h8300/signal.h b/trunk/include/asm-h8300/signal.h index 8eccdc176163..ac3e01bd6396 100644 --- a/trunk/include/asm-h8300/signal.h +++ b/trunk/include/asm-h8300/signal.h @@ -107,7 +107,16 @@ typedef unsigned long sigset_t; #define MINSIGSTKSZ 2048 #define SIGSTKSZ 8192 -#include +#define SIG_BLOCK 0 /* for blocking signals */ +#define SIG_UNBLOCK 1 /* for unblocking signals */ +#define SIG_SETMASK 2 /* for setting the signal mask */ + +/* Type of a signal handler. */ +typedef void (*__sighandler_t)(int); + +#define SIG_DFL ((__sighandler_t)0) /* default signal handling */ +#define SIG_IGN ((__sighandler_t)1) /* ignore signal */ +#define SIG_ERR ((__sighandler_t)-1) /* error return from signal */ #ifdef __KERNEL__ struct old_sigaction { diff --git a/trunk/include/asm-i386/signal.h b/trunk/include/asm-i386/signal.h index cbb47d34aa31..0f082bd1c455 100644 --- a/trunk/include/asm-i386/signal.h +++ b/trunk/include/asm-i386/signal.h @@ -110,7 +110,20 @@ typedef unsigned long sigset_t; #define MINSIGSTKSZ 2048 #define SIGSTKSZ 8192 -#include +#define SIG_BLOCK 0 /* for blocking signals */ +#define SIG_UNBLOCK 1 /* for unblocking signals */ +#define SIG_SETMASK 2 /* for setting the signal mask */ + +/* Type of a signal handler. */ +typedef void __signalfn_t(int); +typedef __signalfn_t __user *__sighandler_t; + +typedef void __restorefn_t(void); +typedef __restorefn_t __user *__sigrestore_t; + +#define SIG_DFL ((__sighandler_t)0) /* default signal handling */ +#define SIG_IGN ((__sighandler_t)1) /* ignore signal */ +#define SIG_ERR ((__sighandler_t)-1) /* error return from signal */ #ifdef __KERNEL__ struct old_sigaction { diff --git a/trunk/include/asm-ia64/signal.h b/trunk/include/asm-ia64/signal.h index 608168d713d3..85a577ae9146 100644 --- a/trunk/include/asm-ia64/signal.h +++ b/trunk/include/asm-ia64/signal.h @@ -118,7 +118,13 @@ #endif /* __KERNEL__ */ -#include +#define SIG_BLOCK 0 /* for blocking signals */ +#define SIG_UNBLOCK 1 /* for unblocking signals */ +#define SIG_SETMASK 2 /* for setting the signal mask */ + +#define SIG_DFL ((__sighandler_t)0) /* default signal handling */ +#define SIG_IGN ((__sighandler_t)1) /* ignore signal */ +#define SIG_ERR ((__sighandler_t)-1) /* error return from signal */ # ifndef __ASSEMBLY__ @@ -127,6 +133,9 @@ /* Avoid too many header ordering problems. */ struct siginfo; +/* Type of a signal handler. */ +typedef void __user (*__sighandler_t)(int); + typedef struct sigaltstack { void __user *ss_sp; int ss_flags; diff --git a/trunk/include/asm-m32r/signal.h b/trunk/include/asm-m32r/signal.h index 95f69b191953..6e55fd421883 100644 --- a/trunk/include/asm-m32r/signal.h +++ b/trunk/include/asm-m32r/signal.h @@ -114,7 +114,20 @@ typedef unsigned long sigset_t; #define MINSIGSTKSZ 2048 #define SIGSTKSZ 8192 -#include +#define SIG_BLOCK 0 /* for blocking signals */ +#define SIG_UNBLOCK 1 /* for unblocking signals */ +#define SIG_SETMASK 2 /* for setting the signal mask */ + +/* Type of a signal handler. */ +typedef void __signalfn_t(int); +typedef __signalfn_t __user *__sighandler_t; + +typedef void __restorefn_t(void); +typedef __restorefn_t __user *__sigrestore_t; + +#define SIG_DFL ((__sighandler_t)0) /* default signal handling */ +#define SIG_IGN ((__sighandler_t)1) /* ignore signal */ +#define SIG_ERR ((__sighandler_t)-1) /* error return from signal */ #ifdef __KERNEL__ struct old_sigaction { diff --git a/trunk/include/asm-m68k/signal.h b/trunk/include/asm-m68k/signal.h index a0cdf9082372..1d016e9f19bf 100644 --- a/trunk/include/asm-m68k/signal.h +++ b/trunk/include/asm-m68k/signal.h @@ -105,20 +105,29 @@ typedef unsigned long sigset_t; #define MINSIGSTKSZ 2048 #define SIGSTKSZ 8192 -#include +#define SIG_BLOCK 0 /* for blocking signals */ +#define SIG_UNBLOCK 1 /* for unblocking signals */ +#define SIG_SETMASK 2 /* for setting the signal mask */ + +/* Type of a signal handler. */ +typedef void (*__sighandler_t)(int); + +#define SIG_DFL ((__sighandler_t)0) /* default signal handling */ +#define SIG_IGN ((__sighandler_t)1) /* ignore signal */ +#define SIG_ERR ((__sighandler_t)-1) /* error return from signal */ #ifdef __KERNEL__ struct old_sigaction { __sighandler_t sa_handler; old_sigset_t sa_mask; unsigned long sa_flags; - __sigrestore_t sa_restorer; + void (*sa_restorer)(void); }; struct sigaction { __sighandler_t sa_handler; unsigned long sa_flags; - __sigrestore_t sa_restorer; + void (*sa_restorer)(void); sigset_t sa_mask; /* mask last for extensibility */ }; diff --git a/trunk/include/asm-m68knommu/signal.h b/trunk/include/asm-m68knommu/signal.h index 1d13187f6062..37c9c8a024ba 100644 --- a/trunk/include/asm-m68knommu/signal.h +++ b/trunk/include/asm-m68knommu/signal.h @@ -105,7 +105,16 @@ typedef unsigned long sigset_t; #define MINSIGSTKSZ 2048 #define SIGSTKSZ 8192 -#include +#define SIG_BLOCK 0 /* for blocking signals */ +#define SIG_UNBLOCK 1 /* for unblocking signals */ +#define SIG_SETMASK 2 /* for setting the signal mask */ + +/* Type of a signal handler. */ +typedef void (*__sighandler_t)(int); + +#define SIG_DFL ((__sighandler_t)0) /* default signal handling */ +#define SIG_IGN ((__sighandler_t)1) /* ignore signal */ +#define SIG_ERR ((__sighandler_t)-1) /* error return from signal */ #ifdef __KERNEL__ struct old_sigaction { diff --git a/trunk/include/asm-mips/signal.h b/trunk/include/asm-mips/signal.h index f2c470f1d369..d81356731eb6 100644 --- a/trunk/include/asm-mips/signal.h +++ b/trunk/include/asm-mips/signal.h @@ -103,7 +103,14 @@ typedef unsigned long old_sigset_t; /* at least 32 bits */ #define SIG_SETMASK 3 /* for setting the signal mask */ #define SIG_SETMASK32 256 /* Goodie from SGI for BSD compatibility: set only the low 32 bit of the sigset. */ -#include + +/* Type of a signal handler. */ +typedef void (*__sighandler_t)(int); + +/* Fake signal functions */ +#define SIG_DFL ((__sighandler_t)0) /* default signal handling */ +#define SIG_IGN ((__sighandler_t)1) /* ignore signal */ +#define SIG_ERR ((__sighandler_t)-1) /* error return from signal */ struct sigaction { unsigned int sa_flags; diff --git a/trunk/include/asm-ppc/signal.h b/trunk/include/asm-ppc/signal.h index caf6ede3710f..d890dabd5a69 100644 --- a/trunk/include/asm-ppc/signal.h +++ b/trunk/include/asm-ppc/signal.h @@ -100,7 +100,20 @@ typedef struct { #define MINSIGSTKSZ 2048 #define SIGSTKSZ 8192 -#include +#define SIG_BLOCK 0 /* for blocking signals */ +#define SIG_UNBLOCK 1 /* for unblocking signals */ +#define SIG_SETMASK 2 /* for setting the signal mask */ + +/* Type of a signal handler. */ +typedef void __signalfn_t(int); +typedef __signalfn_t __user *__sighandler_t; + +typedef void __restorefn_t(void); +typedef __restorefn_t __user *__sigrestore_t; + +#define SIG_DFL ((__sighandler_t)0) /* default signal handling */ +#define SIG_IGN ((__sighandler_t)1) /* ignore signal */ +#define SIG_ERR ((__sighandler_t)-1) /* error return from signal */ struct old_sigaction { __sighandler_t sa_handler; diff --git a/trunk/include/asm-ppc64/signal.h b/trunk/include/asm-ppc64/signal.h index 432df7dd355d..a2d7bbb4befd 100644 --- a/trunk/include/asm-ppc64/signal.h +++ b/trunk/include/asm-ppc64/signal.h @@ -97,19 +97,33 @@ typedef struct { #define MINSIGSTKSZ 2048 #define SIGSTKSZ 8192 -#include +#define SIG_BLOCK 0 /* for blocking signals */ +#define SIG_UNBLOCK 1 /* for unblocking signals */ +#define SIG_SETMASK 2 /* for setting the signal mask */ + +/* Type of a signal handler. */ +typedef void __sigfunction(int); +typedef __sigfunction __user * __sighandler_t; + +/* Type of the restorer function */ +typedef void __sigrestorer(void); +typedef __sigrestorer __user * __sigrestorer_t; + +#define SIG_DFL ((__sighandler_t)0) /* default signal handling */ +#define SIG_IGN ((__sighandler_t)1) /* ignore signal */ +#define SIG_ERR ((__sighandler_t)-1) /* error return from signal */ struct old_sigaction { __sighandler_t sa_handler; old_sigset_t sa_mask; unsigned long sa_flags; - __sigrestore_t sa_restorer; + __sigrestorer_t sa_restorer; }; struct sigaction { __sighandler_t sa_handler; unsigned long sa_flags; - __sigrestore_t sa_restorer; + __sigrestorer_t sa_restorer; sigset_t sa_mask; /* mask last for extensibility */ }; diff --git a/trunk/include/asm-s390/signal.h b/trunk/include/asm-s390/signal.h index 3d6e11c6c1fd..bfed83a818cc 100644 --- a/trunk/include/asm-s390/signal.h +++ b/trunk/include/asm-s390/signal.h @@ -117,7 +117,16 @@ typedef unsigned long sigset_t; #define MINSIGSTKSZ 2048 #define SIGSTKSZ 8192 -#include +#define SIG_BLOCK 0 /* for blocking signals */ +#define SIG_UNBLOCK 1 /* for unblocking signals */ +#define SIG_SETMASK 2 /* for setting the signal mask */ + +/* Type of a signal handler. */ +typedef void (*__sighandler_t)(int); + +#define SIG_DFL ((__sighandler_t)0) /* default signal handling */ +#define SIG_IGN ((__sighandler_t)1) /* ignore signal */ +#define SIG_ERR ((__sighandler_t)-1) /* error return from signal */ #ifdef __KERNEL__ struct old_sigaction { diff --git a/trunk/include/asm-sh/signal.h b/trunk/include/asm-sh/signal.h index d6e8eb0e65c7..29f1ac1bf4df 100644 --- a/trunk/include/asm-sh/signal.h +++ b/trunk/include/asm-sh/signal.h @@ -108,7 +108,16 @@ typedef unsigned long sigset_t; #define MINSIGSTKSZ 2048 #define SIGSTKSZ 8192 -#include +#define SIG_BLOCK 0 /* for blocking signals */ +#define SIG_UNBLOCK 1 /* for unblocking signals */ +#define SIG_SETMASK 2 /* for setting the signal mask */ + +/* Type of a signal handler. */ +typedef void (*__sighandler_t)(int); + +#define SIG_DFL ((__sighandler_t)0) /* default signal handling */ +#define SIG_IGN ((__sighandler_t)1) /* ignore signal */ +#define SIG_ERR ((__sighandler_t)-1) /* error return from signal */ #ifdef __KERNEL__ struct old_sigaction { diff --git a/trunk/include/asm-sh64/signal.h b/trunk/include/asm-sh64/signal.h index 2400dc688a65..864c94ecc98c 100644 --- a/trunk/include/asm-sh64/signal.h +++ b/trunk/include/asm-sh64/signal.h @@ -107,7 +107,16 @@ typedef struct { #define MINSIGSTKSZ 2048 #define SIGSTKSZ THREAD_SIZE -#include +#define SIG_BLOCK 0 /* for blocking signals */ +#define SIG_UNBLOCK 1 /* for unblocking signals */ +#define SIG_SETMASK 2 /* for setting the signal mask */ + +/* Type of a signal handler. */ +typedef void (*__sighandler_t)(int); + +#define SIG_DFL ((__sighandler_t)0) /* default signal handling */ +#define SIG_IGN ((__sighandler_t)1) /* ignore signal */ +#define SIG_ERR ((__sighandler_t)-1) /* error return from signal */ #ifdef __KERNEL__ struct old_sigaction { diff --git a/trunk/include/asm-sparc/floppy.h b/trunk/include/asm-sparc/floppy.h index caf926116506..780ee7ff9dc3 100644 --- a/trunk/include/asm-sparc/floppy.h +++ b/trunk/include/asm-sparc/floppy.h @@ -227,7 +227,7 @@ static __inline__ void sun_fd_disable_dma(void) doing_pdma = 0; if (pdma_base) { mmu_unlockarea(pdma_base, pdma_areasize); - pdma_base = NULL; + pdma_base = 0; } } diff --git a/trunk/include/asm-sparc/signal.h b/trunk/include/asm-sparc/signal.h index aa9960ad0ca9..f792e10e704f 100644 --- a/trunk/include/asm-sparc/signal.h +++ b/trunk/include/asm-sparc/signal.h @@ -174,7 +174,16 @@ struct sigstack { #define SA_STATIC_ALLOC 0x80 #endif -#include +/* Type of a signal handler. */ +#ifdef __KERNEL__ +typedef void (*__sighandler_t)(int, int, struct sigcontext *, char *); +#else +typedef void (*__sighandler_t)(int); +#endif + +#define SIG_DFL ((__sighandler_t)0) /* default signal handling */ +#define SIG_IGN ((__sighandler_t)1) /* ignore signal */ +#define SIG_ERR ((__sighandler_t)-1) /* error return from signal */ #ifdef __KERNEL__ struct __new_sigaction { diff --git a/trunk/include/asm-sparc64/parport.h b/trunk/include/asm-sparc64/parport.h index b7e635544cec..ab88349ddadc 100644 --- a/trunk/include/asm-sparc64/parport.h +++ b/trunk/include/asm-sparc64/parport.h @@ -13,12 +13,6 @@ #define PARPORT_PC_MAX_PORTS PARPORT_MAX -/* - * While sparc64 doesn't have an ISA DMA API, we provide something that looks - * close enough to make parport_pc happy - */ -#define HAS_DMA - static struct sparc_ebus_info { struct ebus_dma_info info; unsigned int addr; diff --git a/trunk/include/asm-sparc64/signal.h b/trunk/include/asm-sparc64/signal.h index becdf1bc5924..466d021d7038 100644 --- a/trunk/include/asm-sparc64/signal.h +++ b/trunk/include/asm-sparc64/signal.h @@ -177,7 +177,21 @@ struct sigstack { #define SA_STATIC_ALLOC 0x80 #endif -#include +/* Type of a signal handler. */ +#ifdef __KERNEL__ +typedef void __signalfn_t(int); +typedef __signalfn_t __user *__sighandler_t; + +typedef void __restorefn_t(void); +typedef __restorefn_t __user *__sigrestore_t; +#else +typedef void (*__sighandler_t)(int); +typedef void (*__sigrestore_t)(void); +#endif + +#define SIG_DFL ((__sighandler_t)0) /* default signal handling */ +#define SIG_IGN ((__sighandler_t)1) /* ignore signal */ +#define SIG_ERR ((__sighandler_t)-1) /* error return from signal */ struct __new_sigaction { __sighandler_t sa_handler; diff --git a/trunk/include/asm-v850/signal.h b/trunk/include/asm-v850/signal.h index cb52caa69925..ec3566c875d9 100644 --- a/trunk/include/asm-v850/signal.h +++ b/trunk/include/asm-v850/signal.h @@ -110,7 +110,17 @@ typedef unsigned long sigset_t; #define MINSIGSTKSZ 2048 #define SIGSTKSZ 8192 -#include +#define SIG_BLOCK 0 /* for blocking signals */ +#define SIG_UNBLOCK 1 /* for unblocking signals */ +#define SIG_SETMASK 2 /* for setting the signal mask */ + +/* Type of a signal handler. */ +typedef void (*__sighandler_t)(int); + +#define SIG_DFL ((__sighandler_t)0) /* default signal handling */ +#define SIG_IGN ((__sighandler_t)1) /* ignore signal */ +#define SIG_ERR ((__sighandler_t)-1) /* error return from signal */ + #ifdef __KERNEL__ diff --git a/trunk/include/asm-x86_64/signal.h b/trunk/include/asm-x86_64/signal.h index fe9b96d94815..4987ad8082ba 100644 --- a/trunk/include/asm-x86_64/signal.h +++ b/trunk/include/asm-x86_64/signal.h @@ -116,9 +116,21 @@ typedef unsigned long sigset_t; #define MINSIGSTKSZ 2048 #define SIGSTKSZ 8192 -#include +#define SIG_BLOCK 0 /* for blocking signals */ +#define SIG_UNBLOCK 1 /* for unblocking signals */ +#define SIG_SETMASK 2 /* for setting the signal mask */ #ifndef __ASSEMBLY__ +/* Type of a signal handler. */ +typedef void __signalfn_t(int); +typedef __signalfn_t __user *__sighandler_t; + +typedef void __restorefn_t(void); +typedef __restorefn_t __user *__sigrestore_t; + +#define SIG_DFL ((__sighandler_t)0) /* default signal handling */ +#define SIG_IGN ((__sighandler_t)1) /* ignore signal */ +#define SIG_ERR ((__sighandler_t)-1) /* error return from signal */ struct sigaction { __sighandler_t sa_handler; diff --git a/trunk/include/linux/pci.h b/trunk/include/linux/pci.h index b5238bd18830..3c89148ae28a 100644 --- a/trunk/include/linux/pci.h +++ b/trunk/include/linux/pci.h @@ -671,7 +671,6 @@ struct pci_driver { int (*suspend) (struct pci_dev *dev, pm_message_t state); /* Device suspended */ int (*resume) (struct pci_dev *dev); /* Device woken up */ int (*enable_wake) (struct pci_dev *dev, pci_power_t state, int enable); /* Enable wake event */ - void (*shutdown) (struct pci_dev *dev); struct device_driver driver; struct pci_dynids dynids; @@ -811,6 +810,7 @@ void pci_set_master(struct pci_dev *dev); int pci_set_mwi(struct pci_dev *dev); void pci_clear_mwi(struct pci_dev *dev); int pci_set_dma_mask(struct pci_dev *dev, u64 mask); +int pci_dac_set_dma_mask(struct pci_dev *dev, u64 mask); int pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask); int pci_assign_resource(struct pci_dev *dev, int i); @@ -941,6 +941,7 @@ static inline void pci_set_master(struct pci_dev *dev) { } static inline int pci_enable_device(struct pci_dev *dev) { return -EIO; } static inline void pci_disable_device(struct pci_dev *dev) { } static inline int pci_set_dma_mask(struct pci_dev *dev, u64 mask) { return -EIO; } +static inline int pci_dac_set_dma_mask(struct pci_dev *dev, u64 mask) { return -EIO; } static inline int pci_assign_resource(struct pci_dev *dev, int i) { return -EBUSY;} static inline int pci_register_driver(struct pci_driver *drv) { return 0;} static inline void pci_unregister_driver(struct pci_driver *drv) { } diff --git a/trunk/include/linux/rtnetlink.h b/trunk/include/linux/rtnetlink.h index 91ac97c20777..32e52769a00b 100644 --- a/trunk/include/linux/rtnetlink.h +++ b/trunk/include/linux/rtnetlink.h @@ -89,14 +89,10 @@ enum { RTM_GETANYCAST = 62, #define RTM_GETANYCAST RTM_GETANYCAST - __RTM_MAX, -#define RTM_MAX (((__RTM_MAX + 3) & ~3) - 1) + RTM_MAX, +#define RTM_MAX RTM_MAX }; -#define RTM_NR_MSGTYPES (RTM_MAX + 1 - RTM_BASE) -#define RTM_NR_FAMILIES (RTM_NR_MSGTYPES >> 2) -#define RTM_FAM(cmd) (((cmd) - RTM_BASE) >> 2) - /* Generic structure for encapsulation of optional route information. It is reminiscent of sockaddr, but with sa_family replaced diff --git a/trunk/include/linux/xfrm.h b/trunk/include/linux/xfrm.h index fd2ef742a9fd..f0df02ae68a4 100644 --- a/trunk/include/linux/xfrm.h +++ b/trunk/include/linux/xfrm.h @@ -140,11 +140,8 @@ enum { XFRM_MSG_FLUSHPOLICY, #define XFRM_MSG_FLUSHPOLICY XFRM_MSG_FLUSHPOLICY - __XFRM_MSG_MAX + XFRM_MSG_MAX }; -#define XFRM_MSG_MAX (__XFRM_MSG_MAX - 1) - -#define XFRM_NR_MSGTYPES (XFRM_MSG_MAX + 1 - XFRM_MSG_BASE) struct xfrm_user_tmpl { struct xfrm_id id; diff --git a/trunk/include/net/addrconf.h b/trunk/include/net/addrconf.h index a0ed93672176..7af9a13cb9be 100644 --- a/trunk/include/net/addrconf.h +++ b/trunk/include/net/addrconf.h @@ -17,8 +17,6 @@ #define IPV6_MAX_ADDRESSES 16 -#include - struct prefix_info { __u8 type; __u8 length; @@ -45,9 +43,9 @@ struct prefix_info { #ifdef __KERNEL__ +#include #include #include -#include #define IN6_ADDR_HSIZE 16 diff --git a/trunk/include/net/pkt_sched.h b/trunk/include/net/pkt_sched.h index fcb05a387dbe..7352e455053c 100644 --- a/trunk/include/net/pkt_sched.h +++ b/trunk/include/net/pkt_sched.h @@ -157,8 +157,7 @@ psched_tod_diff(int delta_sec, int bound) case 1: \ __delta += 1000000; \ case 0: \ - if (__delta > bound || __delta < 0) \ - __delta = bound; \ + __delta = abs(__delta); \ } \ __delta; \ }) diff --git a/trunk/include/net/xfrm.h b/trunk/include/net/xfrm.h index e142a256d5dc..73e9a8ca3d3b 100644 --- a/trunk/include/net/xfrm.h +++ b/trunk/include/net/xfrm.h @@ -1,7 +1,6 @@ #ifndef _NET_XFRM_H #define _NET_XFRM_H -#include #include #include #include @@ -517,15 +516,6 @@ struct xfrm_dst u32 child_mtu_cached; }; -static inline void xfrm_dst_destroy(struct xfrm_dst *xdst) -{ - dst_release(xdst->route); - if (likely(xdst->u.dst.xfrm)) - xfrm_state_put(xdst->u.dst.xfrm); -} - -extern void xfrm_dst_ifdown(struct dst_entry *dst, struct net_device *dev); - /* Decapsulation state, used by the input to store data during * decapsulation procedure, to be used later (during the policy * check diff --git a/trunk/kernel/audit.c b/trunk/kernel/audit.c index ac26d4d960d3..0f84dd7af2c8 100644 --- a/trunk/kernel/audit.c +++ b/trunk/kernel/audit.c @@ -427,7 +427,7 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh) /* Get message from skb (based on rtnetlink_rcv_skb). Each message is * processed by audit_receive_msg. Malformed skbs with wrong length are * discarded silently. */ -static void audit_receive_skb(struct sk_buff *skb) +static int audit_receive_skb(struct sk_buff *skb) { int err; struct nlmsghdr *nlh; @@ -436,7 +436,7 @@ static void audit_receive_skb(struct sk_buff *skb) while (skb->len >= NLMSG_SPACE(0)) { nlh = (struct nlmsghdr *)skb->data; if (nlh->nlmsg_len < sizeof(*nlh) || skb->len < nlh->nlmsg_len) - return; + return 0; rlen = NLMSG_ALIGN(nlh->nlmsg_len); if (rlen > skb->len) rlen = skb->len; @@ -446,20 +446,23 @@ static void audit_receive_skb(struct sk_buff *skb) netlink_ack(skb, nlh, 0); skb_pull(skb, rlen); } + return 0; } /* Receive messages from netlink socket. */ static void audit_receive(struct sock *sk, int length) { struct sk_buff *skb; - unsigned int qlen; - down(&audit_netlink_sem); + if (down_trylock(&audit_netlink_sem)) + return; - for (qlen = skb_queue_len(&sk->sk_receive_queue); qlen; qlen--) { - skb = skb_dequeue(&sk->sk_receive_queue); - audit_receive_skb(skb); - kfree_skb(skb); + /* FIXME: this must not cause starvation */ + while ((skb = skb_dequeue(&sk->sk_receive_queue))) { + if (audit_receive_skb(skb) && skb->len) + skb_queue_head(&sk->sk_receive_queue, skb); + else + kfree_skb(skb); } up(&audit_netlink_sem); } diff --git a/trunk/net/core/link_watch.c b/trunk/net/core/link_watch.c index d43d1201275c..4859b7446c6f 100644 --- a/trunk/net/core/link_watch.c +++ b/trunk/net/core/link_watch.c @@ -16,7 +16,6 @@ #include #include #include -#include #include #include #include @@ -75,12 +74,6 @@ void linkwatch_run_queue(void) clear_bit(__LINK_STATE_LINKWATCH_PENDING, &dev->state); if (dev->flags & IFF_UP) { - if (netif_carrier_ok(dev)) { - WARN_ON(dev->qdisc_sleeping == &noop_qdisc); - dev_activate(dev); - } else - dev_deactivate(dev); - netdev_state_change(dev); } diff --git a/trunk/net/core/netfilter.c b/trunk/net/core/netfilter.c index 22a8f127c4aa..e51cfa46950c 100644 --- a/trunk/net/core/netfilter.c +++ b/trunk/net/core/netfilter.c @@ -217,10 +217,21 @@ void nf_debug_ip_local_deliver(struct sk_buff *skb) * NF_IP_RAW_INPUT and NF_IP_PRE_ROUTING. */ if (!skb->dev) { printk("ip_local_deliver: skb->dev is NULL.\n"); - } else { + } + else if (strcmp(skb->dev->name, "lo") == 0) { + if (skb->nf_debug != ((1 << NF_IP_LOCAL_OUT) + | (1 << NF_IP_POST_ROUTING) + | (1 << NF_IP_PRE_ROUTING) + | (1 << NF_IP_LOCAL_IN))) { + printk("ip_local_deliver: bad loopback skb: "); + debug_print_hooks_ip(skb->nf_debug); + nf_dump_skb(PF_INET, skb); + } + } + else { if (skb->nf_debug != ((1<nf_debug); nf_dump_skb(PF_INET, skb); } @@ -236,6 +247,8 @@ void nf_debug_ip_loopback_xmit(struct sk_buff *newskb) debug_print_hooks_ip(newskb->nf_debug); nf_dump_skb(PF_INET, newskb); } + /* Clear to avoid confusing input check */ + newskb->nf_debug = 0; } void nf_debug_ip_finish_output2(struct sk_buff *skb) diff --git a/trunk/net/core/rtnetlink.c b/trunk/net/core/rtnetlink.c index 00caf4b318b2..d8c198e42f90 100644 --- a/trunk/net/core/rtnetlink.c +++ b/trunk/net/core/rtnetlink.c @@ -86,33 +86,30 @@ struct sock *rtnl; struct rtnetlink_link * rtnetlink_links[NPROTO]; -static const int rtm_min[RTM_NR_FAMILIES] = +static const int rtm_min[(RTM_MAX+1-RTM_BASE)/4] = { - [RTM_FAM(RTM_NEWLINK)] = NLMSG_LENGTH(sizeof(struct ifinfomsg)), - [RTM_FAM(RTM_NEWADDR)] = NLMSG_LENGTH(sizeof(struct ifaddrmsg)), - [RTM_FAM(RTM_NEWROUTE)] = NLMSG_LENGTH(sizeof(struct rtmsg)), - [RTM_FAM(RTM_NEWNEIGH)] = NLMSG_LENGTH(sizeof(struct ndmsg)), - [RTM_FAM(RTM_NEWRULE)] = NLMSG_LENGTH(sizeof(struct rtmsg)), - [RTM_FAM(RTM_NEWQDISC)] = NLMSG_LENGTH(sizeof(struct tcmsg)), - [RTM_FAM(RTM_NEWTCLASS)] = NLMSG_LENGTH(sizeof(struct tcmsg)), - [RTM_FAM(RTM_NEWTFILTER)] = NLMSG_LENGTH(sizeof(struct tcmsg)), - [RTM_FAM(RTM_NEWACTION)] = NLMSG_LENGTH(sizeof(struct tcamsg)), - [RTM_FAM(RTM_NEWPREFIX)] = NLMSG_LENGTH(sizeof(struct rtgenmsg)), - [RTM_FAM(RTM_GETMULTICAST)] = NLMSG_LENGTH(sizeof(struct rtgenmsg)), - [RTM_FAM(RTM_GETANYCAST)] = NLMSG_LENGTH(sizeof(struct rtgenmsg)), + NLMSG_LENGTH(sizeof(struct ifinfomsg)), + NLMSG_LENGTH(sizeof(struct ifaddrmsg)), + NLMSG_LENGTH(sizeof(struct rtmsg)), + NLMSG_LENGTH(sizeof(struct ndmsg)), + NLMSG_LENGTH(sizeof(struct rtmsg)), + NLMSG_LENGTH(sizeof(struct tcmsg)), + NLMSG_LENGTH(sizeof(struct tcmsg)), + NLMSG_LENGTH(sizeof(struct tcmsg)), + NLMSG_LENGTH(sizeof(struct tcamsg)) }; -static const int rta_max[RTM_NR_FAMILIES] = +static const int rta_max[(RTM_MAX+1-RTM_BASE)/4] = { - [RTM_FAM(RTM_NEWLINK)] = IFLA_MAX, - [RTM_FAM(RTM_NEWADDR)] = IFA_MAX, - [RTM_FAM(RTM_NEWROUTE)] = RTA_MAX, - [RTM_FAM(RTM_NEWNEIGH)] = NDA_MAX, - [RTM_FAM(RTM_NEWRULE)] = RTA_MAX, - [RTM_FAM(RTM_NEWQDISC)] = TCA_MAX, - [RTM_FAM(RTM_NEWTCLASS)] = TCA_MAX, - [RTM_FAM(RTM_NEWTFILTER)] = TCA_MAX, - [RTM_FAM(RTM_NEWACTION)] = TCAA_MAX, + IFLA_MAX, + IFA_MAX, + RTA_MAX, + NDA_MAX, + RTA_MAX, + TCA_MAX, + TCA_MAX, + TCA_MAX, + TCAA_MAX }; void __rta_fill(struct sk_buff *skb, int attrtype, int attrlen, const void *data) @@ -609,33 +606,27 @@ static inline int rtnetlink_rcv_skb(struct sk_buff *skb) /* * rtnetlink input queue processing routine: - * - process as much as there was in the queue upon entry. + * - try to acquire shared lock. If it is failed, defer processing. * - feed skbs to rtnetlink_rcv_skb, until it refuse a message, - * that will occur, when a dump started. + * that will occur, when a dump started and/or acquisition of + * exclusive lock failed. */ static void rtnetlink_rcv(struct sock *sk, int len) { - unsigned int qlen = skb_queue_len(&sk->sk_receive_queue); - do { struct sk_buff *skb; - rtnl_lock(); - - if (qlen > skb_queue_len(&sk->sk_receive_queue)) - qlen = skb_queue_len(&sk->sk_receive_queue); + if (rtnl_shlock_nowait()) + return; - for (; qlen; qlen--) { - skb = skb_dequeue(&sk->sk_receive_queue); + while ((skb = skb_dequeue(&sk->sk_receive_queue)) != NULL) { if (rtnetlink_rcv_skb(skb)) { if (skb->len) skb_queue_head(&sk->sk_receive_queue, skb); - else { + else kfree_skb(skb); - qlen--; - } break; } kfree_skb(skb); @@ -644,10 +635,10 @@ static void rtnetlink_rcv(struct sock *sk, int len) up(&rtnl_sem); netdev_run_todo(); - } while (qlen); + } while (rtnl && rtnl->sk_receive_queue.qlen); } -static struct rtnetlink_link link_rtnetlink_table[RTM_NR_MSGTYPES] = +static struct rtnetlink_link link_rtnetlink_table[RTM_MAX-RTM_BASE+1] = { [RTM_GETLINK - RTM_BASE] = { .dumpit = rtnetlink_dump_ifinfo }, [RTM_SETLINK - RTM_BASE] = { .doit = do_setlink }, diff --git a/trunk/net/decnet/dn_dev.c b/trunk/net/decnet/dn_dev.c index e6e23eb14428..c2a0346f423b 100644 --- a/trunk/net/decnet/dn_dev.c +++ b/trunk/net/decnet/dn_dev.c @@ -1411,22 +1411,21 @@ static struct file_operations dn_dev_seq_fops = { #endif /* CONFIG_PROC_FS */ -static struct rtnetlink_link dnet_rtnetlink_table[RTM_NR_MSGTYPES] = +static struct rtnetlink_link dnet_rtnetlink_table[RTM_MAX-RTM_BASE+1] = { - [RTM_NEWADDR - RTM_BASE] = { .doit = dn_dev_rtm_newaddr, }, - [RTM_DELADDR - RTM_BASE] = { .doit = dn_dev_rtm_deladdr, }, - [RTM_GETADDR - RTM_BASE] = { .dumpit = dn_dev_dump_ifaddr, }, + [4] = { .doit = dn_dev_rtm_newaddr, }, + [5] = { .doit = dn_dev_rtm_deladdr, }, + [6] = { .dumpit = dn_dev_dump_ifaddr, }, + #ifdef CONFIG_DECNET_ROUTER - [RTM_NEWROUTE - RTM_BASE] = { .doit = dn_fib_rtm_newroute, }, - [RTM_DELROUTE - RTM_BASE] = { .doit = dn_fib_rtm_delroute, }, - [RTM_GETROUTE - RTM_BASE] = { .doit = dn_cache_getroute, - .dumpit = dn_fib_dump, }, - [RTM_NEWRULE - RTM_BASE] = { .doit = dn_fib_rtm_newrule, }, - [RTM_DELRULE - RTM_BASE] = { .doit = dn_fib_rtm_delrule, }, - [RTM_GETRULE - RTM_BASE] = { .dumpit = dn_fib_dump_rules, }, + [8] = { .doit = dn_fib_rtm_newroute, }, + [9] = { .doit = dn_fib_rtm_delroute, }, + [10] = { .doit = dn_cache_getroute, .dumpit = dn_fib_dump, }, + [16] = { .doit = dn_fib_rtm_newrule, }, + [17] = { .doit = dn_fib_rtm_delrule, }, + [18] = { .dumpit = dn_fib_dump_rules, }, #else - [RTM_GETROUTE - RTM_BASE] = { .doit = dn_cache_getroute, - .dumpit = dn_cache_dump, + [10] = { .doit = dn_cache_getroute, .dumpit = dn_cache_dump, }, #endif }; diff --git a/trunk/net/decnet/netfilter/dn_rtmsg.c b/trunk/net/decnet/netfilter/dn_rtmsg.c index 284a9998e53d..f86a6259fd12 100644 --- a/trunk/net/decnet/netfilter/dn_rtmsg.c +++ b/trunk/net/decnet/netfilter/dn_rtmsg.c @@ -119,9 +119,8 @@ static inline void dnrmg_receive_user_skb(struct sk_buff *skb) static void dnrmg_receive_user_sk(struct sock *sk, int len) { struct sk_buff *skb; - unsigned int qlen = skb_queue_len(&sk->sk_receive_queue); - for (; qlen && (skb = skb_dequeue(&sk->sk_receive_queue)); qlen--) { + while((skb = skb_dequeue(&sk->sk_receive_queue)) != NULL) { dnrmg_receive_user_skb(skb); kfree_skb(skb); } diff --git a/trunk/net/ipv4/devinet.c b/trunk/net/ipv4/devinet.c index abbc6d5c183e..eea7ef010776 100644 --- a/trunk/net/ipv4/devinet.c +++ b/trunk/net/ipv4/devinet.c @@ -1107,18 +1107,17 @@ static void rtmsg_ifa(int event, struct in_ifaddr* ifa) } } -static struct rtnetlink_link inet_rtnetlink_table[RTM_NR_MSGTYPES] = { - [RTM_NEWADDR - RTM_BASE] = { .doit = inet_rtm_newaddr, }, - [RTM_DELADDR - RTM_BASE] = { .doit = inet_rtm_deladdr, }, - [RTM_GETADDR - RTM_BASE] = { .dumpit = inet_dump_ifaddr, }, - [RTM_NEWROUTE - RTM_BASE] = { .doit = inet_rtm_newroute, }, - [RTM_DELROUTE - RTM_BASE] = { .doit = inet_rtm_delroute, }, - [RTM_GETROUTE - RTM_BASE] = { .doit = inet_rtm_getroute, - .dumpit = inet_dump_fib, }, +static struct rtnetlink_link inet_rtnetlink_table[RTM_MAX - RTM_BASE + 1] = { + [4] = { .doit = inet_rtm_newaddr, }, + [5] = { .doit = inet_rtm_deladdr, }, + [6] = { .dumpit = inet_dump_ifaddr, }, + [8] = { .doit = inet_rtm_newroute, }, + [9] = { .doit = inet_rtm_delroute, }, + [10] = { .doit = inet_rtm_getroute, .dumpit = inet_dump_fib, }, #ifdef CONFIG_IP_MULTIPLE_TABLES - [RTM_NEWRULE - RTM_BASE] = { .doit = inet_rtm_newrule, }, - [RTM_DELRULE - RTM_BASE] = { .doit = inet_rtm_delrule, }, - [RTM_GETRULE - RTM_BASE] = { .dumpit = inet_dump_rules, }, + [16] = { .doit = inet_rtm_newrule, }, + [17] = { .doit = inet_rtm_delrule, }, + [18] = { .dumpit = inet_dump_rules, }, #endif }; diff --git a/trunk/net/ipv4/ip_output.c b/trunk/net/ipv4/ip_output.c index 24fe3e00b42b..38f69532a029 100644 --- a/trunk/net/ipv4/ip_output.c +++ b/trunk/net/ipv4/ip_output.c @@ -111,7 +111,6 @@ static int ip_dev_loopback_xmit(struct sk_buff *newskb) #ifdef CONFIG_NETFILTER_DEBUG nf_debug_ip_loopback_xmit(newskb); #endif - nf_reset(newskb); netif_rx(newskb); return 0; } diff --git a/trunk/net/ipv4/netfilter/ip_conntrack_proto_tcp.c b/trunk/net/ipv4/netfilter/ip_conntrack_proto_tcp.c index 721ddbf522b4..2b87c1974be6 100644 --- a/trunk/net/ipv4/netfilter/ip_conntrack_proto_tcp.c +++ b/trunk/net/ipv4/netfilter/ip_conntrack_proto_tcp.c @@ -819,7 +819,6 @@ static int tcp_error(struct sk_buff *skb, */ /* FIXME: Source route IP option packets --RR */ if (hooknum == NF_IP_PRE_ROUTING - && skb->ip_summed != CHECKSUM_UNNECESSARY && csum_tcpudp_magic(iph->saddr, iph->daddr, tcplen, IPPROTO_TCP, skb->ip_summed == CHECKSUM_HW ? skb->csum : skb_checksum(skb, iph->ihl*4, tcplen, 0))) { diff --git a/trunk/net/ipv4/netfilter/ip_queue.c b/trunk/net/ipv4/netfilter/ip_queue.c index e5746b674413..9e40dffc204f 100644 --- a/trunk/net/ipv4/netfilter/ip_queue.c +++ b/trunk/net/ipv4/netfilter/ip_queue.c @@ -546,18 +546,20 @@ ipq_rcv_skb(struct sk_buff *skb) static void ipq_rcv_sk(struct sock *sk, int len) { - struct sk_buff *skb; - unsigned int qlen; + do { + struct sk_buff *skb; - down(&ipqnl_sem); + if (down_trylock(&ipqnl_sem)) + return; - for (qlen = skb_queue_len(&sk->sk_receive_queue); qlen; qlen--) { - skb = skb_dequeue(&sk->sk_receive_queue); - ipq_rcv_skb(skb); - kfree_skb(skb); - } + while ((skb = skb_dequeue(&sk->sk_receive_queue)) != NULL) { + ipq_rcv_skb(skb); + kfree_skb(skb); + } - up(&ipqnl_sem); + up(&ipqnl_sem); + + } while (ipqnl && ipqnl->sk_receive_queue.qlen); } static int diff --git a/trunk/net/ipv4/netfilter/iptable_raw.c b/trunk/net/ipv4/netfilter/iptable_raw.c index 47449ba83eb9..01b4a3c814d3 100644 --- a/trunk/net/ipv4/netfilter/iptable_raw.c +++ b/trunk/net/ipv4/netfilter/iptable_raw.c @@ -103,15 +103,13 @@ static struct nf_hook_ops ipt_ops[] = { .hook = ipt_hook, .pf = PF_INET, .hooknum = NF_IP_PRE_ROUTING, - .priority = NF_IP_PRI_RAW, - .owner = THIS_MODULE, + .priority = NF_IP_PRI_RAW }, { .hook = ipt_hook, .pf = PF_INET, .hooknum = NF_IP_LOCAL_OUT, - .priority = NF_IP_PRI_RAW, - .owner = THIS_MODULE, + .priority = NF_IP_PRI_RAW }, }; diff --git a/trunk/net/ipv4/tcp_diag.c b/trunk/net/ipv4/tcp_diag.c index 8faa8948f75c..313c1408da33 100644 --- a/trunk/net/ipv4/tcp_diag.c +++ b/trunk/net/ipv4/tcp_diag.c @@ -777,9 +777,8 @@ static inline void tcpdiag_rcv_skb(struct sk_buff *skb) static void tcpdiag_rcv(struct sock *sk, int len) { struct sk_buff *skb; - unsigned int qlen = skb_queue_len(&sk->sk_receive_queue); - while (qlen-- && (skb = skb_dequeue(&sk->sk_receive_queue))) { + while ((skb = skb_dequeue(&sk->sk_receive_queue)) != NULL) { tcpdiag_rcv_skb(skb); kfree_skb(skb); } diff --git a/trunk/net/ipv4/tcp_ipv4.c b/trunk/net/ipv4/tcp_ipv4.c index dad98e4a5043..3ac6659869c4 100644 --- a/trunk/net/ipv4/tcp_ipv4.c +++ b/trunk/net/ipv4/tcp_ipv4.c @@ -222,13 +222,10 @@ static int tcp_v4_get_port(struct sock *sk, unsigned short snum) int rover; spin_lock(&tcp_portalloc_lock); - if (tcp_port_rover < low) - rover = low; - else - rover = tcp_port_rover; + rover = tcp_port_rover; do { rover++; - if (rover > high) + if (rover < low || rover > high) rover = low; head = &tcp_bhash[tcp_bhashfn(rover)]; spin_lock(&head->lock); diff --git a/trunk/net/ipv4/xfrm4_policy.c b/trunk/net/ipv4/xfrm4_policy.c index b2b60f3e9cdd..7fe2afd2e669 100644 --- a/trunk/net/ipv4/xfrm4_policy.c +++ b/trunk/net/ipv4/xfrm4_policy.c @@ -8,10 +8,7 @@ * */ -#include -#include #include -#include #include #include @@ -155,8 +152,6 @@ __xfrm4_bundle_create(struct xfrm_policy *policy, struct xfrm_state **xfrm, int x->u.rt.rt_dst = rt0->rt_dst; x->u.rt.rt_gateway = rt->rt_gateway; x->u.rt.rt_spec_dst = rt0->rt_spec_dst; - x->u.rt.idev = rt0->idev; - in_dev_hold(rt0->idev); header_len -= x->u.dst.xfrm->props.header_len; trailer_len -= x->u.dst.xfrm->props.trailer_len; } @@ -248,48 +243,11 @@ static void xfrm4_update_pmtu(struct dst_entry *dst, u32 mtu) path->ops->update_pmtu(path, mtu); } -static void xfrm4_dst_destroy(struct dst_entry *dst) -{ - struct xfrm_dst *xdst = (struct xfrm_dst *)dst; - - if (likely(xdst->u.rt.idev)) - in_dev_put(xdst->u.rt.idev); - xfrm_dst_destroy(xdst); -} - -static void xfrm4_dst_ifdown(struct dst_entry *dst, struct net_device *dev, - int unregister) -{ - struct xfrm_dst *xdst; - - if (!unregister) - return; - - xdst = (struct xfrm_dst *)dst; - if (xdst->u.rt.idev->dev == dev) { - struct in_device *loopback_idev = in_dev_get(&loopback_dev); - BUG_ON(!loopback_idev); - - do { - in_dev_put(xdst->u.rt.idev); - xdst->u.rt.idev = loopback_idev; - in_dev_hold(loopback_idev); - xdst = (struct xfrm_dst *)xdst->u.dst.child; - } while (xdst->u.dst.xfrm); - - __in_dev_put(loopback_idev); - } - - xfrm_dst_ifdown(dst, dev); -} - static struct dst_ops xfrm4_dst_ops = { .family = AF_INET, .protocol = __constant_htons(ETH_P_IP), .gc = xfrm4_garbage_collect, .update_pmtu = xfrm4_update_pmtu, - .destroy = xfrm4_dst_destroy, - .ifdown = xfrm4_dst_ifdown, .gc_thresh = 1024, .entry_size = sizeof(struct xfrm_dst), }; diff --git a/trunk/net/ipv6/addrconf.c b/trunk/net/ipv6/addrconf.c index 7744a2592693..7196ac2f2d16 100644 --- a/trunk/net/ipv6/addrconf.c +++ b/trunk/net/ipv6/addrconf.c @@ -3076,7 +3076,7 @@ static void inet6_prefix_notify(int event, struct inet6_dev *idev, netlink_broadcast(rtnl, skb, 0, RTMGRP_IPV6_PREFIX, GFP_ATOMIC); } -static struct rtnetlink_link inet6_rtnetlink_table[RTM_NR_MSGTYPES] = { +static struct rtnetlink_link inet6_rtnetlink_table[RTM_MAX - RTM_BASE + 1] = { [RTM_GETLINK - RTM_BASE] = { .dumpit = inet6_dump_ifinfo, }, [RTM_NEWADDR - RTM_BASE] = { .doit = inet6_rtm_newaddr, }, [RTM_DELADDR - RTM_BASE] = { .doit = inet6_rtm_deladdr, }, diff --git a/trunk/net/ipv6/netfilter/ip6_queue.c b/trunk/net/ipv6/netfilter/ip6_queue.c index 750943e2d34e..c54830b89593 100644 --- a/trunk/net/ipv6/netfilter/ip6_queue.c +++ b/trunk/net/ipv6/netfilter/ip6_queue.c @@ -549,18 +549,20 @@ ipq_rcv_skb(struct sk_buff *skb) static void ipq_rcv_sk(struct sock *sk, int len) { - struct sk_buff *skb; - unsigned int qlen; + do { + struct sk_buff *skb; - down(&ipqnl_sem); + if (down_trylock(&ipqnl_sem)) + return; - for (qlen = skb_queue_len(&sk->sk_receive_queue); qlen; qlen--) { - skb = skb_dequeue(&sk->sk_receive_queue); - ipq_rcv_skb(skb); - kfree_skb(skb); - } + while ((skb = skb_dequeue(&sk->sk_receive_queue)) != NULL) { + ipq_rcv_skb(skb); + kfree_skb(skb); + } - up(&ipqnl_sem); + up(&ipqnl_sem); + + } while (ipqnl && ipqnl->sk_receive_queue.qlen); } static int diff --git a/trunk/net/ipv6/raw.c b/trunk/net/ipv6/raw.c index 617645bc5ed6..1352c1d9bf4d 100644 --- a/trunk/net/ipv6/raw.c +++ b/trunk/net/ipv6/raw.c @@ -455,11 +455,11 @@ static int rawv6_recvmsg(struct kiocb *iocb, struct sock *sk, static int rawv6_push_pending_frames(struct sock *sk, struct flowi *fl, struct raw6_sock *rp) { + struct inet_sock *inet = inet_sk(sk); struct sk_buff *skb; int err = 0; int offset; int len; - int total_len; u32 tmp_csum; u16 csum; @@ -470,8 +470,7 @@ static int rawv6_push_pending_frames(struct sock *sk, struct flowi *fl, goto out; offset = rp->offset; - total_len = inet_sk(sk)->cork.length - (skb->nh.raw - skb->data); - if (offset >= total_len - 1) { + if (offset >= inet->cork.length - 1) { err = -EINVAL; ip6_flush_pending_frames(sk); goto out; @@ -515,7 +514,7 @@ static int rawv6_push_pending_frames(struct sock *sk, struct flowi *fl, tmp_csum = csum_ipv6_magic(&fl->fl6_src, &fl->fl6_dst, - total_len, fl->proto, tmp_csum); + inet->cork.length, fl->proto, tmp_csum); if (tmp_csum == 0) tmp_csum = -1; diff --git a/trunk/net/ipv6/tcp_ipv6.c b/trunk/net/ipv6/tcp_ipv6.c index 0f69e800a0ad..4760c85e19db 100644 --- a/trunk/net/ipv6/tcp_ipv6.c +++ b/trunk/net/ipv6/tcp_ipv6.c @@ -139,12 +139,9 @@ static int tcp_v6_get_port(struct sock *sk, unsigned short snum) int rover; spin_lock(&tcp_portalloc_lock); - if (tcp_port_rover < low) - rover = low; - else - rover = tcp_port_rover; + rover = tcp_port_rover; do { rover++; - if (rover > high) + if ((rover < low) || (rover > high)) rover = low; head = &tcp_bhash[tcp_bhashfn(rover)]; spin_lock(&head->lock); diff --git a/trunk/net/ipv6/xfrm6_policy.c b/trunk/net/ipv6/xfrm6_policy.c index 4429b1a1fe5f..8a4f37de4d2d 100644 --- a/trunk/net/ipv6/xfrm6_policy.c +++ b/trunk/net/ipv6/xfrm6_policy.c @@ -11,11 +11,7 @@ * */ -#include -#include #include -#include -#include #include #include #include @@ -170,8 +166,6 @@ __xfrm6_bundle_create(struct xfrm_policy *policy, struct xfrm_state **xfrm, int memcpy(&x->u.rt6.rt6i_gateway, &rt0->rt6i_gateway, sizeof(x->u.rt6.rt6i_gateway)); x->u.rt6.rt6i_dst = rt0->rt6i_dst; x->u.rt6.rt6i_src = rt0->rt6i_src; - x->u.rt6.rt6i_idev = rt0->rt6i_idev; - in6_dev_hold(rt0->rt6i_idev); header_len -= x->u.dst.xfrm->props.header_len; trailer_len -= x->u.dst.xfrm->props.trailer_len; } @@ -257,48 +251,11 @@ static void xfrm6_update_pmtu(struct dst_entry *dst, u32 mtu) path->ops->update_pmtu(path, mtu); } -static void xfrm6_dst_destroy(struct dst_entry *dst) -{ - struct xfrm_dst *xdst = (struct xfrm_dst *)dst; - - if (likely(xdst->u.rt6.rt6i_idev)) - in6_dev_put(xdst->u.rt6.rt6i_idev); - xfrm_dst_destroy(xdst); -} - -static void xfrm6_dst_ifdown(struct dst_entry *dst, struct net_device *dev, - int unregister) -{ - struct xfrm_dst *xdst; - - if (!unregister) - return; - - xdst = (struct xfrm_dst *)dst; - if (xdst->u.rt6.rt6i_idev->dev == dev) { - struct inet6_dev *loopback_idev = in6_dev_get(&loopback_dev); - BUG_ON(!loopback_idev); - - do { - in6_dev_put(xdst->u.rt6.rt6i_idev); - xdst->u.rt6.rt6i_idev = loopback_idev; - in6_dev_hold(loopback_idev); - xdst = (struct xfrm_dst *)xdst->u.dst.child; - } while (xdst->u.dst.xfrm); - - __in6_dev_put(loopback_idev); - } - - xfrm_dst_ifdown(dst, dev); -} - static struct dst_ops xfrm6_dst_ops = { .family = AF_INET6, .protocol = __constant_htons(ETH_P_IPV6), .gc = xfrm6_garbage_collect, .update_pmtu = xfrm6_update_pmtu, - .destroy = xfrm6_dst_destroy, - .ifdown = xfrm6_dst_ifdown, .gc_thresh = 1024, .entry_size = sizeof(struct xfrm_dst), }; diff --git a/trunk/net/irda/irda_device.c b/trunk/net/irda/irda_device.c index 70543d89438b..d6ccd3239dcf 100644 --- a/trunk/net/irda/irda_device.c +++ b/trunk/net/irda/irda_device.c @@ -470,7 +470,6 @@ void irda_device_unregister_dongle(struct dongle_reg *dongle) } EXPORT_SYMBOL(irda_device_unregister_dongle); -#ifdef CONFIG_ISA_DMA_API /* * Function setup_dma (idev, buffer, count, mode) * @@ -493,4 +492,3 @@ void irda_setup_dma(int channel, dma_addr_t buffer, int count, int mode) release_dma_lock(flags); } EXPORT_SYMBOL(irda_setup_dma); -#endif diff --git a/trunk/net/netlink/af_netlink.c b/trunk/net/netlink/af_netlink.c index 4ee392066148..29a5fd231eac 100644 --- a/trunk/net/netlink/af_netlink.c +++ b/trunk/net/netlink/af_netlink.c @@ -373,6 +373,7 @@ static int netlink_release(struct socket *sock) nlk->cb->done(nlk->cb); netlink_destroy_callback(nlk->cb); nlk->cb = NULL; + __sock_put(sk); } spin_unlock(&nlk->cb_lock); @@ -1098,6 +1099,7 @@ static int netlink_dump(struct sock *sk) spin_unlock(&nlk->cb_lock); netlink_destroy_callback(cb); + __sock_put(sk); return 0; } @@ -1136,6 +1138,7 @@ int netlink_dump_start(struct sock *ssk, struct sk_buff *skb, return -EBUSY; } nlk->cb = cb; + sock_hold(sk); spin_unlock(&nlk->cb_lock); netlink_dump(sk); diff --git a/trunk/net/sched/Kconfig b/trunk/net/sched/Kconfig index b0941186f867..9c118baed9dc 100644 --- a/trunk/net/sched/Kconfig +++ b/trunk/net/sched/Kconfig @@ -185,7 +185,7 @@ config NET_SCH_GRED depends on NET_SCHED help Say Y here if you want to use the Generic Random Early Detection - (GRED) packet scheduling algorithm for some of your network devices + (RED) packet scheduling algorithm for some of your network devices (see the top of for details and references about the algorithm). diff --git a/trunk/net/sched/act_api.c b/trunk/net/sched/act_api.c index cafcb084098d..5e6cc371b39e 100644 --- a/trunk/net/sched/act_api.c +++ b/trunk/net/sched/act_api.c @@ -171,10 +171,10 @@ int tcf_action_exec(struct sk_buff *skb, struct tc_action *act, skb->tc_verd = SET_TC_OK2MUNGE(skb->tc_verd); skb->tc_verd = CLR_TC_MUNGED(skb->tc_verd); } - if (ret == TC_ACT_REPEAT) - goto repeat; /* we need a ttl - JHS */ if (ret != TC_ACT_PIPE) goto exec_done; + if (ret == TC_ACT_REPEAT) + goto repeat; /* we need a ttl - JHS */ } act = a->next; } diff --git a/trunk/net/sched/sch_api.c b/trunk/net/sched/sch_api.c index 07977f8f2679..4323a74eea30 100644 --- a/trunk/net/sched/sch_api.c +++ b/trunk/net/sched/sch_api.c @@ -1289,7 +1289,6 @@ static int __init pktsched_init(void) subsys_initcall(pktsched_init); -EXPORT_SYMBOL(qdisc_lookup); EXPORT_SYMBOL(qdisc_get_rtab); EXPORT_SYMBOL(qdisc_put_rtab); EXPORT_SYMBOL(register_qdisc); diff --git a/trunk/net/sched/sch_generic.c b/trunk/net/sched/sch_generic.c index 87e48a4e1051..8c01e023f02e 100644 --- a/trunk/net/sched/sch_generic.c +++ b/trunk/net/sched/sch_generic.c @@ -179,7 +179,6 @@ int qdisc_restart(struct net_device *dev) netif_schedule(dev); return 1; } - BUG_ON((int) q->q.qlen < 0); return q->q.qlen; } @@ -540,10 +539,6 @@ void dev_activate(struct net_device *dev) write_unlock_bh(&qdisc_tree_lock); } - if (!netif_carrier_ok(dev)) - /* Delay activation until next carrier-on event */ - return; - spin_lock_bh(&dev->queue_lock); rcu_assign_pointer(dev->qdisc, dev->qdisc_sleeping); if (dev->qdisc != &noqueue_qdisc) { diff --git a/trunk/net/sched/sch_htb.c b/trunk/net/sched/sch_htb.c index 558cc087e602..a85935e7d53d 100644 --- a/trunk/net/sched/sch_htb.c +++ b/trunk/net/sched/sch_htb.c @@ -717,10 +717,6 @@ static int htb_enqueue(struct sk_buff *skb, struct Qdisc *sch) if (q->direct_queue.qlen < q->direct_qlen) { __skb_queue_tail(&q->direct_queue, skb); q->direct_pkts++; - } else { - kfree_skb(skb); - sch->qstats.drops++; - return NET_XMIT_DROP; } #ifdef CONFIG_NET_CLS_ACT } else if (!cl) { diff --git a/trunk/net/sched/sch_netem.c b/trunk/net/sched/sch_netem.c index e0c9fbe73b15..31c29deb139d 100644 --- a/trunk/net/sched/sch_netem.c +++ b/trunk/net/sched/sch_netem.c @@ -138,77 +138,38 @@ static long tabledist(unsigned long mu, long sigma, } /* Put skb in the private delayed queue. */ -static int netem_delay(struct Qdisc *sch, struct sk_buff *skb) +static int delay_skb(struct Qdisc *sch, struct sk_buff *skb) { struct netem_sched_data *q = qdisc_priv(sch); + struct netem_skb_cb *cb = (struct netem_skb_cb *)skb->cb; psched_tdiff_t td; psched_time_t now; PSCHED_GET_TIME(now); td = tabledist(q->latency, q->jitter, &q->delay_cor, q->delay_dist); + PSCHED_TADD2(now, td, cb->time_to_send); /* Always queue at tail to keep packets in order */ if (likely(q->delayed.qlen < q->limit)) { - struct netem_skb_cb *cb = (struct netem_skb_cb *)skb->cb; - - PSCHED_TADD2(now, td, cb->time_to_send); - - pr_debug("netem_delay: skb=%p now=%llu tosend=%llu\n", skb, - now, cb->time_to_send); - __skb_queue_tail(&q->delayed, skb); + if (!timer_pending(&q->timer)) { + q->timer.expires = jiffies + PSCHED_US2JIFFIE(td); + add_timer(&q->timer); + } return NET_XMIT_SUCCESS; } - pr_debug("netem_delay: queue over limit %d\n", q->limit); - sch->qstats.overlimits++; kfree_skb(skb); return NET_XMIT_DROP; } -/* - * Move a packet that is ready to send from the delay holding - * list to the underlying qdisc. - */ -static int netem_run(struct Qdisc *sch) -{ - struct netem_sched_data *q = qdisc_priv(sch); - struct sk_buff *skb; - psched_time_t now; - - PSCHED_GET_TIME(now); - - skb = skb_peek(&q->delayed); - if (skb) { - const struct netem_skb_cb *cb - = (const struct netem_skb_cb *)skb->cb; - long delay - = PSCHED_US2JIFFIE(PSCHED_TDIFF(cb->time_to_send, now)); - pr_debug("netem_run: skb=%p delay=%ld\n", skb, delay); - - /* if more time remaining? */ - if (delay > 0) { - mod_timer(&q->timer, jiffies + delay); - return 1; - } - - __skb_unlink(skb, &q->delayed); - - if (q->qdisc->enqueue(skb, q->qdisc)) { - sch->q.qlen--; - sch->qstats.drops++; - } - } - - return 0; -} - static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch) { struct netem_sched_data *q = qdisc_priv(sch); + struct sk_buff *skb2; int ret; - pr_debug("netem_enqueue skb=%p\n", skb); + pr_debug("netem_enqueue skb=%p @%lu\n", skb, jiffies); /* Random packet drop 0 => none, ~0 => all */ if (q->loss && q->loss >= get_crandom(&q->loss_cor)) { @@ -219,21 +180,11 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch) } /* Random duplication */ - if (q->duplicate && q->duplicate >= get_crandom(&q->dup_cor)) { - struct sk_buff *skb2; - - skb2 = skb_clone(skb, GFP_ATOMIC); - if (skb2 && netem_delay(sch, skb2) == NET_XMIT_SUCCESS) { - struct Qdisc *qp; - - /* Since one packet can generate two packets in the - * queue, the parent's qlen accounting gets confused, - * so fix it. - */ - qp = qdisc_lookup(sch->dev, TC_H_MAJ(sch->parent)); - if (qp) - qp->q.qlen++; + if (q->duplicate && q->duplicate >= get_crandom(&q->dup_cor) + && (skb2 = skb_clone(skb, GFP_ATOMIC)) != NULL) { + pr_debug("netem_enqueue: dup %p\n", skb2); + if (delay_skb(sch, skb2)) { sch->q.qlen++; sch->bstats.bytes += skb2->len; sch->bstats.packets++; @@ -251,8 +202,7 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch) ret = q->qdisc->enqueue(skb, q->qdisc); } else { q->counter = 0; - ret = netem_delay(sch, skb); - netem_run(sch); + ret = delay_skb(sch, skb); } if (likely(ret == NET_XMIT_SUCCESS)) { @@ -262,7 +212,6 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch) } else sch->qstats.drops++; - pr_debug("netem: enqueue ret %d\n", ret); return ret; } @@ -292,35 +241,56 @@ static unsigned int netem_drop(struct Qdisc* sch) return len; } +/* Dequeue packet. + * Move all packets that are ready to send from the delay holding + * list to the underlying qdisc, then just call dequeue + */ static struct sk_buff *netem_dequeue(struct Qdisc *sch) { struct netem_sched_data *q = qdisc_priv(sch); struct sk_buff *skb; - int pending; - - pending = netem_run(sch); skb = q->qdisc->dequeue(q->qdisc); - if (skb) { - pr_debug("netem_dequeue: return skb=%p\n", skb); + if (skb) sch->q.qlen--; - sch->flags &= ~TCQ_F_THROTTLED; - } - else if (pending) { - pr_debug("netem_dequeue: throttling\n"); - sch->flags |= TCQ_F_THROTTLED; - } - return skb; } static void netem_watchdog(unsigned long arg) { struct Qdisc *sch = (struct Qdisc *)arg; + struct netem_sched_data *q = qdisc_priv(sch); + struct net_device *dev = sch->dev; + struct sk_buff *skb; + psched_time_t now; + + pr_debug("netem_watchdog: fired @%lu\n", jiffies); + + spin_lock_bh(&dev->queue_lock); + PSCHED_GET_TIME(now); + + while ((skb = skb_peek(&q->delayed)) != NULL) { + const struct netem_skb_cb *cb + = (const struct netem_skb_cb *)skb->cb; + long delay + = PSCHED_US2JIFFIE(PSCHED_TDIFF(cb->time_to_send, now)); + pr_debug("netem_watchdog: skb %p@%lu %ld\n", + skb, jiffies, delay); - pr_debug("netem_watchdog qlen=%d\n", sch->q.qlen); - sch->flags &= ~TCQ_F_THROTTLED; - netif_schedule(sch->dev); + /* if more time remaining? */ + if (delay > 0) { + mod_timer(&q->timer, jiffies + delay); + break; + } + __skb_unlink(skb, &q->delayed); + + if (q->qdisc->enqueue(skb, q->qdisc)) { + sch->q.qlen--; + sch->qstats.drops++; + } + } + qdisc_run(dev); + spin_unlock_bh(&dev->queue_lock); } static void netem_reset(struct Qdisc *sch) @@ -331,7 +301,6 @@ static void netem_reset(struct Qdisc *sch) skb_queue_purge(&q->delayed); sch->q.qlen = 0; - sch->flags &= ~TCQ_F_THROTTLED; del_timer_sync(&q->timer); } diff --git a/trunk/net/xfrm/xfrm_policy.c b/trunk/net/xfrm/xfrm_policy.c index 55ed979db144..80828078733d 100644 --- a/trunk/net/xfrm/xfrm_policy.c +++ b/trunk/net/xfrm/xfrm_policy.c @@ -1028,15 +1028,30 @@ static int stale_bundle(struct dst_entry *dst) return !xfrm_bundle_ok((struct xfrm_dst *)dst, NULL, AF_UNSPEC); } -void xfrm_dst_ifdown(struct dst_entry *dst, struct net_device *dev) +static void xfrm_dst_destroy(struct dst_entry *dst) { + struct xfrm_dst *xdst = (struct xfrm_dst *)dst; + + dst_release(xdst->route); + + if (!dst->xfrm) + return; + xfrm_state_put(dst->xfrm); + dst->xfrm = NULL; +} + +static void xfrm_dst_ifdown(struct dst_entry *dst, struct net_device *dev, + int unregister) +{ + if (!unregister) + return; + while ((dst = dst->child) && dst->xfrm && dst->dev == dev) { dst->dev = &loopback_dev; dev_hold(&loopback_dev); dev_put(dev); } } -EXPORT_SYMBOL(xfrm_dst_ifdown); static void xfrm_link_failure(struct sk_buff *skb) { @@ -1247,6 +1262,10 @@ int xfrm_policy_register_afinfo(struct xfrm_policy_afinfo *afinfo) dst_ops->kmem_cachep = xfrm_dst_cache; if (likely(dst_ops->check == NULL)) dst_ops->check = xfrm_dst_check; + if (likely(dst_ops->destroy == NULL)) + dst_ops->destroy = xfrm_dst_destroy; + if (likely(dst_ops->ifdown == NULL)) + dst_ops->ifdown = xfrm_dst_ifdown; if (likely(dst_ops->negative_advice == NULL)) dst_ops->negative_advice = xfrm_negative_advice; if (likely(dst_ops->link_failure == NULL)) @@ -1278,6 +1297,8 @@ int xfrm_policy_unregister_afinfo(struct xfrm_policy_afinfo *afinfo) xfrm_policy_afinfo[afinfo->family] = NULL; dst_ops->kmem_cachep = NULL; dst_ops->check = NULL; + dst_ops->destroy = NULL; + dst_ops->ifdown = NULL; dst_ops->negative_advice = NULL; dst_ops->link_failure = NULL; dst_ops->get_mss = NULL; diff --git a/trunk/net/xfrm/xfrm_user.c b/trunk/net/xfrm/xfrm_user.c index 5ddda2c98af9..63661b0fd736 100644 --- a/trunk/net/xfrm/xfrm_user.c +++ b/trunk/net/xfrm/xfrm_user.c @@ -855,44 +855,47 @@ static int xfrm_flush_policy(struct sk_buff *skb, struct nlmsghdr *nlh, void **x return 0; } -#define XMSGSIZE(type) NLMSG_LENGTH(sizeof(struct type)) - -static const int xfrm_msg_min[XFRM_NR_MSGTYPES] = { - [XFRM_MSG_NEWSA - XFRM_MSG_BASE] = XMSGSIZE(xfrm_usersa_info), - [XFRM_MSG_DELSA - XFRM_MSG_BASE] = XMSGSIZE(xfrm_usersa_id), - [XFRM_MSG_GETSA - XFRM_MSG_BASE] = XMSGSIZE(xfrm_usersa_id), - [XFRM_MSG_NEWPOLICY - XFRM_MSG_BASE] = XMSGSIZE(xfrm_userpolicy_info), - [XFRM_MSG_DELPOLICY - XFRM_MSG_BASE] = XMSGSIZE(xfrm_userpolicy_id), - [XFRM_MSG_GETPOLICY - XFRM_MSG_BASE] = XMSGSIZE(xfrm_userpolicy_id), - [XFRM_MSG_ALLOCSPI - XFRM_MSG_BASE] = XMSGSIZE(xfrm_userspi_info), - [XFRM_MSG_ACQUIRE - XFRM_MSG_BASE] = XMSGSIZE(xfrm_user_acquire), - [XFRM_MSG_EXPIRE - XFRM_MSG_BASE] = XMSGSIZE(xfrm_user_expire), - [XFRM_MSG_UPDPOLICY - XFRM_MSG_BASE] = XMSGSIZE(xfrm_userpolicy_info), - [XFRM_MSG_UPDSA - XFRM_MSG_BASE] = XMSGSIZE(xfrm_usersa_info), - [XFRM_MSG_POLEXPIRE - XFRM_MSG_BASE] = XMSGSIZE(xfrm_user_polexpire), - [XFRM_MSG_FLUSHSA - XFRM_MSG_BASE] = XMSGSIZE(xfrm_usersa_flush), - [XFRM_MSG_FLUSHPOLICY - XFRM_MSG_BASE] = NLMSG_LENGTH(0), +static const int xfrm_msg_min[(XFRM_MSG_MAX + 1 - XFRM_MSG_BASE)] = { + NLMSG_LENGTH(sizeof(struct xfrm_usersa_info)), /* NEW SA */ + NLMSG_LENGTH(sizeof(struct xfrm_usersa_id)), /* DEL SA */ + NLMSG_LENGTH(sizeof(struct xfrm_usersa_id)), /* GET SA */ + NLMSG_LENGTH(sizeof(struct xfrm_userpolicy_info)),/* NEW POLICY */ + NLMSG_LENGTH(sizeof(struct xfrm_userpolicy_id)), /* DEL POLICY */ + NLMSG_LENGTH(sizeof(struct xfrm_userpolicy_id)), /* GET POLICY */ + NLMSG_LENGTH(sizeof(struct xfrm_userspi_info)), /* ALLOC SPI */ + NLMSG_LENGTH(sizeof(struct xfrm_user_acquire)), /* ACQUIRE */ + NLMSG_LENGTH(sizeof(struct xfrm_user_expire)), /* EXPIRE */ + NLMSG_LENGTH(sizeof(struct xfrm_userpolicy_info)),/* UPD POLICY */ + NLMSG_LENGTH(sizeof(struct xfrm_usersa_info)), /* UPD SA */ + NLMSG_LENGTH(sizeof(struct xfrm_user_polexpire)), /* POLEXPIRE */ + NLMSG_LENGTH(sizeof(struct xfrm_usersa_flush)), /* FLUSH SA */ + NLMSG_LENGTH(0), /* FLUSH POLICY */ }; -#undef XMSGSIZE - static struct xfrm_link { int (*doit)(struct sk_buff *, struct nlmsghdr *, void **); int (*dump)(struct sk_buff *, struct netlink_callback *); -} xfrm_dispatch[XFRM_NR_MSGTYPES] = { - [XFRM_MSG_NEWSA - XFRM_MSG_BASE] = { .doit = xfrm_add_sa }, - [XFRM_MSG_DELSA - XFRM_MSG_BASE] = { .doit = xfrm_del_sa }, - [XFRM_MSG_GETSA - XFRM_MSG_BASE] = { .doit = xfrm_get_sa, - .dump = xfrm_dump_sa }, - [XFRM_MSG_NEWPOLICY - XFRM_MSG_BASE] = { .doit = xfrm_add_policy }, - [XFRM_MSG_DELPOLICY - XFRM_MSG_BASE] = { .doit = xfrm_get_policy }, - [XFRM_MSG_GETPOLICY - XFRM_MSG_BASE] = { .doit = xfrm_get_policy, - .dump = xfrm_dump_policy }, - [XFRM_MSG_ALLOCSPI - XFRM_MSG_BASE] = { .doit = xfrm_alloc_userspi }, - [XFRM_MSG_UPDPOLICY - XFRM_MSG_BASE] = { .doit = xfrm_add_policy }, - [XFRM_MSG_UPDSA - XFRM_MSG_BASE] = { .doit = xfrm_add_sa }, - [XFRM_MSG_FLUSHSA - XFRM_MSG_BASE] = { .doit = xfrm_flush_sa }, - [XFRM_MSG_FLUSHPOLICY - XFRM_MSG_BASE] = { .doit = xfrm_flush_policy }, +} xfrm_dispatch[] = { + { .doit = xfrm_add_sa, }, + { .doit = xfrm_del_sa, }, + { + .doit = xfrm_get_sa, + .dump = xfrm_dump_sa, + }, + { .doit = xfrm_add_policy }, + { .doit = xfrm_get_policy }, + { + .doit = xfrm_get_policy, + .dump = xfrm_dump_policy, + }, + { .doit = xfrm_alloc_userspi }, + {}, + {}, + { .doit = xfrm_add_policy }, + { .doit = xfrm_add_sa, }, + {}, + { .doit = xfrm_flush_sa }, + { .doit = xfrm_flush_policy }, }; static int xfrm_done(struct netlink_callback *cb) @@ -928,9 +931,7 @@ static int xfrm_user_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, int *err return -1; } - if ((type == (XFRM_MSG_GETSA - XFRM_MSG_BASE) || - type == (XFRM_MSG_GETPOLICY - XFRM_MSG_BASE)) && - (nlh->nlmsg_flags & NLM_F_DUMP)) { + if ((type == 2 || type == 5) && (nlh->nlmsg_flags & NLM_F_DUMP)) { u32 rlen; if (link->dump == NULL) @@ -1008,26 +1009,18 @@ static int xfrm_user_rcv_skb(struct sk_buff *skb) static void xfrm_netlink_rcv(struct sock *sk, int len) { - unsigned int qlen = skb_queue_len(&sk->sk_receive_queue); - do { struct sk_buff *skb; down(&xfrm_cfg_sem); - if (qlen > skb_queue_len(&sk->sk_receive_queue)) - qlen = skb_queue_len(&sk->sk_receive_queue); - - for (; qlen; qlen--) { - skb = skb_dequeue(&sk->sk_receive_queue); + while ((skb = skb_dequeue(&sk->sk_receive_queue)) != NULL) { if (xfrm_user_rcv_skb(skb)) { if (skb->len) skb_queue_head(&sk->sk_receive_queue, skb); - else { + else kfree_skb(skb); - qlen--; - } break; } kfree_skb(skb); @@ -1035,7 +1028,7 @@ static void xfrm_netlink_rcv(struct sock *sk, int len) up(&xfrm_cfg_sem); - } while (qlen); + } while (xfrm_nl && xfrm_nl->sk_receive_queue.qlen); } static int build_expire(struct sk_buff *skb, struct xfrm_state *x, int hard)