From 8e268fb9b5fc270d5db28e36f0096f5ad29ba007 Mon Sep 17 00:00:00 2001 From: Liam Girdwood Date: Thu, 5 Oct 2006 13:22:42 +0100 Subject: [PATCH] --- yaml --- r: 39782 b: refs/heads/master c: 69f0304e174c765c624d75b79c35e49b7ba67ed4 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/Documentation/ibm-acpi.txt | 75 +- trunk/Documentation/video4linux/CARDLIST.cx88 | 2 +- trunk/MAINTAINERS | 22 +- trunk/Makefile | 3 +- trunk/arch/i386/kernel/acpi/boot.c | 10 +- trunk/arch/i386/kernel/acpi/cstate.c | 122 +- trunk/arch/i386/kernel/apm.c | 37 +- trunk/arch/i386/kernel/i8253.c | 2 +- trunk/arch/i386/kernel/i8259.c | 7 +- trunk/arch/i386/kernel/io_apic.c | 17 +- trunk/arch/i386/kernel/irq.c | 2 +- trunk/arch/i386/kernel/process.c | 22 +- trunk/arch/i386/kernel/tsc.c | 6 +- .../powerpc/configs/mpc834x_itx_defconfig | 2 +- trunk/arch/powerpc/kernel/cputable.c | 2 +- trunk/arch/powerpc/kernel/pci_32.c | 12 +- trunk/arch/powerpc/kernel/pci_64.c | 10 +- trunk/arch/powerpc/kernel/process.c | 10 +- trunk/arch/powerpc/kernel/traps.c | 3 +- trunk/arch/powerpc/platforms/83xx/Kconfig | 13 - trunk/arch/powerpc/platforms/83xx/Makefile | 2 - .../arch/powerpc/platforms/83xx/mpc8360e_pb.c | 19 - trunk/arch/powerpc/platforms/cell/spu_base.c | 15 +- .../arch/powerpc/platforms/cell/spufs/file.c | 1 - trunk/arch/ppc/kernel/time.c | 4 - trunk/arch/ppc/platforms/mpc8272ads_setup.c | 4 +- trunk/arch/ppc/platforms/mpc866ads_setup.c | 4 +- trunk/arch/ppc/platforms/mpc885ads_setup.c | 4 +- trunk/arch/um/include/kern_util.h | 1 + trunk/arch/um/sys-x86_64/stub_segv.c | 1 + trunk/arch/x86_64/kernel/i8259.c | 7 +- trunk/arch/x86_64/kernel/io_apic.c | 15 +- trunk/arch/x86_64/kernel/irq.c | 2 +- trunk/arch/x86_64/kernel/process.c | 22 +- trunk/drivers/Kconfig | 6 +- trunk/drivers/acpi/asus_acpi.c | 67 +- trunk/drivers/acpi/battery.c | 14 - trunk/drivers/acpi/ec.c | 1096 ++++++++++++----- trunk/drivers/acpi/events/evmisc.c | 14 +- trunk/drivers/acpi/events/evrgnini.c | 13 +- trunk/drivers/acpi/ibm_acpi.c | 2 + trunk/drivers/acpi/motherboard.c | 6 - trunk/drivers/acpi/osl.c | 34 +- trunk/drivers/acpi/pci_link.c | 2 +- trunk/drivers/acpi/power.c | 9 +- trunk/drivers/acpi/processor_core.c | 2 +- trunk/drivers/acpi/processor_idle.c | 109 +- trunk/drivers/acpi/sbs.c | 20 +- trunk/drivers/acpi/tables/tbget.c | 2 +- trunk/drivers/acpi/tables/tbrsdt.c | 2 +- trunk/drivers/block/rd.c | 12 +- trunk/drivers/bluetooth/bcm203x.c | 17 +- trunk/drivers/char/Kconfig | 2 +- trunk/drivers/char/epca.c | 32 +- trunk/drivers/char/random.c | 1 - trunk/drivers/char/rio/rioctrl.c | 4 +- trunk/drivers/char/serial167.c | 52 +- trunk/drivers/char/specialix.c | 15 +- trunk/drivers/char/sx.c | 2 +- trunk/drivers/char/synclink.c | 4 +- trunk/drivers/ide/ide-taskfile.c | 13 +- trunk/drivers/ide/pci/sgiioc4.c | 2 +- trunk/drivers/input/gameport/fm801-gp.c | 22 +- trunk/drivers/input/gameport/gameport.c | 18 +- trunk/drivers/input/keyboard/atkbd.c | 54 +- trunk/drivers/input/misc/hp_sdc_rtc.c | 8 +- trunk/drivers/input/serio/hil_mlc.c | 18 +- trunk/drivers/input/serio/hp_sdc.c | 4 +- trunk/drivers/input/serio/i8042.c | 13 +- trunk/drivers/input/serio/libps2.c | 3 +- trunk/drivers/input/serio/serio.c | 22 +- trunk/drivers/isdn/capi/capidrv.c | 3 +- trunk/drivers/isdn/hisax/config.c | 6 +- trunk/drivers/isdn/hysdn/boardergo.c | 32 +- trunk/drivers/isdn/hysdn/hysdn_defs.h | 2 - trunk/drivers/isdn/hysdn/hysdn_proclog.c | 17 +- trunk/drivers/isdn/hysdn/hysdn_sched.c | 9 +- trunk/drivers/isdn/i4l/isdn_common.c | 9 +- trunk/drivers/isdn/icn/icn.c | 3 +- trunk/drivers/isdn/isdnloop/isdnloop.c | 73 +- trunk/drivers/isdn/isdnloop/isdnloop.h | 1 - trunk/drivers/isdn/pcbit/drv.c | 16 +- trunk/drivers/leds/led-class.c | 26 +- trunk/drivers/leds/ledtrig-timer.c | 16 +- trunk/drivers/md/md.c | 1 - trunk/drivers/media/dvb/bt8xx/dvb-bt8xx.c | 4 - trunk/drivers/media/dvb/dvb-core/Kconfig | 2 +- .../drivers/media/dvb/dvb-usb/dibusb-common.c | 11 +- trunk/drivers/media/dvb/dvb-usb/dibusb.h | 2 - trunk/drivers/media/dvb/dvb-usb/nova-t-usb2.c | 3 +- trunk/drivers/media/dvb/frontends/dib3000mc.c | 2 +- trunk/drivers/media/dvb/frontends/dib3000mc.h | 3 - trunk/drivers/media/dvb/frontends/tda10086.h | 9 - trunk/drivers/media/dvb/frontends/tda826x.h | 19 +- trunk/drivers/media/video/Kconfig | 2 - .../drivers/media/video/cx25840/cx25840-vbi.c | 25 +- trunk/drivers/media/video/cx88/cx88-cards.c | 21 - trunk/drivers/media/video/cx88/cx88-dvb.c | 17 - trunk/drivers/media/video/cx88/cx88-input.c | 2 - .../media/video/et61x251/et61x251_core.c | 37 +- trunk/drivers/media/video/ov511.c | 58 +- trunk/drivers/media/video/pwc/pwc-if.c | 41 +- trunk/drivers/media/video/saa7115.c | 2 - .../media/video/saa7134/saa7134-video.c | 6 +- .../media/video/sn9c102/sn9c102_core.c | 71 +- trunk/drivers/media/video/stv680.c | 53 +- trunk/drivers/media/video/tuner-types.c | 1 + trunk/drivers/media/video/videodev.c | 16 +- trunk/drivers/media/video/vivi.c | 12 +- trunk/drivers/message/i2o/bus-osm.c | 12 +- trunk/drivers/message/i2o/exec-osm.c | 17 +- trunk/drivers/misc/Kconfig | 30 - trunk/drivers/misc/Makefile | 2 - trunk/drivers/misc/msi-laptop.c | 395 ------ trunk/drivers/net/sky2.c | 200 ++- trunk/drivers/net/sky2.h | 15 +- trunk/drivers/rtc/rtc-max6902.c | 2 +- trunk/drivers/rtc/rtc-v3020.c | 4 +- trunk/drivers/scsi/megaraid/megaraid_mbox.c | 2 +- trunk/drivers/serial/ioc4_serial.c | 2 +- trunk/drivers/sn/Kconfig | 13 + trunk/drivers/sn/Makefile | 1 + trunk/drivers/{misc => sn}/ioc4.c | 47 +- trunk/drivers/w1/Kconfig | 1 + trunk/fs/binfmt_elf.c | 8 +- trunk/fs/buffer.c | 11 +- trunk/fs/cifs/cifssmb.c | 12 +- trunk/fs/fuse/dir.c | 107 +- trunk/fs/fuse/file.c | 12 +- trunk/fs/fuse/fuse_i.h | 3 - trunk/fs/fuse/inode.c | 15 +- trunk/fs/jbd2/journal.c | 3 +- trunk/fs/lockd/svc4proc.c | 12 +- trunk/fs/lockd/svcproc.c | 16 +- trunk/fs/lockd/svcsubs.c | 17 +- trunk/fs/nfsd/lockd.c | 14 +- trunk/fs/nfsd/nfs4callback.c | 4 +- trunk/fs/nfsd/nfs4proc.c | 16 +- trunk/fs/partitions/check.c | 50 +- trunk/fs/proc/base.c | 2 +- trunk/include/acpi/pdc_intel.h | 9 +- trunk/include/acpi/processor.h | 18 - trunk/include/asm-arm/arch-pxa/pxa-regs.h | 1 + trunk/include/asm-frv/highmem.h | 27 +- trunk/include/asm-i386/processor.h | 2 - trunk/include/asm-m68k/sun3mmu.h | 3 +- trunk/include/asm-x86_64/processor.h | 2 - trunk/include/linux/acpi.h | 3 - trunk/include/linux/buffer_head.h | 2 - trunk/include/linux/fs.h | 6 +- trunk/include/linux/irq.h | 22 +- trunk/include/linux/lockd/bind.h | 5 - trunk/include/linux/lockd/xdr.h | 4 - trunk/include/linux/lockdep.h | 17 +- trunk/include/linux/net.h | 7 +- trunk/include/linux/random.h | 3 - trunk/include/linux/serio.h | 1 - trunk/include/linux/sunrpc/msg_prot.h | 4 +- trunk/include/linux/sunrpc/xdr.h | 1 - trunk/include/linux/videodev2.h | 2 +- trunk/include/net/bluetooth/hci_core.h | 17 - trunk/include/net/inetpeer.h | 17 +- trunk/include/net/netlabel.h | 2 +- trunk/kernel/cpu.c | 24 +- trunk/kernel/fork.c | 4 +- trunk/kernel/irq/chip.c | 33 +- trunk/kernel/lockdep.c | 18 +- trunk/kernel/mutex-debug.c | 2 +- trunk/kernel/posix-cpu-timers.c | 27 +- trunk/kernel/power/swap.c | 3 +- trunk/kernel/sys_ni.c | 1 - trunk/kernel/time/jiffies.c | 2 +- trunk/lib/Makefile | 4 +- trunk/lib/carta_random32.c | 41 + trunk/lib/kobject.c | 1 - trunk/lib/random32.c | 142 --- trunk/lib/rwsem-spinlock.c | 2 +- trunk/lib/rwsem.c | 2 +- trunk/lib/spinlock_debug.c | 4 +- trunk/mm/mmap.c | 21 +- trunk/mm/shmem.c | 81 -- trunk/mm/truncate.c | 1 + trunk/mm/vmalloc.c | 7 +- trunk/mm/vmscan.c | 6 - trunk/net/bluetooth/af_bluetooth.c | 38 +- trunk/net/bluetooth/bnep/core.c | 4 +- trunk/net/bluetooth/bnep/sock.c | 69 +- trunk/net/bluetooth/cmtp/sock.c | 35 +- trunk/net/bluetooth/hci_conn.c | 6 +- trunk/net/bluetooth/hci_event.c | 15 +- trunk/net/bluetooth/hci_sock.c | 2 +- trunk/net/bluetooth/hci_sysfs.c | 17 +- trunk/net/bluetooth/hidp/core.c | 8 +- trunk/net/bluetooth/hidp/sock.c | 80 +- trunk/net/bluetooth/l2cap.c | 5 +- trunk/net/bluetooth/rfcomm/core.c | 3 +- trunk/net/bluetooth/rfcomm/sock.c | 6 +- trunk/net/bluetooth/rfcomm/tty.c | 7 +- trunk/net/bluetooth/sco.c | 6 +- trunk/net/bridge/br_fdb.c | 7 +- trunk/net/bridge/br_if.c | 4 +- trunk/net/bridge/br_private.h | 2 +- trunk/net/bridge/br_stp_if.c | 2 - trunk/net/core/dev.c | 2 + trunk/net/core/sock.c | 2 +- trunk/net/core/utils.c | 116 ++ trunk/net/decnet/dn_route.c | 2 +- trunk/net/ipv4/cipso_ipv4.c | 22 +- trunk/net/ipv4/inetpeer.c | 29 +- trunk/net/ipv4/netfilter/arp_tables.c | 2 - .../net/ipv4/netfilter/ip_conntrack_netlink.c | 72 +- trunk/net/ipv4/netfilter/ipt_ECN.c | 6 +- trunk/net/ipv4/netfilter/ipt_TOS.c | 6 +- trunk/net/ipv6/fib6_rules.c | 11 +- trunk/net/ipv6/ndisc.c | 2 + trunk/net/ipv6/route.c | 19 +- trunk/net/ipv6/sit.c | 1 - trunk/net/netfilter/Kconfig | 4 +- trunk/net/netfilter/nf_conntrack_netlink.c | 72 +- trunk/net/netfilter/xt_NFQUEUE.c | 2 +- trunk/net/netfilter/xt_connmark.c | 2 +- trunk/net/sunrpc/svc.c | 5 - trunk/net/xfrm/xfrm_state.c | 17 +- trunk/scripts/Makefile.headersinst | 2 +- trunk/scripts/Makefile.modpost | 2 +- trunk/security/selinux/ss/ebitmap.c | 8 +- trunk/security/selinux/ss/mls.c | 17 +- trunk/security/selinux/ss/services.c | 18 +- 229 files changed, 2156 insertions(+), 3078 deletions(-) delete mode 100644 trunk/drivers/misc/msi-laptop.c rename trunk/drivers/{misc => sn}/ioc4.c (92%) create mode 100644 trunk/lib/carta_random32.c delete mode 100644 trunk/lib/random32.c diff --git a/[refs] b/[refs] index 7a6721cd4e77..fe7f076b0bc1 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 4e4bc305e16440ab38060d61fbcb7d774881d2f1 +refs/heads/master: 69f0304e174c765c624d75b79c35e49b7ba67ed4 diff --git a/trunk/Documentation/ibm-acpi.txt b/trunk/Documentation/ibm-acpi.txt index e50595bfd8ea..71aa40345272 100644 --- a/trunk/Documentation/ibm-acpi.txt +++ b/trunk/Documentation/ibm-acpi.txt @@ -30,10 +30,9 @@ detailed description): - ACPI sounds - temperature sensors - Experimental: embedded controller register dump - - LCD brightness control - - Volume control + - Experimental: LCD brightness control + - Experimental: volume control - Experimental: fan speed, fan enable/disable - - Experimental: WAN enable and disable A compatibility table by model and feature is maintained on the web site, http://ibm-acpi.sf.net/. I appreciate any success or failure @@ -53,7 +52,40 @@ Installation If you are compiling this driver as included in the Linux kernel sources, simply enable the CONFIG_ACPI_IBM option (Power Management / -ACPI / IBM ThinkPad Laptop Extras). +ACPI / IBM ThinkPad Laptop Extras). The rest of this section describes +how to install this driver when downloaded from the web site. + +First, you need to get a kernel with ACPI support up and running. +Please refer to http://acpi.sourceforge.net/ for help with this +step. How successful you will be depends a lot on you ThinkPad model, +the kernel you are using and any additional patches applied. The +kernel provided with your distribution may not be good enough. I +needed to compile a 2.6.7 kernel with the 20040715 ACPI patch to get +ACPI working reliably on my ThinkPad X40. Old ThinkPad models may not +be supported at all. + +Assuming you have the basic ACPI support working (e.g. you can see the +/proc/acpi directory), follow the following steps to install this +driver: + + - unpack the archive: + + tar xzvf ibm-acpi-x.y.tar.gz; cd ibm-acpi-x.y + + - compile the driver: + + make + + - install the module in your kernel modules directory: + + make install + + - load the module: + + modprobe ibm_acpi + +After loading the module, check the "dmesg" output for any error messages. + Features -------- @@ -491,8 +523,13 @@ registers contain the current battery capacity, etc. If you experiment with this, do send me your results (including some complete dumps with a description of the conditions when they were taken.) -LCD brightness control -- /proc/acpi/ibm/brightness ---------------------------------------------------- +EXPERIMENTAL: LCD brightness control -- /proc/acpi/ibm/brightness +----------------------------------------------------------------- + +This feature is marked EXPERIMENTAL because the implementation +directly accesses hardware registers and may not work as expected. USE +WITH CAUTION! To use this feature, you need to supply the +experimental=1 parameter when loading the module. This feature allows software control of the LCD brightness on ThinkPad models which don't have a hardware brightness slider. The available @@ -505,8 +542,13 @@ commands are: The number range is 0 to 7, although not all of them may be distinct. The current brightness level is shown in the file. -Volume control -- /proc/acpi/ibm/volume ---------------------------------------- +EXPERIMENTAL: Volume control -- /proc/acpi/ibm/volume +----------------------------------------------------- + +This feature is marked EXPERIMENTAL because the implementation +directly accesses hardware registers and may not work as expected. USE +WITH CAUTION! To use this feature, you need to supply the +experimental=1 parameter when loading the module. This feature allows volume control on ThinkPad models which don't have a hardware volume knob. The available commands are: @@ -569,23 +611,6 @@ with the following command: echo 'level ' > /proc/acpi/ibm/thermal -EXPERIMENTAL: WAN -- /proc/acpi/ibm/wan ---------------------------------------- - -This feature is marked EXPERIMENTAL because the implementation -directly accesses hardware registers and may not work as expected. USE -WITH CAUTION! To use this feature, you need to supply the -experimental=1 parameter when loading the module. - -This feature shows the presence and current state of a WAN (Sierra -Wireless EV-DO) device. If WAN is installed, the following commands can -be used: - - echo enable > /proc/acpi/ibm/wan - echo disable > /proc/acpi/ibm/wan - -It was tested on a Lenovo Thinkpad X60. It should probably work on other -Thinkpad models which come with this module installed. Multiple Commands, Module Parameters ------------------------------------ diff --git a/trunk/Documentation/video4linux/CARDLIST.cx88 b/trunk/Documentation/video4linux/CARDLIST.cx88 index 8755b3e7b09e..126e59d935cd 100644 --- a/trunk/Documentation/video4linux/CARDLIST.cx88 +++ b/trunk/Documentation/video4linux/CARDLIST.cx88 @@ -51,7 +51,7 @@ 50 -> NPG Tech Real TV FM Top 10 [14f1:0842] 51 -> WinFast DTV2000 H [107d:665e] 52 -> Geniatech DVB-S [14f1:0084] - 53 -> Hauppauge WinTV-HVR3000 TriMode Analog/DVB-S/DVB-T [0070:1404,0070:1400,0070:1401,0070:1402] + 53 -> Hauppauge WinTV-HVR3000 TriMode Analog/DVB-S/DVB-T [0070:1404] 54 -> Norwood Micro TV Tuner 55 -> Shenzhen Tungsten Ages Tech TE-DTV-250 / Swann OEM [c180:c980] 56 -> Hauppauge WinTV-HVR1300 DVB-T/Hybrid MPEG Encoder [0070:9600,0070:9601,0070:9602] diff --git a/trunk/MAINTAINERS b/trunk/MAINTAINERS index 5305dd69095b..1b5430a49fdd 100644 --- a/trunk/MAINTAINERS +++ b/trunk/MAINTAINERS @@ -1998,13 +1998,6 @@ M: rubini@ipvvis.unipv.it L: linux-kernel@vger.kernel.org S: Maintained -MSI LAPTOP SUPPORT -P: Lennart Poettering -M: mzxreary@0pointer.de -L: https://tango.0pointer.de/mailman/listinfo/s270-linux -W: http://0pointer.de/lennart/tchibo.html -S: Maintained - MTRR AND SIMILAR SUPPORT [i386] P: Richard Gooch M: rgooch@atnf.csiro.au @@ -2012,11 +2005,8 @@ L: linux-kernel@vger.kernel.org W: http://www.atnf.csiro.au/~rgooch/linux/kernel-patches.html S: Maintained -MULTIMEDIA CARD (MMC) AND SECURE DIGITAL (SD) SUBSYSTEM -P: Pierre Ossman -M: drzeus-mmc@drzeus.cx -L: linux-kernel@vger.kernel.org -S: Maintained +MULTIMEDIA CARD (MMC) SUBSYSTEM +S: Orphan MULTISOUND SOUND DRIVER P: Andrew Veliath @@ -2052,13 +2042,11 @@ P: Marc Boucher P: James Morris P: Harald Welte P: Jozsef Kadlecsik -P: Patrick McHardy -M: kaber@trash.net -L: netfilter-devel@lists.netfilter.org -L: netfilter@lists.netfilter.org -L: coreteam@netfilter.org +M: coreteam@netfilter.org W: http://www.netfilter.org/ W: http://www.iptables.org/ +L: netfilter@lists.netfilter.org +L: netfilter-devel@lists.netfilter.org S: Supported NETLABEL diff --git a/trunk/Makefile b/trunk/Makefile index 62a1343cf327..703d40a65e7e 100644 --- a/trunk/Makefile +++ b/trunk/Makefile @@ -1319,8 +1319,7 @@ define xtags $(all-sources) | xargs $1 -a \ -I __initdata,__exitdata,__acquires,__releases \ -I EXPORT_SYMBOL,EXPORT_SYMBOL_GPL \ - --extra=+f --c-kinds=+px \ - --regex-asm='/ENTRY\(([^)]*)\).*/\1/'; \ + --extra=+f --c-kinds=+px; \ $(all-kconfigs) | xargs $1 -a \ --langdef=kconfig \ --language-force=kconfig \ diff --git a/trunk/arch/i386/kernel/acpi/boot.c b/trunk/arch/i386/kernel/acpi/boot.c index ab974ff97073..92f79cdd9a48 100644 --- a/trunk/arch/i386/kernel/acpi/boot.c +++ b/trunk/arch/i386/kernel/acpi/boot.c @@ -332,7 +332,7 @@ acpi_parse_ioapic(acpi_table_entry_header * header, const unsigned long end) /* * Parse Interrupt Source Override for the ACPI SCI */ -static void acpi_sci_ioapic_setup(u32 bus_irq, u32 gsi, u16 polarity, u16 trigger) +static void acpi_sci_ioapic_setup(u32 gsi, u16 polarity, u16 trigger) { if (trigger == 0) /* compatible SCI trigger is level */ trigger = 3; @@ -352,13 +352,13 @@ static void acpi_sci_ioapic_setup(u32 bus_irq, u32 gsi, u16 polarity, u16 trigge * If GSI is < 16, this will update its flags, * else it will create a new mp_irqs[] entry. */ - mp_override_legacy_irq(bus_irq, polarity, trigger, gsi); + mp_override_legacy_irq(gsi, polarity, trigger, gsi); /* * stash over-ride to indicate we've been here * and for later update of acpi_fadt */ - acpi_sci_override_gsi = bus_irq; + acpi_sci_override_gsi = gsi; return; } @@ -376,7 +376,7 @@ acpi_parse_int_src_ovr(acpi_table_entry_header * header, acpi_table_print_madt_entry(header); if (intsrc->bus_irq == acpi_fadt.sci_int) { - acpi_sci_ioapic_setup(intsrc->bus_irq, intsrc->global_irq, + acpi_sci_ioapic_setup(intsrc->global_irq, intsrc->flags.polarity, intsrc->flags.trigger); return 0; @@ -879,7 +879,7 @@ static int __init acpi_parse_madt_ioapic_entries(void) * pretend we got one so we can set the SCI flags. */ if (!acpi_sci_override_gsi) - acpi_sci_ioapic_setup(acpi_fadt.sci_int, acpi_fadt.sci_int, 0, 0); + acpi_sci_ioapic_setup(acpi_fadt.sci_int, 0, 0); /* Fill in identity legacy mapings where no override */ mp_config_acpi_legacy_irqs(); diff --git a/trunk/arch/i386/kernel/acpi/cstate.c b/trunk/arch/i386/kernel/acpi/cstate.c index 20563e52c622..25db49ef1770 100644 --- a/trunk/arch/i386/kernel/acpi/cstate.c +++ b/trunk/arch/i386/kernel/acpi/cstate.c @@ -10,7 +10,6 @@ #include #include #include -#include #include #include @@ -42,124 +41,5 @@ void acpi_processor_power_init_bm_check(struct acpi_processor_flags *flags, flags->bm_check = 1; } } -EXPORT_SYMBOL(acpi_processor_power_init_bm_check); - -/* The code below handles cstate entry with monitor-mwait pair on Intel*/ - -struct cstate_entry_s { - struct { - unsigned int eax; - unsigned int ecx; - } states[ACPI_PROCESSOR_MAX_POWER]; -}; -static struct cstate_entry_s *cpu_cstate_entry; /* per CPU ptr */ - -static short mwait_supported[ACPI_PROCESSOR_MAX_POWER]; - -#define MWAIT_SUBSTATE_MASK (0xf) -#define MWAIT_SUBSTATE_SIZE (4) - -#define CPUID_MWAIT_LEAF (5) -#define CPUID5_ECX_EXTENSIONS_SUPPORTED (0x1) -#define CPUID5_ECX_INTERRUPT_BREAK (0x2) - -#define MWAIT_ECX_INTERRUPT_BREAK (0x1) - -#define NATIVE_CSTATE_BEYOND_HALT (2) - -int acpi_processor_ffh_cstate_probe(unsigned int cpu, - struct acpi_processor_cx *cx, struct acpi_power_register *reg) -{ - struct cstate_entry_s *percpu_entry; - struct cpuinfo_x86 *c = cpu_data + cpu; - - cpumask_t saved_mask; - int retval; - unsigned int eax, ebx, ecx, edx; - unsigned int edx_part; - unsigned int cstate_type; /* C-state type and not ACPI C-state type */ - unsigned int num_cstate_subtype; - - if (!cpu_cstate_entry || c->cpuid_level < CPUID_MWAIT_LEAF ) - return -1; - - if (reg->bit_offset != NATIVE_CSTATE_BEYOND_HALT) - return -1; - - percpu_entry = per_cpu_ptr(cpu_cstate_entry, cpu); - percpu_entry->states[cx->index].eax = 0; - percpu_entry->states[cx->index].ecx = 0; - - /* Make sure we are running on right CPU */ - saved_mask = current->cpus_allowed; - retval = set_cpus_allowed(current, cpumask_of_cpu(cpu)); - if (retval) - return -1; - - cpuid(CPUID_MWAIT_LEAF, &eax, &ebx, &ecx, &edx); - - /* Check whether this particular cx_type (in CST) is supported or not */ - cstate_type = (cx->address >> MWAIT_SUBSTATE_SIZE) + 1; - edx_part = edx >> (cstate_type * MWAIT_SUBSTATE_SIZE); - num_cstate_subtype = edx_part & MWAIT_SUBSTATE_MASK; - - retval = 0; - if (num_cstate_subtype < (cx->address & MWAIT_SUBSTATE_MASK)) { - retval = -1; - goto out; - } - /* mwait ecx extensions INTERRUPT_BREAK should be supported for C2/C3 */ - if (!(ecx & CPUID5_ECX_EXTENSIONS_SUPPORTED) || - !(ecx & CPUID5_ECX_INTERRUPT_BREAK)) { - retval = -1; - goto out; - } - percpu_entry->states[cx->index].ecx = MWAIT_ECX_INTERRUPT_BREAK; - - /* Use the hint in CST */ - percpu_entry->states[cx->index].eax = cx->address; - - if (!mwait_supported[cstate_type]) { - mwait_supported[cstate_type] = 1; - printk(KERN_DEBUG "Monitor-Mwait will be used to enter C-%d " - "state\n", cx->type); - } - -out: - set_cpus_allowed(current, saved_mask); - return retval; -} -EXPORT_SYMBOL_GPL(acpi_processor_ffh_cstate_probe); - -void acpi_processor_ffh_cstate_enter(struct acpi_processor_cx *cx) -{ - unsigned int cpu = smp_processor_id(); - struct cstate_entry_s *percpu_entry; - - percpu_entry = per_cpu_ptr(cpu_cstate_entry, cpu); - mwait_idle_with_hints(percpu_entry->states[cx->index].eax, - percpu_entry->states[cx->index].ecx); -} -EXPORT_SYMBOL_GPL(acpi_processor_ffh_cstate_enter); - -static int __init ffh_cstate_init(void) -{ - struct cpuinfo_x86 *c = &boot_cpu_data; - if (c->x86_vendor != X86_VENDOR_INTEL) - return -1; - - cpu_cstate_entry = alloc_percpu(struct cstate_entry_s); - return 0; -} - -static void __exit ffh_cstate_exit(void) -{ - if (cpu_cstate_entry) { - free_percpu(cpu_cstate_entry); - cpu_cstate_entry = NULL; - } -} - -arch_initcall(ffh_cstate_init); -__exitcall(ffh_cstate_exit); +EXPORT_SYMBOL(acpi_processor_power_init_bm_check); diff --git a/trunk/arch/i386/kernel/apm.c b/trunk/arch/i386/kernel/apm.c index 2af65858d322..b42f2d914af3 100644 --- a/trunk/arch/i386/kernel/apm.c +++ b/trunk/arch/i386/kernel/apm.c @@ -540,30 +540,11 @@ static inline void apm_restore_cpus(cpumask_t mask) * Also, we KNOW that for the non error case of apm_bios_call, there * is no useful data returned in the low order 8 bits of eax. */ - -static inline unsigned long __apm_irq_save(void) -{ - unsigned long flags; - local_save_flags(flags); - if (apm_info.allow_ints) { - if (irqs_disabled_flags(flags)) - local_irq_enable(); - } else - local_irq_disable(); - - return flags; -} - -#define apm_irq_save(flags) \ - do { flags = __apm_irq_save(); } while (0) - -static inline void apm_irq_restore(unsigned long flags) -{ - if (irqs_disabled_flags(flags)) +#define APM_DO_CLI \ + if (apm_info.allow_ints) \ + local_irq_enable(); \ + else \ local_irq_disable(); - else if (irqs_disabled()) - local_irq_enable(); -} #ifdef APM_ZERO_SEGS # define APM_DECL_SEGS \ @@ -615,11 +596,12 @@ static u8 apm_bios_call(u32 func, u32 ebx_in, u32 ecx_in, save_desc_40 = gdt[0x40 / 8]; gdt[0x40 / 8] = bad_bios_desc; - apm_irq_save(flags); + local_save_flags(flags); + APM_DO_CLI; APM_DO_SAVE_SEGS; apm_bios_call_asm(func, ebx_in, ecx_in, eax, ebx, ecx, edx, esi); APM_DO_RESTORE_SEGS; - apm_irq_restore(flags); + local_irq_restore(flags); gdt[0x40 / 8] = save_desc_40; put_cpu(); apm_restore_cpus(cpus); @@ -658,11 +640,12 @@ static u8 apm_bios_call_simple(u32 func, u32 ebx_in, u32 ecx_in, u32 *eax) save_desc_40 = gdt[0x40 / 8]; gdt[0x40 / 8] = bad_bios_desc; - apm_irq_save(flags); + local_save_flags(flags); + APM_DO_CLI; APM_DO_SAVE_SEGS; error = apm_bios_call_simple_asm(func, ebx_in, ecx_in, eax); APM_DO_RESTORE_SEGS; - apm_irq_restore(flags); + local_irq_restore(flags); gdt[0x40 / 8] = save_desc_40; put_cpu(); apm_restore_cpus(cpus); diff --git a/trunk/arch/i386/kernel/i8253.c b/trunk/arch/i386/kernel/i8253.c index 9a0060b92e32..477b24daff53 100644 --- a/trunk/arch/i386/kernel/i8253.c +++ b/trunk/arch/i386/kernel/i8253.c @@ -109,7 +109,7 @@ static struct clocksource clocksource_pit = { static int __init init_pit_clocksource(void) { - if (num_possible_cpus() > 1) /* PIT does not scale! */ + if (num_possible_cpus() > 4) /* PIT does not scale! */ return 0; clocksource_pit.mult = clocksource_hz2mult(CLOCK_TICK_RATE, 20); diff --git a/trunk/arch/i386/kernel/i8259.c b/trunk/arch/i386/kernel/i8259.c index 62996cd17084..d53eafb6daa7 100644 --- a/trunk/arch/i386/kernel/i8259.c +++ b/trunk/arch/i386/kernel/i8259.c @@ -113,8 +113,7 @@ void make_8259A_irq(unsigned int irq) { disable_irq_nosync(irq); io_apic_irqs &= ~(1<name); - seq_printf(p, "-%-8s", irq_desc[i].name); + seq_printf(p, "-%s", handle_irq_name(irq_desc[i].handle_irq)); seq_printf(p, " %s", action->name); for (action=action->next; action; action = action->next) diff --git a/trunk/arch/i386/kernel/process.c b/trunk/arch/i386/kernel/process.c index 57d375900afb..b0a07801d9df 100644 --- a/trunk/arch/i386/kernel/process.c +++ b/trunk/arch/i386/kernel/process.c @@ -236,28 +236,20 @@ EXPORT_SYMBOL_GPL(cpu_idle_wait); * We execute MONITOR against need_resched and enter optimized wait state * through MWAIT. Whenever someone changes need_resched, we would be woken * up from MWAIT (without an IPI). - * - * New with Core Duo processors, MWAIT can take some hints based on CPU - * capability. */ -void mwait_idle_with_hints(unsigned long eax, unsigned long ecx) +static void mwait_idle(void) { - if (!need_resched()) { + local_irq_enable(); + + while (!need_resched()) { __monitor((void *)¤t_thread_info()->flags, 0, 0); smp_mb(); - if (!need_resched()) - __mwait(eax, ecx); + if (need_resched()) + break; + __mwait(0, 0); } } -/* Default MONITOR/MWAIT with no hints, used for default C1 state */ -static void mwait_idle(void) -{ - local_irq_enable(); - while (!need_resched()) - mwait_idle_with_hints(0, 0); -} - void __devinit select_idle_routine(const struct cpuinfo_x86 *c) { if (cpu_has(c, X86_FEATURE_MWAIT)) { diff --git a/trunk/arch/i386/kernel/tsc.c b/trunk/arch/i386/kernel/tsc.c index fbc95828cd74..b8fa0a8b2e47 100644 --- a/trunk/arch/i386/kernel/tsc.c +++ b/trunk/arch/i386/kernel/tsc.c @@ -349,8 +349,8 @@ static int tsc_update_callback(void) int change = 0; /* check to see if we should switch to the safe clocksource: */ - if (clocksource_tsc.rating != 0 && check_tsc_unstable()) { - clocksource_tsc.rating = 0; + if (clocksource_tsc.rating != 50 && check_tsc_unstable()) { + clocksource_tsc.rating = 50; clocksource_reselect(); change = 1; } @@ -461,7 +461,7 @@ static int __init init_tsc_clocksource(void) clocksource_tsc.shift); /* lower the rating if we already know its unstable: */ if (check_tsc_unstable()) - clocksource_tsc.rating = 0; + clocksource_tsc.rating = 50; init_timer(&verify_tsc_freq_timer); verify_tsc_freq_timer.function = verify_tsc_freq; diff --git a/trunk/arch/powerpc/configs/mpc834x_itx_defconfig b/trunk/arch/powerpc/configs/mpc834x_itx_defconfig index 0561b73a918f..cd3535e1a095 100644 --- a/trunk/arch/powerpc/configs/mpc834x_itx_defconfig +++ b/trunk/arch/powerpc/configs/mpc834x_itx_defconfig @@ -1248,7 +1248,7 @@ CONFIG_PARTITION_ADVANCED=y # CONFIG_AMIGA_PARTITION is not set # CONFIG_ATARI_PARTITION is not set # CONFIG_MAC_PARTITION is not set -CONFIG_MSDOS_PARTITION=y +# CONFIG_MSDOS_PARTITION is not set # CONFIG_LDM_PARTITION is not set # CONFIG_SGI_PARTITION is not set # CONFIG_ULTRIX_PARTITION is not set diff --git a/trunk/arch/powerpc/kernel/cputable.c b/trunk/arch/powerpc/kernel/cputable.c index 95382f994404..47a613cdd775 100644 --- a/trunk/arch/powerpc/kernel/cputable.c +++ b/trunk/arch/powerpc/kernel/cputable.c @@ -268,7 +268,7 @@ struct cpu_spec cpu_specs[] = { .cpu_user_features = COMMON_USER_POWER6, .icache_bsize = 128, .dcache_bsize = 128, - .num_pmcs = 6, + .num_pmcs = 8, .oprofile_cpu_type = "ppc64/power6", .oprofile_type = PPC_OPROFILE_POWER4, .oprofile_mmcra_sihv = POWER6_MMCRA_SIHV, diff --git a/trunk/arch/powerpc/kernel/pci_32.c b/trunk/arch/powerpc/kernel/pci_32.c index 0d9ff72e2852..9b49f8691d29 100644 --- a/trunk/arch/powerpc/kernel/pci_32.c +++ b/trunk/arch/powerpc/kernel/pci_32.c @@ -441,14 +441,14 @@ update_bridge_base(struct pci_bus *bus, int i) end = res->end - off; io_base_lo = (start >> 8) & PCI_IO_RANGE_MASK; io_limit_lo = (end >> 8) & PCI_IO_RANGE_MASK; - if (end > 0xffff) + if (end > 0xffff) { + pci_write_config_word(dev, PCI_IO_BASE_UPPER16, + start >> 16); + pci_write_config_word(dev, PCI_IO_LIMIT_UPPER16, + end >> 16); io_base_lo |= PCI_IO_RANGE_TYPE_32; - else + } else io_base_lo |= PCI_IO_RANGE_TYPE_16; - pci_write_config_word(dev, PCI_IO_BASE_UPPER16, - start >> 16); - pci_write_config_word(dev, PCI_IO_LIMIT_UPPER16, - end >> 16); pci_write_config_byte(dev, PCI_IO_BASE, io_base_lo); pci_write_config_byte(dev, PCI_IO_LIMIT, io_limit_lo); diff --git a/trunk/arch/powerpc/kernel/pci_64.c b/trunk/arch/powerpc/kernel/pci_64.c index 9bae8a5bf671..78d3c0fc8dfb 100644 --- a/trunk/arch/powerpc/kernel/pci_64.c +++ b/trunk/arch/powerpc/kernel/pci_64.c @@ -199,14 +199,8 @@ struct pci_controller * pcibios_alloc_controller(struct device_node *dev) pci_setup_pci_controller(phb); phb->arch_data = dev; phb->is_dynamic = mem_init_done; - if (dev) { - int nid = of_node_to_nid(dev); - - if (nid < 0 || !node_online(nid)) - nid = -1; - - PHB_SET_NODE(phb, nid); - } + if (dev) + PHB_SET_NODE(phb, of_node_to_nid(dev)); return phb; } diff --git a/trunk/arch/powerpc/kernel/process.c b/trunk/arch/powerpc/kernel/process.c index f3d4dd580dd6..7b2f6452ba72 100644 --- a/trunk/arch/powerpc/kernel/process.c +++ b/trunk/arch/powerpc/kernel/process.c @@ -341,6 +341,13 @@ struct task_struct *__switch_to(struct task_struct *prev, static int instructions_to_print = 16; +#ifdef CONFIG_PPC64 +#define BAD_PC(pc) ((REGION_ID(pc) != KERNEL_REGION_ID) && \ + (REGION_ID(pc) != VMALLOC_REGION_ID)) +#else +#define BAD_PC(pc) ((pc) < KERNELBASE) +#endif + static void show_instructions(struct pt_regs *regs) { int i; @@ -359,8 +366,7 @@ static void show_instructions(struct pt_regs *regs) * bad address because the pc *should* only be a * kernel address. */ - if (!__kernel_text_address(pc) || - __get_user(instr, (unsigned int __user *)pc)) { + if (BAD_PC(pc) || __get_user(instr, (unsigned int __user *)pc)) { printk("XXXXXXXX "); } else { if (regs->nip == pc) diff --git a/trunk/arch/powerpc/kernel/traps.c b/trunk/arch/powerpc/kernel/traps.c index 5ed4c2ceb5ca..d9f10f2fc372 100644 --- a/trunk/arch/powerpc/kernel/traps.c +++ b/trunk/arch/powerpc/kernel/traps.c @@ -900,13 +900,14 @@ void kernel_fp_unavailable_exception(struct pt_regs *regs) void altivec_unavailable_exception(struct pt_regs *regs) { +#if !defined(CONFIG_ALTIVEC) if (user_mode(regs)) { /* A user program has executed an altivec instruction, but this kernel doesn't support altivec. */ _exception(SIGILL, regs, ILL_ILLOPC, regs->nip); return; } - +#endif printk(KERN_EMERG "Unrecoverable VMX/Altivec Unavailable Exception " "%lx at %lx\n", regs->trap, regs->nip); die("Unrecoverable VMX/Altivec Unavailable Exception", regs, SIGABRT); diff --git a/trunk/arch/powerpc/platforms/83xx/Kconfig b/trunk/arch/powerpc/platforms/83xx/Kconfig index 7edb6b461382..0975e94ac7c4 100644 --- a/trunk/arch/powerpc/platforms/83xx/Kconfig +++ b/trunk/arch/powerpc/platforms/83xx/Kconfig @@ -32,13 +32,6 @@ config MPC834x_ITX Be aware that PCI initialization is the bootloader's responsiblilty. -config MPC8360E_PB - bool "Freescale MPC8360E PB" - select DEFAULT_UIMAGE - select QUICC_ENGINE - help - This option enables support for the MPC836x EMDS Processor Board. - endchoice config PPC_MPC832x @@ -53,10 +46,4 @@ config MPC834x select PPC_INDIRECT_PCI default y if MPC834x_SYS || MPC834x_ITX -config PPC_MPC836x - bool - select PPC_UDBG_16550 - select PPC_INDIRECT_PCI - default y if MPC8360E_PB - endmenu diff --git a/trunk/arch/powerpc/platforms/83xx/Makefile b/trunk/arch/powerpc/platforms/83xx/Makefile index f1aa7e24a938..9387a110d28a 100644 --- a/trunk/arch/powerpc/platforms/83xx/Makefile +++ b/trunk/arch/powerpc/platforms/83xx/Makefile @@ -5,5 +5,3 @@ obj-y := misc.o obj-$(CONFIG_PCI) += pci.o obj-$(CONFIG_MPC834x_SYS) += mpc834x_sys.o obj-$(CONFIG_MPC834x_ITX) += mpc834x_itx.o -obj-$(CONFIG_MPC8360E_PB) += mpc8360e_pb.o -obj-$(CONFIG_MPC832x_MDS) += mpc832x_mds.o diff --git a/trunk/arch/powerpc/platforms/83xx/mpc8360e_pb.c b/trunk/arch/powerpc/platforms/83xx/mpc8360e_pb.c index 1a523c81c06e..c0191900fc25 100644 --- a/trunk/arch/powerpc/platforms/83xx/mpc8360e_pb.c +++ b/trunk/arch/powerpc/platforms/83xx/mpc8360e_pb.c @@ -30,7 +30,6 @@ #include #include -#include #include #include #include @@ -142,24 +141,6 @@ static void __init mpc8360_sys_setup_arch(void) #endif } -static int __init mpc8360_declare_of_platform_devices(void) -{ - struct device_node *np; - - for (np = NULL; (np = of_find_compatible_node(np, "network", - "ucc_geth")) != NULL;) { - int ucc_num; - char bus_id[BUS_ID_SIZE]; - - ucc_num = *((uint *) get_property(np, "device-id", NULL)) - 1; - snprintf(bus_id, BUS_ID_SIZE, "ucc_geth.%u", ucc_num); - of_platform_device_create(np, bus_id, NULL); - } - - return 0; -} -device_initcall(mpc8360_declare_of_platform_devices); - void __init mpc8360_sys_init_IRQ(void) { diff --git a/trunk/arch/powerpc/platforms/cell/spu_base.c b/trunk/arch/powerpc/platforms/cell/spu_base.c index d0fb959e3ef1..ccfd0c4db874 100644 --- a/trunk/arch/powerpc/platforms/cell/spu_base.c +++ b/trunk/arch/powerpc/platforms/cell/spu_base.c @@ -781,17 +781,6 @@ static int __init create_spu(struct device_node *spe) if (!spu) goto out; - spu->node = find_spu_node_id(spe); - if (spu->node >= MAX_NUMNODES) { - printk(KERN_WARNING "SPE %s on node %d ignored," - " node number too big\n", spe->full_name, spu->node); - printk(KERN_WARNING "Check if CONFIG_NUMA is enabled.\n"); - return -ENODEV; - } - spu->nid = of_node_to_nid(spe); - if (spu->nid == -1) - spu->nid = 0; - ret = spu_map_device(spu, spe); /* try old method */ if (ret) @@ -799,6 +788,10 @@ static int __init create_spu(struct device_node *spe) if (ret) goto out_free; + spu->node = find_spu_node_id(spe); + spu->nid = of_node_to_nid(spe); + if (spu->nid == -1) + spu->nid = 0; ret = spu_map_interrupts(spu, spe); if (ret) ret = spu_map_interrupts_old(spu, spe); diff --git a/trunk/arch/powerpc/platforms/cell/spufs/file.c b/trunk/arch/powerpc/platforms/cell/spufs/file.c index 0de8e114e6b6..e0d730045260 100644 --- a/trunk/arch/powerpc/platforms/cell/spufs/file.c +++ b/trunk/arch/powerpc/platforms/cell/spufs/file.c @@ -246,7 +246,6 @@ static int spufs_cntl_open(struct inode *inode, struct file *file) static struct file_operations spufs_cntl_fops = { .open = spufs_cntl_open, - .release = simple_attr_close, .read = simple_attr_read, .write = simple_attr_write, .mmap = spufs_cntl_mmap, diff --git a/trunk/arch/ppc/kernel/time.c b/trunk/arch/ppc/kernel/time.c index 18ee851e33e3..d4b2cf74da6a 100644 --- a/trunk/arch/ppc/kernel/time.c +++ b/trunk/arch/ppc/kernel/time.c @@ -62,7 +62,6 @@ #include #include #include -#include #include @@ -130,7 +129,6 @@ void wakeup_decrementer(void) */ void timer_interrupt(struct pt_regs * regs) { - struct pt_regs *old_regs; int next_dec; unsigned long cpu = smp_processor_id(); unsigned jiffy_stamp = last_jiffy_stamp(cpu); @@ -139,7 +137,6 @@ void timer_interrupt(struct pt_regs * regs) if (atomic_read(&ppc_n_lost_interrupts) != 0) do_IRQ(regs); - old_regs = set_irq_regs(regs); irq_enter(); while ((next_dec = tb_ticks_per_jiffy - tb_delta(&jiffy_stamp)) <= 0) { @@ -191,7 +188,6 @@ void timer_interrupt(struct pt_regs * regs) ppc_md.heartbeat(); irq_exit(); - set_irq_regs(old_regs); } /* diff --git a/trunk/arch/ppc/platforms/mpc8272ads_setup.c b/trunk/arch/ppc/platforms/mpc8272ads_setup.c index 1f9ea36837b1..d7b3a6afa78f 100644 --- a/trunk/arch/ppc/platforms/mpc8272ads_setup.c +++ b/trunk/arch/ppc/platforms/mpc8272ads_setup.c @@ -196,7 +196,7 @@ static void __init mpc8272ads_fixup_enet_pdata(struct platform_device *pdev, bd_t* bi = (void*)__res; int fs_no = fsid_fcc1+pdev->id-1; - if(fs_no >= ARRAY_SIZE(mpc82xx_enet_pdata)) { + if(fs_no > ARRAY_SIZE(mpc82xx_enet_pdata)) { return; } @@ -222,7 +222,7 @@ static void mpc8272ads_fixup_uart_pdata(struct platform_device *pdev, int id = fs_uart_id_scc2fsid(idx); /* no need to alter anything if console */ - if ((id < num) && (!pdev->dev.platform_data)) { + if ((id <= num) && (!pdev->dev.platform_data)) { pinfo = &mpc8272_uart_pdata[id]; pinfo->uart_clk = bd->bi_intfreq; pdev->dev.platform_data = pinfo; diff --git a/trunk/arch/ppc/platforms/mpc866ads_setup.c b/trunk/arch/ppc/platforms/mpc866ads_setup.c index e95d2c111747..5f130dca3770 100644 --- a/trunk/arch/ppc/platforms/mpc866ads_setup.c +++ b/trunk/arch/ppc/platforms/mpc866ads_setup.c @@ -259,7 +259,7 @@ static void mpc866ads_fixup_enet_pdata(struct platform_device *pdev, int fs_no) /* Get pointer to Communication Processor */ cp = cpmp; - if(fs_no >= ARRAY_SIZE(mpc8xx_enet_pdata)) { + if(fs_no > ARRAY_SIZE(mpc8xx_enet_pdata)) { printk(KERN_ERR"No network-suitable #%d device on bus", fs_no); return; } @@ -305,7 +305,7 @@ static void __init mpc866ads_fixup_uart_pdata(struct platform_device *pdev, int id = fs_uart_id_smc2fsid(idx); /* no need to alter anything if console */ - if ((id < num) && (!pdev->dev.platform_data)) { + if ((id <= num) && (!pdev->dev.platform_data)) { pinfo = &mpc866_uart_pdata[id]; pinfo->uart_clk = bd->bi_intfreq; pdev->dev.platform_data = pinfo; diff --git a/trunk/arch/ppc/platforms/mpc885ads_setup.c b/trunk/arch/ppc/platforms/mpc885ads_setup.c index f8161f3557f5..02293141efb5 100644 --- a/trunk/arch/ppc/platforms/mpc885ads_setup.c +++ b/trunk/arch/ppc/platforms/mpc885ads_setup.c @@ -263,7 +263,7 @@ static void mpc885ads_fixup_enet_pdata(struct platform_device *pdev, int fs_no) char *e; int i; - if(fs_no >= ARRAY_SIZE(mpc8xx_enet_pdata)) { + if(fs_no > ARRAY_SIZE(mpc8xx_enet_pdata)) { printk(KERN_ERR"No network-suitable #%d device on bus", fs_no); return; } @@ -371,7 +371,7 @@ static void __init mpc885ads_fixup_uart_pdata(struct platform_device *pdev, int id = fs_uart_id_smc2fsid(idx); /* no need to alter anything if console */ - if ((id < num) && (!pdev->dev.platform_data)) { + if ((id <= num) && (!pdev->dev.platform_data)) { pinfo = &mpc885_uart_pdata[id]; pinfo->uart_clk = bd->bi_intfreq; pdev->dev.platform_data = pinfo; diff --git a/trunk/arch/um/include/kern_util.h b/trunk/arch/um/include/kern_util.h index cec9fcc57bf5..59cfa9e0cad0 100644 --- a/trunk/arch/um/include/kern_util.h +++ b/trunk/arch/um/include/kern_util.h @@ -6,6 +6,7 @@ #ifndef __KERN_UTIL_H__ #define __KERN_UTIL_H__ +#include "linux/threads.h" #include "sysdep/ptrace.h" #include "sysdep/faultinfo.h" diff --git a/trunk/arch/um/sys-x86_64/stub_segv.c b/trunk/arch/um/sys-x86_64/stub_segv.c index 652fa34c2cd3..1c967026c957 100644 --- a/trunk/arch/um/sys-x86_64/stub_segv.c +++ b/trunk/arch/um/sys-x86_64/stub_segv.c @@ -5,6 +5,7 @@ #include #include +#include #include #include "uml-config.h" #include "sysdep/sigcontext.h" diff --git a/trunk/arch/x86_64/kernel/i8259.c b/trunk/arch/x86_64/kernel/i8259.c index c4ef801b765b..0612a33bb896 100644 --- a/trunk/arch/x86_64/kernel/i8259.c +++ b/trunk/arch/x86_64/kernel/i8259.c @@ -178,8 +178,7 @@ void make_8259A_irq(unsigned int irq) { disable_irq_nosync(irq); io_apic_irqs &= ~(1<name); - seq_printf(p, "-%-8s", irq_desc[i].name); + seq_printf(p, "-%s", handle_irq_name(irq_desc[i].handle_irq)); seq_printf(p, " %s", action->name); for (action=action->next; action; action = action->next) diff --git a/trunk/arch/x86_64/kernel/process.c b/trunk/arch/x86_64/kernel/process.c index 49f7fac6229e..5e95b257ee26 100644 --- a/trunk/arch/x86_64/kernel/process.c +++ b/trunk/arch/x86_64/kernel/process.c @@ -238,28 +238,20 @@ void cpu_idle (void) * We execute MONITOR against need_resched and enter optimized wait state * through MWAIT. Whenever someone changes need_resched, we would be woken * up from MWAIT (without an IPI). - * - * New with Core Duo processors, MWAIT can take some hints based on CPU - * capability. */ -void mwait_idle_with_hints(unsigned long eax, unsigned long ecx) +static void mwait_idle(void) { - if (!need_resched()) { + local_irq_enable(); + + while (!need_resched()) { __monitor((void *)¤t_thread_info()->flags, 0, 0); smp_mb(); - if (!need_resched()) - __mwait(eax, ecx); + if (need_resched()) + break; + __mwait(0, 0); } } -/* Default MONITOR/MWAIT with no hints, used for default C1 state */ -static void mwait_idle(void) -{ - local_irq_enable(); - while (!need_resched()) - mwait_idle_with_hints(0,0); -} - void __cpuinit select_idle_routine(const struct cpuinfo_x86 *c) { static int printed; diff --git a/trunk/drivers/Kconfig b/trunk/drivers/Kconfig index f39463418904..263e86ddc1a4 100644 --- a/trunk/drivers/Kconfig +++ b/trunk/drivers/Kconfig @@ -14,10 +14,6 @@ source "drivers/pnp/Kconfig" source "drivers/block/Kconfig" -# misc before ide - BLK_DEV_SGIIOC4 depends on SGI_IOC4 - -source "drivers/misc/Kconfig" - source "drivers/ide/Kconfig" source "drivers/scsi/Kconfig" @@ -56,6 +52,8 @@ source "drivers/w1/Kconfig" source "drivers/hwmon/Kconfig" +source "drivers/misc/Kconfig" + source "drivers/mfd/Kconfig" source "drivers/media/Kconfig" diff --git a/trunk/drivers/acpi/asus_acpi.c b/trunk/drivers/acpi/asus_acpi.c index c7ac9297a204..e9ee4c52a5f6 100644 --- a/trunk/drivers/acpi/asus_acpi.c +++ b/trunk/drivers/acpi/asus_acpi.c @@ -138,7 +138,6 @@ struct asus_hotk { S2x, //S200 (J1 reported), Victor MP-XP7210 W1N, //W1000N W5A, //W5A - W3V, //W3030V xxN, //M2400N, M3700N, M5200N, M6800N, S1300N, S5200N //(Centrino) END_MODEL @@ -377,17 +376,6 @@ static struct model_data model_conf[END_MODEL] = { .display_get = "\\ADVG"}, { - .name = "W3V", - .mt_mled = "MLED", - .mt_wled = "WLED", - .mt_lcd_switch = xxN_PREFIX "_Q10", - .lcd_status = "\\BKLT", - .brightness_set = "SPLV", - .brightness_get = "GPLV", - .display_set = "SDSP", - .display_get = "\\INFB"}, - - { .name = "xxN", .mt_mled = "MLED", /* WLED present, but not controlled by ACPI */ @@ -567,11 +555,11 @@ static int write_led(const char __user * buffer, unsigned long count, char *ledname, int ledmask, int invert) { - int rv, value; + int value; int led_out = 0; - rv = parse_arg(buffer, count, &value); - if (rv > 0) + count = parse_arg(buffer, count, &value); + if (count > 0) led_out = value ? 1 : 0; hotk->status = @@ -584,7 +572,7 @@ write_led(const char __user * buffer, unsigned long count, printk(KERN_WARNING "Asus ACPI: LED (%s) write failed\n", ledname); - return rv; + return count; } /* @@ -619,18 +607,20 @@ static int proc_write_ledd(struct file *file, const char __user * buffer, unsigned long count, void *data) { - int rv, value; + int value; - rv = parse_arg(buffer, count, &value); - if (rv > 0) { + count = parse_arg(buffer, count, &value); + if (count > 0) { if (!write_acpi_int (hotk->handle, hotk->methods->mt_ledd, value, NULL)) printk(KERN_WARNING "Asus ACPI: LED display write failed\n"); else hotk->ledd_status = (u32) value; - } - return rv; + } else if (count < 0) + printk(KERN_WARNING "Asus ACPI: Error reading user input\n"); + + return count; } /* @@ -771,12 +761,12 @@ static int proc_write_lcd(struct file *file, const char __user * buffer, unsigned long count, void *data) { - int rv, value; + int value; - rv = parse_arg(buffer, count, &value); - if (rv > 0) + count = parse_arg(buffer, count, &value); + if (count > 0) set_lcd_state(value); - return rv; + return count; } static int read_brightness(void) @@ -840,15 +830,18 @@ static int proc_write_brn(struct file *file, const char __user * buffer, unsigned long count, void *data) { - int rv, value; + int value; - rv = parse_arg(buffer, count, &value); - if (rv > 0) { + count = parse_arg(buffer, count, &value); + if (count > 0) { value = (0 < value) ? ((15 < value) ? 15 : value) : 0; /* 0 <= value <= 15 */ set_brightness(value); + } else if (count < 0) { + printk(KERN_WARNING "Asus ACPI: Error reading user input\n"); } - return rv; + + return count; } static void set_display(int value) @@ -887,12 +880,15 @@ static int proc_write_disp(struct file *file, const char __user * buffer, unsigned long count, void *data) { - int rv, value; + int value; - rv = parse_arg(buffer, count, &value); - if (rv > 0) + count = parse_arg(buffer, count, &value); + if (count > 0) set_display(value); - return rv; + else if (count < 0) + printk(KERN_WARNING "Asus ACPI: Error reading user input\n"); + + return count; } typedef int (proc_readfunc) (char *page, char **start, off_t off, int count, @@ -1101,8 +1097,6 @@ static int asus_model_match(char *model) return A4G; else if (strncmp(model, "W1N", 3) == 0) return W1N; - else if (strncmp(model, "W3V", 3) == 0) - return W3V; else if (strncmp(model, "W5A", 3) == 0) return W5A; else @@ -1206,10 +1200,9 @@ static int asus_hotk_get_info(void) hotk->methods->mt_wled = NULL; /* L5D's WLED is not controlled by ACPI */ else if (strncmp(string, "M2N", 3) == 0 || - strncmp(string, "W3V", 3) == 0 || strncmp(string, "S1N", 3) == 0) hotk->methods->mt_wled = "WLED"; - /* M2N, S1N and W3V have a usable WLED */ + /* M2N and S1N have a usable WLED */ else if (asus_info) { if (strncmp(asus_info->oem_table_id, "L1", 2) == 0) hotk->methods->mled_status = NULL; diff --git a/trunk/drivers/acpi/battery.c b/trunk/drivers/acpi/battery.c index 026e40755cdd..9810e2a55d0a 100644 --- a/trunk/drivers/acpi/battery.c +++ b/trunk/drivers/acpi/battery.c @@ -64,7 +64,6 @@ extern void *acpi_unlock_battery_dir(struct proc_dir_entry *acpi_battery_dir); static int acpi_battery_add(struct acpi_device *device); static int acpi_battery_remove(struct acpi_device *device, int type); -static int acpi_battery_resume(struct acpi_device *device, int status); static struct acpi_driver acpi_battery_driver = { .name = ACPI_BATTERY_DRIVER_NAME, @@ -72,7 +71,6 @@ static struct acpi_driver acpi_battery_driver = { .ids = ACPI_BATTERY_HID, .ops = { .add = acpi_battery_add, - .resume = acpi_battery_resume, .remove = acpi_battery_remove, }, }; @@ -755,18 +753,6 @@ static int acpi_battery_remove(struct acpi_device *device, int type) return 0; } -/* this is needed to learn about changes made in suspended state */ -static int acpi_battery_resume(struct acpi_device *device, int state) -{ - struct acpi_battery *battery; - - if (!device) - return -EINVAL; - - battery = device->driver_data; - return acpi_battery_check(battery); -} - static int __init acpi_battery_init(void) { int result; diff --git a/trunk/drivers/acpi/ec.c b/trunk/drivers/acpi/ec.c index e6d4b084dca2..e5d796362854 100644 --- a/trunk/drivers/acpi/ec.c +++ b/trunk/drivers/acpi/ec.c @@ -45,143 +45,206 @@ ACPI_MODULE_NAME("acpi_ec") #define ACPI_EC_DRIVER_NAME "ACPI Embedded Controller Driver" #define ACPI_EC_DEVICE_NAME "Embedded Controller" #define ACPI_EC_FILE_INFO "info" - -/* EC status register */ #define ACPI_EC_FLAG_OBF 0x01 /* Output buffer full */ #define ACPI_EC_FLAG_IBF 0x02 /* Input buffer full */ #define ACPI_EC_FLAG_BURST 0x10 /* burst mode */ #define ACPI_EC_FLAG_SCI 0x20 /* EC-SCI occurred */ - -/* EC commands */ +#define ACPI_EC_EVENT_OBF 0x01 /* Output buffer full */ +#define ACPI_EC_EVENT_IBE 0x02 /* Input buffer empty */ +#define ACPI_EC_DELAY 50 /* Wait 50ms max. during EC ops */ +#define ACPI_EC_UDELAY_GLK 1000 /* Wait 1ms max. to get global lock */ +#define ACPI_EC_UDELAY 100 /* Poll @ 100us increments */ +#define ACPI_EC_UDELAY_COUNT 1000 /* Wait 10ms max. during EC ops */ #define ACPI_EC_COMMAND_READ 0x80 #define ACPI_EC_COMMAND_WRITE 0x81 #define ACPI_EC_BURST_ENABLE 0x82 #define ACPI_EC_BURST_DISABLE 0x83 #define ACPI_EC_COMMAND_QUERY 0x84 - -/* EC events */ -enum { - ACPI_EC_EVENT_OBF_1 = 1, /* Output buffer full */ - ACPI_EC_EVENT_IBF_0, /* Input buffer empty */ -}; - -#define ACPI_EC_DELAY 50 /* Wait 50ms max. during EC ops */ -#define ACPI_EC_UDELAY_GLK 1000 /* Wait 1ms max. to get global lock */ -#define ACPI_EC_UDELAY 100 /* Poll @ 100us increments */ -#define ACPI_EC_UDELAY_COUNT 1000 /* Wait 10ms max. during EC ops */ - -enum { - EC_INTR = 1, /* Output buffer full */ - EC_POLL, /* Input buffer empty */ -}; - +#define EC_POLL 0xFF +#define EC_INTR 0x00 static int acpi_ec_remove(struct acpi_device *device, int type); static int acpi_ec_start(struct acpi_device *device); static int acpi_ec_stop(struct acpi_device *device, int type); -static int acpi_ec_add(struct acpi_device *device); +static int acpi_ec_intr_add(struct acpi_device *device); +static int acpi_ec_poll_add(struct acpi_device *device); static struct acpi_driver acpi_ec_driver = { .name = ACPI_EC_DRIVER_NAME, .class = ACPI_EC_CLASS, .ids = ACPI_EC_HID, .ops = { - .add = acpi_ec_add, + .add = acpi_ec_intr_add, .remove = acpi_ec_remove, .start = acpi_ec_start, .stop = acpi_ec_stop, }, }; +union acpi_ec { + struct { + u32 mode; + acpi_handle handle; + unsigned long uid; + unsigned long gpe_bit; + struct acpi_generic_address status_addr; + struct acpi_generic_address command_addr; + struct acpi_generic_address data_addr; + unsigned long global_lock; + } common; + + struct { + u32 mode; + acpi_handle handle; + unsigned long uid; + unsigned long gpe_bit; + struct acpi_generic_address status_addr; + struct acpi_generic_address command_addr; + struct acpi_generic_address data_addr; + unsigned long global_lock; + unsigned int expect_event; + atomic_t leaving_burst; /* 0 : No, 1 : Yes, 2: abort */ + atomic_t pending_gpe; + struct semaphore sem; + wait_queue_head_t wait; + } intr; + + struct { + u32 mode; + acpi_handle handle; + unsigned long uid; + unsigned long gpe_bit; + struct acpi_generic_address status_addr; + struct acpi_generic_address command_addr; + struct acpi_generic_address data_addr; + unsigned long global_lock; + struct semaphore sem; + } poll; +}; +static int acpi_ec_poll_wait(union acpi_ec *ec, u8 event); +static int acpi_ec_intr_wait(union acpi_ec *ec, unsigned int event); +static int acpi_ec_poll_read(union acpi_ec *ec, u8 address, u32 * data); +static int acpi_ec_intr_read(union acpi_ec *ec, u8 address, u32 * data); +static int acpi_ec_poll_write(union acpi_ec *ec, u8 address, u8 data); +static int acpi_ec_intr_write(union acpi_ec *ec, u8 address, u8 data); +static int acpi_ec_poll_query(union acpi_ec *ec, u32 * data); +static int acpi_ec_intr_query(union acpi_ec *ec, u32 * data); +static void acpi_ec_gpe_poll_query(void *ec_cxt); +static void acpi_ec_gpe_intr_query(void *ec_cxt); +static u32 acpi_ec_gpe_poll_handler(void *data); +static u32 acpi_ec_gpe_intr_handler(void *data); +static acpi_status __init +acpi_fake_ecdt_poll_callback(acpi_handle handle, + u32 Level, void *context, void **retval); + +static acpi_status __init +acpi_fake_ecdt_intr_callback(acpi_handle handle, + u32 Level, void *context, void **retval); + +static int __init acpi_ec_poll_get_real_ecdt(void); +static int __init acpi_ec_intr_get_real_ecdt(void); /* If we find an EC via the ECDT, we need to keep a ptr to its context */ -struct acpi_ec { - acpi_handle handle; - unsigned long uid; - unsigned long gpe_bit; - unsigned long command_addr; - unsigned long data_addr; - unsigned long global_lock; - struct semaphore sem; - unsigned int expect_event; - atomic_t leaving_burst; /* 0 : No, 1 : Yes, 2: abort */ - wait_queue_head_t wait; -} *ec_ecdt; +static union acpi_ec *ec_ecdt; /* External interfaces use first EC only, so remember */ static struct acpi_device *first_ec; -static int acpi_ec_mode = EC_INTR; +static int acpi_ec_poll_mode = EC_INTR; /* -------------------------------------------------------------------------- Transaction Management -------------------------------------------------------------------------- */ -static inline u8 acpi_ec_read_status(struct acpi_ec *ec) +static u32 acpi_ec_read_status(union acpi_ec *ec) { - return inb(ec->command_addr); -} + u32 status = 0; -static inline u8 acpi_ec_read_data(struct acpi_ec *ec) -{ - return inb(ec->data_addr); + acpi_hw_low_level_read(8, &status, &ec->common.status_addr); + return status; } -static inline void acpi_ec_write_cmd(struct acpi_ec *ec, u8 command) +static int acpi_ec_wait(union acpi_ec *ec, u8 event) { - outb(command, ec->command_addr); + if (acpi_ec_poll_mode) + return acpi_ec_poll_wait(ec, event); + else + return acpi_ec_intr_wait(ec, event); } -static inline void acpi_ec_write_data(struct acpi_ec *ec, u8 data) +static int acpi_ec_poll_wait(union acpi_ec *ec, u8 event) { - outb(data, ec->data_addr); -} + u32 acpi_ec_status = 0; + u32 i = ACPI_EC_UDELAY_COUNT; -static int acpi_ec_check_status(u8 status, u8 event) -{ + if (!ec) + return -EINVAL; + + /* Poll the EC status register waiting for the event to occur. */ switch (event) { - case ACPI_EC_EVENT_OBF_1: - if (status & ACPI_EC_FLAG_OBF) - return 1; + case ACPI_EC_EVENT_OBF: + do { + acpi_hw_low_level_read(8, &acpi_ec_status, + &ec->common.status_addr); + if (acpi_ec_status & ACPI_EC_FLAG_OBF) + return 0; + udelay(ACPI_EC_UDELAY); + } while (--i > 0); break; - case ACPI_EC_EVENT_IBF_0: - if (!(status & ACPI_EC_FLAG_IBF)) - return 1; + case ACPI_EC_EVENT_IBE: + do { + acpi_hw_low_level_read(8, &acpi_ec_status, + &ec->common.status_addr); + if (!(acpi_ec_status & ACPI_EC_FLAG_IBF)) + return 0; + udelay(ACPI_EC_UDELAY); + } while (--i > 0); break; default: - break; + return -EINVAL; } - return 0; + return -ETIME; } - -static int acpi_ec_wait(struct acpi_ec *ec, u8 event) +static int acpi_ec_intr_wait(union acpi_ec *ec, unsigned int event) { - int i = (acpi_ec_mode == EC_POLL) ? ACPI_EC_UDELAY_COUNT : 0; - long time_left; + int result = 0; - ec->expect_event = event; - if (acpi_ec_check_status(acpi_ec_read_status(ec), event)) { - ec->expect_event = 0; - return 0; + + ec->intr.expect_event = event; + smp_mb(); + + switch (event) { + case ACPI_EC_EVENT_IBE: + if (~acpi_ec_read_status(ec) & ACPI_EC_FLAG_IBF) { + ec->intr.expect_event = 0; + return 0; + } + break; + default: + break; } - do { - if (acpi_ec_mode == EC_POLL) { - udelay(ACPI_EC_UDELAY); - } else { - time_left = wait_event_timeout(ec->wait, - !ec->expect_event, + result = wait_event_timeout(ec->intr.wait, + !ec->intr.expect_event, msecs_to_jiffies(ACPI_EC_DELAY)); - if (time_left > 0) { - ec->expect_event = 0; - return 0; - } - } - if (acpi_ec_check_status(acpi_ec_read_status(ec), event)) { - ec->expect_event = 0; + + ec->intr.expect_event = 0; + smp_mb(); + + /* + * Verify that the event in question has actually happened by + * querying EC status. Do the check even if operation timed-out + * to make sure that we did not miss interrupt. + */ + switch (event) { + case ACPI_EC_EVENT_OBF: + if (acpi_ec_read_status(ec) & ACPI_EC_FLAG_OBF) return 0; - } - } while (--i > 0); + break; - ec->expect_event = 0; + case ACPI_EC_EVENT_IBE: + if (~acpi_ec_read_status(ec) & ACPI_EC_FLAG_IBF) + return 0; + break; + } return -ETIME; } @@ -191,150 +254,272 @@ static int acpi_ec_wait(struct acpi_ec *ec, u8 event) * Note: samsung nv5000 doesn't work with ec burst mode. * http://bugzilla.kernel.org/show_bug.cgi?id=4980 */ -int acpi_ec_enter_burst_mode(struct acpi_ec *ec) +int acpi_ec_enter_burst_mode(union acpi_ec *ec) { - u8 tmp = 0; - u8 status = 0; + u32 tmp = 0; + int status = 0; status = acpi_ec_read_status(ec); if (status != -EINVAL && !(status & ACPI_EC_FLAG_BURST)) { - status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0); + status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); if (status) goto end; - acpi_ec_write_cmd(ec, ACPI_EC_BURST_ENABLE); - status = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF_1); - tmp = acpi_ec_read_data(ec); + acpi_hw_low_level_write(8, ACPI_EC_BURST_ENABLE, + &ec->common.command_addr); + status = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF); + acpi_hw_low_level_read(8, &tmp, &ec->common.data_addr); if (tmp != 0x90) { /* Burst ACK byte */ return -EINVAL; } } - atomic_set(&ec->leaving_burst, 0); + atomic_set(&ec->intr.leaving_burst, 0); return 0; - end: - ACPI_EXCEPTION((AE_INFO, status, "EC wait, burst mode")); + end: + ACPI_EXCEPTION ((AE_INFO, status, "EC wait, burst mode"); return -1; } -int acpi_ec_leave_burst_mode(struct acpi_ec *ec) +int acpi_ec_leave_burst_mode(union acpi_ec *ec) { - u8 status = 0; + int status = 0; status = acpi_ec_read_status(ec); if (status != -EINVAL && (status & ACPI_EC_FLAG_BURST)){ - status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0); + status = acpi_ec_wait(ec, ACPI_EC_FLAG_IBF); if(status) goto end; - acpi_ec_write_cmd(ec, ACPI_EC_BURST_DISABLE); - acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0); - } - atomic_set(&ec->leaving_burst, 1); + acpi_hw_low_level_write(8, ACPI_EC_BURST_DISABLE, &ec->common.command_addr); + acpi_ec_wait(ec, ACPI_EC_FLAG_IBF); + } + atomic_set(&ec->intr.leaving_burst, 1); return 0; - end: - ACPI_EXCEPTION((AE_INFO, status, "EC leave burst mode")); +end: + ACPI_EXCEPTION((AE_INFO, status, "EC leave burst mode"); return -1; } #endif /* ACPI_FUTURE_USAGE */ -static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, u8 command, - const u8 *wdata, unsigned wdata_len, - u8 *rdata, unsigned rdata_len) +static int acpi_ec_read(union acpi_ec *ec, u8 address, u32 * data) +{ + if (acpi_ec_poll_mode) + return acpi_ec_poll_read(ec, address, data); + else + return acpi_ec_intr_read(ec, address, data); +} +static int acpi_ec_write(union acpi_ec *ec, u8 address, u8 data) +{ + if (acpi_ec_poll_mode) + return acpi_ec_poll_write(ec, address, data); + else + return acpi_ec_intr_write(ec, address, data); +} +static int acpi_ec_poll_read(union acpi_ec *ec, u8 address, u32 * data) { - int result; + acpi_status status = AE_OK; + int result = 0; + u32 glk = 0; - acpi_ec_write_cmd(ec, command); - for (; wdata_len > 0; wdata_len --) { - result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0); - if (result) - return result; - acpi_ec_write_data(ec, *(wdata++)); + if (!ec || !data) + return -EINVAL; + + *data = 0; + + if (ec->common.global_lock) { + status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk); + if (ACPI_FAILURE(status)) + return -ENODEV; } - if (command == ACPI_EC_COMMAND_WRITE) { - result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0); - if (result) - return result; + if (down_interruptible(&ec->poll.sem)) { + result = -ERESTARTSYS; + goto end_nosem; } + + acpi_hw_low_level_write(8, ACPI_EC_COMMAND_READ, + &ec->common.command_addr); + result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); + if (result) + goto end; + + acpi_hw_low_level_write(8, address, &ec->common.data_addr); + result = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF); + if (result) + goto end; + + acpi_hw_low_level_read(8, data, &ec->common.data_addr); + + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Read [%02x] from address [%02x]\n", + *data, address)); + + end: + up(&ec->poll.sem); +end_nosem: + if (ec->common.global_lock) + acpi_release_global_lock(glk); + + return result; +} + +static int acpi_ec_poll_write(union acpi_ec *ec, u8 address, u8 data) +{ + int result = 0; + acpi_status status = AE_OK; + u32 glk = 0; - for (; rdata_len > 0; rdata_len --) { - result = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF_1); - if (result) - return result; - *(rdata++) = acpi_ec_read_data(ec); + if (!ec) + return -EINVAL; + + if (ec->common.global_lock) { + status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk); + if (ACPI_FAILURE(status)) + return -ENODEV; + } + + if (down_interruptible(&ec->poll.sem)) { + result = -ERESTARTSYS; + goto end_nosem; } + + acpi_hw_low_level_write(8, ACPI_EC_COMMAND_WRITE, + &ec->common.command_addr); + result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); + if (result) + goto end; - return 0; + acpi_hw_low_level_write(8, address, &ec->common.data_addr); + result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); + if (result) + goto end; + + acpi_hw_low_level_write(8, data, &ec->common.data_addr); + result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); + if (result) + goto end; + + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Wrote [%02x] to address [%02x]\n", + data, address)); + + end: + up(&ec->poll.sem); +end_nosem: + if (ec->common.global_lock) + acpi_release_global_lock(glk); + + return result; } -static int acpi_ec_transaction(struct acpi_ec *ec, u8 command, - const u8 *wdata, unsigned wdata_len, - u8 *rdata, unsigned rdata_len) +static int acpi_ec_intr_read(union acpi_ec *ec, u8 address, u32 * data) { - int status; + int status = 0; u32 glk; - if (!ec || (wdata_len && !wdata) || (rdata_len && !rdata)) + + if (!ec || !data) return -EINVAL; - if (rdata) - memset(rdata, 0, rdata_len); + *data = 0; - if (ec->global_lock) { + if (ec->common.global_lock) { status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk); if (ACPI_FAILURE(status)) return -ENODEV; } - down(&ec->sem); - status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0); + WARN_ON(in_interrupt()); + down(&ec->intr.sem); + + status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); if (status) { printk(KERN_DEBUG PREFIX "read EC, IB not empty\n"); goto end; } + acpi_hw_low_level_write(8, ACPI_EC_COMMAND_READ, + &ec->common.command_addr); + status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); + if (status) { + printk(KERN_DEBUG PREFIX "read EC, IB not empty\n"); + } - status = acpi_ec_transaction_unlocked(ec, command, - wdata, wdata_len, - rdata, rdata_len); + acpi_hw_low_level_write(8, address, &ec->common.data_addr); + status = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF); + if (status) { + printk(KERN_DEBUG PREFIX "read EC, OB not full\n"); + goto end; + } + acpi_hw_low_level_read(8, data, &ec->common.data_addr); + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Read [%02x] from address [%02x]\n", + *data, address)); -end: - up(&ec->sem); + end: + up(&ec->intr.sem); - if (ec->global_lock) + if (ec->common.global_lock) acpi_release_global_lock(glk); return status; } -static int acpi_ec_read(struct acpi_ec *ec, u8 address, u8 *data) +static int acpi_ec_intr_write(union acpi_ec *ec, u8 address, u8 data) { - int result; - u8 d; + int status = 0; + u32 glk; - result = acpi_ec_transaction(ec, ACPI_EC_COMMAND_READ, - &address, 1, &d, 1); - *data = d; - return result; -} -static int acpi_ec_write(struct acpi_ec *ec, u8 address, u8 data) -{ - u8 wdata[2] = { address, data }; - return acpi_ec_transaction(ec, ACPI_EC_COMMAND_WRITE, - wdata, 2, NULL, 0); + if (!ec) + return -EINVAL; + + if (ec->common.global_lock) { + status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk); + if (ACPI_FAILURE(status)) + return -ENODEV; + } + + WARN_ON(in_interrupt()); + down(&ec->intr.sem); + + status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); + if (status) { + printk(KERN_DEBUG PREFIX "write EC, IB not empty\n"); + } + acpi_hw_low_level_write(8, ACPI_EC_COMMAND_WRITE, + &ec->common.command_addr); + status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); + if (status) { + printk(KERN_DEBUG PREFIX "write EC, IB not empty\n"); + } + + acpi_hw_low_level_write(8, address, &ec->common.data_addr); + status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); + if (status) { + printk(KERN_DEBUG PREFIX "write EC, IB not empty\n"); + } + + acpi_hw_low_level_write(8, data, &ec->common.data_addr); + + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Wrote [%02x] to address [%02x]\n", + data, address)); + + up(&ec->intr.sem); + + if (ec->common.global_lock) + acpi_release_global_lock(glk); + + return status; } /* * Externally callable EC access functions. For now, assume 1 EC only */ -int ec_read(u8 addr, u8 *val) +int ec_read(u8 addr, u8 * val) { - struct acpi_ec *ec; + union acpi_ec *ec; int err; - u8 temp_data; + u32 temp_data; if (!first_ec) return -ENODEV; @@ -354,7 +539,7 @@ EXPORT_SYMBOL(ec_read); int ec_write(u8 addr, u8 val) { - struct acpi_ec *ec; + union acpi_ec *ec; int err; if (!first_ec) @@ -369,106 +554,255 @@ int ec_write(u8 addr, u8 val) EXPORT_SYMBOL(ec_write); -extern int ec_transaction(u8 command, - const u8 *wdata, unsigned wdata_len, - u8 *rdata, unsigned rdata_len) +static int acpi_ec_query(union acpi_ec *ec, u32 * data) +{ + if (acpi_ec_poll_mode) + return acpi_ec_poll_query(ec, data); + else + return acpi_ec_intr_query(ec, data); +} +static int acpi_ec_poll_query(union acpi_ec *ec, u32 * data) { - struct acpi_ec *ec; + int result = 0; + acpi_status status = AE_OK; + u32 glk = 0; - if (!first_ec) - return -ENODEV; - ec = acpi_driver_data(first_ec); + if (!ec || !data) + return -EINVAL; - return acpi_ec_transaction(ec, command, wdata, - wdata_len, rdata, rdata_len); -} + *data = 0; + + if (ec->common.global_lock) { + status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk); + if (ACPI_FAILURE(status)) + return -ENODEV; + } -EXPORT_SYMBOL(ec_transaction); + /* + * Query the EC to find out which _Qxx method we need to evaluate. + * Note that successful completion of the query causes the ACPI_EC_SCI + * bit to be cleared (and thus clearing the interrupt source). + */ + if (down_interruptible(&ec->poll.sem)) { + result = -ERESTARTSYS; + goto end_nosem; + } + + acpi_hw_low_level_write(8, ACPI_EC_COMMAND_QUERY, + &ec->common.command_addr); + result = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF); + if (result) + goto end; + + acpi_hw_low_level_read(8, data, &ec->common.data_addr); + if (!*data) + result = -ENODATA; + + end: + up(&ec->poll.sem); +end_nosem: + if (ec->common.global_lock) + acpi_release_global_lock(glk); -static int acpi_ec_query(struct acpi_ec *ec, u8 *data) + return result; +} +static int acpi_ec_intr_query(union acpi_ec *ec, u32 * data) { - int result; - u8 d; + int status = 0; + u32 glk; + + + if (!ec || !data) + return -EINVAL; + *data = 0; + + if (ec->common.global_lock) { + status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk); + if (ACPI_FAILURE(status)) + return -ENODEV; + } - if (!ec || !data) - return -EINVAL; + down(&ec->intr.sem); - /* - * Query the EC to find out which _Qxx method we need to evaluate. - * Note that successful completion of the query causes the ACPI_EC_SCI - * bit to be cleared (and thus clearing the interrupt source). - */ + status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); + if (status) { + printk(KERN_DEBUG PREFIX "query EC, IB not empty\n"); + goto end; + } + /* + * Query the EC to find out which _Qxx method we need to evaluate. + * Note that successful completion of the query causes the ACPI_EC_SCI + * bit to be cleared (and thus clearing the interrupt source). + */ + acpi_hw_low_level_write(8, ACPI_EC_COMMAND_QUERY, + &ec->common.command_addr); + status = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF); + if (status) { + printk(KERN_DEBUG PREFIX "query EC, OB not full\n"); + goto end; + } - result = acpi_ec_transaction(ec, ACPI_EC_COMMAND_QUERY, NULL, 0, &d, 1); - if (result) - return result; + acpi_hw_low_level_read(8, data, &ec->common.data_addr); + if (!*data) + status = -ENODATA; - if (!d) - return -ENODATA; + end: + up(&ec->intr.sem); + + if (ec->common.global_lock) + acpi_release_global_lock(glk); - *data = d; - return 0; + return status; } /* -------------------------------------------------------------------------- Event Management -------------------------------------------------------------------------- */ -struct acpi_ec_query_data { +union acpi_ec_query_data { acpi_handle handle; u8 data; }; static void acpi_ec_gpe_query(void *ec_cxt) { - struct acpi_ec *ec = (struct acpi_ec *)ec_cxt; - u8 value = 0; - static char object_name[8]; + if (acpi_ec_poll_mode) + acpi_ec_gpe_poll_query(ec_cxt); + else + acpi_ec_gpe_intr_query(ec_cxt); +} - if (!ec) - goto end; +static void acpi_ec_gpe_poll_query(void *ec_cxt) +{ + union acpi_ec *ec = (union acpi_ec *)ec_cxt; + u32 value = 0; + static char object_name[5] = { '_', 'Q', '0', '0', '\0' }; + const char hex[] = { '0', '1', '2', '3', '4', '5', '6', '7', + '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' + }; - value = acpi_ec_read_status(ec); + if (!ec_cxt) + goto end; + + if (down_interruptible (&ec->poll.sem)) { + return; + } + acpi_hw_low_level_read(8, &value, &ec->common.command_addr); + up(&ec->poll.sem); + + /* TBD: Implement asynch events! + * NOTE: All we care about are EC-SCI's. Other EC events are + * handled via polling (yuck!). This is because some systems + * treat EC-SCIs as level (versus EDGE!) triggered, preventing + * a purely interrupt-driven approach (grumble, grumble). + */ if (!(value & ACPI_EC_FLAG_SCI)) goto end; if (acpi_ec_query(ec, &value)) goto end; - snprintf(object_name, 8, "_Q%2.2X", value); + object_name[2] = hex[((value >> 4) & 0x0F)]; + object_name[3] = hex[(value & 0x0F)]; + + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Evaluating %s\n", object_name)); - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Evaluating %s", object_name)); + acpi_evaluate_object(ec->common.handle, object_name, NULL, NULL); - acpi_evaluate_object(ec->handle, object_name, NULL, NULL); + end: + acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); +} +static void acpi_ec_gpe_intr_query(void *ec_cxt) +{ + union acpi_ec *ec = (union acpi_ec *)ec_cxt; + u32 value; + int result = -ENODATA; + static char object_name[5] = { '_', 'Q', '0', '0', '\0' }; + const char hex[] = { '0', '1', '2', '3', '4', '5', '6', '7', + '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' + }; + + if (acpi_ec_read_status(ec) & ACPI_EC_FLAG_SCI) + result = acpi_ec_query(ec, &value); + + if (result) + goto end; + + object_name[2] = hex[((value >> 4) & 0x0F)]; + object_name[3] = hex[(value & 0x0F)]; + + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Evaluating %s\n", object_name)); + + acpi_evaluate_object(ec->common.handle, object_name, NULL, NULL); end: - acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR); + atomic_dec(&ec->intr.pending_gpe); + return; } static u32 acpi_ec_gpe_handler(void *data) +{ + if (acpi_ec_poll_mode) + return acpi_ec_gpe_poll_handler(data); + else + return acpi_ec_gpe_intr_handler(data); +} +static u32 acpi_ec_gpe_poll_handler(void *data) { acpi_status status = AE_OK; - u8 value; - struct acpi_ec *ec = (struct acpi_ec *)data; + union acpi_ec *ec = (union acpi_ec *)data; + + if (!ec) + return ACPI_INTERRUPT_NOT_HANDLED; + + acpi_disable_gpe(NULL, ec->common.gpe_bit, ACPI_ISR); + + status = acpi_os_execute(OSL_EC_POLL_HANDLER, acpi_ec_gpe_query, ec); + + if (status == AE_OK) + return ACPI_INTERRUPT_HANDLED; + else + return ACPI_INTERRUPT_NOT_HANDLED; +} +static u32 acpi_ec_gpe_intr_handler(void *data) +{ + acpi_status status = AE_OK; + u32 value; + union acpi_ec *ec = (union acpi_ec *)data; + + if (!ec) + return ACPI_INTERRUPT_NOT_HANDLED; - acpi_clear_gpe(NULL, ec->gpe_bit, ACPI_ISR); + acpi_clear_gpe(NULL, ec->common.gpe_bit, ACPI_ISR); value = acpi_ec_read_status(ec); - if (acpi_ec_mode == EC_INTR) { - if (acpi_ec_check_status(value, ec->expect_event)) { - ec->expect_event = 0; - wake_up(&ec->wait); - } + switch (ec->intr.expect_event) { + case ACPI_EC_EVENT_OBF: + if (!(value & ACPI_EC_FLAG_OBF)) + break; + ec->intr.expect_event = 0; + wake_up(&ec->intr.wait); + break; + case ACPI_EC_EVENT_IBE: + if ((value & ACPI_EC_FLAG_IBF)) + break; + ec->intr.expect_event = 0; + wake_up(&ec->intr.wait); + break; + default: + break; } if (value & ACPI_EC_FLAG_SCI) { - status = acpi_os_execute(OSL_EC_BURST_HANDLER, acpi_ec_gpe_query, ec); + atomic_add(1, &ec->intr.pending_gpe); + status = acpi_os_execute(OSL_EC_BURST_HANDLER, + acpi_ec_gpe_query, ec); return status == AE_OK ? ACPI_INTERRUPT_HANDLED : ACPI_INTERRUPT_NOT_HANDLED; } - acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_ISR); + acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_ISR); return status == AE_OK ? ACPI_INTERRUPT_HANDLED : ACPI_INTERRUPT_NOT_HANDLED; } @@ -499,7 +833,7 @@ acpi_ec_space_handler(u32 function, void *handler_context, void *region_context) { int result = 0; - struct acpi_ec *ec = NULL; + union acpi_ec *ec = NULL; u64 temp = *value; acpi_integer f_v = 0; int i = 0; @@ -509,16 +843,18 @@ acpi_ec_space_handler(u32 function, return AE_BAD_PARAMETER; if (bit_width != 8 && acpi_strict) { + printk(KERN_WARNING PREFIX + "acpi_ec_space_handler: bit_width should be 8\n"); return AE_BAD_PARAMETER; } - ec = (struct acpi_ec *)handler_context; + ec = (union acpi_ec *)handler_context; next_byte: switch (function) { case ACPI_READ: temp = 0; - result = acpi_ec_read(ec, (u8) address, (u8 *) &temp); + result = acpi_ec_read(ec, (u8) address, (u32 *) & temp); break; case ACPI_WRITE: result = acpi_ec_write(ec, (u8) address, (u8) temp); @@ -569,20 +905,20 @@ static struct proc_dir_entry *acpi_ec_dir; static int acpi_ec_read_info(struct seq_file *seq, void *offset) { - struct acpi_ec *ec = (struct acpi_ec *)seq->private; + union acpi_ec *ec = (union acpi_ec *)seq->private; if (!ec) goto end; seq_printf(seq, "gpe bit: 0x%02x\n", - (u32) ec->gpe_bit); + (u32) ec->common.gpe_bit); seq_printf(seq, "ports: 0x%02x, 0x%02x\n", - (u32) ec->command_addr, - (u32) ec->data_addr); + (u32) ec->common.status_addr.address, + (u32) ec->common.data_addr.address); seq_printf(seq, "use global lock: %s\n", - ec->global_lock ? "yes" : "no"); - acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR); + ec->common.global_lock ? "yes" : "no"); + acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); end: return 0; @@ -593,7 +929,7 @@ static int acpi_ec_info_open_fs(struct inode *inode, struct file *file) return single_open(file, acpi_ec_read_info, PDE(inode)->data); } -static struct file_operations acpi_ec_info_ops = { +static const struct file_operations acpi_ec_info_ops = { .open = acpi_ec_info_open_fs, .read = seq_read, .llseek = seq_lseek, @@ -642,35 +978,101 @@ static int acpi_ec_remove_fs(struct acpi_device *device) Driver Interface -------------------------------------------------------------------------- */ -static int acpi_ec_add(struct acpi_device *device) +static int acpi_ec_poll_add(struct acpi_device *device) { int result = 0; acpi_status status = AE_OK; - struct acpi_ec *ec = NULL; + union acpi_ec *ec = NULL; if (!device) return -EINVAL; - ec = kmalloc(sizeof(struct acpi_ec), GFP_KERNEL); + ec = kmalloc(sizeof(union acpi_ec), GFP_KERNEL); if (!ec) return -ENOMEM; - memset(ec, 0, sizeof(struct acpi_ec)); - - ec->handle = device->handle; - ec->uid = -1; - init_MUTEX(&ec->sem); - if (acpi_ec_mode == EC_INTR) { - atomic_set(&ec->leaving_burst, 1); - init_waitqueue_head(&ec->wait); + memset(ec, 0, sizeof(union acpi_ec)); + + ec->common.handle = device->handle; + ec->common.uid = -1; + init_MUTEX(&ec->poll.sem); + strcpy(acpi_device_name(device), ACPI_EC_DEVICE_NAME); + strcpy(acpi_device_class(device), ACPI_EC_CLASS); + acpi_driver_data(device) = ec; + + /* Use the global lock for all EC transactions? */ + acpi_evaluate_integer(ec->common.handle, "_GLK", NULL, + &ec->common.global_lock); + + /* XXX we don't test uids, because on some boxes ecdt uid = 0, see: + http://bugzilla.kernel.org/show_bug.cgi?id=6111 */ + if (ec_ecdt) { + acpi_remove_address_space_handler(ACPI_ROOT_OBJECT, + ACPI_ADR_SPACE_EC, + &acpi_ec_space_handler); + + acpi_remove_gpe_handler(NULL, ec_ecdt->common.gpe_bit, + &acpi_ec_gpe_handler); + + kfree(ec_ecdt); } + + /* Get GPE bit assignment (EC events). */ + /* TODO: Add support for _GPE returning a package */ + status = + acpi_evaluate_integer(ec->common.handle, "_GPE", NULL, + &ec->common.gpe_bit); + if (ACPI_FAILURE(status)) { + ACPI_EXCEPTION((AE_INFO, status, "Obtaining GPE bit")); + result = -ENODEV; + goto end; + } + + result = acpi_ec_add_fs(device); + if (result) + goto end; + + printk(KERN_INFO PREFIX "%s [%s] (gpe %d) polling mode.\n", + acpi_device_name(device), acpi_device_bid(device), + (u32) ec->common.gpe_bit); + + if (!first_ec) + first_ec = device; + + end: + if (result) + kfree(ec); + + return result; +} +static int acpi_ec_intr_add(struct acpi_device *device) +{ + int result = 0; + acpi_status status = AE_OK; + union acpi_ec *ec = NULL; + + + if (!device) + return -EINVAL; + + ec = kmalloc(sizeof(union acpi_ec), GFP_KERNEL); + if (!ec) + return -ENOMEM; + memset(ec, 0, sizeof(union acpi_ec)); + + ec->common.handle = device->handle; + ec->common.uid = -1; + atomic_set(&ec->intr.pending_gpe, 0); + atomic_set(&ec->intr.leaving_burst, 1); + init_MUTEX(&ec->intr.sem); + init_waitqueue_head(&ec->intr.wait); strcpy(acpi_device_name(device), ACPI_EC_DEVICE_NAME); strcpy(acpi_device_class(device), ACPI_EC_CLASS); acpi_driver_data(device) = ec; /* Use the global lock for all EC transactions? */ - acpi_evaluate_integer(ec->handle, "_GLK", NULL, - &ec->global_lock); + acpi_evaluate_integer(ec->common.handle, "_GLK", NULL, + &ec->common.global_lock); /* XXX we don't test uids, because on some boxes ecdt uid = 0, see: http://bugzilla.kernel.org/show_bug.cgi?id=6111 */ @@ -679,7 +1081,7 @@ static int acpi_ec_add(struct acpi_device *device) ACPI_ADR_SPACE_EC, &acpi_ec_space_handler); - acpi_remove_gpe_handler(NULL, ec_ecdt->gpe_bit, + acpi_remove_gpe_handler(NULL, ec_ecdt->common.gpe_bit, &acpi_ec_gpe_handler); kfree(ec_ecdt); @@ -688,10 +1090,10 @@ static int acpi_ec_add(struct acpi_device *device) /* Get GPE bit assignment (EC events). */ /* TODO: Add support for _GPE returning a package */ status = - acpi_evaluate_integer(ec->handle, "_GPE", NULL, - &ec->gpe_bit); + acpi_evaluate_integer(ec->common.handle, "_GPE", NULL, + &ec->common.gpe_bit); if (ACPI_FAILURE(status)) { - ACPI_EXCEPTION((AE_INFO, status, "Obtaining GPE bit assignment")); + printk(KERN_ERR PREFIX "Obtaining GPE bit assignment\n"); result = -ENODEV; goto end; } @@ -700,14 +1102,14 @@ static int acpi_ec_add(struct acpi_device *device) if (result) goto end; - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "%s [%s] (gpe %d) interrupt mode.", + printk(KERN_INFO PREFIX "%s [%s] (gpe %d) interrupt mode.\n", acpi_device_name(device), acpi_device_bid(device), - (u32) ec->gpe_bit)); + (u32) ec->common.gpe_bit); if (!first_ec) first_ec = device; - end: + end: if (result) kfree(ec); @@ -716,7 +1118,7 @@ static int acpi_ec_add(struct acpi_device *device) static int acpi_ec_remove(struct acpi_device *device, int type) { - struct acpi_ec *ec = NULL; + union acpi_ec *ec = NULL; if (!device) @@ -734,7 +1136,8 @@ static int acpi_ec_remove(struct acpi_device *device, int type) static acpi_status acpi_ec_io_ports(struct acpi_resource *resource, void *context) { - struct acpi_ec *ec = (struct acpi_ec *)context; + union acpi_ec *ec = (union acpi_ec *)context; + struct acpi_generic_address *addr; if (resource->type != ACPI_RESOURCE_TYPE_IO) { return AE_OK; @@ -745,21 +1148,26 @@ acpi_ec_io_ports(struct acpi_resource *resource, void *context) * the second address region returned is the status/command * port. */ - if (ec->data_addr == 0) { - ec->data_addr = resource->data.io.minimum; - } else if (ec->command_addr == 0) { - ec->command_addr = resource->data.io.minimum; + if (ec->common.data_addr.register_bit_width == 0) { + addr = &ec->common.data_addr; + } else if (ec->common.command_addr.register_bit_width == 0) { + addr = &ec->common.command_addr; } else { return AE_CTRL_TERMINATE; } + addr->address_space_id = ACPI_ADR_SPACE_SYSTEM_IO; + addr->register_bit_width = 8; + addr->register_bit_offset = 0; + addr->address = resource->data.io.minimum; + return AE_OK; } static int acpi_ec_start(struct acpi_device *device) { acpi_status status = AE_OK; - struct acpi_ec *ec = NULL; + union acpi_ec *ec = NULL; if (!device) @@ -773,35 +1181,39 @@ static int acpi_ec_start(struct acpi_device *device) /* * Get I/O port addresses. Convert to GAS format. */ - status = acpi_walk_resources(ec->handle, METHOD_NAME__CRS, + status = acpi_walk_resources(ec->common.handle, METHOD_NAME__CRS, acpi_ec_io_ports, ec); - if (ACPI_FAILURE(status) || ec->command_addr == 0) { - ACPI_EXCEPTION((AE_INFO, status, - "Error getting I/O port addresses")); + if (ACPI_FAILURE(status) + || ec->common.command_addr.register_bit_width == 0) { + printk(KERN_ERR PREFIX "Error getting I/O port addresses\n"); return -ENODEV; } - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "gpe=0x%02lx, ports=0x%2lx,0x%2lx", - ec->gpe_bit, ec->command_addr, ec->data_addr)); + ec->common.status_addr = ec->common.command_addr; + + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "gpe=0x%02x, ports=0x%2x,0x%2x\n", + (u32) ec->common.gpe_bit, + (u32) ec->common.command_addr.address, + (u32) ec->common.data_addr.address)); /* * Install GPE handler */ - status = acpi_install_gpe_handler(NULL, ec->gpe_bit, + status = acpi_install_gpe_handler(NULL, ec->common.gpe_bit, ACPI_GPE_EDGE_TRIGGERED, &acpi_ec_gpe_handler, ec); if (ACPI_FAILURE(status)) { return -ENODEV; } - acpi_set_gpe_type(NULL, ec->gpe_bit, ACPI_GPE_TYPE_RUNTIME); - acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR); + acpi_set_gpe_type(NULL, ec->common.gpe_bit, ACPI_GPE_TYPE_RUNTIME); + acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); - status = acpi_install_address_space_handler(ec->handle, + status = acpi_install_address_space_handler(ec->common.handle, ACPI_ADR_SPACE_EC, &acpi_ec_space_handler, &acpi_ec_space_setup, ec); if (ACPI_FAILURE(status)) { - acpi_remove_gpe_handler(NULL, ec->gpe_bit, + acpi_remove_gpe_handler(NULL, ec->common.gpe_bit, &acpi_ec_gpe_handler); return -ENODEV; } @@ -812,7 +1224,7 @@ static int acpi_ec_start(struct acpi_device *device) static int acpi_ec_stop(struct acpi_device *device, int type) { acpi_status status = AE_OK; - struct acpi_ec *ec = NULL; + union acpi_ec *ec = NULL; if (!device) @@ -820,14 +1232,14 @@ static int acpi_ec_stop(struct acpi_device *device, int type) ec = acpi_driver_data(device); - status = acpi_remove_address_space_handler(ec->handle, + status = acpi_remove_address_space_handler(ec->common.handle, ACPI_ADR_SPACE_EC, &acpi_ec_space_handler); if (ACPI_FAILURE(status)) return -ENODEV; status = - acpi_remove_gpe_handler(NULL, ec->gpe_bit, + acpi_remove_gpe_handler(NULL, ec->common.gpe_bit, &acpi_ec_gpe_handler); if (ACPI_FAILURE(status)) return -ENODEV; @@ -839,30 +1251,76 @@ static acpi_status __init acpi_fake_ecdt_callback(acpi_handle handle, u32 Level, void *context, void **retval) { + + if (acpi_ec_poll_mode) + return acpi_fake_ecdt_poll_callback(handle, + Level, context, retval); + else + return acpi_fake_ecdt_intr_callback(handle, + Level, context, retval); +} + +static acpi_status __init +acpi_fake_ecdt_poll_callback(acpi_handle handle, + u32 Level, void *context, void **retval) +{ acpi_status status; - init_MUTEX(&ec_ecdt->sem); - if (acpi_ec_mode == EC_INTR) { - init_waitqueue_head(&ec_ecdt->wait); - } status = acpi_walk_resources(handle, METHOD_NAME__CRS, acpi_ec_io_ports, ec_ecdt); if (ACPI_FAILURE(status)) return status; + ec_ecdt->common.status_addr = ec_ecdt->common.command_addr; + + ec_ecdt->common.uid = -1; + acpi_evaluate_integer(handle, "_UID", NULL, &ec_ecdt->common.uid); + + status = + acpi_evaluate_integer(handle, "_GPE", NULL, + &ec_ecdt->common.gpe_bit); + if (ACPI_FAILURE(status)) + return status; + init_MUTEX(&ec_ecdt->poll.sem); + ec_ecdt->common.global_lock = TRUE; + ec_ecdt->common.handle = handle; + + printk(KERN_INFO PREFIX "GPE=0x%02x, ports=0x%2x, 0x%2x\n", + (u32) ec_ecdt->common.gpe_bit, + (u32) ec_ecdt->common.command_addr.address, + (u32) ec_ecdt->common.data_addr.address); + + return AE_CTRL_TERMINATE; +} + +static acpi_status __init +acpi_fake_ecdt_intr_callback(acpi_handle handle, + u32 Level, void *context, void **retval) +{ + acpi_status status; + + init_MUTEX(&ec_ecdt->intr.sem); + init_waitqueue_head(&ec_ecdt->intr.wait); + status = acpi_walk_resources(handle, METHOD_NAME__CRS, + acpi_ec_io_ports, ec_ecdt); + if (ACPI_FAILURE(status)) + return status; + ec_ecdt->common.status_addr = ec_ecdt->common.command_addr; - ec_ecdt->uid = -1; - acpi_evaluate_integer(handle, "_UID", NULL, &ec_ecdt->uid); + ec_ecdt->common.uid = -1; + acpi_evaluate_integer(handle, "_UID", NULL, &ec_ecdt->common.uid); status = acpi_evaluate_integer(handle, "_GPE", NULL, - &ec_ecdt->gpe_bit); + &ec_ecdt->common.gpe_bit); if (ACPI_FAILURE(status)) return status; - ec_ecdt->global_lock = TRUE; - ec_ecdt->handle = handle; + ec_ecdt->common.global_lock = TRUE; + ec_ecdt->common.handle = handle; - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "GPE=0x%02lx, ports=0x%2lx, 0x%2lx", - ec_ecdt->gpe_bit, ec_ecdt->command_addr, ec_ecdt->data_addr)); + printk(KERN_INFO PREFIX "GPE=0x%02x, ports=0x%2x, 0x%2x\n", + (u32) ec_ecdt->common.gpe_bit, + (u32) ec_ecdt->common.command_addr.address, + (u32) ec_ecdt->common.data_addr.address); return AE_CTRL_TERMINATE; } @@ -882,14 +1340,14 @@ static int __init acpi_ec_fake_ecdt(void) acpi_status status; int ret = 0; - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Try to make an fake ECDT")); + printk(KERN_INFO PREFIX "Try to make an fake ECDT\n"); - ec_ecdt = kmalloc(sizeof(struct acpi_ec), GFP_KERNEL); + ec_ecdt = kmalloc(sizeof(union acpi_ec), GFP_KERNEL); if (!ec_ecdt) { ret = -ENOMEM; goto error; } - memset(ec_ecdt, 0, sizeof(struct acpi_ec)); + memset(ec_ecdt, 0, sizeof(union acpi_ec)); status = acpi_get_devices(ACPI_EC_HID, acpi_fake_ecdt_callback, NULL, NULL); @@ -897,15 +1355,23 @@ static int __init acpi_ec_fake_ecdt(void) kfree(ec_ecdt); ec_ecdt = NULL; ret = -ENODEV; - ACPI_EXCEPTION((AE_INFO, status, "Can't make an fake ECDT")); goto error; } return 0; - error: + error: + printk(KERN_ERR PREFIX "Can't make an fake ECDT\n"); return ret; } static int __init acpi_ec_get_real_ecdt(void) +{ + if (acpi_ec_poll_mode) + return acpi_ec_poll_get_real_ecdt(); + else + return acpi_ec_intr_get_real_ecdt(); +} + +static int __init acpi_ec_poll_get_real_ecdt(void) { acpi_status status; struct acpi_table_ecdt *ecdt_ptr; @@ -916,36 +1382,80 @@ static int __init acpi_ec_get_real_ecdt(void) if (ACPI_FAILURE(status)) return -ENODEV; - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found ECDT")); + printk(KERN_INFO PREFIX "Found ECDT\n"); /* * Generate a temporary ec context to use until the namespace is scanned */ - ec_ecdt = kmalloc(sizeof(struct acpi_ec), GFP_KERNEL); + ec_ecdt = kmalloc(sizeof(union acpi_ec), GFP_KERNEL); if (!ec_ecdt) return -ENOMEM; - memset(ec_ecdt, 0, sizeof(struct acpi_ec)); + memset(ec_ecdt, 0, sizeof(union acpi_ec)); + + ec_ecdt->common.command_addr = ecdt_ptr->ec_control; + ec_ecdt->common.status_addr = ecdt_ptr->ec_control; + ec_ecdt->common.data_addr = ecdt_ptr->ec_data; + ec_ecdt->common.gpe_bit = ecdt_ptr->gpe_bit; + init_MUTEX(&ec_ecdt->poll.sem); + /* use the GL just to be safe */ + ec_ecdt->common.global_lock = TRUE; + ec_ecdt->common.uid = ecdt_ptr->uid; - init_MUTEX(&ec_ecdt->sem); - if (acpi_ec_mode == EC_INTR) { - init_waitqueue_head(&ec_ecdt->wait); + status = + acpi_get_handle(NULL, ecdt_ptr->ec_id, &ec_ecdt->common.handle); + if (ACPI_FAILURE(status)) { + goto error; } - ec_ecdt->command_addr = ecdt_ptr->ec_control.address; - ec_ecdt->data_addr = ecdt_ptr->ec_data.address; - ec_ecdt->gpe_bit = ecdt_ptr->gpe_bit; + + return 0; + error: + printk(KERN_ERR PREFIX "Could not use ECDT\n"); + kfree(ec_ecdt); + ec_ecdt = NULL; + + return -ENODEV; +} + +static int __init acpi_ec_intr_get_real_ecdt(void) +{ + acpi_status status; + struct acpi_table_ecdt *ecdt_ptr; + + status = acpi_get_firmware_table("ECDT", 1, ACPI_LOGICAL_ADDRESSING, + (struct acpi_table_header **) + &ecdt_ptr); + if (ACPI_FAILURE(status)) + return -ENODEV; + + printk(KERN_INFO PREFIX "Found ECDT\n"); + + /* + * Generate a temporary ec context to use until the namespace is scanned + */ + ec_ecdt = kmalloc(sizeof(union acpi_ec), GFP_KERNEL); + if (!ec_ecdt) + return -ENOMEM; + memset(ec_ecdt, 0, sizeof(union acpi_ec)); + + init_MUTEX(&ec_ecdt->intr.sem); + init_waitqueue_head(&ec_ecdt->intr.wait); + ec_ecdt->common.command_addr = ecdt_ptr->ec_control; + ec_ecdt->common.status_addr = ecdt_ptr->ec_control; + ec_ecdt->common.data_addr = ecdt_ptr->ec_data; + ec_ecdt->common.gpe_bit = ecdt_ptr->gpe_bit; /* use the GL just to be safe */ - ec_ecdt->global_lock = TRUE; - ec_ecdt->uid = ecdt_ptr->uid; + ec_ecdt->common.global_lock = TRUE; + ec_ecdt->common.uid = ecdt_ptr->uid; status = - acpi_get_handle(NULL, ecdt_ptr->ec_id, &ec_ecdt->handle); + acpi_get_handle(NULL, ecdt_ptr->ec_id, &ec_ecdt->common.handle); if (ACPI_FAILURE(status)) { goto error; } return 0; - error: - ACPI_EXCEPTION((AE_INFO, status, "Could not use ECDT")); + error: + printk(KERN_ERR PREFIX "Could not use ECDT\n"); kfree(ec_ecdt); ec_ecdt = NULL; @@ -970,14 +1480,14 @@ int __init acpi_ec_ecdt_probe(void) /* * Install GPE handler */ - status = acpi_install_gpe_handler(NULL, ec_ecdt->gpe_bit, + status = acpi_install_gpe_handler(NULL, ec_ecdt->common.gpe_bit, ACPI_GPE_EDGE_TRIGGERED, &acpi_ec_gpe_handler, ec_ecdt); if (ACPI_FAILURE(status)) { goto error; } - acpi_set_gpe_type(NULL, ec_ecdt->gpe_bit, ACPI_GPE_TYPE_RUNTIME); - acpi_enable_gpe(NULL, ec_ecdt->gpe_bit, ACPI_NOT_ISR); + acpi_set_gpe_type(NULL, ec_ecdt->common.gpe_bit, ACPI_GPE_TYPE_RUNTIME); + acpi_enable_gpe(NULL, ec_ecdt->common.gpe_bit, ACPI_NOT_ISR); status = acpi_install_address_space_handler(ACPI_ROOT_OBJECT, ACPI_ADR_SPACE_EC, @@ -985,7 +1495,7 @@ int __init acpi_ec_ecdt_probe(void) &acpi_ec_space_setup, ec_ecdt); if (ACPI_FAILURE(status)) { - acpi_remove_gpe_handler(NULL, ec_ecdt->gpe_bit, + acpi_remove_gpe_handler(NULL, ec_ecdt->common.gpe_bit, &acpi_ec_gpe_handler); goto error; } @@ -993,7 +1503,7 @@ int __init acpi_ec_ecdt_probe(void) return 0; error: - ACPI_EXCEPTION((AE_INFO, status, "Could not use ECDT")); + printk(KERN_ERR PREFIX "Could not use ECDT\n"); kfree(ec_ecdt); ec_ecdt = NULL; @@ -1052,13 +1562,13 @@ static int __init acpi_ec_set_intr_mode(char *str) return 0; if (intr) { - acpi_ec_mode = EC_INTR; + acpi_ec_poll_mode = EC_INTR; + acpi_ec_driver.ops.add = acpi_ec_intr_add; } else { - acpi_ec_mode = EC_POLL; + acpi_ec_poll_mode = EC_POLL; + acpi_ec_driver.ops.add = acpi_ec_poll_add; } - acpi_ec_driver.ops.add = acpi_ec_add; - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "EC %s mode.\n", intr ? "interrupt" : "polling")); - + printk(KERN_INFO PREFIX "EC %s mode.\n", intr ? "interrupt" : "polling"); return 1; } diff --git a/trunk/drivers/acpi/events/evmisc.c b/trunk/drivers/acpi/events/evmisc.c index ee2a10bf9077..6eef4efddcf6 100644 --- a/trunk/drivers/acpi/events/evmisc.c +++ b/trunk/drivers/acpi/events/evmisc.c @@ -342,8 +342,20 @@ static u32 acpi_ev_global_lock_handler(void *context) if (acquired) { /* Got the lock, now wake all threads waiting for it */ + acpi_gbl_global_lock_acquired = TRUE; - acpi_ev_global_lock_thread(context); + + /* Run the Global Lock thread which will signal all waiting threads */ + + status = + acpi_os_execute(OSL_GLOBAL_LOCK_HANDLER, + acpi_ev_global_lock_thread, context); + if (ACPI_FAILURE(status)) { + ACPI_EXCEPTION((AE_INFO, status, + "Could not queue Global Lock thread")); + + return (ACPI_INTERRUPT_NOT_HANDLED); + } } return (ACPI_INTERRUPT_HANDLED); diff --git a/trunk/drivers/acpi/events/evrgnini.c b/trunk/drivers/acpi/events/evrgnini.c index 203d1359190a..5b3c7a85eb9a 100644 --- a/trunk/drivers/acpi/events/evrgnini.c +++ b/trunk/drivers/acpi/events/evrgnini.c @@ -225,12 +225,13 @@ acpi_ev_pci_config_region_setup(acpi_handle handle, if (! (ACPI_STRNCMP (object_hID.value, PCI_ROOT_HID_STRING, - sizeof(PCI_ROOT_HID_STRING))) - || - !(ACPI_STRNCMP - (object_hID.value, - PCI_EXPRESS_ROOT_HID_STRING, - sizeof(PCI_EXPRESS_ROOT_HID_STRING)))) { + sizeof(PCI_ROOT_HID_STRING)) + || + !(ACPI_STRNCMP + (object_hID.value, + PCI_EXPRESS_ROOT_HID_STRING, + sizeof(PCI_EXPRESS_ROOT_HID_STRING))))) + { /* Install a handler for this PCI root bridge */ diff --git a/trunk/drivers/acpi/ibm_acpi.c b/trunk/drivers/acpi/ibm_acpi.c index 003a9876c968..15fc12482ba0 100644 --- a/trunk/drivers/acpi/ibm_acpi.c +++ b/trunk/drivers/acpi/ibm_acpi.c @@ -1702,11 +1702,13 @@ static struct ibm_struct ibms[] = { .name = "brightness", .read = brightness_read, .write = brightness_write, + .experimental = 1, }, { .name = "volume", .read = volume_read, .write = volume_write, + .experimental = 1, }, { .name = "fan", diff --git a/trunk/drivers/acpi/motherboard.c b/trunk/drivers/acpi/motherboard.c index 2e17ec75af03..ec6b7f9ede34 100644 --- a/trunk/drivers/acpi/motherboard.c +++ b/trunk/drivers/acpi/motherboard.c @@ -48,12 +48,6 @@ ACPI_MODULE_NAME("acpi_motherboard") * the io ports if they really know they can use it, while * still preventing hotplug PCI devices from using it. */ - -/* - * When CONFIG_PNP is enabled, pnp/system.c binds to PNP0C01 - * and PNP0C02, redundant with acpi_reserve_io_ranges(). - * But acpi_reserve_io_ranges() is necessary for !CONFIG_PNP. - */ static acpi_status acpi_reserve_io_ranges(struct acpi_resource *res, void *data) { struct resource *requested_res = NULL; diff --git a/trunk/drivers/acpi/osl.c b/trunk/drivers/acpi/osl.c index c84286cbbe25..068fe4f100b0 100644 --- a/trunk/drivers/acpi/osl.c +++ b/trunk/drivers/acpi/osl.c @@ -73,7 +73,6 @@ static unsigned int acpi_irq_irq; static acpi_osd_handler acpi_irq_handler; static void *acpi_irq_context; static struct workqueue_struct *kacpid_wq; -static struct workqueue_struct *kacpi_notify_wq; acpi_status acpi_os_initialize(void) { @@ -92,9 +91,8 @@ acpi_status acpi_os_initialize1(void) return AE_NULL_ENTRY; } kacpid_wq = create_singlethread_workqueue("kacpid"); - kacpi_notify_wq = create_singlethread_workqueue("kacpi_notify"); BUG_ON(!kacpid_wq); - BUG_ON(!kacpi_notify_wq); + return AE_OK; } @@ -106,7 +104,6 @@ acpi_status acpi_os_terminate(void) } destroy_workqueue(kacpid_wq); - destroy_workqueue(kacpi_notify_wq); return AE_OK; } @@ -569,7 +566,10 @@ void acpi_os_derive_pci_id(acpi_handle rhandle, /* upper bound */ static void acpi_os_execute_deferred(void *context) { - struct acpi_os_dpc *dpc = (struct acpi_os_dpc *)context; + struct acpi_os_dpc *dpc = NULL; + + + dpc = (struct acpi_os_dpc *)context; if (!dpc) { printk(KERN_ERR PREFIX "Invalid (NULL) context\n"); return; @@ -604,12 +604,14 @@ acpi_status acpi_os_execute(acpi_execute_type type, struct acpi_os_dpc *dpc; struct work_struct *task; + ACPI_FUNCTION_TRACE("os_queue_for_execution"); + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Scheduling function [%p(%p)] for deferred execution.\n", function, context)); if (!function) - return AE_BAD_PARAMETER; + return_ACPI_STATUS(AE_BAD_PARAMETER); /* * Allocate/initialize DPC structure. Note that this memory will be @@ -622,20 +624,26 @@ acpi_status acpi_os_execute(acpi_execute_type type, * from the same memory. */ - dpc = kmalloc(sizeof(struct acpi_os_dpc) + - sizeof(struct work_struct), GFP_ATOMIC); + dpc = + kmalloc(sizeof(struct acpi_os_dpc) + sizeof(struct work_struct), + GFP_ATOMIC); if (!dpc) - return AE_NO_MEMORY; + return_ACPI_STATUS(AE_NO_MEMORY); + dpc->function = function; dpc->context = context; + task = (void *)(dpc + 1); INIT_WORK(task, acpi_os_execute_deferred, (void *)dpc); - if (!queue_work((type == OSL_NOTIFY_HANDLER)? - kacpi_notify_wq : kacpid_wq, task)) { - status = AE_ERROR; + + if (!queue_work(kacpid_wq, task)) { + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Call to queue_work() failed.\n")); kfree(dpc); + status = AE_ERROR; } - return status; + + return_ACPI_STATUS(status); } EXPORT_SYMBOL(acpi_os_execute); diff --git a/trunk/drivers/acpi/pci_link.c b/trunk/drivers/acpi/pci_link.c index d53bd9878ca2..7f3e7e77e794 100644 --- a/trunk/drivers/acpi/pci_link.c +++ b/trunk/drivers/acpi/pci_link.c @@ -307,7 +307,7 @@ static int acpi_pci_link_set(struct acpi_pci_link *link, int irq) if (!link || !irq) return -EINVAL; - resource = kmalloc(sizeof(*resource) + 1, irqs_disabled() ? GFP_ATOMIC: GFP_KERNEL); + resource = kmalloc(sizeof(*resource) + 1, GFP_ATOMIC); if (!resource) return -ENOMEM; diff --git a/trunk/drivers/acpi/power.c b/trunk/drivers/acpi/power.c index fe67a8af520e..fec225d1b6b7 100644 --- a/trunk/drivers/acpi/power.c +++ b/trunk/drivers/acpi/power.c @@ -216,8 +216,10 @@ static int acpi_power_off_device(acpi_handle handle) { int result = 0; acpi_status status = AE_OK; + struct acpi_device *device = NULL; struct acpi_power_resource *resource = NULL; + result = acpi_power_get_context(handle, &resource); if (result) return result; @@ -228,13 +230,13 @@ static int acpi_power_off_device(acpi_handle handle) if (resource->references) { ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] is still in use, dereferencing\n", - resource->device->pnp.bus_id)); + device->pnp.bus_id)); return 0; } if (resource->state == ACPI_POWER_RESOURCE_STATE_OFF) { ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] already off\n", - resource->device->pnp.bus_id)); + device->pnp.bus_id)); return 0; } @@ -249,7 +251,8 @@ static int acpi_power_off_device(acpi_handle handle) return -ENOEXEC; /* Update the power resource's _device_ power state */ - resource->device->power.state = ACPI_STATE_D3; + device = resource->device; + device->power.state = ACPI_STATE_D3; ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] turned off\n", resource->name)); diff --git a/trunk/drivers/acpi/processor_core.c b/trunk/drivers/acpi/processor_core.c index 1908e0d20222..b13d64415b7a 100644 --- a/trunk/drivers/acpi/processor_core.c +++ b/trunk/drivers/acpi/processor_core.c @@ -519,7 +519,7 @@ static int acpi_processor_get_info(struct acpi_processor *pr) static void *processor_device_array[NR_CPUS]; -static int __cpuinit acpi_processor_start(struct acpi_device *device) +static int acpi_processor_start(struct acpi_device *device) { int result = 0; acpi_status status = AE_OK; diff --git a/trunk/drivers/acpi/processor_idle.c b/trunk/drivers/acpi/processor_idle.c index e67144cf3c8b..0a395fca843b 100644 --- a/trunk/drivers/acpi/processor_idle.c +++ b/trunk/drivers/acpi/processor_idle.c @@ -219,23 +219,6 @@ static void acpi_safe_halt(void) static atomic_t c3_cpu_count; -/* Common C-state entry for C2, C3, .. */ -static void acpi_cstate_enter(struct acpi_processor_cx *cstate) -{ - if (cstate->space_id == ACPI_CSTATE_FFH) { - /* Call into architectural FFH based C-state */ - acpi_processor_ffh_cstate_enter(cstate); - } else { - int unused; - /* IO port based C-state */ - inb(cstate->address); - /* Dummy wait op - must do something useless after P_LVL2 read - because chipsets cannot guarantee that STPCLK# signal - gets asserted in time to freeze execution properly. */ - unused = inl(acpi_fadt.xpm_tmr_blk.address); - } -} - static void acpi_processor_idle(void) { struct acpi_processor *pr = NULL; @@ -378,7 +361,11 @@ static void acpi_processor_idle(void) /* Get start time (ticks) */ t1 = inl(acpi_fadt.xpm_tmr_blk.address); /* Invoke C2 */ - acpi_cstate_enter(cx); + inb(cx->address); + /* Dummy wait op - must do something useless after P_LVL2 read + because chipsets cannot guarantee that STPCLK# signal + gets asserted in time to freeze execution properly. */ + t2 = inl(acpi_fadt.xpm_tmr_blk.address); /* Get end time (ticks) */ t2 = inl(acpi_fadt.xpm_tmr_blk.address); @@ -414,7 +401,9 @@ static void acpi_processor_idle(void) /* Get start time (ticks) */ t1 = inl(acpi_fadt.xpm_tmr_blk.address); /* Invoke C3 */ - acpi_cstate_enter(cx); + inb(cx->address); + /* Dummy wait op (see above) */ + t2 = inl(acpi_fadt.xpm_tmr_blk.address); /* Get end time (ticks) */ t2 = inl(acpi_fadt.xpm_tmr_blk.address); if (pr->flags.bm_check) { @@ -639,16 +628,20 @@ static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr) return 0; } -static int acpi_processor_get_power_info_default(struct acpi_processor *pr) +static int acpi_processor_get_power_info_default_c1(struct acpi_processor *pr) { - if (!pr->power.states[ACPI_STATE_C1].valid) { - /* set the first C-State to C1 */ - /* all processors need to support C1 */ - pr->power.states[ACPI_STATE_C1].type = ACPI_STATE_C1; - pr->power.states[ACPI_STATE_C1].valid = 1; - } - /* the C0 state only exists as a filler in our array */ + + /* Zero initialize all the C-states info. */ + memset(pr->power.states, 0, sizeof(pr->power.states)); + + /* set the first C-State to C1 */ + pr->power.states[ACPI_STATE_C1].type = ACPI_STATE_C1; + + /* the C0 state only exists as a filler in our array, + * and all processors need to support C1 */ pr->power.states[ACPI_STATE_C0].valid = 1; + pr->power.states[ACPI_STATE_C1].valid = 1; + return 0; } @@ -665,7 +658,12 @@ static int acpi_processor_get_power_info_cst(struct acpi_processor *pr) if (nocst) return -ENODEV; - current_count = 0; + current_count = 1; + + /* Zero initialize C2 onwards and prepare for fresh CST lookup */ + for (i = 2; i < ACPI_PROCESSOR_MAX_POWER; i++) + memset(&(pr->power.states[i]), 0, + sizeof(struct acpi_processor_cx)); status = acpi_evaluate_object(pr->handle, "_CST", NULL, &buffer); if (ACPI_FAILURE(status)) { @@ -720,39 +718,22 @@ static int acpi_processor_get_power_info_cst(struct acpi_processor *pr) (reg->space_id != ACPI_ADR_SPACE_FIXED_HARDWARE)) continue; + cx.address = (reg->space_id == ACPI_ADR_SPACE_FIXED_HARDWARE) ? + 0 : reg->address; + /* There should be an easy way to extract an integer... */ obj = (union acpi_object *)&(element->package.elements[1]); if (obj->type != ACPI_TYPE_INTEGER) continue; cx.type = obj->integer.value; - /* - * Some buggy BIOSes won't list C1 in _CST - - * Let acpi_processor_get_power_info_default() handle them later - */ - if (i == 1 && cx.type != ACPI_STATE_C1) - current_count++; - - cx.address = reg->address; - cx.index = current_count + 1; - - cx.space_id = ACPI_CSTATE_SYSTEMIO; - if (reg->space_id == ACPI_ADR_SPACE_FIXED_HARDWARE) { - if (acpi_processor_ffh_cstate_probe - (pr->id, &cx, reg) == 0) { - cx.space_id = ACPI_CSTATE_FFH; - } else if (cx.type != ACPI_STATE_C1) { - /* - * C1 is a special case where FIXED_HARDWARE - * can be handled in non-MWAIT way as well. - * In that case, save this _CST entry info. - * That is, we retain space_id of SYSTEM_IO for - * halt based C1. - * Otherwise, ignore this info and continue. - */ - continue; - } - } + + if ((cx.type != ACPI_STATE_C1) && + (reg->space_id != ACPI_ADR_SPACE_SYSTEM_IO)) + continue; + + if ((cx.type < ACPI_STATE_C2) || (cx.type > ACPI_STATE_C3)) + continue; obj = (union acpi_object *)&(element->package.elements[2]); if (obj->type != ACPI_TYPE_INTEGER) @@ -957,18 +938,12 @@ static int acpi_processor_get_power_info(struct acpi_processor *pr) /* NOTE: the idle thread may not be running while calling * this function */ - /* Zero initialize all the C-states info. */ - memset(pr->power.states, 0, sizeof(pr->power.states)); - + /* Adding C1 state */ + acpi_processor_get_power_info_default_c1(pr); result = acpi_processor_get_power_info_cst(pr); if (result == -ENODEV) acpi_processor_get_power_info_fadt(pr); - if (result) - return result; - - acpi_processor_get_power_info_default(pr); - pr->power.count = acpi_processor_power_verify(pr); /* @@ -1108,7 +1083,6 @@ static const struct file_operations acpi_processor_power_fops = { .release = single_release, }; -#ifdef CONFIG_SMP static void smp_callback(void *v) { /* we already woke the CPU up, nothing more to do */ @@ -1130,9 +1104,8 @@ static int acpi_processor_latency_notify(struct notifier_block *b, static struct notifier_block acpi_processor_latency_notifier = { .notifier_call = acpi_processor_latency_notify, }; -#endif -int __cpuinit acpi_processor_power_init(struct acpi_processor *pr, +int acpi_processor_power_init(struct acpi_processor *pr, struct acpi_device *device) { acpi_status status = 0; @@ -1148,9 +1121,7 @@ int __cpuinit acpi_processor_power_init(struct acpi_processor *pr, "ACPI: processor limited to max C-state %d\n", max_cstate); first_run++; -#ifdef CONFIG_SMP register_latency_notifier(&acpi_processor_latency_notifier); -#endif } if (!pr) @@ -1222,9 +1193,7 @@ int acpi_processor_power_exit(struct acpi_processor *pr, * copies of pm_idle before proceeding. */ cpu_idle_wait(); -#ifdef CONFIG_SMP unregister_latency_notifier(&acpi_processor_latency_notifier); -#endif } return 0; diff --git a/trunk/drivers/acpi/sbs.c b/trunk/drivers/acpi/sbs.c index 8908a975e575..62bef0b3b614 100644 --- a/trunk/drivers/acpi/sbs.c +++ b/trunk/drivers/acpi/sbs.c @@ -98,11 +98,11 @@ static int update_info_mode = UPDATE_INFO_MODE; static int update_time = UPDATE_TIME; static int update_time2 = UPDATE_TIME2; -module_param(capacity_mode, int, 0); -module_param(update_mode, int, 0); -module_param(update_info_mode, int, 0); -module_param(update_time, int, 0); -module_param(update_time2, int, 0); +module_param(capacity_mode, int, CAPACITY_UNIT); +module_param(update_mode, int, UPDATE_MODE); +module_param(update_info_mode, int, UPDATE_INFO_MODE); +module_param(update_time, int, UPDATE_TIME); +module_param(update_time2, int, UPDATE_TIME2); static int acpi_sbs_add(struct acpi_device *device); static int acpi_sbs_remove(struct acpi_device *device, int type); @@ -1685,16 +1685,10 @@ static int acpi_sbs_add(struct acpi_device *device) int acpi_sbs_remove(struct acpi_device *device, int type) { - struct acpi_sbs *sbs = NULL; + struct acpi_sbs *sbs = (struct acpi_sbs *)acpi_driver_data(device); int id; - if (!device) { - return -EINVAL; - } - - sbs = (struct acpi_sbs *)acpi_driver_data(device); - - if (!sbs) { + if (!device || !sbs) { return -EINVAL; } diff --git a/trunk/drivers/acpi/tables/tbget.c b/trunk/drivers/acpi/tables/tbget.c index 11e2d4454e05..7856db759af0 100644 --- a/trunk/drivers/acpi/tables/tbget.c +++ b/trunk/drivers/acpi/tables/tbget.c @@ -324,7 +324,7 @@ acpi_tb_get_this_table(struct acpi_pointer *address, if (header->length < sizeof(struct acpi_table_header)) { ACPI_ERROR((AE_INFO, - "Table length (%X) is smaller than minimum (%zX)", + "Table length (%X) is smaller than minimum (%X)", header->length, sizeof(struct acpi_table_header))); return_ACPI_STATUS(AE_INVALID_TABLE_LENGTH); diff --git a/trunk/drivers/acpi/tables/tbrsdt.c b/trunk/drivers/acpi/tables/tbrsdt.c index 86a5fca9b739..0ad3dbb9ebca 100644 --- a/trunk/drivers/acpi/tables/tbrsdt.c +++ b/trunk/drivers/acpi/tables/tbrsdt.c @@ -187,7 +187,7 @@ acpi_status acpi_tb_validate_rsdt(struct acpi_table_header *table_ptr) if (table_ptr->length < sizeof(struct acpi_table_header)) { ACPI_ERROR((AE_INFO, - "RSDT/XSDT length (%X) is smaller than minimum (%zX)", + "RSDT/XSDT length (%X) is smaller than minimum (%X)", table_ptr->length, sizeof(struct acpi_table_header))); diff --git a/trunk/drivers/block/rd.c b/trunk/drivers/block/rd.c index 485aa87e9bcd..a3f64bfe6b58 100644 --- a/trunk/drivers/block/rd.c +++ b/trunk/drivers/block/rd.c @@ -432,12 +432,6 @@ static int __init rd_init(void) rd_disks[i] = alloc_disk(1); if (!rd_disks[i]) goto out; - - rd_queue[i] = blk_alloc_queue(GFP_KERNEL); - if (!rd_queue[i]) { - put_disk(rd_disks[i]); - goto out; - } } if (register_blkdev(RAMDISK_MAJOR, "ramdisk")) { @@ -448,6 +442,10 @@ static int __init rd_init(void) for (i = 0; i < CONFIG_BLK_DEV_RAM_COUNT; i++) { struct gendisk *disk = rd_disks[i]; + rd_queue[i] = blk_alloc_queue(GFP_KERNEL); + if (!rd_queue[i]) + goto out_queue; + blk_queue_make_request(rd_queue[i], &rd_make_request); blk_queue_hardsect_size(rd_queue[i], rd_blocksize); @@ -468,6 +466,8 @@ static int __init rd_init(void) CONFIG_BLK_DEV_RAM_COUNT, rd_size, rd_blocksize); return 0; +out_queue: + unregister_blkdev(RAMDISK_MAJOR, "ramdisk"); out: while (i--) { put_disk(rd_disks[i]); diff --git a/trunk/drivers/bluetooth/bcm203x.c b/trunk/drivers/bluetooth/bcm203x.c index 516751754aa9..67cdda43f229 100644 --- a/trunk/drivers/bluetooth/bcm203x.c +++ b/trunk/drivers/bluetooth/bcm203x.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #include @@ -42,7 +43,7 @@ #define BT_DBG(D...) #endif -#define VERSION "1.1" +#define VERSION "1.0" static int ignore = 0; @@ -71,7 +72,7 @@ struct bcm203x_data { unsigned long state; - struct work_struct work; + struct timer_list timer; struct urb *urb; unsigned char *buffer; @@ -104,7 +105,7 @@ static void bcm203x_complete(struct urb *urb) data->state = BCM203X_SELECT_MEMORY; - schedule_work(&data->work); + mod_timer(&data->timer, jiffies + (HZ / 10)); break; case BCM203X_SELECT_MEMORY: @@ -157,9 +158,9 @@ static void bcm203x_complete(struct urb *urb) } } -static void bcm203x_work(void *user_data) +static void bcm203x_timer(unsigned long user_data) { - struct bcm203x_data *data = user_data; + struct bcm203x_data *data = (struct bcm203x_data *) user_data; if (usb_submit_urb(data->urb, GFP_ATOMIC) < 0) BT_ERR("Can't submit URB"); @@ -246,11 +247,13 @@ static int bcm203x_probe(struct usb_interface *intf, const struct usb_device_id release_firmware(firmware); - INIT_WORK(&data->work, bcm203x_work, (void *) data); + init_timer(&data->timer); + data->timer.function = bcm203x_timer; + data->timer.data = (unsigned long) data; usb_set_intfdata(intf, data); - schedule_work(&data->work); + mod_timer(&data->timer, jiffies + HZ); return 0; } diff --git a/trunk/drivers/char/Kconfig b/trunk/drivers/char/Kconfig index 39a9f8cc6412..0e6f35fcc2eb 100644 --- a/trunk/drivers/char/Kconfig +++ b/trunk/drivers/char/Kconfig @@ -1046,7 +1046,7 @@ source "drivers/char/tpm/Kconfig" config TELCLOCK tristate "Telecom clock driver for MPBL0010 ATCA SBC" - depends on EXPERIMENTAL && X86 + depends on EXPERIMENTAL default n help The telecom clock device is specific to the MPBL0010 ATCA computer and diff --git a/trunk/drivers/char/epca.c b/trunk/drivers/char/epca.c index 706733c0b36a..c3f95583a120 100644 --- a/trunk/drivers/char/epca.c +++ b/trunk/drivers/char/epca.c @@ -1157,7 +1157,6 @@ static int __init pc_init(void) int crd; struct board_info *bd; unsigned char board_id = 0; - int err = -ENOMEM; int pci_boards_found, pci_count; @@ -1165,11 +1164,13 @@ static int __init pc_init(void) pc_driver = alloc_tty_driver(MAX_ALLOC); if (!pc_driver) - goto out1; + return -ENOMEM; pc_info = alloc_tty_driver(MAX_ALLOC); - if (!pc_info) - goto out2; + if (!pc_info) { + put_tty_driver(pc_driver); + return -ENOMEM; + } /* ----------------------------------------------------------------------- If epca_setup has not been ran by LILO set num_cards to defaults; copy @@ -1369,17 +1370,11 @@ static int __init pc_init(void) } /* End for each card */ - err = tty_register_driver(pc_driver); - if (err) { - printk(KERN_ERR "Couldn't register Digi PC/ driver"); - goto out3; - } + if (tty_register_driver(pc_driver)) + panic("Couldn't register Digi PC/ driver"); - err = tty_register_driver(pc_info); - if (err) { - printk(KERN_ERR "Couldn't register Digi PC/ info "); - goto out4; - } + if (tty_register_driver(pc_info)) + panic("Couldn't register Digi PC/ info "); /* ------------------------------------------------------------------- Start up the poller to check for events on all enabled boards @@ -1390,15 +1385,6 @@ static int __init pc_init(void) mod_timer(&epca_timer, jiffies + HZ/25); return 0; -out4: - tty_unregister_driver(pc_driver); -out3: - put_tty_driver(pc_info); -out2: - put_tty_driver(pc_driver); -out1: - return err; - } /* End pc_init */ /* ------------------ Begin post_fep_init ---------------------- */ diff --git a/trunk/drivers/char/random.c b/trunk/drivers/char/random.c index eb6b13f4211a..07f47a0208a7 100644 --- a/trunk/drivers/char/random.c +++ b/trunk/drivers/char/random.c @@ -645,7 +645,6 @@ void add_input_randomness(unsigned int type, unsigned int code, add_timer_randomness(&input_timer_state, (type << 4) ^ code ^ (code >> 4) ^ value); } -EXPORT_SYMBOL_GPL(add_input_randomness); void add_interrupt_randomness(int irq) { diff --git a/trunk/drivers/char/rio/rioctrl.c b/trunk/drivers/char/rio/rioctrl.c index 7ce77619707c..052e8120a471 100644 --- a/trunk/drivers/char/rio/rioctrl.c +++ b/trunk/drivers/char/rio/rioctrl.c @@ -662,7 +662,7 @@ int riocontrol(struct rio_info *p, dev_t dev, int cmd, unsigned long arg, int su p->RIOError.Error = COPYIN_FAILED; return -EFAULT; } - if (portStats.port < 0 || portStats.port >= RIO_PORTS) { + if (portStats.port >= RIO_PORTS) { p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; return -ENXIO; } @@ -702,7 +702,7 @@ int riocontrol(struct rio_info *p, dev_t dev, int cmd, unsigned long arg, int su p->RIOError.Error = COPYIN_FAILED; return -EFAULT; } - if (portStats.port < 0 || portStats.port >= RIO_PORTS) { + if (portStats.port >= RIO_PORTS) { p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; return -ENXIO; } diff --git a/trunk/drivers/char/serial167.c b/trunk/drivers/char/serial167.c index 3af7f0958c5d..461bfe0234c9 100644 --- a/trunk/drivers/char/serial167.c +++ b/trunk/drivers/char/serial167.c @@ -839,7 +839,7 @@ shutdown(struct cyclades_port * info) local_irq_save(flags); if (info->xmit_buf){ free_page((unsigned long) info->xmit_buf); - info->xmit_buf = NULL; + info->xmit_buf = 0; } base_addr[CyCAR] = (u_char)channel; @@ -1354,7 +1354,7 @@ cy_unthrottle(struct tty_struct * tty) static int get_serial_info(struct cyclades_port * info, - struct serial_struct __user * retinfo) + struct serial_struct * retinfo) { struct serial_struct tmp; @@ -1376,7 +1376,7 @@ get_serial_info(struct cyclades_port * info, static int set_serial_info(struct cyclades_port * info, - struct serial_struct __user * new_info) + struct serial_struct * new_info) { struct serial_struct new_serial; struct cyclades_port old_info; @@ -1503,7 +1503,7 @@ send_break( struct cyclades_port * info, int duration) } /* send_break */ static int -get_mon_info(struct cyclades_port * info, struct cyclades_monitor __user * mon) +get_mon_info(struct cyclades_port * info, struct cyclades_monitor * mon) { if (copy_to_user(mon, &info->mon, sizeof(struct cyclades_monitor))) @@ -1516,7 +1516,7 @@ get_mon_info(struct cyclades_port * info, struct cyclades_monitor __user * mon) } static int -set_threshold(struct cyclades_port * info, unsigned long __user *arg) +set_threshold(struct cyclades_port * info, unsigned long *arg) { volatile unsigned char *base_addr = (u_char *)BASE_ADDR; unsigned long value; @@ -1533,7 +1533,7 @@ set_threshold(struct cyclades_port * info, unsigned long __user *arg) } static int -get_threshold(struct cyclades_port * info, unsigned long __user *value) +get_threshold(struct cyclades_port * info, unsigned long *value) { volatile unsigned char *base_addr = (u_char *)BASE_ADDR; int channel; @@ -1546,7 +1546,7 @@ get_threshold(struct cyclades_port * info, unsigned long __user *value) } static int -set_default_threshold(struct cyclades_port * info, unsigned long __user *arg) +set_default_threshold(struct cyclades_port * info, unsigned long *arg) { unsigned long value; @@ -1558,13 +1558,13 @@ set_default_threshold(struct cyclades_port * info, unsigned long __user *arg) } static int -get_default_threshold(struct cyclades_port * info, unsigned long __user *value) +get_default_threshold(struct cyclades_port * info, unsigned long *value) { return put_user(info->default_threshold,value); } static int -set_timeout(struct cyclades_port * info, unsigned long __user *arg) +set_timeout(struct cyclades_port * info, unsigned long *arg) { volatile unsigned char *base_addr = (u_char *)BASE_ADDR; int channel; @@ -1581,7 +1581,7 @@ set_timeout(struct cyclades_port * info, unsigned long __user *arg) } static int -get_timeout(struct cyclades_port * info, unsigned long __user *value) +get_timeout(struct cyclades_port * info, unsigned long *value) { volatile unsigned char *base_addr = (u_char *)BASE_ADDR; int channel; @@ -1601,7 +1601,7 @@ set_default_timeout(struct cyclades_port * info, unsigned long value) } static int -get_default_timeout(struct cyclades_port * info, unsigned long __user *value) +get_default_timeout(struct cyclades_port * info, unsigned long *value) { return put_user(info->default_timeout,value); } @@ -1613,7 +1613,6 @@ cy_ioctl(struct tty_struct *tty, struct file * file, unsigned long val; struct cyclades_port * info = (struct cyclades_port *)tty->driver_data; int ret_val = 0; - void __user *argp = (void __user *)arg; #ifdef SERIAL_DEBUG_OTHER printk("cy_ioctl %s, cmd = %x arg = %lx\n", tty->name, cmd, arg); /* */ @@ -1621,28 +1620,28 @@ cy_ioctl(struct tty_struct *tty, struct file * file, switch (cmd) { case CYGETMON: - ret_val = get_mon_info(info, argp); + ret_val = get_mon_info(info, (struct cyclades_monitor *)arg); break; case CYGETTHRESH: - ret_val = get_threshold(info, argp); + ret_val = get_threshold(info, (unsigned long *)arg); break; case CYSETTHRESH: - ret_val = set_threshold(info, argp); + ret_val = set_threshold(info, (unsigned long *)arg); break; case CYGETDEFTHRESH: - ret_val = get_default_threshold(info, argp); + ret_val = get_default_threshold(info, (unsigned long *)arg); break; case CYSETDEFTHRESH: - ret_val = set_default_threshold(info, argp); + ret_val = set_default_threshold(info, (unsigned long *)arg); break; case CYGETTIMEOUT: - ret_val = get_timeout(info, argp); + ret_val = get_timeout(info, (unsigned long *)arg); break; case CYSETTIMEOUT: - ret_val = set_timeout(info, argp); + ret_val = set_timeout(info, (unsigned long *)arg); break; case CYGETDEFTIMEOUT: - ret_val = get_default_timeout(info, argp); + ret_val = get_default_timeout(info, (unsigned long *)arg); break; case CYSETDEFTIMEOUT: ret_val = set_default_timeout(info, (unsigned long)arg); @@ -1665,20 +1664,21 @@ cy_ioctl(struct tty_struct *tty, struct file * file, /* The following commands are incompletely implemented!!! */ case TIOCGSOFTCAR: - ret_val = put_user(C_CLOCAL(tty) ? 1 : 0, (unsigned long __user *) argp); + ret_val = put_user(C_CLOCAL(tty) ? 1 : 0, (unsigned long *) arg); break; case TIOCSSOFTCAR: - ret_val = get_user(val, (unsigned long __user *) argp); + ret_val = get_user(val, (unsigned long *) arg); if (ret_val) break; tty->termios->c_cflag = ((tty->termios->c_cflag & ~CLOCAL) | (val ? CLOCAL : 0)); break; case TIOCGSERIAL: - ret_val = get_serial_info(info, argp); + ret_val = get_serial_info(info, (struct serial_struct *) arg); break; case TIOCSSERIAL: - ret_val = set_serial_info(info, argp); + ret_val = set_serial_info(info, + (struct serial_struct *) arg); break; default: ret_val = -ENOIOCTLCMD; @@ -1773,7 +1773,7 @@ cy_close(struct tty_struct * tty, struct file * filp) tty->driver->flush_buffer(tty); tty_ldisc_flush(tty); info->event = 0; - info->tty = NULL; + info->tty = 0; if (info->blocked_open) { if (info->close_delay) { msleep_interruptible(jiffies_to_msecs(info->close_delay)); @@ -2250,7 +2250,7 @@ scrn[1] = '\0'; info->card = index; info->line = port_num; info->flags = STD_COM_FLAGS; - info->tty = NULL; + info->tty = 0; info->xmit_fifo_size = 12; info->cor1 = CyPARITY_NONE|Cy_8_BITS; info->cor2 = CyETC; diff --git a/trunk/drivers/char/specialix.c b/trunk/drivers/char/specialix.c index 7e1bd9562c2a..d0b88d0e87fd 100644 --- a/trunk/drivers/char/specialix.c +++ b/trunk/drivers/char/specialix.c @@ -183,6 +183,11 @@ static int sx_poll = HZ; static struct tty_driver *specialix_driver; +static unsigned long baud_table[] = { + 0, 50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800, + 9600, 19200, 38400, 57600, 115200, 0, +}; + static struct specialix_board sx_board[SX_NBOARD] = { { 0, SX_IOBASE1, 9, }, { 0, SX_IOBASE2, 11, }, @@ -1085,9 +1090,9 @@ static void sx_change_speed(struct specialix_board *bp, struct specialix_port *p if (baud == 38400) { if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI) - baud = 57600; + baud ++; if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI) - baud = 115200; + baud += 2; } if (!baud) { @@ -1145,9 +1150,11 @@ static void sx_change_speed(struct specialix_board *bp, struct specialix_port *p sx_out(bp, CD186x_RBPRL, tmp & 0xff); sx_out(bp, CD186x_TBPRL, tmp & 0xff); spin_unlock_irqrestore(&bp->lock, flags); - if (port->custom_divisor) + if (port->custom_divisor) { baud = (SX_OSCFREQ + port->custom_divisor/2) / port->custom_divisor; - baud = (baud + 5) / 10; /* Estimated CPS */ + baud = ( baud + 5 ) / 10; + } else + baud = (baud_table[baud] + 5) / 10; /* Estimated CPS */ /* Two timer ticks seems enough to wakeup something like SLIP driver */ tmp = ((baud + HZ/2) / HZ) * 2 - CD186x_NFIFO; diff --git a/trunk/drivers/char/sx.c b/trunk/drivers/char/sx.c index cc10af08cb05..5fec626598cd 100644 --- a/trunk/drivers/char/sx.c +++ b/trunk/drivers/char/sx.c @@ -2602,7 +2602,7 @@ static void __exit sx_exit (void) } } if (misc_deregister(&sx_fw_device) < 0) { - printk (KERN_INFO "sx: couldn't deregister firmware loader device\n"); + printk (KERN_INFO "sx: couldn't deregister firmware loader devic\n"); } sx_dprintk (SX_DEBUG_CLEANUP, "Cleaning up drivers (%d)\n", sx_initialized); if (sx_initialized) diff --git a/trunk/drivers/char/synclink.c b/trunk/drivers/char/synclink.c index 06784adcc35c..f2864cc64240 100644 --- a/trunk/drivers/char/synclink.c +++ b/trunk/drivers/char/synclink.c @@ -133,8 +133,8 @@ static MGSL_PARAMS default_params = { }; #define SHARED_MEM_ADDRESS_SIZE 0x40000 -#define BUFFERLISTSIZE 4096 -#define DMABUFFERSIZE 4096 +#define BUFFERLISTSIZE (PAGE_SIZE) +#define DMABUFFERSIZE (PAGE_SIZE) #define MAXRXFRAMES 7 typedef struct _DMABUFFERENTRY diff --git a/trunk/drivers/ide/ide-taskfile.c b/trunk/drivers/ide/ide-taskfile.c index 30175c7688e8..1d0470c1f957 100644 --- a/trunk/drivers/ide/ide-taskfile.c +++ b/trunk/drivers/ide/ide-taskfile.c @@ -524,8 +524,8 @@ int ide_taskfile_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg) task_ioreg_t *hobsptr = args.hobRegister; int err = 0; int tasksize = sizeof(struct ide_task_request_s); - unsigned int taskin = 0; - unsigned int taskout = 0; + int taskin = 0; + int taskout = 0; u8 io_32bit = drive->io_32bit; char __user *buf = (char __user *)arg; @@ -538,13 +538,8 @@ int ide_taskfile_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg) return -EFAULT; } - taskout = req_task->out_size; - taskin = req_task->in_size; - - if (taskin > 65536 || taskout > 65536) { - err = -EINVAL; - goto abort; - } + taskout = (int) req_task->out_size; + taskin = (int) req_task->in_size; if (taskout) { int outtotal = tasksize; diff --git a/trunk/drivers/ide/pci/sgiioc4.c b/trunk/drivers/ide/pci/sgiioc4.c index 244f7eb7006d..f3fe287fbd89 100644 --- a/trunk/drivers/ide/pci/sgiioc4.c +++ b/trunk/drivers/ide/pci/sgiioc4.c @@ -774,7 +774,7 @@ ioc4_ide_exit(void) ioc4_unregister_submodule(&ioc4_ide_submodule); } -late_initcall(ioc4_ide_init); /* Call only after IDE init is done */ +module_init(ioc4_ide_init); module_exit(ioc4_ide_exit); MODULE_AUTHOR("Aniket Malatpure/Jeremy Higdon"); diff --git a/trunk/drivers/input/gameport/fm801-gp.c b/trunk/drivers/input/gameport/fm801-gp.c index 1dec00e20dbc..90de5afe03c2 100644 --- a/trunk/drivers/input/gameport/fm801-gp.c +++ b/trunk/drivers/input/gameport/fm801-gp.c @@ -82,19 +82,17 @@ static int __devinit fm801_gp_probe(struct pci_dev *pci, const struct pci_device { struct fm801_gp *gp; struct gameport *port; - int error; gp = kzalloc(sizeof(struct fm801_gp), GFP_KERNEL); port = gameport_allocate_port(); if (!gp || !port) { printk(KERN_ERR "fm801-gp: Memory allocation failed\n"); - error = -ENOMEM; - goto err_out_free; + kfree(gp); + gameport_free_port(port); + return -ENOMEM; } - error = pci_enable_device(pci); - if (error) - goto err_out_free; + pci_enable_device(pci); port->open = fm801_gp_open; #ifdef HAVE_COOKED @@ -110,8 +108,9 @@ static int __devinit fm801_gp_probe(struct pci_dev *pci, const struct pci_device if (!gp->res_port) { printk(KERN_DEBUG "fm801-gp: unable to grab region 0x%x-0x%x\n", port->io, port->io + 0x0f); - error = -EBUSY; - goto err_out_disable_dev; + gameport_free_port(port); + kfree(gp); + return -EBUSY; } pci_set_drvdata(pci, gp); @@ -120,13 +119,6 @@ static int __devinit fm801_gp_probe(struct pci_dev *pci, const struct pci_device gameport_register_port(port); return 0; - - err_out_disable_dev: - pci_disable_device(pci); - err_out_free: - gameport_free_port(port); - kfree(gp); - return error; } static void __devexit fm801_gp_remove(struct pci_dev *pci) diff --git a/trunk/drivers/input/gameport/gameport.c b/trunk/drivers/input/gameport/gameport.c index a0af97efe6ac..3f47ae55c6f3 100644 --- a/trunk/drivers/input/gameport/gameport.c +++ b/trunk/drivers/input/gameport/gameport.c @@ -191,8 +191,6 @@ static void gameport_run_poll_handler(unsigned long d) static void gameport_bind_driver(struct gameport *gameport, struct gameport_driver *drv) { - int error; - down_write(&gameport_bus.subsys.rwsem); gameport->dev.driver = &drv->driver; @@ -200,20 +198,8 @@ static void gameport_bind_driver(struct gameport *gameport, struct gameport_driv gameport->dev.driver = NULL; goto out; } - - error = device_bind_driver(&gameport->dev); - if (error) { - printk(KERN_WARNING - "gameport: device_bind_driver() failed " - "for %s (%s) and %s, error: %d\n", - gameport->phys, gameport->name, - drv->description, error); - drv->disconnect(gameport); - gameport->dev.driver = NULL; - goto out; - } - - out: + device_bind_driver(&gameport->dev); +out: up_write(&gameport_bus.subsys.rwsem); } diff --git a/trunk/drivers/input/keyboard/atkbd.c b/trunk/drivers/input/keyboard/atkbd.c index cbb93669d1ce..b6ef9eaad1dc 100644 --- a/trunk/drivers/input/keyboard/atkbd.c +++ b/trunk/drivers/input/keyboard/atkbd.c @@ -221,7 +221,6 @@ struct atkbd { unsigned long xl_bit; unsigned int last; unsigned long time; - unsigned long err_count; struct work_struct event_work; struct mutex event_mutex; @@ -235,13 +234,11 @@ static ssize_t atkbd_attr_set_helper(struct device *dev, const char *buf, size_t #define ATKBD_DEFINE_ATTR(_name) \ static ssize_t atkbd_show_##_name(struct atkbd *, char *); \ static ssize_t atkbd_set_##_name(struct atkbd *, const char *, size_t); \ -static ssize_t atkbd_do_show_##_name(struct device *d, \ - struct device_attribute *attr, char *b) \ +static ssize_t atkbd_do_show_##_name(struct device *d, struct device_attribute *attr, char *b) \ { \ return atkbd_attr_show_helper(d, b, atkbd_show_##_name); \ } \ -static ssize_t atkbd_do_set_##_name(struct device *d, \ - struct device_attribute *attr, const char *b, size_t s) \ +static ssize_t atkbd_do_set_##_name(struct device *d, struct device_attribute *attr, const char *b, size_t s) \ { \ return atkbd_attr_set_helper(d, b, s, atkbd_set_##_name); \ } \ @@ -254,32 +251,6 @@ ATKBD_DEFINE_ATTR(set); ATKBD_DEFINE_ATTR(softrepeat); ATKBD_DEFINE_ATTR(softraw); -#define ATKBD_DEFINE_RO_ATTR(_name) \ -static ssize_t atkbd_show_##_name(struct atkbd *, char *); \ -static ssize_t atkbd_do_show_##_name(struct device *d, \ - struct device_attribute *attr, char *b) \ -{ \ - return atkbd_attr_show_helper(d, b, atkbd_show_##_name); \ -} \ -static struct device_attribute atkbd_attr_##_name = \ - __ATTR(_name, S_IRUGO, atkbd_do_show_##_name, NULL); - -ATKBD_DEFINE_RO_ATTR(err_count); - -static struct attribute *atkbd_attributes[] = { - &atkbd_attr_extra.attr, - &atkbd_attr_scroll.attr, - &atkbd_attr_set.attr, - &atkbd_attr_softrepeat.attr, - &atkbd_attr_softraw.attr, - &atkbd_attr_err_count.attr, - NULL -}; - -static struct attribute_group atkbd_attribute_group = { - .attrs = atkbd_attributes, -}; - static const unsigned int xl_table[] = { ATKBD_RET_BAT, ATKBD_RET_ERR, ATKBD_RET_ACK, ATKBD_RET_NAK, ATKBD_RET_HANJA, ATKBD_RET_HANGEUL, @@ -425,10 +396,7 @@ static irqreturn_t atkbd_interrupt(struct serio *serio, unsigned char data, add_release_event = 1; break; case ATKBD_RET_ERR: - atkbd->err_count++; -#ifdef ATKBD_DEBUG printk(KERN_DEBUG "atkbd.c: Keyboard on %s reports too many keys pressed.\n", serio->phys); -#endif goto out; } @@ -818,7 +786,12 @@ static void atkbd_disconnect(struct serio *serio) synchronize_sched(); /* Allow atkbd_interrupt()s to complete. */ flush_scheduled_work(); - sysfs_remove_group(&serio->dev.kobj, &atkbd_attribute_group); + device_remove_file(&serio->dev, &atkbd_attr_extra); + device_remove_file(&serio->dev, &atkbd_attr_scroll); + device_remove_file(&serio->dev, &atkbd_attr_set); + device_remove_file(&serio->dev, &atkbd_attr_softrepeat); + device_remove_file(&serio->dev, &atkbd_attr_softraw); + input_unregister_device(atkbd->dev); serio_close(serio); serio_set_drvdata(serio, NULL); @@ -988,7 +961,11 @@ static int atkbd_connect(struct serio *serio, struct serio_driver *drv) atkbd_set_keycode_table(atkbd); atkbd_set_device_attrs(atkbd); - sysfs_create_group(&serio->dev.kobj, &atkbd_attribute_group); + device_create_file(&serio->dev, &atkbd_attr_extra); + device_create_file(&serio->dev, &atkbd_attr_scroll); + device_create_file(&serio->dev, &atkbd_attr_set); + device_create_file(&serio->dev, &atkbd_attr_softrepeat); + device_create_file(&serio->dev, &atkbd_attr_softraw); atkbd_enable(atkbd); @@ -1282,11 +1259,6 @@ static ssize_t atkbd_set_softraw(struct atkbd *atkbd, const char *buf, size_t co return count; } -static ssize_t atkbd_show_err_count(struct atkbd *atkbd, char *buf) -{ - return sprintf(buf, "%lu\n", atkbd->err_count); -} - static int __init atkbd_init(void) { diff --git a/trunk/drivers/input/misc/hp_sdc_rtc.c b/trunk/drivers/input/misc/hp_sdc_rtc.c index ab4da79ee560..1be963961c15 100644 --- a/trunk/drivers/input/misc/hp_sdc_rtc.c +++ b/trunk/drivers/input/misc/hp_sdc_rtc.c @@ -60,7 +60,7 @@ static struct fasync_struct *hp_sdc_rtc_async_queue; static DECLARE_WAIT_QUEUE_HEAD(hp_sdc_rtc_wait); -static ssize_t hp_sdc_rtc_read(struct file *file, char __user *buf, +static ssize_t hp_sdc_rtc_read(struct file *file, char *buf, size_t count, loff_t *ppos); static int hp_sdc_rtc_ioctl(struct inode *inode, struct file *file, @@ -385,14 +385,14 @@ static int hp_sdc_rtc_set_i8042timer (struct timeval *setto, uint8_t setcmd) return 0; } -static ssize_t hp_sdc_rtc_read(struct file *file, char __user *buf, +static ssize_t hp_sdc_rtc_read(struct file *file, char *buf, size_t count, loff_t *ppos) { ssize_t retval; if (count < sizeof(unsigned long)) return -EINVAL; - retval = put_user(68, (unsigned long __user *)buf); + retval = put_user(68, (unsigned long *)buf); return retval; } @@ -696,7 +696,7 @@ static int __init hp_sdc_rtc_init(void) if ((ret = hp_sdc_request_timer_irq(&hp_sdc_rtc_isr))) return ret; misc_register(&hp_sdc_rtc_dev); - create_proc_read_entry ("driver/rtc", 0, NULL, + create_proc_read_entry ("driver/rtc", 0, 0, hp_sdc_rtc_read_proc, NULL); printk(KERN_INFO "HP i8042 SDC + MSM-58321 RTC support loaded " diff --git a/trunk/drivers/input/serio/hil_mlc.c b/trunk/drivers/input/serio/hil_mlc.c index 49e11e2c1d5d..bdfde046b741 100644 --- a/trunk/drivers/input/serio/hil_mlc.c +++ b/trunk/drivers/input/serio/hil_mlc.c @@ -391,23 +391,23 @@ static int hilse_operate(hil_mlc *mlc, int repoll) { } #define FUNC(funct, funct_arg, zero_rc, neg_rc, pos_rc) \ -{ HILSE_FUNC, { .func = funct }, funct_arg, zero_rc, neg_rc, pos_rc }, +{ HILSE_FUNC, { func: &funct }, funct_arg, zero_rc, neg_rc, pos_rc }, #define OUT(pack) \ -{ HILSE_OUT, { .packet = pack }, 0, HILSEN_NEXT, HILSEN_DOZE, 0 }, +{ HILSE_OUT, { packet: pack }, 0, HILSEN_NEXT, HILSEN_DOZE, 0 }, #define CTS \ -{ HILSE_CTS, { .packet = 0 }, 0, HILSEN_NEXT | HILSEN_SCHED | HILSEN_BREAK, HILSEN_DOZE, 0 }, +{ HILSE_CTS, { packet: 0 }, 0, HILSEN_NEXT | HILSEN_SCHED | HILSEN_BREAK, HILSEN_DOZE, 0 }, #define EXPECT(comp, to, got, got_wrong, timed_out) \ -{ HILSE_EXPECT, { .packet = comp }, to, got, got_wrong, timed_out }, +{ HILSE_EXPECT, { packet: comp }, to, got, got_wrong, timed_out }, #define EXPECT_LAST(comp, to, got, got_wrong, timed_out) \ -{ HILSE_EXPECT_LAST, { .packet = comp }, to, got, got_wrong, timed_out }, +{ HILSE_EXPECT_LAST, { packet: comp }, to, got, got_wrong, timed_out }, #define EXPECT_DISC(comp, to, got, got_wrong, timed_out) \ -{ HILSE_EXPECT_DISC, { .packet = comp }, to, got, got_wrong, timed_out }, +{ HILSE_EXPECT_DISC, { packet: comp }, to, got, got_wrong, timed_out }, #define IN(to, got, got_error, timed_out) \ -{ HILSE_IN, { .packet = 0 }, to, got, got_error, timed_out }, +{ HILSE_IN, { packet: 0 }, to, got, got_error, timed_out }, #define OUT_DISC(pack) \ -{ HILSE_OUT_DISC, { .packet = pack }, 0, 0, 0, 0 }, +{ HILSE_OUT_DISC, { packet: pack }, 0, 0, 0, 0 }, #define OUT_LAST(pack) \ -{ HILSE_OUT_LAST, { .packet = pack }, 0, 0, 0, 0 }, +{ HILSE_OUT_LAST, { packet: pack }, 0, 0, 0, 0 }, struct hilse_node hil_mlc_se[HILSEN_END] = { diff --git a/trunk/drivers/input/serio/hp_sdc.c b/trunk/drivers/input/serio/hp_sdc.c index 9907ad3bea23..ba7b920347e3 100644 --- a/trunk/drivers/input/serio/hp_sdc.c +++ b/trunk/drivers/input/serio/hp_sdc.c @@ -310,7 +310,7 @@ static void hp_sdc_tasklet(unsigned long foo) { * in tasklet/bh context. */ if (curr->act.irqhook) - curr->act.irqhook(0, NULL, 0, 0); + curr->act.irqhook(0, 0, 0, 0); } curr->actidx = curr->idx; curr->idx++; @@ -525,7 +525,7 @@ unsigned long hp_sdc_put(void) { up(curr->act.semaphore); } else if (act & HP_SDC_ACT_CALLBACK) { - curr->act.irqhook(0,NULL,0,0); + curr->act.irqhook(0,0,0,0); } if (curr->idx >= curr->endidx) { /* This transaction is over. */ if (act & HP_SDC_ACT_DEALLOC) kfree(curr); diff --git a/trunk/drivers/input/serio/i8042.c b/trunk/drivers/input/serio/i8042.c index 7e3141f37e32..09b06e605b50 100644 --- a/trunk/drivers/input/serio/i8042.c +++ b/trunk/drivers/input/serio/i8042.c @@ -106,7 +106,6 @@ static unsigned char i8042_ctr; static unsigned char i8042_mux_present; static unsigned char i8042_kbd_irq_registered; static unsigned char i8042_aux_irq_registered; -static unsigned char i8042_suppress_kbd_ack; static struct platform_device *i8042_platform_device; static irqreturn_t i8042_interrupt(int irq, void *dev_id); @@ -317,7 +316,7 @@ static irqreturn_t i8042_interrupt(int irq, void *dev_id) unsigned char str, data; unsigned int dfl; unsigned int port_no; - int ret = 1; + int ret; spin_lock_irqsave(&i8042_lock, flags); str = i8042_read_status(); @@ -379,16 +378,10 @@ static irqreturn_t i8042_interrupt(int irq, void *dev_id) dfl & SERIO_PARITY ? ", bad parity" : "", dfl & SERIO_TIMEOUT ? ", timeout" : ""); - if (unlikely(i8042_suppress_kbd_ack)) - if (port_no == I8042_KBD_PORT_NO && - (data == 0xfa || data == 0xfe)) { - i8042_suppress_kbd_ack = 0; - goto out; - } - if (likely(port->exists)) serio_interrupt(port->serio, data, dfl); + ret = 1; out: return IRQ_RETVAL(ret); } @@ -849,13 +842,11 @@ static long i8042_panic_blink(long count) led ^= 0x01 | 0x04; while (i8042_read_status() & I8042_STR_IBF) DELAY; - i8042_suppress_kbd_ack = 1; i8042_write_data(0xed); /* set leds */ DELAY; while (i8042_read_status() & I8042_STR_IBF) DELAY; DELAY; - i8042_suppress_kbd_ack = 1; i8042_write_data(led); DELAY; last_blink = count; diff --git a/trunk/drivers/input/serio/libps2.c b/trunk/drivers/input/serio/libps2.c index e5b1b60757bb..dcb16b5cbec0 100644 --- a/trunk/drivers/input/serio/libps2.c +++ b/trunk/drivers/input/serio/libps2.c @@ -189,7 +189,7 @@ int ps2_command(struct ps2dev *ps2dev, unsigned char *param, int command) return -1; } - mutex_lock(&ps2dev->cmd_mutex); + mutex_lock_nested(&ps2dev->cmd_mutex, SINGLE_DEPTH_NESTING); serio_pause_rx(ps2dev->serio); ps2dev->flags = command == PS2_CMD_GETID ? PS2_FLAG_WAITID : 0; @@ -296,7 +296,6 @@ EXPORT_SYMBOL(ps2_schedule_command); void ps2_init(struct ps2dev *ps2dev, struct serio *serio) { mutex_init(&ps2dev->cmd_mutex); - lockdep_set_subclass(&ps2dev->cmd_mutex, serio->depth); init_waitqueue_head(&ps2dev->wait); ps2dev->serio = serio; } diff --git a/trunk/drivers/input/serio/serio.c b/trunk/drivers/input/serio/serio.c index 211943f85cb6..960fae3c3cea 100644 --- a/trunk/drivers/input/serio/serio.c +++ b/trunk/drivers/input/serio/serio.c @@ -118,8 +118,6 @@ static int serio_match_port(const struct serio_device_id *ids, struct serio *ser static void serio_bind_driver(struct serio *serio, struct serio_driver *drv) { - int error; - down_write(&serio_bus.subsys.rwsem); if (serio_match_port(drv->id_table, serio)) { @@ -128,19 +126,9 @@ static void serio_bind_driver(struct serio *serio, struct serio_driver *drv) serio->dev.driver = NULL; goto out; } - error = device_bind_driver(&serio->dev); - if (error) { - printk(KERN_WARNING - "serio: device_bind_driver() failed " - "for %s (%s) and %s, error: %d\n", - serio->phys, serio->name, - drv->description, error); - serio_disconnect_driver(serio); - serio->dev.driver = NULL; - goto out; - } + device_bind_driver(&serio->dev); } - out: +out: up_write(&serio_bus.subsys.rwsem); } @@ -550,12 +538,8 @@ static void serio_init_port(struct serio *serio) "serio%ld", (long)atomic_inc_return(&serio_no) - 1); serio->dev.bus = &serio_bus; serio->dev.release = serio_release_port; - if (serio->parent) { + if (serio->parent) serio->dev.parent = &serio->parent->dev; - serio->depth = serio->parent->depth + 1; - } else - serio->depth = 0; - lockdep_set_subclass(&serio->lock, serio->depth); } /* diff --git a/trunk/drivers/isdn/capi/capidrv.c b/trunk/drivers/isdn/capi/capidrv.c index b6f9476c0501..d10c8b82e6aa 100644 --- a/trunk/drivers/isdn/capi/capidrv.c +++ b/trunk/drivers/isdn/capi/capidrv.c @@ -1907,8 +1907,7 @@ static int if_readstat(u8 __user *buf, int len, int id, int channel) } for (p=buf, count=0; count < len; p++, count++) { - if (put_user(*card->q931_read++, p)) - return -EFAULT; + put_user(*card->q931_read++, p); if (card->q931_read > card->q931_end) card->q931_read = card->q931_buf; } diff --git a/trunk/drivers/isdn/hisax/config.c b/trunk/drivers/isdn/hisax/config.c index 785b08554fca..e4823ab2b127 100644 --- a/trunk/drivers/isdn/hisax/config.c +++ b/trunk/drivers/isdn/hisax/config.c @@ -631,8 +631,7 @@ static int HiSax_readstatus(u_char __user *buf, int len, int id, int channel) count = cs->status_end - cs->status_read + 1; if (count >= len) count = len; - if (copy_to_user(p, cs->status_read, count)) - return -EFAULT; + copy_to_user(p, cs->status_read, count); cs->status_read += count; if (cs->status_read > cs->status_end) cs->status_read = cs->status_buf; @@ -643,8 +642,7 @@ static int HiSax_readstatus(u_char __user *buf, int len, int id, int channel) cnt = HISAX_STATUS_BUFSIZE; else cnt = count; - if (copy_to_user(p, cs->status_read, cnt)) - return -EFAULT; + copy_to_user(p, cs->status_read, cnt); p += cnt; cs->status_read += cnt % HISAX_STATUS_BUFSIZE; count -= cnt; diff --git a/trunk/drivers/isdn/hysdn/boardergo.c b/trunk/drivers/isdn/hysdn/boardergo.c index 8bbe33ae06db..160f22fa5941 100644 --- a/trunk/drivers/isdn/hysdn/boardergo.c +++ b/trunk/drivers/isdn/hysdn/boardergo.c @@ -45,10 +45,11 @@ ergo_interrupt(int intno, void *dev_id) if (!card->irq_enabled) return IRQ_NONE; /* other device interrupting or irq switched off */ - spin_lock_irqsave(&card->hysdn_lock, flags); /* no further irqs allowed */ + save_flags(flags); + cli(); /* no further irqs allowed */ if (!(bytein(card->iobase + PCI9050_INTR_REG) & PCI9050_INTR_REG_STAT1)) { - spin_unlock_irqrestore(&card->hysdn_lock, flags); /* restore old state */ + restore_flags(flags); /* restore old state */ return IRQ_NONE; /* no interrupt requested by E1 */ } /* clear any pending ints on the board */ @@ -60,7 +61,7 @@ ergo_interrupt(int intno, void *dev_id) /* start kernel task immediately after leaving all interrupts */ if (!card->hw_lock) schedule_work(&card->irq_queue); - spin_unlock_irqrestore(&card->hysdn_lock, flags); + restore_flags(flags); return IRQ_HANDLED; } /* ergo_interrupt */ @@ -82,9 +83,10 @@ ergo_irq_bh(hysdn_card * card) dpr = card->dpram; /* point to DPRAM */ - spin_lock_irqsave(&card->hysdn_lock, flags); + save_flags(flags); + cli(); if (card->hw_lock) { - spin_unlock_irqrestore(&card->hysdn_lock, flags); /* hardware currently unavailable */ + restore_flags(flags); /* hardware currently unavailable */ return; } card->hw_lock = 1; /* we now lock the hardware */ @@ -118,7 +120,7 @@ ergo_irq_bh(hysdn_card * card) card->hw_lock = 0; /* free hardware again */ } while (again); /* until nothing more to do */ - spin_unlock_irqrestore(&card->hysdn_lock, flags); + restore_flags(flags); } /* ergo_irq_bh */ @@ -135,7 +137,8 @@ ergo_stopcard(hysdn_card * card) #ifdef CONFIG_HYSDN_CAPI hycapi_capi_stop(card); #endif /* CONFIG_HYSDN_CAPI */ - spin_lock_irqsave(&card->hysdn_lock, flags); + save_flags(flags); + cli(); val = bytein(card->iobase + PCI9050_INTR_REG); /* get actual value */ val &= ~(PCI9050_INTR_REG_ENPCI | PCI9050_INTR_REG_EN1); /* mask irq */ byteout(card->iobase + PCI9050_INTR_REG, val); @@ -144,7 +147,7 @@ ergo_stopcard(hysdn_card * card) card->state = CARD_STATE_UNUSED; card->err_log_state = ERRLOG_STATE_OFF; /* currently no log active */ - spin_unlock_irqrestore(&card->hysdn_lock, flags); + restore_flags(flags); } /* ergo_stopcard */ /**************************************************************************/ @@ -159,11 +162,12 @@ ergo_set_errlog_state(hysdn_card * card, int on) card->err_log_state = ERRLOG_STATE_OFF; /* must be off */ return; } - spin_lock_irqsave(&card->hysdn_lock, flags); + save_flags(flags); + cli(); if (((card->err_log_state == ERRLOG_STATE_OFF) && !on) || ((card->err_log_state == ERRLOG_STATE_ON) && on)) { - spin_unlock_irqrestore(&card->hysdn_lock, flags); + restore_flags(flags); return; /* nothing to do */ } if (on) @@ -171,7 +175,7 @@ ergo_set_errlog_state(hysdn_card * card, int on) else card->err_log_state = ERRLOG_STATE_STOP; /* request stop */ - spin_unlock_irqrestore(&card->hysdn_lock, flags); + restore_flags(flags); schedule_work(&card->irq_queue); } /* ergo_set_errlog_state */ @@ -352,7 +356,8 @@ ergo_waitpofready(struct HYSDN_CARD *card) if (card->debug_flags & LOG_POF_RECORD) hysdn_addlog(card, "ERGO: pof boot success"); - spin_lock_irqsave(&card->hysdn_lock, flags); + save_flags(flags); + cli(); card->state = CARD_STATE_RUN; /* now card is running */ /* enable the cards interrupt */ @@ -365,7 +370,7 @@ ergo_waitpofready(struct HYSDN_CARD *card) dpr->ToHyInt = 1; dpr->ToPcInt = 1; /* interrupt to E1 for all cards */ - spin_unlock_irqrestore(&card->hysdn_lock, flags); + restore_flags(flags); if ((hynet_enable & (1 << card->myid)) && (i = hysdn_net_create(card))) { @@ -443,7 +448,6 @@ ergo_inithardware(hysdn_card * card) card->waitpofready = ergo_waitpofready; card->set_errlog_state = ergo_set_errlog_state; INIT_WORK(&card->irq_queue, (void *) (void *) ergo_irq_bh, card); - card->hysdn_lock = SPIN_LOCK_UNLOCKED; return (0); } /* ergo_inithardware */ diff --git a/trunk/drivers/isdn/hysdn/hysdn_defs.h b/trunk/drivers/isdn/hysdn/hysdn_defs.h index 729df4089385..461e831592dd 100644 --- a/trunk/drivers/isdn/hysdn/hysdn_defs.h +++ b/trunk/drivers/isdn/hysdn/hysdn_defs.h @@ -188,8 +188,6 @@ typedef struct HYSDN_CARD { /* init and deinit stopcard for booting, too */ void (*stopcard) (struct HYSDN_CARD *); void (*releasehardware) (struct HYSDN_CARD *); - - spinlock_t hysdn_lock; #ifdef CONFIG_HYSDN_CAPI struct hycapictrl_info { char cardname[32]; diff --git a/trunk/drivers/isdn/hysdn/hysdn_proclog.c b/trunk/drivers/isdn/hysdn/hysdn_proclog.c index fcd49920b220..c4301e8338ef 100644 --- a/trunk/drivers/isdn/hysdn/hysdn_proclog.c +++ b/trunk/drivers/isdn/hysdn/hysdn_proclog.c @@ -116,7 +116,8 @@ put_log_buffer(hysdn_card * card, char *cp) strcpy(ib->log_start, cp); /* set output string */ ib->next = NULL; ib->proc_ctrl = pd; /* point to own control structure */ - spin_lock_irqsave(&card->hysdn_lock, flags); + save_flags(flags); + cli(); ib->usage_cnt = pd->if_used; if (!pd->log_head) pd->log_head = ib; /* new head */ @@ -124,7 +125,7 @@ put_log_buffer(hysdn_card * card, char *cp) pd->log_tail->next = ib; /* follows existing messages */ pd->log_tail = ib; /* new tail */ i = pd->del_lock++; /* get lock state */ - spin_unlock_irqrestore(&card->hysdn_lock, flags); + restore_flags(flags); /* delete old entrys */ if (!i) @@ -269,13 +270,14 @@ hysdn_log_open(struct inode *ino, struct file *filep) } else if ((filep->f_mode & (FMODE_READ | FMODE_WRITE)) == FMODE_READ) { /* read access -> log/debug read */ - spin_lock_irqsave(&card->hysdn_lock, flags); + save_flags(flags); + cli(); pd->if_used++; if (pd->log_head) filep->private_data = &pd->log_tail->next; else filep->private_data = &pd->log_head; - spin_unlock_irqrestore(&card->hysdn_lock, flags); + restore_flags(flags); } else { /* simultaneous read/write access forbidden ! */ unlock_kernel(); return (-EPERM); /* no permission this time */ @@ -299,7 +301,7 @@ hysdn_log_close(struct inode *ino, struct file *filep) hysdn_card *card; int retval = 0; unsigned long flags; - spinlock_t hysdn_lock = SPIN_LOCK_UNLOCKED; + lock_kernel(); if ((filep->f_mode & (FMODE_READ | FMODE_WRITE)) == FMODE_WRITE) { @@ -309,7 +311,8 @@ hysdn_log_close(struct inode *ino, struct file *filep) /* read access -> log/debug read, mark one further file as closed */ pd = NULL; - spin_lock_irqsave(&hysdn_lock, flags); + save_flags(flags); + cli(); inf = *((struct log_data **) filep->private_data); /* get first log entry */ if (inf) pd = (struct procdata *) inf->proc_ctrl; /* still entries there */ @@ -332,7 +335,7 @@ hysdn_log_close(struct inode *ino, struct file *filep) inf->usage_cnt--; /* decrement usage count for buffers */ inf = inf->next; } - spin_unlock_irqrestore(&hysdn_lock, flags); + restore_flags(flags); if (pd) if (pd->if_used <= 0) /* delete buffers if last file closed */ diff --git a/trunk/drivers/isdn/hysdn/hysdn_sched.c b/trunk/drivers/isdn/hysdn/hysdn_sched.c index 1fadf0133e9b..1c0d54ac12ab 100644 --- a/trunk/drivers/isdn/hysdn/hysdn_sched.c +++ b/trunk/drivers/isdn/hysdn/hysdn_sched.c @@ -155,7 +155,8 @@ hysdn_tx_cfgline(hysdn_card *card, unsigned char *line, unsigned short chan) if (card->debug_flags & LOG_SCHED_ASYN) hysdn_addlog(card, "async tx-cfg chan=%d len=%d", chan, strlen(line) + 1); - spin_lock_irqsave(&card->hysdn_lock, flags); + save_flags(flags); + cli(); while (card->async_busy) { sti(); @@ -164,7 +165,7 @@ hysdn_tx_cfgline(hysdn_card *card, unsigned char *line, unsigned short chan) msleep_interruptible(20); /* Timeout 20ms */ if (!--cnt) { - spin_unlock_irqrestore(&card->hysdn_lock, flags); + restore_flags(flags); return (-ERR_ASYNC_TIME); /* timed out */ } cli(); @@ -193,13 +194,13 @@ hysdn_tx_cfgline(hysdn_card *card, unsigned char *line, unsigned short chan) msleep_interruptible(20); /* Timeout 20ms */ if (!--cnt) { - spin_unlock_irqrestore(&card->hysdn_lock, flags); + restore_flags(flags); return (-ERR_ASYNC_TIME); /* timed out */ } cli(); } /* wait for buffer to become free again */ - spin_unlock_irqrestore(&card->hysdn_lock, flags); + restore_flags(flags); if (card->debug_flags & LOG_SCHED_ASYN) hysdn_addlog(card, "async tx-cfg data send"); diff --git a/trunk/drivers/isdn/i4l/isdn_common.c b/trunk/drivers/isdn/i4l/isdn_common.c index 69aee2602aa6..c3d79eef9e32 100644 --- a/trunk/drivers/isdn/i4l/isdn_common.c +++ b/trunk/drivers/isdn/i4l/isdn_common.c @@ -1134,12 +1134,9 @@ isdn_read(struct file *file, char __user *buf, size_t count, loff_t * off) if (dev->drv[drvidx]->interface->readstat) { if (count > dev->drv[drvidx]->stavail) count = dev->drv[drvidx]->stavail; - len = dev->drv[drvidx]->interface->readstat(buf, count, - drvidx, isdn_minor2chan(minor)); - if (len < 0) { - retval = len; - goto out; - } + len = dev->drv[drvidx]->interface-> + readstat(buf, count, drvidx, + isdn_minor2chan(minor)); } else { len = 0; } diff --git a/trunk/drivers/isdn/icn/icn.c b/trunk/drivers/isdn/icn/icn.c index 730bbd07ebc7..6649f8bc9951 100644 --- a/trunk/drivers/isdn/icn/icn.c +++ b/trunk/drivers/isdn/icn/icn.c @@ -1010,8 +1010,7 @@ icn_readstatus(u_char __user *buf, int len, icn_card * card) for (p = buf, count = 0; count < len; p++, count++) { if (card->msg_buf_read == card->msg_buf_write) return count; - if (put_user(*card->msg_buf_read++, p)) - return -EFAULT; + put_user(*card->msg_buf_read++, p); if (card->msg_buf_read > card->msg_buf_end) card->msg_buf_read = card->msg_buf; } diff --git a/trunk/drivers/isdn/isdnloop/isdnloop.c b/trunk/drivers/isdn/isdnloop/isdnloop.c index c3ae2edaf6fa..fabbd461603e 100644 --- a/trunk/drivers/isdn/isdnloop/isdnloop.c +++ b/trunk/drivers/isdn/isdnloop/isdnloop.c @@ -100,11 +100,12 @@ isdnloop_pollbchan(unsigned long data) isdnloop_bchan_send(card, 1); if (card->flags & (ISDNLOOP_FLAGS_B1ACTIVE | ISDNLOOP_FLAGS_B2ACTIVE)) { /* schedule b-channel polling again */ - spin_lock_irqsave(&card->isdnloop_lock, flags); + save_flags(flags); + cli(); card->rb_timer.expires = jiffies + ISDNLOOP_TIMER_BCREAD; add_timer(&card->rb_timer); card->flags |= ISDNLOOP_FLAGS_RBTIMER; - spin_unlock_irqrestore(&card->isdnloop_lock, flags); + restore_flags(flags); } else card->flags &= ~ISDNLOOP_FLAGS_RBTIMER; } @@ -280,7 +281,8 @@ isdnloop_putmsg(isdnloop_card * card, unsigned char c) { ulong flags; - spin_lock_irqsave(&card->isdnloop_lock, flags); + save_flags(flags); + cli(); *card->msg_buf_write++ = (c == 0xff) ? '\n' : c; if (card->msg_buf_write == card->msg_buf_read) { if (++card->msg_buf_read > card->msg_buf_end) @@ -288,7 +290,7 @@ isdnloop_putmsg(isdnloop_card * card, unsigned char c) } if (card->msg_buf_write > card->msg_buf_end) card->msg_buf_write = card->msg_buf; - spin_unlock_irqrestore(&card->isdnloop_lock, flags); + restore_flags(flags); } /* @@ -370,19 +372,21 @@ isdnloop_polldchan(unsigned long data) if (!(card->flags & ISDNLOOP_FLAGS_RBTIMER)) { /* schedule b-channel polling */ card->flags |= ISDNLOOP_FLAGS_RBTIMER; - spin_lock_irqsave(&card->isdnloop_lock, flags); + save_flags(flags); + cli(); del_timer(&card->rb_timer); card->rb_timer.function = isdnloop_pollbchan; card->rb_timer.data = (unsigned long) card; card->rb_timer.expires = jiffies + ISDNLOOP_TIMER_BCREAD; add_timer(&card->rb_timer); - spin_unlock_irqrestore(&card->isdnloop_lock, flags); + restore_flags(flags); } /* schedule again */ - spin_lock_irqsave(&card->isdnloop_lock, flags); + save_flags(flags); + cli(); card->st_timer.expires = jiffies + ISDNLOOP_TIMER_DCREAD; add_timer(&card->st_timer); - spin_unlock_irqrestore(&card->isdnloop_lock, flags); + restore_flags(flags); } /* @@ -412,7 +416,8 @@ isdnloop_sendbuf(int channel, struct sk_buff *skb, isdnloop_card * card) return 0; if (card->sndcount[channel] > ISDNLOOP_MAX_SQUEUE) return 0; - spin_lock_irqsave(&card->isdnloop_lock, flags); + save_flags(flags); + cli(); nskb = dev_alloc_skb(skb->len); if (nskb) { memcpy(skb_put(nskb, len), skb->data, len); @@ -421,7 +426,7 @@ isdnloop_sendbuf(int channel, struct sk_buff *skb, isdnloop_card * card) } else len = 0; card->sndcount[channel] += len; - spin_unlock_irqrestore(&card->isdnloop_lock, flags); + restore_flags(flags); } return len; } @@ -446,8 +451,7 @@ isdnloop_readstatus(u_char __user *buf, int len, isdnloop_card * card) for (p = buf, count = 0; count < len; p++, count++) { if (card->msg_buf_read == card->msg_buf_write) return count; - if (put_user(*card->msg_buf_read++, p)) - return -EFAULT; + put_user(*card->msg_buf_read++, p); if (card->msg_buf_read > card->msg_buf_end) card->msg_buf_read = card->msg_buf; } @@ -572,7 +576,8 @@ isdnloop_atimeout(isdnloop_card * card, int ch) unsigned long flags; char buf[60]; - spin_lock_irqsave(&card->isdnloop_lock, flags); + save_flags(flags); + cli(); if (card->rcard) { isdnloop_fake(card->rcard[ch], "DDIS_I", card->rch[ch] + 1); card->rcard[ch]->rcard[card->rch[ch]] = NULL; @@ -582,7 +587,7 @@ isdnloop_atimeout(isdnloop_card * card, int ch) /* No user responding */ sprintf(buf, "CAU%s", isdnloop_unicause(card, 1, 3)); isdnloop_fake(card, buf, ch + 1); - spin_unlock_irqrestore(&card->isdnloop_lock, flags); + restore_flags(flags); } /* @@ -617,7 +622,8 @@ isdnloop_start_ctimer(isdnloop_card * card, int ch) { unsigned long flags; - spin_lock_irqsave(&card->isdnloop_lock, flags); + save_flags(flags); + cli(); init_timer(&card->c_timer[ch]); card->c_timer[ch].expires = jiffies + ISDNLOOP_TIMER_ALERTWAIT; if (ch) @@ -626,7 +632,7 @@ isdnloop_start_ctimer(isdnloop_card * card, int ch) card->c_timer[ch].function = isdnloop_atimeout0; card->c_timer[ch].data = (unsigned long) card; add_timer(&card->c_timer[ch]); - spin_unlock_irqrestore(&card->isdnloop_lock, flags); + restore_flags(flags); } /* @@ -641,9 +647,10 @@ isdnloop_kill_ctimer(isdnloop_card * card, int ch) { unsigned long flags; - spin_lock_irqsave(&card->isdnloop_lock, flags); + save_flags(flags); + cli(); del_timer(&card->c_timer[ch]); - spin_unlock_irqrestore(&card->isdnloop_lock, flags); + restore_flags(flags); } static u_char si2bit[] = @@ -699,12 +706,13 @@ isdnloop_try_call(isdnloop_card * card, char *p, int lch, isdn_ctrl * cmd) } } if (num_match) { - spin_lock_irqsave(&card->isdnloop_lock, flags); + save_flags(flags); + cli(); /* channel idle? */ if (!(cc->rcard[ch])) { /* Check SI */ if (!(si2bit[cmd->parm.setup.si1] & cc->sil[ch])) { - spin_unlock_irqrestore(&card->isdnloop_lock, flags); + restore_flags(flags); return 3; } /* ch is idle, si and number matches */ @@ -712,10 +720,10 @@ isdnloop_try_call(isdnloop_card * card, char *p, int lch, isdn_ctrl * cmd) cc->rch[ch] = lch; card->rcard[lch] = cc; card->rch[lch] = ch; - spin_unlock_irqrestore(&card->isdnloop_lock, flags); + restore_flags(flags); return 0; } else { - spin_unlock_irqrestore(&card->isdnloop_lock, flags); + restore_flags(flags); /* num matches, but busy */ if (ch == 1) return 1; @@ -1019,7 +1027,8 @@ isdnloop_stopcard(isdnloop_card * card) unsigned long flags; isdn_ctrl cmd; - spin_lock_irqsave(&card->isdnloop_lock, flags); + save_flags(flags); + cli(); if (card->flags & ISDNLOOP_FLAGS_RUNNING) { card->flags &= ~ISDNLOOP_FLAGS_RUNNING; del_timer(&card->st_timer); @@ -1030,7 +1039,7 @@ isdnloop_stopcard(isdnloop_card * card) cmd.driver = card->myid; card->interface.statcallb(&cmd); } - spin_unlock_irqrestore(&card->isdnloop_lock, flags); + restore_flags(flags); } /* @@ -1069,17 +1078,18 @@ isdnloop_start(isdnloop_card * card, isdnloop_sdef * sdefp) return -EBUSY; if (copy_from_user((char *) &sdef, (char *) sdefp, sizeof(sdef))) return -EFAULT; - spin_lock_irqsave(&card->isdnloop_lock, flags); + save_flags(flags); + cli(); switch (sdef.ptype) { case ISDN_PTYPE_EURO: if (isdnloop_fake(card, "DRV1.23EC-Q.931-CAPI-CNS-BASIS-20.02.96", -1)) { - spin_unlock_irqrestore(&card->isdnloop_lock, flags); + restore_flags(flags); return -ENOMEM; } card->sil[0] = card->sil[1] = 4; if (isdnloop_fake(card, "TEI OK", 0)) { - spin_unlock_irqrestore(&card->isdnloop_lock, flags); + restore_flags(flags); return -ENOMEM; } for (i = 0; i < 3; i++) @@ -1088,12 +1098,12 @@ isdnloop_start(isdnloop_card * card, isdnloop_sdef * sdefp) case ISDN_PTYPE_1TR6: if (isdnloop_fake(card, "DRV1.04TC-1TR6-CAPI-CNS-BASIS-29.11.95", -1)) { - spin_unlock_irqrestore(&card->isdnloop_lock, flags); + restore_flags(flags); return -ENOMEM; } card->sil[0] = card->sil[1] = 4; if (isdnloop_fake(card, "TEI OK", 0)) { - spin_unlock_irqrestore(&card->isdnloop_lock, flags); + restore_flags(flags); return -ENOMEM; } strcpy(card->s0num[0], sdef.num[0]); @@ -1101,7 +1111,7 @@ isdnloop_start(isdnloop_card * card, isdnloop_sdef * sdefp) card->s0num[2][0] = '\0'; break; default: - spin_unlock_irqrestore(&card->isdnloop_lock, flags); + restore_flags(flags); printk(KERN_WARNING "isdnloop: Illegal D-channel protocol %d\n", sdef.ptype); return -EINVAL; @@ -1112,7 +1122,7 @@ isdnloop_start(isdnloop_card * card, isdnloop_sdef * sdefp) card->st_timer.data = (unsigned long) card; add_timer(&card->st_timer); card->flags |= ISDNLOOP_FLAGS_RUNNING; - spin_unlock_irqrestore(&card->isdnloop_lock, flags); + restore_flags(flags); return 0; } @@ -1462,7 +1472,6 @@ isdnloop_initcard(char *id) skb_queue_head_init(&card->bqueue[i]); } skb_queue_head_init(&card->dqueue); - card->isdnloop_lock = SPIN_LOCK_UNLOCKED; card->next = cards; cards = card; if (!register_isdn(&card->interface)) { diff --git a/trunk/drivers/isdn/isdnloop/isdnloop.h b/trunk/drivers/isdn/isdnloop/isdnloop.h index 0d458a86f529..d699fe53e1c3 100644 --- a/trunk/drivers/isdn/isdnloop/isdnloop.h +++ b/trunk/drivers/isdn/isdnloop/isdnloop.h @@ -94,7 +94,6 @@ typedef struct isdnloop_card { struct sk_buff_head bqueue[ISDNLOOP_BCH]; /* B-Channel queues */ struct sk_buff_head dqueue; /* D-Channel queue */ - spinlock_t isdnloop_lock; } isdnloop_card; /* diff --git a/trunk/drivers/isdn/pcbit/drv.c b/trunk/drivers/isdn/pcbit/drv.c index 6ead5e1508b7..94f21486bb24 100644 --- a/trunk/drivers/isdn/pcbit/drv.c +++ b/trunk/drivers/isdn/pcbit/drv.c @@ -725,27 +725,23 @@ static int pcbit_stat(u_char __user *buf, int len, int driver, int channel) if (stat_st < stat_end) { - if (copy_to_user(buf, statbuf + stat_st, len)) - return -EFAULT; + copy_to_user(buf, statbuf + stat_st, len); stat_st += len; } else { if (len > STATBUF_LEN - stat_st) { - if (copy_to_user(buf, statbuf + stat_st, - STATBUF_LEN - stat_st)) - return -EFAULT; - if (copy_to_user(buf, statbuf, - len - (STATBUF_LEN - stat_st))) - return -EFAULT; + copy_to_user(buf, statbuf + stat_st, + STATBUF_LEN - stat_st); + copy_to_user(buf, statbuf, + len - (STATBUF_LEN - stat_st)); stat_st = len - (STATBUF_LEN - stat_st); } else { - if (copy_to_user(buf, statbuf + stat_st, len)) - return -EFAULT; + copy_to_user(buf, statbuf + stat_st, len); stat_st += len; diff --git a/trunk/drivers/leds/led-class.c b/trunk/drivers/leds/led-class.c index 3c1711210e38..aecbbe2e89a9 100644 --- a/trunk/drivers/leds/led-class.c +++ b/trunk/drivers/leds/led-class.c @@ -91,8 +91,6 @@ EXPORT_SYMBOL_GPL(led_classdev_resume); */ int led_classdev_register(struct device *parent, struct led_classdev *led_cdev) { - int rc; - led_cdev->class_dev = class_device_create(leds_class, NULL, 0, parent, "%s", led_cdev->name); if (unlikely(IS_ERR(led_cdev->class_dev))) @@ -101,10 +99,8 @@ int led_classdev_register(struct device *parent, struct led_classdev *led_cdev) class_set_devdata(led_cdev->class_dev, led_cdev); /* register the attributes */ - rc = class_device_create_file(led_cdev->class_dev, - &class_device_attr_brightness); - if (rc) - goto err_out; + class_device_create_file(led_cdev->class_dev, + &class_device_attr_brightness); /* add to the list of leds */ write_lock(&leds_list_lock); @@ -114,28 +110,16 @@ int led_classdev_register(struct device *parent, struct led_classdev *led_cdev) #ifdef CONFIG_LEDS_TRIGGERS rwlock_init(&led_cdev->trigger_lock); - rc = class_device_create_file(led_cdev->class_dev, - &class_device_attr_trigger); - if (rc) - goto err_out_led_list; - led_trigger_set_default(led_cdev); + + class_device_create_file(led_cdev->class_dev, + &class_device_attr_trigger); #endif printk(KERN_INFO "Registered led device: %s\n", led_cdev->class_dev->class_id); return 0; - -#ifdef CONFIG_LEDS_TRIGGERS -err_out_led_list: - class_device_remove_file(led_cdev->class_dev, - &class_device_attr_brightness); - list_del(&led_cdev->node); -#endif -err_out: - class_device_unregister(led_cdev->class_dev); - return rc; } EXPORT_SYMBOL_GPL(led_classdev_register); diff --git a/trunk/drivers/leds/ledtrig-timer.c b/trunk/drivers/leds/ledtrig-timer.c index 29a8818a32ec..179c2876b541 100644 --- a/trunk/drivers/leds/ledtrig-timer.c +++ b/trunk/drivers/leds/ledtrig-timer.c @@ -123,7 +123,6 @@ static CLASS_DEVICE_ATTR(delay_off, 0644, led_delay_off_show, static void timer_trig_activate(struct led_classdev *led_cdev) { struct timer_trig_data *timer_data; - int rc; timer_data = kzalloc(sizeof(struct timer_trig_data), GFP_KERNEL); if (!timer_data) @@ -135,21 +134,10 @@ static void timer_trig_activate(struct led_classdev *led_cdev) timer_data->timer.function = led_timer_function; timer_data->timer.data = (unsigned long) led_cdev; - rc = class_device_create_file(led_cdev->class_dev, + class_device_create_file(led_cdev->class_dev, &class_device_attr_delay_on); - if (rc) goto err_out; - rc = class_device_create_file(led_cdev->class_dev, + class_device_create_file(led_cdev->class_dev, &class_device_attr_delay_off); - if (rc) goto err_out_delayon; - - return; - -err_out_delayon: - class_device_remove_file(led_cdev->class_dev, - &class_device_attr_delay_on); -err_out: - led_cdev->trigger_data = NULL; - kfree(timer_data); } static void timer_trig_deactivate(struct led_classdev *led_cdev) diff --git a/trunk/drivers/md/md.c b/trunk/drivers/md/md.c index f7f19088f3be..57fa64f93e5f 100644 --- a/trunk/drivers/md/md.c +++ b/trunk/drivers/md/md.c @@ -4912,7 +4912,6 @@ static unsigned int mdstat_poll(struct file *filp, poll_table *wait) } static struct file_operations md_seq_fops = { - .owner = THIS_MODULE, .open = md_seq_open, .read = seq_read, .llseek = seq_lseek, diff --git a/trunk/drivers/media/dvb/bt8xx/dvb-bt8xx.c b/trunk/drivers/media/dvb/bt8xx/dvb-bt8xx.c index 14e69a736eda..fb6c4cc8477d 100644 --- a/trunk/drivers/media/dvb/bt8xx/dvb-bt8xx.c +++ b/trunk/drivers/media/dvb/bt8xx/dvb-bt8xx.c @@ -665,10 +665,6 @@ static void frontend_init(struct dvb_bt8xx_card *card, u32 type) case BTTV_BOARD_TWINHAN_DST: /* DST is not a frontend driver !!! */ state = (struct dst_state *) kmalloc(sizeof (struct dst_state), GFP_KERNEL); - if (!state) { - printk("dvb_bt8xx: No memory\n"); - break; - } /* Setup the Card */ state->config = &dst_config; state->i2c = card->i2c_adapter; diff --git a/trunk/drivers/media/dvb/dvb-core/Kconfig b/trunk/drivers/media/dvb/dvb-core/Kconfig index 1990eda10c46..e46eae3b9be2 100644 --- a/trunk/drivers/media/dvb/dvb-core/Kconfig +++ b/trunk/drivers/media/dvb/dvb-core/Kconfig @@ -19,6 +19,6 @@ config DVB_CORE_ATTACH allow the card drivers to only load the frontend modules they require. This saves several KBytes of memory. - Note: You will need module-init-tools v3.2 or later for this feature. + Note: You will need moudule-init-tools v3.2 or later for this feature. If unsure say Y. diff --git a/trunk/drivers/media/dvb/dvb-usb/dibusb-common.c b/trunk/drivers/media/dvb/dvb-usb/dibusb-common.c index 5143e426d283..fd3a9902f98d 100644 --- a/trunk/drivers/media/dvb/dvb-usb/dibusb-common.c +++ b/trunk/drivers/media/dvb/dvb-usb/dibusb-common.c @@ -169,7 +169,7 @@ EXPORT_SYMBOL(dibusb_read_eeprom_byte); // Config Adjacent channels Perf -cal22 static struct dibx000_agc_config dib3000p_mt2060_agc_config = { .band_caps = BAND_VHF | BAND_UHF, - .setup = (1 << 8) | (5 << 5) | (1 << 4) | (1 << 3) | (0 << 2) | (2 << 0), + .setup = (0 << 15) | (0 << 14) | (1 << 13) | (1 << 12) | (29 << 0), .agc1_max = 48497, .agc1_min = 23593, @@ -196,14 +196,10 @@ static struct dib3000mc_config stk3000p_dib3000p_config = { .ln_adc_level = 0x1cc7, .output_mpeg2_in_188_bytes = 1, - - .agc_command1 = 1, - .agc_command2 = 1, }; static struct dibx000_agc_config dib3000p_panasonic_agc_config = { - .band_caps = BAND_VHF | BAND_UHF, - .setup = (1 << 8) | (5 << 5) | (1 << 4) | (1 << 3) | (0 << 2) | (2 << 0), + .setup = (0 << 15) | (0 << 14) | (1 << 13) | (1 << 12) | (29 << 0), .agc1_max = 56361, .agc1_min = 22282, @@ -230,9 +226,6 @@ static struct dib3000mc_config mod3000p_dib3000p_config = { .ln_adc_level = 0x1cc7, .output_mpeg2_in_188_bytes = 1, - - .agc_command1 = 1, - .agc_command2 = 1, }; int dibusb_dib3000mc_frontend_attach(struct dvb_usb_adapter *adap) diff --git a/trunk/drivers/media/dvb/dvb-usb/dibusb.h b/trunk/drivers/media/dvb/dvb-usb/dibusb.h index b60781032742..5153fb943da1 100644 --- a/trunk/drivers/media/dvb/dvb-usb/dibusb.h +++ b/trunk/drivers/media/dvb/dvb-usb/dibusb.h @@ -99,9 +99,7 @@ struct dibusb_state { struct dib_fe_xfer_ops ops; int mt2060_present; -}; -struct dibusb_device_state { /* for RC5 remote control */ int old_toggle; int last_repeat_count; diff --git a/trunk/drivers/media/dvb/dvb-usb/nova-t-usb2.c b/trunk/drivers/media/dvb/dvb-usb/nova-t-usb2.c index a58874c790b2..a9219bf69b89 100644 --- a/trunk/drivers/media/dvb/dvb-usb/nova-t-usb2.c +++ b/trunk/drivers/media/dvb/dvb-usb/nova-t-usb2.c @@ -75,7 +75,7 @@ static int nova_t_rc_query(struct dvb_usb_device *d, u32 *event, int *state) u8 key[5],cmd[2] = { DIBUSB_REQ_POLL_REMOTE, 0x35 }, data,toggle,custom; u16 raw; int i; - struct dibusb_device_state *st = d->priv; + struct dibusb_state *st = d->priv; dvb_usb_generic_rw(d,cmd,2,key,5,0); @@ -184,7 +184,6 @@ static struct dvb_usb_device_properties nova_t_properties = { .size_of_priv = sizeof(struct dibusb_state), } }, - .size_of_priv = sizeof(struct dibusb_device_state), .power_ctrl = dibusb2_0_power_ctrl, .read_mac_address = nova_t_read_mac_address, diff --git a/trunk/drivers/media/dvb/frontends/dib3000mc.c b/trunk/drivers/media/dvb/frontends/dib3000mc.c index 3561a777568c..ccc813b525d6 100644 --- a/trunk/drivers/media/dvb/frontends/dib3000mc.c +++ b/trunk/drivers/media/dvb/frontends/dib3000mc.c @@ -345,7 +345,7 @@ static int dib3000mc_init(struct dvb_frontend *demod) /* agc */ dib3000mc_write_word(state, 36, state->cfg->max_time); - dib3000mc_write_word(state, 37, (state->cfg->agc_command1 << 13) | (state->cfg->agc_command2 << 12) | (0x1d << 0)); + dib3000mc_write_word(state, 37, agc->setup); dib3000mc_write_word(state, 38, state->cfg->pwm3_value); dib3000mc_write_word(state, 39, state->cfg->ln_adc_level); diff --git a/trunk/drivers/media/dvb/frontends/dib3000mc.h b/trunk/drivers/media/dvb/frontends/dib3000mc.h index 0d6fdef77538..b198cd5b1843 100644 --- a/trunk/drivers/media/dvb/frontends/dib3000mc.h +++ b/trunk/drivers/media/dvb/frontends/dib3000mc.h @@ -28,9 +28,6 @@ struct dib3000mc_config { u16 max_time; u16 ln_adc_level; - u8 agc_command1 :1; - u8 agc_command2 :1; - u8 mobile_mode; u8 output_mpeg2_in_188_bytes; diff --git a/trunk/drivers/media/dvb/frontends/tda10086.h b/trunk/drivers/media/dvb/frontends/tda10086.h index 18457adee30b..e8061db11123 100644 --- a/trunk/drivers/media/dvb/frontends/tda10086.h +++ b/trunk/drivers/media/dvb/frontends/tda10086.h @@ -35,16 +35,7 @@ struct tda10086_config u8 invert; }; -#if defined(CONFIG_DVB_TDA10086) || defined(CONFIG_DVB_TDA10086_MODULE) extern struct dvb_frontend* tda10086_attach(const struct tda10086_config* config, struct i2c_adapter* i2c); -#else -static inline struct dvb_frontend* tda10086_attach(const struct tda10086_config* config, - struct i2c_adapter* i2c) -{ - printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__); - return NULL; -} -#endif // CONFIG_DVB_TDA10086 #endif // TDA10086_H diff --git a/trunk/drivers/media/dvb/frontends/tda826x.h b/trunk/drivers/media/dvb/frontends/tda826x.h index 83998c001196..3307607632b0 100644 --- a/trunk/drivers/media/dvb/frontends/tda826x.h +++ b/trunk/drivers/media/dvb/frontends/tda826x.h @@ -35,19 +35,6 @@ * @param has_loopthrough Set to 1 if the card has a loopthrough RF connector. * @return FE pointer on success, NULL on failure. */ -#if defined(CONFIG_DVB_TDA826X) || defined(CONFIG_DVB_TDA826X_MODULE) -extern struct dvb_frontend* tda826x_attach(struct dvb_frontend *fe, int addr, - struct i2c_adapter *i2c, - int has_loopthrough); -#else -static inline struct dvb_frontend* tda826x_attach(struct dvb_frontend *fe, - int addr, - struct i2c_adapter *i2c, - int has_loopthrough) -{ - printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__); - return NULL; -} -#endif // CONFIG_DVB_TDA826X - -#endif // __DVB_TDA826X_H__ +extern struct dvb_frontend *tda826x_attach(struct dvb_frontend *fe, int addr, struct i2c_adapter *i2c, int has_loopthrough); + +#endif diff --git a/trunk/drivers/media/video/Kconfig b/trunk/drivers/media/video/Kconfig index fbe5b6168cc2..afb734df6e05 100644 --- a/trunk/drivers/media/video/Kconfig +++ b/trunk/drivers/media/video/Kconfig @@ -677,8 +677,6 @@ config VIDEO_M32R_AR_M64278 menu "V4L USB devices" depends on USB && VIDEO_DEV -source "drivers/media/video/pvrusb2/Kconfig" - source "drivers/media/video/em28xx/Kconfig" source "drivers/media/video/usbvideo/Kconfig" diff --git a/trunk/drivers/media/video/cx25840/cx25840-vbi.c b/trunk/drivers/media/video/cx25840/cx25840-vbi.c index f85f2084324f..48014a254e15 100644 --- a/trunk/drivers/media/video/cx25840/cx25840-vbi.c +++ b/trunk/drivers/media/video/cx25840/cx25840-vbi.c @@ -235,7 +235,6 @@ int cx25840_vbi(struct i2c_client *client, unsigned int cmd, void *arg) 0, 0, V4L2_SLICED_VPS, 0, 0, /* 9 */ 0, 0, 0, 0 }; - int is_pal = !(cx25840_get_v4lstd(client) & V4L2_STD_525_60); int i; fmt = arg; @@ -247,25 +246,13 @@ int cx25840_vbi(struct i2c_client *client, unsigned int cmd, void *arg) if ((cx25840_read(client, 0x404) & 0x10) == 0) break; - if (is_pal) { - for (i = 7; i <= 23; i++) { - u8 v = cx25840_read(client, 0x424 + i - 7); - - svbi->service_lines[0][i] = lcr2vbi[v >> 4]; - svbi->service_lines[1][i] = lcr2vbi[v & 0xf]; - svbi->service_set |= - svbi->service_lines[0][i] | svbi->service_lines[1][i]; - } - } - else { - for (i = 10; i <= 21; i++) { - u8 v = cx25840_read(client, 0x424 + i - 10); + for (i = 7; i <= 23; i++) { + u8 v = cx25840_read(client, 0x424 + i - 7); - svbi->service_lines[0][i] = lcr2vbi[v >> 4]; - svbi->service_lines[1][i] = lcr2vbi[v & 0xf]; - svbi->service_set |= - svbi->service_lines[0][i] | svbi->service_lines[1][i]; - } + svbi->service_lines[0][i] = lcr2vbi[v >> 4]; + svbi->service_lines[1][i] = lcr2vbi[v & 0xf]; + svbi->service_set |= + svbi->service_lines[0][i] | svbi->service_lines[1][i]; } break; } diff --git a/trunk/drivers/media/video/cx88/cx88-cards.c b/trunk/drivers/media/video/cx88/cx88-cards.c index f764a57c56be..af71d4225c76 100644 --- a/trunk/drivers/media/video/cx88/cx88-cards.c +++ b/trunk/drivers/media/video/cx88/cx88-cards.c @@ -1230,7 +1230,6 @@ struct cx88_board cx88_boards[] = { .vmux = 2, .gpio0 = 0x84bf, }}, - .mpeg = CX88_MPEG_DVB, }, [CX88_BOARD_NORWOOD_MICRO] = { .name = "Norwood Micro TV Tuner", @@ -1591,18 +1590,6 @@ struct cx88_subid cx88_subids[] = { .subvendor = 0x0070, .subdevice = 0x9000, .card = CX88_BOARD_HAUPPAUGE_DVB_T1, - },{ - .subvendor = 0x0070, - .subdevice = 0x1400, - .card = CX88_BOARD_HAUPPAUGE_HVR3000, - },{ - .subvendor = 0x0070, - .subdevice = 0x1401, - .card = CX88_BOARD_HAUPPAUGE_HVR3000, - },{ - .subvendor = 0x0070, - .subdevice = 0x1402, - .card = CX88_BOARD_HAUPPAUGE_HVR3000, }, }; const unsigned int cx88_idcount = ARRAY_SIZE(cx88_subids); @@ -1646,15 +1633,7 @@ static void hauppauge_eeprom(struct cx88_core *core, u8 *eeprom_data) /* Make sure we support the board model */ switch (tv.model) { - case 14009: /* WinTV-HVR3000 (Retail, IR, b/panel video, 3.5mm audio in) */ - case 14019: /* WinTV-HVR3000 (Retail, IR Blaster, b/panel video, 3.5mm audio in) */ - case 14029: /* WinTV-HVR3000 (Retail, IR, b/panel video, 3.5mm audio in - 880 bridge) */ - case 14109: /* WinTV-HVR3000 (Retail, IR, b/panel video, 3.5mm audio in - low profile) */ - case 14129: /* WinTV-HVR3000 (Retail, IR, b/panel video, 3.5mm audio in - 880 bridge - LP) */ - case 14559: /* WinTV-HVR3000 (OEM, no IR, b/panel video, 3.5mm audio in) */ case 14569: /* WinTV-HVR3000 (OEM, no IR, no back panel video) */ - case 14659: /* WinTV-HVR3000 (OEM, no IR, b/panel video, RCA audio in - Low profile) */ - case 14669: /* WinTV-HVR3000 (OEM, no IR, no b/panel video - Low profile) */ case 28552: /* WinTV-PVR 'Roslyn' (No IR) */ case 34519: /* WinTV-PCI-FM */ case 90002: /* Nova-T-PCI (9002) */ diff --git a/trunk/drivers/media/video/cx88/cx88-dvb.c b/trunk/drivers/media/video/cx88/cx88-dvb.c index 0ef13e7efa2e..bd0c8797f26d 100644 --- a/trunk/drivers/media/video/cx88/cx88-dvb.c +++ b/trunk/drivers/media/video/cx88/cx88-dvb.c @@ -315,22 +315,15 @@ static struct cx22702_config hauppauge_novat_config = { .demod_address = 0x43, .output_mode = CX22702_SERIAL_OUTPUT, }; - static struct cx22702_config hauppauge_hvr1100_config = { .demod_address = 0x63, .output_mode = CX22702_SERIAL_OUTPUT, }; - static struct cx22702_config hauppauge_hvr1300_config = { .demod_address = 0x63, .output_mode = CX22702_SERIAL_OUTPUT, }; -static struct cx22702_config hauppauge_hvr3000_config = { - .demod_address = 0x63, - .output_mode = CX22702_SERIAL_OUTPUT, -}; - static int or51132_set_ts_param(struct dvb_frontend* fe, int is_punctured) { @@ -565,16 +558,6 @@ static int dvb_register(struct cx8802_dev *dev) &dvb_pll_fmd1216me); } break; - case CX88_BOARD_HAUPPAUGE_HVR3000: - dev->dvb.frontend = dvb_attach(cx22702_attach, - &hauppauge_hvr3000_config, - &dev->core->i2c_adap); - if (dev->dvb.frontend != NULL) { - dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, - &dev->core->i2c_adap, - &dvb_pll_fmd1216me); - } - break; case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS: dev->dvb.frontend = dvb_attach(mt352_attach, &dvico_fusionhdtv, diff --git a/trunk/drivers/media/video/cx88/cx88-input.c b/trunk/drivers/media/video/cx88/cx88-input.c index ee48995a4ab5..83ebf7a3c054 100644 --- a/trunk/drivers/media/video/cx88/cx88-input.c +++ b/trunk/drivers/media/video/cx88/cx88-input.c @@ -196,7 +196,6 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) case CX88_BOARD_HAUPPAUGE_NOVASPLUS_S1: case CX88_BOARD_HAUPPAUGE_HVR1100: case CX88_BOARD_HAUPPAUGE_HVR1300: - case CX88_BOARD_HAUPPAUGE_HVR3000: ir_codes = ir_codes_hauppauge_new; ir_type = IR_TYPE_RC5; ir->sampling = 1; @@ -420,7 +419,6 @@ void cx88_ir_irq(struct cx88_core *core) case CX88_BOARD_HAUPPAUGE_NOVASPLUS_S1: case CX88_BOARD_HAUPPAUGE_HVR1100: case CX88_BOARD_HAUPPAUGE_HVR1300: - case CX88_BOARD_HAUPPAUGE_HVR3000: ircode = ir_decode_biphase(ir->samples, ir->scount, 5, 7); ir_dprintk("biphase decoded: %x\n", ircode); if ((ircode & 0xfffff000) != 0x3000) diff --git a/trunk/drivers/media/video/et61x251/et61x251_core.c b/trunk/drivers/media/video/et61x251/et61x251_core.c index f786ab11d2cd..bc544cc7ccb8 100644 --- a/trunk/drivers/media/video/et61x251/et61x251_core.c +++ b/trunk/drivers/media/video/et61x251/et61x251_core.c @@ -973,32 +973,16 @@ static CLASS_DEVICE_ATTR(i2c_val, S_IRUGO | S_IWUSR, et61x251_show_i2c_val, et61x251_store_i2c_val); -static int et61x251_create_sysfs(struct et61x251_device* cam) +static void et61x251_create_sysfs(struct et61x251_device* cam) { struct video_device *v4ldev = cam->v4ldev; - int rc; - rc = video_device_create_file(v4ldev, &class_device_attr_reg); - if (rc) goto err; - rc = video_device_create_file(v4ldev, &class_device_attr_val); - if (rc) goto err_reg; + video_device_create_file(v4ldev, &class_device_attr_reg); + video_device_create_file(v4ldev, &class_device_attr_val); if (cam->sensor.sysfs_ops) { - rc = video_device_create_file(v4ldev, &class_device_attr_i2c_reg); - if (rc) goto err_val; - rc = video_device_create_file(v4ldev, &class_device_attr_i2c_val); - if (rc) goto err_i2c_reg; + video_device_create_file(v4ldev, &class_device_attr_i2c_reg); + video_device_create_file(v4ldev, &class_device_attr_i2c_val); } - - return 0; - -err_i2c_reg: - video_device_remove_file(v4ldev, &class_device_attr_i2c_reg); -err_val: - video_device_remove_file(v4ldev, &class_device_attr_val); -err_reg: - video_device_remove_file(v4ldev, &class_device_attr_reg); -err: - return rc; } #endif /* CONFIG_VIDEO_ADV_DEBUG */ @@ -2550,9 +2534,7 @@ et61x251_usb_probe(struct usb_interface* intf, const struct usb_device_id* id) dev_nr = (dev_nr < ET61X251_MAX_DEVICES-1) ? dev_nr+1 : 0; #ifdef CONFIG_VIDEO_ADV_DEBUG - err = et61x251_create_sysfs(cam); - if (err) - goto fail2; + et61x251_create_sysfs(cam); DBG(2, "Optional device control through 'sysfs' interface ready"); #endif @@ -2562,13 +2544,6 @@ et61x251_usb_probe(struct usb_interface* intf, const struct usb_device_id* id) return 0; -#ifdef CONFIG_VIDEO_ADV_DEBUG -fail2: - video_nr[dev_nr] = -1; - dev_nr = (dev_nr < ET61X251_MAX_DEVICES-1) ? dev_nr+1 : 0; - mutex_unlock(&cam->dev_mutex); - video_unregister_device(cam->v4ldev); -#endif fail: if (cam) { kfree(cam->control_buffer); diff --git a/trunk/drivers/media/video/ov511.c b/trunk/drivers/media/video/ov511.c index b4db2cbb5a84..ce4886f1528d 100644 --- a/trunk/drivers/media/video/ov511.c +++ b/trunk/drivers/media/video/ov511.c @@ -5648,49 +5648,17 @@ static ssize_t show_exposure(struct class_device *cd, char *buf) } static CLASS_DEVICE_ATTR(exposure, S_IRUGO, show_exposure, NULL); -static int ov_create_sysfs(struct video_device *vdev) +static void ov_create_sysfs(struct video_device *vdev) { - int rc; - - rc = video_device_create_file(vdev, &class_device_attr_custom_id); - if (rc) goto err; - rc = video_device_create_file(vdev, &class_device_attr_model); - if (rc) goto err_id; - rc = video_device_create_file(vdev, &class_device_attr_bridge); - if (rc) goto err_model; - rc = video_device_create_file(vdev, &class_device_attr_sensor); - if (rc) goto err_bridge; - rc = video_device_create_file(vdev, &class_device_attr_brightness); - if (rc) goto err_sensor; - rc = video_device_create_file(vdev, &class_device_attr_saturation); - if (rc) goto err_bright; - rc = video_device_create_file(vdev, &class_device_attr_contrast); - if (rc) goto err_sat; - rc = video_device_create_file(vdev, &class_device_attr_hue); - if (rc) goto err_contrast; - rc = video_device_create_file(vdev, &class_device_attr_exposure); - if (rc) goto err_hue; - - return 0; - -err_hue: - video_device_remove_file(vdev, &class_device_attr_hue); -err_contrast: - video_device_remove_file(vdev, &class_device_attr_contrast); -err_sat: - video_device_remove_file(vdev, &class_device_attr_saturation); -err_bright: - video_device_remove_file(vdev, &class_device_attr_brightness); -err_sensor: - video_device_remove_file(vdev, &class_device_attr_sensor); -err_bridge: - video_device_remove_file(vdev, &class_device_attr_bridge); -err_model: - video_device_remove_file(vdev, &class_device_attr_model); -err_id: - video_device_remove_file(vdev, &class_device_attr_custom_id); -err: - return rc; + video_device_create_file(vdev, &class_device_attr_custom_id); + video_device_create_file(vdev, &class_device_attr_model); + video_device_create_file(vdev, &class_device_attr_bridge); + video_device_create_file(vdev, &class_device_attr_sensor); + video_device_create_file(vdev, &class_device_attr_brightness); + video_device_create_file(vdev, &class_device_attr_saturation); + video_device_create_file(vdev, &class_device_attr_contrast); + video_device_create_file(vdev, &class_device_attr_hue); + video_device_create_file(vdev, &class_device_attr_exposure); } /**************************************************************************** @@ -5849,11 +5817,7 @@ ov51x_probe(struct usb_interface *intf, const struct usb_device_id *id) ov->vdev->minor); usb_set_intfdata(intf, ov); - if (ov_create_sysfs(ov->vdev)) { - err("ov_create_sysfs failed"); - goto error; - } - + ov_create_sysfs(ov->vdev); return 0; error: diff --git a/trunk/drivers/media/video/pwc/pwc-if.c b/trunk/drivers/media/video/pwc/pwc-if.c index 46c114830884..c77b85cf3d80 100644 --- a/trunk/drivers/media/video/pwc/pwc-if.c +++ b/trunk/drivers/media/video/pwc/pwc-if.c @@ -1024,25 +1024,12 @@ static ssize_t show_snapshot_button_status(struct class_device *class_dev, char static CLASS_DEVICE_ATTR(button, S_IRUGO | S_IWUSR, show_snapshot_button_status, NULL); -static int pwc_create_sysfs_files(struct video_device *vdev) +static void pwc_create_sysfs_files(struct video_device *vdev) { struct pwc_device *pdev = video_get_drvdata(vdev); - int rc; - - rc = video_device_create_file(vdev, &class_device_attr_button); - if (rc) - goto err; - if (pdev->features & FEATURE_MOTOR_PANTILT) { - rc = video_device_create_file(vdev,&class_device_attr_pan_tilt); - if (rc) goto err_button; - } - - return 0; - -err_button: - video_device_remove_file(vdev, &class_device_attr_button); -err: - return rc; + if (pdev->features & FEATURE_MOTOR_PANTILT) + video_device_create_file(vdev, &class_device_attr_pan_tilt); + video_device_create_file(vdev, &class_device_attr_button); } static void pwc_remove_sysfs_files(struct video_device *vdev) @@ -1421,7 +1408,7 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id struct usb_device *udev = interface_to_usbdev(intf); struct pwc_device *pdev = NULL; int vendor_id, product_id, type_id; - int i, hint, rc; + int i, hint; int features = 0; int video_nr = -1; /* default: use next available device */ char serial_number[30], *name; @@ -1722,8 +1709,9 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id i = video_register_device(pdev->vdev, VFL_TYPE_GRABBER, video_nr); if (i < 0) { PWC_ERROR("Failed to register as video device (%d).\n", i); - rc = i; - goto err; + video_device_release(pdev->vdev); /* Drip... drip... drip... */ + kfree(pdev); /* Oops, no memory leaks please */ + return -EIO; } else { PWC_INFO("Registered as /dev/video%d.\n", pdev->vdev->minor & 0x3F); @@ -1735,24 +1723,13 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id PWC_DEBUG_PROBE("probe() function returning struct at 0x%p.\n", pdev); usb_set_intfdata (intf, pdev); - rc = pwc_create_sysfs_files(pdev->vdev); - if (rc) - goto err_unreg; + pwc_create_sysfs_files(pdev->vdev); /* Set the leds off */ pwc_set_leds(pdev, 0, 0); pwc_camera_power(pdev, 0); return 0; - -err_unreg: - if (hint < MAX_DEV_HINTS) - device_hint[hint].pdev = NULL; - video_unregister_device(pdev->vdev); -err: - video_device_release(pdev->vdev); /* Drip... drip... drip... */ - kfree(pdev); /* Oops, no memory leaks please */ - return rc; } /* The user janked out the cable... */ diff --git a/trunk/drivers/media/video/saa7115.c b/trunk/drivers/media/video/saa7115.c index c5719f7bd1ac..974179d4d389 100644 --- a/trunk/drivers/media/video/saa7115.c +++ b/trunk/drivers/media/video/saa7115.c @@ -960,8 +960,6 @@ static void saa711x_set_v4lstd(struct i2c_client *client, v4l2_std_id std) reg |= 0x10; } else if (std == V4L2_STD_NTSC_M_JP) { reg |= 0x40; - } else if (std == V4L2_STD_SECAM) { - reg |= 0x50; } saa711x_write(client, R_0E_CHROMA_CNTL_1, reg); } else { diff --git a/trunk/drivers/media/video/saa7134/saa7134-video.c b/trunk/drivers/media/video/saa7134/saa7134-video.c index 830617ea81cc..203302f21827 100644 --- a/trunk/drivers/media/video/saa7134/saa7134-video.c +++ b/trunk/drivers/media/video/saa7134/saa7134-video.c @@ -2248,11 +2248,7 @@ static int radio_do_ioctl(struct inode *inode, struct file *file, t->type = V4L2_TUNER_RADIO; saa7134_i2c_call_clients(dev, VIDIOC_G_TUNER, t); - if (dev->input->amux == TV) { - t->signal = 0xf800 - ((saa_readb(0x581) & 0x1f) << 11); - t->rxsubchans = (saa_readb(0x529) & 0x08) ? - V4L2_TUNER_SUB_STEREO : V4L2_TUNER_SUB_MONO; - } + return 0; } case VIDIOC_S_TUNER: diff --git a/trunk/drivers/media/video/sn9c102/sn9c102_core.c b/trunk/drivers/media/video/sn9c102/sn9c102_core.c index a4702d3c2aca..3e0ff8a78468 100644 --- a/trunk/drivers/media/video/sn9c102/sn9c102_core.c +++ b/trunk/drivers/media/video/sn9c102/sn9c102_core.c @@ -1240,53 +1240,23 @@ static CLASS_DEVICE_ATTR(frame_header, S_IRUGO, sn9c102_show_frame_header, NULL); -static int sn9c102_create_sysfs(struct sn9c102_device* cam) +static void sn9c102_create_sysfs(struct sn9c102_device* cam) { struct video_device *v4ldev = cam->v4ldev; - int rc; - rc = video_device_create_file(v4ldev, &class_device_attr_reg); - if (rc) goto err; - rc = video_device_create_file(v4ldev, &class_device_attr_val); - if (rc) goto err_reg; - rc = video_device_create_file(v4ldev, &class_device_attr_frame_header); - if (rc) goto err_val; - - if (cam->sensor.sysfs_ops) { - rc = video_device_create_file(v4ldev, &class_device_attr_i2c_reg); - if (rc) goto err_frhead; - rc = video_device_create_file(v4ldev, &class_device_attr_i2c_val); - if (rc) goto err_i2c_reg; + video_device_create_file(v4ldev, &class_device_attr_reg); + video_device_create_file(v4ldev, &class_device_attr_val); + video_device_create_file(v4ldev, &class_device_attr_frame_header); + if (cam->bridge == BRIDGE_SN9C101 || cam->bridge == BRIDGE_SN9C102) + video_device_create_file(v4ldev, &class_device_attr_green); + else if (cam->bridge == BRIDGE_SN9C103) { + video_device_create_file(v4ldev, &class_device_attr_blue); + video_device_create_file(v4ldev, &class_device_attr_red); } - - if (cam->bridge == BRIDGE_SN9C101 || cam->bridge == BRIDGE_SN9C102) { - rc = video_device_create_file(v4ldev, &class_device_attr_green); - if (rc) goto err_i2c_val; - } else if (cam->bridge == BRIDGE_SN9C103) { - rc = video_device_create_file(v4ldev, &class_device_attr_blue); - if (rc) goto err_i2c_val; - rc = video_device_create_file(v4ldev, &class_device_attr_red); - if (rc) goto err_blue; + if (cam->sensor.sysfs_ops) { + video_device_create_file(v4ldev, &class_device_attr_i2c_reg); + video_device_create_file(v4ldev, &class_device_attr_i2c_val); } - - return 0; - -err_blue: - video_device_remove_file(v4ldev, &class_device_attr_blue); -err_i2c_val: - if (cam->sensor.sysfs_ops) - video_device_remove_file(v4ldev, &class_device_attr_i2c_val); -err_i2c_reg: - if (cam->sensor.sysfs_ops) - video_device_remove_file(v4ldev, &class_device_attr_i2c_reg); -err_frhead: - video_device_remove_file(v4ldev, &class_device_attr_frame_header); -err_val: - video_device_remove_file(v4ldev, &class_device_attr_val); -err_reg: - video_device_remove_file(v4ldev, &class_device_attr_reg); -err: - return rc; } #endif /* CONFIG_VIDEO_ADV_DEBUG */ @@ -2839,7 +2809,10 @@ sn9c102_usb_probe(struct usb_interface* intf, const struct usb_device_id* id) DBG(1, "V4L2 device registration failed"); if (err == -ENFILE && video_nr[dev_nr] == -1) DBG(1, "Free /dev/videoX node not found"); - goto fail2; + video_nr[dev_nr] = -1; + dev_nr = (dev_nr < SN9C102_MAX_DEVICES-1) ? dev_nr+1 : 0; + mutex_unlock(&cam->dev_mutex); + goto fail; } DBG(2, "V4L2 device registered as /dev/video%d", cam->v4ldev->minor); @@ -2850,9 +2823,7 @@ sn9c102_usb_probe(struct usb_interface* intf, const struct usb_device_id* id) dev_nr = (dev_nr < SN9C102_MAX_DEVICES-1) ? dev_nr+1 : 0; #ifdef CONFIG_VIDEO_ADV_DEBUG - err = sn9c102_create_sysfs(cam); - if (err) - goto fail3; + sn9c102_create_sysfs(cam); DBG(2, "Optional device control through 'sysfs' interface ready"); #endif @@ -2862,14 +2833,6 @@ sn9c102_usb_probe(struct usb_interface* intf, const struct usb_device_id* id) return 0; -#ifdef CONFIG_VIDEO_ADV_DEBUG -fail3: - video_unregister_device(cam->v4ldev); -#endif -fail2: - video_nr[dev_nr] = -1; - dev_nr = (dev_nr < SN9C102_MAX_DEVICES-1) ? dev_nr+1 : 0; - mutex_unlock(&cam->dev_mutex); fail: if (cam) { kfree(cam->control_buffer); diff --git a/trunk/drivers/media/video/stv680.c b/trunk/drivers/media/video/stv680.c index 6d1ef1e2e8ef..87e11300181d 100644 --- a/trunk/drivers/media/video/stv680.c +++ b/trunk/drivers/media/video/stv680.c @@ -516,45 +516,16 @@ stv680_file(frames_read, framecount, "%d\n"); stv680_file(packets_dropped, dropped, "%d\n"); stv680_file(decoding_errors, error, "%d\n"); -static int stv680_create_sysfs_files(struct video_device *vdev) +static void stv680_create_sysfs_files(struct video_device *vdev) { - int rc; - - rc = video_device_create_file(vdev, &class_device_attr_model); - if (rc) goto err; - rc = video_device_create_file(vdev, &class_device_attr_in_use); - if (rc) goto err_model; - rc = video_device_create_file(vdev, &class_device_attr_streaming); - if (rc) goto err_inuse; - rc = video_device_create_file(vdev, &class_device_attr_palette); - if (rc) goto err_stream; - rc = video_device_create_file(vdev, &class_device_attr_frames_total); - if (rc) goto err_pal; - rc = video_device_create_file(vdev, &class_device_attr_frames_read); - if (rc) goto err_framtot; - rc = video_device_create_file(vdev, &class_device_attr_packets_dropped); - if (rc) goto err_framread; - rc = video_device_create_file(vdev, &class_device_attr_decoding_errors); - if (rc) goto err_dropped; - - return 0; - -err_dropped: - video_device_remove_file(vdev, &class_device_attr_packets_dropped); -err_framread: - video_device_remove_file(vdev, &class_device_attr_frames_read); -err_framtot: - video_device_remove_file(vdev, &class_device_attr_frames_total); -err_pal: - video_device_remove_file(vdev, &class_device_attr_palette); -err_stream: - video_device_remove_file(vdev, &class_device_attr_streaming); -err_inuse: - video_device_remove_file(vdev, &class_device_attr_in_use); -err_model: - video_device_remove_file(vdev, &class_device_attr_model); -err: - return rc; + video_device_create_file(vdev, &class_device_attr_model); + video_device_create_file(vdev, &class_device_attr_in_use); + video_device_create_file(vdev, &class_device_attr_streaming); + video_device_create_file(vdev, &class_device_attr_palette); + video_device_create_file(vdev, &class_device_attr_frames_total); + video_device_create_file(vdev, &class_device_attr_frames_read); + video_device_create_file(vdev, &class_device_attr_packets_dropped); + video_device_create_file(vdev, &class_device_attr_decoding_errors); } static void stv680_remove_sysfs_files(struct video_device *vdev) @@ -1447,13 +1418,9 @@ static int stv680_probe (struct usb_interface *intf, const struct usb_device_id PDEBUG (0, "STV(i): registered new video device: video%d", stv680->vdev->minor); usb_set_intfdata (intf, stv680); - retval = stv680_create_sysfs_files(stv680->vdev); - if (retval) - goto error_unreg; + stv680_create_sysfs_files(stv680->vdev); return 0; -error_unreg: - video_unregister_device(stv680->vdev); error_vdev: video_device_release(stv680->vdev); error: diff --git a/trunk/drivers/media/video/tuner-types.c b/trunk/drivers/media/video/tuner-types.c index 781682373b61..8fff642fad56 100644 --- a/trunk/drivers/media/video/tuner-types.c +++ b/trunk/drivers/media/video/tuner-types.c @@ -1046,6 +1046,7 @@ static struct tuner_params tuner_samsung_tcpn_2121p30a_params[] = { .type = TUNER_PARAM_TYPE_NTSC, .ranges = tuner_samsung_tcpn_2121p30a_ntsc_ranges, .count = ARRAY_SIZE(tuner_samsung_tcpn_2121p30a_ntsc_ranges), + .has_tda9887 = 1, }, }; diff --git a/trunk/drivers/media/video/videodev.c b/trunk/drivers/media/video/videodev.c index d424a4129d69..479a0675cf60 100644 --- a/trunk/drivers/media/video/videodev.c +++ b/trunk/drivers/media/video/videodev.c @@ -17,11 +17,10 @@ */ #define dbgarg(cmd, fmt, arg...) \ - if (vfd->debug & V4L2_DEBUG_IOCTL_ARG) { \ + if (vfd->debug & V4L2_DEBUG_IOCTL_ARG) \ printk (KERN_DEBUG "%s: ", vfd->name); \ v4l_printk_ioctl(cmd); \ - printk (KERN_DEBUG "%s: " fmt, vfd->name, ## arg); \ - } + printk (KERN_DEBUG "%s: " fmt, vfd->name, ## arg); #define dbgarg2(fmt, arg...) \ if (vfd->debug & V4L2_DEBUG_IOCTL_ARG) \ @@ -1288,7 +1287,6 @@ static int __video_do_ioctl(struct inode *inode, struct file *file, ret=vfd->vidioc_g_parm(file, fh, p); } else { struct v4l2_standard s; - int i; if (!vfd->tvnormsize) { printk (KERN_WARNING "%s: no TV norms defined!\n", @@ -1299,14 +1297,8 @@ static int __video_do_ioctl(struct inode *inode, struct file *file, if (p->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) return -EINVAL; - for (i = 0; i < vfd->tvnormsize; i++) - if (vfd->tvnorms[i].id == vfd->current_norm) - break; - if (i >= vfd->tvnormsize) - return -EINVAL; - - v4l2_video_std_construct(&s, vfd->current_norm, - vfd->tvnorms[i].name); + v4l2_video_std_construct(&s, vfd->tvnorms[vfd->current_norm].id, + vfd->tvnorms[vfd->current_norm].name); memset(p,0,sizeof(*p)); diff --git a/trunk/drivers/media/video/vivi.c b/trunk/drivers/media/video/vivi.c index 3c8dc72dc8e9..e7c01d560b64 100644 --- a/trunk/drivers/media/video/vivi.c +++ b/trunk/drivers/media/video/vivi.c @@ -272,7 +272,7 @@ static void gen_line(struct sg_to_addr to_addr[],int inipos,int pages,int wmax, /* Get first addr pointed to pixel position */ oldpg=get_addr_pos(pos,pages,to_addr); - pg=pfn_to_page(sg_dma_address(to_addr[oldpg].sg) >> PAGE_SHIFT); + pg=pfn_to_page(to_addr[oldpg].sg->dma_address >> PAGE_SHIFT); basep = kmap_atomic(pg, KM_BOUNCE_READ)+to_addr[oldpg].sg->offset; /* We will just duplicate the second pixel at the packet */ @@ -287,7 +287,7 @@ static void gen_line(struct sg_to_addr to_addr[],int inipos,int pages,int wmax, for (color=0;color<4;color++) { pgpos=get_addr_pos(pos,pages,to_addr); if (pgpos!=oldpg) { - pg=pfn_to_page(sg_dma_address(to_addr[pgpos].sg) >> PAGE_SHIFT); + pg=pfn_to_page(to_addr[pgpos].sg->dma_address >> PAGE_SHIFT); kunmap_atomic(basep, KM_BOUNCE_READ); basep= kmap_atomic(pg, KM_BOUNCE_READ)+to_addr[pgpos].sg->offset; oldpg=pgpos; @@ -339,8 +339,8 @@ static void gen_line(struct sg_to_addr to_addr[],int inipos,int pages,int wmax, for (color=0;color<4;color++) { pgpos=get_addr_pos(pos,pages,to_addr); if (pgpos!=oldpg) { - pg=pfn_to_page(sg_dma_address( - to_addr[pgpos].sg) + pg=pfn_to_page(to_addr[pgpos]. + sg->dma_address >> PAGE_SHIFT); kunmap_atomic(basep, KM_BOUNCE_READ); @@ -386,7 +386,7 @@ static void vivi_fillbuff(struct vivi_dev *dev,struct vivi_buffer *buf) struct timeval ts; /* Test if DMA mapping is ready */ - if (!sg_dma_address(&vb->dma.sglist[0])) + if (!vb->dma.sglist[0].dma_address) return; prep_to_addr(to_addr,vb); @@ -783,7 +783,7 @@ static int vivi_map_sg(void *dev, struct scatterlist *sg, int nents, for (i = 0; i < nents; i++ ) { BUG_ON(!sg[i].page); - sg_dma_address(&sg[i]) = page_to_phys(sg[i].page) + sg[i].offset; + sg[i].dma_address = page_to_phys(sg[i].page) + sg[i].offset; } return nents; diff --git a/trunk/drivers/message/i2o/bus-osm.c b/trunk/drivers/message/i2o/bus-osm.c index d96c687aee93..ac06f10c54ec 100644 --- a/trunk/drivers/message/i2o/bus-osm.c +++ b/trunk/drivers/message/i2o/bus-osm.c @@ -80,26 +80,18 @@ static DEVICE_ATTR(scan, S_IWUSR, NULL, i2o_bus_store_scan); * @dev: device to verify if it is a I2O Bus Adapter device * * Because we want all Bus Adapters always return 0. - * Except when we fail. Then we are sad. * - * Returns 0, except when we fail to excel. + * Returns 0. */ static int i2o_bus_probe(struct device *dev) { struct i2o_device *i2o_dev = to_i2o_device(get_device(dev)); - int rc; - rc = device_create_file(dev, &dev_attr_scan); - if (rc) - goto err_out; + device_create_file(dev, &dev_attr_scan); osm_info("device added (TID: %03x)\n", i2o_dev->lct_data.tid); return 0; - -err_out: - put_device(dev); - return rc; }; /** diff --git a/trunk/drivers/message/i2o/exec-osm.c b/trunk/drivers/message/i2o/exec-osm.c index 91f95d172ca5..7bd4d85d0b42 100644 --- a/trunk/drivers/message/i2o/exec-osm.c +++ b/trunk/drivers/message/i2o/exec-osm.c @@ -325,24 +325,13 @@ static DEVICE_ATTR(product_id, S_IRUGO, i2o_exec_show_product_id, NULL); static int i2o_exec_probe(struct device *dev) { struct i2o_device *i2o_dev = to_i2o_device(dev); - int rc; - rc = i2o_event_register(i2o_dev, &i2o_exec_driver, 0, 0xffffffff); - if (rc) goto err_out; + i2o_event_register(i2o_dev, &i2o_exec_driver, 0, 0xffffffff); - rc = device_create_file(dev, &dev_attr_vendor_id); - if (rc) goto err_evtreg; - rc = device_create_file(dev, &dev_attr_product_id); - if (rc) goto err_vid; + device_create_file(dev, &dev_attr_vendor_id); + device_create_file(dev, &dev_attr_product_id); return 0; - -err_vid: - device_remove_file(dev, &dev_attr_vendor_id); -err_evtreg: - i2o_event_register(to_i2o_device(dev), &i2o_exec_driver, 0, 0); -err_out: - return rc; }; /** diff --git a/trunk/drivers/misc/Kconfig b/trunk/drivers/misc/Kconfig index b6c045dc97b4..3df0e7a07c46 100644 --- a/trunk/drivers/misc/Kconfig +++ b/trunk/drivers/misc/Kconfig @@ -28,17 +28,6 @@ config IBM_ASM If unsure, say N. -config SGI_IOC4 - tristate "SGI IOC4 Base IO support" - ---help--- - This option enables basic support for the IOC4 chip on certain - SGI IO controller cards (IO9, IO10, and PCI-RT). This option - does not enable any specific functions on such a card, but provides - necessary infrastructure for other drivers to utilize. - - If you have an SGI Altix with an IOC4-based card say Y. - Otherwise say N. - config TIFM_CORE tristate "TI Flash Media interface support (EXPERIMENTAL)" depends on EXPERIMENTAL @@ -68,23 +57,4 @@ config TIFM_7XX1 To compile this driver as a module, choose M here: the module will be called tifm_7xx1. -config MSI_LAPTOP - tristate "MSI Laptop Extras" - depends on X86 - depends on ACPI_EC - depends on BACKLIGHT_CLASS_DEVICE - ---help--- - This is a driver for laptops built by MSI (MICRO-STAR - INTERNATIONAL): - - MSI MegaBook S270 (MS-1013) - Cytron/TCM/Medion/Tchibo MD96100/SAM2000 - - It adds support for Bluetooth, WLAN and LCD brightness control. - - More information about this driver is available at - . - - If you have an MSI S270 laptop, say Y or M here. - endmenu diff --git a/trunk/drivers/misc/Makefile b/trunk/drivers/misc/Makefile index c9e98ab021c5..d65ece76095a 100644 --- a/trunk/drivers/misc/Makefile +++ b/trunk/drivers/misc/Makefile @@ -5,8 +5,6 @@ obj- := misc.o # Dummy rule to force built-in.o to be made obj-$(CONFIG_IBM_ASM) += ibmasm/ obj-$(CONFIG_HDPU_FEATURES) += hdpuftrs/ -obj-$(CONFIG_MSI_LAPTOP) += msi-laptop.o obj-$(CONFIG_LKDTM) += lkdtm.o obj-$(CONFIG_TIFM_CORE) += tifm_core.o obj-$(CONFIG_TIFM_7XX1) += tifm_7xx1.o -obj-$(CONFIG_SGI_IOC4) += ioc4.o diff --git a/trunk/drivers/misc/msi-laptop.c b/trunk/drivers/misc/msi-laptop.c deleted file mode 100644 index fdb7153f4426..000000000000 --- a/trunk/drivers/misc/msi-laptop.c +++ /dev/null @@ -1,395 +0,0 @@ -/*-*-linux-c-*-*/ - -/* - Copyright (C) 2006 Lennart Poettering - - 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 - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. - */ - -/* - * msi-laptop.c - MSI S270 laptop support. This laptop is sold under - * various brands, including "Cytron/TCM/Medion/Tchibo MD96100". - * - * This driver exports a few files in /sys/devices/platform/msi-laptop-pf/: - * - * lcd_level - Screen brightness: contains a single integer in the - * range 0..8. (rw) - * - * auto_brightness - Enable automatic brightness control: contains - * either 0 or 1. If set to 1 the hardware adjusts the screen - * brightness automatically when the power cord is - * plugged/unplugged. (rw) - * - * wlan - WLAN subsystem enabled: contains either 0 or 1. (ro) - * - * bluetooth - Bluetooth subsystem enabled: contains either 0 or 1 - * Please note that this file is constantly 0 if no Bluetooth - * hardware is available. (ro) - * - * In addition to these platform device attributes the driver - * registers itself in the Linux backlight control subsystem and is - * available to userspace under /sys/class/backlight/msi-laptop-bl/. - * - * This driver might work on other laptops produced by MSI. If you - * want to try it you can pass force=1 as argument to the module which - * will force it to load even when the DMI data doesn't identify the - * laptop as MSI S270. YMMV. - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#define MSI_DRIVER_VERSION "0.5" - -#define MSI_LCD_LEVEL_MAX 9 - -#define MSI_EC_COMMAND_WIRELESS 0x10 -#define MSI_EC_COMMAND_LCD_LEVEL 0x11 - -static int force; -module_param(force, bool, 0); -MODULE_PARM_DESC(force, "Force driver load, ignore DMI data"); - -static int auto_brightness; -module_param(auto_brightness, int, 0); -MODULE_PARM_DESC(auto_brightness, "Enable automatic brightness control (0: disabled; 1: enabled; 2: don't touch)"); - -/* Hardware access */ - -static int set_lcd_level(int level) -{ - u8 buf[2]; - - if (level < 0 || level >= MSI_LCD_LEVEL_MAX) - return -EINVAL; - - buf[0] = 0x80; - buf[1] = (u8) (level*31); - - return ec_transaction(MSI_EC_COMMAND_LCD_LEVEL, buf, sizeof(buf), NULL, 0); -} - -static int get_lcd_level(void) -{ - u8 wdata = 0, rdata; - int result; - - result = ec_transaction(MSI_EC_COMMAND_LCD_LEVEL, &wdata, 1, &rdata, 1); - if (result < 0) - return result; - - return (int) rdata / 31; -} - -static int get_auto_brightness(void) -{ - u8 wdata = 4, rdata; - int result; - - result = ec_transaction(MSI_EC_COMMAND_LCD_LEVEL, &wdata, 1, &rdata, 1); - if (result < 0) - return result; - - return !!(rdata & 8); -} - -static int set_auto_brightness(int enable) -{ - u8 wdata[2], rdata; - int result; - - wdata[0] = 4; - - result = ec_transaction(MSI_EC_COMMAND_LCD_LEVEL, wdata, 1, &rdata, 1); - if (result < 0) - return result; - - wdata[0] = 0x84; - wdata[1] = (rdata & 0xF7) | (enable ? 8 : 0); - - return ec_transaction(MSI_EC_COMMAND_LCD_LEVEL, wdata, 2, NULL, 0); -} - -static int get_wireless_state(int *wlan, int *bluetooth) -{ - u8 wdata = 0, rdata; - int result; - - result = ec_transaction(MSI_EC_COMMAND_WIRELESS, &wdata, 1, &rdata, 1); - if (result < 0) - return -1; - - if (wlan) - *wlan = !!(rdata & 8); - - if (bluetooth) - *bluetooth = !!(rdata & 128); - - return 0; -} - -/* Backlight device stuff */ - -static int bl_get_brightness(struct backlight_device *b) -{ - return get_lcd_level(); -} - - -static int bl_update_status(struct backlight_device *b) -{ - return set_lcd_level(b->props->brightness); -} - -static struct backlight_properties msibl_props = { - .owner = THIS_MODULE, - .get_brightness = bl_get_brightness, - .update_status = bl_update_status, - .max_brightness = MSI_LCD_LEVEL_MAX-1, -}; - -static struct backlight_device *msibl_device; - -/* Platform device */ - -static ssize_t show_wlan(struct device *dev, - struct device_attribute *attr, char *buf) -{ - - int ret, enabled; - - ret = get_wireless_state(&enabled, NULL); - if (ret < 0) - return ret; - - return sprintf(buf, "%i\n", enabled); -} - -static ssize_t show_bluetooth(struct device *dev, - struct device_attribute *attr, char *buf) -{ - - int ret, enabled; - - ret = get_wireless_state(NULL, &enabled); - if (ret < 0) - return ret; - - return sprintf(buf, "%i\n", enabled); -} - -static ssize_t show_lcd_level(struct device *dev, - struct device_attribute *attr, char *buf) -{ - - int ret; - - ret = get_lcd_level(); - if (ret < 0) - return ret; - - return sprintf(buf, "%i\n", ret); -} - -static ssize_t store_lcd_level(struct device *dev, - struct device_attribute *attr, const char *buf, size_t count) -{ - - int level, ret; - - if (sscanf(buf, "%i", &level) != 1 || (level < 0 || level >= MSI_LCD_LEVEL_MAX)) - return -EINVAL; - - ret = set_lcd_level(level); - if (ret < 0) - return ret; - - return count; -} - -static ssize_t show_auto_brightness(struct device *dev, - struct device_attribute *attr, char *buf) -{ - - int ret; - - ret = get_auto_brightness(); - if (ret < 0) - return ret; - - return sprintf(buf, "%i\n", ret); -} - -static ssize_t store_auto_brightness(struct device *dev, - struct device_attribute *attr, const char *buf, size_t count) -{ - - int enable, ret; - - if (sscanf(buf, "%i", &enable) != 1 || (enable != (enable & 1))) - return -EINVAL; - - ret = set_auto_brightness(enable); - if (ret < 0) - return ret; - - return count; -} - -static DEVICE_ATTR(lcd_level, 0644, show_lcd_level, store_lcd_level); -static DEVICE_ATTR(auto_brightness, 0644, show_auto_brightness, store_auto_brightness); -static DEVICE_ATTR(bluetooth, 0444, show_bluetooth, NULL); -static DEVICE_ATTR(wlan, 0444, show_wlan, NULL); - -static struct attribute *msipf_attributes[] = { - &dev_attr_lcd_level.attr, - &dev_attr_auto_brightness.attr, - &dev_attr_bluetooth.attr, - &dev_attr_wlan.attr, - NULL -}; - -static struct attribute_group msipf_attribute_group = { - .attrs = msipf_attributes -}; - -static struct platform_driver msipf_driver = { - .driver = { - .name = "msi-laptop-pf", - .owner = THIS_MODULE, - } -}; - -static struct platform_device *msipf_device; - -/* Initialization */ - -static struct dmi_system_id __initdata msi_dmi_table[] = { - { - .ident = "MSI S270", - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "MICRO-STAR INT'L CO.,LTD"), - DMI_MATCH(DMI_PRODUCT_NAME, "MS-1013"), - } - }, - { - .ident = "Medion MD96100", - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "NOTEBOOK"), - DMI_MATCH(DMI_PRODUCT_NAME, "SAM2000"), - } - }, - { } -}; - - -static int __init msi_init(void) -{ - int ret; - - if (acpi_disabled) - return -ENODEV; - - if (!force && !dmi_check_system(msi_dmi_table)) - return -ENODEV; - - if (auto_brightness < 0 || auto_brightness > 2) - return -EINVAL; - - /* Register backlight stuff */ - - msibl_device = backlight_device_register("msi-laptop-bl", NULL, &msibl_props); - if (IS_ERR(msibl_device)) - return PTR_ERR(msibl_device); - - ret = platform_driver_register(&msipf_driver); - if (ret) - goto fail_backlight; - - /* Register platform stuff */ - - msipf_device = platform_device_alloc("msi-laptop-pf", -1); - if (!msipf_device) { - ret = -ENOMEM; - goto fail_platform_driver; - } - - ret = platform_device_add(msipf_device); - if (ret) - goto fail_platform_device1; - - ret = sysfs_create_group(&msipf_device->dev.kobj, &msipf_attribute_group); - if (ret) - goto fail_platform_device2; - - /* Disable automatic brightness control by default because - * this module was probably loaded to do brightness control in - * software. */ - - if (auto_brightness != 2) - set_auto_brightness(auto_brightness); - - printk(KERN_INFO "msi-laptop: driver "MSI_DRIVER_VERSION" successfully loaded.\n"); - - return 0; - -fail_platform_device2: - - platform_device_del(msipf_device); - -fail_platform_device1: - - platform_device_put(msipf_device); - -fail_platform_driver: - - platform_driver_unregister(&msipf_driver); - -fail_backlight: - - backlight_device_unregister(msibl_device); - - return ret; -} - -static void __exit msi_cleanup(void) -{ - - sysfs_remove_group(&msipf_device->dev.kobj, &msipf_attribute_group); - platform_device_unregister(msipf_device); - platform_driver_unregister(&msipf_driver); - backlight_device_unregister(msibl_device); - - /* Enable automatic brightness control again */ - if (auto_brightness != 2) - set_auto_brightness(1); - - printk(KERN_INFO "msi-laptop: driver unloaded.\n"); -} - -module_init(msi_init); -module_exit(msi_cleanup); - -MODULE_AUTHOR("Lennart Poettering"); -MODULE_DESCRIPTION("MSI Laptop Support"); -MODULE_VERSION(MSI_DRIVER_VERSION); -MODULE_LICENSE("GPL"); diff --git a/trunk/drivers/net/sky2.c b/trunk/drivers/net/sky2.c index 67ecd66f26d6..c10e7f5faa5f 100644 --- a/trunk/drivers/net/sky2.c +++ b/trunk/drivers/net/sky2.c @@ -50,7 +50,7 @@ #include "sky2.h" #define DRV_NAME "sky2" -#define DRV_VERSION "1.10" +#define DRV_VERSION "1.9" #define PFX DRV_NAME " " /* @@ -96,9 +96,9 @@ static int disable_msi = 0; module_param(disable_msi, int, 0); MODULE_PARM_DESC(disable_msi, "Disable Message Signaled Interrupt (MSI)"); -static int idle_timeout = 0; +static int idle_timeout = 100; module_param(idle_timeout, int, 0); -MODULE_PARM_DESC(idle_timeout, "Watchdog timer for lost interrupts (ms)"); +MODULE_PARM_DESC(idle_timeout, "Idle timeout workaround for lost interrupts (ms)"); static const struct pci_device_id sky2_id_table[] = { { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, 0x9000) }, @@ -284,31 +284,6 @@ static void sky2_gmac_reset(struct sky2_hw *hw, unsigned port) gma_write16(hw, port, GM_RX_CTRL, reg); } -/* flow control to advertise bits */ -static const u16 copper_fc_adv[] = { - [FC_NONE] = 0, - [FC_TX] = PHY_M_AN_ASP, - [FC_RX] = PHY_M_AN_PC, - [FC_BOTH] = PHY_M_AN_PC | PHY_M_AN_ASP, -}; - -/* flow control to advertise bits when using 1000BaseX */ -static const u16 fiber_fc_adv[] = { - [FC_BOTH] = PHY_M_P_BOTH_MD_X, - [FC_TX] = PHY_M_P_ASYM_MD_X, - [FC_RX] = PHY_M_P_SYM_MD_X, - [FC_NONE] = PHY_M_P_NO_PAUSE_X, -}; - -/* flow control to GMA disable bits */ -static const u16 gm_fc_disable[] = { - [FC_NONE] = GM_GPCR_FC_RX_DIS | GM_GPCR_FC_TX_DIS, - [FC_TX] = GM_GPCR_FC_RX_DIS, - [FC_RX] = GM_GPCR_FC_TX_DIS, - [FC_BOTH] = 0, -}; - - static void sky2_phy_init(struct sky2_hw *hw, unsigned port) { struct sky2_port *sky2 = netdev_priv(hw->dev[port]); @@ -381,7 +356,16 @@ static void sky2_phy_init(struct sky2_hw *hw, unsigned port) gm_phy_write(hw, port, PHY_MARV_EXT_ADR, pg); } - ctrl = PHY_CT_RESET; + ctrl = gm_phy_read(hw, port, PHY_MARV_CTRL); + if (sky2->autoneg == AUTONEG_DISABLE) + ctrl &= ~PHY_CT_ANE; + else + ctrl |= PHY_CT_ANE; + + ctrl |= PHY_CT_RESET; + gm_phy_write(hw, port, PHY_MARV_CTRL, ctrl); + + ctrl = 0; ct1000 = 0; adv = PHY_AN_CSMA; reg = 0; @@ -400,17 +384,21 @@ static void sky2_phy_init(struct sky2_hw *hw, unsigned port) adv |= PHY_M_AN_10_FD; if (sky2->advertising & ADVERTISED_10baseT_Half) adv |= PHY_M_AN_10_HD; - - adv |= copper_fc_adv[sky2->flow_mode]; } else { /* special defines for FIBER (88E1040S only) */ if (sky2->advertising & ADVERTISED_1000baseT_Full) adv |= PHY_M_AN_1000X_AFD; if (sky2->advertising & ADVERTISED_1000baseT_Half) adv |= PHY_M_AN_1000X_AHD; - - adv |= fiber_fc_adv[sky2->flow_mode]; } + /* Set Flow-control capabilities */ + if (sky2->tx_pause && sky2->rx_pause) + adv |= PHY_AN_PAUSE_CAP; /* symmetric */ + else if (sky2->rx_pause && !sky2->tx_pause) + adv |= PHY_AN_PAUSE_ASYM | PHY_AN_PAUSE_CAP; + else if (!sky2->rx_pause && sky2->tx_pause) + adv |= PHY_AN_PAUSE_ASYM; /* local */ + /* Restart Auto-negotiation */ ctrl |= PHY_CT_ANE | PHY_CT_RE_CFG; } else { @@ -434,17 +422,25 @@ static void sky2_phy_init(struct sky2_hw *hw, unsigned port) if (sky2->duplex == DUPLEX_FULL) { reg |= GM_GPCR_DUP_FULL; ctrl |= PHY_CT_DUP_MD; - } else if (sky2->speed < SPEED_1000) - sky2->flow_mode = FC_NONE; + } else if (sky2->speed != SPEED_1000 && hw->chip_id != CHIP_ID_YUKON_EC_U) { + /* Turn off flow control for 10/100mbps */ + sky2->rx_pause = 0; + sky2->tx_pause = 0; + } + if (!sky2->rx_pause) + reg |= GM_GPCR_FC_RX_DIS; - reg |= gm_fc_disable[sky2->flow_mode]; + if (!sky2->tx_pause) + reg |= GM_GPCR_FC_TX_DIS; /* Forward pause packets to GMAC? */ - if (sky2->flow_mode & FC_RX) + if (sky2->tx_pause || sky2->rx_pause) sky2_write8(hw, SK_REG(port, GMAC_CTRL), GMC_PAUSE_ON); else sky2_write8(hw, SK_REG(port, GMAC_CTRL), GMC_PAUSE_OFF); + + ctrl |= PHY_CT_RESET; } gma_write16(hw, port, GM_GP_CTRL, reg); @@ -1503,11 +1499,6 @@ static int sky2_down(struct net_device *dev) /* Stop more packets from being queued */ netif_stop_queue(dev); - /* Disable port IRQ */ - imask = sky2_read32(hw, B0_IMSK); - imask &= ~portirq_msk[port]; - sky2_write32(hw, B0_IMSK, imask); - sky2_gmac_reset(hw, port); /* Stop transmitter */ @@ -1558,6 +1549,11 @@ static int sky2_down(struct net_device *dev) sky2_write8(hw, SK_REG(port, RX_GMF_CTRL_T), GMF_RST_SET); sky2_write8(hw, SK_REG(port, TX_GMF_CTRL_T), GMF_RST_SET); + /* Disable port IRQ */ + imask = sky2_read32(hw, B0_IMSK); + imask &= ~portirq_msk[port]; + sky2_write32(hw, B0_IMSK, imask); + sky2_phy_power(hw, port, 0); /* turn off LED's */ @@ -1609,12 +1605,6 @@ static void sky2_link_up(struct sky2_port *sky2) struct sky2_hw *hw = sky2->hw; unsigned port = sky2->port; u16 reg; - static const char *fc_name[] = { - [FC_NONE] = "none", - [FC_TX] = "tx", - [FC_RX] = "rx", - [FC_BOTH] = "both", - }; /* enable Rx/Tx */ reg = gma_read16(hw, port, GM_GP_CTRL); @@ -1658,7 +1648,8 @@ static void sky2_link_up(struct sky2_port *sky2) "%s: Link is up at %d Mbps, %s duplex, flow control %s\n", sky2->netdev->name, sky2->speed, sky2->duplex == DUPLEX_FULL ? "full" : "half", - fc_name[sky2->flow_status]); + (sky2->tx_pause && sky2->rx_pause) ? "both" : + sky2->tx_pause ? "tx" : sky2->rx_pause ? "rx" : "none"); } static void sky2_link_down(struct sky2_port *sky2) @@ -1673,7 +1664,7 @@ static void sky2_link_down(struct sky2_port *sky2) reg &= ~(GM_GPCR_RX_ENA | GM_GPCR_TX_ENA); gma_write16(hw, port, GM_GP_CTRL, reg); - if (sky2->flow_status == FC_RX) { + if (sky2->rx_pause && !sky2->tx_pause) { /* restore Asymmetric Pause bit */ gm_phy_write(hw, port, PHY_MARV_AUNE_ADV, gm_phy_read(hw, port, PHY_MARV_AUNE_ADV) @@ -1692,14 +1683,6 @@ static void sky2_link_down(struct sky2_port *sky2) sky2_phy_init(hw, port); } -static enum flow_control sky2_flow(int rx, int tx) -{ - if (rx) - return tx ? FC_BOTH : FC_RX; - else - return tx ? FC_TX : FC_NONE; -} - static int sky2_autoneg_done(struct sky2_port *sky2, u16 aux) { struct sky2_hw *hw = sky2->hw; @@ -1720,20 +1703,39 @@ static int sky2_autoneg_done(struct sky2_port *sky2, u16 aux) } sky2->speed = sky2_phy_speed(hw, aux); - sky2->duplex = (aux & PHY_M_PS_FULL_DUP) ? DUPLEX_FULL : DUPLEX_HALF; + if (sky2->speed == SPEED_1000) { + u16 ctl2 = gm_phy_read(hw, port, PHY_MARV_1000T_CTRL); + u16 lpa2 = gm_phy_read(hw, port, PHY_MARV_1000T_STAT); + if (lpa2 & PHY_B_1000S_MSF) { + printk(KERN_ERR PFX "%s: master/slave fault", + sky2->netdev->name); + return -1; + } + + if ((ctl2 & PHY_M_1000C_AFD) && (lpa2 & PHY_B_1000S_LP_FD)) + sky2->duplex = DUPLEX_FULL; + else + sky2->duplex = DUPLEX_HALF; + } else { + u16 adv = gm_phy_read(hw, port, PHY_MARV_AUNE_ADV); + if ((aux & adv) & PHY_AN_FULL) + sky2->duplex = DUPLEX_FULL; + else + sky2->duplex = DUPLEX_HALF; + } /* Pause bits are offset (9..8) */ if (hw->chip_id == CHIP_ID_YUKON_XL || hw->chip_id == CHIP_ID_YUKON_EC_U) aux >>= 6; - sky2->flow_status = sky2_flow(aux & PHY_M_PS_RX_P_EN, - aux & PHY_M_PS_TX_P_EN); + sky2->rx_pause = (aux & PHY_M_PS_RX_P_EN) != 0; + sky2->tx_pause = (aux & PHY_M_PS_TX_P_EN) != 0; - if (sky2->duplex == DUPLEX_HALF && sky2->speed < SPEED_1000 + if (sky2->duplex == DUPLEX_HALF && sky2->speed != SPEED_1000 && hw->chip_id != CHIP_ID_YUKON_EC_U) - sky2->flow_status = FC_NONE; + sky2->rx_pause = sky2->tx_pause = 0; - if (aux & PHY_M_PS_RX_P_EN) + if (sky2->rx_pause || sky2->tx_pause) sky2_write8(hw, SK_REG(port, GMAC_CTRL), GMC_PAUSE_ON); else sky2_write8(hw, SK_REG(port, GMAC_CTRL), GMC_PAUSE_OFF); @@ -1748,13 +1750,13 @@ static void sky2_phy_intr(struct sky2_hw *hw, unsigned port) struct sky2_port *sky2 = netdev_priv(dev); u16 istatus, phystat; - if (!netif_running(dev)) - return; - spin_lock(&sky2->phy_lock); istatus = gm_phy_read(hw, port, PHY_MARV_INT_STAT); phystat = gm_phy_read(hw, port, PHY_MARV_PHY_STAT); + if (!netif_running(dev)) + goto out; + if (netif_msg_intr(sky2)) printk(KERN_INFO PFX "%s: phy interrupt status 0x%x 0x%x\n", sky2->netdev->name, istatus, phystat); @@ -2014,10 +2016,6 @@ static struct sk_buff *sky2_receive(struct net_device *dev, error: ++sky2->net_stats.rx_errors; - if (status & GMR_FS_RX_FF_OV) { - sky2->net_stats.rx_fifo_errors++; - goto resubmit; - } if (netif_msg_rx_err(sky2) && net_ratelimit()) printk(KERN_INFO PFX "%s: rx error, status 0x%x length %d\n", @@ -2029,6 +2027,8 @@ static struct sk_buff *sky2_receive(struct net_device *dev, sky2->net_stats.rx_frame_errors++; if (status & GMR_FS_CRC_ERR) sky2->net_stats.rx_crc_errors++; + if (status & GMR_FS_RX_FF_OV) + sky2->net_stats.rx_fifo_errors++; goto resubmit; } @@ -2748,7 +2748,7 @@ static int sky2_nway_reset(struct net_device *dev) { struct sky2_port *sky2 = netdev_priv(dev); - if (!netif_running(dev) || sky2->autoneg != AUTONEG_ENABLE) + if (sky2->autoneg != AUTONEG_ENABLE) return -EINVAL; sky2_phy_reinit(sky2); @@ -2850,14 +2850,6 @@ static int sky2_set_mac_address(struct net_device *dev, void *p) return 0; } -static void inline sky2_add_filter(u8 filter[8], const u8 *addr) -{ - u32 bit; - - bit = ether_crc(ETH_ALEN, addr) & 63; - filter[bit >> 3] |= 1 << (bit & 7); -} - static void sky2_set_multicast(struct net_device *dev) { struct sky2_port *sky2 = netdev_priv(dev); @@ -2866,10 +2858,7 @@ static void sky2_set_multicast(struct net_device *dev) struct dev_mc_list *list = dev->mc_list; u16 reg; u8 filter[8]; - int rx_pause; - static const u8 pause_mc_addr[ETH_ALEN] = { 0x1, 0x80, 0xc2, 0x0, 0x0, 0x1 }; - rx_pause = (sky2->flow_status == FC_RX || sky2->flow_status == FC_BOTH); memset(filter, 0, sizeof(filter)); reg = gma_read16(hw, port, GM_RX_CTRL); @@ -2877,19 +2866,18 @@ static void sky2_set_multicast(struct net_device *dev) if (dev->flags & IFF_PROMISC) /* promiscuous */ reg &= ~(GM_RXCR_UCF_ENA | GM_RXCR_MCF_ENA); - else if (dev->flags & IFF_ALLMULTI) + else if ((dev->flags & IFF_ALLMULTI) || dev->mc_count > 16) /* all multicast */ memset(filter, 0xff, sizeof(filter)); - else if (dev->mc_count == 0 && !rx_pause) + else if (dev->mc_count == 0) /* no multicast */ reg &= ~GM_RXCR_MCF_ENA; else { int i; reg |= GM_RXCR_MCF_ENA; - if (rx_pause) - sky2_add_filter(filter, pause_mc_addr); - - for (i = 0; list && i < dev->mc_count; i++, list = list->next) - sky2_add_filter(filter, list->dmi_addr); + for (i = 0; list && i < dev->mc_count; i++, list = list->next) { + u32 bit = ether_crc(ETH_ALEN, list->dmi_addr) & 0x3f; + filter[bit / 8] |= 1 << (bit % 8); + } } gma_write16(hw, port, GM_MC_ADDR_H1, @@ -3002,20 +2990,8 @@ static void sky2_get_pauseparam(struct net_device *dev, { struct sky2_port *sky2 = netdev_priv(dev); - switch (sky2->flow_mode) { - case FC_NONE: - ecmd->tx_pause = ecmd->rx_pause = 0; - break; - case FC_TX: - ecmd->tx_pause = 1, ecmd->rx_pause = 0; - break; - case FC_RX: - ecmd->tx_pause = 0, ecmd->rx_pause = 1; - break; - case FC_BOTH: - ecmd->tx_pause = ecmd->rx_pause = 1; - } - + ecmd->tx_pause = sky2->tx_pause; + ecmd->rx_pause = sky2->rx_pause; ecmd->autoneg = sky2->autoneg; } @@ -3025,10 +3001,10 @@ static int sky2_set_pauseparam(struct net_device *dev, struct sky2_port *sky2 = netdev_priv(dev); sky2->autoneg = ecmd->autoneg; - sky2->flow_mode = sky2_flow(ecmd->rx_pause, ecmd->tx_pause); + sky2->tx_pause = ecmd->tx_pause != 0; + sky2->rx_pause = ecmd->rx_pause != 0; - if (netif_running(dev)) - sky2_phy_reinit(sky2); + sky2_phy_reinit(sky2); return 0; } @@ -3258,8 +3234,8 @@ static __devinit struct net_device *sky2_init_netdev(struct sky2_hw *hw, /* Auto speed and flow control */ sky2->autoneg = AUTONEG_ENABLE; - sky2->flow_mode = FC_BOTH; - + sky2->tx_pause = 1; + sky2->rx_pause = 1; sky2->duplex = -1; sky2->speed = -1; sky2->advertising = sky2_supported_modes(hw); @@ -3350,8 +3326,9 @@ static int __devinit sky2_test_msi(struct sky2_hw *hw) if (!hw->msi_detected) { /* MSI test failed, go back to INTx mode */ - printk(KERN_INFO PFX "%s: No interrupt generated using MSI, " - "switching to INTx mode.\n", + printk(KERN_WARNING PFX "%s: No interrupt was generated using MSI, " + "switching to INTx mode. Please report this failure to " + "the PCI maintainer and include system chipset information.\n", pci_name(pdev)); err = -EOPNOTSUPP; @@ -3359,7 +3336,6 @@ static int __devinit sky2_test_msi(struct sky2_hw *hw) } sky2_write32(hw, B0_IMSK, 0); - sky2_read32(hw, B0_IMSK); free_irq(pdev->irq, hw); diff --git a/trunk/drivers/net/sky2.h b/trunk/drivers/net/sky2.h index 6d2a23f66c9a..43d2accf60e1 100644 --- a/trunk/drivers/net/sky2.h +++ b/trunk/drivers/net/sky2.h @@ -1576,7 +1576,7 @@ enum { GMR_FS_ANY_ERR = GMR_FS_RX_FF_OV | GMR_FS_CRC_ERR | GMR_FS_FRAGMENT | GMR_FS_LONG_ERR | - GMR_FS_MII_ERR | GMR_FS_GOOD_FC | GMR_FS_BAD_FC | + GMR_FS_MII_ERR | GMR_FS_BAD_FC | GMR_FS_UN_SIZE | GMR_FS_JABBER, }; @@ -1828,13 +1828,6 @@ struct rx_ring_info { dma_addr_t frag_addr[ETH_JUMBO_MTU >> PAGE_SHIFT]; }; -enum flow_control { - FC_NONE = 0, - FC_TX = 1, - FC_RX = 2, - FC_BOTH = 3, -}; - struct sky2_port { struct sky2_hw *hw; struct net_device *netdev; @@ -1867,13 +1860,13 @@ struct sky2_port { dma_addr_t rx_le_map; dma_addr_t tx_le_map; - u16 advertising; /* ADVERTISED_ bits */ + u32 advertising; /* ADVERTISED_ bits */ u16 speed; /* SPEED_1000, SPEED_100, ... */ u8 autoneg; /* AUTONEG_ENABLE, AUTONEG_DISABLE */ u8 duplex; /* DUPLEX_HALF, DUPLEX_FULL */ + u8 rx_pause; + u8 tx_pause; u8 rx_csum; - enum flow_control flow_mode; - enum flow_control flow_status; struct net_device_stats net_stats; diff --git a/trunk/drivers/rtc/rtc-max6902.c b/trunk/drivers/rtc/rtc-max6902.c index d94170728075..0b20dfacbf59 100644 --- a/trunk/drivers/rtc/rtc-max6902.c +++ b/trunk/drivers/rtc/rtc-max6902.c @@ -136,7 +136,7 @@ static int max6902_get_datetime(struct device *dev, struct rtc_time *dt) dt->tm_min = BCD2BIN(chip->buf[2]); dt->tm_hour = BCD2BIN(chip->buf[3]); dt->tm_mday = BCD2BIN(chip->buf[4]); - dt->tm_mon = BCD2BIN(chip->buf[5]) - 1; + dt->tm_mon = BCD2BIN(chip->buf[5] - 1); dt->tm_wday = BCD2BIN(chip->buf[6]); dt->tm_year = BCD2BIN(chip->buf[7]); diff --git a/trunk/drivers/rtc/rtc-v3020.c b/trunk/drivers/rtc/rtc-v3020.c index 3b58d3d5d38a..09b714f1cdc3 100644 --- a/trunk/drivers/rtc/rtc-v3020.c +++ b/trunk/drivers/rtc/rtc-v3020.c @@ -195,9 +195,9 @@ static int rtc_probe(struct platform_device *pdev) * are all disabled */ v3020_set_reg(chip, V3020_STATUS_0, 0x0); - dev_info(&pdev->dev, "Chip available at physical address 0x%llx," + dev_info(&pdev->dev, "Chip available at physical address 0x%p," "data connected to D%d\n", - (unsigned long long)pdev->resource[0].start, + (void*)pdev->resource[0].start, chip->leftshift); platform_set_drvdata(pdev, chip); diff --git a/trunk/drivers/scsi/megaraid/megaraid_mbox.c b/trunk/drivers/scsi/megaraid/megaraid_mbox.c index 7bac86dda88f..c0edb662d863 100644 --- a/trunk/drivers/scsi/megaraid/megaraid_mbox.c +++ b/trunk/drivers/scsi/megaraid/megaraid_mbox.c @@ -884,7 +884,7 @@ megaraid_init_mbox(adapter_t *adapter) if (((magic64 == HBA_SIGNATURE_64_BIT) && ((adapter->pdev->subsystem_device != - PCI_SUBSYS_ID_MEGARAID_SATA_150_6) && + PCI_SUBSYS_ID_MEGARAID_SATA_150_6) || (adapter->pdev->subsystem_device != PCI_SUBSYS_ID_MEGARAID_SATA_150_4))) || (adapter->pdev->vendor == PCI_VENDOR_ID_LSI_LOGIC && diff --git a/trunk/drivers/serial/ioc4_serial.c b/trunk/drivers/serial/ioc4_serial.c index ff4fa25f9fd1..98ce88d80207 100644 --- a/trunk/drivers/serial/ioc4_serial.c +++ b/trunk/drivers/serial/ioc4_serial.c @@ -2935,7 +2935,7 @@ static void __devexit ioc4_serial_exit(void) uart_unregister_driver(&ioc4_uart_rs422); } -late_initcall(ioc4_serial_init); /* Call only after tty init is done */ +module_init(ioc4_serial_init); module_exit(ioc4_serial_exit); MODULE_AUTHOR("Pat Gefre - Silicon Graphics Inc. (SGI) "); diff --git a/trunk/drivers/sn/Kconfig b/trunk/drivers/sn/Kconfig index c66ba9ad833d..a34731625877 100644 --- a/trunk/drivers/sn/Kconfig +++ b/trunk/drivers/sn/Kconfig @@ -5,6 +5,19 @@ menu "SN Devices" depends on SGI_SN +config SGI_IOC4 + tristate "SGI IOC4 Base IO support" + depends on MMTIMER + default m + ---help--- + This option enables basic support for the SGI IOC4-based Base IO + controller card. This option does not enable any specific + functions on such a card, but provides necessary infrastructure + for other drivers to utilize. + + If you have an SGI Altix with an IOC4-based + I/O controller say Y. Otherwise say N. + config SGI_IOC3 tristate "SGI IOC3 Base IO support" default m diff --git a/trunk/drivers/sn/Makefile b/trunk/drivers/sn/Makefile index 693db8bb8d9c..2cda011597c0 100644 --- a/trunk/drivers/sn/Makefile +++ b/trunk/drivers/sn/Makefile @@ -3,4 +3,5 @@ # # +obj-$(CONFIG_SGI_IOC4) += ioc4.o obj-$(CONFIG_SGI_IOC3) += ioc3.o diff --git a/trunk/drivers/misc/ioc4.c b/trunk/drivers/sn/ioc4.c similarity index 92% rename from trunk/drivers/misc/ioc4.c rename to trunk/drivers/sn/ioc4.c index 1c3c14a3839c..8562821e6498 100644 --- a/trunk/drivers/misc/ioc4.c +++ b/trunk/drivers/sn/ioc4.c @@ -3,7 +3,7 @@ * License. See the file "COPYING" in the main directory of this archive * for more details. * - * Copyright (C) 2005-2006 Silicon Graphics, Inc. All Rights Reserved. + * Copyright (C) 2005 Silicon Graphics, Inc. All Rights Reserved. */ /* This file contains the master driver module for use by SGI IOC4 subdrivers. @@ -29,9 +29,12 @@ #include #include #include -#include +#include +#include #include -#include +#include +#include +#include /*************** * Definitions * @@ -40,7 +43,7 @@ /* Tweakable values */ /* PCI bus speed detection/calibration */ -#define IOC4_CALIBRATE_COUNT 63 /* Calibration cycle period */ +#define IOC4_CALIBRATE_COUNT 63 /* Calibration cycle period */ #define IOC4_CALIBRATE_CYCLES 256 /* Average over this many cycles */ #define IOC4_CALIBRATE_DISCARD 2 /* Discard first few cycles */ #define IOC4_CALIBRATE_LOW_MHZ 25 /* Lower bound on bus speed sanity */ @@ -140,11 +143,11 @@ ioc4_unregister_submodule(struct ioc4_submodule *is) static void ioc4_clock_calibrate(struct ioc4_driver_data *idd) { + extern unsigned long sn_rtc_cycles_per_second; union ioc4_int_out int_out; union ioc4_gpcr gpcr; unsigned int state, last_state = 1; - struct timespec start_ts, end_ts; - uint64_t start, end, period; + uint64_t start = 0, end, period; unsigned int count = 0; /* Enable output */ @@ -172,28 +175,30 @@ ioc4_clock_calibrate(struct ioc4_driver_data *idd) if (!last_state && state) { count++; if (count == IOC4_CALIBRATE_END) { - ktime_get_ts(&end_ts); + end = rtc_time(); break; } else if (count == IOC4_CALIBRATE_DISCARD) - ktime_get_ts(&start_ts); + start = rtc_time(); } last_state = state; } while (1); /* Calculation rearranged to preserve intermediate precision. * Logically: - * 1. "end - start" gives us the measurement period over all - * the square wave cycles. - * 2. Divide by number of square wave cycles to get the period - * of a square wave cycle. + * 1. "end - start" gives us number of RTC cycles over all the + * square wave cycles measured. + * 2. Divide by number of square wave cycles to get number of + * RTC cycles per square wave cycle. * 3. Divide by 2*(int_out.fields.count+1), which is the formula * by which the IOC4 generates the square wave, to get the - * period of an IOC4 INT_OUT count. + * number of RTC cycles per IOC4 INT_OUT count. + * 4. Divide by sn_rtc_cycles_per_second to get seconds per + * count. + * 5. Multiply by 1E9 to get nanoseconds per count. */ - end = end_ts.tv_sec * NSEC_PER_SEC + end_ts.tv_nsec; - start = start_ts.tv_sec * NSEC_PER_SEC + start_ts.tv_nsec; - period = (end - start) / - (IOC4_CALIBRATE_CYCLES * 2 * (IOC4_CALIBRATE_COUNT + 1)); + period = ((end - start) * 1000000000) / + (IOC4_CALIBRATE_CYCLES * 2 * (IOC4_CALIBRATE_COUNT + 1) + * sn_rtc_cycles_per_second); /* Bounds check the result. */ if (period > IOC4_CALIBRATE_LOW_LIMIT || @@ -205,12 +210,10 @@ ioc4_clock_calibrate(struct ioc4_driver_data *idd) IOC4_CALIBRATE_DEFAULT / IOC4_EXTINT_COUNT_DIVISOR); period = IOC4_CALIBRATE_DEFAULT; } else { - u64 ns = period; - - do_div(ns, IOC4_EXTINT_COUNT_DIVISOR); printk(KERN_DEBUG - "IOC4 %s: PCI clock is %lld ns.\n", - pci_name(idd->idd_pdev), ns); + "IOC4 %s: PCI clock is %ld ns.\n", + pci_name(idd->idd_pdev), + period / IOC4_EXTINT_COUNT_DIVISOR); } /* Remember results. We store the extint clock period rather diff --git a/trunk/drivers/w1/Kconfig b/trunk/drivers/w1/Kconfig index c287a9ae4fdd..27c9d05d03ef 100644 --- a/trunk/drivers/w1/Kconfig +++ b/trunk/drivers/w1/Kconfig @@ -2,6 +2,7 @@ menu "Dallas's 1-wire bus" config W1 tristate "Dallas's 1-wire support" + depends on CONNECTOR ---help--- Dallas' 1-wire bus is useful to connect slow 1-pin devices such as iButtons and thermal sensors. diff --git a/trunk/fs/binfmt_elf.c b/trunk/fs/binfmt_elf.c index 79b05a1a4365..561006127902 100644 --- a/trunk/fs/binfmt_elf.c +++ b/trunk/fs/binfmt_elf.c @@ -1220,7 +1220,7 @@ static int notesize(struct memelfnote *en) static int alignfile(struct file *file, loff_t *foffset) { - static const char buf[4] = { 0, }; + char buf[4] = { 0, }; DUMP_WRITE(buf, roundup(*foffset, 4) - *foffset, foffset); return 1; } @@ -1569,8 +1569,7 @@ static int elf_core_dump(long signr, struct pt_regs *regs, struct file *file) DUMP_WRITE(elf, sizeof(*elf)); offset += sizeof(*elf); /* Elf header */ - offset += (segs + 1) * sizeof(struct elf_phdr); /* Program headers */ - foffset = offset; + offset += (segs+1) * sizeof(struct elf_phdr); /* Program headers */ /* Write notes phdr entry */ { @@ -1587,6 +1586,8 @@ static int elf_core_dump(long signr, struct pt_regs *regs, struct file *file) DUMP_WRITE(&phdr, sizeof(phdr)); } + foffset = offset; + dataoff = offset = roundup(offset, ELF_EXEC_PAGESIZE); /* Write program headers for segments dump */ @@ -1611,6 +1612,7 @@ static int elf_core_dump(long signr, struct pt_regs *regs, struct file *file) phdr.p_align = ELF_EXEC_PAGESIZE; DUMP_WRITE(&phdr, sizeof(phdr)); + foffset += sizeof(phdr); } #ifdef ELF_CORE_WRITE_EXTRA_PHDRS diff --git a/trunk/fs/buffer.c b/trunk/fs/buffer.c index 35527dca1dbc..f65ef8821c73 100644 --- a/trunk/fs/buffer.c +++ b/trunk/fs/buffer.c @@ -452,7 +452,6 @@ static void end_buffer_async_write(struct buffer_head *bh, int uptodate) bdevname(bh->b_bdev, b)); } set_bit(AS_EIO, &page->mapping->flags); - set_buffer_write_io_error(bh); clear_buffer_uptodate(bh); SetPageError(page); } @@ -572,10 +571,6 @@ EXPORT_SYMBOL(mark_buffer_async_write); static inline void __remove_assoc_queue(struct buffer_head *bh) { list_del_init(&bh->b_assoc_buffers); - WARN_ON(!bh->b_assoc_map); - if (buffer_write_io_error(bh)) - set_bit(AS_EIO, &bh->b_assoc_map->flags); - bh->b_assoc_map = NULL; } int inode_has_buffers(struct inode *inode) @@ -674,7 +669,6 @@ void mark_buffer_dirty_inode(struct buffer_head *bh, struct inode *inode) spin_lock(&buffer_mapping->private_lock); list_move_tail(&bh->b_assoc_buffers, &mapping->private_list); - bh->b_assoc_map = mapping; spin_unlock(&buffer_mapping->private_lock); } } @@ -771,7 +765,7 @@ static int fsync_buffers_list(spinlock_t *lock, struct list_head *list) spin_lock(lock); while (!list_empty(list)) { bh = BH_ENTRY(list->next); - __remove_assoc_queue(bh); + list_del_init(&bh->b_assoc_buffers); if (buffer_dirty(bh) || buffer_locked(bh)) { list_add(&bh->b_assoc_buffers, &tmp); if (buffer_dirty(bh)) { @@ -792,7 +786,7 @@ static int fsync_buffers_list(spinlock_t *lock, struct list_head *list) while (!list_empty(&tmp)) { bh = BH_ENTRY(tmp.prev); - list_del_init(&bh->b_assoc_buffers); + __remove_assoc_queue(bh); get_bh(bh); spin_unlock(lock); wait_on_buffer(bh); @@ -1173,7 +1167,6 @@ void __bforget(struct buffer_head *bh) spin_lock(&buffer_mapping->private_lock); list_del_init(&bh->b_assoc_buffers); - bh->b_assoc_map = NULL; spin_unlock(&buffer_mapping->private_lock); } __brelse(bh); diff --git a/trunk/fs/cifs/cifssmb.c b/trunk/fs/cifs/cifssmb.c index 098790eb2aa1..5dc5a966bd5f 100644 --- a/trunk/fs/cifs/cifssmb.c +++ b/trunk/fs/cifs/cifssmb.c @@ -399,7 +399,6 @@ CIFSSMBNegotiate(unsigned int xid, struct cifsSesInfo *ses) struct TCP_Server_Info * server; u16 count; unsigned int secFlags; - u16 dialect; if(ses->server) server = ses->server; @@ -439,10 +438,9 @@ CIFSSMBNegotiate(unsigned int xid, struct cifsSesInfo *ses) if (rc != 0) goto neg_err_exit; - dialect = le16_to_cpu(pSMBr->DialectIndex); - cFYI(1,("Dialect: %d", dialect)); + cFYI(1,("Dialect: %d", pSMBr->DialectIndex)); /* Check wct = 1 error case */ - if((pSMBr->hdr.WordCount < 13) || (dialect == BAD_PROT)) { + if((pSMBr->hdr.WordCount < 13) || (pSMBr->DialectIndex == BAD_PROT)) { /* core returns wct = 1, but we do not ask for core - otherwise small wct just comes when dialect index is -1 indicating we could not negotiate a common dialect */ @@ -450,8 +448,8 @@ CIFSSMBNegotiate(unsigned int xid, struct cifsSesInfo *ses) goto neg_err_exit; #ifdef CONFIG_CIFS_WEAK_PW_HASH } else if((pSMBr->hdr.WordCount == 13) - && ((dialect == LANMAN_PROT) - || (dialect == LANMAN2_PROT))) { + && ((pSMBr->DialectIndex == LANMAN_PROT) + || (pSMBr->DialectIndex == LANMAN2_PROT))) { __s16 tmp; struct lanman_neg_rsp * rsp = (struct lanman_neg_rsp *)pSMBr; @@ -2945,7 +2943,7 @@ int SMBQueryInformation(const int xid, struct cifsTconInfo *tcon, ts.tv_nsec = 0; ts.tv_sec = time; /* decode time fields */ - pFinfo->ChangeTime = cpu_to_le64(cifs_UnixTimeToNT(ts)); + pFinfo->ChangeTime = cifs_UnixTimeToNT(ts); pFinfo->LastWriteTime = pFinfo->ChangeTime; pFinfo->LastAccessTime = 0; pFinfo->AllocationSize = diff --git a/trunk/fs/fuse/dir.c b/trunk/fs/fuse/dir.c index cfc8f81e60d0..8605155db171 100644 --- a/trunk/fs/fuse/dir.c +++ b/trunk/fs/fuse/dir.c @@ -138,7 +138,6 @@ static int fuse_dentry_revalidate(struct dentry *entry, struct nameidata *nd) struct fuse_entry_out outarg; struct fuse_conn *fc; struct fuse_req *req; - struct dentry *parent; /* Doesn't hurt to "reset" the validity timeout */ fuse_invalidate_entry_cache(entry); @@ -152,10 +151,8 @@ static int fuse_dentry_revalidate(struct dentry *entry, struct nameidata *nd) if (IS_ERR(req)) return 0; - parent = dget_parent(entry); - fuse_lookup_init(req, parent->d_inode, entry, &outarg); + fuse_lookup_init(req, entry->d_parent->d_inode, entry, &outarg); request_send(fc, req); - dput(parent); err = req->out.h.error; /* Zero nodeid is same as -ENOENT */ if (!err && !outarg.nodeid) @@ -166,9 +163,7 @@ static int fuse_dentry_revalidate(struct dentry *entry, struct nameidata *nd) fuse_send_forget(fc, req, outarg.nodeid, 1); return 0; } - spin_lock(&fc->lock); fi->nlookup ++; - spin_unlock(&fc->lock); } fuse_put_request(fc, req); if (err || (outarg.attr.mode ^ inode->i_mode) & S_IFMT) @@ -180,6 +175,22 @@ static int fuse_dentry_revalidate(struct dentry *entry, struct nameidata *nd) return 1; } +/* + * Check if there's already a hashed alias of this directory inode. + * If yes, then lookup and mkdir must not create a new alias. + */ +static int dir_alias(struct inode *inode) +{ + if (S_ISDIR(inode->i_mode)) { + struct dentry *alias = d_find_alias(inode); + if (alias) { + dput(alias); + return 1; + } + } + return 0; +} + static int invalid_nodeid(u64 nodeid) { return !nodeid || nodeid == FUSE_ROOT_ID; @@ -195,24 +206,6 @@ static int valid_mode(int m) S_ISBLK(m) || S_ISFIFO(m) || S_ISSOCK(m); } -/* - * Add a directory inode to a dentry, ensuring that no other dentry - * refers to this inode. Called with fc->inst_mutex. - */ -static int fuse_d_add_directory(struct dentry *entry, struct inode *inode) -{ - struct dentry *alias = d_find_alias(inode); - if (alias) { - /* This tries to shrink the subtree below alias */ - fuse_invalidate_entry(alias); - dput(alias); - if (!list_empty(&inode->i_dentry)) - return -EBUSY; - } - d_add(entry, inode); - return 0; -} - static struct dentry *fuse_lookup(struct inode *dir, struct dentry *entry, struct nameidata *nd) { @@ -248,17 +241,11 @@ static struct dentry *fuse_lookup(struct inode *dir, struct dentry *entry, if (err && err != -ENOENT) return ERR_PTR(err); - if (inode && S_ISDIR(inode->i_mode)) { - mutex_lock(&fc->inst_mutex); - err = fuse_d_add_directory(entry, inode); - mutex_unlock(&fc->inst_mutex); - if (err) { - iput(inode); - return ERR_PTR(err); - } - } else - d_add(entry, inode); - + if (inode && dir_alias(inode)) { + iput(inode); + return ERR_PTR(-EIO); + } + d_add(entry, inode); entry->d_op = &fuse_dentry_operations; if (!err) fuse_change_timeout(entry, &outarg); @@ -414,22 +401,12 @@ static int create_new_entry(struct fuse_conn *fc, struct fuse_req *req, } fuse_put_request(fc, req); - if (S_ISDIR(inode->i_mode)) { - struct dentry *alias; - mutex_lock(&fc->inst_mutex); - alias = d_find_alias(inode); - if (alias) { - /* New directory must have moved since mkdir */ - mutex_unlock(&fc->inst_mutex); - dput(alias); - iput(inode); - return -EBUSY; - } - d_instantiate(entry, inode); - mutex_unlock(&fc->inst_mutex); - } else - d_instantiate(entry, inode); + if (dir_alias(inode)) { + iput(inode); + return -EIO; + } + d_instantiate(entry, inode); fuse_change_timeout(entry, &outarg); fuse_invalidate_attr(dir); return 0; @@ -958,30 +935,14 @@ static void iattr_to_fattr(struct iattr *iattr, struct fuse_setattr_in *arg) } } -static void fuse_vmtruncate(struct inode *inode, loff_t offset) -{ - struct fuse_conn *fc = get_fuse_conn(inode); - int need_trunc; - - spin_lock(&fc->lock); - need_trunc = inode->i_size > offset; - i_size_write(inode, offset); - spin_unlock(&fc->lock); - - if (need_trunc) { - struct address_space *mapping = inode->i_mapping; - unmap_mapping_range(mapping, offset + PAGE_SIZE - 1, 0, 1); - truncate_inode_pages(mapping, offset); - } -} - /* * Set attributes, and at the same time refresh them. * * Truncation is slightly complicated, because the 'truncate' request * may fail, in which case we don't want to touch the mapping. - * vmtruncate() doesn't allow for this case, so do the rlimit checking - * and the actual truncation by hand. + * vmtruncate() doesn't allow for this case. So do the rlimit + * checking by hand and call vmtruncate() only after the file has + * actually been truncated. */ static int fuse_setattr(struct dentry *entry, struct iattr *attr) { @@ -1032,8 +993,12 @@ static int fuse_setattr(struct dentry *entry, struct iattr *attr) make_bad_inode(inode); err = -EIO; } else { - if (is_truncate) - fuse_vmtruncate(inode, outarg.attr.size); + if (is_truncate) { + loff_t origsize = i_size_read(inode); + i_size_write(inode, outarg.attr.size); + if (origsize > outarg.attr.size) + vmtruncate(inode, outarg.attr.size); + } fuse_change_attributes(inode, &outarg.attr); fi->i_time = time_to_jiffies(outarg.attr_valid, outarg.attr_valid_nsec); diff --git a/trunk/fs/fuse/file.c b/trunk/fs/fuse/file.c index 2bb5ace3882d..183626868eea 100644 --- a/trunk/fs/fuse/file.c +++ b/trunk/fs/fuse/file.c @@ -481,10 +481,8 @@ static int fuse_commit_write(struct file *file, struct page *page, err = -EIO; if (!err) { pos += count; - spin_lock(&fc->lock); - if (pos > inode->i_size) + if (pos > i_size_read(inode)) i_size_write(inode, pos); - spin_unlock(&fc->lock); if (offset == 0 && to == PAGE_CACHE_SIZE) { clear_page_dirty(page); @@ -588,12 +586,8 @@ static ssize_t fuse_direct_io(struct file *file, const char __user *buf, } fuse_put_request(fc, req); if (res > 0) { - if (write) { - spin_lock(&fc->lock); - if (pos > inode->i_size) - i_size_write(inode, pos); - spin_unlock(&fc->lock); - } + if (write && pos > i_size_read(inode)) + i_size_write(inode, pos); *ppos = pos; } fuse_invalidate_attr(inode); diff --git a/trunk/fs/fuse/fuse_i.h b/trunk/fs/fuse/fuse_i.h index 91edb8932d90..69c7750d55b8 100644 --- a/trunk/fs/fuse/fuse_i.h +++ b/trunk/fs/fuse/fuse_i.h @@ -239,9 +239,6 @@ struct fuse_conn { /** Lock protecting accessess to members of this structure */ spinlock_t lock; - /** Mutex protecting against directory alias creation */ - struct mutex inst_mutex; - /** Refcount */ atomic_t count; diff --git a/trunk/fs/fuse/inode.c b/trunk/fs/fuse/inode.c index fc4203570370..7d0a9aee01f2 100644 --- a/trunk/fs/fuse/inode.c +++ b/trunk/fs/fuse/inode.c @@ -109,7 +109,6 @@ static int fuse_remount_fs(struct super_block *sb, int *flags, char *data) void fuse_change_attributes(struct inode *inode, struct fuse_attr *attr) { - struct fuse_conn *fc = get_fuse_conn(inode); if (S_ISREG(inode->i_mode) && i_size_read(inode) != attr->size) invalidate_inode_pages(inode->i_mapping); @@ -118,9 +117,7 @@ void fuse_change_attributes(struct inode *inode, struct fuse_attr *attr) inode->i_nlink = attr->nlink; inode->i_uid = attr->uid; inode->i_gid = attr->gid; - spin_lock(&fc->lock); i_size_write(inode, attr->size); - spin_unlock(&fc->lock); inode->i_blocks = attr->blocks; inode->i_atime.tv_sec = attr->atime; inode->i_atime.tv_nsec = attr->atimensec; @@ -133,7 +130,7 @@ void fuse_change_attributes(struct inode *inode, struct fuse_attr *attr) static void fuse_init_inode(struct inode *inode, struct fuse_attr *attr) { inode->i_mode = attr->mode & S_IFMT; - inode->i_size = attr->size; + i_size_write(inode, attr->size); if (S_ISREG(inode->i_mode)) { fuse_init_common(inode); fuse_init_file_inode(inode); @@ -172,6 +169,7 @@ struct inode *fuse_iget(struct super_block *sb, unsigned long nodeid, struct inode *inode; struct fuse_inode *fi; struct fuse_conn *fc = get_fuse_conn_super(sb); + int retried = 0; retry: inode = iget5_locked(sb, nodeid, fuse_inode_eq, fuse_inode_set, &nodeid); @@ -185,16 +183,16 @@ struct inode *fuse_iget(struct super_block *sb, unsigned long nodeid, fuse_init_inode(inode, attr); unlock_new_inode(inode); } else if ((inode->i_mode ^ attr->mode) & S_IFMT) { + BUG_ON(retried); /* Inode has changed type, any I/O on the old should fail */ make_bad_inode(inode); iput(inode); + retried = 1; goto retry; } fi = get_fuse_inode(inode); - spin_lock(&fc->lock); fi->nlookup ++; - spin_unlock(&fc->lock); fuse_change_attributes(inode, attr); return inode; } @@ -379,7 +377,6 @@ static struct fuse_conn *new_conn(void) fc = kzalloc(sizeof(*fc), GFP_KERNEL); if (fc) { spin_lock_init(&fc->lock); - mutex_init(&fc->inst_mutex); atomic_set(&fc->count, 1); init_waitqueue_head(&fc->waitq); init_waitqueue_head(&fc->blocked_waitq); @@ -399,10 +396,8 @@ static struct fuse_conn *new_conn(void) void fuse_conn_put(struct fuse_conn *fc) { - if (atomic_dec_and_test(&fc->count)) { - mutex_destroy(&fc->inst_mutex); + if (atomic_dec_and_test(&fc->count)) kfree(fc); - } } struct fuse_conn *fuse_conn_get(struct fuse_conn *fc) diff --git a/trunk/fs/jbd2/journal.c b/trunk/fs/jbd2/journal.c index c60f378b0f76..10db92ced014 100644 --- a/trunk/fs/jbd2/journal.c +++ b/trunk/fs/jbd2/journal.c @@ -725,7 +725,6 @@ journal_t * jbd2_journal_init_dev(struct block_device *bdev, __FUNCTION__); kfree(journal); journal = NULL; - goto out; } journal->j_dev = bdev; journal->j_fs_dev = fs_dev; @@ -736,7 +735,7 @@ journal_t * jbd2_journal_init_dev(struct block_device *bdev, J_ASSERT(bh != NULL); journal->j_sb_buffer = bh; journal->j_superblock = (journal_superblock_t *)bh->b_data; -out: + return journal; } diff --git a/trunk/fs/lockd/svc4proc.c b/trunk/fs/lockd/svc4proc.c index 399ad11b97be..fa370f6eb07b 100644 --- a/trunk/fs/lockd/svc4proc.c +++ b/trunk/fs/lockd/svc4proc.c @@ -96,7 +96,7 @@ nlm4svc_proc_test(struct svc_rqst *rqstp, struct nlm_args *argp, /* Obtain client and file */ if ((resp->status = nlm4svc_retrieve_args(rqstp, argp, &host, &file))) - return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success; + return rpc_success; /* Now check for conflicting locks */ resp->status = nlmsvc_testlock(file, &argp->lock, &resp->lock); @@ -126,7 +126,7 @@ nlm4svc_proc_lock(struct svc_rqst *rqstp, struct nlm_args *argp, /* Obtain client and file */ if ((resp->status = nlm4svc_retrieve_args(rqstp, argp, &host, &file))) - return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success; + return rpc_success; #if 0 /* If supplied state doesn't match current state, we assume it's @@ -169,7 +169,7 @@ nlm4svc_proc_cancel(struct svc_rqst *rqstp, struct nlm_args *argp, /* Obtain client and file */ if ((resp->status = nlm4svc_retrieve_args(rqstp, argp, &host, &file))) - return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success; + return rpc_success; /* Try to cancel request. */ resp->status = nlmsvc_cancel_blocked(file, &argp->lock); @@ -202,7 +202,7 @@ nlm4svc_proc_unlock(struct svc_rqst *rqstp, struct nlm_args *argp, /* Obtain client and file */ if ((resp->status = nlm4svc_retrieve_args(rqstp, argp, &host, &file))) - return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success; + return rpc_success; /* Now try to remove the lock */ resp->status = nlmsvc_unlock(file, &argp->lock); @@ -339,7 +339,7 @@ nlm4svc_proc_share(struct svc_rqst *rqstp, struct nlm_args *argp, /* Obtain client and file */ if ((resp->status = nlm4svc_retrieve_args(rqstp, argp, &host, &file))) - return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success; + return rpc_success; /* Now try to create the share */ resp->status = nlmsvc_share_file(host, file, argp); @@ -372,7 +372,7 @@ nlm4svc_proc_unshare(struct svc_rqst *rqstp, struct nlm_args *argp, /* Obtain client and file */ if ((resp->status = nlm4svc_retrieve_args(rqstp, argp, &host, &file))) - return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success; + return rpc_success; /* Now try to lock the file */ resp->status = nlmsvc_unshare_file(host, file, argp); diff --git a/trunk/fs/lockd/svcproc.c b/trunk/fs/lockd/svcproc.c index 6a931f4ab75c..75b2c81bcb93 100644 --- a/trunk/fs/lockd/svcproc.c +++ b/trunk/fs/lockd/svcproc.c @@ -59,7 +59,7 @@ nlmsvc_retrieve_args(struct svc_rqst *rqstp, struct nlm_args *argp, struct nlm_host *host = NULL; struct nlm_file *file = NULL; struct nlm_lock *lock = &argp->lock; - u32 error = 0; + u32 error; /* nfsd callbacks must have been installed for this procedure */ if (!nlmsvc_ops) @@ -88,8 +88,6 @@ nlmsvc_retrieve_args(struct svc_rqst *rqstp, struct nlm_args *argp, no_locks: if (host) nlm_release_host(host); - if (error) - return error; return nlm_lck_denied_nolocks; } @@ -124,7 +122,7 @@ nlmsvc_proc_test(struct svc_rqst *rqstp, struct nlm_args *argp, /* Obtain client and file */ if ((resp->status = nlmsvc_retrieve_args(rqstp, argp, &host, &file))) - return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success; + return rpc_success; /* Now check for conflicting locks */ resp->status = cast_status(nlmsvc_testlock(file, &argp->lock, &resp->lock)); @@ -155,7 +153,7 @@ nlmsvc_proc_lock(struct svc_rqst *rqstp, struct nlm_args *argp, /* Obtain client and file */ if ((resp->status = nlmsvc_retrieve_args(rqstp, argp, &host, &file))) - return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success; + return rpc_success; #if 0 /* If supplied state doesn't match current state, we assume it's @@ -198,7 +196,7 @@ nlmsvc_proc_cancel(struct svc_rqst *rqstp, struct nlm_args *argp, /* Obtain client and file */ if ((resp->status = nlmsvc_retrieve_args(rqstp, argp, &host, &file))) - return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success; + return rpc_success; /* Try to cancel request. */ resp->status = cast_status(nlmsvc_cancel_blocked(file, &argp->lock)); @@ -231,7 +229,7 @@ nlmsvc_proc_unlock(struct svc_rqst *rqstp, struct nlm_args *argp, /* Obtain client and file */ if ((resp->status = nlmsvc_retrieve_args(rqstp, argp, &host, &file))) - return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success; + return rpc_success; /* Now try to remove the lock */ resp->status = cast_status(nlmsvc_unlock(file, &argp->lock)); @@ -370,7 +368,7 @@ nlmsvc_proc_share(struct svc_rqst *rqstp, struct nlm_args *argp, /* Obtain client and file */ if ((resp->status = nlmsvc_retrieve_args(rqstp, argp, &host, &file))) - return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success; + return rpc_success; /* Now try to create the share */ resp->status = cast_status(nlmsvc_share_file(host, file, argp)); @@ -403,7 +401,7 @@ nlmsvc_proc_unshare(struct svc_rqst *rqstp, struct nlm_args *argp, /* Obtain client and file */ if ((resp->status = nlmsvc_retrieve_args(rqstp, argp, &host, &file))) - return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success; + return rpc_success; /* Now try to unshare the file */ resp->status = cast_status(nlmsvc_unshare_file(host, file, argp)); diff --git a/trunk/fs/lockd/svcsubs.c b/trunk/fs/lockd/svcsubs.c index 7dac96e6c82c..514f5f20701e 100644 --- a/trunk/fs/lockd/svcsubs.c +++ b/trunk/fs/lockd/svcsubs.c @@ -135,6 +135,12 @@ nlm_lookup_file(struct svc_rqst *rqstp, struct nlm_file **result, out_free: kfree(file); +#ifdef CONFIG_LOCKD_V4 + if (nfserr == 1) + nfserr = nlm4_stale_fh; + else +#endif + nfserr = nlm_lck_denied; goto out_unlock; } @@ -318,16 +324,7 @@ nlmsvc_same_host(struct nlm_host *host, struct nlm_host *other) static int nlmsvc_is_client(struct nlm_host *host, struct nlm_host *dummy) { - if (host->h_server) { - /* we are destroying locks even though the client - * hasn't asked us too, so don't unmonitor the - * client - */ - if (host->h_nsmhandle) - host->h_nsmhandle->sm_sticky = 1; - return 1; - } else - return 0; + return host->h_server; } /* diff --git a/trunk/fs/nfsd/lockd.c b/trunk/fs/nfsd/lockd.c index 9b9e7e127c03..7b889ff15ae6 100644 --- a/trunk/fs/nfsd/lockd.c +++ b/trunk/fs/nfsd/lockd.c @@ -39,20 +39,18 @@ nlm_fopen(struct svc_rqst *rqstp, struct nfs_fh *f, struct file **filp) fh_put(&fh); rqstp->rq_client = NULL; exp_readunlock(); - /* We return nlm error codes as nlm doesn't know - * about nfsd, but nfsd does know about nlm.. + /* nlm and nfsd don't share error codes. + * we invent: 0 = no error + * 1 = stale file handle + * 2 = other error */ switch (nfserr) { case nfs_ok: return 0; - case nfserr_dropit: - return nlm_drop_reply; -#ifdef CONFIG_LOCKD_V4 case nfserr_stale: - return nlm4_stale_fh; -#endif + return 1; default: - return nlm_lck_denied; + return 2; } } diff --git a/trunk/fs/nfsd/nfs4callback.c b/trunk/fs/nfsd/nfs4callback.c index 324a278f2808..f6ca9fb3fc63 100644 --- a/trunk/fs/nfsd/nfs4callback.c +++ b/trunk/fs/nfsd/nfs4callback.c @@ -421,7 +421,7 @@ nfsd4_probe_callback(struct nfs4_client *clp) /* Create RPC client */ cb->cb_client = rpc_create(&args); - if (IS_ERR(cb->cb_client)) { + if (!cb->cb_client) { dprintk("NFSD: couldn't create callback client\n"); goto out_err; } @@ -448,10 +448,10 @@ nfsd4_probe_callback(struct nfs4_client *clp) out_rpciod: atomic_dec(&clp->cl_count); rpciod_down(); + cb->cb_client = NULL; out_clnt: rpc_shutdown_client(cb->cb_client); out_err: - cb->cb_client = NULL; dprintk("NFSD: warning: no callback path to client %.*s\n", (int)clp->cl_name.len, clp->cl_name.data); } diff --git a/trunk/fs/nfsd/nfs4proc.c b/trunk/fs/nfsd/nfs4proc.c index d1fac6872c44..8333db12caca 100644 --- a/trunk/fs/nfsd/nfs4proc.c +++ b/trunk/fs/nfsd/nfs4proc.c @@ -68,20 +68,20 @@ fh_dup2(struct svc_fh *dst, struct svc_fh *src) } static int -do_open_permission(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open *open, int accmode) +do_open_permission(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open *open) { - int status; + int accmode, status; if (open->op_truncate && !(open->op_share_access & NFS4_SHARE_ACCESS_WRITE)) return nfserr_inval; + accmode = MAY_NOP; if (open->op_share_access & NFS4_SHARE_ACCESS_READ) - accmode |= MAY_READ; - if (open->op_share_access & NFS4_SHARE_ACCESS_WRITE) + accmode = MAY_READ; + if (open->op_share_deny & NFS4_SHARE_ACCESS_WRITE) accmode |= (MAY_WRITE | MAY_TRUNC); - if (open->op_share_deny & NFS4_SHARE_DENY_WRITE) - accmode |= MAY_WRITE; + accmode |= MAY_OWNER_OVERRIDE; status = fh_verify(rqstp, current_fh, S_IFREG, accmode); @@ -124,7 +124,7 @@ do_open_lookup(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_o &resfh.fh_handle.fh_base, resfh.fh_handle.fh_size); - status = do_open_permission(rqstp, current_fh, open, MAY_NOP); + status = do_open_permission(rqstp, current_fh, open); } fh_put(&resfh); @@ -155,7 +155,7 @@ do_open_fhandle(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_ open->op_truncate = (open->op_iattr.ia_valid & ATTR_SIZE) && (open->op_iattr.ia_size == 0); - status = do_open_permission(rqstp, current_fh, open, MAY_OWNER_OVERRIDE); + status = do_open_permission(rqstp, current_fh, open); return status; } diff --git a/trunk/fs/partitions/check.c b/trunk/fs/partitions/check.c index 6fb4b6150d77..51c6a748df49 100644 --- a/trunk/fs/partitions/check.c +++ b/trunk/fs/partitions/check.c @@ -376,48 +376,18 @@ static char *make_block_name(struct gendisk *disk) return name; } -static int disk_sysfs_symlinks(struct gendisk *disk) +static void disk_sysfs_symlinks(struct gendisk *disk) { struct device *target = get_device(disk->driverfs_dev); - int err; - char *disk_name = NULL; - if (target) { - disk_name = make_block_name(disk); - if (!disk_name) { - err = -ENOMEM; - goto err_out; + char *disk_name = make_block_name(disk); + sysfs_create_link(&disk->kobj,&target->kobj,"device"); + if (disk_name) { + sysfs_create_link(&target->kobj,&disk->kobj,disk_name); + kfree(disk_name); } - - err = sysfs_create_link(&disk->kobj, &target->kobj, "device"); - if (err) - goto err_out_disk_name; - - err = sysfs_create_link(&target->kobj, &disk->kobj, disk_name); - if (err) - goto err_out_dev_link; } - - err = sysfs_create_link(&disk->kobj, &block_subsys.kset.kobj, - "subsystem"); - if (err) - goto err_out_disk_name_lnk; - - kfree(disk_name); - - return 0; - -err_out_disk_name_lnk: - if (target) { - sysfs_remove_link(&target->kobj, disk_name); -err_out_dev_link: - sysfs_remove_link(&disk->kobj, "device"); -err_out_disk_name: - kfree(disk_name); -err_out: - put_device(target); - } - return err; + sysfs_create_link(&disk->kobj, &block_subsys.kset.kobj, "subsystem"); } /* Not exported, helper to add_disk(). */ @@ -436,11 +406,7 @@ void register_disk(struct gendisk *disk) *s = '!'; if ((err = kobject_add(&disk->kobj))) return; - err = disk_sysfs_symlinks(disk); - if (err) { - kobject_del(&disk->kobj); - return; - } + disk_sysfs_symlinks(disk); disk_sysfs_add_subdirs(disk); /* No minors to use for partitions */ diff --git a/trunk/fs/proc/base.c b/trunk/fs/proc/base.c index 26a8f8416b79..82da55b5cffe 100644 --- a/trunk/fs/proc/base.c +++ b/trunk/fs/proc/base.c @@ -86,7 +86,7 @@ /* Worst case buffer size needed for holding an integer. */ -#define PROC_NUMBUF 13 +#define PROC_NUMBUF 10 struct pid_entry { int len; diff --git a/trunk/include/acpi/pdc_intel.h b/trunk/include/acpi/pdc_intel.h index e72bfdd887f9..c5472be6f3a2 100644 --- a/trunk/include/acpi/pdc_intel.h +++ b/trunk/include/acpi/pdc_intel.h @@ -13,7 +13,6 @@ #define ACPI_PDC_SMP_C_SWCOORD (0x0040) #define ACPI_PDC_SMP_T_SWCOORD (0x0080) #define ACPI_PDC_C_C1_FFH (0x0100) -#define ACPI_PDC_C_C2C3_FFH (0x0200) #define ACPI_PDC_EST_CAPABILITY_SMP (ACPI_PDC_SMP_C1PT | \ ACPI_PDC_C_C1_HALT | \ @@ -24,10 +23,8 @@ ACPI_PDC_SMP_P_SWCOORD | \ ACPI_PDC_P_FFH) -#define ACPI_PDC_C_CAPABILITY_SMP (ACPI_PDC_SMP_C2C3 | \ - ACPI_PDC_SMP_C1PT | \ - ACPI_PDC_C_C1_HALT | \ - ACPI_PDC_C_C1_FFH | \ - ACPI_PDC_C_C2C3_FFH) +#define ACPI_PDC_C_CAPABILITY_SMP (ACPI_PDC_SMP_C2C3 | \ + ACPI_PDC_SMP_C1PT | \ + ACPI_PDC_C_C1_HALT) #endif /* __PDC_INTEL_H__ */ diff --git a/trunk/include/acpi/processor.h b/trunk/include/acpi/processor.h index 7798d2a9f793..9dd5b75961f8 100644 --- a/trunk/include/acpi/processor.h +++ b/trunk/include/acpi/processor.h @@ -29,9 +29,6 @@ #define DOMAIN_COORD_TYPE_SW_ANY 0xfd #define DOMAIN_COORD_TYPE_HW_ALL 0xfe -#define ACPI_CSTATE_SYSTEMIO (0) -#define ACPI_CSTATE_FFH (1) - /* Power Management */ struct acpi_processor_cx; @@ -61,8 +58,6 @@ struct acpi_processor_cx { u8 valid; u8 type; u32 address; - u8 space_id; - u8 index; u32 latency; u32 latency_ticks; u32 power; @@ -211,9 +206,6 @@ void arch_acpi_processor_init_pdc(struct acpi_processor *pr); #ifdef ARCH_HAS_POWER_INIT void acpi_processor_power_init_bm_check(struct acpi_processor_flags *flags, unsigned int cpu); -int acpi_processor_ffh_cstate_probe(unsigned int cpu, - struct acpi_processor_cx *cx, struct acpi_power_register *reg); -void acpi_processor_ffh_cstate_enter(struct acpi_processor_cx *cstate); #else static inline void acpi_processor_power_init_bm_check(struct acpi_processor_flags @@ -222,16 +214,6 @@ static inline void acpi_processor_power_init_bm_check(struct flags->bm_check = 1; return; } -static inline int acpi_processor_ffh_cstate_probe(unsigned int cpu, - struct acpi_processor_cx *cx, struct acpi_power_register *reg) -{ - return -1; -} -static inline void acpi_processor_ffh_cstate_enter( - struct acpi_processor_cx *cstate) -{ - return; -} #endif /* in processor_perflib.c */ diff --git a/trunk/include/asm-arm/arch-pxa/pxa-regs.h b/trunk/include/asm-arm/arch-pxa/pxa-regs.h index f5cc65dd7d0d..68731e0923a4 100644 --- a/trunk/include/asm-arm/arch-pxa/pxa-regs.h +++ b/trunk/include/asm-arm/arch-pxa/pxa-regs.h @@ -1681,6 +1681,7 @@ #define SSSR_TINT (1 << 19) /* Receiver Time-out Interrupt */ #define SSSR_PINT (1 << 18) /* Peripheral Trailing Byte Interrupt */ +#define SSPSP_FSRT (1 << 25) /* Frame Sync Relative Timing */ #define SSPSP_DMYSTOP(x) (x << 23) /* Dummy Stop */ #define SSPSP_SFRMWDTH(x) (x << 16) /* Serial Frame Width */ #define SSPSP_SFRMDLY(x) (x << 9) /* Serial Frame Delay */ diff --git a/trunk/include/asm-frv/highmem.h b/trunk/include/asm-frv/highmem.h index 0f390f41f816..e2247c22a638 100644 --- a/trunk/include/asm-frv/highmem.h +++ b/trunk/include/asm-frv/highmem.h @@ -82,11 +82,11 @@ extern struct page *kmap_atomic_to_page(void *ptr); dampr = paddr | xAMPRx_L | xAMPRx_M | xAMPRx_S | xAMPRx_SS_16Kb | xAMPRx_V; \ \ if (type != __KM_CACHE) \ - asm volatile("movgs %0,dampr"#ampr :: "r"(dampr) : "memory"); \ + asm volatile("movgs %0,dampr"#ampr :: "r"(dampr)); \ else \ asm volatile("movgs %0,iampr"#ampr"\n" \ "movgs %0,dampr"#ampr"\n" \ - :: "r"(dampr) : "memory" \ + :: "r"(dampr) \ ); \ \ asm("movsg damlr"#ampr",%0" : "=r"(damlr)); \ @@ -104,7 +104,7 @@ extern struct page *kmap_atomic_to_page(void *ptr); asm volatile("movgs %0,tplr \n" \ "movgs %1,tppr \n" \ "tlbpr %0,gr0,#2,#1" \ - : : "r"(damlr), "r"(dampr) : "memory"); \ + : : "r"(damlr), "r"(dampr)); \ \ /*printk("TLB: SECN sl=%d L=%08lx P=%08lx\n", slot, damlr, dampr);*/ \ \ @@ -115,7 +115,7 @@ static inline void *kmap_atomic(struct page *page, enum km_type type) { unsigned long paddr; - inc_preempt_count(); + preempt_disable(); paddr = page_to_phys(page); switch (type) { @@ -138,16 +138,16 @@ static inline void *kmap_atomic(struct page *page, enum km_type type) } } -#define __kunmap_atomic_primary(type, ampr) \ -do { \ - asm volatile("movgs gr0,dampr"#ampr"\n" ::: "memory"); \ - if (type == __KM_CACHE) \ - asm volatile("movgs gr0,iampr"#ampr"\n" ::: "memory"); \ +#define __kunmap_atomic_primary(type, ampr) \ +do { \ + asm volatile("movgs gr0,dampr"#ampr"\n"); \ + if (type == __KM_CACHE) \ + asm volatile("movgs gr0,iampr"#ampr"\n"); \ } while(0) -#define __kunmap_atomic_secondary(slot, vaddr) \ -do { \ - asm volatile("tlbpr %0,gr0,#4,#1" : : "r"(vaddr) : "memory"); \ +#define __kunmap_atomic_secondary(slot, vaddr) \ +do { \ + asm volatile("tlbpr %0,gr0,#4,#1" : : "r"(vaddr)); \ } while(0) static inline void kunmap_atomic(void *kvaddr, enum km_type type) @@ -170,8 +170,7 @@ static inline void kunmap_atomic(void *kvaddr, enum km_type type) default: BUG(); } - dec_preempt_count(); - preempt_check_resched(); + preempt_enable(); } #endif /* !__ASSEMBLY__ */ diff --git a/trunk/include/asm-i386/processor.h b/trunk/include/asm-i386/processor.h index e0ddca94d50c..2277127696d2 100644 --- a/trunk/include/asm-i386/processor.h +++ b/trunk/include/asm-i386/processor.h @@ -306,8 +306,6 @@ static inline void __mwait(unsigned long eax, unsigned long ecx) : :"a" (eax), "c" (ecx)); } -extern void mwait_idle_with_hints(unsigned long eax, unsigned long ecx); - /* from system description table in BIOS. Mostly for MCA use, but others may find it useful. */ extern unsigned int machine_id; diff --git a/trunk/include/asm-m68k/sun3mmu.h b/trunk/include/asm-m68k/sun3mmu.h index d8f17a0d8c9f..6c8c17d047a1 100644 --- a/trunk/include/asm-m68k/sun3mmu.h +++ b/trunk/include/asm-m68k/sun3mmu.h @@ -4,7 +4,6 @@ #ifndef __SUN3_MMU_H__ #define __SUN3_MMU_H__ -#include #include #include @@ -161,7 +160,7 @@ static inline void sun3_put_context(unsigned char c) return; } -extern void __iomem *sun3_ioremap(unsigned long phys, unsigned long size, +extern void *sun3_ioremap(unsigned long phys, unsigned long size, unsigned long type); extern int sun3_map_test(unsigned long addr, char *val); diff --git a/trunk/include/asm-x86_64/processor.h b/trunk/include/asm-x86_64/processor.h index cef17e0f828c..de9c3147ee4c 100644 --- a/trunk/include/asm-x86_64/processor.h +++ b/trunk/include/asm-x86_64/processor.h @@ -475,8 +475,6 @@ static inline void __mwait(unsigned long eax, unsigned long ecx) : :"a" (eax), "c" (ecx)); } -extern void mwait_idle_with_hints(unsigned long eax, unsigned long ecx); - #define stack_current() \ ({ \ struct thread_info *ti; \ diff --git a/trunk/include/linux/acpi.h b/trunk/include/linux/acpi.h index 2b0c955590fe..88b5dfd8ee12 100644 --- a/trunk/include/linux/acpi.h +++ b/trunk/include/linux/acpi.h @@ -494,9 +494,6 @@ void acpi_pci_unregister_driver(struct acpi_pci_driver *driver); extern int ec_read(u8 addr, u8 *val); extern int ec_write(u8 addr, u8 val); -extern int ec_transaction(u8 command, - const u8 *wdata, unsigned wdata_len, - u8 *rdata, unsigned rdata_len); #endif /*CONFIG_ACPI_EC*/ diff --git a/trunk/include/linux/buffer_head.h b/trunk/include/linux/buffer_head.h index 5d9fb0e94156..131ffd37e716 100644 --- a/trunk/include/linux/buffer_head.h +++ b/trunk/include/linux/buffer_head.h @@ -69,8 +69,6 @@ struct buffer_head { bh_end_io_t *b_end_io; /* I/O completion */ void *b_private; /* reserved for b_end_io */ struct list_head b_assoc_buffers; /* associated with another mapping */ - struct address_space *b_assoc_map; /* mapping this buffer is - associated with */ atomic_t b_count; /* users using this buffer_head */ }; diff --git a/trunk/include/linux/fs.h b/trunk/include/linux/fs.h index 661c7c572149..34406ed467c3 100644 --- a/trunk/include/linux/fs.h +++ b/trunk/include/linux/fs.h @@ -656,11 +656,7 @@ static inline loff_t i_size_read(struct inode *inode) #endif } -/* - * NOTE: unlike i_size_read(), i_size_write() does need locking around it - * (normally i_mutex), otherwise on 32bit/SMP an update of i_size_seqcount - * can be lost, resulting in subsequent i_size_read() calls spinning forever. - */ + static inline void i_size_write(struct inode *inode, loff_t i_size) { #if BITS_PER_LONG==32 && defined(CONFIG_SMP) diff --git a/trunk/include/linux/irq.h b/trunk/include/linux/irq.h index 775f5a7da493..c64f3cc7e870 100644 --- a/trunk/include/linux/irq.h +++ b/trunk/include/linux/irq.h @@ -141,7 +141,6 @@ struct irq_chip { * @pending_mask: pending rebalanced interrupts * @dir: /proc/irq/ procfs entry * @affinity_entry: /proc/irq/smp_affinity procfs entry on SMP - * @name: flow handler name for /proc/interrupts output * * Pad this out to 32 bytes for cache and indexing reasons. */ @@ -166,9 +165,8 @@ struct irq_desc { cpumask_t pending_mask; #endif #ifdef CONFIG_PROC_FS - struct proc_dir_entry *dir; + struct proc_dir_entry *dir; #endif - const char *name; } ____cacheline_aligned; extern struct irq_desc irq_desc[NR_IRQS]; @@ -273,6 +271,12 @@ extern void fastcall handle_simple_irq(unsigned int irq, struct irq_desc *desc); extern void fastcall handle_percpu_irq(unsigned int irq, struct irq_desc *desc); extern void fastcall handle_bad_irq(unsigned int irq, struct irq_desc *desc); +/* + * Get a descriptive string for the highlevel handler, for + * /proc/interrupts output: + */ +extern const char *handle_irq_name(irq_flow_handler_t handle); + /* * Monolithic do_IRQ implementation. * (is an explicit fastcall, because i386 4KSTACKS calls it from assembly) @@ -322,12 +326,10 @@ extern struct irq_chip no_irq_chip; extern struct irq_chip dummy_irq_chip; extern void -set_irq_chip_and_handler_name(unsigned int irq, struct irq_chip *chip, - irq_flow_handler_t handle, const char *name); - +set_irq_chip_and_handler(unsigned int irq, struct irq_chip *chip, + irq_flow_handler_t handle); extern void -__set_irq_handler(unsigned int irq, irq_flow_handler_t handle, int is_chained, - const char *name); +__set_irq_handler(unsigned int irq, irq_flow_handler_t handle, int is_chained); /* * Set a highlevel flow handler for a given IRQ: @@ -335,7 +337,7 @@ __set_irq_handler(unsigned int irq, irq_flow_handler_t handle, int is_chained, static inline void set_irq_handler(unsigned int irq, irq_flow_handler_t handle) { - __set_irq_handler(irq, handle, 0, NULL); + __set_irq_handler(irq, handle, 0); } /* @@ -347,7 +349,7 @@ static inline void set_irq_chained_handler(unsigned int irq, irq_flow_handler_t handle) { - __set_irq_handler(irq, handle, 1, NULL); + __set_irq_handler(irq, handle, 1); } /* Handle dynamic irq creation and destruction */ diff --git a/trunk/include/linux/lockd/bind.h b/trunk/include/linux/lockd/bind.h index aa50d89eacd7..81e3a185f951 100644 --- a/trunk/include/linux/lockd/bind.h +++ b/trunk/include/linux/lockd/bind.h @@ -10,11 +10,6 @@ #define LINUX_LOCKD_BIND_H #include -/* need xdr-encoded error codes too, so... */ -#include -#ifdef CONFIG_LOCKD_V4 -#include -#endif /* Dummy declarations */ struct svc_rqst; diff --git a/trunk/include/linux/lockd/xdr.h b/trunk/include/linux/lockd/xdr.h index 66fdae3b490c..bb0a0f1caa91 100644 --- a/trunk/include/linux/lockd/xdr.h +++ b/trunk/include/linux/lockd/xdr.h @@ -13,8 +13,6 @@ #include #include -struct svc_rqst; - #define NLM_MAXCOOKIELEN 32 #define NLM_MAXSTRLEN 1024 @@ -24,8 +22,6 @@ struct svc_rqst; #define nlm_lck_blocked __constant_htonl(NLM_LCK_BLOCKED) #define nlm_lck_denied_grace_period __constant_htonl(NLM_LCK_DENIED_GRACE_PERIOD) -#define nlm_drop_reply __constant_htonl(30000) - /* Lock info passed via NLM */ struct nlm_lock { char * caller; diff --git a/trunk/include/linux/lockdep.h b/trunk/include/linux/lockdep.h index 819f08f1310d..1314ca0f29be 100644 --- a/trunk/include/linux/lockdep.h +++ b/trunk/include/linux/lockdep.h @@ -202,7 +202,7 @@ extern int lockdep_internal(void); */ extern void lockdep_init_map(struct lockdep_map *lock, const char *name, - struct lock_class_key *key, int subclass); + struct lock_class_key *key); /* * Reinitialize a lock key - for cases where there is special locking or @@ -211,14 +211,9 @@ extern void lockdep_init_map(struct lockdep_map *lock, const char *name, * or they are too narrow (they suffer from a false class-split): */ #define lockdep_set_class(lock, key) \ - lockdep_init_map(&(lock)->dep_map, #key, key, 0) + lockdep_init_map(&(lock)->dep_map, #key, key) #define lockdep_set_class_and_name(lock, key, name) \ - lockdep_init_map(&(lock)->dep_map, name, key, 0) -#define lockdep_set_class_and_subclass(lock, key, sub) \ - lockdep_init_map(&(lock)->dep_map, #key, key, sub) -#define lockdep_set_subclass(lock, sub) \ - lockdep_init_map(&(lock)->dep_map, #lock, \ - (lock)->dep_map.key, sub) + lockdep_init_map(&(lock)->dep_map, name, key) /* * Acquire a lock. @@ -262,14 +257,10 @@ static inline int lockdep_internal(void) # define lock_release(l, n, i) do { } while (0) # define lockdep_init() do { } while (0) # define lockdep_info() do { } while (0) -# define lockdep_init_map(lock, name, key, sub) do { (void)(key); } while (0) +# define lockdep_init_map(lock, name, key) do { (void)(key); } while (0) # define lockdep_set_class(lock, key) do { (void)(key); } while (0) # define lockdep_set_class_and_name(lock, key, name) \ do { (void)(key); } while (0) -#define lockdep_set_class_and_subclass(lock, key, sub) \ - do { (void)(key); } while (0) -#define lockdep_set_subclass(lock, sub) do { } while (0) - # define INIT_LOCKDEP # define lockdep_reset() do { debug_locks = 1; } while (0) # define lockdep_free_key_range(start, size) do { } while (0) diff --git a/trunk/include/linux/net.h b/trunk/include/linux/net.h index 15c733b816f0..c257f716e00f 100644 --- a/trunk/include/linux/net.h +++ b/trunk/include/linux/net.h @@ -19,7 +19,6 @@ #define _LINUX_NET_H #include -#include #include struct poll_table_struct; @@ -194,9 +193,9 @@ extern int sock_map_fd(struct socket *sock); extern struct socket *sockfd_lookup(int fd, int *err); #define sockfd_put(sock) fput(sock->file) extern int net_ratelimit(void); - -#define net_random() random32() -#define net_srandom(seed) srandom32(seed) +extern unsigned long net_random(void); +extern void net_srandom(unsigned long); +extern void net_random_init(void); extern int kernel_sendmsg(struct socket *sock, struct msghdr *msg, struct kvec *vec, size_t num, size_t len); diff --git a/trunk/include/linux/random.h b/trunk/include/linux/random.h index 0248b30e306d..5d6456bcdeba 100644 --- a/trunk/include/linux/random.h +++ b/trunk/include/linux/random.h @@ -69,9 +69,6 @@ extern struct file_operations random_fops, urandom_fops; unsigned int get_random_int(void); unsigned long randomize_range(unsigned long start, unsigned long end, unsigned long len); -u32 random32(void); -void srandom32(u32 seed); - #endif /* __KERNEL___ */ #endif /* _LINUX_RANDOM_H */ diff --git a/trunk/include/linux/serio.h b/trunk/include/linux/serio.h index b99c5ca9708d..3a697cc6ecae 100644 --- a/trunk/include/linux/serio.h +++ b/trunk/include/linux/serio.h @@ -41,7 +41,6 @@ struct serio { void (*stop)(struct serio *); struct serio *parent, *child; - unsigned int depth; /* level of nesting in serio hierarchy */ struct serio_driver *drv; /* accessed from interrupt, must be protected by serio->lock and serio->sem */ struct mutex drv_mutex; /* protects serio->drv so attributes can pin driver */ diff --git a/trunk/include/linux/sunrpc/msg_prot.h b/trunk/include/linux/sunrpc/msg_prot.h index 606cb2165232..1e65f2dd80e5 100644 --- a/trunk/include/linux/sunrpc/msg_prot.h +++ b/trunk/include/linux/sunrpc/msg_prot.h @@ -56,9 +56,7 @@ enum rpc_accept_stat { RPC_PROG_MISMATCH = 2, RPC_PROC_UNAVAIL = 3, RPC_GARBAGE_ARGS = 4, - RPC_SYSTEM_ERR = 5, - /* internal use only */ - RPC_DROP_REPLY = 60000, + RPC_SYSTEM_ERR = 5 }; enum rpc_reject_stat { diff --git a/trunk/include/linux/sunrpc/xdr.h b/trunk/include/linux/sunrpc/xdr.h index ac69e5511606..953723b09bc6 100644 --- a/trunk/include/linux/sunrpc/xdr.h +++ b/trunk/include/linux/sunrpc/xdr.h @@ -74,7 +74,6 @@ struct xdr_buf { #define rpc_proc_unavail __constant_htonl(RPC_PROC_UNAVAIL) #define rpc_garbage_args __constant_htonl(RPC_GARBAGE_ARGS) #define rpc_system_err __constant_htonl(RPC_SYSTEM_ERR) -#define rpc_drop_reply __constant_htonl(RPC_DROP_REPLY) #define rpc_auth_ok __constant_htonl(RPC_AUTH_OK) #define rpc_autherr_badcred __constant_htonl(RPC_AUTH_BADCRED) diff --git a/trunk/include/linux/videodev2.h b/trunk/include/linux/videodev2.h index df5c4654360d..c5fdf6259548 100644 --- a/trunk/include/linux/videodev2.h +++ b/trunk/include/linux/videodev2.h @@ -243,7 +243,7 @@ struct v4l2_pix_format #define V4L2_PIX_FMT_YUV420 v4l2_fourcc('Y','U','1','2') /* 12 YUV 4:2:0 */ #define V4L2_PIX_FMT_YYUV v4l2_fourcc('Y','Y','U','V') /* 16 YUV 4:2:2 */ #define V4L2_PIX_FMT_HI240 v4l2_fourcc('H','I','2','4') /* 8 8-bit color */ -#define V4L2_PIX_FMT_HM12 v4l2_fourcc('H','M','1','2') /* 8 YUV 4:2:0 16x16 macroblocks */ +#define V4L2_PIX_FMT_HM12 v4l2_fourcc('H','M','1','2') /* 8 YUV 4:1:1 16x16 macroblocks */ /* see http://www.siliconimaging.com/RGB%20Bayer.htm */ #define V4L2_PIX_FMT_SBGGR8 v4l2_fourcc('B','A','8','1') /* 8 BGBG.. GRGR.. */ diff --git a/trunk/include/net/bluetooth/hci_core.h b/trunk/include/net/bluetooth/hci_core.h index c0fc39620f36..df22efcfcc0b 100644 --- a/trunk/include/net/bluetooth/hci_core.h +++ b/trunk/include/net/bluetooth/hci_core.h @@ -153,7 +153,6 @@ struct hci_conn { __u8 mode; __u8 type; __u8 out; - __u8 attempt; __u8 dev_class[3]; __u8 features[8]; __u16 interval; @@ -290,22 +289,6 @@ static inline struct hci_conn *hci_conn_hash_lookup_ba(struct hci_dev *hdev, return NULL; } -static inline struct hci_conn *hci_conn_hash_lookup_state(struct hci_dev *hdev, - __u8 type, __u16 state) -{ - struct hci_conn_hash *h = &hdev->conn_hash; - struct list_head *p; - struct hci_conn *c; - - list_for_each(p, &h->list) { - c = list_entry(p, struct hci_conn, list); - if (c->type == type && c->state == state) - return c; - } - return NULL; -} - -void hci_acl_connect(struct hci_conn *conn); void hci_acl_disconn(struct hci_conn *conn, __u8 reason); void hci_add_sco(struct hci_conn *conn, __u16 handle); diff --git a/trunk/include/net/inetpeer.h b/trunk/include/net/inetpeer.h index f13cc0c2b163..925573fd2aed 100644 --- a/trunk/include/net/inetpeer.h +++ b/trunk/include/net/inetpeer.h @@ -19,7 +19,7 @@ struct inet_peer { struct inet_peer *avl_left, *avl_right; struct inet_peer *unused_next, **unused_prevp; - __u32 dtime; /* the time of last use of not + unsigned long dtime; /* the time of last use of not * referenced entries */ atomic_t refcnt; __be32 v4daddr; /* peer's address */ @@ -35,8 +35,21 @@ void inet_initpeers(void) __init; /* can be called with or without local BH being disabled */ struct inet_peer *inet_getpeer(__be32 daddr, int create); +extern spinlock_t inet_peer_unused_lock; +extern struct inet_peer **inet_peer_unused_tailp; /* can be called from BH context or outside */ -extern void inet_putpeer(struct inet_peer *p); +static inline void inet_putpeer(struct inet_peer *p) +{ + spin_lock_bh(&inet_peer_unused_lock); + if (atomic_dec_and_test(&p->refcnt)) { + p->unused_prevp = inet_peer_unused_tailp; + p->unused_next = NULL; + *inet_peer_unused_tailp = p; + inet_peer_unused_tailp = &p->unused_next; + p->dtime = jiffies; + } + spin_unlock_bh(&inet_peer_unused_lock); +} extern spinlock_t inet_peer_idlock; /* can be called with or without local BH being disabled */ diff --git a/trunk/include/net/netlabel.h b/trunk/include/net/netlabel.h index 12c214b9eadf..113337c27955 100644 --- a/trunk/include/net/netlabel.h +++ b/trunk/include/net/netlabel.h @@ -136,7 +136,7 @@ struct netlbl_lsm_secattr { * on success, NULL on failure. * */ -static inline struct netlbl_lsm_cache *netlbl_secattr_cache_alloc(gfp_t flags) +static inline struct netlbl_lsm_cache *netlbl_secattr_cache_alloc(int flags) { struct netlbl_lsm_cache *cache; diff --git a/trunk/kernel/cpu.c b/trunk/kernel/cpu.c index 27dd3ee47099..32c96628463e 100644 --- a/trunk/kernel/cpu.c +++ b/trunk/kernel/cpu.c @@ -19,7 +19,7 @@ static DEFINE_MUTEX(cpu_add_remove_lock); static DEFINE_MUTEX(cpu_bitmask_lock); -static __cpuinitdata RAW_NOTIFIER_HEAD(cpu_chain); +static __cpuinitdata BLOCKING_NOTIFIER_HEAD(cpu_chain); /* If set, cpu_up and cpu_down will return -EBUSY and do nothing. * Should always be manipulated under cpu_add_remove_lock @@ -68,11 +68,7 @@ EXPORT_SYMBOL_GPL(unlock_cpu_hotplug); /* Need to know about CPUs going up/down? */ int __cpuinit register_cpu_notifier(struct notifier_block *nb) { - int ret; - mutex_lock(&cpu_add_remove_lock); - ret = raw_notifier_chain_register(&cpu_chain, nb); - mutex_unlock(&cpu_add_remove_lock); - return ret; + return blocking_notifier_chain_register(&cpu_chain, nb); } #ifdef CONFIG_HOTPLUG_CPU @@ -81,9 +77,7 @@ EXPORT_SYMBOL(register_cpu_notifier); void unregister_cpu_notifier(struct notifier_block *nb) { - mutex_lock(&cpu_add_remove_lock); - raw_notifier_chain_unregister(&cpu_chain, nb); - mutex_unlock(&cpu_add_remove_lock); + blocking_notifier_chain_unregister(&cpu_chain, nb); } EXPORT_SYMBOL(unregister_cpu_notifier); @@ -132,7 +126,7 @@ static int _cpu_down(unsigned int cpu) if (!cpu_online(cpu)) return -EINVAL; - err = raw_notifier_call_chain(&cpu_chain, CPU_DOWN_PREPARE, + err = blocking_notifier_call_chain(&cpu_chain, CPU_DOWN_PREPARE, (void *)(long)cpu); if (err == NOTIFY_BAD) { printk("%s: attempt to take down CPU %u failed\n", @@ -152,7 +146,7 @@ static int _cpu_down(unsigned int cpu) if (IS_ERR(p)) { /* CPU didn't die: tell everyone. Can't complain. */ - if (raw_notifier_call_chain(&cpu_chain, CPU_DOWN_FAILED, + if (blocking_notifier_call_chain(&cpu_chain, CPU_DOWN_FAILED, (void *)(long)cpu) == NOTIFY_BAD) BUG(); @@ -175,7 +169,7 @@ static int _cpu_down(unsigned int cpu) put_cpu(); /* CPU is completely dead: tell everyone. Too late to complain. */ - if (raw_notifier_call_chain(&cpu_chain, CPU_DEAD, + if (blocking_notifier_call_chain(&cpu_chain, CPU_DEAD, (void *)(long)cpu) == NOTIFY_BAD) BUG(); @@ -212,7 +206,7 @@ static int __devinit _cpu_up(unsigned int cpu) if (cpu_online(cpu) || !cpu_present(cpu)) return -EINVAL; - ret = raw_notifier_call_chain(&cpu_chain, CPU_UP_PREPARE, hcpu); + ret = blocking_notifier_call_chain(&cpu_chain, CPU_UP_PREPARE, hcpu); if (ret == NOTIFY_BAD) { printk("%s: attempt to bring up CPU %u failed\n", __FUNCTION__, cpu); @@ -229,11 +223,11 @@ static int __devinit _cpu_up(unsigned int cpu) BUG_ON(!cpu_online(cpu)); /* Now call notifier in preparation. */ - raw_notifier_call_chain(&cpu_chain, CPU_ONLINE, hcpu); + blocking_notifier_call_chain(&cpu_chain, CPU_ONLINE, hcpu); out_notify: if (ret != 0) - raw_notifier_call_chain(&cpu_chain, + blocking_notifier_call_chain(&cpu_chain, CPU_UP_CANCELED, hcpu); return ret; diff --git a/trunk/kernel/fork.c b/trunk/kernel/fork.c index 29ebb30850ed..7dc6140baac6 100644 --- a/trunk/kernel/fork.c +++ b/trunk/kernel/fork.c @@ -984,8 +984,6 @@ static struct task_struct *copy_process(unsigned long clone_flags, if (!p) goto fork_out; - rt_mutex_init_task(p); - #ifdef CONFIG_TRACE_IRQFLAGS DEBUG_LOCKS_WARN_ON(!p->hardirqs_enabled); DEBUG_LOCKS_WARN_ON(!p->softirqs_enabled); @@ -1090,6 +1088,8 @@ static struct task_struct *copy_process(unsigned long clone_flags, p->lockdep_recursion = 0; #endif + rt_mutex_init_task(p); + #ifdef CONFIG_DEBUG_MUTEXES p->blocked_on = NULL; /* not blocked yet */ #endif diff --git a/trunk/kernel/irq/chip.c b/trunk/kernel/irq/chip.c index 2d0dc3efe813..11c99697acfe 100644 --- a/trunk/kernel/irq/chip.c +++ b/trunk/kernel/irq/chip.c @@ -499,8 +499,7 @@ handle_percpu_irq(unsigned int irq, struct irq_desc *desc) #endif /* CONFIG_SMP */ void -__set_irq_handler(unsigned int irq, irq_flow_handler_t handle, int is_chained, - const char *name) +__set_irq_handler(unsigned int irq, irq_flow_handler_t handle, int is_chained) { struct irq_desc *desc; unsigned long flags; @@ -541,7 +540,6 @@ __set_irq_handler(unsigned int irq, irq_flow_handler_t handle, int is_chained, desc->depth = 1; } desc->handle_irq = handle; - desc->name = name; if (handle != handle_bad_irq && is_chained) { desc->status &= ~IRQ_DISABLED; @@ -557,13 +555,30 @@ set_irq_chip_and_handler(unsigned int irq, struct irq_chip *chip, irq_flow_handler_t handle) { set_irq_chip(irq, chip); - __set_irq_handler(irq, handle, 0, NULL); + __set_irq_handler(irq, handle, 0); } -void -set_irq_chip_and_handler_name(unsigned int irq, struct irq_chip *chip, - irq_flow_handler_t handle, const char *name) +/* + * Get a descriptive string for the highlevel handler, for + * /proc/interrupts output: + */ +const char * +handle_irq_name(irq_flow_handler_t handle) { - set_irq_chip(irq, chip); - __set_irq_handler(irq, handle, 0, name); + if (handle == handle_level_irq) + return "level "; + if (handle == handle_fasteoi_irq) + return "fasteoi"; + if (handle == handle_edge_irq) + return "edge "; + if (handle == handle_simple_irq) + return "simple "; +#ifdef CONFIG_SMP + if (handle == handle_percpu_irq) + return "percpu "; +#endif + if (handle == handle_bad_irq) + return "bad "; + + return NULL; } diff --git a/trunk/kernel/lockdep.c b/trunk/kernel/lockdep.c index b739be2a6dc9..805a322a5655 100644 --- a/trunk/kernel/lockdep.c +++ b/trunk/kernel/lockdep.c @@ -575,8 +575,6 @@ static noinline int print_circular_bug_tail(void) return 0; } -#define RECURSION_LIMIT 40 - static int noinline print_infinite_recursion_bug(void) { __raw_spin_unlock(&hash_lock); @@ -597,7 +595,7 @@ check_noncircular(struct lock_class *source, unsigned int depth) debug_atomic_inc(&nr_cyclic_check_recursions); if (depth > max_recursion_depth) max_recursion_depth = depth; - if (depth >= RECURSION_LIMIT) + if (depth >= 20) return print_infinite_recursion_bug(); /* * Check this lock's dependency list: @@ -647,7 +645,7 @@ find_usage_forwards(struct lock_class *source, unsigned int depth) if (depth > max_recursion_depth) max_recursion_depth = depth; - if (depth >= RECURSION_LIMIT) + if (depth >= 20) return print_infinite_recursion_bug(); debug_atomic_inc(&nr_find_usage_forwards_checks); @@ -686,7 +684,7 @@ find_usage_backwards(struct lock_class *source, unsigned int depth) if (depth > max_recursion_depth) max_recursion_depth = depth; - if (depth >= RECURSION_LIMIT) + if (depth >= 20) return print_infinite_recursion_bug(); debug_atomic_inc(&nr_find_usage_backwards_checks); @@ -1176,7 +1174,7 @@ look_up_lock_class(struct lockdep_map *lock, unsigned int subclass) * itself, so actual lookup of the hash should be once per lock object. */ static inline struct lock_class * -register_lock_class(struct lockdep_map *lock, unsigned int subclass, int force) +register_lock_class(struct lockdep_map *lock, unsigned int subclass) { struct lockdep_subclass_key *key; struct list_head *hash_head; @@ -1248,7 +1246,7 @@ register_lock_class(struct lockdep_map *lock, unsigned int subclass, int force) out_unlock_set: __raw_spin_unlock(&hash_lock); - if (!subclass || force) + if (!subclass) lock->class_cache = class; DEBUG_LOCKS_WARN_ON(class->subclass != subclass); @@ -1936,7 +1934,7 @@ void trace_softirqs_off(unsigned long ip) * Initialize a lock instance's lock-class mapping info: */ void lockdep_init_map(struct lockdep_map *lock, const char *name, - struct lock_class_key *key, int subclass) + struct lock_class_key *key) { if (unlikely(!debug_locks)) return; @@ -1956,8 +1954,6 @@ void lockdep_init_map(struct lockdep_map *lock, const char *name, lock->name = name; lock->key = key; lock->class_cache = NULL; - if (subclass) - register_lock_class(lock, subclass, 1); } EXPORT_SYMBOL_GPL(lockdep_init_map); @@ -1996,7 +1992,7 @@ static int __lock_acquire(struct lockdep_map *lock, unsigned int subclass, * Not cached yet or subclass? */ if (unlikely(!class)) { - class = register_lock_class(lock, subclass, 0); + class = register_lock_class(lock, subclass); if (!class) return 0; } diff --git a/trunk/kernel/mutex-debug.c b/trunk/kernel/mutex-debug.c index 18651641a7b5..e3203c654dda 100644 --- a/trunk/kernel/mutex-debug.c +++ b/trunk/kernel/mutex-debug.c @@ -91,7 +91,7 @@ void debug_mutex_init(struct mutex *lock, const char *name, * Make sure we are not reinitializing a held lock: */ debug_check_no_locks_freed((void *)lock, sizeof(*lock)); - lockdep_init_map(&lock->dep_map, name, key, 0); + lockdep_init_map(&lock->dep_map, name, key); #endif lock->owner = NULL; lock->magic = lock; diff --git a/trunk/kernel/posix-cpu-timers.c b/trunk/kernel/posix-cpu-timers.c index 7c3e1e6dfb5b..479b16b44f79 100644 --- a/trunk/kernel/posix-cpu-timers.c +++ b/trunk/kernel/posix-cpu-timers.c @@ -87,19 +87,6 @@ static inline union cpu_time_count cpu_time_sub(const clockid_t which_clock, return a; } -/* - * Divide and limit the result to res >= 1 - * - * This is necessary to prevent signal delivery starvation, when the result of - * the division would be rounded down to 0. - */ -static inline cputime_t cputime_div_non_zero(cputime_t time, unsigned long div) -{ - cputime_t res = cputime_div(time, div); - - return max_t(cputime_t, res, 1); -} - /* * Update expiry time from increment, and increase overrun count, * given the current clock sample. @@ -496,8 +483,8 @@ static void process_timer_rebalance(struct task_struct *p, BUG(); break; case CPUCLOCK_PROF: - left = cputime_div_non_zero(cputime_sub(expires.cpu, val.cpu), - nthreads); + left = cputime_div(cputime_sub(expires.cpu, val.cpu), + nthreads); do { if (likely(!(t->flags & PF_EXITING))) { ticks = cputime_add(prof_ticks(t), left); @@ -511,8 +498,8 @@ static void process_timer_rebalance(struct task_struct *p, } while (t != p); break; case CPUCLOCK_VIRT: - left = cputime_div_non_zero(cputime_sub(expires.cpu, val.cpu), - nthreads); + left = cputime_div(cputime_sub(expires.cpu, val.cpu), + nthreads); do { if (likely(!(t->flags & PF_EXITING))) { ticks = cputime_add(virt_ticks(t), left); @@ -528,7 +515,6 @@ static void process_timer_rebalance(struct task_struct *p, case CPUCLOCK_SCHED: nsleft = expires.sched - val.sched; do_div(nsleft, nthreads); - nsleft = max_t(unsigned long long, nsleft, 1); do { if (likely(!(t->flags & PF_EXITING))) { ns = t->sched_time + nsleft; @@ -1173,13 +1159,12 @@ static void check_process_timers(struct task_struct *tsk, prof_left = cputime_sub(prof_expires, utime); prof_left = cputime_sub(prof_left, stime); - prof_left = cputime_div_non_zero(prof_left, nthreads); + prof_left = cputime_div(prof_left, nthreads); virt_left = cputime_sub(virt_expires, utime); - virt_left = cputime_div_non_zero(virt_left, nthreads); + virt_left = cputime_div(virt_left, nthreads); if (sched_expires) { sched_left = sched_expires - sched_time; do_div(sched_left, nthreads); - sched_left = max_t(unsigned long long, sched_left, 1); } else { sched_left = 0; } diff --git a/trunk/kernel/power/swap.c b/trunk/kernel/power/swap.c index 1a3b0dd2c3fc..9b2ee5344dee 100644 --- a/trunk/kernel/power/swap.c +++ b/trunk/kernel/power/swap.c @@ -425,8 +425,7 @@ static int submit(int rw, pgoff_t page_off, struct page *page, bio_set_pages_dirty(bio); bio_put(bio); } else { - if (rw == READ) - get_page(page); /* These pages are freed later */ + get_page(page); bio->bi_private = *bio_chain; *bio_chain = bio; submit_bio(rw | (1 << BIO_RW_SYNC), bio); diff --git a/trunk/kernel/sys_ni.c b/trunk/kernel/sys_ni.c index 0e53314b14de..7a3b2e75f040 100644 --- a/trunk/kernel/sys_ni.c +++ b/trunk/kernel/sys_ni.c @@ -49,7 +49,6 @@ cond_syscall(compat_sys_get_robust_list); cond_syscall(sys_epoll_create); cond_syscall(sys_epoll_ctl); cond_syscall(sys_epoll_wait); -cond_syscall(sys_epoll_pwait); cond_syscall(sys_semget); cond_syscall(sys_semop); cond_syscall(sys_semtimedop); diff --git a/trunk/kernel/time/jiffies.c b/trunk/kernel/time/jiffies.c index a99b2a6e6a07..126bb30c4afe 100644 --- a/trunk/kernel/time/jiffies.c +++ b/trunk/kernel/time/jiffies.c @@ -57,7 +57,7 @@ static cycle_t jiffies_read(void) struct clocksource clocksource_jiffies = { .name = "jiffies", - .rating = 1, /* lowest valid rating*/ + .rating = 0, /* lowest rating*/ .read = jiffies_read, .mask = 0xffffffff, /*32bits*/ .mult = NSEC_PER_JIFFY << JIFFIES_SHIFT, /* details above */ diff --git a/trunk/lib/Makefile b/trunk/lib/Makefile index cf98fabaa549..59070dbfbeb4 100644 --- a/trunk/lib/Makefile +++ b/trunk/lib/Makefile @@ -5,14 +5,14 @@ lib-y := ctype.o string.o vsprintf.o cmdline.o \ bust_spinlocks.o rbtree.o radix-tree.o dump_stack.o \ idr.o div64.o int_sqrt.o bitmap.o extable.o prio_tree.o \ - sha1.o irq_regs.o + sha1.o irq_regs.o carta_random32.o lib-$(CONFIG_MMU) += ioremap.o lib-$(CONFIG_SMP) += cpumask.o lib-y += kobject.o kref.o kobject_uevent.o klist.o -obj-y += sort.o parser.o halfmd4.o iomap_copy.o debug_locks.o random32.o +obj-y += sort.o parser.o halfmd4.o iomap_copy.o debug_locks.o ifeq ($(CONFIG_DEBUG_KOBJECT),y) CFLAGS_kobject.o += -DDEBUG diff --git a/trunk/lib/carta_random32.c b/trunk/lib/carta_random32.c new file mode 100644 index 000000000000..ca82df70eee4 --- /dev/null +++ b/trunk/lib/carta_random32.c @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2002-2006 Hewlett-Packard Development Company, L.P. + * Contributed by David Mosberger-Tang + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU General Public + * License as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + * 02111-1307 USA + */ +#include +#include + +/* + * Fast, simple, yet decent quality random number generator based on + * a paper by David G. Carta ("Two Fast Implementations of the + * `Minimal Standard' Random Number Generator," Communications of the + * ACM, January, 1990). + */ +u64 carta_random32 (u64 seed) +{ +# define A 16807 +# define M ((u32) 1 << 31) + u64 s, prod = A * seed, p, q; + + p = (prod >> 31) & (M - 1); + q = (prod >> 0) & (M - 1); + s = p + q; + if (s >= M) + s -= M - 1; + return s; +} +EXPORT_SYMBOL_GPL(carta_random32); diff --git a/trunk/lib/kobject.c b/trunk/lib/kobject.c index 7dd5c0e9d996..1699eb9161f3 100644 --- a/trunk/lib/kobject.c +++ b/trunk/lib/kobject.c @@ -119,7 +119,6 @@ char *kobject_get_path(struct kobject *kobj, gfp_t gfp_mask) return path; } -EXPORT_SYMBOL_GPL(kobject_get_path); /** * kobject_init - initialize object. diff --git a/trunk/lib/random32.c b/trunk/lib/random32.c deleted file mode 100644 index 4a15ce51cea7..000000000000 --- a/trunk/lib/random32.c +++ /dev/null @@ -1,142 +0,0 @@ -/* - This is a maximally equidistributed combined Tausworthe generator - based on code from GNU Scientific Library 1.5 (30 Jun 2004) - - x_n = (s1_n ^ s2_n ^ s3_n) - - s1_{n+1} = (((s1_n & 4294967294) <<12) ^ (((s1_n <<13) ^ s1_n) >>19)) - s2_{n+1} = (((s2_n & 4294967288) << 4) ^ (((s2_n << 2) ^ s2_n) >>25)) - s3_{n+1} = (((s3_n & 4294967280) <<17) ^ (((s3_n << 3) ^ s3_n) >>11)) - - The period of this generator is about 2^88. - - From: P. L'Ecuyer, "Maximally Equidistributed Combined Tausworthe - Generators", Mathematics of Computation, 65, 213 (1996), 203--213. - - This is available on the net from L'Ecuyer's home page, - - http://www.iro.umontreal.ca/~lecuyer/myftp/papers/tausme.ps - ftp://ftp.iro.umontreal.ca/pub/simulation/lecuyer/papers/tausme.ps - - There is an erratum in the paper "Tables of Maximally - Equidistributed Combined LFSR Generators", Mathematics of - Computation, 68, 225 (1999), 261--269: - http://www.iro.umontreal.ca/~lecuyer/myftp/papers/tausme2.ps - - ... the k_j most significant bits of z_j must be non- - zero, for each j. (Note: this restriction also applies to the - computer code given in [4], but was mistakenly not mentioned in - that paper.) - - This affects the seeding procedure by imposing the requirement - s1 > 1, s2 > 7, s3 > 15. - -*/ - -#include -#include -#include -#include - -struct rnd_state { - u32 s1, s2, s3; -}; - -static DEFINE_PER_CPU(struct rnd_state, net_rand_state); - -static u32 __random32(struct rnd_state *state) -{ -#define TAUSWORTHE(s,a,b,c,d) ((s&c)<>b) - - state->s1 = TAUSWORTHE(state->s1, 13, 19, 4294967294UL, 12); - state->s2 = TAUSWORTHE(state->s2, 2, 25, 4294967288UL, 4); - state->s3 = TAUSWORTHE(state->s3, 3, 11, 4294967280UL, 17); - - return (state->s1 ^ state->s2 ^ state->s3); -} - -static void __set_random32(struct rnd_state *state, unsigned long s) -{ - if (s == 0) - s = 1; /* default seed is 1 */ - -#define LCG(n) (69069 * n) - state->s1 = LCG(s); - state->s2 = LCG(state->s1); - state->s3 = LCG(state->s2); - - /* "warm it up" */ - __random32(state); - __random32(state); - __random32(state); - __random32(state); - __random32(state); - __random32(state); -} - -/** - * random32 - pseudo random number generator - * - * A 32 bit pseudo-random number is generated using a fast - * algorithm suitable for simulation. This algorithm is NOT - * considered safe for cryptographic use. - */ -u32 random32(void) -{ - unsigned long r; - struct rnd_state *state = &get_cpu_var(net_rand_state); - r = __random32(state); - put_cpu_var(state); - return r; -} -EXPORT_SYMBOL(random32); - -/** - * srandom32 - add entropy to pseudo random number generator - * @seed: seed value - * - * Add some additional seeding to the random32() pool. - * Note: this pool is per cpu so it only affects current CPU. - */ -void srandom32(u32 entropy) -{ - struct rnd_state *state = &get_cpu_var(net_rand_state); - __set_random32(state, state->s1 ^ entropy); - put_cpu_var(state); -} -EXPORT_SYMBOL(srandom32); - -/* - * Generate some initially weak seeding values to allow - * to start the random32() engine. - */ -static int __init random32_init(void) -{ - int i; - - for_each_possible_cpu(i) { - struct rnd_state *state = &per_cpu(net_rand_state,i); - __set_random32(state, i + jiffies); - } - return 0; -} -core_initcall(random32_init); - -/* - * Generate better values after random number generator - * is fully initalized. - */ -static int __init random32_reseed(void) -{ - int i; - unsigned long seed; - - for_each_possible_cpu(i) { - struct rnd_state *state = &per_cpu(net_rand_state,i); - - get_random_bytes(&seed, sizeof(seed)); - __set_random32(state, seed); - } - return 0; -} -late_initcall(random32_reseed); diff --git a/trunk/lib/rwsem-spinlock.c b/trunk/lib/rwsem-spinlock.c index c4cfd6c0342f..db4fed74b940 100644 --- a/trunk/lib/rwsem-spinlock.c +++ b/trunk/lib/rwsem-spinlock.c @@ -28,7 +28,7 @@ void __init_rwsem(struct rw_semaphore *sem, const char *name, * Make sure we are not reinitializing a held semaphore: */ debug_check_no_locks_freed((void *)sem, sizeof(*sem)); - lockdep_init_map(&sem->dep_map, name, key, 0); + lockdep_init_map(&sem->dep_map, name, key); #endif sem->activity = 0; spin_lock_init(&sem->wait_lock); diff --git a/trunk/lib/rwsem.c b/trunk/lib/rwsem.c index cdb4e3d05607..901d0e7da892 100644 --- a/trunk/lib/rwsem.c +++ b/trunk/lib/rwsem.c @@ -19,7 +19,7 @@ void __init_rwsem(struct rw_semaphore *sem, const char *name, * Make sure we are not reinitializing a held semaphore: */ debug_check_no_locks_freed((void *)sem, sizeof(*sem)); - lockdep_init_map(&sem->dep_map, name, key, 0); + lockdep_init_map(&sem->dep_map, name, key); #endif sem->count = RWSEM_UNLOCKED_VALUE; spin_lock_init(&sem->wait_lock); diff --git a/trunk/lib/spinlock_debug.c b/trunk/lib/spinlock_debug.c index b6c4f898197c..dafaf1de2491 100644 --- a/trunk/lib/spinlock_debug.c +++ b/trunk/lib/spinlock_debug.c @@ -20,7 +20,7 @@ void __spin_lock_init(spinlock_t *lock, const char *name, * Make sure we are not reinitializing a held lock: */ debug_check_no_locks_freed((void *)lock, sizeof(*lock)); - lockdep_init_map(&lock->dep_map, name, key, 0); + lockdep_init_map(&lock->dep_map, name, key); #endif lock->raw_lock = (raw_spinlock_t)__RAW_SPIN_LOCK_UNLOCKED; lock->magic = SPINLOCK_MAGIC; @@ -38,7 +38,7 @@ void __rwlock_init(rwlock_t *lock, const char *name, * Make sure we are not reinitializing a held lock: */ debug_check_no_locks_freed((void *)lock, sizeof(*lock)); - lockdep_init_map(&lock->dep_map, name, key, 0); + lockdep_init_map(&lock->dep_map, name, key); #endif lock->raw_lock = (raw_rwlock_t) __RAW_RW_LOCK_UNLOCKED; lock->magic = RWLOCK_MAGIC; diff --git a/trunk/mm/mmap.c b/trunk/mm/mmap.c index 497e502dfd6b..eea8eefd51a8 100644 --- a/trunk/mm/mmap.c +++ b/trunk/mm/mmap.c @@ -900,6 +900,17 @@ unsigned long do_mmap_pgoff(struct file * file, unsigned long addr, int accountable = 1; unsigned long charged = 0, reqprot = prot; + if (file) { + if (is_file_hugepages(file)) + accountable = 0; + + if (!file->f_op || !file->f_op->mmap) + return -ENODEV; + + if ((prot & PROT_EXEC) && + (file->f_vfsmnt->mnt_flags & MNT_NOEXEC)) + return -EPERM; + } /* * Does the application expect PROT_READ to imply PROT_EXEC? * @@ -989,16 +1000,6 @@ unsigned long do_mmap_pgoff(struct file * file, unsigned long addr, case MAP_PRIVATE: if (!(file->f_mode & FMODE_READ)) return -EACCES; - if (file->f_vfsmnt->mnt_flags & MNT_NOEXEC) { - if (vm_flags & VM_EXEC) - return -EPERM; - vm_flags &= ~VM_MAYEXEC; - } - if (is_file_hugepages(file)) - accountable = 0; - - if (!file->f_op || !file->f_op->mmap) - return -ENODEV; break; default: diff --git a/trunk/mm/shmem.c b/trunk/mm/shmem.c index b378f66cf2f9..bb8ca7ef7094 100644 --- a/trunk/mm/shmem.c +++ b/trunk/mm/shmem.c @@ -1362,7 +1362,6 @@ shmem_get_inode(struct super_block *sb, int mode, dev_t dev) inode->i_mapping->a_ops = &shmem_aops; inode->i_mapping->backing_dev_info = &shmem_backing_dev_info; inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; - inode->i_generation = get_seconds(); info = SHMEM_I(inode); memset(info, 0, (char *)inode - (char *)info); spin_lock_init(&info->lock); @@ -1957,85 +1956,6 @@ static struct xattr_handler *shmem_xattr_handlers[] = { }; #endif -static struct dentry *shmem_get_parent(struct dentry *child) -{ - return ERR_PTR(-ESTALE); -} - -static int shmem_match(struct inode *ino, void *vfh) -{ - __u32 *fh = vfh; - __u64 inum = fh[2]; - inum = (inum << 32) | fh[1]; - return ino->i_ino == inum && fh[0] == ino->i_generation; -} - -static struct dentry *shmem_get_dentry(struct super_block *sb, void *vfh) -{ - struct dentry *de = NULL; - struct inode *inode; - __u32 *fh = vfh; - __u64 inum = fh[2]; - inum = (inum << 32) | fh[1]; - - inode = ilookup5(sb, (unsigned long)(inum+fh[0]), shmem_match, vfh); - if (inode) { - de = d_find_alias(inode); - iput(inode); - } - - return de? de: ERR_PTR(-ESTALE); -} - -static struct dentry *shmem_decode_fh(struct super_block *sb, __u32 *fh, - int len, int type, - int (*acceptable)(void *context, struct dentry *de), - void *context) -{ - if (len < 3) - return ERR_PTR(-ESTALE); - - return sb->s_export_op->find_exported_dentry(sb, fh, NULL, acceptable, - context); -} - -static int shmem_encode_fh(struct dentry *dentry, __u32 *fh, int *len, - int connectable) -{ - struct inode *inode = dentry->d_inode; - - if (*len < 3) - return 255; - - if (hlist_unhashed(&inode->i_hash)) { - /* Unfortunately insert_inode_hash is not idempotent, - * so as we hash inodes here rather than at creation - * time, we need a lock to ensure we only try - * to do it once - */ - static DEFINE_SPINLOCK(lock); - spin_lock(&lock); - if (hlist_unhashed(&inode->i_hash)) - __insert_inode_hash(inode, - inode->i_ino + inode->i_generation); - spin_unlock(&lock); - } - - fh[0] = inode->i_generation; - fh[1] = inode->i_ino; - fh[2] = ((__u64)inode->i_ino) >> 32; - - *len = 3; - return 1; -} - -static struct export_operations shmem_export_ops = { - .get_parent = shmem_get_parent, - .get_dentry = shmem_get_dentry, - .encode_fh = shmem_encode_fh, - .decode_fh = shmem_decode_fh, -}; - static int shmem_parse_options(char *options, int *mode, uid_t *uid, gid_t *gid, unsigned long *blocks, unsigned long *inodes, int *policy, nodemask_t *policy_nodes) @@ -2208,7 +2128,6 @@ static int shmem_fill_super(struct super_block *sb, &inodes, &policy, &policy_nodes)) return -EINVAL; } - sb->s_export_op = &shmem_export_ops; #else sb->s_flags |= MS_NOUSER; #endif diff --git a/trunk/mm/truncate.c b/trunk/mm/truncate.c index e07b1e682c38..11ca480701dd 100644 --- a/trunk/mm/truncate.c +++ b/trunk/mm/truncate.c @@ -96,6 +96,7 @@ invalidate_complete_page(struct address_space *mapping, struct page *page) return 0; ret = remove_mapping(mapping, page); + ClearPageUptodate(page); return ret; } diff --git a/trunk/mm/vmalloc.c b/trunk/mm/vmalloc.c index 1133dd3aafcf..750ab6ed13fc 100644 --- a/trunk/mm/vmalloc.c +++ b/trunk/mm/vmalloc.c @@ -428,11 +428,8 @@ void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask, if (array_size > PAGE_SIZE) { pages = __vmalloc_node(array_size, gfp_mask, PAGE_KERNEL, node); area->flags |= VM_VPAGES; - } else { - pages = kmalloc_node(array_size, - (gfp_mask & ~(__GFP_HIGHMEM | __GFP_ZERO)), - node); - } + } else + pages = kmalloc_node(array_size, (gfp_mask & ~__GFP_HIGHMEM), node); area->pages = pages; if (!area->pages) { remove_vm_area(area->addr); diff --git a/trunk/mm/vmscan.c b/trunk/mm/vmscan.c index af73c14f9d88..eca70310adb2 100644 --- a/trunk/mm/vmscan.c +++ b/trunk/mm/vmscan.c @@ -378,12 +378,6 @@ static pageout_t pageout(struct page *page, struct address_space *mapping) return PAGE_CLEAN; } -/* - * Attempt to detach a locked page from its ->mapping. If it is dirty or if - * someone else has a ref on the page, abort and return 0. If it was - * successfully detached, return 1. Assumes the caller has a single ref on - * this page. - */ int remove_mapping(struct address_space *mapping, struct page *page) { BUG_ON(!PageLocked(page)); diff --git a/trunk/net/bluetooth/af_bluetooth.c b/trunk/net/bluetooth/af_bluetooth.c index 67df99e2e5c8..305a099b7477 100644 --- a/trunk/net/bluetooth/af_bluetooth.c +++ b/trunk/net/bluetooth/af_bluetooth.c @@ -48,56 +48,41 @@ #define BT_DBG(D...) #endif -#define VERSION "2.11" +#define VERSION "2.10" /* Bluetooth sockets */ #define BT_MAX_PROTO 8 static struct net_proto_family *bt_proto[BT_MAX_PROTO]; -static DEFINE_RWLOCK(bt_proto_lock); int bt_sock_register(int proto, struct net_proto_family *ops) { - int err = 0; - if (proto < 0 || proto >= BT_MAX_PROTO) return -EINVAL; - write_lock(&bt_proto_lock); - if (bt_proto[proto]) - err = -EEXIST; - else - bt_proto[proto] = ops; - - write_unlock(&bt_proto_lock); + return -EEXIST; - return err; + bt_proto[proto] = ops; + return 0; } EXPORT_SYMBOL(bt_sock_register); int bt_sock_unregister(int proto) { - int err = 0; - if (proto < 0 || proto >= BT_MAX_PROTO) return -EINVAL; - write_lock(&bt_proto_lock); - if (!bt_proto[proto]) - err = -ENOENT; - else - bt_proto[proto] = NULL; + return -ENOENT; - write_unlock(&bt_proto_lock); - - return err; + bt_proto[proto] = NULL; + return 0; } EXPORT_SYMBOL(bt_sock_unregister); static int bt_sock_create(struct socket *sock, int proto) { - int err; + int err = 0; if (proto < 0 || proto >= BT_MAX_PROTO) return -EINVAL; @@ -107,18 +92,11 @@ static int bt_sock_create(struct socket *sock, int proto) request_module("bt-proto-%d", proto); } #endif - err = -EPROTONOSUPPORT; - - read_lock(&bt_proto_lock); - if (bt_proto[proto] && try_module_get(bt_proto[proto]->owner)) { err = bt_proto[proto]->create(sock, proto); module_put(bt_proto[proto]->owner); } - - read_unlock(&bt_proto_lock); - return err; } diff --git a/trunk/net/bluetooth/bnep/core.c b/trunk/net/bluetooth/bnep/core.c index 4d3424c2421c..2312d050eeed 100644 --- a/trunk/net/bluetooth/bnep/core.c +++ b/trunk/net/bluetooth/bnep/core.c @@ -528,10 +528,12 @@ static struct device *bnep_get_device(struct bnep_session *session) return NULL; conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, dst); + if (!conn) + return NULL; hci_dev_put(hdev); - return conn ? &conn->dev : NULL; + return &conn->dev; } int bnep_add_connection(struct bnep_connadd_req *req, struct socket *sock) diff --git a/trunk/net/bluetooth/bnep/sock.c b/trunk/net/bluetooth/bnep/sock.c index 5563db1bf526..28c55835422a 100644 --- a/trunk/net/bluetooth/bnep/sock.c +++ b/trunk/net/bluetooth/bnep/sock.c @@ -43,7 +43,6 @@ #include #include #include -#include #include #include @@ -147,56 +146,24 @@ static int bnep_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long return 0; } -#ifdef CONFIG_COMPAT -static int bnep_sock_compat_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) -{ - if (cmd == BNEPGETCONNLIST) { - struct bnep_connlist_req cl; - uint32_t uci; - int err; - - if (get_user(cl.cnum, (uint32_t __user *) arg) || - get_user(uci, (u32 __user *) (arg + 4))) - return -EFAULT; - - cl.ci = compat_ptr(uci); - - if (cl.cnum <= 0) - return -EINVAL; - - err = bnep_get_connlist(&cl); - - if (!err && put_user(cl.cnum, (uint32_t __user *) arg)) - err = -EFAULT; - - return err; - } - - return bnep_sock_ioctl(sock, cmd, arg); -} -#endif - static const struct proto_ops bnep_sock_ops = { - .family = PF_BLUETOOTH, - .owner = THIS_MODULE, - .release = bnep_sock_release, - .ioctl = bnep_sock_ioctl, -#ifdef CONFIG_COMPAT - .compat_ioctl = bnep_sock_compat_ioctl, -#endif - .bind = sock_no_bind, - .getname = sock_no_getname, - .sendmsg = sock_no_sendmsg, - .recvmsg = sock_no_recvmsg, - .poll = sock_no_poll, - .listen = sock_no_listen, - .shutdown = sock_no_shutdown, - .setsockopt = sock_no_setsockopt, - .getsockopt = sock_no_getsockopt, - .connect = sock_no_connect, - .socketpair = sock_no_socketpair, - .accept = sock_no_accept, - .mmap = sock_no_mmap + .family = PF_BLUETOOTH, + .owner = THIS_MODULE, + .release = bnep_sock_release, + .ioctl = bnep_sock_ioctl, + .bind = sock_no_bind, + .getname = sock_no_getname, + .sendmsg = sock_no_sendmsg, + .recvmsg = sock_no_recvmsg, + .poll = sock_no_poll, + .listen = sock_no_listen, + .shutdown = sock_no_shutdown, + .setsockopt = sock_no_setsockopt, + .getsockopt = sock_no_getsockopt, + .connect = sock_no_connect, + .socketpair = sock_no_socketpair, + .accept = sock_no_accept, + .mmap = sock_no_mmap }; static struct proto bnep_proto = { @@ -214,7 +181,7 @@ static int bnep_sock_create(struct socket *sock, int protocol) if (sock->type != SOCK_RAW) return -ESOCKTNOSUPPORT; - sk = sk_alloc(PF_BLUETOOTH, GFP_ATOMIC, &bnep_proto, 1); + sk = sk_alloc(PF_BLUETOOTH, GFP_KERNEL, &bnep_proto, 1); if (!sk) return -ENOMEM; diff --git a/trunk/net/bluetooth/cmtp/sock.c b/trunk/net/bluetooth/cmtp/sock.c index 53295d33dc5c..10ad7fd91d83 100644 --- a/trunk/net/bluetooth/cmtp/sock.c +++ b/trunk/net/bluetooth/cmtp/sock.c @@ -34,7 +34,6 @@ #include #include #include -#include #include #include @@ -138,43 +137,11 @@ static int cmtp_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long return -EINVAL; } -#ifdef CONFIG_COMPAT -static int cmtp_sock_compat_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) -{ - if (cmd == CMTPGETCONNLIST) { - struct cmtp_connlist_req cl; - uint32_t uci; - int err; - - if (get_user(cl.cnum, (uint32_t __user *) arg) || - get_user(uci, (u32 __user *) (arg + 4))) - return -EFAULT; - - cl.ci = compat_ptr(uci); - - if (cl.cnum <= 0) - return -EINVAL; - - err = cmtp_get_connlist(&cl); - - if (!err && put_user(cl.cnum, (uint32_t __user *) arg)) - err = -EFAULT; - - return err; - } - - return cmtp_sock_ioctl(sock, cmd, arg); -} -#endif - static const struct proto_ops cmtp_sock_ops = { .family = PF_BLUETOOTH, .owner = THIS_MODULE, .release = cmtp_sock_release, .ioctl = cmtp_sock_ioctl, -#ifdef CONFIG_COMPAT - .compat_ioctl = cmtp_sock_compat_ioctl, -#endif .bind = sock_no_bind, .getname = sock_no_getname, .sendmsg = sock_no_sendmsg, @@ -205,7 +172,7 @@ static int cmtp_sock_create(struct socket *sock, int protocol) if (sock->type != SOCK_RAW) return -ESOCKTNOSUPPORT; - sk = sk_alloc(PF_BLUETOOTH, GFP_ATOMIC, &cmtp_proto, 1); + sk = sk_alloc(PF_BLUETOOTH, GFP_KERNEL, &cmtp_proto, 1); if (!sk) return -ENOMEM; diff --git a/trunk/net/bluetooth/hci_conn.c b/trunk/net/bluetooth/hci_conn.c index 6cd5711fa28a..90e3a285a17e 100644 --- a/trunk/net/bluetooth/hci_conn.c +++ b/trunk/net/bluetooth/hci_conn.c @@ -51,7 +51,7 @@ #define BT_DBG(D...) #endif -void hci_acl_connect(struct hci_conn *conn) +static void hci_acl_connect(struct hci_conn *conn) { struct hci_dev *hdev = conn->hdev; struct inquiry_entry *ie; @@ -63,8 +63,6 @@ void hci_acl_connect(struct hci_conn *conn) conn->out = 1; conn->link_mode = HCI_LM_MASTER; - conn->attempt++; - memset(&cp, 0, sizeof(cp)); bacpy(&cp.bdaddr, &conn->dst); cp.pscan_rep_mode = 0x02; @@ -82,7 +80,7 @@ void hci_acl_connect(struct hci_conn *conn) cp.role_switch = 0x01; else cp.role_switch = 0x00; - + hci_send_cmd(hdev, OGF_LINK_CTL, OCF_CREATE_CONN, sizeof(cp), &cp); } diff --git a/trunk/net/bluetooth/hci_event.c b/trunk/net/bluetooth/hci_event.c index 65f094845719..d43d0c890975 100644 --- a/trunk/net/bluetooth/hci_event.c +++ b/trunk/net/bluetooth/hci_event.c @@ -414,12 +414,9 @@ static inline void hci_cs_create_conn(struct hci_dev *hdev, __u8 status) if (status) { if (conn && conn->state == BT_CONNECT) { - if (status != 0x0c || conn->attempt > 2) { - conn->state = BT_CLOSED; - hci_proto_connect_cfm(conn, status); - hci_conn_del(conn); - } else - conn->state = BT_CONNECT2; + conn->state = BT_CLOSED; + hci_proto_connect_cfm(conn, status); + hci_conn_del(conn); } } else { if (!conn) { @@ -731,7 +728,7 @@ static inline void hci_conn_request_evt(struct hci_dev *hdev, struct sk_buff *sk static inline void hci_conn_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) { struct hci_ev_conn_complete *ev = (struct hci_ev_conn_complete *) skb->data; - struct hci_conn *conn, *pend; + struct hci_conn *conn; BT_DBG("%s", hdev->name); @@ -804,10 +801,6 @@ static inline void hci_conn_complete_evt(struct hci_dev *hdev, struct sk_buff *s if (ev->status) hci_conn_del(conn); - pend = hci_conn_hash_lookup_state(hdev, ACL_LINK, BT_CONNECT2); - if (pend) - hci_acl_connect(pend); - hci_dev_unlock(hdev); } diff --git a/trunk/net/bluetooth/hci_sock.c b/trunk/net/bluetooth/hci_sock.c index f26a9eb49945..1a35d343e08a 100644 --- a/trunk/net/bluetooth/hci_sock.c +++ b/trunk/net/bluetooth/hci_sock.c @@ -618,7 +618,7 @@ static int hci_sock_create(struct socket *sock, int protocol) sock->ops = &hci_sock_ops; - sk = sk_alloc(PF_BLUETOOTH, GFP_ATOMIC, &hci_sk_proto, 1); + sk = sk_alloc(PF_BLUETOOTH, GFP_KERNEL, &hci_sk_proto, 1); if (!sk) return -ENOMEM; diff --git a/trunk/net/bluetooth/hci_sysfs.c b/trunk/net/bluetooth/hci_sysfs.c index 954eb74eb370..989b22d9042e 100644 --- a/trunk/net/bluetooth/hci_sysfs.c +++ b/trunk/net/bluetooth/hci_sysfs.c @@ -242,14 +242,10 @@ static void add_conn(void *data) struct hci_conn *conn = data; int i; - if (device_register(&conn->dev) < 0) { - BT_ERR("Failed to register connection device"); - return; - } + device_register(&conn->dev); for (i = 0; conn_attrs[i]; i++) - if (device_create_file(&conn->dev, conn_attrs[i]) < 0) - BT_ERR("Failed to create connection attribute"); + device_create_file(&conn->dev, conn_attrs[i]); } void hci_conn_add_sysfs(struct hci_conn *conn) @@ -299,7 +295,11 @@ int hci_register_sysfs(struct hci_dev *hdev) BT_DBG("%p name %s type %d", hdev, hdev->name, hdev->type); dev->class = bt_class; - dev->parent = hdev->parent; + + if (hdev->parent) + dev->parent = hdev->parent; + else + dev->parent = &bt_platform->dev; strlcpy(dev->bus_id, hdev->name, BUS_ID_SIZE); @@ -312,8 +312,7 @@ int hci_register_sysfs(struct hci_dev *hdev) return err; for (i = 0; bt_attrs[i]; i++) - if (device_create_file(dev, bt_attrs[i]) < 0) - BT_ERR("Failed to create device attribute"); + device_create_file(dev, bt_attrs[i]); return 0; } diff --git a/trunk/net/bluetooth/hidp/core.c b/trunk/net/bluetooth/hidp/core.c index 9a562cf7406b..03b5dadb4951 100644 --- a/trunk/net/bluetooth/hidp/core.c +++ b/trunk/net/bluetooth/hidp/core.c @@ -510,11 +510,11 @@ static int hidp_session(void *arg) if (intr_sk->sk_state != BT_CONNECTED) wait_event_timeout(*(ctrl_sk->sk_sleep), (ctrl_sk->sk_state == BT_CLOSED), HZ); - fput(session->intr_sock->file); + fput(session->ctrl_sock->file); wait_event_timeout(*(intr_sk->sk_sleep), (intr_sk->sk_state == BT_CLOSED), HZ); - fput(session->ctrl_sock->file); + fput(session->intr_sock->file); __hidp_unlink_session(session); @@ -541,10 +541,12 @@ static struct device *hidp_get_device(struct hidp_session *session) return NULL; conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, dst); + if (!conn) + return NULL; hci_dev_put(hdev); - return conn ? &conn->dev : NULL; + return &conn->dev; } static inline void hidp_setup_input(struct hidp_session *session, struct hidp_connadd_req *req) diff --git a/trunk/net/bluetooth/hidp/sock.c b/trunk/net/bluetooth/hidp/sock.c index 407fba43c1b9..099646e4e2ef 100644 --- a/trunk/net/bluetooth/hidp/sock.c +++ b/trunk/net/bluetooth/hidp/sock.c @@ -35,7 +35,6 @@ #include #include #include -#include #include #include "hidp.h" @@ -144,88 +143,11 @@ static int hidp_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long return -EINVAL; } -#ifdef CONFIG_COMPAT -struct compat_hidp_connadd_req { - int ctrl_sock; // Connected control socket - int intr_sock; // Connteted interrupt socket - __u16 parser; - __u16 rd_size; - compat_uptr_t rd_data; - __u8 country; - __u8 subclass; - __u16 vendor; - __u16 product; - __u16 version; - __u32 flags; - __u32 idle_to; - char name[128]; -}; - -static int hidp_sock_compat_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) -{ - if (cmd == HIDPGETCONNLIST) { - struct hidp_connlist_req cl; - uint32_t uci; - int err; - - if (get_user(cl.cnum, (uint32_t __user *) arg) || - get_user(uci, (u32 __user *) (arg + 4))) - return -EFAULT; - - cl.ci = compat_ptr(uci); - - if (cl.cnum <= 0) - return -EINVAL; - - err = hidp_get_connlist(&cl); - - if (!err && put_user(cl.cnum, (uint32_t __user *) arg)) - err = -EFAULT; - - return err; - } else if (cmd == HIDPCONNADD) { - struct compat_hidp_connadd_req ca; - struct hidp_connadd_req __user *uca; - - uca = compat_alloc_user_space(sizeof(*uca)); - - if (copy_from_user(&ca, (void *) arg, sizeof(ca))) - return -EFAULT; - - if (put_user(ca.ctrl_sock, &uca->ctrl_sock) || - put_user(ca.intr_sock, &uca->intr_sock) || - put_user(ca.parser, &uca->parser) || - put_user(ca.rd_size, &uca->parser) || - put_user(compat_ptr(ca.rd_data), &uca->rd_data) || - put_user(ca.country, &uca->country) || - put_user(ca.subclass, &uca->subclass) || - put_user(ca.vendor, &uca->vendor) || - put_user(ca.product, &uca->product) || - put_user(ca.version, &uca->version) || - put_user(ca.flags, &uca->flags) || - put_user(ca.idle_to, &uca->idle_to) || - copy_to_user(&uca->name[0], &ca.name[0], 128)) - return -EFAULT; - - arg = (unsigned long) uca; - - /* Fall through. We don't actually write back any _changes_ - to the structure anyway, so there's no need to copy back - into the original compat version */ - } - - return hidp_sock_ioctl(sock, cmd, arg); -} -#endif - static const struct proto_ops hidp_sock_ops = { .family = PF_BLUETOOTH, .owner = THIS_MODULE, .release = hidp_sock_release, .ioctl = hidp_sock_ioctl, -#ifdef CONFIG_COMPAT - .compat_ioctl = hidp_sock_compat_ioctl, -#endif .bind = sock_no_bind, .getname = sock_no_getname, .sendmsg = sock_no_sendmsg, @@ -256,7 +178,7 @@ static int hidp_sock_create(struct socket *sock, int protocol) if (sock->type != SOCK_RAW) return -ESOCKTNOSUPPORT; - sk = sk_alloc(PF_BLUETOOTH, GFP_ATOMIC, &hidp_proto, 1); + sk = sk_alloc(PF_BLUETOOTH, GFP_KERNEL, &hidp_proto, 1); if (!sk) return -ENOMEM; diff --git a/trunk/net/bluetooth/l2cap.c b/trunk/net/bluetooth/l2cap.c index 2b3dcb8f90fa..d56f60b392ac 100644 --- a/trunk/net/bluetooth/l2cap.c +++ b/trunk/net/bluetooth/l2cap.c @@ -559,7 +559,7 @@ static int l2cap_sock_create(struct socket *sock, int protocol) sock->ops = &l2cap_sock_ops; - sk = l2cap_sock_alloc(sock, protocol, GFP_ATOMIC); + sk = l2cap_sock_alloc(sock, protocol, GFP_KERNEL); if (!sk) return -ENOMEM; @@ -2216,8 +2216,7 @@ static int __init l2cap_init(void) goto error; } - if (class_create_file(bt_class, &class_attr_l2cap) < 0) - BT_ERR("Failed to create L2CAP info file"); + class_create_file(bt_class, &class_attr_l2cap); BT_INFO("L2CAP ver %s", VERSION); BT_INFO("L2CAP socket layer initialized"); diff --git a/trunk/net/bluetooth/rfcomm/core.c b/trunk/net/bluetooth/rfcomm/core.c index ddc4e9d5963e..468df3b953f6 100644 --- a/trunk/net/bluetooth/rfcomm/core.c +++ b/trunk/net/bluetooth/rfcomm/core.c @@ -2058,8 +2058,7 @@ static int __init rfcomm_init(void) kernel_thread(rfcomm_run, NULL, CLONE_KERNEL); - if (class_create_file(bt_class, &class_attr_rfcomm_dlc) < 0) - BT_ERR("Failed to create RFCOMM info file"); + class_create_file(bt_class, &class_attr_rfcomm_dlc); rfcomm_init_sockets(); diff --git a/trunk/net/bluetooth/rfcomm/sock.c b/trunk/net/bluetooth/rfcomm/sock.c index 544d65b7baa7..220fee04e7f2 100644 --- a/trunk/net/bluetooth/rfcomm/sock.c +++ b/trunk/net/bluetooth/rfcomm/sock.c @@ -336,8 +336,7 @@ static int rfcomm_sock_create(struct socket *sock, int protocol) sock->ops = &rfcomm_sock_ops; - sk = rfcomm_sock_alloc(sock, protocol, GFP_ATOMIC); - if (!sk) + if (!(sk = rfcomm_sock_alloc(sock, protocol, GFP_KERNEL))) return -ENOMEM; rfcomm_sock_init(sk, NULL); @@ -945,8 +944,7 @@ int __init rfcomm_init_sockets(void) if (err < 0) goto error; - if (class_create_file(bt_class, &class_attr_rfcomm) < 0) - BT_ERR("Failed to create RFCOMM info file"); + class_create_file(bt_class, &class_attr_rfcomm); BT_INFO("RFCOMM socket layer initialized"); diff --git a/trunk/net/bluetooth/rfcomm/tty.c b/trunk/net/bluetooth/rfcomm/tty.c index b8e3a5f1c8a8..1958ad1b8541 100644 --- a/trunk/net/bluetooth/rfcomm/tty.c +++ b/trunk/net/bluetooth/rfcomm/tty.c @@ -172,10 +172,12 @@ static struct device *rfcomm_get_device(struct rfcomm_dev *dev) return NULL; conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &dev->dst); + if (!conn) + return NULL; hci_dev_put(hdev); - return conn ? &conn->dev : NULL; + return &conn->dev; } static int rfcomm_dev_add(struct rfcomm_dev_req *req, struct rfcomm_dlc *dlc) @@ -765,9 +767,6 @@ static void rfcomm_tty_set_termios(struct tty_struct *tty, struct termios *old) BT_DBG("tty %p termios %p", tty, old); - if (!dev) - return; - /* Handle turning off CRTSCTS */ if ((old->c_cflag & CRTSCTS) && !(new->c_cflag & CRTSCTS)) BT_DBG("Turning off CRTSCTS unsupported"); diff --git a/trunk/net/bluetooth/sco.c b/trunk/net/bluetooth/sco.c index 5d13d4f31753..7714a2ec3854 100644 --- a/trunk/net/bluetooth/sco.c +++ b/trunk/net/bluetooth/sco.c @@ -452,8 +452,7 @@ static int sco_sock_create(struct socket *sock, int protocol) sock->ops = &sco_sock_ops; - sk = sco_sock_alloc(sock, protocol, GFP_ATOMIC); - if (!sk) + if (!(sk = sco_sock_alloc(sock, protocol, GFP_KERNEL))) return -ENOMEM; sco_sock_init(sk, NULL); @@ -968,8 +967,7 @@ static int __init sco_init(void) goto error; } - if (class_create_file(bt_class, &class_attr_sco) < 0) - BT_ERR("Failed to create SCO info file"); + class_create_file(bt_class, &class_attr_sco); BT_INFO("SCO (Voice Link) ver %s", VERSION); BT_INFO("SCO socket layer initialized"); diff --git a/trunk/net/bridge/br_fdb.c b/trunk/net/bridge/br_fdb.c index d9f04864d15d..3a73b8c94271 100644 --- a/trunk/net/bridge/br_fdb.c +++ b/trunk/net/bridge/br_fdb.c @@ -128,10 +128,7 @@ void br_fdb_cleanup(unsigned long _data) mod_timer(&br->gc_timer, jiffies + HZ/10); } - -void br_fdb_delete_by_port(struct net_bridge *br, - const struct net_bridge_port *p, - int do_all) +void br_fdb_delete_by_port(struct net_bridge *br, struct net_bridge_port *p) { int i; @@ -145,8 +142,6 @@ void br_fdb_delete_by_port(struct net_bridge *br, if (f->dst != p) continue; - if (f->is_static && !do_all) - continue; /* * if multiple ports all have the same device address * then when one port is deleted, assign diff --git a/trunk/net/bridge/br_if.c b/trunk/net/bridge/br_if.c index f753c40c11d2..b1211d5342f6 100644 --- a/trunk/net/bridge/br_if.c +++ b/trunk/net/bridge/br_if.c @@ -163,7 +163,7 @@ static void del_nbp(struct net_bridge_port *p) br_stp_disable_port(p); spin_unlock_bh(&br->lock); - br_fdb_delete_by_port(br, p, 1); + br_fdb_delete_by_port(br, p); list_del_rcu(&p->list); @@ -448,7 +448,7 @@ int br_add_if(struct net_bridge *br, struct net_device *dev) return 0; err2: - br_fdb_delete_by_port(br, p, 1); + br_fdb_delete_by_port(br, p); err1: kobject_del(&p->kobj); err0: diff --git a/trunk/net/bridge/br_private.h b/trunk/net/bridge/br_private.h index 74258d86f256..c491fb2f280e 100644 --- a/trunk/net/bridge/br_private.h +++ b/trunk/net/bridge/br_private.h @@ -143,7 +143,7 @@ extern void br_fdb_changeaddr(struct net_bridge_port *p, const unsigned char *newaddr); extern void br_fdb_cleanup(unsigned long arg); extern void br_fdb_delete_by_port(struct net_bridge *br, - const struct net_bridge_port *p, int do_all); + struct net_bridge_port *p); extern struct net_bridge_fdb_entry *__br_fdb_get(struct net_bridge *br, const unsigned char *addr); extern struct net_bridge_fdb_entry *br_fdb_get(struct net_bridge *br, diff --git a/trunk/net/bridge/br_stp_if.c b/trunk/net/bridge/br_stp_if.c index d294224592db..14cd025079af 100644 --- a/trunk/net/bridge/br_stp_if.c +++ b/trunk/net/bridge/br_stp_if.c @@ -113,8 +113,6 @@ void br_stp_disable_port(struct net_bridge_port *p) del_timer(&p->forward_delay_timer); del_timer(&p->hold_timer); - br_fdb_delete_by_port(br, p, 0); - br_configuration_update(br); br_port_state_selection(br); diff --git a/trunk/net/core/dev.c b/trunk/net/core/dev.c index 81c426adcd1e..4d891beab138 100644 --- a/trunk/net/core/dev.c +++ b/trunk/net/core/dev.c @@ -3502,6 +3502,8 @@ static int __init net_dev_init(void) BUG_ON(!dev_boot_phase); + net_random_init(); + if (dev_proc_init()) goto out; diff --git a/trunk/net/core/sock.c b/trunk/net/core/sock.c index d472db4776c3..b77e155cbe6c 100644 --- a/trunk/net/core/sock.c +++ b/trunk/net/core/sock.c @@ -823,7 +823,7 @@ static void inline sock_lock_init(struct sock *sk) af_family_slock_key_strings[sk->sk_family]); lockdep_init_map(&sk->sk_lock.dep_map, af_family_key_strings[sk->sk_family], - af_family_keys + sk->sk_family, 0); + af_family_keys + sk->sk_family); } /** diff --git a/trunk/net/core/utils.c b/trunk/net/core/utils.c index d93fe64f6693..94c5d761c830 100644 --- a/trunk/net/core/utils.c +++ b/trunk/net/core/utils.c @@ -30,6 +30,119 @@ #include #include +/* + This is a maximally equidistributed combined Tausworthe generator + based on code from GNU Scientific Library 1.5 (30 Jun 2004) + + x_n = (s1_n ^ s2_n ^ s3_n) + + s1_{n+1} = (((s1_n & 4294967294) <<12) ^ (((s1_n <<13) ^ s1_n) >>19)) + s2_{n+1} = (((s2_n & 4294967288) << 4) ^ (((s2_n << 2) ^ s2_n) >>25)) + s3_{n+1} = (((s3_n & 4294967280) <<17) ^ (((s3_n << 3) ^ s3_n) >>11)) + + The period of this generator is about 2^88. + + From: P. L'Ecuyer, "Maximally Equidistributed Combined Tausworthe + Generators", Mathematics of Computation, 65, 213 (1996), 203--213. + + This is available on the net from L'Ecuyer's home page, + + http://www.iro.umontreal.ca/~lecuyer/myftp/papers/tausme.ps + ftp://ftp.iro.umontreal.ca/pub/simulation/lecuyer/papers/tausme.ps + + There is an erratum in the paper "Tables of Maximally + Equidistributed Combined LFSR Generators", Mathematics of + Computation, 68, 225 (1999), 261--269: + http://www.iro.umontreal.ca/~lecuyer/myftp/papers/tausme2.ps + + ... the k_j most significant bits of z_j must be non- + zero, for each j. (Note: this restriction also applies to the + computer code given in [4], but was mistakenly not mentioned in + that paper.) + + This affects the seeding procedure by imposing the requirement + s1 > 1, s2 > 7, s3 > 15. + +*/ +struct nrnd_state { + u32 s1, s2, s3; +}; + +static DEFINE_PER_CPU(struct nrnd_state, net_rand_state); + +static u32 __net_random(struct nrnd_state *state) +{ +#define TAUSWORTHE(s,a,b,c,d) ((s&c)<>b) + + state->s1 = TAUSWORTHE(state->s1, 13, 19, 4294967294UL, 12); + state->s2 = TAUSWORTHE(state->s2, 2, 25, 4294967288UL, 4); + state->s3 = TAUSWORTHE(state->s3, 3, 11, 4294967280UL, 17); + + return (state->s1 ^ state->s2 ^ state->s3); +} + +static void __net_srandom(struct nrnd_state *state, unsigned long s) +{ + if (s == 0) + s = 1; /* default seed is 1 */ + +#define LCG(n) (69069 * n) + state->s1 = LCG(s); + state->s2 = LCG(state->s1); + state->s3 = LCG(state->s2); + + /* "warm it up" */ + __net_random(state); + __net_random(state); + __net_random(state); + __net_random(state); + __net_random(state); + __net_random(state); +} + + +unsigned long net_random(void) +{ + unsigned long r; + struct nrnd_state *state = &get_cpu_var(net_rand_state); + r = __net_random(state); + put_cpu_var(state); + return r; +} + + +void net_srandom(unsigned long entropy) +{ + struct nrnd_state *state = &get_cpu_var(net_rand_state); + __net_srandom(state, state->s1^entropy); + put_cpu_var(state); +} + +void __init net_random_init(void) +{ + int i; + + for_each_possible_cpu(i) { + struct nrnd_state *state = &per_cpu(net_rand_state,i); + __net_srandom(state, i+jiffies); + } +} + +static int net_random_reseed(void) +{ + int i; + unsigned long seed; + + for_each_possible_cpu(i) { + struct nrnd_state *state = &per_cpu(net_rand_state,i); + + get_random_bytes(&seed, sizeof(seed)); + __net_srandom(state, seed); + } + return 0; +} +late_initcall(net_random_reseed); + int net_msg_cost = 5*HZ; int net_msg_burst = 10; @@ -40,7 +153,10 @@ int net_ratelimit(void) { return __printk_ratelimit(net_msg_cost, net_msg_burst); } + +EXPORT_SYMBOL(net_random); EXPORT_SYMBOL(net_ratelimit); +EXPORT_SYMBOL(net_srandom); /* * Convert an ASCII string to binary IP. diff --git a/trunk/net/decnet/dn_route.c b/trunk/net/decnet/dn_route.c index 491429ce9394..a2a43d8d93fe 100644 --- a/trunk/net/decnet/dn_route.c +++ b/trunk/net/decnet/dn_route.c @@ -269,7 +269,7 @@ static inline int compare_keys(struct flowi *fl1, struct flowi *fl2) { return ((fl1->nl_u.dn_u.daddr ^ fl2->nl_u.dn_u.daddr) | (fl1->nl_u.dn_u.saddr ^ fl2->nl_u.dn_u.saddr) | -#ifdef CONFIG_DECNET_ROUTE_FWMARK +#ifdef CONFIG_IP_ROUTE_FWMARK (fl1->nl_u.dn_u.fwmark ^ fl2->nl_u.dn_u.fwmark) | #endif (fl1->nl_u.dn_u.scope ^ fl2->nl_u.dn_u.scope) | diff --git a/trunk/net/ipv4/cipso_ipv4.c b/trunk/net/ipv4/cipso_ipv4.c index e2077a3aa8c0..bde8ccaa1531 100644 --- a/trunk/net/ipv4/cipso_ipv4.c +++ b/trunk/net/ipv4/cipso_ipv4.c @@ -773,15 +773,13 @@ static int cipso_v4_map_cat_rbm_valid(const struct cipso_v4_doi *doi_def, { int cat = -1; u32 bitmap_len_bits = bitmap_len * 8; - u32 cipso_cat_size; - u32 *cipso_array; + u32 cipso_cat_size = doi_def->map.std->cat.cipso_size; + u32 *cipso_array = doi_def->map.std->cat.cipso; switch (doi_def->type) { case CIPSO_V4_MAP_PASS: return 0; case CIPSO_V4_MAP_STD: - cipso_cat_size = doi_def->map.std->cat.cipso_size; - cipso_array = doi_def->map.std->cat.cipso; for (;;) { cat = cipso_v4_bitmap_walk(bitmap, bitmap_len_bits, @@ -827,21 +825,19 @@ static int cipso_v4_map_cat_rbm_hton(const struct cipso_v4_doi *doi_def, u32 net_spot_max = 0; u32 host_clen_bits = host_cat_len * 8; u32 net_clen_bits = net_cat_len * 8; - u32 host_cat_size; - u32 *host_cat_array; + u32 host_cat_size = doi_def->map.std->cat.local_size; + u32 *host_cat_array = doi_def->map.std->cat.local; switch (doi_def->type) { case CIPSO_V4_MAP_PASS: - net_spot_max = host_cat_len; - while (net_spot_max > 0 && host_cat[net_spot_max - 1] == 0) + net_spot_max = host_cat_len - 1; + while (net_spot_max > 0 && host_cat[net_spot_max] == 0) net_spot_max--; if (net_spot_max > net_cat_len) return -EINVAL; memcpy(net_cat, host_cat, net_spot_max); return net_spot_max; case CIPSO_V4_MAP_STD: - host_cat_size = doi_def->map.std->cat.local_size; - host_cat_array = doi_def->map.std->cat.local; for (;;) { host_spot = cipso_v4_bitmap_walk(host_cat, host_clen_bits, @@ -897,8 +893,8 @@ static int cipso_v4_map_cat_rbm_ntoh(const struct cipso_v4_doi *doi_def, int net_spot = -1; u32 net_clen_bits = net_cat_len * 8; u32 host_clen_bits = host_cat_len * 8; - u32 net_cat_size; - u32 *net_cat_array; + u32 net_cat_size = doi_def->map.std->cat.cipso_size; + u32 *net_cat_array = doi_def->map.std->cat.cipso; switch (doi_def->type) { case CIPSO_V4_MAP_PASS: @@ -907,8 +903,6 @@ static int cipso_v4_map_cat_rbm_ntoh(const struct cipso_v4_doi *doi_def, memcpy(host_cat, net_cat, net_cat_len); return net_cat_len; case CIPSO_V4_MAP_STD: - net_cat_size = doi_def->map.std->cat.cipso_size; - net_cat_array = doi_def->map.std->cat.cipso; for (;;) { net_spot = cipso_v4_bitmap_walk(net_cat, net_clen_bits, diff --git a/trunk/net/ipv4/inetpeer.c b/trunk/net/ipv4/inetpeer.c index f072f3875af8..2b1a54b59c48 100644 --- a/trunk/net/ipv4/inetpeer.c +++ b/trunk/net/ipv4/inetpeer.c @@ -94,8 +94,10 @@ int inet_peer_minttl = 120 * HZ; /* TTL under high load: 120 sec */ int inet_peer_maxttl = 10 * 60 * HZ; /* usual time to live: 10 min */ static struct inet_peer *inet_peer_unused_head; -static struct inet_peer **inet_peer_unused_tailp = &inet_peer_unused_head; -static DEFINE_SPINLOCK(inet_peer_unused_lock); +/* Exported for inet_putpeer inline function. */ +struct inet_peer **inet_peer_unused_tailp = &inet_peer_unused_head; +DEFINE_SPINLOCK(inet_peer_unused_lock); +#define PEER_MAX_CLEANUP_WORK 30 static void peer_check_expire(unsigned long dummy); static DEFINE_TIMER(peer_periodic_timer, peer_check_expire, 0, 0); @@ -338,8 +340,7 @@ static int cleanup_once(unsigned long ttl) spin_lock_bh(&inet_peer_unused_lock); p = inet_peer_unused_head; if (p != NULL) { - __u32 delta = (__u32)jiffies - p->dtime; - if (delta < ttl) { + if (time_after(p->dtime + ttl, jiffies)) { /* Do not prune fresh entries. */ spin_unlock_bh(&inet_peer_unused_lock); return -1; @@ -431,7 +432,7 @@ struct inet_peer *inet_getpeer(__be32 daddr, int create) /* Called with local BH disabled. */ static void peer_check_expire(unsigned long dummy) { - unsigned long now = jiffies; + int i; int ttl; if (peer_total >= inet_peer_threshold) @@ -440,10 +441,7 @@ static void peer_check_expire(unsigned long dummy) ttl = inet_peer_maxttl - (inet_peer_maxttl - inet_peer_minttl) / HZ * peer_total / inet_peer_threshold * HZ; - while (!cleanup_once(ttl)) { - if (jiffies != now) - break; - } + for (i = 0; i < PEER_MAX_CLEANUP_WORK && !cleanup_once(ttl); i++); /* Trigger the timer after inet_peer_gc_mintime .. inet_peer_gc_maxtime * interval depending on the total number of entries (more entries, @@ -457,16 +455,3 @@ static void peer_check_expire(unsigned long dummy) peer_total / inet_peer_threshold * HZ; add_timer(&peer_periodic_timer); } - -void inet_putpeer(struct inet_peer *p) -{ - spin_lock_bh(&inet_peer_unused_lock); - if (atomic_dec_and_test(&p->refcnt)) { - p->unused_prevp = inet_peer_unused_tailp; - p->unused_next = NULL; - *inet_peer_unused_tailp = p; - inet_peer_unused_tailp = &p->unused_next; - p->dtime = (__u32)jiffies; - } - spin_unlock_bh(&inet_peer_unused_lock); -} diff --git a/trunk/net/ipv4/netfilter/arp_tables.c b/trunk/net/ipv4/netfilter/arp_tables.c index 0849f1cced13..17e1a687ab45 100644 --- a/trunk/net/ipv4/netfilter/arp_tables.c +++ b/trunk/net/ipv4/netfilter/arp_tables.c @@ -1196,8 +1196,6 @@ static int __init arp_tables_init(void) static void __exit arp_tables_fini(void) { nf_unregister_sockopt(&arpt_sockopts); - xt_unregister_target(&arpt_error_target); - xt_unregister_target(&arpt_standard_target); xt_proto_fini(NF_ARP); } diff --git a/trunk/net/ipv4/netfilter/ip_conntrack_netlink.c b/trunk/net/ipv4/netfilter/ip_conntrack_netlink.c index 262d0d44ec1b..53b6dffea6c2 100644 --- a/trunk/net/ipv4/netfilter/ip_conntrack_netlink.c +++ b/trunk/net/ipv4/netfilter/ip_conntrack_netlink.c @@ -44,6 +44,13 @@ MODULE_LICENSE("GPL"); static char __initdata version[] = "0.90"; +#if 0 +#define DEBUGP printk +#else +#define DEBUGP(format, args...) +#endif + + static inline int ctnetlink_dump_tuples_proto(struct sk_buff *skb, const struct ip_conntrack_tuple *tuple, @@ -391,6 +398,7 @@ static int ctnetlink_conntrack_event(struct notifier_block *this, static int ctnetlink_done(struct netlink_callback *cb) { + DEBUGP("entered %s\n", __FUNCTION__); if (cb->args[1]) ip_conntrack_put((struct ip_conntrack *)cb->args[1]); return 0; @@ -403,6 +411,9 @@ ctnetlink_dump_table(struct sk_buff *skb, struct netlink_callback *cb) struct ip_conntrack_tuple_hash *h; struct list_head *i; + DEBUGP("entered %s, last bucket=%lu id=%u\n", __FUNCTION__, + cb->args[0], *id); + read_lock_bh(&ip_conntrack_lock); last = (struct ip_conntrack *)cb->args[1]; for (; cb->args[0] < ip_conntrack_htable_size; cb->args[0]++) { @@ -441,6 +452,7 @@ ctnetlink_dump_table(struct sk_buff *skb, struct netlink_callback *cb) if (last) ip_conntrack_put(last); + DEBUGP("leaving, last bucket=%lu id=%u\n", cb->args[0], *id); return skb->len; } @@ -454,6 +466,8 @@ ctnetlink_parse_tuple_ip(struct nfattr *attr, struct ip_conntrack_tuple *tuple) { struct nfattr *tb[CTA_IP_MAX]; + DEBUGP("entered %s\n", __FUNCTION__); + nfattr_parse_nested(tb, CTA_IP_MAX, attr); if (nfattr_bad_size(tb, CTA_IP_MAX, cta_min_ip)) @@ -467,6 +481,8 @@ ctnetlink_parse_tuple_ip(struct nfattr *attr, struct ip_conntrack_tuple *tuple) return -EINVAL; tuple->dst.ip = *(__be32 *)NFA_DATA(tb[CTA_IP_V4_DST-1]); + DEBUGP("leaving\n"); + return 0; } @@ -487,6 +503,8 @@ ctnetlink_parse_tuple_proto(struct nfattr *attr, struct ip_conntrack_protocol *proto; int ret = 0; + DEBUGP("entered %s\n", __FUNCTION__); + nfattr_parse_nested(tb, CTA_PROTO_MAX, attr); if (nfattr_bad_size(tb, CTA_PROTO_MAX, cta_min_proto)) @@ -513,6 +531,8 @@ ctnetlink_parse_tuple(struct nfattr *cda[], struct ip_conntrack_tuple *tuple, struct nfattr *tb[CTA_TUPLE_MAX]; int err; + DEBUGP("entered %s\n", __FUNCTION__); + memset(tuple, 0, sizeof(*tuple)); nfattr_parse_nested(tb, CTA_TUPLE_MAX, cda[type-1]); @@ -537,6 +557,10 @@ ctnetlink_parse_tuple(struct nfattr *cda[], struct ip_conntrack_tuple *tuple, else tuple->dst.dir = IP_CT_DIR_ORIGINAL; + DUMP_TUPLE(tuple); + + DEBUGP("leaving\n"); + return 0; } @@ -553,6 +577,8 @@ static int ctnetlink_parse_nat_proto(struct nfattr *attr, struct nfattr *tb[CTA_PROTONAT_MAX]; struct ip_nat_protocol *npt; + DEBUGP("entered %s\n", __FUNCTION__); + nfattr_parse_nested(tb, CTA_PROTONAT_MAX, attr); if (nfattr_bad_size(tb, CTA_PROTONAT_MAX, cta_min_protonat)) @@ -571,6 +597,7 @@ static int ctnetlink_parse_nat_proto(struct nfattr *attr, ip_nat_proto_put(npt); + DEBUGP("leaving\n"); return 0; } @@ -586,6 +613,8 @@ ctnetlink_parse_nat(struct nfattr *nat, struct nfattr *tb[CTA_NAT_MAX]; int err; + DEBUGP("entered %s\n", __FUNCTION__); + memset(range, 0, sizeof(*range)); nfattr_parse_nested(tb, CTA_NAT_MAX, nat); @@ -611,6 +640,7 @@ ctnetlink_parse_nat(struct nfattr *nat, if (err < 0) return err; + DEBUGP("leaving\n"); return 0; } #endif @@ -620,6 +650,8 @@ ctnetlink_parse_help(struct nfattr *attr, char **helper_name) { struct nfattr *tb[CTA_HELP_MAX]; + DEBUGP("entered %s\n", __FUNCTION__); + nfattr_parse_nested(tb, CTA_HELP_MAX, attr); if (!tb[CTA_HELP_NAME-1]) @@ -647,6 +679,8 @@ ctnetlink_del_conntrack(struct sock *ctnl, struct sk_buff *skb, struct ip_conntrack *ct; int err = 0; + DEBUGP("entered %s\n", __FUNCTION__); + if (nfattr_bad_size(cda, CTA_MAX, cta_min)) return -EINVAL; @@ -664,8 +698,10 @@ ctnetlink_del_conntrack(struct sock *ctnl, struct sk_buff *skb, return err; h = ip_conntrack_find_get(&tuple, NULL); - if (!h) + if (!h) { + DEBUGP("tuple not found in conntrack hash\n"); return -ENOENT; + } ct = tuplehash_to_ctrack(h); @@ -680,6 +716,7 @@ ctnetlink_del_conntrack(struct sock *ctnl, struct sk_buff *skb, ct->timeout.function((unsigned long)ct); ip_conntrack_put(ct); + DEBUGP("leaving\n"); return 0; } @@ -694,6 +731,8 @@ ctnetlink_get_conntrack(struct sock *ctnl, struct sk_buff *skb, struct sk_buff *skb2 = NULL; int err = 0; + DEBUGP("entered %s\n", __FUNCTION__); + if (nlh->nlmsg_flags & NLM_F_DUMP) { struct nfgenmsg *msg = NLMSG_DATA(nlh); u32 rlen; @@ -731,9 +770,11 @@ ctnetlink_get_conntrack(struct sock *ctnl, struct sk_buff *skb, return err; h = ip_conntrack_find_get(&tuple, NULL); - if (!h) + if (!h) { + DEBUGP("tuple not found in conntrack hash"); return -ENOENT; - + } + DEBUGP("tuple found\n"); ct = tuplehash_to_ctrack(h); err = -ENOMEM; @@ -754,6 +795,7 @@ ctnetlink_get_conntrack(struct sock *ctnl, struct sk_buff *skb, if (err < 0) goto out; + DEBUGP("leaving\n"); return 0; free: @@ -824,6 +866,8 @@ ctnetlink_change_helper(struct ip_conntrack *ct, struct nfattr *cda[]) char *helpname; int err; + DEBUGP("entered %s\n", __FUNCTION__); + /* don't change helper of sibling connections */ if (ct->master) return -EINVAL; @@ -894,6 +938,8 @@ ctnetlink_change_conntrack(struct ip_conntrack *ct, struct nfattr *cda[]) { int err; + DEBUGP("entered %s\n", __FUNCTION__); + if (cda[CTA_HELP-1]) { err = ctnetlink_change_helper(ct, cda); if (err < 0) @@ -923,6 +969,7 @@ ctnetlink_change_conntrack(struct ip_conntrack *ct, struct nfattr *cda[]) ct->mark = ntohl(*(__be32 *)NFA_DATA(cda[CTA_MARK-1])); #endif + DEBUGP("all done\n"); return 0; } @@ -934,6 +981,8 @@ ctnetlink_create_conntrack(struct nfattr *cda[], struct ip_conntrack *ct; int err = -EINVAL; + DEBUGP("entered %s\n", __FUNCTION__); + ct = ip_conntrack_alloc(otuple, rtuple); if (ct == NULL || IS_ERR(ct)) return -ENOMEM; @@ -968,6 +1017,7 @@ ctnetlink_create_conntrack(struct nfattr *cda[], if (ct->helper) ip_conntrack_helper_put(ct->helper); + DEBUGP("conntrack with id %u inserted\n", ct->id); return 0; err: @@ -983,6 +1033,8 @@ ctnetlink_new_conntrack(struct sock *ctnl, struct sk_buff *skb, struct ip_conntrack_tuple_hash *h = NULL; int err = 0; + DEBUGP("entered %s\n", __FUNCTION__); + if (nfattr_bad_size(cda, CTA_MAX, cta_min)) return -EINVAL; @@ -1006,6 +1058,7 @@ ctnetlink_new_conntrack(struct sock *ctnl, struct sk_buff *skb, if (h == NULL) { write_unlock_bh(&ip_conntrack_lock); + DEBUGP("no such conntrack, create new\n"); err = -ENOENT; if (nlh->nlmsg_flags & NLM_F_CREATE) err = ctnetlink_create_conntrack(cda, &otuple, &rtuple); @@ -1021,6 +1074,7 @@ ctnetlink_new_conntrack(struct sock *ctnl, struct sk_buff *skb, /* We manipulate the conntrack inside the global conntrack table lock, * so there's no need to increase the refcount */ + DEBUGP("conntrack found\n"); err = -EEXIST; if (!(nlh->nlmsg_flags & NLM_F_EXCL)) err = ctnetlink_change_conntrack(tuplehash_to_ctrack(h), cda); @@ -1195,6 +1249,8 @@ ctnetlink_exp_dump_table(struct sk_buff *skb, struct netlink_callback *cb) struct list_head *i; u_int32_t *id = (u_int32_t *) &cb->args[0]; + DEBUGP("entered %s, last id=%llu\n", __FUNCTION__, *id); + read_lock_bh(&ip_conntrack_lock); list_for_each_prev(i, &ip_conntrack_expect_list) { exp = (struct ip_conntrack_expect *) i; @@ -1210,6 +1266,8 @@ ctnetlink_exp_dump_table(struct sk_buff *skb, struct netlink_callback *cb) out: read_unlock_bh(&ip_conntrack_lock); + DEBUGP("leaving, last id=%llu\n", *id); + return skb->len; } @@ -1227,6 +1285,8 @@ ctnetlink_get_expect(struct sock *ctnl, struct sk_buff *skb, struct sk_buff *skb2; int err = 0; + DEBUGP("entered %s\n", __FUNCTION__); + if (nfattr_bad_size(cda, CTA_EXPECT_MAX, cta_min_exp)) return -EINVAL; @@ -1377,6 +1437,8 @@ ctnetlink_create_expect(struct nfattr *cda[]) struct ip_conntrack *ct; int err = 0; + DEBUGP("entered %s\n", __FUNCTION__); + /* caller guarantees that those three CTA_EXPECT_* exist */ err = ctnetlink_parse_tuple(cda, &tuple, CTA_EXPECT_TUPLE); if (err < 0) @@ -1428,6 +1490,8 @@ ctnetlink_new_expect(struct sock *ctnl, struct sk_buff *skb, struct ip_conntrack_expect *exp; int err = 0; + DEBUGP("entered %s\n", __FUNCTION__); + if (nfattr_bad_size(cda, CTA_EXPECT_MAX, cta_min_exp)) return -EINVAL; @@ -1456,6 +1520,8 @@ ctnetlink_new_expect(struct sock *ctnl, struct sk_buff *skb, err = ctnetlink_change_expect(exp, cda); write_unlock_bh(&ip_conntrack_lock); + DEBUGP("leaving\n"); + return err; } diff --git a/trunk/net/ipv4/netfilter/ipt_ECN.c b/trunk/net/ipv4/netfilter/ipt_ECN.c index 1aa4517fbcdb..12a818a2462f 100644 --- a/trunk/net/ipv4/netfilter/ipt_ECN.c +++ b/trunk/net/ipv4/netfilter/ipt_ECN.c @@ -28,7 +28,7 @@ static inline int set_ect_ip(struct sk_buff **pskb, const struct ipt_ECN_info *einfo) { struct iphdr *iph = (*pskb)->nh.iph; - u_int16_t oldtos; + __be16 oldtos; if ((iph->tos & IPT_ECN_IP_MASK) != (einfo->ip_ect & IPT_ECN_IP_MASK)) { if (!skb_make_writable(pskb, sizeof(struct iphdr))) @@ -37,8 +37,8 @@ set_ect_ip(struct sk_buff **pskb, const struct ipt_ECN_info *einfo) oldtos = iph->tos; iph->tos &= ~IPT_ECN_IP_MASK; iph->tos |= (einfo->ip_ect & IPT_ECN_IP_MASK); - iph->check = nf_csum_update(htons(oldtos) ^ htons(0xFFFF), - htons(iph->tos), iph->check); + iph->check = nf_csum_update(oldtos ^ htons(0xFFFF), iph->tos, + iph->check); } return 1; } diff --git a/trunk/net/ipv4/netfilter/ipt_TOS.c b/trunk/net/ipv4/netfilter/ipt_TOS.c index 83b80b3a5d2f..6b8b14ccc3d3 100644 --- a/trunk/net/ipv4/netfilter/ipt_TOS.c +++ b/trunk/net/ipv4/netfilter/ipt_TOS.c @@ -30,7 +30,7 @@ target(struct sk_buff **pskb, { const struct ipt_tos_target_info *tosinfo = targinfo; struct iphdr *iph = (*pskb)->nh.iph; - u_int16_t oldtos; + __be16 oldtos; if ((iph->tos & IPTOS_TOS_MASK) != tosinfo->tos) { if (!skb_make_writable(pskb, sizeof(struct iphdr))) @@ -38,8 +38,8 @@ target(struct sk_buff **pskb, iph = (*pskb)->nh.iph; oldtos = iph->tos; iph->tos = (iph->tos & IPTOS_PREC_MASK) | tosinfo->tos; - iph->check = nf_csum_update(htons(oldtos) ^ htons(0xFFFF), - htons(iph->tos), iph->check); + iph->check = nf_csum_update(oldtos ^ htons(0xFFFF), iph->tos, + iph->check); } return IPT_CONTINUE; } diff --git a/trunk/net/ipv6/fib6_rules.c b/trunk/net/ipv6/fib6_rules.c index 1896ecb52899..d8c1057e8b00 100644 --- a/trunk/net/ipv6/fib6_rules.c +++ b/trunk/net/ipv6/fib6_rules.c @@ -117,15 +117,12 @@ static int fib6_rule_match(struct fib_rule *rule, struct flowi *fl, int flags) { struct fib6_rule *r = (struct fib6_rule *) rule; - if (r->dst.plen && - !ipv6_prefix_equal(&fl->fl6_dst, &r->dst.addr, r->dst.plen)) + if (!ipv6_prefix_equal(&fl->fl6_dst, &r->dst.addr, r->dst.plen)) return 0; - if (r->src.plen) { - if (!(flags & RT6_LOOKUP_F_HAS_SADDR) || - !ipv6_prefix_equal(&fl->fl6_src, &r->src.addr, r->src.plen)) - return 0; - } + if ((flags & RT6_LOOKUP_F_HAS_SADDR) && + !ipv6_prefix_equal(&fl->fl6_src, &r->src.addr, r->src.plen)) + return 0; if (r->tclass && r->tclass != ((ntohl(fl->fl6_flowlabel) >> 20) & 0xff)) return 0; diff --git a/trunk/net/ipv6/ndisc.c b/trunk/net/ipv6/ndisc.c index 41a8a5f06602..0304b5fe8d6a 100644 --- a/trunk/net/ipv6/ndisc.c +++ b/trunk/net/ipv6/ndisc.c @@ -967,6 +967,8 @@ static void ndisc_recv_na(struct sk_buff *skb) ipv6_devconf.forwarding && ipv6_devconf.proxy_ndp && pneigh_lookup(&nd_tbl, &msg->target, dev, 0)) { /* XXX: idev->cnf.prixy_ndp */ + WARN_ON(skb->dst != NULL && + ((struct rt6_info *)skb->dst)->rt6i_idev); goto out; } diff --git a/trunk/net/ipv6/route.c b/trunk/net/ipv6/route.c index a1b0f075462e..d6b4b4f48d18 100644 --- a/trunk/net/ipv6/route.c +++ b/trunk/net/ipv6/route.c @@ -529,17 +529,13 @@ struct rt6_info *rt6_lookup(struct in6_addr *daddr, struct in6_addr *saddr, .nl_u = { .ip6_u = { .daddr = *daddr, + /* TODO: saddr */ }, }, }; struct dst_entry *dst; int flags = strict ? RT6_LOOKUP_F_IFACE : 0; - if (saddr) { - memcpy(&fl.fl6_src, saddr, sizeof(*saddr)); - flags |= RT6_LOOKUP_F_HAS_SADDR; - } - dst = fib6_rule_lookup(&fl, flags, ip6_pol_route_lookup); if (dst->error == 0) return (struct rt6_info *) dst; @@ -701,7 +697,6 @@ static struct rt6_info *ip6_pol_route_input(struct fib6_table *table, void ip6_route_input(struct sk_buff *skb) { struct ipv6hdr *iph = skb->nh.ipv6h; - int flags = RT6_LOOKUP_F_HAS_SADDR; struct flowi fl = { .iif = skb->dev->ifindex, .nl_u = { @@ -716,9 +711,7 @@ void ip6_route_input(struct sk_buff *skb) }, .proto = iph->nexthdr, }; - - if (rt6_need_strict(&iph->daddr)) - flags |= RT6_LOOKUP_F_IFACE; + int flags = rt6_need_strict(&iph->daddr) ? RT6_LOOKUP_F_IFACE : 0; skb->dst = fib6_rule_lookup(&fl, flags, ip6_pol_route_input); } @@ -801,9 +794,6 @@ struct dst_entry * ip6_route_output(struct sock *sk, struct flowi *fl) if (rt6_need_strict(&fl->fl6_dst)) flags |= RT6_LOOKUP_F_IFACE; - if (!ipv6_addr_any(&fl->fl6_src)) - flags |= RT6_LOOKUP_F_HAS_SADDR; - return fib6_rule_lookup(fl, flags, ip6_pol_route_output); } @@ -1355,7 +1345,6 @@ static struct rt6_info *ip6_route_redirect(struct in6_addr *dest, struct in6_addr *gateway, struct net_device *dev) { - int flags = RT6_LOOKUP_F_HAS_SADDR; struct ip6rd_flowi rdfl = { .fl = { .oif = dev->ifindex, @@ -1368,9 +1357,7 @@ static struct rt6_info *ip6_route_redirect(struct in6_addr *dest, }, .gateway = *gateway, }; - - if (rt6_need_strict(dest)) - flags |= RT6_LOOKUP_F_IFACE; + int flags = rt6_need_strict(dest) ? RT6_LOOKUP_F_IFACE : 0; return (struct rt6_info *)fib6_rule_lookup((struct flowi *)&rdfl, flags, __ip6_route_redirect); } diff --git a/trunk/net/ipv6/sit.c b/trunk/net/ipv6/sit.c index b481a4d780c2..dc5765b62b87 100644 --- a/trunk/net/ipv6/sit.c +++ b/trunk/net/ipv6/sit.c @@ -853,4 +853,3 @@ int __init sit_init(void) module_init(sit_init); module_exit(sit_cleanup); -MODULE_LICENSE("GPL"); diff --git a/trunk/net/netfilter/Kconfig b/trunk/net/netfilter/Kconfig index f619c6527266..ce94732b8e23 100644 --- a/trunk/net/netfilter/Kconfig +++ b/trunk/net/netfilter/Kconfig @@ -209,9 +209,7 @@ config NETFILTER_XT_TARGET_SECMARK config NETFILTER_XT_TARGET_CONNSECMARK tristate '"CONNSECMARK" target support' - depends on NETFILTER_XTABLES && \ - ((NF_CONNTRACK && NF_CONNTRACK_SECMARK) || \ - (IP_NF_CONNTRACK && IP_NF_CONNTRACK_SECMARK)) + depends on NETFILTER_XTABLES && (NF_CONNTRACK_SECMARK || IP_NF_CONNTRACK_SECMARK) help The CONNSECMARK target copies security markings from packets to connections, and restores security markings from connections diff --git a/trunk/net/netfilter/nf_conntrack_netlink.c b/trunk/net/netfilter/nf_conntrack_netlink.c index bd0156a28ecd..1721f7c78c77 100644 --- a/trunk/net/netfilter/nf_conntrack_netlink.c +++ b/trunk/net/netfilter/nf_conntrack_netlink.c @@ -47,6 +47,13 @@ MODULE_LICENSE("GPL"); static char __initdata version[] = "0.93"; +#if 0 +#define DEBUGP printk +#else +#define DEBUGP(format, args...) +#endif + + static inline int ctnetlink_dump_tuples_proto(struct sk_buff *skb, const struct nf_conntrack_tuple *tuple, @@ -403,6 +410,7 @@ static int ctnetlink_done(struct netlink_callback *cb) { if (cb->args[1]) nf_ct_put((struct nf_conn *)cb->args[1]); + DEBUGP("entered %s\n", __FUNCTION__); return 0; } @@ -417,6 +425,9 @@ ctnetlink_dump_table(struct sk_buff *skb, struct netlink_callback *cb) struct nfgenmsg *nfmsg = NLMSG_DATA(cb->nlh); u_int8_t l3proto = nfmsg->nfgen_family; + DEBUGP("entered %s, last bucket=%lu id=%u\n", __FUNCTION__, + cb->args[0], *id); + read_lock_bh(&nf_conntrack_lock); last = (struct nf_conn *)cb->args[1]; for (; cb->args[0] < nf_conntrack_htable_size; cb->args[0]++) { @@ -460,6 +471,7 @@ ctnetlink_dump_table(struct sk_buff *skb, struct netlink_callback *cb) if (last) nf_ct_put(last); + DEBUGP("leaving, last bucket=%lu id=%u\n", cb->args[0], *id); return skb->len; } @@ -470,6 +482,8 @@ ctnetlink_parse_tuple_ip(struct nfattr *attr, struct nf_conntrack_tuple *tuple) struct nf_conntrack_l3proto *l3proto; int ret = 0; + DEBUGP("entered %s\n", __FUNCTION__); + nfattr_parse_nested(tb, CTA_IP_MAX, attr); l3proto = nf_ct_l3proto_find_get(tuple->src.l3num); @@ -479,6 +493,8 @@ ctnetlink_parse_tuple_ip(struct nfattr *attr, struct nf_conntrack_tuple *tuple) nf_ct_l3proto_put(l3proto); + DEBUGP("leaving\n"); + return ret; } @@ -494,6 +510,8 @@ ctnetlink_parse_tuple_proto(struct nfattr *attr, struct nf_conntrack_protocol *proto; int ret = 0; + DEBUGP("entered %s\n", __FUNCTION__); + nfattr_parse_nested(tb, CTA_PROTO_MAX, attr); if (nfattr_bad_size(tb, CTA_PROTO_MAX, cta_min_proto)) @@ -520,6 +538,8 @@ ctnetlink_parse_tuple(struct nfattr *cda[], struct nf_conntrack_tuple *tuple, struct nfattr *tb[CTA_TUPLE_MAX]; int err; + DEBUGP("entered %s\n", __FUNCTION__); + memset(tuple, 0, sizeof(*tuple)); nfattr_parse_nested(tb, CTA_TUPLE_MAX, cda[type-1]); @@ -546,6 +566,10 @@ ctnetlink_parse_tuple(struct nfattr *cda[], struct nf_conntrack_tuple *tuple, else tuple->dst.dir = IP_CT_DIR_ORIGINAL; + NF_CT_DUMP_TUPLE(tuple); + + DEBUGP("leaving\n"); + return 0; } @@ -562,6 +586,8 @@ static int ctnetlink_parse_nat_proto(struct nfattr *attr, struct nfattr *tb[CTA_PROTONAT_MAX]; struct ip_nat_protocol *npt; + DEBUGP("entered %s\n", __FUNCTION__); + nfattr_parse_nested(tb, CTA_PROTONAT_MAX, attr); if (nfattr_bad_size(tb, CTA_PROTONAT_MAX, cta_min_protonat)) @@ -580,6 +606,7 @@ static int ctnetlink_parse_nat_proto(struct nfattr *attr, ip_nat_proto_put(npt); + DEBUGP("leaving\n"); return 0; } @@ -595,6 +622,8 @@ ctnetlink_parse_nat(struct nfattr *nat, struct nfattr *tb[CTA_NAT_MAX]; int err; + DEBUGP("entered %s\n", __FUNCTION__); + memset(range, 0, sizeof(*range)); nfattr_parse_nested(tb, CTA_NAT_MAX, nat); @@ -620,6 +649,7 @@ ctnetlink_parse_nat(struct nfattr *nat, if (err < 0) return err; + DEBUGP("leaving\n"); return 0; } #endif @@ -629,6 +659,8 @@ ctnetlink_parse_help(struct nfattr *attr, char **helper_name) { struct nfattr *tb[CTA_HELP_MAX]; + DEBUGP("entered %s\n", __FUNCTION__); + nfattr_parse_nested(tb, CTA_HELP_MAX, attr); if (!tb[CTA_HELP_NAME-1]) @@ -658,6 +690,8 @@ ctnetlink_del_conntrack(struct sock *ctnl, struct sk_buff *skb, u_int8_t u3 = nfmsg->nfgen_family; int err = 0; + DEBUGP("entered %s\n", __FUNCTION__); + if (nfattr_bad_size(cda, CTA_MAX, cta_min)) return -EINVAL; @@ -675,8 +709,10 @@ ctnetlink_del_conntrack(struct sock *ctnl, struct sk_buff *skb, return err; h = nf_conntrack_find_get(&tuple, NULL); - if (!h) + if (!h) { + DEBUGP("tuple not found in conntrack hash\n"); return -ENOENT; + } ct = nf_ct_tuplehash_to_ctrack(h); @@ -691,6 +727,7 @@ ctnetlink_del_conntrack(struct sock *ctnl, struct sk_buff *skb, ct->timeout.function((unsigned long)ct); nf_ct_put(ct); + DEBUGP("leaving\n"); return 0; } @@ -707,6 +744,8 @@ ctnetlink_get_conntrack(struct sock *ctnl, struct sk_buff *skb, u_int8_t u3 = nfmsg->nfgen_family; int err = 0; + DEBUGP("entered %s\n", __FUNCTION__); + if (nlh->nlmsg_flags & NLM_F_DUMP) { u32 rlen; @@ -740,9 +779,11 @@ ctnetlink_get_conntrack(struct sock *ctnl, struct sk_buff *skb, return err; h = nf_conntrack_find_get(&tuple, NULL); - if (!h) + if (!h) { + DEBUGP("tuple not found in conntrack hash"); return -ENOENT; - + } + DEBUGP("tuple found\n"); ct = nf_ct_tuplehash_to_ctrack(h); err = -ENOMEM; @@ -763,6 +804,7 @@ ctnetlink_get_conntrack(struct sock *ctnl, struct sk_buff *skb, if (err < 0) goto out; + DEBUGP("leaving\n"); return 0; free: @@ -834,6 +876,8 @@ ctnetlink_change_helper(struct nf_conn *ct, struct nfattr *cda[]) char *helpname; int err; + DEBUGP("entered %s\n", __FUNCTION__); + if (!help) { /* FIXME: we need to reallocate and rehash */ return -EBUSY; @@ -910,6 +954,8 @@ ctnetlink_change_conntrack(struct nf_conn *ct, struct nfattr *cda[]) { int err; + DEBUGP("entered %s\n", __FUNCTION__); + if (cda[CTA_HELP-1]) { err = ctnetlink_change_helper(ct, cda); if (err < 0) @@ -939,6 +985,7 @@ ctnetlink_change_conntrack(struct nf_conn *ct, struct nfattr *cda[]) ct->mark = ntohl(*(u_int32_t *)NFA_DATA(cda[CTA_MARK-1])); #endif + DEBUGP("all done\n"); return 0; } @@ -950,6 +997,8 @@ ctnetlink_create_conntrack(struct nfattr *cda[], struct nf_conn *ct; int err = -EINVAL; + DEBUGP("entered %s\n", __FUNCTION__); + ct = nf_conntrack_alloc(otuple, rtuple); if (ct == NULL || IS_ERR(ct)) return -ENOMEM; @@ -979,6 +1028,7 @@ ctnetlink_create_conntrack(struct nfattr *cda[], add_timer(&ct->timeout); nf_conntrack_hash_insert(ct); + DEBUGP("conntrack with id %u inserted\n", ct->id); return 0; err: @@ -996,6 +1046,8 @@ ctnetlink_new_conntrack(struct sock *ctnl, struct sk_buff *skb, u_int8_t u3 = nfmsg->nfgen_family; int err = 0; + DEBUGP("entered %s\n", __FUNCTION__); + if (nfattr_bad_size(cda, CTA_MAX, cta_min)) return -EINVAL; @@ -1019,6 +1071,7 @@ ctnetlink_new_conntrack(struct sock *ctnl, struct sk_buff *skb, if (h == NULL) { write_unlock_bh(&nf_conntrack_lock); + DEBUGP("no such conntrack, create new\n"); err = -ENOENT; if (nlh->nlmsg_flags & NLM_F_CREATE) err = ctnetlink_create_conntrack(cda, &otuple, &rtuple); @@ -1034,6 +1087,7 @@ ctnetlink_new_conntrack(struct sock *ctnl, struct sk_buff *skb, /* We manipulate the conntrack inside the global conntrack table lock, * so there's no need to increase the refcount */ + DEBUGP("conntrack found\n"); err = -EEXIST; if (!(nlh->nlmsg_flags & NLM_F_EXCL)) err = ctnetlink_change_conntrack(nf_ct_tuplehash_to_ctrack(h), cda); @@ -1214,6 +1268,8 @@ ctnetlink_exp_dump_table(struct sk_buff *skb, struct netlink_callback *cb) struct nfgenmsg *nfmsg = NLMSG_DATA(cb->nlh); u_int8_t l3proto = nfmsg->nfgen_family; + DEBUGP("entered %s, last id=%llu\n", __FUNCTION__, *id); + read_lock_bh(&nf_conntrack_lock); list_for_each_prev(i, &nf_conntrack_expect_list) { exp = (struct nf_conntrack_expect *) i; @@ -1231,6 +1287,8 @@ ctnetlink_exp_dump_table(struct sk_buff *skb, struct netlink_callback *cb) out: read_unlock_bh(&nf_conntrack_lock); + DEBUGP("leaving, last id=%llu\n", *id); + return skb->len; } @@ -1250,6 +1308,8 @@ ctnetlink_get_expect(struct sock *ctnl, struct sk_buff *skb, u_int8_t u3 = nfmsg->nfgen_family; int err = 0; + DEBUGP("entered %s\n", __FUNCTION__); + if (nfattr_bad_size(cda, CTA_EXPECT_MAX, cta_min_exp)) return -EINVAL; @@ -1400,6 +1460,8 @@ ctnetlink_create_expect(struct nfattr *cda[], u_int8_t u3) struct nf_conn_help *help; int err = 0; + DEBUGP("entered %s\n", __FUNCTION__); + /* caller guarantees that those three CTA_EXPECT_* exist */ err = ctnetlink_parse_tuple(cda, &tuple, CTA_EXPECT_TUPLE, u3); if (err < 0) @@ -1454,6 +1516,8 @@ ctnetlink_new_expect(struct sock *ctnl, struct sk_buff *skb, u_int8_t u3 = nfmsg->nfgen_family; int err = 0; + DEBUGP("entered %s\n", __FUNCTION__); + if (nfattr_bad_size(cda, CTA_EXPECT_MAX, cta_min_exp)) return -EINVAL; @@ -1482,6 +1546,8 @@ ctnetlink_new_expect(struct sock *ctnl, struct sk_buff *skb, err = ctnetlink_change_expect(exp, cda); write_unlock_bh(&nf_conntrack_lock); + DEBUGP("leaving\n"); + return err; } diff --git a/trunk/net/netfilter/xt_NFQUEUE.c b/trunk/net/netfilter/xt_NFQUEUE.c index 39e117502bd7..db9b896e57c8 100644 --- a/trunk/net/netfilter/xt_NFQUEUE.c +++ b/trunk/net/netfilter/xt_NFQUEUE.c @@ -68,7 +68,7 @@ static int __init xt_nfqueue_init(void) static void __exit xt_nfqueue_fini(void) { - xt_unregister_targets(xt_nfqueue_target, ARRAY_SIZE(xt_nfqueue_target)); + xt_register_targets(xt_nfqueue_target, ARRAY_SIZE(xt_nfqueue_target)); } module_init(xt_nfqueue_init); diff --git a/trunk/net/netfilter/xt_connmark.c b/trunk/net/netfilter/xt_connmark.c index a8f03057dbde..92a5726ef237 100644 --- a/trunk/net/netfilter/xt_connmark.c +++ b/trunk/net/netfilter/xt_connmark.c @@ -147,7 +147,7 @@ static int __init xt_connmark_init(void) static void __exit xt_connmark_fini(void) { - xt_unregister_matches(xt_connmark_match, ARRAY_SIZE(xt_connmark_match)); + xt_register_matches(xt_connmark_match, ARRAY_SIZE(xt_connmark_match)); } module_init(xt_connmark_init); diff --git a/trunk/net/sunrpc/svc.c b/trunk/net/sunrpc/svc.c index eb44ec929ca1..2807fa0eab40 100644 --- a/trunk/net/sunrpc/svc.c +++ b/trunk/net/sunrpc/svc.c @@ -828,11 +828,6 @@ svc_process(struct svc_rqst *rqstp) *statp = procp->pc_func(rqstp, rqstp->rq_argp, rqstp->rq_resp); /* Encode reply */ - if (*statp == rpc_drop_reply) { - if (procp->pc_release) - procp->pc_release(rqstp, NULL, rqstp->rq_resp); - goto dropit; - } if (*statp == rpc_success && (xdr = procp->pc_encode) && !xdr(rqstp, resv->iov_base+resv->iov_len, rqstp->rq_resp)) { dprintk("svc: failed to encode reply\n"); diff --git a/trunk/net/xfrm/xfrm_state.c b/trunk/net/xfrm/xfrm_state.c index 84bbf8474f3e..39b8bf3a9ded 100644 --- a/trunk/net/xfrm/xfrm_state.c +++ b/trunk/net/xfrm/xfrm_state.c @@ -614,14 +614,6 @@ xfrm_state_find(xfrm_address_t *daddr, xfrm_address_t *saddr, return x; } -static void xfrm_hash_grow_check(int have_hash_collision) -{ - if (have_hash_collision && - (xfrm_state_hmask + 1) < xfrm_state_hashmax && - xfrm_state_num > xfrm_state_hmask) - schedule_work(&xfrm_hash_work); -} - static void __xfrm_state_insert(struct xfrm_state *x) { unsigned int h; @@ -650,7 +642,10 @@ static void __xfrm_state_insert(struct xfrm_state *x) xfrm_state_num++; - xfrm_hash_grow_check(x->bydst.next != NULL); + if (x->bydst.next != NULL && + (xfrm_state_hmask + 1) < xfrm_state_hashmax && + xfrm_state_num > xfrm_state_hmask) + schedule_work(&xfrm_hash_work); } /* xfrm_state_lock is held */ @@ -758,10 +753,6 @@ static struct xfrm_state *__find_acq_core(unsigned short family, u8 mode, u32 re h = xfrm_src_hash(daddr, saddr, family); hlist_add_head(&x->bysrc, xfrm_state_bysrc+h); wake_up(&km_waitq); - - xfrm_state_num++; - - xfrm_hash_grow_check(x->bydst.next != NULL); } return x; diff --git a/trunk/scripts/Makefile.headersinst b/trunk/scripts/Makefile.headersinst index 4241e0dfeeaf..6a026f69b563 100644 --- a/trunk/scripts/Makefile.headersinst +++ b/trunk/scripts/Makefile.headersinst @@ -168,7 +168,7 @@ $(objhdr-y) $(header-y) $(unifdef-y): $(KBUILDFILES) $(call cmd,gen) else -$(objhdr-y) : $(INSTALL_HDR_PATH)/$(_dst)/%.h: $(objtree)/$(obj)/%.h $(KBUILDFILES) +$(objhdr-y) : $(INSTALL_HDR_PATH)/$(_dst)/%.h: $(srctree)/$(obj)/%.h $(KBUILDFILES) $(call cmd,o_hdr_install) $(header-y) : $(INSTALL_HDR_PATH)/$(_dst)/%.h: $(srctree)/$(obj)/%.h $(KBUILDFILES) diff --git a/trunk/scripts/Makefile.modpost b/trunk/scripts/Makefile.modpost index 65e0a79c36cf..6c5469b1473b 100644 --- a/trunk/scripts/Makefile.modpost +++ b/trunk/scripts/Makefile.modpost @@ -44,7 +44,7 @@ include scripts/Kbuild.include include scripts/Makefile.lib kernelsymfile := $(objtree)/Module.symvers -modulesymfile := $(firstword $(KBUILD_EXTMOD))/Module.symvers +modulesymfile := $(KBUILD_EXTMOD)/Module.symvers # Step 1), find all modules listed in $(MODVERDIR)/ __modules := $(sort $(shell grep -h '\.ko' /dev/null $(wildcard $(MODVERDIR)/*.mod))) diff --git a/trunk/security/selinux/ss/ebitmap.c b/trunk/security/selinux/ss/ebitmap.c index d539346ab3a2..cfed1d30fa6a 100644 --- a/trunk/security/selinux/ss/ebitmap.c +++ b/trunk/security/selinux/ss/ebitmap.c @@ -93,15 +93,11 @@ int ebitmap_export(const struct ebitmap *src, size_t bitmap_byte; unsigned char bitmask; - if (src->highbit == 0) { - *dst = NULL; - *dst_len = 0; - return 0; - } - bitmap_len = src->highbit / 8; if (src->highbit % 7) bitmap_len += 1; + if (bitmap_len == 0) + return -EINVAL; bitmap = kzalloc((bitmap_len & ~(sizeof(MAPTYPE) - 1)) + sizeof(MAPTYPE), diff --git a/trunk/security/selinux/ss/mls.c b/trunk/security/selinux/ss/mls.c index 2cca8e251624..c713af23250a 100644 --- a/trunk/security/selinux/ss/mls.c +++ b/trunk/security/selinux/ss/mls.c @@ -640,13 +640,8 @@ int mls_export_cat(const struct context *context, { int rc = -EPERM; - if (!selinux_mls_enabled) { - *low = NULL; - *low_len = 0; - *high = NULL; - *high_len = 0; + if (!selinux_mls_enabled) return 0; - } if (low != NULL) { rc = ebitmap_export(&context->range.level[0].cat, @@ -666,16 +661,10 @@ int mls_export_cat(const struct context *context, return 0; export_cat_failure: - if (low != NULL) { + if (low != NULL) kfree(*low); - *low = NULL; - *low_len = 0; - } - if (high != NULL) { + if (high != NULL) kfree(*high); - *high = NULL; - *high_len = 0; - } return rc; } diff --git a/trunk/security/selinux/ss/services.c b/trunk/security/selinux/ss/services.c index b1f6fb36c699..18274b005090 100644 --- a/trunk/security/selinux/ss/services.c +++ b/trunk/security/selinux/ss/services.c @@ -2399,33 +2399,31 @@ static int selinux_netlbl_socket_setsid(struct socket *sock, u32 sid) if (!ss_initialized) return 0; - netlbl_secattr_init(&secattr); - POLICY_RDLOCK; ctx = sidtab_search(&sidtab, sid); if (ctx == NULL) goto netlbl_socket_setsid_return; + netlbl_secattr_init(&secattr); secattr.domain = kstrdup(policydb.p_type_val_to_name[ctx->type - 1], GFP_ATOMIC); mls_export_lvl(ctx, &secattr.mls_lvl, NULL); secattr.mls_lvl_vld = 1; - rc = mls_export_cat(ctx, - &secattr.mls_cat, - &secattr.mls_cat_len, - NULL, - NULL); - if (rc != 0) - goto netlbl_socket_setsid_return; + mls_export_cat(ctx, + &secattr.mls_cat, + &secattr.mls_cat_len, + NULL, + NULL); rc = netlbl_socket_setattr(sock, &secattr); if (rc == 0) sksec->nlbl_state = NLBL_LABELED; + netlbl_secattr_destroy(&secattr); + netlbl_socket_setsid_return: POLICY_RDUNLOCK; - netlbl_secattr_destroy(&secattr); return rc; }