aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Woodhouse <dwmw2@infradead.org>2007-02-05 08:25:21 -0500
committerDavid Woodhouse <dwmw2@infradead.org>2007-02-05 08:25:21 -0500
commit4285431fb658263e98942ce2320b0b26eddcc06d (patch)
tree49bce2d36917cb628ccddee55a47026da2ed90db
parentc033a7e3d593554ba5e8a0e63bf7e5874dc3e92f (diff)
parent62d0cfcb27cf755cebdc93ca95dabc83608007cd (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
-rw-r--r--CREDITS2
-rw-r--r--Documentation/SubmitChecklist4
-rw-r--r--Documentation/SubmittingPatches6
-rw-r--r--Documentation/feature-removal-schedule.txt7
-rw-r--r--Documentation/filesystems/9p.txt20
-rw-r--r--Documentation/i386/boot.txt3
-rw-r--r--Documentation/kdump/kdump.txt49
-rw-r--r--Documentation/sysrq.txt66
-rw-r--r--Documentation/usb/CREDITS2
-rw-r--r--MAINTAINERS48
-rw-r--r--Makefile8
-rw-r--r--README4
-rw-r--r--arch/alpha/kernel/process.c1
-rw-r--r--arch/arm/configs/at91sam9260ek_defconfig1
-rw-r--r--arch/arm/configs/at91sam9261ek_defconfig1
-rw-r--r--arch/arm/kernel/head.S7
-rw-r--r--arch/arm/mach-at91rm9200/at91rm9200_devices.c2
-rw-r--r--arch/arm/mach-at91rm9200/at91sam9260.c3
-rw-r--r--arch/arm/mach-at91rm9200/at91sam9261.c3
-rw-r--r--arch/arm/mach-at91rm9200/gpio.c39
-rw-r--r--arch/arm/mach-imx/cpufreq.c14
-rw-r--r--arch/arm/mach-s3c2410/gpio.c12
-rw-r--r--arch/arm/mach-s3c2410/pm.c7
-rw-r--r--arch/arm/mach-s3c2410/s3c2412-dma.c4
-rw-r--r--arch/arm/mm/init.c11
-rw-r--r--arch/arm/mm/ioremap.c3
-rw-r--r--arch/arm/mm/proc-xscale.S2
-rw-r--r--arch/arm/tools/mach-types25
-rw-r--r--arch/arm/vfp/entry.S1
-rw-r--r--arch/arm/vfp/vfp.h4
-rw-r--r--arch/arm/vfp/vfphw.S26
-rw-r--r--arch/arm/vfp/vfpmodule.c30
-rw-r--r--arch/avr32/configs/atstk1002_defconfig39
-rw-r--r--arch/avr32/kernel/avr32_ksyms.c1
-rw-r--r--arch/i386/boot/compressed/relocs.c2
-rw-r--r--arch/i386/kernel/cpu/cpufreq/p4-clockmod.c9
-rw-r--r--arch/i386/kernel/cpu/cyrix.c2
-rw-r--r--arch/i386/kernel/efi.c89
-rw-r--r--arch/i386/kernel/entry.S4
-rw-r--r--arch/i386/kernel/io_apic.c32
-rw-r--r--arch/i386/kernel/nmi.c8
-rw-r--r--arch/i386/kernel/paravirt.c9
-rw-r--r--arch/i386/kernel/sysenter.c14
-rw-r--r--arch/i386/mach-default/setup.c2
-rw-r--r--arch/ia64/kernel/acpi.c3
-rw-r--r--arch/ia64/kernel/irq.c3
-rw-r--r--arch/mips/Kconfig14
-rw-r--r--arch/mips/Makefile2
-rw-r--r--arch/mips/dec/prom/memory.c2
-rw-r--r--arch/mips/kernel/smtc.c64
-rw-r--r--arch/mips/kernel/vpe.c9
-rw-r--r--arch/mips/mips-boards/malta/Makefile3
-rw-r--r--arch/mips/mips-boards/sim/sim_setup.c2
-rw-r--r--arch/mips/mm/init.c3
-rw-r--r--arch/mips/momentum/ocelot_g/prom.c4
-rw-r--r--arch/mips/momentum/ocelot_g/setup.c4
-rw-r--r--arch/mips/vr41xx/common/irq.c12
-rw-r--r--arch/powerpc/Kconfig6
-rw-r--r--arch/powerpc/kernel/pci_64.c2
-rw-r--r--arch/powerpc/kernel/vdso.c7
-rw-r--r--arch/powerpc/platforms/ps3/Makefile3
-rw-r--r--arch/powerpc/platforms/ps3/interrupt.c2
-rw-r--r--arch/sparc/kernel/process.c1
-rw-r--r--arch/sparc/kernel/smp.c8
-rw-r--r--arch/sparc/kernel/sun4d_smp.c2
-rw-r--r--arch/sparc64/kernel/sun4v_tlb_miss.S4
-rw-r--r--arch/um/Kconfig.i38658
-rw-r--r--arch/um/sys-i386/signal.c3
-rw-r--r--arch/um/sys-x86_64/signal.c5
-rw-r--r--arch/x86_64/ia32/ia32_binfmt.c49
-rw-r--r--arch/x86_64/ia32/syscall32.c15
-rw-r--r--arch/x86_64/kernel/nmi.c2
-rw-r--r--block/elevator.c11
-rw-r--r--block/scsi_ioctl.c5
-rw-r--r--drivers/acpi/processor_perflib.c4
-rw-r--r--drivers/acpi/video.c2
-rw-r--r--drivers/ata/Kconfig4
-rw-r--r--drivers/ata/ahci.c101
-rw-r--r--drivers/ata/ata_generic.c6
-rw-r--r--drivers/ata/libata-core.c17
-rw-r--r--drivers/ata/libata-eh.c2
-rw-r--r--drivers/ata/libata-scsi.c62
-rw-r--r--drivers/ata/libata-sff.c21
-rw-r--r--drivers/ata/pata_atiixp.c11
-rw-r--r--drivers/ata/pata_cmd64x.c23
-rw-r--r--drivers/ata/pata_hpt3x2n.c6
-rw-r--r--drivers/ata/pata_it821x.c4
-rw-r--r--drivers/ata/pata_ixp4xx_cf.c5
-rw-r--r--drivers/ata/pata_jmicron.c18
-rw-r--r--drivers/ata/pata_legacy.c4
-rw-r--r--drivers/ata/pata_platform.c3
-rw-r--r--drivers/ata/pata_rz1000.c6
-rw-r--r--drivers/ata/pata_sil680.c2
-rw-r--r--drivers/ata/pata_via.c4
-rw-r--r--drivers/ata/sata_nv.c14
-rw-r--r--drivers/ata/sata_uli.c3
-rw-r--r--drivers/ata/sata_via.c12
-rw-r--r--drivers/atm/horizon.c2
-rw-r--r--drivers/char/agp/amd-k7-agp.c5
-rw-r--r--drivers/char/agp/amd64-agp.c2
-rw-r--r--drivers/char/agp/ati-agp.c36
-rw-r--r--drivers/char/agp/intel-agp.c9
-rw-r--r--drivers/char/agp/via-agp.c21
-rw-r--r--drivers/char/ipmi/ipmi_msghandler.c3
-rw-r--r--drivers/char/sysrq.c20
-rw-r--r--drivers/char/tlclk.c43
-rw-r--r--drivers/char/vr41xx_giu.c114
-rw-r--r--drivers/cpufreq/cpufreq.c17
-rw-r--r--drivers/firmware/efivars.c29
-rw-r--r--drivers/hid/hid-core.c1
-rw-r--r--drivers/hid/hid-input.c13
-rw-r--r--drivers/ide/ide-pnp.c5
-rw-r--r--drivers/ide/ide.c11
-rw-r--r--drivers/ide/pci/aec62xx.c2
-rw-r--r--drivers/ide/pci/alim15x3.c2
-rw-r--r--drivers/ide/pci/amd74xx.c2
-rw-r--r--drivers/ide/pci/atiixp.c42
-rw-r--r--drivers/ide/pci/cmd64x.c2
-rw-r--r--drivers/ide/pci/cs5520.c2
-rw-r--r--drivers/ide/pci/cs5530.c2
-rw-r--r--drivers/ide/pci/cy82c693.c2
-rw-r--r--drivers/ide/pci/generic.c37
-rw-r--r--drivers/ide/pci/hpt34x.c2
-rw-r--r--drivers/ide/pci/hpt366.c2
-rw-r--r--drivers/ide/pci/jmicron.c17
-rw-r--r--drivers/ide/pci/ns87415.c2
-rw-r--r--drivers/ide/pci/opti621.c2
-rw-r--r--drivers/ide/pci/pdc202xx_new.c2
-rw-r--r--drivers/ide/pci/pdc202xx_old.c2
-rw-r--r--drivers/ide/pci/rz1000.c2
-rw-r--r--drivers/ide/pci/sc1200.c2
-rw-r--r--drivers/ide/pci/serverworks.c2
-rw-r--r--drivers/ide/pci/sgiioc4.c3
-rw-r--r--drivers/ide/pci/siimage.c2
-rw-r--r--drivers/ide/pci/sis5513.c2
-rw-r--r--drivers/ide/pci/sl82c105.c2
-rw-r--r--drivers/ide/pci/slc90e66.c2
-rw-r--r--drivers/ide/pci/triflex.c2
-rw-r--r--drivers/ide/pci/trm290.c2
-rw-r--r--drivers/ide/pci/via82cxxx.c5
-rw-r--r--drivers/infiniband/hw/ehca/ehca_cq.c5
-rw-r--r--drivers/infiniband/hw/ehca/ehca_irq.c3
-rw-r--r--drivers/infiniband/ulp/srp/ib_srp.c20
-rw-r--r--drivers/isdn/gigaset/common.c61
-rw-r--r--drivers/kvm/kvm.h1
-rw-r--r--drivers/kvm/kvm_main.c19
-rw-r--r--drivers/kvm/mmu.c16
-rw-r--r--drivers/kvm/paging_tmpl.h79
-rw-r--r--drivers/kvm/svm.c28
-rw-r--r--drivers/kvm/vmx.c5
-rw-r--r--drivers/kvm/x86_emulate.c98
-rw-r--r--drivers/md/bitmap.c12
-rw-r--r--drivers/md/dm.c27
-rw-r--r--drivers/md/md.c32
-rw-r--r--drivers/md/raid1.c7
-rw-r--r--drivers/md/raid5.c5
-rw-r--r--drivers/media/video/video-buf.c1
-rw-r--r--drivers/mtd/nand/cafe.c1
-rw-r--r--drivers/net/82596.c7
-rw-r--r--drivers/net/b44.c52
-rw-r--r--drivers/net/bnx2.c22
-rw-r--r--drivers/net/bnx2.h6
-rw-r--r--drivers/net/bonding/bonding.h7
-rw-r--r--drivers/net/e100.c7
-rw-r--r--drivers/net/ehea/ehea.h2
-rw-r--r--drivers/net/ehea/ehea_main.c87
-rw-r--r--drivers/net/ehea/ehea_phyp.c10
-rw-r--r--drivers/net/fs_enet/mac-fec.c13
-rw-r--r--drivers/net/fs_enet/mac-scc.c6
-rw-r--r--drivers/net/hamradio/Kconfig6
-rw-r--r--drivers/net/irda/irda-usb.c45
-rw-r--r--drivers/net/irda/irda-usb.h1
-rw-r--r--drivers/net/irda/stir4200.c2
-rw-r--r--drivers/net/irda/vlsi_ir.c16
-rw-r--r--drivers/net/irda/vlsi_ir.h33
-rw-r--r--drivers/net/mv643xx_eth.c11
-rw-r--r--drivers/net/netxen/netxen_nic.h143
-rw-r--r--drivers/net/netxen/netxen_nic_ethtool.c22
-rw-r--r--drivers/net/netxen/netxen_nic_hw.c46
-rw-r--r--drivers/net/netxen/netxen_nic_hw.h74
-rw-r--r--drivers/net/netxen/netxen_nic_init.c15
-rw-r--r--drivers/net/netxen/netxen_nic_isr.c4
-rw-r--r--drivers/net/netxen/netxen_nic_main.c10
-rw-r--r--drivers/net/netxen/netxen_nic_niu.c106
-rw-r--r--drivers/net/pcmcia/3c589_cs.c7
-rw-r--r--drivers/net/phy/fixed.c2
-rw-r--r--drivers/net/phy/phy.c3
-rw-r--r--drivers/net/s2io.c3
-rw-r--r--drivers/net/skge.c2
-rw-r--r--drivers/net/sky2.c27
-rw-r--r--drivers/net/smc911x.c5
-rw-r--r--drivers/net/spider_net.c2
-rw-r--r--drivers/pci/quirks.c84
-rw-r--r--drivers/pci/search.c10
-rw-r--r--drivers/rtc/rtc-sh.c12
-rw-r--r--drivers/rtc/rtc-sysfs.c2
-rw-r--r--drivers/scsi/pcmcia/sym53c500_cs.c2
-rw-r--r--drivers/scsi/qla4xxx/ql4_def.h1
-rw-r--r--drivers/scsi/qla4xxx/ql4_glbl.h1
-rw-r--r--drivers/scsi/qla4xxx/ql4_init.c18
-rw-r--r--drivers/scsi/qla4xxx/ql4_isr.c4
-rw-r--r--drivers/scsi/qla4xxx/ql4_mbx.c35
-rw-r--r--drivers/scsi/qla4xxx/ql4_os.c64
-rw-r--r--drivers/scsi/qla4xxx/ql4_version.h2
-rw-r--r--drivers/scsi/scsi_scan.c6
-rw-r--r--drivers/scsi/sd.c20
-rw-r--r--drivers/scsi/st.c19
-rw-r--r--drivers/serial/amba-pl010.c2
-rw-r--r--drivers/serial/amba-pl011.c2
-rw-r--r--drivers/serial/atmel_serial.c7
-rw-r--r--drivers/serial/atmel_serial.h2
-rw-r--r--drivers/spi/pxa2xx_spi.c5
-rw-r--r--drivers/spi/spi.c23
-rw-r--r--drivers/spi/spi_s3c24xx.c28
-rw-r--r--drivers/usb/input/hid-core.c12
-rw-r--r--drivers/usb/net/rtl8150.c3
-rw-r--r--drivers/usb/serial/funsoft.c2
-rw-r--r--fs/9p/error.c1
-rw-r--r--fs/9p/fid.c69
-rw-r--r--fs/9p/fid.h5
-rw-r--r--fs/9p/mux.c4
-rw-r--r--fs/9p/v9fs.c11
-rw-r--r--fs/9p/vfs_file.c47
-rw-r--r--fs/9p/vfs_inode.c206
-rw-r--r--fs/aio.c20
-rw-r--r--fs/binfmt_elf.c51
-rw-r--r--fs/binfmt_elf_fdpic.c8
-rw-r--r--fs/block_dev.c51
-rw-r--r--fs/buffer.c19
-rw-r--r--fs/cifs/CHANGES4
-rw-r--r--fs/cifs/cifs_debug.c4
-rw-r--r--fs/cifs/cifsfs.h2
-rw-r--r--fs/cifs/misc.c8
-rw-r--r--fs/cifs/sess.c13
-rw-r--r--fs/fs-writeback.c13
-rw-r--r--fs/fuse/control.c4
-rw-r--r--fs/hostfs/hostfs.h2
-rw-r--r--fs/hostfs/hostfs_kern.c2
-rw-r--r--fs/hostfs/hostfs_user.c4
-rw-r--r--fs/lockd/clntlock.c4
-rw-r--r--fs/nfs/dir.c2
-rw-r--r--fs/nfs/file.c5
-rw-r--r--fs/nfs/inode.c97
-rw-r--r--fs/nfs/symlink.c4
-rw-r--r--fs/nfsd/export.c1
-rw-r--r--fs/nfsd/nfs3xdr.c9
-rw-r--r--fs/nfsd/nfs4xdr.c5
-rw-r--r--fs/nfsd/nfsfh.c14
-rw-r--r--fs/nfsd/nfssvc.c8
-rw-r--r--fs/nfsd/nfsxdr.c5
-rw-r--r--fs/nfsd/vfs.c29
-rw-r--r--fs/ntfs/aops.c4
-rw-r--r--fs/ocfs2/ocfs2_fs.h2
-rw-r--r--fs/proc/base.c20
-rw-r--r--fs/reiserfs/file.c20
-rw-r--r--fs/reiserfs/inode.c2
-rw-r--r--fs/ufs/balloc.c46
-rw-r--r--fs/ufs/inode.c14
-rw-r--r--fs/ufs/truncate.c4
-rw-r--r--include/asm-alpha/dma-mapping.h20
-rw-r--r--include/asm-alpha/unistd.h11
-rw-r--r--include/asm-arm/arch-at91rm9200/at91_ecc.h8
-rw-r--r--include/asm-arm/arch-at91rm9200/at91_pmc.h2
-rw-r--r--include/asm-arm/arch-at91rm9200/at91_rstc.h2
-rw-r--r--include/asm-arm/arch-at91rm9200/at91_rtc.h16
-rw-r--r--include/asm-arm/arch-at91rm9200/at91rm9200.h2
-rw-r--r--include/asm-arm/arch-at91rm9200/at91sam9260_matrix.h2
-rw-r--r--include/asm-arm/arch-at91rm9200/at91sam9261_matrix.h6
-rw-r--r--include/asm-arm/arch-at91rm9200/at91sam926x_mc.h16
-rw-r--r--include/asm-arm/arch-s3c2410/regs-gpio.h4
-rw-r--r--include/asm-arm/arch-s3c2410/regs-mem.h14
-rw-r--r--include/asm-arm/fpstate.h3
-rw-r--r--include/asm-frv/Kbuild6
-rw-r--r--include/asm-frv/page.h4
-rw-r--r--include/asm-frv/ptrace.h4
-rw-r--r--include/asm-frv/termios.h2
-rw-r--r--include/asm-generic/libata-portmap.h4
-rw-r--r--include/asm-i386/elf.h51
-rw-r--r--include/asm-i386/fixmap.h2
-rw-r--r--include/asm-i386/page.h2
-rw-r--r--include/asm-ia64/checksum.h6
-rw-r--r--include/asm-ia64/pci.h6
-rw-r--r--include/asm-m68k/uaccess.h1
-rw-r--r--include/asm-mips/checksum.h3
-rw-r--r--include/asm-mips/hazards.h2
-rw-r--r--include/asm-mips/irqflags.h22
-rw-r--r--include/asm-mips/pgtable.h10
-rw-r--r--include/asm-mips/thread_info.h2
-rw-r--r--include/asm-powerpc/dma-mapping.h12
-rw-r--r--include/asm-powerpc/libata-portmap.h12
-rw-r--r--include/asm-sparc/checksum.h2
-rw-r--r--include/asm-um/pgtable.h9
-rw-r--r--include/asm-x86_64/dma-mapping.h3
-rw-r--r--include/asm-x86_64/uaccess.h2
-rw-r--r--include/linux/Kbuild5
-rw-r--r--include/linux/bitops.h6
-rw-r--r--include/linux/cdev.h4
-rw-r--r--include/linux/efi.h2
-rw-r--r--include/linux/hdreg.h8
-rw-r--r--include/linux/hid.h1
-rw-r--r--include/linux/i2o-dev.h5
-rw-r--r--include/linux/if_tunnel.h2
-rw-r--r--include/linux/kvm.h1
-rw-r--r--include/linux/libata.h9
-rw-r--r--include/linux/list.h10
-rw-r--r--include/linux/mm.h1
-rw-r--r--include/linux/mtio.h146
-rw-r--r--include/linux/mutex.h2
-rw-r--r--include/linux/netfilter_ipv4/ip_tables.h2
-rw-r--r--include/linux/nfs_fs.h1
-rw-r--r--include/linux/nfsd/nfsd.h4
-rw-r--r--include/linux/nfsd/nfsfh.h15
-rw-r--r--include/linux/nfsd/xdr.h4
-rw-r--r--include/linux/nfsd/xdr3.h8
-rw-r--r--include/linux/pci_ids.h6
-rw-r--r--include/linux/pid_namespace.h2
-rw-r--r--include/linux/qic117.h290
-rw-r--r--include/linux/raid/md.h2
-rw-r--r--include/linux/reiserfs_fs_i.h2
-rw-r--r--include/linux/rtmutex.h4
-rw-r--r--include/linux/sunrpc/sched.h1
-rw-r--r--include/linux/sunrpc/svc.h5
-rw-r--r--include/linux/timer.h4
-rw-r--r--include/net/inet6_connection_sock.h2
-rw-r--r--include/net/inet_connection_sock.h3
-rw-r--r--include/net/ip.h2
-rw-r--r--include/net/netfilter/nf_conntrack_compat.h1
-rw-r--r--include/net/sctp/sm.h1
-rw-r--r--include/sound/core.h18
-rw-r--r--ipc/shm.c2
-rw-r--r--kernel/exit.c2
-rw-r--r--kernel/fork.c2
-rw-r--r--kernel/irq/manage.c3
-rw-r--r--kernel/kprobes.c20
-rw-r--r--kernel/pid.c2
-rw-r--r--kernel/profile.c3
-rw-r--r--kernel/sys.c15
-rw-r--r--mm/filemap_xip.c4
-rw-r--r--mm/memory.c11
-rw-r--r--mm/mempolicy.c4
-rw-r--r--mm/mmap.c7
-rw-r--r--mm/mremap.c1
-rw-r--r--mm/page-writeback.c41
-rw-r--r--mm/page_alloc.c3
-rw-r--r--mm/truncate.c22
-rw-r--r--net/bluetooth/l2cap.c10
-rw-r--r--net/core/flow.c26
-rw-r--r--net/dccp/output.c4
-rw-r--r--net/decnet/dn_dev.c11
-rw-r--r--net/ipv4/fib_trie.c34
-rw-r--r--net/ipv4/ip_output.c3
-rw-r--r--net/ipv4/netfilter/Makefile20
-rw-r--r--net/ipv4/netfilter/ip_conntrack_netlink.c4
-rw-r--r--net/ipv4/netfilter/ip_conntrack_sip.c10
-rw-r--r--net/ipv4/netfilter/nf_nat_pptp.c4
-rw-r--r--net/ipv4/tcp_input.c15
-rw-r--r--net/ipv4/tcp_output.c6
-rw-r--r--net/ipv4/tcp_probe.c2
-rw-r--r--net/ipv6/addrconf.c10
-rw-r--r--net/ipv6/inet6_connection_sock.c3
-rw-r--r--net/ipv6/mcast.c6
-rw-r--r--net/ipv6/ndisc.c7
-rw-r--r--net/ipv6/route.c1
-rw-r--r--net/netfilter/Kconfig4
-rw-r--r--net/netfilter/nf_conntrack_netlink.c4
-rw-r--r--net/netfilter/nf_conntrack_pptp.c2
-rw-r--r--net/netfilter/nf_conntrack_sip.c10
-rw-r--r--net/netfilter/xt_connbytes.c29
-rw-r--r--net/packet/af_packet.c46
-rw-r--r--net/sched/act_ipt.c8
-rw-r--r--net/sctp/protocol.c2
-rw-r--r--net/sctp/sm_make_chunk.c6
-rw-r--r--net/sctp/sm_sideeffect.c8
-rw-r--r--net/sctp/sm_statefuns.c44
-rw-r--r--net/sctp/sm_statetable.c2
-rw-r--r--net/sunrpc/clnt.c8
-rw-r--r--net/sunrpc/sched.c3
-rw-r--r--net/sunrpc/svc.c32
-rw-r--r--net/sunrpc/svcsock.c14
-rw-r--r--net/x25/x25_dev.c1
-rw-r--r--net/xfrm/xfrm_policy.c16
-rw-r--r--scripts/Makefile.headersinst2
-rw-r--r--security/selinux/include/xfrm.h9
-rw-r--r--security/selinux/ss/services.c3
-rw-r--r--sound/core/init.c18
-rw-r--r--sound/core/sound.c4
-rw-r--r--sound/core/sound_oss.c4
-rw-r--r--sound/usb/usx2y/usbusx2yaudio.c2
-rw-r--r--sound/usb/usx2y/usx2yhwdeppcm.c2
389 files changed, 3094 insertions, 2539 deletions
diff --git a/CREDITS b/CREDITS
index 75c5ce82720c..ae08e4c10ed4 100644
--- a/CREDITS
+++ b/CREDITS
@@ -3279,7 +3279,7 @@ S: Sevilla 41005
3279S: Spain 3279S: Spain
3280 3280
3281N: Linus Torvalds 3281N: Linus Torvalds
3282E: torvalds@osdl.org 3282E: torvalds@linux-foundation.org
3283D: Original kernel hacker 3283D: Original kernel hacker
3284S: 12725 SW Millikan Way, Suite 400 3284S: 12725 SW Millikan Way, Suite 400
3285S: Beaverton, Oregon 97005 3285S: Beaverton, Oregon 97005
diff --git a/Documentation/SubmitChecklist b/Documentation/SubmitChecklist
index 2270efa10153..bfbb2718a279 100644
--- a/Documentation/SubmitChecklist
+++ b/Documentation/SubmitChecklist
@@ -72,3 +72,7 @@ kernel patches.
72 72
73 If the new code is substantial, addition of subsystem-specific fault 73 If the new code is substantial, addition of subsystem-specific fault
74 injection might be appropriate. 74 injection might be appropriate.
75
7622: Newly-added code has been compiled with `gcc -W'. This will generate
77 lots of noise, but is good for finding bugs like "warning: comparison
78 between signed and unsigned".
diff --git a/Documentation/SubmittingPatches b/Documentation/SubmittingPatches
index 302d148c2e18..b0d0043f7c46 100644
--- a/Documentation/SubmittingPatches
+++ b/Documentation/SubmittingPatches
@@ -134,9 +134,9 @@ Do not send more than 15 patches at once to the vger mailing lists!!!
134 134
135 135
136Linus Torvalds is the final arbiter of all changes accepted into the 136Linus Torvalds is the final arbiter of all changes accepted into the
137Linux kernel. His e-mail address is <torvalds@osdl.org>. He gets 137Linux kernel. His e-mail address is <torvalds@linux-foundation.org>.
138a lot of e-mail, so typically you should do your best to -avoid- sending 138He gets a lot of e-mail, so typically you should do your best to -avoid-
139him e-mail. 139sending him e-mail.
140 140
141Patches which are bug fixes, are "obvious" changes, or similarly 141Patches which are bug fixes, are "obvious" changes, or similarly
142require little discussion should be sent or CC'd to Linus. Patches 142require little discussion should be sent or CC'd to Linus. Patches
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt
index fc532395d116..0ba6af02cdaf 100644
--- a/Documentation/feature-removal-schedule.txt
+++ b/Documentation/feature-removal-schedule.txt
@@ -318,3 +318,10 @@ Why: /proc/acpi/button has been replaced by events to the input layer
318Who: Len Brown <len.brown@intel.com> 318Who: Len Brown <len.brown@intel.com>
319 319
320--------------------------- 320---------------------------
321
322What: JFFS (version 1)
323When: 2.6.21
324Why: Unmaintained for years, superceded by JFFS2 for years.
325Who: Jeff Garzik <jeff@garzik.org>
326
327---------------------------
diff --git a/Documentation/filesystems/9p.txt b/Documentation/filesystems/9p.txt
index 43b89c214d20..4d075a4558f9 100644
--- a/Documentation/filesystems/9p.txt
+++ b/Documentation/filesystems/9p.txt
@@ -73,8 +73,22 @@ OPTIONS
73RESOURCES 73RESOURCES
74========= 74=========
75 75
76The Linux version of the 9p server is now maintained under the npfs project 76Our current recommendation is to use Inferno (http://www.vitanuova.com/inferno)
77on sourceforge (http://sourceforge.net/projects/npfs). 77as the 9p server. You can start a 9p server under Inferno by issuing the
78following command:
79 ; styxlisten -A tcp!*!564 export '#U*'
80
81The -A specifies an unauthenticated export. The 564 is the port # (you may
82have to choose a higher port number if running as a normal user). The '#U*'
83specifies exporting the root of the Linux name space. You may specify a
84subset of the namespace by extending the path: '#U*'/tmp would just export
85/tmp. For more information, see the Inferno manual pages covering styxlisten
86and export.
87
88A Linux version of the 9p server is now maintained under the npfs project
89on sourceforge (http://sourceforge.net/projects/npfs). There is also a
90more stable single-threaded version of the server (named spfs) available from
91the same CVS repository.
78 92
79There are user and developer mailing lists available through the v9fs project 93There are user and developer mailing lists available through the v9fs project
80on sourceforge (http://sourceforge.net/projects/v9fs). 94on sourceforge (http://sourceforge.net/projects/v9fs).
@@ -96,5 +110,5 @@ STATUS
96 110
97The 2.6 kernel support is working on PPC and x86. 111The 2.6 kernel support is working on PPC and x86.
98 112
99PLEASE USE THE SOURCEFORGE BUG-TRACKER TO REPORT PROBLEMS. 113PLEASE USE THE KERNEL BUGZILLA TO REPORT PROBLEMS. (http://bugzilla.kernel.org)
100 114
diff --git a/Documentation/i386/boot.txt b/Documentation/i386/boot.txt
index 9575de300a61..38fe1f03fb14 100644
--- a/Documentation/i386/boot.txt
+++ b/Documentation/i386/boot.txt
@@ -2,7 +2,7 @@
2 ---------------------------- 2 ----------------------------
3 3
4 H. Peter Anvin <hpa@zytor.com> 4 H. Peter Anvin <hpa@zytor.com>
5 Last update 2006-11-17 5 Last update 2007-01-26
6 6
7On the i386 platform, the Linux kernel uses a rather complicated boot 7On the i386 platform, the Linux kernel uses a rather complicated boot
8convention. This has evolved partially due to historical aspects, as 8convention. This has evolved partially due to historical aspects, as
@@ -186,6 +186,7 @@ filled out, however:
186 7 GRuB 186 7 GRuB
187 8 U-BOOT 187 8 U-BOOT
188 9 Xen 188 9 Xen
189 A Gujin
189 190
190 Please contact <hpa@zytor.com> if you need a bootloader ID 191 Please contact <hpa@zytor.com> if you need a bootloader ID
191 value assigned. 192 value assigned.
diff --git a/Documentation/kdump/kdump.txt b/Documentation/kdump/kdump.txt
index 5af6676a88f0..073306818347 100644
--- a/Documentation/kdump/kdump.txt
+++ b/Documentation/kdump/kdump.txt
@@ -17,7 +17,7 @@ You can use common Linux commands, such as cp and scp, to copy the
17memory image to a dump file on the local disk, or across the network to 17memory image to a dump file on the local disk, or across the network to
18a remote system. 18a remote system.
19 19
20Kdump and kexec are currently supported on the x86, x86_64, ppc64 and IA64 20Kdump and kexec are currently supported on the x86, x86_64, ppc64 and ia64
21architectures. 21architectures.
22 22
23When the system kernel boots, it reserves a small section of memory for 23When the system kernel boots, it reserves a small section of memory for
@@ -61,7 +61,12 @@ Install kexec-tools
61 61
622) Download the kexec-tools user-space package from the following URL: 622) Download the kexec-tools user-space package from the following URL:
63 63
64http://www.kernel.org/pub/linux/kernel/people/horms/kexec-tools/kexec-tools-testing-20061214.tar.gz 64http://www.kernel.org/pub/linux/kernel/people/horms/kexec-tools/kexec-tools-testing.tar.gz
65
66This is a symlink to the latest version, which at the time of writing is
6720061214, the only release of kexec-tools-testing so far. As other versions
68are made released, the older onese will remain available at
69http://www.kernel.org/pub/linux/kernel/people/horms/kexec-tools/
65 70
66Note: Latest kexec-tools-testing git tree is available at 71Note: Latest kexec-tools-testing git tree is available at
67 72
@@ -71,11 +76,11 @@ http://www.kernel.org/git/?p=linux/kernel/git/horms/kexec-tools-testing.git;a=su
71 76
723) Unpack the tarball with the tar command, as follows: 773) Unpack the tarball with the tar command, as follows:
73 78
74 tar xvpzf kexec-tools-testing-20061214.tar.gz 79 tar xvpzf kexec-tools-testing.tar.gz
75 80
764) Change to the kexec-tools-1.101 directory, as follows: 814) Change to the kexec-tools directory, as follows:
77 82
78 cd kexec-tools-testing-20061214 83 cd kexec-tools-testing-VERSION
79 84
805) Configure the package, as follows: 855) Configure the package, as follows:
81 86
@@ -224,7 +229,23 @@ Dump-capture kernel config options (Arch Dependent, ppc64)
224 229
225Dump-capture kernel config options (Arch Dependent, ia64) 230Dump-capture kernel config options (Arch Dependent, ia64)
226---------------------------------------------------------- 231----------------------------------------------------------
227(To be filled) 232
233- No specific options are required to create a dump-capture kernel
234 for ia64, other than those specified in the arch idependent section
235 above. This means that it is possible to use the system kernel
236 as a dump-capture kernel if desired.
237
238 The crashkernel region can be automatically placed by the system
239 kernel at run time. This is done by specifying the base address as 0,
240 or omitting it all together.
241
242 crashkernel=256M@0
243 or
244 crashkernel=256M
245
246 If the start address is specified, note that the start address of the
247 kernel will be aligned to 64Mb, so if the start address is not then
248 any space below the alignment point will be wasted.
228 249
229 250
230Boot into System Kernel 251Boot into System Kernel
@@ -243,6 +264,10 @@ Boot into System Kernel
243 264
244 On ppc64, use "crashkernel=128M@32M". 265 On ppc64, use "crashkernel=128M@32M".
245 266
267 On ia64, 256M@256M is a generous value that typically works.
268 The region may be automatically placed on ia64, see the
269 dump-capture kernel config option notes above.
270
246Load the Dump-capture Kernel 271Load the Dump-capture Kernel
247============================ 272============================
248 273
@@ -261,7 +286,8 @@ For x86_64:
261For ppc64: 286For ppc64:
262 - Use vmlinux 287 - Use vmlinux
263For ia64: 288For ia64:
264 (To be filled) 289 - Use vmlinux or vmlinuz.gz
290
265 291
266If you are using a uncompressed vmlinux image then use following command 292If you are using a uncompressed vmlinux image then use following command
267to load dump-capture kernel. 293to load dump-capture kernel.
@@ -277,18 +303,19 @@ to load dump-capture kernel.
277 --initrd=<initrd-for-dump-capture-kernel> \ 303 --initrd=<initrd-for-dump-capture-kernel> \
278 --append="root=<root-dev> <arch-specific-options>" 304 --append="root=<root-dev> <arch-specific-options>"
279 305
306Please note, that --args-linux does not need to be specified for ia64.
307It is planned to make this a no-op on that architecture, but for now
308it should be omitted
309
280Following are the arch specific command line options to be used while 310Following are the arch specific command line options to be used while
281loading dump-capture kernel. 311loading dump-capture kernel.
282 312
283For i386 and x86_64: 313For i386, x86_64 and ia64:
284 "init 1 irqpoll maxcpus=1" 314 "init 1 irqpoll maxcpus=1"
285 315
286For ppc64: 316For ppc64:
287 "init 1 maxcpus=1 noirqdistrib" 317 "init 1 maxcpus=1 noirqdistrib"
288 318
289For IA64
290 (To be filled)
291
292 319
293Notes on loading the dump-capture kernel: 320Notes on loading the dump-capture kernel:
294 321
diff --git a/Documentation/sysrq.txt b/Documentation/sysrq.txt
index e0188a23fd5e..61613166981b 100644
--- a/Documentation/sysrq.txt
+++ b/Documentation/sysrq.txt
@@ -1,6 +1,6 @@
1Linux Magic System Request Key Hacks 1Linux Magic System Request Key Hacks
2Documentation for sysrq.c version 1.15 2Documentation for sysrq.c
3Last update: $Date: 2001/01/28 10:15:59 $ 3Last update: 2007-JAN-06
4 4
5* What is the magic SysRq key? 5* What is the magic SysRq key?
6~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -35,7 +35,7 @@ You can set the value in the file by the following command:
35 35
36Note that the value of /proc/sys/kernel/sysrq influences only the invocation 36Note that the value of /proc/sys/kernel/sysrq influences only the invocation
37via a keyboard. Invocation of any operation via /proc/sysrq-trigger is always 37via a keyboard. Invocation of any operation via /proc/sysrq-trigger is always
38allowed. 38allowed (by a user with admin privileges).
39 39
40* How do I use the magic SysRq key? 40* How do I use the magic SysRq key?
41~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 41~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -58,7 +58,7 @@ On PowerPC - Press 'ALT - Print Screen (or F13) - <command key>,
58On other - If you know of the key combos for other architectures, please 58On other - If you know of the key combos for other architectures, please
59 let me know so I can add them to this section. 59 let me know so I can add them to this section.
60 60
61On all - write a character to /proc/sysrq-trigger. eg: 61On all - write a character to /proc/sysrq-trigger. e.g.:
62 62
63 echo t > /proc/sysrq-trigger 63 echo t > /proc/sysrq-trigger
64 64
@@ -74,6 +74,8 @@ On all - write a character to /proc/sysrq-trigger. eg:
74 74
75'c' - Will perform a kexec reboot in order to take a crashdump. 75'c' - Will perform a kexec reboot in order to take a crashdump.
76 76
77'd' - Shows all locks that are held.
78
77'o' - Will shut your system off (if configured and supported). 79'o' - Will shut your system off (if configured and supported).
78 80
79's' - Will attempt to sync all mounted filesystems. 81's' - Will attempt to sync all mounted filesystems.
@@ -87,38 +89,43 @@ On all - write a character to /proc/sysrq-trigger. eg:
87 89
88'm' - Will dump current memory info to your console. 90'm' - Will dump current memory info to your console.
89 91
92'n' - Used to make RT tasks nice-able
93
90'v' - Dumps Voyager SMP processor info to your console. 94'v' - Dumps Voyager SMP processor info to your console.
91 95
96'w' - Dumps tasks that are in uninterruptable (blocked) state.
97
98'x' - Used by xmon interface on ppc/powerpc platforms.
99
92'0'-'9' - Sets the console log level, controlling which kernel messages 100'0'-'9' - Sets the console log level, controlling which kernel messages
93 will be printed to your console. ('0', for example would make 101 will be printed to your console. ('0', for example would make
94 it so that only emergency messages like PANICs or OOPSes would 102 it so that only emergency messages like PANICs or OOPSes would
95 make it to your console.) 103 make it to your console.)
96 104
97'f' - Will call oom_kill to kill a memory hog process 105'f' - Will call oom_kill to kill a memory hog process.
98 106
99'e' - Send a SIGTERM to all processes, except for init. 107'e' - Send a SIGTERM to all processes, except for init.
100 108
101'i' - Send a SIGKILL to all processes, except for init. 109'g' - Used by kgdb on ppc platforms.
102 110
103'l' - Send a SIGKILL to all processes, INCLUDING init. (Your system 111'i' - Send a SIGKILL to all processes, except for init.
104 will be non-functional after this.)
105 112
106'h' - Will display help ( actually any other key than those listed 113'h' - Will display help (actually any other key than those listed
107 above will display help. but 'h' is easy to remember :-) 114 above will display help. but 'h' is easy to remember :-)
108 115
109* Okay, so what can I use them for? 116* Okay, so what can I use them for?
110~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 117~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
111Well, un'R'aw is very handy when your X server or a svgalib program crashes. 118Well, un'R'aw is very handy when your X server or a svgalib program crashes.
112 119
113sa'K' (Secure Access Key) is useful when you want to be sure there are no 120sa'K' (Secure Access Key) is useful when you want to be sure there is no
114trojan program is running at console and which could grab your password 121trojan program running at console which could grab your password
115when you would try to login. It will kill all programs on given console 122when you would try to login. It will kill all programs on given console,
116and thus letting you make sure that the login prompt you see is actually 123thus letting you make sure that the login prompt you see is actually
117the one from init, not some trojan program. 124the one from init, not some trojan program.
118IMPORTANT: In its true form it is not a true SAK like the one in a :IMPORTANT 125IMPORTANT: In its true form it is not a true SAK like the one in a :IMPORTANT
119IMPORTANT: c2 compliant system, and it should not be mistaken as :IMPORTANT 126IMPORTANT: c2 compliant system, and it should not be mistaken as :IMPORTANT
120IMPORTANT: such. :IMPORTANT 127IMPORTANT: such. :IMPORTANT
121 It seems other find it useful as (System Attention Key) which is 128 It seems others find it useful as (System Attention Key) which is
122useful when you want to exit a program that will not let you switch consoles. 129useful when you want to exit a program that will not let you switch consoles.
123(For example, X or a svgalib program.) 130(For example, X or a svgalib program.)
124 131
@@ -139,8 +146,8 @@ OK or Done message...)
139Again, the unmount (remount read-only) hasn't taken place until you see the 146Again, the unmount (remount read-only) hasn't taken place until you see the
140"OK" and "Done" message appear on the screen. 147"OK" and "Done" message appear on the screen.
141 148
142The loglevel'0'-'9' is useful when your console is being flooded with 149The loglevels '0'-'9' are useful when your console is being flooded with
143kernel messages you do not want to see. Setting '0' will prevent all but 150kernel messages you do not want to see. Selecting '0' will prevent all but
144the most urgent kernel messages from reaching your console. (They will 151the most urgent kernel messages from reaching your console. (They will
145still be logged if syslogd/klogd are alive, though.) 152still be logged if syslogd/klogd are alive, though.)
146 153
@@ -152,7 +159,7 @@ processes.
152~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 159~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
153That happens to me, also. I've found that tapping shift, alt, and control 160That happens to me, also. I've found that tapping shift, alt, and control
154on both sides of the keyboard, and hitting an invalid sysrq sequence again 161on both sides of the keyboard, and hitting an invalid sysrq sequence again
155will fix the problem. (ie, something like alt-sysrq-z). Switching to another 162will fix the problem. (i.e., something like alt-sysrq-z). Switching to another
156virtual console (ALT+Fn) and then back again should also help. 163virtual console (ALT+Fn) and then back again should also help.
157 164
158* I hit SysRq, but nothing seems to happen, what's wrong? 165* I hit SysRq, but nothing seems to happen, what's wrong?
@@ -174,11 +181,11 @@ handler function you will use, B) a help_msg string, that will print when SysRQ
174prints help, and C) an action_msg string, that will print right before your 181prints help, and C) an action_msg string, that will print right before your
175handler is called. Your handler must conform to the prototype in 'sysrq.h'. 182handler is called. Your handler must conform to the prototype in 'sysrq.h'.
176 183
177After the sysrq_key_op is created, you can call the macro 184After the sysrq_key_op is created, you can call the kernel function
178register_sysrq_key(int key, struct sysrq_key_op *op_p) that is defined in 185register_sysrq_key(int key, struct sysrq_key_op *op_p); this will
179sysrq.h, this will register the operation pointed to by 'op_p' at table 186register the operation pointed to by 'op_p' at table key 'key',
180key 'key', if that slot in the table is blank. At module unload time, you must 187if that slot in the table is blank. At module unload time, you must call
181call the macro unregister_sysrq_key(int key, struct sysrq_key_op *op_p), which 188the function unregister_sysrq_key(int key, struct sysrq_key_op *op_p), which
182will remove the key op pointed to by 'op_p' from the key 'key', if and only if 189will remove the key op pointed to by 'op_p' from the key 'key', if and only if
183it is currently registered in that slot. This is in case the slot has been 190it is currently registered in that slot. This is in case the slot has been
184overwritten since you registered it. 191overwritten since you registered it.
@@ -186,15 +193,12 @@ overwritten since you registered it.
186The Magic SysRQ system works by registering key operations against a key op 193The Magic SysRQ system works by registering key operations against a key op
187lookup table, which is defined in 'drivers/char/sysrq.c'. This key table has 194lookup table, which is defined in 'drivers/char/sysrq.c'. This key table has
188a number of operations registered into it at compile time, but is mutable, 195a number of operations registered into it at compile time, but is mutable,
189and 4 functions are exported for interface to it: __sysrq_lock_table, 196and 2 functions are exported for interface to it:
190__sysrq_unlock_table, __sysrq_get_key_op, and __sysrq_put_key_op. The 197 register_sysrq_key and unregister_sysrq_key.
191functions __sysrq_swap_key_ops and __sysrq_swap_key_ops_nolock are defined 198Of course, never ever leave an invalid pointer in the table. I.e., when
192in the header itself, and the REGISTER and UNREGISTER macros are built from 199your module that called register_sysrq_key() exits, it must call
193these. More complex (and dangerous!) manipulations of the table are possible 200unregister_sysrq_key() to clean up the sysrq key table entry that it used.
194using these functions, but you must be careful to always lock the table before 201Null pointers in the table are always safe. :)
195you read or write from it, and to unlock it again when you are done. (And of
196course, to never ever leave an invalid pointer in the table). Null pointers in
197the table are always safe :)
198 202
199If for some reason you feel the need to call the handle_sysrq function from 203If for some reason you feel the need to call the handle_sysrq function from
200within a function called by handle_sysrq, you must be aware that you are in 204within a function called by handle_sysrq, you must be aware that you are in
diff --git a/Documentation/usb/CREDITS b/Documentation/usb/CREDITS
index 01e7f857ef35..27a721635f92 100644
--- a/Documentation/usb/CREDITS
+++ b/Documentation/usb/CREDITS
@@ -21,7 +21,7 @@ difficult to maintain, add yourself with a patch if desired.
21 Bill Ryder <bryder@sgi.com> 21 Bill Ryder <bryder@sgi.com>
22 Thomas Sailer <sailer@ife.ee.ethz.ch> 22 Thomas Sailer <sailer@ife.ee.ethz.ch>
23 Gregory P. Smith <greg@electricrain.com> 23 Gregory P. Smith <greg@electricrain.com>
24 Linus Torvalds <torvalds@osdl.org> 24 Linus Torvalds <torvalds@linux-foundation.org>
25 Roman Weissgaerber <weissg@vienna.at> 25 Roman Weissgaerber <weissg@vienna.at>
26 <Kazuki.Yasumatsu@fujixerox.co.jp> 26 <Kazuki.Yasumatsu@fujixerox.co.jp>
27 27
diff --git a/MAINTAINERS b/MAINTAINERS
index b0e33617273d..0ad8803a0c75 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -598,8 +598,6 @@ W: http://linux-atm.sourceforge.net
598S: Maintained 598S: Maintained
599 599
600ATMEL MACB ETHERNET DRIVER 600ATMEL MACB ETHERNET DRIVER
601P: Atmel AVR32 Support Team
602M: avr32@atmel.com
603P: Haavard Skinnemoen 601P: Haavard Skinnemoen
604M: hskinnemoen@atmel.com 602M: hskinnemoen@atmel.com
605S: Supported 603S: Supported
@@ -620,8 +618,6 @@ T: git kernel.org:/pub/scm/linux/kernel/git/dwmw2/audit-2.6.git
620S: Maintained 618S: Maintained
621 619
622AVR32 ARCHITECTURE 620AVR32 ARCHITECTURE
623P: Atmel AVR32 Support Team
624M: avr32@atmel.com
625P: Haavard Skinnemoen 621P: Haavard Skinnemoen
626M: hskinnemoen@atmel.com 622M: hskinnemoen@atmel.com
627W: http://www.atmel.com/products/AVR32/ 623W: http://www.atmel.com/products/AVR32/
@@ -630,8 +626,6 @@ W: http://avrfreaks.net/
630S: Supported 626S: Supported
631 627
632AVR32/AT32AP MACHINE SUPPORT 628AVR32/AT32AP MACHINE SUPPORT
633P: Atmel AVR32 Support Team
634M: avr32@atmel.com
635P: Haavard Skinnemoen 629P: Haavard Skinnemoen
636M: hskinnemoen@atmel.com 630M: hskinnemoen@atmel.com
637S: Supported 631S: Supported
@@ -1137,9 +1131,9 @@ T: git kernel.org:/pub/scm/linux/kernel/git/airlied/drm-2.6.git
1137S: Maintained 1131S: Maintained
1138 1132
1139DSCC4 DRIVER 1133DSCC4 DRIVER
1140P: François Romieu 1134P: Francois Romieu
1141M: romieu@cogenit.fr 1135M: romieu@fr.zoreil.com
1142M: romieu@ensta.fr 1136L: netdev@vger.kernel.org
1143S: Maintained 1137S: Maintained
1144 1138
1145DVB SUBSYSTEM AND DRIVERS 1139DVB SUBSYSTEM AND DRIVERS
@@ -1254,7 +1248,7 @@ S: Maintained
1254 1248
1255ETHERNET BRIDGE 1249ETHERNET BRIDGE
1256P: Stephen Hemminger 1250P: Stephen Hemminger
1257M: shemminger@osdl.org 1251M: shemminger@linux-foundation.org
1258L: bridge@osdl.org 1252L: bridge@osdl.org
1259W: http://bridge.sourceforge.net/ 1253W: http://bridge.sourceforge.net/
1260S: Maintained 1254S: Maintained
@@ -1598,12 +1592,11 @@ M: ipslinux@adaptec.com
1598W: http://www.developer.ibm.com/welcome/netfinity/serveraid.html 1592W: http://www.developer.ibm.com/welcome/netfinity/serveraid.html
1599S: Supported 1593S: Supported
1600 1594
1601IDE DRIVER [GENERAL] 1595IDE SUBSYSTEM
1602P: Bartlomiej Zolnierkiewicz 1596P: Bartlomiej Zolnierkiewicz
1603M: B.Zolnierkiewicz@elka.pw.edu.pl 1597M: bzolnier@gmail.com
1604L: linux-kernel@vger.kernel.org
1605L: linux-ide@vger.kernel.org 1598L: linux-ide@vger.kernel.org
1606T: git kernel.org:/pub/scm/linux/kernel/git/bart/ide-2.6.git 1599T: quilt kernel.org/pub/linux/kernel/people/bart/pata-2.6/
1607S: Maintained 1600S: Maintained
1608 1601
1609IDE/ATAPI CDROM DRIVER 1602IDE/ATAPI CDROM DRIVER
@@ -1928,11 +1921,10 @@ S: Maintained
1928 1921
1929KERNEL NFSD 1922KERNEL NFSD
1930P: Neil Brown 1923P: Neil Brown
1931M: neilb@cse.unsw.edu.au 1924M: neilb@suse.de
1932L: nfs@lists.sourceforge.net 1925L: nfs@lists.sourceforge.net
1933W: http://nfs.sourceforge.net/ 1926W: http://nfs.sourceforge.net/
1934W: http://www.cse.unsw.edu.au/~neilb/patches/linux-devel/ 1927S: Supported
1935S: Maintained
1936 1928
1937KERNEL VIRTUAL MACHINE (KVM) 1929KERNEL VIRTUAL MACHINE (KVM)
1938P: Avi Kivity 1930P: Avi Kivity
@@ -2277,7 +2269,7 @@ S: Maintained
2277 2269
2278NETEM NETWORK EMULATOR 2270NETEM NETWORK EMULATOR
2279P: Stephen Hemminger 2271P: Stephen Hemminger
2280M: shemminger@osdl.org 2272M: shemminger@linux-foundation.org
2281L: netem@osdl.org 2273L: netem@osdl.org
2282S: Maintained 2274S: Maintained
2283 2275
@@ -2290,7 +2282,7 @@ P: Jozsef Kadlecsik
2290P: Patrick McHardy 2282P: Patrick McHardy
2291M: kaber@trash.net 2283M: kaber@trash.net
2292L: netfilter-devel@lists.netfilter.org 2284L: netfilter-devel@lists.netfilter.org
2293L: netfilter@lists.netfilter.org 2285L: netfilter@lists.netfilter.org (subscribers-only)
2294L: coreteam@netfilter.org 2286L: coreteam@netfilter.org
2295W: http://www.netfilter.org/ 2287W: http://www.netfilter.org/
2296W: http://www.iptables.org/ 2288W: http://www.iptables.org/
@@ -2993,9 +2985,9 @@ SOFTWARE RAID (Multiple Disks) SUPPORT
2993P: Ingo Molnar 2985P: Ingo Molnar
2994M: mingo@redhat.com 2986M: mingo@redhat.com
2995P: Neil Brown 2987P: Neil Brown
2996M: neilb@cse.unsw.edu.au 2988M: neilb@suse.de
2997L: linux-raid@vger.kernel.org 2989L: linux-raid@vger.kernel.org
2998S: Maintained 2990S: Supported
2999 2991
3000SOFTWARE SUSPEND: 2992SOFTWARE SUSPEND:
3001P: Pavel Machek 2993P: Pavel Machek
@@ -3081,7 +3073,7 @@ S: Maintained
3081 3073
3082SKGE, SKY2 10/100/1000 GIGABIT ETHERNET DRIVERS 3074SKGE, SKY2 10/100/1000 GIGABIT ETHERNET DRIVERS
3083P: Stephen Hemminger 3075P: Stephen Hemminger
3084M: shemminger@osdl.org 3076M: shemminger@linux-foundation.org
3085L: netdev@vger.kernel.org 3077L: netdev@vger.kernel.org
3086S: Maintained 3078S: Maintained
3087 3079
@@ -3575,6 +3567,12 @@ M: khali@linux-fr.org
3575L: i2c@lm-sensors.org 3567L: i2c@lm-sensors.org
3576S: Maintained 3568S: Maintained
3577 3569
3570VIA VELOCITY NETWORK DRIVER
3571P: Francois Romieu
3572M: romieu@fr.zoreil.com
3573L: netdev@vger.kernel.org
3574S: Maintained
3575
3578UCLINUX (AND M68KNOMMU) 3576UCLINUX (AND M68KNOMMU)
3579P: Greg Ungerer 3577P: Greg Ungerer
3580M: gerg@uclinux.org 3578M: gerg@uclinux.org
@@ -3595,6 +3593,12 @@ M: ysato@users.sourceforge.jp
3595W: http://uclinux-h8.sourceforge.jp/ 3593W: http://uclinux-h8.sourceforge.jp/
3596S: Supported 3594S: Supported
3597 3595
3596UFS FILESYSTEM
3597P: Evgeniy Dushistov
3598M: dushistov@mail.ru
3599L: linux-kernel@vger.kernel.org
3600S: Maintained
3601
3598USB DIAMOND RIO500 DRIVER 3602USB DIAMOND RIO500 DRIVER
3599P: Cesar Miquel 3603P: Cesar Miquel
3600M: miquel@df.uba.ar 3604M: miquel@df.uba.ar
diff --git a/Makefile b/Makefile
index 477f52e3c7f6..7e2750f4ca70 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
1VERSION = 2 1VERSION = 2
2PATCHLEVEL = 6 2PATCHLEVEL = 6
3SUBLEVEL = 20 3SUBLEVEL = 20
4EXTRAVERSION =-rc5 4EXTRAVERSION =
5NAME = Homicidal Dwarf Hamster 5NAME = Homicidal Dwarf Hamster
6 6
7# *DOCUMENTATION* 7# *DOCUMENTATION*
@@ -1116,15 +1116,15 @@ help:
1116 @echo ' cscope - Generate cscope index' 1116 @echo ' cscope - Generate cscope index'
1117 @echo ' kernelrelease - Output the release version string' 1117 @echo ' kernelrelease - Output the release version string'
1118 @echo ' kernelversion - Output the version stored in Makefile' 1118 @echo ' kernelversion - Output the version stored in Makefile'
1119 @if [ -r include/asm-$(ARCH)/Kbuild ]; then \ 1119 @if [ -r $(srctree)/include/asm-$(ARCH)/Kbuild ]; then \
1120 echo ' headers_install - Install sanitised kernel headers to INSTALL_HDR_PATH'; \ 1120 echo ' headers_install - Install sanitised kernel headers to INSTALL_HDR_PATH'; \
1121 echo ' (default: $(INSTALL_HDR_PATH))'; \
1121 fi 1122 fi
1122 @echo ' (default: $(INSTALL_HDR_PATH))'
1123 @echo '' 1123 @echo ''
1124 @echo 'Static analysers' 1124 @echo 'Static analysers'
1125 @echo ' checkstack - Generate a list of stack hogs' 1125 @echo ' checkstack - Generate a list of stack hogs'
1126 @echo ' namespacecheck - Name space analysis on compiled kernel' 1126 @echo ' namespacecheck - Name space analysis on compiled kernel'
1127 @if [ -r include/asm-$(ARCH)/Kbuild ]; then \ 1127 @if [ -r $(srctree)/include/asm-$(ARCH)/Kbuild ]; then \
1128 echo ' headers_check - Sanity check on exported headers'; \ 1128 echo ' headers_check - Sanity check on exported headers'; \
1129 fi 1129 fi
1130 @echo '' 1130 @echo ''
diff --git a/README b/README
index c05561523029..46a66c6e76df 100644
--- a/README
+++ b/README
@@ -278,8 +278,8 @@ IF SOMETHING GOES WRONG:
278 the file MAINTAINERS to see if there is a particular person associated 278 the file MAINTAINERS to see if there is a particular person associated
279 with the part of the kernel that you are having trouble with. If there 279 with the part of the kernel that you are having trouble with. If there
280 isn't anyone listed there, then the second best thing is to mail 280 isn't anyone listed there, then the second best thing is to mail
281 them to me (torvalds@osdl.org), and possibly to any other relevant 281 them to me (torvalds@linux-foundation.org), and possibly to any other
282 mailing-list or to the newsgroup. 282 relevant mailing-list or to the newsgroup.
283 283
284 - In all bug-reports, *please* tell what kernel you are talking about, 284 - In all bug-reports, *please* tell what kernel you are talking about,
285 how to duplicate the problem, and what your setup is (use your common 285 how to duplicate the problem, and what your setup is (use your common
diff --git a/arch/alpha/kernel/process.c b/arch/alpha/kernel/process.c
index 3370e6faeae0..c15186390693 100644
--- a/arch/alpha/kernel/process.c
+++ b/arch/alpha/kernel/process.c
@@ -47,6 +47,7 @@
47 * Power off function, if any 47 * Power off function, if any
48 */ 48 */
49void (*pm_power_off)(void) = machine_power_off; 49void (*pm_power_off)(void) = machine_power_off;
50EXPORT_SYMBOL(pm_power_off);
50 51
51void 52void
52cpu_idle(void) 53cpu_idle(void)
diff --git a/arch/arm/configs/at91sam9260ek_defconfig b/arch/arm/configs/at91sam9260ek_defconfig
index 79049206dfa5..46b0c734aeb9 100644
--- a/arch/arm/configs/at91sam9260ek_defconfig
+++ b/arch/arm/configs/at91sam9260ek_defconfig
@@ -923,7 +923,6 @@ CONFIG_FORCED_INLINING=y
923# CONFIG_HEADERS_CHECK is not set 923# CONFIG_HEADERS_CHECK is not set
924# CONFIG_RCU_TORTURE_TEST is not set 924# CONFIG_RCU_TORTURE_TEST is not set
925CONFIG_DEBUG_USER=y 925CONFIG_DEBUG_USER=y
926# CONFIG_DEBUG_WAITQ is not set
927# CONFIG_DEBUG_ERRORS is not set 926# CONFIG_DEBUG_ERRORS is not set
928CONFIG_DEBUG_LL=y 927CONFIG_DEBUG_LL=y
929# CONFIG_DEBUG_ICEDCC is not set 928# CONFIG_DEBUG_ICEDCC is not set
diff --git a/arch/arm/configs/at91sam9261ek_defconfig b/arch/arm/configs/at91sam9261ek_defconfig
index 784ad7c0186d..fcd8fa091e9d 100644
--- a/arch/arm/configs/at91sam9261ek_defconfig
+++ b/arch/arm/configs/at91sam9261ek_defconfig
@@ -1079,7 +1079,6 @@ CONFIG_FORCED_INLINING=y
1079# CONFIG_HEADERS_CHECK is not set 1079# CONFIG_HEADERS_CHECK is not set
1080# CONFIG_RCU_TORTURE_TEST is not set 1080# CONFIG_RCU_TORTURE_TEST is not set
1081CONFIG_DEBUG_USER=y 1081CONFIG_DEBUG_USER=y
1082# CONFIG_DEBUG_WAITQ is not set
1083# CONFIG_DEBUG_ERRORS is not set 1082# CONFIG_DEBUG_ERRORS is not set
1084CONFIG_DEBUG_LL=y 1083CONFIG_DEBUG_LL=y
1085# CONFIG_DEBUG_ICEDCC is not set 1084# CONFIG_DEBUG_ICEDCC is not set
diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S
index d994561816a1..cf495a3084b3 100644
--- a/arch/arm/kernel/head.S
+++ b/arch/arm/kernel/head.S
@@ -22,6 +22,10 @@
22#include <asm/thread_info.h> 22#include <asm/thread_info.h>
23#include <asm/system.h> 23#include <asm/system.h>
24 24
25#if (PHYS_OFFSET & 0x001fffff)
26#error "PHYS_OFFSET must be at an even 2MiB boundary!"
27#endif
28
25#define KERNEL_RAM_VADDR (PAGE_OFFSET + TEXT_OFFSET) 29#define KERNEL_RAM_VADDR (PAGE_OFFSET + TEXT_OFFSET)
26#define KERNEL_RAM_PADDR (PHYS_OFFSET + TEXT_OFFSET) 30#define KERNEL_RAM_PADDR (PHYS_OFFSET + TEXT_OFFSET)
27 31
@@ -251,7 +255,8 @@ __create_page_tables:
251 * Then map first 1MB of ram in case it contains our boot params. 255 * Then map first 1MB of ram in case it contains our boot params.
252 */ 256 */
253 add r0, r4, #PAGE_OFFSET >> 18 257 add r0, r4, #PAGE_OFFSET >> 18
254 orr r6, r7, #PHYS_OFFSET 258 orr r6, r7, #(PHYS_OFFSET & 0xff000000)
259 orr r6, r6, #(PHYS_OFFSET & 0x00e00000)
255 str r6, [r0] 260 str r6, [r0]
256 261
257#ifdef CONFIG_XIP_KERNEL 262#ifdef CONFIG_XIP_KERNEL
diff --git a/arch/arm/mach-at91rm9200/at91rm9200_devices.c b/arch/arm/mach-at91rm9200/at91rm9200_devices.c
index 4641b99db0ee..57fac7203fe4 100644
--- a/arch/arm/mach-at91rm9200/at91rm9200_devices.c
+++ b/arch/arm/mach-at91rm9200/at91rm9200_devices.c
@@ -272,7 +272,7 @@ void __init at91_add_device_cf(struct at91_cf_data *data)
272 at91_set_A_periph(AT91_PIN_PC12, 0); /* NCS6/CFCE2 */ 272 at91_set_A_periph(AT91_PIN_PC12, 0); /* NCS6/CFCE2 */
273 273
274 /* nWAIT is _not_ a default setting */ 274 /* nWAIT is _not_ a default setting */
275 at91_set_A_periph(AT91_PIN_PC6, 1); /* nWAIT */ 275 at91_set_A_periph(AT91_PIN_PC6, 1); /* nWAIT */
276 276
277 cf_data = *data; 277 cf_data = *data;
278 platform_device_register(&at91rm9200_cf_device); 278 platform_device_register(&at91rm9200_cf_device);
diff --git a/arch/arm/mach-at91rm9200/at91sam9260.c b/arch/arm/mach-at91rm9200/at91sam9260.c
index 203f073a53e6..b14871adc300 100644
--- a/arch/arm/mach-at91rm9200/at91sam9260.c
+++ b/arch/arm/mach-at91rm9200/at91sam9260.c
@@ -16,6 +16,7 @@
16#include <asm/mach/map.h> 16#include <asm/mach/map.h>
17#include <asm/arch/at91sam9260.h> 17#include <asm/arch/at91sam9260.h>
18#include <asm/arch/at91_pmc.h> 18#include <asm/arch/at91_pmc.h>
19#include <asm/arch/at91_rstc.h>
19 20
20#include "generic.h" 21#include "generic.h"
21#include "clock.h" 22#include "clock.h"
@@ -212,7 +213,7 @@ static struct at91_gpio_bank at91sam9260_gpio[] = {
212 213
213static void at91sam9260_reset(void) 214static void at91sam9260_reset(void)
214{ 215{
215#warning "Implement CPU reset" 216 at91_sys_write(AT91_RSTC_CR, (0xA5 << 24) | AT91_RSTC_PROCRST | AT91_RSTC_PERRST);
216} 217}
217 218
218 219
diff --git a/arch/arm/mach-at91rm9200/at91sam9261.c b/arch/arm/mach-at91rm9200/at91sam9261.c
index 5a82f35da2e9..d242bb885c6d 100644
--- a/arch/arm/mach-at91rm9200/at91sam9261.c
+++ b/arch/arm/mach-at91rm9200/at91sam9261.c
@@ -16,6 +16,7 @@
16#include <asm/mach/map.h> 16#include <asm/mach/map.h>
17#include <asm/arch/at91sam9261.h> 17#include <asm/arch/at91sam9261.h>
18#include <asm/arch/at91_pmc.h> 18#include <asm/arch/at91_pmc.h>
19#include <asm/arch/at91_rstc.h>
19 20
20#include "generic.h" 21#include "generic.h"
21#include "clock.h" 22#include "clock.h"
@@ -207,7 +208,7 @@ static struct at91_gpio_bank at91sam9261_gpio[] = {
207 208
208static void at91sam9261_reset(void) 209static void at91sam9261_reset(void)
209{ 210{
210#warning "Implement CPU reset" 211 at91_sys_write(AT91_RSTC_CR, (0xA5 << 24) | AT91_RSTC_PROCRST | AT91_RSTC_PERRST);
211} 212}
212 213
213 214
diff --git a/arch/arm/mach-at91rm9200/gpio.c b/arch/arm/mach-at91rm9200/gpio.c
index 3f188508c391..af22659c8a28 100644
--- a/arch/arm/mach-at91rm9200/gpio.c
+++ b/arch/arm/mach-at91rm9200/gpio.c
@@ -20,7 +20,6 @@
20#include <asm/io.h> 20#include <asm/io.h>
21#include <asm/hardware.h> 21#include <asm/hardware.h>
22#include <asm/arch/at91_pio.h> 22#include <asm/arch/at91_pio.h>
23#include <asm/arch/at91_pmc.h>
24#include <asm/arch/gpio.h> 23#include <asm/arch/gpio.h>
25 24
26#include "generic.h" 25#include "generic.h"
@@ -224,17 +223,17 @@ static u32 backups[MAX_GPIO_BANKS];
224static int gpio_irq_set_wake(unsigned pin, unsigned state) 223static int gpio_irq_set_wake(unsigned pin, unsigned state)
225{ 224{
226 unsigned mask = pin_to_mask(pin); 225 unsigned mask = pin_to_mask(pin);
226 unsigned bank = (pin - PIN_BASE) / 32;
227 227
228 pin -= PIN_BASE; 228 if (unlikely(bank >= MAX_GPIO_BANKS))
229 pin /= 32;
230
231 if (unlikely(pin >= MAX_GPIO_BANKS))
232 return -EINVAL; 229 return -EINVAL;
233 230
234 if (state) 231 if (state)
235 wakeups[pin] |= mask; 232 wakeups[bank] |= mask;
236 else 233 else
237 wakeups[pin] &= ~mask; 234 wakeups[bank] &= ~mask;
235
236 set_irq_wake(gpio[bank].id, state);
238 237
239 return 0; 238 return 0;
240} 239}
@@ -246,29 +245,15 @@ void at91_gpio_suspend(void)
246 for (i = 0; i < gpio_banks; i++) { 245 for (i = 0; i < gpio_banks; i++) {
247 u32 pio = gpio[i].offset; 246 u32 pio = gpio[i].offset;
248 247
249 /*
250 * Note: drivers should have disabled GPIO interrupts that
251 * aren't supposed to be wakeup sources.
252 * But that is not much good on ARM..... disable_irq() does
253 * not update the hardware immediately, so the hardware mask
254 * (IMR) has the wrong value (not current, too much is
255 * permitted).
256 *
257 * Our workaround is to disable all non-wakeup IRQs ...
258 * which is exactly what correct drivers asked for in the
259 * first place!
260 */
261 backups[i] = at91_sys_read(pio + PIO_IMR); 248 backups[i] = at91_sys_read(pio + PIO_IMR);
262 at91_sys_write(pio + PIO_IDR, backups[i]); 249 at91_sys_write(pio + PIO_IDR, backups[i]);
263 at91_sys_write(pio + PIO_IER, wakeups[i]); 250 at91_sys_write(pio + PIO_IER, wakeups[i]);
264 251
265 if (!wakeups[i]) { 252 if (!wakeups[i])
266 disable_irq_wake(gpio[i].id); 253 clk_disable(gpio[i].clock);
267 at91_sys_write(AT91_PMC_PCDR, 1 << gpio[i].id); 254 else {
268 } else {
269 enable_irq_wake(gpio[i].id);
270#ifdef CONFIG_PM_DEBUG 255#ifdef CONFIG_PM_DEBUG
271 printk(KERN_DEBUG "GPIO-%c may wake for %08x\n", "ABCD"[i], wakeups[i]); 256 printk(KERN_DEBUG "GPIO-%c may wake for %08x\n", 'A'+i, wakeups[i]);
272#endif 257#endif
273 } 258 }
274 } 259 }
@@ -281,9 +266,11 @@ void at91_gpio_resume(void)
281 for (i = 0; i < gpio_banks; i++) { 266 for (i = 0; i < gpio_banks; i++) {
282 u32 pio = gpio[i].offset; 267 u32 pio = gpio[i].offset;
283 268
269 if (!wakeups[i])
270 clk_enable(gpio[i].clock);
271
284 at91_sys_write(pio + PIO_IDR, wakeups[i]); 272 at91_sys_write(pio + PIO_IDR, wakeups[i]);
285 at91_sys_write(pio + PIO_IER, backups[i]); 273 at91_sys_write(pio + PIO_IER, backups[i]);
286 at91_sys_write(AT91_PMC_PCER, 1 << gpio[i].id);
287 } 274 }
288} 275}
289 276
diff --git a/arch/arm/mach-imx/cpufreq.c b/arch/arm/mach-imx/cpufreq.c
index ac5f99895660..4f66e90db74f 100644
--- a/arch/arm/mach-imx/cpufreq.c
+++ b/arch/arm/mach-imx/cpufreq.c
@@ -184,6 +184,17 @@ static int imx_set_target(struct cpufreq_policy *policy,
184 long sysclk; 184 long sysclk;
185 unsigned int bclk_div = 1; 185 unsigned int bclk_div = 1;
186 186
187 /*
188 * Some governors do not respects CPU and policy lower limits
189 * which leads to bad things (division by zero etc), ensure
190 * that such things do not happen.
191 */
192 if(target_freq < policy->cpuinfo.min_freq)
193 target_freq = policy->cpuinfo.min_freq;
194
195 if(target_freq < policy->min)
196 target_freq = policy->min;
197
187 freq = target_freq * 1000; 198 freq = target_freq * 1000;
188 199
189 pr_debug(KERN_DEBUG "imx: requested frequency %ld Hz, mpctl0 at boot 0x%08x\n", 200 pr_debug(KERN_DEBUG "imx: requested frequency %ld Hz, mpctl0 at boot 0x%08x\n",
@@ -258,7 +269,8 @@ static int __init imx_cpufreq_driver_init(struct cpufreq_policy *policy)
258 policy->governor = CPUFREQ_DEFAULT_GOVERNOR; 269 policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
259 policy->cpuinfo.min_freq = 8000; 270 policy->cpuinfo.min_freq = 8000;
260 policy->cpuinfo.max_freq = 200000; 271 policy->cpuinfo.max_freq = 200000;
261 policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL; 272 /* Manual states, that PLL stabilizes in two CLK32 periods */
273 policy->cpuinfo.transition_latency = 4 * 1000000000LL / CLK32;
262 return 0; 274 return 0;
263} 275}
264 276
diff --git a/arch/arm/mach-s3c2410/gpio.c b/arch/arm/mach-s3c2410/gpio.c
index ba346546150b..f6fb215bb48c 100644
--- a/arch/arm/mach-s3c2410/gpio.c
+++ b/arch/arm/mach-s3c2410/gpio.c
@@ -57,6 +57,7 @@ void s3c2410_gpio_cfgpin(unsigned int pin, unsigned int function)
57 case S3C2410_GPIO_SFN2: 57 case S3C2410_GPIO_SFN2:
58 case S3C2410_GPIO_SFN3: 58 case S3C2410_GPIO_SFN3:
59 if (pin < S3C2410_GPIO_BANKB) { 59 if (pin < S3C2410_GPIO_BANKB) {
60 function -= 1;
60 function &= 1; 61 function &= 1;
61 function <<= S3C2410_GPIO_OFFSET(pin); 62 function <<= S3C2410_GPIO_OFFSET(pin);
62 } else { 63 } else {
@@ -83,15 +84,18 @@ EXPORT_SYMBOL(s3c2410_gpio_cfgpin);
83unsigned int s3c2410_gpio_getcfg(unsigned int pin) 84unsigned int s3c2410_gpio_getcfg(unsigned int pin)
84{ 85{
85 void __iomem *base = S3C24XX_GPIO_BASE(pin); 86 void __iomem *base = S3C24XX_GPIO_BASE(pin);
86 unsigned long mask; 87 unsigned long val = __raw_readl(base);
87 88
88 if (pin < S3C2410_GPIO_BANKB) { 89 if (pin < S3C2410_GPIO_BANKB) {
89 mask = 1 << S3C2410_GPIO_OFFSET(pin); 90 val >>= S3C2410_GPIO_OFFSET(pin);
91 val &= 1;
92 val += 1;
90 } else { 93 } else {
91 mask = 3 << S3C2410_GPIO_OFFSET(pin)*2; 94 val >>= S3C2410_GPIO_OFFSET(pin)*2;
95 val &= 3;
92 } 96 }
93 97
94 return __raw_readl(base) & mask; 98 return val | S3C2410_GPIO_INPUT;
95} 99}
96 100
97EXPORT_SYMBOL(s3c2410_gpio_getcfg); 101EXPORT_SYMBOL(s3c2410_gpio_getcfg);
diff --git a/arch/arm/mach-s3c2410/pm.c b/arch/arm/mach-s3c2410/pm.c
index 00834097eb82..ebf294dd31da 100644
--- a/arch/arm/mach-s3c2410/pm.c
+++ b/arch/arm/mach-s3c2410/pm.c
@@ -451,15 +451,14 @@ static void s3c2410_pm_check_resume_pin(unsigned int pin, unsigned int irqoffs)
451 irqstate = s3c_irqwake_eintmask & (1L<<irqoffs); 451 irqstate = s3c_irqwake_eintmask & (1L<<irqoffs);
452 452
453 pinstate = s3c2410_gpio_getcfg(pin); 453 pinstate = s3c2410_gpio_getcfg(pin);
454 pinstate >>= S3C2410_GPIO_OFFSET(pin)*2;
455 454
456 if (!irqstate) { 455 if (!irqstate) {
457 if (pinstate == 0x02) 456 if (pinstate == S3C2410_GPIO_IRQ)
458 DBG("Leaving IRQ %d (pin %d) enabled\n", irq, pin); 457 DBG("Leaving IRQ %d (pin %d) enabled\n", irq, pin);
459 } else { 458 } else {
460 if (pinstate == 0x02) { 459 if (pinstate == S3C2410_GPIO_IRQ) {
461 DBG("Disabling IRQ %d (pin %d)\n", irq, pin); 460 DBG("Disabling IRQ %d (pin %d)\n", irq, pin);
462 s3c2410_gpio_cfgpin(pin, 0x00); 461 s3c2410_gpio_cfgpin(pin, S3C2410_GPIO_INPUT);
463 } 462 }
464 } 463 }
465} 464}
diff --git a/arch/arm/mach-s3c2410/s3c2412-dma.c b/arch/arm/mach-s3c2410/s3c2412-dma.c
index fe71a8fdb87c..138f726ac6bf 100644
--- a/arch/arm/mach-s3c2410/s3c2412-dma.c
+++ b/arch/arm/mach-s3c2410/s3c2412-dma.c
@@ -133,8 +133,8 @@ static struct s3c24xx_dma_map __initdata s3c2412_dma_mappings[] = {
133static void s3c2412_dma_select(struct s3c2410_dma_chan *chan, 133static void s3c2412_dma_select(struct s3c2410_dma_chan *chan,
134 struct s3c24xx_dma_map *map) 134 struct s3c24xx_dma_map *map)
135{ 135{
136 writel(chan->regs + S3C2412_DMA_DMAREQSEL, 136 writel(map->channels[0] | S3C2412_DMAREQSEL_HW,
137 map->channels[0] | S3C2412_DMAREQSEL_HW); 137 chan->regs + S3C2412_DMA_DMAREQSEL);
138} 138}
139 139
140static struct s3c24xx_dma_selection __initdata s3c2412_dma_sel = { 140static struct s3c24xx_dma_selection __initdata s3c2412_dma_sel = {
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index b5814b4b6f35..7760193e74cc 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -52,15 +52,18 @@ void show_mem(void)
52 printk("Free swap: %6ldkB\n", nr_swap_pages<<(PAGE_SHIFT-10)); 52 printk("Free swap: %6ldkB\n", nr_swap_pages<<(PAGE_SHIFT-10));
53 53
54 for_each_online_node(node) { 54 for_each_online_node(node) {
55 pg_data_t *n = NODE_DATA(node);
56 struct page *map = n->node_mem_map - n->node_start_pfn;
57
55 for_each_nodebank (i,mi,node) { 58 for_each_nodebank (i,mi,node) {
56 unsigned int pfn1, pfn2; 59 unsigned int pfn1, pfn2;
57 struct page *page, *end; 60 struct page *page, *end;
58 61
59 pfn1 = mi->bank[i].start >> PAGE_SHIFT; 62 pfn1 = __phys_to_pfn(mi->bank[i].start);
60 pfn2 = (mi->bank[i].size + mi->bank[i].start) >> PAGE_SHIFT; 63 pfn2 = __phys_to_pfn(mi->bank[i].size + mi->bank[i].start);
61 64
62 page = NODE_MEM_MAP(node) + pfn1; 65 page = map + pfn1;
63 end = NODE_MEM_MAP(node) + pfn2; 66 end = map + pfn2;
64 67
65 do { 68 do {
66 total++; 69 total++;
diff --git a/arch/arm/mm/ioremap.c b/arch/arm/mm/ioremap.c
index 251685fe73a8..0ac615c0f798 100644
--- a/arch/arm/mm/ioremap.c
+++ b/arch/arm/mm/ioremap.c
@@ -300,7 +300,8 @@ __ioremap_pfn(unsigned long pfn, unsigned long offset, size_t size,
300 addr = (unsigned long)area->addr; 300 addr = (unsigned long)area->addr;
301 301
302#ifndef CONFIG_SMP 302#ifndef CONFIG_SMP
303 if ((((cpu_architecture() >= CPU_ARCH_ARMv6) && (get_cr() & CR_XP)) || 303 if (DOMAIN_IO == 0 &&
304 (((cpu_architecture() >= CPU_ARCH_ARMv6) && (get_cr() & CR_XP)) ||
304 cpu_is_xsc3()) && 305 cpu_is_xsc3()) &&
305 !((__pfn_to_phys(pfn) | size | addr) & ~SUPERSECTION_MASK)) { 306 !((__pfn_to_phys(pfn) | size | addr) & ~SUPERSECTION_MASK)) {
306 area->flags |= VM_ARM_SECTION_MAPPING; 307 area->flags |= VM_ARM_SECTION_MAPPING;
diff --git a/arch/arm/mm/proc-xscale.S b/arch/arm/mm/proc-xscale.S
index 490e11b34231..d29fe927ee9e 100644
--- a/arch/arm/mm/proc-xscale.S
+++ b/arch/arm/mm/proc-xscale.S
@@ -708,7 +708,7 @@ __8032x_proc_info:
708 .type __8033x_proc_info,#object 708 .type __8033x_proc_info,#object
709__8033x_proc_info: 709__8033x_proc_info:
710 .long 0x69054010 710 .long 0x69054010
711 .long 0xffffff30 711 .long 0xfffffd30
712 .long PMD_TYPE_SECT | \ 712 .long PMD_TYPE_SECT | \
713 PMD_SECT_BUFFERABLE | \ 713 PMD_SECT_BUFFERABLE | \
714 PMD_SECT_CACHEABLE | \ 714 PMD_SECT_CACHEABLE | \
diff --git a/arch/arm/tools/mach-types b/arch/arm/tools/mach-types
index 8bcb838e5444..bd78058b7178 100644
--- a/arch/arm/tools/mach-types
+++ b/arch/arm/tools/mach-types
@@ -12,7 +12,7 @@
12# 12#
13# http://www.arm.linux.org.uk/developer/machines/?action=new 13# http://www.arm.linux.org.uk/developer/machines/?action=new
14# 14#
15# Last update: Thu Dec 7 17:19:20 2006 15# Last update: Tue Jan 16 16:52:56 2007
16# 16#
17# machine_is_xxx CONFIG_xxxx MACH_TYPE_xxx number 17# machine_is_xxx CONFIG_xxxx MACH_TYPE_xxx number
18# 18#
@@ -1219,3 +1219,26 @@ zevio_1020 MACH_ZEVIO_1020 ZEVIO_1020 1207
1219hitrack MACH_HITRACK HITRACK 1208 1219hitrack MACH_HITRACK HITRACK 1208
1220syme1 MACH_SYME1 SYME1 1209 1220syme1 MACH_SYME1 SYME1 1209
1221syhl1 MACH_SYHL1 SYHL1 1210 1221syhl1 MACH_SYHL1 SYHL1 1210
1222empca400 MACH_EMPCA400 EMPCA400 1211
1223em7210 MACH_EM7210 EM7210 1212
1224htchermes MACH_HTCHERMES HTCHERMES 1213
1225eti_c1 MACH_ETI_C1 ETI_C1 1214
1226mach_dep2410 MACH_MACH_DEP2410 MACH_DEP2410 1215
1227ac100 MACH_AC100 AC100 1216
1228sneetch MACH_SNEETCH SNEETCH 1217
1229studentmate MACH_STUDENTMATE STUDENTMATE 1218
1230zir2410 MACH_ZIR2410 ZIR2410 1219
1231zir2413 MACH_ZIR2413 ZIR2413 1220
1232dlonip3 MACH_DLONIP3 DLONIP3 1221
1233instream MACH_INSTREAM INSTREAM 1222
1234ambarella MACH_AMBARELLA AMBARELLA 1223
1235nevis MACH_NEVIS NEVIS 1224
1236htc_trinity MACH_HTC_TRINITY HTC_TRINITY 1225
1237ql202b MACH_QL202B QL202B 1226
1238vpac270 MACH_VPAC270 VPAC270 1227
1239rd129 MACH_RD129 RD129 1228
1240htcwizard MACH_HTCWIZARD HTCWIZARD 1229
1241xscale_treo680 MACH_XSCALE_TREO680 XSCALE_TREO680 1230
1242tecon_tmezon MACH_TECON_TMEZON TECON_TMEZON 1231
1243zylonite MACH_ZYLONITE ZYLONITE 1233
1244gene1270 MACH_GENE1270 GENE1270 1234
diff --git a/arch/arm/vfp/entry.S b/arch/arm/vfp/entry.S
index 7b595547c1c8..ca2a5ad19ea6 100644
--- a/arch/arm/vfp/entry.S
+++ b/arch/arm/vfp/entry.S
@@ -25,6 +25,7 @@
25do_vfp: 25do_vfp:
26 enable_irq 26 enable_irq
27 ldr r4, .LCvfp 27 ldr r4, .LCvfp
28 ldr r11, [r10, #TI_CPU] @ CPU number
28 add r10, r10, #TI_VFPSTATE @ r10 = workspace 29 add r10, r10, #TI_VFPSTATE @ r10 = workspace
29 ldr pc, [r4] @ call VFP entry point 30 ldr pc, [r4] @ call VFP entry point
30 31
diff --git a/arch/arm/vfp/vfp.h b/arch/arm/vfp/vfp.h
index f2797896e6d5..54a2ad6d9ca2 100644
--- a/arch/arm/vfp/vfp.h
+++ b/arch/arm/vfp/vfp.h
@@ -370,3 +370,7 @@ struct op {
370 u32 (* const fn)(int dd, int dn, int dm, u32 fpscr); 370 u32 (* const fn)(int dd, int dn, int dm, u32 fpscr);
371 u32 flags; 371 u32 flags;
372}; 372};
373
374#ifdef CONFIG_SMP
375extern void vfp_save_state(void *location, u32 fpexc);
376#endif
diff --git a/arch/arm/vfp/vfphw.S b/arch/arm/vfp/vfphw.S
index e51e6679c402..d4b7b229631d 100644
--- a/arch/arm/vfp/vfphw.S
+++ b/arch/arm/vfp/vfphw.S
@@ -65,6 +65,7 @@
65@ r2 = faulted PC+4 65@ r2 = faulted PC+4
66@ r9 = successful return 66@ r9 = successful return
67@ r10 = vfp_state union 67@ r10 = vfp_state union
68@ r11 = CPU number
68@ lr = failure return 69@ lr = failure return
69 70
70 .globl vfp_support_entry 71 .globl vfp_support_entry
@@ -79,7 +80,7 @@ vfp_support_entry:
79 DBGSTR1 "enable %x", r10 80 DBGSTR1 "enable %x", r10
80 ldr r3, last_VFP_context_address 81 ldr r3, last_VFP_context_address
81 orr r1, r1, #FPEXC_ENABLE @ user FPEXC has the enable bit set 82 orr r1, r1, #FPEXC_ENABLE @ user FPEXC has the enable bit set
82 ldr r4, [r3] @ last_VFP_context pointer 83 ldr r4, [r3, r11, lsl #2] @ last_VFP_context pointer
83 bic r5, r1, #FPEXC_EXCEPTION @ make sure exceptions are disabled 84 bic r5, r1, #FPEXC_EXCEPTION @ make sure exceptions are disabled
84 cmp r4, r10 85 cmp r4, r10
85 beq check_for_exception @ we are returning to the same 86 beq check_for_exception @ we are returning to the same
@@ -91,7 +92,9 @@ vfp_support_entry:
91 @ exceptions, so we can get at the 92 @ exceptions, so we can get at the
92 @ rest of it 93 @ rest of it
93 94
95#ifndef CONFIG_SMP
94 @ Save out the current registers to the old thread state 96 @ Save out the current registers to the old thread state
97 @ No need for SMP since this is not done lazily
95 98
96 DBGSTR1 "save old state %p", r4 99 DBGSTR1 "save old state %p", r4
97 cmp r4, #0 100 cmp r4, #0
@@ -105,10 +108,11 @@ vfp_support_entry:
105 stmia r4, {r1, r5, r6, r8} @ save FPEXC, FPSCR, FPINST, FPINST2 108 stmia r4, {r1, r5, r6, r8} @ save FPEXC, FPSCR, FPINST, FPINST2
106 @ and point r4 at the word at the 109 @ and point r4 at the word at the
107 @ start of the register dump 110 @ start of the register dump
111#endif
108 112
109no_old_VFP_process: 113no_old_VFP_process:
110 DBGSTR1 "load state %p", r10 114 DBGSTR1 "load state %p", r10
111 str r10, [r3] @ update the last_VFP_context pointer 115 str r10, [r3, r11, lsl #2] @ update the last_VFP_context pointer
112 @ Load the saved state back into the VFP 116 @ Load the saved state back into the VFP
113 VFPFLDMIA r10 @ reload the working registers while 117 VFPFLDMIA r10 @ reload the working registers while
114 @ FPEXC is in a safe state 118 @ FPEXC is in a safe state
@@ -162,6 +166,24 @@ process_exception:
162 @ required. If not, the user code will 166 @ required. If not, the user code will
163 @ retry the faulted instruction 167 @ retry the faulted instruction
164 168
169#ifdef CONFIG_SMP
170 .globl vfp_save_state
171 .type vfp_save_state, %function
172vfp_save_state:
173 @ Save the current VFP state
174 @ r0 - save location
175 @ r1 - FPEXC
176 DBGSTR1 "save VFP state %p", r0
177 VFPFMRX r2, FPSCR @ current status
178 VFPFMRX r3, FPINST @ FPINST (always there, rev0 onwards)
179 tst r1, #FPEXC_FPV2 @ is there an FPINST2 to read?
180 VFPFMRX r12, FPINST2, NE @ FPINST2 if needed - avoids reading
181 @ nonexistant reg on rev0
182 VFPFSTMIA r0 @ save the working registers
183 stmia r0, {r1, r2, r3, r12} @ save FPEXC, FPSCR, FPINST, FPINST2
184 mov pc, lr
185#endif
186
165last_VFP_context_address: 187last_VFP_context_address:
166 .word last_VFP_context 188 .word last_VFP_context
167 189
diff --git a/arch/arm/vfp/vfpmodule.c b/arch/arm/vfp/vfpmodule.c
index 490d9d18a7d1..f1e5951dc721 100644
--- a/arch/arm/vfp/vfpmodule.c
+++ b/arch/arm/vfp/vfpmodule.c
@@ -28,7 +28,7 @@ void vfp_testing_entry(void);
28void vfp_support_entry(void); 28void vfp_support_entry(void);
29 29
30void (*vfp_vector)(void) = vfp_testing_entry; 30void (*vfp_vector)(void) = vfp_testing_entry;
31union vfp_state *last_VFP_context; 31union vfp_state *last_VFP_context[NR_CPUS];
32 32
33/* 33/*
34 * Dual-use variable. 34 * Dual-use variable.
@@ -41,13 +41,35 @@ static int vfp_notifier(struct notifier_block *self, unsigned long cmd, void *v)
41{ 41{
42 struct thread_info *thread = v; 42 struct thread_info *thread = v;
43 union vfp_state *vfp; 43 union vfp_state *vfp;
44 __u32 cpu = thread->cpu;
44 45
45 if (likely(cmd == THREAD_NOTIFY_SWITCH)) { 46 if (likely(cmd == THREAD_NOTIFY_SWITCH)) {
47 u32 fpexc = fmrx(FPEXC);
48
49#ifdef CONFIG_SMP
50 /*
51 * On SMP, if VFP is enabled, save the old state in
52 * case the thread migrates to a different CPU. The
53 * restoring is done lazily.
54 */
55 if ((fpexc & FPEXC_ENABLE) && last_VFP_context[cpu]) {
56 vfp_save_state(last_VFP_context[cpu], fpexc);
57 last_VFP_context[cpu]->hard.cpu = cpu;
58 }
59 /*
60 * Thread migration, just force the reloading of the
61 * state on the new CPU in case the VFP registers
62 * contain stale data.
63 */
64 if (thread->vfpstate.hard.cpu != cpu)
65 last_VFP_context[cpu] = NULL;
66#endif
67
46 /* 68 /*
47 * Always disable VFP so we can lazily save/restore the 69 * Always disable VFP so we can lazily save/restore the
48 * old state. 70 * old state.
49 */ 71 */
50 fmxr(FPEXC, fmrx(FPEXC) & ~FPEXC_ENABLE); 72 fmxr(FPEXC, fpexc & ~FPEXC_ENABLE);
51 return NOTIFY_DONE; 73 return NOTIFY_DONE;
52 } 74 }
53 75
@@ -68,8 +90,8 @@ static int vfp_notifier(struct notifier_block *self, unsigned long cmd, void *v)
68 } 90 }
69 91
70 /* flush and release case: Per-thread VFP cleanup. */ 92 /* flush and release case: Per-thread VFP cleanup. */
71 if (last_VFP_context == vfp) 93 if (last_VFP_context[cpu] == vfp)
72 last_VFP_context = NULL; 94 last_VFP_context[cpu] = NULL;
73 95
74 return NOTIFY_DONE; 96 return NOTIFY_DONE;
75} 97}
diff --git a/arch/avr32/configs/atstk1002_defconfig b/arch/avr32/configs/atstk1002_defconfig
index ae92a14ef9a0..77dace9d54bc 100644
--- a/arch/avr32/configs/atstk1002_defconfig
+++ b/arch/avr32/configs/atstk1002_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.19-rc2 3# Linux kernel version: 2.6.20-rc6
4# Fri Oct 20 11:52:37 2006 4# Fri Jan 26 13:12:59 2007
5# 5#
6CONFIG_AVR32=y 6CONFIG_AVR32=y
7CONFIG_GENERIC_HARDIRQS=y 7CONFIG_GENERIC_HARDIRQS=y
@@ -9,6 +9,8 @@ CONFIG_HARDIRQS_SW_RESEND=y
9CONFIG_GENERIC_IRQ_PROBE=y 9CONFIG_GENERIC_IRQ_PROBE=y
10CONFIG_RWSEM_GENERIC_SPINLOCK=y 10CONFIG_RWSEM_GENERIC_SPINLOCK=y
11CONFIG_GENERIC_TIME=y 11CONFIG_GENERIC_TIME=y
12# CONFIG_ARCH_HAS_ILOG2_U32 is not set
13# CONFIG_ARCH_HAS_ILOG2_U64 is not set
12CONFIG_GENERIC_HWEIGHT=y 14CONFIG_GENERIC_HWEIGHT=y
13CONFIG_GENERIC_CALIBRATE_DELAY=y 15CONFIG_GENERIC_CALIBRATE_DELAY=y
14CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 16CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
@@ -36,6 +38,7 @@ CONFIG_TASK_DELAY_ACCT=y
36# CONFIG_UTS_NS is not set 38# CONFIG_UTS_NS is not set
37CONFIG_AUDIT=y 39CONFIG_AUDIT=y
38# CONFIG_IKCONFIG is not set 40# CONFIG_IKCONFIG is not set
41CONFIG_SYSFS_DEPRECATED=y
39CONFIG_RELAY=y 42CONFIG_RELAY=y
40CONFIG_INITRAMFS_SOURCE="" 43CONFIG_INITRAMFS_SOURCE=""
41CONFIG_CC_OPTIMIZE_FOR_SIZE=y 44CONFIG_CC_OPTIMIZE_FOR_SIZE=y
@@ -75,7 +78,9 @@ CONFIG_MODULE_UNLOAD=y
75# Block layer 78# Block layer
76# 79#
77CONFIG_BLOCK=y 80CONFIG_BLOCK=y
81# CONFIG_LBD is not set
78# CONFIG_BLK_DEV_IO_TRACE is not set 82# CONFIG_BLK_DEV_IO_TRACE is not set
83# CONFIG_LSF is not set
79 84
80# 85#
81# IO Schedulers 86# IO Schedulers
@@ -125,6 +130,7 @@ CONFIG_SPLIT_PTLOCK_CPUS=4
125# CONFIG_OWNERSHIP_TRACE is not set 130# CONFIG_OWNERSHIP_TRACE is not set
126# CONFIG_HZ_100 is not set 131# CONFIG_HZ_100 is not set
127CONFIG_HZ_250=y 132CONFIG_HZ_250=y
133# CONFIG_HZ_300 is not set
128# CONFIG_HZ_1000 is not set 134# CONFIG_HZ_1000 is not set
129CONFIG_HZ=250 135CONFIG_HZ=250
130CONFIG_CMDLINE="" 136CONFIG_CMDLINE=""
@@ -182,6 +188,7 @@ CONFIG_INET_TCP_DIAG=y
182# CONFIG_TCP_CONG_ADVANCED is not set 188# CONFIG_TCP_CONG_ADVANCED is not set
183CONFIG_TCP_CONG_CUBIC=y 189CONFIG_TCP_CONG_CUBIC=y
184CONFIG_DEFAULT_TCP_CONG="cubic" 190CONFIG_DEFAULT_TCP_CONG="cubic"
191# CONFIG_TCP_MD5SIG is not set
185# CONFIG_IPV6 is not set 192# CONFIG_IPV6 is not set
186# CONFIG_INET6_XFRM_TUNNEL is not set 193# CONFIG_INET6_XFRM_TUNNEL is not set
187# CONFIG_INET6_TUNNEL is not set 194# CONFIG_INET6_TUNNEL is not set
@@ -260,6 +267,7 @@ CONFIG_MTD_CMDLINE_PARTS=y
260# User Modules And Translation Layers 267# User Modules And Translation Layers
261# 268#
262CONFIG_MTD_CHAR=y 269CONFIG_MTD_CHAR=y
270CONFIG_MTD_BLKDEVS=y
263CONFIG_MTD_BLOCK=y 271CONFIG_MTD_BLOCK=y
264# CONFIG_FTL is not set 272# CONFIG_FTL is not set
265# CONFIG_NFTL is not set 273# CONFIG_NFTL is not set
@@ -355,7 +363,6 @@ CONFIG_BLK_DEV_INITRD=y
355# 363#
356# Misc devices 364# Misc devices
357# 365#
358# CONFIG_SGI_IOC4 is not set
359# CONFIG_TIFM_CORE is not set 366# CONFIG_TIFM_CORE is not set
360 367
361# 368#
@@ -405,11 +412,14 @@ CONFIG_TUN=m
405# 412#
406# PHY device support 413# PHY device support
407# 414#
415# CONFIG_PHYLIB is not set
408 416
409# 417#
410# Ethernet (10 or 100Mbit) 418# Ethernet (10 or 100Mbit)
411# 419#
412# CONFIG_NET_ETHERNET is not set 420CONFIG_NET_ETHERNET=y
421CONFIG_MII=y
422CONFIG_MACB=y
413 423
414# 424#
415# Ethernet (1000 Mbit) 425# Ethernet (1000 Mbit)
@@ -505,10 +515,6 @@ CONFIG_UNIX98_PTYS=y
505# CONFIG_GEN_RTC is not set 515# CONFIG_GEN_RTC is not set
506# CONFIG_DTLK is not set 516# CONFIG_DTLK is not set
507# CONFIG_R3964 is not set 517# CONFIG_R3964 is not set
508
509#
510# Ftape, the floppy tape device driver
511#
512# CONFIG_RAW_DRIVER is not set 518# CONFIG_RAW_DRIVER is not set
513 519
514# 520#
@@ -621,6 +627,10 @@ CONFIG_UNIX98_PTYS=y
621# 627#
622 628
623# 629#
630# Virtualization
631#
632
633#
624# File systems 634# File systems
625# 635#
626CONFIG_EXT2_FS=m 636CONFIG_EXT2_FS=m
@@ -683,7 +693,6 @@ CONFIG_CONFIGFS_FS=m
683# CONFIG_BEFS_FS is not set 693# CONFIG_BEFS_FS is not set
684# CONFIG_BFS_FS is not set 694# CONFIG_BFS_FS is not set
685# CONFIG_EFS_FS is not set 695# CONFIG_EFS_FS is not set
686# CONFIG_JFFS_FS is not set
687CONFIG_JFFS2_FS=y 696CONFIG_JFFS2_FS=y
688CONFIG_JFFS2_FS_DEBUG=0 697CONFIG_JFFS2_FS_DEBUG=0
689CONFIG_JFFS2_FS_WRITEBUFFER=y 698CONFIG_JFFS2_FS_WRITEBUFFER=y
@@ -763,6 +772,11 @@ CONFIG_NLS_ISO8859_1=m
763CONFIG_NLS_UTF8=m 772CONFIG_NLS_UTF8=m
764 773
765# 774#
775# Distributed Lock Manager
776#
777# CONFIG_DLM is not set
778
779#
766# Kernel hacking 780# Kernel hacking
767# 781#
768CONFIG_TRACE_IRQFLAGS_SUPPORT=y 782CONFIG_TRACE_IRQFLAGS_SUPPORT=y
@@ -770,6 +784,8 @@ CONFIG_TRACE_IRQFLAGS_SUPPORT=y
770CONFIG_ENABLE_MUST_CHECK=y 784CONFIG_ENABLE_MUST_CHECK=y
771CONFIG_MAGIC_SYSRQ=y 785CONFIG_MAGIC_SYSRQ=y
772# CONFIG_UNUSED_SYMBOLS is not set 786# CONFIG_UNUSED_SYMBOLS is not set
787CONFIG_DEBUG_FS=y
788# CONFIG_HEADERS_CHECK is not set
773CONFIG_DEBUG_KERNEL=y 789CONFIG_DEBUG_KERNEL=y
774CONFIG_LOG_BUF_SHIFT=14 790CONFIG_LOG_BUF_SHIFT=14
775CONFIG_DETECT_SOFTLOCKUP=y 791CONFIG_DETECT_SOFTLOCKUP=y
@@ -785,13 +801,10 @@ CONFIG_DETECT_SOFTLOCKUP=y
785# CONFIG_DEBUG_KOBJECT is not set 801# CONFIG_DEBUG_KOBJECT is not set
786CONFIG_DEBUG_BUGVERBOSE=y 802CONFIG_DEBUG_BUGVERBOSE=y
787# CONFIG_DEBUG_INFO is not set 803# CONFIG_DEBUG_INFO is not set
788CONFIG_DEBUG_FS=y
789# CONFIG_DEBUG_VM is not set 804# CONFIG_DEBUG_VM is not set
790# CONFIG_DEBUG_LIST is not set 805# CONFIG_DEBUG_LIST is not set
791CONFIG_FRAME_POINTER=y 806CONFIG_FRAME_POINTER=y
792# CONFIG_UNWIND_INFO is not set
793CONFIG_FORCED_INLINING=y 807CONFIG_FORCED_INLINING=y
794# CONFIG_HEADERS_CHECK is not set
795# CONFIG_RCU_TORTURE_TEST is not set 808# CONFIG_RCU_TORTURE_TEST is not set
796# CONFIG_KPROBES is not set 809# CONFIG_KPROBES is not set
797 810
@@ -809,6 +822,7 @@ CONFIG_FORCED_INLINING=y
809# 822#
810# Library routines 823# Library routines
811# 824#
825CONFIG_BITREVERSE=y
812CONFIG_CRC_CCITT=m 826CONFIG_CRC_CCITT=m
813# CONFIG_CRC16 is not set 827# CONFIG_CRC16 is not set
814CONFIG_CRC32=y 828CONFIG_CRC32=y
@@ -817,3 +831,4 @@ CONFIG_AUDIT_GENERIC=y
817CONFIG_ZLIB_INFLATE=y 831CONFIG_ZLIB_INFLATE=y
818CONFIG_ZLIB_DEFLATE=y 832CONFIG_ZLIB_DEFLATE=y
819CONFIG_PLIST=y 833CONFIG_PLIST=y
834CONFIG_IOMAP_COPY=y
diff --git a/arch/avr32/kernel/avr32_ksyms.c b/arch/avr32/kernel/avr32_ksyms.c
index 7c4c76114bba..80f55f8dbf1c 100644
--- a/arch/avr32/kernel/avr32_ksyms.c
+++ b/arch/avr32/kernel/avr32_ksyms.c
@@ -29,6 +29,7 @@ EXPORT_SYMBOL(__avr32_asr64);
29 */ 29 */
30EXPORT_SYMBOL(memset); 30EXPORT_SYMBOL(memset);
31EXPORT_SYMBOL(memcpy); 31EXPORT_SYMBOL(memcpy);
32EXPORT_SYMBOL(clear_page);
32 33
33/* 34/*
34 * Userspace access stuff. 35 * Userspace access stuff.
diff --git a/arch/i386/boot/compressed/relocs.c b/arch/i386/boot/compressed/relocs.c
index 468da89153c4..881951ca03e1 100644
--- a/arch/i386/boot/compressed/relocs.c
+++ b/arch/i386/boot/compressed/relocs.c
@@ -43,6 +43,8 @@ static int is_safe_abs_reloc(const char* sym_name)
43 /* Match found */ 43 /* Match found */
44 return 1; 44 return 1;
45 } 45 }
46 if (strncmp(sym_name, "__crc_", 6) == 0)
47 return 1;
46 return 0; 48 return 0;
47} 49}
48 50
diff --git a/arch/i386/kernel/cpu/cpufreq/p4-clockmod.c b/arch/i386/kernel/cpu/cpufreq/p4-clockmod.c
index bec50170b75a..4786fedca6eb 100644
--- a/arch/i386/kernel/cpu/cpufreq/p4-clockmod.c
+++ b/arch/i386/kernel/cpu/cpufreq/p4-clockmod.c
@@ -51,7 +51,6 @@ enum {
51 51
52 52
53static int has_N44_O17_errata[NR_CPUS]; 53static int has_N44_O17_errata[NR_CPUS];
54static int has_N60_errata[NR_CPUS];
55static unsigned int stock_freq; 54static unsigned int stock_freq;
56static struct cpufreq_driver p4clockmod_driver; 55static struct cpufreq_driver p4clockmod_driver;
57static unsigned int cpufreq_p4_get(unsigned int cpu); 56static unsigned int cpufreq_p4_get(unsigned int cpu);
@@ -224,12 +223,6 @@ static int cpufreq_p4_cpu_init(struct cpufreq_policy *policy)
224 case 0x0f12: 223 case 0x0f12:
225 has_N44_O17_errata[policy->cpu] = 1; 224 has_N44_O17_errata[policy->cpu] = 1;
226 dprintk("has errata -- disabling low frequencies\n"); 225 dprintk("has errata -- disabling low frequencies\n");
227 break;
228
229 case 0x0f29:
230 has_N60_errata[policy->cpu] = 1;
231 dprintk("has errata -- disabling frequencies lower than 2ghz\n");
232 break;
233 } 226 }
234 227
235 /* get max frequency */ 228 /* get max frequency */
@@ -241,8 +234,6 @@ static int cpufreq_p4_cpu_init(struct cpufreq_policy *policy)
241 for (i=1; (p4clockmod_table[i].frequency != CPUFREQ_TABLE_END); i++) { 234 for (i=1; (p4clockmod_table[i].frequency != CPUFREQ_TABLE_END); i++) {
242 if ((i<2) && (has_N44_O17_errata[policy->cpu])) 235 if ((i<2) && (has_N44_O17_errata[policy->cpu]))
243 p4clockmod_table[i].frequency = CPUFREQ_ENTRY_INVALID; 236 p4clockmod_table[i].frequency = CPUFREQ_ENTRY_INVALID;
244 else if (has_N60_errata[policy->cpu] && ((stock_freq * i)/8) < 2000000)
245 p4clockmod_table[i].frequency = CPUFREQ_ENTRY_INVALID;
246 else 237 else
247 p4clockmod_table[i].frequency = (stock_freq * i)/8; 238 p4clockmod_table[i].frequency = (stock_freq * i)/8;
248 } 239 }
diff --git a/arch/i386/kernel/cpu/cyrix.c b/arch/i386/kernel/cpu/cyrix.c
index abcff92f994c..c0c3b59de32c 100644
--- a/arch/i386/kernel/cpu/cyrix.c
+++ b/arch/i386/kernel/cpu/cyrix.c
@@ -173,7 +173,7 @@ static void __cpuinit geode_configure(void)
173 ccr4 = getCx86(CX86_CCR4); 173 ccr4 = getCx86(CX86_CCR4);
174 ccr4 |= 0x38; /* FPU fast, DTE cache, Mem bypass */ 174 ccr4 |= 0x38; /* FPU fast, DTE cache, Mem bypass */
175 175
176 setCx86(CX86_CCR4, ccr4); 176 setCx86(CX86_CCR3, ccr3);
177 177
178 set_cx86_memwb(); 178 set_cx86_memwb();
179 set_cx86_reorder(); 179 set_cx86_reorder();
diff --git a/arch/i386/kernel/efi.c b/arch/i386/kernel/efi.c
index b92c7f0a358a..8f9c624ace6f 100644
--- a/arch/i386/kernel/efi.c
+++ b/arch/i386/kernel/efi.c
@@ -473,6 +473,70 @@ static inline void __init check_range_for_systab(efi_memory_desc_t *md)
473} 473}
474 474
475/* 475/*
476 * Wrap all the virtual calls in a way that forces the parameters on the stack.
477 */
478
479#define efi_call_virt(f, args...) \
480 ((efi_##f##_t __attribute__((regparm(0)))*)efi.systab->runtime->f)(args)
481
482static efi_status_t virt_efi_get_time(efi_time_t *tm, efi_time_cap_t *tc)
483{
484 return efi_call_virt(get_time, tm, tc);
485}
486
487static efi_status_t virt_efi_set_time (efi_time_t *tm)
488{
489 return efi_call_virt(set_time, tm);
490}
491
492static efi_status_t virt_efi_get_wakeup_time (efi_bool_t *enabled,
493 efi_bool_t *pending,
494 efi_time_t *tm)
495{
496 return efi_call_virt(get_wakeup_time, enabled, pending, tm);
497}
498
499static efi_status_t virt_efi_set_wakeup_time (efi_bool_t enabled,
500 efi_time_t *tm)
501{
502 return efi_call_virt(set_wakeup_time, enabled, tm);
503}
504
505static efi_status_t virt_efi_get_variable (efi_char16_t *name,
506 efi_guid_t *vendor, u32 *attr,
507 unsigned long *data_size, void *data)
508{
509 return efi_call_virt(get_variable, name, vendor, attr, data_size, data);
510}
511
512static efi_status_t virt_efi_get_next_variable (unsigned long *name_size,
513 efi_char16_t *name,
514 efi_guid_t *vendor)
515{
516 return efi_call_virt(get_next_variable, name_size, name, vendor);
517}
518
519static efi_status_t virt_efi_set_variable (efi_char16_t *name,
520 efi_guid_t *vendor,
521 unsigned long attr,
522 unsigned long data_size, void *data)
523{
524 return efi_call_virt(set_variable, name, vendor, attr, data_size, data);
525}
526
527static efi_status_t virt_efi_get_next_high_mono_count (u32 *count)
528{
529 return efi_call_virt(get_next_high_mono_count, count);
530}
531
532static void virt_efi_reset_system (int reset_type, efi_status_t status,
533 unsigned long data_size,
534 efi_char16_t *data)
535{
536 efi_call_virt(reset_system, reset_type, status, data_size, data);
537}
538
539/*
476 * This function will switch the EFI runtime services to virtual mode. 540 * This function will switch the EFI runtime services to virtual mode.
477 * Essentially, look through the EFI memmap and map every region that 541 * Essentially, look through the EFI memmap and map every region that
478 * has the runtime attribute bit set in its memory descriptor and update 542 * has the runtime attribute bit set in its memory descriptor and update
@@ -525,22 +589,15 @@ void __init efi_enter_virtual_mode(void)
525 * pointers in the runtime service table to the new virtual addresses. 589 * pointers in the runtime service table to the new virtual addresses.
526 */ 590 */
527 591
528 efi.get_time = (efi_get_time_t *) efi.systab->runtime->get_time; 592 efi.get_time = virt_efi_get_time;
529 efi.set_time = (efi_set_time_t *) efi.systab->runtime->set_time; 593 efi.set_time = virt_efi_set_time;
530 efi.get_wakeup_time = (efi_get_wakeup_time_t *) 594 efi.get_wakeup_time = virt_efi_get_wakeup_time;
531 efi.systab->runtime->get_wakeup_time; 595 efi.set_wakeup_time = virt_efi_set_wakeup_time;
532 efi.set_wakeup_time = (efi_set_wakeup_time_t *) 596 efi.get_variable = virt_efi_get_variable;
533 efi.systab->runtime->set_wakeup_time; 597 efi.get_next_variable = virt_efi_get_next_variable;
534 efi.get_variable = (efi_get_variable_t *) 598 efi.set_variable = virt_efi_set_variable;
535 efi.systab->runtime->get_variable; 599 efi.get_next_high_mono_count = virt_efi_get_next_high_mono_count;
536 efi.get_next_variable = (efi_get_next_variable_t *) 600 efi.reset_system = virt_efi_reset_system;
537 efi.systab->runtime->get_next_variable;
538 efi.set_variable = (efi_set_variable_t *)
539 efi.systab->runtime->set_variable;
540 efi.get_next_high_mono_count = (efi_get_next_high_mono_count_t *)
541 efi.systab->runtime->get_next_high_mono_count;
542 efi.reset_system = (efi_reset_system_t *)
543 efi.systab->runtime->reset_system;
544} 601}
545 602
546void __init 603void __init
diff --git a/arch/i386/kernel/entry.S b/arch/i386/kernel/entry.S
index 06461b8b715d..5e47683fc63a 100644
--- a/arch/i386/kernel/entry.S
+++ b/arch/i386/kernel/entry.S
@@ -302,12 +302,16 @@ sysenter_past_esp:
302 pushl $(__USER_CS) 302 pushl $(__USER_CS)
303 CFI_ADJUST_CFA_OFFSET 4 303 CFI_ADJUST_CFA_OFFSET 4
304 /*CFI_REL_OFFSET cs, 0*/ 304 /*CFI_REL_OFFSET cs, 0*/
305#ifndef CONFIG_COMPAT_VDSO
305 /* 306 /*
306 * Push current_thread_info()->sysenter_return to the stack. 307 * Push current_thread_info()->sysenter_return to the stack.
307 * A tiny bit of offset fixup is necessary - 4*4 means the 4 words 308 * A tiny bit of offset fixup is necessary - 4*4 means the 4 words
308 * pushed above; +8 corresponds to copy_thread's esp0 setting. 309 * pushed above; +8 corresponds to copy_thread's esp0 setting.
309 */ 310 */
310 pushl (TI_sysenter_return-THREAD_SIZE+8+4*4)(%esp) 311 pushl (TI_sysenter_return-THREAD_SIZE+8+4*4)(%esp)
312#else
313 pushl $SYSENTER_RETURN
314#endif
311 CFI_ADJUST_CFA_OFFSET 4 315 CFI_ADJUST_CFA_OFFSET 4
312 CFI_REL_OFFSET eip, 0 316 CFI_REL_OFFSET eip, 0
313 317
diff --git a/arch/i386/kernel/io_apic.c b/arch/i386/kernel/io_apic.c
index 2424cc9c7b3d..6a3875f81a0a 100644
--- a/arch/i386/kernel/io_apic.c
+++ b/arch/i386/kernel/io_apic.c
@@ -1227,26 +1227,32 @@ static u8 irq_vector[NR_IRQ_VECTORS] __read_mostly = { FIRST_DEVICE_VECTOR , 0 }
1227 1227
1228static int __assign_irq_vector(int irq) 1228static int __assign_irq_vector(int irq)
1229{ 1229{
1230 static int current_vector = FIRST_DEVICE_VECTOR, offset = 0; 1230 static int current_vector = FIRST_DEVICE_VECTOR, current_offset = 0;
1231 int vector; 1231 int vector, offset, i;
1232 1232
1233 BUG_ON((unsigned)irq >= NR_IRQ_VECTORS); 1233 BUG_ON((unsigned)irq >= NR_IRQ_VECTORS);
1234 1234
1235 if (irq_vector[irq] > 0) 1235 if (irq_vector[irq] > 0)
1236 return irq_vector[irq]; 1236 return irq_vector[irq];
1237 1237
1238 current_vector += 8;
1239 if (current_vector == SYSCALL_VECTOR)
1240 current_vector += 8;
1241
1242 if (current_vector >= FIRST_SYSTEM_VECTOR) {
1243 offset++;
1244 if (!(offset % 8))
1245 return -ENOSPC;
1246 current_vector = FIRST_DEVICE_VECTOR + offset;
1247 }
1248
1249 vector = current_vector; 1238 vector = current_vector;
1239 offset = current_offset;
1240next:
1241 vector += 8;
1242 if (vector >= FIRST_SYSTEM_VECTOR) {
1243 offset = (offset + 1) % 8;
1244 vector = FIRST_DEVICE_VECTOR + offset;
1245 }
1246 if (vector == current_vector)
1247 return -ENOSPC;
1248 if (vector == SYSCALL_VECTOR)
1249 goto next;
1250 for (i = 0; i < NR_IRQ_VECTORS; i++)
1251 if (irq_vector[i] == vector)
1252 goto next;
1253
1254 current_vector = vector;
1255 current_offset = offset;
1250 irq_vector[irq] = vector; 1256 irq_vector[irq] = vector;
1251 1257
1252 return vector; 1258 return vector;
diff --git a/arch/i386/kernel/nmi.c b/arch/i386/kernel/nmi.c
index a5e34d655965..1a6f8bb8881c 100644
--- a/arch/i386/kernel/nmi.c
+++ b/arch/i386/kernel/nmi.c
@@ -310,13 +310,7 @@ static int __init setup_nmi_watchdog(char *str)
310 310
311 if ((nmi >= NMI_INVALID) || (nmi < NMI_NONE)) 311 if ((nmi >= NMI_INVALID) || (nmi < NMI_NONE))
312 return 0; 312 return 0;
313 /* 313
314 * If any other x86 CPU has a local APIC, then
315 * please test the NMI stuff there and send me the
316 * missing bits. Right now Intel P6/P4 and AMD K7 only.
317 */
318 if ((nmi == NMI_LOCAL_APIC) && (nmi_known_cpu() == 0))
319 return 0; /* no lapic support */
320 nmi_watchdog = nmi; 314 nmi_watchdog = nmi;
321 return 1; 315 return 1;
322} 316}
diff --git a/arch/i386/kernel/paravirt.c b/arch/i386/kernel/paravirt.c
index 3dceab5828f1..e55fd05da0f5 100644
--- a/arch/i386/kernel/paravirt.c
+++ b/arch/i386/kernel/paravirt.c
@@ -566,4 +566,11 @@ struct paravirt_ops paravirt_ops = {
566 .irq_enable_sysexit = native_irq_enable_sysexit, 566 .irq_enable_sysexit = native_irq_enable_sysexit,
567 .iret = native_iret, 567 .iret = native_iret,
568}; 568};
569EXPORT_SYMBOL(paravirt_ops); 569
570/*
571 * NOTE: CONFIG_PARAVIRT is experimental and the paravirt_ops
572 * semantics are subject to change. Hence we only do this
573 * internal-only export of this, until it gets sorted out and
574 * all lowlevel CPU ops used by modules are separately exported.
575 */
576EXPORT_SYMBOL_GPL(paravirt_ops);
diff --git a/arch/i386/kernel/sysenter.c b/arch/i386/kernel/sysenter.c
index 7de9117b5a3a..5da744204d10 100644
--- a/arch/i386/kernel/sysenter.c
+++ b/arch/i386/kernel/sysenter.c
@@ -79,11 +79,6 @@ int __init sysenter_setup(void)
79#ifdef CONFIG_COMPAT_VDSO 79#ifdef CONFIG_COMPAT_VDSO
80 __set_fixmap(FIX_VDSO, __pa(syscall_page), PAGE_READONLY); 80 __set_fixmap(FIX_VDSO, __pa(syscall_page), PAGE_READONLY);
81 printk("Compat vDSO mapped to %08lx.\n", __fix_to_virt(FIX_VDSO)); 81 printk("Compat vDSO mapped to %08lx.\n", __fix_to_virt(FIX_VDSO));
82#else
83 /*
84 * In the non-compat case the ELF coredumping code needs the fixmap:
85 */
86 __set_fixmap(FIX_VDSO, __pa(syscall_page), PAGE_KERNEL_RO);
87#endif 82#endif
88 83
89 if (!boot_cpu_has(X86_FEATURE_SEP)) { 84 if (!boot_cpu_has(X86_FEATURE_SEP)) {
@@ -100,6 +95,7 @@ int __init sysenter_setup(void)
100 return 0; 95 return 0;
101} 96}
102 97
98#ifndef CONFIG_COMPAT_VDSO
103static struct page *syscall_nopage(struct vm_area_struct *vma, 99static struct page *syscall_nopage(struct vm_area_struct *vma,
104 unsigned long adr, int *type) 100 unsigned long adr, int *type)
105{ 101{
@@ -146,6 +142,13 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int exstack)
146 vma->vm_end = addr + PAGE_SIZE; 142 vma->vm_end = addr + PAGE_SIZE;
147 /* MAYWRITE to allow gdb to COW and set breakpoints */ 143 /* MAYWRITE to allow gdb to COW and set breakpoints */
148 vma->vm_flags = VM_READ|VM_EXEC|VM_MAYREAD|VM_MAYEXEC|VM_MAYWRITE; 144 vma->vm_flags = VM_READ|VM_EXEC|VM_MAYREAD|VM_MAYEXEC|VM_MAYWRITE;
145 /*
146 * Make sure the vDSO gets into every core dump.
147 * Dumping its contents makes post-mortem fully interpretable later
148 * without matching up the same kernel and hardware config to see
149 * what PC values meant.
150 */
151 vma->vm_flags |= VM_ALWAYSDUMP;
149 vma->vm_flags |= mm->def_flags; 152 vma->vm_flags |= mm->def_flags;
150 vma->vm_page_prot = protection_map[vma->vm_flags & 7]; 153 vma->vm_page_prot = protection_map[vma->vm_flags & 7];
151 vma->vm_ops = &syscall_vm_ops; 154 vma->vm_ops = &syscall_vm_ops;
@@ -187,3 +190,4 @@ int in_gate_area_no_task(unsigned long addr)
187{ 190{
188 return 0; 191 return 0;
189} 192}
193#endif
diff --git a/arch/i386/mach-default/setup.c b/arch/i386/mach-default/setup.c
index c511705c386c..cc2f519b2f7f 100644
--- a/arch/i386/mach-default/setup.c
+++ b/arch/i386/mach-default/setup.c
@@ -102,7 +102,7 @@ void __init time_init_hook(void)
102 * along the MCA bus. Use this to hook into that chain if you will need 102 * along the MCA bus. Use this to hook into that chain if you will need
103 * it. 103 * it.
104 **/ 104 **/
105void __init mca_nmi_hook(void) 105void mca_nmi_hook(void)
106{ 106{
107 /* If I recall correctly, there's a whole bunch of other things that 107 /* If I recall correctly, there's a whole bunch of other things that
108 * we can do to check for NMI problems, but that's all I know about 108 * we can do to check for NMI problems, but that's all I know about
diff --git a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c
index ef2fe474f107..29f05d4b68cd 100644
--- a/arch/ia64/kernel/acpi.c
+++ b/arch/ia64/kernel/acpi.c
@@ -609,6 +609,9 @@ EXPORT_SYMBOL(acpi_register_gsi);
609 609
610void acpi_unregister_gsi(u32 gsi) 610void acpi_unregister_gsi(u32 gsi)
611{ 611{
612 if (acpi_irq_model == ACPI_IRQ_MODEL_PLATFORM)
613 return;
614
612 iosapic_unregister_intr(gsi); 615 iosapic_unregister_intr(gsi);
613} 616}
614 617
diff --git a/arch/ia64/kernel/irq.c b/arch/ia64/kernel/irq.c
index 54d55e4d64f7..ce49c85c928f 100644
--- a/arch/ia64/kernel/irq.c
+++ b/arch/ia64/kernel/irq.c
@@ -122,6 +122,9 @@ static void migrate_irqs(void)
122 for (irq=0; irq < NR_IRQS; irq++) { 122 for (irq=0; irq < NR_IRQS; irq++) {
123 desc = irq_desc + irq; 123 desc = irq_desc + irq;
124 124
125 if (desc->status == IRQ_DISABLED)
126 continue;
127
125 /* 128 /*
126 * No handling for now. 129 * No handling for now.
127 * TBD: Implement a disable function so we can now 130 * TBD: Implement a disable function so we can now
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index fd2ff0698a85..bbd386f572d9 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -1568,6 +1568,20 @@ config MIPS_MT_FPAFF
1568 depends on MIPS_MT 1568 depends on MIPS_MT
1569 default y 1569 default y
1570 1570
1571config MIPS_MT_SMTC_INSTANT_REPLAY
1572 bool "Low-latency Dispatch of Deferred SMTC IPIs"
1573 depends on MIPS_MT_SMTC
1574 default y
1575 help
1576 SMTC pseudo-interrupts between TCs are deferred and queued
1577 if the target TC is interrupt-inhibited (IXMT). In the first
1578 SMTC prototypes, these queued IPIs were serviced on return
1579 to user mode, or on entry into the kernel idle loop. The
1580 INSTANT_REPLAY option dispatches them as part of local_irq_restore()
1581 processing, which adds runtime overhead (hence the option to turn
1582 it off), but ensures that IPIs are handled promptly even under
1583 heavy I/O interrupt load.
1584
1571config MIPS_VPE_LOADER_TOM 1585config MIPS_VPE_LOADER_TOM
1572 bool "Load VPE program into memory hidden from linux" 1586 bool "Load VPE program into memory hidden from linux"
1573 depends on MIPS_VPE_LOADER 1587 depends on MIPS_VPE_LOADER
diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index d1b026a0337d..c68b5d3e5d18 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -623,7 +623,7 @@ LDFLAGS += -m $(ld-emul)
623 623
624ifdef CONFIG_MIPS 624ifdef CONFIG_MIPS
625CHECKFLAGS += $(shell $(CC) $(CFLAGS) -dM -E -xc /dev/null | \ 625CHECKFLAGS += $(shell $(CC) $(CFLAGS) -dM -E -xc /dev/null | \
626 egrep -vw '__GNUC_(MAJOR|MINOR|PATCHLEVEL)__' | \ 626 egrep -vw '__GNUC_(|MINOR_|PATCHLEVEL_)_' | \
627 sed -e 's/^\#define /-D/' -e "s/ /='/" -e "s/$$/'/") 627 sed -e 's/^\#define /-D/' -e "s/ /='/" -e "s/$$/'/")
628ifdef CONFIG_64BIT 628ifdef CONFIG_64BIT
629CHECKFLAGS += -m64 629CHECKFLAGS += -m64
diff --git a/arch/mips/dec/prom/memory.c b/arch/mips/dec/prom/memory.c
index 3027ce782797..3aa01d268f2d 100644
--- a/arch/mips/dec/prom/memory.c
+++ b/arch/mips/dec/prom/memory.c
@@ -122,7 +122,7 @@ unsigned long __init prom_free_prom_memory(void)
122 addr += PAGE_SIZE; 122 addr += PAGE_SIZE;
123 } 123 }
124 124
125 printk("Freeing unused PROM memory: %ldk freed\n", 125 printk("Freeing unused PROM memory: %ldkb freed\n",
126 (end - PAGE_SIZE) >> 10); 126 (end - PAGE_SIZE) >> 10);
127 127
128 return end - PAGE_SIZE; 128 return end - PAGE_SIZE;
diff --git a/arch/mips/kernel/smtc.c b/arch/mips/kernel/smtc.c
index a8b387197d5b..6a857bf030b0 100644
--- a/arch/mips/kernel/smtc.c
+++ b/arch/mips/kernel/smtc.c
@@ -4,6 +4,7 @@
4#include <linux/sched.h> 4#include <linux/sched.h>
5#include <linux/cpumask.h> 5#include <linux/cpumask.h>
6#include <linux/interrupt.h> 6#include <linux/interrupt.h>
7#include <linux/module.h>
7 8
8#include <asm/cpu.h> 9#include <asm/cpu.h>
9#include <asm/processor.h> 10#include <asm/processor.h>
@@ -270,9 +271,12 @@ void smtc_configure_tlb(void)
270 * of their initialization in smtc_cpu_setup(). 271 * of their initialization in smtc_cpu_setup().
271 */ 272 */
272 273
273 tlbsiz = tlbsiz & 0x3f; /* MIPS32 limits TLB indices to 64 */ 274 /* MIPS32 limits TLB indices to 64 */
274 cpu_data[0].tlbsize = tlbsiz; 275 if (tlbsiz > 64)
276 tlbsiz = 64;
277 cpu_data[0].tlbsize = current_cpu_data.tlbsize = tlbsiz;
275 smtc_status |= SMTC_TLB_SHARED; 278 smtc_status |= SMTC_TLB_SHARED;
279 local_flush_tlb_all();
276 280
277 printk("TLB of %d entry pairs shared by %d VPEs\n", 281 printk("TLB of %d entry pairs shared by %d VPEs\n",
278 tlbsiz, vpes); 282 tlbsiz, vpes);
@@ -1017,6 +1021,35 @@ void setup_cross_vpe_interrupts(void)
1017 * SMTC-specific hacks invoked from elsewhere in the kernel. 1021 * SMTC-specific hacks invoked from elsewhere in the kernel.
1018 */ 1022 */
1019 1023
1024void smtc_ipi_replay(void)
1025{
1026 /*
1027 * To the extent that we've ever turned interrupts off,
1028 * we may have accumulated deferred IPIs. This is subtle.
1029 * If we use the smtc_ipi_qdepth() macro, we'll get an
1030 * exact number - but we'll also disable interrupts
1031 * and create a window of failure where a new IPI gets
1032 * queued after we test the depth but before we re-enable
1033 * interrupts. So long as IXMT never gets set, however,
1034 * we should be OK: If we pick up something and dispatch
1035 * it here, that's great. If we see nothing, but concurrent
1036 * with this operation, another TC sends us an IPI, IXMT
1037 * is clear, and we'll handle it as a real pseudo-interrupt
1038 * and not a pseudo-pseudo interrupt.
1039 */
1040 if (IPIQ[smp_processor_id()].depth > 0) {
1041 struct smtc_ipi *pipi;
1042 extern void self_ipi(struct smtc_ipi *);
1043
1044 while ((pipi = smtc_ipi_dq(&IPIQ[smp_processor_id()]))) {
1045 self_ipi(pipi);
1046 smtc_cpu_stats[smp_processor_id()].selfipis++;
1047 }
1048 }
1049}
1050
1051EXPORT_SYMBOL(smtc_ipi_replay);
1052
1020void smtc_idle_loop_hook(void) 1053void smtc_idle_loop_hook(void)
1021{ 1054{
1022#ifdef SMTC_IDLE_HOOK_DEBUG 1055#ifdef SMTC_IDLE_HOOK_DEBUG
@@ -1113,29 +1146,14 @@ void smtc_idle_loop_hook(void)
1113 if (pdb_msg != &id_ho_db_msg[0]) 1146 if (pdb_msg != &id_ho_db_msg[0])
1114 printk("CPU%d: %s", smp_processor_id(), id_ho_db_msg); 1147 printk("CPU%d: %s", smp_processor_id(), id_ho_db_msg);
1115#endif /* SMTC_IDLE_HOOK_DEBUG */ 1148#endif /* SMTC_IDLE_HOOK_DEBUG */
1149
1116 /* 1150 /*
1117 * To the extent that we've ever turned interrupts off, 1151 * Replay any accumulated deferred IPIs. If "Instant Replay"
1118 * we may have accumulated deferred IPIs. This is subtle. 1152 * is in use, there should never be any.
1119 * If we use the smtc_ipi_qdepth() macro, we'll get an
1120 * exact number - but we'll also disable interrupts
1121 * and create a window of failure where a new IPI gets
1122 * queued after we test the depth but before we re-enable
1123 * interrupts. So long as IXMT never gets set, however,
1124 * we should be OK: If we pick up something and dispatch
1125 * it here, that's great. If we see nothing, but concurrent
1126 * with this operation, another TC sends us an IPI, IXMT
1127 * is clear, and we'll handle it as a real pseudo-interrupt
1128 * and not a pseudo-pseudo interrupt.
1129 */ 1153 */
1130 if (IPIQ[smp_processor_id()].depth > 0) { 1154#ifndef CONFIG_MIPS_MT_SMTC_INSTANT_REPLAY
1131 struct smtc_ipi *pipi; 1155 smtc_ipi_replay();
1132 extern void self_ipi(struct smtc_ipi *); 1156#endif /* CONFIG_MIPS_MT_SMTC_INSTANT_REPLAY */
1133
1134 if ((pipi = smtc_ipi_dq(&IPIQ[smp_processor_id()])) != NULL) {
1135 self_ipi(pipi);
1136 smtc_cpu_stats[smp_processor_id()].selfipis++;
1137 }
1138 }
1139} 1157}
1140 1158
1141void smtc_soft_dump(void) 1159void smtc_soft_dump(void)
diff --git a/arch/mips/kernel/vpe.c b/arch/mips/kernel/vpe.c
index 666bef484dcb..458fccf87c54 100644
--- a/arch/mips/kernel/vpe.c
+++ b/arch/mips/kernel/vpe.c
@@ -139,13 +139,16 @@ struct tc {
139 struct list_head list; 139 struct list_head list;
140}; 140};
141 141
142struct vpecontrol_ { 142struct {
143 /* Virtual processing elements */ 143 /* Virtual processing elements */
144 struct list_head vpe_list; 144 struct list_head vpe_list;
145 145
146 /* Thread contexts */ 146 /* Thread contexts */
147 struct list_head tc_list; 147 struct list_head tc_list;
148} vpecontrol; 148} vpecontrol = {
149 .vpe_list = LIST_HEAD_INIT(vpecontrol.vpe_list),
150 .tc_list = LIST_HEAD_INIT(vpecontrol.tc_list)
151};
149 152
150static void release_progmem(void *ptr); 153static void release_progmem(void *ptr);
151/* static __attribute_used__ void dump_vpe(struct vpe * v); */ 154/* static __attribute_used__ void dump_vpe(struct vpe * v); */
@@ -1388,8 +1391,6 @@ static int __init vpe_module_init(void)
1388 1391
1389 /* dump_mtregs(); */ 1392 /* dump_mtregs(); */
1390 1393
1391 INIT_LIST_HEAD(&vpecontrol.vpe_list);
1392 INIT_LIST_HEAD(&vpecontrol.tc_list);
1393 1394
1394 val = read_c0_mvpconf0(); 1395 val = read_c0_mvpconf0();
1395 for (i = 0; i < ((val & MVPCONF0_PTC) + 1); i++) { 1396 for (i = 0; i < ((val & MVPCONF0_PTC) + 1); i++) {
diff --git a/arch/mips/mips-boards/malta/Makefile b/arch/mips/mips-boards/malta/Makefile
index b662c75fb28e..cb7f349b0514 100644
--- a/arch/mips/mips-boards/malta/Makefile
+++ b/arch/mips/mips-boards/malta/Makefile
@@ -19,5 +19,6 @@
19# under Linux. 19# under Linux.
20# 20#
21 21
22obj-y := malta_int.o malta_mtd.o malta_setup.o 22obj-y := malta_int.o malta_setup.o
23obj-$(CONFIG_MTD) += malta_mtd.o
23obj-$(CONFIG_SMP) += malta_smp.o 24obj-$(CONFIG_SMP) += malta_smp.o
diff --git a/arch/mips/mips-boards/sim/sim_setup.c b/arch/mips/mips-boards/sim/sim_setup.c
index 2659c1c3b78d..ea2066c3a1f7 100644
--- a/arch/mips/mips-boards/sim/sim_setup.c
+++ b/arch/mips/mips-boards/sim/sim_setup.c
@@ -57,7 +57,7 @@ void __init plat_mem_setup(void)
57 board_time_init = sim_time_init; 57 board_time_init = sim_time_init;
58 prom_printf("Linux started...\n"); 58 prom_printf("Linux started...\n");
59 59
60#ifdef CONFIG_MT_SMP 60#ifdef CONFIG_MIPS_MT_SMP
61 sanitize_tlb_entries(); 61 sanitize_tlb_entries();
62#endif 62#endif
63} 63}
diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c
index 30245c09d025..49065c133ebf 100644
--- a/arch/mips/mm/init.c
+++ b/arch/mips/mm/init.c
@@ -501,7 +501,8 @@ void free_initmem(void)
501 501
502 freed = prom_free_prom_memory(); 502 freed = prom_free_prom_memory();
503 if (freed) 503 if (freed)
504 printk(KERN_INFO "Freeing firmware memory: %ldk freed\n",freed); 504 printk(KERN_INFO "Freeing firmware memory: %ldkb freed\n",
505 freed >> 10);
505 506
506 free_init_pages("unused kernel memory", 507 free_init_pages("unused kernel memory",
507 __pa_symbol(&__init_begin), 508 __pa_symbol(&__init_begin),
diff --git a/arch/mips/momentum/ocelot_g/prom.c b/arch/mips/momentum/ocelot_g/prom.c
index 6509a9c9863c..2f75c6b91ec5 100644
--- a/arch/mips/momentum/ocelot_g/prom.c
+++ b/arch/mips/momentum/ocelot_g/prom.c
@@ -28,7 +28,7 @@ struct callvectors* debug_vectors;
28extern unsigned long marvell_base; 28extern unsigned long marvell_base;
29extern unsigned long bus_clock; 29extern unsigned long bus_clock;
30 30
31#ifdef CONFIG_GALILLEO_GT64240_ETH 31#ifdef CONFIG_GALILEO_GT64240_ETH
32extern unsigned char prom_mac_addr_base[6]; 32extern unsigned char prom_mac_addr_base[6];
33#endif 33#endif
34 34
@@ -61,7 +61,7 @@ void __init prom_init(void)
61 mips_machgroup = MACH_GROUP_MOMENCO; 61 mips_machgroup = MACH_GROUP_MOMENCO;
62 mips_machtype = MACH_MOMENCO_OCELOT_G; 62 mips_machtype = MACH_MOMENCO_OCELOT_G;
63 63
64#ifdef CONFIG_GALILLEO_GT64240_ETH 64#ifdef CONFIG_GALILEO_GT64240_ETH
65 /* get the base MAC address for on-board ethernet ports */ 65 /* get the base MAC address for on-board ethernet ports */
66 memcpy(prom_mac_addr_base, (void*)0xfc807cf2, 6); 66 memcpy(prom_mac_addr_base, (void*)0xfc807cf2, 6);
67#endif 67#endif
diff --git a/arch/mips/momentum/ocelot_g/setup.c b/arch/mips/momentum/ocelot_g/setup.c
index d288f7b01842..9db638a7982c 100644
--- a/arch/mips/momentum/ocelot_g/setup.c
+++ b/arch/mips/momentum/ocelot_g/setup.c
@@ -64,7 +64,7 @@
64 64
65#include "ocelot_pld.h" 65#include "ocelot_pld.h"
66 66
67#ifdef CONFIG_GALILLEO_GT64240_ETH 67#ifdef CONFIG_GALILEO_GT64240_ETH
68extern unsigned char prom_mac_addr_base[6]; 68extern unsigned char prom_mac_addr_base[6];
69#endif 69#endif
70 70
@@ -185,7 +185,7 @@ void __init plat_mem_setup(void)
185 /* do handoff reconfiguration */ 185 /* do handoff reconfiguration */
186 PMON_v2_setup(); 186 PMON_v2_setup();
187 187
188#ifdef CONFIG_GALILLEO_GT64240_ETH 188#ifdef CONFIG_GALILEO_GT64240_ETH
189 /* get the mac addr */ 189 /* get the mac addr */
190 memcpy(prom_mac_addr_base, (void*)0xfc807cf2, 6); 190 memcpy(prom_mac_addr_base, (void*)0xfc807cf2, 6);
191#endif 191#endif
diff --git a/arch/mips/vr41xx/common/irq.c b/arch/mips/vr41xx/common/irq.c
index 397ba94cd7ec..16decf4ac2f4 100644
--- a/arch/mips/vr41xx/common/irq.c
+++ b/arch/mips/vr41xx/common/irq.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Interrupt handing routines for NEC VR4100 series. 2 * Interrupt handing routines for NEC VR4100 series.
3 * 3 *
4 * Copyright (C) 2005 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp> 4 * Copyright (C) 2005-2007 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by 7 * it under the terms of the GNU General Public License as published by
@@ -73,13 +73,19 @@ static void irq_dispatch(unsigned int irq)
73 if (cascade->get_irq != NULL) { 73 if (cascade->get_irq != NULL) {
74 unsigned int source_irq = irq; 74 unsigned int source_irq = irq;
75 desc = irq_desc + source_irq; 75 desc = irq_desc + source_irq;
76 desc->chip->ack(source_irq); 76 if (desc->chip->mask_ack)
77 desc->chip->mask_ack(source_irq);
78 else {
79 desc->chip->mask(source_irq);
80 desc->chip->ack(source_irq);
81 }
77 irq = cascade->get_irq(irq); 82 irq = cascade->get_irq(irq);
78 if (irq < 0) 83 if (irq < 0)
79 atomic_inc(&irq_err_count); 84 atomic_inc(&irq_err_count);
80 else 85 else
81 irq_dispatch(irq); 86 irq_dispatch(irq);
82 desc->chip->end(source_irq); 87 if (!(desc->status & IRQ_DISABLED) && desc->chip->unmask)
88 desc->chip->unmask(source_irq);
83 } else 89 } else
84 do_IRQ(irq); 90 do_IRQ(irq);
85} 91}
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 0855d55c194d..d6abe495c6b0 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -484,6 +484,7 @@ config PPC_MAPLE
484 select PPC_970_NAP 484 select PPC_970_NAP
485 select PPC_NATIVE 485 select PPC_NATIVE
486 select PPC_RTAS 486 select PPC_RTAS
487 select ATA_NONSTANDARD if ATA
487 default n 488 default n
488 help 489 help
489 This option enables support for the Maple 970FX Evaluation Board. 490 This option enables support for the Maple 970FX Evaluation Board.
@@ -525,12 +526,15 @@ config PPC_IBM_CELL_BLADE
525 select UDBG_RTAS_CONSOLE 526 select UDBG_RTAS_CONSOLE
526 527
527config PPC_PS3 528config PPC_PS3
528 bool "Sony PS3" 529 bool "Sony PS3 (incomplete)"
529 depends on PPC_MULTIPLATFORM && PPC64 530 depends on PPC_MULTIPLATFORM && PPC64
530 select PPC_CELL 531 select PPC_CELL
531 help 532 help
532 This option enables support for the Sony PS3 game console 533 This option enables support for the Sony PS3 game console
533 and other platforms using the PS3 hypervisor. 534 and other platforms using the PS3 hypervisor.
535 Support for this platform is not yet complete, so
536 enabling this will not result in a bootable kernel on a
537 PS3 system.
534 538
535config PPC_NATIVE 539config PPC_NATIVE
536 bool 540 bool
diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c
index 73c59ec49120..01f18c683407 100644
--- a/arch/powerpc/kernel/pci_64.c
+++ b/arch/powerpc/kernel/pci_64.c
@@ -1430,7 +1430,7 @@ long sys_pciconfig_iobase(long which, unsigned long in_bus,
1430 1430
1431 for (ln = pci_root_buses.next; ln != &pci_root_buses; ln = ln->next) { 1431 for (ln = pci_root_buses.next; ln != &pci_root_buses; ln = ln->next) {
1432 bus = pci_bus_b(ln); 1432 bus = pci_bus_b(ln);
1433 if (in_bus >= bus->number && in_bus < (bus->number + bus->subordinate)) 1433 if (in_bus >= bus->number && in_bus <= bus->subordinate)
1434 break; 1434 break;
1435 bus = NULL; 1435 bus = NULL;
1436 } 1436 }
diff --git a/arch/powerpc/kernel/vdso.c b/arch/powerpc/kernel/vdso.c
index a4b28c73bba0..ae0ede19879d 100644
--- a/arch/powerpc/kernel/vdso.c
+++ b/arch/powerpc/kernel/vdso.c
@@ -284,6 +284,13 @@ int arch_setup_additional_pages(struct linux_binprm *bprm,
284 * pages though 284 * pages though
285 */ 285 */
286 vma->vm_flags = VM_READ|VM_EXEC|VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC; 286 vma->vm_flags = VM_READ|VM_EXEC|VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC;
287 /*
288 * Make sure the vDSO gets into every core dump.
289 * Dumping its contents makes post-mortem fully interpretable later
290 * without matching up the same kernel and hardware config to see
291 * what PC values meant.
292 */
293 vma->vm_flags |= VM_ALWAYSDUMP;
287 vma->vm_flags |= mm->def_flags; 294 vma->vm_flags |= mm->def_flags;
288 vma->vm_page_prot = protection_map[vma->vm_flags & 0x7]; 295 vma->vm_page_prot = protection_map[vma->vm_flags & 0x7];
289 vma->vm_ops = &vdso_vmops; 296 vma->vm_ops = &vdso_vmops;
diff --git a/arch/powerpc/platforms/ps3/Makefile b/arch/powerpc/platforms/ps3/Makefile
index 3757cfabc8ce..1994904f580f 100644
--- a/arch/powerpc/platforms/ps3/Makefile
+++ b/arch/powerpc/platforms/ps3/Makefile
@@ -1,4 +1,5 @@
1obj-y += setup.o mm.o smp.o time.o hvcall.o htab.o repository.o 1obj-y += setup.o mm.o time.o hvcall.o htab.o repository.o
2obj-y += interrupt.o exports.o os-area.o 2obj-y += interrupt.o exports.o os-area.o
3 3
4obj-$(CONFIG_SMP) += smp.o
4obj-$(CONFIG_SPU_BASE) += spu.o 5obj-$(CONFIG_SPU_BASE) += spu.o
diff --git a/arch/powerpc/platforms/ps3/interrupt.c b/arch/powerpc/platforms/ps3/interrupt.c
index 056c1e4141ba..6f5de438b980 100644
--- a/arch/powerpc/platforms/ps3/interrupt.c
+++ b/arch/powerpc/platforms/ps3/interrupt.c
@@ -71,7 +71,7 @@ int ps3_free_io_irq(unsigned int virq)
71 71
72 result = lv1_destruct_io_irq_outlet(virq_to_hw(virq)); 72 result = lv1_destruct_io_irq_outlet(virq_to_hw(virq));
73 73
74 if (!result) 74 if (result)
75 pr_debug("%s:%d: lv1_destruct_io_irq_outlet failed: %s\n", 75 pr_debug("%s:%d: lv1_destruct_io_irq_outlet failed: %s\n",
76 __func__, __LINE__, ps3_result(result)); 76 __func__, __LINE__, ps3_result(result));
77 77
diff --git a/arch/sparc/kernel/process.c b/arch/sparc/kernel/process.c
index 89a28cc018c9..113bd48a89bd 100644
--- a/arch/sparc/kernel/process.c
+++ b/arch/sparc/kernel/process.c
@@ -54,6 +54,7 @@ void (*pm_idle)(void);
54 * handler when auxio is not present-- unused for now... 54 * handler when auxio is not present-- unused for now...
55 */ 55 */
56void (*pm_power_off)(void) = machine_power_off; 56void (*pm_power_off)(void) = machine_power_off;
57EXPORT_SYMBOL(pm_power_off);
57 58
58/* 59/*
59 * sysctl - toggle power-off restriction for serial console 60 * sysctl - toggle power-off restriction for serial console
diff --git a/arch/sparc/kernel/smp.c b/arch/sparc/kernel/smp.c
index 276f22881d0f..6b5f26b0fb75 100644
--- a/arch/sparc/kernel/smp.c
+++ b/arch/sparc/kernel/smp.c
@@ -292,8 +292,8 @@ int setup_profiling_timer(unsigned int multiplier)
292 292
293void __init smp_prepare_cpus(unsigned int max_cpus) 293void __init smp_prepare_cpus(unsigned int max_cpus)
294{ 294{
295 extern void smp4m_boot_cpus(void); 295 extern void __init smp4m_boot_cpus(void);
296 extern void smp4d_boot_cpus(void); 296 extern void __init smp4d_boot_cpus(void);
297 int i, cpuid, extra; 297 int i, cpuid, extra;
298 298
299 printk("Entering SMP Mode...\n"); 299 printk("Entering SMP Mode...\n");
@@ -375,8 +375,8 @@ void __init smp_prepare_boot_cpu(void)
375 375
376int __cpuinit __cpu_up(unsigned int cpu) 376int __cpuinit __cpu_up(unsigned int cpu)
377{ 377{
378 extern int smp4m_boot_one_cpu(int); 378 extern int __cpuinit smp4m_boot_one_cpu(int);
379 extern int smp4d_boot_one_cpu(int); 379 extern int __cpuinit smp4d_boot_one_cpu(int);
380 int ret=0; 380 int ret=0;
381 381
382 switch(sparc_cpu_model) { 382 switch(sparc_cpu_model) {
diff --git a/arch/sparc/kernel/sun4d_smp.c b/arch/sparc/kernel/sun4d_smp.c
index c80ea61e8ba0..c69de5d4863d 100644
--- a/arch/sparc/kernel/sun4d_smp.c
+++ b/arch/sparc/kernel/sun4d_smp.c
@@ -164,7 +164,7 @@ void __init smp4d_boot_cpus(void)
164 local_flush_cache_all(); 164 local_flush_cache_all();
165} 165}
166 166
167int smp4d_boot_one_cpu(int i) 167int __cpuinit smp4d_boot_one_cpu(int i)
168{ 168{
169 extern unsigned long sun4d_cpu_startup; 169 extern unsigned long sun4d_cpu_startup;
170 unsigned long *entry = &sun4d_cpu_startup; 170 unsigned long *entry = &sun4d_cpu_startup;
diff --git a/arch/sparc64/kernel/sun4v_tlb_miss.S b/arch/sparc64/kernel/sun4v_tlb_miss.S
index b731881224e8..9871dbb1ab42 100644
--- a/arch/sparc64/kernel/sun4v_tlb_miss.S
+++ b/arch/sparc64/kernel/sun4v_tlb_miss.S
@@ -142,9 +142,9 @@ sun4v_dtlb_prot:
142 rdpr %tl, %g1 142 rdpr %tl, %g1
143 cmp %g1, 1 143 cmp %g1, 1
144 bgu,pn %xcc, winfix_trampoline 144 bgu,pn %xcc, winfix_trampoline
145 nop
146 ba,pt %xcc, sparc64_realfault_common
147 mov FAULT_CODE_DTLB | FAULT_CODE_WRITE, %g4 145 mov FAULT_CODE_DTLB | FAULT_CODE_WRITE, %g4
146 ba,pt %xcc, sparc64_realfault_common
147 nop
148 148
149 /* Called from trap table: 149 /* Called from trap table:
150 * %g4: vaddr 150 * %g4: vaddr
diff --git a/arch/um/Kconfig.i386 b/arch/um/Kconfig.i386
index f191a550a079..d6cffb27fff8 100644
--- a/arch/um/Kconfig.i386
+++ b/arch/um/Kconfig.i386
@@ -19,31 +19,31 @@ config SEMAPHORE_SLEEPERS
19choice 19choice
20 prompt "Host memory split" 20 prompt "Host memory split"
21 default HOST_VMSPLIT_3G 21 default HOST_VMSPLIT_3G
22 ---help--- 22 help
23 This is needed when the host kernel on which you run has a non-default 23 This is needed when the host kernel on which you run has a non-default
24 (like 2G/2G) memory split, instead of the customary 3G/1G. If you did 24 (like 2G/2G) memory split, instead of the customary 3G/1G. If you did
25 not recompile your own kernel but use the default distro's one, you can 25 not recompile your own kernel but use the default distro's one, you can
26 safely accept the "Default split" option. 26 safely accept the "Default split" option.
27 27
28 It can be enabled on recent (>=2.6.16-rc2) vanilla kernels via 28 It can be enabled on recent (>=2.6.16-rc2) vanilla kernels via
29 CONFIG_VM_SPLIT_*, or on previous kernels with special patches (-ck 29 CONFIG_VM_SPLIT_*, or on previous kernels with special patches (-ck
30 patchset by Con Kolivas, or other ones) - option names match closely the 30 patchset by Con Kolivas, or other ones) - option names match closely the
31 host CONFIG_VM_SPLIT_* ones. 31 host CONFIG_VM_SPLIT_* ones.
32 32
33 A lower setting (where 1G/3G is lowest and 3G/1G is higher) will 33 A lower setting (where 1G/3G is lowest and 3G/1G is higher) will
34 tolerate even more "normal" host kernels, but an higher setting will be 34 tolerate even more "normal" host kernels, but an higher setting will be
35 stricter. 35 stricter.
36 36
37 So, if you do not know what to do here, say 'Default split'. 37 So, if you do not know what to do here, say 'Default split'.
38 38
39 config HOST_VMSPLIT_3G 39config HOST_VMSPLIT_3G
40 bool "Default split (3G/1G user/kernel host split)" 40 bool "Default split (3G/1G user/kernel host split)"
41 config HOST_VMSPLIT_3G_OPT 41config HOST_VMSPLIT_3G_OPT
42 bool "3G/1G user/kernel host split (for full 1G low memory)" 42 bool "3G/1G user/kernel host split (for full 1G low memory)"
43 config HOST_VMSPLIT_2G 43config HOST_VMSPLIT_2G
44 bool "2G/2G user/kernel host split" 44 bool "2G/2G user/kernel host split"
45 config HOST_VMSPLIT_1G 45config HOST_VMSPLIT_1G
46 bool "1G/3G user/kernel host split" 46 bool "1G/3G user/kernel host split"
47endchoice 47endchoice
48 48
49config TOP_ADDR 49config TOP_ADDR
@@ -67,13 +67,13 @@ config 3_LEVEL_PGTABLES
67 67
68config STUB_CODE 68config STUB_CODE
69 hex 69 hex
70 default 0xbfffe000 if !HOST_2G_2G 70 default 0xbfffe000 if !HOST_VMSPLIT_2G
71 default 0x7fffe000 if HOST_2G_2G 71 default 0x7fffe000 if HOST_VMSPLIT_2G
72 72
73config STUB_DATA 73config STUB_DATA
74 hex 74 hex
75 default 0xbffff000 if !HOST_2G_2G 75 default 0xbffff000 if !HOST_VMSPLIT_2G
76 default 0x7ffff000 if HOST_2G_2G 76 default 0x7ffff000 if HOST_VMSPLIT_2G
77 77
78config STUB_START 78config STUB_START
79 hex 79 hex
diff --git a/arch/um/sys-i386/signal.c b/arch/um/sys-i386/signal.c
index 0709fc6670c2..3f6acd667717 100644
--- a/arch/um/sys-i386/signal.c
+++ b/arch/um/sys-i386/signal.c
@@ -219,7 +219,8 @@ int setup_signal_stack_sc(unsigned long stack_top, int sig,
219 unsigned long save_sp = PT_REGS_SP(regs); 219 unsigned long save_sp = PT_REGS_SP(regs);
220 int err = 0; 220 int err = 0;
221 221
222 stack_top &= -8UL; 222 /* This is the same calculation as i386 - ((sp + 4) & 15) == 0 */
223 stack_top = ((stack_top + 4) & -16UL) - 4;
223 frame = (struct sigframe __user *) stack_top - 1; 224 frame = (struct sigframe __user *) stack_top - 1;
224 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) 225 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
225 return 1; 226 return 1;
diff --git a/arch/um/sys-x86_64/signal.c b/arch/um/sys-x86_64/signal.c
index 9edf114faf79..af2f017617b4 100644
--- a/arch/um/sys-x86_64/signal.c
+++ b/arch/um/sys-x86_64/signal.c
@@ -191,8 +191,9 @@ int setup_signal_stack_si(unsigned long stack_top, int sig,
191 struct task_struct *me = current; 191 struct task_struct *me = current;
192 192
193 frame = (struct rt_sigframe __user *) 193 frame = (struct rt_sigframe __user *)
194 round_down(stack_top - sizeof(struct rt_sigframe), 16) - 8; 194 round_down(stack_top - sizeof(struct rt_sigframe), 16);
195 frame = (struct rt_sigframe __user *) ((unsigned long) frame - 128); 195 /* Subtract 128 for a red zone and 8 for proper alignment */
196 frame = (struct rt_sigframe __user *) ((unsigned long) frame - 128 - 8);
196 197
197 if (!access_ok(VERIFY_WRITE, fp, sizeof(struct _fpstate))) 198 if (!access_ok(VERIFY_WRITE, fp, sizeof(struct _fpstate)))
198 goto out; 199 goto out;
diff --git a/arch/x86_64/ia32/ia32_binfmt.c b/arch/x86_64/ia32/ia32_binfmt.c
index 543ef4f405e9..5ce0bd486bbf 100644
--- a/arch/x86_64/ia32/ia32_binfmt.c
+++ b/arch/x86_64/ia32/ia32_binfmt.c
@@ -64,55 +64,6 @@ typedef unsigned int elf_greg_t;
64#define ELF_NGREG (sizeof (struct user_regs_struct32) / sizeof(elf_greg_t)) 64#define ELF_NGREG (sizeof (struct user_regs_struct32) / sizeof(elf_greg_t))
65typedef elf_greg_t elf_gregset_t[ELF_NGREG]; 65typedef elf_greg_t elf_gregset_t[ELF_NGREG];
66 66
67/*
68 * These macros parameterize elf_core_dump in fs/binfmt_elf.c to write out
69 * extra segments containing the vsyscall DSO contents. Dumping its
70 * contents makes post-mortem fully interpretable later without matching up
71 * the same kernel and hardware config to see what PC values meant.
72 * Dumping its extra ELF program headers includes all the other information
73 * a debugger needs to easily find how the vsyscall DSO was being used.
74 */
75#define ELF_CORE_EXTRA_PHDRS (find_vma(current->mm, VSYSCALL32_BASE) ? \
76 (VSYSCALL32_EHDR->e_phnum) : 0)
77#define ELF_CORE_WRITE_EXTRA_PHDRS \
78do { \
79 if (find_vma(current->mm, VSYSCALL32_BASE)) { \
80 const struct elf32_phdr *const vsyscall_phdrs = \
81 (const struct elf32_phdr *) (VSYSCALL32_BASE \
82 + VSYSCALL32_EHDR->e_phoff);\
83 int i; \
84 Elf32_Off ofs = 0; \
85 for (i = 0; i < VSYSCALL32_EHDR->e_phnum; ++i) { \
86 struct elf32_phdr phdr = vsyscall_phdrs[i]; \
87 if (phdr.p_type == PT_LOAD) { \
88 BUG_ON(ofs != 0); \
89 ofs = phdr.p_offset = offset; \
90 phdr.p_memsz = PAGE_ALIGN(phdr.p_memsz); \
91 phdr.p_filesz = phdr.p_memsz; \
92 offset += phdr.p_filesz; \
93 } \
94 else \
95 phdr.p_offset += ofs; \
96 phdr.p_paddr = 0; /* match other core phdrs */ \
97 DUMP_WRITE(&phdr, sizeof(phdr)); \
98 } \
99 } \
100} while (0)
101#define ELF_CORE_WRITE_EXTRA_DATA \
102do { \
103 if (find_vma(current->mm, VSYSCALL32_BASE)) { \
104 const struct elf32_phdr *const vsyscall_phdrs = \
105 (const struct elf32_phdr *) (VSYSCALL32_BASE \
106 + VSYSCALL32_EHDR->e_phoff); \
107 int i; \
108 for (i = 0; i < VSYSCALL32_EHDR->e_phnum; ++i) { \
109 if (vsyscall_phdrs[i].p_type == PT_LOAD) \
110 DUMP_WRITE((void *) (u64) vsyscall_phdrs[i].p_vaddr,\
111 PAGE_ALIGN(vsyscall_phdrs[i].p_memsz)); \
112 } \
113 } \
114} while (0)
115
116struct elf_siginfo 67struct elf_siginfo
117{ 68{
118 int si_signo; /* signal number */ 69 int si_signo; /* signal number */
diff --git a/arch/x86_64/ia32/syscall32.c b/arch/x86_64/ia32/syscall32.c
index 3e5ed20cba45..59f1fa155915 100644
--- a/arch/x86_64/ia32/syscall32.c
+++ b/arch/x86_64/ia32/syscall32.c
@@ -59,6 +59,13 @@ int syscall32_setup_pages(struct linux_binprm *bprm, int exstack)
59 vma->vm_end = VSYSCALL32_END; 59 vma->vm_end = VSYSCALL32_END;
60 /* MAYWRITE to allow gdb to COW and set breakpoints */ 60 /* MAYWRITE to allow gdb to COW and set breakpoints */
61 vma->vm_flags = VM_READ|VM_EXEC|VM_MAYREAD|VM_MAYEXEC|VM_MAYWRITE; 61 vma->vm_flags = VM_READ|VM_EXEC|VM_MAYREAD|VM_MAYEXEC|VM_MAYWRITE;
62 /*
63 * Make sure the vDSO gets into every core dump.
64 * Dumping its contents makes post-mortem fully interpretable later
65 * without matching up the same kernel and hardware config to see
66 * what PC values meant.
67 */
68 vma->vm_flags |= VM_ALWAYSDUMP;
62 vma->vm_flags |= mm->def_flags; 69 vma->vm_flags |= mm->def_flags;
63 vma->vm_page_prot = protection_map[vma->vm_flags & 7]; 70 vma->vm_page_prot = protection_map[vma->vm_flags & 7];
64 vma->vm_ops = &syscall32_vm_ops; 71 vma->vm_ops = &syscall32_vm_ops;
@@ -75,6 +82,14 @@ int syscall32_setup_pages(struct linux_binprm *bprm, int exstack)
75 return 0; 82 return 0;
76} 83}
77 84
85const char *arch_vma_name(struct vm_area_struct *vma)
86{
87 if (vma->vm_start == VSYSCALL32_BASE &&
88 vma->vm_mm && vma->vm_mm->task_size == IA32_PAGE_OFFSET)
89 return "[vdso]";
90 return NULL;
91}
92
78static int __init init_syscall32(void) 93static int __init init_syscall32(void)
79{ 94{
80 syscall32_page = (void *)get_zeroed_page(GFP_KERNEL); 95 syscall32_page = (void *)get_zeroed_page(GFP_KERNEL);
diff --git a/arch/x86_64/kernel/nmi.c b/arch/x86_64/kernel/nmi.c
index 186aebbae32d..9cb42ecb7f89 100644
--- a/arch/x86_64/kernel/nmi.c
+++ b/arch/x86_64/kernel/nmi.c
@@ -302,8 +302,6 @@ int __init setup_nmi_watchdog(char *str)
302 if ((nmi >= NMI_INVALID) || (nmi < NMI_NONE)) 302 if ((nmi >= NMI_INVALID) || (nmi < NMI_NONE))
303 return 0; 303 return 0;
304 304
305 if ((nmi == NMI_LOCAL_APIC) && (nmi_known_cpu() == 0))
306 return 0; /* no lapic support */
307 nmi_watchdog = nmi; 305 nmi_watchdog = nmi;
308 return 1; 306 return 1;
309} 307}
diff --git a/block/elevator.c b/block/elevator.c
index 536be740ba4e..f6dafa8c7c4d 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -590,6 +590,12 @@ void elv_insert(request_queue_t *q, struct request *rq, int where)
590 */ 590 */
591 rq->cmd_flags |= REQ_SOFTBARRIER; 591 rq->cmd_flags |= REQ_SOFTBARRIER;
592 592
593 /*
594 * Most requeues happen because of a busy condition,
595 * don't force unplug of the queue for that case.
596 */
597 unplug_it = 0;
598
593 if (q->ordseq == 0) { 599 if (q->ordseq == 0) {
594 list_add(&rq->queuelist, &q->queue_head); 600 list_add(&rq->queuelist, &q->queue_head);
595 break; 601 break;
@@ -604,11 +610,6 @@ void elv_insert(request_queue_t *q, struct request *rq, int where)
604 } 610 }
605 611
606 list_add_tail(&rq->queuelist, pos); 612 list_add_tail(&rq->queuelist, pos);
607 /*
608 * most requeues happen because of a busy condition, don't
609 * force unplug of the queue for that case.
610 */
611 unplug_it = 0;
612 break; 613 break;
613 614
614 default: 615 default:
diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c
index 2528a0c0dec8..65c6a3cba6d6 100644
--- a/block/scsi_ioctl.c
+++ b/block/scsi_ioctl.c
@@ -223,7 +223,7 @@ static int verify_command(struct file *file, unsigned char *cmd)
223static int sg_io(struct file *file, request_queue_t *q, 223static int sg_io(struct file *file, request_queue_t *q,
224 struct gendisk *bd_disk, struct sg_io_hdr *hdr) 224 struct gendisk *bd_disk, struct sg_io_hdr *hdr)
225{ 225{
226 unsigned long start_time; 226 unsigned long start_time, timeout;
227 int writing = 0, ret = 0; 227 int writing = 0, ret = 0;
228 struct request *rq; 228 struct request *rq;
229 char sense[SCSI_SENSE_BUFFERSIZE]; 229 char sense[SCSI_SENSE_BUFFERSIZE];
@@ -271,7 +271,8 @@ static int sg_io(struct file *file, request_queue_t *q,
271 271
272 rq->cmd_type = REQ_TYPE_BLOCK_PC; 272 rq->cmd_type = REQ_TYPE_BLOCK_PC;
273 273
274 rq->timeout = jiffies_to_msecs(hdr->timeout); 274 timeout = msecs_to_jiffies(hdr->timeout);
275 rq->timeout = (timeout < INT_MAX) ? timeout : INT_MAX;
275 if (!rq->timeout) 276 if (!rq->timeout)
276 rq->timeout = q->sg_timeout; 277 rq->timeout = q->sg_timeout;
277 if (!rq->timeout) 278 if (!rq->timeout)
diff --git a/drivers/acpi/processor_perflib.c b/drivers/acpi/processor_perflib.c
index 5207f9e4b443..cbb6f0814ce2 100644
--- a/drivers/acpi/processor_perflib.c
+++ b/drivers/acpi/processor_perflib.c
@@ -322,10 +322,6 @@ static int acpi_processor_get_performance_info(struct acpi_processor *pr)
322 if (result) 322 if (result)
323 return result; 323 return result;
324 324
325 result = acpi_processor_get_platform_limit(pr);
326 if (result)
327 return result;
328
329 return 0; 325 return 0;
330} 326}
331 327
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
index 36b37d755dbc..3d54680d0333 100644
--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -1677,8 +1677,6 @@ static void acpi_video_device_notify(acpi_handle handle, u32 event, void *data)
1677 struct acpi_video_device *video_device = data; 1677 struct acpi_video_device *video_device = data;
1678 struct acpi_device *device = NULL; 1678 struct acpi_device *device = NULL;
1679 1679
1680
1681 printk("video device notify\n");
1682 if (!video_device) 1680 if (!video_device)
1683 return; 1681 return;
1684 1682
diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
index da21552d2b1c..1c94b43d2c9b 100644
--- a/drivers/ata/Kconfig
+++ b/drivers/ata/Kconfig
@@ -19,6 +19,10 @@ config ATA
19 19
20if ATA 20if ATA
21 21
22config ATA_NONSTANDARD
23 bool
24 default n
25
22config SATA_AHCI 26config SATA_AHCI
23 tristate "AHCI SATA support" 27 tristate "AHCI SATA support"
24 depends on PCI 28 depends on PCI
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index b517d2493551..48616c6fee9d 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -75,6 +75,7 @@ enum {
75 AHCI_CMD_CLR_BUSY = (1 << 10), 75 AHCI_CMD_CLR_BUSY = (1 << 10),
76 76
77 RX_FIS_D2H_REG = 0x40, /* offset of D2H Register FIS data */ 77 RX_FIS_D2H_REG = 0x40, /* offset of D2H Register FIS data */
78 RX_FIS_SDB = 0x58, /* offset of SDB FIS data */
78 RX_FIS_UNK = 0x60, /* offset of Unknown FIS data */ 79 RX_FIS_UNK = 0x60, /* offset of Unknown FIS data */
79 80
80 board_ahci = 0, 81 board_ahci = 0,
@@ -202,6 +203,10 @@ struct ahci_port_priv {
202 dma_addr_t cmd_tbl_dma; 203 dma_addr_t cmd_tbl_dma;
203 void *rx_fis; 204 void *rx_fis;
204 dma_addr_t rx_fis_dma; 205 dma_addr_t rx_fis_dma;
206 /* for NCQ spurious interrupt analysis */
207 int ncq_saw_spurious_sdb_cnt;
208 unsigned int ncq_saw_d2h:1;
209 unsigned int ncq_saw_dmas:1;
205}; 210};
206 211
207static u32 ahci_scr_read (struct ata_port *ap, unsigned int sc_reg); 212static u32 ahci_scr_read (struct ata_port *ap, unsigned int sc_reg);
@@ -361,7 +366,7 @@ static const struct pci_device_id ahci_pci_tbl[] = {
361 { PCI_VDEVICE(INTEL, 0x27c1), board_ahci }, /* ICH7 */ 366 { PCI_VDEVICE(INTEL, 0x27c1), board_ahci }, /* ICH7 */
362 { PCI_VDEVICE(INTEL, 0x27c5), board_ahci }, /* ICH7M */ 367 { PCI_VDEVICE(INTEL, 0x27c5), board_ahci }, /* ICH7M */
363 { PCI_VDEVICE(INTEL, 0x27c3), board_ahci }, /* ICH7R */ 368 { PCI_VDEVICE(INTEL, 0x27c3), board_ahci }, /* ICH7R */
364 { PCI_VDEVICE(AL, 0x5288), board_ahci }, /* ULi M5288 */ 369 { PCI_VDEVICE(AL, 0x5288), board_ahci_ign_iferr }, /* ULi M5288 */
365 { PCI_VDEVICE(INTEL, 0x2681), board_ahci }, /* ESB2 */ 370 { PCI_VDEVICE(INTEL, 0x2681), board_ahci }, /* ESB2 */
366 { PCI_VDEVICE(INTEL, 0x2682), board_ahci }, /* ESB2 */ 371 { PCI_VDEVICE(INTEL, 0x2682), board_ahci }, /* ESB2 */
367 { PCI_VDEVICE(INTEL, 0x2683), board_ahci }, /* ESB2 */ 372 { PCI_VDEVICE(INTEL, 0x2683), board_ahci }, /* ESB2 */
@@ -586,35 +591,18 @@ static void ahci_power_down(void __iomem *port_mmio, u32 cap)
586{ 591{
587 u32 cmd, scontrol; 592 u32 cmd, scontrol;
588 593
589 cmd = readl(port_mmio + PORT_CMD) & ~PORT_CMD_ICC_MASK; 594 if (!(cap & HOST_CAP_SSS))
590 595 return;
591 if (cap & HOST_CAP_SSC) {
592 /* enable transitions to slumber mode */
593 scontrol = readl(port_mmio + PORT_SCR_CTL);
594 if ((scontrol & 0x0f00) > 0x100) {
595 scontrol &= ~0xf00;
596 writel(scontrol, port_mmio + PORT_SCR_CTL);
597 }
598
599 /* put device into slumber mode */
600 writel(cmd | PORT_CMD_ICC_SLUMBER, port_mmio + PORT_CMD);
601
602 /* wait for the transition to complete */
603 ata_wait_register(port_mmio + PORT_CMD, PORT_CMD_ICC_SLUMBER,
604 PORT_CMD_ICC_SLUMBER, 1, 50);
605 }
606 596
607 /* put device into listen mode */ 597 /* put device into listen mode, first set PxSCTL.DET to 0 */
608 if (cap & HOST_CAP_SSS) { 598 scontrol = readl(port_mmio + PORT_SCR_CTL);
609 /* first set PxSCTL.DET to 0 */ 599 scontrol &= ~0xf;
610 scontrol = readl(port_mmio + PORT_SCR_CTL); 600 writel(scontrol, port_mmio + PORT_SCR_CTL);
611 scontrol &= ~0xf;
612 writel(scontrol, port_mmio + PORT_SCR_CTL);
613 601
614 /* then set PxCMD.SUD to 0 */ 602 /* then set PxCMD.SUD to 0 */
615 cmd &= ~PORT_CMD_SPIN_UP; 603 cmd = readl(port_mmio + PORT_CMD) & ~PORT_CMD_ICC_MASK;
616 writel(cmd, port_mmio + PORT_CMD); 604 cmd &= ~PORT_CMD_SPIN_UP;
617 } 605 writel(cmd, port_mmio + PORT_CMD);
618} 606}
619 607
620static void ahci_init_port(void __iomem *port_mmio, u32 cap, 608static void ahci_init_port(void __iomem *port_mmio, u32 cap,
@@ -915,7 +903,7 @@ static int ahci_hardreset(struct ata_port *ap, unsigned int *class)
915 903
916 /* clear D2H reception area to properly wait for D2H FIS */ 904 /* clear D2H reception area to properly wait for D2H FIS */
917 ata_tf_init(ap->device, &tf); 905 ata_tf_init(ap->device, &tf);
918 tf.command = 0xff; 906 tf.command = 0x80;
919 ata_tf_to_fis(&tf, d2h_fis, 0); 907 ata_tf_to_fis(&tf, d2h_fis, 0);
920 908
921 rc = sata_std_hardreset(ap, class); 909 rc = sata_std_hardreset(ap, class);
@@ -1126,8 +1114,9 @@ static void ahci_host_intr(struct ata_port *ap)
1126 void __iomem *mmio = ap->host->mmio_base; 1114 void __iomem *mmio = ap->host->mmio_base;
1127 void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no); 1115 void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no);
1128 struct ata_eh_info *ehi = &ap->eh_info; 1116 struct ata_eh_info *ehi = &ap->eh_info;
1117 struct ahci_port_priv *pp = ap->private_data;
1129 u32 status, qc_active; 1118 u32 status, qc_active;
1130 int rc; 1119 int rc, known_irq = 0;
1131 1120
1132 status = readl(port_mmio + PORT_IRQ_STAT); 1121 status = readl(port_mmio + PORT_IRQ_STAT);
1133 writel(status, port_mmio + PORT_IRQ_STAT); 1122 writel(status, port_mmio + PORT_IRQ_STAT);
@@ -1154,17 +1143,53 @@ static void ahci_host_intr(struct ata_port *ap)
1154 1143
1155 /* hmmm... a spurious interupt */ 1144 /* hmmm... a spurious interupt */
1156 1145
1157 /* some devices send D2H reg with I bit set during NCQ command phase */ 1146 /* if !NCQ, ignore. No modern ATA device has broken HSM
1158 if (ap->sactive && (status & PORT_IRQ_D2H_REG_FIS)) 1147 * implementation for non-NCQ commands.
1148 */
1149 if (!ap->sactive)
1159 return; 1150 return;
1160 1151
1161 /* ignore interim PIO setup fis interrupts */ 1152 if (status & PORT_IRQ_D2H_REG_FIS) {
1162 if (ata_tag_valid(ap->active_tag) && (status & PORT_IRQ_PIOS_FIS)) 1153 if (!pp->ncq_saw_d2h)
1163 return; 1154 ata_port_printk(ap, KERN_INFO,
1155 "D2H reg with I during NCQ, "
1156 "this message won't be printed again\n");
1157 pp->ncq_saw_d2h = 1;
1158 known_irq = 1;
1159 }
1160
1161 if (status & PORT_IRQ_DMAS_FIS) {
1162 if (!pp->ncq_saw_dmas)
1163 ata_port_printk(ap, KERN_INFO,
1164 "DMAS FIS during NCQ, "
1165 "this message won't be printed again\n");
1166 pp->ncq_saw_dmas = 1;
1167 known_irq = 1;
1168 }
1169
1170 if (status & PORT_IRQ_SDB_FIS &&
1171 pp->ncq_saw_spurious_sdb_cnt < 10) {
1172 /* SDB FIS containing spurious completions might be
1173 * dangerous, we need to know more about them. Print
1174 * more of it.
1175 */
1176 const u32 *f = pp->rx_fis + RX_FIS_SDB;
1177
1178 ata_port_printk(ap, KERN_INFO, "Spurious SDB FIS during NCQ "
1179 "issue=0x%x SAct=0x%x FIS=%08x:%08x%s\n",
1180 readl(port_mmio + PORT_CMD_ISSUE),
1181 readl(port_mmio + PORT_SCR_ACT),
1182 le32_to_cpu(f[0]), le32_to_cpu(f[1]),
1183 pp->ncq_saw_spurious_sdb_cnt < 10 ?
1184 "" : ", shutting up");
1185
1186 pp->ncq_saw_spurious_sdb_cnt++;
1187 known_irq = 1;
1188 }
1164 1189
1165 if (ata_ratelimit()) 1190 if (!known_irq)
1166 ata_port_printk(ap, KERN_INFO, "spurious interrupt " 1191 ata_port_printk(ap, KERN_INFO, "spurious interrupt "
1167 "(irq_stat 0x%x active_tag %d sactive 0x%x)\n", 1192 "(irq_stat 0x%x active_tag 0x%x sactive 0x%x)\n",
1168 status, ap->active_tag, ap->sactive); 1193 status, ap->active_tag, ap->sactive);
1169} 1194}
1170 1195
@@ -1257,7 +1282,7 @@ static void ahci_thaw(struct ata_port *ap)
1257 /* clear IRQ */ 1282 /* clear IRQ */
1258 tmp = readl(port_mmio + PORT_IRQ_STAT); 1283 tmp = readl(port_mmio + PORT_IRQ_STAT);
1259 writel(tmp, port_mmio + PORT_IRQ_STAT); 1284 writel(tmp, port_mmio + PORT_IRQ_STAT);
1260 writel(1 << ap->id, mmio + HOST_IRQ_STAT); 1285 writel(1 << ap->port_no, mmio + HOST_IRQ_STAT);
1261 1286
1262 /* turn IRQ back on */ 1287 /* turn IRQ back on */
1263 writel(DEF_PORT_IRQ, port_mmio + PORT_IRQ_MASK); 1288 writel(DEF_PORT_IRQ, port_mmio + PORT_IRQ_MASK);
diff --git a/drivers/ata/ata_generic.c b/drivers/ata/ata_generic.c
index 908751d27e76..24af56081b5d 100644
--- a/drivers/ata/ata_generic.c
+++ b/drivers/ata/ata_generic.c
@@ -64,6 +64,7 @@ static void generic_error_handler(struct ata_port *ap)
64/** 64/**
65 * generic_set_mode - mode setting 65 * generic_set_mode - mode setting
66 * @ap: interface to set up 66 * @ap: interface to set up
67 * @unused: returned device on error
67 * 68 *
68 * Use a non standard set_mode function. We don't want to be tuned. 69 * Use a non standard set_mode function. We don't want to be tuned.
69 * The BIOS configured everything. Our job is not to fiddle. We 70 * The BIOS configured everything. Our job is not to fiddle. We
@@ -71,7 +72,7 @@ static void generic_error_handler(struct ata_port *ap)
71 * and respect them. 72 * and respect them.
72 */ 73 */
73 74
74static void generic_set_mode(struct ata_port *ap) 75static int generic_set_mode(struct ata_port *ap, struct ata_device **unused)
75{ 76{
76 int dma_enabled = 0; 77 int dma_enabled = 0;
77 int i; 78 int i;
@@ -82,7 +83,7 @@ static void generic_set_mode(struct ata_port *ap)
82 83
83 for (i = 0; i < ATA_MAX_DEVICES; i++) { 84 for (i = 0; i < ATA_MAX_DEVICES; i++) {
84 struct ata_device *dev = &ap->device[i]; 85 struct ata_device *dev = &ap->device[i];
85 if (ata_dev_enabled(dev)) { 86 if (ata_dev_ready(dev)) {
86 /* We don't really care */ 87 /* We don't really care */
87 dev->pio_mode = XFER_PIO_0; 88 dev->pio_mode = XFER_PIO_0;
88 dev->dma_mode = XFER_MW_DMA_0; 89 dev->dma_mode = XFER_MW_DMA_0;
@@ -99,6 +100,7 @@ static void generic_set_mode(struct ata_port *ap)
99 } 100 }
100 } 101 }
101 } 102 }
103 return 0;
102} 104}
103 105
104static struct scsi_host_template generic_sht = { 106static struct scsi_host_template generic_sht = {
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 0d51d13b16bf..667acd283364 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -1037,7 +1037,7 @@ static unsigned int ata_id_xfermask(const u16 *id)
1037 * the PIO timing number for the maximum. Turn it into 1037 * the PIO timing number for the maximum. Turn it into
1038 * a mask. 1038 * a mask.
1039 */ 1039 */
1040 u8 mode = id[ATA_ID_OLD_PIO_MODES] & 0xFF; 1040 u8 mode = (id[ATA_ID_OLD_PIO_MODES] >> 8) & 0xFF;
1041 if (mode < 5) /* Valid PIO range */ 1041 if (mode < 5) /* Valid PIO range */
1042 pio_mask = (2 << mode) - 1; 1042 pio_mask = (2 << mode) - 1;
1043 else 1043 else
@@ -1250,6 +1250,7 @@ unsigned ata_exec_internal_sg(struct ata_device *dev,
1250 1250
1251 ata_sg_init(qc, sg, n_elem); 1251 ata_sg_init(qc, sg, n_elem);
1252 qc->nsect = buflen / ATA_SECT_SIZE; 1252 qc->nsect = buflen / ATA_SECT_SIZE;
1253 qc->nbytes = buflen;
1253 } 1254 }
1254 1255
1255 qc->private_data = &wait; 1256 qc->private_data = &wait;
@@ -2431,18 +2432,8 @@ int ata_set_mode(struct ata_port *ap, struct ata_device **r_failed_dev)
2431 int i, rc = 0, used_dma = 0, found = 0; 2432 int i, rc = 0, used_dma = 0, found = 0;
2432 2433
2433 /* has private set_mode? */ 2434 /* has private set_mode? */
2434 if (ap->ops->set_mode) { 2435 if (ap->ops->set_mode)
2435 /* FIXME: make ->set_mode handle no device case and 2436 return ap->ops->set_mode(ap, r_failed_dev);
2436 * return error code and failing device on failure.
2437 */
2438 for (i = 0; i < ATA_MAX_DEVICES; i++) {
2439 if (ata_dev_ready(&ap->device[i])) {
2440 ap->ops->set_mode(ap);
2441 break;
2442 }
2443 }
2444 return 0;
2445 }
2446 2437
2447 /* step 1: calculate xfer_mask */ 2438 /* step 1: calculate xfer_mask */
2448 for (i = 0; i < ATA_MAX_DEVICES; i++) { 2439 for (i = 0; i < ATA_MAX_DEVICES; i++) {
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index 56cf59b60ec4..748435807d68 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -1796,7 +1796,7 @@ static int ata_eh_suspend(struct ata_port *ap, struct ata_device **r_failed_dev)
1796 *r_failed_dev = dev; 1796 *r_failed_dev = dev;
1797 1797
1798 DPRINTK("EXIT\n"); 1798 DPRINTK("EXIT\n");
1799 return 0; 1799 return rc;
1800} 1800}
1801 1801
1802/** 1802/**
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 836947da5b14..73902d335767 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -273,8 +273,8 @@ int ata_task_ioctl(struct scsi_device *scsidev, void __user *arg)
273{ 273{
274 int rc = 0; 274 int rc = 0;
275 u8 scsi_cmd[MAX_COMMAND_SIZE]; 275 u8 scsi_cmd[MAX_COMMAND_SIZE];
276 u8 args[7]; 276 u8 args[7], *sensebuf = NULL;
277 struct scsi_sense_hdr sshdr; 277 int cmd_result;
278 278
279 if (arg == NULL) 279 if (arg == NULL)
280 return -EINVAL; 280 return -EINVAL;
@@ -282,10 +282,14 @@ int ata_task_ioctl(struct scsi_device *scsidev, void __user *arg)
282 if (copy_from_user(args, arg, sizeof(args))) 282 if (copy_from_user(args, arg, sizeof(args)))
283 return -EFAULT; 283 return -EFAULT;
284 284
285 sensebuf = kzalloc(SCSI_SENSE_BUFFERSIZE, GFP_NOIO);
286 if (!sensebuf)
287 return -ENOMEM;
288
285 memset(scsi_cmd, 0, sizeof(scsi_cmd)); 289 memset(scsi_cmd, 0, sizeof(scsi_cmd));
286 scsi_cmd[0] = ATA_16; 290 scsi_cmd[0] = ATA_16;
287 scsi_cmd[1] = (3 << 1); /* Non-data */ 291 scsi_cmd[1] = (3 << 1); /* Non-data */
288 /* scsi_cmd[2] is already 0 -- no off.line, cc, or data xfer */ 292 scsi_cmd[2] = 0x20; /* cc but no off.line or data xfer */
289 scsi_cmd[4] = args[1]; 293 scsi_cmd[4] = args[1];
290 scsi_cmd[6] = args[2]; 294 scsi_cmd[6] = args[2];
291 scsi_cmd[8] = args[3]; 295 scsi_cmd[8] = args[3];
@@ -295,11 +299,46 @@ int ata_task_ioctl(struct scsi_device *scsidev, void __user *arg)
295 299
296 /* Good values for timeout and retries? Values below 300 /* Good values for timeout and retries? Values below
297 from scsi_ioctl_send_command() for default case... */ 301 from scsi_ioctl_send_command() for default case... */
298 if (scsi_execute_req(scsidev, scsi_cmd, DMA_NONE, NULL, 0, &sshdr, 302 cmd_result = scsi_execute(scsidev, scsi_cmd, DMA_NONE, NULL, 0,
299 (10*HZ), 5)) 303 sensebuf, (10*HZ), 5, 0);
304
305 if (driver_byte(cmd_result) == DRIVER_SENSE) {/* sense data available */
306 u8 *desc = sensebuf + 8;
307 cmd_result &= ~(0xFF<<24); /* DRIVER_SENSE is not an error */
308
309 /* If we set cc then ATA pass-through will cause a
310 * check condition even if no error. Filter that. */
311 if (cmd_result & SAM_STAT_CHECK_CONDITION) {
312 struct scsi_sense_hdr sshdr;
313 scsi_normalize_sense(sensebuf, SCSI_SENSE_BUFFERSIZE,
314 &sshdr);
315 if (sshdr.sense_key==0 &&
316 sshdr.asc==0 && sshdr.ascq==0)
317 cmd_result &= ~SAM_STAT_CHECK_CONDITION;
318 }
319
320 /* Send userspace ATA registers */
321 if (sensebuf[0] == 0x72 && /* format is "descriptor" */
322 desc[0] == 0x09) {/* code is "ATA Descriptor" */
323 args[0] = desc[13]; /* status */
324 args[1] = desc[3]; /* error */
325 args[2] = desc[5]; /* sector count (0:7) */
326 args[3] = desc[7]; /* lbal */
327 args[4] = desc[9]; /* lbam */
328 args[5] = desc[11]; /* lbah */
329 args[6] = desc[12]; /* select */
330 if (copy_to_user(arg, args, sizeof(args)))
331 rc = -EFAULT;
332 }
333 }
334
335 if (cmd_result) {
300 rc = -EIO; 336 rc = -EIO;
337 goto error;
338 }
301 339
302 /* Need code to retrieve data from check condition? */ 340 error:
341 kfree(sensebuf);
303 return rc; 342 return rc;
304} 343}
305 344
@@ -372,7 +411,7 @@ struct ata_queued_cmd *ata_scsi_qc_new(struct ata_device *dev,
372 if (cmd->use_sg) { 411 if (cmd->use_sg) {
373 qc->__sg = (struct scatterlist *) cmd->request_buffer; 412 qc->__sg = (struct scatterlist *) cmd->request_buffer;
374 qc->n_elem = cmd->use_sg; 413 qc->n_elem = cmd->use_sg;
375 } else { 414 } else if (cmd->request_bufflen) {
376 qc->__sg = &qc->sgent; 415 qc->__sg = &qc->sgent;
377 qc->n_elem = 1; 416 qc->n_elem = 1;
378 } 417 }
@@ -983,11 +1022,10 @@ static unsigned int ata_scsi_start_stop_xlat(struct ata_queued_cmd *qc)
983 } 1022 }
984 1023
985 tf->command = ATA_CMD_VERIFY; /* READ VERIFY */ 1024 tf->command = ATA_CMD_VERIFY; /* READ VERIFY */
986 } else { 1025 } else
987 tf->nsect = 0; /* time period value (0 implies now) */ 1026 /* Issue ATA STANDBY IMMEDIATE command */
988 tf->command = ATA_CMD_STANDBY; 1027 tf->command = ATA_CMD_STANDBYNOW1;
989 /* Consider: ATA STANDBY IMMEDIATE command */ 1028
990 }
991 /* 1029 /*
992 * Standby and Idle condition timers could be implemented but that 1030 * Standby and Idle condition timers could be implemented but that
993 * would require libata to implement the Power condition mode page 1031 * would require libata to implement the Power condition mode page
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c
index 623cec914c9b..12c88c588039 100644
--- a/drivers/ata/libata-sff.c
+++ b/drivers/ata/libata-sff.c
@@ -827,7 +827,8 @@ void ata_bmdma_error_handler(struct ata_port *ap)
827 */ 827 */
828void ata_bmdma_post_internal_cmd(struct ata_queued_cmd *qc) 828void ata_bmdma_post_internal_cmd(struct ata_queued_cmd *qc)
829{ 829{
830 ata_bmdma_stop(qc); 830 if (qc->ap->ioaddr.bmdma_addr)
831 ata_bmdma_stop(qc);
831} 832}
832 833
833#ifdef CONFIG_PCI 834#ifdef CONFIG_PCI
@@ -870,7 +871,8 @@ ata_pci_init_native_mode(struct pci_dev *pdev, struct ata_port_info **port, int
870 pci_resource_start(pdev, 1) | ATA_PCI_CTL_OFS; 871 pci_resource_start(pdev, 1) | ATA_PCI_CTL_OFS;
871 bmdma = pci_resource_start(pdev, 4); 872 bmdma = pci_resource_start(pdev, 4);
872 if (bmdma) { 873 if (bmdma) {
873 if (inb(bmdma + 2) & 0x80) 874 if ((!(port[p]->flags & ATA_FLAG_IGN_SIMPLEX)) &&
875 (inb(bmdma + 2) & 0x80))
874 probe_ent->_host_flags |= ATA_HOST_SIMPLEX; 876 probe_ent->_host_flags |= ATA_HOST_SIMPLEX;
875 probe_ent->port[p].bmdma_addr = bmdma; 877 probe_ent->port[p].bmdma_addr = bmdma;
876 } 878 }
@@ -886,7 +888,8 @@ ata_pci_init_native_mode(struct pci_dev *pdev, struct ata_port_info **port, int
886 bmdma = pci_resource_start(pdev, 4); 888 bmdma = pci_resource_start(pdev, 4);
887 if (bmdma) { 889 if (bmdma) {
888 bmdma += 8; 890 bmdma += 8;
889 if(inb(bmdma + 2) & 0x80) 891 if ((!(port[p]->flags & ATA_FLAG_IGN_SIMPLEX)) &&
892 (inb(bmdma + 2) & 0x80))
890 probe_ent->_host_flags |= ATA_HOST_SIMPLEX; 893 probe_ent->_host_flags |= ATA_HOST_SIMPLEX;
891 probe_ent->port[p].bmdma_addr = bmdma; 894 probe_ent->port[p].bmdma_addr = bmdma;
892 } 895 }
@@ -914,13 +917,14 @@ static struct ata_probe_ent *ata_pci_init_legacy_port(struct pci_dev *pdev,
914 probe_ent->irq_flags = IRQF_SHARED; 917 probe_ent->irq_flags = IRQF_SHARED;
915 918
916 if (port_mask & ATA_PORT_PRIMARY) { 919 if (port_mask & ATA_PORT_PRIMARY) {
917 probe_ent->irq = ATA_PRIMARY_IRQ; 920 probe_ent->irq = ATA_PRIMARY_IRQ(pdev);
918 probe_ent->port[0].cmd_addr = ATA_PRIMARY_CMD; 921 probe_ent->port[0].cmd_addr = ATA_PRIMARY_CMD;
919 probe_ent->port[0].altstatus_addr = 922 probe_ent->port[0].altstatus_addr =
920 probe_ent->port[0].ctl_addr = ATA_PRIMARY_CTL; 923 probe_ent->port[0].ctl_addr = ATA_PRIMARY_CTL;
921 if (bmdma) { 924 if (bmdma) {
922 probe_ent->port[0].bmdma_addr = bmdma; 925 probe_ent->port[0].bmdma_addr = bmdma;
923 if (inb(bmdma + 2) & 0x80) 926 if ((!(port[0]->flags & ATA_FLAG_IGN_SIMPLEX)) &&
927 (inb(bmdma + 2) & 0x80))
924 probe_ent->_host_flags |= ATA_HOST_SIMPLEX; 928 probe_ent->_host_flags |= ATA_HOST_SIMPLEX;
925 } 929 }
926 ata_std_ports(&probe_ent->port[0]); 930 ata_std_ports(&probe_ent->port[0]);
@@ -929,15 +933,16 @@ static struct ata_probe_ent *ata_pci_init_legacy_port(struct pci_dev *pdev,
929 933
930 if (port_mask & ATA_PORT_SECONDARY) { 934 if (port_mask & ATA_PORT_SECONDARY) {
931 if (probe_ent->irq) 935 if (probe_ent->irq)
932 probe_ent->irq2 = ATA_SECONDARY_IRQ; 936 probe_ent->irq2 = ATA_SECONDARY_IRQ(pdev);
933 else 937 else
934 probe_ent->irq = ATA_SECONDARY_IRQ; 938 probe_ent->irq = ATA_SECONDARY_IRQ(pdev);
935 probe_ent->port[1].cmd_addr = ATA_SECONDARY_CMD; 939 probe_ent->port[1].cmd_addr = ATA_SECONDARY_CMD;
936 probe_ent->port[1].altstatus_addr = 940 probe_ent->port[1].altstatus_addr =
937 probe_ent->port[1].ctl_addr = ATA_SECONDARY_CTL; 941 probe_ent->port[1].ctl_addr = ATA_SECONDARY_CTL;
938 if (bmdma) { 942 if (bmdma) {
939 probe_ent->port[1].bmdma_addr = bmdma + 8; 943 probe_ent->port[1].bmdma_addr = bmdma + 8;
940 if (inb(bmdma + 10) & 0x80) 944 if ((!(port[1]->flags & ATA_FLAG_IGN_SIMPLEX)) &&
945 (inb(bmdma + 10) & 0x80))
941 probe_ent->_host_flags |= ATA_HOST_SIMPLEX; 946 probe_ent->_host_flags |= ATA_HOST_SIMPLEX;
942 } 947 }
943 ata_std_ports(&probe_ent->port[1]); 948 ata_std_ports(&probe_ent->port[1]);
diff --git a/drivers/ata/pata_atiixp.c b/drivers/ata/pata_atiixp.c
index 6f6672c55131..504e1dbfffd7 100644
--- a/drivers/ata/pata_atiixp.c
+++ b/drivers/ata/pata_atiixp.c
@@ -36,15 +36,22 @@ enum {
36static int atiixp_pre_reset(struct ata_port *ap) 36static int atiixp_pre_reset(struct ata_port *ap)
37{ 37{
38 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 38 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
39 static struct pci_bits atiixp_enable_bits[] = { 39 static const struct pci_bits atiixp_enable_bits[] = {
40 { 0x48, 1, 0x01, 0x00 }, 40 { 0x48, 1, 0x01, 0x00 },
41 { 0x48, 1, 0x08, 0x00 } 41 { 0x48, 1, 0x08, 0x00 }
42 }; 42 };
43 u8 udma;
43 44
44 if (!pci_test_config_bits(pdev, &atiixp_enable_bits[ap->port_no])) 45 if (!pci_test_config_bits(pdev, &atiixp_enable_bits[ap->port_no]))
45 return -ENOENT; 46 return -ENOENT;
46 47
47 ap->cbl = ATA_CBL_PATA80; 48 /* Hack from drivers/ide/pci. Really we want to know how to do the
49 raw detection not play follow the bios mode guess */
50 pci_read_config_byte(pdev, ATIIXP_IDE_UDMA_MODE + ap->port_no, &udma);
51 if ((udma & 0x07) >= 0x04 || (udma & 0x70) >= 0x40)
52 ap->cbl = ATA_CBL_PATA80;
53 else
54 ap->cbl = ATA_CBL_PATA40;
48 return ata_std_prereset(ap); 55 return ata_std_prereset(ap);
49} 56}
50 57
diff --git a/drivers/ata/pata_cmd64x.c b/drivers/ata/pata_cmd64x.c
index 15841a563694..449162cbf93e 100644
--- a/drivers/ata/pata_cmd64x.c
+++ b/drivers/ata/pata_cmd64x.c
@@ -197,7 +197,7 @@ static void cmd64x_set_piomode(struct ata_port *ap, struct ata_device *adev)
197static void cmd64x_set_dmamode(struct ata_port *ap, struct ata_device *adev) 197static void cmd64x_set_dmamode(struct ata_port *ap, struct ata_device *adev)
198{ 198{
199 static const u8 udma_data[] = { 199 static const u8 udma_data[] = {
200 0x31, 0x21, 0x11, 0x25, 0x15, 0x05 200 0x30, 0x20, 0x10, 0x20, 0x10, 0x00
201 }; 201 };
202 static const u8 mwdma_data[] = { 202 static const u8 mwdma_data[] = {
203 0x30, 0x20, 0x10 203 0x30, 0x20, 0x10
@@ -213,12 +213,21 @@ static void cmd64x_set_dmamode(struct ata_port *ap, struct ata_device *adev)
213 pci_read_config_byte(pdev, pciD, &regD); 213 pci_read_config_byte(pdev, pciD, &regD);
214 pci_read_config_byte(pdev, pciU, &regU); 214 pci_read_config_byte(pdev, pciU, &regU);
215 215
216 regD &= ~(0x20 << shift); 216 /* DMA bits off */
217 regU &= ~(0x35 << shift); 217 regD &= ~(0x20 << adev->devno);
218 /* DMA control bits */
219 regU &= ~(0x30 << shift);
220 /* DMA timing bits */
221 regU &= ~(0x05 << adev->devno);
218 222
219 if (adev->dma_mode >= XFER_UDMA_0) 223 if (adev->dma_mode >= XFER_UDMA_0) {
224 /* Merge thge timing value */
220 regU |= udma_data[adev->dma_mode - XFER_UDMA_0] << shift; 225 regU |= udma_data[adev->dma_mode - XFER_UDMA_0] << shift;
221 else 226 /* Merge the control bits */
227 regU |= 1 << adev->devno; /* UDMA on */
228 if (adev->dma_mode > 2) /* 15nS timing */
229 regU |= 4 << adev->devno;
230 } else
222 regD |= mwdma_data[adev->dma_mode - XFER_MW_DMA_0] << shift; 231 regD |= mwdma_data[adev->dma_mode - XFER_MW_DMA_0] << shift;
223 232
224 regD |= 0x20 << adev->devno; 233 regD |= 0x20 << adev->devno;
@@ -239,8 +248,8 @@ static void cmd648_bmdma_stop(struct ata_queued_cmd *qc)
239 struct ata_port *ap = qc->ap; 248 struct ata_port *ap = qc->ap;
240 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 249 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
241 u8 dma_intr; 250 u8 dma_intr;
242 int dma_reg = ap->port_no ? ARTTIM23_INTR_CH1 : CFR_INTR_CH0; 251 int dma_mask = ap->port_no ? ARTTIM23_INTR_CH1 : CFR_INTR_CH0;
243 int dma_mask = ap->port_no ? ARTTIM2 : CFR; 252 int dma_reg = ap->port_no ? ARTTIM2 : CFR;
244 253
245 ata_bmdma_stop(qc); 254 ata_bmdma_stop(qc);
246 255
diff --git a/drivers/ata/pata_hpt3x2n.c b/drivers/ata/pata_hpt3x2n.c
index f6817b4093a4..886fab9aa62c 100644
--- a/drivers/ata/pata_hpt3x2n.c
+++ b/drivers/ata/pata_hpt3x2n.c
@@ -25,7 +25,7 @@
25#include <linux/libata.h> 25#include <linux/libata.h>
26 26
27#define DRV_NAME "pata_hpt3x2n" 27#define DRV_NAME "pata_hpt3x2n"
28#define DRV_VERSION "0.3" 28#define DRV_VERSION "0.3.2"
29 29
30enum { 30enum {
31 HPT_PCI_FAST = (1 << 31), 31 HPT_PCI_FAST = (1 << 31),
@@ -297,11 +297,11 @@ static int hpt3x2n_pair_idle(struct ata_port *ap)
297 return 0; 297 return 0;
298} 298}
299 299
300static int hpt3x2n_use_dpll(struct ata_port *ap, int reading) 300static int hpt3x2n_use_dpll(struct ata_port *ap, int writing)
301{ 301{
302 long flags = (long)ap->host->private_data; 302 long flags = (long)ap->host->private_data;
303 /* See if we should use the DPLL */ 303 /* See if we should use the DPLL */
304 if (reading == 0) 304 if (writing)
305 return USE_DPLL; /* Needed for write */ 305 return USE_DPLL; /* Needed for write */
306 if (flags & PCI66) 306 if (flags & PCI66)
307 return USE_DPLL; /* Needed at 66Mhz */ 307 return USE_DPLL; /* Needed at 66Mhz */
diff --git a/drivers/ata/pata_it821x.c b/drivers/ata/pata_it821x.c
index 0b56ff3d1cfe..e8afd486434a 100644
--- a/drivers/ata/pata_it821x.c
+++ b/drivers/ata/pata_it821x.c
@@ -476,6 +476,7 @@ static unsigned int it821x_passthru_qc_issue_prot(struct ata_queued_cmd *qc)
476/** 476/**
477 * it821x_smart_set_mode - mode setting 477 * it821x_smart_set_mode - mode setting
478 * @ap: interface to set up 478 * @ap: interface to set up
479 * @unused: device that failed (error only)
479 * 480 *
480 * Use a non standard set_mode function. We don't want to be tuned. 481 * Use a non standard set_mode function. We don't want to be tuned.
481 * The BIOS configured everything. Our job is not to fiddle. We 482 * The BIOS configured everything. Our job is not to fiddle. We
@@ -483,7 +484,7 @@ static unsigned int it821x_passthru_qc_issue_prot(struct ata_queued_cmd *qc)
483 * and respect them. 484 * and respect them.
484 */ 485 */
485 486
486static void it821x_smart_set_mode(struct ata_port *ap) 487static int it821x_smart_set_mode(struct ata_port *ap, struct ata_device **unused)
487{ 488{
488 int dma_enabled = 0; 489 int dma_enabled = 0;
489 int i; 490 int i;
@@ -512,6 +513,7 @@ static void it821x_smart_set_mode(struct ata_port *ap)
512 } 513 }
513 } 514 }
514 } 515 }
516 return 0;
515} 517}
516 518
517/** 519/**
diff --git a/drivers/ata/pata_ixp4xx_cf.c b/drivers/ata/pata_ixp4xx_cf.c
index cb8924109f59..23b8aab3ebd8 100644
--- a/drivers/ata/pata_ixp4xx_cf.c
+++ b/drivers/ata/pata_ixp4xx_cf.c
@@ -23,9 +23,9 @@
23#include <scsi/scsi_host.h> 23#include <scsi/scsi_host.h>
24 24
25#define DRV_NAME "pata_ixp4xx_cf" 25#define DRV_NAME "pata_ixp4xx_cf"
26#define DRV_VERSION "0.1.1" 26#define DRV_VERSION "0.1.1ac1"
27 27
28static void ixp4xx_set_mode(struct ata_port *ap) 28static int ixp4xx_set_mode(struct ata_port *ap, struct ata_device *adev)
29{ 29{
30 int i; 30 int i;
31 31
@@ -38,6 +38,7 @@ static void ixp4xx_set_mode(struct ata_port *ap)
38 dev->flags |= ATA_DFLAG_PIO; 38 dev->flags |= ATA_DFLAG_PIO;
39 } 39 }
40 } 40 }
41 return 0;
41} 42}
42 43
43static void ixp4xx_phy_reset(struct ata_port *ap) 44static void ixp4xx_phy_reset(struct ata_port *ap)
diff --git a/drivers/ata/pata_jmicron.c b/drivers/ata/pata_jmicron.c
index 2d661cb4df3c..d50264af2848 100644
--- a/drivers/ata/pata_jmicron.c
+++ b/drivers/ata/pata_jmicron.c
@@ -204,20 +204,12 @@ static int jmicron_init_one (struct pci_dev *pdev, const struct pci_device_id *i
204 204
205 u32 reg; 205 u32 reg;
206 206
207 if (id->driver_data != 368) { 207 /* PATA controller is fn 1, AHCI is fn 0 */
208 /* Put the controller into AHCI mode in case the AHCI driver 208 if (id->driver_data != 368 && PCI_FUNC(pdev->devfn) != 1)
209 has not yet been loaded. This can be done with either 209 return -ENODEV;
210 function present */
211 210
212 /* FIXME: We may want a way to override this in future */ 211 /* The 365/66 have two PATA channels, redirect the second */
213 pci_write_config_byte(pdev, 0x41, 0xa1); 212 if (id->driver_data == 365 || id->driver_data == 366) {
214
215 /* PATA controller is fn 1, AHCI is fn 0 */
216 if (PCI_FUNC(pdev->devfn) != 1)
217 return -ENODEV;
218 }
219 if ( id->driver_data == 365 || id->driver_data == 366) {
220 /* The 365/66 have two PATA channels, redirect the second */
221 pci_read_config_dword(pdev, 0x80, &reg); 213 pci_read_config_dword(pdev, 0x80, &reg);
222 reg |= (1 << 24); /* IDE1 to PATA IDE secondary */ 214 reg |= (1 << 24); /* IDE1 to PATA IDE secondary */
223 pci_write_config_dword(pdev, 0x80, reg); 215 pci_write_config_dword(pdev, 0x80, reg);
diff --git a/drivers/ata/pata_legacy.c b/drivers/ata/pata_legacy.c
index e7bf9d89c8ee..581cb33c6f45 100644
--- a/drivers/ata/pata_legacy.c
+++ b/drivers/ata/pata_legacy.c
@@ -96,6 +96,7 @@ static int pio_mask = 0x1F; /* PIO range for autospeed devices */
96/** 96/**
97 * legacy_set_mode - mode setting 97 * legacy_set_mode - mode setting
98 * @ap: IDE interface 98 * @ap: IDE interface
99 * @unused: Device that failed when error is returned
99 * 100 *
100 * Use a non standard set_mode function. We don't want to be tuned. 101 * Use a non standard set_mode function. We don't want to be tuned.
101 * 102 *
@@ -105,7 +106,7 @@ static int pio_mask = 0x1F; /* PIO range for autospeed devices */
105 * expand on this as per hdparm in the base kernel. 106 * expand on this as per hdparm in the base kernel.
106 */ 107 */
107 108
108static void legacy_set_mode(struct ata_port *ap) 109static int legacy_set_mode(struct ata_port *ap, struct ata_device **unused)
109{ 110{
110 int i; 111 int i;
111 112
@@ -118,6 +119,7 @@ static void legacy_set_mode(struct ata_port *ap)
118 dev->flags |= ATA_DFLAG_PIO; 119 dev->flags |= ATA_DFLAG_PIO;
119 } 120 }
120 } 121 }
122 return 0;
121} 123}
122 124
123static struct scsi_host_template legacy_sht = { 125static struct scsi_host_template legacy_sht = {
diff --git a/drivers/ata/pata_platform.c b/drivers/ata/pata_platform.c
index 443b1d85c6c4..40ae11cbfda4 100644
--- a/drivers/ata/pata_platform.c
+++ b/drivers/ata/pata_platform.c
@@ -30,7 +30,7 @@ static int pio_mask = 1;
30 * Provide our own set_mode() as we don't want to change anything that has 30 * Provide our own set_mode() as we don't want to change anything that has
31 * already been configured.. 31 * already been configured..
32 */ 32 */
33static void pata_platform_set_mode(struct ata_port *ap) 33static int pata_platform_set_mode(struct ata_port *ap, struct ata_device **unused)
34{ 34{
35 int i; 35 int i;
36 36
@@ -44,6 +44,7 @@ static void pata_platform_set_mode(struct ata_port *ap)
44 dev->flags |= ATA_DFLAG_PIO; 44 dev->flags |= ATA_DFLAG_PIO;
45 } 45 }
46 } 46 }
47 return 0;
47} 48}
48 49
49static void pata_platform_host_stop(struct ata_host *host) 50static void pata_platform_host_stop(struct ata_host *host)
diff --git a/drivers/ata/pata_rz1000.c b/drivers/ata/pata_rz1000.c
index adf4cc134f25..cec0729225e1 100644
--- a/drivers/ata/pata_rz1000.c
+++ b/drivers/ata/pata_rz1000.c
@@ -52,19 +52,20 @@ static void rz1000_error_handler(struct ata_port *ap)
52/** 52/**
53 * rz1000_set_mode - mode setting function 53 * rz1000_set_mode - mode setting function
54 * @ap: ATA interface 54 * @ap: ATA interface
55 * @unused: returned device on set_mode failure
55 * 56 *
56 * Use a non standard set_mode function. We don't want to be tuned. We 57 * Use a non standard set_mode function. We don't want to be tuned. We
57 * would prefer to be BIOS generic but for the fact our hardware is 58 * would prefer to be BIOS generic but for the fact our hardware is
58 * whacked out. 59 * whacked out.
59 */ 60 */
60 61
61static void rz1000_set_mode(struct ata_port *ap) 62static int rz1000_set_mode(struct ata_port *ap, struct ata_device **unused)
62{ 63{
63 int i; 64 int i;
64 65
65 for (i = 0; i < ATA_MAX_DEVICES; i++) { 66 for (i = 0; i < ATA_MAX_DEVICES; i++) {
66 struct ata_device *dev = &ap->device[i]; 67 struct ata_device *dev = &ap->device[i];
67 if (ata_dev_enabled(dev)) { 68 if (ata_dev_ready(dev)) {
68 /* We don't really care */ 69 /* We don't really care */
69 dev->pio_mode = XFER_PIO_0; 70 dev->pio_mode = XFER_PIO_0;
70 dev->xfer_mode = XFER_PIO_0; 71 dev->xfer_mode = XFER_PIO_0;
@@ -72,6 +73,7 @@ static void rz1000_set_mode(struct ata_port *ap)
72 dev->flags |= ATA_DFLAG_PIO; 73 dev->flags |= ATA_DFLAG_PIO;
73 } 74 }
74 } 75 }
76 return 0;
75} 77}
76 78
77 79
diff --git a/drivers/ata/pata_sil680.c b/drivers/ata/pata_sil680.c
index 32cf0bfa8921..e8dfd8fc3ff7 100644
--- a/drivers/ata/pata_sil680.c
+++ b/drivers/ata/pata_sil680.c
@@ -135,7 +135,7 @@ static void sil680_error_handler(struct ata_port *ap)
135static void sil680_set_piomode(struct ata_port *ap, struct ata_device *adev) 135static void sil680_set_piomode(struct ata_port *ap, struct ata_device *adev)
136{ 136{
137 static u16 speed_p[5] = { 0x328A, 0x2283, 0x1104, 0x10C3, 0x10C1 }; 137 static u16 speed_p[5] = { 0x328A, 0x2283, 0x1104, 0x10C3, 0x10C1 };
138 static u16 speed_t[5] = { 0x328A, 0x1281, 0x1281, 0x10C3, 0x10C1 }; 138 static u16 speed_t[5] = { 0x328A, 0x2283, 0x1281, 0x10C3, 0x10C1 };
139 139
140 unsigned long tfaddr = sil680_selreg(ap, 0x02); 140 unsigned long tfaddr = sil680_selreg(ap, 0x02);
141 unsigned long addr = sil680_seldev(ap, adev, 0x04); 141 unsigned long addr = sil680_seldev(ap, adev, 0x04);
diff --git a/drivers/ata/pata_via.c b/drivers/ata/pata_via.c
index f0d4f7e9ed31..f0b6c3b71429 100644
--- a/drivers/ata/pata_via.c
+++ b/drivers/ata/pata_via.c
@@ -23,6 +23,7 @@
23 * VIA VT8233c - UDMA100 23 * VIA VT8233c - UDMA100
24 * VIA VT8235 - UDMA133 24 * VIA VT8235 - UDMA133
25 * VIA VT8237 - UDMA133 25 * VIA VT8237 - UDMA133
26 * VIA VT8237S - UDMA133
26 * VIA VT8251 - UDMA133 27 * VIA VT8251 - UDMA133
27 * 28 *
28 * Most registers remain compatible across chips. Others start reserved 29 * Most registers remain compatible across chips. Others start reserved
@@ -61,7 +62,7 @@
61#include <linux/libata.h> 62#include <linux/libata.h>
62 63
63#define DRV_NAME "pata_via" 64#define DRV_NAME "pata_via"
64#define DRV_VERSION "0.2.0" 65#define DRV_VERSION "0.2.1"
65 66
66/* 67/*
67 * The following comes directly from Vojtech Pavlik's ide/pci/via82cxxx 68 * The following comes directly from Vojtech Pavlik's ide/pci/via82cxxx
@@ -95,6 +96,7 @@ static const struct via_isa_bridge {
95 u8 rev_max; 96 u8 rev_max;
96 u16 flags; 97 u16 flags;
97} via_isa_bridges[] = { 98} via_isa_bridges[] = {
99 { "vt8237s", PCI_DEVICE_ID_VIA_8237S, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST },
98 { "vt8251", PCI_DEVICE_ID_VIA_8251, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, 100 { "vt8251", PCI_DEVICE_ID_VIA_8251, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST },
99 { "cx700", PCI_DEVICE_ID_VIA_CX700, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, 101 { "cx700", PCI_DEVICE_ID_VIA_CX700, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST },
100 { "vt6410", PCI_DEVICE_ID_VIA_6410, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST | VIA_NO_ENABLES}, 102 { "vt6410", PCI_DEVICE_ID_VIA_6410, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST | VIA_NO_ENABLES},
diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c
index f6d498e1cf80..f7a963eb1f02 100644
--- a/drivers/ata/sata_nv.c
+++ b/drivers/ata/sata_nv.c
@@ -700,7 +700,6 @@ static void nv_adma_check_cpb(struct ata_port *ap, int cpb_num, int force_err)
700static int nv_host_intr(struct ata_port *ap, u8 irq_stat) 700static int nv_host_intr(struct ata_port *ap, u8 irq_stat)
701{ 701{
702 struct ata_queued_cmd *qc = ata_qc_from_tag(ap, ap->active_tag); 702 struct ata_queued_cmd *qc = ata_qc_from_tag(ap, ap->active_tag);
703 int handled;
704 703
705 /* freeze if hotplugged */ 704 /* freeze if hotplugged */
706 if (unlikely(irq_stat & (NV_INT_ADDED | NV_INT_REMOVED))) { 705 if (unlikely(irq_stat & (NV_INT_ADDED | NV_INT_REMOVED))) {
@@ -719,13 +718,7 @@ static int nv_host_intr(struct ata_port *ap, u8 irq_stat)
719 } 718 }
720 719
721 /* handle interrupt */ 720 /* handle interrupt */
722 handled = ata_host_intr(ap, qc); 721 return ata_host_intr(ap, qc);
723 if (unlikely(!handled)) {
724 /* spurious, clear it */
725 ata_check_status(ap);
726 }
727
728 return 1;
729} 722}
730 723
731static irqreturn_t nv_adma_interrupt(int irq, void *dev_instance) 724static irqreturn_t nv_adma_interrupt(int irq, void *dev_instance)
@@ -752,6 +745,11 @@ static irqreturn_t nv_adma_interrupt(int irq, void *dev_instance)
752 if (pp->flags & NV_ADMA_PORT_REGISTER_MODE) { 745 if (pp->flags & NV_ADMA_PORT_REGISTER_MODE) {
753 u8 irq_stat = readb(host->mmio_base + NV_INT_STATUS_CK804) 746 u8 irq_stat = readb(host->mmio_base + NV_INT_STATUS_CK804)
754 >> (NV_INT_PORT_SHIFT * i); 747 >> (NV_INT_PORT_SHIFT * i);
748 if(ata_tag_valid(ap->active_tag))
749 /** NV_INT_DEV indication seems unreliable at times
750 at least in ADMA mode. Force it on always when a
751 command is active, to prevent losing interrupts. */
752 irq_stat |= NV_INT_DEV;
755 handled += nv_host_intr(ap, irq_stat); 753 handled += nv_host_intr(ap, irq_stat);
756 continue; 754 continue;
757 } 755 }
diff --git a/drivers/ata/sata_uli.c b/drivers/ata/sata_uli.c
index 5c603ca3a50a..a43aec62d505 100644
--- a/drivers/ata/sata_uli.c
+++ b/drivers/ata/sata_uli.c
@@ -128,7 +128,8 @@ static const struct ata_port_operations uli_ops = {
128 128
129static struct ata_port_info uli_port_info = { 129static struct ata_port_info uli_port_info = {
130 .sht = &uli_sht, 130 .sht = &uli_sht,
131 .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY, 131 .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
132 ATA_FLAG_IGN_SIMPLEX,
132 .pio_mask = 0x1f, /* pio0-4 */ 133 .pio_mask = 0x1f, /* pio0-4 */
133 .udma_mask = 0x7f, /* udma0-6 */ 134 .udma_mask = 0x7f, /* udma0-6 */
134 .port_ops = &uli_ops, 135 .port_ops = &uli_ops,
diff --git a/drivers/ata/sata_via.c b/drivers/ata/sata_via.c
index 88f0565c8883..d3d5c0d57032 100644
--- a/drivers/ata/sata_via.c
+++ b/drivers/ata/sata_via.c
@@ -74,6 +74,7 @@ enum {
74static int svia_init_one (struct pci_dev *pdev, const struct pci_device_id *ent); 74static int svia_init_one (struct pci_dev *pdev, const struct pci_device_id *ent);
75static u32 svia_scr_read (struct ata_port *ap, unsigned int sc_reg); 75static u32 svia_scr_read (struct ata_port *ap, unsigned int sc_reg);
76static void svia_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val); 76static void svia_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val);
77static void svia_noop_freeze(struct ata_port *ap);
77static void vt6420_error_handler(struct ata_port *ap); 78static void vt6420_error_handler(struct ata_port *ap);
78 79
79static const struct pci_device_id svia_pci_tbl[] = { 80static const struct pci_device_id svia_pci_tbl[] = {
@@ -128,7 +129,7 @@ static const struct ata_port_operations vt6420_sata_ops = {
128 .qc_issue = ata_qc_issue_prot, 129 .qc_issue = ata_qc_issue_prot,
129 .data_xfer = ata_pio_data_xfer, 130 .data_xfer = ata_pio_data_xfer,
130 131
131 .freeze = ata_bmdma_freeze, 132 .freeze = svia_noop_freeze,
132 .thaw = ata_bmdma_thaw, 133 .thaw = ata_bmdma_thaw,
133 .error_handler = vt6420_error_handler, 134 .error_handler = vt6420_error_handler,
134 .post_internal_cmd = ata_bmdma_post_internal_cmd, 135 .post_internal_cmd = ata_bmdma_post_internal_cmd,
@@ -204,6 +205,15 @@ static void svia_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val)
204 outl(val, ap->ioaddr.scr_addr + (4 * sc_reg)); 205 outl(val, ap->ioaddr.scr_addr + (4 * sc_reg));
205} 206}
206 207
208static void svia_noop_freeze(struct ata_port *ap)
209{
210 /* Some VIA controllers choke if ATA_NIEN is manipulated in
211 * certain way. Leave it alone and just clear pending IRQ.
212 */
213 ata_chk_status(ap);
214 ata_bmdma_irq_clear(ap);
215}
216
207/** 217/**
208 * vt6420_prereset - prereset for vt6420 218 * vt6420_prereset - prereset for vt6420
209 * @ap: target ATA port 219 * @ap: target ATA port
diff --git a/drivers/atm/horizon.c b/drivers/atm/horizon.c
index 4dc10105d610..f96446c358ba 100644
--- a/drivers/atm/horizon.c
+++ b/drivers/atm/horizon.c
@@ -1845,7 +1845,7 @@ static u16 __devinit read_bia (const hrz_dev * dev, u16 addr)
1845 1845
1846/********** initialise a card **********/ 1846/********** initialise a card **********/
1847 1847
1848static int __init hrz_init (hrz_dev * dev) { 1848static int __devinit hrz_init (hrz_dev * dev) {
1849 int onefivefive; 1849 int onefivefive;
1850 1850
1851 u16 chan; 1851 u16 chan;
diff --git a/drivers/char/agp/amd-k7-agp.c b/drivers/char/agp/amd-k7-agp.c
index 51d0d562d01e..c85c8cadb6df 100644
--- a/drivers/char/agp/amd-k7-agp.c
+++ b/drivers/char/agp/amd-k7-agp.c
@@ -101,6 +101,11 @@ static int amd_create_gatt_pages(int nr_tables)
101 for (i = 0; i < nr_tables; i++) { 101 for (i = 0; i < nr_tables; i++) {
102 entry = kzalloc(sizeof(struct amd_page_map), GFP_KERNEL); 102 entry = kzalloc(sizeof(struct amd_page_map), GFP_KERNEL);
103 if (entry == NULL) { 103 if (entry == NULL) {
104 while (i > 0) {
105 kfree(tables[i-1]);
106 i--;
107 }
108 kfree(tables);
104 retval = -ENOMEM; 109 retval = -ENOMEM;
105 break; 110 break;
106 } 111 }
diff --git a/drivers/char/agp/amd64-agp.c b/drivers/char/agp/amd64-agp.c
index 979300405c0e..93d2209fee4c 100644
--- a/drivers/char/agp/amd64-agp.c
+++ b/drivers/char/agp/amd64-agp.c
@@ -655,7 +655,7 @@ static struct pci_device_id agp_amd64_pci_table[] = {
655 .class = (PCI_CLASS_BRIDGE_HOST << 8), 655 .class = (PCI_CLASS_BRIDGE_HOST << 8),
656 .class_mask = ~0, 656 .class_mask = ~0,
657 .vendor = PCI_VENDOR_ID_VIA, 657 .vendor = PCI_VENDOR_ID_VIA,
658 .device = PCI_DEVICE_ID_VIA_K8M890CE, 658 .device = PCI_DEVICE_ID_VIA_VT3336,
659 .subvendor = PCI_ANY_ID, 659 .subvendor = PCI_ANY_ID,
660 .subdevice = PCI_ANY_ID, 660 .subdevice = PCI_ANY_ID,
661 }, 661 },
diff --git a/drivers/char/agp/ati-agp.c b/drivers/char/agp/ati-agp.c
index f244c6682738..9987dc2e0c3f 100644
--- a/drivers/char/agp/ati-agp.c
+++ b/drivers/char/agp/ati-agp.c
@@ -41,18 +41,18 @@ static struct gatt_mask ati_generic_masks[] =
41}; 41};
42 42
43 43
44typedef struct _ati_page_map { 44struct ati_page_map {
45 unsigned long *real; 45 unsigned long *real;
46 unsigned long __iomem *remapped; 46 unsigned long __iomem *remapped;
47} ati_page_map; 47};
48 48
49static struct _ati_generic_private { 49static struct _ati_generic_private {
50 volatile u8 __iomem *registers; 50 volatile u8 __iomem *registers;
51 ati_page_map **gatt_pages; 51 struct ati_page_map **gatt_pages;
52 int num_tables; 52 int num_tables;
53} ati_generic_private; 53} ati_generic_private;
54 54
55static int ati_create_page_map(ati_page_map *page_map) 55static int ati_create_page_map(struct ati_page_map *page_map)
56{ 56{
57 int i, err = 0; 57 int i, err = 0;
58 58
@@ -82,7 +82,7 @@ static int ati_create_page_map(ati_page_map *page_map)
82} 82}
83 83
84 84
85static void ati_free_page_map(ati_page_map *page_map) 85static void ati_free_page_map(struct ati_page_map *page_map)
86{ 86{
87 unmap_page_from_agp(virt_to_page(page_map->real)); 87 unmap_page_from_agp(virt_to_page(page_map->real));
88 iounmap(page_map->remapped); 88 iounmap(page_map->remapped);
@@ -94,8 +94,8 @@ static void ati_free_page_map(ati_page_map *page_map)
94static void ati_free_gatt_pages(void) 94static void ati_free_gatt_pages(void)
95{ 95{
96 int i; 96 int i;
97 ati_page_map **tables; 97 struct ati_page_map **tables;
98 ati_page_map *entry; 98 struct ati_page_map *entry;
99 99
100 tables = ati_generic_private.gatt_pages; 100 tables = ati_generic_private.gatt_pages;
101 for (i = 0; i < ati_generic_private.num_tables; i++) { 101 for (i = 0; i < ati_generic_private.num_tables; i++) {
@@ -112,30 +112,30 @@ static void ati_free_gatt_pages(void)
112 112
113static int ati_create_gatt_pages(int nr_tables) 113static int ati_create_gatt_pages(int nr_tables)
114{ 114{
115 ati_page_map **tables; 115 struct ati_page_map **tables;
116 ati_page_map *entry; 116 struct ati_page_map *entry;
117 int retval = 0; 117 int retval = 0;
118 int i; 118 int i;
119 119
120 tables = kzalloc((nr_tables + 1) * sizeof(ati_page_map *),GFP_KERNEL); 120 tables = kzalloc((nr_tables + 1) * sizeof(struct ati_page_map *),GFP_KERNEL);
121 if (tables == NULL) 121 if (tables == NULL)
122 return -ENOMEM; 122 return -ENOMEM;
123 123
124 for (i = 0; i < nr_tables; i++) { 124 for (i = 0; i < nr_tables; i++) {
125 entry = kzalloc(sizeof(ati_page_map), GFP_KERNEL); 125 entry = kzalloc(sizeof(struct ati_page_map), GFP_KERNEL);
126 if (entry == NULL) { 126 if (entry == NULL) {
127 while (i>0) { 127 while (i > 0) {
128 kfree (tables[i-1]); 128 kfree(tables[i-1]);
129 i--; 129 i--;
130 } 130 }
131 kfree (tables); 131 kfree(tables);
132 tables = NULL;
133 retval = -ENOMEM; 132 retval = -ENOMEM;
134 break; 133 break;
135 } 134 }
136 tables[i] = entry; 135 tables[i] = entry;
137 retval = ati_create_page_map(entry); 136 retval = ati_create_page_map(entry);
138 if (retval != 0) break; 137 if (retval != 0)
138 break;
139 } 139 }
140 ati_generic_private.num_tables = nr_tables; 140 ati_generic_private.num_tables = nr_tables;
141 ati_generic_private.gatt_pages = tables; 141 ati_generic_private.gatt_pages = tables;
@@ -340,7 +340,7 @@ static int ati_remove_memory(struct agp_memory * mem, off_t pg_start,
340static int ati_create_gatt_table(struct agp_bridge_data *bridge) 340static int ati_create_gatt_table(struct agp_bridge_data *bridge)
341{ 341{
342 struct aper_size_info_lvl2 *value; 342 struct aper_size_info_lvl2 *value;
343 ati_page_map page_dir; 343 struct ati_page_map page_dir;
344 unsigned long addr; 344 unsigned long addr;
345 int retval; 345 int retval;
346 u32 temp; 346 u32 temp;
@@ -400,7 +400,7 @@ static int ati_create_gatt_table(struct agp_bridge_data *bridge)
400 400
401static int ati_free_gatt_table(struct agp_bridge_data *bridge) 401static int ati_free_gatt_table(struct agp_bridge_data *bridge)
402{ 402{
403 ati_page_map page_dir; 403 struct ati_page_map page_dir;
404 404
405 page_dir.real = (unsigned long *)agp_bridge->gatt_table_real; 405 page_dir.real = (unsigned long *)agp_bridge->gatt_table_real;
406 page_dir.remapped = (unsigned long __iomem *)agp_bridge->gatt_table; 406 page_dir.remapped = (unsigned long __iomem *)agp_bridge->gatt_table;
diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c
index ab0a9c0ad7c0..a3011de51f7c 100644
--- a/drivers/char/agp/intel-agp.c
+++ b/drivers/char/agp/intel-agp.c
@@ -1955,6 +1955,15 @@ static int agp_intel_resume(struct pci_dev *pdev)
1955 1955
1956 pci_restore_state(pdev); 1956 pci_restore_state(pdev);
1957 1957
1958 /* We should restore our graphics device's config space,
1959 * as host bridge (00:00) resumes before graphics device (02:00),
1960 * then our access to its pci space can work right.
1961 */
1962 if (intel_i810_private.i810_dev)
1963 pci_restore_state(intel_i810_private.i810_dev);
1964 if (intel_i830_private.i830_dev)
1965 pci_restore_state(intel_i830_private.i830_dev);
1966
1958 if (bridge->driver == &intel_generic_driver) 1967 if (bridge->driver == &intel_generic_driver)
1959 intel_configure(); 1968 intel_configure();
1960 else if (bridge->driver == &intel_850_driver) 1969 else if (bridge->driver == &intel_850_driver)
diff --git a/drivers/char/agp/via-agp.c b/drivers/char/agp/via-agp.c
index c149ac9ce9a7..2ded7a280d7f 100644
--- a/drivers/char/agp/via-agp.c
+++ b/drivers/char/agp/via-agp.c
@@ -380,9 +380,23 @@ static struct agp_device_ids via_agp_device_ids[] __devinitdata =
380 /* P4M800CE */ 380 /* P4M800CE */
381 { 381 {
382 .device_id = PCI_DEVICE_ID_VIA_P4M800CE, 382 .device_id = PCI_DEVICE_ID_VIA_P4M800CE,
383 .chipset_name = "P4M800CE", 383 .chipset_name = "VT3314",
384 },
385 /* CX700 */
386 {
387 .device_id = PCI_DEVICE_ID_VIA_CX700,
388 .chipset_name = "CX700",
389 },
390 /* VT3336 */
391 {
392 .device_id = PCI_DEVICE_ID_VIA_VT3336,
393 .chipset_name = "VT3336",
394 },
395 /* P4M890 */
396 {
397 .device_id = PCI_DEVICE_ID_VIA_P4M890,
398 .chipset_name = "P4M890",
384 }, 399 },
385
386 { }, /* dummy final entry, always present */ 400 { }, /* dummy final entry, always present */
387}; 401};
388 402
@@ -524,6 +538,9 @@ static const struct pci_device_id agp_via_pci_table[] = {
524 ID(PCI_DEVICE_ID_VIA_83_87XX_1), 538 ID(PCI_DEVICE_ID_VIA_83_87XX_1),
525 ID(PCI_DEVICE_ID_VIA_3296_0), 539 ID(PCI_DEVICE_ID_VIA_3296_0),
526 ID(PCI_DEVICE_ID_VIA_P4M800CE), 540 ID(PCI_DEVICE_ID_VIA_P4M800CE),
541 ID(PCI_DEVICE_ID_VIA_CX700),
542 ID(PCI_DEVICE_ID_VIA_VT3336),
543 ID(PCI_DEVICE_ID_VIA_P4M890),
527 { } 544 { }
528}; 545};
529 546
diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c
index 4e4691a53890..53582b53da95 100644
--- a/drivers/char/ipmi/ipmi_msghandler.c
+++ b/drivers/char/ipmi/ipmi_msghandler.c
@@ -3649,8 +3649,6 @@ static void ipmi_timeout_handler(long timeout_period)
3649 unsigned long flags; 3649 unsigned long flags;
3650 int i; 3650 int i;
3651 3651
3652 INIT_LIST_HEAD(&timeouts);
3653
3654 rcu_read_lock(); 3652 rcu_read_lock();
3655 list_for_each_entry_rcu(intf, &ipmi_interfaces, link) { 3653 list_for_each_entry_rcu(intf, &ipmi_interfaces, link) {
3656 /* See if any waiting messages need to be processed. */ 3654 /* See if any waiting messages need to be processed. */
@@ -3671,6 +3669,7 @@ static void ipmi_timeout_handler(long timeout_period)
3671 /* Go through the seq table and find any messages that 3669 /* Go through the seq table and find any messages that
3672 have timed out, putting them in the timeouts 3670 have timed out, putting them in the timeouts
3673 list. */ 3671 list. */
3672 INIT_LIST_HEAD(&timeouts);
3674 spin_lock_irqsave(&intf->seq_lock, flags); 3673 spin_lock_irqsave(&intf->seq_lock, flags);
3675 for (i = 0; i < IPMI_IPMB_NUM_SEQ; i++) 3674 for (i = 0; i < IPMI_IPMB_NUM_SEQ; i++)
3676 check_msg_timeout(intf, &(intf->seq_table[i]), 3675 check_msg_timeout(intf, &(intf->seq_table[i]),
diff --git a/drivers/char/sysrq.c b/drivers/char/sysrq.c
index 13935235e066..7fd3cd5ddf21 100644
--- a/drivers/char/sysrq.c
+++ b/drivers/char/sysrq.c
@@ -215,7 +215,7 @@ static void sysrq_handle_showstate_blocked(int key, struct tty_struct *tty)
215} 215}
216static struct sysrq_key_op sysrq_showstate_blocked_op = { 216static struct sysrq_key_op sysrq_showstate_blocked_op = {
217 .handler = sysrq_handle_showstate_blocked, 217 .handler = sysrq_handle_showstate_blocked,
218 .help_msg = "showBlockedTasks", 218 .help_msg = "shoW-blocked-tasks",
219 .action_msg = "Show Blocked State", 219 .action_msg = "Show Blocked State",
220 .enable_mask = SYSRQ_ENABLE_DUMP, 220 .enable_mask = SYSRQ_ENABLE_DUMP,
221}; 221};
@@ -315,15 +315,16 @@ static struct sysrq_key_op *sysrq_key_table[36] = {
315 &sysrq_loglevel_op, /* 9 */ 315 &sysrq_loglevel_op, /* 9 */
316 316
317 /* 317 /*
318 * Don't use for system provided sysrqs, it is handled specially on 318 * a: Don't use for system provided sysrqs, it is handled specially on
319 * sparc and will never arrive 319 * sparc and will never arrive.
320 */ 320 */
321 NULL, /* a */ 321 NULL, /* a */
322 &sysrq_reboot_op, /* b */ 322 &sysrq_reboot_op, /* b */
323 &sysrq_crashdump_op, /* c */ 323 &sysrq_crashdump_op, /* c & ibm_emac driver debug */
324 &sysrq_showlocks_op, /* d */ 324 &sysrq_showlocks_op, /* d */
325 &sysrq_term_op, /* e */ 325 &sysrq_term_op, /* e */
326 &sysrq_moom_op, /* f */ 326 &sysrq_moom_op, /* f */
327 /* g: May be registered by ppc for kgdb */
327 NULL, /* g */ 328 NULL, /* g */
328 NULL, /* h */ 329 NULL, /* h */
329 &sysrq_kill_op, /* i */ 330 &sysrq_kill_op, /* i */
@@ -332,18 +333,19 @@ static struct sysrq_key_op *sysrq_key_table[36] = {
332 NULL, /* l */ 333 NULL, /* l */
333 &sysrq_showmem_op, /* m */ 334 &sysrq_showmem_op, /* m */
334 &sysrq_unrt_op, /* n */ 335 &sysrq_unrt_op, /* n */
335 /* This will often be registered as 'Off' at init time */ 336 /* o: This will often be registered as 'Off' at init time */
336 NULL, /* o */ 337 NULL, /* o */
337 &sysrq_showregs_op, /* p */ 338 &sysrq_showregs_op, /* p */
338 NULL, /* q */ 339 NULL, /* q */
339 &sysrq_unraw_op, /* r */ 340 &sysrq_unraw_op, /* r */
340 &sysrq_sync_op, /* s */ 341 &sysrq_sync_op, /* s */
341 &sysrq_showstate_op, /* t */ 342 &sysrq_showstate_op, /* t */
342 &sysrq_mountro_op, /* u */ 343 &sysrq_mountro_op, /* u */
343 /* May be assigned at init time by SMP VOYAGER */ 344 /* v: May be registered at init time by SMP VOYAGER */
344 NULL, /* v */ 345 NULL, /* v */
345 NULL, /* w */ 346 &sysrq_showstate_blocked_op, /* w */
346 &sysrq_showstate_blocked_op, /* x */ 347 /* x: May be registered on ppc/powerpc for xmon */
348 NULL, /* x */
347 NULL, /* y */ 349 NULL, /* y */
348 NULL /* z */ 350 NULL /* z */
349}; 351};
diff --git a/drivers/char/tlclk.c b/drivers/char/tlclk.c
index 448d5083c381..4fac2bdf6215 100644
--- a/drivers/char/tlclk.c
+++ b/drivers/char/tlclk.c
@@ -186,6 +186,7 @@ static int got_event; /* if events processing have been done */
186static void switchover_timeout(unsigned long data); 186static void switchover_timeout(unsigned long data);
187static struct timer_list switchover_timer = 187static struct timer_list switchover_timer =
188 TIMER_INITIALIZER(switchover_timeout , 0, 0); 188 TIMER_INITIALIZER(switchover_timeout , 0, 0);
189static unsigned long tlclk_timer_data;
189 190
190static struct tlclk_alarms *alarm_events; 191static struct tlclk_alarms *alarm_events;
191 192
@@ -197,10 +198,19 @@ static irqreturn_t tlclk_interrupt(int irq, void *dev_id);
197 198
198static DECLARE_WAIT_QUEUE_HEAD(wq); 199static DECLARE_WAIT_QUEUE_HEAD(wq);
199 200
201static unsigned long useflags;
202static DEFINE_MUTEX(tlclk_mutex);
203
200static int tlclk_open(struct inode *inode, struct file *filp) 204static int tlclk_open(struct inode *inode, struct file *filp)
201{ 205{
202 int result; 206 int result;
203 207
208 if (test_and_set_bit(0, &useflags))
209 return -EBUSY;
210 /* this legacy device is always one per system and it doesn't
211 * know how to handle multiple concurrent clients.
212 */
213
204 /* Make sure there is no interrupt pending while 214 /* Make sure there is no interrupt pending while
205 * initialising interrupt handler */ 215 * initialising interrupt handler */
206 inb(TLCLK_REG6); 216 inb(TLCLK_REG6);
@@ -221,6 +231,7 @@ static int tlclk_open(struct inode *inode, struct file *filp)
221static int tlclk_release(struct inode *inode, struct file *filp) 231static int tlclk_release(struct inode *inode, struct file *filp)
222{ 232{
223 free_irq(telclk_interrupt, tlclk_interrupt); 233 free_irq(telclk_interrupt, tlclk_interrupt);
234 clear_bit(0, &useflags);
224 235
225 return 0; 236 return 0;
226} 237}
@@ -230,26 +241,25 @@ static ssize_t tlclk_read(struct file *filp, char __user *buf, size_t count,
230{ 241{
231 if (count < sizeof(struct tlclk_alarms)) 242 if (count < sizeof(struct tlclk_alarms))
232 return -EIO; 243 return -EIO;
244 if (mutex_lock_interruptible(&tlclk_mutex))
245 return -EINTR;
246
233 247
234 wait_event_interruptible(wq, got_event); 248 wait_event_interruptible(wq, got_event);
235 if (copy_to_user(buf, alarm_events, sizeof(struct tlclk_alarms))) 249 if (copy_to_user(buf, alarm_events, sizeof(struct tlclk_alarms))) {
250 mutex_unlock(&tlclk_mutex);
236 return -EFAULT; 251 return -EFAULT;
252 }
237 253
238 memset(alarm_events, 0, sizeof(struct tlclk_alarms)); 254 memset(alarm_events, 0, sizeof(struct tlclk_alarms));
239 got_event = 0; 255 got_event = 0;
240 256
257 mutex_unlock(&tlclk_mutex);
241 return sizeof(struct tlclk_alarms); 258 return sizeof(struct tlclk_alarms);
242} 259}
243 260
244static ssize_t tlclk_write(struct file *filp, const char __user *buf, size_t count,
245 loff_t *f_pos)
246{
247 return 0;
248}
249
250static const struct file_operations tlclk_fops = { 261static const struct file_operations tlclk_fops = {
251 .read = tlclk_read, 262 .read = tlclk_read,
252 .write = tlclk_write,
253 .open = tlclk_open, 263 .open = tlclk_open,
254 .release = tlclk_release, 264 .release = tlclk_release,
255 265
@@ -540,7 +550,7 @@ static ssize_t store_select_amcb1_transmit_clock(struct device *d,
540 SET_PORT_BITS(TLCLK_REG3, 0xf8, 0x7); 550 SET_PORT_BITS(TLCLK_REG3, 0xf8, 0x7);
541 switch (val) { 551 switch (val) {
542 case CLK_8_592MHz: 552 case CLK_8_592MHz:
543 SET_PORT_BITS(TLCLK_REG0, 0xfc, 1); 553 SET_PORT_BITS(TLCLK_REG0, 0xfc, 2);
544 break; 554 break;
545 case CLK_11_184MHz: 555 case CLK_11_184MHz:
546 SET_PORT_BITS(TLCLK_REG0, 0xfc, 0); 556 SET_PORT_BITS(TLCLK_REG0, 0xfc, 0);
@@ -549,7 +559,7 @@ static ssize_t store_select_amcb1_transmit_clock(struct device *d,
549 SET_PORT_BITS(TLCLK_REG0, 0xfc, 3); 559 SET_PORT_BITS(TLCLK_REG0, 0xfc, 3);
550 break; 560 break;
551 case CLK_44_736MHz: 561 case CLK_44_736MHz:
552 SET_PORT_BITS(TLCLK_REG0, 0xfc, 2); 562 SET_PORT_BITS(TLCLK_REG0, 0xfc, 1);
553 break; 563 break;
554 } 564 }
555 } else 565 } else
@@ -839,11 +849,13 @@ static void __exit tlclk_cleanup(void)
839 849
840static void switchover_timeout(unsigned long data) 850static void switchover_timeout(unsigned long data)
841{ 851{
842 if ((data & 1)) { 852 unsigned long flags = *(unsigned long *) data;
843 if ((inb(TLCLK_REG1) & 0x08) != (data & 0x08)) 853
854 if ((flags & 1)) {
855 if ((inb(TLCLK_REG1) & 0x08) != (flags & 0x08))
844 alarm_events->switchover_primary++; 856 alarm_events->switchover_primary++;
845 } else { 857 } else {
846 if ((inb(TLCLK_REG1) & 0x08) != (data & 0x08)) 858 if ((inb(TLCLK_REG1) & 0x08) != (flags & 0x08))
847 alarm_events->switchover_secondary++; 859 alarm_events->switchover_secondary++;
848 } 860 }
849 861
@@ -901,8 +913,9 @@ static irqreturn_t tlclk_interrupt(int irq, void *dev_id)
901 913
902 /* TIMEOUT in ~10ms */ 914 /* TIMEOUT in ~10ms */
903 switchover_timer.expires = jiffies + msecs_to_jiffies(10); 915 switchover_timer.expires = jiffies + msecs_to_jiffies(10);
904 switchover_timer.data = inb(TLCLK_REG1); 916 tlclk_timer_data = inb(TLCLK_REG1);
905 add_timer(&switchover_timer); 917 switchover_timer.data = (unsigned long) &tlclk_timer_data;
918 mod_timer(&switchover_timer, switchover_timer.expires);
906 } else { 919 } else {
907 got_event = 1; 920 got_event = 1;
908 wake_up(&wq); 921 wake_up(&wq);
diff --git a/drivers/char/vr41xx_giu.c b/drivers/char/vr41xx_giu.c
index a744dad9cf45..0cea8d4907df 100644
--- a/drivers/char/vr41xx_giu.c
+++ b/drivers/char/vr41xx_giu.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * Copyright (C) 2002 MontaVista Software Inc. 4 * Copyright (C) 2002 MontaVista Software Inc.
5 * Author: Yoichi Yuasa <yyuasa@mvista.com or source@mvista.com> 5 * Author: Yoichi Yuasa <yyuasa@mvista.com or source@mvista.com>
6 * Copyright (C) 2003-2005 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp> 6 * Copyright (C) 2003-2007 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by 9 * it under the terms of the GNU General Public License as published by
@@ -125,30 +125,17 @@ static inline uint16_t giu_clear(uint16_t offset, uint16_t clear)
125 return data; 125 return data;
126} 126}
127 127
128static unsigned int startup_giuint_low_irq(unsigned int irq) 128static void ack_giuint_low(unsigned int irq)
129{ 129{
130 unsigned int pin; 130 giu_write(GIUINTSTATL, 1 << GPIO_PIN_OF_IRQ(irq));
131
132 pin = GPIO_PIN_OF_IRQ(irq);
133 giu_write(GIUINTSTATL, 1 << pin);
134 giu_set(GIUINTENL, 1 << pin);
135
136 return 0;
137} 131}
138 132
139static void shutdown_giuint_low_irq(unsigned int irq) 133static void mask_giuint_low(unsigned int irq)
140{ 134{
141 giu_clear(GIUINTENL, 1 << GPIO_PIN_OF_IRQ(irq)); 135 giu_clear(GIUINTENL, 1 << GPIO_PIN_OF_IRQ(irq));
142} 136}
143 137
144static void enable_giuint_low_irq(unsigned int irq) 138static void mask_ack_giuint_low(unsigned int irq)
145{
146 giu_set(GIUINTENL, 1 << GPIO_PIN_OF_IRQ(irq));
147}
148
149#define disable_giuint_low_irq shutdown_giuint_low_irq
150
151static void ack_giuint_low_irq(unsigned int irq)
152{ 139{
153 unsigned int pin; 140 unsigned int pin;
154 141
@@ -157,46 +144,30 @@ static void ack_giuint_low_irq(unsigned int irq)
157 giu_write(GIUINTSTATL, 1 << pin); 144 giu_write(GIUINTSTATL, 1 << pin);
158} 145}
159 146
160static void end_giuint_low_irq(unsigned int irq) 147static void unmask_giuint_low(unsigned int irq)
161{ 148{
162 if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS))) 149 giu_set(GIUINTENL, 1 << GPIO_PIN_OF_IRQ(irq));
163 giu_set(GIUINTENL, 1 << GPIO_PIN_OF_IRQ(irq));
164} 150}
165 151
166static struct hw_interrupt_type giuint_low_irq_type = { 152static struct irq_chip giuint_low_irq_chip = {
167 .typename = "GIUINTL", 153 .name = "GIUINTL",
168 .startup = startup_giuint_low_irq, 154 .ack = ack_giuint_low,
169 .shutdown = shutdown_giuint_low_irq, 155 .mask = mask_giuint_low,
170 .enable = enable_giuint_low_irq, 156 .mask_ack = mask_ack_giuint_low,
171 .disable = disable_giuint_low_irq, 157 .unmask = unmask_giuint_low,
172 .ack = ack_giuint_low_irq,
173 .end = end_giuint_low_irq,
174}; 158};
175 159
176static unsigned int startup_giuint_high_irq(unsigned int irq) 160static void ack_giuint_high(unsigned int irq)
177{ 161{
178 unsigned int pin; 162 giu_write(GIUINTSTATH, 1 << (GPIO_PIN_OF_IRQ(irq) - GIUINT_HIGH_OFFSET));
179
180 pin = GPIO_PIN_OF_IRQ(irq) - GIUINT_HIGH_OFFSET;
181 giu_write(GIUINTSTATH, 1 << pin);
182 giu_set(GIUINTENH, 1 << pin);
183
184 return 0;
185} 163}
186 164
187static void shutdown_giuint_high_irq(unsigned int irq) 165static void mask_giuint_high(unsigned int irq)
188{ 166{
189 giu_clear(GIUINTENH, 1 << (GPIO_PIN_OF_IRQ(irq) - GIUINT_HIGH_OFFSET)); 167 giu_clear(GIUINTENH, 1 << (GPIO_PIN_OF_IRQ(irq) - GIUINT_HIGH_OFFSET));
190} 168}
191 169
192static void enable_giuint_high_irq(unsigned int irq) 170static void mask_ack_giuint_high(unsigned int irq)
193{
194 giu_set(GIUINTENH, 1 << (GPIO_PIN_OF_IRQ(irq) - GIUINT_HIGH_OFFSET));
195}
196
197#define disable_giuint_high_irq shutdown_giuint_high_irq
198
199static void ack_giuint_high_irq(unsigned int irq)
200{ 171{
201 unsigned int pin; 172 unsigned int pin;
202 173
@@ -205,20 +176,17 @@ static void ack_giuint_high_irq(unsigned int irq)
205 giu_write(GIUINTSTATH, 1 << pin); 176 giu_write(GIUINTSTATH, 1 << pin);
206} 177}
207 178
208static void end_giuint_high_irq(unsigned int irq) 179static void unmask_giuint_high(unsigned int irq)
209{ 180{
210 if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS))) 181 giu_set(GIUINTENH, 1 << (GPIO_PIN_OF_IRQ(irq) - GIUINT_HIGH_OFFSET));
211 giu_set(GIUINTENH, 1 << (GPIO_PIN_OF_IRQ(irq) - GIUINT_HIGH_OFFSET));
212} 182}
213 183
214static struct hw_interrupt_type giuint_high_irq_type = { 184static struct irq_chip giuint_high_irq_chip = {
215 .typename = "GIUINTH", 185 .name = "GIUINTH",
216 .startup = startup_giuint_high_irq, 186 .ack = ack_giuint_high,
217 .shutdown = shutdown_giuint_high_irq, 187 .mask = mask_giuint_high,
218 .enable = enable_giuint_high_irq, 188 .mask_ack = mask_ack_giuint_high,
219 .disable = disable_giuint_high_irq, 189 .unmask = unmask_giuint_high,
220 .ack = ack_giuint_high_irq,
221 .end = end_giuint_high_irq,
222}; 190};
223 191
224static int giu_get_irq(unsigned int irq) 192static int giu_get_irq(unsigned int irq)
@@ -282,9 +250,15 @@ void vr41xx_set_irq_trigger(unsigned int pin, irq_trigger_t trigger, irq_signal_
282 break; 250 break;
283 } 251 }
284 } 252 }
253 set_irq_chip_and_handler(GIU_IRQ(pin),
254 &giuint_low_irq_chip,
255 handle_edge_irq);
285 } else { 256 } else {
286 giu_clear(GIUINTTYPL, mask); 257 giu_clear(GIUINTTYPL, mask);
287 giu_clear(GIUINTHTSELL, mask); 258 giu_clear(GIUINTHTSELL, mask);
259 set_irq_chip_and_handler(GIU_IRQ(pin),
260 &giuint_low_irq_chip,
261 handle_level_irq);
288 } 262 }
289 giu_write(GIUINTSTATL, mask); 263 giu_write(GIUINTSTATL, mask);
290 } else if (pin < GIUINT_HIGH_MAX) { 264 } else if (pin < GIUINT_HIGH_MAX) {
@@ -311,9 +285,15 @@ void vr41xx_set_irq_trigger(unsigned int pin, irq_trigger_t trigger, irq_signal_
311 break; 285 break;
312 } 286 }
313 } 287 }
288 set_irq_chip_and_handler(GIU_IRQ(pin),
289 &giuint_high_irq_chip,
290 handle_edge_irq);
314 } else { 291 } else {
315 giu_clear(GIUINTTYPH, mask); 292 giu_clear(GIUINTTYPH, mask);
316 giu_clear(GIUINTHTSELH, mask); 293 giu_clear(GIUINTHTSELH, mask);
294 set_irq_chip_and_handler(GIU_IRQ(pin),
295 &giuint_high_irq_chip,
296 handle_level_irq);
317 } 297 }
318 giu_write(GIUINTSTATH, mask); 298 giu_write(GIUINTSTATH, mask);
319 } 299 }
@@ -617,10 +597,11 @@ static const struct file_operations gpio_fops = {
617static int __devinit giu_probe(struct platform_device *dev) 597static int __devinit giu_probe(struct platform_device *dev)
618{ 598{
619 unsigned long start, size, flags = 0; 599 unsigned long start, size, flags = 0;
620 unsigned int nr_pins = 0; 600 unsigned int nr_pins = 0, trigger, i, pin;
621 struct resource *res1, *res2 = NULL; 601 struct resource *res1, *res2 = NULL;
622 void *base; 602 void *base;
623 int retval, i; 603 struct irq_chip *chip;
604 int retval;
624 605
625 switch (current_cpu_data.cputype) { 606 switch (current_cpu_data.cputype) {
626 case CPU_VR4111: 607 case CPU_VR4111:
@@ -688,11 +669,20 @@ static int __devinit giu_probe(struct platform_device *dev)
688 giu_write(GIUINTENL, 0); 669 giu_write(GIUINTENL, 0);
689 giu_write(GIUINTENH, 0); 670 giu_write(GIUINTENH, 0);
690 671
672 trigger = giu_read(GIUINTTYPH) << 16;
673 trigger |= giu_read(GIUINTTYPL);
691 for (i = GIU_IRQ_BASE; i <= GIU_IRQ_LAST; i++) { 674 for (i = GIU_IRQ_BASE; i <= GIU_IRQ_LAST; i++) {
692 if (i < GIU_IRQ(GIUINT_HIGH_OFFSET)) 675 pin = GPIO_PIN_OF_IRQ(i);
693 irq_desc[i].chip = &giuint_low_irq_type; 676 if (pin < GIUINT_HIGH_OFFSET)
677 chip = &giuint_low_irq_chip;
694 else 678 else
695 irq_desc[i].chip = &giuint_high_irq_type; 679 chip = &giuint_high_irq_chip;
680
681 if (trigger & (1 << pin))
682 set_irq_chip_and_handler(i, chip, handle_edge_irq);
683 else
684 set_irq_chip_and_handler(i, chip, handle_level_irq);
685
696 } 686 }
697 687
698 return cascade_irq(GIUINT_IRQ, giu_get_irq); 688 return cascade_irq(GIUINT_IRQ, giu_get_irq);
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index d91330432ba2..a45cc89e387a 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -722,8 +722,13 @@ static int cpufreq_add_dev (struct sys_device * sys_dev)
722 spin_unlock_irqrestore(&cpufreq_driver_lock, flags); 722 spin_unlock_irqrestore(&cpufreq_driver_lock, flags);
723 723
724 dprintk("CPU already managed, adding link\n"); 724 dprintk("CPU already managed, adding link\n");
725 sysfs_create_link(&sys_dev->kobj, 725 ret = sysfs_create_link(&sys_dev->kobj,
726 &managed_policy->kobj, "cpufreq"); 726 &managed_policy->kobj,
727 "cpufreq");
728 if (ret) {
729 mutex_unlock(&policy->lock);
730 goto err_out_driver_exit;
731 }
727 732
728 cpufreq_debug_enable_ratelimit(); 733 cpufreq_debug_enable_ratelimit();
729 mutex_unlock(&policy->lock); 734 mutex_unlock(&policy->lock);
@@ -770,8 +775,12 @@ static int cpufreq_add_dev (struct sys_device * sys_dev)
770 dprintk("CPU %u already managed, adding link\n", j); 775 dprintk("CPU %u already managed, adding link\n", j);
771 cpufreq_cpu_get(cpu); 776 cpufreq_cpu_get(cpu);
772 cpu_sys_dev = get_cpu_sysdev(j); 777 cpu_sys_dev = get_cpu_sysdev(j);
773 sysfs_create_link(&cpu_sys_dev->kobj, &policy->kobj, 778 ret = sysfs_create_link(&cpu_sys_dev->kobj, &policy->kobj,
774 "cpufreq"); 779 "cpufreq");
780 if (ret) {
781 mutex_unlock(&policy->lock);
782 goto err_out_unregister;
783 }
775 } 784 }
776 785
777 policy->governor = NULL; /* to assure that the starting sequence is 786 policy->governor = NULL; /* to assure that the starting sequence is
diff --git a/drivers/firmware/efivars.c b/drivers/firmware/efivars.c
index 5ab5e393b882..c6281ccd4fe7 100644
--- a/drivers/firmware/efivars.c
+++ b/drivers/firmware/efivars.c
@@ -122,8 +122,6 @@ struct efivar_entry {
122 struct kobject kobj; 122 struct kobject kobj;
123}; 123};
124 124
125#define get_efivar_entry(n) list_entry(n, struct efivar_entry, list)
126
127struct efivar_attribute { 125struct efivar_attribute {
128 struct attribute attr; 126 struct attribute attr;
129 ssize_t (*show) (struct efivar_entry *entry, char *buf); 127 ssize_t (*show) (struct efivar_entry *entry, char *buf);
@@ -386,9 +384,6 @@ static struct sysfs_ops efivar_attr_ops = {
386static void efivar_release(struct kobject *kobj) 384static void efivar_release(struct kobject *kobj)
387{ 385{
388 struct efivar_entry *var = container_of(kobj, struct efivar_entry, kobj); 386 struct efivar_entry *var = container_of(kobj, struct efivar_entry, kobj);
389 spin_lock(&efivars_lock);
390 list_del(&var->list);
391 spin_unlock(&efivars_lock);
392 kfree(var); 387 kfree(var);
393} 388}
394 389
@@ -430,9 +425,8 @@ static ssize_t
430efivar_create(struct subsystem *sub, const char *buf, size_t count) 425efivar_create(struct subsystem *sub, const char *buf, size_t count)
431{ 426{
432 struct efi_variable *new_var = (struct efi_variable *)buf; 427 struct efi_variable *new_var = (struct efi_variable *)buf;
433 struct efivar_entry *search_efivar = NULL; 428 struct efivar_entry *search_efivar, *n;
434 unsigned long strsize1, strsize2; 429 unsigned long strsize1, strsize2;
435 struct list_head *pos, *n;
436 efi_status_t status = EFI_NOT_FOUND; 430 efi_status_t status = EFI_NOT_FOUND;
437 int found = 0; 431 int found = 0;
438 432
@@ -444,8 +438,7 @@ efivar_create(struct subsystem *sub, const char *buf, size_t count)
444 /* 438 /*
445 * Does this variable already exist? 439 * Does this variable already exist?
446 */ 440 */
447 list_for_each_safe(pos, n, &efivar_list) { 441 list_for_each_entry_safe(search_efivar, n, &efivar_list, list) {
448 search_efivar = get_efivar_entry(pos);
449 strsize1 = utf8_strsize(search_efivar->var.VariableName, 1024); 442 strsize1 = utf8_strsize(search_efivar->var.VariableName, 1024);
450 strsize2 = utf8_strsize(new_var->VariableName, 1024); 443 strsize2 = utf8_strsize(new_var->VariableName, 1024);
451 if (strsize1 == strsize2 && 444 if (strsize1 == strsize2 &&
@@ -490,9 +483,8 @@ static ssize_t
490efivar_delete(struct subsystem *sub, const char *buf, size_t count) 483efivar_delete(struct subsystem *sub, const char *buf, size_t count)
491{ 484{
492 struct efi_variable *del_var = (struct efi_variable *)buf; 485 struct efi_variable *del_var = (struct efi_variable *)buf;
493 struct efivar_entry *search_efivar = NULL; 486 struct efivar_entry *search_efivar, *n;
494 unsigned long strsize1, strsize2; 487 unsigned long strsize1, strsize2;
495 struct list_head *pos, *n;
496 efi_status_t status = EFI_NOT_FOUND; 488 efi_status_t status = EFI_NOT_FOUND;
497 int found = 0; 489 int found = 0;
498 490
@@ -504,8 +496,7 @@ efivar_delete(struct subsystem *sub, const char *buf, size_t count)
504 /* 496 /*
505 * Does this variable already exist? 497 * Does this variable already exist?
506 */ 498 */
507 list_for_each_safe(pos, n, &efivar_list) { 499 list_for_each_entry_safe(search_efivar, n, &efivar_list, list) {
508 search_efivar = get_efivar_entry(pos);
509 strsize1 = utf8_strsize(search_efivar->var.VariableName, 1024); 500 strsize1 = utf8_strsize(search_efivar->var.VariableName, 1024);
510 strsize2 = utf8_strsize(del_var->VariableName, 1024); 501 strsize2 = utf8_strsize(del_var->VariableName, 1024);
511 if (strsize1 == strsize2 && 502 if (strsize1 == strsize2 &&
@@ -537,9 +528,9 @@ efivar_delete(struct subsystem *sub, const char *buf, size_t count)
537 spin_unlock(&efivars_lock); 528 spin_unlock(&efivars_lock);
538 return -EIO; 529 return -EIO;
539 } 530 }
531 list_del(&search_efivar->list);
540 /* We need to release this lock before unregistering. */ 532 /* We need to release this lock before unregistering. */
541 spin_unlock(&efivars_lock); 533 spin_unlock(&efivars_lock);
542
543 efivar_unregister(search_efivar); 534 efivar_unregister(search_efivar);
544 535
545 /* It's dead Jim.... */ 536 /* It's dead Jim.... */
@@ -768,10 +759,14 @@ out_free:
768static void __exit 759static void __exit
769efivars_exit(void) 760efivars_exit(void)
770{ 761{
771 struct list_head *pos, *n; 762 struct efivar_entry *entry, *n;
772 763
773 list_for_each_safe(pos, n, &efivar_list) 764 list_for_each_entry_safe(entry, n, &efivar_list, list) {
774 efivar_unregister(get_efivar_entry(pos)); 765 spin_lock(&efivars_lock);
766 list_del(&entry->list);
767 spin_unlock(&efivars_lock);
768 efivar_unregister(entry);
769 }
775 770
776 subsystem_unregister(&vars_subsys); 771 subsystem_unregister(&vars_subsys);
777 firmware_unregister(&efi_subsys); 772 firmware_unregister(&efi_subsys);
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index b8cf50fcd64d..49f18f5b2514 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -543,6 +543,7 @@ void hid_free_device(struct hid_device *device)
543 } 543 }
544 544
545 kfree(device->rdesc); 545 kfree(device->rdesc);
546 kfree(device->collection);
546 kfree(device); 547 kfree(device);
547} 548}
548EXPORT_SYMBOL_GPL(hid_free_device); 549EXPORT_SYMBOL_GPL(hid_free_device);
diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
index 9cf591a1bda3..c7a6833f6821 100644
--- a/drivers/hid/hid-input.c
+++ b/drivers/hid/hid-input.c
@@ -35,6 +35,11 @@
35 35
36#include <linux/hid.h> 36#include <linux/hid.h>
37 37
38static int hid_pb_fnmode = 1;
39module_param_named(pb_fnmode, hid_pb_fnmode, int, 0644);
40MODULE_PARM_DESC(pb_fnmode,
41 "Mode of fn key on PowerBooks (0 = disabled, 1 = fkeyslast, 2 = fkeysfirst)");
42
38#define unk KEY_UNKNOWN 43#define unk KEY_UNKNOWN
39 44
40static const unsigned char hid_keyboard[256] = { 45static const unsigned char hid_keyboard[256] = {
@@ -154,7 +159,7 @@ static int hidinput_pb_event(struct hid_device *hid, struct input_dev *input,
154 return 1; 159 return 1;
155 } 160 }
156 161
157 if (hid->pb_fnmode) { 162 if (hid_pb_fnmode) {
158 int do_translate; 163 int do_translate;
159 164
160 trans = find_translation(powerbook_fn_keys, usage->code); 165 trans = find_translation(powerbook_fn_keys, usage->code);
@@ -163,8 +168,8 @@ static int hidinput_pb_event(struct hid_device *hid, struct input_dev *input,
163 do_translate = 1; 168 do_translate = 1;
164 else if (trans->flags & POWERBOOK_FLAG_FKEY) 169 else if (trans->flags & POWERBOOK_FLAG_FKEY)
165 do_translate = 170 do_translate =
166 (hid->pb_fnmode == 2 && (hid->quirks & HID_QUIRK_POWERBOOK_FN_ON)) || 171 (hid_pb_fnmode == 2 && (hid->quirks & HID_QUIRK_POWERBOOK_FN_ON)) ||
167 (hid->pb_fnmode == 1 && !(hid->quirks & HID_QUIRK_POWERBOOK_FN_ON)); 172 (hid_pb_fnmode == 1 && !(hid->quirks & HID_QUIRK_POWERBOOK_FN_ON));
168 else 173 else
169 do_translate = (hid->quirks & HID_QUIRK_POWERBOOK_FN_ON); 174 do_translate = (hid->quirks & HID_QUIRK_POWERBOOK_FN_ON);
170 175
@@ -431,6 +436,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
431 case 0x040: map_key_clear(KEY_MENU); break; 436 case 0x040: map_key_clear(KEY_MENU); break;
432 case 0x045: map_key_clear(KEY_RADIO); break; 437 case 0x045: map_key_clear(KEY_RADIO); break;
433 438
439 case 0x083: map_key_clear(KEY_LAST); break;
434 case 0x088: map_key_clear(KEY_PC); break; 440 case 0x088: map_key_clear(KEY_PC); break;
435 case 0x089: map_key_clear(KEY_TV); break; 441 case 0x089: map_key_clear(KEY_TV); break;
436 case 0x08a: map_key_clear(KEY_WWW); break; 442 case 0x08a: map_key_clear(KEY_WWW); break;
@@ -448,6 +454,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
448 case 0x096: map_key_clear(KEY_TAPE); break; 454 case 0x096: map_key_clear(KEY_TAPE); break;
449 case 0x097: map_key_clear(KEY_TV2); break; 455 case 0x097: map_key_clear(KEY_TV2); break;
450 case 0x098: map_key_clear(KEY_SAT); break; 456 case 0x098: map_key_clear(KEY_SAT); break;
457 case 0x09a: map_key_clear(KEY_PVR); break;
451 458
452 case 0x09c: map_key_clear(KEY_CHANNELUP); break; 459 case 0x09c: map_key_clear(KEY_CHANNELUP); break;
453 case 0x09d: map_key_clear(KEY_CHANNELDOWN); break; 460 case 0x09d: map_key_clear(KEY_CHANNELDOWN); break;
diff --git a/drivers/ide/ide-pnp.c b/drivers/ide/ide-pnp.c
index df7d1504f84e..98410ca044cf 100644
--- a/drivers/ide/ide-pnp.c
+++ b/drivers/ide/ide-pnp.c
@@ -73,3 +73,8 @@ void __init pnpide_init(void)
73{ 73{
74 pnp_register_driver(&idepnp_driver); 74 pnp_register_driver(&idepnp_driver);
75} 75}
76
77void __exit pnpide_exit(void)
78{
79 pnp_unregister_driver(&idepnp_driver);
80}
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c
index 16890769dca6..6c9bd5165bdb 100644
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -1781,8 +1781,9 @@ done:
1781 return 1; 1781 return 1;
1782} 1782}
1783 1783
1784extern void pnpide_init(void); 1784extern void __init pnpide_init(void);
1785extern void h8300_ide_init(void); 1785extern void __exit pnpide_exit(void);
1786extern void __init h8300_ide_init(void);
1786 1787
1787/* 1788/*
1788 * probe_for_hwifs() finds/initializes "known" IDE interfaces 1789 * probe_for_hwifs() finds/initializes "known" IDE interfaces
@@ -2087,13 +2088,17 @@ int __init init_module (void)
2087 return ide_init(); 2088 return ide_init();
2088} 2089}
2089 2090
2090void cleanup_module (void) 2091void __exit cleanup_module (void)
2091{ 2092{
2092 int index; 2093 int index;
2093 2094
2094 for (index = 0; index < MAX_HWIFS; ++index) 2095 for (index = 0; index < MAX_HWIFS; ++index)
2095 ide_unregister(index); 2096 ide_unregister(index);
2096 2097
2098#ifdef CONFIG_BLK_DEV_IDEPNP
2099 pnpide_exit();
2100#endif
2101
2097#ifdef CONFIG_PROC_FS 2102#ifdef CONFIG_PROC_FS
2098 proc_ide_destroy(); 2103 proc_ide_destroy();
2099#endif 2104#endif
diff --git a/drivers/ide/pci/aec62xx.c b/drivers/ide/pci/aec62xx.c
index f286079d233f..d261bfbad222 100644
--- a/drivers/ide/pci/aec62xx.c
+++ b/drivers/ide/pci/aec62xx.c
@@ -441,7 +441,7 @@ static struct pci_driver driver = {
441 .probe = aec62xx_init_one, 441 .probe = aec62xx_init_one,
442}; 442};
443 443
444static int aec62xx_ide_init(void) 444static int __init aec62xx_ide_init(void)
445{ 445{
446 return ide_pci_register_driver(&driver); 446 return ide_pci_register_driver(&driver);
447} 447}
diff --git a/drivers/ide/pci/alim15x3.c b/drivers/ide/pci/alim15x3.c
index 89109be5162c..68df77ec502b 100644
--- a/drivers/ide/pci/alim15x3.c
+++ b/drivers/ide/pci/alim15x3.c
@@ -907,7 +907,7 @@ static struct pci_driver driver = {
907 .probe = alim15x3_init_one, 907 .probe = alim15x3_init_one,
908}; 908};
909 909
910static int ali15x3_ide_init(void) 910static int __init ali15x3_ide_init(void)
911{ 911{
912 return ide_pci_register_driver(&driver); 912 return ide_pci_register_driver(&driver);
913} 913}
diff --git a/drivers/ide/pci/amd74xx.c b/drivers/ide/pci/amd74xx.c
index 753fe0e21456..a4336995a410 100644
--- a/drivers/ide/pci/amd74xx.c
+++ b/drivers/ide/pci/amd74xx.c
@@ -544,7 +544,7 @@ static struct pci_driver driver = {
544 .probe = amd74xx_probe, 544 .probe = amd74xx_probe,
545}; 545};
546 546
547static int amd74xx_ide_init(void) 547static int __init amd74xx_ide_init(void)
548{ 548{
549 return ide_pci_register_driver(&driver); 549 return ide_pci_register_driver(&driver);
550} 550}
diff --git a/drivers/ide/pci/atiixp.c b/drivers/ide/pci/atiixp.c
index 524e65de4398..982ac31fa995 100644
--- a/drivers/ide/pci/atiixp.c
+++ b/drivers/ide/pci/atiixp.c
@@ -291,8 +291,12 @@ fast_ata_pio:
291 291
292static void __devinit init_hwif_atiixp(ide_hwif_t *hwif) 292static void __devinit init_hwif_atiixp(ide_hwif_t *hwif)
293{ 293{
294 u8 udma_mode = 0;
295 u8 ch = hwif->channel;
296 struct pci_dev *pdev = hwif->pci_dev;
297
294 if (!hwif->irq) 298 if (!hwif->irq)
295 hwif->irq = hwif->channel ? 15 : 14; 299 hwif->irq = ch ? 15 : 14;
296 300
297 hwif->autodma = 0; 301 hwif->autodma = 0;
298 hwif->tuneproc = &atiixp_tuneproc; 302 hwif->tuneproc = &atiixp_tuneproc;
@@ -308,8 +312,12 @@ static void __devinit init_hwif_atiixp(ide_hwif_t *hwif)
308 hwif->mwdma_mask = 0x06; 312 hwif->mwdma_mask = 0x06;
309 hwif->swdma_mask = 0x04; 313 hwif->swdma_mask = 0x04;
310 314
311 /* FIXME: proper cable detection needed */ 315 pci_read_config_byte(pdev, ATIIXP_IDE_UDMA_MODE + ch, &udma_mode);
312 hwif->udma_four = 1; 316 if ((udma_mode & 0x07) >= 0x04 || (udma_mode & 0x70) >= 0x40)
317 hwif->udma_four = 1;
318 else
319 hwif->udma_four = 0;
320
313 hwif->ide_dma_host_on = &atiixp_ide_dma_host_on; 321 hwif->ide_dma_host_on = &atiixp_ide_dma_host_on;
314 hwif->ide_dma_host_off = &atiixp_ide_dma_host_off; 322 hwif->ide_dma_host_off = &atiixp_ide_dma_host_off;
315 hwif->ide_dma_check = &atiixp_dma_check; 323 hwif->ide_dma_check = &atiixp_dma_check;
@@ -320,19 +328,6 @@ static void __devinit init_hwif_atiixp(ide_hwif_t *hwif)
320 hwif->drives[0].autodma = hwif->autodma; 328 hwif->drives[0].autodma = hwif->autodma;
321} 329}
322 330
323static void __devinit init_hwif_sb600_legacy(ide_hwif_t *hwif)
324{
325
326 hwif->atapi_dma = 1;
327 hwif->ultra_mask = 0x7f;
328 hwif->mwdma_mask = 0x07;
329 hwif->swdma_mask = 0x07;
330
331 if (!noautodma)
332 hwif->autodma = 1;
333 hwif->drives[0].autodma = hwif->autodma;
334 hwif->drives[1].autodma = hwif->autodma;
335}
336 331
337static ide_pci_device_t atiixp_pci_info[] __devinitdata = { 332static ide_pci_device_t atiixp_pci_info[] __devinitdata = {
338 { /* 0 */ 333 { /* 0 */
@@ -343,12 +338,13 @@ static ide_pci_device_t atiixp_pci_info[] __devinitdata = {
343 .enablebits = {{0x48,0x01,0x00}, {0x48,0x08,0x00}}, 338 .enablebits = {{0x48,0x01,0x00}, {0x48,0x08,0x00}},
344 .bootable = ON_BOARD, 339 .bootable = ON_BOARD,
345 },{ /* 1 */ 340 },{ /* 1 */
346 .name = "ATI SB600 SATA Legacy IDE", 341 .name = "SB600_PATA",
347 .init_hwif = init_hwif_sb600_legacy, 342 .init_hwif = init_hwif_atiixp,
348 .channels = 2, 343 .channels = 1,
349 .autodma = AUTODMA, 344 .autodma = AUTODMA,
350 .bootable = ON_BOARD, 345 .enablebits = {{0x48,0x01,0x00}, {0x00,0x00,0x00}},
351 } 346 .bootable = ON_BOARD,
347 },
352}; 348};
353 349
354/** 350/**
@@ -369,7 +365,7 @@ static struct pci_device_id atiixp_pci_tbl[] = {
369 { PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP200_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, 365 { PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP200_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
370 { PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP300_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, 366 { PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP300_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
371 { PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP400_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, 367 { PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP400_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
372 { PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP600_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, 368 { PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP600_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1},
373 { 0, }, 369 { 0, },
374}; 370};
375MODULE_DEVICE_TABLE(pci, atiixp_pci_tbl); 371MODULE_DEVICE_TABLE(pci, atiixp_pci_tbl);
@@ -380,7 +376,7 @@ static struct pci_driver driver = {
380 .probe = atiixp_init_one, 376 .probe = atiixp_init_one,
381}; 377};
382 378
383static int atiixp_ide_init(void) 379static int __init atiixp_ide_init(void)
384{ 380{
385 return ide_pci_register_driver(&driver); 381 return ide_pci_register_driver(&driver);
386} 382}
diff --git a/drivers/ide/pci/cmd64x.c b/drivers/ide/pci/cmd64x.c
index 20c32716bbc4..aee947e8fc38 100644
--- a/drivers/ide/pci/cmd64x.c
+++ b/drivers/ide/pci/cmd64x.c
@@ -793,7 +793,7 @@ static struct pci_driver driver = {
793 .probe = cmd64x_init_one, 793 .probe = cmd64x_init_one,
794}; 794};
795 795
796static int cmd64x_ide_init(void) 796static int __init cmd64x_ide_init(void)
797{ 797{
798 return ide_pci_register_driver(&driver); 798 return ide_pci_register_driver(&driver);
799} 799}
diff --git a/drivers/ide/pci/cs5520.c b/drivers/ide/pci/cs5520.c
index 079f7c86726b..ba6786aabf3b 100644
--- a/drivers/ide/pci/cs5520.c
+++ b/drivers/ide/pci/cs5520.c
@@ -260,7 +260,7 @@ static struct pci_driver driver = {
260 .probe = cs5520_init_one, 260 .probe = cs5520_init_one,
261}; 261};
262 262
263static int cs5520_ide_init(void) 263static int __init cs5520_ide_init(void)
264{ 264{
265 return ide_pci_register_driver(&driver); 265 return ide_pci_register_driver(&driver);
266} 266}
diff --git a/drivers/ide/pci/cs5530.c b/drivers/ide/pci/cs5530.c
index ae405fa32236..9bf5fdfc5b1f 100644
--- a/drivers/ide/pci/cs5530.c
+++ b/drivers/ide/pci/cs5530.c
@@ -374,7 +374,7 @@ static struct pci_driver driver = {
374 .probe = cs5530_init_one, 374 .probe = cs5530_init_one,
375}; 375};
376 376
377static int cs5530_ide_init(void) 377static int __init cs5530_ide_init(void)
378{ 378{
379 return ide_pci_register_driver(&driver); 379 return ide_pci_register_driver(&driver);
380} 380}
diff --git a/drivers/ide/pci/cy82c693.c b/drivers/ide/pci/cy82c693.c
index 64330c459bd4..9eafcbf444f4 100644
--- a/drivers/ide/pci/cy82c693.c
+++ b/drivers/ide/pci/cy82c693.c
@@ -519,7 +519,7 @@ static struct pci_driver driver = {
519 .probe = cy82c693_init_one, 519 .probe = cy82c693_init_one,
520}; 520};
521 521
522static int cy82c693_ide_init(void) 522static int __init cy82c693_ide_init(void)
523{ 523{
524 return ide_pci_register_driver(&driver); 524 return ide_pci_register_driver(&driver);
525} 525}
diff --git a/drivers/ide/pci/generic.c b/drivers/ide/pci/generic.c
index 9f306880491a..b408c6c517ea 100644
--- a/drivers/ide/pci/generic.c
+++ b/drivers/ide/pci/generic.c
@@ -185,36 +185,6 @@ static ide_pci_device_t generic_chipsets[] __devinitdata = {
185 .channels = 2, 185 .channels = 2,
186 .autodma = AUTODMA, 186 .autodma = AUTODMA,
187 .bootable = OFF_BOARD, 187 .bootable = OFF_BOARD,
188 },{ /* 15 */
189 .name = "JMB361",
190 .init_hwif = init_hwif_generic,
191 .channels = 2,
192 .autodma = AUTODMA,
193 .bootable = OFF_BOARD,
194 },{ /* 16 */
195 .name = "JMB363",
196 .init_hwif = init_hwif_generic,
197 .channels = 2,
198 .autodma = AUTODMA,
199 .bootable = OFF_BOARD,
200 },{ /* 17 */
201 .name = "JMB365",
202 .init_hwif = init_hwif_generic,
203 .channels = 2,
204 .autodma = AUTODMA,
205 .bootable = OFF_BOARD,
206 },{ /* 18 */
207 .name = "JMB366",
208 .init_hwif = init_hwif_generic,
209 .channels = 2,
210 .autodma = AUTODMA,
211 .bootable = OFF_BOARD,
212 },{ /* 19 */
213 .name = "JMB368",
214 .init_hwif = init_hwif_generic,
215 .channels = 2,
216 .autodma = AUTODMA,
217 .bootable = OFF_BOARD,
218 } 188 }
219}; 189};
220 190
@@ -281,11 +251,6 @@ static struct pci_device_id generic_pci_tbl[] = {
281 { PCI_VENDOR_ID_TOSHIBA,PCI_DEVICE_ID_TOSHIBA_PICCOLO_1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 12}, 251 { PCI_VENDOR_ID_TOSHIBA,PCI_DEVICE_ID_TOSHIBA_PICCOLO_1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 12},
282 { PCI_VENDOR_ID_TOSHIBA,PCI_DEVICE_ID_TOSHIBA_PICCOLO_2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 13}, 252 { PCI_VENDOR_ID_TOSHIBA,PCI_DEVICE_ID_TOSHIBA_PICCOLO_2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 13},
283 { PCI_VENDOR_ID_NETCELL,PCI_DEVICE_ID_REVOLUTION, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 14}, 253 { PCI_VENDOR_ID_NETCELL,PCI_DEVICE_ID_REVOLUTION, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 14},
284 { PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB361, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 15},
285 { PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB363, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 16},
286 { PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB365, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 17},
287 { PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB366, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 18},
288 { PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB368, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 19},
289 /* Must come last. If you add entries adjust this table appropriately and the init_one code */ 254 /* Must come last. If you add entries adjust this table appropriately and the init_one code */
290 { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_STORAGE_IDE << 8, 0xFFFFFF00UL, 0}, 255 { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_STORAGE_IDE << 8, 0xFFFFFF00UL, 0},
291 { 0, }, 256 { 0, },
@@ -298,7 +263,7 @@ static struct pci_driver driver = {
298 .probe = generic_init_one, 263 .probe = generic_init_one,
299}; 264};
300 265
301static int generic_ide_init(void) 266static int __init generic_ide_init(void)
302{ 267{
303 return ide_pci_register_driver(&driver); 268 return ide_pci_register_driver(&driver);
304} 269}
diff --git a/drivers/ide/pci/hpt34x.c b/drivers/ide/pci/hpt34x.c
index b46cb042290a..ce7b08f08a09 100644
--- a/drivers/ide/pci/hpt34x.c
+++ b/drivers/ide/pci/hpt34x.c
@@ -265,7 +265,7 @@ static struct pci_driver driver = {
265 .probe = hpt34x_init_one, 265 .probe = hpt34x_init_one,
266}; 266};
267 267
268static int hpt34x_ide_init(void) 268static int __init hpt34x_ide_init(void)
269{ 269{
270 return ide_pci_register_driver(&driver); 270 return ide_pci_register_driver(&driver);
271} 271}
diff --git a/drivers/ide/pci/hpt366.c b/drivers/ide/pci/hpt366.c
index 08119da06d54..b486442dd5d7 100644
--- a/drivers/ide/pci/hpt366.c
+++ b/drivers/ide/pci/hpt366.c
@@ -1613,7 +1613,7 @@ static struct pci_driver driver = {
1613 .probe = hpt366_init_one, 1613 .probe = hpt366_init_one,
1614}; 1614};
1615 1615
1616static int hpt366_ide_init(void) 1616static int __init hpt366_ide_init(void)
1617{ 1617{
1618 return ide_pci_register_driver(&driver); 1618 return ide_pci_register_driver(&driver);
1619} 1619}
diff --git a/drivers/ide/pci/jmicron.c b/drivers/ide/pci/jmicron.c
index c1cec236ecf0..f07bbbed1778 100644
--- a/drivers/ide/pci/jmicron.c
+++ b/drivers/ide/pci/jmicron.c
@@ -86,15 +86,16 @@ static int __devinit ata66_jmicron(ide_hwif_t *hwif)
86 { 86 {
87 case PORT_PATA0: 87 case PORT_PATA0:
88 if (control & (1 << 3)) /* 40/80 pin primary */ 88 if (control & (1 << 3)) /* 40/80 pin primary */
89 return 1; 89 return 0;
90 return 0; 90 return 1;
91 case PORT_PATA1: 91 case PORT_PATA1:
92 if (control5 & (1 << 19)) /* 40/80 pin secondary */ 92 if (control5 & (1 << 19)) /* 40/80 pin secondary */
93 return 0; 93 return 0;
94 return 1; 94 return 1;
95 case PORT_SATA: 95 case PORT_SATA:
96 return 1; 96 break;
97 } 97 }
98 return 1; /* Avoid bogus "control reaches end of non-void function" */
98} 99}
99 100
100static void jmicron_tuneproc (ide_drive_t *drive, byte mode_wanted) 101static void jmicron_tuneproc (ide_drive_t *drive, byte mode_wanted)
@@ -240,11 +241,11 @@ static int __devinit jmicron_init_one(struct pci_dev *dev, const struct pci_devi
240} 241}
241 242
242static struct pci_device_id jmicron_pci_tbl[] = { 243static struct pci_device_id jmicron_pci_tbl[] = {
243 { PCI_DEVICE(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB361), 0}, 244 { PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB361, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
244 { PCI_DEVICE(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB363), 1}, 245 { PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB363, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1},
245 { PCI_DEVICE(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB365), 2}, 246 { PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB365, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 2},
246 { PCI_DEVICE(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB366), 3}, 247 { PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB366, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 3},
247 { PCI_DEVICE(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB368), 4}, 248 { PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB368, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 4},
248 { 0, }, 249 { 0, },
249}; 250};
250 251
diff --git a/drivers/ide/pci/ns87415.c b/drivers/ide/pci/ns87415.c
index d95714bcee4e..8aaea4ea5549 100644
--- a/drivers/ide/pci/ns87415.c
+++ b/drivers/ide/pci/ns87415.c
@@ -302,7 +302,7 @@ static struct pci_driver driver = {
302 .probe = ns87415_init_one, 302 .probe = ns87415_init_one,
303}; 303};
304 304
305static int ns87415_ide_init(void) 305static int __init ns87415_ide_init(void)
306{ 306{
307 return ide_pci_register_driver(&driver); 307 return ide_pci_register_driver(&driver);
308} 308}
diff --git a/drivers/ide/pci/opti621.c b/drivers/ide/pci/opti621.c
index 7a7c2ef78ac2..22bbf613f948 100644
--- a/drivers/ide/pci/opti621.c
+++ b/drivers/ide/pci/opti621.c
@@ -382,7 +382,7 @@ static struct pci_driver driver = {
382 .probe = opti621_init_one, 382 .probe = opti621_init_one,
383}; 383};
384 384
385static int opti621_ide_init(void) 385static int __init opti621_ide_init(void)
386{ 386{
387 return ide_pci_register_driver(&driver); 387 return ide_pci_register_driver(&driver);
388} 388}
diff --git a/drivers/ide/pci/pdc202xx_new.c b/drivers/ide/pci/pdc202xx_new.c
index 7cb48576e479..77a9aaa7dab9 100644
--- a/drivers/ide/pci/pdc202xx_new.c
+++ b/drivers/ide/pci/pdc202xx_new.c
@@ -756,7 +756,7 @@ static struct pci_driver driver = {
756 .probe = pdc202new_init_one, 756 .probe = pdc202new_init_one,
757}; 757};
758 758
759static int pdc202new_ide_init(void) 759static int __init pdc202new_ide_init(void)
760{ 760{
761 return ide_pci_register_driver(&driver); 761 return ide_pci_register_driver(&driver);
762} 762}
diff --git a/drivers/ide/pci/pdc202xx_old.c b/drivers/ide/pci/pdc202xx_old.c
index 184cdacddeb6..143239c093d5 100644
--- a/drivers/ide/pci/pdc202xx_old.c
+++ b/drivers/ide/pci/pdc202xx_old.c
@@ -719,7 +719,7 @@ static struct pci_driver driver = {
719 .probe = pdc202xx_init_one, 719 .probe = pdc202xx_init_one,
720}; 720};
721 721
722static int pdc202xx_ide_init(void) 722static int __init pdc202xx_ide_init(void)
723{ 723{
724 return ide_pci_register_driver(&driver); 724 return ide_pci_register_driver(&driver);
725} 725}
diff --git a/drivers/ide/pci/rz1000.c b/drivers/ide/pci/rz1000.c
index 5f6950c2d1d1..c1855311052b 100644
--- a/drivers/ide/pci/rz1000.c
+++ b/drivers/ide/pci/rz1000.c
@@ -77,7 +77,7 @@ static struct pci_driver driver = {
77 .probe = rz1000_init_one, 77 .probe = rz1000_init_one,
78}; 78};
79 79
80static int rz1000_ide_init(void) 80static int __init rz1000_ide_init(void)
81{ 81{
82 return ide_pci_register_driver(&driver); 82 return ide_pci_register_driver(&driver);
83} 83}
diff --git a/drivers/ide/pci/sc1200.c b/drivers/ide/pci/sc1200.c
index ff80937d94dd..8d762d323f8b 100644
--- a/drivers/ide/pci/sc1200.c
+++ b/drivers/ide/pci/sc1200.c
@@ -507,7 +507,7 @@ static struct pci_driver driver = {
507#endif 507#endif
508}; 508};
509 509
510static int sc1200_ide_init(void) 510static int __init sc1200_ide_init(void)
511{ 511{
512 return ide_pci_register_driver(&driver); 512 return ide_pci_register_driver(&driver);
513} 513}
diff --git a/drivers/ide/pci/serverworks.c b/drivers/ide/pci/serverworks.c
index 057548d07205..ea9a28a45853 100644
--- a/drivers/ide/pci/serverworks.c
+++ b/drivers/ide/pci/serverworks.c
@@ -666,7 +666,7 @@ static struct pci_driver driver = {
666 .probe = svwks_init_one, 666 .probe = svwks_init_one,
667}; 667};
668 668
669static int svwks_ide_init(void) 669static int __init svwks_ide_init(void)
670{ 670{
671 return ide_pci_register_driver(&driver); 671 return ide_pci_register_driver(&driver);
672} 672}
diff --git a/drivers/ide/pci/sgiioc4.c b/drivers/ide/pci/sgiioc4.c
index cfad09accf52..b0bf01809279 100644
--- a/drivers/ide/pci/sgiioc4.c
+++ b/drivers/ide/pci/sgiioc4.c
@@ -762,8 +762,7 @@ static struct ioc4_submodule ioc4_ide_submodule = {
762/* .is_remove = ioc4_ide_remove_one, */ 762/* .is_remove = ioc4_ide_remove_one, */
763}; 763};
764 764
765static int __devinit 765static int __init ioc4_ide_init(void)
766ioc4_ide_init(void)
767{ 766{
768 return ioc4_register_submodule(&ioc4_ide_submodule); 767 return ioc4_register_submodule(&ioc4_ide_submodule);
769} 768}
diff --git a/drivers/ide/pci/siimage.c b/drivers/ide/pci/siimage.c
index 697f566fb90a..4ff89c7d990a 100644
--- a/drivers/ide/pci/siimage.c
+++ b/drivers/ide/pci/siimage.c
@@ -1096,7 +1096,7 @@ static struct pci_driver driver = {
1096 .probe = siimage_init_one, 1096 .probe = siimage_init_one,
1097}; 1097};
1098 1098
1099static int siimage_ide_init(void) 1099static int __init siimage_ide_init(void)
1100{ 1100{
1101 return ide_pci_register_driver(&driver); 1101 return ide_pci_register_driver(&driver);
1102} 1102}
diff --git a/drivers/ide/pci/sis5513.c b/drivers/ide/pci/sis5513.c
index 6b313139b5e4..1afff659ab55 100644
--- a/drivers/ide/pci/sis5513.c
+++ b/drivers/ide/pci/sis5513.c
@@ -968,7 +968,7 @@ static struct pci_driver driver = {
968 .probe = sis5513_init_one, 968 .probe = sis5513_init_one,
969}; 969};
970 970
971static int sis5513_ide_init(void) 971static int __init sis5513_ide_init(void)
972{ 972{
973 return ide_pci_register_driver(&driver); 973 return ide_pci_register_driver(&driver);
974} 974}
diff --git a/drivers/ide/pci/sl82c105.c b/drivers/ide/pci/sl82c105.c
index 5afefe8692fe..170a26199050 100644
--- a/drivers/ide/pci/sl82c105.c
+++ b/drivers/ide/pci/sl82c105.c
@@ -492,7 +492,7 @@ static struct pci_driver driver = {
492 .probe = sl82c105_init_one, 492 .probe = sl82c105_init_one,
493}; 493};
494 494
495static int sl82c105_ide_init(void) 495static int __init sl82c105_ide_init(void)
496{ 496{
497 return ide_pci_register_driver(&driver); 497 return ide_pci_register_driver(&driver);
498} 498}
diff --git a/drivers/ide/pci/slc90e66.c b/drivers/ide/pci/slc90e66.c
index 9be7e49cba0e..90e79c0844d2 100644
--- a/drivers/ide/pci/slc90e66.c
+++ b/drivers/ide/pci/slc90e66.c
@@ -253,7 +253,7 @@ static struct pci_driver driver = {
253 .probe = slc90e66_init_one, 253 .probe = slc90e66_init_one,
254}; 254};
255 255
256static int slc90e66_ide_init(void) 256static int __init slc90e66_ide_init(void)
257{ 257{
258 return ide_pci_register_driver(&driver); 258 return ide_pci_register_driver(&driver);
259} 259}
diff --git a/drivers/ide/pci/triflex.c b/drivers/ide/pci/triflex.c
index 56d84931d6de..b13cce1fd1a6 100644
--- a/drivers/ide/pci/triflex.c
+++ b/drivers/ide/pci/triflex.c
@@ -173,7 +173,7 @@ static struct pci_driver driver = {
173 .probe = triflex_init_one, 173 .probe = triflex_init_one,
174}; 174};
175 175
176static int triflex_ide_init(void) 176static int __init triflex_ide_init(void)
177{ 177{
178 return ide_pci_register_driver(&driver); 178 return ide_pci_register_driver(&driver);
179} 179}
diff --git a/drivers/ide/pci/trm290.c b/drivers/ide/pci/trm290.c
index 2a282529bfc1..174b88c4780e 100644
--- a/drivers/ide/pci/trm290.c
+++ b/drivers/ide/pci/trm290.c
@@ -355,7 +355,7 @@ static struct pci_driver driver = {
355 .probe = trm290_init_one, 355 .probe = trm290_init_one,
356}; 356};
357 357
358static int trm290_ide_init(void) 358static int __init trm290_ide_init(void)
359{ 359{
360 return ide_pci_register_driver(&driver); 360 return ide_pci_register_driver(&driver);
361} 361}
diff --git a/drivers/ide/pci/via82cxxx.c b/drivers/ide/pci/via82cxxx.c
index 381cc6f101ce..6fb6e50b8231 100644
--- a/drivers/ide/pci/via82cxxx.c
+++ b/drivers/ide/pci/via82cxxx.c
@@ -78,6 +78,8 @@ static struct via_isa_bridge {
78 u8 rev_max; 78 u8 rev_max;
79 u16 flags; 79 u16 flags;
80} via_isa_bridges[] = { 80} via_isa_bridges[] = {
81 { "cx700", PCI_DEVICE_ID_VIA_CX700, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST },
82 { "vt8237s", PCI_DEVICE_ID_VIA_8237S, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST },
81 { "vt6410", PCI_DEVICE_ID_VIA_6410, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, 83 { "vt6410", PCI_DEVICE_ID_VIA_6410, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST },
82 { "vt8251", PCI_DEVICE_ID_VIA_8251, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, 84 { "vt8251", PCI_DEVICE_ID_VIA_8251, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST },
83 { "vt8237", PCI_DEVICE_ID_VIA_8237, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, 85 { "vt8237", PCI_DEVICE_ID_VIA_8237, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST },
@@ -504,6 +506,7 @@ static struct pci_device_id via_pci_tbl[] = {
504 { PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C576_1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, 506 { PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C576_1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
505 { PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, 507 { PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
506 { PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_6410, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1}, 508 { PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_6410, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1},
509 { PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_SATA_EIDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1},
507 { 0, }, 510 { 0, },
508}; 511};
509MODULE_DEVICE_TABLE(pci, via_pci_tbl); 512MODULE_DEVICE_TABLE(pci, via_pci_tbl);
@@ -514,7 +517,7 @@ static struct pci_driver driver = {
514 .probe = via_init_one, 517 .probe = via_init_one,
515}; 518};
516 519
517static int via_ide_init(void) 520static int __init via_ide_init(void)
518{ 521{
519 return ide_pci_register_driver(&driver); 522 return ide_pci_register_driver(&driver);
520} 523}
diff --git a/drivers/infiniband/hw/ehca/ehca_cq.c b/drivers/infiniband/hw/ehca/ehca_cq.c
index 93995b658d94..6074c897f51c 100644
--- a/drivers/infiniband/hw/ehca/ehca_cq.c
+++ b/drivers/infiniband/hw/ehca/ehca_cq.c
@@ -344,8 +344,11 @@ int ehca_destroy_cq(struct ib_cq *cq)
344 unsigned long flags; 344 unsigned long flags;
345 345
346 spin_lock_irqsave(&ehca_cq_idr_lock, flags); 346 spin_lock_irqsave(&ehca_cq_idr_lock, flags);
347 while (my_cq->nr_callbacks) 347 while (my_cq->nr_callbacks) {
348 spin_unlock_irqrestore(&ehca_cq_idr_lock, flags);
348 yield(); 349 yield();
350 spin_lock_irqsave(&ehca_cq_idr_lock, flags);
351 }
349 352
350 idr_remove(&ehca_cq_idr, my_cq->token); 353 idr_remove(&ehca_cq_idr, my_cq->token);
351 spin_unlock_irqrestore(&ehca_cq_idr_lock, flags); 354 spin_unlock_irqrestore(&ehca_cq_idr_lock, flags);
diff --git a/drivers/infiniband/hw/ehca/ehca_irq.c b/drivers/infiniband/hw/ehca/ehca_irq.c
index e7209afb4250..c069be8cbcb2 100644
--- a/drivers/infiniband/hw/ehca/ehca_irq.c
+++ b/drivers/infiniband/hw/ehca/ehca_irq.c
@@ -440,7 +440,8 @@ void ehca_tasklet_eq(unsigned long data)
440 cq = idr_find(&ehca_cq_idr, token); 440 cq = idr_find(&ehca_cq_idr, token);
441 441
442 if (cq == NULL) { 442 if (cq == NULL) {
443 spin_unlock(&ehca_cq_idr_lock); 443 spin_unlock_irqrestore(&ehca_cq_idr_lock,
444 flags);
444 break; 445 break;
445 } 446 }
446 447
diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
index cdecbf5911c8..72611fd15103 100644
--- a/drivers/infiniband/ulp/srp/ib_srp.c
+++ b/drivers/infiniband/ulp/srp/ib_srp.c
@@ -1621,18 +1621,30 @@ static int srp_parse_options(const char *buf, struct srp_target_port *target)
1621 switch (token) { 1621 switch (token) {
1622 case SRP_OPT_ID_EXT: 1622 case SRP_OPT_ID_EXT:
1623 p = match_strdup(args); 1623 p = match_strdup(args);
1624 if (!p) {
1625 ret = -ENOMEM;
1626 goto out;
1627 }
1624 target->id_ext = cpu_to_be64(simple_strtoull(p, NULL, 16)); 1628 target->id_ext = cpu_to_be64(simple_strtoull(p, NULL, 16));
1625 kfree(p); 1629 kfree(p);
1626 break; 1630 break;
1627 1631
1628 case SRP_OPT_IOC_GUID: 1632 case SRP_OPT_IOC_GUID:
1629 p = match_strdup(args); 1633 p = match_strdup(args);
1634 if (!p) {
1635 ret = -ENOMEM;
1636 goto out;
1637 }
1630 target->ioc_guid = cpu_to_be64(simple_strtoull(p, NULL, 16)); 1638 target->ioc_guid = cpu_to_be64(simple_strtoull(p, NULL, 16));
1631 kfree(p); 1639 kfree(p);
1632 break; 1640 break;
1633 1641
1634 case SRP_OPT_DGID: 1642 case SRP_OPT_DGID:
1635 p = match_strdup(args); 1643 p = match_strdup(args);
1644 if (!p) {
1645 ret = -ENOMEM;
1646 goto out;
1647 }
1636 if (strlen(p) != 32) { 1648 if (strlen(p) != 32) {
1637 printk(KERN_WARNING PFX "bad dest GID parameter '%s'\n", p); 1649 printk(KERN_WARNING PFX "bad dest GID parameter '%s'\n", p);
1638 kfree(p); 1650 kfree(p);
@@ -1656,6 +1668,10 @@ static int srp_parse_options(const char *buf, struct srp_target_port *target)
1656 1668
1657 case SRP_OPT_SERVICE_ID: 1669 case SRP_OPT_SERVICE_ID:
1658 p = match_strdup(args); 1670 p = match_strdup(args);
1671 if (!p) {
1672 ret = -ENOMEM;
1673 goto out;
1674 }
1659 target->service_id = cpu_to_be64(simple_strtoull(p, NULL, 16)); 1675 target->service_id = cpu_to_be64(simple_strtoull(p, NULL, 16));
1660 kfree(p); 1676 kfree(p);
1661 break; 1677 break;
@@ -1693,6 +1709,10 @@ static int srp_parse_options(const char *buf, struct srp_target_port *target)
1693 1709
1694 case SRP_OPT_INITIATOR_EXT: 1710 case SRP_OPT_INITIATOR_EXT:
1695 p = match_strdup(args); 1711 p = match_strdup(args);
1712 if (!p) {
1713 ret = -ENOMEM;
1714 goto out;
1715 }
1696 target->initiator_ext = cpu_to_be64(simple_strtoull(p, NULL, 16)); 1716 target->initiator_ext = cpu_to_be64(simple_strtoull(p, NULL, 16));
1697 kfree(p); 1717 kfree(p);
1698 break; 1718 break;
diff --git a/drivers/isdn/gigaset/common.c b/drivers/isdn/gigaset/common.c
index 95eff3b2917a..4f75cce6fdff 100644
--- a/drivers/isdn/gigaset/common.c
+++ b/drivers/isdn/gigaset/common.c
@@ -356,16 +356,17 @@ static struct cardstate *alloc_cs(struct gigaset_driver *drv)
356{ 356{
357 unsigned long flags; 357 unsigned long flags;
358 unsigned i; 358 unsigned i;
359 static struct cardstate *ret = NULL; 359 struct cardstate *ret = NULL;
360 360
361 spin_lock_irqsave(&drv->lock, flags); 361 spin_lock_irqsave(&drv->lock, flags);
362 for (i = 0; i < drv->minors; ++i) { 362 for (i = 0; i < drv->minors; ++i) {
363 if (!(drv->flags[i] & VALID_MINOR)) { 363 if (!(drv->flags[i] & VALID_MINOR)) {
364 drv->flags[i] = VALID_MINOR; 364 if (try_module_get(drv->owner)) {
365 ret = drv->cs + i; 365 drv->flags[i] = VALID_MINOR;
366 } 366 ret = drv->cs + i;
367 if (ret) 367 }
368 break; 368 break;
369 }
369 } 370 }
370 spin_unlock_irqrestore(&drv->lock, flags); 371 spin_unlock_irqrestore(&drv->lock, flags);
371 return ret; 372 return ret;
@@ -376,6 +377,8 @@ static void free_cs(struct cardstate *cs)
376 unsigned long flags; 377 unsigned long flags;
377 struct gigaset_driver *drv = cs->driver; 378 struct gigaset_driver *drv = cs->driver;
378 spin_lock_irqsave(&drv->lock, flags); 379 spin_lock_irqsave(&drv->lock, flags);
380 if (drv->flags[cs->minor_index] & VALID_MINOR)
381 module_put(drv->owner);
379 drv->flags[cs->minor_index] = 0; 382 drv->flags[cs->minor_index] = 0;
380 spin_unlock_irqrestore(&drv->lock, flags); 383 spin_unlock_irqrestore(&drv->lock, flags);
381} 384}
@@ -579,7 +582,7 @@ static struct bc_state *gigaset_initbcs(struct bc_state *bcs,
579 } else if ((bcs->skb = dev_alloc_skb(SBUFSIZE + HW_HDR_LEN)) != NULL) 582 } else if ((bcs->skb = dev_alloc_skb(SBUFSIZE + HW_HDR_LEN)) != NULL)
580 skb_reserve(bcs->skb, HW_HDR_LEN); 583 skb_reserve(bcs->skb, HW_HDR_LEN);
581 else { 584 else {
582 warn("could not allocate skb\n"); 585 warn("could not allocate skb");
583 bcs->inputstate |= INS_skip_frame; 586 bcs->inputstate |= INS_skip_frame;
584 } 587 }
585 588
@@ -632,17 +635,25 @@ struct cardstate *gigaset_initcs(struct gigaset_driver *drv, int channels,
632 int i; 635 int i;
633 636
634 gig_dbg(DEBUG_INIT, "allocating cs"); 637 gig_dbg(DEBUG_INIT, "allocating cs");
635 cs = alloc_cs(drv); 638 if (!(cs = alloc_cs(drv))) {
636 if (!cs) 639 err("maximum number of devices exceeded");
637 goto error; 640 return NULL;
641 }
642 mutex_init(&cs->mutex);
643 mutex_lock(&cs->mutex);
644
638 gig_dbg(DEBUG_INIT, "allocating bcs[0..%d]", channels - 1); 645 gig_dbg(DEBUG_INIT, "allocating bcs[0..%d]", channels - 1);
639 cs->bcs = kmalloc(channels * sizeof(struct bc_state), GFP_KERNEL); 646 cs->bcs = kmalloc(channels * sizeof(struct bc_state), GFP_KERNEL);
640 if (!cs->bcs) 647 if (!cs->bcs) {
648 err("out of memory");
641 goto error; 649 goto error;
650 }
642 gig_dbg(DEBUG_INIT, "allocating inbuf"); 651 gig_dbg(DEBUG_INIT, "allocating inbuf");
643 cs->inbuf = kmalloc(sizeof(struct inbuf_t), GFP_KERNEL); 652 cs->inbuf = kmalloc(sizeof(struct inbuf_t), GFP_KERNEL);
644 if (!cs->inbuf) 653 if (!cs->inbuf) {
654 err("out of memory");
645 goto error; 655 goto error;
656 }
646 657
647 cs->cs_init = 0; 658 cs->cs_init = 0;
648 cs->channels = channels; 659 cs->channels = channels;
@@ -654,8 +665,6 @@ struct cardstate *gigaset_initcs(struct gigaset_driver *drv, int channels,
654 spin_lock_init(&cs->ev_lock); 665 spin_lock_init(&cs->ev_lock);
655 cs->ev_tail = 0; 666 cs->ev_tail = 0;
656 cs->ev_head = 0; 667 cs->ev_head = 0;
657 mutex_init(&cs->mutex);
658 mutex_lock(&cs->mutex);
659 668
660 tasklet_init(&cs->event_tasklet, &gigaset_handle_event, 669 tasklet_init(&cs->event_tasklet, &gigaset_handle_event,
661 (unsigned long) cs); 670 (unsigned long) cs);
@@ -684,8 +693,10 @@ struct cardstate *gigaset_initcs(struct gigaset_driver *drv, int channels,
684 693
685 for (i = 0; i < channels; ++i) { 694 for (i = 0; i < channels; ++i) {
686 gig_dbg(DEBUG_INIT, "setting up bcs[%d].read", i); 695 gig_dbg(DEBUG_INIT, "setting up bcs[%d].read", i);
687 if (!gigaset_initbcs(cs->bcs + i, cs, i)) 696 if (!gigaset_initbcs(cs->bcs + i, cs, i)) {
697 err("could not allocate channel %d data", i);
688 goto error; 698 goto error;
699 }
689 } 700 }
690 701
691 ++cs->cs_init; 702 ++cs->cs_init;
@@ -720,8 +731,10 @@ struct cardstate *gigaset_initcs(struct gigaset_driver *drv, int channels,
720 make_valid(cs, VALID_ID); 731 make_valid(cs, VALID_ID);
721 ++cs->cs_init; 732 ++cs->cs_init;
722 gig_dbg(DEBUG_INIT, "setting up hw"); 733 gig_dbg(DEBUG_INIT, "setting up hw");
723 if (!cs->ops->initcshw(cs)) 734 if (!cs->ops->initcshw(cs)) {
735 err("could not allocate device specific data");
724 goto error; 736 goto error;
737 }
725 738
726 ++cs->cs_init; 739 ++cs->cs_init;
727 740
@@ -743,8 +756,8 @@ struct cardstate *gigaset_initcs(struct gigaset_driver *drv, int channels,
743 mutex_unlock(&cs->mutex); 756 mutex_unlock(&cs->mutex);
744 return cs; 757 return cs;
745 758
746error: if (cs) 759error:
747 mutex_unlock(&cs->mutex); 760 mutex_unlock(&cs->mutex);
748 gig_dbg(DEBUG_INIT, "failed"); 761 gig_dbg(DEBUG_INIT, "failed");
749 gigaset_freecs(cs); 762 gigaset_freecs(cs);
750 return NULL; 763 return NULL;
@@ -1040,7 +1053,6 @@ void gigaset_freedriver(struct gigaset_driver *drv)
1040 spin_unlock_irqrestore(&driver_lock, flags); 1053 spin_unlock_irqrestore(&driver_lock, flags);
1041 1054
1042 gigaset_if_freedriver(drv); 1055 gigaset_if_freedriver(drv);
1043 module_put(drv->owner);
1044 1056
1045 kfree(drv->cs); 1057 kfree(drv->cs);
1046 kfree(drv->flags); 1058 kfree(drv->flags);
@@ -1072,10 +1084,6 @@ struct gigaset_driver *gigaset_initdriver(unsigned minor, unsigned minors,
1072 if (!drv) 1084 if (!drv)
1073 return NULL; 1085 return NULL;
1074 1086
1075 if (!try_module_get(owner))
1076 goto out1;
1077
1078 drv->cs = NULL;
1079 drv->have_tty = 0; 1087 drv->have_tty = 0;
1080 drv->minor = minor; 1088 drv->minor = minor;
1081 drv->minors = minors; 1089 drv->minors = minors;
@@ -1087,11 +1095,11 @@ struct gigaset_driver *gigaset_initdriver(unsigned minor, unsigned minors,
1087 1095
1088 drv->cs = kmalloc(minors * sizeof *drv->cs, GFP_KERNEL); 1096 drv->cs = kmalloc(minors * sizeof *drv->cs, GFP_KERNEL);
1089 if (!drv->cs) 1097 if (!drv->cs)
1090 goto out2; 1098 goto error;
1091 1099
1092 drv->flags = kmalloc(minors * sizeof *drv->flags, GFP_KERNEL); 1100 drv->flags = kmalloc(minors * sizeof *drv->flags, GFP_KERNEL);
1093 if (!drv->flags) 1101 if (!drv->flags)
1094 goto out3; 1102 goto error;
1095 1103
1096 for (i = 0; i < minors; ++i) { 1104 for (i = 0; i < minors; ++i) {
1097 drv->flags[i] = 0; 1105 drv->flags[i] = 0;
@@ -1108,11 +1116,8 @@ struct gigaset_driver *gigaset_initdriver(unsigned minor, unsigned minors,
1108 1116
1109 return drv; 1117 return drv;
1110 1118
1111out3: 1119error:
1112 kfree(drv->cs); 1120 kfree(drv->cs);
1113out2:
1114 module_put(owner);
1115out1:
1116 kfree(drv); 1121 kfree(drv);
1117 return NULL; 1122 return NULL;
1118} 1123}
diff --git a/drivers/kvm/kvm.h b/drivers/kvm/kvm.h
index 91e0c75aca8f..2db1ca4c6800 100644
--- a/drivers/kvm/kvm.h
+++ b/drivers/kvm/kvm.h
@@ -242,6 +242,7 @@ struct kvm_vcpu {
242 u64 pdptrs[4]; /* pae */ 242 u64 pdptrs[4]; /* pae */
243 u64 shadow_efer; 243 u64 shadow_efer;
244 u64 apic_base; 244 u64 apic_base;
245 u64 ia32_misc_enable_msr;
245 int nmsrs; 246 int nmsrs;
246 struct vmx_msr_entry *guest_msrs; 247 struct vmx_msr_entry *guest_msrs;
247 struct vmx_msr_entry *host_msrs; 248 struct vmx_msr_entry *host_msrs;
diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c
index 67c1154960f0..b10972ed0c9f 100644
--- a/drivers/kvm/kvm_main.c
+++ b/drivers/kvm/kvm_main.c
@@ -272,7 +272,9 @@ static void kvm_free_physmem(struct kvm *kvm)
272 272
273static void kvm_free_vcpu(struct kvm_vcpu *vcpu) 273static void kvm_free_vcpu(struct kvm_vcpu *vcpu)
274{ 274{
275 vcpu_load(vcpu->kvm, vcpu_slot(vcpu));
275 kvm_mmu_destroy(vcpu); 276 kvm_mmu_destroy(vcpu);
277 vcpu_put(vcpu);
276 kvm_arch_ops->vcpu_free(vcpu); 278 kvm_arch_ops->vcpu_free(vcpu);
277} 279}
278 280
@@ -1224,6 +1226,9 @@ int kvm_get_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 *pdata)
1224 case MSR_IA32_APICBASE: 1226 case MSR_IA32_APICBASE:
1225 data = vcpu->apic_base; 1227 data = vcpu->apic_base;
1226 break; 1228 break;
1229 case MSR_IA32_MISC_ENABLE:
1230 data = vcpu->ia32_misc_enable_msr;
1231 break;
1227#ifdef CONFIG_X86_64 1232#ifdef CONFIG_X86_64
1228 case MSR_EFER: 1233 case MSR_EFER:
1229 data = vcpu->shadow_efer; 1234 data = vcpu->shadow_efer;
@@ -1295,6 +1300,9 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 data)
1295 case MSR_IA32_APICBASE: 1300 case MSR_IA32_APICBASE:
1296 vcpu->apic_base = data; 1301 vcpu->apic_base = data;
1297 break; 1302 break;
1303 case MSR_IA32_MISC_ENABLE:
1304 vcpu->ia32_misc_enable_msr = data;
1305 break;
1298 default: 1306 default:
1299 printk(KERN_ERR "kvm: unhandled wrmsr: 0x%x\n", msr); 1307 printk(KERN_ERR "kvm: unhandled wrmsr: 0x%x\n", msr);
1300 return 1; 1308 return 1;
@@ -1598,6 +1606,10 @@ static u32 msrs_to_save[] = {
1598 1606
1599static unsigned num_msrs_to_save; 1607static unsigned num_msrs_to_save;
1600 1608
1609static u32 emulated_msrs[] = {
1610 MSR_IA32_MISC_ENABLE,
1611};
1612
1601static __init void kvm_init_msr_list(void) 1613static __init void kvm_init_msr_list(void)
1602{ 1614{
1603 u32 dummy[2]; 1615 u32 dummy[2];
@@ -1923,7 +1935,7 @@ static long kvm_dev_ioctl(struct file *filp,
1923 if (copy_from_user(&msr_list, user_msr_list, sizeof msr_list)) 1935 if (copy_from_user(&msr_list, user_msr_list, sizeof msr_list))
1924 goto out; 1936 goto out;
1925 n = msr_list.nmsrs; 1937 n = msr_list.nmsrs;
1926 msr_list.nmsrs = num_msrs_to_save; 1938 msr_list.nmsrs = num_msrs_to_save + ARRAY_SIZE(emulated_msrs);
1927 if (copy_to_user(user_msr_list, &msr_list, sizeof msr_list)) 1939 if (copy_to_user(user_msr_list, &msr_list, sizeof msr_list))
1928 goto out; 1940 goto out;
1929 r = -E2BIG; 1941 r = -E2BIG;
@@ -1933,6 +1945,11 @@ static long kvm_dev_ioctl(struct file *filp,
1933 if (copy_to_user(user_msr_list->indices, &msrs_to_save, 1945 if (copy_to_user(user_msr_list->indices, &msrs_to_save,
1934 num_msrs_to_save * sizeof(u32))) 1946 num_msrs_to_save * sizeof(u32)))
1935 goto out; 1947 goto out;
1948 if (copy_to_user(user_msr_list->indices
1949 + num_msrs_to_save * sizeof(u32),
1950 &emulated_msrs,
1951 ARRAY_SIZE(emulated_msrs) * sizeof(u32)))
1952 goto out;
1936 r = 0; 1953 r = 0;
1937 break; 1954 break;
1938 } 1955 }
diff --git a/drivers/kvm/mmu.c b/drivers/kvm/mmu.c
index c6f972914f08..22c426cd8cb2 100644
--- a/drivers/kvm/mmu.c
+++ b/drivers/kvm/mmu.c
@@ -143,6 +143,7 @@ static int dbg = 1;
143#define PFERR_PRESENT_MASK (1U << 0) 143#define PFERR_PRESENT_MASK (1U << 0)
144#define PFERR_WRITE_MASK (1U << 1) 144#define PFERR_WRITE_MASK (1U << 1)
145#define PFERR_USER_MASK (1U << 2) 145#define PFERR_USER_MASK (1U << 2)
146#define PFERR_FETCH_MASK (1U << 4)
146 147
147#define PT64_ROOT_LEVEL 4 148#define PT64_ROOT_LEVEL 4
148#define PT32_ROOT_LEVEL 2 149#define PT32_ROOT_LEVEL 2
@@ -168,6 +169,11 @@ static int is_cpuid_PSE36(void)
168 return 1; 169 return 1;
169} 170}
170 171
172static int is_nx(struct kvm_vcpu *vcpu)
173{
174 return vcpu->shadow_efer & EFER_NX;
175}
176
171static int is_present_pte(unsigned long pte) 177static int is_present_pte(unsigned long pte)
172{ 178{
173 return pte & PT_PRESENT_MASK; 179 return pte & PT_PRESENT_MASK;
@@ -992,16 +998,6 @@ static inline int fix_read_pf(u64 *shadow_ent)
992 return 0; 998 return 0;
993} 999}
994 1000
995static int may_access(u64 pte, int write, int user)
996{
997
998 if (user && !(pte & PT_USER_MASK))
999 return 0;
1000 if (write && !(pte & PT_WRITABLE_MASK))
1001 return 0;
1002 return 1;
1003}
1004
1005static void paging_free(struct kvm_vcpu *vcpu) 1001static void paging_free(struct kvm_vcpu *vcpu)
1006{ 1002{
1007 nonpaging_free(vcpu); 1003 nonpaging_free(vcpu);
diff --git a/drivers/kvm/paging_tmpl.h b/drivers/kvm/paging_tmpl.h
index 2dbf4307ed9e..149fa45fd9a5 100644
--- a/drivers/kvm/paging_tmpl.h
+++ b/drivers/kvm/paging_tmpl.h
@@ -63,13 +63,15 @@ struct guest_walker {
63 pt_element_t *ptep; 63 pt_element_t *ptep;
64 pt_element_t inherited_ar; 64 pt_element_t inherited_ar;
65 gfn_t gfn; 65 gfn_t gfn;
66 u32 error_code;
66}; 67};
67 68
68/* 69/*
69 * Fetch a guest pte for a guest virtual address 70 * Fetch a guest pte for a guest virtual address
70 */ 71 */
71static void FNAME(walk_addr)(struct guest_walker *walker, 72static int FNAME(walk_addr)(struct guest_walker *walker,
72 struct kvm_vcpu *vcpu, gva_t addr) 73 struct kvm_vcpu *vcpu, gva_t addr,
74 int write_fault, int user_fault, int fetch_fault)
73{ 75{
74 hpa_t hpa; 76 hpa_t hpa;
75 struct kvm_memory_slot *slot; 77 struct kvm_memory_slot *slot;
@@ -86,7 +88,7 @@ static void FNAME(walk_addr)(struct guest_walker *walker,
86 walker->ptep = &vcpu->pdptrs[(addr >> 30) & 3]; 88 walker->ptep = &vcpu->pdptrs[(addr >> 30) & 3];
87 root = *walker->ptep; 89 root = *walker->ptep;
88 if (!(root & PT_PRESENT_MASK)) 90 if (!(root & PT_PRESENT_MASK))
89 return; 91 goto not_present;
90 --walker->level; 92 --walker->level;
91 } 93 }
92#endif 94#endif
@@ -111,11 +113,23 @@ static void FNAME(walk_addr)(struct guest_walker *walker,
111 ASSERT(((unsigned long)walker->table & PAGE_MASK) == 113 ASSERT(((unsigned long)walker->table & PAGE_MASK) ==
112 ((unsigned long)ptep & PAGE_MASK)); 114 ((unsigned long)ptep & PAGE_MASK));
113 115
114 if (is_present_pte(*ptep) && !(*ptep & PT_ACCESSED_MASK))
115 *ptep |= PT_ACCESSED_MASK;
116
117 if (!is_present_pte(*ptep)) 116 if (!is_present_pte(*ptep))
118 break; 117 goto not_present;
118
119 if (write_fault && !is_writeble_pte(*ptep))
120 if (user_fault || is_write_protection(vcpu))
121 goto access_error;
122
123 if (user_fault && !(*ptep & PT_USER_MASK))
124 goto access_error;
125
126#if PTTYPE == 64
127 if (fetch_fault && is_nx(vcpu) && (*ptep & PT64_NX_MASK))
128 goto access_error;
129#endif
130
131 if (!(*ptep & PT_ACCESSED_MASK))
132 *ptep |= PT_ACCESSED_MASK; /* avoid rmw */
119 133
120 if (walker->level == PT_PAGE_TABLE_LEVEL) { 134 if (walker->level == PT_PAGE_TABLE_LEVEL) {
121 walker->gfn = (*ptep & PT_BASE_ADDR_MASK) 135 walker->gfn = (*ptep & PT_BASE_ADDR_MASK)
@@ -146,6 +160,23 @@ static void FNAME(walk_addr)(struct guest_walker *walker,
146 } 160 }
147 walker->ptep = ptep; 161 walker->ptep = ptep;
148 pgprintk("%s: pte %llx\n", __FUNCTION__, (u64)*ptep); 162 pgprintk("%s: pte %llx\n", __FUNCTION__, (u64)*ptep);
163 return 1;
164
165not_present:
166 walker->error_code = 0;
167 goto err;
168
169access_error:
170 walker->error_code = PFERR_PRESENT_MASK;
171
172err:
173 if (write_fault)
174 walker->error_code |= PFERR_WRITE_MASK;
175 if (user_fault)
176 walker->error_code |= PFERR_USER_MASK;
177 if (fetch_fault)
178 walker->error_code |= PFERR_FETCH_MASK;
179 return 0;
149} 180}
150 181
151static void FNAME(release_walker)(struct guest_walker *walker) 182static void FNAME(release_walker)(struct guest_walker *walker)
@@ -274,7 +305,7 @@ static int FNAME(fix_write_pf)(struct kvm_vcpu *vcpu,
274 struct kvm_mmu_page *page; 305 struct kvm_mmu_page *page;
275 306
276 if (is_writeble_pte(*shadow_ent)) 307 if (is_writeble_pte(*shadow_ent))
277 return 0; 308 return !user || (*shadow_ent & PT_USER_MASK);
278 309
279 writable_shadow = *shadow_ent & PT_SHADOW_WRITABLE_MASK; 310 writable_shadow = *shadow_ent & PT_SHADOW_WRITABLE_MASK;
280 if (user) { 311 if (user) {
@@ -347,8 +378,8 @@ static int FNAME(page_fault)(struct kvm_vcpu *vcpu, gva_t addr,
347 u32 error_code) 378 u32 error_code)
348{ 379{
349 int write_fault = error_code & PFERR_WRITE_MASK; 380 int write_fault = error_code & PFERR_WRITE_MASK;
350 int pte_present = error_code & PFERR_PRESENT_MASK;
351 int user_fault = error_code & PFERR_USER_MASK; 381 int user_fault = error_code & PFERR_USER_MASK;
382 int fetch_fault = error_code & PFERR_FETCH_MASK;
352 struct guest_walker walker; 383 struct guest_walker walker;
353 u64 *shadow_pte; 384 u64 *shadow_pte;
354 int fixed; 385 int fixed;
@@ -365,19 +396,20 @@ static int FNAME(page_fault)(struct kvm_vcpu *vcpu, gva_t addr,
365 /* 396 /*
366 * Look up the shadow pte for the faulting address. 397 * Look up the shadow pte for the faulting address.
367 */ 398 */
368 FNAME(walk_addr)(&walker, vcpu, addr); 399 r = FNAME(walk_addr)(&walker, vcpu, addr, write_fault, user_fault,
369 shadow_pte = FNAME(fetch)(vcpu, addr, &walker); 400 fetch_fault);
370 401
371 /* 402 /*
372 * The page is not mapped by the guest. Let the guest handle it. 403 * The page is not mapped by the guest. Let the guest handle it.
373 */ 404 */
374 if (!shadow_pte) { 405 if (!r) {
375 pgprintk("%s: not mapped\n", __FUNCTION__); 406 pgprintk("%s: guest page fault\n", __FUNCTION__);
376 inject_page_fault(vcpu, addr, error_code); 407 inject_page_fault(vcpu, addr, walker.error_code);
377 FNAME(release_walker)(&walker); 408 FNAME(release_walker)(&walker);
378 return 0; 409 return 0;
379 } 410 }
380 411
412 shadow_pte = FNAME(fetch)(vcpu, addr, &walker);
381 pgprintk("%s: shadow pte %p %llx\n", __FUNCTION__, 413 pgprintk("%s: shadow pte %p %llx\n", __FUNCTION__,
382 shadow_pte, *shadow_pte); 414 shadow_pte, *shadow_pte);
383 415
@@ -399,22 +431,7 @@ static int FNAME(page_fault)(struct kvm_vcpu *vcpu, gva_t addr,
399 * mmio: emulate if accessible, otherwise its a guest fault. 431 * mmio: emulate if accessible, otherwise its a guest fault.
400 */ 432 */
401 if (is_io_pte(*shadow_pte)) { 433 if (is_io_pte(*shadow_pte)) {
402 if (may_access(*shadow_pte, write_fault, user_fault)) 434 return 1;
403 return 1;
404 pgprintk("%s: io work, no access\n", __FUNCTION__);
405 inject_page_fault(vcpu, addr,
406 error_code | PFERR_PRESENT_MASK);
407 kvm_mmu_audit(vcpu, "post page fault (io)");
408 return 0;
409 }
410
411 /*
412 * pte not present, guest page fault.
413 */
414 if (pte_present && !fixed && !write_pt) {
415 inject_page_fault(vcpu, addr, error_code);
416 kvm_mmu_audit(vcpu, "post page fault (guest)");
417 return 0;
418 } 435 }
419 436
420 ++kvm_stat.pf_fixed; 437 ++kvm_stat.pf_fixed;
@@ -429,7 +446,7 @@ static gpa_t FNAME(gva_to_gpa)(struct kvm_vcpu *vcpu, gva_t vaddr)
429 pt_element_t guest_pte; 446 pt_element_t guest_pte;
430 gpa_t gpa; 447 gpa_t gpa;
431 448
432 FNAME(walk_addr)(&walker, vcpu, vaddr); 449 FNAME(walk_addr)(&walker, vcpu, vaddr, 0, 0, 0);
433 guest_pte = *walker.ptep; 450 guest_pte = *walker.ptep;
434 FNAME(release_walker)(&walker); 451 FNAME(release_walker)(&walker);
435 452
diff --git a/drivers/kvm/svm.c b/drivers/kvm/svm.c
index 714f6a7841cd..c79df79307ed 100644
--- a/drivers/kvm/svm.c
+++ b/drivers/kvm/svm.c
@@ -502,6 +502,7 @@ static void init_vmcb(struct vmcb *vmcb)
502 (1ULL << INTERCEPT_IOIO_PROT) | 502 (1ULL << INTERCEPT_IOIO_PROT) |
503 (1ULL << INTERCEPT_MSR_PROT) | 503 (1ULL << INTERCEPT_MSR_PROT) |
504 (1ULL << INTERCEPT_TASK_SWITCH) | 504 (1ULL << INTERCEPT_TASK_SWITCH) |
505 (1ULL << INTERCEPT_SHUTDOWN) |
505 (1ULL << INTERCEPT_VMRUN) | 506 (1ULL << INTERCEPT_VMRUN) |
506 (1ULL << INTERCEPT_VMMCALL) | 507 (1ULL << INTERCEPT_VMMCALL) |
507 (1ULL << INTERCEPT_VMLOAD) | 508 (1ULL << INTERCEPT_VMLOAD) |
@@ -680,14 +681,14 @@ static void svm_get_cs_db_l_bits(struct kvm_vcpu *vcpu, int *db, int *l)
680 681
681static void svm_get_idt(struct kvm_vcpu *vcpu, struct descriptor_table *dt) 682static void svm_get_idt(struct kvm_vcpu *vcpu, struct descriptor_table *dt)
682{ 683{
683 dt->limit = vcpu->svm->vmcb->save.ldtr.limit; 684 dt->limit = vcpu->svm->vmcb->save.idtr.limit;
684 dt->base = vcpu->svm->vmcb->save.ldtr.base; 685 dt->base = vcpu->svm->vmcb->save.idtr.base;
685} 686}
686 687
687static void svm_set_idt(struct kvm_vcpu *vcpu, struct descriptor_table *dt) 688static void svm_set_idt(struct kvm_vcpu *vcpu, struct descriptor_table *dt)
688{ 689{
689 vcpu->svm->vmcb->save.ldtr.limit = dt->limit; 690 vcpu->svm->vmcb->save.idtr.limit = dt->limit;
690 vcpu->svm->vmcb->save.ldtr.base = dt->base ; 691 vcpu->svm->vmcb->save.idtr.base = dt->base ;
691} 692}
692 693
693static void svm_get_gdt(struct kvm_vcpu *vcpu, struct descriptor_table *dt) 694static void svm_get_gdt(struct kvm_vcpu *vcpu, struct descriptor_table *dt)
@@ -892,6 +893,19 @@ static int pf_interception(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
892 return 0; 893 return 0;
893} 894}
894 895
896static int shutdown_interception(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
897{
898 /*
899 * VMCB is undefined after a SHUTDOWN intercept
900 * so reinitialize it.
901 */
902 memset(vcpu->svm->vmcb, 0, PAGE_SIZE);
903 init_vmcb(vcpu->svm->vmcb);
904
905 kvm_run->exit_reason = KVM_EXIT_SHUTDOWN;
906 return 0;
907}
908
895static int io_get_override(struct kvm_vcpu *vcpu, 909static int io_get_override(struct kvm_vcpu *vcpu,
896 struct vmcb_seg **seg, 910 struct vmcb_seg **seg,
897 int *addr_override) 911 int *addr_override)
@@ -1149,7 +1163,7 @@ static int svm_set_msr(struct kvm_vcpu *vcpu, unsigned ecx, u64 data)
1149 case MSR_K6_STAR: 1163 case MSR_K6_STAR:
1150 vcpu->svm->vmcb->save.star = data; 1164 vcpu->svm->vmcb->save.star = data;
1151 break; 1165 break;
1152#ifdef CONFIG_X86_64_ 1166#ifdef CONFIG_X86_64
1153 case MSR_LSTAR: 1167 case MSR_LSTAR:
1154 vcpu->svm->vmcb->save.lstar = data; 1168 vcpu->svm->vmcb->save.lstar = data;
1155 break; 1169 break;
@@ -1249,6 +1263,7 @@ static int (*svm_exit_handlers[])(struct kvm_vcpu *vcpu,
1249 [SVM_EXIT_IOIO] = io_interception, 1263 [SVM_EXIT_IOIO] = io_interception,
1250 [SVM_EXIT_MSR] = msr_interception, 1264 [SVM_EXIT_MSR] = msr_interception,
1251 [SVM_EXIT_TASK_SWITCH] = task_switch_interception, 1265 [SVM_EXIT_TASK_SWITCH] = task_switch_interception,
1266 [SVM_EXIT_SHUTDOWN] = shutdown_interception,
1252 [SVM_EXIT_VMRUN] = invalid_op_interception, 1267 [SVM_EXIT_VMRUN] = invalid_op_interception,
1253 [SVM_EXIT_VMMCALL] = invalid_op_interception, 1268 [SVM_EXIT_VMMCALL] = invalid_op_interception,
1254 [SVM_EXIT_VMLOAD] = invalid_op_interception, 1269 [SVM_EXIT_VMLOAD] = invalid_op_interception,
@@ -1407,7 +1422,8 @@ static int svm_vcpu_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
1407 int r; 1422 int r;
1408 1423
1409again: 1424again:
1410 do_interrupt_requests(vcpu, kvm_run); 1425 if (!vcpu->mmio_read_completed)
1426 do_interrupt_requests(vcpu, kvm_run);
1411 1427
1412 clgi(); 1428 clgi();
1413 1429
diff --git a/drivers/kvm/vmx.c b/drivers/kvm/vmx.c
index 0aa2659f6ae5..54c35c0b3181 100644
--- a/drivers/kvm/vmx.c
+++ b/drivers/kvm/vmx.c
@@ -1116,6 +1116,8 @@ static int vmx_vcpu_setup(struct kvm_vcpu *vcpu)
1116 1116
1117 if (rdmsr_safe(index, &data_low, &data_high) < 0) 1117 if (rdmsr_safe(index, &data_low, &data_high) < 0)
1118 continue; 1118 continue;
1119 if (wrmsr_safe(index, data_low, data_high) < 0)
1120 continue;
1119 data = data_low | ((u64)data_high << 32); 1121 data = data_low | ((u64)data_high << 32);
1120 vcpu->host_msrs[j].index = index; 1122 vcpu->host_msrs[j].index = index;
1121 vcpu->host_msrs[j].reserved = 0; 1123 vcpu->host_msrs[j].reserved = 0;
@@ -1717,7 +1719,8 @@ again:
1717 vmcs_writel(HOST_GS_BASE, segment_base(gs_sel)); 1719 vmcs_writel(HOST_GS_BASE, segment_base(gs_sel));
1718#endif 1720#endif
1719 1721
1720 do_interrupt_requests(vcpu, kvm_run); 1722 if (!vcpu->mmio_read_completed)
1723 do_interrupt_requests(vcpu, kvm_run);
1721 1724
1722 if (vcpu->guest_debug.enabled) 1725 if (vcpu->guest_debug.enabled)
1723 kvm_guest_debug_pre(vcpu); 1726 kvm_guest_debug_pre(vcpu);
diff --git a/drivers/kvm/x86_emulate.c b/drivers/kvm/x86_emulate.c
index be70795b4822..7513cddb929f 100644
--- a/drivers/kvm/x86_emulate.c
+++ b/drivers/kvm/x86_emulate.c
@@ -61,6 +61,7 @@
61#define ModRM (1<<6) 61#define ModRM (1<<6)
62/* Destination is only written; never read. */ 62/* Destination is only written; never read. */
63#define Mov (1<<7) 63#define Mov (1<<7)
64#define BitOp (1<<8)
64 65
65static u8 opcode_table[256] = { 66static u8 opcode_table[256] = {
66 /* 0x00 - 0x07 */ 67 /* 0x00 - 0x07 */
@@ -148,7 +149,7 @@ static u8 opcode_table[256] = {
148 0, 0, ByteOp | DstMem | SrcNone | ModRM, DstMem | SrcNone | ModRM 149 0, 0, ByteOp | DstMem | SrcNone | ModRM, DstMem | SrcNone | ModRM
149}; 150};
150 151
151static u8 twobyte_table[256] = { 152static u16 twobyte_table[256] = {
152 /* 0x00 - 0x0F */ 153 /* 0x00 - 0x0F */
153 0, SrcMem | ModRM | DstReg, 0, 0, 0, 0, ImplicitOps, 0, 154 0, SrcMem | ModRM | DstReg, 0, 0, 0, 0, ImplicitOps, 0,
154 0, 0, 0, 0, 0, ImplicitOps | ModRM, 0, 0, 155 0, 0, 0, 0, 0, ImplicitOps | ModRM, 0, 0,
@@ -180,16 +181,16 @@ static u8 twobyte_table[256] = {
180 /* 0x90 - 0x9F */ 181 /* 0x90 - 0x9F */
181 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 182 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
182 /* 0xA0 - 0xA7 */ 183 /* 0xA0 - 0xA7 */
183 0, 0, 0, DstMem | SrcReg | ModRM, 0, 0, 0, 0, 184 0, 0, 0, DstMem | SrcReg | ModRM | BitOp, 0, 0, 0, 0,
184 /* 0xA8 - 0xAF */ 185 /* 0xA8 - 0xAF */
185 0, 0, 0, DstMem | SrcReg | ModRM, 0, 0, 0, 0, 186 0, 0, 0, DstMem | SrcReg | ModRM | BitOp, 0, 0, 0, 0,
186 /* 0xB0 - 0xB7 */ 187 /* 0xB0 - 0xB7 */
187 ByteOp | DstMem | SrcReg | ModRM, DstMem | SrcReg | ModRM, 0, 188 ByteOp | DstMem | SrcReg | ModRM, DstMem | SrcReg | ModRM, 0,
188 DstMem | SrcReg | ModRM, 189 DstMem | SrcReg | ModRM | BitOp,
189 0, 0, ByteOp | DstReg | SrcMem | ModRM | Mov, 190 0, 0, ByteOp | DstReg | SrcMem | ModRM | Mov,
190 DstReg | SrcMem16 | ModRM | Mov, 191 DstReg | SrcMem16 | ModRM | Mov,
191 /* 0xB8 - 0xBF */ 192 /* 0xB8 - 0xBF */
192 0, 0, DstMem | SrcImmByte | ModRM, DstMem | SrcReg | ModRM, 193 0, 0, DstMem | SrcImmByte | ModRM, DstMem | SrcReg | ModRM | BitOp,
193 0, 0, ByteOp | DstReg | SrcMem | ModRM | Mov, 194 0, 0, ByteOp | DstReg | SrcMem | ModRM | Mov,
194 DstReg | SrcMem16 | ModRM | Mov, 195 DstReg | SrcMem16 | ModRM | Mov,
195 /* 0xC0 - 0xCF */ 196 /* 0xC0 - 0xCF */
@@ -469,7 +470,8 @@ static int read_descriptor(struct x86_emulate_ctxt *ctxt,
469int 470int
470x86_emulate_memop(struct x86_emulate_ctxt *ctxt, struct x86_emulate_ops *ops) 471x86_emulate_memop(struct x86_emulate_ctxt *ctxt, struct x86_emulate_ops *ops)
471{ 472{
472 u8 b, d, sib, twobyte = 0, rex_prefix = 0; 473 unsigned d;
474 u8 b, sib, twobyte = 0, rex_prefix = 0;
473 u8 modrm, modrm_mod = 0, modrm_reg = 0, modrm_rm = 0; 475 u8 modrm, modrm_mod = 0, modrm_reg = 0, modrm_rm = 0;
474 unsigned long *override_base = NULL; 476 unsigned long *override_base = NULL;
475 unsigned int op_bytes, ad_bytes, lock_prefix = 0, rep_prefix = 0, i; 477 unsigned int op_bytes, ad_bytes, lock_prefix = 0, rep_prefix = 0, i;
@@ -726,46 +728,6 @@ done_prefixes:
726 ; 728 ;
727 } 729 }
728 730
729 /* Decode and fetch the destination operand: register or memory. */
730 switch (d & DstMask) {
731 case ImplicitOps:
732 /* Special instructions do their own operand decoding. */
733 goto special_insn;
734 case DstReg:
735 dst.type = OP_REG;
736 if ((d & ByteOp)
737 && !(twobyte_table && (b == 0xb6 || b == 0xb7))) {
738 dst.ptr = decode_register(modrm_reg, _regs,
739 (rex_prefix == 0));
740 dst.val = *(u8 *) dst.ptr;
741 dst.bytes = 1;
742 } else {
743 dst.ptr = decode_register(modrm_reg, _regs, 0);
744 switch ((dst.bytes = op_bytes)) {
745 case 2:
746 dst.val = *(u16 *)dst.ptr;
747 break;
748 case 4:
749 dst.val = *(u32 *)dst.ptr;
750 break;
751 case 8:
752 dst.val = *(u64 *)dst.ptr;
753 break;
754 }
755 }
756 break;
757 case DstMem:
758 dst.type = OP_MEM;
759 dst.ptr = (unsigned long *)cr2;
760 dst.bytes = (d & ByteOp) ? 1 : op_bytes;
761 if (!(d & Mov) && /* optimisation - avoid slow emulated read */
762 ((rc = ops->read_emulated((unsigned long)dst.ptr,
763 &dst.val, dst.bytes, ctxt)) != 0))
764 goto done;
765 break;
766 }
767 dst.orig_val = dst.val;
768
769 /* 731 /*
770 * Decode and fetch the source operand: register, memory 732 * Decode and fetch the source operand: register, memory
771 * or immediate. 733 * or immediate.
@@ -838,6 +800,50 @@ done_prefixes:
838 break; 800 break;
839 } 801 }
840 802
803 /* Decode and fetch the destination operand: register or memory. */
804 switch (d & DstMask) {
805 case ImplicitOps:
806 /* Special instructions do their own operand decoding. */
807 goto special_insn;
808 case DstReg:
809 dst.type = OP_REG;
810 if ((d & ByteOp)
811 && !(twobyte_table && (b == 0xb6 || b == 0xb7))) {
812 dst.ptr = decode_register(modrm_reg, _regs,
813 (rex_prefix == 0));
814 dst.val = *(u8 *) dst.ptr;
815 dst.bytes = 1;
816 } else {
817 dst.ptr = decode_register(modrm_reg, _regs, 0);
818 switch ((dst.bytes = op_bytes)) {
819 case 2:
820 dst.val = *(u16 *)dst.ptr;
821 break;
822 case 4:
823 dst.val = *(u32 *)dst.ptr;
824 break;
825 case 8:
826 dst.val = *(u64 *)dst.ptr;
827 break;
828 }
829 }
830 break;
831 case DstMem:
832 dst.type = OP_MEM;
833 dst.ptr = (unsigned long *)cr2;
834 dst.bytes = (d & ByteOp) ? 1 : op_bytes;
835 if (d & BitOp) {
836 dst.ptr += src.val / BITS_PER_LONG;
837 dst.bytes = sizeof(long);
838 }
839 if (!(d & Mov) && /* optimisation - avoid slow emulated read */
840 ((rc = ops->read_emulated((unsigned long)dst.ptr,
841 &dst.val, dst.bytes, ctxt)) != 0))
842 goto done;
843 break;
844 }
845 dst.orig_val = dst.val;
846
841 if (twobyte) 847 if (twobyte)
842 goto twobyte_insn; 848 goto twobyte_insn;
843 849
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c
index 5432d07c074d..11108165e264 100644
--- a/drivers/md/bitmap.c
+++ b/drivers/md/bitmap.c
@@ -479,9 +479,12 @@ static int bitmap_read_sb(struct bitmap *bitmap)
479 int err = -EINVAL; 479 int err = -EINVAL;
480 480
481 /* page 0 is the superblock, read it... */ 481 /* page 0 is the superblock, read it... */
482 if (bitmap->file) 482 if (bitmap->file) {
483 bitmap->sb_page = read_page(bitmap->file, 0, bitmap, PAGE_SIZE); 483 loff_t isize = i_size_read(bitmap->file->f_mapping->host);
484 else { 484 int bytes = isize > PAGE_SIZE ? PAGE_SIZE : isize;
485
486 bitmap->sb_page = read_page(bitmap->file, 0, bitmap, bytes);
487 } else {
485 bitmap->sb_page = read_sb_page(bitmap->mddev, bitmap->offset, 0); 488 bitmap->sb_page = read_sb_page(bitmap->mddev, bitmap->offset, 0);
486 } 489 }
487 if (IS_ERR(bitmap->sb_page)) { 490 if (IS_ERR(bitmap->sb_page)) {
@@ -877,7 +880,8 @@ static int bitmap_init_from_disk(struct bitmap *bitmap, sector_t start)
877 int count; 880 int count;
878 /* unmap the old page, we're done with it */ 881 /* unmap the old page, we're done with it */
879 if (index == num_pages-1) 882 if (index == num_pages-1)
880 count = bytes - index * PAGE_SIZE; 883 count = bytes + sizeof(bitmap_super_t)
884 - index * PAGE_SIZE;
881 else 885 else
882 count = PAGE_SIZE; 886 count = PAGE_SIZE;
883 if (index == 0) { 887 if (index == 0) {
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index fe7c56e10435..3668b170ea68 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -1116,7 +1116,8 @@ static int __bind(struct mapped_device *md, struct dm_table *t)
1116 if (size != get_capacity(md->disk)) 1116 if (size != get_capacity(md->disk))
1117 memset(&md->geometry, 0, sizeof(md->geometry)); 1117 memset(&md->geometry, 0, sizeof(md->geometry));
1118 1118
1119 __set_size(md, size); 1119 if (md->suspended_bdev)
1120 __set_size(md, size);
1120 if (size == 0) 1121 if (size == 0)
1121 return 0; 1122 return 0;
1122 1123
@@ -1264,6 +1265,11 @@ int dm_swap_table(struct mapped_device *md, struct dm_table *table)
1264 if (!dm_suspended(md)) 1265 if (!dm_suspended(md))
1265 goto out; 1266 goto out;
1266 1267
1268 /* without bdev, the device size cannot be changed */
1269 if (!md->suspended_bdev)
1270 if (get_capacity(md->disk) != dm_table_get_size(table))
1271 goto out;
1272
1267 __unbind(md); 1273 __unbind(md);
1268 r = __bind(md, table); 1274 r = __bind(md, table);
1269 1275
@@ -1341,11 +1347,14 @@ int dm_suspend(struct mapped_device *md, unsigned suspend_flags)
1341 /* This does not get reverted if there's an error later. */ 1347 /* This does not get reverted if there's an error later. */
1342 dm_table_presuspend_targets(map); 1348 dm_table_presuspend_targets(map);
1343 1349
1344 md->suspended_bdev = bdget_disk(md->disk, 0); 1350 /* bdget() can stall if the pending I/Os are not flushed */
1345 if (!md->suspended_bdev) { 1351 if (!noflush) {
1346 DMWARN("bdget failed in dm_suspend"); 1352 md->suspended_bdev = bdget_disk(md->disk, 0);
1347 r = -ENOMEM; 1353 if (!md->suspended_bdev) {
1348 goto flush_and_out; 1354 DMWARN("bdget failed in dm_suspend");
1355 r = -ENOMEM;
1356 goto flush_and_out;
1357 }
1349 } 1358 }
1350 1359
1351 /* 1360 /*
@@ -1473,8 +1482,10 @@ int dm_resume(struct mapped_device *md)
1473 1482
1474 unlock_fs(md); 1483 unlock_fs(md);
1475 1484
1476 bdput(md->suspended_bdev); 1485 if (md->suspended_bdev) {
1477 md->suspended_bdev = NULL; 1486 bdput(md->suspended_bdev);
1487 md->suspended_bdev = NULL;
1488 }
1478 1489
1479 clear_bit(DMF_SUSPENDED, &md->flags); 1490 clear_bit(DMF_SUSPENDED, &md->flags);
1480 1491
diff --git a/drivers/md/md.c b/drivers/md/md.c
index d1cb45f6d6a9..e8807ea5377d 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -1633,7 +1633,8 @@ repeat:
1633 * and 'events' is odd, we can roll back to the previous clean state */ 1633 * and 'events' is odd, we can roll back to the previous clean state */
1634 if (nospares 1634 if (nospares
1635 && (mddev->in_sync && mddev->recovery_cp == MaxSector) 1635 && (mddev->in_sync && mddev->recovery_cp == MaxSector)
1636 && (mddev->events & 1)) 1636 && (mddev->events & 1)
1637 && mddev->events != 1)
1637 mddev->events--; 1638 mddev->events--;
1638 else { 1639 else {
1639 /* otherwise we have to go forward and ... */ 1640 /* otherwise we have to go forward and ... */
@@ -3563,6 +3564,8 @@ static int get_bitmap_file(mddev_t * mddev, void __user * arg)
3563 char *ptr, *buf = NULL; 3564 char *ptr, *buf = NULL;
3564 int err = -ENOMEM; 3565 int err = -ENOMEM;
3565 3566
3567 md_allow_write(mddev);
3568
3566 file = kmalloc(sizeof(*file), GFP_KERNEL); 3569 file = kmalloc(sizeof(*file), GFP_KERNEL);
3567 if (!file) 3570 if (!file)
3568 goto out; 3571 goto out;
@@ -5031,6 +5034,33 @@ void md_write_end(mddev_t *mddev)
5031 } 5034 }
5032} 5035}
5033 5036
5037/* md_allow_write(mddev)
5038 * Calling this ensures that the array is marked 'active' so that writes
5039 * may proceed without blocking. It is important to call this before
5040 * attempting a GFP_KERNEL allocation while holding the mddev lock.
5041 * Must be called with mddev_lock held.
5042 */
5043void md_allow_write(mddev_t *mddev)
5044{
5045 if (!mddev->pers)
5046 return;
5047 if (mddev->ro)
5048 return;
5049
5050 spin_lock_irq(&mddev->write_lock);
5051 if (mddev->in_sync) {
5052 mddev->in_sync = 0;
5053 set_bit(MD_CHANGE_CLEAN, &mddev->flags);
5054 if (mddev->safemode_delay &&
5055 mddev->safemode == 0)
5056 mddev->safemode = 1;
5057 spin_unlock_irq(&mddev->write_lock);
5058 md_update_sb(mddev, 0);
5059 } else
5060 spin_unlock_irq(&mddev->write_lock);
5061}
5062EXPORT_SYMBOL_GPL(md_allow_write);
5063
5034static DECLARE_WAIT_QUEUE_HEAD(resync_wait); 5064static DECLARE_WAIT_QUEUE_HEAD(resync_wait);
5035 5065
5036#define SYNC_MARKS 10 5066#define SYNC_MARKS 10
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index 164b25dca101..97ee870b265d 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -1266,6 +1266,11 @@ static void sync_request_write(mddev_t *mddev, r1bio_t *r1_bio)
1266 sbio->bi_sector = r1_bio->sector + 1266 sbio->bi_sector = r1_bio->sector +
1267 conf->mirrors[i].rdev->data_offset; 1267 conf->mirrors[i].rdev->data_offset;
1268 sbio->bi_bdev = conf->mirrors[i].rdev->bdev; 1268 sbio->bi_bdev = conf->mirrors[i].rdev->bdev;
1269 for (j = 0; j < vcnt ; j++)
1270 memcpy(page_address(sbio->bi_io_vec[j].bv_page),
1271 page_address(pbio->bi_io_vec[j].bv_page),
1272 PAGE_SIZE);
1273
1269 } 1274 }
1270 } 1275 }
1271 } 1276 }
@@ -2099,6 +2104,8 @@ static int raid1_reshape(mddev_t *mddev)
2099 return -EINVAL; 2104 return -EINVAL;
2100 } 2105 }
2101 2106
2107 md_allow_write(mddev);
2108
2102 raid_disks = mddev->raid_disks + mddev->delta_disks; 2109 raid_disks = mddev->raid_disks + mddev->delta_disks;
2103 2110
2104 if (raid_disks < conf->raid_disks) { 2111 if (raid_disks < conf->raid_disks) {
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index be008f034ada..467c16982d02 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -405,6 +405,8 @@ static int resize_stripes(raid5_conf_t *conf, int newsize)
405 if (newsize <= conf->pool_size) 405 if (newsize <= conf->pool_size)
406 return 0; /* never bother to shrink */ 406 return 0; /* never bother to shrink */
407 407
408 md_allow_write(conf->mddev);
409
408 /* Step 1 */ 410 /* Step 1 */
409 sc = kmem_cache_create(conf->cache_name[1-conf->active_name], 411 sc = kmem_cache_create(conf->cache_name[1-conf->active_name],
410 sizeof(struct stripe_head)+(newsize-1)*sizeof(struct r5dev), 412 sizeof(struct stripe_head)+(newsize-1)*sizeof(struct r5dev),
@@ -2678,7 +2680,7 @@ static int chunk_aligned_read(request_queue_t *q, struct bio * raid_bio)
2678 mdk_rdev_t *rdev; 2680 mdk_rdev_t *rdev;
2679 2681
2680 if (!in_chunk_boundary(mddev, raid_bio)) { 2682 if (!in_chunk_boundary(mddev, raid_bio)) {
2681 printk("chunk_aligned_read : non aligned\n"); 2683 PRINTK("chunk_aligned_read : non aligned\n");
2682 return 0; 2684 return 0;
2683 } 2685 }
2684 /* 2686 /*
@@ -3250,6 +3252,7 @@ raid5_store_stripe_cache_size(mddev_t *mddev, const char *page, size_t len)
3250 else 3252 else
3251 break; 3253 break;
3252 } 3254 }
3255 md_allow_write(mddev);
3253 while (new > conf->max_nr_stripes) { 3256 while (new > conf->max_nr_stripes) {
3254 if (grow_one_stripe(conf)) 3257 if (grow_one_stripe(conf))
3255 conf->max_nr_stripes++; 3258 conf->max_nr_stripes++;
diff --git a/drivers/media/video/video-buf.c b/drivers/media/video/video-buf.c
index 635d102c86f0..6504a5866849 100644
--- a/drivers/media/video/video-buf.c
+++ b/drivers/media/video/video-buf.c
@@ -700,6 +700,7 @@ videobuf_qbuf(struct videobuf_queue *q,
700 goto done; 700 goto done;
701 } 701 }
702 if (buf->state == STATE_QUEUED || 702 if (buf->state == STATE_QUEUED ||
703 buf->state == STATE_PREPARED ||
703 buf->state == STATE_ACTIVE) { 704 buf->state == STATE_ACTIVE) {
704 dprintk(1,"qbuf: buffer is already queued or active.\n"); 705 dprintk(1,"qbuf: buffer is already queued or active.\n");
705 goto done; 706 goto done;
diff --git a/drivers/mtd/nand/cafe.c b/drivers/mtd/nand/cafe.c
index e1ee62a17fe0..1e877cbe7757 100644
--- a/drivers/mtd/nand/cafe.c
+++ b/drivers/mtd/nand/cafe.c
@@ -14,6 +14,7 @@
14#include <linux/pci.h> 14#include <linux/pci.h>
15#include <linux/delay.h> 15#include <linux/delay.h>
16#include <linux/interrupt.h> 16#include <linux/interrupt.h>
17#include <linux/dma-mapping.h>
17#include <asm/io.h> 18#include <asm/io.h>
18 19
19#define CAFE_NAND_CTRL1 0x00 20#define CAFE_NAND_CTRL1 0x00
diff --git a/drivers/net/82596.c b/drivers/net/82596.c
index 8236f26ffd46..640d7ca2ebcf 100644
--- a/drivers/net/82596.c
+++ b/drivers/net/82596.c
@@ -1066,8 +1066,8 @@ static int i596_start_xmit(struct sk_buff *skb, struct net_device *dev)
1066 short length = skb->len; 1066 short length = skb->len;
1067 dev->trans_start = jiffies; 1067 dev->trans_start = jiffies;
1068 1068
1069 DEB(DEB_STARTTX,printk(KERN_DEBUG "%s: i596_start_xmit(%x,%x) called\n", dev->name, 1069 DEB(DEB_STARTTX,printk(KERN_DEBUG "%s: i596_start_xmit(%x,%p) called\n",
1070 skb->len, (unsigned int)skb->data)); 1070 dev->name, skb->len, skb->data));
1071 1071
1072 if (skb->len < ETH_ZLEN) { 1072 if (skb->len < ETH_ZLEN) {
1073 if (skb_padto(skb, ETH_ZLEN)) 1073 if (skb_padto(skb, ETH_ZLEN))
@@ -1246,7 +1246,8 @@ struct net_device * __init i82596_probe(int unit)
1246 dev->priv = (void *)(dev->mem_start); 1246 dev->priv = (void *)(dev->mem_start);
1247 1247
1248 lp = dev->priv; 1248 lp = dev->priv;
1249 DEB(DEB_INIT,printk(KERN_DEBUG "%s: lp at 0x%08lx (%d bytes), lp->scb at 0x%08lx\n", 1249 DEB(DEB_INIT,printk(KERN_DEBUG "%s: lp at 0x%08lx (%zd bytes), "
1250 "lp->scb at 0x%08lx\n",
1250 dev->name, (unsigned long)lp, 1251 dev->name, (unsigned long)lp,
1251 sizeof(struct i596_private), (unsigned long)&lp->scb)); 1252 sizeof(struct i596_private), (unsigned long)&lp->scb));
1252 memset((void *) lp, 0, sizeof(struct i596_private)); 1253 memset((void *) lp, 0, sizeof(struct i596_private));
diff --git a/drivers/net/b44.c b/drivers/net/b44.c
index 5eb2ec68393f..303a8d94ad4b 100644
--- a/drivers/net/b44.c
+++ b/drivers/net/b44.c
@@ -110,6 +110,11 @@ MODULE_DEVICE_TABLE(pci, b44_pci_tbl);
110 110
111static void b44_halt(struct b44 *); 111static void b44_halt(struct b44 *);
112static void b44_init_rings(struct b44 *); 112static void b44_init_rings(struct b44 *);
113
114#define B44_FULL_RESET 1
115#define B44_FULL_RESET_SKIP_PHY 2
116#define B44_PARTIAL_RESET 3
117
113static void b44_init_hw(struct b44 *, int); 118static void b44_init_hw(struct b44 *, int);
114 119
115static int dma_desc_align_mask; 120static int dma_desc_align_mask;
@@ -752,7 +757,7 @@ static void b44_recycle_rx(struct b44 *bp, int src_idx, u32 dest_idx_unmasked)
752 dest_idx * sizeof(dest_desc), 757 dest_idx * sizeof(dest_desc),
753 DMA_BIDIRECTIONAL); 758 DMA_BIDIRECTIONAL);
754 759
755 pci_dma_sync_single_for_device(bp->pdev, src_desc->addr, 760 pci_dma_sync_single_for_device(bp->pdev, le32_to_cpu(src_desc->addr),
756 RX_PKT_BUF_SZ, 761 RX_PKT_BUF_SZ,
757 PCI_DMA_FROMDEVICE); 762 PCI_DMA_FROMDEVICE);
758} 763}
@@ -884,7 +889,7 @@ static int b44_poll(struct net_device *netdev, int *budget)
884 spin_lock_irqsave(&bp->lock, flags); 889 spin_lock_irqsave(&bp->lock, flags);
885 b44_halt(bp); 890 b44_halt(bp);
886 b44_init_rings(bp); 891 b44_init_rings(bp);
887 b44_init_hw(bp, 1); 892 b44_init_hw(bp, B44_FULL_RESET_SKIP_PHY);
888 netif_wake_queue(bp->dev); 893 netif_wake_queue(bp->dev);
889 spin_unlock_irqrestore(&bp->lock, flags); 894 spin_unlock_irqrestore(&bp->lock, flags);
890 done = 1; 895 done = 1;
@@ -954,7 +959,7 @@ static void b44_tx_timeout(struct net_device *dev)
954 959
955 b44_halt(bp); 960 b44_halt(bp);
956 b44_init_rings(bp); 961 b44_init_rings(bp);
957 b44_init_hw(bp, 1); 962 b44_init_hw(bp, B44_FULL_RESET);
958 963
959 spin_unlock_irq(&bp->lock); 964 spin_unlock_irq(&bp->lock);
960 965
@@ -1071,7 +1076,7 @@ static int b44_change_mtu(struct net_device *dev, int new_mtu)
1071 b44_halt(bp); 1076 b44_halt(bp);
1072 dev->mtu = new_mtu; 1077 dev->mtu = new_mtu;
1073 b44_init_rings(bp); 1078 b44_init_rings(bp);
1074 b44_init_hw(bp, 1); 1079 b44_init_hw(bp, B44_FULL_RESET);
1075 spin_unlock_irq(&bp->lock); 1080 spin_unlock_irq(&bp->lock);
1076 1081
1077 b44_enable_ints(bp); 1082 b44_enable_ints(bp);
@@ -1368,12 +1373,12 @@ static int b44_set_mac_addr(struct net_device *dev, void *p)
1368 * packet processing. Invoked with bp->lock held. 1373 * packet processing. Invoked with bp->lock held.
1369 */ 1374 */
1370static void __b44_set_rx_mode(struct net_device *); 1375static void __b44_set_rx_mode(struct net_device *);
1371static void b44_init_hw(struct b44 *bp, int full_reset) 1376static void b44_init_hw(struct b44 *bp, int reset_kind)
1372{ 1377{
1373 u32 val; 1378 u32 val;
1374 1379
1375 b44_chip_reset(bp); 1380 b44_chip_reset(bp);
1376 if (full_reset) { 1381 if (reset_kind == B44_FULL_RESET) {
1377 b44_phy_reset(bp); 1382 b44_phy_reset(bp);
1378 b44_setup_phy(bp); 1383 b44_setup_phy(bp);
1379 } 1384 }
@@ -1390,7 +1395,10 @@ static void b44_init_hw(struct b44 *bp, int full_reset)
1390 bw32(bp, B44_TXMAXLEN, bp->dev->mtu + ETH_HLEN + 8 + RX_HEADER_LEN); 1395 bw32(bp, B44_TXMAXLEN, bp->dev->mtu + ETH_HLEN + 8 + RX_HEADER_LEN);
1391 1396
1392 bw32(bp, B44_TX_WMARK, 56); /* XXX magic */ 1397 bw32(bp, B44_TX_WMARK, 56); /* XXX magic */
1393 if (full_reset) { 1398 if (reset_kind == B44_PARTIAL_RESET) {
1399 bw32(bp, B44_DMARX_CTRL, (DMARX_CTRL_ENABLE |
1400 (bp->rx_offset << DMARX_CTRL_ROSHIFT)));
1401 } else {
1394 bw32(bp, B44_DMATX_CTRL, DMATX_CTRL_ENABLE); 1402 bw32(bp, B44_DMATX_CTRL, DMATX_CTRL_ENABLE);
1395 bw32(bp, B44_DMATX_ADDR, bp->tx_ring_dma + bp->dma_offset); 1403 bw32(bp, B44_DMATX_ADDR, bp->tx_ring_dma + bp->dma_offset);
1396 bw32(bp, B44_DMARX_CTRL, (DMARX_CTRL_ENABLE | 1404 bw32(bp, B44_DMARX_CTRL, (DMARX_CTRL_ENABLE |
@@ -1401,9 +1409,6 @@ static void b44_init_hw(struct b44 *bp, int full_reset)
1401 bp->rx_prod = bp->rx_pending; 1409 bp->rx_prod = bp->rx_pending;
1402 1410
1403 bw32(bp, B44_MIB_CTRL, MIB_CTRL_CLR_ON_READ); 1411 bw32(bp, B44_MIB_CTRL, MIB_CTRL_CLR_ON_READ);
1404 } else {
1405 bw32(bp, B44_DMARX_CTRL, (DMARX_CTRL_ENABLE |
1406 (bp->rx_offset << DMARX_CTRL_ROSHIFT)));
1407 } 1412 }
1408 1413
1409 val = br32(bp, B44_ENET_CTRL); 1414 val = br32(bp, B44_ENET_CTRL);
@@ -1420,7 +1425,7 @@ static int b44_open(struct net_device *dev)
1420 goto out; 1425 goto out;
1421 1426
1422 b44_init_rings(bp); 1427 b44_init_rings(bp);
1423 b44_init_hw(bp, 1); 1428 b44_init_hw(bp, B44_FULL_RESET);
1424 1429
1425 b44_check_phy(bp); 1430 b44_check_phy(bp);
1426 1431
@@ -1629,7 +1634,7 @@ static int b44_close(struct net_device *dev)
1629 netif_poll_enable(dev); 1634 netif_poll_enable(dev);
1630 1635
1631 if (bp->flags & B44_FLAG_WOL_ENABLE) { 1636 if (bp->flags & B44_FLAG_WOL_ENABLE) {
1632 b44_init_hw(bp, 0); 1637 b44_init_hw(bp, B44_PARTIAL_RESET);
1633 b44_setup_wol(bp); 1638 b44_setup_wol(bp);
1634 } 1639 }
1635 1640
@@ -1905,7 +1910,7 @@ static int b44_set_ringparam(struct net_device *dev,
1905 1910
1906 b44_halt(bp); 1911 b44_halt(bp);
1907 b44_init_rings(bp); 1912 b44_init_rings(bp);
1908 b44_init_hw(bp, 1); 1913 b44_init_hw(bp, B44_FULL_RESET);
1909 netif_wake_queue(bp->dev); 1914 netif_wake_queue(bp->dev);
1910 spin_unlock_irq(&bp->lock); 1915 spin_unlock_irq(&bp->lock);
1911 1916
@@ -1948,7 +1953,7 @@ static int b44_set_pauseparam(struct net_device *dev,
1948 if (bp->flags & B44_FLAG_PAUSE_AUTO) { 1953 if (bp->flags & B44_FLAG_PAUSE_AUTO) {
1949 b44_halt(bp); 1954 b44_halt(bp);
1950 b44_init_rings(bp); 1955 b44_init_rings(bp);
1951 b44_init_hw(bp, 1); 1956 b44_init_hw(bp, B44_FULL_RESET);
1952 } else { 1957 } else {
1953 __b44_set_flow_ctrl(bp, bp->flags); 1958 __b44_set_flow_ctrl(bp, bp->flags);
1954 } 1959 }
@@ -2304,7 +2309,7 @@ static int b44_suspend(struct pci_dev *pdev, pm_message_t state)
2304 2309
2305 free_irq(dev->irq, dev); 2310 free_irq(dev->irq, dev);
2306 if (bp->flags & B44_FLAG_WOL_ENABLE) { 2311 if (bp->flags & B44_FLAG_WOL_ENABLE) {
2307 b44_init_hw(bp, 0); 2312 b44_init_hw(bp, B44_PARTIAL_RESET);
2308 b44_setup_wol(bp); 2313 b44_setup_wol(bp);
2309 } 2314 }
2310 pci_disable_device(pdev); 2315 pci_disable_device(pdev);
@@ -2315,21 +2320,32 @@ static int b44_resume(struct pci_dev *pdev)
2315{ 2320{
2316 struct net_device *dev = pci_get_drvdata(pdev); 2321 struct net_device *dev = pci_get_drvdata(pdev);
2317 struct b44 *bp = netdev_priv(dev); 2322 struct b44 *bp = netdev_priv(dev);
2323 int rc = 0;
2318 2324
2319 pci_restore_state(pdev); 2325 pci_restore_state(pdev);
2320 pci_enable_device(pdev); 2326 rc = pci_enable_device(pdev);
2327 if (rc) {
2328 printk(KERN_ERR PFX "%s: pci_enable_device failed\n",
2329 dev->name);
2330 return rc;
2331 }
2332
2321 pci_set_master(pdev); 2333 pci_set_master(pdev);
2322 2334
2323 if (!netif_running(dev)) 2335 if (!netif_running(dev))
2324 return 0; 2336 return 0;
2325 2337
2326 if (request_irq(dev->irq, b44_interrupt, IRQF_SHARED, dev->name, dev)) 2338 rc = request_irq(dev->irq, b44_interrupt, IRQF_SHARED, dev->name, dev);
2339 if (rc) {
2327 printk(KERN_ERR PFX "%s: request_irq failed\n", dev->name); 2340 printk(KERN_ERR PFX "%s: request_irq failed\n", dev->name);
2341 pci_disable_device(pdev);
2342 return rc;
2343 }
2328 2344
2329 spin_lock_irq(&bp->lock); 2345 spin_lock_irq(&bp->lock);
2330 2346
2331 b44_init_rings(bp); 2347 b44_init_rings(bp);
2332 b44_init_hw(bp, 1); 2348 b44_init_hw(bp, B44_FULL_RESET);
2333 netif_device_attach(bp->dev); 2349 netif_device_attach(bp->dev);
2334 spin_unlock_irq(&bp->lock); 2350 spin_unlock_irq(&bp->lock);
2335 2351
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index ca5acc4736df..ee7b75b976b5 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -57,8 +57,8 @@
57 57
58#define DRV_MODULE_NAME "bnx2" 58#define DRV_MODULE_NAME "bnx2"
59#define PFX DRV_MODULE_NAME ": " 59#define PFX DRV_MODULE_NAME ": "
60#define DRV_MODULE_VERSION "1.5.3" 60#define DRV_MODULE_VERSION "1.5.5"
61#define DRV_MODULE_RELDATE "January 8, 2007" 61#define DRV_MODULE_RELDATE "February 1, 2007"
62 62
63#define RUN_AT(x) (jiffies + (x)) 63#define RUN_AT(x) (jiffies + (x))
64 64
@@ -1356,6 +1356,14 @@ bnx2_init_copper_phy(struct bnx2 *bp)
1356 bnx2_write_phy(bp, 0x18, 0x0400); 1356 bnx2_write_phy(bp, 0x18, 0x0400);
1357 } 1357 }
1358 1358
1359 if (bp->phy_flags & PHY_DIS_EARLY_DAC_FLAG) {
1360 bnx2_write_phy(bp, MII_BNX2_DSP_ADDRESS,
1361 MII_BNX2_DSP_EXPAND_REG | 0x8);
1362 bnx2_read_phy(bp, MII_BNX2_DSP_RW_PORT, &val);
1363 val &= ~(1 << 8);
1364 bnx2_write_phy(bp, MII_BNX2_DSP_RW_PORT, val);
1365 }
1366
1359 if (bp->dev->mtu > 1500) { 1367 if (bp->dev->mtu > 1500) {
1360 /* Set extended packet length bit */ 1368 /* Set extended packet length bit */
1361 bnx2_write_phy(bp, 0x18, 0x7); 1369 bnx2_write_phy(bp, 0x18, 0x7);
@@ -5845,9 +5853,11 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev)
5845 reg = REG_RD_IND(bp, BNX2_SHM_HDR_SIGNATURE); 5853 reg = REG_RD_IND(bp, BNX2_SHM_HDR_SIGNATURE);
5846 5854
5847 if ((reg & BNX2_SHM_HDR_SIGNATURE_SIG_MASK) == 5855 if ((reg & BNX2_SHM_HDR_SIGNATURE_SIG_MASK) ==
5848 BNX2_SHM_HDR_SIGNATURE_SIG) 5856 BNX2_SHM_HDR_SIGNATURE_SIG) {
5849 bp->shmem_base = REG_RD_IND(bp, BNX2_SHM_HDR_ADDR_0); 5857 u32 off = PCI_FUNC(pdev->devfn) << 2;
5850 else 5858
5859 bp->shmem_base = REG_RD_IND(bp, BNX2_SHM_HDR_ADDR_0 + off);
5860 } else
5851 bp->shmem_base = HOST_VIEW_SHMEM_BASE; 5861 bp->shmem_base = HOST_VIEW_SHMEM_BASE;
5852 5862
5853 /* Get the permanent MAC address. First we need to make sure the 5863 /* Get the permanent MAC address. First we need to make sure the
@@ -5916,6 +5926,8 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev)
5916 } else if (CHIP_NUM(bp) == CHIP_NUM_5706 || 5926 } else if (CHIP_NUM(bp) == CHIP_NUM_5706 ||
5917 CHIP_NUM(bp) == CHIP_NUM_5708) 5927 CHIP_NUM(bp) == CHIP_NUM_5708)
5918 bp->phy_flags |= PHY_CRC_FIX_FLAG; 5928 bp->phy_flags |= PHY_CRC_FIX_FLAG;
5929 else if (CHIP_ID(bp) == CHIP_ID_5709_A0)
5930 bp->phy_flags |= PHY_DIS_EARLY_DAC_FLAG;
5919 5931
5920 if ((CHIP_ID(bp) == CHIP_ID_5708_A0) || 5932 if ((CHIP_ID(bp) == CHIP_ID_5708_A0) ||
5921 (CHIP_ID(bp) == CHIP_ID_5708_B0) || 5933 (CHIP_ID(bp) == CHIP_ID_5708_B0) ||
diff --git a/drivers/net/bnx2.h b/drivers/net/bnx2.h
index 13b6f9b11e01..ccbdf81c6599 100644
--- a/drivers/net/bnx2.h
+++ b/drivers/net/bnx2.h
@@ -6288,6 +6288,10 @@ struct l2_fhdr {
6288 6288
6289#define BCM5708S_TX_ACTL3 0x17 6289#define BCM5708S_TX_ACTL3 0x17
6290 6290
6291#define MII_BNX2_DSP_RW_PORT 0x15
6292#define MII_BNX2_DSP_ADDRESS 0x17
6293#define MII_BNX2_DSP_EXPAND_REG 0x0f00
6294
6291#define MIN_ETHERNET_PACKET_SIZE 60 6295#define MIN_ETHERNET_PACKET_SIZE 60
6292#define MAX_ETHERNET_PACKET_SIZE 1514 6296#define MAX_ETHERNET_PACKET_SIZE 1514
6293#define MAX_ETHERNET_JUMBO_PACKET_SIZE 9014 6297#define MAX_ETHERNET_JUMBO_PACKET_SIZE 9014
@@ -6489,6 +6493,7 @@ struct bnx2 {
6489#define PHY_INT_MODE_MASK_FLAG 0x300 6493#define PHY_INT_MODE_MASK_FLAG 0x300
6490#define PHY_INT_MODE_AUTO_POLLING_FLAG 0x100 6494#define PHY_INT_MODE_AUTO_POLLING_FLAG 0x100
6491#define PHY_INT_MODE_LINK_READY_FLAG 0x200 6495#define PHY_INT_MODE_LINK_READY_FLAG 0x200
6496#define PHY_DIS_EARLY_DAC_FLAG 0x400
6492 6497
6493 u32 chip_id; 6498 u32 chip_id;
6494 /* chip num:16-31, rev:12-15, metal:4-11, bond_id:0-3 */ 6499 /* chip num:16-31, rev:12-15, metal:4-11, bond_id:0-3 */
@@ -6512,6 +6517,7 @@ struct bnx2 {
6512#define CHIP_ID_5708_A0 0x57080000 6517#define CHIP_ID_5708_A0 0x57080000
6513#define CHIP_ID_5708_B0 0x57081000 6518#define CHIP_ID_5708_B0 0x57081000
6514#define CHIP_ID_5708_B1 0x57081010 6519#define CHIP_ID_5708_B1 0x57081010
6520#define CHIP_ID_5709_A0 0x57090000
6515 6521
6516#define CHIP_BOND_ID(bp) (((bp)->chip_id) & 0xf) 6522#define CHIP_BOND_ID(bp) (((bp)->chip_id) & 0xf)
6517 6523
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h
index dc434fb6da85..0978c9ac6d2b 100644
--- a/drivers/net/bonding/bonding.h
+++ b/drivers/net/bonding/bonding.h
@@ -151,8 +151,8 @@ struct slave {
151 struct slave *next; 151 struct slave *next;
152 struct slave *prev; 152 struct slave *prev;
153 int delay; 153 int delay;
154 u32 jiffies; 154 unsigned long jiffies;
155 u32 last_arp_rx; 155 unsigned long last_arp_rx;
156 s8 link; /* one of BOND_LINK_XXXX */ 156 s8 link; /* one of BOND_LINK_XXXX */
157 s8 state; /* one of BOND_STATE_XXXX */ 157 s8 state; /* one of BOND_STATE_XXXX */
158 u32 original_flags; 158 u32 original_flags;
@@ -242,7 +242,8 @@ extern inline int slave_do_arp_validate(struct bonding *bond, struct slave *slav
242 return bond->params.arp_validate & (1 << slave->state); 242 return bond->params.arp_validate & (1 << slave->state);
243} 243}
244 244
245extern inline u32 slave_last_rx(struct bonding *bond, struct slave *slave) 245extern inline unsigned long slave_last_rx(struct bonding *bond,
246 struct slave *slave)
246{ 247{
247 if (slave_do_arp_validate(bond, slave)) 248 if (slave_do_arp_validate(bond, slave))
248 return slave->last_arp_rx; 249 return slave->last_arp_rx;
diff --git a/drivers/net/e100.c b/drivers/net/e100.c
index c2ae2a24629b..0cefef5e3f06 100644
--- a/drivers/net/e100.c
+++ b/drivers/net/e100.c
@@ -2718,12 +2718,11 @@ static int e100_suspend(struct pci_dev *pdev, pm_message_t state)
2718 struct net_device *netdev = pci_get_drvdata(pdev); 2718 struct net_device *netdev = pci_get_drvdata(pdev);
2719 struct nic *nic = netdev_priv(netdev); 2719 struct nic *nic = netdev_priv(netdev);
2720 2720
2721#ifdef CONFIG_E100_NAPI
2722 if (netif_running(netdev)) 2721 if (netif_running(netdev))
2723 netif_poll_disable(nic->netdev); 2722 netif_poll_disable(nic->netdev);
2724#endif
2725 del_timer_sync(&nic->watchdog); 2723 del_timer_sync(&nic->watchdog);
2726 netif_carrier_off(nic->netdev); 2724 netif_carrier_off(nic->netdev);
2725 netif_device_detach(netdev);
2727 2726
2728 pci_save_state(pdev); 2727 pci_save_state(pdev);
2729 2728
@@ -2736,6 +2735,7 @@ static int e100_suspend(struct pci_dev *pdev, pm_message_t state)
2736 } 2735 }
2737 2736
2738 pci_disable_device(pdev); 2737 pci_disable_device(pdev);
2738 free_irq(pdev->irq, netdev);
2739 pci_set_power_state(pdev, PCI_D3hot); 2739 pci_set_power_state(pdev, PCI_D3hot);
2740 2740
2741 return 0; 2741 return 0;
@@ -2759,16 +2759,13 @@ static int e100_resume(struct pci_dev *pdev)
2759} 2759}
2760#endif /* CONFIG_PM */ 2760#endif /* CONFIG_PM */
2761 2761
2762
2763static void e100_shutdown(struct pci_dev *pdev) 2762static void e100_shutdown(struct pci_dev *pdev)
2764{ 2763{
2765 struct net_device *netdev = pci_get_drvdata(pdev); 2764 struct net_device *netdev = pci_get_drvdata(pdev);
2766 struct nic *nic = netdev_priv(netdev); 2765 struct nic *nic = netdev_priv(netdev);
2767 2766
2768#ifdef CONFIG_E100_NAPI
2769 if (netif_running(netdev)) 2767 if (netif_running(netdev))
2770 netif_poll_disable(nic->netdev); 2768 netif_poll_disable(nic->netdev);
2771#endif
2772 del_timer_sync(&nic->watchdog); 2769 del_timer_sync(&nic->watchdog);
2773 netif_carrier_off(nic->netdev); 2770 netif_carrier_off(nic->netdev);
2774 2771
diff --git a/drivers/net/ehea/ehea.h b/drivers/net/ehea/ehea.h
index 39ad9f73d1ec..272e1ec51aa2 100644
--- a/drivers/net/ehea/ehea.h
+++ b/drivers/net/ehea/ehea.h
@@ -39,7 +39,7 @@
39#include <asm/io.h> 39#include <asm/io.h>
40 40
41#define DRV_NAME "ehea" 41#define DRV_NAME "ehea"
42#define DRV_VERSION "EHEA_0043" 42#define DRV_VERSION "EHEA_0045"
43 43
44#define EHEA_MSG_DEFAULT (NETIF_MSG_LINK | NETIF_MSG_TIMER \ 44#define EHEA_MSG_DEFAULT (NETIF_MSG_LINK | NETIF_MSG_TIMER \
45 | NETIF_MSG_RX_ERR | NETIF_MSG_TX_ERR) 45 | NETIF_MSG_RX_ERR | NETIF_MSG_TX_ERR)
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c
index 83fa32f72398..9de2d38a5321 100644
--- a/drivers/net/ehea/ehea_main.c
+++ b/drivers/net/ehea/ehea_main.c
@@ -558,12 +558,12 @@ static irqreturn_t ehea_qp_aff_irq_handler(int irq, void *param)
558 u32 qp_token; 558 u32 qp_token;
559 559
560 eqe = ehea_poll_eq(port->qp_eq); 560 eqe = ehea_poll_eq(port->qp_eq);
561 ehea_debug("eqe=%p", eqe); 561
562 while (eqe) { 562 while (eqe) {
563 ehea_debug("*eqe=%lx", *(u64*)eqe);
564 eqe = ehea_poll_eq(port->qp_eq);
565 qp_token = EHEA_BMASK_GET(EHEA_EQE_QP_TOKEN, eqe->entry); 563 qp_token = EHEA_BMASK_GET(EHEA_EQE_QP_TOKEN, eqe->entry);
566 ehea_debug("next eqe=%p", eqe); 564 ehea_error("QP aff_err: entry=0x%lx, token=0x%x",
565 eqe->entry, qp_token);
566 eqe = ehea_poll_eq(port->qp_eq);
567 } 567 }
568 568
569 return IRQ_HANDLED; 569 return IRQ_HANDLED;
@@ -575,8 +575,9 @@ static struct ehea_port *ehea_get_port(struct ehea_adapter *adapter,
575 int i; 575 int i;
576 576
577 for (i = 0; i < adapter->num_ports; i++) 577 for (i = 0; i < adapter->num_ports; i++)
578 if (adapter->port[i]->logical_port_id == logical_port) 578 if (adapter->port[i])
579 return adapter->port[i]; 579 if (adapter->port[i]->logical_port_id == logical_port)
580 return adapter->port[i];
580 return NULL; 581 return NULL;
581} 582}
582 583
@@ -642,6 +643,8 @@ int ehea_sense_port_attr(struct ehea_port *port)
642 break; 643 break;
643 } 644 }
644 645
646 port->autoneg = 1;
647
645 /* Number of default QPs */ 648 /* Number of default QPs */
646 port->num_def_qps = cb0->num_default_qps; 649 port->num_def_qps = cb0->num_default_qps;
647 650
@@ -728,10 +731,7 @@ int ehea_set_portspeed(struct ehea_port *port, u32 port_speed)
728 } 731 }
729 } else { 732 } else {
730 if (hret == H_AUTHORITY) { 733 if (hret == H_AUTHORITY) {
731 ehea_info("Hypervisor denied setting port speed. Either" 734 ehea_info("Hypervisor denied setting port speed");
732 " this partition is not authorized to set "
733 "port speed or another partition has modified"
734 " port speed first.");
735 ret = -EPERM; 735 ret = -EPERM;
736 } else { 736 } else {
737 ret = -EIO; 737 ret = -EIO;
@@ -998,7 +998,7 @@ static int ehea_configure_port(struct ehea_port *port)
998 | EHEA_BMASK_SET(PXLY_RC_JUMBO_FRAME, 1); 998 | EHEA_BMASK_SET(PXLY_RC_JUMBO_FRAME, 1);
999 999
1000 for (i = 0; i < port->num_def_qps; i++) 1000 for (i = 0; i < port->num_def_qps; i++)
1001 cb0->default_qpn_arr[i] = port->port_res[i].qp->init_attr.qp_nr; 1001 cb0->default_qpn_arr[i] = port->port_res[0].qp->init_attr.qp_nr;
1002 1002
1003 if (netif_msg_ifup(port)) 1003 if (netif_msg_ifup(port))
1004 ehea_dump(cb0, sizeof(*cb0), "ehea_configure_port"); 1004 ehea_dump(cb0, sizeof(*cb0), "ehea_configure_port");
@@ -1485,11 +1485,12 @@ out:
1485 1485
1486static void ehea_promiscuous_error(u64 hret, int enable) 1486static void ehea_promiscuous_error(u64 hret, int enable)
1487{ 1487{
1488 ehea_info("Hypervisor denied %sabling promiscuous mode.%s", 1488 if (hret == H_AUTHORITY)
1489 enable == 1 ? "en" : "dis", 1489 ehea_info("Hypervisor denied %sabling promiscuous mode",
1490 hret != H_AUTHORITY ? "" : " Another partition owning a " 1490 enable == 1 ? "en" : "dis");
1491 "logical port on the same physical port might have altered " 1491 else
1492 "promiscuous mode first."); 1492 ehea_error("failed %sabling promiscuous mode",
1493 enable == 1 ? "en" : "dis");
1493} 1494}
1494 1495
1495static void ehea_promiscuous(struct net_device *dev, int enable) 1496static void ehea_promiscuous(struct net_device *dev, int enable)
@@ -2267,6 +2268,8 @@ static void ehea_tx_watchdog(struct net_device *dev)
2267int ehea_sense_adapter_attr(struct ehea_adapter *adapter) 2268int ehea_sense_adapter_attr(struct ehea_adapter *adapter)
2268{ 2269{
2269 struct hcp_query_ehea *cb; 2270 struct hcp_query_ehea *cb;
2271 struct device_node *lhea_dn = NULL;
2272 struct device_node *eth_dn = NULL;
2270 u64 hret; 2273 u64 hret;
2271 int ret; 2274 int ret;
2272 2275
@@ -2283,7 +2286,18 @@ int ehea_sense_adapter_attr(struct ehea_adapter *adapter)
2283 goto out_herr; 2286 goto out_herr;
2284 } 2287 }
2285 2288
2286 adapter->num_ports = cb->num_ports; 2289 /* Determine the number of available logical ports
2290 * by counting the child nodes of the lhea OFDT entry
2291 */
2292 adapter->num_ports = 0;
2293 lhea_dn = of_find_node_by_name(lhea_dn, "lhea");
2294 do {
2295 eth_dn = of_get_next_child(lhea_dn, eth_dn);
2296 if (eth_dn)
2297 adapter->num_ports++;
2298 } while ( eth_dn );
2299 of_node_put(lhea_dn);
2300
2287 adapter->max_mc_mac = cb->max_mc_mac - 1; 2301 adapter->max_mc_mac = cb->max_mc_mac - 1;
2288 ret = 0; 2302 ret = 0;
2289 2303
@@ -2302,6 +2316,7 @@ static int ehea_setup_single_port(struct ehea_port *port,
2302 struct ehea_adapter *adapter = port->adapter; 2316 struct ehea_adapter *adapter = port->adapter;
2303 struct hcp_ehea_port_cb4 *cb4; 2317 struct hcp_ehea_port_cb4 *cb4;
2304 u32 *dn_log_port_id; 2318 u32 *dn_log_port_id;
2319 int jumbo = 0;
2305 2320
2306 sema_init(&port->port_lock, 1); 2321 sema_init(&port->port_lock, 1);
2307 port->state = EHEA_PORT_DOWN; 2322 port->state = EHEA_PORT_DOWN;
@@ -2334,8 +2349,6 @@ static int ehea_setup_single_port(struct ehea_port *port,
2334 2349
2335 INIT_LIST_HEAD(&port->mc_list->list); 2350 INIT_LIST_HEAD(&port->mc_list->list);
2336 2351
2337 ehea_set_portspeed(port, EHEA_SPEED_AUTONEG);
2338
2339 ret = ehea_sense_port_attr(port); 2352 ret = ehea_sense_port_attr(port);
2340 if (ret) 2353 if (ret)
2341 goto out; 2354 goto out;
@@ -2345,13 +2358,25 @@ static int ehea_setup_single_port(struct ehea_port *port,
2345 if (!cb4) { 2358 if (!cb4) {
2346 ehea_error("no mem for cb4"); 2359 ehea_error("no mem for cb4");
2347 } else { 2360 } else {
2348 cb4->jumbo_frame = 1; 2361 hret = ehea_h_query_ehea_port(adapter->handle,
2349 hret = ehea_h_modify_ehea_port(adapter->handle, 2362 port->logical_port_id,
2350 port->logical_port_id, 2363 H_PORT_CB4,
2351 H_PORT_CB4, H_PORT_CB4_JUMBO, 2364 H_PORT_CB4_JUMBO, cb4);
2352 cb4); 2365
2353 if (hret != H_SUCCESS) { 2366 if (hret == H_SUCCESS) {
2354 ehea_info("Jumbo frames not activated"); 2367 if (cb4->jumbo_frame)
2368 jumbo = 1;
2369 else {
2370 cb4->jumbo_frame = 1;
2371 hret = ehea_h_modify_ehea_port(adapter->handle,
2372 port->
2373 logical_port_id,
2374 H_PORT_CB4,
2375 H_PORT_CB4_JUMBO,
2376 cb4);
2377 if (hret == H_SUCCESS)
2378 jumbo = 1;
2379 }
2355 } 2380 }
2356 kfree(cb4); 2381 kfree(cb4);
2357 } 2382 }
@@ -2390,6 +2415,9 @@ static int ehea_setup_single_port(struct ehea_port *port,
2390 goto out_free; 2415 goto out_free;
2391 } 2416 }
2392 2417
2418 ehea_info("%s: Jumbo frames are %sabled", dev->name,
2419 jumbo == 1 ? "en" : "dis");
2420
2393 port->netdev = dev; 2421 port->netdev = dev;
2394 ret = 0; 2422 ret = 0;
2395 goto out; 2423 goto out;
@@ -2471,14 +2499,16 @@ static int __devinit ehea_probe(struct ibmebus_dev *dev,
2471 2499
2472 adapter_handle = (u64*)get_property(dev->ofdev.node, "ibm,hea-handle", 2500 adapter_handle = (u64*)get_property(dev->ofdev.node, "ibm,hea-handle",
2473 NULL); 2501 NULL);
2474 if (!adapter_handle) { 2502 if (adapter_handle)
2503 adapter->handle = *adapter_handle;
2504
2505 if (!adapter->handle) {
2475 dev_err(&dev->ofdev.dev, "failed getting handle for adapter" 2506 dev_err(&dev->ofdev.dev, "failed getting handle for adapter"
2476 " '%s'\n", dev->ofdev.node->full_name); 2507 " '%s'\n", dev->ofdev.node->full_name);
2477 ret = -ENODEV; 2508 ret = -ENODEV;
2478 goto out_free_ad; 2509 goto out_free_ad;
2479 } 2510 }
2480 2511
2481 adapter->handle = *adapter_handle;
2482 adapter->pd = EHEA_PD_ID; 2512 adapter->pd = EHEA_PD_ID;
2483 2513
2484 dev->ofdev.dev.driver_data = adapter; 2514 dev->ofdev.dev.driver_data = adapter;
@@ -2568,6 +2598,7 @@ static int __devexit ehea_remove(struct ibmebus_dev *dev)
2568 destroy_workqueue(adapter->ehea_wq); 2598 destroy_workqueue(adapter->ehea_wq);
2569 2599
2570 ibmebus_free_irq(NULL, adapter->neq->attr.ist1, adapter); 2600 ibmebus_free_irq(NULL, adapter->neq->attr.ist1, adapter);
2601 tasklet_kill(&adapter->neq_tasklet);
2571 2602
2572 ehea_destroy_eq(adapter->neq); 2603 ehea_destroy_eq(adapter->neq);
2573 2604
diff --git a/drivers/net/ehea/ehea_phyp.c b/drivers/net/ehea/ehea_phyp.c
index 0cfc2bc1a27b..37716e05e808 100644
--- a/drivers/net/ehea/ehea_phyp.c
+++ b/drivers/net/ehea/ehea_phyp.c
@@ -94,6 +94,7 @@ static long ehea_plpar_hcall9(unsigned long opcode,
94{ 94{
95 long ret; 95 long ret;
96 int i, sleep_msecs; 96 int i, sleep_msecs;
97 u8 cb_cat;
97 98
98 for (i = 0; i < 5; i++) { 99 for (i = 0; i < 5; i++) {
99 ret = plpar_hcall9(opcode, outs, 100 ret = plpar_hcall9(opcode, outs,
@@ -106,7 +107,13 @@ static long ehea_plpar_hcall9(unsigned long opcode,
106 continue; 107 continue;
107 } 108 }
108 109
109 if (ret < H_SUCCESS) 110 cb_cat = EHEA_BMASK_GET(H_MEHEAPORT_CAT, arg2);
111
112 if ((ret < H_SUCCESS) && !(((ret == H_AUTHORITY)
113 && (opcode == H_MODIFY_HEA_PORT))
114 && (((cb_cat == H_PORT_CB4) && ((arg3 == H_PORT_CB4_JUMBO)
115 || (arg3 == H_PORT_CB4_SPEED))) || ((cb_cat == H_PORT_CB7)
116 && (arg3 == H_PORT_CB7_DUCQPN)))))
110 ehea_error("opcode=%lx ret=%lx" 117 ehea_error("opcode=%lx ret=%lx"
111 " arg1=%lx arg2=%lx arg3=%lx arg4=%lx" 118 " arg1=%lx arg2=%lx arg3=%lx arg4=%lx"
112 " arg5=%lx arg6=%lx arg7=%lx arg8=%lx" 119 " arg5=%lx arg6=%lx arg7=%lx arg8=%lx"
@@ -120,7 +127,6 @@ static long ehea_plpar_hcall9(unsigned long opcode,
120 outs[0], outs[1], outs[2], outs[3], 127 outs[0], outs[1], outs[2], outs[3],
121 outs[4], outs[5], outs[6], outs[7], 128 outs[4], outs[5], outs[6], outs[7],
122 outs[8]); 129 outs[8]);
123
124 return ret; 130 return ret;
125 } 131 }
126 132
diff --git a/drivers/net/fs_enet/mac-fec.c b/drivers/net/fs_enet/mac-fec.c
index c2c5fd419bd0..ff6839477306 100644
--- a/drivers/net/fs_enet/mac-fec.c
+++ b/drivers/net/fs_enet/mac-fec.c
@@ -104,9 +104,9 @@ static int do_pd_setup(struct fs_enet_private *fep)
104 fep->interrupt = platform_get_irq_byname(pdev,"interrupt"); 104 fep->interrupt = platform_get_irq_byname(pdev,"interrupt");
105 if (fep->interrupt < 0) 105 if (fep->interrupt < 0)
106 return -EINVAL; 106 return -EINVAL;
107 107
108 r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "regs"); 108 r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "regs");
109 fep->fec.fecp =(void*)r->start; 109 fep->fec.fecp = ioremap(r->start, r->end - r->start + 1);
110 110
111 if(fep->fec.fecp == NULL) 111 if(fep->fec.fecp == NULL)
112 return -EINVAL; 112 return -EINVAL;
@@ -319,11 +319,14 @@ static void restart(struct net_device *dev)
319 * Clear any outstanding interrupt. 319 * Clear any outstanding interrupt.
320 */ 320 */
321 FW(fecp, ievent, 0xffc0); 321 FW(fecp, ievent, 0xffc0);
322#ifndef CONFIG_PPC_MERGE
322 FW(fecp, ivec, (fep->interrupt / 2) << 29); 323 FW(fecp, ivec, (fep->interrupt / 2) << 29);
323 324#else
325 FW(fecp, ivec, (virq_to_hw(fep->interrupt) / 2) << 29);
326#endif
324 327
325 /* 328 /*
326 * adjust to speed (only for DUET & RMII) 329 * adjust to speed (only for DUET & RMII)
327 */ 330 */
328#ifdef CONFIG_DUET 331#ifdef CONFIG_DUET
329 if (fpi->use_rmii) { 332 if (fpi->use_rmii) {
@@ -418,6 +421,7 @@ static void stop(struct net_device *dev)
418 421
419static void pre_request_irq(struct net_device *dev, int irq) 422static void pre_request_irq(struct net_device *dev, int irq)
420{ 423{
424#ifndef CONFIG_PPC_MERGE
421 immap_t *immap = fs_enet_immap; 425 immap_t *immap = fs_enet_immap;
422 u32 siel; 426 u32 siel;
423 427
@@ -431,6 +435,7 @@ static void pre_request_irq(struct net_device *dev, int irq)
431 siel &= ~(0x80000000 >> (irq & ~1)); 435 siel &= ~(0x80000000 >> (irq & ~1));
432 out_be32(&immap->im_siu_conf.sc_siel, siel); 436 out_be32(&immap->im_siu_conf.sc_siel, siel);
433 } 437 }
438#endif
434} 439}
435 440
436static void post_free_irq(struct net_device *dev, int irq) 441static void post_free_irq(struct net_device *dev, int irq)
diff --git a/drivers/net/fs_enet/mac-scc.c b/drivers/net/fs_enet/mac-scc.c
index 95ec5872c507..afd7fca7c6c4 100644
--- a/drivers/net/fs_enet/mac-scc.c
+++ b/drivers/net/fs_enet/mac-scc.c
@@ -121,13 +121,13 @@ static int do_pd_setup(struct fs_enet_private *fep)
121 return -EINVAL; 121 return -EINVAL;
122 122
123 r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "regs"); 123 r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "regs");
124 fep->scc.sccp = (void *)r->start; 124 fep->scc.sccp = ioremap(r->start, r->end - r->start + 1);
125 125
126 if (fep->scc.sccp == NULL) 126 if (fep->scc.sccp == NULL)
127 return -EINVAL; 127 return -EINVAL;
128 128
129 r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "pram"); 129 r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "pram");
130 fep->scc.ep = (void *)r->start; 130 fep->scc.ep = ioremap(r->start, r->end - r->start + 1);
131 131
132 if (fep->scc.ep == NULL) 132 if (fep->scc.ep == NULL)
133 return -EINVAL; 133 return -EINVAL;
@@ -397,6 +397,7 @@ static void stop(struct net_device *dev)
397 397
398static void pre_request_irq(struct net_device *dev, int irq) 398static void pre_request_irq(struct net_device *dev, int irq)
399{ 399{
400#ifndef CONFIG_PPC_MERGE
400 immap_t *immap = fs_enet_immap; 401 immap_t *immap = fs_enet_immap;
401 u32 siel; 402 u32 siel;
402 403
@@ -410,6 +411,7 @@ static void pre_request_irq(struct net_device *dev, int irq)
410 siel &= ~(0x80000000 >> (irq & ~1)); 411 siel &= ~(0x80000000 >> (irq & ~1));
411 out_be32(&immap->im_siu_conf.sc_siel, siel); 412 out_be32(&immap->im_siu_conf.sc_siel, siel);
412 } 413 }
414#endif
413} 415}
414 416
415static void post_free_irq(struct net_device *dev, int irq) 417static void post_free_irq(struct net_device *dev, int irq)
diff --git a/drivers/net/hamradio/Kconfig b/drivers/net/hamradio/Kconfig
index 896aa02000d7..feb0ada7a025 100644
--- a/drivers/net/hamradio/Kconfig
+++ b/drivers/net/hamradio/Kconfig
@@ -113,7 +113,7 @@ config SCC_TRXECHO
113 113
114config BAYCOM_SER_FDX 114config BAYCOM_SER_FDX
115 tristate "BAYCOM ser12 fullduplex driver for AX.25" 115 tristate "BAYCOM ser12 fullduplex driver for AX.25"
116 depends on AX25 116 depends on AX25 && !S390
117 select CRC_CCITT 117 select CRC_CCITT
118 ---help--- 118 ---help---
119 This is one of two drivers for Baycom style simple amateur radio 119 This is one of two drivers for Baycom style simple amateur radio
@@ -133,7 +133,7 @@ config BAYCOM_SER_FDX
133 133
134config BAYCOM_SER_HDX 134config BAYCOM_SER_HDX
135 tristate "BAYCOM ser12 halfduplex driver for AX.25" 135 tristate "BAYCOM ser12 halfduplex driver for AX.25"
136 depends on AX25 136 depends on AX25 && !S390
137 select CRC_CCITT 137 select CRC_CCITT
138 ---help--- 138 ---help---
139 This is one of two drivers for Baycom style simple amateur radio 139 This is one of two drivers for Baycom style simple amateur radio
@@ -181,7 +181,7 @@ config BAYCOM_EPP
181 181
182config YAM 182config YAM
183 tristate "YAM driver for AX.25" 183 tristate "YAM driver for AX.25"
184 depends on AX25 184 depends on AX25 && !S390
185 help 185 help
186 The YAM is a modem for packet radio which connects to the serial 186 The YAM is a modem for packet radio which connects to the serial
187 port and includes some of the functions of a Terminal Node 187 port and includes some of the functions of a Terminal Node
diff --git a/drivers/net/irda/irda-usb.c b/drivers/net/irda/irda-usb.c
index 3ca1082ec776..340ee99652eb 100644
--- a/drivers/net/irda/irda-usb.c
+++ b/drivers/net/irda/irda-usb.c
@@ -441,25 +441,13 @@ static int irda_usb_hard_xmit(struct sk_buff *skb, struct net_device *netdev)
441 goto drop; 441 goto drop;
442 } 442 }
443 443
444 /* Make sure there is room for IrDA-USB header. The actual 444 memcpy(self->tx_buff + self->header_length, skb->data, skb->len);
445 * allocation will be done lower in skb_push().
446 * Also, we don't use directly skb_cow(), because it require
447 * headroom >= 16, which force unnecessary copies - Jean II */
448 if (skb_headroom(skb) < self->header_length) {
449 IRDA_DEBUG(0, "%s(), Insuficient skb headroom.\n", __FUNCTION__);
450 if (skb_cow(skb, self->header_length)) {
451 IRDA_WARNING("%s(), failed skb_cow() !!!\n", __FUNCTION__);
452 goto drop;
453 }
454 }
455 445
456 /* Change setting for next frame */ 446 /* Change setting for next frame */
457
458 if (self->capability & IUC_STIR421X) { 447 if (self->capability & IUC_STIR421X) {
459 __u8 turnaround_time; 448 __u8 turnaround_time;
460 __u8* frame; 449 __u8* frame = self->tx_buff;
461 turnaround_time = get_turnaround_time( skb ); 450 turnaround_time = get_turnaround_time( skb );
462 frame= skb_push(skb, self->header_length);
463 irda_usb_build_header(self, frame, 0); 451 irda_usb_build_header(self, frame, 0);
464 frame[2] = turnaround_time; 452 frame[2] = turnaround_time;
465 if ((skb->len != 0) && 453 if ((skb->len != 0) &&
@@ -472,17 +460,17 @@ static int irda_usb_hard_xmit(struct sk_buff *skb, struct net_device *netdev)
472 frame[1] = 0; 460 frame[1] = 0;
473 } 461 }
474 } else { 462 } else {
475 irda_usb_build_header(self, skb_push(skb, self->header_length), 0); 463 irda_usb_build_header(self, self->tx_buff, 0);
476 } 464 }
477 465
478 /* FIXME: Make macro out of this one */ 466 /* FIXME: Make macro out of this one */
479 ((struct irda_skb_cb *)skb->cb)->context = self; 467 ((struct irda_skb_cb *)skb->cb)->context = self;
480 468
481 usb_fill_bulk_urb(urb, self->usbdev, 469 usb_fill_bulk_urb(urb, self->usbdev,
482 usb_sndbulkpipe(self->usbdev, self->bulk_out_ep), 470 usb_sndbulkpipe(self->usbdev, self->bulk_out_ep),
483 skb->data, IRDA_SKB_MAX_MTU, 471 self->tx_buff, skb->len + self->header_length,
484 write_bulk_callback, skb); 472 write_bulk_callback, skb);
485 urb->transfer_buffer_length = skb->len; 473
486 /* This flag (URB_ZERO_PACKET) indicates that what we send is not 474 /* This flag (URB_ZERO_PACKET) indicates that what we send is not
487 * a continuous stream of data but separate packets. 475 * a continuous stream of data but separate packets.
488 * In this case, the USB layer will insert an empty USB frame (TD) 476 * In this case, the USB layer will insert an empty USB frame (TD)
@@ -1455,6 +1443,9 @@ static inline void irda_usb_close(struct irda_usb_cb *self)
1455 /* Remove the speed buffer */ 1443 /* Remove the speed buffer */
1456 kfree(self->speed_buff); 1444 kfree(self->speed_buff);
1457 self->speed_buff = NULL; 1445 self->speed_buff = NULL;
1446
1447 kfree(self->tx_buff);
1448 self->tx_buff = NULL;
1458} 1449}
1459 1450
1460/********************** USB CONFIG SUBROUTINES **********************/ 1451/********************** USB CONFIG SUBROUTINES **********************/
@@ -1524,8 +1515,6 @@ static inline int irda_usb_parse_endpoints(struct irda_usb_cb *self, struct usb_
1524 1515
1525 IRDA_DEBUG(0, "%s(), And our endpoints are : in=%02X, out=%02X (%d), int=%02X\n", 1516 IRDA_DEBUG(0, "%s(), And our endpoints are : in=%02X, out=%02X (%d), int=%02X\n",
1526 __FUNCTION__, self->bulk_in_ep, self->bulk_out_ep, self->bulk_out_mtu, self->bulk_int_ep); 1517 __FUNCTION__, self->bulk_in_ep, self->bulk_out_ep, self->bulk_out_mtu, self->bulk_int_ep);
1527 /* Should be 8, 16, 32 or 64 bytes */
1528 IRDA_ASSERT(self->bulk_out_mtu == 64, ;);
1529 1518
1530 return((self->bulk_in_ep != 0) && (self->bulk_out_ep != 0)); 1519 return((self->bulk_in_ep != 0) && (self->bulk_out_ep != 0));
1531} 1520}
@@ -1753,9 +1742,14 @@ static int irda_usb_probe(struct usb_interface *intf,
1753 1742
1754 memset(self->speed_buff, 0, IRDA_USB_SPEED_MTU); 1743 memset(self->speed_buff, 0, IRDA_USB_SPEED_MTU);
1755 1744
1745 self->tx_buff = kzalloc(IRDA_SKB_MAX_MTU + self->header_length,
1746 GFP_KERNEL);
1747 if (self->tx_buff == NULL)
1748 goto err_out_4;
1749
1756 ret = irda_usb_open(self); 1750 ret = irda_usb_open(self);
1757 if (ret) 1751 if (ret)
1758 goto err_out_4; 1752 goto err_out_5;
1759 1753
1760 IRDA_MESSAGE("IrDA: Registered device %s\n", net->name); 1754 IRDA_MESSAGE("IrDA: Registered device %s\n", net->name);
1761 usb_set_intfdata(intf, self); 1755 usb_set_intfdata(intf, self);
@@ -1766,14 +1760,14 @@ static int irda_usb_probe(struct usb_interface *intf,
1766 self->needspatch = (ret < 0); 1760 self->needspatch = (ret < 0);
1767 if (self->needspatch) { 1761 if (self->needspatch) {
1768 IRDA_ERROR("STIR421X: Couldn't upload patch\n"); 1762 IRDA_ERROR("STIR421X: Couldn't upload patch\n");
1769 goto err_out_5; 1763 goto err_out_6;
1770 } 1764 }
1771 1765
1772 /* replace IrDA class descriptor with what patched device is now reporting */ 1766 /* replace IrDA class descriptor with what patched device is now reporting */
1773 irda_desc = irda_usb_find_class_desc (self->usbintf); 1767 irda_desc = irda_usb_find_class_desc (self->usbintf);
1774 if (irda_desc == NULL) { 1768 if (irda_desc == NULL) {
1775 ret = -ENODEV; 1769 ret = -ENODEV;
1776 goto err_out_5; 1770 goto err_out_6;
1777 } 1771 }
1778 if (self->irda_desc) 1772 if (self->irda_desc)
1779 kfree (self->irda_desc); 1773 kfree (self->irda_desc);
@@ -1782,9 +1776,10 @@ static int irda_usb_probe(struct usb_interface *intf,
1782 } 1776 }
1783 1777
1784 return 0; 1778 return 0;
1785 1779err_out_6:
1786err_out_5:
1787 unregister_netdev(self->netdev); 1780 unregister_netdev(self->netdev);
1781err_out_5:
1782 kfree(self->tx_buff);
1788err_out_4: 1783err_out_4:
1789 kfree(self->speed_buff); 1784 kfree(self->speed_buff);
1790err_out_3: 1785err_out_3:
diff --git a/drivers/net/irda/irda-usb.h b/drivers/net/irda/irda-usb.h
index 6b2271f18e77..e846c38224a3 100644
--- a/drivers/net/irda/irda-usb.h
+++ b/drivers/net/irda/irda-usb.h
@@ -156,6 +156,7 @@ struct irda_usb_cb {
156 struct irlap_cb *irlap; /* The link layer we are binded to */ 156 struct irlap_cb *irlap; /* The link layer we are binded to */
157 struct qos_info qos; 157 struct qos_info qos;
158 char *speed_buff; /* Buffer for speed changes */ 158 char *speed_buff; /* Buffer for speed changes */
159 char *tx_buff;
159 160
160 struct timeval stamp; 161 struct timeval stamp;
161 struct timeval now; 162 struct timeval now;
diff --git a/drivers/net/irda/stir4200.c b/drivers/net/irda/stir4200.c
index c14a74634fd5..20d306fea4cb 100644
--- a/drivers/net/irda/stir4200.c
+++ b/drivers/net/irda/stir4200.c
@@ -59,7 +59,7 @@
59#include <asm/byteorder.h> 59#include <asm/byteorder.h>
60#include <asm/unaligned.h> 60#include <asm/unaligned.h>
61 61
62MODULE_AUTHOR("Stephen Hemminger <shemminger@osdl.org>"); 62MODULE_AUTHOR("Stephen Hemminger <shemminger@linux-foundation.org>");
63MODULE_DESCRIPTION("IrDA-USB Dongle Driver for SigmaTel STIr4200"); 63MODULE_DESCRIPTION("IrDA-USB Dongle Driver for SigmaTel STIr4200");
64MODULE_LICENSE("GPL"); 64MODULE_LICENSE("GPL");
65 65
diff --git a/drivers/net/irda/vlsi_ir.c b/drivers/net/irda/vlsi_ir.c
index 18c68193bf14..e2b1af618450 100644
--- a/drivers/net/irda/vlsi_ir.c
+++ b/drivers/net/irda/vlsi_ir.c
@@ -166,7 +166,7 @@ static void vlsi_proc_pdev(struct seq_file *seq, struct pci_dev *pdev)
166 unsigned i; 166 unsigned i;
167 167
168 seq_printf(seq, "\n%s (vid/did: %04x/%04x)\n", 168 seq_printf(seq, "\n%s (vid/did: %04x/%04x)\n",
169 PCIDEV_NAME(pdev), (int)pdev->vendor, (int)pdev->device); 169 pci_name(pdev), (int)pdev->vendor, (int)pdev->device);
170 seq_printf(seq, "pci-power-state: %u\n", (unsigned) pdev->current_state); 170 seq_printf(seq, "pci-power-state: %u\n", (unsigned) pdev->current_state);
171 seq_printf(seq, "resources: irq=%u / io=0x%04x / dma_mask=0x%016Lx\n", 171 seq_printf(seq, "resources: irq=%u / io=0x%04x / dma_mask=0x%016Lx\n",
172 pdev->irq, (unsigned)pci_resource_start(pdev, 0), (unsigned long long)pdev->dma_mask); 172 pdev->irq, (unsigned)pci_resource_start(pdev, 0), (unsigned long long)pdev->dma_mask);
@@ -1401,7 +1401,7 @@ static void vlsi_tx_timeout(struct net_device *ndev)
1401 1401
1402 if (vlsi_start_hw(idev)) 1402 if (vlsi_start_hw(idev))
1403 IRDA_ERROR("%s: failed to restart hw - %s(%s) unusable!\n", 1403 IRDA_ERROR("%s: failed to restart hw - %s(%s) unusable!\n",
1404 __FUNCTION__, PCIDEV_NAME(idev->pdev), ndev->name); 1404 __FUNCTION__, pci_name(idev->pdev), ndev->name);
1405 else 1405 else
1406 netif_start_queue(ndev); 1406 netif_start_queue(ndev);
1407} 1407}
@@ -1643,7 +1643,7 @@ vlsi_irda_probe(struct pci_dev *pdev, const struct pci_device_id *id)
1643 pdev->current_state = 0; /* hw must be running now */ 1643 pdev->current_state = 0; /* hw must be running now */
1644 1644
1645 IRDA_MESSAGE("%s: IrDA PCI controller %s detected\n", 1645 IRDA_MESSAGE("%s: IrDA PCI controller %s detected\n",
1646 drivername, PCIDEV_NAME(pdev)); 1646 drivername, pci_name(pdev));
1647 1647
1648 if ( !pci_resource_start(pdev,0) 1648 if ( !pci_resource_start(pdev,0)
1649 || !(pci_resource_flags(pdev,0) & IORESOURCE_IO) ) { 1649 || !(pci_resource_flags(pdev,0) & IORESOURCE_IO) ) {
@@ -1728,7 +1728,7 @@ static void __devexit vlsi_irda_remove(struct pci_dev *pdev)
1728 1728
1729 pci_set_drvdata(pdev, NULL); 1729 pci_set_drvdata(pdev, NULL);
1730 1730
1731 IRDA_MESSAGE("%s: %s removed\n", drivername, PCIDEV_NAME(pdev)); 1731 IRDA_MESSAGE("%s: %s removed\n", drivername, pci_name(pdev));
1732} 1732}
1733 1733
1734#ifdef CONFIG_PM 1734#ifdef CONFIG_PM
@@ -1748,7 +1748,7 @@ static int vlsi_irda_suspend(struct pci_dev *pdev, pm_message_t state)
1748 1748
1749 if (!ndev) { 1749 if (!ndev) {
1750 IRDA_ERROR("%s - %s: no netdevice \n", 1750 IRDA_ERROR("%s - %s: no netdevice \n",
1751 __FUNCTION__, PCIDEV_NAME(pdev)); 1751 __FUNCTION__, pci_name(pdev));
1752 return 0; 1752 return 0;
1753 } 1753 }
1754 idev = ndev->priv; 1754 idev = ndev->priv;
@@ -1759,7 +1759,7 @@ static int vlsi_irda_suspend(struct pci_dev *pdev, pm_message_t state)
1759 pdev->current_state = state.event; 1759 pdev->current_state = state.event;
1760 } 1760 }
1761 else 1761 else
1762 IRDA_ERROR("%s - %s: invalid suspend request %u -> %u\n", __FUNCTION__, PCIDEV_NAME(pdev), pdev->current_state, state.event); 1762 IRDA_ERROR("%s - %s: invalid suspend request %u -> %u\n", __FUNCTION__, pci_name(pdev), pdev->current_state, state.event);
1763 up(&idev->sem); 1763 up(&idev->sem);
1764 return 0; 1764 return 0;
1765 } 1765 }
@@ -1787,7 +1787,7 @@ static int vlsi_irda_resume(struct pci_dev *pdev)
1787 1787
1788 if (!ndev) { 1788 if (!ndev) {
1789 IRDA_ERROR("%s - %s: no netdevice \n", 1789 IRDA_ERROR("%s - %s: no netdevice \n",
1790 __FUNCTION__, PCIDEV_NAME(pdev)); 1790 __FUNCTION__, pci_name(pdev));
1791 return 0; 1791 return 0;
1792 } 1792 }
1793 idev = ndev->priv; 1793 idev = ndev->priv;
@@ -1795,7 +1795,7 @@ static int vlsi_irda_resume(struct pci_dev *pdev)
1795 if (pdev->current_state == 0) { 1795 if (pdev->current_state == 0) {
1796 up(&idev->sem); 1796 up(&idev->sem);
1797 IRDA_WARNING("%s - %s: already resumed\n", 1797 IRDA_WARNING("%s - %s: already resumed\n",
1798 __FUNCTION__, PCIDEV_NAME(pdev)); 1798 __FUNCTION__, pci_name(pdev));
1799 return 0; 1799 return 0;
1800 } 1800 }
1801 1801
diff --git a/drivers/net/irda/vlsi_ir.h b/drivers/net/irda/vlsi_ir.h
index c37f0bc4c7f9..2d3b773d8e35 100644
--- a/drivers/net/irda/vlsi_ir.h
+++ b/drivers/net/irda/vlsi_ir.h
@@ -41,39 +41,6 @@
41#define PCI_CLASS_SUBCLASS_MASK 0xffff 41#define PCI_CLASS_SUBCLASS_MASK 0xffff
42#endif 42#endif
43 43
44/* in recent 2.5 interrupt handlers have non-void return value */
45#ifndef IRQ_RETVAL
46typedef void irqreturn_t;
47#define IRQ_NONE
48#define IRQ_HANDLED
49#define IRQ_RETVAL(x)
50#endif
51
52/* some stuff need to check kernelversion. Not all 2.5 stuff was present
53 * in early 2.5.x - the test is merely to separate 2.4 from 2.5
54 */
55#include <linux/version.h>
56
57#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
58
59/* PDE() introduced in 2.5.4 */
60#ifdef CONFIG_PROC_FS
61#define PDE(inode) ((inode)->i_private)
62#endif
63
64/* irda crc16 calculation exported in 2.5.42 */
65#define irda_calc_crc16(fcs,buf,len) (GOOD_FCS)
66
67/* we use this for unified pci device name access */
68#define PCIDEV_NAME(pdev) ((pdev)->name)
69
70#else /* 2.5 or later */
71
72/* whatever we get from the associated struct device - bus:slot:dev.fn id */
73#define PCIDEV_NAME(pdev) (pci_name(pdev))
74
75#endif
76
77/* ================================================================ */ 44/* ================================================================ */
78 45
79/* non-standard PCI registers */ 46/* non-standard PCI registers */
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c
index c41ae4286eea..b3bf86422734 100644
--- a/drivers/net/mv643xx_eth.c
+++ b/drivers/net/mv643xx_eth.c
@@ -314,6 +314,13 @@ int mv643xx_eth_free_tx_descs(struct net_device *dev, int force)
314 314
315 while (mp->tx_desc_count > 0) { 315 while (mp->tx_desc_count > 0) {
316 spin_lock_irqsave(&mp->lock, flags); 316 spin_lock_irqsave(&mp->lock, flags);
317
318 /* tx_desc_count might have changed before acquiring the lock */
319 if (mp->tx_desc_count <= 0) {
320 spin_unlock_irqrestore(&mp->lock, flags);
321 return released;
322 }
323
317 tx_index = mp->tx_used_desc_q; 324 tx_index = mp->tx_used_desc_q;
318 desc = &mp->p_tx_desc_area[tx_index]; 325 desc = &mp->p_tx_desc_area[tx_index];
319 cmd_sts = desc->cmd_sts; 326 cmd_sts = desc->cmd_sts;
@@ -332,13 +339,13 @@ int mv643xx_eth_free_tx_descs(struct net_device *dev, int force)
332 if (skb) 339 if (skb)
333 mp->tx_skb[tx_index] = NULL; 340 mp->tx_skb[tx_index] = NULL;
334 341
335 spin_unlock_irqrestore(&mp->lock, flags);
336
337 if (cmd_sts & ETH_ERROR_SUMMARY) { 342 if (cmd_sts & ETH_ERROR_SUMMARY) {
338 printk("%s: Error in TX\n", dev->name); 343 printk("%s: Error in TX\n", dev->name);
339 mp->stats.tx_errors++; 344 mp->stats.tx_errors++;
340 } 345 }
341 346
347 spin_unlock_irqrestore(&mp->lock, flags);
348
342 if (cmd_sts & ETH_TX_FIRST_DESC) 349 if (cmd_sts & ETH_TX_FIRST_DESC)
343 dma_unmap_single(NULL, addr, count, DMA_TO_DEVICE); 350 dma_unmap_single(NULL, addr, count, DMA_TO_DEVICE);
344 else 351 else
diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h
index 6490acf05305..e8598b809228 100644
--- a/drivers/net/netxen/netxen_nic.h
+++ b/drivers/net/netxen/netxen_nic.h
@@ -63,12 +63,11 @@
63 63
64#include "netxen_nic_hw.h" 64#include "netxen_nic_hw.h"
65 65
66#define NETXEN_NIC_BUILD_NO "4" 66#define NETXEN_NIC_BUILD_NO "2"
67#define _NETXEN_NIC_LINUX_MAJOR 3 67#define _NETXEN_NIC_LINUX_MAJOR 3
68#define _NETXEN_NIC_LINUX_MINOR 3 68#define _NETXEN_NIC_LINUX_MINOR 3
69#define _NETXEN_NIC_LINUX_SUBVERSION 2 69#define _NETXEN_NIC_LINUX_SUBVERSION 3
70#define NETXEN_NIC_LINUX_VERSIONID "3.3.2" "-" NETXEN_NIC_BUILD_NO 70#define NETXEN_NIC_LINUX_VERSIONID "3.3.3" "-" NETXEN_NIC_BUILD_NO
71#define NETXEN_NIC_FW_VERSIONID "3.3.2"
72 71
73#define RCV_DESC_RINGSIZE \ 72#define RCV_DESC_RINGSIZE \
74 (sizeof(struct rcv_desc) * adapter->max_rx_desc_count) 73 (sizeof(struct rcv_desc) * adapter->max_rx_desc_count)
@@ -240,49 +239,39 @@ extern unsigned long long netxen_dma_mask;
240 239
241typedef u32 netxen_ctx_msg; 240typedef u32 netxen_ctx_msg;
242 241
243#define _netxen_set_bits(config_word, start, bits, val) {\
244 unsigned long long mask = (((1ULL << (bits)) - 1) << (start)); \
245 unsigned long long value = (val); \
246 (config_word) &= ~mask; \
247 (config_word) |= (((value) << (start)) & mask); \
248}
249
250#define netxen_set_msg_peg_id(config_word, val) \ 242#define netxen_set_msg_peg_id(config_word, val) \
251 _netxen_set_bits(config_word, 0, 2, val) 243 ((config_word) &= ~3, (config_word) |= val & 3)
252#define netxen_set_msg_privid(config_word) \ 244#define netxen_set_msg_privid(config_word) \
253 set_bit(2, (unsigned long*)&config_word) 245 ((config_word) |= 1 << 2)
254#define netxen_set_msg_count(config_word, val) \ 246#define netxen_set_msg_count(config_word, val) \
255 _netxen_set_bits(config_word, 3, 15, val) 247 ((config_word) &= ~(0x7fff<<3), (config_word) |= (val & 0x7fff) << 3)
256#define netxen_set_msg_ctxid(config_word, val) \ 248#define netxen_set_msg_ctxid(config_word, val) \
257 _netxen_set_bits(config_word, 18, 10, val) 249 ((config_word) &= ~(0x3ff<<18), (config_word) |= (val & 0x3ff) << 18)
258#define netxen_set_msg_opcode(config_word, val) \ 250#define netxen_set_msg_opcode(config_word, val) \
259 _netxen_set_bits(config_word, 28, 4, val) 251 ((config_word) &= ~(0xf<<24), (config_word) |= (val & 0xf) << 24)
260 252
261struct netxen_rcv_context { 253struct netxen_rcv_context {
262 u32 rcv_ring_addr_lo; 254 __le64 rcv_ring_addr;
263 u32 rcv_ring_addr_hi; 255 __le32 rcv_ring_size;
264 u32 rcv_ring_size; 256 __le32 rsrvd;
265 u32 rsrvd;
266}; 257};
267 258
268struct netxen_ring_ctx { 259struct netxen_ring_ctx {
269 260
270 /* one command ring */ 261 /* one command ring */
271 u64 cmd_consumer_offset; 262 __le64 cmd_consumer_offset;
272 u32 cmd_ring_addr_lo; 263 __le64 cmd_ring_addr;
273 u32 cmd_ring_addr_hi; 264 __le32 cmd_ring_size;
274 u32 cmd_ring_size; 265 __le32 rsrvd;
275 u32 rsrvd;
276 266
277 /* three receive rings */ 267 /* three receive rings */
278 struct netxen_rcv_context rcv_ctx[3]; 268 struct netxen_rcv_context rcv_ctx[3];
279 269
280 /* one status ring */ 270 /* one status ring */
281 u32 sts_ring_addr_lo; 271 __le64 sts_ring_addr;
282 u32 sts_ring_addr_hi; 272 __le32 sts_ring_size;
283 u32 sts_ring_size;
284 273
285 u32 ctx_id; 274 __le32 ctx_id;
286} __attribute__ ((aligned(64))); 275} __attribute__ ((aligned(64)));
287 276
288/* 277/*
@@ -306,81 +295,85 @@ struct netxen_ring_ctx {
306 ((cmd_desc)->port_ctxid |= ((var) & 0x0F)) 295 ((cmd_desc)->port_ctxid |= ((var) & 0x0F))
307 296
308#define netxen_set_cmd_desc_flags(cmd_desc, val) \ 297#define netxen_set_cmd_desc_flags(cmd_desc, val) \
309 _netxen_set_bits((cmd_desc)->flags_opcode, 0, 7, val) 298 ((cmd_desc)->flags_opcode &= ~cpu_to_le16(0x7f), \
299 (cmd_desc)->flags_opcode |= cpu_to_le16((val) & 0x7f))
310#define netxen_set_cmd_desc_opcode(cmd_desc, val) \ 300#define netxen_set_cmd_desc_opcode(cmd_desc, val) \
311 _netxen_set_bits((cmd_desc)->flags_opcode, 7, 6, val) 301 ((cmd_desc)->flags_opcode &= ~cpu_to_le16(0x3f<<7), \
302 (cmd_desc)->flags_opcode |= cpu_to_le16((val) & (0x3f<<7)))
312 303
313#define netxen_set_cmd_desc_num_of_buff(cmd_desc, val) \ 304#define netxen_set_cmd_desc_num_of_buff(cmd_desc, val) \
314 _netxen_set_bits((cmd_desc)->num_of_buffers_total_length, 0, 8, val); 305 ((cmd_desc)->num_of_buffers_total_length &= ~cpu_to_le32(0xff), \
306 (cmd_desc)->num_of_buffers_total_length |= cpu_to_le32((val) & 0xff))
315#define netxen_set_cmd_desc_totallength(cmd_desc, val) \ 307#define netxen_set_cmd_desc_totallength(cmd_desc, val) \
316 _netxen_set_bits((cmd_desc)->num_of_buffers_total_length, 8, 24, val); 308 ((cmd_desc)->num_of_buffers_total_length &= cpu_to_le32(0xff), \
309 (cmd_desc)->num_of_buffers_total_length |= cpu_to_le32(val << 24))
317 310
318#define netxen_get_cmd_desc_opcode(cmd_desc) \ 311#define netxen_get_cmd_desc_opcode(cmd_desc) \
319 (((cmd_desc)->flags_opcode >> 7) & 0x003F) 312 ((le16_to_cpu((cmd_desc)->flags_opcode) >> 7) & 0x003F)
320#define netxen_get_cmd_desc_totallength(cmd_desc) \ 313#define netxen_get_cmd_desc_totallength(cmd_desc) \
321 (((cmd_desc)->num_of_buffers_total_length >> 8) & 0x0FFFFFF) 314 (le32_to_cpu((cmd_desc)->num_of_buffers_total_length) >> 8)
322 315
323struct cmd_desc_type0 { 316struct cmd_desc_type0 {
324 u8 tcp_hdr_offset; /* For LSO only */ 317 u8 tcp_hdr_offset; /* For LSO only */
325 u8 ip_hdr_offset; /* For LSO only */ 318 u8 ip_hdr_offset; /* For LSO only */
326 /* Bit pattern: 0-6 flags, 7-12 opcode, 13-15 unused */ 319 /* Bit pattern: 0-6 flags, 7-12 opcode, 13-15 unused */
327 u16 flags_opcode; 320 __le16 flags_opcode;
328 /* Bit pattern: 0-7 total number of segments, 321 /* Bit pattern: 0-7 total number of segments,
329 8-31 Total size of the packet */ 322 8-31 Total size of the packet */
330 u32 num_of_buffers_total_length; 323 __le32 num_of_buffers_total_length;
331 union { 324 union {
332 struct { 325 struct {
333 u32 addr_low_part2; 326 __le32 addr_low_part2;
334 u32 addr_high_part2; 327 __le32 addr_high_part2;
335 }; 328 };
336 u64 addr_buffer2; 329 __le64 addr_buffer2;
337 }; 330 };
338 331
339 u16 reference_handle; /* changed to u16 to add mss */ 332 __le16 reference_handle; /* changed to u16 to add mss */
340 u16 mss; /* passed by NDIS_PACKET for LSO */ 333 __le16 mss; /* passed by NDIS_PACKET for LSO */
341 /* Bit pattern 0-3 port, 0-3 ctx id */ 334 /* Bit pattern 0-3 port, 0-3 ctx id */
342 u8 port_ctxid; 335 u8 port_ctxid;
343 u8 total_hdr_length; /* LSO only : MAC+IP+TCP Hdr size */ 336 u8 total_hdr_length; /* LSO only : MAC+IP+TCP Hdr size */
344 u16 conn_id; /* IPSec offoad only */ 337 __le16 conn_id; /* IPSec offoad only */
345 338
346 union { 339 union {
347 struct { 340 struct {
348 u32 addr_low_part3; 341 __le32 addr_low_part3;
349 u32 addr_high_part3; 342 __le32 addr_high_part3;
350 }; 343 };
351 u64 addr_buffer3; 344 __le64 addr_buffer3;
352 }; 345 };
353 union { 346 union {
354 struct { 347 struct {
355 u32 addr_low_part1; 348 __le32 addr_low_part1;
356 u32 addr_high_part1; 349 __le32 addr_high_part1;
357 }; 350 };
358 u64 addr_buffer1; 351 __le64 addr_buffer1;
359 }; 352 };
360 353
361 u16 buffer1_length; 354 __le16 buffer1_length;
362 u16 buffer2_length; 355 __le16 buffer2_length;
363 u16 buffer3_length; 356 __le16 buffer3_length;
364 u16 buffer4_length; 357 __le16 buffer4_length;
365 358
366 union { 359 union {
367 struct { 360 struct {
368 u32 addr_low_part4; 361 __le32 addr_low_part4;
369 u32 addr_high_part4; 362 __le32 addr_high_part4;
370 }; 363 };
371 u64 addr_buffer4; 364 __le64 addr_buffer4;
372 }; 365 };
373 366
374 u64 unused; 367 __le64 unused;
375 368
376} __attribute__ ((aligned(64))); 369} __attribute__ ((aligned(64)));
377 370
378/* Note: sizeof(rcv_desc) should always be a mutliple of 2 */ 371/* Note: sizeof(rcv_desc) should always be a mutliple of 2 */
379struct rcv_desc { 372struct rcv_desc {
380 u16 reference_handle; 373 __le16 reference_handle;
381 u16 reserved; 374 __le16 reserved;
382 u32 buffer_length; /* allocated buffer length (usually 2K) */ 375 __le32 buffer_length; /* allocated buffer length (usually 2K) */
383 u64 addr_buffer; 376 __le64 addr_buffer;
384}; 377};
385 378
386/* opcode field in status_desc */ 379/* opcode field in status_desc */
@@ -406,36 +399,36 @@ struct rcv_desc {
406 (((status_desc)->lro & 0x80) >> 7) 399 (((status_desc)->lro & 0x80) >> 7)
407 400
408#define netxen_get_sts_port(status_desc) \ 401#define netxen_get_sts_port(status_desc) \
409 ((status_desc)->status_desc_data & 0x0F) 402 (le64_to_cpu((status_desc)->status_desc_data) & 0x0F)
410#define netxen_get_sts_status(status_desc) \ 403#define netxen_get_sts_status(status_desc) \
411 (((status_desc)->status_desc_data >> 4) & 0x0F) 404 ((le64_to_cpu((status_desc)->status_desc_data) >> 4) & 0x0F)
412#define netxen_get_sts_type(status_desc) \ 405#define netxen_get_sts_type(status_desc) \
413 (((status_desc)->status_desc_data >> 8) & 0x0F) 406 ((le64_to_cpu((status_desc)->status_desc_data) >> 8) & 0x0F)
414#define netxen_get_sts_totallength(status_desc) \ 407#define netxen_get_sts_totallength(status_desc) \
415 (((status_desc)->status_desc_data >> 12) & 0xFFFF) 408 ((le64_to_cpu((status_desc)->status_desc_data) >> 12) & 0xFFFF)
416#define netxen_get_sts_refhandle(status_desc) \ 409#define netxen_get_sts_refhandle(status_desc) \
417 (((status_desc)->status_desc_data >> 28) & 0xFFFF) 410 ((le64_to_cpu((status_desc)->status_desc_data) >> 28) & 0xFFFF)
418#define netxen_get_sts_prot(status_desc) \ 411#define netxen_get_sts_prot(status_desc) \
419 (((status_desc)->status_desc_data >> 44) & 0x0F) 412 ((le64_to_cpu((status_desc)->status_desc_data) >> 44) & 0x0F)
420#define netxen_get_sts_owner(status_desc) \ 413#define netxen_get_sts_owner(status_desc) \
421 (((status_desc)->status_desc_data >> 56) & 0x03) 414 ((le64_to_cpu((status_desc)->status_desc_data) >> 56) & 0x03)
422#define netxen_get_sts_opcode(status_desc) \ 415#define netxen_get_sts_opcode(status_desc) \
423 (((status_desc)->status_desc_data >> 58) & 0x03F) 416 ((le64_to_cpu((status_desc)->status_desc_data) >> 58) & 0x03F)
424 417
425#define netxen_clear_sts_owner(status_desc) \ 418#define netxen_clear_sts_owner(status_desc) \
426 ((status_desc)->status_desc_data &= \ 419 ((status_desc)->status_desc_data &= \
427 ~(((unsigned long long)3) << 56 )) 420 ~cpu_to_le64(((unsigned long long)3) << 56 ))
428#define netxen_set_sts_owner(status_desc, val) \ 421#define netxen_set_sts_owner(status_desc, val) \
429 ((status_desc)->status_desc_data |= \ 422 ((status_desc)->status_desc_data |= \
430 (((unsigned long long)((val) & 0x3)) << 56 )) 423 cpu_to_le64(((unsigned long long)((val) & 0x3)) << 56 ))
431 424
432struct status_desc { 425struct status_desc {
433 /* Bit pattern: 0-3 port, 4-7 status, 8-11 type, 12-27 total_length 426 /* Bit pattern: 0-3 port, 4-7 status, 8-11 type, 12-27 total_length
434 28-43 reference_handle, 44-47 protocol, 48-52 unused 427 28-43 reference_handle, 44-47 protocol, 48-52 unused
435 53-55 desc_cnt, 56-57 owner, 58-63 opcode 428 53-55 desc_cnt, 56-57 owner, 58-63 opcode
436 */ 429 */
437 u64 status_desc_data; 430 __le64 status_desc_data;
438 u32 hash_value; 431 __le32 hash_value;
439 u8 hash_type; 432 u8 hash_type;
440 u8 msg_type; 433 u8 msg_type;
441 u8 unused; 434 u8 unused;
@@ -1006,9 +999,9 @@ void netxen_niu_gbe_set_mii_mode(struct netxen_adapter *adapter, int port,
1006void netxen_niu_gbe_set_gmii_mode(struct netxen_adapter *adapter, int port, 999void netxen_niu_gbe_set_gmii_mode(struct netxen_adapter *adapter, int port,
1007 long enable); 1000 long enable);
1008int netxen_niu_gbe_phy_read(struct netxen_adapter *adapter, long phy, long reg, 1001int netxen_niu_gbe_phy_read(struct netxen_adapter *adapter, long phy, long reg,
1009 __le32 * readval); 1002 __u32 * readval);
1010int netxen_niu_gbe_phy_write(struct netxen_adapter *adapter, long phy, 1003int netxen_niu_gbe_phy_write(struct netxen_adapter *adapter, long phy,
1011 long reg, __le32 val); 1004 long reg, __u32 val);
1012 1005
1013/* Functions available from netxen_nic_hw.c */ 1006/* Functions available from netxen_nic_hw.c */
1014int netxen_nic_set_mtu_xgb(struct netxen_port *port, int new_mtu); 1007int netxen_nic_set_mtu_xgb(struct netxen_port *port, int new_mtu);
diff --git a/drivers/net/netxen/netxen_nic_ethtool.c b/drivers/net/netxen/netxen_nic_ethtool.c
index 34044616b3c8..c381d77a7336 100644
--- a/drivers/net/netxen/netxen_nic_ethtool.c
+++ b/drivers/net/netxen/netxen_nic_ethtool.c
@@ -218,7 +218,7 @@ netxen_nic_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
218{ 218{
219 struct netxen_port *port = netdev_priv(dev); 219 struct netxen_port *port = netdev_priv(dev);
220 struct netxen_adapter *adapter = port->adapter; 220 struct netxen_adapter *adapter = port->adapter;
221 __le32 status; 221 __u32 status;
222 222
223 /* read which mode */ 223 /* read which mode */
224 if (adapter->ahw.board_type == NETXEN_NIC_GBE) { 224 if (adapter->ahw.board_type == NETXEN_NIC_GBE) {
@@ -226,7 +226,7 @@ netxen_nic_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
226 if (adapter->phy_write 226 if (adapter->phy_write
227 && adapter->phy_write(adapter, port->portnum, 227 && adapter->phy_write(adapter, port->portnum,
228 NETXEN_NIU_GB_MII_MGMT_ADDR_AUTONEG, 228 NETXEN_NIU_GB_MII_MGMT_ADDR_AUTONEG,
229 (__le32) ecmd->autoneg) != 0) 229 ecmd->autoneg) != 0)
230 return -EIO; 230 return -EIO;
231 else 231 else
232 port->link_autoneg = ecmd->autoneg; 232 port->link_autoneg = ecmd->autoneg;
@@ -279,7 +279,7 @@ static int netxen_nic_get_regs_len(struct net_device *dev)
279} 279}
280 280
281struct netxen_niu_regs { 281struct netxen_niu_regs {
282 __le32 reg[NETXEN_NIC_REGS_COUNT]; 282 __u32 reg[NETXEN_NIC_REGS_COUNT];
283}; 283};
284 284
285static struct netxen_niu_regs niu_registers[] = { 285static struct netxen_niu_regs niu_registers[] = {
@@ -372,7 +372,7 @@ netxen_nic_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *p)
372{ 372{
373 struct netxen_port *port = netdev_priv(dev); 373 struct netxen_port *port = netdev_priv(dev);
374 struct netxen_adapter *adapter = port->adapter; 374 struct netxen_adapter *adapter = port->adapter;
375 __le32 mode, *regs_buff = p; 375 __u32 mode, *regs_buff = p;
376 void __iomem *addr; 376 void __iomem *addr;
377 int i, window; 377 int i, window;
378 378
@@ -415,7 +415,7 @@ static u32 netxen_nic_get_link(struct net_device *dev)
415{ 415{
416 struct netxen_port *port = netdev_priv(dev); 416 struct netxen_port *port = netdev_priv(dev);
417 struct netxen_adapter *adapter = port->adapter; 417 struct netxen_adapter *adapter = port->adapter;
418 __le32 status; 418 __u32 status;
419 419
420 /* read which mode */ 420 /* read which mode */
421 if (adapter->ahw.board_type == NETXEN_NIC_GBE) { 421 if (adapter->ahw.board_type == NETXEN_NIC_GBE) {
@@ -482,13 +482,13 @@ netxen_nic_get_pauseparam(struct net_device *dev,
482{ 482{
483 struct netxen_port *port = netdev_priv(dev); 483 struct netxen_port *port = netdev_priv(dev);
484 struct netxen_adapter *adapter = port->adapter; 484 struct netxen_adapter *adapter = port->adapter;
485 __le32 val; 485 __u32 val;
486 486
487 if (adapter->ahw.board_type == NETXEN_NIC_GBE) { 487 if (adapter->ahw.board_type == NETXEN_NIC_GBE) {
488 /* get flow control settings */ 488 /* get flow control settings */
489 netxen_nic_read_w0(adapter, 489 netxen_nic_read_w0(adapter,
490 NETXEN_NIU_GB_MAC_CONFIG_0(port->portnum), 490 NETXEN_NIU_GB_MAC_CONFIG_0(port->portnum),
491 (u32 *) & val); 491 &val);
492 pause->rx_pause = netxen_gb_get_rx_flowctl(val); 492 pause->rx_pause = netxen_gb_get_rx_flowctl(val);
493 pause->tx_pause = netxen_gb_get_tx_flowctl(val); 493 pause->tx_pause = netxen_gb_get_tx_flowctl(val);
494 /* get autoneg settings */ 494 /* get autoneg settings */
@@ -502,7 +502,7 @@ netxen_nic_set_pauseparam(struct net_device *dev,
502{ 502{
503 struct netxen_port *port = netdev_priv(dev); 503 struct netxen_port *port = netdev_priv(dev);
504 struct netxen_adapter *adapter = port->adapter; 504 struct netxen_adapter *adapter = port->adapter;
505 __le32 val; 505 __u32 val;
506 unsigned int autoneg; 506 unsigned int autoneg;
507 507
508 /* read mode */ 508 /* read mode */
@@ -522,13 +522,13 @@ netxen_nic_set_pauseparam(struct net_device *dev,
522 522
523 netxen_nic_write_w0(adapter, 523 netxen_nic_write_w0(adapter,
524 NETXEN_NIU_GB_MAC_CONFIG_0(port->portnum), 524 NETXEN_NIU_GB_MAC_CONFIG_0(port->portnum),
525 *(u32 *) (&val)); 525 *&val);
526 /* set autoneg */ 526 /* set autoneg */
527 autoneg = pause->autoneg; 527 autoneg = pause->autoneg;
528 if (adapter->phy_write 528 if (adapter->phy_write
529 && adapter->phy_write(adapter, port->portnum, 529 && adapter->phy_write(adapter, port->portnum,
530 NETXEN_NIU_GB_MII_MGMT_ADDR_AUTONEG, 530 NETXEN_NIU_GB_MII_MGMT_ADDR_AUTONEG,
531 (__le32) autoneg) != 0) 531 autoneg) != 0)
532 return -EIO; 532 return -EIO;
533 else { 533 else {
534 port->link_autoneg = pause->autoneg; 534 port->link_autoneg = pause->autoneg;
@@ -543,7 +543,7 @@ static int netxen_nic_reg_test(struct net_device *dev)
543 struct netxen_port *port = netdev_priv(dev); 543 struct netxen_port *port = netdev_priv(dev);
544 struct netxen_adapter *adapter = port->adapter; 544 struct netxen_adapter *adapter = port->adapter;
545 u32 data_read, data_written, save; 545 u32 data_read, data_written, save;
546 __le32 mode; 546 __u32 mode;
547 547
548 /* 548 /*
549 * first test the "Read Only" registers by writing which mode 549 * first test the "Read Only" registers by writing which mode
diff --git a/drivers/net/netxen/netxen_nic_hw.c b/drivers/net/netxen/netxen_nic_hw.c
index c0c31d1914a7..f263232f499f 100644
--- a/drivers/net/netxen/netxen_nic_hw.c
+++ b/drivers/net/netxen/netxen_nic_hw.c
@@ -95,7 +95,7 @@ void netxen_nic_set_multi(struct net_device *netdev)
95 struct netxen_port *port = netdev_priv(netdev); 95 struct netxen_port *port = netdev_priv(netdev);
96 struct netxen_adapter *adapter = port->adapter; 96 struct netxen_adapter *adapter = port->adapter;
97 struct dev_mc_list *mc_ptr; 97 struct dev_mc_list *mc_ptr;
98 __le32 netxen_mac_addr_cntl_data = 0; 98 __u32 netxen_mac_addr_cntl_data = 0;
99 99
100 mc_ptr = netdev->mc_list; 100 mc_ptr = netdev->mc_list;
101 if (netdev->flags & IFF_PROMISC) { 101 if (netdev->flags & IFF_PROMISC) {
@@ -236,8 +236,9 @@ int netxen_nic_hw_resources(struct netxen_adapter *adapter)
236 } 236 }
237 memset(addr, 0, sizeof(struct netxen_ring_ctx)); 237 memset(addr, 0, sizeof(struct netxen_ring_ctx));
238 adapter->ctx_desc = (struct netxen_ring_ctx *)addr; 238 adapter->ctx_desc = (struct netxen_ring_ctx *)addr;
239 adapter->ctx_desc->cmd_consumer_offset = adapter->ctx_desc_phys_addr 239 adapter->ctx_desc->cmd_consumer_offset =
240 + sizeof(struct netxen_ring_ctx); 240 cpu_to_le64(adapter->ctx_desc_phys_addr +
241 sizeof(struct netxen_ring_ctx));
241 adapter->cmd_consumer = (uint32_t *) (((char *)addr) + 242 adapter->cmd_consumer = (uint32_t *) (((char *)addr) +
242 sizeof(struct netxen_ring_ctx)); 243 sizeof(struct netxen_ring_ctx));
243 244
@@ -253,11 +254,10 @@ int netxen_nic_hw_resources(struct netxen_adapter *adapter)
253 return -ENOMEM; 254 return -ENOMEM;
254 } 255 }
255 256
256 adapter->ctx_desc->cmd_ring_addr_lo = 257 adapter->ctx_desc->cmd_ring_addr =
257 hw->cmd_desc_phys_addr & 0xffffffffUL; 258 cpu_to_le64(hw->cmd_desc_phys_addr);
258 adapter->ctx_desc->cmd_ring_addr_hi = 259 adapter->ctx_desc->cmd_ring_size =
259 ((u64) hw->cmd_desc_phys_addr >> 32); 260 cpu_to_le32(adapter->max_tx_desc_count);
260 adapter->ctx_desc->cmd_ring_size = adapter->max_tx_desc_count;
261 261
262 hw->cmd_desc_head = (struct cmd_desc_type0 *)addr; 262 hw->cmd_desc_head = (struct cmd_desc_type0 *)addr;
263 263
@@ -278,12 +278,10 @@ int netxen_nic_hw_resources(struct netxen_adapter *adapter)
278 return err; 278 return err;
279 } 279 }
280 rcv_desc->desc_head = (struct rcv_desc *)addr; 280 rcv_desc->desc_head = (struct rcv_desc *)addr;
281 adapter->ctx_desc->rcv_ctx[ring].rcv_ring_addr_lo = 281 adapter->ctx_desc->rcv_ctx[ring].rcv_ring_addr =
282 rcv_desc->phys_addr & 0xffffffffUL; 282 cpu_to_le64(rcv_desc->phys_addr);
283 adapter->ctx_desc->rcv_ctx[ring].rcv_ring_addr_hi =
284 ((u64) rcv_desc->phys_addr >> 32);
285 adapter->ctx_desc->rcv_ctx[ring].rcv_ring_size = 283 adapter->ctx_desc->rcv_ctx[ring].rcv_ring_size =
286 rcv_desc->max_rx_desc_count; 284 cpu_to_le32(rcv_desc->max_rx_desc_count);
287 } 285 }
288 286
289 addr = netxen_alloc(adapter->ahw.pdev, STATUS_DESC_RINGSIZE, 287 addr = netxen_alloc(adapter->ahw.pdev, STATUS_DESC_RINGSIZE,
@@ -297,11 +295,10 @@ int netxen_nic_hw_resources(struct netxen_adapter *adapter)
297 return err; 295 return err;
298 } 296 }
299 recv_ctx->rcv_status_desc_head = (struct status_desc *)addr; 297 recv_ctx->rcv_status_desc_head = (struct status_desc *)addr;
300 adapter->ctx_desc->sts_ring_addr_lo = 298 adapter->ctx_desc->sts_ring_addr =
301 recv_ctx->rcv_status_desc_phys_addr & 0xffffffffUL; 299 cpu_to_le64(recv_ctx->rcv_status_desc_phys_addr);
302 adapter->ctx_desc->sts_ring_addr_hi = 300 adapter->ctx_desc->sts_ring_size =
303 ((u64) recv_ctx->rcv_status_desc_phys_addr >> 32); 301 cpu_to_le32(adapter->max_rx_desc_count);
304 adapter->ctx_desc->sts_ring_size = adapter->max_rx_desc_count;
305 302
306 } 303 }
307 /* Window = 1 */ 304 /* Window = 1 */
@@ -387,10 +384,6 @@ void netxen_tso_check(struct netxen_adapter *adapter,
387 } 384 }
388 adapter->stats.xmitcsummed++; 385 adapter->stats.xmitcsummed++;
389 desc->tcp_hdr_offset = skb->h.raw - skb->data; 386 desc->tcp_hdr_offset = skb->h.raw - skb->data;
390 netxen_set_cmd_desc_totallength(desc,
391 cpu_to_le32
392 (netxen_get_cmd_desc_totallength
393 (desc)));
394 desc->ip_hdr_offset = skb->nh.raw - skb->data; 387 desc->ip_hdr_offset = skb->nh.raw - skb->data;
395} 388}
396 389
@@ -867,9 +860,9 @@ netxen_crb_writelit_adapter(struct netxen_adapter *adapter, unsigned long off,
867void netxen_nic_set_link_parameters(struct netxen_port *port) 860void netxen_nic_set_link_parameters(struct netxen_port *port)
868{ 861{
869 struct netxen_adapter *adapter = port->adapter; 862 struct netxen_adapter *adapter = port->adapter;
870 __le32 status; 863 __u32 status;
871 __le32 autoneg; 864 __u32 autoneg;
872 __le32 mode; 865 __u32 mode;
873 866
874 netxen_nic_read_w0(adapter, NETXEN_NIU_MODE, &mode); 867 netxen_nic_read_w0(adapter, NETXEN_NIU_MODE, &mode);
875 if (netxen_get_niu_enable_ge(mode)) { /* Gb 10/100/1000 Mbps mode */ 868 if (netxen_get_niu_enable_ge(mode)) { /* Gb 10/100/1000 Mbps mode */
@@ -984,7 +977,8 @@ void netxen_nic_flash_print(struct netxen_adapter *adapter)
984 _NETXEN_NIC_LINUX_MAJOR, fw_major); 977 _NETXEN_NIC_LINUX_MAJOR, fw_major);
985 adapter->driver_mismatch = 1; 978 adapter->driver_mismatch = 1;
986 } 979 }
987 if (fw_minor != _NETXEN_NIC_LINUX_MINOR) { 980 if (fw_minor != _NETXEN_NIC_LINUX_MINOR &&
981 fw_minor != (_NETXEN_NIC_LINUX_MINOR + 1)) {
988 printk(KERN_ERR "The mismatch in driver version and firmware " 982 printk(KERN_ERR "The mismatch in driver version and firmware "
989 "version minor number\n" 983 "version minor number\n"
990 "Driver version minor number = %d \t" 984 "Driver version minor number = %d \t"
diff --git a/drivers/net/netxen/netxen_nic_hw.h b/drivers/net/netxen/netxen_nic_hw.h
index 0685633a9c1e..ab1112eb1b0d 100644
--- a/drivers/net/netxen/netxen_nic_hw.h
+++ b/drivers/net/netxen/netxen_nic_hw.h
@@ -124,28 +124,28 @@ typedef enum {
124 */ 124 */
125 125
126#define netxen_gb_enable_tx(config_word) \ 126#define netxen_gb_enable_tx(config_word) \
127 set_bit(0, (unsigned long*)(&config_word)) 127 ((config_word) |= 1 << 0)
128#define netxen_gb_enable_rx(config_word) \ 128#define netxen_gb_enable_rx(config_word) \
129 set_bit(2, (unsigned long*)(&config_word)) 129 ((config_word) |= 1 << 2)
130#define netxen_gb_tx_flowctl(config_word) \ 130#define netxen_gb_tx_flowctl(config_word) \
131 set_bit(4, (unsigned long*)(&config_word)) 131 ((config_word) |= 1 << 4)
132#define netxen_gb_rx_flowctl(config_word) \ 132#define netxen_gb_rx_flowctl(config_word) \
133 set_bit(5, (unsigned long*)(&config_word)) 133 ((config_word) |= 1 << 5)
134#define netxen_gb_tx_reset_pb(config_word) \ 134#define netxen_gb_tx_reset_pb(config_word) \
135 set_bit(16, (unsigned long*)(&config_word)) 135 ((config_word) |= 1 << 16)
136#define netxen_gb_rx_reset_pb(config_word) \ 136#define netxen_gb_rx_reset_pb(config_word) \
137 set_bit(17, (unsigned long*)(&config_word)) 137 ((config_word) |= 1 << 17)
138#define netxen_gb_tx_reset_mac(config_word) \ 138#define netxen_gb_tx_reset_mac(config_word) \
139 set_bit(18, (unsigned long*)(&config_word)) 139 ((config_word) |= 1 << 18)
140#define netxen_gb_rx_reset_mac(config_word) \ 140#define netxen_gb_rx_reset_mac(config_word) \
141 set_bit(19, (unsigned long*)(&config_word)) 141 ((config_word) |= 1 << 19)
142#define netxen_gb_soft_reset(config_word) \ 142#define netxen_gb_soft_reset(config_word) \
143 set_bit(31, (unsigned long*)(&config_word)) 143 ((config_word) |= 1 << 31)
144 144
145#define netxen_gb_unset_tx_flowctl(config_word) \ 145#define netxen_gb_unset_tx_flowctl(config_word) \
146 clear_bit(4, (unsigned long *)(&config_word)) 146 ((config_word) &= ~(1 << 4))
147#define netxen_gb_unset_rx_flowctl(config_word) \ 147#define netxen_gb_unset_rx_flowctl(config_word) \
148 clear_bit(5, (unsigned long*)(&config_word)) 148 ((config_word) &= ~(1 << 5))
149 149
150#define netxen_gb_get_tx_synced(config_word) \ 150#define netxen_gb_get_tx_synced(config_word) \
151 _netxen_crb_get_bit((config_word), 1) 151 _netxen_crb_get_bit((config_word), 1)
@@ -171,15 +171,15 @@ typedef enum {
171 */ 171 */
172 172
173#define netxen_gb_set_duplex(config_word) \ 173#define netxen_gb_set_duplex(config_word) \
174 set_bit(0, (unsigned long*)&config_word) 174 ((config_word) |= 1 << 0)
175#define netxen_gb_set_crc_enable(config_word) \ 175#define netxen_gb_set_crc_enable(config_word) \
176 set_bit(1, (unsigned long*)&config_word) 176 ((config_word) |= 1 << 1)
177#define netxen_gb_set_padshort(config_word) \ 177#define netxen_gb_set_padshort(config_word) \
178 set_bit(2, (unsigned long*)&config_word) 178 ((config_word) |= 1 << 2)
179#define netxen_gb_set_checklength(config_word) \ 179#define netxen_gb_set_checklength(config_word) \
180 set_bit(4, (unsigned long*)&config_word) 180 ((config_word) |= 1 << 4)
181#define netxen_gb_set_hugeframes(config_word) \ 181#define netxen_gb_set_hugeframes(config_word) \
182 set_bit(5, (unsigned long*)&config_word) 182 ((config_word) |= 1 << 5)
183#define netxen_gb_set_preamblelen(config_word, val) \ 183#define netxen_gb_set_preamblelen(config_word, val) \
184 ((config_word) |= ((val) << 12) & 0xF000) 184 ((config_word) |= ((val) << 12) & 0xF000)
185#define netxen_gb_set_intfmode(config_word, val) \ 185#define netxen_gb_set_intfmode(config_word, val) \
@@ -190,9 +190,9 @@ typedef enum {
190#define netxen_gb_set_mii_mgmt_clockselect(config_word, val) \ 190#define netxen_gb_set_mii_mgmt_clockselect(config_word, val) \
191 ((config_word) |= ((val) & 0x07)) 191 ((config_word) |= ((val) & 0x07))
192#define netxen_gb_mii_mgmt_reset(config_word) \ 192#define netxen_gb_mii_mgmt_reset(config_word) \
193 set_bit(31, (unsigned long*)&config_word) 193 ((config_word) |= 1 << 31)
194#define netxen_gb_mii_mgmt_unset(config_word) \ 194#define netxen_gb_mii_mgmt_unset(config_word) \
195 clear_bit(31, (unsigned long*)&config_word) 195 ((config_word) &= ~(1 << 31))
196 196
197/* 197/*
198 * NIU GB MII Mgmt Command Register (applies to GB0, GB1, GB2, GB3) 198 * NIU GB MII Mgmt Command Register (applies to GB0, GB1, GB2, GB3)
@@ -201,7 +201,7 @@ typedef enum {
201 */ 201 */
202 202
203#define netxen_gb_mii_mgmt_set_read_cycle(config_word) \ 203#define netxen_gb_mii_mgmt_set_read_cycle(config_word) \
204 set_bit(0, (unsigned long*)&config_word) 204 ((config_word) |= 1 << 0)
205#define netxen_gb_mii_mgmt_reg_addr(config_word, val) \ 205#define netxen_gb_mii_mgmt_reg_addr(config_word, val) \
206 ((config_word) |= ((val) & 0x1F)) 206 ((config_word) |= ((val) & 0x1F))
207#define netxen_gb_mii_mgmt_phy_addr(config_word, val) \ 207#define netxen_gb_mii_mgmt_phy_addr(config_word, val) \
@@ -274,9 +274,9 @@ typedef enum {
274#define netxen_set_phy_speed(config_word, val) \ 274#define netxen_set_phy_speed(config_word, val) \
275 ((config_word) |= ((val & 0x03) << 14)) 275 ((config_word) |= ((val & 0x03) << 14))
276#define netxen_set_phy_duplex(config_word) \ 276#define netxen_set_phy_duplex(config_word) \
277 set_bit(13, (unsigned long*)&config_word) 277 ((config_word) |= 1 << 13)
278#define netxen_clear_phy_duplex(config_word) \ 278#define netxen_clear_phy_duplex(config_word) \
279 clear_bit(13, (unsigned long*)&config_word) 279 ((config_word) &= ~(1 << 13))
280 280
281#define netxen_get_phy_jabber(config_word) \ 281#define netxen_get_phy_jabber(config_word) \
282 _netxen_crb_get_bit(config_word, 0) 282 _netxen_crb_get_bit(config_word, 0)
@@ -350,11 +350,11 @@ typedef enum {
350 _netxen_crb_get_bit(config_word, 15) 350 _netxen_crb_get_bit(config_word, 15)
351 351
352#define netxen_set_phy_int_link_status_changed(config_word) \ 352#define netxen_set_phy_int_link_status_changed(config_word) \
353 set_bit(10, (unsigned long*)&config_word) 353 ((config_word) |= 1 << 10)
354#define netxen_set_phy_int_autoneg_completed(config_word) \ 354#define netxen_set_phy_int_autoneg_completed(config_word) \
355 set_bit(11, (unsigned long*)&config_word) 355 ((config_word) |= 1 << 11)
356#define netxen_set_phy_int_speed_changed(config_word) \ 356#define netxen_set_phy_int_speed_changed(config_word) \
357 set_bit(14, (unsigned long*)&config_word) 357 ((config_word) |= 1 << 14)
358 358
359/* 359/*
360 * NIU Mode Register. 360 * NIU Mode Register.
@@ -382,22 +382,22 @@ typedef enum {
382 */ 382 */
383 383
384#define netxen_set_gb_drop_gb0(config_word) \ 384#define netxen_set_gb_drop_gb0(config_word) \
385 set_bit(0, (unsigned long*)&config_word) 385 ((config_word) |= 1 << 0)
386#define netxen_set_gb_drop_gb1(config_word) \ 386#define netxen_set_gb_drop_gb1(config_word) \
387 set_bit(1, (unsigned long*)&config_word) 387 ((config_word) |= 1 << 1)
388#define netxen_set_gb_drop_gb2(config_word) \ 388#define netxen_set_gb_drop_gb2(config_word) \
389 set_bit(2, (unsigned long*)&config_word) 389 ((config_word) |= 1 << 2)
390#define netxen_set_gb_drop_gb3(config_word) \ 390#define netxen_set_gb_drop_gb3(config_word) \
391 set_bit(3, (unsigned long*)&config_word) 391 ((config_word) |= 1 << 3)
392 392
393#define netxen_clear_gb_drop_gb0(config_word) \ 393#define netxen_clear_gb_drop_gb0(config_word) \
394 clear_bit(0, (unsigned long*)&config_word) 394 ((config_word) &= ~(1 << 0))
395#define netxen_clear_gb_drop_gb1(config_word) \ 395#define netxen_clear_gb_drop_gb1(config_word) \
396 clear_bit(1, (unsigned long*)&config_word) 396 ((config_word) &= ~(1 << 1))
397#define netxen_clear_gb_drop_gb2(config_word) \ 397#define netxen_clear_gb_drop_gb2(config_word) \
398 clear_bit(2, (unsigned long*)&config_word) 398 ((config_word) &= ~(1 << 2))
399#define netxen_clear_gb_drop_gb3(config_word) \ 399#define netxen_clear_gb_drop_gb3(config_word) \
400 clear_bit(3, (unsigned long*)&config_word) 400 ((config_word) &= ~(1 << 3))
401 401
402/* 402/*
403 * NIU XG MAC Config Register 403 * NIU XG MAC Config Register
@@ -413,7 +413,7 @@ typedef enum {
413 */ 413 */
414 414
415#define netxen_xg_soft_reset(config_word) \ 415#define netxen_xg_soft_reset(config_word) \
416 set_bit(4, (unsigned long*)&config_word) 416 ((config_word) |= 1 << 4)
417 417
418/* 418/*
419 * MAC Control Register 419 * MAC Control Register
@@ -433,19 +433,19 @@ typedef enum {
433#define netxen_nic_mcr_set_id_pool0(config, val) \ 433#define netxen_nic_mcr_set_id_pool0(config, val) \
434 ((config) |= ((val) &0x03)) 434 ((config) |= ((val) &0x03))
435#define netxen_nic_mcr_set_enable_xtnd0(config) \ 435#define netxen_nic_mcr_set_enable_xtnd0(config) \
436 (set_bit(3, (unsigned long *)&(config))) 436 ((config) |= 1 << 3)
437#define netxen_nic_mcr_set_id_pool1(config, val) \ 437#define netxen_nic_mcr_set_id_pool1(config, val) \
438 ((config) |= (((val) & 0x03) << 4)) 438 ((config) |= (((val) & 0x03) << 4))
439#define netxen_nic_mcr_set_enable_xtnd1(config) \ 439#define netxen_nic_mcr_set_enable_xtnd1(config) \
440 (set_bit(6, (unsigned long *)&(config))) 440 ((config) |= 1 << 6)
441#define netxen_nic_mcr_set_id_pool2(config, val) \ 441#define netxen_nic_mcr_set_id_pool2(config, val) \
442 ((config) |= (((val) & 0x03) << 8)) 442 ((config) |= (((val) & 0x03) << 8))
443#define netxen_nic_mcr_set_enable_xtnd2(config) \ 443#define netxen_nic_mcr_set_enable_xtnd2(config) \
444 (set_bit(10, (unsigned long *)&(config))) 444 ((config) |= 1 << 10)
445#define netxen_nic_mcr_set_id_pool3(config, val) \ 445#define netxen_nic_mcr_set_id_pool3(config, val) \
446 ((config) |= (((val) & 0x03) << 12)) 446 ((config) |= (((val) & 0x03) << 12))
447#define netxen_nic_mcr_set_enable_xtnd3(config) \ 447#define netxen_nic_mcr_set_enable_xtnd3(config) \
448 (set_bit(14, (unsigned long *)&(config))) 448 ((config) |= 1 << 14)
449#define netxen_nic_mcr_set_mode_select(config, val) \ 449#define netxen_nic_mcr_set_mode_select(config, val) \
450 ((config) |= (((val) & 0x03) << 24)) 450 ((config) |= (((val) & 0x03) << 24))
451#define netxen_nic_mcr_set_enable_pool(config, val) \ 451#define netxen_nic_mcr_set_enable_pool(config, val) \
diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c
index c3e41f368554..973af96337a9 100644
--- a/drivers/net/netxen/netxen_nic_init.c
+++ b/drivers/net/netxen/netxen_nic_init.c
@@ -690,8 +690,7 @@ int netxen_nic_rx_has_work(struct netxen_adapter *adapter)
690 desc_head = recv_ctx->rcv_status_desc_head; 690 desc_head = recv_ctx->rcv_status_desc_head;
691 desc = &desc_head[consumer]; 691 desc = &desc_head[consumer];
692 692
693 if (((le16_to_cpu(netxen_get_sts_owner(desc))) 693 if (netxen_get_sts_owner(desc) & STATUS_OWNER_HOST)
694 & STATUS_OWNER_HOST))
695 return 1; 694 return 1;
696 } 695 }
697 696
@@ -787,11 +786,11 @@ netxen_process_rcv(struct netxen_adapter *adapter, int ctxid,
787 struct netxen_port *port = adapter->port[netxen_get_sts_port(desc)]; 786 struct netxen_port *port = adapter->port[netxen_get_sts_port(desc)];
788 struct pci_dev *pdev = port->pdev; 787 struct pci_dev *pdev = port->pdev;
789 struct net_device *netdev = port->netdev; 788 struct net_device *netdev = port->netdev;
790 int index = le16_to_cpu(netxen_get_sts_refhandle(desc)); 789 int index = netxen_get_sts_refhandle(desc);
791 struct netxen_recv_context *recv_ctx = &(adapter->recv_ctx[ctxid]); 790 struct netxen_recv_context *recv_ctx = &(adapter->recv_ctx[ctxid]);
792 struct netxen_rx_buffer *buffer; 791 struct netxen_rx_buffer *buffer;
793 struct sk_buff *skb; 792 struct sk_buff *skb;
794 u32 length = le16_to_cpu(netxen_get_sts_totallength(desc)); 793 u32 length = netxen_get_sts_totallength(desc);
795 u32 desc_ctx; 794 u32 desc_ctx;
796 struct netxen_rcv_desc_ctx *rcv_desc; 795 struct netxen_rcv_desc_ctx *rcv_desc;
797 int ret; 796 int ret;
@@ -918,16 +917,14 @@ u32 netxen_process_rcv_ring(struct netxen_adapter *adapter, int ctxid, int max)
918 */ 917 */
919 while (count < max) { 918 while (count < max) {
920 desc = &desc_head[consumer]; 919 desc = &desc_head[consumer];
921 if (! 920 if (!(netxen_get_sts_owner(desc) & STATUS_OWNER_HOST)) {
922 (le16_to_cpu(netxen_get_sts_owner(desc)) &
923 STATUS_OWNER_HOST)) {
924 DPRINTK(ERR, "desc %p ownedby %x\n", desc, 921 DPRINTK(ERR, "desc %p ownedby %x\n", desc,
925 netxen_get_sts_owner(desc)); 922 netxen_get_sts_owner(desc));
926 break; 923 break;
927 } 924 }
928 netxen_process_rcv(adapter, ctxid, desc); 925 netxen_process_rcv(adapter, ctxid, desc);
929 netxen_clear_sts_owner(desc); 926 netxen_clear_sts_owner(desc);
930 netxen_set_sts_owner(desc, cpu_to_le16(STATUS_OWNER_PHANTOM)); 927 netxen_set_sts_owner(desc, STATUS_OWNER_PHANTOM);
931 consumer = (consumer + 1) & (adapter->max_rx_desc_count - 1); 928 consumer = (consumer + 1) & (adapter->max_rx_desc_count - 1);
932 count++; 929 count++;
933 } 930 }
@@ -1232,7 +1229,7 @@ void netxen_post_rx_buffers_nodb(struct netxen_adapter *adapter, uint32_t ctx,
1232 1229
1233 /* make a rcv descriptor */ 1230 /* make a rcv descriptor */
1234 pdesc->reference_handle = cpu_to_le16(buffer->ref_handle); 1231 pdesc->reference_handle = cpu_to_le16(buffer->ref_handle);
1235 pdesc->buffer_length = cpu_to_le16(rcv_desc->dma_size); 1232 pdesc->buffer_length = cpu_to_le32(rcv_desc->dma_size);
1236 pdesc->addr_buffer = cpu_to_le64(buffer->dma); 1233 pdesc->addr_buffer = cpu_to_le64(buffer->dma);
1237 DPRINTK(INFO, "done writing descripter\n"); 1234 DPRINTK(INFO, "done writing descripter\n");
1238 producer = 1235 producer =
diff --git a/drivers/net/netxen/netxen_nic_isr.c b/drivers/net/netxen/netxen_nic_isr.c
index 06847d4252c3..be366e48007c 100644
--- a/drivers/net/netxen/netxen_nic_isr.c
+++ b/drivers/net/netxen/netxen_nic_isr.c
@@ -79,7 +79,7 @@ void netxen_indicate_link_status(struct netxen_adapter *adapter, u32 portno,
79void netxen_handle_port_int(struct netxen_adapter *adapter, u32 portno, 79void netxen_handle_port_int(struct netxen_adapter *adapter, u32 portno,
80 u32 enable) 80 u32 enable)
81{ 81{
82 __le32 int_src; 82 __u32 int_src;
83 struct netxen_port *port; 83 struct netxen_port *port;
84 84
85 /* This should clear the interrupt source */ 85 /* This should clear the interrupt source */
@@ -110,7 +110,7 @@ void netxen_handle_port_int(struct netxen_adapter *adapter, u32 portno,
110 /* write it down later.. */ 110 /* write it down later.. */
111 if ((netxen_get_phy_int_speed_changed(int_src)) 111 if ((netxen_get_phy_int_speed_changed(int_src))
112 || (netxen_get_phy_int_link_status_changed(int_src))) { 112 || (netxen_get_phy_int_link_status_changed(int_src))) {
113 __le32 status; 113 __u32 status;
114 114
115 DPRINTK(INFO, "SPEED CHANGED OR LINK STATUS CHANGED \n"); 115 DPRINTK(INFO, "SPEED CHANGED OR LINK STATUS CHANGED \n");
116 116
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c
index 8a5792fea774..69c1b9d23a1a 100644
--- a/drivers/net/netxen/netxen_nic_main.c
+++ b/drivers/net/netxen/netxen_nic_main.c
@@ -117,7 +117,7 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
117 void __iomem *mem_ptr1 = NULL; 117 void __iomem *mem_ptr1 = NULL;
118 void __iomem *mem_ptr2 = NULL; 118 void __iomem *mem_ptr2 = NULL;
119 119
120 u8 *db_ptr = NULL; 120 u8 __iomem *db_ptr = NULL;
121 unsigned long mem_base, mem_len, db_base, db_len; 121 unsigned long mem_base, mem_len, db_base, db_len;
122 int pci_using_dac, i, err; 122 int pci_using_dac, i, err;
123 int ring; 123 int ring;
@@ -191,7 +191,7 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
191 db_len); 191 db_len);
192 192
193 db_ptr = ioremap(db_base, NETXEN_DB_MAPSIZE_BYTES); 193 db_ptr = ioremap(db_base, NETXEN_DB_MAPSIZE_BYTES);
194 if (db_ptr == 0UL) { 194 if (!db_ptr) {
195 printk(KERN_ERR "%s: Failed to allocate doorbell map.", 195 printk(KERN_ERR "%s: Failed to allocate doorbell map.",
196 netxen_nic_driver_name); 196 netxen_nic_driver_name);
197 err = -EIO; 197 err = -EIO;
@@ -818,7 +818,7 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
818 /* Take skb->data itself */ 818 /* Take skb->data itself */
819 pbuf = &adapter->cmd_buf_arr[producer]; 819 pbuf = &adapter->cmd_buf_arr[producer];
820 if ((netdev->features & NETIF_F_TSO) && skb_shinfo(skb)->gso_size > 0) { 820 if ((netdev->features & NETIF_F_TSO) && skb_shinfo(skb)->gso_size > 0) {
821 pbuf->mss = cpu_to_le16(skb_shinfo(skb)->gso_size); 821 pbuf->mss = skb_shinfo(skb)->gso_size;
822 hwdesc->mss = cpu_to_le16(skb_shinfo(skb)->gso_size); 822 hwdesc->mss = cpu_to_le16(skb_shinfo(skb)->gso_size);
823 } else { 823 } else {
824 pbuf->mss = 0; 824 pbuf->mss = 0;
@@ -882,7 +882,7 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
882 hwdesc->addr_buffer3 = cpu_to_le64(temp_dma); 882 hwdesc->addr_buffer3 = cpu_to_le64(temp_dma);
883 break; 883 break;
884 case 3: 884 case 3:
885 hwdesc->buffer4_length = temp_len; 885 hwdesc->buffer4_length = cpu_to_le16(temp_len);
886 hwdesc->addr_buffer4 = cpu_to_le64(temp_dma); 886 hwdesc->addr_buffer4 = cpu_to_le64(temp_dma);
887 break; 887 break;
888 } 888 }
@@ -1144,7 +1144,7 @@ static int __init netxen_init_module(void)
1144 if ((netxen_workq = create_singlethread_workqueue("netxen")) == 0) 1144 if ((netxen_workq = create_singlethread_workqueue("netxen")) == 0)
1145 return -ENOMEM; 1145 return -ENOMEM;
1146 1146
1147 return pci_module_init(&netxen_driver); 1147 return pci_register_driver(&netxen_driver);
1148} 1148}
1149 1149
1150module_init(netxen_init_module); 1150module_init(netxen_init_module);
diff --git a/drivers/net/netxen/netxen_nic_niu.c b/drivers/net/netxen/netxen_nic_niu.c
index 4987dc765d99..40d7003a371c 100644
--- a/drivers/net/netxen/netxen_nic_niu.c
+++ b/drivers/net/netxen/netxen_nic_niu.c
@@ -89,15 +89,15 @@ static inline int phy_unlock(struct netxen_adapter *adapter)
89 * 89 *
90 */ 90 */
91int netxen_niu_gbe_phy_read(struct netxen_adapter *adapter, long phy, 91int netxen_niu_gbe_phy_read(struct netxen_adapter *adapter, long phy,
92 long reg, __le32 * readval) 92 long reg, __u32 * readval)
93{ 93{
94 long timeout = 0; 94 long timeout = 0;
95 long result = 0; 95 long result = 0;
96 long restore = 0; 96 long restore = 0;
97 __le32 address; 97 __u32 address;
98 __le32 command; 98 __u32 command;
99 __le32 status; 99 __u32 status;
100 __le32 mac_cfg0; 100 __u32 mac_cfg0;
101 101
102 if (phy_lock(adapter) != 0) { 102 if (phy_lock(adapter) != 0) {
103 return -1; 103 return -1;
@@ -112,7 +112,7 @@ int netxen_niu_gbe_phy_read(struct netxen_adapter *adapter, long phy,
112 &mac_cfg0, 4)) 112 &mac_cfg0, 4))
113 return -EIO; 113 return -EIO;
114 if (netxen_gb_get_soft_reset(mac_cfg0)) { 114 if (netxen_gb_get_soft_reset(mac_cfg0)) {
115 __le32 temp; 115 __u32 temp;
116 temp = 0; 116 temp = 0;
117 netxen_gb_tx_reset_pb(temp); 117 netxen_gb_tx_reset_pb(temp);
118 netxen_gb_rx_reset_pb(temp); 118 netxen_gb_rx_reset_pb(temp);
@@ -184,15 +184,15 @@ int netxen_niu_gbe_phy_read(struct netxen_adapter *adapter, long phy,
184 * 184 *
185 */ 185 */
186int netxen_niu_gbe_phy_write(struct netxen_adapter *adapter, 186int netxen_niu_gbe_phy_write(struct netxen_adapter *adapter,
187 long phy, long reg, __le32 val) 187 long phy, long reg, __u32 val)
188{ 188{
189 long timeout = 0; 189 long timeout = 0;
190 long result = 0; 190 long result = 0;
191 long restore = 0; 191 long restore = 0;
192 __le32 address; 192 __u32 address;
193 __le32 command; 193 __u32 command;
194 __le32 status; 194 __u32 status;
195 __le32 mac_cfg0; 195 __u32 mac_cfg0;
196 196
197 /* 197 /*
198 * MII mgmt all goes through port 0 MAC interface, so it 198 * MII mgmt all goes through port 0 MAC interface, so it
@@ -203,7 +203,7 @@ int netxen_niu_gbe_phy_write(struct netxen_adapter *adapter,
203 &mac_cfg0, 4)) 203 &mac_cfg0, 4))
204 return -EIO; 204 return -EIO;
205 if (netxen_gb_get_soft_reset(mac_cfg0)) { 205 if (netxen_gb_get_soft_reset(mac_cfg0)) {
206 __le32 temp; 206 __u32 temp;
207 temp = 0; 207 temp = 0;
208 netxen_gb_tx_reset_pb(temp); 208 netxen_gb_tx_reset_pb(temp);
209 netxen_gb_rx_reset_pb(temp); 209 netxen_gb_rx_reset_pb(temp);
@@ -269,7 +269,7 @@ int netxen_niu_gbe_enable_phy_interrupts(struct netxen_adapter *adapter,
269 int port) 269 int port)
270{ 270{
271 int result = 0; 271 int result = 0;
272 __le32 enable = 0; 272 __u32 enable = 0;
273 netxen_set_phy_int_link_status_changed(enable); 273 netxen_set_phy_int_link_status_changed(enable);
274 netxen_set_phy_int_autoneg_completed(enable); 274 netxen_set_phy_int_autoneg_completed(enable);
275 netxen_set_phy_int_speed_changed(enable); 275 netxen_set_phy_int_speed_changed(enable);
@@ -402,7 +402,7 @@ void netxen_niu_gbe_set_gmii_mode(struct netxen_adapter *adapter,
402int netxen_niu_gbe_init_port(struct netxen_adapter *adapter, int port) 402int netxen_niu_gbe_init_port(struct netxen_adapter *adapter, int port)
403{ 403{
404 int result = 0; 404 int result = 0;
405 __le32 status; 405 __u32 status;
406 if (adapter->disable_phy_interrupts) 406 if (adapter->disable_phy_interrupts)
407 adapter->disable_phy_interrupts(adapter, port); 407 adapter->disable_phy_interrupts(adapter, port);
408 mdelay(2); 408 mdelay(2);
@@ -410,7 +410,7 @@ int netxen_niu_gbe_init_port(struct netxen_adapter *adapter, int port)
410 if (0 == 410 if (0 ==
411 netxen_niu_gbe_phy_read(adapter, port, 411 netxen_niu_gbe_phy_read(adapter, port,
412 NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS, 412 NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS,
413 (__le32 *) & status)) { 413 &status)) {
414 if (netxen_get_phy_link(status)) { 414 if (netxen_get_phy_link(status)) {
415 if (netxen_get_phy_speed(status) == 2) { 415 if (netxen_get_phy_speed(status) == 2) {
416 netxen_niu_gbe_set_gmii_mode(adapter, port, 1); 416 netxen_niu_gbe_set_gmii_mode(adapter, port, 1);
@@ -489,7 +489,7 @@ int netxen_niu_gbe_handle_phy_interrupt(struct netxen_adapter *adapter,
489 int port, long enable) 489 int port, long enable)
490{ 490{
491 int result = 0; 491 int result = 0;
492 __le32 int_src; 492 __u32 int_src;
493 493
494 printk(KERN_INFO PFX "NETXEN: Handling PHY interrupt on port %d" 494 printk(KERN_INFO PFX "NETXEN: Handling PHY interrupt on port %d"
495 " (device enable = %d)\n", (int)port, (int)enable); 495 " (device enable = %d)\n", (int)port, (int)enable);
@@ -530,7 +530,7 @@ int netxen_niu_gbe_handle_phy_interrupt(struct netxen_adapter *adapter,
530 printk(KERN_INFO PFX "autoneg_error "); 530 printk(KERN_INFO PFX "autoneg_error ");
531 if ((netxen_get_phy_int_speed_changed(int_src)) 531 if ((netxen_get_phy_int_speed_changed(int_src))
532 || (netxen_get_phy_int_link_status_changed(int_src))) { 532 || (netxen_get_phy_int_link_status_changed(int_src))) {
533 __le32 status; 533 __u32 status;
534 534
535 printk(KERN_INFO PFX 535 printk(KERN_INFO PFX
536 "speed_changed or link status changed"); 536 "speed_changed or link status changed");
@@ -583,9 +583,9 @@ int netxen_niu_gbe_handle_phy_interrupt(struct netxen_adapter *adapter,
583int netxen_niu_macaddr_get(struct netxen_adapter *adapter, 583int netxen_niu_macaddr_get(struct netxen_adapter *adapter,
584 int phy, netxen_ethernet_macaddr_t * addr) 584 int phy, netxen_ethernet_macaddr_t * addr)
585{ 585{
586 u64 result = 0; 586 u32 stationhigh;
587 __le32 stationhigh; 587 u32 stationlow;
588 __le32 stationlow; 588 u8 val[8];
589 589
590 if (addr == NULL) 590 if (addr == NULL)
591 return -EINVAL; 591 return -EINVAL;
@@ -598,10 +598,10 @@ int netxen_niu_macaddr_get(struct netxen_adapter *adapter,
598 if (netxen_nic_hw_read_wx(adapter, NETXEN_NIU_GB_STATION_ADDR_1(phy), 598 if (netxen_nic_hw_read_wx(adapter, NETXEN_NIU_GB_STATION_ADDR_1(phy),
599 &stationlow, 4)) 599 &stationlow, 4))
600 return -EIO; 600 return -EIO;
601 ((__le32 *)val)[1] = cpu_to_le32(stationhigh);
602 ((__le32 *)val)[0] = cpu_to_le32(stationlow);
601 603
602 result = (u64) netxen_gb_get_stationaddress_low(stationlow); 604 memcpy(addr, val + 2, 6);
603 result |= (u64) stationhigh << 16;
604 memcpy(*addr, &result, sizeof(netxen_ethernet_macaddr_t));
605 605
606 return 0; 606 return 0;
607} 607}
@@ -613,24 +613,25 @@ int netxen_niu_macaddr_get(struct netxen_adapter *adapter,
613int netxen_niu_macaddr_set(struct netxen_port *port, 613int netxen_niu_macaddr_set(struct netxen_port *port,
614 netxen_ethernet_macaddr_t addr) 614 netxen_ethernet_macaddr_t addr)
615{ 615{
616 __le32 temp = 0; 616 u8 temp[4];
617 u32 val;
617 struct netxen_adapter *adapter = port->adapter; 618 struct netxen_adapter *adapter = port->adapter;
618 int phy = port->portnum; 619 int phy = port->portnum;
619 unsigned char mac_addr[6]; 620 unsigned char mac_addr[6];
620 int i; 621 int i;
621 622
622 for (i = 0; i < 10; i++) { 623 for (i = 0; i < 10; i++) {
623 memcpy(&temp, addr, 2); 624 temp[0] = temp[1] = 0;
624 temp <<= 16; 625 memcpy(temp + 2, addr, 2);
626 val = le32_to_cpu(*(__le32 *)temp);
625 if (netxen_nic_hw_write_wx 627 if (netxen_nic_hw_write_wx
626 (adapter, NETXEN_NIU_GB_STATION_ADDR_1(phy), &temp, 4)) 628 (adapter, NETXEN_NIU_GB_STATION_ADDR_1(phy), &val, 4))
627 return -EIO; 629 return -EIO;
628 630
629 temp = 0; 631 memcpy(temp, ((u8 *) addr) + 2, sizeof(__le32));
630 632 val = le32_to_cpu(*(__le32 *)temp);
631 memcpy(&temp, ((u8 *) addr) + 2, sizeof(__le32));
632 if (netxen_nic_hw_write_wx 633 if (netxen_nic_hw_write_wx
633 (adapter, NETXEN_NIU_GB_STATION_ADDR_0(phy), &temp, 4)) 634 (adapter, NETXEN_NIU_GB_STATION_ADDR_0(phy), &val, 4))
634 return -2; 635 return -2;
635 636
636 netxen_niu_macaddr_get(adapter, phy, 637 netxen_niu_macaddr_get(adapter, phy,
@@ -659,9 +660,9 @@ int netxen_niu_macaddr_set(struct netxen_port *port,
659int netxen_niu_enable_gbe_port(struct netxen_adapter *adapter, 660int netxen_niu_enable_gbe_port(struct netxen_adapter *adapter,
660 int port, netxen_niu_gbe_ifmode_t mode) 661 int port, netxen_niu_gbe_ifmode_t mode)
661{ 662{
662 __le32 mac_cfg0; 663 __u32 mac_cfg0;
663 __le32 mac_cfg1; 664 __u32 mac_cfg1;
664 __le32 mii_cfg; 665 __u32 mii_cfg;
665 666
666 if ((port < 0) || (port > NETXEN_NIU_MAX_GBE_PORTS)) 667 if ((port < 0) || (port > NETXEN_NIU_MAX_GBE_PORTS))
667 return -EINVAL; 668 return -EINVAL;
@@ -736,7 +737,7 @@ int netxen_niu_enable_gbe_port(struct netxen_adapter *adapter,
736/* Disable a GbE interface */ 737/* Disable a GbE interface */
737int netxen_niu_disable_gbe_port(struct netxen_adapter *adapter, int port) 738int netxen_niu_disable_gbe_port(struct netxen_adapter *adapter, int port)
738{ 739{
739 __le32 mac_cfg0; 740 __u32 mac_cfg0;
740 741
741 if ((port < 0) || (port > NETXEN_NIU_MAX_GBE_PORTS)) 742 if ((port < 0) || (port > NETXEN_NIU_MAX_GBE_PORTS))
742 return -EINVAL; 743 return -EINVAL;
@@ -752,7 +753,7 @@ int netxen_niu_disable_gbe_port(struct netxen_adapter *adapter, int port)
752/* Disable an XG interface */ 753/* Disable an XG interface */
753int netxen_niu_disable_xg_port(struct netxen_adapter *adapter, int port) 754int netxen_niu_disable_xg_port(struct netxen_adapter *adapter, int port)
754{ 755{
755 __le32 mac_cfg; 756 __u32 mac_cfg;
756 757
757 if (port != 0) 758 if (port != 0)
758 return -EINVAL; 759 return -EINVAL;
@@ -769,7 +770,7 @@ int netxen_niu_disable_xg_port(struct netxen_adapter *adapter, int port)
769int netxen_niu_set_promiscuous_mode(struct netxen_adapter *adapter, int port, 770int netxen_niu_set_promiscuous_mode(struct netxen_adapter *adapter, int port,
770 netxen_niu_prom_mode_t mode) 771 netxen_niu_prom_mode_t mode)
771{ 772{
772 __le32 reg; 773 __u32 reg;
773 774
774 if ((port < 0) || (port > NETXEN_NIU_MAX_GBE_PORTS)) 775 if ((port < 0) || (port > NETXEN_NIU_MAX_GBE_PORTS))
775 return -EINVAL; 776 return -EINVAL;
@@ -826,22 +827,21 @@ int netxen_niu_set_promiscuous_mode(struct netxen_adapter *adapter, int port,
826int netxen_niu_xg_macaddr_set(struct netxen_port *port, 827int netxen_niu_xg_macaddr_set(struct netxen_port *port,
827 netxen_ethernet_macaddr_t addr) 828 netxen_ethernet_macaddr_t addr)
828{ 829{
829 __le32 temp = 0; 830 u8 temp[4];
831 u32 val;
830 struct netxen_adapter *adapter = port->adapter; 832 struct netxen_adapter *adapter = port->adapter;
831 833
832 memcpy(&temp, addr, 2); 834 temp[0] = temp[1] = 0;
833 temp = cpu_to_le32(temp); 835 memcpy(temp + 2, addr, 2);
834 temp <<= 16; 836 val = le32_to_cpu(*(__le32 *)temp);
835 if (netxen_nic_hw_write_wx(adapter, NETXEN_NIU_XGE_STATION_ADDR_0_1, 837 if (netxen_nic_hw_write_wx(adapter, NETXEN_NIU_XGE_STATION_ADDR_0_1,
836 &temp, 4)) 838 &val, 4))
837 return -EIO; 839 return -EIO;
838 840
839 temp = 0;
840
841 memcpy(&temp, ((u8 *) addr) + 2, sizeof(__le32)); 841 memcpy(&temp, ((u8 *) addr) + 2, sizeof(__le32));
842 temp = cpu_to_le32(temp); 842 val = le32_to_cpu(*(__le32 *)temp);
843 if (netxen_nic_hw_write_wx(adapter, NETXEN_NIU_XGE_STATION_ADDR_0_HI, 843 if (netxen_nic_hw_write_wx(adapter, NETXEN_NIU_XGE_STATION_ADDR_0_HI,
844 &temp, 4)) 844 &val, 4))
845 return -EIO; 845 return -EIO;
846 846
847 return 0; 847 return 0;
@@ -854,9 +854,9 @@ int netxen_niu_xg_macaddr_set(struct netxen_port *port,
854int netxen_niu_xg_macaddr_get(struct netxen_adapter *adapter, int phy, 854int netxen_niu_xg_macaddr_get(struct netxen_adapter *adapter, int phy,
855 netxen_ethernet_macaddr_t * addr) 855 netxen_ethernet_macaddr_t * addr)
856{ 856{
857 __le32 stationhigh; 857 u32 stationhigh;
858 __le32 stationlow; 858 u32 stationlow;
859 u64 result; 859 u8 val[8];
860 860
861 if (addr == NULL) 861 if (addr == NULL)
862 return -EINVAL; 862 return -EINVAL;
@@ -869,10 +869,10 @@ int netxen_niu_xg_macaddr_get(struct netxen_adapter *adapter, int phy,
869 if (netxen_nic_hw_read_wx(adapter, NETXEN_NIU_XGE_STATION_ADDR_0_1, 869 if (netxen_nic_hw_read_wx(adapter, NETXEN_NIU_XGE_STATION_ADDR_0_1,
870 &stationlow, 4)) 870 &stationlow, 4))
871 return -EIO; 871 return -EIO;
872 ((__le32 *)val)[1] = cpu_to_le32(stationhigh);
873 ((__le32 *)val)[0] = cpu_to_le32(stationlow);
872 874
873 result = ((u64) stationlow) >> 16; 875 memcpy(addr, val + 2, 6);
874 result |= (u64) stationhigh << 16;
875 memcpy(*addr, &result, sizeof(netxen_ethernet_macaddr_t));
876 876
877 return 0; 877 return 0;
878} 878}
@@ -880,7 +880,7 @@ int netxen_niu_xg_macaddr_get(struct netxen_adapter *adapter, int phy,
880int netxen_niu_xg_set_promiscuous_mode(struct netxen_adapter *adapter, 880int netxen_niu_xg_set_promiscuous_mode(struct netxen_adapter *adapter,
881 int port, netxen_niu_prom_mode_t mode) 881 int port, netxen_niu_prom_mode_t mode)
882{ 882{
883 __le32 reg; 883 __u32 reg;
884 884
885 if ((port < 0) || (port > NETXEN_NIU_MAX_GBE_PORTS)) 885 if ((port < 0) || (port > NETXEN_NIU_MAX_GBE_PORTS))
886 return -EINVAL; 886 return -EINVAL;
diff --git a/drivers/net/pcmcia/3c589_cs.c b/drivers/net/pcmcia/3c589_cs.c
index 342f4062de0b..461e8274ef69 100644
--- a/drivers/net/pcmcia/3c589_cs.c
+++ b/drivers/net/pcmcia/3c589_cs.c
@@ -606,11 +606,14 @@ static int el3_start_xmit(struct sk_buff *skb, struct net_device *dev)
606{ 606{
607 kio_addr_t ioaddr = dev->base_addr; 607 kio_addr_t ioaddr = dev->base_addr;
608 struct el3_private *priv = netdev_priv(dev); 608 struct el3_private *priv = netdev_priv(dev);
609 unsigned long flags;
609 610
610 DEBUG(3, "%s: el3_start_xmit(length = %ld) called, " 611 DEBUG(3, "%s: el3_start_xmit(length = %ld) called, "
611 "status %4.4x.\n", dev->name, (long)skb->len, 612 "status %4.4x.\n", dev->name, (long)skb->len,
612 inw(ioaddr + EL3_STATUS)); 613 inw(ioaddr + EL3_STATUS));
613 614
615 spin_lock_irqsave(&priv->lock, flags);
616
614 priv->stats.tx_bytes += skb->len; 617 priv->stats.tx_bytes += skb->len;
615 618
616 /* Put out the doubleword header... */ 619 /* Put out the doubleword header... */
@@ -628,6 +631,7 @@ static int el3_start_xmit(struct sk_buff *skb, struct net_device *dev)
628 631
629 dev_kfree_skb(skb); 632 dev_kfree_skb(skb);
630 pop_tx_status(dev); 633 pop_tx_status(dev);
634 spin_unlock_irqrestore(&priv->lock, flags);
631 635
632 return 0; 636 return 0;
633} 637}
@@ -729,14 +733,13 @@ static void media_check(unsigned long arg)
729 733
730 if (!netif_device_present(dev)) goto reschedule; 734 if (!netif_device_present(dev)) goto reschedule;
731 735
732 EL3WINDOW(1);
733 /* Check for pending interrupt with expired latency timer: with 736 /* Check for pending interrupt with expired latency timer: with
734 this, we can limp along even if the interrupt is blocked */ 737 this, we can limp along even if the interrupt is blocked */
735 if ((inw(ioaddr + EL3_STATUS) & IntLatch) && 738 if ((inw(ioaddr + EL3_STATUS) & IntLatch) &&
736 (inb(ioaddr + EL3_TIMER) == 0xff)) { 739 (inb(ioaddr + EL3_TIMER) == 0xff)) {
737 if (!lp->fast_poll) 740 if (!lp->fast_poll)
738 printk(KERN_WARNING "%s: interrupt(s) dropped!\n", dev->name); 741 printk(KERN_WARNING "%s: interrupt(s) dropped!\n", dev->name);
739 el3_interrupt(dev->irq, lp); 742 el3_interrupt(dev->irq, dev);
740 lp->fast_poll = HZ; 743 lp->fast_poll = HZ;
741 } 744 }
742 if (lp->fast_poll) { 745 if (lp->fast_poll) {
diff --git a/drivers/net/phy/fixed.c b/drivers/net/phy/fixed.c
index 096d4a100bf2..86135397f430 100644
--- a/drivers/net/phy/fixed.c
+++ b/drivers/net/phy/fixed.c
@@ -349,7 +349,7 @@ static int __init fixed_init(void)
349 fixed_mdio_register_device(0, 100, 1); 349 fixed_mdio_register_device(0, 100, 1);
350#endif 350#endif
351 351
352#ifdef CONFIX_FIXED_MII_10_FDX 352#ifdef CONFIG_FIXED_MII_10_FDX
353 fixed_mdio_register_device(0, 10, 1); 353 fixed_mdio_register_device(0, 10, 1);
354#endif 354#endif
355 return 0; 355 return 0;
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index e175f3910b18..9765fa661467 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -286,6 +286,7 @@ int phy_ethtool_sset(struct phy_device *phydev, struct ethtool_cmd *cmd)
286 286
287 return 0; 287 return 0;
288} 288}
289EXPORT_SYMBOL(phy_ethtool_sset);
289 290
290int phy_ethtool_gset(struct phy_device *phydev, struct ethtool_cmd *cmd) 291int phy_ethtool_gset(struct phy_device *phydev, struct ethtool_cmd *cmd)
291{ 292{
@@ -302,7 +303,7 @@ int phy_ethtool_gset(struct phy_device *phydev, struct ethtool_cmd *cmd)
302 303
303 return 0; 304 return 0;
304} 305}
305 306EXPORT_SYMBOL(phy_ethtool_gset);
306 307
307/* Note that this function is currently incompatible with the 308/* Note that this function is currently incompatible with the
308 * PHYCONTROL layer. It changes registers without regard to 309 * PHYCONTROL layer. It changes registers without regard to
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c
index 250cdbeefdfd..1dd66b8ea0fa 100644
--- a/drivers/net/s2io.c
+++ b/drivers/net/s2io.c
@@ -556,10 +556,9 @@ static int init_shared_mem(struct s2io_nic *nic)
556 } 556 }
557 } 557 }
558 558
559 nic->ufo_in_band_v = kmalloc((sizeof(u64) * size), GFP_KERNEL); 559 nic->ufo_in_band_v = kcalloc(size, sizeof(u64), GFP_KERNEL);
560 if (!nic->ufo_in_band_v) 560 if (!nic->ufo_in_band_v)
561 return -ENOMEM; 561 return -ENOMEM;
562 memset(nic->ufo_in_band_v, 0, size);
563 562
564 /* Allocation and initialization of RXDs in Rings */ 563 /* Allocation and initialization of RXDs in Rings */
565 size = 0; 564 size = 0;
diff --git a/drivers/net/skge.c b/drivers/net/skge.c
index deedfd5f8226..45283f3f95e4 100644
--- a/drivers/net/skge.c
+++ b/drivers/net/skge.c
@@ -60,7 +60,7 @@
60#define LINK_HZ (HZ/2) 60#define LINK_HZ (HZ/2)
61 61
62MODULE_DESCRIPTION("SysKonnect Gigabit Ethernet driver"); 62MODULE_DESCRIPTION("SysKonnect Gigabit Ethernet driver");
63MODULE_AUTHOR("Stephen Hemminger <shemminger@osdl.org>"); 63MODULE_AUTHOR("Stephen Hemminger <shemminger@linux-foundation.org>");
64MODULE_LICENSE("GPL"); 64MODULE_LICENSE("GPL");
65MODULE_VERSION(DRV_VERSION); 65MODULE_VERSION(DRV_VERSION);
66 66
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index a6601e8d423c..822dd0b13133 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -3639,29 +3639,6 @@ static int sky2_resume(struct pci_dev *pdev)
3639out: 3639out:
3640 return err; 3640 return err;
3641} 3641}
3642
3643/* BIOS resume runs after device (it's a bug in PM)
3644 * as a temporary workaround on suspend/resume leave MSI disabled
3645 */
3646static int sky2_suspend_late(struct pci_dev *pdev, pm_message_t state)
3647{
3648 struct sky2_hw *hw = pci_get_drvdata(pdev);
3649
3650 free_irq(pdev->irq, hw);
3651 if (hw->msi) {
3652 pci_disable_msi(pdev);
3653 hw->msi = 0;
3654 }
3655 return 0;
3656}
3657
3658static int sky2_resume_early(struct pci_dev *pdev)
3659{
3660 struct sky2_hw *hw = pci_get_drvdata(pdev);
3661 struct net_device *dev = hw->dev[0];
3662
3663 return request_irq(pdev->irq, sky2_intr, IRQF_SHARED, dev->name, hw);
3664}
3665#endif 3642#endif
3666 3643
3667static struct pci_driver sky2_driver = { 3644static struct pci_driver sky2_driver = {
@@ -3672,8 +3649,6 @@ static struct pci_driver sky2_driver = {
3672#ifdef CONFIG_PM 3649#ifdef CONFIG_PM
3673 .suspend = sky2_suspend, 3650 .suspend = sky2_suspend,
3674 .resume = sky2_resume, 3651 .resume = sky2_resume,
3675 .suspend_late = sky2_suspend_late,
3676 .resume_early = sky2_resume_early,
3677#endif 3652#endif
3678}; 3653};
3679 3654
@@ -3691,6 +3666,6 @@ module_init(sky2_init_module);
3691module_exit(sky2_cleanup_module); 3666module_exit(sky2_cleanup_module);
3692 3667
3693MODULE_DESCRIPTION("Marvell Yukon 2 Gigabit Ethernet driver"); 3668MODULE_DESCRIPTION("Marvell Yukon 2 Gigabit Ethernet driver");
3694MODULE_AUTHOR("Stephen Hemminger <shemminger@osdl.org>"); 3669MODULE_AUTHOR("Stephen Hemminger <shemminger@linux-foundation.org>");
3695MODULE_LICENSE("GPL"); 3670MODULE_LICENSE("GPL");
3696MODULE_VERSION(DRV_VERSION); 3671MODULE_VERSION(DRV_VERSION);
diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c
index 880d9fdd7c67..43af61438449 100644
--- a/drivers/net/smc911x.c
+++ b/drivers/net/smc911x.c
@@ -968,11 +968,11 @@ static void smc911x_phy_configure(struct work_struct *work)
968 * We should not be called if phy_type is zero. 968 * We should not be called if phy_type is zero.
969 */ 969 */
970 if (lp->phy_type == 0) 970 if (lp->phy_type == 0)
971 goto smc911x_phy_configure_exit; 971 goto smc911x_phy_configure_exit_nolock;
972 972
973 if (smc911x_phy_reset(dev, phyaddr)) { 973 if (smc911x_phy_reset(dev, phyaddr)) {
974 printk("%s: PHY reset timed out\n", dev->name); 974 printk("%s: PHY reset timed out\n", dev->name);
975 goto smc911x_phy_configure_exit; 975 goto smc911x_phy_configure_exit_nolock;
976 } 976 }
977 spin_lock_irqsave(&lp->lock, flags); 977 spin_lock_irqsave(&lp->lock, flags);
978 978
@@ -1041,6 +1041,7 @@ static void smc911x_phy_configure(struct work_struct *work)
1041 1041
1042smc911x_phy_configure_exit: 1042smc911x_phy_configure_exit:
1043 spin_unlock_irqrestore(&lp->lock, flags); 1043 spin_unlock_irqrestore(&lp->lock, flags);
1044smc911x_phy_configure_exit_nolock:
1044 lp->work_pending = 0; 1045 lp->work_pending = 0;
1045} 1046}
1046 1047
diff --git a/drivers/net/spider_net.c b/drivers/net/spider_net.c
index ebb6aa39f9c7..8ea2fc1b96cb 100644
--- a/drivers/net/spider_net.c
+++ b/drivers/net/spider_net.c
@@ -1925,6 +1925,8 @@ spider_net_stop(struct net_device *netdev)
1925 /* release chains */ 1925 /* release chains */
1926 spider_net_release_tx_chain(card, 1); 1926 spider_net_release_tx_chain(card, 1);
1927 1927
1928 spider_net_free_rx_chain_contents(card);
1929
1928 spider_net_free_chain(card, &card->tx_chain); 1930 spider_net_free_chain(card, &card->tx_chain);
1929 spider_net_free_chain(card, &card->rx_chain); 1931 spider_net_free_chain(card, &card->rx_chain);
1930 1932
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index ef882a8a094e..c913ea4e545c 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -654,19 +654,42 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686_4, quirk_vi
654 * VIA bridges which have VLink 654 * VIA bridges which have VLink
655 */ 655 */
656 656
657static const struct pci_device_id via_vlink_fixup_tbl[] = { 657static int via_vlink_dev_lo = -1, via_vlink_dev_hi = 18;
658 /* Internal devices need IRQ line routing, pre VLink */ 658
659 { PCI_VDEVICE(VIA, PCI_DEVICE_ID_VIA_82C686), 0 }, 659static void quirk_via_bridge(struct pci_dev *dev)
660 { PCI_VDEVICE(VIA, PCI_DEVICE_ID_VIA_8231), 17 }, 660{
661 /* Devices with VLink */ 661 /* See what bridge we have and find the device ranges */
662 { PCI_VDEVICE(VIA, PCI_DEVICE_ID_VIA_8233_0), 17}, 662 switch (dev->device) {
663 { PCI_VDEVICE(VIA, PCI_DEVICE_ID_VIA_8233A), 17 }, 663 case PCI_DEVICE_ID_VIA_82C686:
664 { PCI_VDEVICE(VIA, PCI_DEVICE_ID_VIA_8233C_0), 17 }, 664 /* The VT82C686 is special, it attaches to PCI and can have
665 { PCI_VDEVICE(VIA, PCI_DEVICE_ID_VIA_8235), 16 }, 665 any device number. All its subdevices are functions of
666 { PCI_VDEVICE(VIA, PCI_DEVICE_ID_VIA_8237), 15 }, 666 that single device. */
667 { PCI_VDEVICE(VIA, PCI_DEVICE_ID_VIA_8237A), 15 }, 667 via_vlink_dev_lo = PCI_SLOT(dev->devfn);
668 { 0, }, 668 via_vlink_dev_hi = PCI_SLOT(dev->devfn);
669}; 669 break;
670 case PCI_DEVICE_ID_VIA_8237:
671 case PCI_DEVICE_ID_VIA_8237A:
672 via_vlink_dev_lo = 15;
673 break;
674 case PCI_DEVICE_ID_VIA_8235:
675 via_vlink_dev_lo = 16;
676 break;
677 case PCI_DEVICE_ID_VIA_8231:
678 case PCI_DEVICE_ID_VIA_8233_0:
679 case PCI_DEVICE_ID_VIA_8233A:
680 case PCI_DEVICE_ID_VIA_8233C_0:
681 via_vlink_dev_lo = 17;
682 break;
683 }
684}
685DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686, quirk_via_bridge);
686DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8231, quirk_via_bridge);
687DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8233_0, quirk_via_bridge);
688DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8233A, quirk_via_bridge);
689DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8233C_0, quirk_via_bridge);
690DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8235, quirk_via_bridge);
691DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8237, quirk_via_bridge);
692DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8237A, quirk_via_bridge);
670 693
671/** 694/**
672 * quirk_via_vlink - VIA VLink IRQ number update 695 * quirk_via_vlink - VIA VLink IRQ number update
@@ -675,35 +698,20 @@ static const struct pci_device_id via_vlink_fixup_tbl[] = {
675 * If the device we are dealing with is on a PIC IRQ we need to 698 * If the device we are dealing with is on a PIC IRQ we need to
676 * ensure that the IRQ line register which usually is not relevant 699 * ensure that the IRQ line register which usually is not relevant
677 * for PCI cards, is actually written so that interrupts get sent 700 * for PCI cards, is actually written so that interrupts get sent
678 * to the right place 701 * to the right place.
702 * We only do this on systems where a VIA south bridge was detected,
703 * and only for VIA devices on the motherboard (see quirk_via_bridge
704 * above).
679 */ 705 */
680 706
681static void quirk_via_vlink(struct pci_dev *dev) 707static void quirk_via_vlink(struct pci_dev *dev)
682{ 708{
683 const struct pci_device_id *via_vlink_fixup;
684 static int dev_lo = -1, dev_hi = 18;
685 u8 irq, new_irq; 709 u8 irq, new_irq;
686 710
687 /* Check if we have VLink and cache the result */ 711 /* Check if we have VLink at all */
688 712 if (via_vlink_dev_lo == -1)
689 /* Checked already - no */
690 if (dev_lo == -2)
691 return; 713 return;
692 714
693 /* Not checked - see what bridge we have and find the device
694 ranges */
695
696 if (dev_lo == -1) {
697 via_vlink_fixup = pci_find_present(via_vlink_fixup_tbl);
698 if (via_vlink_fixup == NULL) {
699 dev_lo = -2;
700 return;
701 }
702 dev_lo = via_vlink_fixup->driver_data;
703 /* 82C686 is special - 0/0 */
704 if (dev_lo == 0)
705 dev_hi = 0;
706 }
707 new_irq = dev->irq; 715 new_irq = dev->irq;
708 716
709 /* Don't quirk interrupts outside the legacy IRQ range */ 717 /* Don't quirk interrupts outside the legacy IRQ range */
@@ -711,8 +719,8 @@ static void quirk_via_vlink(struct pci_dev *dev)
711 return; 719 return;
712 720
713 /* Internal device ? */ 721 /* Internal device ? */
714 if (dev->bus->number != 0 || PCI_SLOT(dev->devfn) > dev_hi || 722 if (dev->bus->number != 0 || PCI_SLOT(dev->devfn) > via_vlink_dev_hi ||
715 PCI_SLOT(dev->devfn) < dev_lo) 723 PCI_SLOT(dev->devfn) < via_vlink_dev_lo)
716 return; 724 return;
717 725
718 /* This is an internal VLink device on a PIC interrupt. The BIOS 726 /* This is an internal VLink device on a PIC interrupt. The BIOS
@@ -1254,8 +1262,8 @@ static void quirk_jmicron_dualfn(struct pci_dev *pdev)
1254 pci_read_config_dword(pdev, 0x40, &conf); 1262 pci_read_config_dword(pdev, 0x40, &conf);
1255 /* Enable dual function mode, AHCI on fn 0, IDE fn1 */ 1263 /* Enable dual function mode, AHCI on fn 0, IDE fn1 */
1256 /* Set the class codes correctly and then direct IDE 0 */ 1264 /* Set the class codes correctly and then direct IDE 0 */
1257 conf &= ~0x000F0200; /* Clear bit 9 and 16-19 */ 1265 conf &= ~0x000FF200; /* Clear bit 9 and 12-19 */
1258 conf |= 0x00C20002; /* Set bit 1, 17, 22, 23 */ 1266 conf |= 0x00C2A102; /* Set 1, 8, 13, 15, 17, 22, 23 */
1259 pci_write_config_dword(pdev, 0x40, conf); 1267 pci_write_config_dword(pdev, 0x40, conf);
1260 1268
1261 /* Reconfigure so that the PCI scanner discovers the 1269 /* Reconfigure so that the PCI scanner discovers the
diff --git a/drivers/pci/search.c b/drivers/pci/search.c
index fab381ed853c..b2653c4afe9e 100644
--- a/drivers/pci/search.c
+++ b/drivers/pci/search.c
@@ -200,11 +200,8 @@ static struct pci_dev * pci_find_subsys(unsigned int vendor,
200 * can cause some machines to crash. So here we detect and flag that 200 * can cause some machines to crash. So here we detect and flag that
201 * situation and bail out early. 201 * situation and bail out early.
202 */ 202 */
203 if (unlikely(list_empty(&pci_devices))) { 203 if (unlikely(list_empty(&pci_devices)))
204 printk(KERN_INFO "pci_find_subsys() called while pci_devices "
205 "is still empty\n");
206 return NULL; 204 return NULL;
207 }
208 down_read(&pci_bus_sem); 205 down_read(&pci_bus_sem);
209 n = from ? from->global_list.next : pci_devices.next; 206 n = from ? from->global_list.next : pci_devices.next;
210 207
@@ -278,11 +275,8 @@ pci_get_subsys(unsigned int vendor, unsigned int device,
278 * can cause some machines to crash. So here we detect and flag that 275 * can cause some machines to crash. So here we detect and flag that
279 * situation and bail out early. 276 * situation and bail out early.
280 */ 277 */
281 if (unlikely(list_empty(&pci_devices))) { 278 if (unlikely(list_empty(&pci_devices)))
282 printk(KERN_NOTICE "pci_get_subsys() called while pci_devices "
283 "is still empty\n");
284 return NULL; 279 return NULL;
285 }
286 down_read(&pci_bus_sem); 280 down_read(&pci_bus_sem);
287 n = from ? from->global_list.next : pci_devices.next; 281 n = from ? from->global_list.next : pci_devices.next;
288 282
diff --git a/drivers/rtc/rtc-sh.c b/drivers/rtc/rtc-sh.c
index e9e0934380b8..198b9f22fbff 100644
--- a/drivers/rtc/rtc-sh.c
+++ b/drivers/rtc/rtc-sh.c
@@ -492,10 +492,10 @@ static int sh_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *wkalrm)
492 492
493 spin_lock_irq(&rtc->lock); 493 spin_lock_irq(&rtc->lock);
494 494
495 /* disable alarm interrupt and clear flag */ 495 /* disable alarm interrupt and clear the alarm flag */
496 rcr1 = readb(rtc->regbase + RCR1); 496 rcr1 = readb(rtc->regbase + RCR1);
497 rcr1 &= ~RCR1_AF; 497 rcr1 &= ~(RCR1_AF|RCR1_AIE);
498 writeb(rcr1 & ~RCR1_AIE, rtc->regbase + RCR1); 498 writeb(rcr1, rtc->regbase + RCR1);
499 499
500 rtc->rearm_aie = 0; 500 rtc->rearm_aie = 0;
501 501
@@ -510,8 +510,10 @@ static int sh_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *wkalrm)
510 mon += 1; 510 mon += 1;
511 sh_rtc_write_alarm_value(rtc, mon, RMONAR); 511 sh_rtc_write_alarm_value(rtc, mon, RMONAR);
512 512
513 /* Restore interrupt activation status */ 513 if (wkalrm->enabled) {
514 writeb(rcr1, rtc->regbase + RCR1); 514 rcr1 |= RCR1_AIE;
515 writeb(rcr1, rtc->regbase + RCR1);
516 }
515 517
516 spin_unlock_irq(&rtc->lock); 518 spin_unlock_irq(&rtc->lock);
517 519
diff --git a/drivers/rtc/rtc-sysfs.c b/drivers/rtc/rtc-sysfs.c
index 9418a59fb368..2ddd0cf07140 100644
--- a/drivers/rtc/rtc-sysfs.c
+++ b/drivers/rtc/rtc-sysfs.c
@@ -78,7 +78,7 @@ static struct attribute_group rtc_attr_group = {
78 .attrs = rtc_attrs, 78 .attrs = rtc_attrs,
79}; 79};
80 80
81static int __devinit rtc_sysfs_add_device(struct class_device *class_dev, 81static int rtc_sysfs_add_device(struct class_device *class_dev,
82 struct class_interface *class_intf) 82 struct class_interface *class_intf)
83{ 83{
84 int err; 84 int err;
diff --git a/drivers/scsi/pcmcia/sym53c500_cs.c b/drivers/scsi/pcmcia/sym53c500_cs.c
index 9fb0ea5c1fb9..5b458d2478f7 100644
--- a/drivers/scsi/pcmcia/sym53c500_cs.c
+++ b/drivers/scsi/pcmcia/sym53c500_cs.c
@@ -545,8 +545,6 @@ SYM53C500_release(struct pcmcia_device *link)
545 */ 545 */
546 if (shost->irq) 546 if (shost->irq)
547 free_irq(shost->irq, shost); 547 free_irq(shost->irq, shost);
548 if (shost->dma_channel != 0xff)
549 free_dma(shost->dma_channel);
550 if (shost->io_port && shost->n_io_port) 548 if (shost->io_port && shost->n_io_port)
551 release_region(shost->io_port, shost->n_io_port); 549 release_region(shost->io_port, shost->n_io_port);
552 550
diff --git a/drivers/scsi/qla4xxx/ql4_def.h b/drivers/scsi/qla4xxx/ql4_def.h
index 4249e52a5592..6f4cf2dd2f4a 100644
--- a/drivers/scsi/qla4xxx/ql4_def.h
+++ b/drivers/scsi/qla4xxx/ql4_def.h
@@ -418,7 +418,6 @@ struct scsi_qla_host {
418 * concurrently. 418 * concurrently.
419 */ 419 */
420 struct mutex mbox_sem; 420 struct mutex mbox_sem;
421 wait_queue_head_t mailbox_wait_queue;
422 421
423 /* temporary mailbox status registers */ 422 /* temporary mailbox status registers */
424 volatile uint8_t mbox_status_count; 423 volatile uint8_t mbox_status_count;
diff --git a/drivers/scsi/qla4xxx/ql4_glbl.h b/drivers/scsi/qla4xxx/ql4_glbl.h
index 2122967bbf0b..e021eb5db2b2 100644
--- a/drivers/scsi/qla4xxx/ql4_glbl.h
+++ b/drivers/scsi/qla4xxx/ql4_glbl.h
@@ -76,4 +76,5 @@ int qla4xxx_process_ddb_changed(struct scsi_qla_host * ha,
76extern int ql4xextended_error_logging; 76extern int ql4xextended_error_logging;
77extern int ql4xdiscoverywait; 77extern int ql4xdiscoverywait;
78extern int ql4xdontresethba; 78extern int ql4xdontresethba;
79extern int ql4_mod_unload;
79#endif /* _QLA4x_GBL_H */ 80#endif /* _QLA4x_GBL_H */
diff --git a/drivers/scsi/qla4xxx/ql4_init.c b/drivers/scsi/qla4xxx/ql4_init.c
index cc210f297a78..b907b06d72ab 100644
--- a/drivers/scsi/qla4xxx/ql4_init.c
+++ b/drivers/scsi/qla4xxx/ql4_init.c
@@ -958,25 +958,25 @@ static int qla4xxx_start_firmware_from_flash(struct scsi_qla_host *ha)
958 return status; 958 return status;
959} 959}
960 960
961int ql4xxx_lock_drvr_wait(struct scsi_qla_host *a) 961int ql4xxx_lock_drvr_wait(struct scsi_qla_host *ha)
962{ 962{
963#define QL4_LOCK_DRVR_WAIT 300 963#define QL4_LOCK_DRVR_WAIT 30
964#define QL4_LOCK_DRVR_SLEEP 100 964#define QL4_LOCK_DRVR_SLEEP 1
965 965
966 int drvr_wait = QL4_LOCK_DRVR_WAIT; 966 int drvr_wait = QL4_LOCK_DRVR_WAIT;
967 while (drvr_wait) { 967 while (drvr_wait) {
968 if (ql4xxx_lock_drvr(a) == 0) { 968 if (ql4xxx_lock_drvr(ha) == 0) {
969 msleep(QL4_LOCK_DRVR_SLEEP); 969 ssleep(QL4_LOCK_DRVR_SLEEP);
970 if (drvr_wait) { 970 if (drvr_wait) {
971 DEBUG2(printk("scsi%ld: %s: Waiting for " 971 DEBUG2(printk("scsi%ld: %s: Waiting for "
972 "Global Init Semaphore...n", 972 "Global Init Semaphore(%d)...n",
973 a->host_no, 973 ha->host_no,
974 __func__)); 974 __func__, drvr_wait));
975 } 975 }
976 drvr_wait -= QL4_LOCK_DRVR_SLEEP; 976 drvr_wait -= QL4_LOCK_DRVR_SLEEP;
977 } else { 977 } else {
978 DEBUG2(printk("scsi%ld: %s: Global Init Semaphore " 978 DEBUG2(printk("scsi%ld: %s: Global Init Semaphore "
979 "acquired.n", a->host_no, __func__)); 979 "acquired.n", ha->host_no, __func__));
980 return QLA_SUCCESS; 980 return QLA_SUCCESS;
981 } 981 }
982 } 982 }
diff --git a/drivers/scsi/qla4xxx/ql4_isr.c b/drivers/scsi/qla4xxx/ql4_isr.c
index ef975e0dc87f..35b9e36a0e8d 100644
--- a/drivers/scsi/qla4xxx/ql4_isr.c
+++ b/drivers/scsi/qla4xxx/ql4_isr.c
@@ -433,7 +433,6 @@ static void qla4xxx_isr_decode_mailbox(struct scsi_qla_host * ha,
433 readl(&ha->reg->mailbox[i]); 433 readl(&ha->reg->mailbox[i]);
434 434
435 set_bit(AF_MBOX_COMMAND_DONE, &ha->flags); 435 set_bit(AF_MBOX_COMMAND_DONE, &ha->flags);
436 wake_up(&ha->mailbox_wait_queue);
437 } 436 }
438 } else if (mbox_status >> 12 == MBOX_ASYNC_EVENT_STATUS) { 437 } else if (mbox_status >> 12 == MBOX_ASYNC_EVENT_STATUS) {
439 /* Immediately process the AENs that don't require much work. 438 /* Immediately process the AENs that don't require much work.
@@ -686,7 +685,8 @@ irqreturn_t qla4xxx_intr_handler(int irq, void *dev_id)
686 &ha->reg->ctrl_status); 685 &ha->reg->ctrl_status);
687 readl(&ha->reg->ctrl_status); 686 readl(&ha->reg->ctrl_status);
688 687
689 set_bit(DPC_RESET_HA_INTR, &ha->dpc_flags); 688 if (!ql4_mod_unload)
689 set_bit(DPC_RESET_HA_INTR, &ha->dpc_flags);
690 690
691 break; 691 break;
692 } else if (intr_status & INTR_PENDING) { 692 } else if (intr_status & INTR_PENDING) {
diff --git a/drivers/scsi/qla4xxx/ql4_mbx.c b/drivers/scsi/qla4xxx/ql4_mbx.c
index b721dc5dd711..7f28657eef3f 100644
--- a/drivers/scsi/qla4xxx/ql4_mbx.c
+++ b/drivers/scsi/qla4xxx/ql4_mbx.c
@@ -29,18 +29,30 @@ int qla4xxx_mailbox_command(struct scsi_qla_host *ha, uint8_t inCount,
29 u_long wait_count; 29 u_long wait_count;
30 uint32_t intr_status; 30 uint32_t intr_status;
31 unsigned long flags = 0; 31 unsigned long flags = 0;
32 DECLARE_WAITQUEUE(wait, current);
33
34 mutex_lock(&ha->mbox_sem);
35
36 /* Mailbox code active */
37 set_bit(AF_MBOX_COMMAND, &ha->flags);
38 32
39 /* Make sure that pointers are valid */ 33 /* Make sure that pointers are valid */
40 if (!mbx_cmd || !mbx_sts) { 34 if (!mbx_cmd || !mbx_sts) {
41 DEBUG2(printk("scsi%ld: %s: Invalid mbx_cmd or mbx_sts " 35 DEBUG2(printk("scsi%ld: %s: Invalid mbx_cmd or mbx_sts "
42 "pointer\n", ha->host_no, __func__)); 36 "pointer\n", ha->host_no, __func__));
43 goto mbox_exit; 37 return status;
38 }
39 /* Mailbox code active */
40 wait_count = MBOX_TOV * 100;
41
42 while (wait_count--) {
43 mutex_lock(&ha->mbox_sem);
44 if (!test_bit(AF_MBOX_COMMAND, &ha->flags)) {
45 set_bit(AF_MBOX_COMMAND, &ha->flags);
46 mutex_unlock(&ha->mbox_sem);
47 break;
48 }
49 mutex_unlock(&ha->mbox_sem);
50 if (!wait_count) {
51 DEBUG2(printk("scsi%ld: %s: mbox_sem failed\n",
52 ha->host_no, __func__));
53 return status;
54 }
55 msleep(10);
44 } 56 }
45 57
46 /* To prevent overwriting mailbox registers for a command that has 58 /* To prevent overwriting mailbox registers for a command that has
@@ -73,8 +85,6 @@ int qla4xxx_mailbox_command(struct scsi_qla_host *ha, uint8_t inCount,
73 spin_unlock_irqrestore(&ha->hardware_lock, flags); 85 spin_unlock_irqrestore(&ha->hardware_lock, flags);
74 86
75 /* Wait for completion */ 87 /* Wait for completion */
76 set_current_state(TASK_UNINTERRUPTIBLE);
77 add_wait_queue(&ha->mailbox_wait_queue, &wait);
78 88
79 /* 89 /*
80 * If we don't want status, don't wait for the mailbox command to 90 * If we don't want status, don't wait for the mailbox command to
@@ -83,8 +93,6 @@ int qla4xxx_mailbox_command(struct scsi_qla_host *ha, uint8_t inCount,
83 */ 93 */
84 if (outCount == 0) { 94 if (outCount == 0) {
85 status = QLA_SUCCESS; 95 status = QLA_SUCCESS;
86 set_current_state(TASK_RUNNING);
87 remove_wait_queue(&ha->mailbox_wait_queue, &wait);
88 goto mbox_exit; 96 goto mbox_exit;
89 } 97 }
90 /* Wait for command to complete */ 98 /* Wait for command to complete */
@@ -108,8 +116,6 @@ int qla4xxx_mailbox_command(struct scsi_qla_host *ha, uint8_t inCount,
108 spin_unlock_irqrestore(&ha->hardware_lock, flags); 116 spin_unlock_irqrestore(&ha->hardware_lock, flags);
109 msleep(10); 117 msleep(10);
110 } 118 }
111 set_current_state(TASK_RUNNING);
112 remove_wait_queue(&ha->mailbox_wait_queue, &wait);
113 119
114 /* Check for mailbox timeout. */ 120 /* Check for mailbox timeout. */
115 if (!test_bit(AF_MBOX_COMMAND_DONE, &ha->flags)) { 121 if (!test_bit(AF_MBOX_COMMAND_DONE, &ha->flags)) {
@@ -155,9 +161,10 @@ int qla4xxx_mailbox_command(struct scsi_qla_host *ha, uint8_t inCount,
155 spin_unlock_irqrestore(&ha->hardware_lock, flags); 161 spin_unlock_irqrestore(&ha->hardware_lock, flags);
156 162
157mbox_exit: 163mbox_exit:
164 mutex_lock(&ha->mbox_sem);
158 clear_bit(AF_MBOX_COMMAND, &ha->flags); 165 clear_bit(AF_MBOX_COMMAND, &ha->flags);
159 clear_bit(AF_MBOX_COMMAND_DONE, &ha->flags);
160 mutex_unlock(&ha->mbox_sem); 166 mutex_unlock(&ha->mbox_sem);
167 clear_bit(AF_MBOX_COMMAND_DONE, &ha->flags);
161 168
162 return status; 169 return status;
163} 170}
diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
index 9ef693c8809a..81fb7bd44f01 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -40,6 +40,8 @@ MODULE_PARM_DESC(ql4xextended_error_logging,
40 "Option to enable extended error logging, " 40 "Option to enable extended error logging, "
41 "Default is 0 - no logging, 1 - debug logging"); 41 "Default is 0 - no logging, 1 - debug logging");
42 42
43int ql4_mod_unload = 0;
44
43/* 45/*
44 * SCSI host template entry points 46 * SCSI host template entry points
45 */ 47 */
@@ -422,6 +424,9 @@ static int qla4xxx_queuecommand(struct scsi_cmnd *cmd,
422 goto qc_host_busy; 424 goto qc_host_busy;
423 } 425 }
424 426
427 if (test_bit(DPC_RESET_HA_INTR, &ha->dpc_flags))
428 goto qc_host_busy;
429
425 spin_unlock_irq(ha->host->host_lock); 430 spin_unlock_irq(ha->host->host_lock);
426 431
427 srb = qla4xxx_get_new_srb(ha, ddb_entry, cmd, done); 432 srb = qla4xxx_get_new_srb(ha, ddb_entry, cmd, done);
@@ -707,16 +712,12 @@ static int qla4xxx_cmd_wait(struct scsi_qla_host *ha)
707 return stat; 712 return stat;
708} 713}
709 714
710/** 715static void qla4xxx_hw_reset(struct scsi_qla_host *ha)
711 * qla4xxx_soft_reset - performs soft reset.
712 * @ha: Pointer to host adapter structure.
713 **/
714int qla4xxx_soft_reset(struct scsi_qla_host *ha)
715{ 716{
716 uint32_t max_wait_time;
717 unsigned long flags = 0;
718 int status = QLA_ERROR;
719 uint32_t ctrl_status; 717 uint32_t ctrl_status;
718 unsigned long flags = 0;
719
720 DEBUG2(printk(KERN_ERR "scsi%ld: %s\n", ha->host_no, __func__));
720 721
721 spin_lock_irqsave(&ha->hardware_lock, flags); 722 spin_lock_irqsave(&ha->hardware_lock, flags);
722 723
@@ -733,6 +734,20 @@ int qla4xxx_soft_reset(struct scsi_qla_host *ha)
733 readl(&ha->reg->ctrl_status); 734 readl(&ha->reg->ctrl_status);
734 735
735 spin_unlock_irqrestore(&ha->hardware_lock, flags); 736 spin_unlock_irqrestore(&ha->hardware_lock, flags);
737}
738
739/**
740 * qla4xxx_soft_reset - performs soft reset.
741 * @ha: Pointer to host adapter structure.
742 **/
743int qla4xxx_soft_reset(struct scsi_qla_host *ha)
744{
745 uint32_t max_wait_time;
746 unsigned long flags = 0;
747 int status = QLA_ERROR;
748 uint32_t ctrl_status;
749
750 qla4xxx_hw_reset(ha);
736 751
737 /* Wait until the Network Reset Intr bit is cleared */ 752 /* Wait until the Network Reset Intr bit is cleared */
738 max_wait_time = RESET_INTR_TOV; 753 max_wait_time = RESET_INTR_TOV;
@@ -966,10 +981,12 @@ static void qla4xxx_do_dpc(struct work_struct *work)
966 struct scsi_qla_host *ha = 981 struct scsi_qla_host *ha =
967 container_of(work, struct scsi_qla_host, dpc_work); 982 container_of(work, struct scsi_qla_host, dpc_work);
968 struct ddb_entry *ddb_entry, *dtemp; 983 struct ddb_entry *ddb_entry, *dtemp;
984 int status = QLA_ERROR;
969 985
970 DEBUG2(printk("scsi%ld: %s: DPC handler waking up." 986 DEBUG2(printk("scsi%ld: %s: DPC handler waking up."
971 "flags = 0x%08lx, dpc_flags = 0x%08lx\n", 987 "flags = 0x%08lx, dpc_flags = 0x%08lx ctrl_stat = 0x%08x\n",
972 ha->host_no, __func__, ha->flags, ha->dpc_flags)); 988 ha->host_no, __func__, ha->flags, ha->dpc_flags,
989 readw(&ha->reg->ctrl_status)));
973 990
974 /* Initialization not yet finished. Don't do anything yet. */ 991 /* Initialization not yet finished. Don't do anything yet. */
975 if (!test_bit(AF_INIT_DONE, &ha->flags)) 992 if (!test_bit(AF_INIT_DONE, &ha->flags))
@@ -983,31 +1000,28 @@ static void qla4xxx_do_dpc(struct work_struct *work)
983 test_bit(DPC_RESET_HA, &ha->dpc_flags)) 1000 test_bit(DPC_RESET_HA, &ha->dpc_flags))
984 qla4xxx_recover_adapter(ha, PRESERVE_DDB_LIST); 1001 qla4xxx_recover_adapter(ha, PRESERVE_DDB_LIST);
985 1002
986 if (test_and_clear_bit(DPC_RESET_HA_INTR, &ha->dpc_flags)) { 1003 if (test_bit(DPC_RESET_HA_INTR, &ha->dpc_flags)) {
987 uint8_t wait_time = RESET_INTR_TOV; 1004 uint8_t wait_time = RESET_INTR_TOV;
988 unsigned long flags = 0;
989
990 qla4xxx_flush_active_srbs(ha);
991 1005
992 spin_lock_irqsave(&ha->hardware_lock, flags);
993 while ((readw(&ha->reg->ctrl_status) & 1006 while ((readw(&ha->reg->ctrl_status) &
994 (CSR_SOFT_RESET | CSR_FORCE_SOFT_RESET)) != 0) { 1007 (CSR_SOFT_RESET | CSR_FORCE_SOFT_RESET)) != 0) {
995 if (--wait_time == 0) 1008 if (--wait_time == 0)
996 break; 1009 break;
997
998 spin_unlock_irqrestore(&ha->hardware_lock,
999 flags);
1000
1001 msleep(1000); 1010 msleep(1000);
1002
1003 spin_lock_irqsave(&ha->hardware_lock, flags);
1004 } 1011 }
1005 spin_unlock_irqrestore(&ha->hardware_lock, flags);
1006
1007 if (wait_time == 0) 1012 if (wait_time == 0)
1008 DEBUG2(printk("scsi%ld: %s: SR|FSR " 1013 DEBUG2(printk("scsi%ld: %s: SR|FSR "
1009 "bit not cleared-- resetting\n", 1014 "bit not cleared-- resetting\n",
1010 ha->host_no, __func__)); 1015 ha->host_no, __func__));
1016 qla4xxx_flush_active_srbs(ha);
1017 if (ql4xxx_lock_drvr_wait(ha) == QLA_SUCCESS) {
1018 qla4xxx_process_aen(ha, FLUSH_DDB_CHANGED_AENS);
1019 status = qla4xxx_initialize_adapter(ha,
1020 PRESERVE_DDB_LIST);
1021 }
1022 clear_bit(DPC_RESET_HA_INTR, &ha->dpc_flags);
1023 if (status == QLA_SUCCESS)
1024 qla4xxx_enable_intrs(ha);
1011 } 1025 }
1012 } 1026 }
1013 1027
@@ -1062,7 +1076,7 @@ static void qla4xxx_free_adapter(struct scsi_qla_host *ha)
1062 1076
1063 /* Issue Soft Reset to put firmware in unknown state */ 1077 /* Issue Soft Reset to put firmware in unknown state */
1064 if (ql4xxx_lock_drvr_wait(ha) == QLA_SUCCESS) 1078 if (ql4xxx_lock_drvr_wait(ha) == QLA_SUCCESS)
1065 qla4xxx_soft_reset(ha); 1079 qla4xxx_hw_reset(ha);
1066 1080
1067 /* Remove timer thread, if present */ 1081 /* Remove timer thread, if present */
1068 if (ha->timer_active) 1082 if (ha->timer_active)
@@ -1198,7 +1212,6 @@ static int __devinit qla4xxx_probe_adapter(struct pci_dev *pdev,
1198 INIT_LIST_HEAD(&ha->free_srb_q); 1212 INIT_LIST_HEAD(&ha->free_srb_q);
1199 1213
1200 mutex_init(&ha->mbox_sem); 1214 mutex_init(&ha->mbox_sem);
1201 init_waitqueue_head(&ha->mailbox_wait_queue);
1202 1215
1203 spin_lock_init(&ha->hardware_lock); 1216 spin_lock_init(&ha->hardware_lock);
1204 1217
@@ -1665,6 +1678,7 @@ no_srp_cache:
1665 1678
1666static void __exit qla4xxx_module_exit(void) 1679static void __exit qla4xxx_module_exit(void)
1667{ 1680{
1681 ql4_mod_unload = 1;
1668 pci_unregister_driver(&qla4xxx_pci_driver); 1682 pci_unregister_driver(&qla4xxx_pci_driver);
1669 iscsi_unregister_transport(&qla4xxx_iscsi_transport); 1683 iscsi_unregister_transport(&qla4xxx_iscsi_transport);
1670 kmem_cache_destroy(srb_cachep); 1684 kmem_cache_destroy(srb_cachep);
diff --git a/drivers/scsi/qla4xxx/ql4_version.h b/drivers/scsi/qla4xxx/ql4_version.h
index 454e19c8ad68..e5183a697d1f 100644
--- a/drivers/scsi/qla4xxx/ql4_version.h
+++ b/drivers/scsi/qla4xxx/ql4_version.h
@@ -5,4 +5,4 @@
5 * See LICENSE.qla4xxx for copyright and licensing details. 5 * See LICENSE.qla4xxx for copyright and licensing details.
6 */ 6 */
7 7
8#define QLA4XXX_DRIVER_VERSION "5.00.07-k" 8#define QLA4XXX_DRIVER_VERSION "5.00.07-k1"
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index b83d03c4deef..96b7cbd746a8 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -1453,6 +1453,12 @@ struct scsi_device *__scsi_add_device(struct Scsi_Host *shost, uint channel,
1453 struct device *parent = &shost->shost_gendev; 1453 struct device *parent = &shost->shost_gendev;
1454 struct scsi_target *starget; 1454 struct scsi_target *starget;
1455 1455
1456 if (strncmp(scsi_scan_type, "none", 4) == 0)
1457 return ERR_PTR(-ENODEV);
1458
1459 if (!shost->async_scan)
1460 scsi_complete_async_scans();
1461
1456 starget = scsi_alloc_target(parent, channel, id); 1462 starget = scsi_alloc_target(parent, channel, id);
1457 if (!starget) 1463 if (!starget)
1458 return ERR_PTR(-ENOMEM); 1464 return ERR_PTR(-ENOMEM);
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 978bfc1e0c6a..b781a90d6699 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -1647,16 +1647,6 @@ static int sd_probe(struct device *dev)
1647 if (error) 1647 if (error)
1648 goto out_put; 1648 goto out_put;
1649 1649
1650 class_device_initialize(&sdkp->cdev);
1651 sdkp->cdev.dev = &sdp->sdev_gendev;
1652 sdkp->cdev.class = &sd_disk_class;
1653 strncpy(sdkp->cdev.class_id, sdp->sdev_gendev.bus_id, BUS_ID_SIZE);
1654
1655 if (class_device_add(&sdkp->cdev))
1656 goto out_put;
1657
1658 get_device(&sdp->sdev_gendev);
1659
1660 sdkp->device = sdp; 1650 sdkp->device = sdp;
1661 sdkp->driver = &sd_template; 1651 sdkp->driver = &sd_template;
1662 sdkp->disk = gd; 1652 sdkp->disk = gd;
@@ -1670,6 +1660,16 @@ static int sd_probe(struct device *dev)
1670 sdp->timeout = SD_MOD_TIMEOUT; 1660 sdp->timeout = SD_MOD_TIMEOUT;
1671 } 1661 }
1672 1662
1663 class_device_initialize(&sdkp->cdev);
1664 sdkp->cdev.dev = &sdp->sdev_gendev;
1665 sdkp->cdev.class = &sd_disk_class;
1666 strncpy(sdkp->cdev.class_id, sdp->sdev_gendev.bus_id, BUS_ID_SIZE);
1667
1668 if (class_device_add(&sdkp->cdev))
1669 goto out_put;
1670
1671 get_device(&sdp->sdev_gendev);
1672
1673 gd->major = sd_major((index & 0xf0) >> 4); 1673 gd->major = sd_major((index & 0xf0) >> 4);
1674 gd->first_minor = ((index & 0xf) << 4) | (index & 0xfff00); 1674 gd->first_minor = ((index & 0xf) << 4) | (index & 0xfff00);
1675 gd->minors = 16; 1675 gd->minors = 16;
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
index e016e0906e1a..488ec7948a57 100644
--- a/drivers/scsi/st.c
+++ b/drivers/scsi/st.c
@@ -2816,15 +2816,18 @@ static int st_int_ioctl(struct scsi_tape *STp, unsigned int cmd_in, unsigned lon
2816 2816
2817 if (cmd_in == MTWEOF && 2817 if (cmd_in == MTWEOF &&
2818 cmdstatp->have_sense && 2818 cmdstatp->have_sense &&
2819 (cmdstatp->flags & SENSE_EOM) && 2819 (cmdstatp->flags & SENSE_EOM)) {
2820 (cmdstatp->sense_hdr.sense_key == NO_SENSE || 2820 if (cmdstatp->sense_hdr.sense_key == NO_SENSE ||
2821 cmdstatp->sense_hdr.sense_key == RECOVERED_ERROR) && 2821 cmdstatp->sense_hdr.sense_key == RECOVERED_ERROR) {
2822 undone == 0) { 2822 ioctl_result = 0; /* EOF(s) written successfully at EOM */
2823 ioctl_result = 0; /* EOF written successfully at EOM */ 2823 STps->eof = ST_NOEOF;
2824 if (fileno >= 0) 2824 } else { /* Writing EOF(s) failed */
2825 fileno++; 2825 if (fileno >= 0)
2826 fileno -= undone;
2827 if (undone < arg)
2828 STps->eof = ST_NOEOF;
2829 }
2826 STps->drv_file = fileno; 2830 STps->drv_file = fileno;
2827 STps->eof = ST_NOEOF;
2828 } else if ((cmd_in == MTFSF) || (cmd_in == MTFSFM)) { 2831 } else if ((cmd_in == MTFSF) || (cmd_in == MTFSFM)) {
2829 if (fileno >= 0) 2832 if (fileno >= 0)
2830 STps->drv_file = fileno - undone; 2833 STps->drv_file = fileno - undone;
diff --git a/drivers/serial/amba-pl010.c b/drivers/serial/amba-pl010.c
index 61db6973755a..f69bd097166e 100644
--- a/drivers/serial/amba-pl010.c
+++ b/drivers/serial/amba-pl010.c
@@ -589,6 +589,8 @@ static int __init pl010_console_setup(struct console *co, char *options)
589 */ 589 */
590 if (co->index >= UART_NR) 590 if (co->index >= UART_NR)
591 co->index = 0; 591 co->index = 0;
592 if (!amba_ports[co->index])
593 return -ENODEV;
592 port = &amba_ports[co->index]->port; 594 port = &amba_ports[co->index]->port;
593 595
594 if (options) 596 if (options)
diff --git a/drivers/serial/amba-pl011.c b/drivers/serial/amba-pl011.c
index 9a3b374b2a08..44639e71372a 100644
--- a/drivers/serial/amba-pl011.c
+++ b/drivers/serial/amba-pl011.c
@@ -661,6 +661,8 @@ static int __init pl011_console_setup(struct console *co, char *options)
661 if (co->index >= UART_NR) 661 if (co->index >= UART_NR)
662 co->index = 0; 662 co->index = 0;
663 uap = amba_ports[co->index]; 663 uap = amba_ports[co->index];
664 if (!uap)
665 return -ENODEV;
664 666
665 uap->port.uartclk = clk_get_rate(uap->clk); 667 uap->port.uartclk = clk_get_rate(uap->clk);
666 668
diff --git a/drivers/serial/atmel_serial.c b/drivers/serial/atmel_serial.c
index ed7f7209ea59..881f886b91c6 100644
--- a/drivers/serial/atmel_serial.c
+++ b/drivers/serial/atmel_serial.c
@@ -689,9 +689,9 @@ static void __devinit atmel_init_port(struct atmel_uart_port *atmel_port, struct
689 struct atmel_uart_data *data = pdev->dev.platform_data; 689 struct atmel_uart_data *data = pdev->dev.platform_data;
690 690
691 port->iotype = UPIO_MEM; 691 port->iotype = UPIO_MEM;
692 port->flags = UPF_BOOT_AUTOCONF; 692 port->flags = UPF_BOOT_AUTOCONF;
693 port->ops = &atmel_pops; 693 port->ops = &atmel_pops;
694 port->fifosize = 1; 694 port->fifosize = 1;
695 port->line = pdev->id; 695 port->line = pdev->id;
696 port->dev = &pdev->dev; 696 port->dev = &pdev->dev;
697 697
@@ -890,7 +890,6 @@ static int atmel_serial_suspend(struct platform_device *pdev, pm_message_t state
890 if (device_may_wakeup(&pdev->dev) && !at91_suspend_entering_slow_clock()) 890 if (device_may_wakeup(&pdev->dev) && !at91_suspend_entering_slow_clock())
891 enable_irq_wake(port->irq); 891 enable_irq_wake(port->irq);
892 else { 892 else {
893 disable_irq_wake(port->irq);
894 uart_suspend_port(&atmel_uart, port); 893 uart_suspend_port(&atmel_uart, port);
895 atmel_port->suspended = 1; 894 atmel_port->suspended = 1;
896 } 895 }
@@ -907,6 +906,8 @@ static int atmel_serial_resume(struct platform_device *pdev)
907 uart_resume_port(&atmel_uart, port); 906 uart_resume_port(&atmel_uart, port);
908 atmel_port->suspended = 0; 907 atmel_port->suspended = 0;
909 } 908 }
909 else
910 disable_irq_wake(port->irq);
910 911
911 return 0; 912 return 0;
912} 913}
diff --git a/drivers/serial/atmel_serial.h b/drivers/serial/atmel_serial.h
index fe1763b2a6d5..11b44360e108 100644
--- a/drivers/serial/atmel_serial.h
+++ b/drivers/serial/atmel_serial.h
@@ -106,7 +106,7 @@
106#define ATMEL_US_CSR 0x14 /* Channel Status Register */ 106#define ATMEL_US_CSR 0x14 /* Channel Status Register */
107#define ATMEL_US_RHR 0x18 /* Receiver Holding Register */ 107#define ATMEL_US_RHR 0x18 /* Receiver Holding Register */
108#define ATMEL_US_THR 0x1c /* Transmitter Holding Register */ 108#define ATMEL_US_THR 0x1c /* Transmitter Holding Register */
109#define ATMEL_US_SYNH (1 << 15) /* Transmit/Receive Sync [SAM9 only] */ 109#define ATMEL_US_SYNH (1 << 15) /* Transmit/Receive Sync [AT91SAM9261 only] */
110 110
111#define ATMEL_US_BRGR 0x20 /* Baud Rate Generator Register */ 111#define ATMEL_US_BRGR 0x20 /* Baud Rate Generator Register */
112#define ATMEL_US_CD (0xffff << 0) /* Clock Divider */ 112#define ATMEL_US_CD (0xffff << 0) /* Clock Divider */
diff --git a/drivers/spi/pxa2xx_spi.c b/drivers/spi/pxa2xx_spi.c
index 6ed3f1da9296..8b41f9cc2560 100644
--- a/drivers/spi/pxa2xx_spi.c
+++ b/drivers/spi/pxa2xx_spi.c
@@ -1169,8 +1169,9 @@ static int setup(struct spi_device *spi)
1169 spi->bits_per_word - 16 : spi->bits_per_word) 1169 spi->bits_per_word - 16 : spi->bits_per_word)
1170 | SSCR0_SSE 1170 | SSCR0_SSE
1171 | (spi->bits_per_word > 16 ? SSCR0_EDSS : 0); 1171 | (spi->bits_per_word > 16 ? SSCR0_EDSS : 0);
1172 chip->cr1 |= (((spi->mode & SPI_CPHA) != 0) << 4) 1172 chip->cr1 &= ~(SSCR1_SPO | SSCR1_SPH);
1173 | (((spi->mode & SPI_CPOL) != 0) << 3); 1173 chip->cr1 |= (((spi->mode & SPI_CPHA) != 0) ? SSCR1_SPH : 0)
1174 | (((spi->mode & SPI_CPOL) != 0) ? SSCR1_SPO : 0);
1174 1175
1175 /* NOTE: PXA25x_SSP _could_ use external clocking ... */ 1176 /* NOTE: PXA25x_SSP _could_ use external clocking ... */
1176 if (drv_data->ssp_type != PXA25x_SSP) 1177 if (drv_data->ssp_type != PXA25x_SSP)
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 270e6211c2e3..6307428d2c94 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -366,7 +366,6 @@ spi_alloc_master(struct device *dev, unsigned size)
366 366
367 class_device_initialize(&master->cdev); 367 class_device_initialize(&master->cdev);
368 master->cdev.class = &spi_master_class; 368 master->cdev.class = &spi_master_class;
369 kobj_set_kset_s(&master->cdev, spi_master_class.subsys);
370 master->cdev.dev = get_device(dev); 369 master->cdev.dev = get_device(dev);
371 spi_master_set_devdata(master, &master[1]); 370 spi_master_set_devdata(master, &master[1]);
372 371
@@ -466,14 +465,20 @@ EXPORT_SYMBOL_GPL(spi_unregister_master);
466 */ 465 */
467struct spi_master *spi_busnum_to_master(u16 bus_num) 466struct spi_master *spi_busnum_to_master(u16 bus_num)
468{ 467{
469 char name[9]; 468 struct class_device *cdev;
470 struct kobject *bus; 469 struct spi_master *master = NULL;
471 470 struct spi_master *m;
472 snprintf(name, sizeof name, "spi%u", bus_num); 471
473 bus = kset_find_obj(&spi_master_class.subsys.kset, name); 472 down(&spi_master_class.sem);
474 if (bus) 473 list_for_each_entry(cdev, &spi_master_class.children, node) {
475 return container_of(bus, struct spi_master, cdev.kobj); 474 m = container_of(cdev, struct spi_master, cdev);
476 return NULL; 475 if (m->bus_num == bus_num) {
476 master = spi_master_get(m);
477 break;
478 }
479 }
480 up(&spi_master_class.sem);
481 return master;
477} 482}
478EXPORT_SYMBOL_GPL(spi_busnum_to_master); 483EXPORT_SYMBOL_GPL(spi_busnum_to_master);
479 484
diff --git a/drivers/spi/spi_s3c24xx.c b/drivers/spi/spi_s3c24xx.c
index 8ca08713528e..651379c51ae6 100644
--- a/drivers/spi/spi_s3c24xx.c
+++ b/drivers/spi/spi_s3c24xx.c
@@ -10,9 +10,6 @@
10 * 10 *
11*/ 11*/
12 12
13
14//#define DEBUG
15
16#include <linux/init.h> 13#include <linux/init.h>
17#include <linux/spinlock.h> 14#include <linux/spinlock.h>
18#include <linux/workqueue.h> 15#include <linux/workqueue.h>
@@ -44,6 +41,9 @@ struct s3c24xx_spi {
44 int len; 41 int len;
45 int count; 42 int count;
46 43
44 int (*set_cs)(struct s3c2410_spi_info *spi,
45 int cs, int pol);
46
47 /* data buffers */ 47 /* data buffers */
48 const unsigned char *tx; 48 const unsigned char *tx;
49 unsigned char *rx; 49 unsigned char *rx;
@@ -64,6 +64,11 @@ static inline struct s3c24xx_spi *to_hw(struct spi_device *sdev)
64 return spi_master_get_devdata(sdev->master); 64 return spi_master_get_devdata(sdev->master);
65} 65}
66 66
67static void s3c24xx_spi_gpiocs(struct s3c2410_spi_info *spi, int cs, int pol)
68{
69 s3c2410_gpio_setpin(spi->pin_cs, pol);
70}
71
67static void s3c24xx_spi_chipsel(struct spi_device *spi, int value) 72static void s3c24xx_spi_chipsel(struct spi_device *spi, int value)
68{ 73{
69 struct s3c24xx_spi *hw = to_hw(spi); 74 struct s3c24xx_spi *hw = to_hw(spi);
@@ -72,10 +77,7 @@ static void s3c24xx_spi_chipsel(struct spi_device *spi, int value)
72 77
73 switch (value) { 78 switch (value) {
74 case BITBANG_CS_INACTIVE: 79 case BITBANG_CS_INACTIVE:
75 if (hw->pdata->set_cs) 80 hw->pdata->set_cs(hw->pdata, spi->chip_select, cspol^1);
76 hw->pdata->set_cs(hw->pdata, value, cspol);
77 else
78 s3c2410_gpio_setpin(hw->pdata->pin_cs, cspol ^ 1);
79 break; 81 break;
80 82
81 case BITBANG_CS_ACTIVE: 83 case BITBANG_CS_ACTIVE:
@@ -96,14 +98,9 @@ static void s3c24xx_spi_chipsel(struct spi_device *spi, int value)
96 /* write new configration */ 98 /* write new configration */
97 99
98 writeb(spcon, hw->regs + S3C2410_SPCON); 100 writeb(spcon, hw->regs + S3C2410_SPCON);
99 101 hw->pdata->set_cs(hw->pdata, spi->chip_select, cspol);
100 if (hw->pdata->set_cs)
101 hw->pdata->set_cs(hw->pdata, value, cspol);
102 else
103 s3c2410_gpio_setpin(hw->pdata->pin_cs, cspol);
104 102
105 break; 103 break;
106
107 } 104 }
108} 105}
109 106
@@ -330,9 +327,12 @@ static int s3c24xx_spi_probe(struct platform_device *pdev)
330 /* setup any gpio we can */ 327 /* setup any gpio we can */
331 328
332 if (!hw->pdata->set_cs) { 329 if (!hw->pdata->set_cs) {
330 hw->set_cs = s3c24xx_spi_gpiocs;
331
333 s3c2410_gpio_setpin(hw->pdata->pin_cs, 1); 332 s3c2410_gpio_setpin(hw->pdata->pin_cs, 1);
334 s3c2410_gpio_cfgpin(hw->pdata->pin_cs, S3C2410_GPIO_OUTPUT); 333 s3c2410_gpio_cfgpin(hw->pdata->pin_cs, S3C2410_GPIO_OUTPUT);
335 } 334 } else
335 hw->set_cs = hw->pdata->set_cs;
336 336
337 /* register our spi controller */ 337 /* register our spi controller */
338 338
diff --git a/drivers/usb/input/hid-core.c b/drivers/usb/input/hid-core.c
index ea3636d96e1b..c6c9e72e5fd9 100644
--- a/drivers/usb/input/hid-core.c
+++ b/drivers/usb/input/hid-core.c
@@ -56,11 +56,6 @@ static unsigned int hid_mousepoll_interval;
56module_param_named(mousepoll, hid_mousepoll_interval, uint, 0644); 56module_param_named(mousepoll, hid_mousepoll_interval, uint, 0644);
57MODULE_PARM_DESC(mousepoll, "Polling interval of mice"); 57MODULE_PARM_DESC(mousepoll, "Polling interval of mice");
58 58
59static int usbhid_pb_fnmode = 1;
60module_param_named(pb_fnmode, usbhid_pb_fnmode, int, 0644);
61MODULE_PARM_DESC(pb_fnmode,
62 "Mode of fn key on PowerBooks (0 = disabled, 1 = fkeyslast, 2 = fkeysfirst)");
63
64/* 59/*
65 * Input submission and I/O error handler. 60 * Input submission and I/O error handler.
66 */ 61 */
@@ -582,7 +577,6 @@ void usbhid_init_reports(struct hid_device *hid)
582} 577}
583 578
584#define USB_VENDOR_ID_GTCO 0x078c 579#define USB_VENDOR_ID_GTCO 0x078c
585#define USB_VENDOR_ID_GTCO_IPANEL_1 0x08ca
586#define USB_VENDOR_ID_GTCO_IPANEL_2 0x5543 580#define USB_VENDOR_ID_GTCO_IPANEL_2 0x5543
587#define USB_DEVICE_ID_GTCO_90 0x0090 581#define USB_DEVICE_ID_GTCO_90 0x0090
588#define USB_DEVICE_ID_GTCO_100 0x0100 582#define USB_DEVICE_ID_GTCO_100 0x0100
@@ -629,7 +623,6 @@ void usbhid_init_reports(struct hid_device *hid)
629#define USB_DEVICE_ID_GTCO_1004 0x1004 623#define USB_DEVICE_ID_GTCO_1004 0x1004
630#define USB_DEVICE_ID_GTCO_1005 0x1005 624#define USB_DEVICE_ID_GTCO_1005 0x1005
631#define USB_DEVICE_ID_GTCO_1006 0x1006 625#define USB_DEVICE_ID_GTCO_1006 0x1006
632#define USB_DEVICE_ID_GTCO_10 0x0010
633#define USB_DEVICE_ID_GTCO_8 0x0008 626#define USB_DEVICE_ID_GTCO_8 0x0008
634#define USB_DEVICE_ID_GTCO_d 0x000d 627#define USB_DEVICE_ID_GTCO_d 0x000d
635 628
@@ -883,7 +876,6 @@ static const struct hid_blacklist {
883 { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1004, HID_QUIRK_IGNORE }, 876 { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1004, HID_QUIRK_IGNORE },
884 { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1005, HID_QUIRK_IGNORE }, 877 { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1005, HID_QUIRK_IGNORE },
885 { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1006, HID_QUIRK_IGNORE }, 878 { USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1006, HID_QUIRK_IGNORE },
886 { USB_VENDOR_ID_GTCO_IPANEL_1, USB_DEVICE_ID_GTCO_10, HID_QUIRK_IGNORE },
887 { USB_VENDOR_ID_GTCO_IPANEL_2, USB_DEVICE_ID_GTCO_8, HID_QUIRK_IGNORE }, 879 { USB_VENDOR_ID_GTCO_IPANEL_2, USB_DEVICE_ID_GTCO_8, HID_QUIRK_IGNORE },
888 { USB_VENDOR_ID_GTCO_IPANEL_2, USB_DEVICE_ID_GTCO_d, HID_QUIRK_IGNORE }, 880 { USB_VENDOR_ID_GTCO_IPANEL_2, USB_DEVICE_ID_GTCO_d, HID_QUIRK_IGNORE },
889 { USB_VENDOR_ID_IMATION, USB_DEVICE_ID_DISC_STAKKA, HID_QUIRK_IGNORE }, 881 { USB_VENDOR_ID_IMATION, USB_DEVICE_ID_DISC_STAKKA, HID_QUIRK_IGNORE },
@@ -1249,10 +1241,6 @@ static struct hid_device *usb_hid_configure(struct usb_interface *intf)
1249 hid->hiddev_hid_event = hiddev_hid_event; 1241 hid->hiddev_hid_event = hiddev_hid_event;
1250 hid->hiddev_report_event = hiddev_report_event; 1242 hid->hiddev_report_event = hiddev_report_event;
1251#endif 1243#endif
1252#ifdef CONFIG_USB_HIDINPUT_POWERBOOK
1253 hid->pb_fnmode = usbhid_pb_fnmode;
1254#endif
1255
1256 return hid; 1244 return hid;
1257 1245
1258fail: 1246fail:
diff --git a/drivers/usb/net/rtl8150.c b/drivers/usb/net/rtl8150.c
index e0eecda78ec1..670262a38a0f 100644
--- a/drivers/usb/net/rtl8150.c
+++ b/drivers/usb/net/rtl8150.c
@@ -284,7 +284,8 @@ static int write_mii_word(rtl8150_t * dev, u8 phy, __u8 indx, u16 reg)
284 u8 data[3], tmp; 284 u8 data[3], tmp;
285 285
286 data[0] = phy; 286 data[0] = phy;
287 *(data + 1) = cpu_to_le16p(&reg); 287 data[1] = reg & 0xff;
288 data[2] = (reg >> 8) & 0xff;
288 tmp = indx | PHY_WRITE | PHY_GO; 289 tmp = indx | PHY_WRITE | PHY_GO;
289 i = 0; 290 i = 0;
290 291
diff --git a/drivers/usb/serial/funsoft.c b/drivers/usb/serial/funsoft.c
index 31501c9361b9..2bebd63d5ed1 100644
--- a/drivers/usb/serial/funsoft.c
+++ b/drivers/usb/serial/funsoft.c
@@ -27,7 +27,7 @@ MODULE_DEVICE_TABLE(usb, id_table);
27static int funsoft_ioctl(struct usb_serial_port *port, struct file *file, 27static int funsoft_ioctl(struct usb_serial_port *port, struct file *file,
28 unsigned int cmd, unsigned long arg) 28 unsigned int cmd, unsigned long arg)
29{ 29{
30 struct termios t; 30 struct ktermios t;
31 31
32 dbg("%s - port %d, cmd 0x%04x", __FUNCTION__, port->number, cmd); 32 dbg("%s - port %d, cmd 0x%04x", __FUNCTION__, port->number, cmd);
33 33
diff --git a/fs/9p/error.c b/fs/9p/error.c
index ae91555c1558..0d7fa4e08812 100644
--- a/fs/9p/error.c
+++ b/fs/9p/error.c
@@ -83,6 +83,7 @@ int v9fs_errstr2errno(char *errstr, int len)
83 83
84 if (errno == 0) { 84 if (errno == 0) {
85 /* TODO: if error isn't found, add it dynamically */ 85 /* TODO: if error isn't found, add it dynamically */
86 errstr[len] = 0;
86 printk(KERN_ERR "%s: errstr :%s: not found\n", __FUNCTION__, 87 printk(KERN_ERR "%s: errstr :%s: not found\n", __FUNCTION__,
87 errstr); 88 errstr);
88 errno = 1; 89 errno = 1;
diff --git a/fs/9p/fid.c b/fs/9p/fid.c
index 27507201f9e7..a9b6301a04fc 100644
--- a/fs/9p/fid.c
+++ b/fs/9p/fid.c
@@ -25,6 +25,7 @@
25#include <linux/fs.h> 25#include <linux/fs.h>
26#include <linux/sched.h> 26#include <linux/sched.h>
27#include <linux/idr.h> 27#include <linux/idr.h>
28#include <asm/semaphore.h>
28 29
29#include "debug.h" 30#include "debug.h"
30#include "v9fs.h" 31#include "v9fs.h"
@@ -84,6 +85,7 @@ struct v9fs_fid *v9fs_fid_create(struct v9fs_session_info *v9ses, int fid)
84 new->iounit = 0; 85 new->iounit = 0;
85 new->rdir_pos = 0; 86 new->rdir_pos = 0;
86 new->rdir_fcall = NULL; 87 new->rdir_fcall = NULL;
88 init_MUTEX(&new->lock);
87 INIT_LIST_HEAD(&new->list); 89 INIT_LIST_HEAD(&new->list);
88 90
89 return new; 91 return new;
@@ -102,11 +104,11 @@ void v9fs_fid_destroy(struct v9fs_fid *fid)
102} 104}
103 105
104/** 106/**
105 * v9fs_fid_lookup - retrieve the right fid from a particular dentry 107 * v9fs_fid_lookup - return a locked fid from a dentry
106 * @dentry: dentry to look for fid in 108 * @dentry: dentry to look for fid in
107 * @type: intent of lookup (operation or traversal)
108 * 109 *
109 * find a fid in the dentry 110 * find a fid in the dentry, obtain its semaphore and return a reference to it.
111 * code calling lookup is responsible for releasing lock
110 * 112 *
111 * TODO: only match fids that have the same uid as current user 113 * TODO: only match fids that have the same uid as current user
112 * 114 *
@@ -124,7 +126,68 @@ struct v9fs_fid *v9fs_fid_lookup(struct dentry *dentry)
124 126
125 if (!return_fid) { 127 if (!return_fid) {
126 dprintk(DEBUG_ERROR, "Couldn't find a fid in dentry\n"); 128 dprintk(DEBUG_ERROR, "Couldn't find a fid in dentry\n");
129 return_fid = ERR_PTR(-EBADF);
127 } 130 }
128 131
132 if(down_interruptible(&return_fid->lock))
133 return ERR_PTR(-EINTR);
134
129 return return_fid; 135 return return_fid;
130} 136}
137
138/**
139 * v9fs_fid_clone - lookup the fid for a dentry, clone a private copy and release it
140 * @dentry: dentry to look for fid in
141 *
142 * find a fid in the dentry and then clone to a new private fid
143 *
144 * TODO: only match fids that have the same uid as current user
145 *
146 */
147
148struct v9fs_fid *v9fs_fid_clone(struct dentry *dentry)
149{
150 struct v9fs_session_info *v9ses = v9fs_inode2v9ses(dentry->d_inode);
151 struct v9fs_fid *base_fid, *new_fid = ERR_PTR(-EBADF);
152 struct v9fs_fcall *fcall = NULL;
153 int fid, err;
154
155 base_fid = v9fs_fid_lookup(dentry);
156
157 if(IS_ERR(base_fid))
158 return base_fid;
159
160 if(base_fid) { /* clone fid */
161 fid = v9fs_get_idpool(&v9ses->fidpool);
162 if (fid < 0) {
163 eprintk(KERN_WARNING, "newfid fails!\n");
164 new_fid = ERR_PTR(-ENOSPC);
165 goto Release_Fid;
166 }
167
168 err = v9fs_t_walk(v9ses, base_fid->fid, fid, NULL, &fcall);
169 if (err < 0) {
170 dprintk(DEBUG_ERROR, "clone walk didn't work\n");
171 v9fs_put_idpool(fid, &v9ses->fidpool);
172 new_fid = ERR_PTR(err);
173 goto Free_Fcall;
174 }
175 new_fid = v9fs_fid_create(v9ses, fid);
176 if (new_fid == NULL) {
177 dprintk(DEBUG_ERROR, "out of memory\n");
178 new_fid = ERR_PTR(-ENOMEM);
179 }
180Free_Fcall:
181 kfree(fcall);
182 }
183
184Release_Fid:
185 up(&base_fid->lock);
186 return new_fid;
187}
188
189void v9fs_fid_clunk(struct v9fs_session_info *v9ses, struct v9fs_fid *fid)
190{
191 v9fs_t_clunk(v9ses, fid->fid);
192 v9fs_fid_destroy(fid);
193}
diff --git a/fs/9p/fid.h b/fs/9p/fid.h
index aa974d6875c3..48fc170c26c8 100644
--- a/fs/9p/fid.h
+++ b/fs/9p/fid.h
@@ -30,6 +30,8 @@ struct v9fs_fid {
30 struct list_head list; /* list of fids associated with a dentry */ 30 struct list_head list; /* list of fids associated with a dentry */
31 struct list_head active; /* XXX - debug */ 31 struct list_head active; /* XXX - debug */
32 32
33 struct semaphore lock;
34
33 u32 fid; 35 u32 fid;
34 unsigned char fidopen; /* set when fid is opened */ 36 unsigned char fidopen; /* set when fid is opened */
35 unsigned char fidclunked; /* set when fid has already been clunked */ 37 unsigned char fidclunked; /* set when fid has already been clunked */
@@ -55,3 +57,6 @@ struct v9fs_fid *v9fs_fid_get_created(struct dentry *);
55void v9fs_fid_destroy(struct v9fs_fid *fid); 57void v9fs_fid_destroy(struct v9fs_fid *fid);
56struct v9fs_fid *v9fs_fid_create(struct v9fs_session_info *, int fid); 58struct v9fs_fid *v9fs_fid_create(struct v9fs_session_info *, int fid);
57int v9fs_fid_insert(struct v9fs_fid *fid, struct dentry *dentry); 59int v9fs_fid_insert(struct v9fs_fid *fid, struct dentry *dentry);
60struct v9fs_fid *v9fs_fid_clone(struct dentry *dentry);
61void v9fs_fid_clunk(struct v9fs_session_info *v9ses, struct v9fs_fid *fid);
62
diff --git a/fs/9p/mux.c b/fs/9p/mux.c
index 944273c3dbff..147ceef8e537 100644
--- a/fs/9p/mux.c
+++ b/fs/9p/mux.c
@@ -132,8 +132,10 @@ int v9fs_mux_global_init(void)
132 v9fs_mux_poll_tasks[i].task = NULL; 132 v9fs_mux_poll_tasks[i].task = NULL;
133 133
134 v9fs_mux_wq = create_workqueue("v9fs"); 134 v9fs_mux_wq = create_workqueue("v9fs");
135 if (!v9fs_mux_wq) 135 if (!v9fs_mux_wq) {
136 printk(KERN_WARNING "v9fs: mux: creating workqueue failed\n");
136 return -ENOMEM; 137 return -ENOMEM;
138 }
137 139
138 return 0; 140 return 0;
139} 141}
diff --git a/fs/9p/v9fs.c b/fs/9p/v9fs.c
index 0b96fae8b479..d9b561ba5e58 100644
--- a/fs/9p/v9fs.c
+++ b/fs/9p/v9fs.c
@@ -457,14 +457,19 @@ static int __init init_v9fs(void)
457 457
458 v9fs_error_init(); 458 v9fs_error_init();
459 459
460 printk(KERN_INFO "Installing v9fs 9P2000 file system support\n"); 460 printk(KERN_INFO "Installing v9fs 9p2000 file system support\n");
461 461
462 ret = v9fs_mux_global_init(); 462 ret = v9fs_mux_global_init();
463 if (!ret) 463 if (ret) {
464 printk(KERN_WARNING "v9fs: starting mux failed\n");
464 return ret; 465 return ret;
466 }
465 ret = register_filesystem(&v9fs_fs_type); 467 ret = register_filesystem(&v9fs_fs_type);
466 if (!ret) 468 if (ret) {
469 printk(KERN_WARNING "v9fs: registering file system failed\n");
467 v9fs_mux_global_exit(); 470 v9fs_mux_global_exit();
471 }
472
468 return ret; 473 return ret;
469} 474}
470 475
diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c
index e86a07151280..9f17b0cacdd0 100644
--- a/fs/9p/vfs_file.c
+++ b/fs/9p/vfs_file.c
@@ -55,53 +55,22 @@ int v9fs_file_open(struct inode *inode, struct file *file)
55 struct v9fs_fid *vfid; 55 struct v9fs_fid *vfid;
56 struct v9fs_fcall *fcall = NULL; 56 struct v9fs_fcall *fcall = NULL;
57 int omode; 57 int omode;
58 int fid = V9FS_NOFID;
59 int err; 58 int err;
60 59
61 dprintk(DEBUG_VFS, "inode: %p file: %p \n", inode, file); 60 dprintk(DEBUG_VFS, "inode: %p file: %p \n", inode, file);
62 61
63 vfid = v9fs_fid_lookup(file->f_path.dentry); 62 vfid = v9fs_fid_clone(file->f_path.dentry);
64 if (!vfid) { 63 if (IS_ERR(vfid))
65 dprintk(DEBUG_ERROR, "Couldn't resolve fid from dentry\n"); 64 return PTR_ERR(vfid);
66 return -EBADF;
67 }
68
69 fid = v9fs_get_idpool(&v9ses->fidpool);
70 if (fid < 0) {
71 eprintk(KERN_WARNING, "newfid fails!\n");
72 return -ENOSPC;
73 }
74 65
75 err = v9fs_t_walk(v9ses, vfid->fid, fid, NULL, &fcall);
76 if (err < 0) {
77 dprintk(DEBUG_ERROR, "rewalk didn't work\n");
78 if (fcall && fcall->id == RWALK)
79 goto clunk_fid;
80 else {
81 v9fs_put_idpool(fid, &v9ses->fidpool);
82 goto free_fcall;
83 }
84 }
85 kfree(fcall);
86
87 /* TODO: do special things for O_EXCL, O_NOFOLLOW, O_SYNC */
88 /* translate open mode appropriately */
89 omode = v9fs_uflags2omode(file->f_flags); 66 omode = v9fs_uflags2omode(file->f_flags);
90 err = v9fs_t_open(v9ses, fid, omode, &fcall); 67 err = v9fs_t_open(v9ses, vfid->fid, omode, &fcall);
91 if (err < 0) { 68 if (err < 0) {
92 PRINT_FCALL_ERROR("open failed", fcall); 69 PRINT_FCALL_ERROR("open failed", fcall);
93 goto clunk_fid; 70 goto Clunk_Fid;
94 }
95
96 vfid = kmalloc(sizeof(struct v9fs_fid), GFP_KERNEL);
97 if (vfid == NULL) {
98 dprintk(DEBUG_ERROR, "out of memory\n");
99 err = -ENOMEM;
100 goto clunk_fid;
101 } 71 }
102 72
103 file->private_data = vfid; 73 file->private_data = vfid;
104 vfid->fid = fid;
105 vfid->fidopen = 1; 74 vfid->fidopen = 1;
106 vfid->fidclunked = 0; 75 vfid->fidclunked = 0;
107 vfid->iounit = fcall->params.ropen.iounit; 76 vfid->iounit = fcall->params.ropen.iounit;
@@ -112,10 +81,8 @@ int v9fs_file_open(struct inode *inode, struct file *file)
112 81
113 return 0; 82 return 0;
114 83
115clunk_fid: 84Clunk_Fid:
116 v9fs_t_clunk(v9ses, fid); 85 v9fs_fid_clunk(v9ses, vfid);
117
118free_fcall:
119 kfree(fcall); 86 kfree(fcall);
120 87
121 return err; 88 return err;
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c
index 18f26cdfd882..9109ba1d6969 100644
--- a/fs/9p/vfs_inode.c
+++ b/fs/9p/vfs_inode.c
@@ -416,12 +416,8 @@ static int v9fs_remove(struct inode *dir, struct dentry *file, int rmdir)
416 sb = file_inode->i_sb; 416 sb = file_inode->i_sb;
417 v9ses = v9fs_inode2v9ses(file_inode); 417 v9ses = v9fs_inode2v9ses(file_inode);
418 v9fid = v9fs_fid_lookup(file); 418 v9fid = v9fs_fid_lookup(file);
419 419 if(IS_ERR(v9fid))
420 if (!v9fid) { 420 return PTR_ERR(v9fid);
421 dprintk(DEBUG_ERROR,
422 "no v9fs_fid\n");
423 return -EBADF;
424 }
425 421
426 fid = v9fid->fid; 422 fid = v9fid->fid;
427 if (fid < 0) { 423 if (fid < 0) {
@@ -433,11 +429,13 @@ static int v9fs_remove(struct inode *dir, struct dentry *file, int rmdir)
433 result = v9fs_t_remove(v9ses, fid, &fcall); 429 result = v9fs_t_remove(v9ses, fid, &fcall);
434 if (result < 0) { 430 if (result < 0) {
435 PRINT_FCALL_ERROR("remove fails", fcall); 431 PRINT_FCALL_ERROR("remove fails", fcall);
432 goto Error;
436 } 433 }
437 434
438 v9fs_put_idpool(fid, &v9ses->fidpool); 435 v9fs_put_idpool(fid, &v9ses->fidpool);
439 v9fs_fid_destroy(v9fid); 436 v9fs_fid_destroy(v9fid);
440 437
438Error:
441 kfree(fcall); 439 kfree(fcall);
442 return result; 440 return result;
443} 441}
@@ -473,9 +471,13 @@ v9fs_vfs_create(struct inode *dir, struct dentry *dentry, int mode,
473 inode = NULL; 471 inode = NULL;
474 vfid = NULL; 472 vfid = NULL;
475 v9ses = v9fs_inode2v9ses(dir); 473 v9ses = v9fs_inode2v9ses(dir);
476 dfid = v9fs_fid_lookup(dentry->d_parent); 474 dfid = v9fs_fid_clone(dentry->d_parent);
477 perm = unixmode2p9mode(v9ses, mode); 475 if(IS_ERR(dfid)) {
476 err = PTR_ERR(dfid);
477 goto error;
478 }
478 479
480 perm = unixmode2p9mode(v9ses, mode);
479 if (nd && nd->flags & LOOKUP_OPEN) 481 if (nd && nd->flags & LOOKUP_OPEN)
480 flags = nd->intent.open.flags - 1; 482 flags = nd->intent.open.flags - 1;
481 else 483 else
@@ -485,9 +487,10 @@ v9fs_vfs_create(struct inode *dir, struct dentry *dentry, int mode,
485 perm, v9fs_uflags2omode(flags), NULL, &fid, &qid, &iounit); 487 perm, v9fs_uflags2omode(flags), NULL, &fid, &qid, &iounit);
486 488
487 if (err) 489 if (err)
488 goto error; 490 goto clunk_dfid;
489 491
490 vfid = v9fs_clone_walk(v9ses, dfid->fid, dentry); 492 vfid = v9fs_clone_walk(v9ses, dfid->fid, dentry);
493 v9fs_fid_clunk(v9ses, dfid);
491 if (IS_ERR(vfid)) { 494 if (IS_ERR(vfid)) {
492 err = PTR_ERR(vfid); 495 err = PTR_ERR(vfid);
493 vfid = NULL; 496 vfid = NULL;
@@ -525,6 +528,9 @@ v9fs_vfs_create(struct inode *dir, struct dentry *dentry, int mode,
525 528
526 return 0; 529 return 0;
527 530
531clunk_dfid:
532 v9fs_fid_clunk(v9ses, dfid);
533
528error: 534error:
529 if (vfid) 535 if (vfid)
530 v9fs_fid_destroy(vfid); 536 v9fs_fid_destroy(vfid);
@@ -551,7 +557,12 @@ static int v9fs_vfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
551 inode = NULL; 557 inode = NULL;
552 vfid = NULL; 558 vfid = NULL;
553 v9ses = v9fs_inode2v9ses(dir); 559 v9ses = v9fs_inode2v9ses(dir);
554 dfid = v9fs_fid_lookup(dentry->d_parent); 560 dfid = v9fs_fid_clone(dentry->d_parent);
561 if(IS_ERR(dfid)) {
562 err = PTR_ERR(dfid);
563 goto error;
564 }
565
555 perm = unixmode2p9mode(v9ses, mode | S_IFDIR); 566 perm = unixmode2p9mode(v9ses, mode | S_IFDIR);
556 567
557 err = v9fs_create(v9ses, dfid->fid, (char *) dentry->d_name.name, 568 err = v9fs_create(v9ses, dfid->fid, (char *) dentry->d_name.name,
@@ -559,37 +570,36 @@ static int v9fs_vfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
559 570
560 if (err) { 571 if (err) {
561 dprintk(DEBUG_ERROR, "create error %d\n", err); 572 dprintk(DEBUG_ERROR, "create error %d\n", err);
562 goto error; 573 goto clean_up_dfid;
563 }
564
565 err = v9fs_t_clunk(v9ses, fid);
566 if (err) {
567 dprintk(DEBUG_ERROR, "clunk error %d\n", err);
568 goto error;
569 } 574 }
570 575
571 vfid = v9fs_clone_walk(v9ses, dfid->fid, dentry); 576 vfid = v9fs_clone_walk(v9ses, dfid->fid, dentry);
572 if (IS_ERR(vfid)) { 577 if (IS_ERR(vfid)) {
573 err = PTR_ERR(vfid); 578 err = PTR_ERR(vfid);
574 vfid = NULL; 579 vfid = NULL;
575 goto error; 580 goto clean_up_dfid;
576 } 581 }
577 582
583 v9fs_fid_clunk(v9ses, dfid);
578 inode = v9fs_inode_from_fid(v9ses, vfid->fid, dir->i_sb); 584 inode = v9fs_inode_from_fid(v9ses, vfid->fid, dir->i_sb);
579 if (IS_ERR(inode)) { 585 if (IS_ERR(inode)) {
580 err = PTR_ERR(inode); 586 err = PTR_ERR(inode);
581 inode = NULL; 587 inode = NULL;
582 goto error; 588 goto clean_up_fids;
583 } 589 }
584 590
585 dentry->d_op = &v9fs_dentry_operations; 591 dentry->d_op = &v9fs_dentry_operations;
586 d_instantiate(dentry, inode); 592 d_instantiate(dentry, inode);
587 return 0; 593 return 0;
588 594
589error: 595clean_up_fids:
590 if (vfid) 596 if (vfid)
591 v9fs_fid_destroy(vfid); 597 v9fs_fid_destroy(vfid);
592 598
599clean_up_dfid:
600 v9fs_fid_clunk(v9ses, dfid);
601
602error:
593 return err; 603 return err;
594} 604}
595 605
@@ -622,28 +632,23 @@ static struct dentry *v9fs_vfs_lookup(struct inode *dir, struct dentry *dentry,
622 dentry->d_op = &v9fs_dentry_operations; 632 dentry->d_op = &v9fs_dentry_operations;
623 dirfid = v9fs_fid_lookup(dentry->d_parent); 633 dirfid = v9fs_fid_lookup(dentry->d_parent);
624 634
625 if (!dirfid) { 635 if(IS_ERR(dirfid))
626 dprintk(DEBUG_ERROR, "no dirfid\n"); 636 return ERR_PTR(PTR_ERR(dirfid));
627 return ERR_PTR(-EINVAL);
628 }
629 637
630 dirfidnum = dirfid->fid; 638 dirfidnum = dirfid->fid;
631 639
632 if (dirfidnum < 0) {
633 dprintk(DEBUG_ERROR, "no dirfid for inode %p, #%lu\n",
634 dir, dir->i_ino);
635 return ERR_PTR(-EBADF);
636 }
637
638 newfid = v9fs_get_idpool(&v9ses->fidpool); 640 newfid = v9fs_get_idpool(&v9ses->fidpool);
639 if (newfid < 0) { 641 if (newfid < 0) {
640 eprintk(KERN_WARNING, "newfid fails!\n"); 642 eprintk(KERN_WARNING, "newfid fails!\n");
641 return ERR_PTR(-ENOSPC); 643 result = -ENOSPC;
644 goto Release_Dirfid;
642 } 645 }
643 646
644 result = v9fs_t_walk(v9ses, dirfidnum, newfid, 647 result = v9fs_t_walk(v9ses, dirfidnum, newfid,
645 (char *)dentry->d_name.name, &fcall); 648 (char *)dentry->d_name.name, &fcall);
646 649
650 up(&dirfid->lock);
651
647 if (result < 0) { 652 if (result < 0) {
648 if (fcall && fcall->id == RWALK) 653 if (fcall && fcall->id == RWALK)
649 v9fs_t_clunk(v9ses, newfid); 654 v9fs_t_clunk(v9ses, newfid);
@@ -701,8 +706,12 @@ static struct dentry *v9fs_vfs_lookup(struct inode *dir, struct dentry *dentry,
701 706
702 return NULL; 707 return NULL;
703 708
704 FreeFcall: 709Release_Dirfid:
710 up(&dirfid->lock);
711
712FreeFcall:
705 kfree(fcall); 713 kfree(fcall);
714
706 return ERR_PTR(result); 715 return ERR_PTR(result);
707} 716}
708 717
@@ -746,10 +755,8 @@ v9fs_vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
746 struct inode *old_inode = old_dentry->d_inode; 755 struct inode *old_inode = old_dentry->d_inode;
747 struct v9fs_session_info *v9ses = v9fs_inode2v9ses(old_inode); 756 struct v9fs_session_info *v9ses = v9fs_inode2v9ses(old_inode);
748 struct v9fs_fid *oldfid = v9fs_fid_lookup(old_dentry); 757 struct v9fs_fid *oldfid = v9fs_fid_lookup(old_dentry);
749 struct v9fs_fid *olddirfid = 758 struct v9fs_fid *olddirfid;
750 v9fs_fid_lookup(old_dentry->d_parent); 759 struct v9fs_fid *newdirfid;
751 struct v9fs_fid *newdirfid =
752 v9fs_fid_lookup(new_dentry->d_parent);
753 struct v9fs_wstat wstat; 760 struct v9fs_wstat wstat;
754 struct v9fs_fcall *fcall = NULL; 761 struct v9fs_fcall *fcall = NULL;
755 int fid = -1; 762 int fid = -1;
@@ -759,16 +766,26 @@ v9fs_vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
759 766
760 dprintk(DEBUG_VFS, "\n"); 767 dprintk(DEBUG_VFS, "\n");
761 768
762 if ((!oldfid) || (!olddirfid) || (!newdirfid)) { 769 if(IS_ERR(oldfid))
763 dprintk(DEBUG_ERROR, "problem with arguments\n"); 770 return PTR_ERR(oldfid);
764 return -EBADF; 771
772 olddirfid = v9fs_fid_clone(old_dentry->d_parent);
773 if(IS_ERR(olddirfid)) {
774 retval = PTR_ERR(olddirfid);
775 goto Release_lock;
776 }
777
778 newdirfid = v9fs_fid_clone(new_dentry->d_parent);
779 if(IS_ERR(newdirfid)) {
780 retval = PTR_ERR(newdirfid);
781 goto Clunk_olddir;
765 } 782 }
766 783
767 /* 9P can only handle file rename in the same directory */ 784 /* 9P can only handle file rename in the same directory */
768 if (memcmp(&olddirfid->qid, &newdirfid->qid, sizeof(newdirfid->qid))) { 785 if (memcmp(&olddirfid->qid, &newdirfid->qid, sizeof(newdirfid->qid))) {
769 dprintk(DEBUG_ERROR, "old dir and new dir are different\n"); 786 dprintk(DEBUG_ERROR, "old dir and new dir are different\n");
770 retval = -EPERM; 787 retval = -EXDEV;
771 goto FreeFcallnBail; 788 goto Clunk_newdir;
772 } 789 }
773 790
774 fid = oldfid->fid; 791 fid = oldfid->fid;
@@ -779,7 +796,7 @@ v9fs_vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
779 dprintk(DEBUG_ERROR, "no fid for old file #%lu\n", 796 dprintk(DEBUG_ERROR, "no fid for old file #%lu\n",
780 old_inode->i_ino); 797 old_inode->i_ino);
781 retval = -EBADF; 798 retval = -EBADF;
782 goto FreeFcallnBail; 799 goto Clunk_newdir;
783 } 800 }
784 801
785 v9fs_blank_wstat(&wstat); 802 v9fs_blank_wstat(&wstat);
@@ -788,11 +805,20 @@ v9fs_vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
788 805
789 retval = v9fs_t_wstat(v9ses, fid, &wstat, &fcall); 806 retval = v9fs_t_wstat(v9ses, fid, &wstat, &fcall);
790 807
791 FreeFcallnBail:
792 if (retval < 0) 808 if (retval < 0)
793 PRINT_FCALL_ERROR("wstat error", fcall); 809 PRINT_FCALL_ERROR("wstat error", fcall);
794 810
795 kfree(fcall); 811 kfree(fcall);
812
813Clunk_newdir:
814 v9fs_fid_clunk(v9ses, newdirfid);
815
816Clunk_olddir:
817 v9fs_fid_clunk(v9ses, olddirfid);
818
819Release_lock:
820 up(&oldfid->lock);
821
796 return retval; 822 return retval;
797} 823}
798 824
@@ -810,15 +836,12 @@ v9fs_vfs_getattr(struct vfsmount *mnt, struct dentry *dentry,
810{ 836{
811 struct v9fs_fcall *fcall = NULL; 837 struct v9fs_fcall *fcall = NULL;
812 struct v9fs_session_info *v9ses = v9fs_inode2v9ses(dentry->d_inode); 838 struct v9fs_session_info *v9ses = v9fs_inode2v9ses(dentry->d_inode);
813 struct v9fs_fid *fid = v9fs_fid_lookup(dentry); 839 struct v9fs_fid *fid = v9fs_fid_clone(dentry);
814 int err = -EPERM; 840 int err = -EPERM;
815 841
816 dprintk(DEBUG_VFS, "dentry: %p\n", dentry); 842 dprintk(DEBUG_VFS, "dentry: %p\n", dentry);
817 if (!fid) { 843 if(IS_ERR(fid))
818 dprintk(DEBUG_ERROR, 844 return PTR_ERR(fid);
819 "couldn't find fid associated with dentry\n");
820 return -EBADF;
821 }
822 845
823 err = v9fs_t_stat(v9ses, fid->fid, &fcall); 846 err = v9fs_t_stat(v9ses, fid->fid, &fcall);
824 847
@@ -831,6 +854,7 @@ v9fs_vfs_getattr(struct vfsmount *mnt, struct dentry *dentry,
831 } 854 }
832 855
833 kfree(fcall); 856 kfree(fcall);
857 v9fs_fid_clunk(v9ses, fid);
834 return err; 858 return err;
835} 859}
836 860
@@ -844,18 +868,14 @@ v9fs_vfs_getattr(struct vfsmount *mnt, struct dentry *dentry,
844static int v9fs_vfs_setattr(struct dentry *dentry, struct iattr *iattr) 868static int v9fs_vfs_setattr(struct dentry *dentry, struct iattr *iattr)
845{ 869{
846 struct v9fs_session_info *v9ses = v9fs_inode2v9ses(dentry->d_inode); 870 struct v9fs_session_info *v9ses = v9fs_inode2v9ses(dentry->d_inode);
847 struct v9fs_fid *fid = v9fs_fid_lookup(dentry); 871 struct v9fs_fid *fid = v9fs_fid_clone(dentry);
848 struct v9fs_fcall *fcall = NULL; 872 struct v9fs_fcall *fcall = NULL;
849 struct v9fs_wstat wstat; 873 struct v9fs_wstat wstat;
850 int res = -EPERM; 874 int res = -EPERM;
851 875
852 dprintk(DEBUG_VFS, "\n"); 876 dprintk(DEBUG_VFS, "\n");
853 877 if(IS_ERR(fid))
854 if (!fid) { 878 return PTR_ERR(fid);
855 dprintk(DEBUG_ERROR,
856 "Couldn't find fid associated with dentry\n");
857 return -EBADF;
858 }
859 879
860 v9fs_blank_wstat(&wstat); 880 v9fs_blank_wstat(&wstat);
861 if (iattr->ia_valid & ATTR_MODE) 881 if (iattr->ia_valid & ATTR_MODE)
@@ -887,6 +907,7 @@ static int v9fs_vfs_setattr(struct dentry *dentry, struct iattr *iattr)
887 if (res >= 0) 907 if (res >= 0)
888 res = inode_setattr(dentry->d_inode, iattr); 908 res = inode_setattr(dentry->d_inode, iattr);
889 909
910 v9fs_fid_clunk(v9ses, fid);
890 return res; 911 return res;
891} 912}
892 913
@@ -987,18 +1008,15 @@ static int v9fs_readlink(struct dentry *dentry, char *buffer, int buflen)
987 1008
988 struct v9fs_fcall *fcall = NULL; 1009 struct v9fs_fcall *fcall = NULL;
989 struct v9fs_session_info *v9ses = v9fs_inode2v9ses(dentry->d_inode); 1010 struct v9fs_session_info *v9ses = v9fs_inode2v9ses(dentry->d_inode);
990 struct v9fs_fid *fid = v9fs_fid_lookup(dentry); 1011 struct v9fs_fid *fid = v9fs_fid_clone(dentry);
991 1012
992 if (!fid) { 1013 if(IS_ERR(fid))
993 dprintk(DEBUG_ERROR, "could not resolve fid from dentry\n"); 1014 return PTR_ERR(fid);
994 retval = -EBADF;
995 goto FreeFcall;
996 }
997 1015
998 if (!v9ses->extended) { 1016 if (!v9ses->extended) {
999 retval = -EBADF; 1017 retval = -EBADF;
1000 dprintk(DEBUG_ERROR, "not extended\n"); 1018 dprintk(DEBUG_ERROR, "not extended\n");
1001 goto FreeFcall; 1019 goto ClunkFid;
1002 } 1020 }
1003 1021
1004 dprintk(DEBUG_VFS, " %s\n", dentry->d_name.name); 1022 dprintk(DEBUG_VFS, " %s\n", dentry->d_name.name);
@@ -1009,8 +1027,10 @@ static int v9fs_readlink(struct dentry *dentry, char *buffer, int buflen)
1009 goto FreeFcall; 1027 goto FreeFcall;
1010 } 1028 }
1011 1029
1012 if (!fcall) 1030 if (!fcall) {
1013 return -EIO; 1031 retval = -EIO;
1032 goto ClunkFid;
1033 }
1014 1034
1015 if (!(fcall->params.rstat.stat.mode & V9FS_DMSYMLINK)) { 1035 if (!(fcall->params.rstat.stat.mode & V9FS_DMSYMLINK)) {
1016 retval = -EINVAL; 1036 retval = -EINVAL;
@@ -1028,9 +1048,12 @@ static int v9fs_readlink(struct dentry *dentry, char *buffer, int buflen)
1028 fcall->params.rstat.stat.extension.str, buffer); 1048 fcall->params.rstat.stat.extension.str, buffer);
1029 retval = buflen; 1049 retval = buflen;
1030 1050
1031 FreeFcall: 1051FreeFcall:
1032 kfree(fcall); 1052 kfree(fcall);
1033 1053
1054ClunkFid:
1055 v9fs_fid_clunk(v9ses, fid);
1056
1034 return retval; 1057 return retval;
1035} 1058}
1036 1059
@@ -1123,52 +1146,58 @@ static int v9fs_vfs_mkspecial(struct inode *dir, struct dentry *dentry,
1123 int err; 1146 int err;
1124 u32 fid, perm; 1147 u32 fid, perm;
1125 struct v9fs_session_info *v9ses; 1148 struct v9fs_session_info *v9ses;
1126 struct v9fs_fid *dfid, *vfid; 1149 struct v9fs_fid *dfid, *vfid = NULL;
1127 struct inode *inode; 1150 struct inode *inode = NULL;
1128 1151
1129 inode = NULL;
1130 vfid = NULL;
1131 v9ses = v9fs_inode2v9ses(dir); 1152 v9ses = v9fs_inode2v9ses(dir);
1132 dfid = v9fs_fid_lookup(dentry->d_parent);
1133 perm = unixmode2p9mode(v9ses, mode);
1134
1135 if (!v9ses->extended) { 1153 if (!v9ses->extended) {
1136 dprintk(DEBUG_ERROR, "not extended\n"); 1154 dprintk(DEBUG_ERROR, "not extended\n");
1137 return -EPERM; 1155 return -EPERM;
1138 } 1156 }
1139 1157
1158 dfid = v9fs_fid_clone(dentry->d_parent);
1159 if(IS_ERR(dfid)) {
1160 err = PTR_ERR(dfid);
1161 goto error;
1162 }
1163
1164 perm = unixmode2p9mode(v9ses, mode);
1165
1140 err = v9fs_create(v9ses, dfid->fid, (char *) dentry->d_name.name, 1166 err = v9fs_create(v9ses, dfid->fid, (char *) dentry->d_name.name,
1141 perm, V9FS_OREAD, (char *) extension, &fid, NULL, NULL); 1167 perm, V9FS_OREAD, (char *) extension, &fid, NULL, NULL);
1142 1168
1143 if (err) 1169 if (err)
1144 goto error; 1170 goto clunk_dfid;
1145 1171
1146 err = v9fs_t_clunk(v9ses, fid); 1172 err = v9fs_t_clunk(v9ses, fid);
1147 if (err) 1173 if (err)
1148 goto error; 1174 goto clunk_dfid;
1149 1175
1150 vfid = v9fs_clone_walk(v9ses, dfid->fid, dentry); 1176 vfid = v9fs_clone_walk(v9ses, dfid->fid, dentry);
1151 if (IS_ERR(vfid)) { 1177 if (IS_ERR(vfid)) {
1152 err = PTR_ERR(vfid); 1178 err = PTR_ERR(vfid);
1153 vfid = NULL; 1179 vfid = NULL;
1154 goto error; 1180 goto clunk_dfid;
1155 } 1181 }
1156 1182
1157 inode = v9fs_inode_from_fid(v9ses, vfid->fid, dir->i_sb); 1183 inode = v9fs_inode_from_fid(v9ses, vfid->fid, dir->i_sb);
1158 if (IS_ERR(inode)) { 1184 if (IS_ERR(inode)) {
1159 err = PTR_ERR(inode); 1185 err = PTR_ERR(inode);
1160 inode = NULL; 1186 inode = NULL;
1161 goto error; 1187 goto free_vfid;
1162 } 1188 }
1163 1189
1164 dentry->d_op = &v9fs_dentry_operations; 1190 dentry->d_op = &v9fs_dentry_operations;
1165 d_instantiate(dentry, inode); 1191 d_instantiate(dentry, inode);
1166 return 0; 1192 return 0;
1167 1193
1168error: 1194free_vfid:
1169 if (vfid) 1195 v9fs_fid_destroy(vfid);
1170 v9fs_fid_destroy(vfid); 1196
1197clunk_dfid:
1198 v9fs_fid_clunk(v9ses, dfid);
1171 1199
1200error:
1172 return err; 1201 return err;
1173 1202
1174} 1203}
@@ -1209,26 +1238,29 @@ v9fs_vfs_link(struct dentry *old_dentry, struct inode *dir,
1209 struct dentry *dentry) 1238 struct dentry *dentry)
1210{ 1239{
1211 int retval; 1240 int retval;
1241 struct v9fs_session_info *v9ses = v9fs_inode2v9ses(dir);
1212 struct v9fs_fid *oldfid; 1242 struct v9fs_fid *oldfid;
1213 char *name; 1243 char *name;
1214 1244
1215 dprintk(DEBUG_VFS, " %lu,%s,%s\n", dir->i_ino, dentry->d_name.name, 1245 dprintk(DEBUG_VFS, " %lu,%s,%s\n", dir->i_ino, dentry->d_name.name,
1216 old_dentry->d_name.name); 1246 old_dentry->d_name.name);
1217 1247
1218 oldfid = v9fs_fid_lookup(old_dentry); 1248 oldfid = v9fs_fid_clone(old_dentry);
1219 if (!oldfid) { 1249 if(IS_ERR(oldfid))
1220 dprintk(DEBUG_ERROR, "can't find oldfid\n"); 1250 return PTR_ERR(oldfid);
1221 return -EPERM;
1222 }
1223 1251
1224 name = __getname(); 1252 name = __getname();
1225 if (unlikely(!name)) 1253 if (unlikely(!name)) {
1226 return -ENOMEM; 1254 retval = -ENOMEM;
1255 goto clunk_fid;
1256 }
1227 1257
1228 sprintf(name, "%d\n", oldfid->fid); 1258 sprintf(name, "%d\n", oldfid->fid);
1229 retval = v9fs_vfs_mkspecial(dir, dentry, V9FS_DMLINK, name); 1259 retval = v9fs_vfs_mkspecial(dir, dentry, V9FS_DMLINK, name);
1230 __putname(name); 1260 __putname(name);
1231 1261
1262clunk_fid:
1263 v9fs_fid_clunk(v9ses, oldfid);
1232 return retval; 1264 return retval;
1233} 1265}
1234 1266
diff --git a/fs/aio.c b/fs/aio.c
index ee20fc4240e0..55991e4132a7 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -298,17 +298,23 @@ static void wait_for_all_aios(struct kioctx *ctx)
298 struct task_struct *tsk = current; 298 struct task_struct *tsk = current;
299 DECLARE_WAITQUEUE(wait, tsk); 299 DECLARE_WAITQUEUE(wait, tsk);
300 300
301 spin_lock_irq(&ctx->ctx_lock);
301 if (!ctx->reqs_active) 302 if (!ctx->reqs_active)
302 return; 303 goto out;
303 304
304 add_wait_queue(&ctx->wait, &wait); 305 add_wait_queue(&ctx->wait, &wait);
305 set_task_state(tsk, TASK_UNINTERRUPTIBLE); 306 set_task_state(tsk, TASK_UNINTERRUPTIBLE);
306 while (ctx->reqs_active) { 307 while (ctx->reqs_active) {
308 spin_unlock_irq(&ctx->ctx_lock);
307 schedule(); 309 schedule();
308 set_task_state(tsk, TASK_UNINTERRUPTIBLE); 310 set_task_state(tsk, TASK_UNINTERRUPTIBLE);
311 spin_lock_irq(&ctx->ctx_lock);
309 } 312 }
310 __set_task_state(tsk, TASK_RUNNING); 313 __set_task_state(tsk, TASK_RUNNING);
311 remove_wait_queue(&ctx->wait, &wait); 314 remove_wait_queue(&ctx->wait, &wait);
315
316out:
317 spin_unlock_irq(&ctx->ctx_lock);
312} 318}
313 319
314/* wait_on_sync_kiocb: 320/* wait_on_sync_kiocb:
@@ -424,7 +430,6 @@ static struct kiocb fastcall *__aio_get_req(struct kioctx *ctx)
424 ring = kmap_atomic(ctx->ring_info.ring_pages[0], KM_USER0); 430 ring = kmap_atomic(ctx->ring_info.ring_pages[0], KM_USER0);
425 if (ctx->reqs_active < aio_ring_avail(&ctx->ring_info, ring)) { 431 if (ctx->reqs_active < aio_ring_avail(&ctx->ring_info, ring)) {
426 list_add(&req->ki_list, &ctx->active_reqs); 432 list_add(&req->ki_list, &ctx->active_reqs);
427 get_ioctx(ctx);
428 ctx->reqs_active++; 433 ctx->reqs_active++;
429 okay = 1; 434 okay = 1;
430 } 435 }
@@ -536,8 +541,6 @@ int fastcall aio_put_req(struct kiocb *req)
536 spin_lock_irq(&ctx->ctx_lock); 541 spin_lock_irq(&ctx->ctx_lock);
537 ret = __aio_put_req(ctx, req); 542 ret = __aio_put_req(ctx, req);
538 spin_unlock_irq(&ctx->ctx_lock); 543 spin_unlock_irq(&ctx->ctx_lock);
539 if (ret)
540 put_ioctx(ctx);
541 return ret; 544 return ret;
542} 545}
543 546
@@ -779,8 +782,7 @@ static int __aio_run_iocbs(struct kioctx *ctx)
779 */ 782 */
780 iocb->ki_users++; /* grab extra reference */ 783 iocb->ki_users++; /* grab extra reference */
781 aio_run_iocb(iocb); 784 aio_run_iocb(iocb);
782 if (__aio_put_req(ctx, iocb)) /* drop extra ref */ 785 __aio_put_req(ctx, iocb);
783 put_ioctx(ctx);
784 } 786 }
785 if (!list_empty(&ctx->run_list)) 787 if (!list_empty(&ctx->run_list))
786 return 1; 788 return 1;
@@ -997,14 +999,10 @@ put_rq:
997 /* everything turned out well, dispose of the aiocb. */ 999 /* everything turned out well, dispose of the aiocb. */
998 ret = __aio_put_req(ctx, iocb); 1000 ret = __aio_put_req(ctx, iocb);
999 1001
1000 spin_unlock_irqrestore(&ctx->ctx_lock, flags);
1001
1002 if (waitqueue_active(&ctx->wait)) 1002 if (waitqueue_active(&ctx->wait))
1003 wake_up(&ctx->wait); 1003 wake_up(&ctx->wait);
1004 1004
1005 if (ret) 1005 spin_unlock_irqrestore(&ctx->ctx_lock, flags);
1006 put_ioctx(ctx);
1007
1008 return ret; 1006 return ret;
1009} 1007}
1010 1008
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index 7cb28720f90e..669dbe5b0317 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -682,6 +682,15 @@ static int load_elf_binary(struct linux_binprm *bprm, struct pt_regs *regs)
682 retval = PTR_ERR(interpreter); 682 retval = PTR_ERR(interpreter);
683 if (IS_ERR(interpreter)) 683 if (IS_ERR(interpreter))
684 goto out_free_interp; 684 goto out_free_interp;
685
686 /*
687 * If the binary is not readable then enforce
688 * mm->dumpable = 0 regardless of the interpreter's
689 * permissions.
690 */
691 if (file_permission(interpreter, MAY_READ) < 0)
692 bprm->interp_flags |= BINPRM_FLAGS_ENFORCE_NONDUMP;
693
685 retval = kernel_read(interpreter, 0, bprm->buf, 694 retval = kernel_read(interpreter, 0, bprm->buf,
686 BINPRM_BUF_SIZE); 695 BINPRM_BUF_SIZE);
687 if (retval != BINPRM_BUF_SIZE) { 696 if (retval != BINPRM_BUF_SIZE) {
@@ -1178,6 +1187,10 @@ static int dump_seek(struct file *file, loff_t off)
1178 */ 1187 */
1179static int maydump(struct vm_area_struct *vma) 1188static int maydump(struct vm_area_struct *vma)
1180{ 1189{
1190 /* The vma can be set up to tell us the answer directly. */
1191 if (vma->vm_flags & VM_ALWAYSDUMP)
1192 return 1;
1193
1181 /* Do not dump I/O mapped devices or special mappings */ 1194 /* Do not dump I/O mapped devices or special mappings */
1182 if (vma->vm_flags & (VM_IO | VM_RESERVED)) 1195 if (vma->vm_flags & (VM_IO | VM_RESERVED))
1183 return 0; 1196 return 0;
@@ -1424,6 +1437,32 @@ static int elf_dump_thread_status(long signr, struct elf_thread_status *t)
1424 return sz; 1437 return sz;
1425} 1438}
1426 1439
1440static struct vm_area_struct *first_vma(struct task_struct *tsk,
1441 struct vm_area_struct *gate_vma)
1442{
1443 struct vm_area_struct *ret = tsk->mm->mmap;
1444
1445 if (ret)
1446 return ret;
1447 return gate_vma;
1448}
1449/*
1450 * Helper function for iterating across a vma list. It ensures that the caller
1451 * will visit `gate_vma' prior to terminating the search.
1452 */
1453static struct vm_area_struct *next_vma(struct vm_area_struct *this_vma,
1454 struct vm_area_struct *gate_vma)
1455{
1456 struct vm_area_struct *ret;
1457
1458 ret = this_vma->vm_next;
1459 if (ret)
1460 return ret;
1461 if (this_vma == gate_vma)
1462 return NULL;
1463 return gate_vma;
1464}
1465
1427/* 1466/*
1428 * Actual dumper 1467 * Actual dumper
1429 * 1468 *
@@ -1439,7 +1478,7 @@ static int elf_core_dump(long signr, struct pt_regs *regs, struct file *file)
1439 int segs; 1478 int segs;
1440 size_t size = 0; 1479 size_t size = 0;
1441 int i; 1480 int i;
1442 struct vm_area_struct *vma; 1481 struct vm_area_struct *vma, *gate_vma;
1443 struct elfhdr *elf = NULL; 1482 struct elfhdr *elf = NULL;
1444 loff_t offset = 0, dataoff, foffset; 1483 loff_t offset = 0, dataoff, foffset;
1445 unsigned long limit = current->signal->rlim[RLIMIT_CORE].rlim_cur; 1484 unsigned long limit = current->signal->rlim[RLIMIT_CORE].rlim_cur;
@@ -1525,6 +1564,10 @@ static int elf_core_dump(long signr, struct pt_regs *regs, struct file *file)
1525 segs += ELF_CORE_EXTRA_PHDRS; 1564 segs += ELF_CORE_EXTRA_PHDRS;
1526#endif 1565#endif
1527 1566
1567 gate_vma = get_gate_vma(current);
1568 if (gate_vma != NULL)
1569 segs++;
1570
1528 /* Set up header */ 1571 /* Set up header */
1529 fill_elf_header(elf, segs + 1); /* including notes section */ 1572 fill_elf_header(elf, segs + 1); /* including notes section */
1530 1573
@@ -1592,7 +1635,8 @@ static int elf_core_dump(long signr, struct pt_regs *regs, struct file *file)
1592 dataoff = offset = roundup(offset, ELF_EXEC_PAGESIZE); 1635 dataoff = offset = roundup(offset, ELF_EXEC_PAGESIZE);
1593 1636
1594 /* Write program headers for segments dump */ 1637 /* Write program headers for segments dump */
1595 for (vma = current->mm->mmap; vma != NULL; vma = vma->vm_next) { 1638 for (vma = first_vma(current, gate_vma); vma != NULL;
1639 vma = next_vma(vma, gate_vma)) {
1596 struct elf_phdr phdr; 1640 struct elf_phdr phdr;
1597 size_t sz; 1641 size_t sz;
1598 1642
@@ -1641,7 +1685,8 @@ static int elf_core_dump(long signr, struct pt_regs *regs, struct file *file)
1641 /* Align to page */ 1685 /* Align to page */
1642 DUMP_SEEK(dataoff - foffset); 1686 DUMP_SEEK(dataoff - foffset);
1643 1687
1644 for (vma = current->mm->mmap; vma != NULL; vma = vma->vm_next) { 1688 for (vma = first_vma(current, gate_vma); vma != NULL;
1689 vma = next_vma(vma, gate_vma)) {
1645 unsigned long addr; 1690 unsigned long addr;
1646 1691
1647 if (!maydump(vma)) 1692 if (!maydump(vma))
diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c
index 6e6d4568d548..a4d933a51208 100644
--- a/fs/binfmt_elf_fdpic.c
+++ b/fs/binfmt_elf_fdpic.c
@@ -234,6 +234,14 @@ static int load_elf_fdpic_binary(struct linux_binprm *bprm,
234 goto error; 234 goto error;
235 } 235 }
236 236
237 /*
238 * If the binary is not readable then enforce
239 * mm->dumpable = 0 regardless of the interpreter's
240 * permissions.
241 */
242 if (file_permission(interpreter, MAY_READ) < 0)
243 bprm->interp_flags |= BINPRM_FLAGS_ENFORCE_NONDUMP;
244
237 retval = kernel_read(interpreter, 0, bprm->buf, 245 retval = kernel_read(interpreter, 0, bprm->buf,
238 BINPRM_BUF_SIZE); 246 BINPRM_BUF_SIZE);
239 if (retval < 0) 247 if (retval < 0)
diff --git a/fs/block_dev.c b/fs/block_dev.c
index 8b18e43b82fe..fc7028b685f2 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -129,6 +129,46 @@ blkdev_get_block(struct inode *inode, sector_t iblock,
129 return 0; 129 return 0;
130} 130}
131 131
132static int
133blkdev_get_blocks(struct inode *inode, sector_t iblock,
134 struct buffer_head *bh, int create)
135{
136 sector_t end_block = max_block(I_BDEV(inode));
137 unsigned long max_blocks = bh->b_size >> inode->i_blkbits;
138
139 if ((iblock + max_blocks) > end_block) {
140 max_blocks = end_block - iblock;
141 if ((long)max_blocks <= 0) {
142 if (create)
143 return -EIO; /* write fully beyond EOF */
144 /*
145 * It is a read which is fully beyond EOF. We return
146 * a !buffer_mapped buffer
147 */
148 max_blocks = 0;
149 }
150 }
151
152 bh->b_bdev = I_BDEV(inode);
153 bh->b_blocknr = iblock;
154 bh->b_size = max_blocks << inode->i_blkbits;
155 if (max_blocks)
156 set_buffer_mapped(bh);
157 return 0;
158}
159
160static ssize_t
161blkdev_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov,
162 loff_t offset, unsigned long nr_segs)
163{
164 struct file *file = iocb->ki_filp;
165 struct inode *inode = file->f_mapping->host;
166
167 return blockdev_direct_IO_no_locking(rw, iocb, inode, I_BDEV(inode),
168 iov, offset, nr_segs, blkdev_get_blocks, NULL);
169}
170
171#if 0
132static int blk_end_aio(struct bio *bio, unsigned int bytes_done, int error) 172static int blk_end_aio(struct bio *bio, unsigned int bytes_done, int error)
133{ 173{
134 struct kiocb *iocb = bio->bi_private; 174 struct kiocb *iocb = bio->bi_private;
@@ -146,7 +186,7 @@ static int blk_end_aio(struct bio *bio, unsigned int bytes_done, int error)
146 iocb->ki_nbytes = -EIO; 186 iocb->ki_nbytes = -EIO;
147 187
148 if (atomic_dec_and_test(bio_count)) { 188 if (atomic_dec_and_test(bio_count)) {
149 if (iocb->ki_nbytes < 0) 189 if ((long)iocb->ki_nbytes < 0)
150 aio_complete(iocb, iocb->ki_nbytes, 0); 190 aio_complete(iocb, iocb->ki_nbytes, 0);
151 else 191 else
152 aio_complete(iocb, iocb->ki_left, 0); 192 aio_complete(iocb, iocb->ki_left, 0);
@@ -190,6 +230,12 @@ static struct page *blk_get_page(unsigned long addr, size_t count, int rw,
190 return pvec->page[pvec->idx++]; 230 return pvec->page[pvec->idx++];
191} 231}
192 232
233/* return a page back to pvec array */
234static void blk_unget_page(struct page *page, struct pvec *pvec)
235{
236 pvec->page[--pvec->idx] = page;
237}
238
193static ssize_t 239static ssize_t
194blkdev_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov, 240blkdev_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov,
195 loff_t pos, unsigned long nr_segs) 241 loff_t pos, unsigned long nr_segs)
@@ -278,6 +324,8 @@ same_bio:
278 count = min(count, nbytes); 324 count = min(count, nbytes);
279 goto same_bio; 325 goto same_bio;
280 } 326 }
327 } else {
328 blk_unget_page(page, &pvec);
281 } 329 }
282 330
283 /* bio is ready, submit it */ 331 /* bio is ready, submit it */
@@ -315,6 +363,7 @@ backout:
315 return PTR_ERR(page); 363 return PTR_ERR(page);
316 goto completion; 364 goto completion;
317} 365}
366#endif
318 367
319static int blkdev_writepage(struct page *page, struct writeback_control *wbc) 368static int blkdev_writepage(struct page *page, struct writeback_control *wbc)
320{ 369{
diff --git a/fs/buffer.c b/fs/buffer.c
index 3b116078b4c3..1ad674fd348c 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -2834,7 +2834,7 @@ int try_to_free_buffers(struct page *page)
2834 int ret = 0; 2834 int ret = 0;
2835 2835
2836 BUG_ON(!PageLocked(page)); 2836 BUG_ON(!PageLocked(page));
2837 if (PageDirty(page) || PageWriteback(page)) 2837 if (PageWriteback(page))
2838 return 0; 2838 return 0;
2839 2839
2840 if (mapping == NULL) { /* can this still happen? */ 2840 if (mapping == NULL) { /* can this still happen? */
@@ -2844,6 +2844,23 @@ int try_to_free_buffers(struct page *page)
2844 2844
2845 spin_lock(&mapping->private_lock); 2845 spin_lock(&mapping->private_lock);
2846 ret = drop_buffers(page, &buffers_to_free); 2846 ret = drop_buffers(page, &buffers_to_free);
2847
2848 /*
2849 * If the filesystem writes its buffers by hand (eg ext3)
2850 * then we can have clean buffers against a dirty page. We
2851 * clean the page here; otherwise the VM will never notice
2852 * that the filesystem did any IO at all.
2853 *
2854 * Also, during truncate, discard_buffer will have marked all
2855 * the page's buffers clean. We discover that here and clean
2856 * the page also.
2857 *
2858 * private_lock must be held over this entire operation in order
2859 * to synchronise against __set_page_dirty_buffers and prevent the
2860 * dirty bit from being lost.
2861 */
2862 if (ret)
2863 cancel_dirty_page(page, PAGE_CACHE_SIZE);
2847 spin_unlock(&mapping->private_lock); 2864 spin_unlock(&mapping->private_lock);
2848out: 2865out:
2849 if (buffers_to_free) { 2866 if (buffers_to_free) {
diff --git a/fs/cifs/CHANGES b/fs/cifs/CHANGES
index 3539d6ef9611..d04d2f7448d9 100644
--- a/fs/cifs/CHANGES
+++ b/fs/cifs/CHANGES
@@ -1,3 +1,7 @@
1Version 1.47
2------------
3Fix oops in list_del during mount caused by unaligned string.
4
1Version 1.46 5Version 1.46
2------------ 6------------
3Support deep tree mounts. Better support OS/2, Win9x (DOS) time stamps. 7Support deep tree mounts. Better support OS/2, Win9x (DOS) time stamps.
diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c
index 96abeb738978..6017c465440e 100644
--- a/fs/cifs/cifs_debug.c
+++ b/fs/cifs/cifs_debug.c
@@ -143,8 +143,8 @@ cifs_debug_data_read(char *buf, char **beginBuffer, off_t offset,
143 ses = list_entry(tmp, struct cifsSesInfo, cifsSessionList); 143 ses = list_entry(tmp, struct cifsSesInfo, cifsSessionList);
144 if((ses->serverDomain == NULL) || (ses->serverOS == NULL) || 144 if((ses->serverDomain == NULL) || (ses->serverOS == NULL) ||
145 (ses->serverNOS == NULL)) { 145 (ses->serverNOS == NULL)) {
146 buf += sprintf("\nentry for %s not fully displayed\n\t", 146 buf += sprintf(buf, "\nentry for %s not fully "
147 ses->serverName); 147 "displayed\n\t", ses->serverName);
148 148
149 } else { 149 } else {
150 length = 150 length =
diff --git a/fs/cifs/cifsfs.h b/fs/cifs/cifsfs.h
index a243f779b363..8aa66dcf13bd 100644
--- a/fs/cifs/cifsfs.h
+++ b/fs/cifs/cifsfs.h
@@ -100,5 +100,5 @@ extern ssize_t cifs_getxattr(struct dentry *, const char *, void *, size_t);
100extern ssize_t cifs_listxattr(struct dentry *, char *, size_t); 100extern ssize_t cifs_listxattr(struct dentry *, char *, size_t);
101extern int cifs_ioctl (struct inode * inode, struct file * filep, 101extern int cifs_ioctl (struct inode * inode, struct file * filep,
102 unsigned int command, unsigned long arg); 102 unsigned int command, unsigned long arg);
103#define CIFS_VERSION "1.46" 103#define CIFS_VERSION "1.47"
104#endif /* _CIFSFS_H */ 104#endif /* _CIFSFS_H */
diff --git a/fs/cifs/misc.c b/fs/cifs/misc.c
index aedf683f011f..19cc294c7c70 100644
--- a/fs/cifs/misc.c
+++ b/fs/cifs/misc.c
@@ -71,9 +71,7 @@ sesInfoAlloc(void)
71{ 71{
72 struct cifsSesInfo *ret_buf; 72 struct cifsSesInfo *ret_buf;
73 73
74 ret_buf = 74 ret_buf = kzalloc(sizeof (struct cifsSesInfo), GFP_KERNEL);
75 (struct cifsSesInfo *) kzalloc(sizeof (struct cifsSesInfo),
76 GFP_KERNEL);
77 if (ret_buf) { 75 if (ret_buf) {
78 write_lock(&GlobalSMBSeslock); 76 write_lock(&GlobalSMBSeslock);
79 atomic_inc(&sesInfoAllocCount); 77 atomic_inc(&sesInfoAllocCount);
@@ -109,9 +107,7 @@ struct cifsTconInfo *
109tconInfoAlloc(void) 107tconInfoAlloc(void)
110{ 108{
111 struct cifsTconInfo *ret_buf; 109 struct cifsTconInfo *ret_buf;
112 ret_buf = 110 ret_buf = kzalloc(sizeof (struct cifsTconInfo), GFP_KERNEL);
113 (struct cifsTconInfo *) kzalloc(sizeof (struct cifsTconInfo),
114 GFP_KERNEL);
115 if (ret_buf) { 111 if (ret_buf) {
116 write_lock(&GlobalSMBSeslock); 112 write_lock(&GlobalSMBSeslock);
117 atomic_inc(&tconInfoAllocCount); 113 atomic_inc(&tconInfoAllocCount);
diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c
index bbdda99dce61..758464630893 100644
--- a/fs/cifs/sess.c
+++ b/fs/cifs/sess.c
@@ -182,11 +182,14 @@ static int decode_unicode_ssetup(char ** pbcc_area, int bleft, struct cifsSesInf
182 cFYI(1,("bleft %d",bleft)); 182 cFYI(1,("bleft %d",bleft));
183 183
184 184
185 /* word align, if bytes remaining is not even */ 185 /* SMB header is unaligned, so cifs servers word align start of
186 if(bleft % 2) { 186 Unicode strings */
187 bleft--; 187 data++;
188 data++; 188 bleft--; /* Windows servers do not always double null terminate
189 } 189 their final Unicode string - in which case we
190 now will not attempt to decode the byte of junk
191 which follows it */
192
190 words_left = bleft / 2; 193 words_left = bleft / 2;
191 194
192 /* save off server operating system */ 195 /* save off server operating system */
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index c403b66ec83c..a4b142a6a2c7 100644
--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@ -251,8 +251,19 @@ __writeback_single_inode(struct inode *inode, struct writeback_control *wbc)
251 WARN_ON(inode->i_state & I_WILL_FREE); 251 WARN_ON(inode->i_state & I_WILL_FREE);
252 252
253 if ((wbc->sync_mode != WB_SYNC_ALL) && (inode->i_state & I_LOCK)) { 253 if ((wbc->sync_mode != WB_SYNC_ALL) && (inode->i_state & I_LOCK)) {
254 struct address_space *mapping = inode->i_mapping;
255 int ret;
256
254 list_move(&inode->i_list, &inode->i_sb->s_dirty); 257 list_move(&inode->i_list, &inode->i_sb->s_dirty);
255 return 0; 258
259 /*
260 * Even if we don't actually write the inode itself here,
261 * we can at least start some of the data writeout..
262 */
263 spin_unlock(&inode_lock);
264 ret = do_writepages(mapping, wbc);
265 spin_lock(&inode_lock);
266 return ret;
256 } 267 }
257 268
258 /* 269 /*
diff --git a/fs/fuse/control.c b/fs/fuse/control.c
index 8c58bd453993..1794305f9ed8 100644
--- a/fs/fuse/control.c
+++ b/fs/fuse/control.c
@@ -193,8 +193,12 @@ static int fuse_ctl_get_sb(struct file_system_type *fs_type, int flags,
193 193
194static void fuse_ctl_kill_sb(struct super_block *sb) 194static void fuse_ctl_kill_sb(struct super_block *sb)
195{ 195{
196 struct fuse_conn *fc;
197
196 mutex_lock(&fuse_mutex); 198 mutex_lock(&fuse_mutex);
197 fuse_control_sb = NULL; 199 fuse_control_sb = NULL;
200 list_for_each_entry(fc, &fuse_conn_list, entry)
201 fc->ctl_ndents = 0;
198 mutex_unlock(&fuse_mutex); 202 mutex_unlock(&fuse_mutex);
199 203
200 kill_litter_super(sb); 204 kill_litter_super(sb);
diff --git a/fs/hostfs/hostfs.h b/fs/hostfs/hostfs.h
index cca3fb693f99..70543b17e4c7 100644
--- a/fs/hostfs/hostfs.h
+++ b/fs/hostfs/hostfs.h
@@ -76,7 +76,7 @@ extern int make_symlink(const char *from, const char *to);
76extern int unlink_file(const char *file); 76extern int unlink_file(const char *file);
77extern int do_mkdir(const char *file, int mode); 77extern int do_mkdir(const char *file, int mode);
78extern int do_rmdir(const char *file); 78extern int do_rmdir(const char *file);
79extern int do_mknod(const char *file, int mode, int dev); 79extern int do_mknod(const char *file, int mode, unsigned int major, unsigned int minor);
80extern int link_file(const char *from, const char *to); 80extern int link_file(const char *from, const char *to);
81extern int do_readlink(char *file, char *buf, int size); 81extern int do_readlink(char *file, char *buf, int size);
82extern int rename_file(char *from, char *to); 82extern int rename_file(char *from, char *to);
diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c
index 1e6fc3799876..69a376f35a68 100644
--- a/fs/hostfs/hostfs_kern.c
+++ b/fs/hostfs/hostfs_kern.c
@@ -755,7 +755,7 @@ int hostfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev)
755 goto out_put; 755 goto out_put;
756 756
757 init_special_inode(inode, mode, dev); 757 init_special_inode(inode, mode, dev);
758 err = do_mknod(name, mode, dev); 758 err = do_mknod(name, mode, MAJOR(dev), MINOR(dev));
759 if(err) 759 if(err)
760 goto out_free; 760 goto out_free;
761 761
diff --git a/fs/hostfs/hostfs_user.c b/fs/hostfs/hostfs_user.c
index 23b7cee72123..1ed5ea389f15 100644
--- a/fs/hostfs/hostfs_user.c
+++ b/fs/hostfs/hostfs_user.c
@@ -295,11 +295,11 @@ int do_rmdir(const char *file)
295 return(0); 295 return(0);
296} 296}
297 297
298int do_mknod(const char *file, int mode, int dev) 298int do_mknod(const char *file, int mode, unsigned int major, unsigned int minor)
299{ 299{
300 int err; 300 int err;
301 301
302 err = mknod(file, mode, dev); 302 err = mknod(file, mode, makedev(major, minor));
303 if(err) return(-errno); 303 if(err) return(-errno);
304 return(0); 304 return(0);
305} 305}
diff --git a/fs/lockd/clntlock.c b/fs/lockd/clntlock.c
index 062707745162..f4d45d4d835b 100644
--- a/fs/lockd/clntlock.c
+++ b/fs/lockd/clntlock.c
@@ -176,7 +176,7 @@ reclaimer(void *ptr)
176 lock_kernel(); 176 lock_kernel();
177 lockd_up(0); /* note: this cannot fail as lockd is already running */ 177 lockd_up(0); /* note: this cannot fail as lockd is already running */
178 178
179 dprintk("lockd: reclaiming locks for host %s", host->h_name); 179 dprintk("lockd: reclaiming locks for host %s\n", host->h_name);
180 180
181restart: 181restart:
182 nsmstate = host->h_nsmstate; 182 nsmstate = host->h_nsmstate;
@@ -206,7 +206,7 @@ restart:
206 206
207 host->h_reclaiming = 0; 207 host->h_reclaiming = 0;
208 up_write(&host->h_rwsem); 208 up_write(&host->h_rwsem);
209 dprintk("NLM: done reclaiming locks for host %s", host->h_name); 209 dprintk("NLM: done reclaiming locks for host %s\n", host->h_name);
210 210
211 /* Now, wake up all processes that sleep on a blocked lock */ 211 /* Now, wake up all processes that sleep on a blocked lock */
212 list_for_each_entry(block, &nlm_blocked, b_list) { 212 list_for_each_entry(block, &nlm_blocked, b_list) {
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index dee3d6c0f194..d9ba8cb0ee75 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -532,7 +532,7 @@ static int nfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
532 532
533 lock_kernel(); 533 lock_kernel();
534 534
535 res = nfs_revalidate_mapping(inode, filp->f_mapping); 535 res = nfs_revalidate_mapping_nolock(inode, filp->f_mapping);
536 if (res < 0) { 536 if (res < 0) {
537 unlock_kernel(); 537 unlock_kernel();
538 return res; 538 return res;
diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index fab20d06d936..9e4a2b70995a 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -434,8 +434,9 @@ static int do_vfs_lock(struct file *file, struct file_lock *fl)
434 BUG(); 434 BUG();
435 } 435 }
436 if (res < 0) 436 if (res < 0)
437 printk(KERN_WARNING "%s: VFS is out of sync with lock manager!\n", 437 dprintk(KERN_WARNING "%s: VFS is out of sync with lock manager"
438 __FUNCTION__); 438 " - error %d!\n",
439 __FUNCTION__, res);
439 return res; 440 return res;
440} 441}
441 442
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 63e470279309..d83498282837 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -665,49 +665,86 @@ int nfs_revalidate_inode(struct nfs_server *server, struct inode *inode)
665 return __nfs_revalidate_inode(server, inode); 665 return __nfs_revalidate_inode(server, inode);
666} 666}
667 667
668static int nfs_invalidate_mapping_nolock(struct inode *inode, struct address_space *mapping)
669{
670 struct nfs_inode *nfsi = NFS_I(inode);
671
672 if (mapping->nrpages != 0) {
673 int ret = invalidate_inode_pages2(mapping);
674 if (ret < 0)
675 return ret;
676 }
677 spin_lock(&inode->i_lock);
678 nfsi->cache_validity &= ~NFS_INO_INVALID_DATA;
679 if (S_ISDIR(inode->i_mode)) {
680 memset(nfsi->cookieverf, 0, sizeof(nfsi->cookieverf));
681 /* This ensures we revalidate child dentries */
682 nfsi->cache_change_attribute = jiffies;
683 }
684 spin_unlock(&inode->i_lock);
685 nfs_inc_stats(inode, NFSIOS_DATAINVALIDATE);
686 dfprintk(PAGECACHE, "NFS: (%s/%Ld) data cache invalidated\n",
687 inode->i_sb->s_id, (long long)NFS_FILEID(inode));
688 return 0;
689}
690
691static int nfs_invalidate_mapping(struct inode *inode, struct address_space *mapping)
692{
693 int ret = 0;
694
695 mutex_lock(&inode->i_mutex);
696 if (NFS_I(inode)->cache_validity & NFS_INO_INVALID_DATA) {
697 ret = nfs_sync_mapping(mapping);
698 if (ret == 0)
699 ret = nfs_invalidate_mapping_nolock(inode, mapping);
700 }
701 mutex_unlock(&inode->i_mutex);
702 return ret;
703}
704
668/** 705/**
669 * nfs_revalidate_mapping - Revalidate the pagecache 706 * nfs_revalidate_mapping_nolock - Revalidate the pagecache
670 * @inode - pointer to host inode 707 * @inode - pointer to host inode
671 * @mapping - pointer to mapping 708 * @mapping - pointer to mapping
672 */ 709 */
673int nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping) 710int nfs_revalidate_mapping_nolock(struct inode *inode, struct address_space *mapping)
674{ 711{
675 struct nfs_inode *nfsi = NFS_I(inode); 712 struct nfs_inode *nfsi = NFS_I(inode);
676 int ret = 0; 713 int ret = 0;
677 714
678 if (NFS_STALE(inode))
679 ret = -ESTALE;
680 if ((nfsi->cache_validity & NFS_INO_REVAL_PAGECACHE) 715 if ((nfsi->cache_validity & NFS_INO_REVAL_PAGECACHE)
681 || nfs_attribute_timeout(inode)) 716 || nfs_attribute_timeout(inode) || NFS_STALE(inode)) {
682 ret = __nfs_revalidate_inode(NFS_SERVER(inode), inode); 717 ret = __nfs_revalidate_inode(NFS_SERVER(inode), inode);
683 if (ret < 0) 718 if (ret < 0)
684 goto out; 719 goto out;
720 }
721 if (nfsi->cache_validity & NFS_INO_INVALID_DATA)
722 ret = nfs_invalidate_mapping_nolock(inode, mapping);
723out:
724 return ret;
725}
685 726
686 if (nfsi->cache_validity & NFS_INO_INVALID_DATA) { 727/**
687 if (mapping->nrpages != 0) { 728 * nfs_revalidate_mapping - Revalidate the pagecache
688 if (S_ISREG(inode->i_mode)) { 729 * @inode - pointer to host inode
689 ret = nfs_sync_mapping(mapping); 730 * @mapping - pointer to mapping
690 if (ret < 0) 731 *
691 goto out; 732 * This version of the function will take the inode->i_mutex and attempt to
692 } 733 * flush out all dirty data if it needs to invalidate the page cache.
693 ret = invalidate_inode_pages2(mapping); 734 */
694 if (ret < 0) 735int nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping)
695 goto out; 736{
696 } 737 struct nfs_inode *nfsi = NFS_I(inode);
697 spin_lock(&inode->i_lock); 738 int ret = 0;
698 nfsi->cache_validity &= ~NFS_INO_INVALID_DATA;
699 if (S_ISDIR(inode->i_mode)) {
700 memset(nfsi->cookieverf, 0, sizeof(nfsi->cookieverf));
701 /* This ensures we revalidate child dentries */
702 nfsi->cache_change_attribute = jiffies;
703 }
704 spin_unlock(&inode->i_lock);
705 739
706 nfs_inc_stats(inode, NFSIOS_DATAINVALIDATE); 740 if ((nfsi->cache_validity & NFS_INO_REVAL_PAGECACHE)
707 dfprintk(PAGECACHE, "NFS: (%s/%Ld) data cache invalidated\n", 741 || nfs_attribute_timeout(inode) || NFS_STALE(inode)) {
708 inode->i_sb->s_id, 742 ret = __nfs_revalidate_inode(NFS_SERVER(inode), inode);
709 (long long)NFS_FILEID(inode)); 743 if (ret < 0)
744 goto out;
710 } 745 }
746 if (nfsi->cache_validity & NFS_INO_INVALID_DATA)
747 ret = nfs_invalidate_mapping(inode, mapping);
711out: 748out:
712 return ret; 749 return ret;
713} 750}
diff --git a/fs/nfs/symlink.c b/fs/nfs/symlink.c
index 6c686112cc03..525c136c7d8c 100644
--- a/fs/nfs/symlink.c
+++ b/fs/nfs/symlink.c
@@ -50,7 +50,9 @@ static void *nfs_follow_link(struct dentry *dentry, struct nameidata *nd)
50{ 50{
51 struct inode *inode = dentry->d_inode; 51 struct inode *inode = dentry->d_inode;
52 struct page *page; 52 struct page *page;
53 void *err = ERR_PTR(nfs_revalidate_mapping(inode, inode->i_mapping)); 53 void *err;
54
55 err = ERR_PTR(nfs_revalidate_mapping_nolock(inode, inode->i_mapping));
54 if (err) 56 if (err)
55 goto read_failed; 57 goto read_failed;
56 page = read_cache_page(&inode->i_data, 0, 58 page = read_cache_page(&inode->i_data, 0,
diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c
index 248dd92e6a56..49c310b84923 100644
--- a/fs/nfsd/export.c
+++ b/fs/nfsd/export.c
@@ -35,7 +35,6 @@
35#include <linux/lockd/bind.h> 35#include <linux/lockd/bind.h>
36 36
37#define NFSDDBG_FACILITY NFSDDBG_EXPORT 37#define NFSDDBG_FACILITY NFSDDBG_EXPORT
38#define NFSD_PARANOIA 1
39 38
40typedef struct auth_domain svc_client; 39typedef struct auth_domain svc_client;
41typedef struct svc_export svc_export; 40typedef struct svc_export svc_export;
diff --git a/fs/nfsd/nfs3xdr.c b/fs/nfsd/nfs3xdr.c
index 277df40f098d..e695660921ec 100644
--- a/fs/nfsd/nfs3xdr.c
+++ b/fs/nfsd/nfs3xdr.c
@@ -990,15 +990,16 @@ encode_entry(struct readdir_cd *ccd, const char *name,
990} 990}
991 991
992int 992int
993nfs3svc_encode_entry(struct readdir_cd *cd, const char *name, 993nfs3svc_encode_entry(void *cd, const char *name,
994 int namlen, loff_t offset, ino_t ino, unsigned int d_type) 994 int namlen, loff_t offset, u64 ino, unsigned int d_type)
995{ 995{
996 return encode_entry(cd, name, namlen, offset, ino, d_type, 0); 996 return encode_entry(cd, name, namlen, offset, ino, d_type, 0);
997} 997}
998 998
999int 999int
1000nfs3svc_encode_entry_plus(struct readdir_cd *cd, const char *name, 1000nfs3svc_encode_entry_plus(void *cd, const char *name,
1001 int namlen, loff_t offset, ino_t ino, unsigned int d_type) 1001 int namlen, loff_t offset, u64 ino,
1002 unsigned int d_type)
1002{ 1003{
1003 return encode_entry(cd, name, namlen, offset, ino, d_type, 1); 1004 return encode_entry(cd, name, namlen, offset, ino, d_type, 1);
1004} 1005}
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index fea46368afb2..18aa9440df14 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -1880,9 +1880,10 @@ nfsd4_encode_rdattr_error(__be32 *p, int buflen, __be32 nfserr)
1880} 1880}
1881 1881
1882static int 1882static int
1883nfsd4_encode_dirent(struct readdir_cd *ccd, const char *name, int namlen, 1883nfsd4_encode_dirent(void *ccdv, const char *name, int namlen,
1884 loff_t offset, ino_t ino, unsigned int d_type) 1884 loff_t offset, u64 ino, unsigned int d_type)
1885{ 1885{
1886 struct readdir_cd *ccd = ccdv;
1886 struct nfsd4_readdir *cd = container_of(ccd, struct nfsd4_readdir, common); 1887 struct nfsd4_readdir *cd = container_of(ccd, struct nfsd4_readdir, common);
1887 int buflen; 1888 int buflen;
1888 __be32 *p = cd->buffer; 1889 __be32 *p = cd->buffer;
diff --git a/fs/nfsd/nfsfh.c b/fs/nfsd/nfsfh.c
index b06bf9f70efc..c59d6fbb7a6b 100644
--- a/fs/nfsd/nfsfh.c
+++ b/fs/nfsd/nfsfh.c
@@ -24,8 +24,6 @@
24#include <linux/nfsd/nfsd.h> 24#include <linux/nfsd/nfsd.h>
25 25
26#define NFSDDBG_FACILITY NFSDDBG_FH 26#define NFSDDBG_FACILITY NFSDDBG_FH
27#define NFSD_PARANOIA 1
28/* #define NFSD_DEBUG_VERBOSE 1 */
29 27
30 28
31static int nfsd_nr_verified; 29static int nfsd_nr_verified;
@@ -230,13 +228,12 @@ fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, int access)
230 error = nfserrno(PTR_ERR(dentry)); 228 error = nfserrno(PTR_ERR(dentry));
231 goto out; 229 goto out;
232 } 230 }
233#ifdef NFSD_PARANOIA 231
234 if (S_ISDIR(dentry->d_inode->i_mode) && 232 if (S_ISDIR(dentry->d_inode->i_mode) &&
235 (dentry->d_flags & DCACHE_DISCONNECTED)) { 233 (dentry->d_flags & DCACHE_DISCONNECTED)) {
236 printk("nfsd: find_fh_dentry returned a DISCONNECTED directory: %s/%s\n", 234 printk("nfsd: find_fh_dentry returned a DISCONNECTED directory: %s/%s\n",
237 dentry->d_parent->d_name.name, dentry->d_name.name); 235 dentry->d_parent->d_name.name, dentry->d_name.name);
238 } 236 }
239#endif
240 237
241 fhp->fh_dentry = dentry; 238 fhp->fh_dentry = dentry;
242 fhp->fh_export = exp; 239 fhp->fh_export = exp;
@@ -267,12 +264,13 @@ fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, int access)
267 /* Finally, check access permissions. */ 264 /* Finally, check access permissions. */
268 error = nfsd_permission(exp, dentry, access); 265 error = nfsd_permission(exp, dentry, access);
269 266
270#ifdef NFSD_PARANOIA_EXTREME
271 if (error) { 267 if (error) {
272 printk("fh_verify: %s/%s permission failure, acc=%x, error=%d\n", 268 dprintk("fh_verify: %s/%s permission failure, "
273 dentry->d_parent->d_name.name, dentry->d_name.name, access, (error >> 24)); 269 "acc=%x, error=%d\n",
270 dentry->d_parent->d_name.name,
271 dentry->d_name.name,
272 access, ntohl(error));
274 } 273 }
275#endif
276out: 274out:
277 if (exp && !IS_ERR(exp)) 275 if (exp && !IS_ERR(exp))
278 exp_put(exp); 276 exp_put(exp);
diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c
index 0aaccb03bf76..fbf5d51947ea 100644
--- a/fs/nfsd/nfssvc.c
+++ b/fs/nfsd/nfssvc.c
@@ -72,7 +72,7 @@ static struct svc_program nfsd_acl_program = {
72 .pg_prog = NFS_ACL_PROGRAM, 72 .pg_prog = NFS_ACL_PROGRAM,
73 .pg_nvers = NFSD_ACL_NRVERS, 73 .pg_nvers = NFSD_ACL_NRVERS,
74 .pg_vers = nfsd_acl_versions, 74 .pg_vers = nfsd_acl_versions,
75 .pg_name = "nfsd", 75 .pg_name = "nfsacl",
76 .pg_class = "nfsd", 76 .pg_class = "nfsd",
77 .pg_stats = &nfsd_acl_svcstats, 77 .pg_stats = &nfsd_acl_svcstats,
78 .pg_authenticate = &svc_set_client, 78 .pg_authenticate = &svc_set_client,
@@ -118,16 +118,16 @@ int nfsd_vers(int vers, enum vers_op change)
118 switch(change) { 118 switch(change) {
119 case NFSD_SET: 119 case NFSD_SET:
120 nfsd_versions[vers] = nfsd_version[vers]; 120 nfsd_versions[vers] = nfsd_version[vers];
121 break;
122#if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL) 121#if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL)
123 if (vers < NFSD_ACL_NRVERS) 122 if (vers < NFSD_ACL_NRVERS)
124 nfsd_acl_version[vers] = nfsd_acl_version[vers]; 123 nfsd_acl_versions[vers] = nfsd_acl_version[vers];
125#endif 124#endif
125 break;
126 case NFSD_CLEAR: 126 case NFSD_CLEAR:
127 nfsd_versions[vers] = NULL; 127 nfsd_versions[vers] = NULL;
128#if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL) 128#if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL)
129 if (vers < NFSD_ACL_NRVERS) 129 if (vers < NFSD_ACL_NRVERS)
130 nfsd_acl_version[vers] = NULL; 130 nfsd_acl_versions[vers] = NULL;
131#endif 131#endif
132 break; 132 break;
133 case NFSD_TEST: 133 case NFSD_TEST:
diff --git a/fs/nfsd/nfsxdr.c b/fs/nfsd/nfsxdr.c
index f5243f943996..6555c50d9006 100644
--- a/fs/nfsd/nfsxdr.c
+++ b/fs/nfsd/nfsxdr.c
@@ -462,9 +462,10 @@ nfssvc_encode_statfsres(struct svc_rqst *rqstp, __be32 *p,
462} 462}
463 463
464int 464int
465nfssvc_encode_entry(struct readdir_cd *ccd, const char *name, 465nfssvc_encode_entry(void *ccdv, const char *name,
466 int namlen, loff_t offset, ino_t ino, unsigned int d_type) 466 int namlen, loff_t offset, u64 ino, unsigned int d_type)
467{ 467{
468 struct readdir_cd *ccd = ccdv;
468 struct nfsd_readdirres *cd = container_of(ccd, struct nfsd_readdirres, common); 469 struct nfsd_readdirres *cd = container_of(ccd, struct nfsd_readdirres, common);
469 __be32 *p = cd->buffer; 470 __be32 *p = cd->buffer;
470 int buflen, slen; 471 int buflen, slen;
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index 7a79c23aa6d4..8283236c6a0f 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -59,7 +59,6 @@
59#include <asm/uaccess.h> 59#include <asm/uaccess.h>
60 60
61#define NFSDDBG_FACILITY NFSDDBG_FILEOP 61#define NFSDDBG_FACILITY NFSDDBG_FILEOP
62#define NFSD_PARANOIA
63 62
64 63
65/* We must ignore files (but only files) which might have mandatory 64/* We must ignore files (but only files) which might have mandatory
@@ -822,7 +821,8 @@ nfsd_read_actor(read_descriptor_t *desc, struct page *page, unsigned long offset
822 rqstp->rq_res.page_len = size; 821 rqstp->rq_res.page_len = size;
823 } else if (page != pp[-1]) { 822 } else if (page != pp[-1]) {
824 get_page(page); 823 get_page(page);
825 put_page(*pp); 824 if (*pp)
825 put_page(*pp);
826 *pp = page; 826 *pp = page;
827 rqstp->rq_resused++; 827 rqstp->rq_resused++;
828 rqstp->rq_res.page_len += size; 828 rqstp->rq_res.page_len += size;
@@ -1244,7 +1244,6 @@ nfsd_create_v3(struct svc_rqst *rqstp, struct svc_fh *fhp,
1244 __be32 err; 1244 __be32 err;
1245 int host_err; 1245 int host_err;
1246 __u32 v_mtime=0, v_atime=0; 1246 __u32 v_mtime=0, v_atime=0;
1247 int v_mode=0;
1248 1247
1249 err = nfserr_perm; 1248 err = nfserr_perm;
1250 if (!flen) 1249 if (!flen)
@@ -1281,16 +1280,11 @@ nfsd_create_v3(struct svc_rqst *rqstp, struct svc_fh *fhp,
1281 goto out; 1280 goto out;
1282 1281
1283 if (createmode == NFS3_CREATE_EXCLUSIVE) { 1282 if (createmode == NFS3_CREATE_EXCLUSIVE) {
1284 /* while the verifier would fit in mtime+atime, 1283 /* solaris7 gets confused (bugid 4218508) if these have
1285 * solaris7 gets confused (bugid 4218508) if these have 1284 * the high bit set, so just clear the high bits.
1286 * the high bit set, so we use the mode as well
1287 */ 1285 */
1288 v_mtime = verifier[0]&0x7fffffff; 1286 v_mtime = verifier[0]&0x7fffffff;
1289 v_atime = verifier[1]&0x7fffffff; 1287 v_atime = verifier[1]&0x7fffffff;
1290 v_mode = S_IFREG
1291 | ((verifier[0]&0x80000000) >> (32-7)) /* u+x */
1292 | ((verifier[1]&0x80000000) >> (32-9)) /* u+r */
1293 ;
1294 } 1288 }
1295 1289
1296 if (dchild->d_inode) { 1290 if (dchild->d_inode) {
@@ -1318,7 +1312,6 @@ nfsd_create_v3(struct svc_rqst *rqstp, struct svc_fh *fhp,
1318 case NFS3_CREATE_EXCLUSIVE: 1312 case NFS3_CREATE_EXCLUSIVE:
1319 if ( dchild->d_inode->i_mtime.tv_sec == v_mtime 1313 if ( dchild->d_inode->i_mtime.tv_sec == v_mtime
1320 && dchild->d_inode->i_atime.tv_sec == v_atime 1314 && dchild->d_inode->i_atime.tv_sec == v_atime
1321 && dchild->d_inode->i_mode == v_mode
1322 && dchild->d_inode->i_size == 0 ) 1315 && dchild->d_inode->i_size == 0 )
1323 break; 1316 break;
1324 /* fallthru */ 1317 /* fallthru */
@@ -1340,26 +1333,22 @@ nfsd_create_v3(struct svc_rqst *rqstp, struct svc_fh *fhp,
1340 } 1333 }
1341 1334
1342 if (createmode == NFS3_CREATE_EXCLUSIVE) { 1335 if (createmode == NFS3_CREATE_EXCLUSIVE) {
1343 /* Cram the verifier into atime/mtime/mode */ 1336 /* Cram the verifier into atime/mtime */
1344 iap->ia_valid = ATTR_MTIME|ATTR_ATIME 1337 iap->ia_valid = ATTR_MTIME|ATTR_ATIME
1345 | ATTR_MTIME_SET|ATTR_ATIME_SET 1338 | ATTR_MTIME_SET|ATTR_ATIME_SET;
1346 | ATTR_MODE;
1347 /* XXX someone who knows this better please fix it for nsec */ 1339 /* XXX someone who knows this better please fix it for nsec */
1348 iap->ia_mtime.tv_sec = v_mtime; 1340 iap->ia_mtime.tv_sec = v_mtime;
1349 iap->ia_atime.tv_sec = v_atime; 1341 iap->ia_atime.tv_sec = v_atime;
1350 iap->ia_mtime.tv_nsec = 0; 1342 iap->ia_mtime.tv_nsec = 0;
1351 iap->ia_atime.tv_nsec = 0; 1343 iap->ia_atime.tv_nsec = 0;
1352 iap->ia_mode = v_mode;
1353 } 1344 }
1354 1345
1355 /* Set file attributes. 1346 /* Set file attributes.
1356 * Mode has already been set but we might need to reset it
1357 * for CREATE_EXCLUSIVE
1358 * Irix appears to send along the gid when it tries to 1347 * Irix appears to send along the gid when it tries to
1359 * implement setgid directories via NFS. Clear out all that cruft. 1348 * implement setgid directories via NFS. Clear out all that cruft.
1360 */ 1349 */
1361 set_attr: 1350 set_attr:
1362 if ((iap->ia_valid &= ~(ATTR_UID|ATTR_GID)) != 0) { 1351 if ((iap->ia_valid &= ~(ATTR_UID|ATTR_GID|ATTR_MODE)) != 0) {
1363 __be32 err2 = nfsd_setattr(rqstp, resfhp, iap, 0, (time_t)0); 1352 __be32 err2 = nfsd_setattr(rqstp, resfhp, iap, 0, (time_t)0);
1364 if (err2) 1353 if (err2)
1365 err = err2; 1354 err = err2;
@@ -1726,7 +1715,7 @@ out:
1726 */ 1715 */
1727__be32 1716__be32
1728nfsd_readdir(struct svc_rqst *rqstp, struct svc_fh *fhp, loff_t *offsetp, 1717nfsd_readdir(struct svc_rqst *rqstp, struct svc_fh *fhp, loff_t *offsetp,
1729 struct readdir_cd *cdp, encode_dent_fn func) 1718 struct readdir_cd *cdp, filldir_t func)
1730{ 1719{
1731 __be32 err; 1720 __be32 err;
1732 int host_err; 1721 int host_err;
@@ -1751,7 +1740,7 @@ nfsd_readdir(struct svc_rqst *rqstp, struct svc_fh *fhp, loff_t *offsetp,
1751 1740
1752 do { 1741 do {
1753 cdp->err = nfserr_eof; /* will be cleared on successful read */ 1742 cdp->err = nfserr_eof; /* will be cleared on successful read */
1754 host_err = vfs_readdir(file, (filldir_t) func, cdp); 1743 host_err = vfs_readdir(file, func, cdp);
1755 } while (host_err >=0 && cdp->err == nfs_ok); 1744 } while (host_err >=0 && cdp->err == nfs_ok);
1756 if (host_err) 1745 if (host_err)
1757 err = nfserrno(host_err); 1746 err = nfserrno(host_err);
diff --git a/fs/ntfs/aops.c b/fs/ntfs/aops.c
index 7b2c8f4f6a6f..629e7abdd840 100644
--- a/fs/ntfs/aops.c
+++ b/fs/ntfs/aops.c
@@ -92,10 +92,12 @@ static void ntfs_end_buffer_async_read(struct buffer_head *bh, int uptodate)
92 ofs = 0; 92 ofs = 0;
93 if (file_ofs < init_size) 93 if (file_ofs < init_size)
94 ofs = init_size - file_ofs; 94 ofs = init_size - file_ofs;
95 local_irq_save(flags);
95 kaddr = kmap_atomic(page, KM_BIO_SRC_IRQ); 96 kaddr = kmap_atomic(page, KM_BIO_SRC_IRQ);
96 memset(kaddr + bh_offset(bh) + ofs, 0, 97 memset(kaddr + bh_offset(bh) + ofs, 0,
97 bh->b_size - ofs); 98 bh->b_size - ofs);
98 kunmap_atomic(kaddr, KM_BIO_SRC_IRQ); 99 kunmap_atomic(kaddr, KM_BIO_SRC_IRQ);
100 local_irq_restore(flags);
99 flush_dcache_page(page); 101 flush_dcache_page(page);
100 } 102 }
101 } else { 103 } else {
@@ -143,11 +145,13 @@ static void ntfs_end_buffer_async_read(struct buffer_head *bh, int uptodate)
143 recs = PAGE_CACHE_SIZE / rec_size; 145 recs = PAGE_CACHE_SIZE / rec_size;
144 /* Should have been verified before we got here... */ 146 /* Should have been verified before we got here... */
145 BUG_ON(!recs); 147 BUG_ON(!recs);
148 local_irq_save(flags);
146 kaddr = kmap_atomic(page, KM_BIO_SRC_IRQ); 149 kaddr = kmap_atomic(page, KM_BIO_SRC_IRQ);
147 for (i = 0; i < recs; i++) 150 for (i = 0; i < recs; i++)
148 post_read_mst_fixup((NTFS_RECORD*)(kaddr + 151 post_read_mst_fixup((NTFS_RECORD*)(kaddr +
149 i * rec_size), rec_size); 152 i * rec_size), rec_size);
150 kunmap_atomic(kaddr, KM_BIO_SRC_IRQ); 153 kunmap_atomic(kaddr, KM_BIO_SRC_IRQ);
154 local_irq_restore(flags);
151 flush_dcache_page(page); 155 flush_dcache_page(page);
152 if (likely(page_uptodate && !PageError(page))) 156 if (likely(page_uptodate && !PageError(page)))
153 SetPageUptodate(page); 157 SetPageUptodate(page);
diff --git a/fs/ocfs2/ocfs2_fs.h b/fs/ocfs2/ocfs2_fs.h
index c99e9058c198..e61e218f5e0b 100644
--- a/fs/ocfs2/ocfs2_fs.h
+++ b/fs/ocfs2/ocfs2_fs.h
@@ -587,7 +587,7 @@ static inline u64 ocfs2_backup_super_blkno(struct super_block *sb, int index)
587 587
588 if (index >= 0 && index < OCFS2_MAX_BACKUP_SUPERBLOCKS) { 588 if (index >= 0 && index < OCFS2_MAX_BACKUP_SUPERBLOCKS) {
589 offset <<= (2 * index); 589 offset <<= (2 * index);
590 offset /= sb->s_blocksize; 590 offset >>= sb->s_blocksize_bits;
591 return offset; 591 return offset;
592 } 592 }
593 593
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 77a57b5799c4..1a979ea3b379 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -371,9 +371,11 @@ static int mounts_open(struct inode *inode, struct file *file)
371 371
372 if (task) { 372 if (task) {
373 task_lock(task); 373 task_lock(task);
374 ns = task->nsproxy->mnt_ns; 374 if (task->nsproxy) {
375 if (ns) 375 ns = task->nsproxy->mnt_ns;
376 get_mnt_ns(ns); 376 if (ns)
377 get_mnt_ns(ns);
378 }
377 task_unlock(task); 379 task_unlock(task);
378 put_task_struct(task); 380 put_task_struct(task);
379 } 381 }
@@ -2326,13 +2328,23 @@ static int proc_task_readdir(struct file * filp, void * dirent, filldir_t filldi
2326{ 2328{
2327 struct dentry *dentry = filp->f_path.dentry; 2329 struct dentry *dentry = filp->f_path.dentry;
2328 struct inode *inode = dentry->d_inode; 2330 struct inode *inode = dentry->d_inode;
2329 struct task_struct *leader = get_proc_task(inode); 2331 struct task_struct *leader = NULL;
2330 struct task_struct *task; 2332 struct task_struct *task;
2331 int retval = -ENOENT; 2333 int retval = -ENOENT;
2332 ino_t ino; 2334 ino_t ino;
2333 int tid; 2335 int tid;
2334 unsigned long pos = filp->f_pos; /* avoiding "long long" filp->f_pos */ 2336 unsigned long pos = filp->f_pos; /* avoiding "long long" filp->f_pos */
2335 2337
2338 task = get_proc_task(inode);
2339 if (!task)
2340 goto out_no_task;
2341 rcu_read_lock();
2342 if (pid_alive(task)) {
2343 leader = task->group_leader;
2344 get_task_struct(leader);
2345 }
2346 rcu_read_unlock();
2347 put_task_struct(task);
2336 if (!leader) 2348 if (!leader)
2337 goto out_no_task; 2349 goto out_no_task;
2338 retval = 0; 2350 retval = 0;
diff --git a/fs/reiserfs/file.c b/fs/reiserfs/file.c
index 99b6f329ba23..5109f1d5e7ff 100644
--- a/fs/reiserfs/file.c
+++ b/fs/reiserfs/file.c
@@ -48,6 +48,11 @@ static int reiserfs_file_release(struct inode *inode, struct file *filp)
48 } 48 }
49 49
50 mutex_lock(&inode->i_mutex); 50 mutex_lock(&inode->i_mutex);
51
52 mutex_lock(&(REISERFS_I(inode)->i_mmap));
53 if (REISERFS_I(inode)->i_flags & i_ever_mapped)
54 REISERFS_I(inode)->i_flags &= ~i_pack_on_close_mask;
55
51 reiserfs_write_lock(inode->i_sb); 56 reiserfs_write_lock(inode->i_sb);
52 /* freeing preallocation only involves relogging blocks that 57 /* freeing preallocation only involves relogging blocks that
53 * are already in the current transaction. preallocation gets 58 * are already in the current transaction. preallocation gets
@@ -100,11 +105,24 @@ static int reiserfs_file_release(struct inode *inode, struct file *filp)
100 err = reiserfs_truncate_file(inode, 0); 105 err = reiserfs_truncate_file(inode, 0);
101 } 106 }
102 out: 107 out:
108 mutex_unlock(&(REISERFS_I(inode)->i_mmap));
103 mutex_unlock(&inode->i_mutex); 109 mutex_unlock(&inode->i_mutex);
104 reiserfs_write_unlock(inode->i_sb); 110 reiserfs_write_unlock(inode->i_sb);
105 return err; 111 return err;
106} 112}
107 113
114static int reiserfs_file_mmap(struct file *file, struct vm_area_struct *vma)
115{
116 struct inode *inode;
117
118 inode = file->f_path.dentry->d_inode;
119 mutex_lock(&(REISERFS_I(inode)->i_mmap));
120 REISERFS_I(inode)->i_flags |= i_ever_mapped;
121 mutex_unlock(&(REISERFS_I(inode)->i_mmap));
122
123 return generic_file_mmap(file, vma);
124}
125
108static void reiserfs_vfs_truncate_file(struct inode *inode) 126static void reiserfs_vfs_truncate_file(struct inode *inode)
109{ 127{
110 reiserfs_truncate_file(inode, 1); 128 reiserfs_truncate_file(inode, 1);
@@ -1527,7 +1545,7 @@ const struct file_operations reiserfs_file_operations = {
1527#ifdef CONFIG_COMPAT 1545#ifdef CONFIG_COMPAT
1528 .compat_ioctl = reiserfs_compat_ioctl, 1546 .compat_ioctl = reiserfs_compat_ioctl,
1529#endif 1547#endif
1530 .mmap = generic_file_mmap, 1548 .mmap = reiserfs_file_mmap,
1531 .open = generic_file_open, 1549 .open = generic_file_open,
1532 .release = reiserfs_file_release, 1550 .release = reiserfs_file_release,
1533 .fsync = reiserfs_sync_file, 1551 .fsync = reiserfs_sync_file,
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c
index f3d1c4a77979..9fcbfe316977 100644
--- a/fs/reiserfs/inode.c
+++ b/fs/reiserfs/inode.c
@@ -1125,6 +1125,7 @@ static void init_inode(struct inode *inode, struct treepath *path)
1125 REISERFS_I(inode)->i_prealloc_count = 0; 1125 REISERFS_I(inode)->i_prealloc_count = 0;
1126 REISERFS_I(inode)->i_trans_id = 0; 1126 REISERFS_I(inode)->i_trans_id = 0;
1127 REISERFS_I(inode)->i_jl = NULL; 1127 REISERFS_I(inode)->i_jl = NULL;
1128 mutex_init(&(REISERFS_I(inode)->i_mmap));
1128 reiserfs_init_acl_access(inode); 1129 reiserfs_init_acl_access(inode);
1129 reiserfs_init_acl_default(inode); 1130 reiserfs_init_acl_default(inode);
1130 reiserfs_init_xattr_rwsem(inode); 1131 reiserfs_init_xattr_rwsem(inode);
@@ -1832,6 +1833,7 @@ int reiserfs_new_inode(struct reiserfs_transaction_handle *th,
1832 REISERFS_I(inode)->i_attrs = 1833 REISERFS_I(inode)->i_attrs =
1833 REISERFS_I(dir)->i_attrs & REISERFS_INHERIT_MASK; 1834 REISERFS_I(dir)->i_attrs & REISERFS_INHERIT_MASK;
1834 sd_attrs_to_i_attrs(REISERFS_I(inode)->i_attrs, inode); 1835 sd_attrs_to_i_attrs(REISERFS_I(inode)->i_attrs, inode);
1836 mutex_init(&(REISERFS_I(inode)->i_mmap));
1835 reiserfs_init_acl_access(inode); 1837 reiserfs_init_acl_access(inode);
1836 reiserfs_init_acl_default(inode); 1838 reiserfs_init_acl_default(inode);
1837 reiserfs_init_xattr_rwsem(inode); 1839 reiserfs_init_xattr_rwsem(inode);
diff --git a/fs/ufs/balloc.c b/fs/ufs/balloc.c
index 2e0021e8f366..638f4c585e89 100644
--- a/fs/ufs/balloc.c
+++ b/fs/ufs/balloc.c
@@ -227,24 +227,27 @@ failed:
227 * We can come here from ufs_writepage or ufs_prepare_write, 227 * We can come here from ufs_writepage or ufs_prepare_write,
228 * locked_page is argument of these functions, so we already lock it. 228 * locked_page is argument of these functions, so we already lock it.
229 */ 229 */
230static void ufs_change_blocknr(struct inode *inode, unsigned int baseblk, 230static void ufs_change_blocknr(struct inode *inode, unsigned int beg,
231 unsigned int count, unsigned int oldb, 231 unsigned int count, unsigned int oldb,
232 unsigned int newb, struct page *locked_page) 232 unsigned int newb, struct page *locked_page)
233{ 233{
234 unsigned int blk_per_page = 1 << (PAGE_CACHE_SHIFT - inode->i_blkbits); 234 const unsigned mask = (1 << (PAGE_CACHE_SHIFT - inode->i_blkbits)) - 1;
235 struct address_space *mapping = inode->i_mapping; 235 struct address_space * const mapping = inode->i_mapping;
236 pgoff_t index, cur_index = locked_page->index; 236 pgoff_t index, cur_index;
237 unsigned int i, j; 237 unsigned end, pos, j;
238 struct page *page; 238 struct page *page;
239 struct buffer_head *head, *bh; 239 struct buffer_head *head, *bh;
240 240
241 UFSD("ENTER, ino %lu, count %u, oldb %u, newb %u\n", 241 UFSD("ENTER, ino %lu, count %u, oldb %u, newb %u\n",
242 inode->i_ino, count, oldb, newb); 242 inode->i_ino, count, oldb, newb);
243 243
244 BUG_ON(!locked_page);
244 BUG_ON(!PageLocked(locked_page)); 245 BUG_ON(!PageLocked(locked_page));
245 246
246 for (i = 0; i < count; i += blk_per_page) { 247 cur_index = locked_page->index;
247 index = (baseblk+i) >> (PAGE_CACHE_SHIFT - inode->i_blkbits); 248
249 for (end = count + beg; beg < end; beg = (beg | mask) + 1) {
250 index = beg >> (PAGE_CACHE_SHIFT - inode->i_blkbits);
248 251
249 if (likely(cur_index != index)) { 252 if (likely(cur_index != index)) {
250 page = ufs_get_locked_page(mapping, index); 253 page = ufs_get_locked_page(mapping, index);
@@ -253,21 +256,32 @@ static void ufs_change_blocknr(struct inode *inode, unsigned int baseblk,
253 } else 256 } else
254 page = locked_page; 257 page = locked_page;
255 258
256 j = i;
257 head = page_buffers(page); 259 head = page_buffers(page);
258 bh = head; 260 bh = head;
261 pos = beg & mask;
262 for (j = 0; j < pos; ++j)
263 bh = bh->b_this_page;
264 j = 0;
259 do { 265 do {
260 if (likely(bh->b_blocknr == j + oldb && j < count)) { 266 if (buffer_mapped(bh)) {
261 unmap_underlying_metadata(bh->b_bdev, 267 pos = bh->b_blocknr - oldb;
262 bh->b_blocknr); 268 if (pos < count) {
263 bh->b_blocknr = newb + j++; 269 UFSD(" change from %llu to %llu\n",
264 mark_buffer_dirty(bh); 270 (unsigned long long)pos + oldb,
271 (unsigned long long)pos + newb);
272 bh->b_blocknr = newb + pos;
273 unmap_underlying_metadata(bh->b_bdev,
274 bh->b_blocknr);
275 mark_buffer_dirty(bh);
276 ++j;
277 }
265 } 278 }
266 279
267 bh = bh->b_this_page; 280 bh = bh->b_this_page;
268 } while (bh != head); 281 } while (bh != head);
269 282
270 set_page_dirty(page); 283 if (j)
284 set_page_dirty(page);
271 285
272 if (likely(cur_index != index)) 286 if (likely(cur_index != index))
273 ufs_put_locked_page(page); 287 ufs_put_locked_page(page);
@@ -415,14 +429,14 @@ unsigned ufs_new_fragments(struct inode * inode, __fs32 * p, unsigned fragment,
415 } 429 }
416 result = ufs_alloc_fragments (inode, cgno, goal, request, err); 430 result = ufs_alloc_fragments (inode, cgno, goal, request, err);
417 if (result) { 431 if (result) {
432 ufs_clear_frags(inode, result + oldcount, newcount - oldcount,
433 locked_page != NULL);
418 ufs_change_blocknr(inode, fragment - oldcount, oldcount, tmp, 434 ufs_change_blocknr(inode, fragment - oldcount, oldcount, tmp,
419 result, locked_page); 435 result, locked_page);
420 436
421 *p = cpu_to_fs32(sb, result); 437 *p = cpu_to_fs32(sb, result);
422 *err = 0; 438 *err = 0;
423 UFS_I(inode)->i_lastfrag = max_t(u32, UFS_I(inode)->i_lastfrag, fragment + count); 439 UFS_I(inode)->i_lastfrag = max_t(u32, UFS_I(inode)->i_lastfrag, fragment + count);
424 ufs_clear_frags(inode, result + oldcount, newcount - oldcount,
425 locked_page != NULL);
426 unlock_super(sb); 440 unlock_super(sb);
427 if (newcount < request) 441 if (newcount < request)
428 ufs_free_fragments (inode, result + newcount, request - newcount); 442 ufs_free_fragments (inode, result + newcount, request - newcount);
diff --git a/fs/ufs/inode.c b/fs/ufs/inode.c
index 2fbab0aab688..4295ca91cf85 100644
--- a/fs/ufs/inode.c
+++ b/fs/ufs/inode.c
@@ -242,7 +242,8 @@ repeat:
242 goal = tmp + uspi->s_fpb; 242 goal = tmp + uspi->s_fpb;
243 tmp = ufs_new_fragments (inode, p, fragment - blockoff, 243 tmp = ufs_new_fragments (inode, p, fragment - blockoff,
244 goal, required + blockoff, 244 goal, required + blockoff,
245 err, locked_page); 245 err,
246 phys != NULL ? locked_page : NULL);
246 } 247 }
247 /* 248 /*
248 * We will extend last allocated block 249 * We will extend last allocated block
@@ -250,7 +251,7 @@ repeat:
250 else if (lastblock == block) { 251 else if (lastblock == block) {
251 tmp = ufs_new_fragments(inode, p, fragment - (blockoff - lastblockoff), 252 tmp = ufs_new_fragments(inode, p, fragment - (blockoff - lastblockoff),
252 fs32_to_cpu(sb, *p), required + (blockoff - lastblockoff), 253 fs32_to_cpu(sb, *p), required + (blockoff - lastblockoff),
253 err, locked_page); 254 err, phys != NULL ? locked_page : NULL);
254 } else /* (lastblock > block) */ { 255 } else /* (lastblock > block) */ {
255 /* 256 /*
256 * We will allocate new block before last allocated block 257 * We will allocate new block before last allocated block
@@ -261,7 +262,8 @@ repeat:
261 goal = tmp + uspi->s_fpb; 262 goal = tmp + uspi->s_fpb;
262 } 263 }
263 tmp = ufs_new_fragments(inode, p, fragment - blockoff, 264 tmp = ufs_new_fragments(inode, p, fragment - blockoff,
264 goal, uspi->s_fpb, err, locked_page); 265 goal, uspi->s_fpb, err,
266 phys != NULL ? locked_page : NULL);
265 } 267 }
266 if (!tmp) { 268 if (!tmp) {
267 if ((!blockoff && *p) || 269 if ((!blockoff && *p) ||
@@ -438,9 +440,11 @@ int ufs_getfrag_block(struct inode *inode, sector_t fragment, struct buffer_head
438 * it much more readable: 440 * it much more readable:
439 */ 441 */
440#define GET_INODE_DATABLOCK(x) \ 442#define GET_INODE_DATABLOCK(x) \
441 ufs_inode_getfrag(inode, x, fragment, 1, &err, &phys, &new, bh_result->b_page) 443 ufs_inode_getfrag(inode, x, fragment, 1, &err, &phys, &new,\
444 bh_result->b_page)
442#define GET_INODE_PTR(x) \ 445#define GET_INODE_PTR(x) \
443 ufs_inode_getfrag(inode, x, fragment, uspi->s_fpb, &err, NULL, NULL, NULL) 446 ufs_inode_getfrag(inode, x, fragment, uspi->s_fpb, &err, NULL, NULL,\
447 bh_result->b_page)
444#define GET_INDIRECT_DATABLOCK(x) \ 448#define GET_INDIRECT_DATABLOCK(x) \
445 ufs_inode_getblock(inode, bh, x, fragment, \ 449 ufs_inode_getblock(inode, bh, x, fragment, \
446 &err, &phys, &new, bh_result->b_page) 450 &err, &phys, &new, bh_result->b_page)
diff --git a/fs/ufs/truncate.c b/fs/ufs/truncate.c
index ea11d04c41a0..0437b0a6fe97 100644
--- a/fs/ufs/truncate.c
+++ b/fs/ufs/truncate.c
@@ -109,10 +109,10 @@ static int ufs_trunc_direct (struct inode * inode)
109 tmp = fs32_to_cpu(sb, *p); 109 tmp = fs32_to_cpu(sb, *p);
110 if (!tmp ) 110 if (!tmp )
111 ufs_panic (sb, "ufs_trunc_direct", "internal error"); 111 ufs_panic (sb, "ufs_trunc_direct", "internal error");
112 frag2 -= frag1;
112 frag1 = ufs_fragnum (frag1); 113 frag1 = ufs_fragnum (frag1);
113 frag2 = ufs_fragnum (frag2);
114 114
115 ufs_free_fragments (inode, tmp + frag1, frag2 - frag1); 115 ufs_free_fragments(inode, tmp + frag1, frag2);
116 mark_inode_dirty(inode); 116 mark_inode_dirty(inode);
117 frag_to_free = tmp + frag1; 117 frag_to_free = tmp + frag1;
118 118
diff --git a/include/asm-alpha/dma-mapping.h b/include/asm-alpha/dma-mapping.h
index 57e09f5e3424..75a1aff5b57b 100644
--- a/include/asm-alpha/dma-mapping.h
+++ b/include/asm-alpha/dma-mapping.h
@@ -41,9 +41,9 @@ int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
41#define dma_map_single(dev, va, size, dir) virt_to_phys(va) 41#define dma_map_single(dev, va, size, dir) virt_to_phys(va)
42#define dma_map_page(dev, page, off, size, dir) (page_to_pa(page) + off) 42#define dma_map_page(dev, page, off, size, dir) (page_to_pa(page) + off)
43 43
44#define dma_unmap_single(dev, addr, size, dir) do { } while (0) 44#define dma_unmap_single(dev, addr, size, dir) ((void)0)
45#define dma_unmap_page(dev, addr, size, dir) do { } while (0) 45#define dma_unmap_page(dev, addr, size, dir) ((void)0)
46#define dma_unmap_sg(dev, sg, nents, dir) do { } while (0) 46#define dma_unmap_sg(dev, sg, nents, dir) ((void)0)
47 47
48#define dma_mapping_error(addr) (0) 48#define dma_mapping_error(addr) (0)
49 49
@@ -55,12 +55,14 @@ int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
55 55
56int dma_set_mask(struct device *dev, u64 mask); 56int dma_set_mask(struct device *dev, u64 mask);
57 57
58#define dma_sync_single_for_cpu(dev, addr, size, dir) do { } while (0) 58#define dma_sync_single_for_cpu(dev, addr, size, dir) ((void)0)
59#define dma_sync_single_for_device(dev, addr, size, dir) do { } while (0) 59#define dma_sync_single_for_device(dev, addr, size, dir) ((void)0)
60#define dma_sync_single_range(dev, addr, off, size, dir) do { } while (0) 60#define dma_sync_single_range(dev, addr, off, size, dir) ((void)0)
61#define dma_sync_sg_for_cpu(dev, sg, nents, dir) do { } while (0) 61#define dma_sync_sg_for_cpu(dev, sg, nents, dir) ((void)0)
62#define dma_sync_sg_for_device(dev, sg, nents, dir) do { } while (0) 62#define dma_sync_sg_for_device(dev, sg, nents, dir) ((void)0)
63#define dma_cache_sync(dev, va, size, dir) do { } while (0) 63#define dma_cache_sync(dev, va, size, dir) ((void)0)
64#define dma_sync_single_range_for_cpu(dev, addr, offset, size, dir) ((void)0)
65#define dma_sync_single_range_for_device(dev, addr, offset, size, dir) ((void)0)
64 66
65#define dma_get_cache_alignment() L1_CACHE_BYTES 67#define dma_get_cache_alignment() L1_CACHE_BYTES
66 68
diff --git a/include/asm-alpha/unistd.h b/include/asm-alpha/unistd.h
index 84313d14e780..e58a427012dd 100644
--- a/include/asm-alpha/unistd.h
+++ b/include/asm-alpha/unistd.h
@@ -342,9 +342,14 @@
342#define __NR_io_cancel 402 342#define __NR_io_cancel 402
343#define __NR_exit_group 405 343#define __NR_exit_group 405
344#define __NR_lookup_dcookie 406 344#define __NR_lookup_dcookie 406
345#define __NR_sys_epoll_create 407 345#define __NR_epoll_create 407
346#define __NR_sys_epoll_ctl 408 346#define __NR_epoll_ctl 408
347#define __NR_sys_epoll_wait 409 347#define __NR_epoll_wait 409
348/* Feb 2007: These three sys_epoll defines shouldn't be here but culling
349 * them would break userspace apps ... we'll kill them off in 2010 :) */
350#define __NR_sys_epoll_create __NR_epoll_create
351#define __NR_sys_epoll_ctl __NR_epoll_ctl
352#define __NR_sys_epoll_wait __NR_epoll_wait
348#define __NR_remap_file_pages 410 353#define __NR_remap_file_pages 410
349#define __NR_set_tid_address 411 354#define __NR_set_tid_address 411
350#define __NR_restart_syscall 412 355#define __NR_restart_syscall 412
diff --git a/include/asm-arm/arch-at91rm9200/at91_ecc.h b/include/asm-arm/arch-at91rm9200/at91_ecc.h
index fddf256a98d3..5c564ede5c5d 100644
--- a/include/asm-arm/arch-at91rm9200/at91_ecc.h
+++ b/include/asm-arm/arch-at91rm9200/at91_ecc.h
@@ -14,7 +14,7 @@
14#define AT91_ECC_H 14#define AT91_ECC_H
15 15
16#define AT91_ECC_CR (AT91_ECC + 0x00) /* Control register */ 16#define AT91_ECC_CR (AT91_ECC + 0x00) /* Control register */
17#define AT91_ECC_RST (1 << 0) /* Reset parity */ 17#define AT91_ECC_RST (1 << 0) /* Reset parity */
18 18
19#define AT91_ECC_MR (AT91_ECC + 0x04) /* Mode register */ 19#define AT91_ECC_MR (AT91_ECC + 0x04) /* Mode register */
20#define AT91_ECC_PAGESIZE (3 << 0) /* Page Size */ 20#define AT91_ECC_PAGESIZE (3 << 0) /* Page Size */
@@ -23,16 +23,16 @@
23#define AT91_ECC_PAGESIZE_2112 (2) 23#define AT91_ECC_PAGESIZE_2112 (2)
24#define AT91_ECC_PAGESIZE_4224 (3) 24#define AT91_ECC_PAGESIZE_4224 (3)
25 25
26#define AT91_ECC_SR (AT91_ECC + 0x08) /* Status register */ 26#define AT91_ECC_SR (AT91_ECC + 0x08) /* Status register */
27#define AT91_ECC_RECERR (1 << 0) /* Recoverable Error */ 27#define AT91_ECC_RECERR (1 << 0) /* Recoverable Error */
28#define AT91_ECC_ECCERR (1 << 1) /* ECC Single Bit Error */ 28#define AT91_ECC_ECCERR (1 << 1) /* ECC Single Bit Error */
29#define AT91_ECC_MULERR (1 << 2) /* Multiple Errors */ 29#define AT91_ECC_MULERR (1 << 2) /* Multiple Errors */
30 30
31#define AT91_ECC_PR (AT91_ECC + 0x0c) /* Parity register */ 31#define AT91_ECC_PR (AT91_ECC + 0x0c) /* Parity register */
32#define AT91_ECC_BITADDR (0xf << 0) /* Bit Error Address */ 32#define AT91_ECC_BITADDR (0xf << 0) /* Bit Error Address */
33#define AT91_ECC_WORDADDR (0xfff << 4) /* Word Error Address */ 33#define AT91_ECC_WORDADDR (0xfff << 4) /* Word Error Address */
34 34
35#define AT91_ECC_NPR (AT91_ECC + 0x10) /* NParity register */ 35#define AT91_ECC_NPR (AT91_ECC + 0x10) /* NParity register */
36#define AT91_ECC_NPARITY (0xffff << 0) /* NParity */ 36#define AT91_ECC_NPARITY (0xffff << 0) /* NParity */
37 37
38#endif 38#endif
diff --git a/include/asm-arm/arch-at91rm9200/at91_pmc.h b/include/asm-arm/arch-at91rm9200/at91_pmc.h
index de8c3da74a01..c3b489d09b6c 100644
--- a/include/asm-arm/arch-at91rm9200/at91_pmc.h
+++ b/include/asm-arm/arch-at91rm9200/at91_pmc.h
@@ -61,7 +61,7 @@
61#define AT91_PMC_CSS_PLLA (2 << 0) 61#define AT91_PMC_CSS_PLLA (2 << 0)
62#define AT91_PMC_CSS_PLLB (3 << 0) 62#define AT91_PMC_CSS_PLLB (3 << 0)
63#define AT91_PMC_PRES (7 << 2) /* Master Clock Prescaler */ 63#define AT91_PMC_PRES (7 << 2) /* Master Clock Prescaler */
64#define AT91_PMC_PRES_1 (0 << 2) 64#define AT91_PMC_PRES_1 (0 << 2)
65#define AT91_PMC_PRES_2 (1 << 2) 65#define AT91_PMC_PRES_2 (1 << 2)
66#define AT91_PMC_PRES_4 (2 << 2) 66#define AT91_PMC_PRES_4 (2 << 2)
67#define AT91_PMC_PRES_8 (3 << 2) 67#define AT91_PMC_PRES_8 (3 << 2)
diff --git a/include/asm-arm/arch-at91rm9200/at91_rstc.h b/include/asm-arm/arch-at91rm9200/at91_rstc.h
index ccdc52da973d..237d3c40b318 100644
--- a/include/asm-arm/arch-at91rm9200/at91_rstc.h
+++ b/include/asm-arm/arch-at91rm9200/at91_rstc.h
@@ -17,7 +17,7 @@
17#define AT91_RSTC_PROCRST (1 << 0) /* Processor Reset */ 17#define AT91_RSTC_PROCRST (1 << 0) /* Processor Reset */
18#define AT91_RSTC_PERRST (1 << 2) /* Peripheral Reset */ 18#define AT91_RSTC_PERRST (1 << 2) /* Peripheral Reset */
19#define AT91_RSTC_EXTRST (1 << 3) /* External Reset */ 19#define AT91_RSTC_EXTRST (1 << 3) /* External Reset */
20#define AT01_RSTC_KEY (0xff << 24) /* KEY Password */ 20#define AT91_RSTC_KEY (0xff << 24) /* KEY Password */
21 21
22#define AT91_RSTC_SR (AT91_RSTC + 0x04) /* Reset Controller Status Register */ 22#define AT91_RSTC_SR (AT91_RSTC + 0x04) /* Reset Controller Status Register */
23#define AT91_RSTC_URSTS (1 << 0) /* User Reset Status */ 23#define AT91_RSTC_URSTS (1 << 0) /* User Reset Status */
diff --git a/include/asm-arm/arch-at91rm9200/at91_rtc.h b/include/asm-arm/arch-at91rm9200/at91_rtc.h
index 6e5065d56260..095fe0883102 100644
--- a/include/asm-arm/arch-at91rm9200/at91_rtc.h
+++ b/include/asm-arm/arch-at91rm9200/at91_rtc.h
@@ -21,21 +21,21 @@
21#define AT91_RTC_UPDCAL (1 << 1) /* Update Request Calendar Register */ 21#define AT91_RTC_UPDCAL (1 << 1) /* Update Request Calendar Register */
22#define AT91_RTC_TIMEVSEL (3 << 8) /* Time Event Selection */ 22#define AT91_RTC_TIMEVSEL (3 << 8) /* Time Event Selection */
23#define AT91_RTC_TIMEVSEL_MINUTE (0 << 8) 23#define AT91_RTC_TIMEVSEL_MINUTE (0 << 8)
24#define AT91_RTC_TIMEVSEL_HOUR (1 << 8) 24#define AT91_RTC_TIMEVSEL_HOUR (1 << 8)
25#define AT91_RTC_TIMEVSEL_DAY24 (2 << 8) 25#define AT91_RTC_TIMEVSEL_DAY24 (2 << 8)
26#define AT91_RTC_TIMEVSEL_DAY12 (3 << 8) 26#define AT91_RTC_TIMEVSEL_DAY12 (3 << 8)
27#define AT91_RTC_CALEVSEL (3 << 16) /* Calendar Event Selection */ 27#define AT91_RTC_CALEVSEL (3 << 16) /* Calendar Event Selection */
28#define AT91_RTC_CALEVSEL_WEEK (0 << 16) 28#define AT91_RTC_CALEVSEL_WEEK (0 << 16)
29#define AT91_RTC_CALEVSEL_MONTH (1 << 16) 29#define AT91_RTC_CALEVSEL_MONTH (1 << 16)
30#define AT91_RTC_CALEVSEL_YEAR (2 << 16) 30#define AT91_RTC_CALEVSEL_YEAR (2 << 16)
31 31
32#define AT91_RTC_MR (AT91_RTC + 0x04) /* Mode Register */ 32#define AT91_RTC_MR (AT91_RTC + 0x04) /* Mode Register */
33#define AT91_RTC_HRMOD (1 << 0) /* 12/24 Hour Mode */ 33#define AT91_RTC_HRMOD (1 << 0) /* 12/24 Hour Mode */
34 34
35#define AT91_RTC_TIMR (AT91_RTC + 0x08) /* Time Register */ 35#define AT91_RTC_TIMR (AT91_RTC + 0x08) /* Time Register */
36#define AT91_RTC_SEC (0x7f << 0) /* Current Second */ 36#define AT91_RTC_SEC (0x7f << 0) /* Current Second */
37#define AT91_RTC_MIN (0x7f << 8) /* Current Minute */ 37#define AT91_RTC_MIN (0x7f << 8) /* Current Minute */
38#define AT91_RTC_HOUR (0x3f << 16) /* Current Hour */ 38#define AT91_RTC_HOUR (0x3f << 16) /* Current Hour */
39#define AT91_RTC_AMPM (1 << 22) /* Ante Meridiem Post Meridiem Indicator */ 39#define AT91_RTC_AMPM (1 << 22) /* Ante Meridiem Post Meridiem Indicator */
40 40
41#define AT91_RTC_CALR (AT91_RTC + 0x0c) /* Calendar Register */ 41#define AT91_RTC_CALR (AT91_RTC + 0x0c) /* Calendar Register */
diff --git a/include/asm-arm/arch-at91rm9200/at91rm9200.h b/include/asm-arm/arch-at91rm9200/at91rm9200.h
index 4d51177efddd..c569b6a21a42 100644
--- a/include/asm-arm/arch-at91rm9200/at91rm9200.h
+++ b/include/asm-arm/arch-at91rm9200/at91rm9200.h
@@ -274,7 +274,7 @@
274#define AT91_PD19_TPK7 (1 << 19) /* B: ETM Trace Packet Port 7 */ 274#define AT91_PD19_TPK7 (1 << 19) /* B: ETM Trace Packet Port 7 */
275#define AT91_PD20_NPCS3 (1 << 20) /* A: SPI Peripheral Chip Select 3 */ 275#define AT91_PD20_NPCS3 (1 << 20) /* A: SPI Peripheral Chip Select 3 */
276#define AT91_PD20_TPK8 (1 << 20) /* B: ETM Trace Packet Port 8 */ 276#define AT91_PD20_TPK8 (1 << 20) /* B: ETM Trace Packet Port 8 */
277#define AT91_PD21_RTS0 (1 << 21) /* A: USART Ready To Send 0 */ 277#define AT91_PD21_RTS0 (1 << 21) /* A: USART Ready To Send 0 */
278#define AT91_PD21_TPK9 (1 << 21) /* B: ETM Trace Packet Port 9 */ 278#define AT91_PD21_TPK9 (1 << 21) /* B: ETM Trace Packet Port 9 */
279#define AT91_PD22_RTS1 (1 << 22) /* A: USART Ready To Send 1 */ 279#define AT91_PD22_RTS1 (1 << 22) /* A: USART Ready To Send 1 */
280#define AT91_PD22_TPK10 (1 << 22) /* B: ETM Trace Packet Port 10 */ 280#define AT91_PD22_TPK10 (1 << 22) /* B: ETM Trace Packet Port 10 */
diff --git a/include/asm-arm/arch-at91rm9200/at91sam9260_matrix.h b/include/asm-arm/arch-at91rm9200/at91sam9260_matrix.h
index 746d973705bf..78f6b4917b8b 100644
--- a/include/asm-arm/arch-at91rm9200/at91sam9260_matrix.h
+++ b/include/asm-arm/arch-at91rm9200/at91sam9260_matrix.h
@@ -58,7 +58,7 @@
58#define AT91_MATRIX_RCB1 (1 << 1) /* Remap Command for AHB Master 1 (ARM926EJ-S Data Master) */ 58#define AT91_MATRIX_RCB1 (1 << 1) /* Remap Command for AHB Master 1 (ARM926EJ-S Data Master) */
59 59
60#define AT91_MATRIX_EBICSA (AT91_MATRIX + 0x11C) /* EBI Chip Select Assignment Register */ 60#define AT91_MATRIX_EBICSA (AT91_MATRIX + 0x11C) /* EBI Chip Select Assignment Register */
61#define AT91_MATRIX_CS1A (1 << 1) /* Chip Select 1 Assignment */ 61#define AT91_MATRIX_CS1A (1 << 1) /* Chip Select 1 Assignment */
62#define AT91_MATRIX_CS1A_SMC (0 << 1) 62#define AT91_MATRIX_CS1A_SMC (0 << 1)
63#define AT91_MATRIX_CS1A_SDRAMC (1 << 1) 63#define AT91_MATRIX_CS1A_SDRAMC (1 << 1)
64#define AT91_MATRIX_CS3A (1 << 3) /* Chip Select 3 Assignment */ 64#define AT91_MATRIX_CS3A (1 << 3) /* Chip Select 3 Assignment */
diff --git a/include/asm-arm/arch-at91rm9200/at91sam9261_matrix.h b/include/asm-arm/arch-at91rm9200/at91sam9261_matrix.h
index 270a5dcdf1cd..ec88efabbe6c 100644
--- a/include/asm-arm/arch-at91rm9200/at91sam9261_matrix.h
+++ b/include/asm-arm/arch-at91rm9200/at91sam9261_matrix.h
@@ -15,7 +15,7 @@
15 15
16#define AT91_MATRIX_MCFG (AT91_MATRIX + 0x00) /* Master Configuration Register */ 16#define AT91_MATRIX_MCFG (AT91_MATRIX + 0x00) /* Master Configuration Register */
17#define AT91_MATRIX_RCB0 (1 << 0) /* Remap Command for AHB Master 0 (ARM926EJ-S Instruction Master) */ 17#define AT91_MATRIX_RCB0 (1 << 0) /* Remap Command for AHB Master 0 (ARM926EJ-S Instruction Master) */
18#define AT01_MATRIX_RCB1 (1 << 1) /* Remap Command for AHB Master 1 (ARM926EJ-S Data Master) */ 18#define AT91_MATRIX_RCB1 (1 << 1) /* Remap Command for AHB Master 1 (ARM926EJ-S Data Master) */
19 19
20#define AT91_MATRIX_SCFG0 (AT91_MATRIX + 0x04) /* Slave Configuration Register 0 */ 20#define AT91_MATRIX_SCFG0 (AT91_MATRIX + 0x04) /* Slave Configuration Register 0 */
21#define AT91_MATRIX_SCFG1 (AT91_MATRIX + 0x08) /* Slave Configuration Register 1 */ 21#define AT91_MATRIX_SCFG1 (AT91_MATRIX + 0x08) /* Slave Configuration Register 1 */
@@ -43,8 +43,8 @@
43 43
44#define AT91_MATRIX_EBICSA (AT91_MATRIX + 0x30) /* EBI Chip Select Assignment Register */ 44#define AT91_MATRIX_EBICSA (AT91_MATRIX + 0x30) /* EBI Chip Select Assignment Register */
45#define AT91_MATRIX_CS1A (1 << 1) /* Chip Select 1 Assignment */ 45#define AT91_MATRIX_CS1A (1 << 1) /* Chip Select 1 Assignment */
46#define AT91_MATRIX_CS1A_SMC (0 << 1) 46#define AT91_MATRIX_CS1A_SMC (0 << 1)
47#define AT91_MATRIX_CS1A_SDRAMC (1 << 1) 47#define AT91_MATRIX_CS1A_SDRAMC (1 << 1)
48#define AT91_MATRIX_CS3A (1 << 3) /* Chip Select 3 Assignment */ 48#define AT91_MATRIX_CS3A (1 << 3) /* Chip Select 3 Assignment */
49#define AT91_MATRIX_CS3A_SMC (0 << 3) 49#define AT91_MATRIX_CS3A_SMC (0 << 3)
50#define AT91_MATRIX_CS3A_SMC_SMARTMEDIA (1 << 3) 50#define AT91_MATRIX_CS3A_SMC_SMARTMEDIA (1 << 3)
diff --git a/include/asm-arm/arch-at91rm9200/at91sam926x_mc.h b/include/asm-arm/arch-at91rm9200/at91sam926x_mc.h
index 7d94968b5d57..972e7531c7f4 100644
--- a/include/asm-arm/arch-at91rm9200/at91sam926x_mc.h
+++ b/include/asm-arm/arch-at91rm9200/at91sam926x_mc.h
@@ -33,14 +33,14 @@
33#define AT91_SDRAMC_NC_9 (1 << 0) 33#define AT91_SDRAMC_NC_9 (1 << 0)
34#define AT91_SDRAMC_NC_10 (2 << 0) 34#define AT91_SDRAMC_NC_10 (2 << 0)
35#define AT91_SDRAMC_NC_11 (3 << 0) 35#define AT91_SDRAMC_NC_11 (3 << 0)
36#define AT91_SDRAMC_NR (3 << 2) /* Number of Row Bits */ 36#define AT91_SDRAMC_NR (3 << 2) /* Number of Row Bits */
37#define AT91_SDRAMC_NR_11 (0 << 2) 37#define AT91_SDRAMC_NR_11 (0 << 2)
38#define AT91_SDRAMC_NR_12 (1 << 2) 38#define AT91_SDRAMC_NR_12 (1 << 2)
39#define AT91_SDRAMC_NR_13 (2 << 2) 39#define AT91_SDRAMC_NR_13 (2 << 2)
40#define AT91_SDRAMC_NB (1 << 4) /* Number of Banks */ 40#define AT91_SDRAMC_NB (1 << 4) /* Number of Banks */
41#define AT91_SDRAMC_NB_2 (0 << 4) 41#define AT91_SDRAMC_NB_2 (0 << 4)
42#define AT91_SDRAMC_NB_4 (1 << 4) 42#define AT91_SDRAMC_NB_4 (1 << 4)
43#define AT91_SDRAMC_CAS (3 << 5) /* CAS Latency */ 43#define AT91_SDRAMC_CAS (3 << 5) /* CAS Latency */
44#define AT91_SDRAMC_CAS_1 (1 << 5) 44#define AT91_SDRAMC_CAS_1 (1 << 5)
45#define AT91_SDRAMC_CAS_2 (2 << 5) 45#define AT91_SDRAMC_CAS_2 (2 << 5)
46#define AT91_SDRAMC_CAS_3 (3 << 5) 46#define AT91_SDRAMC_CAS_3 (3 << 5)
@@ -110,10 +110,10 @@
110#define AT91_SMC_MODE(n) (AT91_SMC + 0x0c + ((n)*0x10)) /* Mode Register for CS n */ 110#define AT91_SMC_MODE(n) (AT91_SMC + 0x0c + ((n)*0x10)) /* Mode Register for CS n */
111#define AT91_SMC_READMODE (1 << 0) /* Read Mode */ 111#define AT91_SMC_READMODE (1 << 0) /* Read Mode */
112#define AT91_SMC_WRITEMODE (1 << 1) /* Write Mode */ 112#define AT91_SMC_WRITEMODE (1 << 1) /* Write Mode */
113#define AT91_SMC_EXNWMODE (3 << 5) /* NWAIT Mode */ 113#define AT91_SMC_EXNWMODE (3 << 4) /* NWAIT Mode */
114#define AT91_SMC_EXNWMODE_DISABLE (0 << 5) 114#define AT91_SMC_EXNWMODE_DISABLE (0 << 4)
115#define AT91_SMC_EXNWMODE_FROZEN (2 << 5) 115#define AT91_SMC_EXNWMODE_FROZEN (2 << 4)
116#define AT91_SMC_EXNWMODE_READY (3 << 5) 116#define AT91_SMC_EXNWMODE_READY (3 << 4)
117#define AT91_SMC_BAT (1 << 8) /* Byte Access Type */ 117#define AT91_SMC_BAT (1 << 8) /* Byte Access Type */
118#define AT91_SMC_BAT_SELECT (0 << 8) 118#define AT91_SMC_BAT_SELECT (0 << 8)
119#define AT91_SMC_BAT_WRITE (1 << 8) 119#define AT91_SMC_BAT_WRITE (1 << 8)
diff --git a/include/asm-arm/arch-s3c2410/regs-gpio.h b/include/asm-arm/arch-s3c2410/regs-gpio.h
index b2893e32a236..eae91694edcd 100644
--- a/include/asm-arm/arch-s3c2410/regs-gpio.h
+++ b/include/asm-arm/arch-s3c2410/regs-gpio.h
@@ -52,10 +52,10 @@
52/* general configuration options */ 52/* general configuration options */
53 53
54#define S3C2410_GPIO_LEAVE (0xFFFFFFFF) 54#define S3C2410_GPIO_LEAVE (0xFFFFFFFF)
55#define S3C2410_GPIO_INPUT (0xFFFFFFF0) 55#define S3C2410_GPIO_INPUT (0xFFFFFFF0) /* not available on A */
56#define S3C2410_GPIO_OUTPUT (0xFFFFFFF1) 56#define S3C2410_GPIO_OUTPUT (0xFFFFFFF1)
57#define S3C2410_GPIO_IRQ (0xFFFFFFF2) /* not available for all */ 57#define S3C2410_GPIO_IRQ (0xFFFFFFF2) /* not available for all */
58#define S3C2410_GPIO_SFN2 (0xFFFFFFF2) /* not available on A */ 58#define S3C2410_GPIO_SFN2 (0xFFFFFFF2) /* bank A => addr/cs/nand */
59#define S3C2410_GPIO_SFN3 (0xFFFFFFF3) /* not available on A */ 59#define S3C2410_GPIO_SFN3 (0xFFFFFFF3) /* not available on A */
60 60
61/* register address for the GPIO registers. 61/* register address for the GPIO registers.
diff --git a/include/asm-arm/arch-s3c2410/regs-mem.h b/include/asm-arm/arch-s3c2410/regs-mem.h
index 375dca50364e..e4d82341f7ba 100644
--- a/include/asm-arm/arch-s3c2410/regs-mem.h
+++ b/include/asm-arm/arch-s3c2410/regs-mem.h
@@ -133,10 +133,10 @@
133#define S3C2410_BANKCON_SDRAM (0x3 << 15) 133#define S3C2410_BANKCON_SDRAM (0x3 << 15)
134 134
135/* next bits only for EDO DRAM in 6,7 */ 135/* next bits only for EDO DRAM in 6,7 */
136#define S3C2400_BANKCON_EDO_Trdc1 (0x00 << 4) 136#define S3C2400_BANKCON_EDO_Trcd1 (0x00 << 4)
137#define S3C2400_BANKCON_EDO_Trdc2 (0x01 << 4) 137#define S3C2400_BANKCON_EDO_Trcd2 (0x01 << 4)
138#define S3C2400_BANKCON_EDO_Trdc3 (0x02 << 4) 138#define S3C2400_BANKCON_EDO_Trcd3 (0x02 << 4)
139#define S3C2400_BANKCON_EDO_Trdc4 (0x03 << 4) 139#define S3C2400_BANKCON_EDO_Trcd4 (0x03 << 4)
140 140
141/* CAS pulse width */ 141/* CAS pulse width */
142#define S3C2400_BANKCON_EDO_PULSE1 (0x00 << 3) 142#define S3C2400_BANKCON_EDO_PULSE1 (0x00 << 3)
@@ -153,9 +153,9 @@
153#define S3C2400_BANKCON_EDO_SCANb11 (0x03 << 0) 153#define S3C2400_BANKCON_EDO_SCANb11 (0x03 << 0)
154 154
155/* next bits only for SDRAM in 6,7 */ 155/* next bits only for SDRAM in 6,7 */
156#define S3C2410_BANKCON_Trdc2 (0x00 << 2) 156#define S3C2410_BANKCON_Trcd2 (0x00 << 2)
157#define S3C2410_BANKCON_Trdc3 (0x01 << 2) 157#define S3C2410_BANKCON_Trcd3 (0x01 << 2)
158#define S3C2410_BANKCON_Trdc4 (0x02 << 2) 158#define S3C2410_BANKCON_Trcd4 (0x02 << 2)
159 159
160/* control column address select */ 160/* control column address select */
161#define S3C2410_BANKCON_SCANb8 (0x00 << 0) 161#define S3C2410_BANKCON_SCANb8 (0x00 << 0)
diff --git a/include/asm-arm/fpstate.h b/include/asm-arm/fpstate.h
index 6af4e6bd1290..f31cda5a55ee 100644
--- a/include/asm-arm/fpstate.h
+++ b/include/asm-arm/fpstate.h
@@ -35,6 +35,9 @@ struct vfp_hard_struct {
35 */ 35 */
36 __u32 fpinst; 36 __u32 fpinst;
37 __u32 fpinst2; 37 __u32 fpinst2;
38#ifdef CONFIG_SMP
39 __u32 cpu;
40#endif
38}; 41};
39 42
40union vfp_state { 43union vfp_state {
diff --git a/include/asm-frv/Kbuild b/include/asm-frv/Kbuild
index c68e1680da01..966a9836d556 100644
--- a/include/asm-frv/Kbuild
+++ b/include/asm-frv/Kbuild
@@ -1 +1,7 @@
1include include/asm-generic/Kbuild.asm 1include include/asm-generic/Kbuild.asm
2
3header-y += registers.h
4
5unifdef-y += termios.h
6unifdef-y += ptrace.h
7unifdef-y += page.h
diff --git a/include/asm-frv/page.h b/include/asm-frv/page.h
index 134cc0cdf6c2..213d92fd652a 100644
--- a/include/asm-frv/page.h
+++ b/include/asm-frv/page.h
@@ -76,8 +76,6 @@ extern unsigned long max_pfn;
76 76
77#endif /* __ASSEMBLY__ */ 77#endif /* __ASSEMBLY__ */
78 78
79#endif /* __KERNEL__ */
80
81#ifdef CONFIG_CONTIGUOUS_PAGE_ALLOC 79#ifdef CONFIG_CONTIGUOUS_PAGE_ALLOC
82#define WANT_PAGE_VIRTUAL 1 80#define WANT_PAGE_VIRTUAL 1
83#endif 81#endif
@@ -85,4 +83,6 @@ extern unsigned long max_pfn;
85#include <asm-generic/memory_model.h> 83#include <asm-generic/memory_model.h>
86#include <asm-generic/page.h> 84#include <asm-generic/page.h>
87 85
86#endif /* __KERNEL__ */
87
88#endif /* _ASM_PAGE_H */ 88#endif /* _ASM_PAGE_H */
diff --git a/include/asm-frv/ptrace.h b/include/asm-frv/ptrace.h
index 9a2241b8eb1e..cf6934012b64 100644
--- a/include/asm-frv/ptrace.h
+++ b/include/asm-frv/ptrace.h
@@ -12,9 +12,11 @@
12#define _ASM_PTRACE_H 12#define _ASM_PTRACE_H
13 13
14#include <asm/registers.h> 14#include <asm/registers.h>
15#ifdef __KERNEL__
15#include <asm/irq_regs.h> 16#include <asm/irq_regs.h>
16 17
17#define in_syscall(regs) (((regs)->tbr & TBR_TT) == TBR_TT_TRAP0) 18#define in_syscall(regs) (((regs)->tbr & TBR_TT) == TBR_TT_TRAP0)
19#endif
18 20
19 21
20#define PT_PSR 0 22#define PT_PSR 0
@@ -60,6 +62,7 @@
60#define PTRACE_GETFDPIC_EXEC 0 /* [addr] request the executable loadmap */ 62#define PTRACE_GETFDPIC_EXEC 0 /* [addr] request the executable loadmap */
61#define PTRACE_GETFDPIC_INTERP 1 /* [addr] request the interpreter loadmap */ 63#define PTRACE_GETFDPIC_INTERP 1 /* [addr] request the interpreter loadmap */
62 64
65#ifdef __KERNEL__
63#ifndef __ASSEMBLY__ 66#ifndef __ASSEMBLY__
64 67
65/* 68/*
@@ -74,6 +77,7 @@ register struct pt_regs *__frame asm("gr28");
74extern unsigned long user_stack(const struct pt_regs *); 77extern unsigned long user_stack(const struct pt_regs *);
75extern void show_regs(struct pt_regs *); 78extern void show_regs(struct pt_regs *);
76#define profile_pc(regs) ((regs)->pc) 79#define profile_pc(regs) ((regs)->pc)
80#endif
77 81
78#endif /* !__ASSEMBLY__ */ 82#endif /* !__ASSEMBLY__ */
79#endif /* _ASM_PTRACE_H */ 83#endif /* _ASM_PTRACE_H */
diff --git a/include/asm-frv/termios.h b/include/asm-frv/termios.h
index b4a664e7f55c..8840cf95e8dd 100644
--- a/include/asm-frv/termios.h
+++ b/include/asm-frv/termios.h
@@ -69,6 +69,8 @@ struct termio {
69#define N_SYNC_PPP 14 69#define N_SYNC_PPP 14
70#define N_HCI 15 /* Bluetooth HCI UART */ 70#define N_HCI 15 /* Bluetooth HCI UART */
71 71
72#ifdef __KERNEL__
72#include <asm-generic/termios.h> 73#include <asm-generic/termios.h>
74#endif
73 75
74#endif /* _ASM_TERMIOS_H */ 76#endif /* _ASM_TERMIOS_H */
diff --git a/include/asm-generic/libata-portmap.h b/include/asm-generic/libata-portmap.h
index 9202fd02d5be..62fb3618293d 100644
--- a/include/asm-generic/libata-portmap.h
+++ b/include/asm-generic/libata-portmap.h
@@ -3,10 +3,10 @@
3 3
4#define ATA_PRIMARY_CMD 0x1F0 4#define ATA_PRIMARY_CMD 0x1F0
5#define ATA_PRIMARY_CTL 0x3F6 5#define ATA_PRIMARY_CTL 0x3F6
6#define ATA_PRIMARY_IRQ 14 6#define ATA_PRIMARY_IRQ(dev) 14
7 7
8#define ATA_SECONDARY_CMD 0x170 8#define ATA_SECONDARY_CMD 0x170
9#define ATA_SECONDARY_CTL 0x376 9#define ATA_SECONDARY_CTL 0x376
10#define ATA_SECONDARY_IRQ 15 10#define ATA_SECONDARY_IRQ(dev) 15
11 11
12#endif 12#endif
diff --git a/include/asm-i386/elf.h b/include/asm-i386/elf.h
index 45d21a0c95bf..369035dfe4b6 100644
--- a/include/asm-i386/elf.h
+++ b/include/asm-i386/elf.h
@@ -143,11 +143,8 @@ extern int dump_task_extended_fpu (struct task_struct *, struct user_fxsr_struct
143# define VDSO_PRELINK 0 143# define VDSO_PRELINK 0
144#endif 144#endif
145 145
146#define VDSO_COMPAT_SYM(x) \
147 (VDSO_COMPAT_BASE + (unsigned long)(x) - VDSO_PRELINK)
148
149#define VDSO_SYM(x) \ 146#define VDSO_SYM(x) \
150 (VDSO_BASE + (unsigned long)(x) - VDSO_PRELINK) 147 (VDSO_COMPAT_BASE + (unsigned long)(x) - VDSO_PRELINK)
151 148
152#define VDSO_HIGH_EHDR ((const struct elfhdr *) VDSO_HIGH_BASE) 149#define VDSO_HIGH_EHDR ((const struct elfhdr *) VDSO_HIGH_BASE)
153#define VDSO_EHDR ((const struct elfhdr *) VDSO_COMPAT_BASE) 150#define VDSO_EHDR ((const struct elfhdr *) VDSO_COMPAT_BASE)
@@ -156,10 +153,12 @@ extern void __kernel_vsyscall;
156 153
157#define VDSO_ENTRY VDSO_SYM(&__kernel_vsyscall) 154#define VDSO_ENTRY VDSO_SYM(&__kernel_vsyscall)
158 155
156#ifndef CONFIG_COMPAT_VDSO
159#define ARCH_HAS_SETUP_ADDITIONAL_PAGES 157#define ARCH_HAS_SETUP_ADDITIONAL_PAGES
160struct linux_binprm; 158struct linux_binprm;
161extern int arch_setup_additional_pages(struct linux_binprm *bprm, 159extern int arch_setup_additional_pages(struct linux_binprm *bprm,
162 int executable_stack); 160 int executable_stack);
161#endif
163 162
164extern unsigned int vdso_enabled; 163extern unsigned int vdso_enabled;
165 164
@@ -169,50 +168,6 @@ do if (vdso_enabled) { \
169 NEW_AUX_ENT(AT_SYSINFO_EHDR, VDSO_COMPAT_BASE); \ 168 NEW_AUX_ENT(AT_SYSINFO_EHDR, VDSO_COMPAT_BASE); \
170} while (0) 169} while (0)
171 170
172/*
173 * These macros parameterize elf_core_dump in fs/binfmt_elf.c to write out
174 * extra segments containing the vsyscall DSO contents. Dumping its
175 * contents makes post-mortem fully interpretable later without matching up
176 * the same kernel and hardware config to see what PC values meant.
177 * Dumping its extra ELF program headers includes all the other information
178 * a debugger needs to easily find how the vsyscall DSO was being used.
179 */
180#define ELF_CORE_EXTRA_PHDRS (VDSO_HIGH_EHDR->e_phnum)
181#define ELF_CORE_WRITE_EXTRA_PHDRS \
182do { \
183 const struct elf_phdr *const vsyscall_phdrs = \
184 (const struct elf_phdr *) (VDSO_HIGH_BASE \
185 + VDSO_HIGH_EHDR->e_phoff); \
186 int i; \
187 Elf32_Off ofs = 0; \
188 for (i = 0; i < VDSO_HIGH_EHDR->e_phnum; ++i) { \
189 struct elf_phdr phdr = vsyscall_phdrs[i]; \
190 if (phdr.p_type == PT_LOAD) { \
191 BUG_ON(ofs != 0); \
192 ofs = phdr.p_offset = offset; \
193 phdr.p_memsz = PAGE_ALIGN(phdr.p_memsz); \
194 phdr.p_filesz = phdr.p_memsz; \
195 offset += phdr.p_filesz; \
196 } \
197 else \
198 phdr.p_offset += ofs; \
199 phdr.p_paddr = 0; /* match other core phdrs */ \
200 DUMP_WRITE(&phdr, sizeof(phdr)); \
201 } \
202} while (0)
203#define ELF_CORE_WRITE_EXTRA_DATA \
204do { \
205 const struct elf_phdr *const vsyscall_phdrs = \
206 (const struct elf_phdr *) (VDSO_HIGH_BASE \
207 + VDSO_HIGH_EHDR->e_phoff); \
208 int i; \
209 for (i = 0; i < VDSO_HIGH_EHDR->e_phnum; ++i) { \
210 if (vsyscall_phdrs[i].p_type == PT_LOAD) \
211 DUMP_WRITE((void *) vsyscall_phdrs[i].p_vaddr, \
212 PAGE_ALIGN(vsyscall_phdrs[i].p_memsz)); \
213 } \
214} while (0)
215
216#endif 171#endif
217 172
218#endif 173#endif
diff --git a/include/asm-i386/fixmap.h b/include/asm-i386/fixmap.h
index 02428cb36621..3e9f610c35df 100644
--- a/include/asm-i386/fixmap.h
+++ b/include/asm-i386/fixmap.h
@@ -23,6 +23,8 @@
23extern unsigned long __FIXADDR_TOP; 23extern unsigned long __FIXADDR_TOP;
24#else 24#else
25#define __FIXADDR_TOP 0xfffff000 25#define __FIXADDR_TOP 0xfffff000
26#define FIXADDR_USER_START __fix_to_virt(FIX_VDSO)
27#define FIXADDR_USER_END __fix_to_virt(FIX_VDSO - 1)
26#endif 28#endif
27 29
28#ifndef __ASSEMBLY__ 30#ifndef __ASSEMBLY__
diff --git a/include/asm-i386/page.h b/include/asm-i386/page.h
index fd3f64ace248..7b19f454761d 100644
--- a/include/asm-i386/page.h
+++ b/include/asm-i386/page.h
@@ -143,7 +143,9 @@ extern int page_is_ram(unsigned long pagenr);
143#include <asm-generic/memory_model.h> 143#include <asm-generic/memory_model.h>
144#include <asm-generic/page.h> 144#include <asm-generic/page.h>
145 145
146#ifndef CONFIG_COMPAT_VDSO
146#define __HAVE_ARCH_GATE_AREA 1 147#define __HAVE_ARCH_GATE_AREA 1
148#endif
147#endif /* __KERNEL__ */ 149#endif /* __KERNEL__ */
148 150
149#endif /* _I386_PAGE_H */ 151#endif /* _I386_PAGE_H */
diff --git a/include/asm-ia64/checksum.h b/include/asm-ia64/checksum.h
index 2b78582cbd61..97af155057e4 100644
--- a/include/asm-ia64/checksum.h
+++ b/include/asm-ia64/checksum.h
@@ -72,8 +72,8 @@ static inline __sum16 csum_fold(__wsum csum)
72 72
73#define _HAVE_ARCH_IPV6_CSUM 1 73#define _HAVE_ARCH_IPV6_CSUM 1
74struct in6_addr; 74struct in6_addr;
75extern unsigned short int csum_ipv6_magic(struct in6_addr *saddr, 75extern __sum16 csum_ipv6_magic(const struct in6_addr *saddr,
76 struct in6_addr *daddr, __u32 len, unsigned short proto, 76 const struct in6_addr *daddr, __u32 len, unsigned short proto,
77 unsigned int csum); 77 __wsum csum);
78 78
79#endif /* _ASM_IA64_CHECKSUM_H */ 79#endif /* _ASM_IA64_CHECKSUM_H */
diff --git a/include/asm-ia64/pci.h b/include/asm-ia64/pci.h
index 556f53fa44cb..5160233bbfac 100644
--- a/include/asm-ia64/pci.h
+++ b/include/asm-ia64/pci.h
@@ -167,4 +167,10 @@ pcibios_select_root(struct pci_dev *pdev, struct resource *res)
167 167
168#define pcibios_scan_all_fns(a, b) 0 168#define pcibios_scan_all_fns(a, b) 0
169 169
170#define HAVE_ARCH_PCI_GET_LEGACY_IDE_IRQ
171static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
172{
173 return channel ? 15 : 14;
174}
175
170#endif /* _ASM_IA64_PCI_H */ 176#endif /* _ASM_IA64_PCI_H */
diff --git a/include/asm-m68k/uaccess.h b/include/asm-m68k/uaccess.h
index e4c9f080ff20..6a4cf2081512 100644
--- a/include/asm-m68k/uaccess.h
+++ b/include/asm-m68k/uaccess.h
@@ -7,6 +7,7 @@
7#include <linux/compiler.h> 7#include <linux/compiler.h>
8#include <linux/errno.h> 8#include <linux/errno.h>
9#include <linux/types.h> 9#include <linux/types.h>
10#include <linux/sched.h>
10#include <asm/segment.h> 11#include <asm/segment.h>
11 12
12#define VERIFY_READ 0 13#define VERIFY_READ 0
diff --git a/include/asm-mips/checksum.h b/include/asm-mips/checksum.h
index 24cdcc6eaab8..20a81e1548f5 100644
--- a/include/asm-mips/checksum.h
+++ b/include/asm-mips/checksum.h
@@ -159,7 +159,8 @@ static inline __wsum csum_tcpudp_nofold(__be32 saddr,
159#endif 159#endif
160 " .set pop" 160 " .set pop"
161 : "=r" (sum) 161 : "=r" (sum)
162 : "0" (daddr), "r"(saddr), 162 : "0" ((__force unsigned long)daddr),
163 "r" ((__force unsigned long)saddr),
163#ifdef __MIPSEL__ 164#ifdef __MIPSEL__
164 "r" ((proto + len) << 8), 165 "r" ((proto + len) << 8),
165#else 166#else
diff --git a/include/asm-mips/hazards.h b/include/asm-mips/hazards.h
index 0fe02945feba..50073157a617 100644
--- a/include/asm-mips/hazards.h
+++ b/include/asm-mips/hazards.h
@@ -157,7 +157,7 @@ ASMMACRO(back_to_back_c0_hazard,
157 * processors. 157 * processors.
158 */ 158 */
159ASMMACRO(mtc0_tlbw_hazard, 159ASMMACRO(mtc0_tlbw_hazard,
160 nop 160 nop; nop
161 ) 161 )
162ASMMACRO(tlbw_use_hazard, 162ASMMACRO(tlbw_use_hazard,
163 nop; nop; nop 163 nop; nop; nop
diff --git a/include/asm-mips/irqflags.h b/include/asm-mips/irqflags.h
index 46bf5de5ac72..af3b07dfad4b 100644
--- a/include/asm-mips/irqflags.h
+++ b/include/asm-mips/irqflags.h
@@ -15,6 +15,27 @@
15 15
16#include <asm/hazards.h> 16#include <asm/hazards.h>
17 17
18/*
19 * CONFIG_MIPS_MT_SMTC_INSTANT_REPLAY does prompt replay of deferred IPIs,
20 * at the cost of branch and call overhead on each local_irq_restore()
21 */
22
23#ifdef CONFIG_MIPS_MT_SMTC_INSTANT_REPLAY
24
25extern void smtc_ipi_replay(void);
26
27#define irq_restore_epilog(flags) \
28do { \
29 if (!(flags & 0x0400)) \
30 smtc_ipi_replay(); \
31} while (0)
32
33#else
34
35#define irq_restore_epilog(ignore) do { } while (0)
36
37#endif /* CONFIG_MIPS_MT_SMTC_INSTANT_REPLAY */
38
18__asm__ ( 39__asm__ (
19 " .macro raw_local_irq_enable \n" 40 " .macro raw_local_irq_enable \n"
20 " .set push \n" 41 " .set push \n"
@@ -193,6 +214,7 @@ do { \
193 : "=r" (__tmp1) \ 214 : "=r" (__tmp1) \
194 : "0" (flags) \ 215 : "0" (flags) \
195 : "memory"); \ 216 : "memory"); \
217 irq_restore_epilog(flags); \
196} while(0) 218} while(0)
197 219
198static inline int raw_irqs_disabled_flags(unsigned long flags) 220static inline int raw_irqs_disabled_flags(unsigned long flags)
diff --git a/include/asm-mips/pgtable.h b/include/asm-mips/pgtable.h
index f2e1325fec6c..3fcfd7979de5 100644
--- a/include/asm-mips/pgtable.h
+++ b/include/asm-mips/pgtable.h
@@ -69,16 +69,6 @@ extern unsigned long zero_page_mask;
69#define ZERO_PAGE(vaddr) \ 69#define ZERO_PAGE(vaddr) \
70 (virt_to_page((void *)(empty_zero_page + (((unsigned long)(vaddr)) & zero_page_mask)))) 70 (virt_to_page((void *)(empty_zero_page + (((unsigned long)(vaddr)) & zero_page_mask))))
71 71
72#define __HAVE_ARCH_MOVE_PTE
73#define move_pte(pte, prot, old_addr, new_addr) \
74({ \
75 pte_t newpte = (pte); \
76 if (pte_present(pte) && pfn_valid(pte_pfn(pte)) && \
77 pte_page(pte) == ZERO_PAGE(old_addr)) \
78 newpte = mk_pte(ZERO_PAGE(new_addr), (prot)); \
79 newpte; \
80})
81
82extern void paging_init(void); 72extern void paging_init(void);
83 73
84/* 74/*
diff --git a/include/asm-mips/thread_info.h b/include/asm-mips/thread_info.h
index e475c45ea263..fbcda8204473 100644
--- a/include/asm-mips/thread_info.h
+++ b/include/asm-mips/thread_info.h
@@ -118,6 +118,7 @@ register struct thread_info *__current_thread_info __asm__("$28");
118#define TIF_USEDFPU 16 /* FPU was used by this task this quantum (SMP) */ 118#define TIF_USEDFPU 16 /* FPU was used by this task this quantum (SMP) */
119#define TIF_POLLING_NRFLAG 17 /* true if poll_idle() is polling TIF_NEED_RESCHED */ 119#define TIF_POLLING_NRFLAG 17 /* true if poll_idle() is polling TIF_NEED_RESCHED */
120#define TIF_MEMDIE 18 120#define TIF_MEMDIE 18
121#define TIF_FREEZE 19
121#define TIF_SYSCALL_TRACE 31 /* syscall trace active */ 122#define TIF_SYSCALL_TRACE 31 /* syscall trace active */
122 123
123#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) 124#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
@@ -129,6 +130,7 @@ register struct thread_info *__current_thread_info __asm__("$28");
129#define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK) 130#define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK)
130#define _TIF_USEDFPU (1<<TIF_USEDFPU) 131#define _TIF_USEDFPU (1<<TIF_USEDFPU)
131#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) 132#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
133#define _TIF_FREEZE (1<<TIF_FREEZE)
132 134
133/* work to do on interrupt/exception return */ 135/* work to do on interrupt/exception return */
134#define _TIF_WORK_MASK (0x0000ffef & ~_TIF_SECCOMP) 136#define _TIF_WORK_MASK (0x0000ffef & ~_TIF_SECCOMP)
diff --git a/include/asm-powerpc/dma-mapping.h b/include/asm-powerpc/dma-mapping.h
index 7c7de87bd8ae..a19a6f1a1cf1 100644
--- a/include/asm-powerpc/dma-mapping.h
+++ b/include/asm-powerpc/dma-mapping.h
@@ -37,9 +37,9 @@ extern void __dma_sync_page(struct page *page, unsigned long offset,
37 */ 37 */
38 38
39#define __dma_alloc_coherent(gfp, size, handle) NULL 39#define __dma_alloc_coherent(gfp, size, handle) NULL
40#define __dma_free_coherent(size, addr) do { } while (0) 40#define __dma_free_coherent(size, addr) ((void)0)
41#define __dma_sync(addr, size, rw) do { } while (0) 41#define __dma_sync(addr, size, rw) ((void)0)
42#define __dma_sync_page(pg, off, sz, rw) do { } while (0) 42#define __dma_sync_page(pg, off, sz, rw) ((void)0)
43 43
44#endif /* ! CONFIG_NOT_COHERENT_CACHE */ 44#endif /* ! CONFIG_NOT_COHERENT_CACHE */
45 45
@@ -251,7 +251,7 @@ dma_map_single(struct device *dev, void *ptr, size_t size,
251} 251}
252 252
253/* We do nothing. */ 253/* We do nothing. */
254#define dma_unmap_single(dev, addr, size, dir) do { } while (0) 254#define dma_unmap_single(dev, addr, size, dir) ((void)0)
255 255
256static inline dma_addr_t 256static inline dma_addr_t
257dma_map_page(struct device *dev, struct page *page, 257dma_map_page(struct device *dev, struct page *page,
@@ -266,7 +266,7 @@ dma_map_page(struct device *dev, struct page *page,
266} 266}
267 267
268/* We do nothing. */ 268/* We do nothing. */
269#define dma_unmap_page(dev, handle, size, dir) do { } while (0) 269#define dma_unmap_page(dev, handle, size, dir) ((void)0)
270 270
271static inline int 271static inline int
272dma_map_sg(struct device *dev, struct scatterlist *sg, int nents, 272dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
@@ -286,7 +286,7 @@ dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
286} 286}
287 287
288/* We don't do anything here. */ 288/* We don't do anything here. */
289#define dma_unmap_sg(dev, sg, nents, dir) do { } while (0) 289#define dma_unmap_sg(dev, sg, nents, dir) ((void)0)
290 290
291#endif /* CONFIG_PPC64 */ 291#endif /* CONFIG_PPC64 */
292 292
diff --git a/include/asm-powerpc/libata-portmap.h b/include/asm-powerpc/libata-portmap.h
new file mode 100644
index 000000000000..4d8518049f4d
--- /dev/null
+++ b/include/asm-powerpc/libata-portmap.h
@@ -0,0 +1,12 @@
1#ifndef __ASM_POWERPC_LIBATA_PORTMAP_H
2#define __ASM_POWERPC_LIBATA_PORTMAP_H
3
4#define ATA_PRIMARY_CMD 0x1F0
5#define ATA_PRIMARY_CTL 0x3F6
6#define ATA_PRIMARY_IRQ(dev) pci_get_legacy_ide_irq(dev, 0)
7
8#define ATA_SECONDARY_CMD 0x170
9#define ATA_SECONDARY_CTL 0x376
10#define ATA_SECONDARY_IRQ(dev) pci_get_legacy_ide_irq(dev, 1)
11
12#endif
diff --git a/include/asm-sparc/checksum.h b/include/asm-sparc/checksum.h
index 267e631e9bbc..34518ea7bf1b 100644
--- a/include/asm-sparc/checksum.h
+++ b/include/asm-sparc/checksum.h
@@ -151,7 +151,7 @@ static inline __sum16 ip_fast_csum(const void *iph, unsigned int ihl)
151 "xnor\t%%g0, %0, %0" 151 "xnor\t%%g0, %0, %0"
152 : "=r" (sum), "=&r" (iph) 152 : "=r" (sum), "=&r" (iph)
153 : "r" (ihl), "1" (iph) 153 : "r" (ihl), "1" (iph)
154 : "g2", "g3", "g4", "cc"); 154 : "g2", "g3", "g4", "cc", "memory");
155 return sum; 155 return sum;
156} 156}
157 157
diff --git a/include/asm-um/pgtable.h b/include/asm-um/pgtable.h
index 188f72621776..e57ff136ee51 100644
--- a/include/asm-um/pgtable.h
+++ b/include/asm-um/pgtable.h
@@ -408,6 +408,15 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
408 408
409#include <asm-generic/pgtable-nopud.h> 409#include <asm-generic/pgtable-nopud.h>
410 410
411#ifdef CONFIG_HIGHMEM
412/* Clear a kernel PTE and flush it from the TLB */
413#define kpte_clear_flush(ptep, vaddr) \
414do { \
415 pte_clear(&init_mm, vaddr, ptep); \
416 __flush_tlb_one(vaddr); \
417} while (0)
418#endif
419
411#endif 420#endif
412#endif 421#endif
413 422
diff --git a/include/asm-x86_64/dma-mapping.h b/include/asm-x86_64/dma-mapping.h
index be9ec6890723..49dbab09ef2b 100644
--- a/include/asm-x86_64/dma-mapping.h
+++ b/include/asm-x86_64/dma-mapping.h
@@ -63,6 +63,9 @@ static inline int dma_mapping_error(dma_addr_t dma_addr)
63 return (dma_addr == bad_dma_address); 63 return (dma_addr == bad_dma_address);
64} 64}
65 65
66#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
67#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
68
66extern void *dma_alloc_coherent(struct device *dev, size_t size, 69extern void *dma_alloc_coherent(struct device *dev, size_t size,
67 dma_addr_t *dma_handle, gfp_t gfp); 70 dma_addr_t *dma_handle, gfp_t gfp);
68extern void dma_free_coherent(struct device *dev, size_t size, void *vaddr, 71extern void dma_free_coherent(struct device *dev, size_t size, void *vaddr,
diff --git a/include/asm-x86_64/uaccess.h b/include/asm-x86_64/uaccess.h
index d5dbc87274f8..c0eac519840b 100644
--- a/include/asm-x86_64/uaccess.h
+++ b/include/asm-x86_64/uaccess.h
@@ -157,7 +157,7 @@ do { \
157 case 1: __put_user_asm(x,ptr,retval,"b","b","iq",-EFAULT); break;\ 157 case 1: __put_user_asm(x,ptr,retval,"b","b","iq",-EFAULT); break;\
158 case 2: __put_user_asm(x,ptr,retval,"w","w","ir",-EFAULT); break;\ 158 case 2: __put_user_asm(x,ptr,retval,"w","w","ir",-EFAULT); break;\
159 case 4: __put_user_asm(x,ptr,retval,"l","k","ir",-EFAULT); break;\ 159 case 4: __put_user_asm(x,ptr,retval,"l","k","ir",-EFAULT); break;\
160 case 8: __put_user_asm(x,ptr,retval,"q","","ir",-EFAULT); break;\ 160 case 8: __put_user_asm(x,ptr,retval,"q","","Zr",-EFAULT); break;\
161 default: __put_user_bad(); \ 161 default: __put_user_bad(); \
162 } \ 162 } \
163} while (0) 163} while (0)
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index 862e483cce8a..157db77a7170 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -69,7 +69,6 @@ header-y += hysdn_if.h
69header-y += i2c-dev.h 69header-y += i2c-dev.h
70header-y += i8k.h 70header-y += i8k.h
71header-y += icmp.h 71header-y += icmp.h
72header-y += if_addr.h
73header-y += if_arcnet.h 72header-y += if_arcnet.h
74header-y += if_arp.h 73header-y += if_arp.h
75header-y += if_bonding.h 74header-y += if_bonding.h
@@ -79,7 +78,6 @@ header-y += if_fddi.h
79header-y += if.h 78header-y += if.h
80header-y += if_hippi.h 79header-y += if_hippi.h
81header-y += if_infiniband.h 80header-y += if_infiniband.h
82header-y += if_link.h
83header-y += if_packet.h 81header-y += if_packet.h
84header-y += if_plip.h 82header-y += if_plip.h
85header-y += if_ppp.h 83header-y += if_ppp.h
@@ -129,7 +127,6 @@ header-y += posix_types.h
129header-y += ppdev.h 127header-y += ppdev.h
130header-y += prctl.h 128header-y += prctl.h
131header-y += ps2esdi.h 129header-y += ps2esdi.h
132header-y += qic117.h
133header-y += qnxtypes.h 130header-y += qnxtypes.h
134header-y += quotaio_v1.h 131header-y += quotaio_v1.h
135header-y += quotaio_v2.h 132header-y += quotaio_v2.h
@@ -214,6 +211,7 @@ unifdef-y += hpet.h
214unifdef-y += i2c.h 211unifdef-y += i2c.h
215unifdef-y += i2o-dev.h 212unifdef-y += i2o-dev.h
216unifdef-y += icmpv6.h 213unifdef-y += icmpv6.h
214unifdef-y += if_addr.h
217unifdef-y += if_bridge.h 215unifdef-y += if_bridge.h
218unifdef-y += if_ec.h 216unifdef-y += if_ec.h
219unifdef-y += if_eql.h 217unifdef-y += if_eql.h
@@ -221,6 +219,7 @@ unifdef-y += if_ether.h
221unifdef-y += if_fddi.h 219unifdef-y += if_fddi.h
222unifdef-y += if_frad.h 220unifdef-y += if_frad.h
223unifdef-y += if_ltalk.h 221unifdef-y += if_ltalk.h
222unifdef-y += if_link.h
224unifdef-y += if_pppox.h 223unifdef-y += if_pppox.h
225unifdef-y += if_shaper.h 224unifdef-y += if_shaper.h
226unifdef-y += if_tr.h 225unifdef-y += if_tr.h
diff --git a/include/linux/bitops.h b/include/linux/bitops.h
index 5d1eabcde5d5..638165f571da 100644
--- a/include/linux/bitops.h
+++ b/include/linux/bitops.h
@@ -31,9 +31,8 @@ static inline unsigned long hweight_long(unsigned long w)
31 return sizeof(w) == 4 ? hweight32(w) : hweight64(w); 31 return sizeof(w) == 4 ? hweight32(w) : hweight64(w);
32} 32}
33 33
34/* 34/**
35 * rol32 - rotate a 32-bit value left 35 * rol32 - rotate a 32-bit value left
36 *
37 * @word: value to rotate 36 * @word: value to rotate
38 * @shift: bits to roll 37 * @shift: bits to roll
39 */ 38 */
@@ -42,9 +41,8 @@ static inline __u32 rol32(__u32 word, unsigned int shift)
42 return (word << shift) | (word >> (32 - shift)); 41 return (word << shift) | (word >> (32 - shift));
43} 42}
44 43
45/* 44/**
46 * ror32 - rotate a 32-bit value right 45 * ror32 - rotate a 32-bit value right
47 *
48 * @word: value to rotate 46 * @word: value to rotate
49 * @shift: bits to roll 47 * @shift: bits to roll
50 */ 48 */
diff --git a/include/linux/cdev.h b/include/linux/cdev.h
index f309b00e986e..1e29b13d0062 100644
--- a/include/linux/cdev.h
+++ b/include/linux/cdev.h
@@ -6,6 +6,10 @@
6#include <linux/kdev_t.h> 6#include <linux/kdev_t.h>
7#include <linux/list.h> 7#include <linux/list.h>
8 8
9struct file_operations;
10struct inode;
11struct module;
12
9struct cdev { 13struct cdev {
10 struct kobject kobj; 14 struct kobject kobj;
11 struct module *owner; 15 struct module *owner;
diff --git a/include/linux/efi.h b/include/linux/efi.h
index df1c91855f0e..f8ebd7c1ddb3 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -301,7 +301,7 @@ extern int __init efi_uart_console_only (void);
301extern void efi_initialize_iomem_resources(struct resource *code_resource, 301extern void efi_initialize_iomem_resources(struct resource *code_resource,
302 struct resource *data_resource); 302 struct resource *data_resource);
303extern unsigned long efi_get_time(void); 303extern unsigned long efi_get_time(void);
304extern int __init efi_set_rtc_mmss(unsigned long nowtime); 304extern int efi_set_rtc_mmss(unsigned long nowtime);
305extern int is_available_memory(efi_memory_desc_t * md); 305extern int is_available_memory(efi_memory_desc_t * md);
306extern struct efi_memory_map memmap; 306extern struct efi_memory_map memmap;
307 307
diff --git a/include/linux/hdreg.h b/include/linux/hdreg.h
index 2b54eac738ea..818c6afc1091 100644
--- a/include/linux/hdreg.h
+++ b/include/linux/hdreg.h
@@ -60,13 +60,15 @@
60#define TAG_MASK 0xf8 60#define TAG_MASK 0xf8
61#endif /* __KERNEL__ */ 61#endif /* __KERNEL__ */
62 62
63#include <linux/types.h>
64
63/* 65/*
64 * Command Header sizes for IOCTL commands 66 * Command Header sizes for IOCTL commands
65 */ 67 */
66 68
67#define HDIO_DRIVE_CMD_HDR_SIZE (4 * sizeof(u8)) 69#define HDIO_DRIVE_CMD_HDR_SIZE (4 * sizeof(__u8))
68#define HDIO_DRIVE_HOB_HDR_SIZE (8 * sizeof(u8)) 70#define HDIO_DRIVE_HOB_HDR_SIZE (8 * sizeof(__u8))
69#define HDIO_DRIVE_TASK_HDR_SIZE (8 * sizeof(u8)) 71#define HDIO_DRIVE_TASK_HDR_SIZE (8 * sizeof(__u8))
70 72
71#define IDE_DRIVE_TASK_INVALID -1 73#define IDE_DRIVE_TASK_INVALID -1
72#define IDE_DRIVE_TASK_NO_DATA 0 74#define IDE_DRIVE_TASK_NO_DATA 0
diff --git a/include/linux/hid.h b/include/linux/hid.h
index 770120add15a..342b4e639acb 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -438,7 +438,6 @@ struct hid_device { /* device report descriptor */
438 struct hid_usage *, __s32); 438 struct hid_usage *, __s32);
439 void (*hiddev_report_event) (struct hid_device *, struct hid_report *); 439 void (*hiddev_report_event) (struct hid_device *, struct hid_report *);
440#ifdef CONFIG_USB_HIDINPUT_POWERBOOK 440#ifdef CONFIG_USB_HIDINPUT_POWERBOOK
441 unsigned int pb_fnmode;
442 unsigned long pb_pressed_fn[NBITS(KEY_MAX)]; 441 unsigned long pb_pressed_fn[NBITS(KEY_MAX)];
443 unsigned long pb_pressed_numlock[NBITS(KEY_MAX)]; 442 unsigned long pb_pressed_numlock[NBITS(KEY_MAX)];
444#endif 443#endif
diff --git a/include/linux/i2o-dev.h b/include/linux/i2o-dev.h
index c2519df1b6dc..a0b23dd45239 100644
--- a/include/linux/i2o-dev.h
+++ b/include/linux/i2o-dev.h
@@ -24,12 +24,13 @@
24#define MAX_I2O_CONTROLLERS 32 24#define MAX_I2O_CONTROLLERS 32
25 25
26#include <linux/ioctl.h> 26#include <linux/ioctl.h>
27#include <linux/types.h>
27 28
28/* 29/*
29 * I2O Control IOCTLs and structures 30 * I2O Control IOCTLs and structures
30 */ 31 */
31#define I2O_MAGIC_NUMBER 'i' 32#define I2O_MAGIC_NUMBER 'i'
32#define I2OGETIOPS _IOR(I2O_MAGIC_NUMBER,0,u8[MAX_I2O_CONTROLLERS]) 33#define I2OGETIOPS _IOR(I2O_MAGIC_NUMBER,0,__u8[MAX_I2O_CONTROLLERS])
33#define I2OHRTGET _IOWR(I2O_MAGIC_NUMBER,1,struct i2o_cmd_hrtlct) 34#define I2OHRTGET _IOWR(I2O_MAGIC_NUMBER,1,struct i2o_cmd_hrtlct)
34#define I2OLCTGET _IOWR(I2O_MAGIC_NUMBER,2,struct i2o_cmd_hrtlct) 35#define I2OLCTGET _IOWR(I2O_MAGIC_NUMBER,2,struct i2o_cmd_hrtlct)
35#define I2OPARMSET _IOWR(I2O_MAGIC_NUMBER,3,struct i2o_cmd_psetget) 36#define I2OPARMSET _IOWR(I2O_MAGIC_NUMBER,3,struct i2o_cmd_psetget)
@@ -37,7 +38,7 @@
37#define I2OSWDL _IOWR(I2O_MAGIC_NUMBER,5,struct i2o_sw_xfer) 38#define I2OSWDL _IOWR(I2O_MAGIC_NUMBER,5,struct i2o_sw_xfer)
38#define I2OSWUL _IOWR(I2O_MAGIC_NUMBER,6,struct i2o_sw_xfer) 39#define I2OSWUL _IOWR(I2O_MAGIC_NUMBER,6,struct i2o_sw_xfer)
39#define I2OSWDEL _IOWR(I2O_MAGIC_NUMBER,7,struct i2o_sw_xfer) 40#define I2OSWDEL _IOWR(I2O_MAGIC_NUMBER,7,struct i2o_sw_xfer)
40#define I2OVALIDATE _IOR(I2O_MAGIC_NUMBER,8,u32) 41#define I2OVALIDATE _IOR(I2O_MAGIC_NUMBER,8,__u32)
41#define I2OHTML _IOWR(I2O_MAGIC_NUMBER,9,struct i2o_html) 42#define I2OHTML _IOWR(I2O_MAGIC_NUMBER,9,struct i2o_html)
42#define I2OEVTREG _IOW(I2O_MAGIC_NUMBER,10,struct i2o_evt_id) 43#define I2OEVTREG _IOW(I2O_MAGIC_NUMBER,10,struct i2o_evt_id)
43#define I2OEVTGET _IOR(I2O_MAGIC_NUMBER,11,struct i2o_evt_info) 44#define I2OEVTGET _IOR(I2O_MAGIC_NUMBER,11,struct i2o_evt_info)
diff --git a/include/linux/if_tunnel.h b/include/linux/if_tunnel.h
index 8de079ba1107..660b5010c2d9 100644
--- a/include/linux/if_tunnel.h
+++ b/include/linux/if_tunnel.h
@@ -1,6 +1,8 @@
1#ifndef _IF_TUNNEL_H_ 1#ifndef _IF_TUNNEL_H_
2#define _IF_TUNNEL_H_ 2#define _IF_TUNNEL_H_
3 3
4#include <linux/types.h>
5
4#define SIOCGETTUNNEL (SIOCDEVPRIVATE + 0) 6#define SIOCGETTUNNEL (SIOCDEVPRIVATE + 0)
5#define SIOCADDTUNNEL (SIOCDEVPRIVATE + 1) 7#define SIOCADDTUNNEL (SIOCDEVPRIVATE + 1)
6#define SIOCDELTUNNEL (SIOCDEVPRIVATE + 2) 8#define SIOCDELTUNNEL (SIOCDEVPRIVATE + 2)
diff --git a/include/linux/kvm.h b/include/linux/kvm.h
index bc8b4616bad7..1be148f0fce4 100644
--- a/include/linux/kvm.h
+++ b/include/linux/kvm.h
@@ -46,6 +46,7 @@ enum kvm_exit_reason {
46 KVM_EXIT_HLT = 5, 46 KVM_EXIT_HLT = 5,
47 KVM_EXIT_MMIO = 6, 47 KVM_EXIT_MMIO = 6,
48 KVM_EXIT_IRQ_WINDOW_OPEN = 7, 48 KVM_EXIT_IRQ_WINDOW_OPEN = 7,
49 KVM_EXIT_SHUTDOWN = 8,
49}; 50};
50 51
51/* for KVM_RUN */ 52/* for KVM_RUN */
diff --git a/include/linux/libata.h b/include/linux/libata.h
index e53a13ba7f78..91bb8ceef0b5 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -177,6 +177,7 @@ enum {
177 * Register FIS clearing BSY */ 177 * Register FIS clearing BSY */
178 ATA_FLAG_DEBUGMSG = (1 << 13), 178 ATA_FLAG_DEBUGMSG = (1 << 13),
179 ATA_FLAG_SETXFER_POLLING= (1 << 14), /* use polling for SETXFER */ 179 ATA_FLAG_SETXFER_POLLING= (1 << 14), /* use polling for SETXFER */
180 ATA_FLAG_IGN_SIMPLEX = (1 << 15), /* ignore SIMPLEX */
180 181
181 /* The following flag belongs to ap->pflags but is kept in 182 /* The following flag belongs to ap->pflags but is kept in
182 * ap->flags because it's referenced in many LLDs and will be 183 * ap->flags because it's referenced in many LLDs and will be
@@ -612,11 +613,11 @@ struct ata_port_operations {
612 void (*dev_select)(struct ata_port *ap, unsigned int device); 613 void (*dev_select)(struct ata_port *ap, unsigned int device);
613 614
614 void (*phy_reset) (struct ata_port *ap); /* obsolete */ 615 void (*phy_reset) (struct ata_port *ap); /* obsolete */
615 void (*set_mode) (struct ata_port *ap); 616 int (*set_mode) (struct ata_port *ap, struct ata_device **r_failed_dev);
616 617
617 void (*post_set_mode) (struct ata_port *ap); 618 void (*post_set_mode) (struct ata_port *ap);
618 619
619 int (*check_atapi_dma) (struct ata_queued_cmd *qc); 620 int (*check_atapi_dma) (struct ata_queued_cmd *qc);
620 621
621 void (*bmdma_setup) (struct ata_queued_cmd *qc); 622 void (*bmdma_setup) (struct ata_queued_cmd *qc);
622 void (*bmdma_start) (struct ata_queued_cmd *qc); 623 void (*bmdma_start) (struct ata_queued_cmd *qc);
@@ -1053,6 +1054,8 @@ static inline void ata_pause(struct ata_port *ap)
1053/** 1054/**
1054 * ata_busy_wait - Wait for a port status register 1055 * ata_busy_wait - Wait for a port status register
1055 * @ap: Port to wait for. 1056 * @ap: Port to wait for.
1057 * @bits: bits that must be clear
1058 * @max: number of 10uS waits to perform
1056 * 1059 *
1057 * Waits up to max*10 microseconds for the selected bits in the port's 1060 * Waits up to max*10 microseconds for the selected bits in the port's
1058 * status register to be cleared. 1061 * status register to be cleared.
@@ -1149,7 +1152,9 @@ static inline void ata_qc_reinit(struct ata_queued_cmd *qc)
1149 qc->cursect = qc->cursg = qc->cursg_ofs = 0; 1152 qc->cursect = qc->cursg = qc->cursg_ofs = 0;
1150 qc->nsect = 0; 1153 qc->nsect = 0;
1151 qc->nbytes = qc->curbytes = 0; 1154 qc->nbytes = qc->curbytes = 0;
1155 qc->n_elem = 0;
1152 qc->err_mask = 0; 1156 qc->err_mask = 0;
1157 qc->pad_len = 0;
1153 1158
1154 ata_tf_init(qc->dev, &qc->tf); 1159 ata_tf_init(qc->dev, &qc->tf);
1155 1160
diff --git a/include/linux/list.h b/include/linux/list.h
index a9c90287c0ff..611059d633f4 100644
--- a/include/linux/list.h
+++ b/include/linux/list.h
@@ -227,13 +227,13 @@ static inline void list_replace_init(struct list_head *old,
227 INIT_LIST_HEAD(old); 227 INIT_LIST_HEAD(old);
228} 228}
229 229
230/* 230/**
231 * list_replace_rcu - replace old entry by new one 231 * list_replace_rcu - replace old entry by new one
232 * @old : the element to be replaced 232 * @old : the element to be replaced
233 * @new : the new element to insert 233 * @new : the new element to insert
234 * 234 *
235 * The old entry will be replaced with the new entry atomically. 235 * The @old entry will be replaced with the @new entry atomically.
236 * Note: 'old' should not be empty. 236 * Note: @old should not be empty.
237 */ 237 */
238static inline void list_replace_rcu(struct list_head *old, 238static inline void list_replace_rcu(struct list_head *old,
239 struct list_head *new) 239 struct list_head *new)
@@ -680,12 +680,12 @@ static inline void hlist_del_init(struct hlist_node *n)
680 } 680 }
681} 681}
682 682
683/* 683/**
684 * hlist_replace_rcu - replace old entry by new one 684 * hlist_replace_rcu - replace old entry by new one
685 * @old : the element to be replaced 685 * @old : the element to be replaced
686 * @new : the new element to insert 686 * @new : the new element to insert
687 * 687 *
688 * The old entry will be replaced with the new entry atomically. 688 * The @old entry will be replaced with the @new entry atomically.
689 */ 689 */
690static inline void hlist_replace_rcu(struct hlist_node *old, 690static inline void hlist_replace_rcu(struct hlist_node *old,
691 struct hlist_node *new) 691 struct hlist_node *new)
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 76912231af41..2d2c08d5f473 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -168,6 +168,7 @@ extern unsigned int kobjsize(const void *objp);
168#define VM_NONLINEAR 0x00800000 /* Is non-linear (remap_file_pages) */ 168#define VM_NONLINEAR 0x00800000 /* Is non-linear (remap_file_pages) */
169#define VM_MAPPED_COPY 0x01000000 /* T if mapped copy of data (nommu mmap) */ 169#define VM_MAPPED_COPY 0x01000000 /* T if mapped copy of data (nommu mmap) */
170#define VM_INSERTPAGE 0x02000000 /* The vma has had "vm_insert_page()" done on it */ 170#define VM_INSERTPAGE 0x02000000 /* The vma has had "vm_insert_page()" done on it */
171#define VM_ALWAYSDUMP 0x04000000 /* Always include in core dumps */
171 172
172#ifndef VM_STACK_DEFAULT_FLAGS /* arch can override this */ 173#ifndef VM_STACK_DEFAULT_FLAGS /* arch can override this */
173#define VM_STACK_DEFAULT_FLAGS VM_DATA_DEFAULT_FLAGS 174#define VM_STACK_DEFAULT_FLAGS VM_DATA_DEFAULT_FLAGS
diff --git a/include/linux/mtio.h b/include/linux/mtio.h
index 8c66151821e3..6f8d2d45a8fb 100644
--- a/include/linux/mtio.h
+++ b/include/linux/mtio.h
@@ -10,7 +10,6 @@
10 10
11#include <linux/types.h> 11#include <linux/types.h>
12#include <linux/ioctl.h> 12#include <linux/ioctl.h>
13#include <linux/qic117.h>
14 13
15/* 14/*
16 * Structures and definitions for mag tape io control commands 15 * Structures and definitions for mag tape io control commands
@@ -116,32 +115,6 @@ struct mtget {
116#define MT_ISFTAPE_UNKNOWN 0x800000 /* obsolete */ 115#define MT_ISFTAPE_UNKNOWN 0x800000 /* obsolete */
117#define MT_ISFTAPE_FLAG 0x800000 116#define MT_ISFTAPE_FLAG 0x800000
118 117
119struct mt_tape_info {
120 long t_type; /* device type id (mt_type) */
121 char *t_name; /* descriptive name */
122};
123
124#define MT_TAPE_INFO { \
125 {MT_ISUNKNOWN, "Unknown type of tape device"}, \
126 {MT_ISQIC02, "Generic QIC-02 tape streamer"}, \
127 {MT_ISWT5150, "Wangtek 5150, QIC-150"}, \
128 {MT_ISARCHIVE_5945L2, "Archive 5945L-2"}, \
129 {MT_ISCMSJ500, "CMS Jumbo 500"}, \
130 {MT_ISTDC3610, "Tandberg TDC 3610, QIC-24"}, \
131 {MT_ISARCHIVE_VP60I, "Archive VP60i, QIC-02"}, \
132 {MT_ISARCHIVE_2150L, "Archive Viper 2150L"}, \
133 {MT_ISARCHIVE_2060L, "Archive Viper 2060L"}, \
134 {MT_ISARCHIVESC499, "Archive SC-499 QIC-36 controller"}, \
135 {MT_ISQIC02_ALL_FEATURES, "Generic QIC-02 tape, all features"}, \
136 {MT_ISWT5099EEN24, "Wangtek 5099-een24, 60MB"}, \
137 {MT_ISTEAC_MT2ST, "Teac MT-2ST 155mb data cassette drive"}, \
138 {MT_ISEVEREX_FT40A, "Everex FT40A, QIC-40"}, \
139 {MT_ISONSTREAM_SC, "OnStream SC-, DI-, DP-, or USB tape drive"}, \
140 {MT_ISSCSI1, "Generic SCSI-1 tape"}, \
141 {MT_ISSCSI2, "Generic SCSI-2 tape"}, \
142 {0, NULL} \
143}
144
145 118
146/* structure for MTIOCPOS - mag tape get position command */ 119/* structure for MTIOCPOS - mag tape get position command */
147 120
@@ -150,130 +123,11 @@ struct mtpos {
150}; 123};
151 124
152 125
153/* structure for MTIOCVOLINFO, query information about the volume
154 * currently positioned at (zftape)
155 */
156struct mtvolinfo {
157 unsigned int mt_volno; /* vol-number */
158 unsigned int mt_blksz; /* blocksize used when recording */
159 unsigned int mt_rawsize; /* raw tape space consumed, in kb */
160 unsigned int mt_size; /* volume size after decompression, in kb */
161 unsigned int mt_cmpr:1; /* this volume has been compressed */
162};
163
164/* raw access to a floppy drive, read and write an arbitrary segment.
165 * For ftape/zftape to support formatting etc.
166 */
167#define MT_FT_RD_SINGLE 0
168#define MT_FT_RD_AHEAD 1
169#define MT_FT_WR_ASYNC 0 /* start tape only when all buffers are full */
170#define MT_FT_WR_MULTI 1 /* start tape, continue until buffers are empty */
171#define MT_FT_WR_SINGLE 2 /* write a single segment and stop afterwards */
172#define MT_FT_WR_DELETE 3 /* write deleted data marks, one segment at time */
173
174struct mtftseg
175{
176 unsigned mt_segno; /* the segment to read or write */
177 unsigned mt_mode; /* modes for read/write (sync/async etc.) */
178 int mt_result; /* result of r/w request, not of the ioctl */
179 void __user *mt_data; /* User space buffer: must be 29kb */
180};
181
182/* get tape capacity (ftape/zftape)
183 */
184struct mttapesize {
185 unsigned long mt_capacity; /* entire, uncompressed capacity
186 * of a cartridge
187 */
188 unsigned long mt_used; /* what has been used so far, raw
189 * uncompressed amount
190 */
191};
192
193/* possible values of the ftfmt_op field
194 */
195#define FTFMT_SET_PARMS 1 /* set software parms */
196#define FTFMT_GET_PARMS 2 /* get software parms */
197#define FTFMT_FORMAT_TRACK 3 /* start formatting a tape track */
198#define FTFMT_STATUS 4 /* monitor formatting a tape track */
199#define FTFMT_VERIFY 5 /* verify the given segment */
200
201struct ftfmtparms {
202 unsigned char ft_qicstd; /* QIC-40/QIC-80/QIC-3010/QIC-3020 */
203 unsigned char ft_fmtcode; /* Refer to the QIC specs */
204 unsigned char ft_fhm; /* floppy head max */
205 unsigned char ft_ftm; /* floppy track max */
206 unsigned short ft_spt; /* segments per track */
207 unsigned short ft_tpc; /* tracks per cartridge */
208};
209
210struct ftfmttrack {
211 unsigned int ft_track; /* track to format */
212 unsigned char ft_gap3; /* size of gap3, for FORMAT_TRK */
213};
214
215struct ftfmtstatus {
216 unsigned int ft_segment; /* segment currently being formatted */
217};
218
219struct ftfmtverify {
220 unsigned int ft_segment; /* segment to verify */
221 unsigned long ft_bsm; /* bsm as result of VERIFY cmd */
222};
223
224struct mtftformat {
225 unsigned int fmt_op; /* operation to perform */
226 union fmt_arg {
227 struct ftfmtparms fmt_parms; /* format parameters */
228 struct ftfmttrack fmt_track; /* ctrl while formatting */
229 struct ftfmtstatus fmt_status;
230 struct ftfmtverify fmt_verify; /* for verifying */
231 } fmt_arg;
232};
233
234struct mtftcmd {
235 unsigned int ft_wait_before; /* timeout to wait for drive to get ready
236 * before command is sent. Milliseconds
237 */
238 qic117_cmd_t ft_cmd; /* command to send */
239 unsigned char ft_parm_cnt; /* zero: no parm is sent. */
240 unsigned char ft_parms[3]; /* parameter(s) to send to
241 * the drive. The parms are nibbles
242 * driver sends cmd + 2 step pulses */
243 unsigned int ft_result_bits; /* if non zero, number of bits
244 * returned by the tape drive
245 */
246 unsigned int ft_result; /* the result returned by the tape drive*/
247 unsigned int ft_wait_after; /* timeout to wait for drive to get ready
248 * after command is sent. 0: don't wait */
249 int ft_status; /* status returned by ready wait
250 * undefined if timeout was 0.
251 */
252 int ft_error; /* error code if error status was set by
253 * command
254 */
255};
256
257/* mag tape io control commands */ 126/* mag tape io control commands */
258#define MTIOCTOP _IOW('m', 1, struct mtop) /* do a mag tape op */ 127#define MTIOCTOP _IOW('m', 1, struct mtop) /* do a mag tape op */
259#define MTIOCGET _IOR('m', 2, struct mtget) /* get tape status */ 128#define MTIOCGET _IOR('m', 2, struct mtget) /* get tape status */
260#define MTIOCPOS _IOR('m', 3, struct mtpos) /* get tape position */ 129#define MTIOCPOS _IOR('m', 3, struct mtpos) /* get tape position */
261 130
262/* The next two are used by the QIC-02 driver for runtime reconfiguration.
263 * See tpqic02.h for struct mtconfiginfo.
264 */
265#define MTIOCGETCONFIG _IOR('m', 4, struct mtconfiginfo) /* get tape config */
266#define MTIOCSETCONFIG _IOW('m', 5, struct mtconfiginfo) /* set tape config */
267
268/* the next six are used by the floppy ftape drivers and its frontends
269 * sorry, but MTIOCTOP commands are write only.
270 */
271#define MTIOCRDFTSEG _IOWR('m', 6, struct mtftseg) /* read a segment */
272#define MTIOCWRFTSEG _IOWR('m', 7, struct mtftseg) /* write a segment */
273#define MTIOCVOLINFO _IOR('m', 8, struct mtvolinfo) /* info about volume */
274#define MTIOCGETSIZE _IOR('m', 9, struct mttapesize)/* get cartridge size*/
275#define MTIOCFTFORMAT _IOWR('m', 10, struct mtftformat) /* format ftape */
276#define MTIOCFTCMD _IOWR('m', 11, struct mtftcmd) /* send QIC-117 cmd */
277 131
278/* Generic Mag Tape (device independent) status macros for examining 132/* Generic Mag Tape (device independent) status macros for examining
279 * mt_gstat -- HP-UX compatible. 133 * mt_gstat -- HP-UX compatible.
diff --git a/include/linux/mutex.h b/include/linux/mutex.h
index a7544afd7582..b81bc2adaeff 100644
--- a/include/linux/mutex.h
+++ b/include/linux/mutex.h
@@ -105,7 +105,7 @@ do { \
105extern void __mutex_init(struct mutex *lock, const char *name, 105extern void __mutex_init(struct mutex *lock, const char *name,
106 struct lock_class_key *key); 106 struct lock_class_key *key);
107 107
108/*** 108/**
109 * mutex_is_locked - is the mutex locked 109 * mutex_is_locked - is the mutex locked
110 * @lock: the mutex to be queried 110 * @lock: the mutex to be queried
111 * 111 *
diff --git a/include/linux/netfilter_ipv4/ip_tables.h b/include/linux/netfilter_ipv4/ip_tables.h
index 4f06dad0bde9..98d566c5e32a 100644
--- a/include/linux/netfilter_ipv4/ip_tables.h
+++ b/include/linux/netfilter_ipv4/ip_tables.h
@@ -28,7 +28,7 @@
28#include <linux/netfilter/x_tables.h> 28#include <linux/netfilter/x_tables.h>
29 29
30#define IPT_FUNCTION_MAXNAMELEN XT_FUNCTION_MAXNAMELEN 30#define IPT_FUNCTION_MAXNAMELEN XT_FUNCTION_MAXNAMELEN
31#define IPT_TABLE_MAXNAMELEN XT_FUNCTION_MAXNAMELEN 31#define IPT_TABLE_MAXNAMELEN XT_TABLE_MAXNAMELEN
32#define ipt_match xt_match 32#define ipt_match xt_match
33#define ipt_target xt_target 33#define ipt_target xt_target
34#define ipt_table xt_table 34#define ipt_table xt_table
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index 04963063e620..c5d4084773e8 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -308,6 +308,7 @@ extern int nfs_attribute_timeout(struct inode *inode);
308extern int nfs_revalidate_inode(struct nfs_server *server, struct inode *inode); 308extern int nfs_revalidate_inode(struct nfs_server *server, struct inode *inode);
309extern int __nfs_revalidate_inode(struct nfs_server *, struct inode *); 309extern int __nfs_revalidate_inode(struct nfs_server *, struct inode *);
310extern int nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping); 310extern int nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping);
311extern int nfs_revalidate_mapping_nolock(struct inode *inode, struct address_space *mapping);
311extern int nfs_setattr(struct dentry *, struct iattr *); 312extern int nfs_setattr(struct dentry *, struct iattr *);
312extern void nfs_setattr_update_inode(struct inode *inode, struct iattr *attr); 313extern void nfs_setattr_update_inode(struct inode *inode, struct iattr *attr);
313extern void nfs_begin_attr_update(struct inode *); 314extern void nfs_begin_attr_update(struct inode *);
diff --git a/include/linux/nfsd/nfsd.h b/include/linux/nfsd/nfsd.h
index 0727774772ba..4b7c4b568f6d 100644
--- a/include/linux/nfsd/nfsd.h
+++ b/include/linux/nfsd/nfsd.h
@@ -52,8 +52,6 @@
52struct readdir_cd { 52struct readdir_cd {
53 __be32 err; /* 0, nfserr, or nfserr_eof */ 53 __be32 err; /* 0, nfserr, or nfserr_eof */
54}; 54};
55typedef int (*encode_dent_fn)(struct readdir_cd *, const char *,
56 int, loff_t, ino_t, unsigned int);
57typedef int (*nfsd_dirop_t)(struct inode *, struct dentry *, int, int); 55typedef int (*nfsd_dirop_t)(struct inode *, struct dentry *, int, int);
58 56
59extern struct svc_program nfsd_program; 57extern struct svc_program nfsd_program;
@@ -117,7 +115,7 @@ __be32 nfsd_unlink(struct svc_rqst *, struct svc_fh *, int type,
117int nfsd_truncate(struct svc_rqst *, struct svc_fh *, 115int nfsd_truncate(struct svc_rqst *, struct svc_fh *,
118 unsigned long size); 116 unsigned long size);
119__be32 nfsd_readdir(struct svc_rqst *, struct svc_fh *, 117__be32 nfsd_readdir(struct svc_rqst *, struct svc_fh *,
120 loff_t *, struct readdir_cd *, encode_dent_fn); 118 loff_t *, struct readdir_cd *, filldir_t);
121__be32 nfsd_statfs(struct svc_rqst *, struct svc_fh *, 119__be32 nfsd_statfs(struct svc_rqst *, struct svc_fh *,
122 struct kstatfs *); 120 struct kstatfs *);
123 121
diff --git a/include/linux/nfsd/nfsfh.h b/include/linux/nfsd/nfsfh.h
index f3b51d62ec7d..d9c6c382165d 100644
--- a/include/linux/nfsd/nfsfh.h
+++ b/include/linux/nfsd/nfsfh.h
@@ -217,11 +217,7 @@ void fh_put(struct svc_fh *);
217static __inline__ struct svc_fh * 217static __inline__ struct svc_fh *
218fh_copy(struct svc_fh *dst, struct svc_fh *src) 218fh_copy(struct svc_fh *dst, struct svc_fh *src)
219{ 219{
220 if (src->fh_dentry || src->fh_locked) { 220 WARN_ON(src->fh_dentry || src->fh_locked);
221 struct dentry *dentry = src->fh_dentry;
222 printk(KERN_ERR "fh_copy: copying %s/%s, already verified!\n",
223 dentry->d_parent->d_name.name, dentry->d_name.name);
224 }
225 221
226 *dst = *src; 222 *dst = *src;
227 return dst; 223 return dst;
@@ -300,10 +296,8 @@ fh_lock_nested(struct svc_fh *fhp, unsigned int subclass)
300 dfprintk(FILEOP, "nfsd: fh_lock(%s) locked = %d\n", 296 dfprintk(FILEOP, "nfsd: fh_lock(%s) locked = %d\n",
301 SVCFH_fmt(fhp), fhp->fh_locked); 297 SVCFH_fmt(fhp), fhp->fh_locked);
302 298
303 if (!fhp->fh_dentry) { 299 BUG_ON(!dentry);
304 printk(KERN_ERR "fh_lock: fh not verified!\n"); 300
305 return;
306 }
307 if (fhp->fh_locked) { 301 if (fhp->fh_locked) {
308 printk(KERN_WARNING "fh_lock: %s/%s already locked!\n", 302 printk(KERN_WARNING "fh_lock: %s/%s already locked!\n",
309 dentry->d_parent->d_name.name, dentry->d_name.name); 303 dentry->d_parent->d_name.name, dentry->d_name.name);
@@ -328,8 +322,7 @@ fh_lock(struct svc_fh *fhp)
328static inline void 322static inline void
329fh_unlock(struct svc_fh *fhp) 323fh_unlock(struct svc_fh *fhp)
330{ 324{
331 if (!fhp->fh_dentry) 325 BUG_ON(!fhp->fh_dentry);
332 printk(KERN_ERR "fh_unlock: fh not verified!\n");
333 326
334 if (fhp->fh_locked) { 327 if (fhp->fh_locked) {
335 fill_post_wcc(fhp); 328 fill_post_wcc(fhp);
diff --git a/include/linux/nfsd/xdr.h b/include/linux/nfsd/xdr.h
index 877192d3ae79..67885d5e6e50 100644
--- a/include/linux/nfsd/xdr.h
+++ b/include/linux/nfsd/xdr.h
@@ -165,8 +165,8 @@ int nfssvc_encode_readres(struct svc_rqst *, __be32 *, struct nfsd_readres *);
165int nfssvc_encode_statfsres(struct svc_rqst *, __be32 *, struct nfsd_statfsres *); 165int nfssvc_encode_statfsres(struct svc_rqst *, __be32 *, struct nfsd_statfsres *);
166int nfssvc_encode_readdirres(struct svc_rqst *, __be32 *, struct nfsd_readdirres *); 166int nfssvc_encode_readdirres(struct svc_rqst *, __be32 *, struct nfsd_readdirres *);
167 167
168int nfssvc_encode_entry(struct readdir_cd *, const char *name, 168int nfssvc_encode_entry(void *, const char *name,
169 int namlen, loff_t offset, ino_t ino, unsigned int); 169 int namlen, loff_t offset, u64 ino, unsigned int);
170 170
171int nfssvc_release_fhandle(struct svc_rqst *, __be32 *, struct nfsd_fhandle *); 171int nfssvc_release_fhandle(struct svc_rqst *, __be32 *, struct nfsd_fhandle *);
172 172
diff --git a/include/linux/nfsd/xdr3.h b/include/linux/nfsd/xdr3.h
index 79963867b0d7..89d9d6061a62 100644
--- a/include/linux/nfsd/xdr3.h
+++ b/include/linux/nfsd/xdr3.h
@@ -331,11 +331,11 @@ int nfs3svc_release_fhandle(struct svc_rqst *, __be32 *,
331 struct nfsd3_attrstat *); 331 struct nfsd3_attrstat *);
332int nfs3svc_release_fhandle2(struct svc_rqst *, __be32 *, 332int nfs3svc_release_fhandle2(struct svc_rqst *, __be32 *,
333 struct nfsd3_fhandle_pair *); 333 struct nfsd3_fhandle_pair *);
334int nfs3svc_encode_entry(struct readdir_cd *, const char *name, 334int nfs3svc_encode_entry(void *, const char *name,
335 int namlen, loff_t offset, ino_t ino, 335 int namlen, loff_t offset, u64 ino,
336 unsigned int); 336 unsigned int);
337int nfs3svc_encode_entry_plus(struct readdir_cd *, const char *name, 337int nfs3svc_encode_entry_plus(void *, const char *name,
338 int namlen, loff_t offset, ino_t ino, 338 int namlen, loff_t offset, u64 ino,
339 unsigned int); 339 unsigned int);
340/* Helper functions for NFSv3 ACL code */ 340/* Helper functions for NFSv3 ACL code */
341__be32 *nfs3svc_encode_post_op_attr(struct svc_rqst *rqstp, __be32 *p, 341__be32 *nfs3svc_encode_post_op_attr(struct svc_rqst *rqstp, __be32 *p,
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index f7a416c52edc..3d1d21035dec 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -1277,13 +1277,13 @@
1277#define PCI_DEVICE_ID_VIA_3296_0 0x0296 1277#define PCI_DEVICE_ID_VIA_3296_0 0x0296
1278#define PCI_DEVICE_ID_VIA_8363_0 0x0305 1278#define PCI_DEVICE_ID_VIA_8363_0 0x0305
1279#define PCI_DEVICE_ID_VIA_P4M800CE 0x0314 1279#define PCI_DEVICE_ID_VIA_P4M800CE 0x0314
1280#define PCI_DEVICE_ID_VIA_K8M890CE 0x0336 1280#define PCI_DEVICE_ID_VIA_P4M890 0x0327
1281#define PCI_DEVICE_ID_VIA_VT3336 0x0336
1281#define PCI_DEVICE_ID_VIA_8371_0 0x0391 1282#define PCI_DEVICE_ID_VIA_8371_0 0x0391
1282#define PCI_DEVICE_ID_VIA_8501_0 0x0501 1283#define PCI_DEVICE_ID_VIA_8501_0 0x0501
1283#define PCI_DEVICE_ID_VIA_82C561 0x0561 1284#define PCI_DEVICE_ID_VIA_82C561 0x0561
1284#define PCI_DEVICE_ID_VIA_82C586_1 0x0571 1285#define PCI_DEVICE_ID_VIA_82C586_1 0x0571
1285#define PCI_DEVICE_ID_VIA_82C576 0x0576 1286#define PCI_DEVICE_ID_VIA_82C576 0x0576
1286#define PCI_DEVICE_ID_VIA_SATA_EIDE 0x0581
1287#define PCI_DEVICE_ID_VIA_82C586_0 0x0586 1287#define PCI_DEVICE_ID_VIA_82C586_0 0x0586
1288#define PCI_DEVICE_ID_VIA_82C596 0x0596 1288#define PCI_DEVICE_ID_VIA_82C596 0x0596
1289#define PCI_DEVICE_ID_VIA_82C597_0 0x0597 1289#define PCI_DEVICE_ID_VIA_82C597_0 0x0597
@@ -1326,6 +1326,8 @@
1326#define PCI_DEVICE_ID_VIA_8237 0x3227 1326#define PCI_DEVICE_ID_VIA_8237 0x3227
1327#define PCI_DEVICE_ID_VIA_8251 0x3287 1327#define PCI_DEVICE_ID_VIA_8251 0x3287
1328#define PCI_DEVICE_ID_VIA_8237A 0x3337 1328#define PCI_DEVICE_ID_VIA_8237A 0x3337
1329#define PCI_DEVICE_ID_VIA_8237S 0x3372
1330#define PCI_DEVICE_ID_VIA_SATA_EIDE 0x5324
1329#define PCI_DEVICE_ID_VIA_8231 0x8231 1331#define PCI_DEVICE_ID_VIA_8231 0x8231
1330#define PCI_DEVICE_ID_VIA_8231_4 0x8235 1332#define PCI_DEVICE_ID_VIA_8231_4 0x8235
1331#define PCI_DEVICE_ID_VIA_8365_1 0x8305 1333#define PCI_DEVICE_ID_VIA_8365_1 0x8305
diff --git a/include/linux/pid_namespace.h b/include/linux/pid_namespace.h
index d2a9d419f01f..2833806d42c6 100644
--- a/include/linux/pid_namespace.h
+++ b/include/linux/pid_namespace.h
@@ -39,7 +39,7 @@ static inline void put_pid_ns(struct pid_namespace *ns)
39 39
40static inline struct task_struct *child_reaper(struct task_struct *tsk) 40static inline struct task_struct *child_reaper(struct task_struct *tsk)
41{ 41{
42 return tsk->nsproxy->pid_ns->child_reaper; 42 return init_pid_ns.child_reaper;
43} 43}
44 44
45#endif /* _LINUX_PID_NS_H */ 45#endif /* _LINUX_PID_NS_H */
diff --git a/include/linux/qic117.h b/include/linux/qic117.h
deleted file mode 100644
index 07b537e5d359..000000000000
--- a/include/linux/qic117.h
+++ /dev/null
@@ -1,290 +0,0 @@
1#ifndef _QIC117_H
2#define _QIC117_H
3
4/*
5 * Copyright (C) 1993-1996 Bas Laarhoven,
6 * (C) 1997 Claus-Justus Heine.
7
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
11 any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program; see the file COPYING. If not, write to
20 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
21
22 *
23 * $Source: /homes/cvs/ftape-stacked/include/linux/qic117.h,v $
24 * $Revision: 1.2 $
25 * $Date: 1997/10/05 19:19:32 $
26 *
27 * This file contains QIC-117 spec. related definitions for the
28 * QIC-40/80/3010/3020 floppy-tape driver "ftape" for Linux.
29 *
30 * These data were taken from the Quarter-Inch Cartridge
31 * Drive Standards, Inc. document titled:
32 * `Common Command Set Interface Specification for Flexible
33 * Disk Controller Based Minicartridge Tape Drives'
34 * document QIC-117 Revision J, 28 Aug 96.
35 * For more information, contact:
36 * Quarter-Inch Cartridge Drive Standards, Inc.
37 * 311 East Carrillo Street
38 * Santa Barbara, California 93101
39 * Telephone (805) 963-3853
40 * Fax (805) 962-1541
41 * WWW http://www.qic.org
42 *
43 * Current QIC standard revisions (of interest) are:
44 * QIC-40-MC, Rev. M, 2 Sep 92.
45 * QIC-80-MC, Rev. N, 20 Mar 96.
46 * QIC-80-MC, Rev. K, 15 Dec 94.
47 * QIC-113, Rev. G, 15 Jun 95.
48 * QIC-117, Rev. J, 28 Aug 96.
49 * QIC-122, Rev. B, 6 Mar 91.
50 * QIC-130, Rev. C, 2 Sep 92.
51 * QIC-3010-MC, Rev. F, 14 Jun 95.
52 * QIC-3020-MC, Rev. G, 31 Aug 95.
53 * QIC-CRF3, Rev. B, 15 Jun 95.
54 * */
55
56/*
57 * QIC-117 common command set rev. J.
58 * These commands are sent to the tape unit
59 * as number of pulses over the step line.
60 */
61
62typedef enum {
63 QIC_NO_COMMAND = 0,
64 QIC_RESET = 1,
65 QIC_REPORT_NEXT_BIT = 2,
66 QIC_PAUSE = 3,
67 QIC_MICRO_STEP_PAUSE = 4,
68 QIC_ALTERNATE_TIMEOUT = 5,
69 QIC_REPORT_DRIVE_STATUS = 6,
70 QIC_REPORT_ERROR_CODE = 7,
71 QIC_REPORT_DRIVE_CONFIGURATION = 8,
72 QIC_REPORT_ROM_VERSION = 9,
73 QIC_LOGICAL_FORWARD = 10,
74 QIC_PHYSICAL_REVERSE = 11,
75 QIC_PHYSICAL_FORWARD = 12,
76 QIC_SEEK_HEAD_TO_TRACK = 13,
77 QIC_SEEK_LOAD_POINT = 14,
78 QIC_ENTER_FORMAT_MODE = 15,
79 QIC_WRITE_REFERENCE_BURST = 16,
80 QIC_ENTER_VERIFY_MODE = 17,
81 QIC_STOP_TAPE = 18,
82/* commands 19-20: reserved */
83 QIC_MICRO_STEP_HEAD_UP = 21,
84 QIC_MICRO_STEP_HEAD_DOWN = 22,
85 QIC_SOFT_SELECT = 23,
86 QIC_SOFT_DESELECT = 24,
87 QIC_SKIP_REVERSE = 25,
88 QIC_SKIP_FORWARD = 26,
89 QIC_SELECT_RATE = 27,
90/* command 27, in ccs2: Select Rate or Format */
91 QIC_ENTER_DIAGNOSTIC_1 = 28,
92 QIC_ENTER_DIAGNOSTIC_2 = 29,
93 QIC_ENTER_PRIMARY_MODE = 30,
94/* command 31: vendor unique */
95 QIC_REPORT_VENDOR_ID = 32,
96 QIC_REPORT_TAPE_STATUS = 33,
97 QIC_SKIP_EXTENDED_REVERSE = 34,
98 QIC_SKIP_EXTENDED_FORWARD = 35,
99 QIC_CALIBRATE_TAPE_LENGTH = 36,
100 QIC_REPORT_FORMAT_SEGMENTS = 37,
101 QIC_SET_FORMAT_SEGMENTS = 38,
102/* commands 39-45: reserved */
103 QIC_PHANTOM_SELECT = 46,
104 QIC_PHANTOM_DESELECT = 47
105} qic117_cmd_t;
106
107typedef enum {
108 discretional = 0, required, ccs1, ccs2
109} qic_compatibility;
110
111typedef enum {
112 unused, mode, motion, report
113} command_types;
114
115struct qic117_command_table {
116 char *name;
117 __u8 mask;
118 __u8 state;
119 __u8 cmd_type;
120 __u8 non_intr;
121 __u8 level;
122};
123
124#define QIC117_COMMANDS {\
125/* command mask state cmd_type */\
126/* | name | | | non_intr */\
127/* | | | | | | level */\
128/* 0*/ {NULL, 0x00, 0x00, mode, 0, discretional},\
129/* 1*/ {"soft reset", 0x00, 0x00, motion, 1, required},\
130/* 2*/ {"report next bit", 0x00, 0x00, report, 0, required},\
131/* 3*/ {"pause", 0x36, 0x24, motion, 1, required},\
132/* 4*/ {"micro step pause", 0x36, 0x24, motion, 1, required},\
133/* 5*/ {"alternate command timeout", 0x00, 0x00, mode, 0, required},\
134/* 6*/ {"report drive status", 0x00, 0x00, report, 0, required},\
135/* 7*/ {"report error code", 0x01, 0x01, report, 0, required},\
136/* 8*/ {"report drive configuration",0x00, 0x00, report, 0, required},\
137/* 9*/ {"report rom version", 0x00, 0x00, report, 0, required},\
138/*10*/ {"logical forward", 0x37, 0x25, motion, 0, required},\
139/*11*/ {"physical reverse", 0x17, 0x05, motion, 0, required},\
140/*12*/ {"physical forward", 0x17, 0x05, motion, 0, required},\
141/*13*/ {"seek head to track", 0x37, 0x25, motion, 0, required},\
142/*14*/ {"seek load point", 0x17, 0x05, motion, 1, required},\
143/*15*/ {"enter format mode", 0x1f, 0x05, mode, 0, required},\
144/*16*/ {"write reference burst", 0x1f, 0x05, motion, 1, required},\
145/*17*/ {"enter verify mode", 0x37, 0x25, mode, 0, required},\
146/*18*/ {"stop tape", 0x00, 0x00, motion, 1, required},\
147/*19*/ {"reserved (19)", 0x00, 0x00, unused, 0, discretional},\
148/*20*/ {"reserved (20)", 0x00, 0x00, unused, 0, discretional},\
149/*21*/ {"micro step head up", 0x02, 0x00, motion, 0, required},\
150/*22*/ {"micro step head down", 0x02, 0x00, motion, 0, required},\
151/*23*/ {"soft select", 0x00, 0x00, mode, 0, discretional},\
152/*24*/ {"soft deselect", 0x00, 0x00, mode, 0, discretional},\
153/*25*/ {"skip segments reverse", 0x36, 0x24, motion, 1, required},\
154/*26*/ {"skip segments forward", 0x36, 0x24, motion, 1, required},\
155/*27*/ {"select rate or format", 0x03, 0x01, mode, 0, required /* [ccs2] */},\
156/*28*/ {"enter diag mode 1", 0x00, 0x00, mode, 0, discretional},\
157/*29*/ {"enter diag mode 2", 0x00, 0x00, mode, 0, discretional},\
158/*30*/ {"enter primary mode", 0x00, 0x00, mode, 0, required},\
159/*31*/ {"vendor unique (31)", 0x00, 0x00, unused, 0, discretional},\
160/*32*/ {"report vendor id", 0x00, 0x00, report, 0, required},\
161/*33*/ {"report tape status", 0x04, 0x04, report, 0, ccs1},\
162/*34*/ {"skip extended reverse", 0x36, 0x24, motion, 1, ccs1},\
163/*35*/ {"skip extended forward", 0x36, 0x24, motion, 1, ccs1},\
164/*36*/ {"calibrate tape length", 0x17, 0x05, motion, 1, ccs2},\
165/*37*/ {"report format segments", 0x17, 0x05, report, 0, ccs2},\
166/*38*/ {"set format segments", 0x17, 0x05, mode, 0, ccs2},\
167/*39*/ {"reserved (39)", 0x00, 0x00, unused, 0, discretional},\
168/*40*/ {"vendor unique (40)", 0x00, 0x00, unused, 0, discretional},\
169/*41*/ {"vendor unique (41)", 0x00, 0x00, unused, 0, discretional},\
170/*42*/ {"vendor unique (42)", 0x00, 0x00, unused, 0, discretional},\
171/*43*/ {"vendor unique (43)", 0x00, 0x00, unused, 0, discretional},\
172/*44*/ {"vendor unique (44)", 0x00, 0x00, unused, 0, discretional},\
173/*45*/ {"vendor unique (45)", 0x00, 0x00, unused, 0, discretional},\
174/*46*/ {"phantom select", 0x00, 0x00, mode, 0, discretional},\
175/*47*/ {"phantom deselect", 0x00, 0x00, mode, 0, discretional},\
176}
177
178/*
179 * Status bits returned by QIC_REPORT_DRIVE_STATUS
180 */
181
182#define QIC_STATUS_READY 0x01 /* Drive is ready or idle. */
183#define QIC_STATUS_ERROR 0x02 /* Error detected, must read
184 error code to clear this */
185#define QIC_STATUS_CARTRIDGE_PRESENT 0x04 /* Tape is present */
186#define QIC_STATUS_WRITE_PROTECT 0x08 /* Tape is write protected */
187#define QIC_STATUS_NEW_CARTRIDGE 0x10 /* New cartridge inserted, must
188 read error status to clear. */
189#define QIC_STATUS_REFERENCED 0x20 /* Cartridge appears to have been
190 formatted. */
191#define QIC_STATUS_AT_BOT 0x40 /* Cartridge is at physical
192 beginning of tape. */
193#define QIC_STATUS_AT_EOT 0x80 /* Cartridge is at physical end
194 of tape. */
195/*
196 * Status bits returned by QIC_REPORT_DRIVE_CONFIGURATION
197 */
198
199#define QIC_CONFIG_RATE_MASK 0x18
200#define QIC_CONFIG_RATE_SHIFT 3
201#define QIC_CONFIG_RATE_250 0
202#define QIC_CONFIG_RATE_500 2
203#define QIC_CONFIG_RATE_1000 3
204#define QIC_CONFIG_RATE_2000 1
205#define QIC_CONFIG_RATE_4000 0 /* since QIC-117 Rev. J */
206
207#define QIC_CONFIG_LONG 0x40 /* Extra Length Tape Detected */
208#define QIC_CONFIG_80 0x80 /* QIC-80 detected. */
209
210/*
211 * Status bits returned by QIC_REPORT_TAPE_STATUS
212 */
213
214#define QIC_TAPE_STD_MASK 0x0f
215#define QIC_TAPE_QIC40 0x01
216#define QIC_TAPE_QIC80 0x02
217#define QIC_TAPE_QIC3020 0x03
218#define QIC_TAPE_QIC3010 0x04
219
220#define QIC_TAPE_LEN_MASK 0x70
221#define QIC_TAPE_205FT 0x10
222#define QIC_TAPE_307FT 0x20
223#define QIC_TAPE_VARIABLE 0x30
224#define QIC_TAPE_1100FT 0x40
225#define QIC_TAPE_FLEX 0x60
226
227#define QIC_TAPE_WIDE 0x80
228
229/* Define a value (in feet) slightly higher than
230 * the possible maximum tape length.
231 */
232#define QIC_TOP_TAPE_LEN 1500
233
234/*
235 * Errors: List of error codes, and their severity.
236 */
237
238typedef struct {
239 char *message; /* Text describing the error. */
240 unsigned int fatal:1; /* Non-zero if the error is fatal. */
241} ftape_error;
242
243#define QIC117_ERRORS {\
244 /* 0*/ { "No error", 0, },\
245 /* 1*/ { "Command Received while Drive Not Ready", 0, },\
246 /* 2*/ { "Cartridge Not Present or Removed", 1, },\
247 /* 3*/ { "Motor Speed Error (not within 1%)", 1, },\
248 /* 4*/ { "Motor Speed Fault (jammed, or gross speed error", 1, },\
249 /* 5*/ { "Cartridge Write Protected", 1, },\
250 /* 6*/ { "Undefined or Reserved Command Code", 1, },\
251 /* 7*/ { "Illegal Track Address Specified for Seek", 1, },\
252 /* 8*/ { "Illegal Command in Report Subcontext", 0, },\
253 /* 9*/ { "Illegal Entry into a Diagnostic Mode", 1, },\
254 /*10*/ { "Broken Tape Detected (based on hole sensor)", 1, },\
255 /*11*/ { "Warning--Read Gain Setting Error", 1, },\
256 /*12*/ { "Command Received While Error Status Pending (obs)", 1, },\
257 /*13*/ { "Command Received While New Cartridge Pending", 1, },\
258 /*14*/ { "Command Illegal or Undefined in Primary Mode", 1, },\
259 /*15*/ { "Command Illegal or Undefined in Format Mode", 1, },\
260 /*16*/ { "Command Illegal or Undefined in Verify Mode", 1, },\
261 /*17*/ { "Logical Forward Not at Logical BOT or no Format Segments in Format Mode", 1, },\
262 /*18*/ { "Logical EOT Before All Segments generated", 1, },\
263 /*19*/ { "Command Illegal When Cartridge Not Referenced", 1, },\
264 /*20*/ { "Self-Diagnostic Failed (cannot be cleared)", 1, },\
265 /*21*/ { "Warning EEPROM Not Initialized, Defaults Set", 1, },\
266 /*22*/ { "EEPROM Corrupted or Hardware Failure", 1, },\
267 /*23*/ { "Motion Time-out Error", 1, },\
268 /*24*/ { "Data Segment Too Long -- Logical Forward or Pause", 1, },\
269 /*25*/ { "Transmit Overrun (obs)", 1, },\
270 /*26*/ { "Power On Reset Occurred", 0, },\
271 /*27*/ { "Software Reset Occurred", 0, },\
272 /*28*/ { "Diagnostic Mode 1 Error", 1, },\
273 /*29*/ { "Diagnostic Mode 2 Error", 1, },\
274 /*30*/ { "Command Received During Non-Interruptible Process", 1, },\
275 /*31*/ { "Rate or Format Selection Error", 1, },\
276 /*32*/ { "Illegal Command While in High Speed Mode", 1, },\
277 /*33*/ { "Illegal Seek Segment Value", 1, },\
278 /*34*/ { "Invalid Media", 1, },\
279 /*35*/ { "Head Positioning Failure", 1, },\
280 /*36*/ { "Write Reference Burst Failure", 1, },\
281 /*37*/ { "Prom Code Missing", 1, },\
282 /*38*/ { "Invalid Format", 1, },\
283 /*39*/ { "EOT/BOT System Failure", 1, },\
284 /*40*/ { "Prom A Checksum Error", 1, },\
285 /*41*/ { "Drive Wakeup Reset Occurred", 1, },\
286 /*42*/ { "Prom B Checksum Error", 1, },\
287 /*43*/ { "Illegal Entry into Format Mode", 1, },\
288}
289
290#endif /* _QIC117_H */
diff --git a/include/linux/raid/md.h b/include/linux/raid/md.h
index 866a1e2b0ce0..fbaeda79b2e9 100644
--- a/include/linux/raid/md.h
+++ b/include/linux/raid/md.h
@@ -94,7 +94,7 @@ extern int sync_page_io(struct block_device *bdev, sector_t sector, int size,
94 struct page *page, int rw); 94 struct page *page, int rw);
95extern void md_do_sync(mddev_t *mddev); 95extern void md_do_sync(mddev_t *mddev);
96extern void md_new_event(mddev_t *mddev); 96extern void md_new_event(mddev_t *mddev);
97 97extern void md_allow_write(mddev_t *mddev);
98 98
99#endif /* CONFIG_MD */ 99#endif /* CONFIG_MD */
100#endif 100#endif
diff --git a/include/linux/reiserfs_fs_i.h b/include/linux/reiserfs_fs_i.h
index 5b3b297aa2c5..ce3663fb0101 100644
--- a/include/linux/reiserfs_fs_i.h
+++ b/include/linux/reiserfs_fs_i.h
@@ -25,6 +25,7 @@ typedef enum {
25 i_link_saved_truncate_mask = 0x0020, 25 i_link_saved_truncate_mask = 0x0020,
26 i_has_xattr_dir = 0x0040, 26 i_has_xattr_dir = 0x0040,
27 i_data_log = 0x0080, 27 i_data_log = 0x0080,
28 i_ever_mapped = 0x0100
28} reiserfs_inode_flags; 29} reiserfs_inode_flags;
29 30
30struct reiserfs_inode_info { 31struct reiserfs_inode_info {
@@ -52,6 +53,7 @@ struct reiserfs_inode_info {
52 ** flushed */ 53 ** flushed */
53 unsigned long i_trans_id; 54 unsigned long i_trans_id;
54 struct reiserfs_journal_list *i_jl; 55 struct reiserfs_journal_list *i_jl;
56 struct mutex i_mmap;
55#ifdef CONFIG_REISERFS_FS_POSIX_ACL 57#ifdef CONFIG_REISERFS_FS_POSIX_ACL
56 struct posix_acl *i_acl_access; 58 struct posix_acl *i_acl_access;
57 struct posix_acl *i_acl_default; 59 struct posix_acl *i_acl_default;
diff --git a/include/linux/rtmutex.h b/include/linux/rtmutex.h
index b0090e9f7884..382bb7951166 100644
--- a/include/linux/rtmutex.h
+++ b/include/linux/rtmutex.h
@@ -16,7 +16,7 @@
16#include <linux/plist.h> 16#include <linux/plist.h>
17#include <linux/spinlock_types.h> 17#include <linux/spinlock_types.h>
18 18
19/* 19/**
20 * The rt_mutex structure 20 * The rt_mutex structure
21 * 21 *
22 * @wait_lock: spinlock to protect the structure 22 * @wait_lock: spinlock to protect the structure
@@ -71,7 +71,7 @@ struct hrtimer_sleeper;
71#define DEFINE_RT_MUTEX(mutexname) \ 71#define DEFINE_RT_MUTEX(mutexname) \
72 struct rt_mutex mutexname = __RT_MUTEX_INITIALIZER(mutexname) 72 struct rt_mutex mutexname = __RT_MUTEX_INITIALIZER(mutexname)
73 73
74/*** 74/**
75 * rt_mutex_is_locked - is the mutex locked 75 * rt_mutex_is_locked - is the mutex locked
76 * @lock: the mutex to be queried 76 * @lock: the mutex to be queried
77 * 77 *
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h
index 97c761652581..8b6ce60ea057 100644
--- a/include/linux/sunrpc/sched.h
+++ b/include/linux/sunrpc/sched.h
@@ -250,7 +250,6 @@ void rpc_init_task(struct rpc_task *task, struct rpc_clnt *clnt,
250 int flags, const struct rpc_call_ops *ops, 250 int flags, const struct rpc_call_ops *ops,
251 void *data); 251 void *data);
252void rpc_put_task(struct rpc_task *); 252void rpc_put_task(struct rpc_task *);
253void rpc_release_task(struct rpc_task *);
254void rpc_exit_task(struct rpc_task *); 253void rpc_exit_task(struct rpc_task *);
255void rpc_release_calldata(const struct rpc_call_ops *, void *); 254void rpc_release_calldata(const struct rpc_call_ops *, void *);
256void rpc_killall_tasks(struct rpc_clnt *); 255void rpc_killall_tasks(struct rpc_clnt *);
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h
index 965d6c20086e..64f3d60c72af 100644
--- a/include/linux/sunrpc/svc.h
+++ b/include/linux/sunrpc/svc.h
@@ -144,8 +144,11 @@ extern u32 svc_max_payload(const struct svc_rqst *rqstp);
144 * 144 *
145 * Each request/reply pair can have at most one "payload", plus two pages, 145 * Each request/reply pair can have at most one "payload", plus two pages,
146 * one for the request, and one for the reply. 146 * one for the request, and one for the reply.
147 * We using ->sendfile to return read data, we might need one extra page
148 * if the request is not page-aligned. So add another '1'.
147 */ 149 */
148#define RPCSVC_MAXPAGES ((RPCSVC_MAXPAYLOAD+PAGE_SIZE-1)/PAGE_SIZE + 2) 150#define RPCSVC_MAXPAGES ((RPCSVC_MAXPAYLOAD+PAGE_SIZE-1)/PAGE_SIZE \
151 + 2 + 1)
149 152
150static inline u32 svc_getnl(struct kvec *iov) 153static inline u32 svc_getnl(struct kvec *iov)
151{ 154{
diff --git a/include/linux/timer.h b/include/linux/timer.h
index eeef6643d4c6..fb5edaaf0ebd 100644
--- a/include/linux/timer.h
+++ b/include/linux/timer.h
@@ -41,7 +41,7 @@ static inline void setup_timer(struct timer_list * timer,
41 init_timer(timer); 41 init_timer(timer);
42} 42}
43 43
44/*** 44/**
45 * timer_pending - is a timer pending? 45 * timer_pending - is a timer pending?
46 * @timer: the timer in question 46 * @timer: the timer in question
47 * 47 *
@@ -63,7 +63,7 @@ extern int mod_timer(struct timer_list *timer, unsigned long expires);
63 63
64extern unsigned long next_timer_interrupt(void); 64extern unsigned long next_timer_interrupt(void);
65 65
66/*** 66/**
67 * add_timer - start a timer 67 * add_timer - start a timer
68 * @timer: the timer to be added 68 * @timer: the timer to be added
69 * 69 *
diff --git a/include/net/inet6_connection_sock.h b/include/net/inet6_connection_sock.h
index 16aa96a6a53b..f13ddc2543b1 100644
--- a/include/net/inet6_connection_sock.h
+++ b/include/net/inet6_connection_sock.h
@@ -38,5 +38,5 @@ extern void inet6_csk_reqsk_queue_hash_add(struct sock *sk,
38 38
39extern void inet6_csk_addr2sockaddr(struct sock *sk, struct sockaddr *uaddr); 39extern void inet6_csk_addr2sockaddr(struct sock *sk, struct sockaddr *uaddr);
40 40
41extern int inet6_csk_xmit(struct sk_buff *skb, struct sock *sk, int ipfragok); 41extern int inet6_csk_xmit(struct sk_buff *skb, int ipfragok);
42#endif /* _INET6_CONNECTION_SOCK_H */ 42#endif /* _INET6_CONNECTION_SOCK_H */
diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h
index bf16d98d372c..133cf30d2d79 100644
--- a/include/net/inet_connection_sock.h
+++ b/include/net/inet_connection_sock.h
@@ -37,8 +37,7 @@ struct tcp_congestion_ops;
37 * (i.e. things that depend on the address family) 37 * (i.e. things that depend on the address family)
38 */ 38 */
39struct inet_connection_sock_af_ops { 39struct inet_connection_sock_af_ops {
40 int (*queue_xmit)(struct sk_buff *skb, struct sock *sk, 40 int (*queue_xmit)(struct sk_buff *skb, int ipfragok);
41 int ipfragok);
42 void (*send_check)(struct sock *sk, int len, 41 void (*send_check)(struct sock *sk, int len,
43 struct sk_buff *skb); 42 struct sk_buff *skb);
44 int (*rebuild_header)(struct sock *sk); 43 int (*rebuild_header)(struct sock *sk);
diff --git a/include/net/ip.h b/include/net/ip.h
index 053f02b5cb89..e79c3e3aa4f6 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -97,7 +97,7 @@ extern int ip_mc_output(struct sk_buff *skb);
97extern int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *)); 97extern int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *));
98extern int ip_do_nat(struct sk_buff *skb); 98extern int ip_do_nat(struct sk_buff *skb);
99extern void ip_send_check(struct iphdr *ip); 99extern void ip_send_check(struct iphdr *ip);
100extern int ip_queue_xmit(struct sk_buff *skb, struct sock *sk, int ipfragok); 100extern int ip_queue_xmit(struct sk_buff *skb, int ipfragok);
101extern void ip_init(void); 101extern void ip_init(void);
102extern int ip_append_data(struct sock *sk, 102extern int ip_append_data(struct sock *sk,
103 int getfrag(void *from, char *to, int offset, int len, 103 int getfrag(void *from, char *to, int offset, int len,
diff --git a/include/net/netfilter/nf_conntrack_compat.h b/include/net/netfilter/nf_conntrack_compat.h
index b9ce5c80d9d5..6f84c1f7fcd4 100644
--- a/include/net/netfilter/nf_conntrack_compat.h
+++ b/include/net/netfilter/nf_conntrack_compat.h
@@ -6,6 +6,7 @@
6#if defined(CONFIG_IP_NF_CONNTRACK) || defined(CONFIG_IP_NF_CONNTRACK_MODULE) 6#if defined(CONFIG_IP_NF_CONNTRACK) || defined(CONFIG_IP_NF_CONNTRACK_MODULE)
7 7
8#include <linux/netfilter_ipv4/ip_conntrack.h> 8#include <linux/netfilter_ipv4/ip_conntrack.h>
9#include <linux/socket.h>
9 10
10#ifdef CONFIG_IP_NF_CONNTRACK_MARK 11#ifdef CONFIG_IP_NF_CONNTRACK_MARK
11static inline u_int32_t *nf_ct_get_mark(const struct sk_buff *skb, 12static inline u_int32_t *nf_ct_get_mark(const struct sk_buff *skb,
diff --git a/include/net/sctp/sm.h b/include/net/sctp/sm.h
index 3269ed1cc222..73cb9943c8a8 100644
--- a/include/net/sctp/sm.h
+++ b/include/net/sctp/sm.h
@@ -134,6 +134,7 @@ sctp_state_fn_t sctp_sf_violation;
134sctp_state_fn_t sctp_sf_discard_chunk; 134sctp_state_fn_t sctp_sf_discard_chunk;
135sctp_state_fn_t sctp_sf_do_5_2_1_siminit; 135sctp_state_fn_t sctp_sf_do_5_2_1_siminit;
136sctp_state_fn_t sctp_sf_do_5_2_2_dupinit; 136sctp_state_fn_t sctp_sf_do_5_2_2_dupinit;
137sctp_state_fn_t sctp_sf_do_5_2_3_initack;
137sctp_state_fn_t sctp_sf_do_5_2_4_dupcook; 138sctp_state_fn_t sctp_sf_do_5_2_4_dupcook;
138sctp_state_fn_t sctp_sf_unk_chunk; 139sctp_state_fn_t sctp_sf_unk_chunk;
139sctp_state_fn_t sctp_sf_do_8_5_1_E_sa; 140sctp_state_fn_t sctp_sf_do_8_5_1_E_sa;
diff --git a/include/sound/core.h b/include/sound/core.h
index a994bea09cd6..521f036cce99 100644
--- a/include/sound/core.h
+++ b/include/sound/core.h
@@ -132,8 +132,10 @@ struct snd_card {
132 int shutdown; /* this card is going down */ 132 int shutdown; /* this card is going down */
133 int free_on_last_close; /* free in context of file_release */ 133 int free_on_last_close; /* free in context of file_release */
134 wait_queue_head_t shutdown_sleep; 134 wait_queue_head_t shutdown_sleep;
135 struct device *parent; 135 struct device *dev; /* device assigned to this card */
136 struct device *dev; 136#ifndef CONFIG_SYSFS_DEPRECATED
137 struct device *card_dev; /* cardX object for sysfs */
138#endif
137 139
138#ifdef CONFIG_PM 140#ifdef CONFIG_PM
139 unsigned int power_state; /* power state */ 141 unsigned int power_state; /* power state */
@@ -191,6 +193,16 @@ struct snd_minor {
191 struct device *dev; /* device for sysfs */ 193 struct device *dev; /* device for sysfs */
192}; 194};
193 195
196/* return a device pointer linked to each sound device as a parent */
197static inline struct device *snd_card_get_device_link(struct snd_card *card)
198{
199#ifdef CONFIG_SYSFS_DEPRECATED
200 return card ? card->dev : NULL;
201#else
202 return card ? card->card_dev : NULL;
203#endif
204}
205
194/* sound.c */ 206/* sound.c */
195 207
196extern int snd_major; 208extern int snd_major;
@@ -257,7 +269,7 @@ int snd_card_file_add(struct snd_card *card, struct file *file);
257int snd_card_file_remove(struct snd_card *card, struct file *file); 269int snd_card_file_remove(struct snd_card *card, struct file *file);
258 270
259#ifndef snd_card_set_dev 271#ifndef snd_card_set_dev
260#define snd_card_set_dev(card,devptr) ((card)->parent = (devptr)) 272#define snd_card_set_dev(card,devptr) ((card)->dev = (devptr))
261#endif 273#endif
262 274
263/* device.c */ 275/* device.c */
diff --git a/ipc/shm.c b/ipc/shm.c
index 6d16bb6de7d2..f8e10a25ad7d 100644
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -279,7 +279,7 @@ static int newseg (struct ipc_namespace *ns, key_t key, int shmflg, size_t size)
279 if (size < SHMMIN || size > ns->shm_ctlmax) 279 if (size < SHMMIN || size > ns->shm_ctlmax)
280 return -EINVAL; 280 return -EINVAL;
281 281
282 if (ns->shm_tot + numpages >= ns->shm_ctlall) 282 if (ns->shm_tot + numpages > ns->shm_ctlall)
283 return -ENOSPC; 283 return -ENOSPC;
284 284
285 shp = ipc_rcu_alloc(sizeof(*shp)); 285 shp = ipc_rcu_alloc(sizeof(*shp));
diff --git a/kernel/exit.c b/kernel/exit.c
index 35401720635b..fec12eb12471 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -938,8 +938,8 @@ fastcall NORET_TYPE void do_exit(long code)
938 938
939 tsk->exit_code = code; 939 tsk->exit_code = code;
940 proc_exit_connector(tsk); 940 proc_exit_connector(tsk);
941 exit_notify(tsk);
942 exit_task_namespaces(tsk); 941 exit_task_namespaces(tsk);
942 exit_notify(tsk);
943#ifdef CONFIG_NUMA 943#ifdef CONFIG_NUMA
944 mpol_free(tsk->mempolicy); 944 mpol_free(tsk->mempolicy);
945 tsk->mempolicy = NULL; 945 tsk->mempolicy = NULL;
diff --git a/kernel/fork.c b/kernel/fork.c
index fc723e595cd5..d57118da73ff 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -1313,7 +1313,7 @@ noinline struct pt_regs * __devinit __attribute__((weak)) idle_regs(struct pt_re
1313 return regs; 1313 return regs;
1314} 1314}
1315 1315
1316struct task_struct * __devinit fork_idle(int cpu) 1316struct task_struct * __cpuinit fork_idle(int cpu)
1317{ 1317{
1318 struct task_struct *task; 1318 struct task_struct *task;
1319 struct pt_regs regs; 1319 struct pt_regs regs;
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index b385878c6e80..8b961adc3bd2 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -315,6 +315,9 @@ int setup_irq(unsigned int irq, struct irqaction *new)
315 /* Undo nested disables: */ 315 /* Undo nested disables: */
316 desc->depth = 1; 316 desc->depth = 1;
317 } 317 }
318 /* Reset broken irq detection when installing new handler */
319 desc->irq_count = 0;
320 desc->irqs_unhandled = 0;
318 spin_unlock_irqrestore(&desc->lock, flags); 321 spin_unlock_irqrestore(&desc->lock, flags);
319 322
320 new->irq = irq; 323 new->irq = irq;
diff --git a/kernel/kprobes.c b/kernel/kprobes.c
index 17ec4afb0994..6fcf8dd148d0 100644
--- a/kernel/kprobes.c
+++ b/kernel/kprobes.c
@@ -87,6 +87,12 @@ struct kprobe_insn_page {
87 int ngarbage; 87 int ngarbage;
88}; 88};
89 89
90enum kprobe_slot_state {
91 SLOT_CLEAN = 0,
92 SLOT_DIRTY = 1,
93 SLOT_USED = 2,
94};
95
90static struct hlist_head kprobe_insn_pages; 96static struct hlist_head kprobe_insn_pages;
91static int kprobe_garbage_slots; 97static int kprobe_garbage_slots;
92static int collect_garbage_slots(void); 98static int collect_garbage_slots(void);
@@ -130,8 +136,8 @@ kprobe_opcode_t __kprobes *get_insn_slot(void)
130 if (kip->nused < INSNS_PER_PAGE) { 136 if (kip->nused < INSNS_PER_PAGE) {
131 int i; 137 int i;
132 for (i = 0; i < INSNS_PER_PAGE; i++) { 138 for (i = 0; i < INSNS_PER_PAGE; i++) {
133 if (!kip->slot_used[i]) { 139 if (kip->slot_used[i] == SLOT_CLEAN) {
134 kip->slot_used[i] = 1; 140 kip->slot_used[i] = SLOT_USED;
135 kip->nused++; 141 kip->nused++;
136 return kip->insns + (i * MAX_INSN_SIZE); 142 return kip->insns + (i * MAX_INSN_SIZE);
137 } 143 }
@@ -163,8 +169,8 @@ kprobe_opcode_t __kprobes *get_insn_slot(void)
163 } 169 }
164 INIT_HLIST_NODE(&kip->hlist); 170 INIT_HLIST_NODE(&kip->hlist);
165 hlist_add_head(&kip->hlist, &kprobe_insn_pages); 171 hlist_add_head(&kip->hlist, &kprobe_insn_pages);
166 memset(kip->slot_used, 0, INSNS_PER_PAGE); 172 memset(kip->slot_used, SLOT_CLEAN, INSNS_PER_PAGE);
167 kip->slot_used[0] = 1; 173 kip->slot_used[0] = SLOT_USED;
168 kip->nused = 1; 174 kip->nused = 1;
169 kip->ngarbage = 0; 175 kip->ngarbage = 0;
170 return kip->insns; 176 return kip->insns;
@@ -173,7 +179,7 @@ kprobe_opcode_t __kprobes *get_insn_slot(void)
173/* Return 1 if all garbages are collected, otherwise 0. */ 179/* Return 1 if all garbages are collected, otherwise 0. */
174static int __kprobes collect_one_slot(struct kprobe_insn_page *kip, int idx) 180static int __kprobes collect_one_slot(struct kprobe_insn_page *kip, int idx)
175{ 181{
176 kip->slot_used[idx] = 0; 182 kip->slot_used[idx] = SLOT_CLEAN;
177 kip->nused--; 183 kip->nused--;
178 if (kip->nused == 0) { 184 if (kip->nused == 0) {
179 /* 185 /*
@@ -212,7 +218,7 @@ static int __kprobes collect_garbage_slots(void)
212 continue; 218 continue;
213 kip->ngarbage = 0; /* we will collect all garbages */ 219 kip->ngarbage = 0; /* we will collect all garbages */
214 for (i = 0; i < INSNS_PER_PAGE; i++) { 220 for (i = 0; i < INSNS_PER_PAGE; i++) {
215 if (kip->slot_used[i] == -1 && 221 if (kip->slot_used[i] == SLOT_DIRTY &&
216 collect_one_slot(kip, i)) 222 collect_one_slot(kip, i))
217 break; 223 break;
218 } 224 }
@@ -232,7 +238,7 @@ void __kprobes free_insn_slot(kprobe_opcode_t * slot, int dirty)
232 slot < kip->insns + (INSNS_PER_PAGE * MAX_INSN_SIZE)) { 238 slot < kip->insns + (INSNS_PER_PAGE * MAX_INSN_SIZE)) {
233 int i = (slot - kip->insns) / MAX_INSN_SIZE; 239 int i = (slot - kip->insns) / MAX_INSN_SIZE;
234 if (dirty) { 240 if (dirty) {
235 kip->slot_used[i] = -1; 241 kip->slot_used[i] = SLOT_DIRTY;
236 kip->ngarbage++; 242 kip->ngarbage++;
237 } else { 243 } else {
238 collect_one_slot(kip, i); 244 collect_one_slot(kip, i);
diff --git a/kernel/pid.c b/kernel/pid.c
index 2efe9d8d367b..78f2aee90f54 100644
--- a/kernel/pid.c
+++ b/kernel/pid.c
@@ -197,7 +197,7 @@ fastcall void free_pid(struct pid *pid)
197 hlist_del_rcu(&pid->pid_chain); 197 hlist_del_rcu(&pid->pid_chain);
198 spin_unlock_irqrestore(&pidmap_lock, flags); 198 spin_unlock_irqrestore(&pidmap_lock, flags);
199 199
200 free_pidmap(current->nsproxy->pid_ns, pid->nr); 200 free_pidmap(&init_pid_ns, pid->nr);
201 call_rcu(&pid->rcu, delayed_put_pid); 201 call_rcu(&pid->rcu, delayed_put_pid);
202} 202}
203 203
diff --git a/kernel/profile.c b/kernel/profile.c
index a6574a18514e..d6579d511069 100644
--- a/kernel/profile.c
+++ b/kernel/profile.c
@@ -331,7 +331,6 @@ out:
331 local_irq_restore(flags); 331 local_irq_restore(flags);
332 put_cpu(); 332 put_cpu();
333} 333}
334EXPORT_SYMBOL_GPL(profile_hits);
335 334
336static int __devinit profile_cpu_callback(struct notifier_block *info, 335static int __devinit profile_cpu_callback(struct notifier_block *info,
337 unsigned long action, void *__cpu) 336 unsigned long action, void *__cpu)
@@ -401,6 +400,8 @@ void profile_hits(int type, void *__pc, unsigned int nr_hits)
401} 400}
402#endif /* !CONFIG_SMP */ 401#endif /* !CONFIG_SMP */
403 402
403EXPORT_SYMBOL_GPL(profile_hits);
404
404void profile_tick(int type) 405void profile_tick(int type)
405{ 406{
406 struct pt_regs *regs = get_irq_regs(); 407 struct pt_regs *regs = get_irq_regs();
diff --git a/kernel/sys.c b/kernel/sys.c
index c7675c1bfdf2..6e2101dec0fc 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -323,11 +323,18 @@ EXPORT_SYMBOL_GPL(blocking_notifier_chain_unregister);
323int blocking_notifier_call_chain(struct blocking_notifier_head *nh, 323int blocking_notifier_call_chain(struct blocking_notifier_head *nh,
324 unsigned long val, void *v) 324 unsigned long val, void *v)
325{ 325{
326 int ret; 326 int ret = NOTIFY_DONE;
327 327
328 down_read(&nh->rwsem); 328 /*
329 ret = notifier_call_chain(&nh->head, val, v); 329 * We check the head outside the lock, but if this access is
330 up_read(&nh->rwsem); 330 * racy then it does not matter what the result of the test
331 * is, we re-check the list after having taken the lock anyway:
332 */
333 if (rcu_dereference(nh->head)) {
334 down_read(&nh->rwsem);
335 ret = notifier_call_chain(&nh->head, val, v);
336 up_read(&nh->rwsem);
337 }
331 return ret; 338 return ret;
332} 339}
333 340
diff --git a/mm/filemap_xip.c b/mm/filemap_xip.c
index 45b3553865cf..9dd9fbb75139 100644
--- a/mm/filemap_xip.c
+++ b/mm/filemap_xip.c
@@ -183,7 +183,7 @@ __xip_unmap (struct address_space * mapping,
183 address = vma->vm_start + 183 address = vma->vm_start +
184 ((pgoff - vma->vm_pgoff) << PAGE_SHIFT); 184 ((pgoff - vma->vm_pgoff) << PAGE_SHIFT);
185 BUG_ON(address < vma->vm_start || address >= vma->vm_end); 185 BUG_ON(address < vma->vm_start || address >= vma->vm_end);
186 page = ZERO_PAGE(address); 186 page = ZERO_PAGE(0);
187 pte = page_check_address(page, mm, address, &ptl); 187 pte = page_check_address(page, mm, address, &ptl);
188 if (pte) { 188 if (pte) {
189 /* Nuke the page table entry. */ 189 /* Nuke the page table entry. */
@@ -246,7 +246,7 @@ xip_file_nopage(struct vm_area_struct * area,
246 __xip_unmap(mapping, pgoff); 246 __xip_unmap(mapping, pgoff);
247 } else { 247 } else {
248 /* not shared and writable, use ZERO_PAGE() */ 248 /* not shared and writable, use ZERO_PAGE() */
249 page = ZERO_PAGE(address); 249 page = ZERO_PAGE(0);
250 } 250 }
251 251
252out: 252out:
diff --git a/mm/memory.c b/mm/memory.c
index af227d26e104..ef09f0acb1d8 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -2606,8 +2606,15 @@ static int __init gate_vma_init(void)
2606 gate_vma.vm_mm = NULL; 2606 gate_vma.vm_mm = NULL;
2607 gate_vma.vm_start = FIXADDR_USER_START; 2607 gate_vma.vm_start = FIXADDR_USER_START;
2608 gate_vma.vm_end = FIXADDR_USER_END; 2608 gate_vma.vm_end = FIXADDR_USER_END;
2609 gate_vma.vm_page_prot = PAGE_READONLY; 2609 gate_vma.vm_flags = VM_READ | VM_MAYREAD | VM_EXEC | VM_MAYEXEC;
2610 gate_vma.vm_flags = 0; 2610 gate_vma.vm_page_prot = __P101;
2611 /*
2612 * Make sure the vDSO gets into every core dump.
2613 * Dumping its contents makes post-mortem fully interpretable later
2614 * without matching up the same kernel and hardware config to see
2615 * what PC values meant.
2616 */
2617 gate_vma.vm_flags |= VM_ALWAYSDUMP;
2611 return 0; 2618 return 0;
2612} 2619}
2613__initcall(gate_vma_init); 2620__initcall(gate_vma_init);
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index da9463946556..c2aec0e1090d 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -884,6 +884,10 @@ asmlinkage long sys_mbind(unsigned long start, unsigned long len,
884 err = get_nodes(&nodes, nmask, maxnode); 884 err = get_nodes(&nodes, nmask, maxnode);
885 if (err) 885 if (err)
886 return err; 886 return err;
887#ifdef CONFIG_CPUSETS
888 /* Restrict the nodes to the allowed nodes in the cpuset */
889 nodes_and(nodes, nodes, current->mems_allowed);
890#endif
887 return do_mbind(start, len, mode, &nodes, flags); 891 return do_mbind(start, len, mode, &nodes, flags);
888} 892}
889 893
diff --git a/mm/mmap.c b/mm/mmap.c
index 9717337293c3..cc3a20819457 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -1477,6 +1477,7 @@ static int acct_stack_growth(struct vm_area_struct * vma, unsigned long size, un
1477{ 1477{
1478 struct mm_struct *mm = vma->vm_mm; 1478 struct mm_struct *mm = vma->vm_mm;
1479 struct rlimit *rlim = current->signal->rlim; 1479 struct rlimit *rlim = current->signal->rlim;
1480 unsigned long new_start;
1480 1481
1481 /* address space limit tests */ 1482 /* address space limit tests */
1482 if (!may_expand_vm(mm, grow)) 1483 if (!may_expand_vm(mm, grow))
@@ -1496,6 +1497,12 @@ static int acct_stack_growth(struct vm_area_struct * vma, unsigned long size, un
1496 return -ENOMEM; 1497 return -ENOMEM;
1497 } 1498 }
1498 1499
1500 /* Check to ensure the stack will not grow into a hugetlb-only region */
1501 new_start = (vma->vm_flags & VM_GROWSUP) ? vma->vm_start :
1502 vma->vm_end - size;
1503 if (is_hugepage_only_range(vma->vm_mm, new_start, size))
1504 return -EFAULT;
1505
1499 /* 1506 /*
1500 * Overcommit.. This must be the final test, as it will 1507 * Overcommit.. This must be the final test, as it will
1501 * update security statistics. 1508 * update security statistics.
diff --git a/mm/mremap.c b/mm/mremap.c
index 9c769fa29f32..5d4bd4f95b8e 100644
--- a/mm/mremap.c
+++ b/mm/mremap.c
@@ -105,7 +105,6 @@ static void move_ptes(struct vm_area_struct *vma, pmd_t *old_pmd,
105 if (pte_none(*old_pte)) 105 if (pte_none(*old_pte))
106 continue; 106 continue;
107 pte = ptep_clear_flush(vma, old_addr, old_pte); 107 pte = ptep_clear_flush(vma, old_addr, old_pte);
108 /* ZERO_PAGE can be dependant on virtual addr */
109 pte = move_pte(pte, new_vma->vm_page_prot, old_addr, new_addr); 108 pte = move_pte(pte, new_vma->vm_page_prot, old_addr, new_addr);
110 set_pte_at(mm, new_addr, new_pte, pte); 109 set_pte_at(mm, new_addr, new_pte, pte);
111 } 110 }
diff --git a/mm/page-writeback.c b/mm/page-writeback.c
index 1d2fc89ca56d..be0efbde4994 100644
--- a/mm/page-writeback.c
+++ b/mm/page-writeback.c
@@ -133,11 +133,9 @@ get_dirty_limits(long *pbackground, long *pdirty,
133 133
134#ifdef CONFIG_HIGHMEM 134#ifdef CONFIG_HIGHMEM
135 /* 135 /*
136 * If this mapping can only allocate from low memory, 136 * We always exclude high memory from our count.
137 * we exclude high memory from our count.
138 */ 137 */
139 if (mapping && !(mapping_gfp_mask(mapping) & __GFP_HIGHMEM)) 138 available_memory -= totalhigh_pages;
140 available_memory -= totalhigh_pages;
141#endif 139#endif
142 140
143 141
@@ -526,28 +524,25 @@ static struct notifier_block __cpuinitdata ratelimit_nb = {
526}; 524};
527 525
528/* 526/*
529 * If the machine has a large highmem:lowmem ratio then scale back the default 527 * Called early on to tune the page writeback dirty limits.
530 * dirty memory thresholds: allowing too much dirty highmem pins an excessive 528 *
531 * number of buffer_heads. 529 * We used to scale dirty pages according to how total memory
530 * related to pages that could be allocated for buffers (by
531 * comparing nr_free_buffer_pages() to vm_total_pages.
532 *
533 * However, that was when we used "dirty_ratio" to scale with
534 * all memory, and we don't do that any more. "dirty_ratio"
535 * is now applied to total non-HIGHPAGE memory (by subtracting
536 * totalhigh_pages from vm_total_pages), and as such we can't
537 * get into the old insane situation any more where we had
538 * large amounts of dirty pages compared to a small amount of
539 * non-HIGHMEM memory.
540 *
541 * But we might still want to scale the dirty_ratio by how
542 * much memory the box has..
532 */ 543 */
533void __init page_writeback_init(void) 544void __init page_writeback_init(void)
534{ 545{
535 long buffer_pages = nr_free_buffer_pages();
536 long correction;
537
538 correction = (100 * 4 * buffer_pages) / vm_total_pages;
539
540 if (correction < 100) {
541 dirty_background_ratio *= correction;
542 dirty_background_ratio /= 100;
543 vm_dirty_ratio *= correction;
544 vm_dirty_ratio /= 100;
545
546 if (dirty_background_ratio <= 0)
547 dirty_background_ratio = 1;
548 if (vm_dirty_ratio <= 0)
549 vm_dirty_ratio = 1;
550 }
551 mod_timer(&wb_timer, jiffies + dirty_writeback_interval); 546 mod_timer(&wb_timer, jiffies + dirty_writeback_interval);
552 writeback_set_ratelimit(); 547 writeback_set_ratelimit();
553 register_cpu_notifier(&ratelimit_nb); 548 register_cpu_notifier(&ratelimit_nb);
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index fc5b5442e942..2c606cc922a5 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -989,8 +989,7 @@ int zone_watermark_ok(struct zone *z, int order, unsigned long mark,
989 int classzone_idx, int alloc_flags) 989 int classzone_idx, int alloc_flags)
990{ 990{
991 /* free_pages my go negative - that's OK */ 991 /* free_pages my go negative - that's OK */
992 unsigned long min = mark; 992 long min = mark, free_pages = z->free_pages - (1 << order) + 1;
993 long free_pages = z->free_pages - (1 << order) + 1;
994 int o; 993 int o;
995 994
996 if (alloc_flags & ALLOC_HIGH) 995 if (alloc_flags & ALLOC_HIGH)
diff --git a/mm/truncate.c b/mm/truncate.c
index 6c79ca4a1ca7..5df947de7654 100644
--- a/mm/truncate.c
+++ b/mm/truncate.c
@@ -51,15 +51,22 @@ static inline void truncate_partial_page(struct page *page, unsigned partial)
51 do_invalidatepage(page, partial); 51 do_invalidatepage(page, partial);
52} 52}
53 53
54/*
55 * This cancels just the dirty bit on the kernel page itself, it
56 * does NOT actually remove dirty bits on any mmap's that may be
57 * around. It also leaves the page tagged dirty, so any sync
58 * activity will still find it on the dirty lists, and in particular,
59 * clear_page_dirty_for_io() will still look at the dirty bits in
60 * the VM.
61 *
62 * Doing this should *normally* only ever be done when a page
63 * is truncated, and is not actually mapped anywhere at all. However,
64 * fs/buffer.c does this when it notices that somebody has cleaned
65 * out all the buffers on a page without actually doing it through
66 * the VM. Can you say "ext3 is horribly ugly"? Tought you could.
67 */
54void cancel_dirty_page(struct page *page, unsigned int account_size) 68void cancel_dirty_page(struct page *page, unsigned int account_size)
55{ 69{
56 /* If we're cancelling the page, it had better not be mapped any more */
57 if (page_mapped(page)) {
58 static unsigned int warncount;
59
60 WARN_ON(++warncount < 5);
61 }
62
63 if (TestClearPageDirty(page)) { 70 if (TestClearPageDirty(page)) {
64 struct address_space *mapping = page->mapping; 71 struct address_space *mapping = page->mapping;
65 if (mapping && mapping_cap_account_dirty(mapping)) { 72 if (mapping && mapping_cap_account_dirty(mapping)) {
@@ -422,7 +429,6 @@ int invalidate_inode_pages2_range(struct address_space *mapping,
422 pagevec_release(&pvec); 429 pagevec_release(&pvec);
423 cond_resched(); 430 cond_resched();
424 } 431 }
425 WARN_ON_ONCE(ret);
426 return ret; 432 return ret;
427} 433}
428EXPORT_SYMBOL_GPL(invalidate_inode_pages2_range); 434EXPORT_SYMBOL_GPL(invalidate_inode_pages2_range);
diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c
index 29a8fa4d3728..f8c25d500155 100644
--- a/net/bluetooth/l2cap.c
+++ b/net/bluetooth/l2cap.c
@@ -585,6 +585,12 @@ static int l2cap_sock_bind(struct socket *sock, struct sockaddr *addr, int addr_
585 goto done; 585 goto done;
586 } 586 }
587 587
588 if (la->l2_psm > 0 && btohs(la->l2_psm) < 0x1001 &&
589 !capable(CAP_NET_BIND_SERVICE)) {
590 err = -EACCES;
591 goto done;
592 }
593
588 write_lock_bh(&l2cap_sk_list.lock); 594 write_lock_bh(&l2cap_sk_list.lock);
589 595
590 if (la->l2_psm && __l2cap_get_sock_by_addr(la->l2_psm, &la->l2_bdaddr)) { 596 if (la->l2_psm && __l2cap_get_sock_by_addr(la->l2_psm, &la->l2_bdaddr)) {
@@ -2150,8 +2156,8 @@ static ssize_t l2cap_sysfs_show(struct class *dev, char *buf)
2150 2156
2151 str += sprintf(str, "%s %s %d %d 0x%4.4x 0x%4.4x %d %d 0x%x\n", 2157 str += sprintf(str, "%s %s %d %d 0x%4.4x 0x%4.4x %d %d 0x%x\n",
2152 batostr(&bt_sk(sk)->src), batostr(&bt_sk(sk)->dst), 2158 batostr(&bt_sk(sk)->src), batostr(&bt_sk(sk)->dst),
2153 sk->sk_state, pi->psm, pi->scid, pi->dcid, pi->imtu, 2159 sk->sk_state, btohs(pi->psm), pi->scid, pi->dcid,
2154 pi->omtu, pi->link_mode); 2160 pi->imtu, pi->omtu, pi->link_mode);
2155 } 2161 }
2156 2162
2157 read_unlock_bh(&l2cap_sk_list.lock); 2163 read_unlock_bh(&l2cap_sk_list.lock);
diff --git a/net/core/flow.c b/net/core/flow.c
index d137f971f97d..5d25697920b1 100644
--- a/net/core/flow.c
+++ b/net/core/flow.c
@@ -231,22 +231,16 @@ nocache:
231 231
232 err = resolver(key, family, dir, &obj, &obj_ref); 232 err = resolver(key, family, dir, &obj, &obj_ref);
233 233
234 if (fle) { 234 if (fle && !err) {
235 if (err) { 235 fle->genid = atomic_read(&flow_cache_genid);
236 /* Force security policy check on next lookup */ 236
237 *head = fle->next; 237 if (fle->object)
238 flow_entry_kill(cpu, fle); 238 atomic_dec(fle->object_ref);
239 } else { 239
240 fle->genid = atomic_read(&flow_cache_genid); 240 fle->object = obj;
241 241 fle->object_ref = obj_ref;
242 if (fle->object) 242 if (obj)
243 atomic_dec(fle->object_ref); 243 atomic_inc(fle->object_ref);
244
245 fle->object = obj;
246 fle->object_ref = obj_ref;
247 if (obj)
248 atomic_inc(fle->object_ref);
249 }
250 } 244 }
251 local_bh_enable(); 245 local_bh_enable();
252 246
diff --git a/net/dccp/output.c b/net/dccp/output.c
index 824569659083..3435542e9652 100644
--- a/net/dccp/output.c
+++ b/net/dccp/output.c
@@ -124,7 +124,7 @@ static int dccp_transmit_skb(struct sock *sk, struct sk_buff *skb)
124 DCCP_INC_STATS(DCCP_MIB_OUTSEGS); 124 DCCP_INC_STATS(DCCP_MIB_OUTSEGS);
125 125
126 memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt)); 126 memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt));
127 err = icsk->icsk_af_ops->queue_xmit(skb, sk, 0); 127 err = icsk->icsk_af_ops->queue_xmit(skb, 0);
128 return net_xmit_eval(err); 128 return net_xmit_eval(err);
129 } 129 }
130 return -ENOBUFS; 130 return -ENOBUFS;
@@ -396,7 +396,7 @@ int dccp_send_reset(struct sock *sk, enum dccp_reset_codes code)
396 code); 396 code);
397 if (skb != NULL) { 397 if (skb != NULL) {
398 memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt)); 398 memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt));
399 err = inet_csk(sk)->icsk_af_ops->queue_xmit(skb, sk, 0); 399 err = inet_csk(sk)->icsk_af_ops->queue_xmit(skb, 0);
400 return net_xmit_eval(err); 400 return net_xmit_eval(err);
401 } 401 }
402 } 402 }
diff --git a/net/decnet/dn_dev.c b/net/decnet/dn_dev.c
index fc6f3c023a54..ed083ab455b7 100644
--- a/net/decnet/dn_dev.c
+++ b/net/decnet/dn_dev.c
@@ -1145,16 +1145,23 @@ struct dn_dev *dn_dev_create(struct net_device *dev, int *err)
1145 init_timer(&dn_db->timer); 1145 init_timer(&dn_db->timer);
1146 1146
1147 dn_db->uptime = jiffies; 1147 dn_db->uptime = jiffies;
1148
1149 dn_db->neigh_parms = neigh_parms_alloc(dev, &dn_neigh_table);
1150 if (!dn_db->neigh_parms) {
1151 dev->dn_ptr = NULL;
1152 kfree(dn_db);
1153 return NULL;
1154 }
1155
1148 if (dn_db->parms.up) { 1156 if (dn_db->parms.up) {
1149 if (dn_db->parms.up(dev) < 0) { 1157 if (dn_db->parms.up(dev) < 0) {
1158 neigh_parms_release(&dn_neigh_table, dn_db->neigh_parms);
1150 dev->dn_ptr = NULL; 1159 dev->dn_ptr = NULL;
1151 kfree(dn_db); 1160 kfree(dn_db);
1152 return NULL; 1161 return NULL;
1153 } 1162 }
1154 } 1163 }
1155 1164
1156 dn_db->neigh_parms = neigh_parms_alloc(dev, &dn_neigh_table);
1157
1158 dn_dev_sysctl_register(dev, &dn_db->parms); 1165 dn_dev_sysctl_register(dev, &dn_db->parms);
1159 1166
1160 dn_dev_set_timer(dev); 1167 dn_dev_set_timer(dev);
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
index cfb249cc0a58..1e589b91605e 100644
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
@@ -1989,6 +1989,10 @@ static struct node *fib_trie_get_next(struct fib_trie_iter *iter)
1989 unsigned cindex = iter->index; 1989 unsigned cindex = iter->index;
1990 struct tnode *p; 1990 struct tnode *p;
1991 1991
1992 /* A single entry routing table */
1993 if (!tn)
1994 return NULL;
1995
1992 pr_debug("get_next iter={node=%p index=%d depth=%d}\n", 1996 pr_debug("get_next iter={node=%p index=%d depth=%d}\n",
1993 iter->tnode, iter->index, iter->depth); 1997 iter->tnode, iter->index, iter->depth);
1994rescan: 1998rescan:
@@ -2037,11 +2041,18 @@ static struct node *fib_trie_get_first(struct fib_trie_iter *iter,
2037 if(!iter) 2041 if(!iter)
2038 return NULL; 2042 return NULL;
2039 2043
2040 if (n && IS_TNODE(n)) { 2044 if (n) {
2041 iter->tnode = (struct tnode *) n; 2045 if (IS_TNODE(n)) {
2042 iter->trie = t; 2046 iter->tnode = (struct tnode *) n;
2043 iter->index = 0; 2047 iter->trie = t;
2044 iter->depth = 1; 2048 iter->index = 0;
2049 iter->depth = 1;
2050 } else {
2051 iter->tnode = NULL;
2052 iter->trie = t;
2053 iter->index = 0;
2054 iter->depth = 0;
2055 }
2045 return n; 2056 return n;
2046 } 2057 }
2047 return NULL; 2058 return NULL;
@@ -2279,16 +2290,17 @@ static int fib_trie_seq_show(struct seq_file *seq, void *v)
2279 if (v == SEQ_START_TOKEN) 2290 if (v == SEQ_START_TOKEN)
2280 return 0; 2291 return 0;
2281 2292
2293 if (!NODE_PARENT(n)) {
2294 if (iter->trie == trie_local)
2295 seq_puts(seq, "<local>:\n");
2296 else
2297 seq_puts(seq, "<main>:\n");
2298 }
2299
2282 if (IS_TNODE(n)) { 2300 if (IS_TNODE(n)) {
2283 struct tnode *tn = (struct tnode *) n; 2301 struct tnode *tn = (struct tnode *) n;
2284 __be32 prf = htonl(MASK_PFX(tn->key, tn->pos)); 2302 __be32 prf = htonl(MASK_PFX(tn->key, tn->pos));
2285 2303
2286 if (!NODE_PARENT(n)) {
2287 if (iter->trie == trie_local)
2288 seq_puts(seq, "<local>:\n");
2289 else
2290 seq_puts(seq, "<main>:\n");
2291 }
2292 seq_indent(seq, iter->depth-1); 2304 seq_indent(seq, iter->depth-1);
2293 seq_printf(seq, " +-- %d.%d.%d.%d/%d %d %d %d\n", 2305 seq_printf(seq, " +-- %d.%d.%d.%d/%d %d %d %d\n",
2294 NIPQUAD(prf), tn->pos, tn->bits, tn->full_children, 2306 NIPQUAD(prf), tn->pos, tn->bits, tn->full_children,
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index f071f84808fa..a0f2008584bc 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -281,8 +281,9 @@ int ip_output(struct sk_buff *skb)
281 !(IPCB(skb)->flags & IPSKB_REROUTED)); 281 !(IPCB(skb)->flags & IPSKB_REROUTED));
282} 282}
283 283
284int ip_queue_xmit(struct sk_buff *skb, struct sock *sk, int ipfragok) 284int ip_queue_xmit(struct sk_buff *skb, int ipfragok)
285{ 285{
286 struct sock *sk = skb->sk;
286 struct inet_sock *inet = inet_sk(sk); 287 struct inet_sock *inet = inet_sk(sk);
287 struct ip_options *opt = inet->opt; 288 struct ip_options *opt = inet->opt;
288 struct rtable *rt; 289 struct rtable *rt;
diff --git a/net/ipv4/netfilter/Makefile b/net/ipv4/netfilter/Makefile
index 15e741aeb291..16d177b71bf8 100644
--- a/net/ipv4/netfilter/Makefile
+++ b/net/ipv4/netfilter/Makefile
@@ -4,6 +4,14 @@
4 4
5# objects for the standalone - connection tracking / NAT 5# objects for the standalone - connection tracking / NAT
6ip_conntrack-objs := ip_conntrack_standalone.o ip_conntrack_core.o ip_conntrack_proto_generic.o ip_conntrack_proto_tcp.o ip_conntrack_proto_udp.o ip_conntrack_proto_icmp.o 6ip_conntrack-objs := ip_conntrack_standalone.o ip_conntrack_core.o ip_conntrack_proto_generic.o ip_conntrack_proto_tcp.o ip_conntrack_proto_udp.o ip_conntrack_proto_icmp.o
7# objects for l3 independent conntrack
8nf_conntrack_ipv4-objs := nf_conntrack_l3proto_ipv4.o nf_conntrack_proto_icmp.o
9ifeq ($(CONFIG_NF_CONNTRACK_PROC_COMPAT),y)
10ifeq ($(CONFIG_PROC_FS),y)
11nf_conntrack_ipv4-objs += nf_conntrack_l3proto_ipv4_compat.o
12endif
13endif
14
7ip_nat-objs := ip_nat_core.o ip_nat_helper.o ip_nat_proto_unknown.o ip_nat_proto_tcp.o ip_nat_proto_udp.o ip_nat_proto_icmp.o 15ip_nat-objs := ip_nat_core.o ip_nat_helper.o ip_nat_proto_unknown.o ip_nat_proto_tcp.o ip_nat_proto_udp.o ip_nat_proto_icmp.o
8nf_nat-objs := nf_nat_core.o nf_nat_helper.o nf_nat_proto_unknown.o nf_nat_proto_tcp.o nf_nat_proto_udp.o nf_nat_proto_icmp.o 16nf_nat-objs := nf_nat_core.o nf_nat_helper.o nf_nat_proto_unknown.o nf_nat_proto_tcp.o nf_nat_proto_udp.o nf_nat_proto_icmp.o
9ifneq ($(CONFIG_NF_NAT),) 17ifneq ($(CONFIG_NF_NAT),)
@@ -20,6 +28,8 @@ ip_nat_h323-objs := ip_nat_helper_h323.o
20 28
21# connection tracking 29# connection tracking
22obj-$(CONFIG_IP_NF_CONNTRACK) += ip_conntrack.o 30obj-$(CONFIG_IP_NF_CONNTRACK) += ip_conntrack.o
31obj-$(CONFIG_NF_CONNTRACK_IPV4) += nf_conntrack_ipv4.o
32
23obj-$(CONFIG_IP_NF_NAT) += ip_nat.o 33obj-$(CONFIG_IP_NF_NAT) += ip_nat.o
24obj-$(CONFIG_NF_NAT) += nf_nat.o 34obj-$(CONFIG_NF_NAT) += nf_nat.o
25 35
@@ -106,13 +116,3 @@ obj-$(CONFIG_IP_NF_ARPFILTER) += arptable_filter.o
106 116
107obj-$(CONFIG_IP_NF_QUEUE) += ip_queue.o 117obj-$(CONFIG_IP_NF_QUEUE) += ip_queue.o
108 118
109# objects for l3 independent conntrack
110nf_conntrack_ipv4-objs := nf_conntrack_l3proto_ipv4.o nf_conntrack_proto_icmp.o
111ifeq ($(CONFIG_NF_CONNTRACK_PROC_COMPAT),y)
112ifeq ($(CONFIG_PROC_FS),y)
113nf_conntrack_ipv4-objs += nf_conntrack_l3proto_ipv4_compat.o
114endif
115endif
116
117# l3 independent conntrack
118obj-$(CONFIG_NF_CONNTRACK_IPV4) += nf_conntrack_ipv4.o
diff --git a/net/ipv4/netfilter/ip_conntrack_netlink.c b/net/ipv4/netfilter/ip_conntrack_netlink.c
index 5fcf91d617cd..7f70b0886b83 100644
--- a/net/ipv4/netfilter/ip_conntrack_netlink.c
+++ b/net/ipv4/netfilter/ip_conntrack_netlink.c
@@ -374,9 +374,11 @@ static int ctnetlink_conntrack_event(struct notifier_block *this,
374 && ctnetlink_dump_helpinfo(skb, ct) < 0) 374 && ctnetlink_dump_helpinfo(skb, ct) < 0)
375 goto nfattr_failure; 375 goto nfattr_failure;
376 376
377#ifdef CONFIG_IP_NF_CONNTRACK_MARK
377 if ((events & IPCT_MARK || ct->mark) 378 if ((events & IPCT_MARK || ct->mark)
378 && ctnetlink_dump_mark(skb, ct) < 0) 379 && ctnetlink_dump_mark(skb, ct) < 0)
379 goto nfattr_failure; 380 goto nfattr_failure;
381#endif
380 382
381 if (events & IPCT_COUNTER_FILLING && 383 if (events & IPCT_COUNTER_FILLING &&
382 (ctnetlink_dump_counters(skb, ct, IP_CT_DIR_ORIGINAL) < 0 || 384 (ctnetlink_dump_counters(skb, ct, IP_CT_DIR_ORIGINAL) < 0 ||
@@ -959,7 +961,7 @@ ctnetlink_create_conntrack(struct nfattr *cda[],
959 if (cda[CTA_PROTOINFO-1]) { 961 if (cda[CTA_PROTOINFO-1]) {
960 err = ctnetlink_change_protoinfo(ct, cda); 962 err = ctnetlink_change_protoinfo(ct, cda);
961 if (err < 0) 963 if (err < 0)
962 return err; 964 goto err;
963 } 965 }
964 966
965#if defined(CONFIG_IP_NF_CONNTRACK_MARK) 967#if defined(CONFIG_IP_NF_CONNTRACK_MARK)
diff --git a/net/ipv4/netfilter/ip_conntrack_sip.c b/net/ipv4/netfilter/ip_conntrack_sip.c
index 3a26d63eed88..11c588a10e6b 100644
--- a/net/ipv4/netfilter/ip_conntrack_sip.c
+++ b/net/ipv4/netfilter/ip_conntrack_sip.c
@@ -283,10 +283,16 @@ static int skp_epaddr_len(const char *dptr, const char *limit, int *shift)
283{ 283{
284 int s = *shift; 284 int s = *shift;
285 285
286 for (; dptr <= limit && *dptr != '@'; dptr++) 286 /* Search for @, but stop at the end of the line.
287 * We are inside a sip: URI, so we don't need to worry about
288 * continuation lines. */
289 while (dptr <= limit &&
290 *dptr != '@' && *dptr != '\r' && *dptr != '\n') {
287 (*shift)++; 291 (*shift)++;
292 dptr++;
293 }
288 294
289 if (*dptr == '@') { 295 if (dptr <= limit && *dptr == '@') {
290 dptr++; 296 dptr++;
291 (*shift)++; 297 (*shift)++;
292 } else 298 } else
diff --git a/net/ipv4/netfilter/nf_nat_pptp.c b/net/ipv4/netfilter/nf_nat_pptp.c
index 0ae45b79a4eb..5df4fcae3ab6 100644
--- a/net/ipv4/netfilter/nf_nat_pptp.c
+++ b/net/ipv4/netfilter/nf_nat_pptp.c
@@ -72,9 +72,9 @@ static void pptp_nat_expected(struct nf_conn *ct,
72 DEBUGP("we are PAC->PNS\n"); 72 DEBUGP("we are PAC->PNS\n");
73 /* build tuple for PNS->PAC */ 73 /* build tuple for PNS->PAC */
74 t.src.l3num = AF_INET; 74 t.src.l3num = AF_INET;
75 t.src.u3.ip = master->tuplehash[exp->dir].tuple.src.u3.ip; 75 t.src.u3.ip = master->tuplehash[!exp->dir].tuple.src.u3.ip;
76 t.src.u.gre.key = nat_pptp_info->pns_call_id; 76 t.src.u.gre.key = nat_pptp_info->pns_call_id;
77 t.dst.u3.ip = master->tuplehash[exp->dir].tuple.dst.u3.ip; 77 t.dst.u3.ip = master->tuplehash[!exp->dir].tuple.dst.u3.ip;
78 t.dst.u.gre.key = nat_pptp_info->pac_call_id; 78 t.dst.u.gre.key = nat_pptp_info->pac_call_id;
79 t.dst.protonum = IPPROTO_GRE; 79 t.dst.protonum = IPPROTO_GRE;
80 } 80 }
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index c701f6abbfc1..c26076fb890e 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -1011,10 +1011,11 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, u32 prior_snd_
1011 for (j = 0; j < i; j++){ 1011 for (j = 0; j < i; j++){
1012 if (after(ntohl(sp[j].start_seq), 1012 if (after(ntohl(sp[j].start_seq),
1013 ntohl(sp[j+1].start_seq))){ 1013 ntohl(sp[j+1].start_seq))){
1014 sp[j].start_seq = htonl(tp->recv_sack_cache[j+1].start_seq); 1014 struct tcp_sack_block_wire tmp;
1015 sp[j].end_seq = htonl(tp->recv_sack_cache[j+1].end_seq); 1015
1016 sp[j+1].start_seq = htonl(tp->recv_sack_cache[j].start_seq); 1016 tmp = sp[j];
1017 sp[j+1].end_seq = htonl(tp->recv_sack_cache[j].end_seq); 1017 sp[j] = sp[j+1];
1018 sp[j+1] = tmp;
1018 } 1019 }
1019 1020
1020 } 1021 }
@@ -4420,9 +4421,11 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
4420 * But, this leaves one open to an easy denial of 4421 * But, this leaves one open to an easy denial of
4421 * service attack, and SYN cookies can't defend 4422 * service attack, and SYN cookies can't defend
4422 * against this problem. So, we drop the data 4423 * against this problem. So, we drop the data
4423 * in the interest of security over speed. 4424 * in the interest of security over speed unless
4425 * it's still in use.
4424 */ 4426 */
4425 goto discard; 4427 kfree_skb(skb);
4428 return 0;
4426 } 4429 }
4427 goto discard; 4430 goto discard;
4428 4431
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 32c1a972fa31..975f4472af29 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -467,6 +467,7 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it,
467 467
468 th = (struct tcphdr *) skb_push(skb, tcp_header_size); 468 th = (struct tcphdr *) skb_push(skb, tcp_header_size);
469 skb->h.th = th; 469 skb->h.th = th;
470 skb_set_owner_w(skb, sk);
470 471
471 /* Build TCP header and checksum it. */ 472 /* Build TCP header and checksum it. */
472 th->source = inet->sport; 473 th->source = inet->sport;
@@ -540,7 +541,7 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it,
540 if (after(tcb->end_seq, tp->snd_nxt) || tcb->seq == tcb->end_seq) 541 if (after(tcb->end_seq, tp->snd_nxt) || tcb->seq == tcb->end_seq)
541 TCP_INC_STATS(TCP_MIB_OUTSEGS); 542 TCP_INC_STATS(TCP_MIB_OUTSEGS);
542 543
543 err = icsk->icsk_af_ops->queue_xmit(skb, sk, 0); 544 err = icsk->icsk_af_ops->queue_xmit(skb, 0);
544 if (likely(err <= 0)) 545 if (likely(err <= 0))
545 return err; 546 return err;
546 547
@@ -1650,7 +1651,8 @@ static void tcp_retrans_try_collapse(struct sock *sk, struct sk_buff *skb, int m
1650 1651
1651 memcpy(skb_put(skb, next_skb_size), next_skb->data, next_skb_size); 1652 memcpy(skb_put(skb, next_skb_size), next_skb->data, next_skb_size);
1652 1653
1653 skb->ip_summed = next_skb->ip_summed; 1654 if (next_skb->ip_summed == CHECKSUM_PARTIAL)
1655 skb->ip_summed = CHECKSUM_PARTIAL;
1654 1656
1655 if (skb->ip_summed != CHECKSUM_PARTIAL) 1657 if (skb->ip_summed != CHECKSUM_PARTIAL)
1656 skb->csum = csum_block_add(skb->csum, next_skb->csum, skb_size); 1658 skb->csum = csum_block_add(skb->csum, next_skb->csum, skb_size);
diff --git a/net/ipv4/tcp_probe.c b/net/ipv4/tcp_probe.c
index f230eeecf092..41c157848181 100644
--- a/net/ipv4/tcp_probe.c
+++ b/net/ipv4/tcp_probe.c
@@ -30,7 +30,7 @@
30 30
31#include <net/tcp.h> 31#include <net/tcp.h>
32 32
33MODULE_AUTHOR("Stephen Hemminger <shemminger@osdl.org>"); 33MODULE_AUTHOR("Stephen Hemminger <shemminger@linux-foundation.org>");
34MODULE_DESCRIPTION("TCP cwnd snooper"); 34MODULE_DESCRIPTION("TCP cwnd snooper");
35MODULE_LICENSE("GPL"); 35MODULE_LICENSE("GPL");
36 36
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 171e5b55d7d6..e3854696988d 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -341,6 +341,7 @@ void in6_dev_finish_destroy(struct inet6_dev *idev)
341static struct inet6_dev * ipv6_add_dev(struct net_device *dev) 341static struct inet6_dev * ipv6_add_dev(struct net_device *dev)
342{ 342{
343 struct inet6_dev *ndev; 343 struct inet6_dev *ndev;
344 struct in6_addr maddr;
344 345
345 ASSERT_RTNL(); 346 ASSERT_RTNL();
346 347
@@ -425,6 +426,11 @@ static struct inet6_dev * ipv6_add_dev(struct net_device *dev)
425#endif 426#endif
426 /* protected by rtnl_lock */ 427 /* protected by rtnl_lock */
427 rcu_assign_pointer(dev->ip6_ptr, ndev); 428 rcu_assign_pointer(dev->ip6_ptr, ndev);
429
430 /* Join all-node multicast group */
431 ipv6_addr_all_nodes(&maddr);
432 ipv6_dev_mc_inc(dev, &maddr);
433
428 return ndev; 434 return ndev;
429} 435}
430 436
@@ -3387,7 +3393,7 @@ static void inline ipv6_store_devconf(struct ipv6_devconf *cnf,
3387#ifdef CONFIG_IPV6_ROUTER_PREF 3393#ifdef CONFIG_IPV6_ROUTER_PREF
3388 array[DEVCONF_ACCEPT_RA_RTR_PREF] = cnf->accept_ra_rtr_pref; 3394 array[DEVCONF_ACCEPT_RA_RTR_PREF] = cnf->accept_ra_rtr_pref;
3389 array[DEVCONF_RTR_PROBE_INTERVAL] = cnf->rtr_probe_interval; 3395 array[DEVCONF_RTR_PROBE_INTERVAL] = cnf->rtr_probe_interval;
3390#ifdef CONFIV_IPV6_ROUTE_INFO 3396#ifdef CONFIG_IPV6_ROUTE_INFO
3391 array[DEVCONF_ACCEPT_RA_RT_INFO_MAX_PLEN] = cnf->accept_ra_rt_info_max_plen; 3397 array[DEVCONF_ACCEPT_RA_RT_INFO_MAX_PLEN] = cnf->accept_ra_rt_info_max_plen;
3392#endif 3398#endif
3393#endif 3399#endif
@@ -3892,7 +3898,7 @@ static struct addrconf_sysctl_table
3892 .proc_handler = &proc_dointvec_jiffies, 3898 .proc_handler = &proc_dointvec_jiffies,
3893 .strategy = &sysctl_jiffies, 3899 .strategy = &sysctl_jiffies,
3894 }, 3900 },
3895#ifdef CONFIV_IPV6_ROUTE_INFO 3901#ifdef CONFIG_IPV6_ROUTE_INFO
3896 { 3902 {
3897 .ctl_name = NET_IPV6_ACCEPT_RA_RT_INFO_MAX_PLEN, 3903 .ctl_name = NET_IPV6_ACCEPT_RA_RT_INFO_MAX_PLEN,
3898 .procname = "accept_ra_rt_info_max_plen", 3904 .procname = "accept_ra_rt_info_max_plen",
diff --git a/net/ipv6/inet6_connection_sock.c b/net/ipv6/inet6_connection_sock.c
index c700302ad51a..116f94a49071 100644
--- a/net/ipv6/inet6_connection_sock.c
+++ b/net/ipv6/inet6_connection_sock.c
@@ -139,8 +139,9 @@ void inet6_csk_addr2sockaddr(struct sock *sk, struct sockaddr * uaddr)
139 139
140EXPORT_SYMBOL_GPL(inet6_csk_addr2sockaddr); 140EXPORT_SYMBOL_GPL(inet6_csk_addr2sockaddr);
141 141
142int inet6_csk_xmit(struct sk_buff *skb, struct sock *sk, int ipfragok) 142int inet6_csk_xmit(struct sk_buff *skb, int ipfragok)
143{ 143{
144 struct sock *sk = skb->sk;
144 struct inet_sock *inet = inet_sk(sk); 145 struct inet_sock *inet = inet_sk(sk);
145 struct ipv6_pinfo *np = inet6_sk(sk); 146 struct ipv6_pinfo *np = inet6_sk(sk);
146 struct flowi fl; 147 struct flowi fl;
diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c
index a1c231a04ac2..882cde4b4047 100644
--- a/net/ipv6/mcast.c
+++ b/net/ipv6/mcast.c
@@ -2258,8 +2258,6 @@ void ipv6_mc_up(struct inet6_dev *idev)
2258 2258
2259void ipv6_mc_init_dev(struct inet6_dev *idev) 2259void ipv6_mc_init_dev(struct inet6_dev *idev)
2260{ 2260{
2261 struct in6_addr maddr;
2262
2263 write_lock_bh(&idev->lock); 2261 write_lock_bh(&idev->lock);
2264 rwlock_init(&idev->mc_lock); 2262 rwlock_init(&idev->mc_lock);
2265 idev->mc_gq_running = 0; 2263 idev->mc_gq_running = 0;
@@ -2275,10 +2273,6 @@ void ipv6_mc_init_dev(struct inet6_dev *idev)
2275 idev->mc_maxdelay = IGMP6_UNSOLICITED_IVAL; 2273 idev->mc_maxdelay = IGMP6_UNSOLICITED_IVAL;
2276 idev->mc_v1_seen = 0; 2274 idev->mc_v1_seen = 0;
2277 write_unlock_bh(&idev->lock); 2275 write_unlock_bh(&idev->lock);
2278
2279 /* Add all-nodes address. */
2280 ipv6_addr_all_nodes(&maddr);
2281 ipv6_dev_mc_inc(idev->dev, &maddr);
2282} 2276}
2283 2277
2284/* 2278/*
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index 6a9f616de37d..39bb658f3c44 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -1413,6 +1413,13 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh,
1413 return; 1413 return;
1414 } 1414 }
1415 1415
1416 if (!ipv6_addr_equal(&skb->nh.ipv6h->daddr, target) &&
1417 !(ipv6_addr_type(target) & IPV6_ADDR_LINKLOCAL)) {
1418 ND_PRINTK2(KERN_WARNING
1419 "ICMPv6 Redirect: target address is not link-local.\n");
1420 return;
1421 }
1422
1416 ndisc_flow_init(&fl, NDISC_REDIRECT, &saddr_buf, &skb->nh.ipv6h->saddr, 1423 ndisc_flow_init(&fl, NDISC_REDIRECT, &saddr_buf, &skb->nh.ipv6h->saddr,
1417 dev->ifindex); 1424 dev->ifindex);
1418 1425
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 8c3d56871b50..5f0043c30b70 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -2017,6 +2017,7 @@ static inline size_t rt6_nlmsg_size(void)
2017 + nla_total_size(4) /* RTA_IIF */ 2017 + nla_total_size(4) /* RTA_IIF */
2018 + nla_total_size(4) /* RTA_OIF */ 2018 + nla_total_size(4) /* RTA_OIF */
2019 + nla_total_size(4) /* RTA_PRIORITY */ 2019 + nla_total_size(4) /* RTA_PRIORITY */
2020 + RTAX_MAX * nla_total_size(4) /* RTA_METRICS */
2020 + nla_total_size(sizeof(struct rta_cacheinfo)); 2021 + nla_total_size(sizeof(struct rta_cacheinfo));
2021} 2022}
2022 2023
diff --git a/net/netfilter/Kconfig b/net/netfilter/Kconfig
index cd10e44db015..80107d4909c5 100644
--- a/net/netfilter/Kconfig
+++ b/net/netfilter/Kconfig
@@ -165,7 +165,7 @@ config NF_CONNTRACK_FTP
165 165
166config NF_CONNTRACK_H323 166config NF_CONNTRACK_H323
167 tristate "H.323 protocol support (EXPERIMENTAL)" 167 tristate "H.323 protocol support (EXPERIMENTAL)"
168 depends on EXPERIMENTAL && NF_CONNTRACK 168 depends on EXPERIMENTAL && NF_CONNTRACK && (IPV6 || IPV6=n)
169 help 169 help
170 H.323 is a VoIP signalling protocol from ITU-T. As one of the most 170 H.323 is a VoIP signalling protocol from ITU-T. As one of the most
171 important VoIP protocols, it is widely used by voice hardware and 171 important VoIP protocols, it is widely used by voice hardware and
@@ -628,7 +628,7 @@ config NETFILTER_XT_MATCH_TCPMSS
628 628
629config NETFILTER_XT_MATCH_HASHLIMIT 629config NETFILTER_XT_MATCH_HASHLIMIT
630 tristate '"hashlimit" match support' 630 tristate '"hashlimit" match support'
631 depends on NETFILTER_XTABLES 631 depends on NETFILTER_XTABLES && (IP6_NF_IPTABLES || IP6_NF_IPTABLES=n)
632 help 632 help
633 This option adds a `hashlimit' match. 633 This option adds a `hashlimit' match.
634 634
diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c
index bd1d2de75e45..c64f029f7052 100644
--- a/net/netfilter/nf_conntrack_netlink.c
+++ b/net/netfilter/nf_conntrack_netlink.c
@@ -389,9 +389,11 @@ static int ctnetlink_conntrack_event(struct notifier_block *this,
389 && ctnetlink_dump_helpinfo(skb, ct) < 0) 389 && ctnetlink_dump_helpinfo(skb, ct) < 0)
390 goto nfattr_failure; 390 goto nfattr_failure;
391 391
392#ifdef CONFIG_NF_CONNTRACK_MARK
392 if ((events & IPCT_MARK || ct->mark) 393 if ((events & IPCT_MARK || ct->mark)
393 && ctnetlink_dump_mark(skb, ct) < 0) 394 && ctnetlink_dump_mark(skb, ct) < 0)
394 goto nfattr_failure; 395 goto nfattr_failure;
396#endif
395 397
396 if (events & IPCT_COUNTER_FILLING && 398 if (events & IPCT_COUNTER_FILLING &&
397 (ctnetlink_dump_counters(skb, ct, IP_CT_DIR_ORIGINAL) < 0 || 399 (ctnetlink_dump_counters(skb, ct, IP_CT_DIR_ORIGINAL) < 0 ||
@@ -981,7 +983,7 @@ ctnetlink_create_conntrack(struct nfattr *cda[],
981 if (cda[CTA_PROTOINFO-1]) { 983 if (cda[CTA_PROTOINFO-1]) {
982 err = ctnetlink_change_protoinfo(ct, cda); 984 err = ctnetlink_change_protoinfo(ct, cda);
983 if (err < 0) 985 if (err < 0)
984 return err; 986 goto err;
985 } 987 }
986 988
987#if defined(CONFIG_NF_CONNTRACK_MARK) 989#if defined(CONFIG_NF_CONNTRACK_MARK)
diff --git a/net/netfilter/nf_conntrack_pptp.c b/net/netfilter/nf_conntrack_pptp.c
index f0ff00e0d052..c59df3bc2bbd 100644
--- a/net/netfilter/nf_conntrack_pptp.c
+++ b/net/netfilter/nf_conntrack_pptp.c
@@ -113,7 +113,7 @@ static void pptp_expectfn(struct nf_conn *ct,
113 113
114 rcu_read_lock(); 114 rcu_read_lock();
115 nf_nat_pptp_expectfn = rcu_dereference(nf_nat_pptp_hook_expectfn); 115 nf_nat_pptp_expectfn = rcu_dereference(nf_nat_pptp_hook_expectfn);
116 if (nf_nat_pptp_expectfn && ct->status & IPS_NAT_MASK) 116 if (nf_nat_pptp_expectfn && ct->master->status & IPS_NAT_MASK)
117 nf_nat_pptp_expectfn(ct, exp); 117 nf_nat_pptp_expectfn(ct, exp);
118 else { 118 else {
119 struct nf_conntrack_tuple inv_t; 119 struct nf_conntrack_tuple inv_t;
diff --git a/net/netfilter/nf_conntrack_sip.c b/net/netfilter/nf_conntrack_sip.c
index eb2a2411f97b..9dec11534678 100644
--- a/net/netfilter/nf_conntrack_sip.c
+++ b/net/netfilter/nf_conntrack_sip.c
@@ -303,10 +303,16 @@ static int skp_epaddr_len(struct nf_conn *ct, const char *dptr,
303{ 303{
304 int s = *shift; 304 int s = *shift;
305 305
306 for (; dptr <= limit && *dptr != '@'; dptr++) 306 /* Search for @, but stop at the end of the line.
307 * We are inside a sip: URI, so we don't need to worry about
308 * continuation lines. */
309 while (dptr <= limit &&
310 *dptr != '@' && *dptr != '\r' && *dptr != '\n') {
307 (*shift)++; 311 (*shift)++;
312 dptr++;
313 }
308 314
309 if (*dptr == '@') { 315 if (dptr <= limit && *dptr == '@') {
310 dptr++; 316 dptr++;
311 (*shift)++; 317 (*shift)++;
312 } else 318 } else
diff --git a/net/netfilter/xt_connbytes.c b/net/netfilter/xt_connbytes.c
index d93cb096a675..5e32dfa2668b 100644
--- a/net/netfilter/xt_connbytes.c
+++ b/net/netfilter/xt_connbytes.c
@@ -52,6 +52,8 @@ match(const struct sk_buff *skb,
52{ 52{
53 const struct xt_connbytes_info *sinfo = matchinfo; 53 const struct xt_connbytes_info *sinfo = matchinfo;
54 u_int64_t what = 0; /* initialize to make gcc happy */ 54 u_int64_t what = 0; /* initialize to make gcc happy */
55 u_int64_t bytes = 0;
56 u_int64_t pkts = 0;
55 const struct ip_conntrack_counter *counters; 57 const struct ip_conntrack_counter *counters;
56 58
57 if (!(counters = nf_ct_get_counters(skb))) 59 if (!(counters = nf_ct_get_counters(skb)))
@@ -89,29 +91,22 @@ match(const struct sk_buff *skb,
89 case XT_CONNBYTES_AVGPKT: 91 case XT_CONNBYTES_AVGPKT:
90 switch (sinfo->direction) { 92 switch (sinfo->direction) {
91 case XT_CONNBYTES_DIR_ORIGINAL: 93 case XT_CONNBYTES_DIR_ORIGINAL:
92 what = div64_64(counters[IP_CT_DIR_ORIGINAL].bytes, 94 bytes = counters[IP_CT_DIR_ORIGINAL].bytes;
93 counters[IP_CT_DIR_ORIGINAL].packets); 95 pkts = counters[IP_CT_DIR_ORIGINAL].packets;
94 break; 96 break;
95 case XT_CONNBYTES_DIR_REPLY: 97 case XT_CONNBYTES_DIR_REPLY:
96 what = div64_64(counters[IP_CT_DIR_REPLY].bytes, 98 bytes = counters[IP_CT_DIR_REPLY].bytes;
97 counters[IP_CT_DIR_REPLY].packets); 99 pkts = counters[IP_CT_DIR_REPLY].packets;
98 break; 100 break;
99 case XT_CONNBYTES_DIR_BOTH: 101 case XT_CONNBYTES_DIR_BOTH:
100 { 102 bytes = counters[IP_CT_DIR_ORIGINAL].bytes +
101 u_int64_t bytes; 103 counters[IP_CT_DIR_REPLY].bytes;
102 u_int64_t pkts; 104 pkts = counters[IP_CT_DIR_ORIGINAL].packets +
103 bytes = counters[IP_CT_DIR_ORIGINAL].bytes + 105 counters[IP_CT_DIR_REPLY].packets;
104 counters[IP_CT_DIR_REPLY].bytes;
105 pkts = counters[IP_CT_DIR_ORIGINAL].packets+
106 counters[IP_CT_DIR_REPLY].packets;
107
108 /* FIXME_THEORETICAL: what to do if sum
109 * overflows ? */
110
111 what = div64_64(bytes, pkts);
112 }
113 break; 106 break;
114 } 107 }
108 if (pkts != 0)
109 what = div64_64(bytes, pkts);
115 break; 110 break;
116 } 111 }
117 112
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index da73e8a8c18d..6dc01bdeb76b 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -359,6 +359,10 @@ static int packet_sendmsg_spkt(struct kiocb *iocb, struct socket *sock,
359 if (dev == NULL) 359 if (dev == NULL)
360 goto out_unlock; 360 goto out_unlock;
361 361
362 err = -ENETDOWN;
363 if (!(dev->flags & IFF_UP))
364 goto out_unlock;
365
362 /* 366 /*
363 * You may not queue a frame bigger than the mtu. This is the lowest level 367 * You may not queue a frame bigger than the mtu. This is the lowest level
364 * raw protocol and you must do your own fragmentation at this level. 368 * raw protocol and you must do your own fragmentation at this level.
@@ -407,10 +411,6 @@ static int packet_sendmsg_spkt(struct kiocb *iocb, struct socket *sock,
407 if (err) 411 if (err)
408 goto out_free; 412 goto out_free;
409 413
410 err = -ENETDOWN;
411 if (!(dev->flags & IFF_UP))
412 goto out_free;
413
414 /* 414 /*
415 * Now send it 415 * Now send it
416 */ 416 */
@@ -428,24 +428,18 @@ out_unlock:
428} 428}
429#endif 429#endif
430 430
431static inline int run_filter(struct sk_buff *skb, struct sock *sk, 431static inline unsigned int run_filter(struct sk_buff *skb, struct sock *sk,
432 unsigned *snaplen) 432 unsigned int res)
433{ 433{
434 struct sk_filter *filter; 434 struct sk_filter *filter;
435 int err = 0;
436 435
437 rcu_read_lock_bh(); 436 rcu_read_lock_bh();
438 filter = rcu_dereference(sk->sk_filter); 437 filter = rcu_dereference(sk->sk_filter);
439 if (filter != NULL) { 438 if (filter != NULL)
440 err = sk_run_filter(skb, filter->insns, filter->len); 439 res = sk_run_filter(skb, filter->insns, filter->len);
441 if (!err)
442 err = -EPERM;
443 else if (*snaplen > err)
444 *snaplen = err;
445 }
446 rcu_read_unlock_bh(); 440 rcu_read_unlock_bh();
447 441
448 return err; 442 return res;
449} 443}
450 444
451/* 445/*
@@ -467,7 +461,7 @@ static int packet_rcv(struct sk_buff *skb, struct net_device *dev, struct packet
467 struct packet_sock *po; 461 struct packet_sock *po;
468 u8 * skb_head = skb->data; 462 u8 * skb_head = skb->data;
469 int skb_len = skb->len; 463 int skb_len = skb->len;
470 unsigned snaplen; 464 unsigned int snaplen, res;
471 465
472 if (skb->pkt_type == PACKET_LOOPBACK) 466 if (skb->pkt_type == PACKET_LOOPBACK)
473 goto drop; 467 goto drop;
@@ -495,8 +489,11 @@ static int packet_rcv(struct sk_buff *skb, struct net_device *dev, struct packet
495 489
496 snaplen = skb->len; 490 snaplen = skb->len;
497 491
498 if (run_filter(skb, sk, &snaplen) < 0) 492 res = run_filter(skb, sk, snaplen);
493 if (!res)
499 goto drop_n_restore; 494 goto drop_n_restore;
495 if (snaplen > res)
496 snaplen = res;
500 497
501 if (atomic_read(&sk->sk_rmem_alloc) + skb->truesize >= 498 if (atomic_read(&sk->sk_rmem_alloc) + skb->truesize >=
502 (unsigned)sk->sk_rcvbuf) 499 (unsigned)sk->sk_rcvbuf)
@@ -568,7 +565,7 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev, struct packe
568 struct tpacket_hdr *h; 565 struct tpacket_hdr *h;
569 u8 * skb_head = skb->data; 566 u8 * skb_head = skb->data;
570 int skb_len = skb->len; 567 int skb_len = skb->len;
571 unsigned snaplen; 568 unsigned int snaplen, res;
572 unsigned long status = TP_STATUS_LOSING|TP_STATUS_USER; 569 unsigned long status = TP_STATUS_LOSING|TP_STATUS_USER;
573 unsigned short macoff, netoff; 570 unsigned short macoff, netoff;
574 struct sk_buff *copy_skb = NULL; 571 struct sk_buff *copy_skb = NULL;
@@ -592,8 +589,11 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev, struct packe
592 589
593 snaplen = skb->len; 590 snaplen = skb->len;
594 591
595 if (run_filter(skb, sk, &snaplen) < 0) 592 res = run_filter(skb, sk, snaplen);
593 if (!res)
596 goto drop_n_restore; 594 goto drop_n_restore;
595 if (snaplen > res)
596 snaplen = res;
597 597
598 if (sk->sk_type == SOCK_DGRAM) { 598 if (sk->sk_type == SOCK_DGRAM) {
599 macoff = netoff = TPACKET_ALIGN(TPACKET_HDRLEN) + 16; 599 macoff = netoff = TPACKET_ALIGN(TPACKET_HDRLEN) + 16;
@@ -738,6 +738,10 @@ static int packet_sendmsg(struct kiocb *iocb, struct socket *sock,
738 if (sock->type == SOCK_RAW) 738 if (sock->type == SOCK_RAW)
739 reserve = dev->hard_header_len; 739 reserve = dev->hard_header_len;
740 740
741 err = -ENETDOWN;
742 if (!(dev->flags & IFF_UP))
743 goto out_unlock;
744
741 err = -EMSGSIZE; 745 err = -EMSGSIZE;
742 if (len > dev->mtu+reserve) 746 if (len > dev->mtu+reserve)
743 goto out_unlock; 747 goto out_unlock;
@@ -770,10 +774,6 @@ static int packet_sendmsg(struct kiocb *iocb, struct socket *sock,
770 skb->dev = dev; 774 skb->dev = dev;
771 skb->priority = sk->sk_priority; 775 skb->priority = sk->sk_priority;
772 776
773 err = -ENETDOWN;
774 if (!(dev->flags & IFF_UP))
775 goto out_free;
776
777 /* 777 /*
778 * Now send it 778 * Now send it
779 */ 779 */
diff --git a/net/sched/act_ipt.c b/net/sched/act_ipt.c
index a9608064a4c3..01e69138578d 100644
--- a/net/sched/act_ipt.c
+++ b/net/sched/act_ipt.c
@@ -55,7 +55,8 @@ static int ipt_init_target(struct ipt_entry_target *t, char *table, unsigned int
55 struct ipt_target *target; 55 struct ipt_target *target;
56 int ret = 0; 56 int ret = 0;
57 57
58 target = xt_find_target(AF_INET, t->u.user.name, t->u.user.revision); 58 target = xt_request_find_target(AF_INET, t->u.user.name,
59 t->u.user.revision);
59 if (!target) 60 if (!target)
60 return -ENOENT; 61 return -ENOENT;
61 62
@@ -63,9 +64,10 @@ static int ipt_init_target(struct ipt_entry_target *t, char *table, unsigned int
63 64
64 ret = xt_check_target(target, AF_INET, t->u.target_size - sizeof(*t), 65 ret = xt_check_target(target, AF_INET, t->u.target_size - sizeof(*t),
65 table, hook, 0, 0); 66 table, hook, 0, 0);
66 if (ret) 67 if (ret) {
68 module_put(t->u.kernel.target->me);
67 return ret; 69 return ret;
68 70 }
69 if (t->u.kernel.target->checkentry 71 if (t->u.kernel.target->checkentry
70 && !t->u.kernel.target->checkentry(table, NULL, 72 && !t->u.kernel.target->checkentry(table, NULL,
71 t->u.kernel.target, t->data, 73 t->u.kernel.target, t->data,
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
index 225f39b5d595..0ef48126b117 100644
--- a/net/sctp/protocol.c
+++ b/net/sctp/protocol.c
@@ -804,7 +804,7 @@ static inline int sctp_v4_xmit(struct sk_buff *skb,
804 NIPQUAD(((struct rtable *)skb->dst)->rt_dst)); 804 NIPQUAD(((struct rtable *)skb->dst)->rt_dst));
805 805
806 SCTP_INC_STATS(SCTP_MIB_OUTSCTPPACKS); 806 SCTP_INC_STATS(SCTP_MIB_OUTSCTPPACKS);
807 return ip_queue_xmit(skb, skb->sk, ipfragok); 807 return ip_queue_xmit(skb, ipfragok);
808} 808}
809 809
810static struct sctp_af sctp_ipv4_specific; 810static struct sctp_af sctp_ipv4_specific;
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
index 167d888d1df2..0b1ddb1005ac 100644
--- a/net/sctp/sm_make_chunk.c
+++ b/net/sctp/sm_make_chunk.c
@@ -1562,7 +1562,7 @@ static int sctp_process_missing_param(const struct sctp_association *asoc,
1562 if (*errp) { 1562 if (*errp) {
1563 report.num_missing = htonl(1); 1563 report.num_missing = htonl(1);
1564 report.type = paramtype; 1564 report.type = paramtype;
1565 sctp_init_cause(*errp, SCTP_ERROR_INV_PARAM, 1565 sctp_init_cause(*errp, SCTP_ERROR_MISS_PARAM,
1566 &report, sizeof(report)); 1566 &report, sizeof(report));
1567 } 1567 }
1568 1568
@@ -1775,7 +1775,9 @@ int sctp_verify_init(const struct sctp_association *asoc,
1775 1775
1776 /* Verify stream values are non-zero. */ 1776 /* Verify stream values are non-zero. */
1777 if ((0 == peer_init->init_hdr.num_outbound_streams) || 1777 if ((0 == peer_init->init_hdr.num_outbound_streams) ||
1778 (0 == peer_init->init_hdr.num_inbound_streams)) { 1778 (0 == peer_init->init_hdr.num_inbound_streams) ||
1779 (0 == peer_init->init_hdr.init_tag) ||
1780 (SCTP_DEFAULT_MINWINDOW > ntohl(peer_init->init_hdr.a_rwnd))) {
1779 1781
1780 sctp_process_inv_mandatory(asoc, chunk, errp); 1782 sctp_process_inv_mandatory(asoc, chunk, errp);
1781 return 0; 1783 return 0;
diff --git a/net/sctp/sm_sideeffect.c b/net/sctp/sm_sideeffect.c
index 7bbc6156e455..6db77d1329f7 100644
--- a/net/sctp/sm_sideeffect.c
+++ b/net/sctp/sm_sideeffect.c
@@ -217,7 +217,7 @@ static int sctp_gen_sack(struct sctp_association *asoc, int force,
217 217
218 asoc->peer.sack_needed = 0; 218 asoc->peer.sack_needed = 0;
219 219
220 error = sctp_outq_tail(&asoc->outqueue, sack); 220 sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(sack));
221 221
222 /* Stop the SACK timer. */ 222 /* Stop the SACK timer. */
223 sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_STOP, 223 sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_STOP,
@@ -621,7 +621,13 @@ static void sctp_cmd_transport_on(sctp_cmd_seq_t *cmds,
621 /* The receiver of the HEARTBEAT ACK should also perform an 621 /* The receiver of the HEARTBEAT ACK should also perform an
622 * RTT measurement for that destination transport address 622 * RTT measurement for that destination transport address
623 * using the time value carried in the HEARTBEAT ACK chunk. 623 * using the time value carried in the HEARTBEAT ACK chunk.
624 * If the transport's rto_pending variable has been cleared,
625 * it was most likely due to a retransmit. However, we want
626 * to re-enable it to properly update the rto.
624 */ 627 */
628 if (t->rto_pending == 0)
629 t->rto_pending = 1;
630
625 hbinfo = (sctp_sender_hb_info_t *) chunk->skb->data; 631 hbinfo = (sctp_sender_hb_info_t *) chunk->skb->data;
626 sctp_transport_update_rto(t, (jiffies - hbinfo->sent_at)); 632 sctp_transport_update_rto(t, (jiffies - hbinfo->sent_at));
627 633
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
index aa51d190bfb2..fbbc9e6a3b78 100644
--- a/net/sctp/sm_statefuns.c
+++ b/net/sctp/sm_statefuns.c
@@ -440,7 +440,6 @@ sctp_disposition_t sctp_sf_do_5_1C_ack(const struct sctp_endpoint *ep,
440{ 440{
441 struct sctp_chunk *chunk = arg; 441 struct sctp_chunk *chunk = arg;
442 sctp_init_chunk_t *initchunk; 442 sctp_init_chunk_t *initchunk;
443 __u32 init_tag;
444 struct sctp_chunk *err_chunk; 443 struct sctp_chunk *err_chunk;
445 struct sctp_packet *packet; 444 struct sctp_packet *packet;
446 sctp_error_t error; 445 sctp_error_t error;
@@ -462,24 +461,6 @@ sctp_disposition_t sctp_sf_do_5_1C_ack(const struct sctp_endpoint *ep,
462 /* Grab the INIT header. */ 461 /* Grab the INIT header. */
463 chunk->subh.init_hdr = (sctp_inithdr_t *) chunk->skb->data; 462 chunk->subh.init_hdr = (sctp_inithdr_t *) chunk->skb->data;
464 463
465 init_tag = ntohl(chunk->subh.init_hdr->init_tag);
466
467 /* Verification Tag: 3.3.3
468 * If the value of the Initiate Tag in a received INIT ACK
469 * chunk is found to be 0, the receiver MUST treat it as an
470 * error and close the association by transmitting an ABORT.
471 */
472 if (!init_tag) {
473 struct sctp_chunk *reply = sctp_make_abort(asoc, chunk, 0);
474 if (!reply)
475 goto nomem;
476
477 sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(reply));
478 return sctp_stop_t1_and_abort(commands, SCTP_ERROR_INV_PARAM,
479 ECONNREFUSED, asoc,
480 chunk->transport);
481 }
482
483 /* Verify the INIT chunk before processing it. */ 464 /* Verify the INIT chunk before processing it. */
484 err_chunk = NULL; 465 err_chunk = NULL;
485 if (!sctp_verify_init(asoc, chunk->chunk_hdr->type, 466 if (!sctp_verify_init(asoc, chunk->chunk_hdr->type,
@@ -550,9 +531,6 @@ sctp_disposition_t sctp_sf_do_5_1C_ack(const struct sctp_endpoint *ep,
550 SCTP_CHUNK(err_chunk)); 531 SCTP_CHUNK(err_chunk));
551 532
552 return SCTP_DISPOSITION_CONSUME; 533 return SCTP_DISPOSITION_CONSUME;
553
554nomem:
555 return SCTP_DISPOSITION_NOMEM;
556} 534}
557 535
558/* 536/*
@@ -1553,6 +1531,28 @@ sctp_disposition_t sctp_sf_do_5_2_2_dupinit(const struct sctp_endpoint *ep,
1553} 1531}
1554 1532
1555 1533
1534/*
1535 * Unexpected INIT-ACK handler.
1536 *
1537 * Section 5.2.3
1538 * If an INIT ACK received by an endpoint in any state other than the
1539 * COOKIE-WAIT state, the endpoint should discard the INIT ACK chunk.
1540 * An unexpected INIT ACK usually indicates the processing of an old or
1541 * duplicated INIT chunk.
1542*/
1543sctp_disposition_t sctp_sf_do_5_2_3_initack(const struct sctp_endpoint *ep,
1544 const struct sctp_association *asoc,
1545 const sctp_subtype_t type,
1546 void *arg, sctp_cmd_seq_t *commands)
1547{
1548 /* Per the above section, we'll discard the chunk if we have an
1549 * endpoint. If this is an OOTB INIT-ACK, treat it as such.
1550 */
1551 if (ep == sctp_sk((sctp_get_ctl_sock()))->ep)
1552 return sctp_sf_ootb(ep, asoc, type, arg, commands);
1553 else
1554 return sctp_sf_discard_chunk(ep, asoc, type, arg, commands);
1555}
1556 1556
1557/* Unexpected COOKIE-ECHO handler for peer restart (Table 2, action 'A') 1557/* Unexpected COOKIE-ECHO handler for peer restart (Table 2, action 'A')
1558 * 1558 *
diff --git a/net/sctp/sm_statetable.c b/net/sctp/sm_statetable.c
index 733dd87b3a7d..5f6cc7aa661b 100644
--- a/net/sctp/sm_statetable.c
+++ b/net/sctp/sm_statetable.c
@@ -152,7 +152,7 @@ const sctp_sm_table_entry_t *sctp_sm_lookup_event(sctp_event_t event_type,
152 /* SCTP_STATE_EMPTY */ \ 152 /* SCTP_STATE_EMPTY */ \
153 TYPE_SCTP_FUNC(sctp_sf_ootb), \ 153 TYPE_SCTP_FUNC(sctp_sf_ootb), \
154 /* SCTP_STATE_CLOSED */ \ 154 /* SCTP_STATE_CLOSED */ \
155 TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \ 155 TYPE_SCTP_FUNC(sctp_sf_do_5_2_3_initack), \
156 /* SCTP_STATE_COOKIE_WAIT */ \ 156 /* SCTP_STATE_COOKIE_WAIT */ \
157 TYPE_SCTP_FUNC(sctp_sf_do_5_1C_ack), \ 157 TYPE_SCTP_FUNC(sctp_sf_do_5_1C_ack), \
158 /* SCTP_STATE_COOKIE_ECHOED */ \ 158 /* SCTP_STATE_COOKIE_ECHOED */ \
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index aba528b9ae76..16c9fbc1db69 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -490,16 +490,14 @@ int rpc_call_sync(struct rpc_clnt *clnt, struct rpc_message *msg, int flags)
490 490
491 /* Set up the call info struct and execute the task */ 491 /* Set up the call info struct and execute the task */
492 status = task->tk_status; 492 status = task->tk_status;
493 if (status != 0) { 493 if (status != 0)
494 rpc_release_task(task);
495 goto out; 494 goto out;
496 }
497 atomic_inc(&task->tk_count); 495 atomic_inc(&task->tk_count);
498 status = rpc_execute(task); 496 status = rpc_execute(task);
499 if (status == 0) 497 if (status == 0)
500 status = task->tk_status; 498 status = task->tk_status;
501 rpc_put_task(task);
502out: 499out:
500 rpc_put_task(task);
503 rpc_restore_sigmask(&oldset); 501 rpc_restore_sigmask(&oldset);
504 return status; 502 return status;
505} 503}
@@ -537,7 +535,7 @@ rpc_call_async(struct rpc_clnt *clnt, struct rpc_message *msg, int flags,
537 if (status == 0) 535 if (status == 0)
538 rpc_execute(task); 536 rpc_execute(task);
539 else 537 else
540 rpc_release_task(task); 538 rpc_put_task(task);
541 539
542 rpc_restore_sigmask(&oldset); 540 rpc_restore_sigmask(&oldset);
543 return status; 541 return status;
diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c
index 79bc4cdf5d48..fc083f0b3544 100644
--- a/net/sunrpc/sched.c
+++ b/net/sunrpc/sched.c
@@ -42,6 +42,7 @@ static mempool_t *rpc_buffer_mempool __read_mostly;
42static void __rpc_default_timer(struct rpc_task *task); 42static void __rpc_default_timer(struct rpc_task *task);
43static void rpciod_killall(void); 43static void rpciod_killall(void);
44static void rpc_async_schedule(struct work_struct *); 44static void rpc_async_schedule(struct work_struct *);
45static void rpc_release_task(struct rpc_task *task);
45 46
46/* 47/*
47 * RPC tasks sit here while waiting for conditions to improve. 48 * RPC tasks sit here while waiting for conditions to improve.
@@ -896,7 +897,7 @@ void rpc_put_task(struct rpc_task *task)
896} 897}
897EXPORT_SYMBOL(rpc_put_task); 898EXPORT_SYMBOL(rpc_put_task);
898 899
899void rpc_release_task(struct rpc_task *task) 900static void rpc_release_task(struct rpc_task *task)
900{ 901{
901#ifdef RPC_DEBUG 902#ifdef RPC_DEBUG
902 BUG_ON(task->tk_magic != RPC_TASK_MAGIC_ID); 903 BUG_ON(task->tk_magic != RPC_TASK_MAGIC_ID);
diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c
index f3001f3626f6..4c1611211119 100644
--- a/net/sunrpc/svc.c
+++ b/net/sunrpc/svc.c
@@ -26,7 +26,6 @@
26#include <linux/sunrpc/clnt.h> 26#include <linux/sunrpc/clnt.h>
27 27
28#define RPCDBG_FACILITY RPCDBG_SVCDSP 28#define RPCDBG_FACILITY RPCDBG_SVCDSP
29#define RPC_PARANOIA 1
30 29
31/* 30/*
32 * Mode for mapping cpus to pools. 31 * Mode for mapping cpus to pools.
@@ -872,15 +871,15 @@ svc_process(struct svc_rqst *rqstp)
872 return 0; 871 return 0;
873 872
874err_short_len: 873err_short_len:
875#ifdef RPC_PARANOIA 874 if (net_ratelimit())
876 printk("svc: short len %Zd, dropping request\n", argv->iov_len); 875 printk("svc: short len %Zd, dropping request\n", argv->iov_len);
877#endif 876
878 goto dropit; /* drop request */ 877 goto dropit; /* drop request */
879 878
880err_bad_dir: 879err_bad_dir:
881#ifdef RPC_PARANOIA 880 if (net_ratelimit())
882 printk("svc: bad direction %d, dropping request\n", dir); 881 printk("svc: bad direction %d, dropping request\n", dir);
883#endif 882
884 serv->sv_stats->rpcbadfmt++; 883 serv->sv_stats->rpcbadfmt++;
885 goto dropit; /* drop request */ 884 goto dropit; /* drop request */
886 885
@@ -909,9 +908,10 @@ err_bad_prog:
909 goto sendit; 908 goto sendit;
910 909
911err_bad_vers: 910err_bad_vers:
912#ifdef RPC_PARANOIA 911 if (net_ratelimit())
913 printk("svc: unknown version (%d)\n", vers); 912 printk("svc: unknown version (%d for prog %d, %s)\n",
914#endif 913 vers, prog, progp->pg_name);
914
915 serv->sv_stats->rpcbadfmt++; 915 serv->sv_stats->rpcbadfmt++;
916 svc_putnl(resv, RPC_PROG_MISMATCH); 916 svc_putnl(resv, RPC_PROG_MISMATCH);
917 svc_putnl(resv, progp->pg_lovers); 917 svc_putnl(resv, progp->pg_lovers);
@@ -919,17 +919,17 @@ err_bad_vers:
919 goto sendit; 919 goto sendit;
920 920
921err_bad_proc: 921err_bad_proc:
922#ifdef RPC_PARANOIA 922 if (net_ratelimit())
923 printk("svc: unknown procedure (%d)\n", proc); 923 printk("svc: unknown procedure (%d)\n", proc);
924#endif 924
925 serv->sv_stats->rpcbadfmt++; 925 serv->sv_stats->rpcbadfmt++;
926 svc_putnl(resv, RPC_PROC_UNAVAIL); 926 svc_putnl(resv, RPC_PROC_UNAVAIL);
927 goto sendit; 927 goto sendit;
928 928
929err_garbage: 929err_garbage:
930#ifdef RPC_PARANOIA 930 if (net_ratelimit())
931 printk("svc: failed to decode args\n"); 931 printk("svc: failed to decode args\n");
932#endif 932
933 rpc_stat = rpc_garbage_args; 933 rpc_stat = rpc_garbage_args;
934err_bad: 934err_bad:
935 serv->sv_stats->rpcbadfmt++; 935 serv->sv_stats->rpcbadfmt++;
diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c
index 99f54fb6d669..ff1f8bf680aa 100644
--- a/net/sunrpc/svcsock.c
+++ b/net/sunrpc/svcsock.c
@@ -1062,15 +1062,19 @@ svc_tcp_recvfrom(struct svc_rqst *rqstp)
1062 * bit set in the fragment length header. 1062 * bit set in the fragment length header.
1063 * But apparently no known nfs clients send fragmented 1063 * But apparently no known nfs clients send fragmented
1064 * records. */ 1064 * records. */
1065 printk(KERN_NOTICE "RPC: bad TCP reclen 0x%08lx (non-terminal)\n", 1065 if (net_ratelimit())
1066 (unsigned long) svsk->sk_reclen); 1066 printk(KERN_NOTICE "RPC: bad TCP reclen 0x%08lx"
1067 " (non-terminal)\n",
1068 (unsigned long) svsk->sk_reclen);
1067 goto err_delete; 1069 goto err_delete;
1068 } 1070 }
1069 svsk->sk_reclen &= 0x7fffffff; 1071 svsk->sk_reclen &= 0x7fffffff;
1070 dprintk("svc: TCP record, %d bytes\n", svsk->sk_reclen); 1072 dprintk("svc: TCP record, %d bytes\n", svsk->sk_reclen);
1071 if (svsk->sk_reclen > serv->sv_max_mesg) { 1073 if (svsk->sk_reclen > serv->sv_max_mesg) {
1072 printk(KERN_NOTICE "RPC: bad TCP reclen 0x%08lx (large)\n", 1074 if (net_ratelimit())
1073 (unsigned long) svsk->sk_reclen); 1075 printk(KERN_NOTICE "RPC: bad TCP reclen 0x%08lx"
1076 " (large)\n",
1077 (unsigned long) svsk->sk_reclen);
1074 goto err_delete; 1078 goto err_delete;
1075 } 1079 }
1076 } 1080 }
@@ -1278,6 +1282,8 @@ svc_recv(struct svc_rqst *rqstp, long timeout)
1278 schedule_timeout_uninterruptible(msecs_to_jiffies(500)); 1282 schedule_timeout_uninterruptible(msecs_to_jiffies(500));
1279 rqstp->rq_pages[i] = p; 1283 rqstp->rq_pages[i] = p;
1280 } 1284 }
1285 rqstp->rq_pages[i++] = NULL; /* this might be seen in nfs_read_actor */
1286 BUG_ON(pages >= RPCSVC_MAXPAGES);
1281 1287
1282 /* Make arg->head point to first page and arg->pages point to rest */ 1288 /* Make arg->head point to first page and arg->pages point to rest */
1283 arg = &rqstp->rq_arg; 1289 arg = &rqstp->rq_arg;
diff --git a/net/x25/x25_dev.c b/net/x25/x25_dev.c
index 47b68a301677..328d80f000ad 100644
--- a/net/x25/x25_dev.c
+++ b/net/x25/x25_dev.c
@@ -56,6 +56,7 @@ static int x25_receive_data(struct sk_buff *skb, struct x25_neigh *nb)
56 sk_add_backlog(sk, skb); 56 sk_add_backlog(sk, skb);
57 } 57 }
58 bh_unlock_sock(sk); 58 bh_unlock_sock(sk);
59 sock_put(sk);
59 return queued; 60 return queued;
60 } 61 }
61 62
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index bebd40e5a62e..b7e537fe2d75 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -650,19 +650,18 @@ int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl)
650 struct xfrm_policy *pol; 650 struct xfrm_policy *pol;
651 struct xfrm_policy *delpol; 651 struct xfrm_policy *delpol;
652 struct hlist_head *chain; 652 struct hlist_head *chain;
653 struct hlist_node *entry, *newpos, *last; 653 struct hlist_node *entry, *newpos;
654 struct dst_entry *gc_list; 654 struct dst_entry *gc_list;
655 655
656 write_lock_bh(&xfrm_policy_lock); 656 write_lock_bh(&xfrm_policy_lock);
657 chain = policy_hash_bysel(&policy->selector, policy->family, dir); 657 chain = policy_hash_bysel(&policy->selector, policy->family, dir);
658 delpol = NULL; 658 delpol = NULL;
659 newpos = NULL; 659 newpos = NULL;
660 last = NULL;
661 hlist_for_each_entry(pol, entry, chain, bydst) { 660 hlist_for_each_entry(pol, entry, chain, bydst) {
662 if (!delpol && 661 if (pol->type == policy->type &&
663 pol->type == policy->type &&
664 !selector_cmp(&pol->selector, &policy->selector) && 662 !selector_cmp(&pol->selector, &policy->selector) &&
665 xfrm_sec_ctx_match(pol->security, policy->security)) { 663 xfrm_sec_ctx_match(pol->security, policy->security) &&
664 !WARN_ON(delpol)) {
666 if (excl) { 665 if (excl) {
667 write_unlock_bh(&xfrm_policy_lock); 666 write_unlock_bh(&xfrm_policy_lock);
668 return -EEXIST; 667 return -EEXIST;
@@ -671,17 +670,12 @@ int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl)
671 if (policy->priority > pol->priority) 670 if (policy->priority > pol->priority)
672 continue; 671 continue;
673 } else if (policy->priority >= pol->priority) { 672 } else if (policy->priority >= pol->priority) {
674 last = &pol->bydst; 673 newpos = &pol->bydst;
675 continue; 674 continue;
676 } 675 }
677 if (!newpos)
678 newpos = &pol->bydst;
679 if (delpol) 676 if (delpol)
680 break; 677 break;
681 last = &pol->bydst;
682 } 678 }
683 if (!newpos)
684 newpos = last;
685 if (newpos) 679 if (newpos)
686 hlist_add_after(newpos, &policy->bydst); 680 hlist_add_after(newpos, &policy->bydst);
687 else 681 else
diff --git a/scripts/Makefile.headersinst b/scripts/Makefile.headersinst
index 4241e0dfeeaf..f7b6705fd6a3 100644
--- a/scripts/Makefile.headersinst
+++ b/scripts/Makefile.headersinst
@@ -109,7 +109,7 @@ quiet_cmd_mkdir = MKDIR $(patsubst $(INSTALL_HDR_PATH)/%,%,$@)
109quiet_cmd_gen = GEN $(patsubst $(INSTALL_HDR_PATH)/%,%,$@) 109quiet_cmd_gen = GEN $(patsubst $(INSTALL_HDR_PATH)/%,%,$@)
110 cmd_gen = \ 110 cmd_gen = \
111FNAME=$(patsubst $(INSTALL_HDR_PATH)/$(_dst)/%,%,$@) \ 111FNAME=$(patsubst $(INSTALL_HDR_PATH)/$(_dst)/%,%,$@) \
112STUBDEF=__ASM_STUB_`echo $$FNAME | tr a-z. A-Z_`; \ 112STUBDEF=__ASM_STUB_`echo $$FNAME | tr a-z.- A-Z__`; \
113(echo "/* File autogenerated by 'make headers_install' */" ; \ 113(echo "/* File autogenerated by 'make headers_install' */" ; \
114echo "\#ifndef $$STUBDEF" ; \ 114echo "\#ifndef $$STUBDEF" ; \
115echo "\#define $$STUBDEF" ; \ 115echo "\#define $$STUBDEF" ; \
diff --git a/security/selinux/include/xfrm.h b/security/selinux/include/xfrm.h
index 161eb571c82d..31929e39f5ca 100644
--- a/security/selinux/include/xfrm.h
+++ b/security/selinux/include/xfrm.h
@@ -37,6 +37,11 @@ int selinux_xfrm_sock_rcv_skb(u32 sid, struct sk_buff *skb,
37int selinux_xfrm_postroute_last(u32 isec_sid, struct sk_buff *skb, 37int selinux_xfrm_postroute_last(u32 isec_sid, struct sk_buff *skb,
38 struct avc_audit_data *ad, u8 proto); 38 struct avc_audit_data *ad, u8 proto);
39int selinux_xfrm_decode_session(struct sk_buff *skb, u32 *sid, int ckall); 39int selinux_xfrm_decode_session(struct sk_buff *skb, u32 *sid, int ckall);
40
41static inline void selinux_xfrm_notify_policyload(void)
42{
43 atomic_inc(&flow_cache_genid);
44}
40#else 45#else
41static inline int selinux_xfrm_sock_rcv_skb(u32 isec_sid, struct sk_buff *skb, 46static inline int selinux_xfrm_sock_rcv_skb(u32 isec_sid, struct sk_buff *skb,
42 struct avc_audit_data *ad) 47 struct avc_audit_data *ad)
@@ -55,6 +60,10 @@ static inline int selinux_xfrm_decode_session(struct sk_buff *skb, u32 *sid, int
55 *sid = SECSID_NULL; 60 *sid = SECSID_NULL;
56 return 0; 61 return 0;
57} 62}
63
64static inline void selinux_xfrm_notify_policyload(void)
65{
66}
58#endif 67#endif
59 68
60static inline void selinux_skb_xfrm_sid(struct sk_buff *skb, u32 *sid) 69static inline void selinux_skb_xfrm_sid(struct sk_buff *skb, u32 *sid)
diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c
index 3eb1fa9f0de1..ca9154dc5d82 100644
--- a/security/selinux/ss/services.c
+++ b/security/selinux/ss/services.c
@@ -1299,6 +1299,7 @@ int security_load_policy(void *data, size_t len)
1299 avc_ss_reset(seqno); 1299 avc_ss_reset(seqno);
1300 selnl_notify_policyload(seqno); 1300 selnl_notify_policyload(seqno);
1301 selinux_netlbl_cache_invalidate(); 1301 selinux_netlbl_cache_invalidate();
1302 selinux_xfrm_notify_policyload();
1302 return 0; 1303 return 0;
1303 } 1304 }
1304 1305
@@ -1354,6 +1355,7 @@ int security_load_policy(void *data, size_t len)
1354 avc_ss_reset(seqno); 1355 avc_ss_reset(seqno);
1355 selnl_notify_policyload(seqno); 1356 selnl_notify_policyload(seqno);
1356 selinux_netlbl_cache_invalidate(); 1357 selinux_netlbl_cache_invalidate();
1358 selinux_xfrm_notify_policyload();
1357 1359
1358 return 0; 1360 return 0;
1359 1361
@@ -1853,6 +1855,7 @@ out:
1853 if (!rc) { 1855 if (!rc) {
1854 avc_ss_reset(seqno); 1856 avc_ss_reset(seqno);
1855 selnl_notify_policyload(seqno); 1857 selnl_notify_policyload(seqno);
1858 selinux_xfrm_notify_policyload();
1856 } 1859 }
1857 return rc; 1860 return rc;
1858} 1861}
diff --git a/sound/core/init.c b/sound/core/init.c
index 6152a7554dfd..a4cc6b155ae9 100644
--- a/sound/core/init.c
+++ b/sound/core/init.c
@@ -361,8 +361,10 @@ static int snd_card_do_free(struct snd_card *card)
361 snd_printk(KERN_WARNING "unable to free card info\n"); 361 snd_printk(KERN_WARNING "unable to free card info\n");
362 /* Not fatal error */ 362 /* Not fatal error */
363 } 363 }
364 if (card->dev) 364#ifndef CONFIG_SYSFS_DEPRECATED
365 device_unregister(card->dev); 365 if (card->card_dev)
366 device_unregister(card->card_dev);
367#endif
366 kfree(card); 368 kfree(card);
367 return 0; 369 return 0;
368} 370}
@@ -497,12 +499,14 @@ int snd_card_register(struct snd_card *card)
497 int err; 499 int err;
498 500
499 snd_assert(card != NULL, return -EINVAL); 501 snd_assert(card != NULL, return -EINVAL);
500 if (!card->dev) { 502#ifndef CONFIG_SYSFS_DEPRECATED
501 card->dev = device_create(sound_class, card->parent, 0, 503 if (!card->card_dev) {
502 "card%i", card->number); 504 card->card_dev = device_create(sound_class, card->dev, 0,
503 if (IS_ERR(card->dev)) 505 "card%i", card->number);
504 card->dev = NULL; 506 if (IS_ERR(card->card_dev))
507 card->card_dev = NULL;
505 } 508 }
509#endif
506 if ((err = snd_device_register_all(card)) < 0) 510 if ((err = snd_device_register_all(card)) < 0)
507 return err; 511 return err;
508 mutex_lock(&snd_card_mutex); 512 mutex_lock(&snd_card_mutex);
diff --git a/sound/core/sound.c b/sound/core/sound.c
index 282742022de6..82a61c67cf3a 100644
--- a/sound/core/sound.c
+++ b/sound/core/sound.c
@@ -238,7 +238,7 @@ int snd_register_device(int type, struct snd_card *card, int dev,
238{ 238{
239 int minor; 239 int minor;
240 struct snd_minor *preg; 240 struct snd_minor *preg;
241 struct device *device = NULL; 241 struct device *device = snd_card_get_device_link(card);
242 242
243 snd_assert(name, return -EINVAL); 243 snd_assert(name, return -EINVAL);
244 preg = kmalloc(sizeof *preg, GFP_KERNEL); 244 preg = kmalloc(sizeof *preg, GFP_KERNEL);
@@ -263,8 +263,6 @@ int snd_register_device(int type, struct snd_card *card, int dev,
263 return minor; 263 return minor;
264 } 264 }
265 snd_minors[minor] = preg; 265 snd_minors[minor] = preg;
266 if (card)
267 device = card->dev;
268 preg->dev = device_create(sound_class, device, MKDEV(major, minor), 266 preg->dev = device_create(sound_class, device, MKDEV(major, minor),
269 "%s", name); 267 "%s", name);
270 if (preg->dev) 268 if (preg->dev)
diff --git a/sound/core/sound_oss.c b/sound/core/sound_oss.c
index b2fc40aa520b..4566df41912a 100644
--- a/sound/core/sound_oss.c
+++ b/sound/core/sound_oss.c
@@ -106,7 +106,7 @@ int snd_register_oss_device(int type, struct snd_card *card, int dev,
106 int cidx = SNDRV_MINOR_OSS_CARD(minor); 106 int cidx = SNDRV_MINOR_OSS_CARD(minor);
107 int track2 = -1; 107 int track2 = -1;
108 int register1 = -1, register2 = -1; 108 int register1 = -1, register2 = -1;
109 struct device *carddev = NULL; 109 struct device *carddev = snd_card_get_device_link(card);
110 110
111 if (card && card->number >= 8) 111 if (card && card->number >= 8)
112 return 0; /* ignore silently */ 112 return 0; /* ignore silently */
@@ -134,8 +134,6 @@ int snd_register_oss_device(int type, struct snd_card *card, int dev,
134 track2 = SNDRV_MINOR_OSS(cidx, SNDRV_MINOR_OSS_DMMIDI1); 134 track2 = SNDRV_MINOR_OSS(cidx, SNDRV_MINOR_OSS_DMMIDI1);
135 break; 135 break;
136 } 136 }
137 if (card)
138 carddev = card->dev;
139 register1 = register_sound_special_device(f_ops, minor, carddev); 137 register1 = register_sound_special_device(f_ops, minor, carddev);
140 if (register1 != minor) 138 if (register1 != minor)
141 goto __end; 139 goto __end;
diff --git a/sound/usb/usx2y/usbusx2yaudio.c b/sound/usb/usx2y/usbusx2yaudio.c
index 367f8a32a665..0a352e46862f 100644
--- a/sound/usb/usx2y/usbusx2yaudio.c
+++ b/sound/usb/usx2y/usbusx2yaudio.c
@@ -322,7 +322,7 @@ static void i_usX2Y_urb_complete(struct urb *urb)
322 usX2Y_error_urb_status(usX2Y, subs, urb); 322 usX2Y_error_urb_status(usX2Y, subs, urb);
323 return; 323 return;
324 } 324 }
325 if (likely(urb->start_frame == usX2Y->wait_iso_frame)) 325 if (likely((urb->start_frame & 0xFFFF) == (usX2Y->wait_iso_frame & 0xFFFF)))
326 subs->completed_urb = urb; 326 subs->completed_urb = urb;
327 else { 327 else {
328 usX2Y_error_sequence(usX2Y, subs, urb); 328 usX2Y_error_sequence(usX2Y, subs, urb);
diff --git a/sound/usb/usx2y/usx2yhwdeppcm.c b/sound/usb/usx2y/usx2yhwdeppcm.c
index 8f3e35e24e72..a5e7bcd7ca2e 100644
--- a/sound/usb/usx2y/usx2yhwdeppcm.c
+++ b/sound/usb/usx2y/usx2yhwdeppcm.c
@@ -243,7 +243,7 @@ static void i_usX2Y_usbpcm_urb_complete(struct urb *urb)
243 usX2Y_error_urb_status(usX2Y, subs, urb); 243 usX2Y_error_urb_status(usX2Y, subs, urb);
244 return; 244 return;
245 } 245 }
246 if (likely(urb->start_frame == usX2Y->wait_iso_frame)) 246 if (likely((urb->start_frame & 0xFFFF) == (usX2Y->wait_iso_frame & 0xFFFF)))
247 subs->completed_urb = urb; 247 subs->completed_urb = urb;
248 else { 248 else {
249 usX2Y_error_sequence(usX2Y, subs, urb); 249 usX2Y_error_sequence(usX2Y, subs, urb);