From f91c3404ba16c88cdb33824bf0249c6263cd4465 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Fri, 23 Nov 2007 15:26:58 -0500 Subject: [PATCH] Import 2.3.15pre1 --- Documentation/fb/00-INDEX | 3 +- Documentation/fb/framebuffer.txt | 2 +- Documentation/fb/internals.txt | 2 +- Documentation/serial-console.txt | 2 +- Documentation/smart-config.txt | 39 ++++---- Makefile | 4 +- arch/alpha/lib/io.c | 8 +- arch/i386/boot/bootsect.S | 6 +- arch/i386/boot/compressed/misc.c | 2 +- arch/i386/boot/setup.S | 10 +- arch/i386/kernel/i386_ksyms.c | 1 - arch/i386/kernel/i8259.c | 1 - arch/i386/kernel/irq.c | 27 +++-- arch/m68k/amiga/chipram.c | 3 +- arch/m68k/tools/amiga/dmesg.c | 3 +- drivers/char/console.c | 2 +- drivers/net/a2065.c | 3 +- drivers/net/a2065.h | 3 +- drivers/net/ariadne.c | 3 +- drivers/net/ariadne.h | 3 +- drivers/net/de4x5.c | 3 +- drivers/net/hydra.c | 2 +- drivers/usb/cpia.c | 2 +- drivers/usb/keyboard.c | 2 +- drivers/usb/usb_scsi.c | 8 +- drivers/video/S3triofb.c | 4 +- drivers/video/acornfb.c | 2 +- drivers/video/amifb.c | 2 +- drivers/video/atyfb.c | 10 +- drivers/video/chipsfb.c | 2 +- drivers/video/clgenfb.c | 26 ++--- drivers/video/controlfb.c | 4 +- drivers/video/cyber2000fb.c | 4 +- drivers/video/cyberfb.c | 4 +- drivers/video/dnfb.c | 2 +- drivers/video/fbmem.c | 6 +- drivers/video/fm2fb.c | 4 +- drivers/video/g364fb.c | 4 +- drivers/video/hpfb.c | 2 +- drivers/video/igafb.c | 2 +- drivers/video/imsttfb.c | 4 +- drivers/video/macfb.c | 2 +- drivers/video/matroxfb.c | 55 ++++++---- drivers/video/offb.c | 2 +- drivers/video/platinumfb.c | 4 +- drivers/video/q40fb.c | 2 +- drivers/video/retz3fb.c | 4 +- drivers/video/sgivwfb.c | 4 +- drivers/video/tgafb.c | 4 +- drivers/video/valkyriefb.c | 2 +- drivers/video/vesafb.c | 2 +- drivers/video/vfb.c | 2 +- drivers/video/vga16fb.c | 2 +- drivers/video/virgefb.c | 8 +- fs/ext2/inode.c | 34 ++++--- fs/namei.c | 13 ++- include/asm-alpha/io.h | 12 +-- include/asm-alpha/pgtable.h | 3 + include/asm-i386/atomic.h | 11 ++ include/asm-i386/hardirq.h | 2 +- include/asm-i386/pgtable.h | 2 + include/asm-i386/semaphore-helper.h | 30 ++++-- include/asm-m68k/pgtable.h | 2 + include/asm-ppc/pgtable.h | 2 + include/linux/fb.h | 4 +- kernel/printk.c | 150 ++++++++++++++++------------ kernel/sched.c | 102 ++----------------- mm/filemap.c | 7 +- mm/memory.c | 4 +- net/khttpd/security.c | 2 +- scripts/mkdep.c | 38 +++---- 71 files changed, 375 insertions(+), 362 deletions(-) diff --git a/Documentation/fb/00-INDEX b/Documentation/fb/00-INDEX index 4140afb88c26..32b2e760eafb 100644 --- a/Documentation/fb/00-INDEX +++ b/Documentation/fb/00-INDEX @@ -1,8 +1,7 @@ Index of files in Documentation/fb. If you think something about frame buffer devices needs an entry here, needs correction or you've written one please mail me. - Geert Uytterhoeven - + Geert Uytterhoeven 00-INDEX - this file diff --git a/Documentation/fb/framebuffer.txt b/Documentation/fb/framebuffer.txt index 644a007a57e7..c268d025a40b 100644 --- a/Documentation/fb/framebuffer.txt +++ b/Documentation/fb/framebuffer.txt @@ -1,7 +1,7 @@ The Frame Buffer Device ----------------------- -Maintained by Geert Uytterhoeven (Geert.Uytterhoeven@cs.kuleuven.ac.be) +Maintained by Geert Uytterhoeven Last revised: November 7, 1998 diff --git a/Documentation/fb/internals.txt b/Documentation/fb/internals.txt index 7a6b9e99c0d1..a73d721d7bba 100644 --- a/Documentation/fb/internals.txt +++ b/Documentation/fb/internals.txt @@ -2,7 +2,7 @@ This is a first start for some documentation about frame buffer device internals. -Geert Uytterhoeven , 21 July 1998 +Geert Uytterhoeven , 21 July 1998 -------------------------------------------------------------------------------- diff --git a/Documentation/serial-console.txt b/Documentation/serial-console.txt index 2894b8008110..5b4168833a9e 100644 --- a/Documentation/serial-console.txt +++ b/Documentation/serial-console.txt @@ -87,7 +87,7 @@ Replace the sample values as needed. 6. Thanks - Thanks to Geert Uytterhoeven + Thanks to Geert Uytterhoeven for porting the patches from 2.1.4x to 2.1.6x for taking care of the integration of these patches into m68k, ppc and alpha. diff --git a/Documentation/smart-config.txt b/Documentation/smart-config.txt index b31d252fa507..c9bed4cf8773 100644 --- a/Documentation/smart-config.txt +++ b/Documentation/smart-config.txt @@ -1,5 +1,5 @@ Smart CONFIG_* Dependencies -Fri 2 Dec 1997 +1 August 1999 Michael Chastain Werner Almesberger @@ -44,22 +44,21 @@ Here is the solution: It now generates these dependencies: drivers/net/foo.c: \ - include/config/foo_autofrob.h \ - include/config/foo_model_two.h + include/config/foo/autofrob.h \ + include/config/foo/model/two.h So drivers/net/foo.c depends only on the CONFIG_* lines that it actually uses. - A new program, split-include.c, runs at the end of make config (also - make oldconfig, make menuconfig, and make xconfig). split-include - reads include/linux/autoconf.h and updates the include/linux/*.h - directory, writing one file per option. It updates only the files - that changed. + A new program, split-include.c, runs at the beginning of + compilation (make bzImage or make zImage). split-include reads + include/linux/autoconf.h and updates the include/config/ tree, + writing one file per option. It updates only the files for options + that have changed. - mkdep.c also generates much better warning messages for missing - or unneeded lines. In fact, you can get these - messages without generating dependencies with the new top-level - target 'make checkconfig'. + mkdep.c no longer generates warning messages for missing or unneeded + lines. The new top-level target 'make checkconfig' + checks for these problems. Flag Dependencies @@ -68,12 +67,14 @@ Flag Dependencies the compilation flags used to build it. The file foo.o has its flags stored in .flags.foo.o. - Suppose the user changes the foo driver from resident to - modular, 'make' will notice that the foo.o was not compiled - with -DMODULE and will recompile foo.c. + Suppose the user changes the foo driver from resident to modular. + 'make' will notice that the current foo.o was not compiled with + -DMODULE and will recompile foo.c. - All .a and .o files made from C source or with 'ld' or 'ar' - have flag dependencies. .S files do not have flag dependencies. + All .o files made from C source have flag dependencies. So do .o + files made with ld, and .a files made with ar. However, .o files + made from assembly source do not have flag dependencies (nobody + needs this yet, but it would be good to fix). Per-source-file Flags @@ -92,8 +93,8 @@ Credit version of this patch. Michael Chastain picked it up and continued development. He is - now the principal author and maintainer. Report bugs to him, - or to all three people together. + now the principal author and maintainer. Please report any bugs + to him. Martin von Loewis wrote flag dependencies, with some modifications by Michael Chastain. diff --git a/Makefile b/Makefile index 8e6bd5e6cecf..cc79a0e638fd 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ VERSION = 2 PATCHLEVEL = 3 -SUBLEVEL = 14 +SUBLEVEL = 15 EXTRAVERSION = ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/) @@ -162,7 +162,7 @@ ifdef CONFIG_PPC DRIVERS := $(DRIVERS) drivers/macintosh/macintosh.a endif -ifdef CONFIG_PNP +ifeq ($(CONFIG_PNP),y) DRIVERS := $(DRIVERS) drivers/pnp/pnp.a endif diff --git a/arch/alpha/lib/io.c b/arch/alpha/lib/io.c index 4e6839bddcdb..25de0f871863 100644 --- a/arch/alpha/lib/io.c +++ b/arch/alpha/lib/io.c @@ -90,7 +90,7 @@ void ___raw_writeb(unsigned char b, unsigned long addr) __writeb(b, addr); } -void ___raw_writeb(unsigned short b, unsigned long addr) +void ___raw_writew(unsigned short b, unsigned long addr) { __writew(b, addr); } @@ -487,7 +487,7 @@ void _memcpy_toio(unsigned long to, const void * from, long count) if (count >= 2 && (to & 1) == ((long)from & 1)) { count -= 2; do { - __raw_writeb(*(const u16 *)from, to); + __raw_writew(*(const u16 *)from, to); count -= 2; to += 2; from += 2; @@ -518,7 +518,7 @@ void _memset_c_io(unsigned long to, unsigned long c, long count) /* Handle any initial odd halfword */ if (count >= 2 && (to & 2)) { - __raw_writeb(c, to); + __raw_writew(c, to); to += 2; count -= 2; } @@ -551,7 +551,7 @@ void _memset_c_io(unsigned long to, unsigned long c, long count) /* The tail is half-word aligned if we have count >= 2 */ if (count >= 2) { - __raw_writeb(c, to); + __raw_writew(c, to); to += 2; count -= 2; } diff --git a/arch/i386/boot/bootsect.S b/arch/i386/boot/bootsect.S index baac50716b56..82c6e74593b4 100644 --- a/arch/i386/boot/bootsect.S +++ b/arch/i386/boot/bootsect.S @@ -106,12 +106,12 @@ go: mov di,#0x4000-12 ! 0x4000 is arbitrary value >= length of seg fs lds si,(bx) ! ds:si is source - mov cl,#6 ! copy 12 bytes + mov cl,#3 ! copy 12 bytes cld push di rep - movsw + movsd pop di pop ds @@ -125,7 +125,7 @@ go: mov di,#0x4000-12 ! 0x4000 is arbitrary value >= length of ! load the setup-sectors directly after the bootblock. ! Note that 'es' is already set up. -! Also cx is 0 from rep movsw above. +! Also cx is 0 from rep movsd above. load_setup: xor ah,ah ! reset FDC diff --git a/arch/i386/boot/compressed/misc.c b/arch/i386/boot/compressed/misc.c index ad78c419d988..128b534276b9 100644 --- a/arch/i386/boot/compressed/misc.c +++ b/arch/i386/boot/compressed/misc.c @@ -104,7 +104,7 @@ static long free_mem_end_ptr = 0x90000; #define LOW_BUFFER_START 0x2000 #define LOW_BUFFER_END 0x90000 #define LOW_BUFFER_SIZE ( LOW_BUFFER_END - LOW_BUFFER_START ) -#define HEAP_SIZE 0x2000 +#define HEAP_SIZE 0x3000 static int high_loaded =0; static uch *high_buffer_start /* = (uch *)(((ulg)&end) + HEAP_SIZE)*/; diff --git a/arch/i386/boot/setup.S b/arch/i386/boot/setup.S index e45fcda2d0b1..2b853668b31a 100644 --- a/arch/i386/boot/setup.S +++ b/arch/i386/boot/setup.S @@ -188,9 +188,9 @@ bad_sig: xor bh,bh mov bl,[497] ! get setup sects from boot sector sub bx,#4 ! LILO loads 4 sectors of setup - shl bx,#8 ! convert to words + shl bx,#7 ! convert to dwords (1sect=2^7 dwords) mov cx,bx - shr bx,#3 ! convert to segment + shr bx,#2 ! convert to segment add bx,#SYSSEG seg cs mov start_sys_seg,bx @@ -203,7 +203,7 @@ bad_sig: mov ax,#SYSSEG mov ds,ax rep - movsw + movsd mov ax,cs ! aka #SETUPSEG mov ds,ax @@ -485,9 +485,9 @@ do_move: add bx,#0x100 sub di,di sub si,si - mov cx,#0x800 + mov cx,#0x400 rep - movsw + movsd cmp bx,bp ! we assume start_sys_seg > 0x200, ! so we will perhaps read one page more then ! needed, but never overwrite INITSEG because diff --git a/arch/i386/kernel/i386_ksyms.c b/arch/i386/kernel/i386_ksyms.c index afcfd274e2ea..b3c3fdb81db1 100644 --- a/arch/i386/kernel/i386_ksyms.c +++ b/arch/i386/kernel/i386_ksyms.c @@ -76,7 +76,6 @@ EXPORT_SYMBOL(strlen_user); #ifdef __SMP__ EXPORT_SYMBOL(cpu_data); EXPORT_SYMBOL(kernel_flag); -EXPORT_SYMBOL(smp_invalidate_needed); EXPORT_SYMBOL(cpu_number_map); EXPORT_SYMBOL(__cpu_logical_map); EXPORT_SYMBOL(smp_num_cpus); diff --git a/arch/i386/kernel/i8259.c b/arch/i386/kernel/i8259.c index dee5a9e02634..efd8e8bc0412 100644 --- a/arch/i386/kernel/i8259.c +++ b/arch/i386/kernel/i8259.c @@ -10,7 +10,6 @@ #include #include #include -#include #include #include diff --git a/arch/i386/kernel/irq.c b/arch/i386/kernel/irq.c index 6e44aca7e0f7..8d71ed8bcb9d 100644 --- a/arch/i386/kernel/irq.c +++ b/arch/i386/kernel/irq.c @@ -149,7 +149,10 @@ atomic_t global_bh_lock; static inline void check_smp_invalidate(int cpu) { if (test_bit(cpu, &smp_invalidate_needed)) { + struct mm_struct *mm = current->mm; clear_bit(cpu, &smp_invalidate_needed); + if (mm) + atomic_set_mask(1 << cpu, &mm->cpu_vm_mask); local_flush_tlb(); } } @@ -617,25 +620,33 @@ int request_irq(unsigned int irq, void free_irq(unsigned int irq, void *dev_id) { - struct irqaction * action, **p; + struct irqaction **p; unsigned long flags; if (irq >= NR_IRQS) return; spin_lock_irqsave(&irq_controller_lock,flags); - for (p = &irq_desc[irq].action; (action = *p) != NULL; p = &action->next) { - if (action->dev_id != dev_id) - continue; + p = &irq_desc[irq].action; + for (;;) { + struct irqaction * action = *p; + if (action) { + struct irqaction **pp = p; + p = &action->next; + if (action->dev_id != dev_id) + continue; - /* Found it - now remove it from the list of entries */ - *p = action->next; - if (!irq_desc[irq].action) { + /* Found it - now remove it from the list of entries */ + *pp = action->next; + if (irq_desc[irq].action) + break; irq_desc[irq].status |= IRQ_DISABLED; irq_desc[irq].handler->shutdown(irq); + break; } + printk("Trying to free free IRQ%d\n",irq); + break; } - printk("Trying to free free IRQ%d\n",irq); spin_unlock_irqrestore(&irq_controller_lock,flags); } diff --git a/arch/m68k/amiga/chipram.c b/arch/m68k/amiga/chipram.c index 50d5a0de0be0..9211f85997a2 100644 --- a/arch/m68k/amiga/chipram.c +++ b/arch/m68k/amiga/chipram.c @@ -1,8 +1,7 @@ /* ** linux/amiga/chipram.c ** -** Modified 03-May-94 by Geert Uytterhoeven -** (Geert.Uytterhoeven@cs.kuleuven.ac.be) +** Modified 03-May-94 by Geert Uytterhoeven ** - 64-bit aligned allocations for full AGA compatibility */ diff --git a/arch/m68k/tools/amiga/dmesg.c b/arch/m68k/tools/amiga/dmesg.c index 9affff5659cc..e892748e7386 100644 --- a/arch/m68k/tools/amiga/dmesg.c +++ b/arch/m68k/tools/amiga/dmesg.c @@ -3,8 +3,7 @@ * in Chip RAM with the kernel command * line option `debug=mem'. * - * © Copyright 1996 by Geert Uytterhoeven - * (Geert.Uytterhoeven@cs.kuleuven.ac.be) + * © Copyright 1996 by Geert Uytterhoeven * * * Usage: diff --git a/drivers/char/console.c b/drivers/char/console.c index f003c61de752..d0503cdcb9f2 100644 --- a/drivers/char/console.c +++ b/drivers/char/console.c @@ -33,7 +33,7 @@ * APM screenblank bug fixed Takashi Manabe * * Merge with the abstract console driver by Geert Uytterhoeven - * , Jan 1997. + * , Jan 1997. * * Original m68k console driver modifications by * diff --git a/drivers/net/a2065.c b/drivers/net/a2065.c index ccb6fb122d5e..ead77eb9eedd 100644 --- a/drivers/net/a2065.c +++ b/drivers/net/a2065.c @@ -1,8 +1,7 @@ /* * Amiga Linux/68k A2065 Ethernet Driver * - * (C) Copyright 1995 by Geert Uytterhoeven - * (Geert.Uytterhoeven@cs.kuleuven.ac.be) + * (C) Copyright 1995 by Geert Uytterhoeven * * Fixes and tips by: * - Janos Farkas (CHEXUM@sparta.banki.hu) diff --git a/drivers/net/a2065.h b/drivers/net/a2065.h index 145bc694d256..db6e9e65d968 100644 --- a/drivers/net/a2065.h +++ b/drivers/net/a2065.h @@ -1,8 +1,7 @@ /* * Amiga Linux/68k A2065 Ethernet Driver * - * (C) Copyright 1995 by Geert Uytterhoeven - * (Geert.Uytterhoeven@cs.kuleuven.ac.be) + * (C) Copyright 1995 by Geert Uytterhoeven * * --------------------------------------------------------------------------- * diff --git a/drivers/net/ariadne.c b/drivers/net/ariadne.c index ce4bb99f12c2..6d102836c35a 100644 --- a/drivers/net/ariadne.c +++ b/drivers/net/ariadne.c @@ -1,8 +1,7 @@ /* * Amiga Linux/m68k Ariadne Ethernet Driver * - * © Copyright 1995 by Geert Uytterhoeven - * (Geert.Uytterhoeven@cs.kuleuven.ac.be) + * © Copyright 1995 by Geert Uytterhoeven (geert@linux-m68k.org) * Peter De Schrijver * (Peter.DeSchrijver@linux.cc.kuleuven.ac.be) * diff --git a/drivers/net/ariadne.h b/drivers/net/ariadne.h index 796bbcba4c1c..2ba188134b29 100644 --- a/drivers/net/ariadne.h +++ b/drivers/net/ariadne.h @@ -1,8 +1,7 @@ /* * Amiga Linux/m68k Ariadne Ethernet Driver * - * © Copyright 1995 by Geert Uytterhoeven - * (Geert.Uytterhoeven@cs.kuleuven.ac.be) + * © Copyright 1995 by Geert Uytterhoeven (geert@linux-m68k.org) * Peter De Schrijver * (Peter.DeSchrijver@linux.cc.kuleuven.ac.be) * diff --git a/drivers/net/de4x5.c b/drivers/net/de4x5.c index 17fc199465d5..c2e33d8ad8e1 100644 --- a/drivers/net/de4x5.c +++ b/drivers/net/de4x5.c @@ -379,8 +379,7 @@ Fix bug in pci_probe() for 64 bit systems reported by . 0.533 9-Jan-98 Fix more 64 bit bugs reported by . - 0.534 24-Jan-98 Fix last (?) endian bug from - + 0.534 24-Jan-98 Fix last (?) endian bug from 0.535 21-Feb-98 Fix Ethernet Address PROM reset bug for DC21040. 0.536 21-Mar-98 Change pci_probe() to use the pci_dev structure. **Incompatible with 2.0.x from here.** diff --git a/drivers/net/hydra.c b/drivers/net/hydra.c index 0adf30ac35d0..483d94e4542c 100644 --- a/drivers/net/hydra.c +++ b/drivers/net/hydra.c @@ -3,7 +3,7 @@ /* also some code & lots of fixes by Timo Rossi (trossi@cc.jyu.fi) */ /* The code is mostly based on the linux/68k Ariadne driver */ -/* copyrighted by Geert Uytterhoeven (Geert.Uytterhoeven@cs.kuleuven.ac.be) */ +/* copyrighted by Geert Uytterhoeven (geert@linux-m68k.org) */ /* and Peter De Schrijver (Peter.DeSchrijver@linux.cc.kuleuven.ac.be) */ /* This file is subject to the terms and conditions of the GNU General */ diff --git a/drivers/usb/cpia.c b/drivers/usb/cpia.c index ef2c4d3e6f76..9e7f0acd8c8d 100644 --- a/drivers/usb/cpia.c +++ b/drivers/usb/cpia.c @@ -1083,7 +1083,7 @@ static int cpia_probe(struct usb_device *dev) if (dev->descriptor.bNumConfigurations != 1) return -1; - interface = &dev->config[0].altsetting[0].interface[0]; + interface = &dev->config[0].interface[0].altsetting[0]; /* Is it a CPiA? */ if (dev->descriptor.idVendor != 0x0553) diff --git a/drivers/usb/keyboard.c b/drivers/usb/keyboard.c index 47c0780e51b6..7b7b346dd247 100644 --- a/drivers/usb/keyboard.c +++ b/drivers/usb/keyboard.c @@ -176,7 +176,7 @@ usb_kbd_probe(struct usb_device *dev) if (dev->descriptor.bNumConfigurations < 1) return -1; - interface = &dev->config[0].altsetting[0].interface[0]; + interface = &dev->config[0].interface[0].altsetting[0]; endpoint = &interface->endpoint[0]; if(interface->bInterfaceClass != 3 diff --git a/drivers/usb/usb_scsi.c b/drivers/usb/usb_scsi.c index 646bb039d698..fcd5f5da5ea3 100644 --- a/drivers/usb/usb_scsi.c +++ b/drivers/usb/usb_scsi.c @@ -1108,9 +1108,9 @@ static int scsi_probe(struct usb_device *dev) protocol = US_PR_CB; subclass = US_SC_8070; /* an assumption */ } else if (dev->descriptor.bDeviceClass != 0 || - dev->config->altsetting->interface->bInterfaceClass != 8 || - dev->config->altsetting->interface->bInterfaceSubClass < US_SC_MIN || - dev->config->altsetting->interface->bInterfaceSubClass > US_SC_MAX) { + dev->config->interface->altsetting->bInterfaceClass != 8 || + dev->config->interface->altsetting->bInterfaceSubClass < US_SC_MIN || + dev->config->interface->altsetting->bInterfaceSubClass > US_SC_MAX) { return -1; } @@ -1143,7 +1143,7 @@ static int scsi_probe(struct usb_device *dev) memset(ss, 0, sizeof(struct us_data)); } - interface = dev->config->altsetting->interface; + interface = dev->config->interface->altsetting; ss->filter = filter; ss->fdata = fdata; ss->flags = flags; diff --git a/drivers/video/S3triofb.c b/drivers/video/S3triofb.c index 0cce81aefb90..22fb32ab1ed2 100644 --- a/drivers/video/S3triofb.c +++ b/drivers/video/S3triofb.c @@ -446,11 +446,11 @@ void __init s3triofb_init_of(struct device_node *dp) s3trio_init(dp); address = 0xc6000000; s3trio_base = ioremap(address,64*1024*1024); - fb_fix.smem_start = (char *)address; + fb_fix.smem_start = address; fb_fix.type = FB_TYPE_PACKED_PIXELS; fb_fix.type_aux = 0; fb_fix.accel = FB_ACCEL_S3_TRIO64; - fb_fix.mmio_start = (char *)address+0x1000000; + fb_fix.mmio_start = address+0x1000000; fb_fix.mmio_len = 0x1000000; fb_fix.xpanstep = 1; diff --git a/drivers/video/acornfb.c b/drivers/video/acornfb.c index 7f22c2e9edc0..9f59f4aa1872 100644 --- a/drivers/video/acornfb.c +++ b/drivers/video/acornfb.c @@ -1037,7 +1037,7 @@ acornfb_get_fix(struct fb_fix_screeninfo *fix, int con, struct fb_info *info) else display = &global_disp; - fix->smem_start = (char *)current_par.screen_base_p; + fix->smem_start = current_par.screen_base_p; fix->smem_len = current_par.screen_size; fix->type = display->type; fix->type_aux = display->type_aux; diff --git a/drivers/video/amifb.c b/drivers/video/amifb.c index 129ab3a10c76..47531e1bb997 100644 --- a/drivers/video/amifb.c +++ b/drivers/video/amifb.c @@ -1981,7 +1981,7 @@ static int ami_encode_fix(struct fb_fix_screeninfo *fix, { memset(fix, 0, sizeof(struct fb_fix_screeninfo)); strcpy(fix->id, amifb_name); - fix->smem_start = (char *)videomemory_phys; + fix->smem_start = videomemory_phys; fix->smem_len = videomemorysize; #ifdef FBCON_HAS_MFB diff --git a/drivers/video/atyfb.c b/drivers/video/atyfb.c index af750c5873e0..d13782b50cfe 100644 --- a/drivers/video/atyfb.c +++ b/drivers/video/atyfb.c @@ -1926,7 +1926,7 @@ static int encode_fix(struct fb_fix_screeninfo *fix, memset(fix, 0, sizeof(struct fb_fix_screeninfo)); strcpy(fix->id, atyfb_name); - fix->smem_start = (char *)info->frame_buffer_phys; + fix->smem_start = info->frame_buffer_phys; fix->smem_len = (u32)info->total_vram; #ifdef __LITTLE_ENDIAN @@ -1943,19 +1943,19 @@ static int encode_fix(struct fb_fix_screeninfo *fix, * Reg Block 1 (multimedia extensions) is at ati_regbase_phys-0x400 */ if (Gx == GX_CHIP_ID || Gx == CX_CHIP_ID) { - fix->mmio_start = (char *)info->ati_regbase_phys; + fix->mmio_start = info->ati_regbase_phys; fix->mmio_len = 0x400; fix->accel = FB_ACCEL_ATI_MACH64GX; } else if (Gx == CT_CHIP_ID || Gx == ET_CHIP_ID) { - fix->mmio_start = (char *)info->ati_regbase_phys; + fix->mmio_start = info->ati_regbase_phys; fix->mmio_len = 0x400; fix->accel = FB_ACCEL_ATI_MACH64CT; } else if (Gx == VT_CHIP_ID || Gx == VU_CHIP_ID || Gx == VV_CHIP_ID) { - fix->mmio_start = (char *)(info->ati_regbase_phys-0x400); + fix->mmio_start = info->ati_regbase_phys-0x400); fix->mmio_len = 0x800; fix->accel = FB_ACCEL_ATI_MACH64VT; } else { - fix->mmio_start = (char *)(info->ati_regbase_phys-0x400); + fix->mmio_start = info->ati_regbase_phys-0x400); fix->mmio_len = 0x800; fix->accel = FB_ACCEL_ATI_MACH64GT; } diff --git a/drivers/video/chipsfb.c b/drivers/video/chipsfb.c index 85152dec2fca..f1fa1dc9e021 100644 --- a/drivers/video/chipsfb.c +++ b/drivers/video/chipsfb.c @@ -549,7 +549,7 @@ static void __init init_chips(struct fb_info_chips *p) int i; strcpy(p->fix.id, "C&T 65550"); - p->fix.smem_start = (char *) p->frame_buffer_phys; + p->fix.smem_start = p->frame_buffer_phys; // FIXME: Assumes 1MB frame buffer, but 65550 supports 1MB or 2MB. // * "3500" PowerBook G3 (the original PB G3) has 2MB. diff --git a/drivers/video/clgenfb.c b/drivers/video/clgenfb.c index 1ae5e79f5c90..c6d650463977 100644 --- a/drivers/video/clgenfb.c +++ b/drivers/video/clgenfb.c @@ -31,7 +31,7 @@ * */ -#define CLGEN_VERSION "1.9.4.1" +#define CLGEN_VERSION "1.9.4.2" #include #include @@ -98,7 +98,6 @@ if(!(expr)) { \ printk( "Assertion failed! %s,%s,%s,line=%d\n",\ #expr,__FILE__,__FUNCTION__,__LINE__); \ - *(int*)0 = 0;\ } #else #define assert(expr) @@ -635,18 +634,18 @@ static int clgen_encode_fix (struct fb_fix_screeninfo *fix, const void *par, switch (_par->var.bits_per_pixel) { case 1: case 8: - fix->smem_start = (char *) _info->fbmem_phys; + fix->smem_start = _info->fbmem_phys; break; case 16: - fix->smem_start = (char *) _info->fbmem_phys + 1 * MB_; + fix->smem_start = _info->fbmem_phys + 1 * MB_; break; case 24: case 32: - fix->smem_start = (char *) _info->fbmem_phys + 2 * MB_; + fix->smem_start = _info->fbmem_phys + 2 * MB_; break; } } else { - fix->smem_start = (char *) _info->fbmem_phys; + fix->smem_start = _info->fbmem_phys; } /* monochrome: only 1 memory plane */ @@ -662,7 +661,7 @@ static int clgen_encode_fix (struct fb_fix_screeninfo *fix, const void *par, fix->line_length = _par->line_length; /* FIXME: map region at 0xB8000 if available, fill in here */ - fix->mmio_start = (char *) NULL; + fix->mmio_start = 0; fix->mmio_len = 0; fix->accel = FB_ACCEL_NONE; @@ -831,7 +830,7 @@ static int clgen_decode_var (const struct fb_var_screeninfo *var, void *par, if (_par->var.yoffset > _par->var.yres_virtual - _par->var.yres) _par->var.yoffset = _par->var.yres_virtual - _par->var.yres - 1; - switch (var->bits_per_pixel) { + switch (_par->var.bits_per_pixel) { case 1: _par->line_length = _par->var.xres_virtual / 8; _par->visual = FB_VISUAL_MONO10; @@ -900,7 +899,8 @@ static int clgen_decode_var (const struct fb_var_screeninfo *var, void *par, break; default: - assert (0); + DPRINTK("Unsupported bpp size: %d\n", _par->var.bits_per_pixel); + assert (FALSE); /* should never occur */ break; } @@ -951,7 +951,7 @@ static int clgen_decode_var (const struct fb_var_screeninfo *var, void *par, bestclock (freq, &_par->freq, &_par->nom, &_par->den, &_par->div, maxclock); - _par->mclk = clgen_get_mclk (freq, var->bits_per_pixel, &_par->divMCLK); + _par->mclk = clgen_get_mclk (freq, _par->var.bits_per_pixel, &_par->divMCLK); xres = _par->var.xres; hfront = _par->var.right_margin; @@ -2326,7 +2326,7 @@ static struct pci_dev * __init clgen_pci_dev_get (clgen_board_t *btype) clgen_pci_probe_list[i].device, NULL); if (pdev) - *btype = clgen_pci_probe_list[i].btype; + *btype = clgen_pci_probe_list[i - 1].btype; DPRINTK ("EXIT, returning %p\n", pdev); return pdev; @@ -2485,7 +2485,7 @@ static int __init clgen_zorro_find (int *key_o, int *key2_o, clgen_board_t *btyp *key2_o = zorro_find (clgen_zorro_probe_list[i].key2, 0, 0); else *key2_o = 0; - *btype = clgen_zorro_probe_list[i].btype; + *btype = clgen_zorro_probe_list[i - 1].btype; printk (KERN_INFO "clgen: %s board detected; ", clgen_board_info[*btype].name); @@ -3277,7 +3277,7 @@ void clgen_dbg_print_regs (caddr_t regbase, clgen_dbg_reg_class_t reg_class,...) break; default: /* should never occur */ - assert (0); + assert (FALSE); break; } diff --git a/drivers/video/controlfb.c b/drivers/video/controlfb.c index 81a6e1a78234..20ef95d93145 100644 --- a/drivers/video/controlfb.c +++ b/drivers/video/controlfb.c @@ -998,7 +998,7 @@ static void control_par_to_fix(struct fb_par_control *par, struct fb_fix_screeni { memset(fix, 0, sizeof(*fix)); strcpy(fix->id, "control"); - fix->mmio_start = (char *)p->control_regs_phys; + fix->mmio_start = p->control_regs_phys; fix->mmio_len = sizeof(struct control_regs); fix->type = FB_TYPE_PACKED_PIXELS; @@ -1010,7 +1010,7 @@ static void control_par_to_fix(struct fb_par_control *par, struct fb_fix_screeni fix->xpanstep = 0; */ - fix->smem_start = (void *)(p->frame_buffer_phys + fix->smem_start = (p->frame_buffer_phys + control_reg_init[par->vmode-1]->offset[par->cmode]); fix->smem_len = p->total_vram - control_reg_init[par->vmode-1]->offset[par->cmode]; fix->visual = (par->cmode == CMODE_8) ? diff --git a/drivers/video/cyber2000fb.c b/drivers/video/cyber2000fb.c index 1b3b659d1518..184ec443fd68 100644 --- a/drivers/video/cyber2000fb.c +++ b/drivers/video/cyber2000fb.c @@ -765,9 +765,9 @@ cyber2000fb_get_fix(struct fb_fix_screeninfo *fix, int con, else display = &global_disp; - fix->smem_start = (char *)current_par.screen_base_p; + fix->smem_start = current_par.screen_base_p; fix->smem_len = current_par.screen_size; - fix->mmio_start = (char *)current_par.regs_base_p; + fix->mmio_start = current_par.regs_base_p; fix->mmio_len = 0x000c0000; fix->type = display->type; fix->type_aux = display->type_aux; diff --git a/drivers/video/cyberfb.c b/drivers/video/cyberfb.c index cbf96d080b32..7e4aea83f3db 100644 --- a/drivers/video/cyberfb.c +++ b/drivers/video/cyberfb.c @@ -406,9 +406,9 @@ static int Cyber_encode_fix(struct fb_fix_screeninfo *fix, DPRINTK("ENTER\n"); memset(fix, 0, sizeof(struct fb_fix_screeninfo)); strcpy(fix->id, cyberfb_name); - fix->smem_start = (char*) CyberMem_phys; + fix->smem_start = CyberMem_phys; fix->smem_len = CyberSize; - fix->mmio_start = (char*) CyberRegs_phys; + fix->mmio_start = CyberRegs_phys; fix->mmio_len = 0x10000; fix->type = FB_TYPE_PACKED_PIXELS; diff --git a/drivers/video/dnfb.c b/drivers/video/dnfb.c index 5c663f665509..c8a550eb827b 100644 --- a/drivers/video/dnfb.c +++ b/drivers/video/dnfb.c @@ -169,7 +169,7 @@ static int dnfb_get_fix(struct fb_fix_screeninfo *fix, int con, { memset(fix, 0, sizeof(struct fb_fix_screeninfo)); strcpy(fix->id,"Apollo Mono"); - fix->smem_start=(char*)(FRAME_BUFFER_START+IO_BASE); + fix->smem_start=FRAME_BUFFER_START+IO_BASE; fix->smem_len=FRAME_BUFFER_LEN; fix->type=FB_TYPE_PACKED_PIXELS; fix->type_aux=0; diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c index 42097b620ba7..e333730c188e 100644 --- a/drivers/video/fbmem.c +++ b/drivers/video/fbmem.c @@ -473,7 +473,7 @@ fb_mmap(struct file *file, struct vm_area_struct * vma) fb->fb_get_fix(&fix, PROC_CONSOLE(info), info); /* frame buffer memory */ - start = (unsigned long)fix.smem_start; + start = fix.smem_start; len = (start & ~PAGE_MASK)+fix.smem_len; start &= PAGE_MASK; len = (len+~PAGE_MASK) & PAGE_MASK; @@ -483,7 +483,7 @@ fb_mmap(struct file *file, struct vm_area_struct * vma) fb->fb_get_var(&var, PROC_CONSOLE(info), info); if (var.accel_flags) return -EINVAL; - start = (unsigned long)fix.mmio_start; + start = fix.mmio_start; len = (start & ~PAGE_MASK)+fix.mmio_len; start &= PAGE_MASK; len = (len+~PAGE_MASK) & PAGE_MASK; @@ -524,7 +524,7 @@ fb_mmap(struct file *file, struct vm_area_struct * vma) #else #warning What do we have to do here?? #endif - if (remap_page_range(vma->vm_start, vma->vm_offset, + if (io_remap_page_range(vma->vm_start, vma->vm_offset, vma->vm_end - vma->vm_start, vma->vm_page_prot)) return -EAGAIN; return 0; diff --git a/drivers/video/fm2fb.c b/drivers/video/fm2fb.c index b356de3fd41c..97f4e9ba8edd 100644 --- a/drivers/video/fm2fb.c +++ b/drivers/video/fm2fb.c @@ -415,13 +415,13 @@ int __init fm2fb_init(void) fb_var = fb_var_modes[fm2fb_mode]; strcpy(fb_fix.id, is_fm ? "FrameMaster II" : "Rainbow II"); - fb_fix.smem_start = (char *)fm2fb_mem_phys; + fb_fix.smem_start = fm2fb_mem_phys; fb_fix.smem_len = FRAMEMASTER_REG; fb_fix.type = FB_TYPE_PACKED_PIXELS; fb_fix.type_aux = 0; fb_fix.visual = FB_VISUAL_TRUECOLOR; fb_fix.line_length = 768<<2; - fb_fix.mmio_start = (char *)fm2fb_reg_phys; + fb_fix.mmio_start = fm2fb_reg_phys; fb_fix.mmio_len = 8; fb_fix.accel = FB_ACCEL_NONE; diff --git a/drivers/video/g364fb.c b/drivers/video/g364fb.c index 808a0988e6dc..b74d12d937cc 100644 --- a/drivers/video/g364fb.c +++ b/drivers/video/g364fb.c @@ -345,7 +345,7 @@ int __init g364fb_init(void) fb_var.yres = yres; fb_fix.line_length = (xres / 8) * fb_var.bits_per_pixel; - fb_fix.smem_start = (char *)0x40000000; /* physical address */ + fb_fix.smem_start = 0x40000000; /* physical address */ /* get size of video memory; this is special for the JAZZ hardware */ mem = (r4030_read_reg32(JAZZ_R4030_CONFIG) >> 8) & 3; fb_fix.smem_len = (1 << (mem*2)) * 512 * 1024; @@ -355,7 +355,7 @@ int __init g364fb_init(void) fb_fix.xpanstep = 0; fb_fix.ypanstep = 1; fb_fix.ywrapstep = 0; - fb_fix.mmio_start = NULL; + fb_fix.mmio_start = 0; fb_fix.mmio_len = 0; fb_fix.accel = FB_ACCEL_NONE; diff --git a/drivers/video/hpfb.c b/drivers/video/hpfb.c index 9012c52e5320..27a383ece24b 100644 --- a/drivers/video/hpfb.c +++ b/drivers/video/hpfb.c @@ -192,7 +192,7 @@ static void hpfb_encode_fix(struct fb_fix_screeninfo *fix, /* * X works, but screen wraps ... */ - fix->smem_start=(char *)fb_start; + fix->smem_start=fb_start; fix->smem_len=fb_size; fix->type = FB_TYPE_PACKED_PIXELS; fix->visual = FB_VISUAL_PSEUDOCOLOR; diff --git a/drivers/video/igafb.c b/drivers/video/igafb.c index 30ca34ef1527..5ed528af2395 100644 --- a/drivers/video/igafb.c +++ b/drivers/video/igafb.c @@ -217,7 +217,7 @@ static int igafb_get_fix(struct fb_fix_screeninfo *fix, int con, memset(fix, 0, sizeof(struct fb_fix_screeninfo)); strcpy(fix->id, igafb_name); - fix->smem_start = (char *)fb->frame_buffer; + fix->smem_start = fb->frame_buffer; fix->smem_len = fb->total_vram; fix->xpanstep = 0; fix->ypanstep = 0; diff --git a/drivers/video/imsttfb.c b/drivers/video/imsttfb.c index 43f6d0df2ea6..398e8e500a92 100644 --- a/drivers/video/imsttfb.c +++ b/drivers/video/imsttfb.c @@ -1797,9 +1797,9 @@ init_imstt(struct fb_info_imstt *p) } sprintf(p->fix.id, "IMS TT (%s)", p->ramdac == IBM ? "IBM" : "TVP"); - p->fix.smem_start = (__u8 *)p->frame_buffer_phys; + p->fix.smem_start = p->frame_buffer_phys; p->fix.smem_len = p->total_vram; - p->fix.mmio_start = (__u8 *)p->dc_regs_phys; + p->fix.mmio_start = p->dc_regs_phys; p->fix.mmio_len = 0x1000; p->fix.accel = FB_ACCEL_IMS_TWINTURBO; p->fix.type = FB_TYPE_PACKED_PIXELS; diff --git a/drivers/video/macfb.c b/drivers/video/macfb.c index db41162e8a67..282c47739c13 100644 --- a/drivers/video/macfb.c +++ b/drivers/video/macfb.c @@ -157,7 +157,7 @@ static void macfb_encode_fix(struct fb_fix_screeninfo *fix, /* * fbmem.c accepts non page aligned mappings now! */ - fix->smem_start=(char *)mac_videobase; + fix->smem_start=mac_videobase; fix->smem_len=mac_videosize; fix->type = FB_TYPE_PACKED_PIXELS; if (mac_depth == 1) diff --git a/drivers/video/matroxfb.c b/drivers/video/matroxfb.c index cb08cbb9c3d0..1c27a49e91b0 100644 --- a/drivers/video/matroxfb.c +++ b/drivers/video/matroxfb.c @@ -2680,7 +2680,7 @@ static void initMatrox(WPMINFO struct display* p) { /* --------------------------------------------------------------------- */ static struct fb_var_screeninfo vesafb_defined __initdata = { - 0,0,0,0, /* W,H, W, H (virtual) load xres,xres_virtual*/ + 640,480,640,480,/* W,H, W, H (virtual) load xres,xres_virtual*/ 0,0, /* virtual -> visible no offset */ 8, /* depth -> load bits_per_pixel */ 0, /* greyscale ? */ @@ -2692,8 +2692,8 @@ static struct fb_var_screeninfo vesafb_defined __initdata = { FB_ACTIVATE_NOW, -1,-1, FB_ACCELF_TEXT, /* accel flags */ - 0L,0L,0L,0L,0L, - 0L,0L,0, /* No sync info */ + 39721L,48L,16L,33L,10L, + 96L,2L,~0, /* No sync info */ FB_VMODE_NONINTERLACED, {0,0,0,0,0,0} }; @@ -4622,7 +4622,7 @@ static int matroxfb_get_fix(struct fb_fix_screeninfo *fix, int con, memset(fix, 0, sizeof(struct fb_fix_screeninfo)); strcpy(fix->id,"MATROX"); - fix->smem_start = (void*)ACCESS_FBINFO(video.base) + ACCESS_FBINFO(curr.ydstorg.bytes); + fix->smem_start = ACCESS_FBINFO(video.base) + ACCESS_FBINFO(curr.ydstorg.bytes); fix->smem_len = ACCESS_FBINFO(video.len_usable) - ACCESS_FBINFO(curr.ydstorg.bytes); fix->type = p->type; fix->type_aux = p->type_aux; @@ -4631,7 +4631,7 @@ static int matroxfb_get_fix(struct fb_fix_screeninfo *fix, int con, fix->ypanstep = 1; fix->ywrapstep = 0; fix->line_length = p->line_length; - fix->mmio_start = (void*)ACCESS_FBINFO(mmio.base); + fix->mmio_start = ACCESS_FBINFO(mmio.base); fix->mmio_len = ACCESS_FBINFO(mmio.len); fix->accel = ACCESS_FBINFO(devflags.accelerator); return 0; @@ -5207,7 +5207,7 @@ int __init matroxfb_setup(char *options) { else if (!strncmp(this_opt, "vesa:", 5)) vesa = simple_strtoul(this_opt+5, NULL, 0); else if (!strncmp(this_opt, "font:", 5)) - strcpy(fontname, this_opt+5); + strncpy(fontname, this_opt+5, sizeof(fontname)-1); else if (!strncmp(this_opt, "maxclk:", 7)) maxclk = simple_strtoul(this_opt+7, NULL, 0); else if (!strncmp(this_opt, "fh:", 3)) @@ -5217,7 +5217,7 @@ int __init matroxfb_setup(char *options) { else if (!strncmp(this_opt, "mem:", 4)) mem = simple_strtoul(this_opt+4, NULL, 0); else if (!strncmp(this_opt, "mode:", 5)) - strcpy(videomode, this_opt+5); + strncpy(videomode, this_opt+5, sizeof(videomode)-1); #ifdef CONFIG_FB_OF else if (!strncmp(this_opt, "vmode:", 6)) { unsigned int vmode = simple_strtoul(this_opt+6, NULL, 0); @@ -5289,7 +5289,7 @@ int __init matroxfb_setup(char *options) { else if (!strcmp(this_opt, "grayscale")) grayscale = value; else { - printk(KERN_ERR "matroxfb: unknown parameter %s%s\n", value?"":"no", this_opt); + strncpy(videomode, this_opt, sizeof(videomode)-1); } } } @@ -5847,15 +5847,6 @@ static int __init initMatrox2(WPMINFO struct display* d, struct board* b){ if (depth == -1) depth = RSDepth(RSptr->info); } -#if 0 - if (sync == -1) { - sync = 0; - if (yres < 400) - sync |= FB_SYNC_HOR_HIGH_ACT; - else if (yres < 480) - sync |= FB_SYNC_VERT_HIGH_ACT; - } -#endif if ((depth == RSText8) && (!*ACCESS_FBINFO(fbcon.fontname))) { strcpy(ACCESS_FBINFO(fbcon.fontname), "VGA8x8"); } @@ -5879,13 +5870,23 @@ static int __init initMatrox2(WPMINFO struct display* d, struct board* b){ ACCESS_FBINFO(fbcon.flags) = FBINFO_FLAG_DEFAULT; ACCESS_FBINFO(video.len_usable) &= PAGE_MASK; -#if 0 - fb_find_mode(&vesafb_defined, &ACCESS_FBINFO(fbcon), videomode[0]?videomode:NULL, - NULL, 0, NULL, vesafb_defined.bits_per_pixel); +#ifndef MODULE + /* mode database is marked __init ... */ + { + /* it cannot be static const struct due to __initdata + marker */ + static struct fb_videomode defaultmode __initdata = { + /* 640x480 @ 60Hz, 31.5 kHz */ + NULL, 60, 640, 480, 39721, 40, 24, 32, 11, 96, 2, + 0, FB_VMODE_NONINTERLACED + }; + + fb_find_mode(&vesafb_defined, &ACCESS_FBINFO(fbcon), videomode[0]?videomode:NULL, + NULL, 0, &defaultmode, vesafb_defined.bits_per_pixel); + } #endif + /* mode modifiers */ - if (sync != -1) - vesafb_defined.sync = sync; if (hslen) vesafb_defined.hsync_len = hslen; if (vslen) @@ -5902,6 +5903,16 @@ static int __init initMatrox2(WPMINFO struct display* d, struct board* b){ vesafb_defined.xres = xres; if (yres) vesafb_defined.yres = yres; + if (sync != -1) + vesafb_defined.sync = sync; + else if (vesafb_defined.sync == ~0) { + vesafb_defined.sync = 0; + if (yres < 400) + vesafb_defined.sync |= FB_SYNC_HOR_HIGH_ACT; + else if (yres < 480) + vesafb_defined.sync |= FB_SYNC_VERT_HIGH_ACT; + } + /* fv, fh, maxclk limits was specified */ { unsigned int tmp; diff --git a/drivers/video/offb.c b/drivers/video/offb.c index 9ca7f6313dd3..068282244ef6 100644 --- a/drivers/video/offb.c +++ b/drivers/video/offb.c @@ -533,7 +533,7 @@ static void offb_init_fb(const char *name, const char *full_name, var->yres = var->yres_virtual = height; fix->line_length = pitch; - fix->smem_start = (char *)address; + fix->smem_start = address; fix->smem_len = pitch * height; fix->type = FB_TYPE_PACKED_PIXELS; fix->type_aux = 0; diff --git a/drivers/video/platinumfb.c b/drivers/video/platinumfb.c index fbf1a5006c88..cf7fe3418e80 100644 --- a/drivers/video/platinumfb.c +++ b/drivers/video/platinumfb.c @@ -837,9 +837,9 @@ static int platinum_encode_fix(struct fb_fix_screeninfo *fix, { memset(fix, 0, sizeof(*fix)); strcpy(fix->id, "platinum"); - fix->smem_start = (void *) (info->frame_buffer_phys + 0x1000); + fix->smem_start = (info->frame_buffer_phys + 0x1000); fix->smem_len = (u32) info->total_vram - 0x1000; - fix->mmio_start = (char *) (info->platinum_regs_phys); + fix->mmio_start = (info->platinum_regs_phys); fix->mmio_len = 0x1000; fix->type = FB_TYPE_PACKED_PIXELS; fix->type_aux = 0; diff --git a/drivers/video/q40fb.c b/drivers/video/q40fb.c index 50d3940917b2..8f1e2eb88af6 100644 --- a/drivers/video/q40fb.c +++ b/drivers/video/q40fb.c @@ -86,7 +86,7 @@ static int q40fb_get_fix(struct fb_fix_screeninfo *fix, int con, memset(fix, 0, sizeof(struct fb_fix_screeninfo)); strcpy(fix->id,"Q40"); - fix->smem_start=(char*)q40_screen_addr; + fix->smem_start=q40_screen_addr; fix->smem_len=1024*1024; fix->type=FB_TYPE_PACKED_PIXELS; fix->type_aux=0; diff --git a/drivers/video/retz3fb.c b/drivers/video/retz3fb.c index babad83e7926..dbc6eb022723 100644 --- a/drivers/video/retz3fb.c +++ b/drivers/video/retz3fb.c @@ -794,9 +794,9 @@ static int retz3_encode_fix(struct fb_info *info, memset(fix, 0, sizeof(struct fb_fix_screeninfo)); strcpy(fix->id, retz3fb_name); - fix->smem_start = (char *)(zinfo->physfbmem); + fix->smem_start = zinfo->physfbmem; fix->smem_len = zinfo->fbsize; - fix->mmio_start = (char *)(zinfo->physregs); + fix->mmio_start = zinfo->physregs; fix->mmio_len = 0x00c00000; fix->type = FB_TYPE_PACKED_PIXELS; diff --git a/drivers/video/sgivwfb.c b/drivers/video/sgivwfb.c index 9131d880d467..ce02149cfae3 100644 --- a/drivers/video/sgivwfb.c +++ b/drivers/video/sgivwfb.c @@ -501,7 +501,7 @@ static void sgivwfb_encode_fix(struct fb_fix_screeninfo *fix, { memset(fix, 0, sizeof(struct fb_fix_screeninfo)); strcpy(fix->id, sgivwfb_name); - fix->smem_start = (char *) sgivwfb_mem_phys; + fix->smem_start = sgivwfb_mem_phys; fix->smem_len = sgivwfb_mem_size; fix->type = FB_TYPE_PACKED_PIXELS; fix->type_aux = 0; @@ -517,7 +517,7 @@ static void sgivwfb_encode_fix(struct fb_fix_screeninfo *fix, fix->xpanstep = 0; fix->ypanstep = ypan; fix->line_length = get_line_length(var->xres_virtual, var->bits_per_pixel); - fix->mmio_start = (char *) DBE_REG_PHYS; + fix->mmio_start = DBE_REG_PHYS; fix->mmio_len = DBE_REG_SIZE; } diff --git a/drivers/video/tgafb.c b/drivers/video/tgafb.c index 54a394aae973..841cde277ec3 100644 --- a/drivers/video/tgafb.c +++ b/drivers/video/tgafb.c @@ -328,9 +328,9 @@ static int tgafb_encode_fix(struct fb_fix_screeninfo *fix, const void *fb_par, fix->visual = FB_VISUAL_TRUECOLOR; fix->line_length = par->xres * (par->bits_per_pixel >> 3); - fix->smem_start = ioremap(fb_info.tga_fb_base); + fix->smem_start = fb_info.tga_fb_base; fix->smem_len = fix->line_length * par->yres; - fix->mmio_start = ioremap(fb_info.tga_regs_base); + fix->mmio_start = fb_info.tga_regs_base; fix->mmio_len = 0x1000; /* Is this sufficient? */ fix->xpanstep = fix->ypanstep = fix->ywrapstep = 0; fix->accel = FB_ACCEL_DEC_TGA; diff --git a/drivers/video/valkyriefb.c b/drivers/video/valkyriefb.c index b2d723bc175e..b8342c962670 100644 --- a/drivers/video/valkyriefb.c +++ b/drivers/video/valkyriefb.c @@ -783,7 +783,7 @@ static void valkyrie_par_to_fix(struct fb_par_valkyrie *par, struct fb_fix_screeninfo *fix, struct fb_info_valkyrie *p) { - fix->smem_start = (void *)(p->frame_buffer_phys + 0x1000); + fix->smem_start = p->frame_buffer_phys + 0x1000; #if 1 fix->smem_len = valkyrie_vram_reqd(par->vmode, par->cmode); #else diff --git a/drivers/video/vesafb.c b/drivers/video/vesafb.c index 9ecfad93165f..b808fd0a6b0b 100644 --- a/drivers/video/vesafb.c +++ b/drivers/video/vesafb.c @@ -166,7 +166,7 @@ static int vesafb_get_fix(struct fb_fix_screeninfo *fix, int con, memset(fix, 0, sizeof(struct fb_fix_screeninfo)); strcpy(fix->id,"VESA VGA"); - fix->smem_start=(char *) video_base; + fix->smem_start=video_base; fix->smem_len=video_size; fix->type = video_type; fix->visual = video_visual; diff --git a/drivers/video/vfb.c b/drivers/video/vfb.c index 81bdba8545a2..165b030778bc 100644 --- a/drivers/video/vfb.c +++ b/drivers/video/vfb.c @@ -507,7 +507,7 @@ static void vfb_encode_fix(struct fb_fix_screeninfo *fix, { memset(fix, 0, sizeof(struct fb_fix_screeninfo)); strcpy(fix->id, vfb_name); - fix->smem_start = (char *)videomemory; + fix->smem_start = videomemory; fix->smem_len = videomemorysize; fix->type = FB_TYPE_PACKED_PIXELS; fix->type_aux = 0; diff --git a/drivers/video/vga16fb.c b/drivers/video/vga16fb.c index 6ade171b99ef..723bef47657f 100644 --- a/drivers/video/vga16fb.c +++ b/drivers/video/vga16fb.c @@ -158,7 +158,7 @@ static int vga16fb_get_fix(struct fb_fix_screeninfo *fix, int con, memset(fix, 0, sizeof(struct fb_fix_screeninfo)); strcpy(fix->id,"VGA16 VGA"); - fix->smem_start = (char *) 0xa0000; + fix->smem_start = 0xa0000; fix->smem_len = 65536; fix->type = FB_TYPE_VGA_PLANES; fix->visual = FB_VISUAL_PSEUDOCOLOR; diff --git a/drivers/video/virgefb.c b/drivers/video/virgefb.c index 8b39e8c06433..1e9abfe3d6a0 100644 --- a/drivers/video/virgefb.c +++ b/drivers/video/virgefb.c @@ -441,19 +441,19 @@ static int Cyber_encode_fix(struct fb_fix_screeninfo *fix, memset(fix, 0, sizeof(struct fb_fix_screeninfo)); strcpy(fix->id, virgefb_name); if (cv3d_on_zorro2) { - fix->smem_start = (char*) CyberMem_phys; + fix->smem_start = CyberMem_phys; } else { switch (par->bpp) { case 8: - fix->smem_start = (char*) (CyberMem_phys + CYBMEM_OFFSET_8); + fix->smem_start = (CyberMem_phys + CYBMEM_OFFSET_8); break; case 16: - fix->smem_start = (char*) (CyberMem_phys + CYBMEM_OFFSET_16); + fix->smem_start = (CyberMem_phys + CYBMEM_OFFSET_16); break; } } fix->smem_len = CyberSize; - fix->mmio_start = (char*) CyberRegs_phys; + fix->mmio_start = CyberRegs_phys; fix->mmio_len = 0x10000; /* TODO: verify this for the CV64/3D */ fix->type = FB_TYPE_PACKED_PIXELS; diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c index 171f34a164c7..a4e995432787 100644 --- a/fs/ext2/inode.c +++ b/fs/ext2/inode.c @@ -259,20 +259,22 @@ repeat: } if (metadata) { result = getblk (inode->i_dev, tmp, blocksize); + memset(result->b_data, 0, blocksize); + mark_buffer_uptodate(result, 1); + mark_buffer_dirty(result, 1); if (*p) { ext2_free_blocks (inode, tmp, 1); - brelse (result); + bforget (result); goto repeat; } - memset(result->b_data, 0, blocksize); - mark_buffer_uptodate(result, 1); - mark_buffer_dirty(result, 1); } else { if (*p) { /* * Nobody is allowed to change block allocation * state from under us: */ + ext2_error (inode->i_sb, "block_getblk", + "data block filled under us"); BUG(); ext2_free_blocks (inode, tmp, 1); goto repeat; @@ -366,23 +368,29 @@ repeat: goto out; if (metadata) { result = getblk (bh->b_dev, tmp, blocksize); + memset(result->b_data, 0, inode->i_sb->s_blocksize); + mark_buffer_uptodate(result, 1); + mark_buffer_dirty(result, 1); if (*p) { ext2_free_blocks (inode, tmp, 1); - brelse (result); + bforget (result); goto repeat; } - memset(result->b_data, 0, inode->i_sb->s_blocksize); - mark_buffer_uptodate(result, 1); - mark_buffer_dirty(result, 1); } else { + if (*p) { + /* + * Nobody is allowed to change block allocation + * state from under us: + */ + ext2_error (inode->i_sb, "block_getblk", + "data block filled under us"); + BUG(); + ext2_free_blocks (inode, tmp, 1); + goto repeat; + } *phys = tmp; *new = 1; } - if (*p) { - ext2_free_blocks (inode, tmp, 1); - brelse (result); - goto repeat; - } *p = le32_to_cpu(tmp); mark_buffer_dirty(bh, 1); if (IS_SYNC(inode) || inode->u.ext2_i.i_osync) { diff --git a/fs/namei.c b/fs/namei.c index e39cd24e1bc6..e0e41507335c 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -250,7 +250,7 @@ static struct dentry * real_lookup(struct dentry * parent, struct qstr * name, i * FIXME! This could use version numbering or similar to * avoid unnecessary cache lookups. */ - result = cached_lookup(parent, name, flags); + result = d_lookup(parent, name); if (!result) { struct dentry * dentry = d_alloc(parent, name); result = ERR_PTR(-ENOMEM); @@ -261,8 +261,19 @@ static struct dentry * real_lookup(struct dentry * parent, struct qstr * name, i else result = dentry; } + up(&dir->i_sem); + return result; } + + /* + * Uhhuh! Nasty case: the cache was re-populated while + * we waited on the semaphore. Need to revalidate, but + * we're going to return this entry regardless (same + * as if it was busy). + */ up(&dir->i_sem); + if (result->d_op && result->d_op->d_revalidate) + result->d_op->d_revalidate(result, flags); return result; } diff --git a/include/asm-alpha/io.h b/include/asm-alpha/io.h index 24cd808892ae..dfb39c3ddd6e 100644 --- a/include/asm-alpha/io.h +++ b/include/asm-alpha/io.h @@ -121,7 +121,7 @@ extern void _sethae (unsigned long addr); /* cached version */ # define __raw_readl __readl # define __raw_readq __readq # define __raw_writeb __writeb -# define __raw_writeb __writew +# define __raw_writew __writew # define __raw_writel __writel # define __raw_writeq __writeq @@ -271,7 +271,7 @@ extern unsigned long ___raw_readw(unsigned long addr); extern unsigned long ___raw_readl(unsigned long addr); extern unsigned long ___raw_readq(unsigned long addr); extern void ___raw_writeb(unsigned char b, unsigned long addr); -extern void ___raw_writeb(unsigned short b, unsigned long addr); +extern void ___raw_writew(unsigned short b, unsigned long addr); extern void ___raw_writel(unsigned int b, unsigned long addr); extern void ___raw_writeq(unsigned long b, unsigned long addr); @@ -291,8 +291,8 @@ extern void ___raw_writeq(unsigned long b, unsigned long addr); #ifdef __raw_writeb # define writeb(v,a) ({ __raw_writeb((v),(a)); mb(); }) #endif -#ifdef __raw_writeb -# define writew(v,a) ({ __raw_writeb((v),(a)); mb(); }) +#ifdef __raw_writew +# define writew(v,a) ({ __raw_writew((v),(a)); mb(); }) #endif #ifdef __raw_writel # define writel(v,a) ({ __raw_writel((v),(a)); mb(); }) @@ -317,8 +317,8 @@ extern void ___raw_writeq(unsigned long b, unsigned long addr); #ifndef __raw_writeb # define __raw_writeb(v,a) ___raw_writeb((v),(unsigned long)(a)) #endif -#ifndef __raw_writeb -# define __raw_writeb(v,a) ___raw_writeb((v),(unsigned long)(a)) +#ifndef __raw_writew +# define __raw_writew(v,a) ___raw_writew((v),(unsigned long)(a)) #endif #ifndef __raw_writel # define __raw_writel(v,a) ___raw_writel((v),(unsigned long)(a)) diff --git a/include/asm-alpha/pgtable.h b/include/asm-alpha/pgtable.h index 5c810dc57fc7..0082f4bc229f 100644 --- a/include/asm-alpha/pgtable.h +++ b/include/asm-alpha/pgtable.h @@ -621,4 +621,7 @@ extern inline pte_t mk_swap_pte(unsigned long type, unsigned long offset) #define PageSkip(page) (0) #define kern_addr_valid(addr) (1) +#define io_remap_page_range(start, busaddr, size, prot) \ + remap_page_range(start, virt_to_phys(ioremap(busaddr)), size, prot) + #endif /* _ALPHA_PGTABLE_H */ diff --git a/include/asm-i386/atomic.h b/include/asm-i386/atomic.h index fd1d75bebaf1..70bd39f695d5 100644 --- a/include/asm-i386/atomic.h +++ b/include/asm-i386/atomic.h @@ -73,6 +73,17 @@ static __inline__ int atomic_dec_and_test(volatile atomic_t *v) return c != 0; } +extern __inline__ int atomic_inc_and_test_greater_zero(volatile atomic_t *v) +{ + unsigned char c; + + __asm__ __volatile__( + LOCK "incl %0; setg %1" + :"=m" (__atomic_fool_gcc(v)), "=qm" (c) + :"m" (__atomic_fool_gcc(v))); + return c; /* can be only 0 or 1 */ +} + /* These are x86-specific, used by some header files */ #define atomic_clear_mask(mask, addr) \ __asm__ __volatile__(LOCK "andl %0,%1" \ diff --git a/include/asm-i386/hardirq.h b/include/asm-i386/hardirq.h index 25dbbc2c0e91..f96faa80649c 100644 --- a/include/asm-i386/hardirq.h +++ b/include/asm-i386/hardirq.h @@ -53,7 +53,7 @@ static inline void hardirq_exit(int cpu) static inline int hardirq_trylock(int cpu) { - return !atomic_read(&global_irq_count) && !test_bit(0,&global_irq_lock); + return !local_irq_count[cpu] && !test_bit(0,&global_irq_lock); } #define hardirq_endlock(cpu) do { } while (0) diff --git a/include/asm-i386/pgtable.h b/include/asm-i386/pgtable.h index 6d720e72e079..36303437b527 100644 --- a/include/asm-i386/pgtable.h +++ b/include/asm-i386/pgtable.h @@ -525,4 +525,6 @@ extern inline void update_mmu_cache(struct vm_area_struct * vma, #define PageSkip(page) (0) #define kern_addr_valid(addr) (1) +#define io_remap_page_range remap_page_range + #endif /* _I386_PAGE_H */ diff --git a/include/asm-i386/semaphore-helper.h b/include/asm-i386/semaphore-helper.h index c8636da0cc61..a80dfe566f40 100644 --- a/include/asm-i386/semaphore-helper.h +++ b/include/asm-i386/semaphore-helper.h @@ -13,14 +13,19 @@ * * This is trivially done with load_locked/store_cond, * but on the x86 we need an external synchronizer. + * + * NOTE: we can't look at the semaphore count here since it can be + * unreliable. Even if the count is minor than 1, the semaphore + * could be just owned by another process (this because not only up() increases + * the semaphore count, also the interruptible/trylock call can increment + * the semaphore count when they fails). */ static inline void wake_one_more(struct semaphore * sem) { unsigned long flags; spin_lock_irqsave(&semaphore_wake_lock, flags); - if (atomic_read(&sem->count) <= 0) - sem->waking++; + sem->waking++; spin_unlock_irqrestore(&semaphore_wake_lock, flags); } @@ -44,9 +49,11 @@ static inline int waking_non_zero(struct semaphore *sem) * 0 go to sleep * -EINTR interrupted * - * We must undo the sem->count down_interruptible() increment while we are - * protected by the spinlock in order to make atomic this atomic_inc() with the - * atomic_read() in wake_one_more(), otherwise we can race. -arca + * If we give up we must undo our count-decrease we previously did in down(). + * Subtle: up() can continue to happens and increase the semaphore count + * even during our critical section protected by the spinlock. So + * we must remeber to undo the sem->waking that will be run from + * wake_one_more() some time soon, if the semaphore count become > 0. */ static inline int waking_non_zero_interruptible(struct semaphore *sem, struct task_struct *tsk) @@ -59,7 +66,8 @@ static inline int waking_non_zero_interruptible(struct semaphore *sem, sem->waking--; ret = 1; } else if (signal_pending(tsk)) { - atomic_inc(&sem->count); + if (atomic_inc_and_test_greater_zero(&sem->count)) + sem->waking--; ret = -EINTR; } spin_unlock_irqrestore(&semaphore_wake_lock, flags); @@ -71,9 +79,7 @@ static inline int waking_non_zero_interruptible(struct semaphore *sem, * 1 failed to lock * 0 got the lock * - * We must undo the sem->count down_trylock() increment while we are - * protected by the spinlock in order to make atomic this atomic_inc() with the - * atomic_read() in wake_one_more(), otherwise we can race. -arca + * Implementation details are the same of the interruptible case. */ static inline int waking_non_zero_trylock(struct semaphore *sem) { @@ -82,8 +88,10 @@ static inline int waking_non_zero_trylock(struct semaphore *sem) spin_lock_irqsave(&semaphore_wake_lock, flags); if (sem->waking <= 0) - atomic_inc(&sem->count); - else { + { + if (atomic_inc_and_test_greater_zero(&sem->count)) + sem->waking--; + } else { sem->waking--; ret = 0; } diff --git a/include/asm-m68k/pgtable.h b/include/asm-m68k/pgtable.h index a895528dc7e6..f809fa5a7e73 100644 --- a/include/asm-m68k/pgtable.h +++ b/include/asm-m68k/pgtable.h @@ -777,4 +777,6 @@ extern inline void update_mmu_cache(struct vm_area_struct * vma, #define PageSkip(page) (0) #define kern_addr_valid(addr) (1) +#define io_remap_page_range remap_page_range + #endif /* _M68K_PGTABLE_H */ diff --git a/include/asm-ppc/pgtable.h b/include/asm-ppc/pgtable.h index 235e1f762918..c7b39de35364 100644 --- a/include/asm-ppc/pgtable.h +++ b/include/asm-ppc/pgtable.h @@ -647,5 +647,7 @@ extern void kernel_set_cachemode (unsigned long address, unsigned long size, #define PageSkip(page) (0) #define kern_addr_valid(addr) (1) +#define io_remap_page_range remap_page_range + #endif __ASSEMBLY__ #endif /* _PPC_PGTABLE_H */ diff --git a/include/linux/fb.h b/include/linux/fb.h index 4b5100136158..f7a7e2b645c0 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -83,7 +83,7 @@ struct fb_fix_screeninfo { char id[16]; /* identification string eg "TT Builtin" */ - char *smem_start; /* Start of frame buffer mem */ + unsigned long smem_start; /* Start of frame buffer mem */ /* (physical address) */ __u32 smem_len; /* Length of frame buffer mem */ __u32 type; /* see FB_TYPE_* */ @@ -93,7 +93,7 @@ struct fb_fix_screeninfo { __u16 ypanstep; /* zero if no hardware panning */ __u16 ywrapstep; /* zero if no hardware ywrap */ __u32 line_length; /* length of a line in bytes */ - char *mmio_start; /* Start of Memory Mapped I/O */ + unsigned long mmio_start; /* Start of Memory Mapped I/O */ /* (physical address) */ __u32 mmio_len; /* Length of Memory Mapped I/O */ __u32 accel; /* Type of acceleration available */ diff --git a/kernel/printk.c b/kernel/printk.c index 09fb686280e9..ebae4a565b2f 100644 --- a/kernel/printk.c +++ b/kernel/printk.c @@ -10,6 +10,8 @@ * elsewhere, in preparation for a serial line console (someday). * Ted Ts'o, 2/11/93. * Modified for sysctl support, 1/8/97, Chris Horn. + * Fixed SMP synchronization, 08/08/99, Manfred Spraul + * manfreds@colorfullife.com */ #include @@ -21,6 +23,7 @@ #include #define LOG_BUF_LEN (16384) +#define LOG_BUF_MASK (LOG_BUF_LEN-1) static char buf[1024]; @@ -40,13 +43,14 @@ int default_message_loglevel = DEFAULT_MESSAGE_LOGLEVEL; int minimum_console_loglevel = MINIMUM_CONSOLE_LOGLEVEL; int default_console_loglevel = DEFAULT_CONSOLE_LOGLEVEL; +spinlock_t console_lock = SPIN_LOCK_UNLOCKED; + struct console *console_drivers = NULL; static char log_buf[LOG_BUF_LEN]; static unsigned long log_start = 0; static unsigned long logged_chars = 0; struct console_cmdline console_cmdline[MAX_CMDLINECONSOLES]; static int preferred_console = -1; -spinlock_t console_lock = SPIN_LOCK_UNLOCKED; /* * Setup a list of consoles. Called from init/main.c @@ -118,7 +122,7 @@ __setup("console=", console_setup); */ int do_syslog(int type, char * buf, int len) { - unsigned long i, j, count; + unsigned long i, j, limit, count; int do_clear = 0; char c; int error = -EPERM; @@ -145,10 +149,9 @@ int do_syslog(int type, char * buf, int len) i = 0; spin_lock_irq(&console_lock); while (log_size && i < len) { - c = *((char *) log_buf+log_start); + c = log_buf[log_start & LOG_BUF_MASK]; log_start++; log_size--; - log_start &= LOG_BUF_LEN-1; spin_unlock_irq(&console_lock); __put_user(c,buf); buf++; @@ -171,34 +174,41 @@ int do_syslog(int type, char * buf, int len) error = verify_area(VERIFY_WRITE,buf,len); if (error) goto out; + spin_lock_irq(&console_lock); count = len; if (count > LOG_BUF_LEN) count = LOG_BUF_LEN; - /* The logged_chars, log_start, and log_size are serialized - by the console_lock (the console_lock can be acquired also - from irqs by printk). */ - spin_lock_irq(&console_lock); if (count > logged_chars) count = logged_chars; - j = log_start + log_size - count; - spin_unlock_irq(&console_lock); - /* While writing data to the userspace buffer printk may - trash our information but the _only_ thing we care is to - have a coherent `j' value. */ - for (i = 0; i < count; i++) { - c = *((char *) log_buf+(j++ & (LOG_BUF_LEN-1))); - __put_user(c, buf++); - } if (do_clear) - { - /* the increment done in printk may undo our - not atomic assigment if we do it without the - console lock held. */ - spin_lock_irq(&console_lock); logged_chars = 0; + limit = log_start + log_size; + /* + * __put_user() could sleep, and while we sleep + * printk() could overwrite the messages + * we try to copy to user space. Therefore + * the messages are copied in reverse. + */ + for(i=0;i < count;i++) { + j = limit-1-i; + if (j+LOG_BUF_LEN < log_start+log_size) + break; + c = log_buf[ j & LOG_BUF_MASK ]; spin_unlock_irq(&console_lock); + __put_user(c,&buf[count-1-i]); + spin_lock_irq(&console_lock); } + spin_unlock_irq(&console_lock); error = i; + if(i != count) { + int offset = count-error; + /* buffer overflow during copy, correct user buffer. */ + for(i=0;i 8) goto out; - spin_lock_irq(&console_lock); if (len < minimum_console_loglevel) len = minimum_console_loglevel; + spin_lock_irq(&console_lock); console_loglevel = len; spin_unlock_irq(&console_lock); error = 0; @@ -241,7 +251,6 @@ asmlinkage int sys_syslog(int type, char * buf, int len) return do_syslog(type, buf, len); } - asmlinkage int printk(const char *fmt, ...) { va_list args; @@ -275,13 +284,12 @@ asmlinkage int printk(const char *fmt, ...) } line_feed = 0; for (; p < buf_end; p++) { - log_buf[(log_start+log_size) & (LOG_BUF_LEN-1)] = *p; + log_buf[(log_start+log_size) & LOG_BUF_MASK] = *p; if (log_size < LOG_BUF_LEN) log_size++; - else { + else log_start++; - log_start &= LOG_BUF_LEN-1; - } + logged_chars++; if (*p == '\n') { line_feed = 1; @@ -306,29 +314,33 @@ asmlinkage int printk(const char *fmt, ...) void console_print(const char *s) { - struct console *c = console_drivers; + struct console *c; + unsigned long flags; int len = strlen(s); - spin_lock_irq(&console_lock); + spin_lock_irqsave(&console_lock,flags); + c = console_drivers; while(c) { if ((c->flags & CON_ENABLED) && c->write) c->write(c, s, len); c = c->next; } - spin_unlock_irq(&console_lock); + spin_unlock_irqrestore(&console_lock,flags); } void unblank_console(void) { - struct console *c = console_drivers; - - spin_lock_irq(&console_lock); + struct console *c; + unsigned long flags; + + spin_lock_irqsave(&console_lock,flags); + c = console_drivers; while(c) { if ((c->flags & CON_ENABLED) && c->unblank) c->unblank(); c = c->next; } - spin_unlock_irq(&console_lock); + spin_unlock_irqrestore(&console_lock,flags); } /* @@ -339,13 +351,13 @@ void unblank_console(void) */ void register_console(struct console * console) { - int i,j,len; + int i, j,len; int p; char buf[16]; signed char msg_level = -1; char *q; + unsigned long flags; - spin_lock_irq(&console_lock); /* * See if we want to use this console driver. If we * didn't select a console we take the first one @@ -384,12 +396,13 @@ void register_console(struct console * console) } if (!(console->flags & CON_ENABLED)) - goto out; + return; /* * Put this console in the list - keep the * preferred driver at the head of the list. */ + spin_lock_irqsave(&console_lock,flags); if ((console->flags & CON_CONSDEV) || console_drivers == NULL) { console->next = console_drivers; console_drivers = console; @@ -397,23 +410,33 @@ void register_console(struct console * console) console->next = console_drivers->next; console_drivers->next = console; } - if ((console->flags & CON_PRINTBUFFER) == 0) goto out; - + if ((console->flags & CON_PRINTBUFFER) == 0) + goto done; /* * Print out buffered log messages. */ - for (p=log_start,i=0,j=0; i < log_size; i++) { + p = log_start & LOG_BUF_MASK; + + for (i=0,j=0; i < log_size; i++) { buf[j++] = log_buf[p]; - p++; p &= LOG_BUF_LEN-1; + p = (p+1) & LOG_BUF_MASK; if (buf[j-1] != '\n' && i < log_size - 1 && j < sizeof(buf)-1) continue; buf[j] = 0; q = buf; len = j; if (msg_level < 0) { - msg_level = buf[1] - '0'; - q = buf + 3; - len -= 3; + if(buf[0] == '<' && + buf[1] >= '0' && + buf[1] <= '7' && + buf[2] == '>') { + msg_level = buf[1] - '0'; + q = buf + 3; + len -= 3; + } else + { + msg_level = default_message_loglevel; + } } if (msg_level < console_loglevel) console->write(console, q, len); @@ -421,32 +444,35 @@ void register_console(struct console * console) msg_level = -1; j = 0; } - out: - spin_unlock_irq(&console_lock); +done: + spin_unlock_irqrestore(&console_lock,flags); } int unregister_console(struct console * console) { struct console *a,*b; - int ret = 0; - - spin_lock_irq(&console_lock); + unsigned long flags; + int res = 1; + + spin_lock_irqsave(&console_lock,flags); if (console_drivers == console) { console_drivers=console->next; - goto out; - } - for (a=console_drivers->next, b=console_drivers ; - a; b=a, a=b->next) { - if (a == console) { - b->next = a->next; - goto out; - } + res = 0; + } else + { + for (a=console_drivers->next, b=console_drivers ; + a; b=a, a=b->next) { + if (a == console) { + b->next = a->next; + res = 0; + break; + } + } } - ret = 1; - out: - spin_unlock_irq(&console_lock); - return ret; + + spin_unlock_irqrestore(&console_lock,flags); + return res; } /* diff --git a/kernel/sched.c b/kernel/sched.c index e61d2c5dc0ae..3cfeb7deca7e 100644 --- a/kernel/sched.c +++ b/kernel/sched.c @@ -224,69 +224,14 @@ static inline int preemption_goodness(struct task_struct * prev, struct task_str return goodness(p, cpu, prev->mm) - goodness(prev, cpu, prev->mm); } -/* - * If there is a dependency between p1 and p2, - * don't be too eager to go into the slow schedule. - * In particular, if p1 and p2 both want the kernel - * lock, there is no point in trying to make them - * extremely parallel.. - * - * (No lock - lock_depth < 0) - * - * There are two additional metrics here: - * - * first, a 'cutoff' interval, currently 0-200 usecs on - * x86 CPUs, depending on the size of the 'SMP-local cache'. - * If the current process has longer average timeslices than - * this, then we utilize the idle CPU. - * - * second, if the wakeup comes from a process context, - * then the two processes are 'related'. (they form a - * 'gang') - * - * An idle CPU is almost always a bad thing, thus we skip - * the idle-CPU utilization only if both these conditions - * are true. (ie. a 'process-gang' rescheduling with rather - * high frequency should stay on the same CPU). - * - * [We can switch to something more finegrained in 2.3.] - * - * do not 'guess' if the to-be-scheduled task is RT. - */ -#define related(p1,p2) (((p1)->lock_depth >= 0) && (p2)->lock_depth >= 0) && \ - (((p2)->policy == SCHED_OTHER) && ((p1)->avg_slice < cacheflush_time)) - -static inline void reschedule_idle_slow(struct task_struct * p) +static void reschedule_idle(struct task_struct * p) { #ifdef __SMP__ -/* - * (see reschedule_idle() for an explanation first ...) - * - * Pass #2 - * - * We try to find another (idle) CPU for this woken-up process. - * - * On SMP, we mostly try to see if the CPU the task used - * to run on is idle.. but we will use another idle CPU too, - * at this point we already know that this CPU is not - * willing to reschedule in the near future. - * - * An idle CPU is definitely wasted, especially if this CPU is - * running long-timeslice processes. The following algorithm is - * pretty good at finding the best idle CPU to send this process - * to. - * - * [We can try to preempt low-priority processes on other CPUs in - * 2.3. Also we can try to use the avg_slice value to predict - * 'likely reschedule' events even on other CPUs.] - */ int this_cpu = smp_processor_id(), target_cpu; struct task_struct *tsk, *target_tsk; - int cpu, best_cpu, weight, best_weight, i; + int cpu, best_cpu, i; unsigned long flags; - best_weight = 0; /* prevents negative weight */ - spin_lock_irqsave(&runqueue_lock, flags); /* @@ -302,15 +247,17 @@ static inline void reschedule_idle_slow(struct task_struct * p) for (i = 0; i < smp_num_cpus; i++) { cpu = cpu_logical_map(i); tsk = cpu_curr(cpu); - if (related(tsk, p)) - goto out_no_target; - weight = preemption_goodness(tsk, p, cpu); - if (weight > best_weight) { - best_weight = weight; + if (tsk == idle_task(cpu)) target_tsk = tsk; - } } + if (target_tsk && p->avg_slice > cacheflush_time) + goto send_now; + + tsk = cpu_curr(best_cpu); + if (preemption_goodness(tsk, p, best_cpu) > 0) + target_tsk = tsk; + /* * found any suitable CPU? */ @@ -341,35 +288,6 @@ out_no_target: #endif } -static void reschedule_idle(struct task_struct * p) -{ -#ifdef __SMP__ - int cpu = smp_processor_id(); - /* - * ("wakeup()" should not be called before we've initialized - * SMP completely. - * Basically a not-yet initialized SMP subsystem can be - * considered as a not-yet working scheduler, simply dont use - * it before it's up and running ...) - * - * SMP rescheduling is done in 2 passes: - * - pass #1: faster: 'quick decisions' - * - pass #2: slower: 'lets try and find a suitable CPU' - */ - - /* - * Pass #1. (subtle. We might be in the middle of __switch_to, so - * to preserve scheduling atomicity we have to use cpu_curr) - */ - if ((p->processor == cpu) && related(cpu_curr(cpu), p)) - return; -#endif /* __SMP__ */ - /* - * Pass #2 - */ - reschedule_idle_slow(p); -} - /* * Careful! * diff --git a/mm/filemap.c b/mm/filemap.c index f41622f40fca..e9d1705933a3 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -1383,8 +1383,11 @@ page_not_uptodate: * because there really aren't any performance issues here * and we need to check for errors. */ - if (!PageLocked(page)) - PAGE_BUG(page); + lock_page(page); + if (Page_Uptodate(page)) { + UnlockPage(page); + goto success; + } ClearPageError(page); error = inode->i_op->readpage(file, page); if (error) diff --git a/mm/memory.c b/mm/memory.c index 91d9bc6ce4ed..c68c40f37428 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -540,8 +540,10 @@ int map_user_kiobuf(int rw, struct kiobuf *iobuf, unsigned long va, size_t len) wait_on_page(map); } - if (++repeat < 16) + if (++repeat < 16) { + ptr = va & PAGE_MASK; goto repeat; + } return -EAGAIN; } diff --git a/net/khttpd/security.c b/net/khttpd/security.c index 76f8fbf37008..cef3c27c75fe 100644 --- a/net/khttpd/security.c +++ b/net/khttpd/security.c @@ -156,7 +156,7 @@ struct file *OpenFileForSecurity(char *Filename) while (List!=NULL) { - if (strstr(List->value,Filename)!=NULL) + if (strstr(Filename,List->value)!=NULL) { if (filp!=NULL) fput(filp); diff --git a/scripts/mkdep.c b/scripts/mkdep.c index 973c1ced2e50..0430b2bbaa7b 100644 --- a/scripts/mkdep.c +++ b/scripts/mkdep.c @@ -8,6 +8,16 @@ * I make simple dependency lines for #include <*.h> and #include "*.h". * I also find instances of CONFIG_FOO and generate dependencies * like include/config/foo.h. + * + * 1 August 1999, Michael Elizabeth Chastain, + * - Keith Owens reported a bug in smart config processing. There used + * to be an optimization for "#define CONFIG_FOO ... #ifdef CONFIG_FOO", + * so that the file would not depend on CONFIG_FOO because the file defines + * this symbol itself. But this optimization is bogus! Consider this code: + * "#if 0 \n #define CONFIG_FOO \n #endif ... #ifdef CONFIG_FOO". Here + * the definition is inactivated, but I still used it. It turns out this + * actually happens a few times in the kernel source. The simple way to + * fix this problem is to remove this particular optimization. */ #include @@ -93,22 +103,11 @@ int is_defined_config(const char * name, int len) /* * Add a new value to the configuration string. */ -void define_config(int convert, const char * name, int len) +void define_config(const char * name, int len) { grow_config(len + 1); memcpy(str_config+len_config, name, len); - - if (convert) { - int i; - for (i = 0; i < len; i++) { - char c = str_config[len_config+i]; - if (isupper(c)) c = tolower(c); - if (c == '_') c = '/'; - str_config[len_config+i] = c; - } - } - len_config += len; str_config[len_config++] = '\n'; } @@ -121,7 +120,7 @@ void define_config(int convert, const char * name, int len) void clear_config(void) { len_config = 0; - define_config(0, "", 0); + define_config("", 0); } @@ -186,7 +185,7 @@ void handle_include(int type, const char * name, int len) return; if (len >= 7 && !memcmp(name, "config/", 7)) - define_config(0, name+7, len-7-2); + define_config(name+7, len-7-2); memcpy(path->buffer+path->len, name, len); path->buffer[path->len+len] = '\0'; @@ -225,7 +224,7 @@ void use_config(const char * name, int len) if (is_defined_config(pc, len)) return; - define_config(0, pc, len); + define_config(pc, len); if (!hasdep) { hasdep = 1; @@ -409,7 +408,13 @@ pound_u: GETNEXT NOTCASE('f', __start); goto pound_define_undef; -/* #\s*(define|undef)\s*CONFIG_(\w*) */ +/* + * #\s*(define|undef)\s*CONFIG_(\w*) + * + * this does not define the word, because it could be inside another + * conditional (#if 0). But I do parse the word so that this instance + * does not count as a use. -- mec + */ pound_define_undef: GETNEXT CASE(' ', pound_define_undef); @@ -428,7 +433,6 @@ pound_define_undef_CONFIG_word: GETNEXT if (isalnum(current) || current == '_') goto pound_define_undef_CONFIG_word; - define_config(1, map_dot, next - map_dot - 1); goto __start; /* \