aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/cpusets.txt3
-rw-r--r--Documentation/kernel-parameters.txt11
-rw-r--r--Documentation/networking/ax25.txt18
-rw-r--r--Documentation/power/pci.txt17
-rw-r--r--Documentation/sysrq.txt2
-rw-r--r--MAINTAINERS31
-rw-r--r--Makefile2
-rw-r--r--arch/arm/kernel/dma.c1
-rw-r--r--arch/arm/mach-at91/at91sam9260_devices.c8
-rw-r--r--arch/arm/mach-iop32x/Kconfig4
-rw-r--r--arch/arm/mach-iop32x/iq31244.c59
-rw-r--r--arch/arm/mach-s3c2410/mach-h1940.c2
-rw-r--r--arch/arm/mach-s3c2440/mach-rx3715.c2
-rw-r--r--arch/arm/mach-s3c2443/irq.c2
-rw-r--r--arch/cris/arch-v32/drivers/pci/bios.c4
-rw-r--r--arch/frv/mb93090-mb00/pci-vdk.c3
-rw-r--r--arch/i386/boot/video.S14
-rw-r--r--arch/i386/kernel/apic.c39
-rw-r--r--arch/i386/kernel/cpu/amd.c34
-rw-r--r--arch/i386/kernel/hpet.c70
-rw-r--r--arch/i386/kernel/i8253.c10
-rw-r--r--arch/i386/kernel/io_apic.c2
-rw-r--r--arch/i386/kernel/microcode.c71
-rw-r--r--arch/i386/kernel/nmi.c129
-rw-r--r--arch/i386/kernel/tsc.c9
-rw-r--r--arch/i386/kernel/vmi.c23
-rw-r--r--arch/i386/lib/usercopy.c9
-rw-r--r--arch/i386/mm/highmem.c2
-rw-r--r--arch/i386/pci/common.c14
-rw-r--r--arch/ia64/Kconfig1
-rw-r--r--arch/ia64/kernel/msi_ia64.c2
-rw-r--r--arch/ia64/kernel/smpboot.c17
-rw-r--r--arch/ia64/mm/init.c2
-rw-r--r--arch/ia64/pci/pci.c7
-rw-r--r--arch/mips/Kconfig2
-rw-r--r--arch/mips/gt64120/momenco_ocelot/prom.c1
-rw-r--r--arch/mips/gt64120/momenco_ocelot/setup.c2
-rw-r--r--arch/mips/jazz/jazzdma.c3
-rw-r--r--arch/mips/kernel/entry.S6
-rw-r--r--arch/mips/kernel/genex.S31
-rw-r--r--arch/mips/kernel/smtc.c65
-rw-r--r--arch/mips/mm/c-r3k.c2
-rw-r--r--arch/mips/mm/cache.c16
-rw-r--r--arch/mips/mm/cerr-sb1.c9
-rw-r--r--arch/mips/mm/dma-default.c17
-rw-r--r--arch/mips/mm/fault.c6
-rw-r--r--arch/mips/mm/init.c6
-rw-r--r--arch/mips/mm/pg-sb1.c3
-rw-r--r--arch/mips/pci/pci-bcm1480.c2
-rw-r--r--arch/mips/pci/pci-ev64120.c1
-rw-r--r--arch/mips/pci/pci-sb1250.c2
-rw-r--r--arch/mips/sibyte/bcm1480/irq.c4
-rw-r--r--arch/mips/sibyte/bcm1480/smp.c6
-rw-r--r--arch/mips/sibyte/swarm/setup.c18
-rw-r--r--arch/powerpc/kernel/process.c9
-rw-r--r--arch/powerpc/platforms/pseries/hvCall.S41
-rw-r--r--arch/powerpc/platforms/pseries/lpar.c2
-rw-r--r--arch/powerpc/platforms/pseries/plpar_wrappers.h16
-rw-r--r--arch/powerpc/sysdev/dcr.c2
-rw-r--r--arch/powerpc/sysdev/qe_lib/qe.c6
-rw-r--r--arch/s390/kernel/kprobes.c2
-rw-r--r--arch/sh/kernel/sh_ksyms.c3
-rw-r--r--arch/sparc/lib/atomic32.c2
-rw-r--r--arch/um/drivers/chan_kern.c12
-rw-r--r--arch/um/drivers/mconsole_kern.c3
-rw-r--r--arch/um/drivers/ubd_kern.c13
-rw-r--r--arch/um/include/mconsole.h2
-rw-r--r--arch/um/include/sysdep-x86_64/ptrace.h4
-rw-r--r--arch/um/kernel/mem.c3
-rw-r--r--arch/um/os-Linux/skas/mem.c10
-rw-r--r--arch/um/os-Linux/skas/process.c6
-rw-r--r--arch/um/os-Linux/sys-i386/registers.c5
-rw-r--r--arch/um/os-Linux/sys-x86_64/registers.c4
-rw-r--r--arch/um/sys-i386/delay.c11
-rw-r--r--arch/um/sys-i386/ldt.c3
-rw-r--r--arch/um/sys-x86_64/delay.c11
-rw-r--r--arch/x86_64/boot/video.S14
-rw-r--r--arch/x86_64/kernel/acpi/sleep.c4
-rw-r--r--arch/x86_64/kernel/apic.c19
-rw-r--r--arch/x86_64/kernel/early-quirks.c2
-rw-r--r--arch/x86_64/kernel/i8259.c6
-rw-r--r--arch/x86_64/kernel/nmi.c120
-rw-r--r--block/elevator.c7
-rw-r--r--block/genhd.c2
-rw-r--r--block/ll_rw_blk.c6
-rw-r--r--crypto/scatterwalk.c10
-rw-r--r--drivers/acpi/events/evmisc.c8
-rw-r--r--drivers/acpi/events/evregion.c15
-rw-r--r--drivers/acpi/events/evxface.c6
-rw-r--r--drivers/acpi/executer/excreate.c5
-rw-r--r--drivers/acpi/executer/exsystem.c30
-rw-r--r--drivers/acpi/executer/exutils.c104
-rw-r--r--drivers/acpi/hardware/hwsleep.c5
-rw-r--r--drivers/acpi/ibm_acpi.c19
-rw-r--r--drivers/acpi/namespace/nseval.c11
-rw-r--r--drivers/acpi/namespace/nsinit.c7
-rw-r--r--drivers/acpi/namespace/nsxfeval.c11
-rw-r--r--drivers/acpi/processor_idle.c3
-rw-r--r--drivers/acpi/tables.c57
-rw-r--r--drivers/ata/ahci.c21
-rw-r--r--drivers/ata/libata-acpi.c8
-rw-r--r--drivers/ata/libata-core.c46
-rw-r--r--drivers/ata/libata-eh.c88
-rw-r--r--drivers/ata/libata-scsi.c2
-rw-r--r--drivers/ata/libata.h2
-rw-r--r--drivers/ata/pata_pdc202xx_old.c2
-rw-r--r--drivers/base/core.c14
-rw-r--r--drivers/base/driver.c9
-rw-r--r--drivers/block/cciss.c1
-rw-r--r--drivers/char/Kconfig33
-rw-r--r--drivers/char/drm/Makefile2
-rw-r--r--drivers/char/drm/ffb_context.c544
-rw-r--r--drivers/char/drm/ffb_drv.c355
-rw-r--r--drivers/char/drm/ffb_drv.h379
-rw-r--r--drivers/char/generic_serial.c7
-rw-r--r--drivers/char/vt_ioctl.c16
-rw-r--r--drivers/clocksource/acpi_pm.c2
-rw-r--r--drivers/cpufreq/cpufreq.c4
-rw-r--r--drivers/eisa/pci_eisa.c4
-rw-r--r--drivers/i2c/busses/i2c-amd8111.c3
-rw-r--r--drivers/i2c/busses/i2c-i801.c25
-rw-r--r--drivers/i2c/chips/ds1374.c4
-rw-r--r--drivers/ide/Kconfig6
-rw-r--r--drivers/ide/ide-io.c32
-rw-r--r--drivers/ide/ide-iops.c11
-rw-r--r--drivers/ide/ide.c37
-rw-r--r--drivers/ide/pci/pdc202xx_new.c3
-rw-r--r--drivers/ieee1394/eth1394.c3
-rw-r--r--drivers/infiniband/hw/cxgb3/cxio_hal.c12
-rw-r--r--drivers/infiniband/hw/cxgb3/iwch_provider.c5
-rw-r--r--drivers/infiniband/hw/ehca/ehca_irq.c8
-rw-r--r--drivers/infiniband/hw/ipath/ipath_fs.c16
-rw-r--r--drivers/infiniband/hw/mthca/mthca_mr.c4
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_cm.c4
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_ib.c4
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_main.c10
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_multicast.c6
-rw-r--r--drivers/infiniband/ulp/iser/iser_initiator.c17
-rw-r--r--drivers/isdn/gigaset/bas-gigaset.c4
-rw-r--r--drivers/isdn/gigaset/common.c6
-rw-r--r--drivers/isdn/gigaset/ev-layer.c4
-rw-r--r--drivers/isdn/gigaset/isocdata.c4
-rw-r--r--drivers/isdn/gigaset/ser-gigaset.c2
-rw-r--r--drivers/isdn/gigaset/usb-gigaset.c4
-rw-r--r--drivers/isdn/hisax/isar.c2
-rw-r--r--drivers/kvm/vmx.c39
-rw-r--r--drivers/md/md.c58
-rw-r--r--drivers/md/raid5.c19
-rw-r--r--drivers/media/common/ir-functions.c6
-rw-r--r--drivers/media/dvb/dvb-core/dmxdev.c12
-rw-r--r--drivers/media/dvb/dvb-core/dvb_demux.c21
-rw-r--r--drivers/media/dvb/dvb-core/dvbdev.c9
-rw-r--r--drivers/media/dvb/frontends/isl6421.c1
-rw-r--r--drivers/media/dvb/frontends/nxt200x.c4
-rw-r--r--drivers/media/dvb/frontends/tda10086.c2
-rw-r--r--drivers/media/dvb/pluto2/pluto2.c22
-rw-r--r--drivers/media/radio/Kconfig2
-rw-r--r--drivers/media/video/msp3400-driver.c14
-rw-r--r--drivers/media/video/saa7115.c2
-rw-r--r--drivers/media/video/tuner-core.c10
-rw-r--r--drivers/message/fusion/mptsas.c7
-rw-r--r--drivers/message/i2o/i2o_block.c12
-rw-r--r--drivers/mfd/sm501.c2
-rw-r--r--drivers/net/Kconfig25
-rw-r--r--drivers/net/atl1/atl1_hw.c1
-rw-r--r--drivers/net/atl1/atl1_main.c10
-rw-r--r--drivers/net/b44.c2
-rw-r--r--drivers/net/bnx2.c38
-rw-r--r--drivers/net/cxgb3/common.h24
-rw-r--r--drivers/net/cxgb3/cxgb3_main.c119
-rw-r--r--drivers/net/cxgb3/cxgb3_offload.c4
-rw-r--r--drivers/net/cxgb3/mc5.c3
-rw-r--r--drivers/net/cxgb3/regs.h26
-rw-r--r--drivers/net/cxgb3/sge.c2
-rw-r--r--drivers/net/cxgb3/t3_hw.c39
-rw-r--r--drivers/net/cxgb3/version.h5
-rw-r--r--drivers/net/cxgb3/xgmac.c134
-rw-r--r--drivers/net/ewrk3.c3
-rw-r--r--drivers/net/forcedeth.c8
-rw-r--r--drivers/net/ifb.c35
-rw-r--r--drivers/net/irda/irda-usb.c2
-rw-r--r--drivers/net/irda/pxaficp_ir.c30
-rw-r--r--drivers/net/mv643xx_eth.c18
-rw-r--r--drivers/net/myri10ge/myri10ge.c27
-rw-r--r--drivers/net/netxen/netxen_nic_init.c3
-rw-r--r--drivers/net/pci-skeleton.c4
-rw-r--r--drivers/net/ppp_generic.c3
-rwxr-xr-xdrivers/net/qla3xxx.c110
-rwxr-xr-xdrivers/net/qla3xxx.h3
-rw-r--r--drivers/net/r8169.c46
-rw-r--r--drivers/net/saa9730.c177
-rw-r--r--drivers/net/sb1250-mac.c2
-rw-r--r--drivers/net/sis190.c1
-rw-r--r--drivers/net/skge.c110
-rw-r--r--drivers/net/skge.h6
-rw-r--r--drivers/net/sun3lance.c16
-rw-r--r--drivers/net/sungem.c30
-rw-r--r--drivers/net/tg3.c136
-rw-r--r--drivers/net/tg3.h5
-rw-r--r--drivers/net/ucc_geth.c3
-rw-r--r--drivers/net/wan/lmc/lmc_media.h65
-rw-r--r--drivers/net/wireless/airo.c4
-rw-r--r--drivers/net/wireless/bcm43xx/bcm43xx_phy.c4
-rw-r--r--drivers/net/wireless/bcm43xx/bcm43xx_radio.c26
-rw-r--r--drivers/oprofile/event_buffer.c5
-rw-r--r--drivers/oprofile/oprofilefs.c5
-rw-r--r--drivers/pci/msi.c1
-rw-r--r--drivers/pci/pcie/portdrv_pci.c2
-rw-r--r--drivers/pci/quirks.c18
-rw-r--r--drivers/pcmcia/au1000_generic.c2
-rw-r--r--drivers/pcmcia/omap_cf.c41
-rw-r--r--drivers/pnp/system.c13
-rw-r--r--drivers/rtc/rtc-cmos.c50
-rw-r--r--drivers/s390/block/dasd_diag.c10
-rw-r--r--drivers/s390/cio/device_status.c14
-rw-r--r--drivers/s390/crypto/ap_bus.c30
-rw-r--r--drivers/scsi/gdth.c2
-rw-r--r--drivers/scsi/lpfc/lpfc_init.c5
-rw-r--r--drivers/scsi/scsi_error.c2
-rw-r--r--drivers/serial/8250_pnp.c3
-rw-r--r--drivers/spi/spi.c10
-rw-r--r--drivers/tc/zs.c1
-rw-r--r--drivers/usb/core/quirks.c3
-rw-r--r--drivers/usb/gadget/omap_udc.c103
-rw-r--r--drivers/usb/host/uhci-debug.c26
-rw-r--r--drivers/usb/host/uhci-hcd.c3
-rw-r--r--drivers/usb/host/uhci-q.c94
-rw-r--r--drivers/usb/serial/airprime.c1
-rw-r--r--drivers/usb/serial/ftdi_sio.c6
-rw-r--r--drivers/usb/serial/generic.c7
-rw-r--r--drivers/video/cg3.c26
-rw-r--r--drivers/video/ffb.c84
-rw-r--r--drivers/video/riva/fbdev.c4
-rw-r--r--drivers/video/s3fb.c3
-rw-r--r--fs/9p/v9fs_vfs.h1
-rw-r--r--fs/9p/vfs_file.c4
-rw-r--r--fs/aio.c1
-rw-r--r--fs/binfmt_elf.c5
-rw-r--r--fs/binfmt_elf_fdpic.c17
-rw-r--r--fs/char_dev.c2
-rw-r--r--fs/cifs/CHANGES6
-rw-r--r--fs/cifs/cifspdu.h8
-rw-r--r--fs/cifs/inode.c21
-rw-r--r--fs/cifs/readdir.c4
-rw-r--r--fs/compat_ioctl.c9
-rw-r--r--fs/ext3/inode.c85
-rw-r--r--fs/ext3/xattr.c3
-rw-r--r--fs/ext4/inode.c85
-rw-r--r--fs/fuse/dir.c5
-rw-r--r--fs/fuse/fuse_i.h5
-rw-r--r--fs/fuse/inode.c2
-rw-r--r--fs/hostfs/hostfs_kern.c25
-rw-r--r--fs/nfsd/nfs3xdr.c6
-rw-r--r--fs/nfsd/nfs4acl.c2
-rw-r--r--fs/nfsd/nfs4state.c6
-rw-r--r--fs/ocfs2/dlm/dlmdomain.c8
-rw-r--r--fs/ocfs2/dlm/dlmmaster.c99
-rw-r--r--fs/ocfs2/dlm/dlmthread.c10
-rw-r--r--fs/proc/Makefile3
-rw-r--r--fs/proc/internal.h4
-rw-r--r--fs/proc/root.c2
-rw-r--r--fs/splice.c109
-rw-r--r--fs/xfs/linux-2.6/xfs_buf.c4
-rw-r--r--include/acpi/acinterp.h6
-rw-r--r--include/acpi/actypes.h2
-rw-r--r--include/asm-arm/arch-ixp4xx/io.h17
-rw-r--r--include/asm-arm/arch-ns9xxx/clock.h10
-rw-r--r--include/asm-arm/arch-pxa/pxa-regs.h2
-rw-r--r--include/asm-arm/system.h34
-rw-r--r--include/asm-arm/unistd.h2
-rw-r--r--include/asm-generic/pgtable.h2
-rw-r--r--include/asm-i386/apic.h1
-rw-r--r--include/asm-i386/cpufeature.h1
-rw-r--r--include/asm-i386/elf.h10
-rw-r--r--include/asm-i386/msr.h2
-rw-r--r--include/asm-i386/paravirt.h3
-rw-r--r--include/asm-i386/termbits.h2
-rw-r--r--include/asm-ia64/processor.h2
-rw-r--r--include/asm-mips/cacheflush.h12
-rw-r--r--include/asm-mips/delay.h2
-rw-r--r--include/asm-mips/hazards.h1
-rw-r--r--include/asm-mips/irqflags.h55
-rw-r--r--include/asm-mips/marvell.h1
-rw-r--r--include/asm-mips/pgtable-64.h2
-rw-r--r--include/asm-mips/pgtable.h2
-rw-r--r--include/asm-mips/sgiarcs.h2
-rw-r--r--include/asm-mips/sibyte/sb1250.h2
-rw-r--r--include/asm-mips/smtc_ipi.h16
-rw-r--r--include/asm-powerpc/hvcall.h14
-rw-r--r--include/asm-powerpc/immap_qe.h3
-rw-r--r--include/asm-s390/checksum.h59
-rw-r--r--include/asm-sh/hp6xx.h6
-rw-r--r--include/asm-sh/system.h1
-rw-r--r--include/asm-sparc/a.out.h2
-rw-r--r--include/asm-sparc/mostek.h2
-rw-r--r--include/asm-sparc64/a.out.h2
-rw-r--r--include/asm-sparc64/mostek.h2
-rw-r--r--include/asm-um/common.lds.S1
-rw-r--r--include/asm-um/delay.h17
-rw-r--r--include/asm-um/pgtable-2level.h8
-rw-r--r--include/asm-x86_64/apic.h1
-rw-r--r--include/asm-x86_64/hw_irq.h2
-rw-r--r--include/linux/ata.h1
-rw-r--r--include/linux/bootmem.h2
-rw-r--r--include/linux/compiler.h4
-rw-r--r--include/linux/cpu.h4
-rw-r--r--include/linux/device.h1
-rw-r--r--include/linux/eventpoll.h7
-rw-r--r--include/linux/hrtimer.h3
-rw-r--r--include/linux/ide.h1
-rw-r--r--include/linux/ipc.h9
-rw-r--r--include/linux/kdev_t.h2
-rw-r--r--include/linux/libata.h6
-rw-r--r--include/linux/lockdep.h2
-rw-r--r--include/linux/pipe_fs_i.h4
-rw-r--r--include/linux/raid/md_k.h1
-rw-r--r--include/linux/skbuff.h5
-rw-r--r--include/linux/utsname.h2
-rw-r--r--include/linux/wireless.h21
-rw-r--r--include/media/saa7146_vv.h3
-rw-r--r--include/net/fib_rules.h1
-rw-r--r--include/net/ip6_fib.h1
-rw-r--r--include/net/iw_handler.h30
-rw-r--r--include/net/neighbour.h2
-rw-r--r--include/net/pkt_cls.h7
-rw-r--r--include/net/sctp/structs.h1
-rw-r--r--include/net/sctp/ulpqueue.h1
-rw-r--r--ipc/util.c7
-rw-r--r--kernel/cpu.c32
-rw-r--r--kernel/exit.c2
-rw-r--r--kernel/hrtimer.c19
-rw-r--r--kernel/irq/devres.c2
-rw-r--r--kernel/lockdep.c8
-rw-r--r--kernel/module.c18
-rw-r--r--kernel/power/disk.c9
-rw-r--r--kernel/power/swsusp.c2
-rw-r--r--kernel/power/user.c12
-rw-r--r--kernel/sched.c36
-rw-r--r--kernel/time.c2
-rw-r--r--kernel/time/clockevents.c69
-rw-r--r--kernel/time/clocksource.c3
-rw-r--r--kernel/time/jiffies.c2
-rw-r--r--kernel/time/ntp.c30
-rw-r--r--kernel/time/timer_list.c6
-rw-r--r--kernel/timer.c21
-rw-r--r--mm/bounce.c2
-rw-r--r--mm/filemap_xip.c48
-rw-r--r--mm/madvise.c19
-rw-r--r--mm/nommu.c28
-rw-r--r--mm/rmap.c4
-rw-r--r--mm/shmem.c132
-rw-r--r--mm/slab.c4
-rw-r--r--net/appletalk/ddp.c7
-rw-r--r--net/atm/clip.c9
-rw-r--r--net/ax25/Kconfig61
-rw-r--r--net/bluetooth/hidp/core.c25
-rw-r--r--net/bridge/br_fdb.c4
-rw-r--r--net/bridge/br_netfilter.c2
-rw-r--r--net/core/dev.c23
-rw-r--r--net/core/fib_rules.c34
-rw-r--r--net/core/neighbour.c14
-rw-r--r--net/core/rtnetlink.c3
-rw-r--r--net/core/skbuff.c2
-rw-r--r--net/core/sock.c2
-rw-r--r--net/core/wireless.c82
-rw-r--r--net/dccp/dccp.h1
-rw-r--r--net/dccp/proto.c4
-rw-r--r--net/dccp/timer.c2
-rw-r--r--net/decnet/dn_fib.c5
-rw-r--r--net/decnet/dn_rules.c13
-rw-r--r--net/ieee80211/Kconfig6
-rw-r--r--net/ipv4/fib_frontend.c5
-rw-r--r--net/ipv4/fib_rules.c14
-rw-r--r--net/ipv4/fib_semantics.c2
-rw-r--r--net/ipv4/fib_trie.c9
-rw-r--r--net/ipv4/netfilter/ip_nat_standalone.c15
-rw-r--r--net/ipv4/netfilter/nf_nat_standalone.c14
-rw-r--r--net/ipv4/tcp_output.c3
-rw-r--r--net/ipv4/xfrm4_mode_beet.c26
-rw-r--r--net/ipv6/addrconf.c9
-rw-r--r--net/ipv6/fib6_rules.c14
-rw-r--r--net/ipv6/ip6_fib.c8
-rw-r--r--net/ipv6/ip6_input.c8
-rw-r--r--net/ipv6/raw.c4
-rw-r--r--net/ipv6/route.c120
-rw-r--r--net/ipv6/udp.c2
-rw-r--r--net/ipv6/xfrm6_tunnel.c4
-rw-r--r--net/irda/irnet/irnet.h2
-rw-r--r--net/irda/irnet/irnet_irda.c34
-rw-r--r--net/irda/irttp.c1
-rw-r--r--net/netfilter/Kconfig1
-rw-r--r--net/sched/Makefile1
-rw-r--r--net/sched/act_mirred.c2
-rw-r--r--net/sched/cls_basic.c17
-rw-r--r--net/sched/cls_route.c2
-rw-r--r--net/sched/sch_hfsc.c4
-rw-r--r--net/sched/sch_htb.c6
-rw-r--r--net/sctp/associola.c15
-rw-r--r--net/sctp/sm_statefuns.c20
-rw-r--r--net/sctp/transport.c32
-rw-r--r--net/sctp/ulpqueue.c2
-rw-r--r--net/socket.c7
-rw-r--r--net/sunrpc/svcsock.c4
-rw-r--r--net/x25/x25_forward.c88
-rw-r--r--net/xfrm/xfrm_policy.c2
-rw-r--r--net/xfrm/xfrm_state.c3
-rw-r--r--net/xfrm/xfrm_user.c2
-rw-r--r--scripts/basic/fixdep.c10
408 files changed, 4030 insertions, 3638 deletions
diff --git a/Documentation/cpusets.txt b/Documentation/cpusets.txt
index 842f0d1ab216..f2c0a6842930 100644
--- a/Documentation/cpusets.txt
+++ b/Documentation/cpusets.txt
@@ -557,6 +557,9 @@ Set some flags:
557Add some cpus: 557Add some cpus:
558# /bin/echo 0-7 > cpus 558# /bin/echo 0-7 > cpus
559 559
560Add some mems:
561# /bin/echo 0-7 > mems
562
560Now attach your shell to this cpuset: 563Now attach your shell to this cpuset:
561# /bin/echo $$ > tasks 564# /bin/echo $$ > tasks
562 565
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index 856c8b114e71..12533a958c51 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -138,6 +138,12 @@ and is between 256 and 4096 characters. It is defined in the file
138 138
139 See also Documentation/pm.txt, pci=noacpi 139 See also Documentation/pm.txt, pci=noacpi
140 140
141 acpi_apic_instance= [ACPI, IOAPIC]
142 Format: <int>
143 2: use 2nd APIC table, if available
144 1,0: use 1st APIC table
145 default: 0
146
141 acpi_sleep= [HW,ACPI] Sleep options 147 acpi_sleep= [HW,ACPI] Sleep options
142 Format: { s3_bios, s3_mode } 148 Format: { s3_bios, s3_mode }
143 See Documentation/power/video.txt 149 See Documentation/power/video.txt
@@ -774,6 +780,9 @@ and is between 256 and 4096 characters. It is defined in the file
774 lapic [IA-32,APIC] Enable the local APIC even if BIOS 780 lapic [IA-32,APIC] Enable the local APIC even if BIOS
775 disabled it. 781 disabled it.
776 782
783 lapic_timer_c2_ok [IA-32,x86-64,APIC] trust the local apic timer in
784 C2 power state.
785
777 lasi= [HW,SCSI] PARISC LASI driver for the 53c700 chip 786 lasi= [HW,SCSI] PARISC LASI driver for the 53c700 chip
778 Format: addr:<io>,irq:<irq> 787 Format: addr:<io>,irq:<irq>
779 788
@@ -1117,6 +1126,8 @@ and is between 256 and 4096 characters. It is defined in the file
1117 1126
1118 nolapic [IA-32,APIC] Do not enable or use the local APIC. 1127 nolapic [IA-32,APIC] Do not enable or use the local APIC.
1119 1128
1129 nolapic_timer [IA-32,APIC] Do not use the local APIC timer.
1130
1120 noltlbs [PPC] Do not use large page/tlb entries for kernel 1131 noltlbs [PPC] Do not use large page/tlb entries for kernel
1121 lowmem mapping on PPC40x. 1132 lowmem mapping on PPC40x.
1122 1133
diff --git a/Documentation/networking/ax25.txt b/Documentation/networking/ax25.txt
index 37c25b0925f0..8257dbf9be57 100644
--- a/Documentation/networking/ax25.txt
+++ b/Documentation/networking/ax25.txt
@@ -1,16 +1,10 @@
1To use the amateur radio protocols within Linux you will need to get a 1To use the amateur radio protocols within Linux you will need to get a
2suitable copy of the AX.25 Utilities. More detailed information about these 2suitable copy of the AX.25 Utilities. More detailed information about
3and associated programs can be found on http://zone.pspt.fi/~jsn/. 3AX.25, NET/ROM and ROSE, associated programs and and utilities can be
4 4found on http://www.linux-ax25.org.
5For more information about the AX.25, NET/ROM and ROSE protocol stacks, see
6the AX25-HOWTO written by Terry Dawson <terry@perf.no.itg.telstra.com.au>
7who is also the AX.25 Utilities maintainer.
8 5
9There is an active mailing list for discussing Linux amateur radio matters 6There is an active mailing list for discussing Linux amateur radio matters
10called linux-hams. To subscribe to it, send a message to 7called linux-hams@vger.kernel.org. To subscribe to it, send a message to
11majordomo@vger.kernel.org with the words "subscribe linux-hams" in the body 8majordomo@vger.kernel.org with the words "subscribe linux-hams" in the body
12of the message, the subject field is ignored. 9of the message, the subject field is ignored. You don't need to be
13 10subscribed to post but of course that means you might miss an answer.
14Jonathan G4KLX
15
16g4klx@g4klx.demon.co.uk
diff --git a/Documentation/power/pci.txt b/Documentation/power/pci.txt
index c750f9f2e76e..b6a3cbf7e846 100644
--- a/Documentation/power/pci.txt
+++ b/Documentation/power/pci.txt
@@ -102,31 +102,28 @@ pci_save_state
102-------------- 102--------------
103 103
104Usage: 104Usage:
105 pci_save_state(dev, buffer); 105 pci_save_state(struct pci_dev *dev);
106 106
107Description: 107Description:
108 Save first 64 bytes of PCI config space. Buffer must be allocated by 108 Save first 64 bytes of PCI config space, along with any additional
109 caller. 109 PCI-Express or PCI-X information.
110 110
111 111
112pci_restore_state 112pci_restore_state
113----------------- 113-----------------
114 114
115Usage: 115Usage:
116 pci_restore_state(dev, buffer); 116 pci_restore_state(struct pci_dev *dev);
117 117
118Description: 118Description:
119 Restore previously saved config space. (First 64 bytes only); 119 Restore previously saved config space.
120
121 If buffer is NULL, then restore what information we know about the
122 device from bootup: BARs and interrupt line.
123 120
124 121
125pci_set_power_state 122pci_set_power_state
126------------------- 123-------------------
127 124
128Usage: 125Usage:
129 pci_set_power_state(dev, state); 126 pci_set_power_state(struct pci_dev *dev, pci_power_t state);
130 127
131Description: 128Description:
132 Transition device to low power state using PCI PM Capabilities 129 Transition device to low power state using PCI PM Capabilities
@@ -142,7 +139,7 @@ pci_enable_wake
142--------------- 139---------------
143 140
144Usage: 141Usage:
145 pci_enable_wake(dev, state, enable); 142 pci_enable_wake(struct pci_dev *dev, pci_power_t state, int enable);
146 143
147Description: 144Description:
148 Enable device to generate PME# during low power state using PCI PM 145 Enable device to generate PME# during low power state using PCI PM
diff --git a/Documentation/sysrq.txt b/Documentation/sysrq.txt
index 452c0f152304..d43aa9d3c105 100644
--- a/Documentation/sysrq.txt
+++ b/Documentation/sysrq.txt
@@ -93,6 +93,8 @@ On all - write a character to /proc/sysrq-trigger. e.g.:
93 93
94'p' - Will dump the current registers and flags to your console. 94'p' - Will dump the current registers and flags to your console.
95 95
96'q' - Will dump a list of all running timers.
97
96'r' - Turns off keyboard raw mode and sets it to XLATE. 98'r' - Turns off keyboard raw mode and sets it to XLATE.
97 99
98's' - Will attempt to sync all mounted filesystems. 100's' - Will attempt to sync all mounted filesystems.
diff --git a/MAINTAINERS b/MAINTAINERS
index 6d8d5b917d1f..829407ff41f1 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -198,10 +198,25 @@ L: linux-sound@vger.kernel.org
198W: http://www.stud.uni-karlsruhe.de/~uh1b/ 198W: http://www.stud.uni-karlsruhe.de/~uh1b/
199S: Maintained 199S: Maintained
200 200
201IPS SCSI RAID DRIVER
202P: Adaptec OEM Raid Solutions
203M: aacraid@adaptec.com
204L: linux-scsi@vger.kernel.org
205W: http://www.adaptec.com/
206S: Maintained
207
208DPT_I2O SCSI RAID DRIVER
209P: Adaptec OEM Raid Solutions
210M: aacraid@adaptec.com
211L: linux-scsi@vger.kernel.org
212W: http://www.adaptec.com/
213S: Maintained
214
201AACRAID SCSI RAID DRIVER 215AACRAID SCSI RAID DRIVER
202P: Adaptec OEM Raid Solutions 216P: Adaptec OEM Raid Solutions
217M: aacraid@adaptec.com
203L: linux-scsi@vger.kernel.org 218L: linux-scsi@vger.kernel.org
204W: http://linux.dell.com/storage.shtml 219W: http://www.adaptec.com/
205S: Supported 220S: Supported
206 221
207ACPI 222ACPI
@@ -1585,12 +1600,6 @@ L: i2c@lm-sensors.org
1585T: quilt http://khali.linux-fr.org/devel/linux-2.6/jdelvare-i2c/ 1600T: quilt http://khali.linux-fr.org/devel/linux-2.6/jdelvare-i2c/
1586S: Maintained 1601S: Maintained
1587 1602
1588I2O
1589P: Markus Lidel
1590M: markus.lidel@shadowconnect.com
1591W: http://i2o.shadowconnect.com/
1592S: Maintained
1593
1594i386 BOOT CODE 1603i386 BOOT CODE
1595P: Riley H. Williams 1604P: Riley H. Williams
1596M: Riley@Williams.Name 1605M: Riley@Williams.Name
@@ -2928,9 +2937,12 @@ L: linux-scsi@vger.kernel.org
2928S: Maintained 2937S: Maintained
2929 2938
2930SCTP PROTOCOL 2939SCTP PROTOCOL
2940P: Vlad Yasevich
2941M: vladislav.yasevich@hp.com
2931P: Sridhar Samudrala 2942P: Sridhar Samudrala
2932M: sri@us.ibm.com 2943M: sri@us.ibm.com
2933L: lksctp-developers@lists.sourceforge.net 2944L: lksctp-developers@lists.sourceforge.net
2945W: http://lksctp.sourceforge.net
2934S: Supported 2946S: Supported
2935 2947
2936SCx200 CPU SUPPORT 2948SCx200 CPU SUPPORT
@@ -3066,11 +3078,10 @@ L: netdev@vger.kernel.org
3066S: Maintained 3078S: Maintained
3067 3079
3068SONY VAIO CONTROL DEVICE DRIVER 3080SONY VAIO CONTROL DEVICE DRIVER
3069P: Stelian Pop
3070M: stelian@popies.net
3071P: Mattia Dongili 3081P: Mattia Dongili
3072M: malattia@linux.it 3082M: malattia@linux.it
3073W: http://popies.net/sonypi/ 3083L: linux-acpi@vger.kernel.org
3084W: http://www.linux.it/~malattia/wiki/index.php/Sony_drivers
3074S: Maintained 3085S: Maintained
3075 3086
3076SOUND 3087SOUND
diff --git a/Makefile b/Makefile
index 1c018c468e15..6486af1ae69c 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
1VERSION = 2 1VERSION = 2
2PATCHLEVEL = 6 2PATCHLEVEL = 6
3SUBLEVEL = 21 3SUBLEVEL = 21
4EXTRAVERSION = -rc4 4EXTRAVERSION = -rc6
5NAME = Nocturnal Monster Puppy 5NAME = Nocturnal Monster Puppy
6 6
7# *DOCUMENTATION* 7# *DOCUMENTATION*
diff --git a/arch/arm/kernel/dma.c b/arch/arm/kernel/dma.c
index 5a0f4bc5da95..ba99a2035523 100644
--- a/arch/arm/kernel/dma.c
+++ b/arch/arm/kernel/dma.c
@@ -228,6 +228,7 @@ int dma_channel_active(dmach_t channel)
228{ 228{
229 return dma_chan[channel].active; 229 return dma_chan[channel].active;
230} 230}
231EXPORT_SYMBOL(dma_channel_active);
231 232
232void set_dma_page(dmach_t channel, char pagenr) 233void set_dma_page(dmach_t channel, char pagenr)
233{ 234{
diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-at91/at91sam9260_devices.c
index f7d342ccbebf..40586e22cd38 100644
--- a/arch/arm/mach-at91/at91sam9260_devices.c
+++ b/arch/arm/mach-at91/at91sam9260_devices.c
@@ -320,16 +320,16 @@ void __init at91_add_device_nand(struct at91_nand_data *data)
320 at91_sys_write(AT91_SMC_SETUP(3), AT91_SMC_NWESETUP_(0) | AT91_SMC_NCS_WRSETUP_(0) 320 at91_sys_write(AT91_SMC_SETUP(3), AT91_SMC_NWESETUP_(0) | AT91_SMC_NCS_WRSETUP_(0)
321 | AT91_SMC_NRDSETUP_(0) | AT91_SMC_NCS_RDSETUP_(0)); 321 | AT91_SMC_NRDSETUP_(0) | AT91_SMC_NCS_RDSETUP_(0));
322 322
323 at91_sys_write(AT91_SMC_PULSE(3), AT91_SMC_NWEPULSE_(2) | AT91_SMC_NCS_WRPULSE_(5) 323 at91_sys_write(AT91_SMC_PULSE(3), AT91_SMC_NWEPULSE_(3) | AT91_SMC_NCS_WRPULSE_(3)
324 | AT91_SMC_NRDPULSE_(2) | AT91_SMC_NCS_RDPULSE_(5)); 324 | AT91_SMC_NRDPULSE_(3) | AT91_SMC_NCS_RDPULSE_(3));
325 325
326 at91_sys_write(AT91_SMC_CYCLE(3), AT91_SMC_NWECYCLE_(7) | AT91_SMC_NRDCYCLE_(7)); 326 at91_sys_write(AT91_SMC_CYCLE(3), AT91_SMC_NWECYCLE_(5) | AT91_SMC_NRDCYCLE_(5));
327 327
328 if (data->bus_width_16) 328 if (data->bus_width_16)
329 mode = AT91_SMC_DBW_16; 329 mode = AT91_SMC_DBW_16;
330 else 330 else
331 mode = AT91_SMC_DBW_8; 331 mode = AT91_SMC_DBW_8;
332 at91_sys_write(AT91_SMC_MODE(3), mode | AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_TDF_(1)); 332 at91_sys_write(AT91_SMC_MODE(3), mode | AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_TDF_(2));
333 333
334 /* enable pin */ 334 /* enable pin */
335 if (data->enable_pin) 335 if (data->enable_pin)
diff --git a/arch/arm/mach-iop32x/Kconfig b/arch/arm/mach-iop32x/Kconfig
index c072d94070da..9dd49cff21ff 100644
--- a/arch/arm/mach-iop32x/Kconfig
+++ b/arch/arm/mach-iop32x/Kconfig
@@ -4,6 +4,9 @@ menu "IOP32x Implementation Options"
4 4
5comment "IOP32x Platform Types" 5comment "IOP32x Platform Types"
6 6
7config MACH_EP80219
8 bool
9
7config MACH_GLANTANK 10config MACH_GLANTANK
8 bool "Enable support for the IO-Data GLAN Tank" 11 bool "Enable support for the IO-Data GLAN Tank"
9 help 12 help
@@ -19,6 +22,7 @@ config ARCH_IQ80321
19 22
20config ARCH_IQ31244 23config ARCH_IQ31244
21 bool "Enable support for EP80219/IQ31244" 24 bool "Enable support for EP80219/IQ31244"
25 select MACH_EP80219
22 help 26 help
23 Say Y here if you want to run your kernel on the Intel EP80219 27 Say Y here if you want to run your kernel on the Intel EP80219
24 evaluation kit for the Intel 80219 processor (a IOP321 variant) 28 evaluation kit for the Intel 80219 processor (a IOP321 variant)
diff --git a/arch/arm/mach-iop32x/iq31244.c b/arch/arm/mach-iop32x/iq31244.c
index 571ac35bc2c7..60e74309a458 100644
--- a/arch/arm/mach-iop32x/iq31244.c
+++ b/arch/arm/mach-iop32x/iq31244.c
@@ -39,22 +39,35 @@
39#include <asm/arch/time.h> 39#include <asm/arch/time.h>
40 40
41/* 41/*
42 * The EP80219 and IQ31244 use the same machine ID. To find out 42 * Until March of 2007 iq31244 platforms and ep80219 platforms shared the
43 * which of the two we're running on, we look at the processor ID. 43 * same machine id, and the processor type was used to select board type.
44 * However this assumption breaks for an iq80219 board which is an iop219
45 * processor on an iq31244 board. The force_ep80219 flag has been added
46 * for old boot loaders using the iq31244 machine id for an ep80219 platform.
44 */ 47 */
48static int force_ep80219;
49
45static int is_80219(void) 50static int is_80219(void)
46{ 51{
47 extern int processor_id; 52 extern int processor_id;
48 return !!((processor_id & 0xffffffe0) == 0x69052e20); 53 return !!((processor_id & 0xffffffe0) == 0x69052e20);
49} 54}
50 55
56static int is_ep80219(void)
57{
58 if (machine_is_ep80219() || force_ep80219)
59 return 1;
60 else
61 return 0;
62}
63
51 64
52/* 65/*
53 * EP80219/IQ31244 timer tick configuration. 66 * EP80219/IQ31244 timer tick configuration.
54 */ 67 */
55static void __init iq31244_timer_init(void) 68static void __init iq31244_timer_init(void)
56{ 69{
57 if (is_80219()) { 70 if (is_ep80219()) {
58 /* 33.333 MHz crystal. */ 71 /* 33.333 MHz crystal. */
59 iop_init_time(200000000); 72 iop_init_time(200000000);
60 } else { 73 } else {
@@ -165,12 +178,18 @@ static struct hw_pci iq31244_pci __initdata = {
165 178
166static int __init iq31244_pci_init(void) 179static int __init iq31244_pci_init(void)
167{ 180{
168 if (machine_is_iq31244()) { 181 if (is_ep80219())
182 pci_common_init(&ep80219_pci);
183 else if (machine_is_iq31244()) {
169 if (is_80219()) { 184 if (is_80219()) {
170 pci_common_init(&ep80219_pci); 185 printk("note: iq31244 board type has been selected\n");
171 } else { 186 printk("note: to select ep80219 operation:\n");
172 pci_common_init(&iq31244_pci); 187 printk("\t1/ specify \"force_ep80219\" on the kernel"
188 " command line\n");
189 printk("\t2/ update boot loader to pass"
190 " the ep80219 id: %d\n", MACH_TYPE_EP80219);
173 } 191 }
192 pci_common_init(&iq31244_pci);
174 } 193 }
175 194
176 return 0; 195 return 0;
@@ -277,10 +296,18 @@ static void __init iq31244_init_machine(void)
277 platform_device_register(&iq31244_flash_device); 296 platform_device_register(&iq31244_flash_device);
278 platform_device_register(&iq31244_serial_device); 297 platform_device_register(&iq31244_serial_device);
279 298
280 if (is_80219()) 299 if (is_ep80219())
281 pm_power_off = ep80219_power_off; 300 pm_power_off = ep80219_power_off;
282} 301}
283 302
303static int __init force_ep80219_setup(char *str)
304{
305 force_ep80219 = 1;
306 return 1;
307}
308
309__setup("force_ep80219", force_ep80219_setup);
310
284MACHINE_START(IQ31244, "Intel IQ31244") 311MACHINE_START(IQ31244, "Intel IQ31244")
285 /* Maintainer: Intel Corp. */ 312 /* Maintainer: Intel Corp. */
286 .phys_io = IQ31244_UART, 313 .phys_io = IQ31244_UART,
@@ -291,3 +318,19 @@ MACHINE_START(IQ31244, "Intel IQ31244")
291 .timer = &iq31244_timer, 318 .timer = &iq31244_timer,
292 .init_machine = iq31244_init_machine, 319 .init_machine = iq31244_init_machine,
293MACHINE_END 320MACHINE_END
321
322/* There should have been an ep80219 machine identifier from the beginning.
323 * Boot roms older than March 2007 do not know the ep80219 machine id. Pass
324 * "force_ep80219" on the kernel command line, otherwise iq31244 operation
325 * will be selected.
326 */
327MACHINE_START(EP80219, "Intel EP80219")
328 /* Maintainer: Intel Corp. */
329 .phys_io = IQ31244_UART,
330 .io_pg_offst = ((IQ31244_UART) >> 18) & 0xfffc,
331 .boot_params = 0xa0000100,
332 .map_io = iq31244_map_io,
333 .init_irq = iop32x_init_irq,
334 .timer = &iq31244_timer,
335 .init_machine = iq31244_init_machine,
336MACHINE_END
diff --git a/arch/arm/mach-s3c2410/mach-h1940.c b/arch/arm/mach-s3c2410/mach-h1940.c
index 01c60d0923cd..d052ab2d9377 100644
--- a/arch/arm/mach-s3c2410/mach-h1940.c
+++ b/arch/arm/mach-s3c2410/mach-h1940.c
@@ -202,7 +202,9 @@ static void __init h1940_map_io(void)
202 202
203 /* setup PM */ 203 /* setup PM */
204 204
205#ifdef CONFIG_PM_H1940
205 memcpy(phys_to_virt(H1940_SUSPEND_RESUMEAT), h1940_pm_return, 1024); 206 memcpy(phys_to_virt(H1940_SUSPEND_RESUMEAT), h1940_pm_return, 1024);
207#endif
206 s3c2410_pm_init(); 208 s3c2410_pm_init();
207} 209}
208 210
diff --git a/arch/arm/mach-s3c2440/mach-rx3715.c b/arch/arm/mach-s3c2440/mach-rx3715.c
index 480ccde63fb4..ae1d0a81fd6a 100644
--- a/arch/arm/mach-s3c2440/mach-rx3715.c
+++ b/arch/arm/mach-s3c2440/mach-rx3715.c
@@ -224,7 +224,9 @@ static void __init rx3715_init_irq(void)
224 224
225static void __init rx3715_init_machine(void) 225static void __init rx3715_init_machine(void)
226{ 226{
227#ifdef CONFIG_PM_H1940
227 memcpy(phys_to_virt(H1940_SUSPEND_RESUMEAT), h1940_pm_return, 1024); 228 memcpy(phys_to_virt(H1940_SUSPEND_RESUMEAT), h1940_pm_return, 1024);
229#endif
228 s3c2410_pm_init(); 230 s3c2410_pm_init();
229 231
230 s3c24xx_fb_set_platdata(&rx3715_lcdcfg); 232 s3c24xx_fb_set_platdata(&rx3715_lcdcfg);
diff --git a/arch/arm/mach-s3c2443/irq.c b/arch/arm/mach-s3c2443/irq.c
index 7a45b6dcb73e..756573595b88 100644
--- a/arch/arm/mach-s3c2443/irq.c
+++ b/arch/arm/mach-s3c2443/irq.c
@@ -137,7 +137,7 @@ static struct irq_chip s3c2443_irq_lcd = {
137 137
138static void s3c2443_irq_demux_dma(unsigned int irq, struct irq_desc *desc) 138static void s3c2443_irq_demux_dma(unsigned int irq, struct irq_desc *desc)
139{ 139{
140 s3c2443_irq_demux(IRQ_S3C2443_DMA1, 6); 140 s3c2443_irq_demux(IRQ_S3C2443_DMA0, 6);
141} 141}
142 142
143#define INTMSK_DMA (1UL << (IRQ_S3C2443_DMA - IRQ_EINT0)) 143#define INTMSK_DMA (1UL << (IRQ_S3C2443_DMA - IRQ_EINT0))
diff --git a/arch/cris/arch-v32/drivers/pci/bios.c b/arch/cris/arch-v32/drivers/pci/bios.c
index a2b9c60c2777..5b79a7a772d4 100644
--- a/arch/cris/arch-v32/drivers/pci/bios.c
+++ b/arch/cris/arch-v32/drivers/pci/bios.c
@@ -100,7 +100,9 @@ int pcibios_enable_device(struct pci_dev *dev, int mask)
100 if ((err = pcibios_enable_resources(dev, mask)) < 0) 100 if ((err = pcibios_enable_resources(dev, mask)) < 0)
101 return err; 101 return err;
102 102
103 return pcibios_enable_irq(dev); 103 if (!dev->msi_enabled)
104 pcibios_enable_irq(dev);
105 return 0;
104} 106}
105 107
106int pcibios_assign_resources(void) 108int pcibios_assign_resources(void)
diff --git a/arch/frv/mb93090-mb00/pci-vdk.c b/arch/frv/mb93090-mb00/pci-vdk.c
index f7279d78995a..0b581e3cf7c7 100644
--- a/arch/frv/mb93090-mb00/pci-vdk.c
+++ b/arch/frv/mb93090-mb00/pci-vdk.c
@@ -466,6 +466,7 @@ int pcibios_enable_device(struct pci_dev *dev, int mask)
466 466
467 if ((err = pcibios_enable_resources(dev, mask)) < 0) 467 if ((err = pcibios_enable_resources(dev, mask)) < 0)
468 return err; 468 return err;
469 pcibios_enable_irq(dev); 469 if (!dev->msi_enabled)
470 pcibios_enable_irq(dev);
470 return 0; 471 return 0;
471} 472}
diff --git a/arch/i386/boot/video.S b/arch/i386/boot/video.S
index 2c5b5cc55f79..8143c9516cb4 100644
--- a/arch/i386/boot/video.S
+++ b/arch/i386/boot/video.S
@@ -571,6 +571,16 @@ setr1: lodsw
571 jmp _m_s 571 jmp _m_s
572 572
573check_vesa: 573check_vesa:
574#ifdef CONFIG_FIRMWARE_EDID
575 leaw modelist+1024, %di
576 movw $0x4f00, %ax
577 int $0x10
578 cmpw $0x004f, %ax
579 jnz setbad
580
581 movw 4(%di), %ax
582 movw %ax, vbe_version
583#endif
574 leaw modelist+1024, %di 584 leaw modelist+1024, %di
575 subb $VIDEO_FIRST_VESA>>8, %bh 585 subb $VIDEO_FIRST_VESA>>8, %bh
576 movw %bx, %cx # Get mode information structure 586 movw %bx, %cx # Get mode information structure
@@ -1945,6 +1955,9 @@ store_edid:
1945 rep 1955 rep
1946 stosl 1956 stosl
1947 1957
1958 cmpw $0x0200, vbe_version # only do EDID on >= VBE2.0
1959 jl no_edid
1960
1948 pushw %es # save ES 1961 pushw %es # save ES
1949 xorw %di, %di # Report Capability 1962 xorw %di, %di # Report Capability
1950 pushw %di 1963 pushw %di
@@ -1987,6 +2000,7 @@ do_restore: .byte 0 # Screen contents altered during mode change
1987svga_prefix: .byte VIDEO_FIRST_BIOS>>8 # Default prefix for BIOS modes 2000svga_prefix: .byte VIDEO_FIRST_BIOS>>8 # Default prefix for BIOS modes
1988graphic_mode: .byte 0 # Graphic mode with a linear frame buffer 2001graphic_mode: .byte 0 # Graphic mode with a linear frame buffer
1989dac_size: .byte 6 # DAC bit depth 2002dac_size: .byte 6 # DAC bit depth
2003vbe_version: .word 0 # VBE bios version
1990 2004
1991# Status messages 2005# Status messages
1992keymsg: .ascii "Press <RETURN> to see video modes available, " 2006keymsg: .ascii "Press <RETURN> to see video modes available, "
diff --git a/arch/i386/kernel/apic.c b/arch/i386/kernel/apic.c
index 5cff7970911e..93aa911646ad 100644
--- a/arch/i386/kernel/apic.c
+++ b/arch/i386/kernel/apic.c
@@ -28,6 +28,7 @@
28#include <linux/clockchips.h> 28#include <linux/clockchips.h>
29#include <linux/acpi_pmtmr.h> 29#include <linux/acpi_pmtmr.h>
30#include <linux/module.h> 30#include <linux/module.h>
31#include <linux/dmi.h>
31 32
32#include <asm/atomic.h> 33#include <asm/atomic.h>
33#include <asm/smp.h> 34#include <asm/smp.h>
@@ -61,6 +62,11 @@ static int enable_local_apic __initdata = 0;
61 62
62/* Local APIC timer verification ok */ 63/* Local APIC timer verification ok */
63static int local_apic_timer_verify_ok; 64static int local_apic_timer_verify_ok;
65/* Disable local APIC timer from the kernel commandline or via dmi quirk */
66static int local_apic_timer_disabled;
67/* Local APIC timer works in C2 */
68int local_apic_timer_c2_ok;
69EXPORT_SYMBOL_GPL(local_apic_timer_c2_ok);
64 70
65/* 71/*
66 * Debug level, exported for io_apic.c 72 * Debug level, exported for io_apic.c
@@ -340,6 +346,22 @@ void __init setup_boot_APIC_clock(void)
340 long delta, deltapm; 346 long delta, deltapm;
341 int pm_referenced = 0; 347 int pm_referenced = 0;
342 348
349 if (boot_cpu_has(X86_FEATURE_LAPIC_TIMER_BROKEN))
350 local_apic_timer_disabled = 1;
351
352 /*
353 * The local apic timer can be disabled via the kernel
354 * commandline or from the test above. Register the lapic
355 * timer as a dummy clock event source on SMP systems, so the
356 * broadcast mechanism is used. On UP systems simply ignore it.
357 */
358 if (local_apic_timer_disabled) {
359 /* No broadcast on UP ! */
360 if (num_possible_cpus() > 1)
361 setup_APIC_timer();
362 return;
363 }
364
343 apic_printk(APIC_VERBOSE, "Using local APIC timer interrupts.\n" 365 apic_printk(APIC_VERBOSE, "Using local APIC timer interrupts.\n"
344 "calibrating APIC timer ...\n"); 366 "calibrating APIC timer ...\n");
345 367
@@ -461,7 +483,8 @@ void __init setup_boot_APIC_clock(void)
461 apic_printk(APIC_VERBOSE, "... jiffies result ok\n"); 483 apic_printk(APIC_VERBOSE, "... jiffies result ok\n");
462 else 484 else
463 local_apic_timer_verify_ok = 0; 485 local_apic_timer_verify_ok = 0;
464 } 486 } else
487 local_irq_enable();
465 488
466 if (!local_apic_timer_verify_ok) { 489 if (!local_apic_timer_verify_ok) {
467 printk(KERN_WARNING 490 printk(KERN_WARNING
@@ -1179,6 +1202,20 @@ static int __init parse_nolapic(char *arg)
1179} 1202}
1180early_param("nolapic", parse_nolapic); 1203early_param("nolapic", parse_nolapic);
1181 1204
1205static int __init parse_disable_lapic_timer(char *arg)
1206{
1207 local_apic_timer_disabled = 1;
1208 return 0;
1209}
1210early_param("nolapic_timer", parse_disable_lapic_timer);
1211
1212static int __init parse_lapic_timer_c2_ok(char *arg)
1213{
1214 local_apic_timer_c2_ok = 1;
1215 return 0;
1216}
1217early_param("lapic_timer_c2_ok", parse_lapic_timer_c2_ok);
1218
1182static int __init apic_set_verbosity(char *str) 1219static int __init apic_set_verbosity(char *str)
1183{ 1220{
1184 if (strcmp("debug", str) == 0) 1221 if (strcmp("debug", str) == 0)
diff --git a/arch/i386/kernel/cpu/amd.c b/arch/i386/kernel/cpu/amd.c
index 41cfea57232b..2d47db482972 100644
--- a/arch/i386/kernel/cpu/amd.c
+++ b/arch/i386/kernel/cpu/amd.c
@@ -22,6 +22,37 @@
22extern void vide(void); 22extern void vide(void);
23__asm__(".align 4\nvide: ret"); 23__asm__(".align 4\nvide: ret");
24 24
25#define ENABLE_C1E_MASK 0x18000000
26#define CPUID_PROCESSOR_SIGNATURE 1
27#define CPUID_XFAM 0x0ff00000
28#define CPUID_XFAM_K8 0x00000000
29#define CPUID_XFAM_10H 0x00100000
30#define CPUID_XFAM_11H 0x00200000
31#define CPUID_XMOD 0x000f0000
32#define CPUID_XMOD_REV_F 0x00040000
33
34/* AMD systems with C1E don't have a working lAPIC timer. Check for that. */
35static __cpuinit int amd_apic_timer_broken(void)
36{
37 u32 lo, hi;
38 u32 eax = cpuid_eax(CPUID_PROCESSOR_SIGNATURE);
39 switch (eax & CPUID_XFAM) {
40 case CPUID_XFAM_K8:
41 if ((eax & CPUID_XMOD) < CPUID_XMOD_REV_F)
42 break;
43 case CPUID_XFAM_10H:
44 case CPUID_XFAM_11H:
45 rdmsr(MSR_K8_ENABLE_C1E, lo, hi);
46 if (lo & ENABLE_C1E_MASK)
47 return 1;
48 break;
49 default:
50 /* err on the side of caution */
51 return 1;
52 }
53 return 0;
54}
55
25static void __cpuinit init_amd(struct cpuinfo_x86 *c) 56static void __cpuinit init_amd(struct cpuinfo_x86 *c)
26{ 57{
27 u32 l, h; 58 u32 l, h;
@@ -241,6 +272,9 @@ static void __cpuinit init_amd(struct cpuinfo_x86 *c)
241 272
242 if (cpuid_eax(0x80000000) >= 0x80000006) 273 if (cpuid_eax(0x80000000) >= 0x80000006)
243 num_cache_leaves = 3; 274 num_cache_leaves = 3;
275
276 if (amd_apic_timer_broken())
277 set_bit(X86_FEATURE_LAPIC_TIMER_BROKEN, c->x86_capability);
244} 278}
245 279
246static unsigned int __cpuinit amd_size_cache(struct cpuinfo_x86 * c, unsigned int size) 280static unsigned int __cpuinit amd_size_cache(struct cpuinfo_x86 * c, unsigned int size)
diff --git a/arch/i386/kernel/hpet.c b/arch/i386/kernel/hpet.c
index f3ab61ee7498..17d73459fc5f 100644
--- a/arch/i386/kernel/hpet.c
+++ b/arch/i386/kernel/hpet.c
@@ -3,6 +3,8 @@
3#include <linux/errno.h> 3#include <linux/errno.h>
4#include <linux/hpet.h> 4#include <linux/hpet.h>
5#include <linux/init.h> 5#include <linux/init.h>
6#include <linux/sysdev.h>
7#include <linux/pm.h>
6 8
7#include <asm/hpet.h> 9#include <asm/hpet.h>
8#include <asm/io.h> 10#include <asm/io.h>
@@ -197,7 +199,7 @@ static int hpet_next_event(unsigned long delta,
197 cnt += delta; 199 cnt += delta;
198 hpet_writel(cnt, HPET_T0_CMP); 200 hpet_writel(cnt, HPET_T0_CMP);
199 201
200 return ((long)(hpet_readl(HPET_COUNTER) - cnt ) > 0); 202 return ((long)(hpet_readl(HPET_COUNTER) - cnt ) > 0) ? -ETIME : 0;
201} 203}
202 204
203/* 205/*
@@ -307,6 +309,7 @@ int __init hpet_enable(void)
307out_nohpet: 309out_nohpet:
308 iounmap(hpet_virt_address); 310 iounmap(hpet_virt_address);
309 hpet_virt_address = NULL; 311 hpet_virt_address = NULL;
312 boot_hpet_disable = 1;
310 return 0; 313 return 0;
311} 314}
312 315
@@ -521,3 +524,68 @@ irqreturn_t hpet_rtc_interrupt(int irq, void *dev_id)
521 return IRQ_HANDLED; 524 return IRQ_HANDLED;
522} 525}
523#endif 526#endif
527
528
529/*
530 * Suspend/resume part
531 */
532
533#ifdef CONFIG_PM
534
535static int hpet_suspend(struct sys_device *sys_device, pm_message_t state)
536{
537 unsigned long cfg = hpet_readl(HPET_CFG);
538
539 cfg &= ~(HPET_CFG_ENABLE|HPET_CFG_LEGACY);
540 hpet_writel(cfg, HPET_CFG);
541
542 return 0;
543}
544
545static int hpet_resume(struct sys_device *sys_device)
546{
547 unsigned int id;
548
549 hpet_start_counter();
550
551 id = hpet_readl(HPET_ID);
552
553 if (id & HPET_ID_LEGSUP)
554 hpet_enable_int();
555
556 return 0;
557}
558
559static struct sysdev_class hpet_class = {
560 set_kset_name("hpet"),
561 .suspend = hpet_suspend,
562 .resume = hpet_resume,
563};
564
565static struct sys_device hpet_device = {
566 .id = 0,
567 .cls = &hpet_class,
568};
569
570
571static __init int hpet_register_sysfs(void)
572{
573 int err;
574
575 if (!is_hpet_capable())
576 return 0;
577
578 err = sysdev_class_register(&hpet_class);
579
580 if (!err) {
581 err = sysdev_register(&hpet_device);
582 if (err)
583 sysdev_class_unregister(&hpet_class);
584 }
585
586 return err;
587}
588
589device_initcall(hpet_register_sysfs);
590
591#endif
diff --git a/arch/i386/kernel/i8253.c b/arch/i386/kernel/i8253.c
index 5cbb776b3089..10cef5ca8a5b 100644
--- a/arch/i386/kernel/i8253.c
+++ b/arch/i386/kernel/i8253.c
@@ -47,9 +47,17 @@ static void init_pit_timer(enum clock_event_mode mode,
47 outb(LATCH >> 8 , PIT_CH0); /* MSB */ 47 outb(LATCH >> 8 , PIT_CH0); /* MSB */
48 break; 48 break;
49 49
50 case CLOCK_EVT_MODE_ONESHOT: 50 /*
51 * Avoid unnecessary state transitions, as it confuses
52 * Geode / Cyrix based boxen.
53 */
51 case CLOCK_EVT_MODE_SHUTDOWN: 54 case CLOCK_EVT_MODE_SHUTDOWN:
55 if (evt->mode == CLOCK_EVT_MODE_UNUSED)
56 break;
52 case CLOCK_EVT_MODE_UNUSED: 57 case CLOCK_EVT_MODE_UNUSED:
58 if (evt->mode == CLOCK_EVT_MODE_SHUTDOWN)
59 break;
60 case CLOCK_EVT_MODE_ONESHOT:
53 /* One shot setup */ 61 /* One shot setup */
54 outb_p(0x38, PIT_MODE); 62 outb_p(0x38, PIT_MODE);
55 udelay(10); 63 udelay(10);
diff --git a/arch/i386/kernel/io_apic.c b/arch/i386/kernel/io_apic.c
index e4408ff4e674..b3ab8ffebd27 100644
--- a/arch/i386/kernel/io_apic.c
+++ b/arch/i386/kernel/io_apic.c
@@ -736,7 +736,7 @@ failed:
736 return 0; 736 return 0;
737} 737}
738 738
739int __init irqbalance_disable(char *str) 739int __devinit irqbalance_disable(char *str)
740{ 740{
741 irqbalance_disabled = 1; 741 irqbalance_disabled = 1;
742 return 1; 742 return 1;
diff --git a/arch/i386/kernel/microcode.c b/arch/i386/kernel/microcode.c
index b8f16633a6ec..cbe7ec8dbb9f 100644
--- a/arch/i386/kernel/microcode.c
+++ b/arch/i386/kernel/microcode.c
@@ -567,6 +567,53 @@ static int cpu_request_microcode(int cpu)
567 return error; 567 return error;
568} 568}
569 569
570static int apply_microcode_on_cpu(int cpu)
571{
572 struct cpuinfo_x86 *c = cpu_data + cpu;
573 struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
574 cpumask_t old;
575 unsigned int val[2];
576 int err = 0;
577
578 if (!uci->mc)
579 return -EINVAL;
580
581 old = current->cpus_allowed;
582 set_cpus_allowed(current, cpumask_of_cpu(cpu));
583
584 /* Check if the microcode we have in memory matches the CPU */
585 if (c->x86_vendor != X86_VENDOR_INTEL || c->x86 < 6 ||
586 cpu_has(c, X86_FEATURE_IA64) || uci->sig != cpuid_eax(0x00000001))
587 err = -EINVAL;
588
589 if (!err && ((c->x86_model >= 5) || (c->x86 > 6))) {
590 /* get processor flags from MSR 0x17 */
591 rdmsr(MSR_IA32_PLATFORM_ID, val[0], val[1]);
592 if (uci->pf != (1 << ((val[1] >> 18) & 7)))
593 err = -EINVAL;
594 }
595
596 if (!err) {
597 wrmsr(MSR_IA32_UCODE_REV, 0, 0);
598 /* see notes above for revision 1.07. Apparent chip bug */
599 sync_core();
600 /* get the current revision from MSR 0x8B */
601 rdmsr(MSR_IA32_UCODE_REV, val[0], val[1]);
602 if (uci->rev != val[1])
603 err = -EINVAL;
604 }
605
606 if (!err)
607 apply_microcode(cpu);
608 else
609 printk(KERN_ERR "microcode: Could not apply microcode to CPU%d:"
610 " sig=0x%x, pf=0x%x, rev=0x%x\n",
611 cpu, uci->sig, uci->pf, uci->rev);
612
613 set_cpus_allowed(current, old);
614 return err;
615}
616
570static void microcode_init_cpu(int cpu) 617static void microcode_init_cpu(int cpu)
571{ 618{
572 cpumask_t old; 619 cpumask_t old;
@@ -577,7 +624,8 @@ static void microcode_init_cpu(int cpu)
577 set_cpus_allowed(current, cpumask_of_cpu(cpu)); 624 set_cpus_allowed(current, cpumask_of_cpu(cpu));
578 mutex_lock(&microcode_mutex); 625 mutex_lock(&microcode_mutex);
579 collect_cpu_info(cpu); 626 collect_cpu_info(cpu);
580 if (uci->valid && system_state == SYSTEM_RUNNING) 627 if (uci->valid && system_state == SYSTEM_RUNNING &&
628 !suspend_cpu_hotplug)
581 cpu_request_microcode(cpu); 629 cpu_request_microcode(cpu);
582 mutex_unlock(&microcode_mutex); 630 mutex_unlock(&microcode_mutex);
583 set_cpus_allowed(current, old); 631 set_cpus_allowed(current, old);
@@ -663,13 +711,24 @@ static int mc_sysdev_add(struct sys_device *sys_dev)
663 return 0; 711 return 0;
664 712
665 pr_debug("Microcode:CPU %d added\n", cpu); 713 pr_debug("Microcode:CPU %d added\n", cpu);
666 memset(uci, 0, sizeof(*uci)); 714 /* If suspend_cpu_hotplug is set, the system is resuming and we should
715 * use the data from before the suspend.
716 */
717 if (suspend_cpu_hotplug) {
718 err = apply_microcode_on_cpu(cpu);
719 if (err)
720 microcode_fini_cpu(cpu);
721 }
722 if (!uci->valid)
723 memset(uci, 0, sizeof(*uci));
667 724
668 err = sysfs_create_group(&sys_dev->kobj, &mc_attr_group); 725 err = sysfs_create_group(&sys_dev->kobj, &mc_attr_group);
669 if (err) 726 if (err)
670 return err; 727 return err;
671 728
672 microcode_init_cpu(cpu); 729 if (!uci->valid)
730 microcode_init_cpu(cpu);
731
673 return 0; 732 return 0;
674} 733}
675 734
@@ -680,7 +739,11 @@ static int mc_sysdev_remove(struct sys_device *sys_dev)
680 if (!cpu_online(cpu)) 739 if (!cpu_online(cpu))
681 return 0; 740 return 0;
682 pr_debug("Microcode:CPU %d removed\n", cpu); 741 pr_debug("Microcode:CPU %d removed\n", cpu);
683 microcode_fini_cpu(cpu); 742 /* If suspend_cpu_hotplug is set, the system is suspending and we should
743 * keep the microcode in memory for the resume.
744 */
745 if (!suspend_cpu_hotplug)
746 microcode_fini_cpu(cpu);
684 sysfs_remove_group(&sys_dev->kobj, &mc_attr_group); 747 sysfs_remove_group(&sys_dev->kobj, &mc_attr_group);
685 return 0; 748 return 0;
686} 749}
diff --git a/arch/i386/kernel/nmi.c b/arch/i386/kernel/nmi.c
index 14702427b104..a98ba88a8c0c 100644
--- a/arch/i386/kernel/nmi.c
+++ b/arch/i386/kernel/nmi.c
@@ -122,64 +122,129 @@ static inline unsigned int nmi_evntsel_msr_to_bit(unsigned int msr)
122/* checks for a bit availability (hack for oprofile) */ 122/* checks for a bit availability (hack for oprofile) */
123int avail_to_resrv_perfctr_nmi_bit(unsigned int counter) 123int avail_to_resrv_perfctr_nmi_bit(unsigned int counter)
124{ 124{
125 int cpu;
125 BUG_ON(counter > NMI_MAX_COUNTER_BITS); 126 BUG_ON(counter > NMI_MAX_COUNTER_BITS);
126 127 for_each_possible_cpu (cpu) {
127 return (!test_bit(counter, &__get_cpu_var(perfctr_nmi_owner))); 128 if (test_bit(counter, &per_cpu(perfctr_nmi_owner, cpu)))
129 return 0;
130 }
131 return 1;
128} 132}
129 133
130/* checks the an msr for availability */ 134/* checks the an msr for availability */
131int avail_to_resrv_perfctr_nmi(unsigned int msr) 135int avail_to_resrv_perfctr_nmi(unsigned int msr)
132{ 136{
133 unsigned int counter; 137 unsigned int counter;
138 int cpu;
134 139
135 counter = nmi_perfctr_msr_to_bit(msr); 140 counter = nmi_perfctr_msr_to_bit(msr);
136 BUG_ON(counter > NMI_MAX_COUNTER_BITS); 141 BUG_ON(counter > NMI_MAX_COUNTER_BITS);
137 142
138 return (!test_bit(counter, &__get_cpu_var(perfctr_nmi_owner))); 143 for_each_possible_cpu (cpu) {
144 if (test_bit(counter, &per_cpu(perfctr_nmi_owner, cpu)))
145 return 0;
146 }
147 return 1;
139} 148}
140 149
141int reserve_perfctr_nmi(unsigned int msr) 150static int __reserve_perfctr_nmi(int cpu, unsigned int msr)
142{ 151{
143 unsigned int counter; 152 unsigned int counter;
153 if (cpu < 0)
154 cpu = smp_processor_id();
144 155
145 counter = nmi_perfctr_msr_to_bit(msr); 156 counter = nmi_perfctr_msr_to_bit(msr);
146 BUG_ON(counter > NMI_MAX_COUNTER_BITS); 157 BUG_ON(counter > NMI_MAX_COUNTER_BITS);
147 158
148 if (!test_and_set_bit(counter, &__get_cpu_var(perfctr_nmi_owner))) 159 if (!test_and_set_bit(counter, &per_cpu(perfctr_nmi_owner, cpu)))
149 return 1; 160 return 1;
150 return 0; 161 return 0;
151} 162}
152 163
153void release_perfctr_nmi(unsigned int msr) 164static void __release_perfctr_nmi(int cpu, unsigned int msr)
154{ 165{
155 unsigned int counter; 166 unsigned int counter;
167 if (cpu < 0)
168 cpu = smp_processor_id();
156 169
157 counter = nmi_perfctr_msr_to_bit(msr); 170 counter = nmi_perfctr_msr_to_bit(msr);
158 BUG_ON(counter > NMI_MAX_COUNTER_BITS); 171 BUG_ON(counter > NMI_MAX_COUNTER_BITS);
159 172
160 clear_bit(counter, &__get_cpu_var(perfctr_nmi_owner)); 173 clear_bit(counter, &per_cpu(perfctr_nmi_owner, cpu));
161} 174}
162 175
163int reserve_evntsel_nmi(unsigned int msr) 176int reserve_perfctr_nmi(unsigned int msr)
177{
178 int cpu, i;
179 for_each_possible_cpu (cpu) {
180 if (!__reserve_perfctr_nmi(cpu, msr)) {
181 for_each_possible_cpu (i) {
182 if (i >= cpu)
183 break;
184 __release_perfctr_nmi(i, msr);
185 }
186 return 0;
187 }
188 }
189 return 1;
190}
191
192void release_perfctr_nmi(unsigned int msr)
193{
194 int cpu;
195 for_each_possible_cpu (cpu) {
196 __release_perfctr_nmi(cpu, msr);
197 }
198}
199
200int __reserve_evntsel_nmi(int cpu, unsigned int msr)
164{ 201{
165 unsigned int counter; 202 unsigned int counter;
203 if (cpu < 0)
204 cpu = smp_processor_id();
166 205
167 counter = nmi_evntsel_msr_to_bit(msr); 206 counter = nmi_evntsel_msr_to_bit(msr);
168 BUG_ON(counter > NMI_MAX_COUNTER_BITS); 207 BUG_ON(counter > NMI_MAX_COUNTER_BITS);
169 208
170 if (!test_and_set_bit(counter, &__get_cpu_var(evntsel_nmi_owner)[0])) 209 if (!test_and_set_bit(counter, &per_cpu(evntsel_nmi_owner, cpu)[0]))
171 return 1; 210 return 1;
172 return 0; 211 return 0;
173} 212}
174 213
175void release_evntsel_nmi(unsigned int msr) 214static void __release_evntsel_nmi(int cpu, unsigned int msr)
176{ 215{
177 unsigned int counter; 216 unsigned int counter;
217 if (cpu < 0)
218 cpu = smp_processor_id();
178 219
179 counter = nmi_evntsel_msr_to_bit(msr); 220 counter = nmi_evntsel_msr_to_bit(msr);
180 BUG_ON(counter > NMI_MAX_COUNTER_BITS); 221 BUG_ON(counter > NMI_MAX_COUNTER_BITS);
181 222
182 clear_bit(counter, &__get_cpu_var(evntsel_nmi_owner)[0]); 223 clear_bit(counter, &per_cpu(evntsel_nmi_owner, cpu)[0]);
224}
225
226int reserve_evntsel_nmi(unsigned int msr)
227{
228 int cpu, i;
229 for_each_possible_cpu (cpu) {
230 if (!__reserve_evntsel_nmi(cpu, msr)) {
231 for_each_possible_cpu (i) {
232 if (i >= cpu)
233 break;
234 __release_evntsel_nmi(i, msr);
235 }
236 return 0;
237 }
238 }
239 return 1;
240}
241
242void release_evntsel_nmi(unsigned int msr)
243{
244 int cpu;
245 for_each_possible_cpu (cpu) {
246 __release_evntsel_nmi(cpu, msr);
247 }
183} 248}
184 249
185static __cpuinit inline int nmi_known_cpu(void) 250static __cpuinit inline int nmi_known_cpu(void)
@@ -263,7 +328,7 @@ static int __init check_nmi_watchdog(void)
263 for_each_possible_cpu(cpu) 328 for_each_possible_cpu(cpu)
264 prev_nmi_count[cpu] = per_cpu(irq_stat, cpu).__nmi_count; 329 prev_nmi_count[cpu] = per_cpu(irq_stat, cpu).__nmi_count;
265 local_irq_enable(); 330 local_irq_enable();
266 mdelay((10*1000)/nmi_hz); // wait 10 ticks 331 mdelay((20*1000)/nmi_hz); // wait 20 ticks
267 332
268 for_each_possible_cpu(cpu) { 333 for_each_possible_cpu(cpu) {
269#ifdef CONFIG_SMP 334#ifdef CONFIG_SMP
@@ -507,10 +572,10 @@ static int setup_k7_watchdog(void)
507 572
508 perfctr_msr = MSR_K7_PERFCTR0; 573 perfctr_msr = MSR_K7_PERFCTR0;
509 evntsel_msr = MSR_K7_EVNTSEL0; 574 evntsel_msr = MSR_K7_EVNTSEL0;
510 if (!reserve_perfctr_nmi(perfctr_msr)) 575 if (!__reserve_perfctr_nmi(-1, perfctr_msr))
511 goto fail; 576 goto fail;
512 577
513 if (!reserve_evntsel_nmi(evntsel_msr)) 578 if (!__reserve_evntsel_nmi(-1, evntsel_msr))
514 goto fail1; 579 goto fail1;
515 580
516 wrmsrl(perfctr_msr, 0UL); 581 wrmsrl(perfctr_msr, 0UL);
@@ -533,7 +598,7 @@ static int setup_k7_watchdog(void)
533 wd->check_bit = 1ULL<<63; 598 wd->check_bit = 1ULL<<63;
534 return 1; 599 return 1;
535fail1: 600fail1:
536 release_perfctr_nmi(perfctr_msr); 601 __release_perfctr_nmi(-1, perfctr_msr);
537fail: 602fail:
538 return 0; 603 return 0;
539} 604}
@@ -544,8 +609,8 @@ static void stop_k7_watchdog(void)
544 609
545 wrmsr(wd->evntsel_msr, 0, 0); 610 wrmsr(wd->evntsel_msr, 0, 0);
546 611
547 release_evntsel_nmi(wd->evntsel_msr); 612 __release_evntsel_nmi(-1, wd->evntsel_msr);
548 release_perfctr_nmi(wd->perfctr_msr); 613 __release_perfctr_nmi(-1, wd->perfctr_msr);
549} 614}
550 615
551#define P6_EVNTSEL0_ENABLE (1 << 22) 616#define P6_EVNTSEL0_ENABLE (1 << 22)
@@ -563,10 +628,10 @@ static int setup_p6_watchdog(void)
563 628
564 perfctr_msr = MSR_P6_PERFCTR0; 629 perfctr_msr = MSR_P6_PERFCTR0;
565 evntsel_msr = MSR_P6_EVNTSEL0; 630 evntsel_msr = MSR_P6_EVNTSEL0;
566 if (!reserve_perfctr_nmi(perfctr_msr)) 631 if (!__reserve_perfctr_nmi(-1, perfctr_msr))
567 goto fail; 632 goto fail;
568 633
569 if (!reserve_evntsel_nmi(evntsel_msr)) 634 if (!__reserve_evntsel_nmi(-1, evntsel_msr))
570 goto fail1; 635 goto fail1;
571 636
572 wrmsrl(perfctr_msr, 0UL); 637 wrmsrl(perfctr_msr, 0UL);
@@ -590,7 +655,7 @@ static int setup_p6_watchdog(void)
590 wd->check_bit = 1ULL<<39; 655 wd->check_bit = 1ULL<<39;
591 return 1; 656 return 1;
592fail1: 657fail1:
593 release_perfctr_nmi(perfctr_msr); 658 __release_perfctr_nmi(-1, perfctr_msr);
594fail: 659fail:
595 return 0; 660 return 0;
596} 661}
@@ -601,8 +666,8 @@ static void stop_p6_watchdog(void)
601 666
602 wrmsr(wd->evntsel_msr, 0, 0); 667 wrmsr(wd->evntsel_msr, 0, 0);
603 668
604 release_evntsel_nmi(wd->evntsel_msr); 669 __release_evntsel_nmi(-1, wd->evntsel_msr);
605 release_perfctr_nmi(wd->perfctr_msr); 670 __release_perfctr_nmi(-1, wd->perfctr_msr);
606} 671}
607 672
608/* Note that these events don't tick when the CPU idles. This means 673/* Note that these events don't tick when the CPU idles. This means
@@ -668,10 +733,10 @@ static int setup_p4_watchdog(void)
668 cccr_val = P4_CCCR_OVF_PMI1 | P4_CCCR_ESCR_SELECT(4); 733 cccr_val = P4_CCCR_OVF_PMI1 | P4_CCCR_ESCR_SELECT(4);
669 } 734 }
670 735
671 if (!reserve_perfctr_nmi(perfctr_msr)) 736 if (!__reserve_perfctr_nmi(-1, perfctr_msr))
672 goto fail; 737 goto fail;
673 738
674 if (!reserve_evntsel_nmi(evntsel_msr)) 739 if (!__reserve_evntsel_nmi(-1, evntsel_msr))
675 goto fail1; 740 goto fail1;
676 741
677 evntsel = P4_ESCR_EVENT_SELECT(0x3F) 742 evntsel = P4_ESCR_EVENT_SELECT(0x3F)
@@ -695,7 +760,7 @@ static int setup_p4_watchdog(void)
695 wd->check_bit = 1ULL<<39; 760 wd->check_bit = 1ULL<<39;
696 return 1; 761 return 1;
697fail1: 762fail1:
698 release_perfctr_nmi(perfctr_msr); 763 __release_perfctr_nmi(-1, perfctr_msr);
699fail: 764fail:
700 return 0; 765 return 0;
701} 766}
@@ -707,8 +772,8 @@ static void stop_p4_watchdog(void)
707 wrmsr(wd->cccr_msr, 0, 0); 772 wrmsr(wd->cccr_msr, 0, 0);
708 wrmsr(wd->evntsel_msr, 0, 0); 773 wrmsr(wd->evntsel_msr, 0, 0);
709 774
710 release_evntsel_nmi(wd->evntsel_msr); 775 __release_evntsel_nmi(-1, wd->evntsel_msr);
711 release_perfctr_nmi(wd->perfctr_msr); 776 __release_perfctr_nmi(-1, wd->perfctr_msr);
712} 777}
713 778
714#define ARCH_PERFMON_NMI_EVENT_SEL ARCH_PERFMON_UNHALTED_CORE_CYCLES_SEL 779#define ARCH_PERFMON_NMI_EVENT_SEL ARCH_PERFMON_UNHALTED_CORE_CYCLES_SEL
@@ -736,10 +801,10 @@ static int setup_intel_arch_watchdog(void)
736 perfctr_msr = MSR_ARCH_PERFMON_PERFCTR0; 801 perfctr_msr = MSR_ARCH_PERFMON_PERFCTR0;
737 evntsel_msr = MSR_ARCH_PERFMON_EVENTSEL0; 802 evntsel_msr = MSR_ARCH_PERFMON_EVENTSEL0;
738 803
739 if (!reserve_perfctr_nmi(perfctr_msr)) 804 if (!__reserve_perfctr_nmi(-1, perfctr_msr))
740 goto fail; 805 goto fail;
741 806
742 if (!reserve_evntsel_nmi(evntsel_msr)) 807 if (!__reserve_evntsel_nmi(-1, evntsel_msr))
743 goto fail1; 808 goto fail1;
744 809
745 wrmsrl(perfctr_msr, 0UL); 810 wrmsrl(perfctr_msr, 0UL);
@@ -764,7 +829,7 @@ static int setup_intel_arch_watchdog(void)
764 wd->check_bit = 1ULL << (eax.split.bit_width - 1); 829 wd->check_bit = 1ULL << (eax.split.bit_width - 1);
765 return 1; 830 return 1;
766fail1: 831fail1:
767 release_perfctr_nmi(perfctr_msr); 832 __release_perfctr_nmi(-1, perfctr_msr);
768fail: 833fail:
769 return 0; 834 return 0;
770} 835}
@@ -787,8 +852,8 @@ static void stop_intel_arch_watchdog(void)
787 return; 852 return;
788 853
789 wrmsr(wd->evntsel_msr, 0, 0); 854 wrmsr(wd->evntsel_msr, 0, 0);
790 release_evntsel_nmi(wd->evntsel_msr); 855 __release_evntsel_nmi(-1, wd->evntsel_msr);
791 release_perfctr_nmi(wd->perfctr_msr); 856 __release_perfctr_nmi(-1, wd->perfctr_msr);
792} 857}
793 858
794void setup_apic_nmi_watchdog (void *unused) 859void setup_apic_nmi_watchdog (void *unused)
diff --git a/arch/i386/kernel/tsc.c b/arch/i386/kernel/tsc.c
index 0e65f7ab63a2..6cb8f5336732 100644
--- a/arch/i386/kernel/tsc.c
+++ b/arch/i386/kernel/tsc.c
@@ -18,6 +18,8 @@
18 18
19#include "mach_timer.h" 19#include "mach_timer.h"
20 20
21static int tsc_enabled;
22
21/* 23/*
22 * On some systems the TSC frequency does not 24 * On some systems the TSC frequency does not
23 * change with the cpu frequency. So we need 25 * change with the cpu frequency. So we need
@@ -105,7 +107,7 @@ unsigned long long sched_clock(void)
105 /* 107 /*
106 * Fall back to jiffies if there's no TSC available: 108 * Fall back to jiffies if there's no TSC available:
107 */ 109 */
108 if (tsc_unstable || unlikely(tsc_disable)) 110 if (unlikely(!tsc_enabled))
109 /* No locking but a rare wrong value is not a big deal: */ 111 /* No locking but a rare wrong value is not a big deal: */
110 return (jiffies_64 - INITIAL_JIFFIES) * (1000000000 / HZ); 112 return (jiffies_64 - INITIAL_JIFFIES) * (1000000000 / HZ);
111 113
@@ -283,6 +285,7 @@ void mark_tsc_unstable(void)
283{ 285{
284 if (!tsc_unstable) { 286 if (!tsc_unstable) {
285 tsc_unstable = 1; 287 tsc_unstable = 1;
288 tsc_enabled = 0;
286 /* Can be called before registration */ 289 /* Can be called before registration */
287 if (clocksource_tsc.mult) 290 if (clocksource_tsc.mult)
288 clocksource_change_rating(&clocksource_tsc, 0); 291 clocksource_change_rating(&clocksource_tsc, 0);
@@ -383,7 +386,9 @@ void __init tsc_init(void)
383 if (check_tsc_unstable()) { 386 if (check_tsc_unstable()) {
384 clocksource_tsc.rating = 0; 387 clocksource_tsc.rating = 0;
385 clocksource_tsc.flags &= ~CLOCK_SOURCE_IS_CONTINUOUS; 388 clocksource_tsc.flags &= ~CLOCK_SOURCE_IS_CONTINUOUS;
386 } 389 } else
390 tsc_enabled = 1;
391
387 clocksource_register(&clocksource_tsc); 392 clocksource_register(&clocksource_tsc);
388 393
389 return; 394 return;
diff --git a/arch/i386/kernel/vmi.c b/arch/i386/kernel/vmi.c
index fb07a1aad225..edc339fa5038 100644
--- a/arch/i386/kernel/vmi.c
+++ b/arch/i386/kernel/vmi.c
@@ -69,6 +69,7 @@ struct {
69 void (*flush_tlb)(int); 69 void (*flush_tlb)(int);
70 void (*set_initial_ap_state)(int, int); 70 void (*set_initial_ap_state)(int, int);
71 void (*halt)(void); 71 void (*halt)(void);
72 void (*set_lazy_mode)(int mode);
72} vmi_ops; 73} vmi_ops;
73 74
74/* XXX move this to alternative.h */ 75/* XXX move this to alternative.h */
@@ -574,6 +575,26 @@ vmi_startup_ipi_hook(int phys_apicid, unsigned long start_eip,
574} 575}
575#endif 576#endif
576 577
578static void vmi_set_lazy_mode(int mode)
579{
580 static DEFINE_PER_CPU(int, lazy_mode);
581
582 if (!vmi_ops.set_lazy_mode)
583 return;
584
585 /* Modes should never nest or overlap */
586 BUG_ON(__get_cpu_var(lazy_mode) && !(mode == PARAVIRT_LAZY_NONE ||
587 mode == PARAVIRT_LAZY_FLUSH));
588
589 if (mode == PARAVIRT_LAZY_FLUSH) {
590 vmi_ops.set_lazy_mode(0);
591 vmi_ops.set_lazy_mode(__get_cpu_var(lazy_mode));
592 } else {
593 vmi_ops.set_lazy_mode(mode);
594 __get_cpu_var(lazy_mode) = mode;
595 }
596}
597
577static inline int __init check_vmi_rom(struct vrom_header *rom) 598static inline int __init check_vmi_rom(struct vrom_header *rom)
578{ 599{
579 struct pci_header *pci; 600 struct pci_header *pci;
@@ -804,7 +825,7 @@ static inline int __init activate_vmi(void)
804 para_wrap(load_esp0, vmi_load_esp0, set_kernel_stack, UpdateKernelStack); 825 para_wrap(load_esp0, vmi_load_esp0, set_kernel_stack, UpdateKernelStack);
805 para_fill(set_iopl_mask, SetIOPLMask); 826 para_fill(set_iopl_mask, SetIOPLMask);
806 para_fill(io_delay, IODelay); 827 para_fill(io_delay, IODelay);
807 para_fill(set_lazy_mode, SetLazyMode); 828 para_wrap(set_lazy_mode, vmi_set_lazy_mode, set_lazy_mode, SetLazyMode);
808 829
809 /* user and kernel flush are just handled with different flags to FlushTLB */ 830 /* user and kernel flush are just handled with different flags to FlushTLB */
810 para_wrap(flush_tlb_user, vmi_flush_tlb_user, flush_tlb, FlushTLB); 831 para_wrap(flush_tlb_user, vmi_flush_tlb_user, flush_tlb, FlushTLB);
diff --git a/arch/i386/lib/usercopy.c b/arch/i386/lib/usercopy.c
index d22cfc9d656c..086b3726862a 100644
--- a/arch/i386/lib/usercopy.c
+++ b/arch/i386/lib/usercopy.c
@@ -10,6 +10,7 @@
10#include <linux/blkdev.h> 10#include <linux/blkdev.h>
11#include <linux/module.h> 11#include <linux/module.h>
12#include <linux/backing-dev.h> 12#include <linux/backing-dev.h>
13#include <linux/interrupt.h>
13#include <asm/uaccess.h> 14#include <asm/uaccess.h>
14#include <asm/mmx.h> 15#include <asm/mmx.h>
15 16
@@ -719,6 +720,14 @@ unsigned long __copy_to_user_ll(void __user *to, const void *from,
719#ifndef CONFIG_X86_WP_WORKS_OK 720#ifndef CONFIG_X86_WP_WORKS_OK
720 if (unlikely(boot_cpu_data.wp_works_ok == 0) && 721 if (unlikely(boot_cpu_data.wp_works_ok == 0) &&
721 ((unsigned long )to) < TASK_SIZE) { 722 ((unsigned long )to) < TASK_SIZE) {
723 /*
724 * When we are in an atomic section (see
725 * mm/filemap.c:file_read_actor), return the full
726 * length to take the slow path.
727 */
728 if (in_atomic())
729 return n;
730
722 /* 731 /*
723 * CPU does not honor the WP bit when writing 732 * CPU does not honor the WP bit when writing
724 * from supervisory mode, and due to preemption or SMP, 733 * from supervisory mode, and due to preemption or SMP,
diff --git a/arch/i386/mm/highmem.c b/arch/i386/mm/highmem.c
index bb2de1089add..ac70d09df7ee 100644
--- a/arch/i386/mm/highmem.c
+++ b/arch/i386/mm/highmem.c
@@ -42,6 +42,7 @@ void *kmap_atomic(struct page *page, enum km_type type)
42 42
43 vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx); 43 vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx);
44 set_pte(kmap_pte-idx, mk_pte(page, kmap_prot)); 44 set_pte(kmap_pte-idx, mk_pte(page, kmap_prot));
45 arch_flush_lazy_mmu_mode();
45 46
46 return (void*) vaddr; 47 return (void*) vaddr;
47} 48}
@@ -82,6 +83,7 @@ void *kmap_atomic_pfn(unsigned long pfn, enum km_type type)
82 idx = type + KM_TYPE_NR*smp_processor_id(); 83 idx = type + KM_TYPE_NR*smp_processor_id();
83 vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx); 84 vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx);
84 set_pte(kmap_pte-idx, pfn_pte(pfn, kmap_prot)); 85 set_pte(kmap_pte-idx, pfn_pte(pfn, kmap_prot));
86 arch_flush_lazy_mmu_mode();
85 87
86 return (void*) vaddr; 88 return (void*) vaddr;
87} 89}
diff --git a/arch/i386/pci/common.c b/arch/i386/pci/common.c
index 1bb069372143..3f78d4d8ecf3 100644
--- a/arch/i386/pci/common.c
+++ b/arch/i386/pci/common.c
@@ -193,6 +193,14 @@ static struct dmi_system_id __devinitdata pciprobe_dmi_table[] = {
193 }, 193 },
194 { 194 {
195 .callback = set_bf_sort, 195 .callback = set_bf_sort,
196 .ident = "Dell PowerEdge R900",
197 .matches = {
198 DMI_MATCH(DMI_SYS_VENDOR, "Dell"),
199 DMI_MATCH(DMI_PRODUCT_NAME, "PowerEdge R900"),
200 },
201 },
202 {
203 .callback = set_bf_sort,
196 .ident = "HP ProLiant BL20p G3", 204 .ident = "HP ProLiant BL20p G3",
197 .matches = { 205 .matches = {
198 DMI_MATCH(DMI_SYS_VENDOR, "HP"), 206 DMI_MATCH(DMI_SYS_VENDOR, "HP"),
@@ -426,11 +434,13 @@ int pcibios_enable_device(struct pci_dev *dev, int mask)
426 if ((err = pcibios_enable_resources(dev, mask)) < 0) 434 if ((err = pcibios_enable_resources(dev, mask)) < 0)
427 return err; 435 return err;
428 436
429 return pcibios_enable_irq(dev); 437 if (!dev->msi_enabled)
438 return pcibios_enable_irq(dev);
439 return 0;
430} 440}
431 441
432void pcibios_disable_device (struct pci_dev *dev) 442void pcibios_disable_device (struct pci_dev *dev)
433{ 443{
434 if (pcibios_disable_irq) 444 if (!dev->msi_enabled && pcibios_disable_irq)
435 pcibios_disable_irq(dev); 445 pcibios_disable_irq(dev);
436} 446}
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index d51f0f11f7f9..e19185d26554 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -13,6 +13,7 @@ config IA64
13 bool 13 bool
14 select PCI if (!IA64_HP_SIM) 14 select PCI if (!IA64_HP_SIM)
15 select ACPI if (!IA64_HP_SIM) 15 select ACPI if (!IA64_HP_SIM)
16 select PM if (!IA64_HP_SIM)
16 default y 17 default y
17 help 18 help
18 The Itanium Processor Family is Intel's 64-bit successor to 19 The Itanium Processor Family is Intel's 64-bit successor to
diff --git a/arch/ia64/kernel/msi_ia64.c b/arch/ia64/kernel/msi_ia64.c
index e7220900ea14..ebbeadfee42d 100644
--- a/arch/ia64/kernel/msi_ia64.c
+++ b/arch/ia64/kernel/msi_ia64.c
@@ -68,7 +68,7 @@ int ia64_setup_msi_irq(struct pci_dev *pdev, struct msi_desc *desc)
68{ 68{
69 struct msi_msg msg; 69 struct msi_msg msg;
70 unsigned long dest_phys_id; 70 unsigned long dest_phys_id;
71 unsigned int irq, vector; 71 int irq, vector;
72 72
73 irq = create_irq(); 73 irq = create_irq();
74 if (irq < 0) 74 if (irq < 0)
diff --git a/arch/ia64/kernel/smpboot.c b/arch/ia64/kernel/smpboot.c
index b21ddecea943..ff7df439da6d 100644
--- a/arch/ia64/kernel/smpboot.c
+++ b/arch/ia64/kernel/smpboot.c
@@ -375,6 +375,7 @@ static void __devinit
375smp_callin (void) 375smp_callin (void)
376{ 376{
377 int cpuid, phys_id, itc_master; 377 int cpuid, phys_id, itc_master;
378 struct cpuinfo_ia64 *last_cpuinfo, *this_cpuinfo;
378 extern void ia64_init_itm(void); 379 extern void ia64_init_itm(void);
379 extern volatile int time_keeper_id; 380 extern volatile int time_keeper_id;
380 381
@@ -424,7 +425,21 @@ smp_callin (void)
424 * Get our bogomips. 425 * Get our bogomips.
425 */ 426 */
426 ia64_init_itm(); 427 ia64_init_itm();
427 calibrate_delay(); 428
429 /*
430 * Delay calibration can be skipped if new processor is identical to the
431 * previous processor.
432 */
433 last_cpuinfo = cpu_data(cpuid - 1);
434 this_cpuinfo = local_cpu_data;
435 if (last_cpuinfo->itc_freq != this_cpuinfo->itc_freq ||
436 last_cpuinfo->proc_freq != this_cpuinfo->proc_freq ||
437 last_cpuinfo->features != this_cpuinfo->features ||
438 last_cpuinfo->revision != this_cpuinfo->revision ||
439 last_cpuinfo->family != this_cpuinfo->family ||
440 last_cpuinfo->archrev != this_cpuinfo->archrev ||
441 last_cpuinfo->model != this_cpuinfo->model)
442 calibrate_delay();
428 local_cpu_data->loops_per_jiffy = loops_per_jiffy; 443 local_cpu_data->loops_per_jiffy = loops_per_jiffy;
429 444
430#ifdef CONFIG_IA32_SUPPORT 445#ifdef CONFIG_IA32_SUPPORT
diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c
index c8da621aab17..4f36987eea72 100644
--- a/arch/ia64/mm/init.c
+++ b/arch/ia64/mm/init.c
@@ -155,7 +155,7 @@ ia64_set_rbs_bot (void)
155 155
156 if (stack_size > MAX_USER_STACK_SIZE) 156 if (stack_size > MAX_USER_STACK_SIZE)
157 stack_size = MAX_USER_STACK_SIZE; 157 stack_size = MAX_USER_STACK_SIZE;
158 current->thread.rbs_bot = STACK_TOP - stack_size; 158 current->thread.rbs_bot = PAGE_ALIGN(current->mm->start_stack - stack_size);
159} 159}
160 160
161/* 161/*
diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c
index 474d179966dc..0e83f3b419b5 100644
--- a/arch/ia64/pci/pci.c
+++ b/arch/ia64/pci/pci.c
@@ -557,14 +557,17 @@ pcibios_enable_device (struct pci_dev *dev, int mask)
557 if (ret < 0) 557 if (ret < 0)
558 return ret; 558 return ret;
559 559
560 return acpi_pci_irq_enable(dev); 560 if (!dev->msi_enabled)
561 return acpi_pci_irq_enable(dev);
562 return 0;
561} 563}
562 564
563void 565void
564pcibios_disable_device (struct pci_dev *dev) 566pcibios_disable_device (struct pci_dev *dev)
565{ 567{
566 BUG_ON(atomic_read(&dev->enable_cnt)); 568 BUG_ON(atomic_read(&dev->enable_cnt));
567 acpi_pci_irq_disable(dev); 569 if (!dev->msi_enabled)
570 acpi_pci_irq_disable(dev);
568} 571}
569 572
570void 573void
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 656f0ca52782..c78b14380b3e 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -1606,7 +1606,7 @@ config MIPS_MT_FPAFF
1606 1606
1607config MIPS_MT_SMTC_INSTANT_REPLAY 1607config MIPS_MT_SMTC_INSTANT_REPLAY
1608 bool "Low-latency Dispatch of Deferred SMTC IPIs" 1608 bool "Low-latency Dispatch of Deferred SMTC IPIs"
1609 depends on MIPS_MT_SMTC 1609 depends on MIPS_MT_SMTC && !PREEMPT
1610 default y 1610 default y
1611 help 1611 help
1612 SMTC pseudo-interrupts between TCs are deferred and queued 1612 SMTC pseudo-interrupts between TCs are deferred and queued
diff --git a/arch/mips/gt64120/momenco_ocelot/prom.c b/arch/mips/gt64120/momenco_ocelot/prom.c
index 78f393b2afd9..c71c85276c74 100644
--- a/arch/mips/gt64120/momenco_ocelot/prom.c
+++ b/arch/mips/gt64120/momenco_ocelot/prom.c
@@ -32,7 +32,6 @@ void __init prom_init(void)
32 char **arg = (char **) fw_arg1; 32 char **arg = (char **) fw_arg1;
33 char **env = (char **) fw_arg2; 33 char **env = (char **) fw_arg2;
34 struct callvectors *cv = (struct callvectors *) fw_arg3; 34 struct callvectors *cv = (struct callvectors *) fw_arg3;
35 uint32_t tmp;
36 int i; 35 int i;
37 36
38 /* save the PROM vectors for debugging use */ 37 /* save the PROM vectors for debugging use */
diff --git a/arch/mips/gt64120/momenco_ocelot/setup.c b/arch/mips/gt64120/momenco_ocelot/setup.c
index 94f94ebbda6c..98b6fb38096d 100644
--- a/arch/mips/gt64120/momenco_ocelot/setup.c
+++ b/arch/mips/gt64120/momenco_ocelot/setup.c
@@ -79,7 +79,7 @@ static char reset_reason;
79static void __init setup_l3cache(unsigned long size); 79static void __init setup_l3cache(unsigned long size);
80 80
81/* setup code for a handoff from a version 1 PMON 2000 PROM */ 81/* setup code for a handoff from a version 1 PMON 2000 PROM */
82void PMON_v1_setup() 82static void PMON_v1_setup(void)
83{ 83{
84 /* A wired TLB entry for the GT64120A and the serial port. The 84 /* A wired TLB entry for the GT64120A and the serial port. The
85 GT64120A is going to be hit on every IRQ anyway - there's 85 GT64120A is going to be hit on every IRQ anyway - there's
diff --git a/arch/mips/jazz/jazzdma.c b/arch/mips/jazz/jazzdma.c
index 46e421e14348..e8e0ffb9354d 100644
--- a/arch/mips/jazz/jazzdma.c
+++ b/arch/mips/jazz/jazzdma.c
@@ -67,7 +67,8 @@ void __init vdma_init(void)
67 * aligned and should be uncached to avoid cache flushing after every 67 * aligned and should be uncached to avoid cache flushing after every
68 * update. 68 * update.
69 */ 69 */
70 vdma_pagetable_start = alloc_bootmem_low_pages(VDMA_PGTBL_SIZE); 70 vdma_pagetable_start =
71 (unsigned long) alloc_bootmem_low_pages(VDMA_PGTBL_SIZE);
71 if (!vdma_pagetable_start) 72 if (!vdma_pagetable_start)
72 BUG(); 73 BUG();
73 dma_cache_wback_inv(vdma_pagetable_start, VDMA_PGTBL_SIZE); 74 dma_cache_wback_inv(vdma_pagetable_start, VDMA_PGTBL_SIZE);
diff --git a/arch/mips/kernel/entry.S b/arch/mips/kernel/entry.S
index 0b78fcbf044a..686249c5c328 100644
--- a/arch/mips/kernel/entry.S
+++ b/arch/mips/kernel/entry.S
@@ -121,7 +121,11 @@ FEXPORT(restore_partial) # restore partial frame
121 SAVE_AT 121 SAVE_AT
122 SAVE_TEMP 122 SAVE_TEMP
123 LONG_L v0, PT_STATUS(sp) 123 LONG_L v0, PT_STATUS(sp)
124 and v0, 1 124#if defined(CONFIG_CPU_R3000) || defined(CONFIG_CPU_TX39XX)
125 and v0, ST0_IEP
126#else
127 and v0, ST0_IE
128#endif
125 beqz v0, 1f 129 beqz v0, 1f
126 jal trace_hardirqs_on 130 jal trace_hardirqs_on
127 b 2f 131 b 2f
diff --git a/arch/mips/kernel/genex.S b/arch/mips/kernel/genex.S
index 83843a229be7..297bd56c2347 100644
--- a/arch/mips/kernel/genex.S
+++ b/arch/mips/kernel/genex.S
@@ -128,6 +128,37 @@ handle_vcei:
128 128
129 .align 5 129 .align 5
130NESTED(handle_int, PT_SIZE, sp) 130NESTED(handle_int, PT_SIZE, sp)
131#ifdef CONFIG_TRACE_IRQFLAGS
132 /*
133 * Check to see if the interrupted code has just disabled
134 * interrupts and ignore this interrupt for now if so.
135 *
136 * local_irq_disable() disables interrupts and then calls
137 * trace_hardirqs_off() to track the state. If an interrupt is taken
138 * after interrupts are disabled but before the state is updated
139 * it will appear to restore_all that it is incorrectly returning with
140 * interrupts disabled
141 */
142 .set push
143 .set noat
144 mfc0 k0, CP0_STATUS
145#if defined(CONFIG_CPU_R3000) || defined(CONFIG_CPU_TX39XX)
146 and k0, ST0_IEP
147 bnez k0, 1f
148
149 mfc0 k0, EP0_EPC
150 .set noreorder
151 j k0
152 rfe
153#else
154 and k0, ST0_IE
155 bnez k0, 1f
156
157 eret
158#endif
1591:
160 .set pop
161#endif
131 SAVE_ALL 162 SAVE_ALL
132 CLI 163 CLI
133 TRACE_IRQS_OFF 164 TRACE_IRQS_OFF
diff --git a/arch/mips/kernel/smtc.c b/arch/mips/kernel/smtc.c
index f253eda27fa3..5dcfab6b288e 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/kernel_stat.h>
7#include <linux/module.h> 8#include <linux/module.h>
8 9
9#include <asm/cpu.h> 10#include <asm/cpu.h>
@@ -14,6 +15,7 @@
14#include <asm/hazards.h> 15#include <asm/hazards.h>
15#include <asm/mmu_context.h> 16#include <asm/mmu_context.h>
16#include <asm/smp.h> 17#include <asm/smp.h>
18#include <asm/mips-boards/maltaint.h>
17#include <asm/mipsregs.h> 19#include <asm/mipsregs.h>
18#include <asm/cacheflush.h> 20#include <asm/cacheflush.h>
19#include <asm/time.h> 21#include <asm/time.h>
@@ -75,7 +77,7 @@ static struct smtc_ipi_q freeIPIq;
75 77
76void ipi_decode(struct smtc_ipi *); 78void ipi_decode(struct smtc_ipi *);
77static void post_direct_ipi(int cpu, struct smtc_ipi *pipi); 79static void post_direct_ipi(int cpu, struct smtc_ipi *pipi);
78static void setup_cross_vpe_interrupts(void); 80static void setup_cross_vpe_interrupts(unsigned int nvpe);
79void init_smtc_stats(void); 81void init_smtc_stats(void);
80 82
81/* Global SMTC Status */ 83/* Global SMTC Status */
@@ -168,7 +170,10 @@ __setup("tintq=", tintq);
168 170
169int imstuckcount[2][8]; 171int imstuckcount[2][8];
170/* vpemask represents IM/IE bits of per-VPE Status registers, low-to-high */ 172/* vpemask represents IM/IE bits of per-VPE Status registers, low-to-high */
171int vpemask[2][8] = {{0,1,1,0,0,0,0,1},{0,1,0,0,0,0,0,1}}; 173int vpemask[2][8] = {
174 {0, 0, 1, 0, 0, 0, 0, 1},
175 {0, 0, 0, 0, 0, 0, 0, 1}
176};
172int tcnoprog[NR_CPUS]; 177int tcnoprog[NR_CPUS];
173static atomic_t idle_hook_initialized = {0}; 178static atomic_t idle_hook_initialized = {0};
174static int clock_hang_reported[NR_CPUS]; 179static int clock_hang_reported[NR_CPUS];
@@ -501,8 +506,7 @@ void mipsmt_prepare_cpus(void)
501 506
502 /* If we have multiple VPEs running, set up the cross-VPE interrupt */ 507 /* If we have multiple VPEs running, set up the cross-VPE interrupt */
503 508
504 if (nvpe > 1) 509 setup_cross_vpe_interrupts(nvpe);
505 setup_cross_vpe_interrupts();
506 510
507 /* Set up queue of free IPI "messages". */ 511 /* Set up queue of free IPI "messages". */
508 nipi = NR_CPUS * IPIBUF_PER_CPU; 512 nipi = NR_CPUS * IPIBUF_PER_CPU;
@@ -607,7 +611,12 @@ void smtc_cpus_done(void)
607int setup_irq_smtc(unsigned int irq, struct irqaction * new, 611int setup_irq_smtc(unsigned int irq, struct irqaction * new,
608 unsigned long hwmask) 612 unsigned long hwmask)
609{ 613{
614 unsigned int vpe = current_cpu_data.vpe_id;
615
610 irq_hwmask[irq] = hwmask; 616 irq_hwmask[irq] = hwmask;
617#ifdef CONFIG_SMTC_IDLE_HOOK_DEBUG
618 vpemask[vpe][irq - MIPSCPU_INT_BASE] = 1;
619#endif
611 620
612 return setup_irq(irq, new); 621 return setup_irq(irq, new);
613} 622}
@@ -812,12 +821,15 @@ void ipi_decode(struct smtc_ipi *pipi)
812 smtc_ipi_nq(&freeIPIq, pipi); 821 smtc_ipi_nq(&freeIPIq, pipi);
813 switch (type_copy) { 822 switch (type_copy) {
814 case SMTC_CLOCK_TICK: 823 case SMTC_CLOCK_TICK:
824 irq_enter();
825 kstat_this_cpu.irqs[MIPSCPU_INT_BASE + MIPSCPU_INT_CPUCTR]++;
815 /* Invoke Clock "Interrupt" */ 826 /* Invoke Clock "Interrupt" */
816 ipi_timer_latch[dest_copy] = 0; 827 ipi_timer_latch[dest_copy] = 0;
817#ifdef CONFIG_SMTC_IDLE_HOOK_DEBUG 828#ifdef CONFIG_SMTC_IDLE_HOOK_DEBUG
818 clock_hang_reported[dest_copy] = 0; 829 clock_hang_reported[dest_copy] = 0;
819#endif /* CONFIG_SMTC_IDLE_HOOK_DEBUG */ 830#endif /* CONFIG_SMTC_IDLE_HOOK_DEBUG */
820 local_timer_interrupt(0, NULL); 831 local_timer_interrupt(0, NULL);
832 irq_exit();
821 break; 833 break;
822 case LINUX_SMP_IPI: 834 case LINUX_SMP_IPI:
823 switch ((int)arg_copy) { 835 switch ((int)arg_copy) {
@@ -965,8 +977,11 @@ static void ipi_irq_dispatch(void)
965 977
966static struct irqaction irq_ipi; 978static struct irqaction irq_ipi;
967 979
968static void setup_cross_vpe_interrupts(void) 980static void setup_cross_vpe_interrupts(unsigned int nvpe)
969{ 981{
982 if (nvpe < 1)
983 return;
984
970 if (!cpu_has_vint) 985 if (!cpu_has_vint)
971 panic("SMTC Kernel requires Vectored Interupt support"); 986 panic("SMTC Kernel requires Vectored Interupt support");
972 987
@@ -984,10 +999,17 @@ static void setup_cross_vpe_interrupts(void)
984 999
985/* 1000/*
986 * SMTC-specific hacks invoked from elsewhere in the kernel. 1001 * SMTC-specific hacks invoked from elsewhere in the kernel.
1002 *
1003 * smtc_ipi_replay is called from raw_local_irq_restore which is only ever
1004 * called with interrupts disabled. We do rely on interrupts being disabled
1005 * here because using spin_lock_irqsave()/spin_unlock_irqrestore() would
1006 * result in a recursive call to raw_local_irq_restore().
987 */ 1007 */
988 1008
989void smtc_ipi_replay(void) 1009static void __smtc_ipi_replay(void)
990{ 1010{
1011 unsigned int cpu = smp_processor_id();
1012
991 /* 1013 /*
992 * To the extent that we've ever turned interrupts off, 1014 * To the extent that we've ever turned interrupts off,
993 * we may have accumulated deferred IPIs. This is subtle. 1015 * we may have accumulated deferred IPIs. This is subtle.
@@ -1002,17 +1024,30 @@ void smtc_ipi_replay(void)
1002 * is clear, and we'll handle it as a real pseudo-interrupt 1024 * is clear, and we'll handle it as a real pseudo-interrupt
1003 * and not a pseudo-pseudo interrupt. 1025 * and not a pseudo-pseudo interrupt.
1004 */ 1026 */
1005 if (IPIQ[smp_processor_id()].depth > 0) { 1027 if (IPIQ[cpu].depth > 0) {
1006 struct smtc_ipi *pipi; 1028 while (1) {
1007 extern void self_ipi(struct smtc_ipi *); 1029 struct smtc_ipi_q *q = &IPIQ[cpu];
1030 struct smtc_ipi *pipi;
1031 extern void self_ipi(struct smtc_ipi *);
1032
1033 spin_lock(&q->lock);
1034 pipi = __smtc_ipi_dq(q);
1035 spin_unlock(&q->lock);
1036 if (!pipi)
1037 break;
1008 1038
1009 while ((pipi = smtc_ipi_dq(&IPIQ[smp_processor_id()]))) {
1010 self_ipi(pipi); 1039 self_ipi(pipi);
1011 smtc_cpu_stats[smp_processor_id()].selfipis++; 1040 smtc_cpu_stats[cpu].selfipis++;
1012 } 1041 }
1013 } 1042 }
1014} 1043}
1015 1044
1045void smtc_ipi_replay(void)
1046{
1047 raw_local_irq_disable();
1048 __smtc_ipi_replay();
1049}
1050
1016EXPORT_SYMBOL(smtc_ipi_replay); 1051EXPORT_SYMBOL(smtc_ipi_replay);
1017 1052
1018void smtc_idle_loop_hook(void) 1053void smtc_idle_loop_hook(void)
@@ -1117,7 +1152,13 @@ void smtc_idle_loop_hook(void)
1117 * is in use, there should never be any. 1152 * is in use, there should never be any.
1118 */ 1153 */
1119#ifndef CONFIG_MIPS_MT_SMTC_INSTANT_REPLAY 1154#ifndef CONFIG_MIPS_MT_SMTC_INSTANT_REPLAY
1120 smtc_ipi_replay(); 1155 {
1156 unsigned long flags;
1157
1158 local_irq_save(flags);
1159 __smtc_ipi_replay();
1160 local_irq_restore(flags);
1161 }
1121#endif /* CONFIG_MIPS_MT_SMTC_INSTANT_REPLAY */ 1162#endif /* CONFIG_MIPS_MT_SMTC_INSTANT_REPLAY */
1122} 1163}
1123 1164
diff --git a/arch/mips/mm/c-r3k.c b/arch/mips/mm/c-r3k.c
index d1af42c2a52e..59868a1edf66 100644
--- a/arch/mips/mm/c-r3k.c
+++ b/arch/mips/mm/c-r3k.c
@@ -260,7 +260,7 @@ static void r3k_flush_cache_page(struct vm_area_struct *vma, unsigned long page,
260{ 260{
261} 261}
262 262
263static void local_r3k_flush_data_cache_page(unsigned long addr) 263static void local_r3k_flush_data_cache_page(void *addr)
264{ 264{
265} 265}
266 266
diff --git a/arch/mips/mm/cache.c b/arch/mips/mm/cache.c
index 31819c58bffa..4e8f1b683376 100644
--- a/arch/mips/mm/cache.c
+++ b/arch/mips/mm/cache.c
@@ -3,7 +3,8 @@
3 * License. See the file "COPYING" in the main directory of this archive 3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details. 4 * for more details.
5 * 5 *
6 * Copyright (C) 1994 - 2003 by Ralf Baechle 6 * Copyright (C) 1994 - 2003, 07 by Ralf Baechle (ralf@linux-mips.org)
7 * Copyright (C) 2007 MIPS Technologies, Inc.
7 */ 8 */
8#include <linux/init.h> 9#include <linux/init.h>
9#include <linux/kernel.h> 10#include <linux/kernel.h>
@@ -88,6 +89,19 @@ void __flush_dcache_page(struct page *page)
88 89
89EXPORT_SYMBOL(__flush_dcache_page); 90EXPORT_SYMBOL(__flush_dcache_page);
90 91
92void __flush_anon_page(struct page *page, unsigned long vmaddr)
93{
94 if (pages_do_alias((unsigned long)page_address(page), vmaddr)) {
95 void *kaddr;
96
97 kaddr = kmap_coherent(page, vmaddr);
98 flush_data_cache_page((unsigned long)kaddr);
99 kunmap_coherent(kaddr);
100 }
101}
102
103EXPORT_SYMBOL(__flush_anon_page);
104
91void __update_cache(struct vm_area_struct *vma, unsigned long address, 105void __update_cache(struct vm_area_struct *vma, unsigned long address,
92 pte_t pte) 106 pte_t pte)
93{ 107{
diff --git a/arch/mips/mm/cerr-sb1.c b/arch/mips/mm/cerr-sb1.c
index 11a916629d3b..4c72e650f9b6 100644
--- a/arch/mips/mm/cerr-sb1.c
+++ b/arch/mips/mm/cerr-sb1.c
@@ -177,8 +177,8 @@ extern void check_bus_watcher(void);
177 177
178asmlinkage void sb1_cache_error(void) 178asmlinkage void sb1_cache_error(void)
179{ 179{
180 uint64_t cerr_dpa;
181 uint32_t errctl, cerr_i, cerr_d, dpalo, dpahi, eepc, res; 180 uint32_t errctl, cerr_i, cerr_d, dpalo, dpahi, eepc, res;
181 unsigned long long cerr_dpa;
182 182
183#ifdef CONFIG_SIBYTE_BW_TRACE 183#ifdef CONFIG_SIBYTE_BW_TRACE
184 /* Freeze the trace buffer now */ 184 /* Freeze the trace buffer now */
@@ -329,8 +329,9 @@ static uint32_t extract_ic(unsigned short addr, int data)
329{ 329{
330 unsigned short way; 330 unsigned short way;
331 int valid; 331 int valid;
332 uint64_t taglo, va, tlo_tmp;
333 uint32_t taghi, taglolo, taglohi; 332 uint32_t taghi, taglolo, taglohi;
333 unsigned long long taglo, va;
334 uint64_t tlo_tmp;
334 uint8_t lru; 335 uint8_t lru;
335 int res = 0; 336 int res = 0;
336 337
@@ -484,8 +485,8 @@ static uint32_t extract_dc(unsigned short addr, int data)
484{ 485{
485 int valid, way; 486 int valid, way;
486 unsigned char state; 487 unsigned char state;
487 uint64_t taglo, pa;
488 uint32_t taghi, taglolo, taglohi; 488 uint32_t taghi, taglolo, taglohi;
489 unsigned long long taglo, pa;
489 uint8_t ecc, lru; 490 uint8_t ecc, lru;
490 int res = 0; 491 int res = 0;
491 492
@@ -535,8 +536,8 @@ static uint32_t extract_dc(unsigned short addr, int data)
535 } 536 }
536 537
537 if (data) { 538 if (data) {
538 uint64_t datalo;
539 uint32_t datalohi, datalolo, datahi; 539 uint32_t datalohi, datalolo, datahi;
540 unsigned long long datalo;
540 int offset; 541 int offset;
541 char bad_ecc = 0; 542 char bad_ecc = 0;
542 543
diff --git a/arch/mips/mm/dma-default.c b/arch/mips/mm/dma-default.c
index f503d02e403b..f0eb29917d9a 100644
--- a/arch/mips/mm/dma-default.c
+++ b/arch/mips/mm/dma-default.c
@@ -19,6 +19,13 @@
19 19
20#include <dma-coherence.h> 20#include <dma-coherence.h>
21 21
22static inline unsigned long dma_addr_to_virt(dma_addr_t dma_addr)
23{
24 unsigned long addr = plat_dma_addr_to_phys(dma_addr);
25
26 return (unsigned long)phys_to_virt(addr);
27}
28
22/* 29/*
23 * Warning on the terminology - Linux calls an uncached area coherent; 30 * Warning on the terminology - Linux calls an uncached area coherent;
24 * MIPS terminology calls memory areas with hardware maintained coherency 31 * MIPS terminology calls memory areas with hardware maintained coherency
@@ -140,7 +147,7 @@ void dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size,
140 enum dma_data_direction direction) 147 enum dma_data_direction direction)
141{ 148{
142 if (cpu_is_noncoherent_r10000(dev)) 149 if (cpu_is_noncoherent_r10000(dev))
143 __dma_sync(plat_dma_addr_to_phys(dma_addr) + PAGE_OFFSET, size, 150 __dma_sync(dma_addr_to_virt(dma_addr), size,
144 direction); 151 direction);
145 152
146 plat_unmap_dma_mem(dma_addr); 153 plat_unmap_dma_mem(dma_addr);
@@ -234,7 +241,7 @@ void dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle,
234 if (cpu_is_noncoherent_r10000(dev)) { 241 if (cpu_is_noncoherent_r10000(dev)) {
235 unsigned long addr; 242 unsigned long addr;
236 243
237 addr = PAGE_OFFSET + plat_dma_addr_to_phys(dma_handle); 244 addr = dma_addr_to_virt(dma_handle);
238 __dma_sync(addr, size, direction); 245 __dma_sync(addr, size, direction);
239 } 246 }
240} 247}
@@ -249,7 +256,7 @@ void dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle,
249 if (!plat_device_is_coherent(dev)) { 256 if (!plat_device_is_coherent(dev)) {
250 unsigned long addr; 257 unsigned long addr;
251 258
252 addr = PAGE_OFFSET + plat_dma_addr_to_phys(dma_handle); 259 addr = dma_addr_to_virt(dma_handle);
253 __dma_sync(addr, size, direction); 260 __dma_sync(addr, size, direction);
254 } 261 }
255} 262}
@@ -264,7 +271,7 @@ void dma_sync_single_range_for_cpu(struct device *dev, dma_addr_t dma_handle,
264 if (cpu_is_noncoherent_r10000(dev)) { 271 if (cpu_is_noncoherent_r10000(dev)) {
265 unsigned long addr; 272 unsigned long addr;
266 273
267 addr = PAGE_OFFSET + plat_dma_addr_to_phys(dma_handle); 274 addr = dma_addr_to_virt(dma_handle);
268 __dma_sync(addr + offset, size, direction); 275 __dma_sync(addr + offset, size, direction);
269 } 276 }
270} 277}
@@ -279,7 +286,7 @@ void dma_sync_single_range_for_device(struct device *dev, dma_addr_t dma_handle,
279 if (!plat_device_is_coherent(dev)) { 286 if (!plat_device_is_coherent(dev)) {
280 unsigned long addr; 287 unsigned long addr;
281 288
282 addr = PAGE_OFFSET + plat_dma_addr_to_phys(dma_handle); 289 addr = dma_addr_to_virt(dma_handle);
283 __dma_sync(addr + offset, size, direction); 290 __dma_sync(addr + offset, size, direction);
284 } 291 }
285} 292}
diff --git a/arch/mips/mm/fault.c b/arch/mips/mm/fault.c
index 6f90e7ef66ac..f9c595dceba9 100644
--- a/arch/mips/mm/fault.c
+++ b/arch/mips/mm/fault.c
@@ -42,7 +42,7 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long write,
42 siginfo_t info; 42 siginfo_t info;
43 43
44#if 0 44#if 0
45 printk("Cpu%d[%s:%d:%0*lx:%ld:%0*lx]\n", smp_processor_id(), 45 printk("Cpu%d[%s:%d:%0*lx:%ld:%0*lx]\n", raw_smp_processor_id(),
46 current->comm, current->pid, field, address, write, 46 current->comm, current->pid, field, address, write,
47 field, regs->cp0_epc); 47 field, regs->cp0_epc);
48#endif 48#endif
@@ -165,7 +165,7 @@ no_context:
165 165
166 printk(KERN_ALERT "CPU %d Unable to handle kernel paging request at " 166 printk(KERN_ALERT "CPU %d Unable to handle kernel paging request at "
167 "virtual address %0*lx, epc == %0*lx, ra == %0*lx\n", 167 "virtual address %0*lx, epc == %0*lx, ra == %0*lx\n",
168 smp_processor_id(), field, address, field, regs->cp0_epc, 168 raw_smp_processor_id(), field, address, field, regs->cp0_epc,
169 field, regs->regs[31]); 169 field, regs->regs[31]);
170 die("Oops", regs); 170 die("Oops", regs);
171 171
@@ -228,7 +228,7 @@ vmalloc_fault:
228 pmd_t *pmd, *pmd_k; 228 pmd_t *pmd, *pmd_k;
229 pte_t *pte_k; 229 pte_t *pte_k;
230 230
231 pgd = (pgd_t *) pgd_current[smp_processor_id()] + offset; 231 pgd = (pgd_t *) pgd_current[raw_smp_processor_id()] + offset;
232 pgd_k = init_mm.pgd + offset; 232 pgd_k = init_mm.pgd + offset;
233 233
234 if (!pgd_present(*pgd_k)) 234 if (!pgd_present(*pgd_k))
diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c
index f08ae71c46ff..e9951c0e689f 100644
--- a/arch/mips/mm/init.c
+++ b/arch/mips/mm/init.c
@@ -123,7 +123,7 @@ static void __init kmap_coherent_init(void)
123static inline void kmap_coherent_init(void) {} 123static inline void kmap_coherent_init(void) {}
124#endif 124#endif
125 125
126static inline void *kmap_coherent(struct page *page, unsigned long addr) 126void *kmap_coherent(struct page *page, unsigned long addr)
127{ 127{
128 enum fixed_addresses idx; 128 enum fixed_addresses idx;
129 unsigned long vaddr, flags, entrylo; 129 unsigned long vaddr, flags, entrylo;
@@ -177,7 +177,7 @@ static inline void *kmap_coherent(struct page *page, unsigned long addr)
177 177
178#define UNIQUE_ENTRYHI(idx) (CKSEG0 + ((idx) << (PAGE_SHIFT + 1))) 178#define UNIQUE_ENTRYHI(idx) (CKSEG0 + ((idx) << (PAGE_SHIFT + 1)))
179 179
180static inline void kunmap_coherent(struct page *page) 180void kunmap_coherent(struct page *page)
181{ 181{
182#ifndef CONFIG_MIPS_MT_SMTC 182#ifndef CONFIG_MIPS_MT_SMTC
183 unsigned int wired; 183 unsigned int wired;
@@ -377,7 +377,7 @@ void __init paging_init(void)
377#ifdef CONFIG_FLATMEM 377#ifdef CONFIG_FLATMEM
378 free_area_init(zones_size); 378 free_area_init(zones_size);
379#else 379#else
380 pfn = 0; 380 pfn = min_low_pfn;
381 for (i = 0; i < MAX_NR_ZONES; i++) 381 for (i = 0; i < MAX_NR_ZONES; i++)
382 for (j = 0; j < zones_size[i]; j++, pfn++) 382 for (j = 0; j < zones_size[i]; j++, pfn++)
383 if (!page_is_ram(pfn)) 383 if (!page_is_ram(pfn))
diff --git a/arch/mips/mm/pg-sb1.c b/arch/mips/mm/pg-sb1.c
index fc3c7878fb45..adb37d0a30ea 100644
--- a/arch/mips/mm/pg-sb1.c
+++ b/arch/mips/mm/pg-sb1.c
@@ -218,8 +218,7 @@ void sb1_dma_init(void)
218 for (i = 0; i < DM_NUM_CHANNELS; i++) { 218 for (i = 0; i < DM_NUM_CHANNELS; i++) {
219 const u64 base_val = CPHYSADDR(&page_descr[i]) | 219 const u64 base_val = CPHYSADDR(&page_descr[i]) |
220 V_DM_DSCR_BASE_RINGSZ(1); 220 V_DM_DSCR_BASE_RINGSZ(1);
221 volatile void *base_reg = 221 void *base_reg = IOADDR(A_DM_REGISTER(i, R_DM_DSCR_BASE));
222 IOADDR(A_DM_REGISTER(i, R_DM_DSCR_BASE));
223 222
224 __raw_writeq(base_val, base_reg); 223 __raw_writeq(base_val, base_reg);
225 __raw_writeq(base_val | M_DM_DSCR_BASE_RESET, base_reg); 224 __raw_writeq(base_val | M_DM_DSCR_BASE_RESET, base_reg);
diff --git a/arch/mips/pci/pci-bcm1480.c b/arch/mips/pci/pci-bcm1480.c
index f6774f54cd3c..d7b9e1349f6d 100644
--- a/arch/mips/pci/pci-bcm1480.c
+++ b/arch/mips/pci/pci-bcm1480.c
@@ -216,7 +216,7 @@ static int __init bcm1480_pcibios_init(void)
216 /* 216 /*
217 * See if the PCI bus has been configured by the firmware. 217 * See if the PCI bus has been configured by the firmware.
218 */ 218 */
219 reg = *((volatile uint64_t *) IOADDR(A_SCD_SYSTEM_CFG)); 219 reg = __raw_readq(IOADDR(A_SCD_SYSTEM_CFG));
220 if (!(reg & M_BCM1480_SYS_PCI_HOST)) { 220 if (!(reg & M_BCM1480_SYS_PCI_HOST)) {
221 bcm1480_bus_status |= PCI_DEVICE_MODE; 221 bcm1480_bus_status |= PCI_DEVICE_MODE;
222 } else { 222 } else {
diff --git a/arch/mips/pci/pci-ev64120.c b/arch/mips/pci/pci-ev64120.c
index 9cd859ef1842..a84f594b5a18 100644
--- a/arch/mips/pci/pci-ev64120.c
+++ b/arch/mips/pci/pci-ev64120.c
@@ -1,4 +1,5 @@
1#include <linux/pci.h> 1#include <linux/pci.h>
2#include <asm/irq.h>
2 3
3int __init pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 4int __init pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
4{ 5{
diff --git a/arch/mips/pci/pci-sb1250.c b/arch/mips/pci/pci-sb1250.c
index 80f5e8c4bcd4..75c1246ced5f 100644
--- a/arch/mips/pci/pci-sb1250.c
+++ b/arch/mips/pci/pci-sb1250.c
@@ -228,7 +228,7 @@ static int __init sb1250_pcibios_init(void)
228 /* 228 /*
229 * See if the PCI bus has been configured by the firmware. 229 * See if the PCI bus has been configured by the firmware.
230 */ 230 */
231 reg = *((volatile uint64_t *) IOADDR(A_SCD_SYSTEM_CFG)); 231 reg = __raw_readq(IOADDR(A_SCD_SYSTEM_CFG));
232 if (!(reg & M_SYS_PCI_HOST)) { 232 if (!(reg & M_SYS_PCI_HOST)) {
233 sb1250_bus_status |= PCI_DEVICE_MODE; 233 sb1250_bus_status |= PCI_DEVICE_MODE;
234 } else { 234 } else {
diff --git a/arch/mips/sibyte/bcm1480/irq.c b/arch/mips/sibyte/bcm1480/irq.c
index 20af0f1bb7bf..ba0c4b776c85 100644
--- a/arch/mips/sibyte/bcm1480/irq.c
+++ b/arch/mips/sibyte/bcm1480/irq.c
@@ -141,11 +141,11 @@ static void bcm1480_set_affinity(unsigned int irq, cpumask_t mask)
141 unsigned long flags; 141 unsigned long flags;
142 unsigned int irq_dirty; 142 unsigned int irq_dirty;
143 143
144 i = first_cpu(mask); 144 if (cpus_weight(mask) != 1) {
145 if (next_cpu(i, mask) <= NR_CPUS) {
146 printk("attempted to set irq affinity for irq %d to multiple CPUs\n", irq); 145 printk("attempted to set irq affinity for irq %d to multiple CPUs\n", irq);
147 return; 146 return;
148 } 147 }
148 i = first_cpu(mask);
149 149
150 /* Convert logical CPU to physical CPU */ 150 /* Convert logical CPU to physical CPU */
151 cpu = cpu_logical_map(i); 151 cpu = cpu_logical_map(i);
diff --git a/arch/mips/sibyte/bcm1480/smp.c b/arch/mips/sibyte/bcm1480/smp.c
index bf328277c775..6eac36d1b8c8 100644
--- a/arch/mips/sibyte/bcm1480/smp.c
+++ b/arch/mips/sibyte/bcm1480/smp.c
@@ -34,21 +34,21 @@ extern void smp_call_function_interrupt(void);
34 * independent of board/firmware 34 * independent of board/firmware
35 */ 35 */
36 36
37static volatile void *mailbox_0_set_regs[] = { 37static void *mailbox_0_set_regs[] = {
38 IOADDR(A_BCM1480_IMR_CPU0_BASE + R_BCM1480_IMR_MAILBOX_0_SET_CPU), 38 IOADDR(A_BCM1480_IMR_CPU0_BASE + R_BCM1480_IMR_MAILBOX_0_SET_CPU),
39 IOADDR(A_BCM1480_IMR_CPU1_BASE + R_BCM1480_IMR_MAILBOX_0_SET_CPU), 39 IOADDR(A_BCM1480_IMR_CPU1_BASE + R_BCM1480_IMR_MAILBOX_0_SET_CPU),
40 IOADDR(A_BCM1480_IMR_CPU2_BASE + R_BCM1480_IMR_MAILBOX_0_SET_CPU), 40 IOADDR(A_BCM1480_IMR_CPU2_BASE + R_BCM1480_IMR_MAILBOX_0_SET_CPU),
41 IOADDR(A_BCM1480_IMR_CPU3_BASE + R_BCM1480_IMR_MAILBOX_0_SET_CPU), 41 IOADDR(A_BCM1480_IMR_CPU3_BASE + R_BCM1480_IMR_MAILBOX_0_SET_CPU),
42}; 42};
43 43
44static volatile void *mailbox_0_clear_regs[] = { 44static void *mailbox_0_clear_regs[] = {
45 IOADDR(A_BCM1480_IMR_CPU0_BASE + R_BCM1480_IMR_MAILBOX_0_CLR_CPU), 45 IOADDR(A_BCM1480_IMR_CPU0_BASE + R_BCM1480_IMR_MAILBOX_0_CLR_CPU),
46 IOADDR(A_BCM1480_IMR_CPU1_BASE + R_BCM1480_IMR_MAILBOX_0_CLR_CPU), 46 IOADDR(A_BCM1480_IMR_CPU1_BASE + R_BCM1480_IMR_MAILBOX_0_CLR_CPU),
47 IOADDR(A_BCM1480_IMR_CPU2_BASE + R_BCM1480_IMR_MAILBOX_0_CLR_CPU), 47 IOADDR(A_BCM1480_IMR_CPU2_BASE + R_BCM1480_IMR_MAILBOX_0_CLR_CPU),
48 IOADDR(A_BCM1480_IMR_CPU3_BASE + R_BCM1480_IMR_MAILBOX_0_CLR_CPU), 48 IOADDR(A_BCM1480_IMR_CPU3_BASE + R_BCM1480_IMR_MAILBOX_0_CLR_CPU),
49}; 49};
50 50
51static volatile void *mailbox_0_regs[] = { 51static void *mailbox_0_regs[] = {
52 IOADDR(A_BCM1480_IMR_CPU0_BASE + R_BCM1480_IMR_MAILBOX_0_CPU), 52 IOADDR(A_BCM1480_IMR_CPU0_BASE + R_BCM1480_IMR_MAILBOX_0_CPU),
53 IOADDR(A_BCM1480_IMR_CPU1_BASE + R_BCM1480_IMR_MAILBOX_0_CPU), 53 IOADDR(A_BCM1480_IMR_CPU1_BASE + R_BCM1480_IMR_MAILBOX_0_CPU),
54 IOADDR(A_BCM1480_IMR_CPU2_BASE + R_BCM1480_IMR_MAILBOX_0_CPU), 54 IOADDR(A_BCM1480_IMR_CPU2_BASE + R_BCM1480_IMR_MAILBOX_0_CPU),
diff --git a/arch/mips/sibyte/swarm/setup.c b/arch/mips/sibyte/swarm/setup.c
index defa1f1452ad..83572d8f3e14 100644
--- a/arch/mips/sibyte/swarm/setup.c
+++ b/arch/mips/sibyte/swarm/setup.c
@@ -169,17 +169,19 @@ void __init plat_mem_setup(void)
169#define LEDS_PHYS MLEDS_PHYS 169#define LEDS_PHYS MLEDS_PHYS
170#endif 170#endif
171 171
172#define setled(index, c) \
173 ((unsigned char *)(IOADDR(LEDS_PHYS)+0x20))[(3-(index))<<3] = (c)
174void setleds(char *str) 172void setleds(char *str)
175{ 173{
174 void *reg;
176 int i; 175 int i;
176
177 for (i = 0; i < 4; i++) { 177 for (i = 0; i < 4; i++) {
178 if (!str[i]) { 178 reg = IOADDR(LEDS_PHYS) + 0x20 + ((3 - i) << 3);
179 setled(i, ' '); 179
180 } else { 180 if (!str[i])
181 setled(i, str[i]); 181 writeb(' ', reg);
182 } 182 else
183 writeb(str[i], reg);
183 } 184 }
184} 185}
185#endif 186
187#endif /* LEDS_PHYS */
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index f3d4dd580dd6..e53b2988d1bf 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -465,8 +465,13 @@ void flush_thread(void)
465#ifdef CONFIG_PPC64 465#ifdef CONFIG_PPC64
466 struct thread_info *t = current_thread_info(); 466 struct thread_info *t = current_thread_info();
467 467
468 if (t->flags & _TIF_ABI_PENDING) 468 if (test_ti_thread_flag(t, TIF_ABI_PENDING)) {
469 t->flags ^= (_TIF_ABI_PENDING | _TIF_32BIT); 469 clear_ti_thread_flag(t, TIF_ABI_PENDING);
470 if (test_ti_thread_flag(t, TIF_32BIT))
471 clear_ti_thread_flag(t, TIF_32BIT);
472 else
473 set_ti_thread_flag(t, TIF_32BIT);
474 }
470#endif 475#endif
471 476
472 discard_lazy_cpu_state(); 477 discard_lazy_cpu_state();
diff --git a/arch/powerpc/platforms/pseries/hvCall.S b/arch/powerpc/platforms/pseries/hvCall.S
index 5c7e38789897..c1427b3634ec 100644
--- a/arch/powerpc/platforms/pseries/hvCall.S
+++ b/arch/powerpc/platforms/pseries/hvCall.S
@@ -30,9 +30,14 @@ END_FTR_SECTION_IFSET(CPU_FTR_PURR);
30 30
31/* 31/*
32 * postcall is performed immediately before function return which 32 * postcall is performed immediately before function return which
33 * allows liberal use of volatile registers. 33 * allows liberal use of volatile registers. We branch around this
34 * in early init (eg when populating the MMU hashtable) by using an
35 * unconditional cpu feature.
34 */ 36 */
35#define HCALL_INST_POSTCALL \ 37#define HCALL_INST_POSTCALL \
38BEGIN_FTR_SECTION; \
39 b 1f; \
40END_FTR_SECTION(0, 1); \
36 ld r4,STK_PARM(r3)(r1); /* validate opcode */ \ 41 ld r4,STK_PARM(r3)(r1); /* validate opcode */ \
37 cmpldi cr7,r4,MAX_HCALL_OPCODE; \ 42 cmpldi cr7,r4,MAX_HCALL_OPCODE; \
38 bgt- cr7,1f; \ 43 bgt- cr7,1f; \
@@ -123,6 +128,40 @@ _GLOBAL(plpar_hcall)
123 128
124 blr /* return r3 = status */ 129 blr /* return r3 = status */
125 130
131/*
132 * plpar_hcall_raw can be called in real mode. kexec/kdump need some
133 * hypervisor calls to be executed in real mode. So plpar_hcall_raw
134 * does not access the per cpu hypervisor call statistics variables,
135 * since these variables may not be present in the RMO region.
136 */
137_GLOBAL(plpar_hcall_raw)
138 HMT_MEDIUM
139
140 mfcr r0
141 stw r0,8(r1)
142
143 std r4,STK_PARM(r4)(r1) /* Save ret buffer */
144
145 mr r4,r5
146 mr r5,r6
147 mr r6,r7
148 mr r7,r8
149 mr r8,r9
150 mr r9,r10
151
152 HVSC /* invoke the hypervisor */
153
154 ld r12,STK_PARM(r4)(r1)
155 std r4, 0(r12)
156 std r5, 8(r12)
157 std r6, 16(r12)
158 std r7, 24(r12)
159
160 lwz r0,8(r1)
161 mtcrf 0xff,r0
162
163 blr /* return r3 = status */
164
126_GLOBAL(plpar_hcall9) 165_GLOBAL(plpar_hcall9)
127 HMT_MEDIUM 166 HMT_MEDIUM
128 167
diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c
index 7496005566ef..843ee9643211 100644
--- a/arch/powerpc/platforms/pseries/lpar.c
+++ b/arch/powerpc/platforms/pseries/lpar.c
@@ -378,7 +378,7 @@ static void pSeries_lpar_hptab_clear(void)
378 378
379 /* TODO: Use bulk call */ 379 /* TODO: Use bulk call */
380 for (i = 0; i < hpte_count; i++) 380 for (i = 0; i < hpte_count; i++)
381 plpar_pte_remove(0, i, 0, &dummy1, &dummy2); 381 plpar_pte_remove_raw(0, i, 0, &dummy1, &dummy2);
382} 382}
383 383
384/* 384/*
diff --git a/arch/powerpc/platforms/pseries/plpar_wrappers.h b/arch/powerpc/platforms/pseries/plpar_wrappers.h
index 3eb7b294d92f..2e4d10c9eea8 100644
--- a/arch/powerpc/platforms/pseries/plpar_wrappers.h
+++ b/arch/powerpc/platforms/pseries/plpar_wrappers.h
@@ -78,6 +78,22 @@ static inline long plpar_pte_remove(unsigned long flags, unsigned long ptex,
78 return rc; 78 return rc;
79} 79}
80 80
81/* plpar_pte_remove_raw can be called in real mode. It calls plpar_hcall_raw */
82static inline long plpar_pte_remove_raw(unsigned long flags, unsigned long ptex,
83 unsigned long avpn, unsigned long *old_pteh_ret,
84 unsigned long *old_ptel_ret)
85{
86 long rc;
87 unsigned long retbuf[PLPAR_HCALL_BUFSIZE];
88
89 rc = plpar_hcall_raw(H_REMOVE, retbuf, flags, ptex, avpn);
90
91 *old_pteh_ret = retbuf[0];
92 *old_ptel_ret = retbuf[1];
93
94 return rc;
95}
96
81static inline long plpar_pte_read(unsigned long flags, unsigned long ptex, 97static inline long plpar_pte_read(unsigned long flags, unsigned long ptex,
82 unsigned long *old_pteh_ret, unsigned long *old_ptel_ret) 98 unsigned long *old_pteh_ret, unsigned long *old_ptel_ret)
83{ 99{
diff --git a/arch/powerpc/sysdev/dcr.c b/arch/powerpc/sysdev/dcr.c
index dffeeaeca1d9..1fc5819e7d18 100644
--- a/arch/powerpc/sysdev/dcr.c
+++ b/arch/powerpc/sysdev/dcr.c
@@ -129,7 +129,7 @@ void dcr_unmap(dcr_host_t host, unsigned int dcr_n, unsigned int dcr_c)
129 129
130 if (h.token == NULL) 130 if (h.token == NULL)
131 return; 131 return;
132 h.token -= dcr_n * h.stride; 132 h.token += dcr_n * h.stride;
133 iounmap(h.token); 133 iounmap(h.token);
134 h.token = NULL; 134 h.token = NULL;
135} 135}
diff --git a/arch/powerpc/sysdev/qe_lib/qe.c b/arch/powerpc/sysdev/qe_lib/qe.c
index e3d71e083f35..43f6cc9d7ea0 100644
--- a/arch/powerpc/sysdev/qe_lib/qe.c
+++ b/arch/powerpc/sysdev/qe_lib/qe.c
@@ -251,13 +251,13 @@ static int qe_sdma_init(void)
251 251
252 /* allocate 2 internal temporary buffers (512 bytes size each) for 252 /* allocate 2 internal temporary buffers (512 bytes size each) for
253 * the SDMA */ 253 * the SDMA */
254 sdma_buf_offset = qe_muram_alloc(512 * 2, 64); 254 sdma_buf_offset = qe_muram_alloc(512 * 2, 4096);
255 if (IS_MURAM_ERR(sdma_buf_offset)) 255 if (IS_MURAM_ERR(sdma_buf_offset))
256 return -ENOMEM; 256 return -ENOMEM;
257 257
258 out_be32(&sdma->sdebcr, sdma_buf_offset & QE_SDEBCR_BA_MASK); 258 out_be32(&sdma->sdebcr, sdma_buf_offset & QE_SDEBCR_BA_MASK);
259 out_be32(&sdma->sdmr, (QE_SDMR_GLB_1_MSK | (0x1 >> 259 out_be32(&sdma->sdmr, (QE_SDMR_GLB_1_MSK |
260 QE_SDMR_CEN_SHIFT))); 260 (0x1 << QE_SDMR_CEN_SHIFT)));
261 261
262 return 0; 262 return 0;
263} 263}
diff --git a/arch/s390/kernel/kprobes.c b/arch/s390/kernel/kprobes.c
index 8af549e95730..993f35381496 100644
--- a/arch/s390/kernel/kprobes.c
+++ b/arch/s390/kernel/kprobes.c
@@ -167,7 +167,7 @@ static int __kprobes swap_instruction(void *aref)
167 * shall not cross any page boundaries (vmalloc area!) when writing 167 * shall not cross any page boundaries (vmalloc area!) when writing
168 * the new instruction. 168 * the new instruction.
169 */ 169 */
170 addr = (u32 *)ALIGN((unsigned long)args->ptr, 4); 170 addr = (u32 *)((unsigned long)args->ptr & -4UL);
171 if ((unsigned long)args->ptr & 2) 171 if ((unsigned long)args->ptr & 2)
172 instr = ((*addr) & 0xffff0000) | args->new; 172 instr = ((*addr) & 0xffff0000) | args->new;
173 else 173 else
diff --git a/arch/sh/kernel/sh_ksyms.c b/arch/sh/kernel/sh_ksyms.c
index fe1b276c97c6..6e0d10fac4a8 100644
--- a/arch/sh/kernel/sh_ksyms.c
+++ b/arch/sh/kernel/sh_ksyms.c
@@ -82,9 +82,6 @@ DECLARE_EXPORT(__movstr);
82DECLARE_EXPORT(__movmem_i4_even); 82DECLARE_EXPORT(__movmem_i4_even);
83DECLARE_EXPORT(__movmem_i4_odd); 83DECLARE_EXPORT(__movmem_i4_odd);
84DECLARE_EXPORT(__movmemSI12_i4); 84DECLARE_EXPORT(__movmemSI12_i4);
85DECLARE_EXPORT(__sdivsi3_i4i);
86DECLARE_EXPORT(__udiv_qrnnd_16);
87DECLARE_EXPORT(__udivsi3_i4i);
88#else /* GCC 3.x */ 85#else /* GCC 3.x */
89DECLARE_EXPORT(__movstr_i4_even); 86DECLARE_EXPORT(__movstr_i4_even);
90DECLARE_EXPORT(__movstr_i4_odd); 87DECLARE_EXPORT(__movstr_i4_odd);
diff --git a/arch/sparc/lib/atomic32.c b/arch/sparc/lib/atomic32.c
index 53ddcd9d1e60..559335f4917d 100644
--- a/arch/sparc/lib/atomic32.c
+++ b/arch/sparc/lib/atomic32.c
@@ -52,6 +52,7 @@ int atomic_cmpxchg(atomic_t *v, int old, int new)
52 spin_unlock_irqrestore(ATOMIC_HASH(v), flags); 52 spin_unlock_irqrestore(ATOMIC_HASH(v), flags);
53 return ret; 53 return ret;
54} 54}
55EXPORT_SYMBOL(atomic_cmpxchg);
55 56
56int atomic_add_unless(atomic_t *v, int a, int u) 57int atomic_add_unless(atomic_t *v, int a, int u)
57{ 58{
@@ -65,6 +66,7 @@ int atomic_add_unless(atomic_t *v, int a, int u)
65 spin_unlock_irqrestore(ATOMIC_HASH(v), flags); 66 spin_unlock_irqrestore(ATOMIC_HASH(v), flags);
66 return ret != u; 67 return ret != u;
67} 68}
69EXPORT_SYMBOL(atomic_add_unless);
68 70
69/* Atomic operations are already serializing */ 71/* Atomic operations are already serializing */
70void atomic_set(atomic_t *v, int i) 72void atomic_set(atomic_t *v, int i)
diff --git a/arch/um/drivers/chan_kern.c b/arch/um/drivers/chan_kern.c
index 7b8baf146acc..9fdfad649536 100644
--- a/arch/um/drivers/chan_kern.c
+++ b/arch/um/drivers/chan_kern.c
@@ -236,11 +236,11 @@ void free_irqs(void)
236 struct chan *chan; 236 struct chan *chan;
237 LIST_HEAD(list); 237 LIST_HEAD(list);
238 struct list_head *ele; 238 struct list_head *ele;
239 unsigned long flags;
239 240
240 spin_lock_irq(&irqs_to_free_lock); 241 spin_lock_irqsave(&irqs_to_free_lock, flags);
241 list_splice_init(&irqs_to_free, &list); 242 list_splice_init(&irqs_to_free, &list);
242 INIT_LIST_HEAD(&irqs_to_free); 243 spin_unlock_irqrestore(&irqs_to_free_lock, flags);
243 spin_unlock_irq(&irqs_to_free_lock);
244 244
245 list_for_each(ele, &list){ 245 list_for_each(ele, &list){
246 chan = list_entry(ele, struct chan, free_list); 246 chan = list_entry(ele, struct chan, free_list);
@@ -255,13 +255,15 @@ void free_irqs(void)
255 255
256static void close_one_chan(struct chan *chan, int delay_free_irq) 256static void close_one_chan(struct chan *chan, int delay_free_irq)
257{ 257{
258 unsigned long flags;
259
258 if(!chan->opened) 260 if(!chan->opened)
259 return; 261 return;
260 262
261 if(delay_free_irq){ 263 if(delay_free_irq){
262 spin_lock_irq(&irqs_to_free_lock); 264 spin_lock_irqsave(&irqs_to_free_lock, flags);
263 list_add(&chan->free_list, &irqs_to_free); 265 list_add(&chan->free_list, &irqs_to_free);
264 spin_unlock_irq(&irqs_to_free_lock); 266 spin_unlock_irqrestore(&irqs_to_free_lock, flags);
265 } 267 }
266 else { 268 else {
267 if(chan->input) 269 if(chan->input)
diff --git a/arch/um/drivers/mconsole_kern.c b/arch/um/drivers/mconsole_kern.c
index 178b2eff4a8c..65ad2932672c 100644
--- a/arch/um/drivers/mconsole_kern.c
+++ b/arch/um/drivers/mconsole_kern.c
@@ -615,6 +615,9 @@ void mconsole_remove(struct mc_request *req)
615 err_msg = NULL; 615 err_msg = NULL;
616 err = (*dev->remove)(n, &err_msg); 616 err = (*dev->remove)(n, &err_msg);
617 switch(err){ 617 switch(err){
618 case 0:
619 err_msg = "";
620 break;
618 case -ENODEV: 621 case -ENODEV:
619 if(err_msg == NULL) 622 if(err_msg == NULL)
620 err_msg = "Device doesn't exist"; 623 err_msg = "Device doesn't exist";
diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c
index f98d26e51381..8bd9204ac1ab 100644
--- a/arch/um/drivers/ubd_kern.c
+++ b/arch/um/drivers/ubd_kern.c
@@ -109,10 +109,6 @@ static inline void ubd_set_bit(__u64 bit, unsigned char *data)
109 109
110static DEFINE_MUTEX(ubd_lock); 110static DEFINE_MUTEX(ubd_lock);
111 111
112/* XXX - this made sense in 2.4 days, now it's only used as a boolean, and
113 * probably it doesn't make sense even for that. */
114static int do_ubd;
115
116static int ubd_open(struct inode * inode, struct file * filp); 112static int ubd_open(struct inode * inode, struct file * filp);
117static int ubd_release(struct inode * inode, struct file * file); 113static int ubd_release(struct inode * inode, struct file * file);
118static int ubd_ioctl(struct inode * inode, struct file * file, 114static int ubd_ioctl(struct inode * inode, struct file * file,
@@ -169,6 +165,7 @@ struct ubd {
169 struct platform_device pdev; 165 struct platform_device pdev;
170 struct request_queue *queue; 166 struct request_queue *queue;
171 spinlock_t lock; 167 spinlock_t lock;
168 int active;
172}; 169};
173 170
174#define DEFAULT_COW { \ 171#define DEFAULT_COW { \
@@ -190,6 +187,7 @@ struct ubd {
190 .shared = 0, \ 187 .shared = 0, \
191 .cow = DEFAULT_COW, \ 188 .cow = DEFAULT_COW, \
192 .lock = SPIN_LOCK_UNLOCKED, \ 189 .lock = SPIN_LOCK_UNLOCKED, \
190 .active = 0, \
193} 191}
194 192
195/* Protected by ubd_lock */ 193/* Protected by ubd_lock */
@@ -507,7 +505,6 @@ static void ubd_handler(void)
507 struct ubd *dev; 505 struct ubd *dev;
508 int n; 506 int n;
509 507
510 do_ubd = 0;
511 n = os_read_file(thread_fd, &req, sizeof(req)); 508 n = os_read_file(thread_fd, &req, sizeof(req));
512 if(n != sizeof(req)){ 509 if(n != sizeof(req)){
513 printk(KERN_ERR "Pid %d - spurious interrupt in ubd_handler, " 510 printk(KERN_ERR "Pid %d - spurious interrupt in ubd_handler, "
@@ -517,6 +514,7 @@ static void ubd_handler(void)
517 514
518 rq = req.req; 515 rq = req.req;
519 dev = rq->rq_disk->private_data; 516 dev = rq->rq_disk->private_data;
517 dev->active = 0;
520 518
521 ubd_finish(rq, req.error); 519 ubd_finish(rq, req.error);
522 reactivate_fd(thread_fd, UBD_IRQ); 520 reactivate_fd(thread_fd, UBD_IRQ);
@@ -1081,11 +1079,12 @@ static void do_ubd_request(request_queue_t *q)
1081 } 1079 }
1082 } 1080 }
1083 else { 1081 else {
1084 if(do_ubd || (req = elv_next_request(q)) == NULL) 1082 struct ubd *dev = q->queuedata;
1083 if(dev->active || (req = elv_next_request(q)) == NULL)
1085 return; 1084 return;
1086 err = prepare_request(req, &io_req); 1085 err = prepare_request(req, &io_req);
1087 if(!err){ 1086 if(!err){
1088 do_ubd = 1; 1087 dev->active = 1;
1089 n = os_write_file(thread_fd, (char *) &io_req, 1088 n = os_write_file(thread_fd, (char *) &io_req,
1090 sizeof(io_req)); 1089 sizeof(io_req));
1091 if(n != sizeof(io_req)) 1090 if(n != sizeof(io_req))
diff --git a/arch/um/include/mconsole.h b/arch/um/include/mconsole.h
index 2666815b6af5..b282839c1625 100644
--- a/arch/um/include/mconsole.h
+++ b/arch/um/include/mconsole.h
@@ -12,6 +12,8 @@
12#define u32 uint32_t 12#define u32 uint32_t
13#endif 13#endif
14 14
15#include "sysdep/ptrace.h"
16
15#define MCONSOLE_MAGIC (0xcafebabe) 17#define MCONSOLE_MAGIC (0xcafebabe)
16#define MCONSOLE_MAX_DATA (512) 18#define MCONSOLE_MAX_DATA (512)
17#define MCONSOLE_VERSION 2 19#define MCONSOLE_VERSION 2
diff --git a/arch/um/include/sysdep-x86_64/ptrace.h b/arch/um/include/sysdep-x86_64/ptrace.h
index 66cb400c2c92..62403bd99661 100644
--- a/arch/um/include/sysdep-x86_64/ptrace.h
+++ b/arch/um/include/sysdep-x86_64/ptrace.h
@@ -104,10 +104,6 @@ union uml_pt_regs {
104#endif 104#endif
105#ifdef UML_CONFIG_MODE_SKAS 105#ifdef UML_CONFIG_MODE_SKAS
106 struct skas_regs { 106 struct skas_regs {
107 /* x86_64 ptrace uses sizeof(user_regs_struct) as its register
108 * file size, while i386 uses FRAME_SIZE. Therefore, we need
109 * to use UM_FRAME_SIZE here instead of HOST_FRAME_SIZE.
110 */
111 unsigned long regs[MAX_REG_NR]; 107 unsigned long regs[MAX_REG_NR];
112 unsigned long fp[HOST_FP_SIZE]; 108 unsigned long fp[HOST_FP_SIZE];
113 struct faultinfo faultinfo; 109 struct faultinfo faultinfo;
diff --git a/arch/um/kernel/mem.c b/arch/um/kernel/mem.c
index e85d65deea0d..df7d662b98ce 100644
--- a/arch/um/kernel/mem.c
+++ b/arch/um/kernel/mem.c
@@ -64,8 +64,6 @@ static void setup_highmem(unsigned long highmem_start,
64 64
65void mem_init(void) 65void mem_init(void)
66{ 66{
67 max_low_pfn = (high_physmem - uml_physmem) >> PAGE_SHIFT;
68
69 /* clear the zero-page */ 67 /* clear the zero-page */
70 memset((void *) empty_zero_page, 0, PAGE_SIZE); 68 memset((void *) empty_zero_page, 0, PAGE_SIZE);
71 69
@@ -80,6 +78,7 @@ void mem_init(void)
80 78
81 /* this will put all low memory onto the freelists */ 79 /* this will put all low memory onto the freelists */
82 totalram_pages = free_all_bootmem(); 80 totalram_pages = free_all_bootmem();
81 max_low_pfn = totalram_pages;
83#ifdef CONFIG_HIGHMEM 82#ifdef CONFIG_HIGHMEM
84 totalhigh_pages = highmem >> PAGE_SHIFT; 83 totalhigh_pages = highmem >> PAGE_SHIFT;
85 totalram_pages += totalhigh_pages; 84 totalram_pages += totalhigh_pages;
diff --git a/arch/um/os-Linux/skas/mem.c b/arch/um/os-Linux/skas/mem.c
index b3c11cfa995a..9383e8751ae7 100644
--- a/arch/um/os-Linux/skas/mem.c
+++ b/arch/um/os-Linux/skas/mem.c
@@ -48,7 +48,7 @@ int multi_op_count = 0;
48static inline long do_syscall_stub(struct mm_id * mm_idp, void **addr) 48static inline long do_syscall_stub(struct mm_id * mm_idp, void **addr)
49{ 49{
50 unsigned long regs[MAX_REG_NR]; 50 unsigned long regs[MAX_REG_NR];
51 int n; 51 int n, i;
52 long ret, offset; 52 long ret, offset;
53 unsigned long * data; 53 unsigned long * data;
54 unsigned long * syscall; 54 unsigned long * syscall;
@@ -66,9 +66,13 @@ static inline long do_syscall_stub(struct mm_id * mm_idp, void **addr)
66 (unsigned long) &__syscall_stub_start); 66 (unsigned long) &__syscall_stub_start);
67 67
68 n = ptrace_setregs(pid, regs); 68 n = ptrace_setregs(pid, regs);
69 if(n < 0) 69 if(n < 0){
70 printk("Registers - \n");
71 for(i = 0; i < MAX_REG_NR; i++)
72 printk("\t%d\t0x%lx\n", i, regs[i]);
70 panic("do_syscall_stub : PTRACE_SETREGS failed, errno = %d\n", 73 panic("do_syscall_stub : PTRACE_SETREGS failed, errno = %d\n",
71 n); 74 -n);
75 }
72 76
73 wait_stub_done(pid, 0, "do_syscall_stub"); 77 wait_stub_done(pid, 0, "do_syscall_stub");
74 78
diff --git a/arch/um/os-Linux/skas/process.c b/arch/um/os-Linux/skas/process.c
index dda06789bcb0..0564422c155f 100644
--- a/arch/um/os-Linux/skas/process.c
+++ b/arch/um/os-Linux/skas/process.c
@@ -67,7 +67,7 @@ void wait_stub_done(int pid, int sig, char * fname)
67 67
68 if((n < 0) || !WIFSTOPPED(status) || 68 if((n < 0) || !WIFSTOPPED(status) ||
69 (WSTOPSIG(status) != SIGUSR1 && WSTOPSIG(status) != SIGTRAP)){ 69 (WSTOPSIG(status) != SIGUSR1 && WSTOPSIG(status) != SIGTRAP)){
70 unsigned long regs[HOST_FRAME_SIZE]; 70 unsigned long regs[MAX_REG_NR];
71 71
72 if(ptrace(PTRACE_GETREGS, pid, 0, regs) < 0) 72 if(ptrace(PTRACE_GETREGS, pid, 0, regs) < 0)
73 printk("Failed to get registers from stub, " 73 printk("Failed to get registers from stub, "
@@ -76,7 +76,7 @@ void wait_stub_done(int pid, int sig, char * fname)
76 int i; 76 int i;
77 77
78 printk("Stub registers -\n"); 78 printk("Stub registers -\n");
79 for(i = 0; i < HOST_FRAME_SIZE; i++) 79 for(i = 0; i < ARRAY_SIZE(regs); i++)
80 printk("\t%d - %lx\n", i, regs[i]); 80 printk("\t%d - %lx\n", i, regs[i]);
81 } 81 }
82 panic("%s : failed to wait for SIGUSR1/SIGTRAP, " 82 panic("%s : failed to wait for SIGUSR1/SIGTRAP, "
@@ -328,7 +328,7 @@ void userspace(union uml_pt_regs *regs)
328int copy_context_skas0(unsigned long new_stack, int pid) 328int copy_context_skas0(unsigned long new_stack, int pid)
329{ 329{
330 int err; 330 int err;
331 unsigned long regs[HOST_FRAME_SIZE]; 331 unsigned long regs[MAX_REG_NR];
332 unsigned long fp_regs[HOST_FP_SIZE]; 332 unsigned long fp_regs[HOST_FP_SIZE];
333 unsigned long current_stack = current_stub_stack(); 333 unsigned long current_stack = current_stub_stack();
334 struct stub_data *data = (struct stub_data *) current_stack; 334 struct stub_data *data = (struct stub_data *) current_stack;
diff --git a/arch/um/os-Linux/sys-i386/registers.c b/arch/um/os-Linux/sys-i386/registers.c
index 79cd93c8c5ed..84b44f9cd42a 100644
--- a/arch/um/os-Linux/sys-i386/registers.c
+++ b/arch/um/os-Linux/sys-i386/registers.c
@@ -15,7 +15,7 @@
15 15
16/* These are set once at boot time and not changed thereafter */ 16/* These are set once at boot time and not changed thereafter */
17 17
18static unsigned long exec_regs[HOST_FRAME_SIZE]; 18static unsigned long exec_regs[MAX_REG_NR];
19static unsigned long exec_fp_regs[HOST_FP_SIZE]; 19static unsigned long exec_fp_regs[HOST_FP_SIZE];
20static unsigned long exec_fpx_regs[HOST_XFP_SIZE]; 20static unsigned long exec_fpx_regs[HOST_XFP_SIZE];
21static int have_fpx_regs = 1; 21static int have_fpx_regs = 1;
@@ -101,6 +101,7 @@ void init_registers(int pid)
101{ 101{
102 int err; 102 int err;
103 103
104 memset(exec_regs, 0, sizeof(exec_regs));
104 err = ptrace(PTRACE_GETREGS, pid, 0, exec_regs); 105 err = ptrace(PTRACE_GETREGS, pid, 0, exec_regs);
105 if(err) 106 if(err)
106 panic("check_ptrace : PTRACE_GETREGS failed, errno = %d", 107 panic("check_ptrace : PTRACE_GETREGS failed, errno = %d",
@@ -124,7 +125,7 @@ void init_registers(int pid)
124 125
125void get_safe_registers(unsigned long *regs, unsigned long *fp_regs) 126void get_safe_registers(unsigned long *regs, unsigned long *fp_regs)
126{ 127{
127 memcpy(regs, exec_regs, HOST_FRAME_SIZE * sizeof(unsigned long)); 128 memcpy(regs, exec_regs, sizeof(exec_regs));
128 if(fp_regs != NULL) 129 if(fp_regs != NULL)
129 memcpy(fp_regs, exec_fp_regs, 130 memcpy(fp_regs, exec_fp_regs,
130 HOST_FP_SIZE * sizeof(unsigned long)); 131 HOST_FP_SIZE * sizeof(unsigned long));
diff --git a/arch/um/os-Linux/sys-x86_64/registers.c b/arch/um/os-Linux/sys-x86_64/registers.c
index a2d7e0c603f7..e6fc2179d1bc 100644
--- a/arch/um/os-Linux/sys-x86_64/registers.c
+++ b/arch/um/os-Linux/sys-x86_64/registers.c
@@ -14,7 +14,7 @@
14 14
15/* These are set once at boot time and not changed thereafter */ 15/* These are set once at boot time and not changed thereafter */
16 16
17static unsigned long exec_regs[HOST_FRAME_SIZE]; 17static unsigned long exec_regs[MAX_REG_NR];
18static unsigned long exec_fp_regs[HOST_FP_SIZE]; 18static unsigned long exec_fp_regs[HOST_FP_SIZE];
19 19
20void init_thread_registers(union uml_pt_regs *to) 20void init_thread_registers(union uml_pt_regs *to)
@@ -72,7 +72,7 @@ void init_registers(int pid)
72 72
73void get_safe_registers(unsigned long *regs, unsigned long *fp_regs) 73void get_safe_registers(unsigned long *regs, unsigned long *fp_regs)
74{ 74{
75 memcpy(regs, exec_regs, HOST_FRAME_SIZE * sizeof(unsigned long)); 75 memcpy(regs, exec_regs, sizeof(exec_regs));
76 if(fp_regs != NULL) 76 if(fp_regs != NULL)
77 memcpy(fp_regs, exec_fp_regs, 77 memcpy(fp_regs, exec_fp_regs,
78 HOST_FP_SIZE * sizeof(unsigned long)); 78 HOST_FP_SIZE * sizeof(unsigned long));
diff --git a/arch/um/sys-i386/delay.c b/arch/um/sys-i386/delay.c
index 2c11b9770e8b..d623e074f41d 100644
--- a/arch/um/sys-i386/delay.c
+++ b/arch/um/sys-i386/delay.c
@@ -27,14 +27,3 @@ void __udelay(unsigned long usecs)
27} 27}
28 28
29EXPORT_SYMBOL(__udelay); 29EXPORT_SYMBOL(__udelay);
30
31void __const_udelay(unsigned long usecs)
32{
33 int i, n;
34
35 n = (loops_per_jiffy * HZ * usecs) / MILLION;
36 for(i=0;i<n;i++)
37 cpu_relax();
38}
39
40EXPORT_SYMBOL(__const_udelay);
diff --git a/arch/um/sys-i386/ldt.c b/arch/um/sys-i386/ldt.c
index 4a8b4202ef9e..a939a7ef0227 100644
--- a/arch/um/sys-i386/ldt.c
+++ b/arch/um/sys-i386/ldt.c
@@ -394,7 +394,8 @@ static short * host_ldt_entries = NULL;
394static void ldt_get_host_info(void) 394static void ldt_get_host_info(void)
395{ 395{
396 long ret; 396 long ret;
397 struct ldt_entry * ldt, *tmp; 397 struct ldt_entry * ldt;
398 short *tmp;
398 int i, size, k, order; 399 int i, size, k, order;
399 400
400 spin_lock(&host_ldt_lock); 401 spin_lock(&host_ldt_lock);
diff --git a/arch/um/sys-x86_64/delay.c b/arch/um/sys-x86_64/delay.c
index 137f4446b439..dee5be66da82 100644
--- a/arch/um/sys-x86_64/delay.c
+++ b/arch/um/sys-x86_64/delay.c
@@ -28,14 +28,3 @@ void __udelay(unsigned long usecs)
28} 28}
29 29
30EXPORT_SYMBOL(__udelay); 30EXPORT_SYMBOL(__udelay);
31
32void __const_udelay(unsigned long usecs)
33{
34 unsigned long i, n;
35
36 n = (loops_per_jiffy * HZ * usecs) / MILLION;
37 for(i=0;i<n;i++)
38 cpu_relax();
39}
40
41EXPORT_SYMBOL(__const_udelay);
diff --git a/arch/x86_64/boot/video.S b/arch/x86_64/boot/video.S
index d6ff88f35135..6090516c9c7f 100644
--- a/arch/x86_64/boot/video.S
+++ b/arch/x86_64/boot/video.S
@@ -571,6 +571,16 @@ setr1: lodsw
571 jmp _m_s 571 jmp _m_s
572 572
573check_vesa: 573check_vesa:
574#ifdef CONFIG_FIRMWARE_EDID
575 leaw modelist+1024, %di
576 movw $0x4f00, %ax
577 int $0x10
578 cmpw $0x004f, %ax
579 jnz setbad
580
581 movw 4(%di), %ax
582 movw %ax, vbe_version
583#endif
574 leaw modelist+1024, %di 584 leaw modelist+1024, %di
575 subb $VIDEO_FIRST_VESA>>8, %bh 585 subb $VIDEO_FIRST_VESA>>8, %bh
576 movw %bx, %cx # Get mode information structure 586 movw %bx, %cx # Get mode information structure
@@ -1945,6 +1955,9 @@ store_edid:
1945 rep 1955 rep
1946 stosl 1956 stosl
1947 1957
1958 cmpw $0x0200, vbe_version # only do EDID on >= VBE2.0
1959 jl no_edid
1960
1948 pushw %es # save ES 1961 pushw %es # save ES
1949 xorw %di, %di # Report Capability 1962 xorw %di, %di # Report Capability
1950 pushw %di 1963 pushw %di
@@ -1987,6 +2000,7 @@ do_restore: .byte 0 # Screen contents altered during mode change
1987svga_prefix: .byte VIDEO_FIRST_BIOS>>8 # Default prefix for BIOS modes 2000svga_prefix: .byte VIDEO_FIRST_BIOS>>8 # Default prefix for BIOS modes
1988graphic_mode: .byte 0 # Graphic mode with a linear frame buffer 2001graphic_mode: .byte 0 # Graphic mode with a linear frame buffer
1989dac_size: .byte 6 # DAC bit depth 2002dac_size: .byte 6 # DAC bit depth
2003vbe_version: .word 0 # VBE bios version
1990 2004
1991# Status messages 2005# Status messages
1992keymsg: .ascii "Press <RETURN> to see video modes available, " 2006keymsg: .ascii "Press <RETURN> to see video modes available, "
diff --git a/arch/x86_64/kernel/acpi/sleep.c b/arch/x86_64/kernel/acpi/sleep.c
index 23178ce6c783..e1548fbe95ae 100644
--- a/arch/x86_64/kernel/acpi/sleep.c
+++ b/arch/x86_64/kernel/acpi/sleep.c
@@ -66,8 +66,10 @@ static void init_low_mapping(void)
66{ 66{
67 pgd_t *slot0 = pgd_offset(current->mm, 0UL); 67 pgd_t *slot0 = pgd_offset(current->mm, 0UL);
68 low_ptr = *slot0; 68 low_ptr = *slot0;
69 /* FIXME: We're playing with the current task's page tables here, which
70 * is potentially dangerous on SMP systems.
71 */
69 set_pgd(slot0, *pgd_offset(current->mm, PAGE_OFFSET)); 72 set_pgd(slot0, *pgd_offset(current->mm, PAGE_OFFSET));
70 WARN_ON(num_online_cpus() != 1);
71 local_flush_tlb(); 73 local_flush_tlb();
72} 74}
73 75
diff --git a/arch/x86_64/kernel/apic.c b/arch/x86_64/kernel/apic.c
index 723417d924c0..bd3e45d47c37 100644
--- a/arch/x86_64/kernel/apic.c
+++ b/arch/x86_64/kernel/apic.c
@@ -47,6 +47,10 @@ int apic_calibrate_pmtmr __initdata;
47 47
48int disable_apic_timer __initdata; 48int disable_apic_timer __initdata;
49 49
50/* Local APIC timer works in C2? */
51int local_apic_timer_c2_ok;
52EXPORT_SYMBOL_GPL(local_apic_timer_c2_ok);
53
50static struct resource *ioapic_resources; 54static struct resource *ioapic_resources;
51static struct resource lapic_resource = { 55static struct resource lapic_resource = {
52 .name = "Local APIC", 56 .name = "Local APIC",
@@ -930,9 +934,17 @@ EXPORT_SYMBOL(switch_APIC_timer_to_ipi);
930 934
931void smp_send_timer_broadcast_ipi(void) 935void smp_send_timer_broadcast_ipi(void)
932{ 936{
937 int cpu = smp_processor_id();
933 cpumask_t mask; 938 cpumask_t mask;
934 939
935 cpus_and(mask, cpu_online_map, timer_interrupt_broadcast_ipi_mask); 940 cpus_and(mask, cpu_online_map, timer_interrupt_broadcast_ipi_mask);
941
942 if (cpu_isset(cpu, mask)) {
943 cpu_clear(cpu, mask);
944 add_pda(apic_timer_irqs, 1);
945 smp_local_timer_interrupt();
946 }
947
936 if (!cpus_empty(mask)) { 948 if (!cpus_empty(mask)) {
937 send_IPI_mask(mask, LOCAL_TIMER_VECTOR); 949 send_IPI_mask(mask, LOCAL_TIMER_VECTOR);
938 } 950 }
@@ -1192,6 +1204,13 @@ static __init int setup_nolapic(char *str)
1192} 1204}
1193early_param("nolapic", setup_nolapic); 1205early_param("nolapic", setup_nolapic);
1194 1206
1207static int __init parse_lapic_timer_c2_ok(char *arg)
1208{
1209 local_apic_timer_c2_ok = 1;
1210 return 0;
1211}
1212early_param("lapic_timer_c2_ok", parse_lapic_timer_c2_ok);
1213
1195static __init int setup_noapictimer(char *str) 1214static __init int setup_noapictimer(char *str)
1196{ 1215{
1197 if (str[0] != ' ' && str[0] != 0) 1216 if (str[0] != ' ' && str[0] != 0)
diff --git a/arch/x86_64/kernel/early-quirks.c b/arch/x86_64/kernel/early-quirks.c
index 148c6bcf5bb4..fede55a53995 100644
--- a/arch/x86_64/kernel/early-quirks.c
+++ b/arch/x86_64/kernel/early-quirks.c
@@ -88,7 +88,7 @@ struct chipset {
88 void (*f)(void); 88 void (*f)(void);
89}; 89};
90 90
91static struct __initdata chipset early_qrk[] = { 91static struct chipset early_qrk[] __initdata = {
92 { PCI_VENDOR_ID_NVIDIA, nvidia_bugs }, 92 { PCI_VENDOR_ID_NVIDIA, nvidia_bugs },
93 { PCI_VENDOR_ID_VIA, via_bugs }, 93 { PCI_VENDOR_ID_VIA, via_bugs },
94 { PCI_VENDOR_ID_ATI, ati_bugs }, 94 { PCI_VENDOR_ID_ATI, ati_bugs },
diff --git a/arch/x86_64/kernel/i8259.c b/arch/x86_64/kernel/i8259.c
index 21d95b747437..489426682772 100644
--- a/arch/x86_64/kernel/i8259.c
+++ b/arch/x86_64/kernel/i8259.c
@@ -45,7 +45,7 @@
45 45
46/* 46/*
47 * ISA PIC or low IO-APIC triggered (INTA-cycle or APIC) interrupts: 47 * ISA PIC or low IO-APIC triggered (INTA-cycle or APIC) interrupts:
48 * (these are usually mapped to vectors 0x20-0x2f) 48 * (these are usually mapped to vectors 0x30-0x3f)
49 */ 49 */
50 50
51/* 51/*
@@ -299,7 +299,7 @@ void init_8259A(int auto_eoi)
299 * outb_p - this has to work on a wide range of PC hardware. 299 * outb_p - this has to work on a wide range of PC hardware.
300 */ 300 */
301 outb_p(0x11, 0x20); /* ICW1: select 8259A-1 init */ 301 outb_p(0x11, 0x20); /* ICW1: select 8259A-1 init */
302 outb_p(IRQ0_VECTOR, 0x21); /* ICW2: 8259A-1 IR0-7 mapped to 0x20-0x27 */ 302 outb_p(IRQ0_VECTOR, 0x21); /* ICW2: 8259A-1 IR0-7 mapped to 0x30-0x37 */
303 outb_p(0x04, 0x21); /* 8259A-1 (the master) has a slave on IR2 */ 303 outb_p(0x04, 0x21); /* 8259A-1 (the master) has a slave on IR2 */
304 if (auto_eoi) 304 if (auto_eoi)
305 outb_p(0x03, 0x21); /* master does Auto EOI */ 305 outb_p(0x03, 0x21); /* master does Auto EOI */
@@ -307,7 +307,7 @@ void init_8259A(int auto_eoi)
307 outb_p(0x01, 0x21); /* master expects normal EOI */ 307 outb_p(0x01, 0x21); /* master expects normal EOI */
308 308
309 outb_p(0x11, 0xA0); /* ICW1: select 8259A-2 init */ 309 outb_p(0x11, 0xA0); /* ICW1: select 8259A-2 init */
310 outb_p(IRQ8_VECTOR, 0xA1); /* ICW2: 8259A-2 IR0-7 mapped to 0x28-0x2f */ 310 outb_p(IRQ8_VECTOR, 0xA1); /* ICW2: 8259A-2 IR0-7 mapped to 0x38-0x3f */
311 outb_p(0x02, 0xA1); /* 8259A-2 is a slave on master's IR2 */ 311 outb_p(0x02, 0xA1); /* 8259A-2 is a slave on master's IR2 */
312 outb_p(0x01, 0xA1); /* (slave's support for AEOI in flat mode 312 outb_p(0x01, 0xA1); /* (slave's support for AEOI in flat mode
313 is to be investigated) */ 313 is to be investigated) */
diff --git a/arch/x86_64/kernel/nmi.c b/arch/x86_64/kernel/nmi.c
index 82d9d85d5270..a90996c27dc8 100644
--- a/arch/x86_64/kernel/nmi.c
+++ b/arch/x86_64/kernel/nmi.c
@@ -108,64 +108,128 @@ static inline unsigned int nmi_evntsel_msr_to_bit(unsigned int msr)
108/* checks for a bit availability (hack for oprofile) */ 108/* checks for a bit availability (hack for oprofile) */
109int avail_to_resrv_perfctr_nmi_bit(unsigned int counter) 109int avail_to_resrv_perfctr_nmi_bit(unsigned int counter)
110{ 110{
111 int cpu;
111 BUG_ON(counter > NMI_MAX_COUNTER_BITS); 112 BUG_ON(counter > NMI_MAX_COUNTER_BITS);
112 113 for_each_possible_cpu (cpu) {
113 return (!test_bit(counter, &__get_cpu_var(perfctr_nmi_owner))); 114 if (test_bit(counter, &per_cpu(perfctr_nmi_owner, cpu)))
115 return 0;
116 }
117 return 1;
114} 118}
115 119
116/* checks the an msr for availability */ 120/* checks the an msr for availability */
117int avail_to_resrv_perfctr_nmi(unsigned int msr) 121int avail_to_resrv_perfctr_nmi(unsigned int msr)
118{ 122{
119 unsigned int counter; 123 unsigned int counter;
124 int cpu;
120 125
121 counter = nmi_perfctr_msr_to_bit(msr); 126 counter = nmi_perfctr_msr_to_bit(msr);
122 BUG_ON(counter > NMI_MAX_COUNTER_BITS); 127 BUG_ON(counter > NMI_MAX_COUNTER_BITS);
123 128
124 return (!test_bit(counter, &__get_cpu_var(perfctr_nmi_owner))); 129 for_each_possible_cpu (cpu) {
130 if (test_bit(counter, &per_cpu(perfctr_nmi_owner, cpu)))
131 return 0;
132 }
133 return 1;
125} 134}
126 135
127int reserve_perfctr_nmi(unsigned int msr) 136static int __reserve_perfctr_nmi(int cpu, unsigned int msr)
128{ 137{
129 unsigned int counter; 138 unsigned int counter;
139 if (cpu < 0)
140 cpu = smp_processor_id();
130 141
131 counter = nmi_perfctr_msr_to_bit(msr); 142 counter = nmi_perfctr_msr_to_bit(msr);
132 BUG_ON(counter > NMI_MAX_COUNTER_BITS); 143 BUG_ON(counter > NMI_MAX_COUNTER_BITS);
133 144
134 if (!test_and_set_bit(counter, &__get_cpu_var(perfctr_nmi_owner))) 145 if (!test_and_set_bit(counter, &per_cpu(perfctr_nmi_owner, cpu)))
135 return 1; 146 return 1;
136 return 0; 147 return 0;
137} 148}
138 149
139void release_perfctr_nmi(unsigned int msr) 150static void __release_perfctr_nmi(int cpu, unsigned int msr)
140{ 151{
141 unsigned int counter; 152 unsigned int counter;
153 if (cpu < 0)
154 cpu = smp_processor_id();
142 155
143 counter = nmi_perfctr_msr_to_bit(msr); 156 counter = nmi_perfctr_msr_to_bit(msr);
144 BUG_ON(counter > NMI_MAX_COUNTER_BITS); 157 BUG_ON(counter > NMI_MAX_COUNTER_BITS);
145 158
146 clear_bit(counter, &__get_cpu_var(perfctr_nmi_owner)); 159 clear_bit(counter, &per_cpu(perfctr_nmi_owner, cpu));
147} 160}
148 161
149int reserve_evntsel_nmi(unsigned int msr) 162int reserve_perfctr_nmi(unsigned int msr)
163{
164 int cpu, i;
165 for_each_possible_cpu (cpu) {
166 if (!__reserve_perfctr_nmi(cpu, msr)) {
167 for_each_possible_cpu (i) {
168 if (i >= cpu)
169 break;
170 __release_perfctr_nmi(i, msr);
171 }
172 return 0;
173 }
174 }
175 return 1;
176}
177
178void release_perfctr_nmi(unsigned int msr)
179{
180 int cpu;
181 for_each_possible_cpu (cpu)
182 __release_perfctr_nmi(cpu, msr);
183}
184
185int __reserve_evntsel_nmi(int cpu, unsigned int msr)
150{ 186{
151 unsigned int counter; 187 unsigned int counter;
188 if (cpu < 0)
189 cpu = smp_processor_id();
152 190
153 counter = nmi_evntsel_msr_to_bit(msr); 191 counter = nmi_evntsel_msr_to_bit(msr);
154 BUG_ON(counter > NMI_MAX_COUNTER_BITS); 192 BUG_ON(counter > NMI_MAX_COUNTER_BITS);
155 193
156 if (!test_and_set_bit(counter, &__get_cpu_var(evntsel_nmi_owner))) 194 if (!test_and_set_bit(counter, &per_cpu(evntsel_nmi_owner, cpu)[0]))
157 return 1; 195 return 1;
158 return 0; 196 return 0;
159} 197}
160 198
161void release_evntsel_nmi(unsigned int msr) 199static void __release_evntsel_nmi(int cpu, unsigned int msr)
162{ 200{
163 unsigned int counter; 201 unsigned int counter;
202 if (cpu < 0)
203 cpu = smp_processor_id();
164 204
165 counter = nmi_evntsel_msr_to_bit(msr); 205 counter = nmi_evntsel_msr_to_bit(msr);
166 BUG_ON(counter > NMI_MAX_COUNTER_BITS); 206 BUG_ON(counter > NMI_MAX_COUNTER_BITS);
167 207
168 clear_bit(counter, &__get_cpu_var(evntsel_nmi_owner)); 208 clear_bit(counter, &per_cpu(evntsel_nmi_owner, cpu)[0]);
209}
210
211int reserve_evntsel_nmi(unsigned int msr)
212{
213 int cpu, i;
214 for_each_possible_cpu (cpu) {
215 if (!__reserve_evntsel_nmi(cpu, msr)) {
216 for_each_possible_cpu (i) {
217 if (i >= cpu)
218 break;
219 __release_evntsel_nmi(i, msr);
220 }
221 return 0;
222 }
223 }
224 return 1;
225}
226
227void release_evntsel_nmi(unsigned int msr)
228{
229 int cpu;
230 for_each_possible_cpu (cpu) {
231 __release_evntsel_nmi(cpu, msr);
232 }
169} 233}
170 234
171static __cpuinit inline int nmi_known_cpu(void) 235static __cpuinit inline int nmi_known_cpu(void)
@@ -253,7 +317,7 @@ int __init check_nmi_watchdog (void)
253 for (cpu = 0; cpu < NR_CPUS; cpu++) 317 for (cpu = 0; cpu < NR_CPUS; cpu++)
254 counts[cpu] = cpu_pda(cpu)->__nmi_count; 318 counts[cpu] = cpu_pda(cpu)->__nmi_count;
255 local_irq_enable(); 319 local_irq_enable();
256 mdelay((10*1000)/nmi_hz); // wait 10 ticks 320 mdelay((20*1000)/nmi_hz); // wait 20 ticks
257 321
258 for_each_online_cpu(cpu) { 322 for_each_online_cpu(cpu) {
259 if (!per_cpu(nmi_watchdog_ctlblk, cpu).enabled) 323 if (!per_cpu(nmi_watchdog_ctlblk, cpu).enabled)
@@ -472,10 +536,10 @@ static int setup_k7_watchdog(void)
472 536
473 perfctr_msr = MSR_K7_PERFCTR0; 537 perfctr_msr = MSR_K7_PERFCTR0;
474 evntsel_msr = MSR_K7_EVNTSEL0; 538 evntsel_msr = MSR_K7_EVNTSEL0;
475 if (!reserve_perfctr_nmi(perfctr_msr)) 539 if (!__reserve_perfctr_nmi(-1, perfctr_msr))
476 goto fail; 540 goto fail;
477 541
478 if (!reserve_evntsel_nmi(evntsel_msr)) 542 if (!__reserve_evntsel_nmi(-1, evntsel_msr))
479 goto fail1; 543 goto fail1;
480 544
481 /* Simulator may not support it */ 545 /* Simulator may not support it */
@@ -501,9 +565,9 @@ static int setup_k7_watchdog(void)
501 wd->check_bit = 1ULL<<63; 565 wd->check_bit = 1ULL<<63;
502 return 1; 566 return 1;
503fail2: 567fail2:
504 release_evntsel_nmi(evntsel_msr); 568 __release_evntsel_nmi(-1, evntsel_msr);
505fail1: 569fail1:
506 release_perfctr_nmi(perfctr_msr); 570 __release_perfctr_nmi(-1, perfctr_msr);
507fail: 571fail:
508 return 0; 572 return 0;
509} 573}
@@ -514,8 +578,8 @@ static void stop_k7_watchdog(void)
514 578
515 wrmsr(wd->evntsel_msr, 0, 0); 579 wrmsr(wd->evntsel_msr, 0, 0);
516 580
517 release_evntsel_nmi(wd->evntsel_msr); 581 __release_evntsel_nmi(-1, wd->evntsel_msr);
518 release_perfctr_nmi(wd->perfctr_msr); 582 __release_perfctr_nmi(-1, wd->perfctr_msr);
519} 583}
520 584
521/* Note that these events don't tick when the CPU idles. This means 585/* Note that these events don't tick when the CPU idles. This means
@@ -581,10 +645,10 @@ static int setup_p4_watchdog(void)
581 cccr_val = P4_CCCR_OVF_PMI1 | P4_CCCR_ESCR_SELECT(4); 645 cccr_val = P4_CCCR_OVF_PMI1 | P4_CCCR_ESCR_SELECT(4);
582 } 646 }
583 647
584 if (!reserve_perfctr_nmi(perfctr_msr)) 648 if (!__reserve_perfctr_nmi(-1, perfctr_msr))
585 goto fail; 649 goto fail;
586 650
587 if (!reserve_evntsel_nmi(evntsel_msr)) 651 if (!__reserve_evntsel_nmi(-1, evntsel_msr))
588 goto fail1; 652 goto fail1;
589 653
590 evntsel = P4_ESCR_EVENT_SELECT(0x3F) 654 evntsel = P4_ESCR_EVENT_SELECT(0x3F)
@@ -609,7 +673,7 @@ static int setup_p4_watchdog(void)
609 wd->check_bit = 1ULL<<39; 673 wd->check_bit = 1ULL<<39;
610 return 1; 674 return 1;
611fail1: 675fail1:
612 release_perfctr_nmi(perfctr_msr); 676 __release_perfctr_nmi(-1, perfctr_msr);
613fail: 677fail:
614 return 0; 678 return 0;
615} 679}
@@ -621,8 +685,8 @@ static void stop_p4_watchdog(void)
621 wrmsr(wd->cccr_msr, 0, 0); 685 wrmsr(wd->cccr_msr, 0, 0);
622 wrmsr(wd->evntsel_msr, 0, 0); 686 wrmsr(wd->evntsel_msr, 0, 0);
623 687
624 release_evntsel_nmi(wd->evntsel_msr); 688 __release_evntsel_nmi(-1, wd->evntsel_msr);
625 release_perfctr_nmi(wd->perfctr_msr); 689 __release_perfctr_nmi(-1, wd->perfctr_msr);
626} 690}
627 691
628#define ARCH_PERFMON_NMI_EVENT_SEL ARCH_PERFMON_UNHALTED_CORE_CYCLES_SEL 692#define ARCH_PERFMON_NMI_EVENT_SEL ARCH_PERFMON_UNHALTED_CORE_CYCLES_SEL
@@ -650,10 +714,10 @@ static int setup_intel_arch_watchdog(void)
650 perfctr_msr = MSR_ARCH_PERFMON_PERFCTR0; 714 perfctr_msr = MSR_ARCH_PERFMON_PERFCTR0;
651 evntsel_msr = MSR_ARCH_PERFMON_EVENTSEL0; 715 evntsel_msr = MSR_ARCH_PERFMON_EVENTSEL0;
652 716
653 if (!reserve_perfctr_nmi(perfctr_msr)) 717 if (!__reserve_perfctr_nmi(-1, perfctr_msr))
654 goto fail; 718 goto fail;
655 719
656 if (!reserve_evntsel_nmi(evntsel_msr)) 720 if (!__reserve_evntsel_nmi(-1, evntsel_msr))
657 goto fail1; 721 goto fail1;
658 722
659 wrmsrl(perfctr_msr, 0UL); 723 wrmsrl(perfctr_msr, 0UL);
@@ -680,7 +744,7 @@ static int setup_intel_arch_watchdog(void)
680 wd->check_bit = 1ULL << (eax.split.bit_width - 1); 744 wd->check_bit = 1ULL << (eax.split.bit_width - 1);
681 return 1; 745 return 1;
682fail1: 746fail1:
683 release_perfctr_nmi(perfctr_msr); 747 __release_perfctr_nmi(-1, perfctr_msr);
684fail: 748fail:
685 return 0; 749 return 0;
686} 750}
@@ -704,8 +768,8 @@ static void stop_intel_arch_watchdog(void)
704 768
705 wrmsr(wd->evntsel_msr, 0, 0); 769 wrmsr(wd->evntsel_msr, 0, 0);
706 770
707 release_evntsel_nmi(wd->evntsel_msr); 771 __release_evntsel_nmi(-1, wd->evntsel_msr);
708 release_perfctr_nmi(wd->perfctr_msr); 772 __release_perfctr_nmi(-1, wd->perfctr_msr);
709} 773}
710 774
711void setup_apic_nmi_watchdog(void *unused) 775void setup_apic_nmi_watchdog(void *unused)
diff --git a/block/elevator.c b/block/elevator.c
index 25f6ef28e3bb..96a00c822748 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -964,17 +964,18 @@ void elv_unregister_queue(struct request_queue *q)
964 964
965int elv_register(struct elevator_type *e) 965int elv_register(struct elevator_type *e)
966{ 966{
967 char *def = "";
967 spin_lock_irq(&elv_list_lock); 968 spin_lock_irq(&elv_list_lock);
968 BUG_ON(elevator_find(e->elevator_name)); 969 BUG_ON(elevator_find(e->elevator_name));
969 list_add_tail(&e->list, &elv_list); 970 list_add_tail(&e->list, &elv_list);
970 spin_unlock_irq(&elv_list_lock); 971 spin_unlock_irq(&elv_list_lock);
971 972
972 printk(KERN_INFO "io scheduler %s registered", e->elevator_name);
973 if (!strcmp(e->elevator_name, chosen_elevator) || 973 if (!strcmp(e->elevator_name, chosen_elevator) ||
974 (!*chosen_elevator && 974 (!*chosen_elevator &&
975 !strcmp(e->elevator_name, CONFIG_DEFAULT_IOSCHED))) 975 !strcmp(e->elevator_name, CONFIG_DEFAULT_IOSCHED)))
976 printk(" (default)"); 976 def = " (default)";
977 printk("\n"); 977
978 printk(KERN_INFO "io scheduler %s registered%s\n", e->elevator_name, def);
978 return 0; 979 return 0;
979} 980}
980EXPORT_SYMBOL_GPL(elv_register); 981EXPORT_SYMBOL_GPL(elv_register);
diff --git a/block/genhd.c b/block/genhd.c
index 050a1f0f3a86..441432a142f2 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -62,8 +62,6 @@ int register_blkdev(unsigned int major, const char *name)
62 /* temporary */ 62 /* temporary */
63 if (major == 0) { 63 if (major == 0) {
64 for (index = ARRAY_SIZE(major_names)-1; index > 0; index--) { 64 for (index = ARRAY_SIZE(major_names)-1; index > 0; index--) {
65 if (is_lanana_major(index))
66 continue;
67 if (major_names[index] == NULL) 65 if (major_names[index] == NULL)
68 break; 66 break;
69 } 67 }
diff --git a/block/ll_rw_blk.c b/block/ll_rw_blk.c
index 38c293b987b7..3de06953ac33 100644
--- a/block/ll_rw_blk.c
+++ b/block/ll_rw_blk.c
@@ -1221,7 +1221,7 @@ void blk_recount_segments(request_queue_t *q, struct bio *bio)
1221 * considered part of another segment, since that might 1221 * considered part of another segment, since that might
1222 * change with the bounce page. 1222 * change with the bounce page.
1223 */ 1223 */
1224 high = page_to_pfn(bv->bv_page) >= q->bounce_pfn; 1224 high = page_to_pfn(bv->bv_page) > q->bounce_pfn;
1225 if (high || highprv) 1225 if (high || highprv)
1226 goto new_hw_segment; 1226 goto new_hw_segment;
1227 if (cluster) { 1227 if (cluster) {
@@ -3658,8 +3658,8 @@ int __init blk_dev_init(void)
3658 open_softirq(BLOCK_SOFTIRQ, blk_done_softirq, NULL); 3658 open_softirq(BLOCK_SOFTIRQ, blk_done_softirq, NULL);
3659 register_hotcpu_notifier(&blk_cpu_notifier); 3659 register_hotcpu_notifier(&blk_cpu_notifier);
3660 3660
3661 blk_max_low_pfn = max_low_pfn; 3661 blk_max_low_pfn = max_low_pfn - 1;
3662 blk_max_pfn = max_pfn; 3662 blk_max_pfn = max_pfn - 1;
3663 3663
3664 return 0; 3664 return 0;
3665} 3665}
diff --git a/crypto/scatterwalk.c b/crypto/scatterwalk.c
index a66423121773..81afd1790a1d 100644
--- a/crypto/scatterwalk.c
+++ b/crypto/scatterwalk.c
@@ -59,8 +59,12 @@ EXPORT_SYMBOL_GPL(scatterwalk_map);
59static void scatterwalk_pagedone(struct scatter_walk *walk, int out, 59static void scatterwalk_pagedone(struct scatter_walk *walk, int out,
60 unsigned int more) 60 unsigned int more)
61{ 61{
62 if (out) 62 if (out) {
63 flush_dcache_page(scatterwalk_page(walk)); 63 struct page *page;
64
65 page = walk->sg->page + ((walk->offset - 1) >> PAGE_SHIFT);
66 flush_dcache_page(page);
67 }
64 68
65 if (more) { 69 if (more) {
66 walk->offset += PAGE_SIZE - 1; 70 walk->offset += PAGE_SIZE - 1;
@@ -91,7 +95,7 @@ void scatterwalk_copychunks(void *buf, struct scatter_walk *walk,
91 memcpy_dir(buf, vaddr, len_this_page, out); 95 memcpy_dir(buf, vaddr, len_this_page, out);
92 scatterwalk_unmap(vaddr, out); 96 scatterwalk_unmap(vaddr, out);
93 97
94 scatterwalk_advance(walk, nbytes); 98 scatterwalk_advance(walk, len_this_page);
95 99
96 if (nbytes == len_this_page) 100 if (nbytes == len_this_page)
97 break; 101 break;
diff --git a/drivers/acpi/events/evmisc.c b/drivers/acpi/events/evmisc.c
index 3a799b9b5df5..cae786ca8600 100644
--- a/drivers/acpi/events/evmisc.c
+++ b/drivers/acpi/events/evmisc.c
@@ -196,11 +196,15 @@ acpi_ev_queue_notify_request(struct acpi_namespace_node * node,
196 notify_info->notify.value = (u16) notify_value; 196 notify_info->notify.value = (u16) notify_value;
197 notify_info->notify.handler_obj = handler_obj; 197 notify_info->notify.handler_obj = handler_obj;
198 198
199 acpi_ex_relinquish_interpreter(); 199 acpi_ex_exit_interpreter();
200 200
201 acpi_ev_notify_dispatch(notify_info); 201 acpi_ev_notify_dispatch(notify_info);
202 202
203 acpi_ex_reacquire_interpreter(); 203 status = acpi_ex_enter_interpreter();
204 if (ACPI_FAILURE(status)) {
205 return_ACPI_STATUS(status);
206 }
207
204 } 208 }
205 209
206 if (!handler_obj) { 210 if (!handler_obj) {
diff --git a/drivers/acpi/events/evregion.c b/drivers/acpi/events/evregion.c
index e99f0c435a47..96b0e8431748 100644
--- a/drivers/acpi/events/evregion.c
+++ b/drivers/acpi/events/evregion.c
@@ -291,6 +291,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
291 u32 bit_width, acpi_integer * value) 291 u32 bit_width, acpi_integer * value)
292{ 292{
293 acpi_status status; 293 acpi_status status;
294 acpi_status status2;
294 acpi_adr_space_handler handler; 295 acpi_adr_space_handler handler;
295 acpi_adr_space_setup region_setup; 296 acpi_adr_space_setup region_setup;
296 union acpi_operand_object *handler_desc; 297 union acpi_operand_object *handler_desc;
@@ -344,7 +345,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
344 * setup will potentially execute control methods 345 * setup will potentially execute control methods
345 * (e.g., _REG method for this region) 346 * (e.g., _REG method for this region)
346 */ 347 */
347 acpi_ex_relinquish_interpreter(); 348 acpi_ex_exit_interpreter();
348 349
349 status = region_setup(region_obj, ACPI_REGION_ACTIVATE, 350 status = region_setup(region_obj, ACPI_REGION_ACTIVATE,
350 handler_desc->address_space.context, 351 handler_desc->address_space.context,
@@ -352,7 +353,10 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
352 353
353 /* Re-enter the interpreter */ 354 /* Re-enter the interpreter */
354 355
355 acpi_ex_reacquire_interpreter(); 356 status2 = acpi_ex_enter_interpreter();
357 if (ACPI_FAILURE(status2)) {
358 return_ACPI_STATUS(status2);
359 }
356 360
357 /* Check for failure of the Region Setup */ 361 /* Check for failure of the Region Setup */
358 362
@@ -405,7 +409,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
405 * exit the interpreter because the handler *might* block -- we don't 409 * exit the interpreter because the handler *might* block -- we don't
406 * know what it will do, so we can't hold the lock on the intepreter. 410 * know what it will do, so we can't hold the lock on the intepreter.
407 */ 411 */
408 acpi_ex_relinquish_interpreter(); 412 acpi_ex_exit_interpreter();
409 } 413 }
410 414
411 /* Call the handler */ 415 /* Call the handler */
@@ -426,7 +430,10 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
426 * We just returned from a non-default handler, we must re-enter the 430 * We just returned from a non-default handler, we must re-enter the
427 * interpreter 431 * interpreter
428 */ 432 */
429 acpi_ex_reacquire_interpreter(); 433 status2 = acpi_ex_enter_interpreter();
434 if (ACPI_FAILURE(status2)) {
435 return_ACPI_STATUS(status2);
436 }
430 } 437 }
431 438
432 return_ACPI_STATUS(status); 439 return_ACPI_STATUS(status);
diff --git a/drivers/acpi/events/evxface.c b/drivers/acpi/events/evxface.c
index 685a103a3587..a3379bafa676 100644
--- a/drivers/acpi/events/evxface.c
+++ b/drivers/acpi/events/evxface.c
@@ -768,9 +768,11 @@ acpi_status acpi_acquire_global_lock(u16 timeout, u32 * handle)
768 return (AE_BAD_PARAMETER); 768 return (AE_BAD_PARAMETER);
769 } 769 }
770 770
771 /* Must lock interpreter to prevent race conditions */ 771 status = acpi_ex_enter_interpreter();
772 if (ACPI_FAILURE(status)) {
773 return (status);
774 }
772 775
773 acpi_ex_enter_interpreter();
774 status = acpi_ev_acquire_global_lock(timeout); 776 status = acpi_ev_acquire_global_lock(timeout);
775 acpi_ex_exit_interpreter(); 777 acpi_ex_exit_interpreter();
776 778
diff --git a/drivers/acpi/executer/excreate.c b/drivers/acpi/executer/excreate.c
index 7c38528a7e83..ae97812681a3 100644
--- a/drivers/acpi/executer/excreate.c
+++ b/drivers/acpi/executer/excreate.c
@@ -583,7 +583,10 @@ acpi_ex_create_method(u8 * aml_start,
583 * Get the sync_level. If method is serialized, a mutex will be 583 * Get the sync_level. If method is serialized, a mutex will be
584 * created for this method when it is parsed. 584 * created for this method when it is parsed.
585 */ 585 */
586 if (method_flags & AML_METHOD_SERIALIZED) { 586 if (acpi_gbl_all_methods_serialized) {
587 obj_desc->method.sync_level = 0;
588 obj_desc->method.method_flags |= AML_METHOD_SERIALIZED;
589 } else if (method_flags & AML_METHOD_SERIALIZED) {
587 /* 590 /*
588 * ACPI 1.0: sync_level = 0 591 * ACPI 1.0: sync_level = 0
589 * ACPI 2.0: sync_level = sync_level in method declaration 592 * ACPI 2.0: sync_level = sync_level in method declaration
diff --git a/drivers/acpi/executer/exsystem.c b/drivers/acpi/executer/exsystem.c
index 9460baff3032..b2edf620ba89 100644
--- a/drivers/acpi/executer/exsystem.c
+++ b/drivers/acpi/executer/exsystem.c
@@ -66,6 +66,7 @@ ACPI_MODULE_NAME("exsystem")
66acpi_status acpi_ex_system_wait_semaphore(acpi_semaphore semaphore, u16 timeout) 66acpi_status acpi_ex_system_wait_semaphore(acpi_semaphore semaphore, u16 timeout)
67{ 67{
68 acpi_status status; 68 acpi_status status;
69 acpi_status status2;
69 70
70 ACPI_FUNCTION_TRACE(ex_system_wait_semaphore); 71 ACPI_FUNCTION_TRACE(ex_system_wait_semaphore);
71 72
@@ -78,7 +79,7 @@ acpi_status acpi_ex_system_wait_semaphore(acpi_semaphore semaphore, u16 timeout)
78 79
79 /* We must wait, so unlock the interpreter */ 80 /* We must wait, so unlock the interpreter */
80 81
81 acpi_ex_relinquish_interpreter(); 82 acpi_ex_exit_interpreter();
82 83
83 status = acpi_os_wait_semaphore(semaphore, 1, timeout); 84 status = acpi_os_wait_semaphore(semaphore, 1, timeout);
84 85
@@ -88,7 +89,13 @@ acpi_status acpi_ex_system_wait_semaphore(acpi_semaphore semaphore, u16 timeout)
88 89
89 /* Reacquire the interpreter */ 90 /* Reacquire the interpreter */
90 91
91 acpi_ex_reacquire_interpreter(); 92 status2 = acpi_ex_enter_interpreter();
93 if (ACPI_FAILURE(status2)) {
94
95 /* Report fatal error, could not acquire interpreter */
96
97 return_ACPI_STATUS(status2);
98 }
92 } 99 }
93 100
94 return_ACPI_STATUS(status); 101 return_ACPI_STATUS(status);
@@ -112,6 +119,7 @@ acpi_status acpi_ex_system_wait_semaphore(acpi_semaphore semaphore, u16 timeout)
112acpi_status acpi_ex_system_wait_mutex(acpi_mutex mutex, u16 timeout) 119acpi_status acpi_ex_system_wait_mutex(acpi_mutex mutex, u16 timeout)
113{ 120{
114 acpi_status status; 121 acpi_status status;
122 acpi_status status2;
115 123
116 ACPI_FUNCTION_TRACE(ex_system_wait_mutex); 124 ACPI_FUNCTION_TRACE(ex_system_wait_mutex);
117 125
@@ -124,7 +132,7 @@ acpi_status acpi_ex_system_wait_mutex(acpi_mutex mutex, u16 timeout)
124 132
125 /* We must wait, so unlock the interpreter */ 133 /* We must wait, so unlock the interpreter */
126 134
127 acpi_ex_relinquish_interpreter(); 135 acpi_ex_exit_interpreter();
128 136
129 status = acpi_os_acquire_mutex(mutex, timeout); 137 status = acpi_os_acquire_mutex(mutex, timeout);
130 138
@@ -134,7 +142,13 @@ acpi_status acpi_ex_system_wait_mutex(acpi_mutex mutex, u16 timeout)
134 142
135 /* Reacquire the interpreter */ 143 /* Reacquire the interpreter */
136 144
137 acpi_ex_reacquire_interpreter(); 145 status2 = acpi_ex_enter_interpreter();
146 if (ACPI_FAILURE(status2)) {
147
148 /* Report fatal error, could not acquire interpreter */
149
150 return_ACPI_STATUS(status2);
151 }
138 } 152 }
139 153
140 return_ACPI_STATUS(status); 154 return_ACPI_STATUS(status);
@@ -195,18 +209,20 @@ acpi_status acpi_ex_system_do_stall(u32 how_long)
195 209
196acpi_status acpi_ex_system_do_suspend(acpi_integer how_long) 210acpi_status acpi_ex_system_do_suspend(acpi_integer how_long)
197{ 211{
212 acpi_status status;
213
198 ACPI_FUNCTION_ENTRY(); 214 ACPI_FUNCTION_ENTRY();
199 215
200 /* Since this thread will sleep, we must release the interpreter */ 216 /* Since this thread will sleep, we must release the interpreter */
201 217
202 acpi_ex_relinquish_interpreter(); 218 acpi_ex_exit_interpreter();
203 219
204 acpi_os_sleep(how_long); 220 acpi_os_sleep(how_long);
205 221
206 /* And now we must get the interpreter again */ 222 /* And now we must get the interpreter again */
207 223
208 acpi_ex_reacquire_interpreter(); 224 status = acpi_ex_enter_interpreter();
209 return (AE_OK); 225 return (status);
210} 226}
211 227
212/******************************************************************************* 228/*******************************************************************************
diff --git a/drivers/acpi/executer/exutils.c b/drivers/acpi/executer/exutils.c
index 6b0aeccbb69b..aea461f3a48c 100644
--- a/drivers/acpi/executer/exutils.c
+++ b/drivers/acpi/executer/exutils.c
@@ -76,15 +76,14 @@ static u32 acpi_ex_digits_needed(acpi_integer value, u32 base);
76 * 76 *
77 * PARAMETERS: None 77 * PARAMETERS: None
78 * 78 *
79 * RETURN: None 79 * RETURN: Status
80 * 80 *
81 * DESCRIPTION: Enter the interpreter execution region. Failure to enter 81 * DESCRIPTION: Enter the interpreter execution region. Failure to enter
82 * the interpreter region is a fatal system error. Used in 82 * the interpreter region is a fatal system error
83 * conjunction with exit_interpreter.
84 * 83 *
85 ******************************************************************************/ 84 ******************************************************************************/
86 85
87void acpi_ex_enter_interpreter(void) 86acpi_status acpi_ex_enter_interpreter(void)
88{ 87{
89 acpi_status status; 88 acpi_status status;
90 89
@@ -92,42 +91,10 @@ void acpi_ex_enter_interpreter(void)
92 91
93 status = acpi_ut_acquire_mutex(ACPI_MTX_INTERPRETER); 92 status = acpi_ut_acquire_mutex(ACPI_MTX_INTERPRETER);
94 if (ACPI_FAILURE(status)) { 93 if (ACPI_FAILURE(status)) {
95 ACPI_ERROR((AE_INFO, 94 ACPI_ERROR((AE_INFO, "Could not acquire interpreter mutex"));
96 "Could not acquire AML Interpreter mutex"));
97 } 95 }
98 96
99 return_VOID; 97 return_ACPI_STATUS(status);
100}
101
102/*******************************************************************************
103 *
104 * FUNCTION: acpi_ex_reacquire_interpreter
105 *
106 * PARAMETERS: None
107 *
108 * RETURN: None
109 *
110 * DESCRIPTION: Reacquire the interpreter execution region from within the
111 * interpreter code. Failure to enter the interpreter region is a
112 * fatal system error. Used in conjuction with
113 * relinquish_interpreter
114 *
115 ******************************************************************************/
116
117void acpi_ex_reacquire_interpreter(void)
118{
119 ACPI_FUNCTION_TRACE(ex_reacquire_interpreter);
120
121 /*
122 * If the global serialized flag is set, do not release the interpreter,
123 * since it was not actually released by acpi_ex_relinquish_interpreter.
124 * This forces the interpreter to be single threaded.
125 */
126 if (!acpi_gbl_all_methods_serialized) {
127 acpi_ex_enter_interpreter();
128 }
129
130 return_VOID;
131} 98}
132 99
133/******************************************************************************* 100/*******************************************************************************
@@ -138,9 +105,17 @@ void acpi_ex_reacquire_interpreter(void)
138 * 105 *
139 * RETURN: None 106 * RETURN: None
140 * 107 *
141 * DESCRIPTION: Exit the interpreter execution region. This is the top level 108 * DESCRIPTION: Exit the interpreter execution region
142 * routine used to exit the interpreter when all processing has 109 *
143 * been completed. 110 * Cases where the interpreter is unlocked:
111 * 1) Completion of the execution of a control method
112 * 2) Method blocked on a Sleep() AML opcode
113 * 3) Method blocked on an Acquire() AML opcode
114 * 4) Method blocked on a Wait() AML opcode
115 * 5) Method blocked to acquire the global lock
116 * 6) Method blocked to execute a serialized control method that is
117 * already executing
118 * 7) About to invoke a user-installed opregion handler
144 * 119 *
145 ******************************************************************************/ 120 ******************************************************************************/
146 121
@@ -152,46 +127,7 @@ void acpi_ex_exit_interpreter(void)
152 127
153 status = acpi_ut_release_mutex(ACPI_MTX_INTERPRETER); 128 status = acpi_ut_release_mutex(ACPI_MTX_INTERPRETER);
154 if (ACPI_FAILURE(status)) { 129 if (ACPI_FAILURE(status)) {
155 ACPI_ERROR((AE_INFO, 130 ACPI_ERROR((AE_INFO, "Could not release interpreter mutex"));
156 "Could not release AML Interpreter mutex"));
157 }
158
159 return_VOID;
160}
161
162/*******************************************************************************
163 *
164 * FUNCTION: acpi_ex_relinquish_interpreter
165 *
166 * PARAMETERS: None
167 *
168 * RETURN: None
169 *
170 * DESCRIPTION: Exit the interpreter execution region, from within the
171 * interpreter - before attempting an operation that will possibly
172 * block the running thread.
173 *
174 * Cases where the interpreter is unlocked internally
175 * 1) Method to be blocked on a Sleep() AML opcode
176 * 2) Method to be blocked on an Acquire() AML opcode
177 * 3) Method to be blocked on a Wait() AML opcode
178 * 4) Method to be blocked to acquire the global lock
179 * 5) Method to be blocked waiting to execute a serialized control method
180 * that is currently executing
181 * 6) About to invoke a user-installed opregion handler
182 *
183 ******************************************************************************/
184
185void acpi_ex_relinquish_interpreter(void)
186{
187 ACPI_FUNCTION_TRACE(ex_relinquish_interpreter);
188
189 /*
190 * If the global serialized flag is set, do not release the interpreter.
191 * This forces the interpreter to be single threaded.
192 */
193 if (!acpi_gbl_all_methods_serialized) {
194 acpi_ex_exit_interpreter();
195 } 131 }
196 132
197 return_VOID; 133 return_VOID;
@@ -205,8 +141,8 @@ void acpi_ex_relinquish_interpreter(void)
205 * 141 *
206 * RETURN: none 142 * RETURN: none
207 * 143 *
208 * DESCRIPTION: Truncate an ACPI Integer to 32 bits if the execution mode is 144 * DESCRIPTION: Truncate a number to 32-bits if the currently executing method
209 * 32-bit, as determined by the revision of the DSDT. 145 * belongs to a 32-bit ACPI table.
210 * 146 *
211 ******************************************************************************/ 147 ******************************************************************************/
212 148
diff --git a/drivers/acpi/hardware/hwsleep.c b/drivers/acpi/hardware/hwsleep.c
index 8fa93125fd4c..c84b1faba28c 100644
--- a/drivers/acpi/hardware/hwsleep.c
+++ b/drivers/acpi/hardware/hwsleep.c
@@ -300,6 +300,11 @@ acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state)
300 /* 300 /*
301 * 2) Enable all wakeup GPEs 301 * 2) Enable all wakeup GPEs
302 */ 302 */
303 status = acpi_hw_disable_all_gpes();
304 if (ACPI_FAILURE(status)) {
305 return_ACPI_STATUS(status);
306 }
307
303 acpi_gbl_system_awake_and_running = FALSE; 308 acpi_gbl_system_awake_and_running = FALSE;
304 309
305 status = acpi_hw_enable_all_wakeup_gpes(); 310 status = acpi_hw_enable_all_wakeup_gpes();
diff --git a/drivers/acpi/ibm_acpi.c b/drivers/acpi/ibm_acpi.c
index 36901362fd24..dc1096608f43 100644
--- a/drivers/acpi/ibm_acpi.c
+++ b/drivers/acpi/ibm_acpi.c
@@ -2507,7 +2507,7 @@ static int __init setup_notify(struct ibm_struct *ibm)
2507 ret = acpi_bus_get_device(*ibm->handle, &ibm->device); 2507 ret = acpi_bus_get_device(*ibm->handle, &ibm->device);
2508 if (ret < 0) { 2508 if (ret < 0) {
2509 printk(IBM_ERR "%s device not present\n", ibm->name); 2509 printk(IBM_ERR "%s device not present\n", ibm->name);
2510 return 0; 2510 return -ENODEV;
2511 } 2511 }
2512 2512
2513 acpi_driver_data(ibm->device) = ibm; 2513 acpi_driver_data(ibm->device) = ibm;
@@ -2516,8 +2516,13 @@ static int __init setup_notify(struct ibm_struct *ibm)
2516 status = acpi_install_notify_handler(*ibm->handle, ibm->type, 2516 status = acpi_install_notify_handler(*ibm->handle, ibm->type,
2517 dispatch_notify, ibm); 2517 dispatch_notify, ibm);
2518 if (ACPI_FAILURE(status)) { 2518 if (ACPI_FAILURE(status)) {
2519 printk(IBM_ERR "acpi_install_notify_handler(%s) failed: %d\n", 2519 if (status == AE_ALREADY_EXISTS) {
2520 ibm->name, status); 2520 printk(IBM_NOTICE "another device driver is already handling %s events\n",
2521 ibm->name);
2522 } else {
2523 printk(IBM_ERR "acpi_install_notify_handler(%s) failed: %d\n",
2524 ibm->name, status);
2525 }
2521 return -ENODEV; 2526 return -ENODEV;
2522 } 2527 }
2523 ibm->notify_installed = 1; 2528 ibm->notify_installed = 1;
@@ -2553,6 +2558,8 @@ static int __init register_driver(struct ibm_struct *ibm)
2553 return ret; 2558 return ret;
2554} 2559}
2555 2560
2561static void ibm_exit(struct ibm_struct *ibm);
2562
2556static int __init ibm_init(struct ibm_struct *ibm) 2563static int __init ibm_init(struct ibm_struct *ibm)
2557{ 2564{
2558 int ret; 2565 int ret;
@@ -2594,6 +2601,12 @@ static int __init ibm_init(struct ibm_struct *ibm)
2594 2601
2595 if (ibm->notify) { 2602 if (ibm->notify) {
2596 ret = setup_notify(ibm); 2603 ret = setup_notify(ibm);
2604 if (ret == -ENODEV) {
2605 printk(IBM_NOTICE "disabling subdriver %s\n",
2606 ibm->name);
2607 ibm_exit(ibm);
2608 return 0;
2609 }
2597 if (ret < 0) 2610 if (ret < 0)
2598 return ret; 2611 return ret;
2599 } 2612 }
diff --git a/drivers/acpi/namespace/nseval.c b/drivers/acpi/namespace/nseval.c
index aa6370c67ec1..26fd0dd6953d 100644
--- a/drivers/acpi/namespace/nseval.c
+++ b/drivers/acpi/namespace/nseval.c
@@ -154,7 +154,11 @@ acpi_status acpi_ns_evaluate(struct acpi_evaluate_info *info)
154 * Execute the method via the interpreter. The interpreter is locked 154 * Execute the method via the interpreter. The interpreter is locked
155 * here before calling into the AML parser 155 * here before calling into the AML parser
156 */ 156 */
157 acpi_ex_enter_interpreter(); 157 status = acpi_ex_enter_interpreter();
158 if (ACPI_FAILURE(status)) {
159 return_ACPI_STATUS(status);
160 }
161
158 status = acpi_ps_execute_method(info); 162 status = acpi_ps_execute_method(info);
159 acpi_ex_exit_interpreter(); 163 acpi_ex_exit_interpreter();
160 } else { 164 } else {
@@ -178,7 +182,10 @@ acpi_status acpi_ns_evaluate(struct acpi_evaluate_info *info)
178 * resolution, we must lock it because we could access an opregion. 182 * resolution, we must lock it because we could access an opregion.
179 * The opregion access code assumes that the interpreter is locked. 183 * The opregion access code assumes that the interpreter is locked.
180 */ 184 */
181 acpi_ex_enter_interpreter(); 185 status = acpi_ex_enter_interpreter();
186 if (ACPI_FAILURE(status)) {
187 return_ACPI_STATUS(status);
188 }
182 189
183 /* Function has a strange interface */ 190 /* Function has a strange interface */
184 191
diff --git a/drivers/acpi/namespace/nsinit.c b/drivers/acpi/namespace/nsinit.c
index 33db2241044e..c4ab615f77fe 100644
--- a/drivers/acpi/namespace/nsinit.c
+++ b/drivers/acpi/namespace/nsinit.c
@@ -214,7 +214,7 @@ acpi_ns_init_one_object(acpi_handle obj_handle,
214 u32 level, void *context, void **return_value) 214 u32 level, void *context, void **return_value)
215{ 215{
216 acpi_object_type type; 216 acpi_object_type type;
217 acpi_status status = AE_OK; 217 acpi_status status;
218 struct acpi_init_walk_info *info = 218 struct acpi_init_walk_info *info =
219 (struct acpi_init_walk_info *)context; 219 (struct acpi_init_walk_info *)context;
220 struct acpi_namespace_node *node = 220 struct acpi_namespace_node *node =
@@ -268,7 +268,10 @@ acpi_ns_init_one_object(acpi_handle obj_handle,
268 /* 268 /*
269 * Must lock the interpreter before executing AML code 269 * Must lock the interpreter before executing AML code
270 */ 270 */
271 acpi_ex_enter_interpreter(); 271 status = acpi_ex_enter_interpreter();
272 if (ACPI_FAILURE(status)) {
273 return (status);
274 }
272 275
273 /* 276 /*
274 * Each of these types can contain executable AML code within the 277 * Each of these types can contain executable AML code within the
diff --git a/drivers/acpi/namespace/nsxfeval.c b/drivers/acpi/namespace/nsxfeval.c
index 7ac6ace50059..8904d0fae6a2 100644
--- a/drivers/acpi/namespace/nsxfeval.c
+++ b/drivers/acpi/namespace/nsxfeval.c
@@ -170,6 +170,7 @@ acpi_evaluate_object(acpi_handle handle,
170 struct acpi_buffer *return_buffer) 170 struct acpi_buffer *return_buffer)
171{ 171{
172 acpi_status status; 172 acpi_status status;
173 acpi_status status2;
173 struct acpi_evaluate_info *info; 174 struct acpi_evaluate_info *info;
174 acpi_size buffer_space_needed; 175 acpi_size buffer_space_needed;
175 u32 i; 176 u32 i;
@@ -328,12 +329,14 @@ acpi_evaluate_object(acpi_handle handle,
328 * Delete the internal return object. NOTE: Interpreter must be 329 * Delete the internal return object. NOTE: Interpreter must be
329 * locked to avoid race condition. 330 * locked to avoid race condition.
330 */ 331 */
331 acpi_ex_enter_interpreter(); 332 status2 = acpi_ex_enter_interpreter();
333 if (ACPI_SUCCESS(status2)) {
332 334
333 /* Remove one reference on the return object (should delete it) */ 335 /* Remove one reference on the return object (should delete it) */
334 336
335 acpi_ut_remove_reference(info->return_object); 337 acpi_ut_remove_reference(info->return_object);
336 acpi_ex_exit_interpreter(); 338 acpi_ex_exit_interpreter();
339 }
337 } 340 }
338 341
339 cleanup: 342 cleanup:
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index 60773005b8af..cdf78943af4d 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -268,6 +268,7 @@ static void acpi_timer_check_state(int state, struct acpi_processor *pr,
268 struct acpi_processor_cx *cx) 268 struct acpi_processor_cx *cx)
269{ 269{
270 struct acpi_processor_power *pwr = &pr->power; 270 struct acpi_processor_power *pwr = &pr->power;
271 u8 type = local_apic_timer_c2_ok ? ACPI_STATE_C3 : ACPI_STATE_C2;
271 272
272 /* 273 /*
273 * Check, if one of the previous states already marked the lapic 274 * Check, if one of the previous states already marked the lapic
@@ -276,7 +277,7 @@ static void acpi_timer_check_state(int state, struct acpi_processor *pr,
276 if (pwr->timer_broadcast_on_state < state) 277 if (pwr->timer_broadcast_on_state < state)
277 return; 278 return;
278 279
279 if (cx->type >= ACPI_STATE_C2) 280 if (cx->type >= type)
280 pr->power.timer_broadcast_on_state = state; 281 pr->power.timer_broadcast_on_state = state;
281} 282}
282 283
diff --git a/drivers/acpi/tables.c b/drivers/acpi/tables.c
index 849e2c361804..c3419182c9a7 100644
--- a/drivers/acpi/tables.c
+++ b/drivers/acpi/tables.c
@@ -42,7 +42,9 @@ static char *mps_inti_flags_trigger[] = { "dfl", "edge", "res", "level" };
42 42
43static struct acpi_table_desc initial_tables[ACPI_MAX_TABLES] __initdata; 43static struct acpi_table_desc initial_tables[ACPI_MAX_TABLES] __initdata;
44 44
45void acpi_table_print_madt_entry(struct acpi_subtable_header * header) 45static int acpi_apic_instance __initdata;
46
47void acpi_table_print_madt_entry(struct acpi_subtable_header *header)
46{ 48{
47 if (!header) 49 if (!header)
48 return; 50 return;
@@ -183,8 +185,10 @@ acpi_table_parse_entries(char *id,
183 if (!handler) 185 if (!handler)
184 return -EINVAL; 186 return -EINVAL;
185 187
186 /* Locate the table (if exists). There should only be one. */ 188 if (strncmp(id, ACPI_SIG_MADT, 4) == 0)
187 acpi_get_table(id, 0, &table_header); 189 acpi_get_table(id, acpi_apic_instance, &table_header);
190 else
191 acpi_get_table(id, 0, &table_header);
188 192
189 if (!table_header) { 193 if (!table_header) {
190 printk(KERN_WARNING PREFIX "%4.4s not present\n", id); 194 printk(KERN_WARNING PREFIX "%4.4s not present\n", id);
@@ -237,10 +241,15 @@ acpi_table_parse_madt(enum acpi_madt_type id,
237int __init acpi_table_parse(char *id, acpi_table_handler handler) 241int __init acpi_table_parse(char *id, acpi_table_handler handler)
238{ 242{
239 struct acpi_table_header *table = NULL; 243 struct acpi_table_header *table = NULL;
244
240 if (!handler) 245 if (!handler)
241 return -EINVAL; 246 return -EINVAL;
242 247
243 acpi_get_table(id, 0, &table); 248 if (strncmp(id, ACPI_SIG_MADT, 4) == 0)
249 acpi_get_table(id, acpi_apic_instance, &table);
250 else
251 acpi_get_table(id, 0, &table);
252
244 if (table) { 253 if (table) {
245 handler(table); 254 handler(table);
246 return 0; 255 return 0;
@@ -248,6 +257,31 @@ int __init acpi_table_parse(char *id, acpi_table_handler handler)
248 return 1; 257 return 1;
249} 258}
250 259
260/*
261 * The BIOS is supposed to supply a single APIC/MADT,
262 * but some report two. Provide a knob to use either.
263 * (don't you wish instance 0 and 1 were not the same?)
264 */
265static void __init check_multiple_madt(void)
266{
267 struct acpi_table_header *table = NULL;
268
269 acpi_get_table(ACPI_SIG_MADT, 2, &table);
270 if (table) {
271 printk(KERN_WARNING PREFIX
272 "BIOS bug: multiple APIC/MADT found,"
273 " using %d\n", acpi_apic_instance);
274 printk(KERN_WARNING PREFIX
275 "If \"acpi_apic_instance=%d\" works better, "
276 "notify linux-acpi@vger.kernel.org\n",
277 acpi_apic_instance ? 0 : 2);
278
279 } else
280 acpi_apic_instance = 0;
281
282 return;
283}
284
251/* 285/*
252 * acpi_table_init() 286 * acpi_table_init()
253 * 287 *
@@ -257,9 +291,22 @@ int __init acpi_table_parse(char *id, acpi_table_handler handler)
257 * result: sdt_entry[] is initialized 291 * result: sdt_entry[] is initialized
258 */ 292 */
259 293
260
261int __init acpi_table_init(void) 294int __init acpi_table_init(void)
262{ 295{
263 acpi_initialize_tables(initial_tables, ACPI_MAX_TABLES, 0); 296 acpi_initialize_tables(initial_tables, ACPI_MAX_TABLES, 0);
297 check_multiple_madt();
298 return 0;
299}
300
301static int __init acpi_parse_apic_instance(char *str)
302{
303
304 acpi_apic_instance = simple_strtoul(str, NULL, 0);
305
306 printk(KERN_NOTICE PREFIX "Shall use APIC/MADT table %d\n",
307 acpi_apic_instance);
308
264 return 0; 309 return 0;
265} 310}
311
312early_param("acpi_apic_instance", acpi_parse_apic_instance);
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index dc7b56225923..fd27227771b4 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -80,6 +80,7 @@ enum {
80 board_ahci_pi = 1, 80 board_ahci_pi = 1,
81 board_ahci_vt8251 = 2, 81 board_ahci_vt8251 = 2,
82 board_ahci_ign_iferr = 3, 82 board_ahci_ign_iferr = 3,
83 board_ahci_sb600 = 4,
83 84
84 /* global controller registers */ 85 /* global controller registers */
85 HOST_CAP = 0x00, /* host capabilities */ 86 HOST_CAP = 0x00, /* host capabilities */
@@ -168,6 +169,7 @@ enum {
168 AHCI_FLAG_NO_NCQ = (1 << 24), 169 AHCI_FLAG_NO_NCQ = (1 << 24),
169 AHCI_FLAG_IGN_IRQ_IF_ERR = (1 << 25), /* ignore IRQ_IF_ERR */ 170 AHCI_FLAG_IGN_IRQ_IF_ERR = (1 << 25), /* ignore IRQ_IF_ERR */
170 AHCI_FLAG_HONOR_PI = (1 << 26), /* honor PORTS_IMPL */ 171 AHCI_FLAG_HONOR_PI = (1 << 26), /* honor PORTS_IMPL */
172 AHCI_FLAG_IGN_SERR_INTERNAL = (1 << 27), /* ignore SERR_INTERNAL */
171}; 173};
172 174
173struct ahci_cmd_hdr { 175struct ahci_cmd_hdr {
@@ -362,6 +364,18 @@ static const struct ata_port_info ahci_port_info[] = {
362 .udma_mask = 0x7f, /* udma0-6 ; FIXME */ 364 .udma_mask = 0x7f, /* udma0-6 ; FIXME */
363 .port_ops = &ahci_ops, 365 .port_ops = &ahci_ops,
364 }, 366 },
367 /* board_ahci_sb600 */
368 {
369 .sht = &ahci_sht,
370 .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
371 ATA_FLAG_MMIO | ATA_FLAG_PIO_DMA |
372 ATA_FLAG_SKIP_D2H_BSY |
373 AHCI_FLAG_IGN_SERR_INTERNAL,
374 .pio_mask = 0x1f, /* pio0-4 */
375 .udma_mask = 0x7f, /* udma0-6 ; FIXME */
376 .port_ops = &ahci_ops,
377 },
378
365}; 379};
366 380
367static const struct pci_device_id ahci_pci_tbl[] = { 381static const struct pci_device_id ahci_pci_tbl[] = {
@@ -399,7 +413,7 @@ static const struct pci_device_id ahci_pci_tbl[] = {
399 PCI_CLASS_STORAGE_SATA_AHCI, 0xffffff, board_ahci_ign_iferr }, 413 PCI_CLASS_STORAGE_SATA_AHCI, 0xffffff, board_ahci_ign_iferr },
400 414
401 /* ATI */ 415 /* ATI */
402 { PCI_VDEVICE(ATI, 0x4380), board_ahci }, /* ATI SB600 non-raid */ 416 { PCI_VDEVICE(ATI, 0x4380), board_ahci_sb600 }, /* ATI SB600 non-raid */
403 { PCI_VDEVICE(ATI, 0x4381), board_ahci }, /* ATI SB600 raid */ 417 { PCI_VDEVICE(ATI, 0x4381), board_ahci }, /* ATI SB600 raid */
404 418
405 /* VIA */ 419 /* VIA */
@@ -1067,8 +1081,11 @@ static void ahci_error_intr(struct ata_port *ap, u32 irq_stat)
1067 if (ap->flags & AHCI_FLAG_IGN_IRQ_IF_ERR) 1081 if (ap->flags & AHCI_FLAG_IGN_IRQ_IF_ERR)
1068 irq_stat &= ~PORT_IRQ_IF_ERR; 1082 irq_stat &= ~PORT_IRQ_IF_ERR;
1069 1083
1070 if (irq_stat & PORT_IRQ_TF_ERR) 1084 if (irq_stat & PORT_IRQ_TF_ERR) {
1071 err_mask |= AC_ERR_DEV; 1085 err_mask |= AC_ERR_DEV;
1086 if (ap->flags & AHCI_FLAG_IGN_SERR_INTERNAL)
1087 serror &= ~SERR_INTERNAL;
1088 }
1072 1089
1073 if (irq_stat & (PORT_IRQ_HBUS_ERR | PORT_IRQ_HBUS_DATA_ERR)) { 1090 if (irq_stat & (PORT_IRQ_HBUS_ERR | PORT_IRQ_HBUS_DATA_ERR)) {
1074 err_mask |= AC_ERR_HOST_BUS; 1091 err_mask |= AC_ERR_HOST_BUS;
diff --git a/drivers/ata/libata-acpi.c b/drivers/ata/libata-acpi.c
index c428a56e6f31..03a0acff6cfa 100644
--- a/drivers/ata/libata-acpi.c
+++ b/drivers/ata/libata-acpi.c
@@ -305,7 +305,7 @@ static int do_drive_get_GTF(struct ata_port *ap, int ix,
305 *gtf_address = 0UL; 305 *gtf_address = 0UL;
306 *obj_loc = 0UL; 306 *obj_loc = 0UL;
307 307
308 if (noacpi) 308 if (libata_noacpi)
309 return 0; 309 return 0;
310 310
311 if (ata_msg_probe(ap)) 311 if (ata_msg_probe(ap))
@@ -531,7 +531,7 @@ static int do_drive_set_taskfiles(struct ata_port *ap,
531 ata_dev_printk(atadev, KERN_DEBUG, "%s: ENTER: port#: %d\n", 531 ata_dev_printk(atadev, KERN_DEBUG, "%s: ENTER: port#: %d\n",
532 __FUNCTION__, ap->port_no); 532 __FUNCTION__, ap->port_no);
533 533
534 if (noacpi || !(ap->cbl == ATA_CBL_SATA)) 534 if (libata_noacpi || !(ap->cbl == ATA_CBL_SATA))
535 return 0; 535 return 0;
536 536
537 if (!ata_dev_enabled(atadev) || (ap->flags & ATA_FLAG_DISABLED)) 537 if (!ata_dev_enabled(atadev) || (ap->flags & ATA_FLAG_DISABLED))
@@ -574,7 +574,7 @@ int ata_acpi_exec_tfs(struct ata_port *ap)
574 unsigned long gtf_address; 574 unsigned long gtf_address;
575 unsigned long obj_loc; 575 unsigned long obj_loc;
576 576
577 if (noacpi) 577 if (libata_noacpi)
578 return 0; 578 return 0;
579 /* 579 /*
580 * TBD - implement PATA support. For now, 580 * TBD - implement PATA support. For now,
@@ -636,7 +636,7 @@ int ata_acpi_push_id(struct ata_port *ap, unsigned int ix)
636 struct acpi_object_list input; 636 struct acpi_object_list input;
637 union acpi_object in_params[1]; 637 union acpi_object in_params[1];
638 638
639 if (noacpi) 639 if (libata_noacpi)
640 return 0; 640 return 0;
641 641
642 if (ata_msg_probe(ap)) 642 if (ata_msg_probe(ap))
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index bf327d473ce9..0abd72d0dec2 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -93,8 +93,8 @@ static int ata_probe_timeout = ATA_TMOUT_INTERNAL / HZ;
93module_param(ata_probe_timeout, int, 0444); 93module_param(ata_probe_timeout, int, 0444);
94MODULE_PARM_DESC(ata_probe_timeout, "Set ATA probing timeout (seconds)"); 94MODULE_PARM_DESC(ata_probe_timeout, "Set ATA probing timeout (seconds)");
95 95
96int noacpi; 96int libata_noacpi = 1;
97module_param(noacpi, int, 0444); 97module_param_named(noacpi, libata_noacpi, int, 0444);
98MODULE_PARM_DESC(noacpi, "Disables the use of ACPI in suspend/resume when set"); 98MODULE_PARM_DESC(noacpi, "Disables the use of ACPI in suspend/resume when set");
99 99
100MODULE_AUTHOR("Jeff Garzik"); 100MODULE_AUTHOR("Jeff Garzik");
@@ -1784,6 +1784,13 @@ int ata_dev_configure(struct ata_device *dev)
1784 dev->max_sectors = ATA_MAX_SECTORS; 1784 dev->max_sectors = ATA_MAX_SECTORS;
1785 } 1785 }
1786 1786
1787 if (ata_device_blacklisted(dev) & ATA_HORKAGE_MAX_SEC_128)
1788 dev->max_sectors = min(ATA_MAX_SECTORS_128, dev->max_sectors);
1789
1790 /* limit ATAPI DMA to R/W commands only */
1791 if (ata_device_blacklisted(dev) & ATA_HORKAGE_DMA_RW_ONLY)
1792 dev->horkage |= ATA_HORKAGE_DMA_RW_ONLY;
1793
1787 if (ap->ops->dev_config) 1794 if (ap->ops->dev_config)
1788 ap->ops->dev_config(ap, dev); 1795 ap->ops->dev_config(ap, dev);
1789 1796
@@ -3352,6 +3359,10 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
3352 { "_NEC DV5800A", NULL, ATA_HORKAGE_NODMA }, 3359 { "_NEC DV5800A", NULL, ATA_HORKAGE_NODMA },
3353 { "SAMSUNG CD-ROM SN-124","N001", ATA_HORKAGE_NODMA }, 3360 { "SAMSUNG CD-ROM SN-124","N001", ATA_HORKAGE_NODMA },
3354 3361
3362 /* Weird ATAPI devices */
3363 { "TORiSAN DVD-ROM DRD-N216", NULL, ATA_HORKAGE_MAX_SEC_128 |
3364 ATA_HORKAGE_DMA_RW_ONLY },
3365
3355 /* Devices we expect to fail diagnostics */ 3366 /* Devices we expect to fail diagnostics */
3356 3367
3357 /* Devices where NCQ should be avoided */ 3368 /* Devices where NCQ should be avoided */
@@ -3359,6 +3370,15 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
3359 { "WDC WD740ADFD-00", NULL, ATA_HORKAGE_NONCQ }, 3370 { "WDC WD740ADFD-00", NULL, ATA_HORKAGE_NONCQ },
3360 /* http://thread.gmane.org/gmane.linux.ide/14907 */ 3371 /* http://thread.gmane.org/gmane.linux.ide/14907 */
3361 { "FUJITSU MHT2060BH", NULL, ATA_HORKAGE_NONCQ }, 3372 { "FUJITSU MHT2060BH", NULL, ATA_HORKAGE_NONCQ },
3373 /* NCQ is broken */
3374 { "Maxtor 6L250S0", "BANC1G10", ATA_HORKAGE_NONCQ },
3375 /* NCQ hard hangs device under heavier load, needs hard power cycle */
3376 { "Maxtor 6B250S0", "BANC1B70", ATA_HORKAGE_NONCQ },
3377 /* Blacklist entries taken from Silicon Image 3124/3132
3378 Windows driver .inf file - also several Linux problem reports */
3379 { "HTS541060G9SA00", "MB3OC60D", ATA_HORKAGE_NONCQ, },
3380 { "HTS541080G9SA00", "MB4OC60D", ATA_HORKAGE_NONCQ, },
3381 { "HTS541010G9SA00", "MBZOC60D", ATA_HORKAGE_NONCQ, },
3362 3382
3363 /* Devices with NCQ limits */ 3383 /* Devices with NCQ limits */
3364 3384
@@ -3670,6 +3690,26 @@ int ata_check_atapi_dma(struct ata_queued_cmd *qc)
3670 struct ata_port *ap = qc->ap; 3690 struct ata_port *ap = qc->ap;
3671 int rc = 0; /* Assume ATAPI DMA is OK by default */ 3691 int rc = 0; /* Assume ATAPI DMA is OK by default */
3672 3692
3693 /* some drives can only do ATAPI DMA on read/write */
3694 if (unlikely(qc->dev->horkage & ATA_HORKAGE_DMA_RW_ONLY)) {
3695 struct scsi_cmnd *cmd = qc->scsicmd;
3696 u8 *scsicmd = cmd->cmnd;
3697
3698 switch (scsicmd[0]) {
3699 case READ_10:
3700 case WRITE_10:
3701 case READ_12:
3702 case WRITE_12:
3703 case READ_6:
3704 case WRITE_6:
3705 /* atapi dma maybe ok */
3706 break;
3707 default:
3708 /* turn off atapi dma */
3709 return 1;
3710 }
3711 }
3712
3673 if (ap->ops->check_atapi_dma) 3713 if (ap->ops->check_atapi_dma)
3674 rc = ap->ops->check_atapi_dma(qc); 3714 rc = ap->ops->check_atapi_dma(qc);
3675 3715
@@ -4713,8 +4753,8 @@ static void fill_result_tf(struct ata_queued_cmd *qc)
4713{ 4753{
4714 struct ata_port *ap = qc->ap; 4754 struct ata_port *ap = qc->ap;
4715 4755
4716 ap->ops->tf_read(ap, &qc->result_tf);
4717 qc->result_tf.flags = qc->tf.flags; 4756 qc->result_tf.flags = qc->tf.flags;
4757 ap->ops->tf_read(ap, &qc->result_tf);
4718} 4758}
4719 4759
4720/** 4760/**
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index 361953a50203..39f556c02992 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -982,26 +982,27 @@ static int ata_eh_read_log_10h(struct ata_device *dev,
982 * RETURNS: 982 * RETURNS:
983 * 0 on success, AC_ERR_* mask on failure 983 * 0 on success, AC_ERR_* mask on failure
984 */ 984 */
985static unsigned int atapi_eh_request_sense(struct ata_device *dev, 985static unsigned int atapi_eh_request_sense(struct ata_queued_cmd *qc)
986 unsigned char *sense_buf)
987{ 986{
987 struct ata_device *dev = qc->dev;
988 unsigned char *sense_buf = qc->scsicmd->sense_buffer;
988 struct ata_port *ap = dev->ap; 989 struct ata_port *ap = dev->ap;
989 struct ata_taskfile tf; 990 struct ata_taskfile tf;
990 u8 cdb[ATAPI_CDB_LEN]; 991 u8 cdb[ATAPI_CDB_LEN];
991 992
992 DPRINTK("ATAPI request sense\n"); 993 DPRINTK("ATAPI request sense\n");
993 994
994 ata_tf_init(dev, &tf);
995
996 /* FIXME: is this needed? */ 995 /* FIXME: is this needed? */
997 memset(sense_buf, 0, SCSI_SENSE_BUFFERSIZE); 996 memset(sense_buf, 0, SCSI_SENSE_BUFFERSIZE);
998 997
999 /* XXX: why tf_read here? */ 998 /* initialize sense_buf with the error register,
1000 ap->ops->tf_read(ap, &tf); 999 * for the case where they are -not- overwritten
1001 1000 */
1002 /* fill these in, for the case where they are -not- overwritten */
1003 sense_buf[0] = 0x70; 1001 sense_buf[0] = 0x70;
1004 sense_buf[2] = tf.feature >> 4; 1002 sense_buf[2] = qc->result_tf.feature >> 4;
1003
1004 /* some devices time out if garbage left in tf */
1005 ata_tf_init(dev, &tf);
1005 1006
1006 memset(cdb, 0, ATAPI_CDB_LEN); 1007 memset(cdb, 0, ATAPI_CDB_LEN);
1007 cdb[0] = REQUEST_SENSE; 1008 cdb[0] = REQUEST_SENSE;
@@ -1165,8 +1166,7 @@ static unsigned int ata_eh_analyze_tf(struct ata_queued_cmd *qc,
1165 1166
1166 case ATA_DEV_ATAPI: 1167 case ATA_DEV_ATAPI:
1167 if (!(qc->ap->pflags & ATA_PFLAG_FROZEN)) { 1168 if (!(qc->ap->pflags & ATA_PFLAG_FROZEN)) {
1168 tmp = atapi_eh_request_sense(qc->dev, 1169 tmp = atapi_eh_request_sense(qc);
1169 qc->scsicmd->sense_buffer);
1170 if (!tmp) { 1170 if (!tmp) {
1171 /* ATA_QCFLAG_SENSE_VALID is used to 1171 /* ATA_QCFLAG_SENSE_VALID is used to
1172 * tell atapi_qc_complete() that sense 1172 * tell atapi_qc_complete() that sense
@@ -1743,12 +1743,17 @@ static int ata_eh_revalidate_and_attach(struct ata_port *ap,
1743{ 1743{
1744 struct ata_eh_context *ehc = &ap->eh_context; 1744 struct ata_eh_context *ehc = &ap->eh_context;
1745 struct ata_device *dev; 1745 struct ata_device *dev;
1746 unsigned int new_mask = 0;
1746 unsigned long flags; 1747 unsigned long flags;
1747 int i, rc = 0; 1748 int i, rc = 0;
1748 1749
1749 DPRINTK("ENTER\n"); 1750 DPRINTK("ENTER\n");
1750 1751
1751 for (i = 0; i < ATA_MAX_DEVICES; i++) { 1752 /* For PATA drive side cable detection to work, IDENTIFY must
1753 * be done backwards such that PDIAG- is released by the slave
1754 * device before the master device is identified.
1755 */
1756 for (i = ATA_MAX_DEVICES - 1; i >= 0; i--) {
1752 unsigned int action, readid_flags = 0; 1757 unsigned int action, readid_flags = 0;
1753 1758
1754 dev = &ap->device[i]; 1759 dev = &ap->device[i];
@@ -1760,13 +1765,13 @@ static int ata_eh_revalidate_and_attach(struct ata_port *ap,
1760 if (action & ATA_EH_REVALIDATE && ata_dev_ready(dev)) { 1765 if (action & ATA_EH_REVALIDATE && ata_dev_ready(dev)) {
1761 if (ata_port_offline(ap)) { 1766 if (ata_port_offline(ap)) {
1762 rc = -EIO; 1767 rc = -EIO;
1763 break; 1768 goto err;
1764 } 1769 }
1765 1770
1766 ata_eh_about_to_do(ap, dev, ATA_EH_REVALIDATE); 1771 ata_eh_about_to_do(ap, dev, ATA_EH_REVALIDATE);
1767 rc = ata_dev_revalidate(dev, readid_flags); 1772 rc = ata_dev_revalidate(dev, readid_flags);
1768 if (rc) 1773 if (rc)
1769 break; 1774 goto err;
1770 1775
1771 ata_eh_done(ap, dev, ATA_EH_REVALIDATE); 1776 ata_eh_done(ap, dev, ATA_EH_REVALIDATE);
1772 1777
@@ -1784,40 +1789,53 @@ static int ata_eh_revalidate_and_attach(struct ata_port *ap,
1784 1789
1785 rc = ata_dev_read_id(dev, &dev->class, readid_flags, 1790 rc = ata_dev_read_id(dev, &dev->class, readid_flags,
1786 dev->id); 1791 dev->id);
1787 if (rc == 0) { 1792 switch (rc) {
1788 ehc->i.flags |= ATA_EHI_PRINTINFO; 1793 case 0:
1789 rc = ata_dev_configure(dev); 1794 new_mask |= 1 << i;
1790 ehc->i.flags &= ~ATA_EHI_PRINTINFO; 1795 break;
1791 } else if (rc == -ENOENT) { 1796 case -ENOENT:
1792 /* IDENTIFY was issued to non-existent 1797 /* IDENTIFY was issued to non-existent
1793 * device. No need to reset. Just 1798 * device. No need to reset. Just
1794 * thaw and kill the device. 1799 * thaw and kill the device.
1795 */ 1800 */
1796 ata_eh_thaw_port(ap); 1801 ata_eh_thaw_port(ap);
1797 dev->class = ATA_DEV_UNKNOWN; 1802 dev->class = ATA_DEV_UNKNOWN;
1798 rc = 0;
1799 }
1800
1801 if (rc) {
1802 dev->class = ATA_DEV_UNKNOWN;
1803 break; 1803 break;
1804 default:
1805 dev->class = ATA_DEV_UNKNOWN;
1806 goto err;
1804 } 1807 }
1808 }
1809 }
1805 1810
1806 if (ata_dev_enabled(dev)) { 1811 /* Configure new devices forward such that user doesn't see
1807 spin_lock_irqsave(ap->lock, flags); 1812 * device detection messages backwards.
1808 ap->pflags |= ATA_PFLAG_SCSI_HOTPLUG; 1813 */
1809 spin_unlock_irqrestore(ap->lock, flags); 1814 for (i = 0; i < ATA_MAX_DEVICES; i++) {
1815 dev = &ap->device[i];
1810 1816
1811 /* new device discovered, configure xfermode */ 1817 if (!(new_mask & (1 << i)))
1812 ehc->i.flags |= ATA_EHI_SETMODE; 1818 continue;
1813 } 1819
1814 } 1820 ehc->i.flags |= ATA_EHI_PRINTINFO;
1821 rc = ata_dev_configure(dev);
1822 ehc->i.flags &= ~ATA_EHI_PRINTINFO;
1823 if (rc)
1824 goto err;
1825
1826 spin_lock_irqsave(ap->lock, flags);
1827 ap->pflags |= ATA_PFLAG_SCSI_HOTPLUG;
1828 spin_unlock_irqrestore(ap->lock, flags);
1829
1830 /* new device discovered, configure xfermode */
1831 ehc->i.flags |= ATA_EHI_SETMODE;
1815 } 1832 }
1816 1833
1817 if (rc) 1834 return 0;
1818 *r_failed_dev = dev;
1819 1835
1820 DPRINTK("EXIT\n"); 1836 err:
1837 *r_failed_dev = dev;
1838 DPRINTK("EXIT rc=%d\n", rc);
1821 return rc; 1839 return rc;
1822} 1840}
1823 1841
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 6cc817a10204..e9364434182c 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -333,7 +333,7 @@ int ata_task_ioctl(struct scsi_device *scsidev, void __user *arg)
333 scsi_cmd[8] = args[3]; 333 scsi_cmd[8] = args[3];
334 scsi_cmd[10] = args[4]; 334 scsi_cmd[10] = args[4];
335 scsi_cmd[12] = args[5]; 335 scsi_cmd[12] = args[5];
336 scsi_cmd[13] = args[6] & 0x0f; 336 scsi_cmd[13] = args[6] & 0x4f;
337 scsi_cmd[14] = args[0]; 337 scsi_cmd[14] = args[0];
338 338
339 /* Good values for timeout and retries? Values below 339 /* Good values for timeout and retries? Values below
diff --git a/drivers/ata/libata.h b/drivers/ata/libata.h
index c42671493e8c..1f1e3a51f859 100644
--- a/drivers/ata/libata.h
+++ b/drivers/ata/libata.h
@@ -56,7 +56,7 @@ extern struct workqueue_struct *ata_aux_wq;
56extern int atapi_enabled; 56extern int atapi_enabled;
57extern int atapi_dmadir; 57extern int atapi_dmadir;
58extern int libata_fua; 58extern int libata_fua;
59extern int noacpi; 59extern int libata_noacpi;
60extern struct ata_queued_cmd *ata_qc_new_init(struct ata_device *dev); 60extern struct ata_queued_cmd *ata_qc_new_init(struct ata_device *dev);
61extern int ata_build_rw_tf(struct ata_taskfile *tf, struct ata_device *dev, 61extern int ata_build_rw_tf(struct ata_taskfile *tf, struct ata_device *dev,
62 u64 block, u32 n_block, unsigned int tf_flags, 62 u64 block, u32 n_block, unsigned int tf_flags,
diff --git a/drivers/ata/pata_pdc202xx_old.c b/drivers/ata/pata_pdc202xx_old.c
index acdc52cbe38a..0a1493398913 100644
--- a/drivers/ata/pata_pdc202xx_old.c
+++ b/drivers/ata/pata_pdc202xx_old.c
@@ -195,7 +195,7 @@ static void pdc2026x_bmdma_start(struct ata_queued_cmd *qc)
195 /* Cases the state machine will not complete correctly without help */ 195 /* Cases the state machine will not complete correctly without help */
196 if ((tf->flags & ATA_TFLAG_LBA48) || tf->protocol == ATA_PROT_ATAPI_DMA) 196 if ((tf->flags & ATA_TFLAG_LBA48) || tf->protocol == ATA_PROT_ATAPI_DMA)
197 { 197 {
198 len = qc->nbytes; 198 len = qc->nbytes / 2;
199 199
200 if (tf->flags & ATA_TFLAG_WRITE) 200 if (tf->flags & ATA_TFLAG_WRITE)
201 len |= 0x06000000; 201 len |= 0x06000000;
diff --git a/drivers/base/core.c b/drivers/base/core.c
index ad0f4a2f25c4..d7fcf823a42a 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -28,20 +28,6 @@ int (*platform_notify)(struct device * dev) = NULL;
28int (*platform_notify_remove)(struct device * dev) = NULL; 28int (*platform_notify_remove)(struct device * dev) = NULL;
29 29
30/* 30/*
31 * Detect the LANANA-assigned LOCAL/EXPERIMENTAL majors
32 */
33bool is_lanana_major(unsigned int major)
34{
35 if (major >= 60 && major <= 63)
36 return 1;
37 if (major >= 120 && major <= 127)
38 return 1;
39 if (major >= 240 && major <= 254)
40 return 1;
41 return 0;
42}
43
44/*
45 * sysfs bindings for devices. 31 * sysfs bindings for devices.
46 */ 32 */
47 33
diff --git a/drivers/base/driver.c b/drivers/base/driver.c
index 1214cbd17d86..082bfded3854 100644
--- a/drivers/base/driver.c
+++ b/drivers/base/driver.c
@@ -183,7 +183,14 @@ int driver_register(struct device_driver * drv)
183void driver_unregister(struct device_driver * drv) 183void driver_unregister(struct device_driver * drv)
184{ 184{
185 bus_remove_driver(drv); 185 bus_remove_driver(drv);
186 wait_for_completion(&drv->unloaded); 186 /*
187 * If the driver is a module, we are probably in
188 * the module unload path, and we want to wait
189 * for everything to unload before we can actually
190 * finish the unload.
191 */
192 if (drv->owner)
193 wait_for_completion(&drv->unloaded);
187} 194}
188 195
189/** 196/**
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index 072e18e6d76d..14d780666c0a 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -1915,6 +1915,7 @@ static void cciss_geometry_inquiry(int ctlr, int logvol,
1915 "does not support reading geometry\n"); 1915 "does not support reading geometry\n");
1916 drv->heads = 255; 1916 drv->heads = 255;
1917 drv->sectors = 32; // Sectors per track 1917 drv->sectors = 32; // Sectors per track
1918 drv->cylinders = total_size + 1;
1918 drv->raid_level = RAID_UNKNOWN; 1919 drv->raid_level = RAID_UNKNOWN;
1919 } else { 1920 } else {
1920 drv->heads = inq_buff->data_byte[6]; 1921 drv->heads = inq_buff->data_byte[6];
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
index 3429ece4ef92..d0c978fbc204 100644
--- a/drivers/char/Kconfig
+++ b/drivers/char/Kconfig
@@ -386,6 +386,39 @@ config AU1000_SERIAL_CONSOLE
386 If you have an Alchemy AU1000 processor (MIPS based) and you want 386 If you have an Alchemy AU1000 processor (MIPS based) and you want
387 to use a console on a serial port, say Y. Otherwise, say N. 387 to use a console on a serial port, say Y. Otherwise, say N.
388 388
389config SERIAL_DEC
390 bool "DECstation serial support"
391 depends on MACH_DECSTATION
392 default y
393 help
394 This selects whether you want to be asked about drivers for
395 DECstation serial ports.
396
397 Note that the answer to this question won't directly affect the
398 kernel: saying N will just cause the configurator to skip all
399 the questions about DECstation serial ports.
400
401config SERIAL_DEC_CONSOLE
402 bool "Support for console on a DECstation serial port"
403 depends on SERIAL_DEC
404 default y
405 help
406 If you say Y here, it will be possible to use a serial port as the
407 system console (the system console is the device which receives all
408 kernel messages and warnings and which allows logins in single user
409 mode). Note that the firmware uses ttyS0 as the serial console on
410 the Maxine and ttyS2 on the others.
411
412 If unsure, say Y.
413
414config ZS
415 bool "Z85C30 Serial Support"
416 depends on SERIAL_DEC
417 default y
418 help
419 Documentation on the Zilog 85C350 serial communications controller
420 is downloadable at <http://www.zilog.com/pdfs/serial/z85c30.pdf>
421
389config A2232 422config A2232
390 tristate "Commodore A2232 serial support (EXPERIMENTAL)" 423 tristate "Commodore A2232 serial support (EXPERIMENTAL)"
391 depends on EXPERIMENTAL && ZORRO && BROKEN_ON_SMP 424 depends on EXPERIMENTAL && ZORRO && BROKEN_ON_SMP
diff --git a/drivers/char/drm/Makefile b/drivers/char/drm/Makefile
index 3ad0f648c6b2..6915a0599dfb 100644
--- a/drivers/char/drm/Makefile
+++ b/drivers/char/drm/Makefile
@@ -15,7 +15,6 @@ i810-objs := i810_drv.o i810_dma.o
15i830-objs := i830_drv.o i830_dma.o i830_irq.o 15i830-objs := i830_drv.o i830_dma.o i830_irq.o
16i915-objs := i915_drv.o i915_dma.o i915_irq.o i915_mem.o 16i915-objs := i915_drv.o i915_dma.o i915_irq.o i915_mem.o
17radeon-objs := radeon_drv.o radeon_cp.o radeon_state.o radeon_mem.o radeon_irq.o r300_cmdbuf.o 17radeon-objs := radeon_drv.o radeon_cp.o radeon_state.o radeon_mem.o radeon_irq.o r300_cmdbuf.o
18ffb-objs := ffb_drv.o ffb_context.o
19sis-objs := sis_drv.o sis_mm.o 18sis-objs := sis_drv.o sis_mm.o
20savage-objs := savage_drv.o savage_bci.o savage_state.o 19savage-objs := savage_drv.o savage_bci.o savage_state.o
21via-objs := via_irq.o via_drv.o via_map.o via_mm.o via_dma.o via_verifier.o via_video.o via_dmablit.o 20via-objs := via_irq.o via_drv.o via_map.o via_mm.o via_dma.o via_verifier.o via_video.o via_dmablit.o
@@ -36,7 +35,6 @@ obj-$(CONFIG_DRM_MGA) += mga.o
36obj-$(CONFIG_DRM_I810) += i810.o 35obj-$(CONFIG_DRM_I810) += i810.o
37obj-$(CONFIG_DRM_I830) += i830.o 36obj-$(CONFIG_DRM_I830) += i830.o
38obj-$(CONFIG_DRM_I915) += i915.o 37obj-$(CONFIG_DRM_I915) += i915.o
39obj-$(CONFIG_DRM_FFB) += ffb.o
40obj-$(CONFIG_DRM_SIS) += sis.o 38obj-$(CONFIG_DRM_SIS) += sis.o
41obj-$(CONFIG_DRM_SAVAGE)+= savage.o 39obj-$(CONFIG_DRM_SAVAGE)+= savage.o
42obj-$(CONFIG_DRM_VIA) +=via.o 40obj-$(CONFIG_DRM_VIA) +=via.o
diff --git a/drivers/char/drm/ffb_context.c b/drivers/char/drm/ffb_context.c
deleted file mode 100644
index ac9ab40d57aa..000000000000
--- a/drivers/char/drm/ffb_context.c
+++ /dev/null
@@ -1,544 +0,0 @@
1/* $Id: ffb_context.c,v 1.5 2001/08/09 17:47:51 davem Exp $
2 * ffb_context.c: Creator/Creator3D DRI/DRM context switching.
3 *
4 * Copyright (C) 2000 David S. Miller (davem@redhat.com)
5 *
6 * Almost entirely stolen from tdfx_context.c, see there
7 * for authors.
8 */
9
10#include <asm/upa.h>
11
12#include "ffb.h"
13#include "drmP.h"
14
15#include "ffb_drv.h"
16
17static int DRM(alloc_queue) (drm_device_t * dev, int is_2d_only) {
18 ffb_dev_priv_t *fpriv = (ffb_dev_priv_t *) dev->dev_private;
19 int i;
20
21 for (i = 0; i < FFB_MAX_CTXS; i++) {
22 if (fpriv->hw_state[i] == NULL)
23 break;
24 }
25 if (i == FFB_MAX_CTXS)
26 return -1;
27
28 fpriv->hw_state[i] = kmalloc(sizeof(struct ffb_hw_context), GFP_KERNEL);
29 if (fpriv->hw_state[i] == NULL)
30 return -1;
31
32 fpriv->hw_state[i]->is_2d_only = is_2d_only;
33
34 /* Plus one because 0 is the special DRM_KERNEL_CONTEXT. */
35 return i + 1;
36}
37
38static void ffb_save_context(ffb_dev_priv_t * fpriv, int idx)
39{
40 ffb_fbcPtr ffb = fpriv->regs;
41 struct ffb_hw_context *ctx;
42 int i;
43
44 ctx = fpriv->hw_state[idx - 1];
45 if (idx == 0 || ctx == NULL)
46 return;
47
48 if (ctx->is_2d_only) {
49 /* 2D applications only care about certain pieces
50 * of state.
51 */
52 ctx->drawop = upa_readl(&ffb->drawop);
53 ctx->ppc = upa_readl(&ffb->ppc);
54 ctx->wid = upa_readl(&ffb->wid);
55 ctx->fg = upa_readl(&ffb->fg);
56 ctx->bg = upa_readl(&ffb->bg);
57 ctx->xclip = upa_readl(&ffb->xclip);
58 ctx->fbc = upa_readl(&ffb->fbc);
59 ctx->rop = upa_readl(&ffb->rop);
60 ctx->cmp = upa_readl(&ffb->cmp);
61 ctx->matchab = upa_readl(&ffb->matchab);
62 ctx->magnab = upa_readl(&ffb->magnab);
63 ctx->pmask = upa_readl(&ffb->pmask);
64 ctx->xpmask = upa_readl(&ffb->xpmask);
65 ctx->lpat = upa_readl(&ffb->lpat);
66 ctx->fontxy = upa_readl(&ffb->fontxy);
67 ctx->fontw = upa_readl(&ffb->fontw);
68 ctx->fontinc = upa_readl(&ffb->fontinc);
69
70 /* stencil/stencilctl only exists on FFB2+ and later
71 * due to the introduction of 3DRAM-III.
72 */
73 if (fpriv->ffb_type == ffb2_vertical_plus ||
74 fpriv->ffb_type == ffb2_horizontal_plus) {
75 ctx->stencil = upa_readl(&ffb->stencil);
76 ctx->stencilctl = upa_readl(&ffb->stencilctl);
77 }
78
79 for (i = 0; i < 32; i++)
80 ctx->area_pattern[i] = upa_readl(&ffb->pattern[i]);
81 ctx->ucsr = upa_readl(&ffb->ucsr);
82 return;
83 }
84
85 /* Fetch drawop. */
86 ctx->drawop = upa_readl(&ffb->drawop);
87
88 /* If we were saving the vertex registers, this is where
89 * we would do it. We would save 32 32-bit words starting
90 * at ffb->suvtx.
91 */
92
93 /* Capture rendering attributes. */
94
95 ctx->ppc = upa_readl(&ffb->ppc); /* Pixel Processor Control */
96 ctx->wid = upa_readl(&ffb->wid); /* Current WID */
97 ctx->fg = upa_readl(&ffb->fg); /* Constant FG color */
98 ctx->bg = upa_readl(&ffb->bg); /* Constant BG color */
99 ctx->consty = upa_readl(&ffb->consty); /* Constant Y */
100 ctx->constz = upa_readl(&ffb->constz); /* Constant Z */
101 ctx->xclip = upa_readl(&ffb->xclip); /* X plane clip */
102 ctx->dcss = upa_readl(&ffb->dcss); /* Depth Cue Scale Slope */
103 ctx->vclipmin = upa_readl(&ffb->vclipmin); /* Primary XY clip, minimum */
104 ctx->vclipmax = upa_readl(&ffb->vclipmax); /* Primary XY clip, maximum */
105 ctx->vclipzmin = upa_readl(&ffb->vclipzmin); /* Primary Z clip, minimum */
106 ctx->vclipzmax = upa_readl(&ffb->vclipzmax); /* Primary Z clip, maximum */
107 ctx->dcsf = upa_readl(&ffb->dcsf); /* Depth Cue Scale Front Bound */
108 ctx->dcsb = upa_readl(&ffb->dcsb); /* Depth Cue Scale Back Bound */
109 ctx->dczf = upa_readl(&ffb->dczf); /* Depth Cue Scale Z Front */
110 ctx->dczb = upa_readl(&ffb->dczb); /* Depth Cue Scale Z Back */
111 ctx->blendc = upa_readl(&ffb->blendc); /* Alpha Blend Control */
112 ctx->blendc1 = upa_readl(&ffb->blendc1); /* Alpha Blend Color 1 */
113 ctx->blendc2 = upa_readl(&ffb->blendc2); /* Alpha Blend Color 2 */
114 ctx->fbc = upa_readl(&ffb->fbc); /* Frame Buffer Control */
115 ctx->rop = upa_readl(&ffb->rop); /* Raster Operation */
116 ctx->cmp = upa_readl(&ffb->cmp); /* Compare Controls */
117 ctx->matchab = upa_readl(&ffb->matchab); /* Buffer A/B Match Ops */
118 ctx->matchc = upa_readl(&ffb->matchc); /* Buffer C Match Ops */
119 ctx->magnab = upa_readl(&ffb->magnab); /* Buffer A/B Magnitude Ops */
120 ctx->magnc = upa_readl(&ffb->magnc); /* Buffer C Magnitude Ops */
121 ctx->pmask = upa_readl(&ffb->pmask); /* RGB Plane Mask */
122 ctx->xpmask = upa_readl(&ffb->xpmask); /* X Plane Mask */
123 ctx->ypmask = upa_readl(&ffb->ypmask); /* Y Plane Mask */
124 ctx->zpmask = upa_readl(&ffb->zpmask); /* Z Plane Mask */
125
126 /* Auxiliary Clips. */
127 ctx->auxclip0min = upa_readl(&ffb->auxclip[0].min);
128 ctx->auxclip0max = upa_readl(&ffb->auxclip[0].max);
129 ctx->auxclip1min = upa_readl(&ffb->auxclip[1].min);
130 ctx->auxclip1max = upa_readl(&ffb->auxclip[1].max);
131 ctx->auxclip2min = upa_readl(&ffb->auxclip[2].min);
132 ctx->auxclip2max = upa_readl(&ffb->auxclip[2].max);
133 ctx->auxclip3min = upa_readl(&ffb->auxclip[3].min);
134 ctx->auxclip3max = upa_readl(&ffb->auxclip[3].max);
135
136 ctx->lpat = upa_readl(&ffb->lpat); /* Line Pattern */
137 ctx->fontxy = upa_readl(&ffb->fontxy); /* XY Font Coordinate */
138 ctx->fontw = upa_readl(&ffb->fontw); /* Font Width */
139 ctx->fontinc = upa_readl(&ffb->fontinc); /* Font X/Y Increment */
140
141 /* These registers/features only exist on FFB2 and later chips. */
142 if (fpriv->ffb_type >= ffb2_prototype) {
143 ctx->dcss1 = upa_readl(&ffb->dcss1); /* Depth Cue Scale Slope 1 */
144 ctx->dcss2 = upa_readl(&ffb->dcss2); /* Depth Cue Scale Slope 2 */
145 ctx->dcss2 = upa_readl(&ffb->dcss3); /* Depth Cue Scale Slope 3 */
146 ctx->dcs2 = upa_readl(&ffb->dcs2); /* Depth Cue Scale 2 */
147 ctx->dcs3 = upa_readl(&ffb->dcs3); /* Depth Cue Scale 3 */
148 ctx->dcs4 = upa_readl(&ffb->dcs4); /* Depth Cue Scale 4 */
149 ctx->dcd2 = upa_readl(&ffb->dcd2); /* Depth Cue Depth 2 */
150 ctx->dcd3 = upa_readl(&ffb->dcd3); /* Depth Cue Depth 3 */
151 ctx->dcd4 = upa_readl(&ffb->dcd4); /* Depth Cue Depth 4 */
152
153 /* And stencil/stencilctl only exists on FFB2+ and later
154 * due to the introduction of 3DRAM-III.
155 */
156 if (fpriv->ffb_type == ffb2_vertical_plus ||
157 fpriv->ffb_type == ffb2_horizontal_plus) {
158 ctx->stencil = upa_readl(&ffb->stencil);
159 ctx->stencilctl = upa_readl(&ffb->stencilctl);
160 }
161 }
162
163 /* Save the 32x32 area pattern. */
164 for (i = 0; i < 32; i++)
165 ctx->area_pattern[i] = upa_readl(&ffb->pattern[i]);
166
167 /* Finally, stash away the User Constol/Status Register. */
168 ctx->ucsr = upa_readl(&ffb->ucsr);
169}
170
171static void ffb_restore_context(ffb_dev_priv_t * fpriv, int old, int idx)
172{
173 ffb_fbcPtr ffb = fpriv->regs;
174 struct ffb_hw_context *ctx;
175 int i;
176
177 ctx = fpriv->hw_state[idx - 1];
178 if (idx == 0 || ctx == NULL)
179 return;
180
181 if (ctx->is_2d_only) {
182 /* 2D applications only care about certain pieces
183 * of state.
184 */
185 upa_writel(ctx->drawop, &ffb->drawop);
186
187 /* If we were restoring the vertex registers, this is where
188 * we would do it. We would restore 32 32-bit words starting
189 * at ffb->suvtx.
190 */
191
192 upa_writel(ctx->ppc, &ffb->ppc);
193 upa_writel(ctx->wid, &ffb->wid);
194 upa_writel(ctx->fg, &ffb->fg);
195 upa_writel(ctx->bg, &ffb->bg);
196 upa_writel(ctx->xclip, &ffb->xclip);
197 upa_writel(ctx->fbc, &ffb->fbc);
198 upa_writel(ctx->rop, &ffb->rop);
199 upa_writel(ctx->cmp, &ffb->cmp);
200 upa_writel(ctx->matchab, &ffb->matchab);
201 upa_writel(ctx->magnab, &ffb->magnab);
202 upa_writel(ctx->pmask, &ffb->pmask);
203 upa_writel(ctx->xpmask, &ffb->xpmask);
204 upa_writel(ctx->lpat, &ffb->lpat);
205 upa_writel(ctx->fontxy, &ffb->fontxy);
206 upa_writel(ctx->fontw, &ffb->fontw);
207 upa_writel(ctx->fontinc, &ffb->fontinc);
208
209 /* stencil/stencilctl only exists on FFB2+ and later
210 * due to the introduction of 3DRAM-III.
211 */
212 if (fpriv->ffb_type == ffb2_vertical_plus ||
213 fpriv->ffb_type == ffb2_horizontal_plus) {
214 upa_writel(ctx->stencil, &ffb->stencil);
215 upa_writel(ctx->stencilctl, &ffb->stencilctl);
216 upa_writel(0x80000000, &ffb->fbc);
217 upa_writel((ctx->stencilctl | 0x80000),
218 &ffb->rawstencilctl);
219 upa_writel(ctx->fbc, &ffb->fbc);
220 }
221
222 for (i = 0; i < 32; i++)
223 upa_writel(ctx->area_pattern[i], &ffb->pattern[i]);
224 upa_writel((ctx->ucsr & 0xf0000), &ffb->ucsr);
225 return;
226 }
227
228 /* Restore drawop. */
229 upa_writel(ctx->drawop, &ffb->drawop);
230
231 /* If we were restoring the vertex registers, this is where
232 * we would do it. We would restore 32 32-bit words starting
233 * at ffb->suvtx.
234 */
235
236 /* Restore rendering attributes. */
237
238 upa_writel(ctx->ppc, &ffb->ppc); /* Pixel Processor Control */
239 upa_writel(ctx->wid, &ffb->wid); /* Current WID */
240 upa_writel(ctx->fg, &ffb->fg); /* Constant FG color */
241 upa_writel(ctx->bg, &ffb->bg); /* Constant BG color */
242 upa_writel(ctx->consty, &ffb->consty); /* Constant Y */
243 upa_writel(ctx->constz, &ffb->constz); /* Constant Z */
244 upa_writel(ctx->xclip, &ffb->xclip); /* X plane clip */
245 upa_writel(ctx->dcss, &ffb->dcss); /* Depth Cue Scale Slope */
246 upa_writel(ctx->vclipmin, &ffb->vclipmin); /* Primary XY clip, minimum */
247 upa_writel(ctx->vclipmax, &ffb->vclipmax); /* Primary XY clip, maximum */
248 upa_writel(ctx->vclipzmin, &ffb->vclipzmin); /* Primary Z clip, minimum */
249 upa_writel(ctx->vclipzmax, &ffb->vclipzmax); /* Primary Z clip, maximum */
250 upa_writel(ctx->dcsf, &ffb->dcsf); /* Depth Cue Scale Front Bound */
251 upa_writel(ctx->dcsb, &ffb->dcsb); /* Depth Cue Scale Back Bound */
252 upa_writel(ctx->dczf, &ffb->dczf); /* Depth Cue Scale Z Front */
253 upa_writel(ctx->dczb, &ffb->dczb); /* Depth Cue Scale Z Back */
254 upa_writel(ctx->blendc, &ffb->blendc); /* Alpha Blend Control */
255 upa_writel(ctx->blendc1, &ffb->blendc1); /* Alpha Blend Color 1 */
256 upa_writel(ctx->blendc2, &ffb->blendc2); /* Alpha Blend Color 2 */
257 upa_writel(ctx->fbc, &ffb->fbc); /* Frame Buffer Control */
258 upa_writel(ctx->rop, &ffb->rop); /* Raster Operation */
259 upa_writel(ctx->cmp, &ffb->cmp); /* Compare Controls */
260 upa_writel(ctx->matchab, &ffb->matchab); /* Buffer A/B Match Ops */
261 upa_writel(ctx->matchc, &ffb->matchc); /* Buffer C Match Ops */
262 upa_writel(ctx->magnab, &ffb->magnab); /* Buffer A/B Magnitude Ops */
263 upa_writel(ctx->magnc, &ffb->magnc); /* Buffer C Magnitude Ops */
264 upa_writel(ctx->pmask, &ffb->pmask); /* RGB Plane Mask */
265 upa_writel(ctx->xpmask, &ffb->xpmask); /* X Plane Mask */
266 upa_writel(ctx->ypmask, &ffb->ypmask); /* Y Plane Mask */
267 upa_writel(ctx->zpmask, &ffb->zpmask); /* Z Plane Mask */
268
269 /* Auxiliary Clips. */
270 upa_writel(ctx->auxclip0min, &ffb->auxclip[0].min);
271 upa_writel(ctx->auxclip0max, &ffb->auxclip[0].max);
272 upa_writel(ctx->auxclip1min, &ffb->auxclip[1].min);
273 upa_writel(ctx->auxclip1max, &ffb->auxclip[1].max);
274 upa_writel(ctx->auxclip2min, &ffb->auxclip[2].min);
275 upa_writel(ctx->auxclip2max, &ffb->auxclip[2].max);
276 upa_writel(ctx->auxclip3min, &ffb->auxclip[3].min);
277 upa_writel(ctx->auxclip3max, &ffb->auxclip[3].max);
278
279 upa_writel(ctx->lpat, &ffb->lpat); /* Line Pattern */
280 upa_writel(ctx->fontxy, &ffb->fontxy); /* XY Font Coordinate */
281 upa_writel(ctx->fontw, &ffb->fontw); /* Font Width */
282 upa_writel(ctx->fontinc, &ffb->fontinc); /* Font X/Y Increment */
283
284 /* These registers/features only exist on FFB2 and later chips. */
285 if (fpriv->ffb_type >= ffb2_prototype) {
286 upa_writel(ctx->dcss1, &ffb->dcss1); /* Depth Cue Scale Slope 1 */
287 upa_writel(ctx->dcss2, &ffb->dcss2); /* Depth Cue Scale Slope 2 */
288 upa_writel(ctx->dcss3, &ffb->dcss2); /* Depth Cue Scale Slope 3 */
289 upa_writel(ctx->dcs2, &ffb->dcs2); /* Depth Cue Scale 2 */
290 upa_writel(ctx->dcs3, &ffb->dcs3); /* Depth Cue Scale 3 */
291 upa_writel(ctx->dcs4, &ffb->dcs4); /* Depth Cue Scale 4 */
292 upa_writel(ctx->dcd2, &ffb->dcd2); /* Depth Cue Depth 2 */
293 upa_writel(ctx->dcd3, &ffb->dcd3); /* Depth Cue Depth 3 */
294 upa_writel(ctx->dcd4, &ffb->dcd4); /* Depth Cue Depth 4 */
295
296 /* And stencil/stencilctl only exists on FFB2+ and later
297 * due to the introduction of 3DRAM-III.
298 */
299 if (fpriv->ffb_type == ffb2_vertical_plus ||
300 fpriv->ffb_type == ffb2_horizontal_plus) {
301 /* Unfortunately, there is a hardware bug on
302 * the FFB2+ chips which prevents a normal write
303 * to the stencil control register from working
304 * as it should.
305 *
306 * The state controlled by the FFB stencilctl register
307 * really gets transferred to the per-buffer instances
308 * of the stencilctl register in the 3DRAM chips.
309 *
310 * The bug is that FFB does not update buffer C correctly,
311 * so we have to do it by hand for them.
312 */
313
314 /* This will update buffers A and B. */
315 upa_writel(ctx->stencil, &ffb->stencil);
316 upa_writel(ctx->stencilctl, &ffb->stencilctl);
317
318 /* Force FFB to use buffer C 3dram regs. */
319 upa_writel(0x80000000, &ffb->fbc);
320 upa_writel((ctx->stencilctl | 0x80000),
321 &ffb->rawstencilctl);
322
323 /* Now restore the correct FBC controls. */
324 upa_writel(ctx->fbc, &ffb->fbc);
325 }
326 }
327
328 /* Restore the 32x32 area pattern. */
329 for (i = 0; i < 32; i++)
330 upa_writel(ctx->area_pattern[i], &ffb->pattern[i]);
331
332 /* Finally, stash away the User Constol/Status Register.
333 * The only state we really preserve here is the picking
334 * control.
335 */
336 upa_writel((ctx->ucsr & 0xf0000), &ffb->ucsr);
337}
338
339#define FFB_UCSR_FB_BUSY 0x01000000
340#define FFB_UCSR_RP_BUSY 0x02000000
341#define FFB_UCSR_ALL_BUSY (FFB_UCSR_RP_BUSY|FFB_UCSR_FB_BUSY)
342
343static void FFBWait(ffb_fbcPtr ffb)
344{
345 int limit = 100000;
346
347 do {
348 u32 regval = upa_readl(&ffb->ucsr);
349
350 if ((regval & FFB_UCSR_ALL_BUSY) == 0)
351 break;
352 } while (--limit);
353}
354
355int ffb_driver_context_switch(drm_device_t * dev, int old, int new)
356{
357 ffb_dev_priv_t *fpriv = (ffb_dev_priv_t *) dev->dev_private;
358
359#ifdef DRM_DMA_HISTOGRAM
360 dev->ctx_start = get_cycles();
361#endif
362
363 DRM_DEBUG("Context switch from %d to %d\n", old, new);
364
365 if (new == dev->last_context || dev->last_context == 0) {
366 dev->last_context = new;
367 return 0;
368 }
369
370 FFBWait(fpriv->regs);
371 ffb_save_context(fpriv, old);
372 ffb_restore_context(fpriv, old, new);
373 FFBWait(fpriv->regs);
374
375 dev->last_context = new;
376
377 return 0;
378}
379
380int ffb_driver_resctx(struct inode *inode, struct file *filp, unsigned int cmd,
381 unsigned long arg)
382{
383 drm_ctx_res_t res;
384 drm_ctx_t ctx;
385 int i;
386
387 DRM_DEBUG("%d\n", DRM_RESERVED_CONTEXTS);
388 if (copy_from_user(&res, (drm_ctx_res_t __user *) arg, sizeof(res)))
389 return -EFAULT;
390 if (res.count >= DRM_RESERVED_CONTEXTS) {
391 memset(&ctx, 0, sizeof(ctx));
392 for (i = 0; i < DRM_RESERVED_CONTEXTS; i++) {
393 ctx.handle = i;
394 if (copy_to_user(&res.contexts[i], &i, sizeof(i)))
395 return -EFAULT;
396 }
397 }
398 res.count = DRM_RESERVED_CONTEXTS;
399 if (copy_to_user((drm_ctx_res_t __user *) arg, &res, sizeof(res)))
400 return -EFAULT;
401 return 0;
402}
403
404int ffb_driver_addctx(struct inode *inode, struct file *filp, unsigned int cmd,
405 unsigned long arg)
406{
407 drm_file_t *priv = filp->private_data;
408 drm_device_t *dev = priv->dev;
409 drm_ctx_t ctx;
410 int idx;
411
412 if (copy_from_user(&ctx, (drm_ctx_t __user *) arg, sizeof(ctx)))
413 return -EFAULT;
414 idx = DRM(alloc_queue) (dev, (ctx.flags & _DRM_CONTEXT_2DONLY));
415 if (idx < 0)
416 return -ENFILE;
417
418 DRM_DEBUG("%d\n", ctx.handle);
419 ctx.handle = idx;
420 if (copy_to_user((drm_ctx_t __user *) arg, &ctx, sizeof(ctx)))
421 return -EFAULT;
422 return 0;
423}
424
425int ffb_driver_modctx(struct inode *inode, struct file *filp, unsigned int cmd,
426 unsigned long arg)
427{
428 drm_file_t *priv = filp->private_data;
429 drm_device_t *dev = priv->dev;
430 ffb_dev_priv_t *fpriv = (ffb_dev_priv_t *) dev->dev_private;
431 struct ffb_hw_context *hwctx;
432 drm_ctx_t ctx;
433 int idx;
434
435 if (copy_from_user(&ctx, (drm_ctx_t __user *) arg, sizeof(ctx)))
436 return -EFAULT;
437
438 idx = ctx.handle;
439 if (idx <= 0 || idx >= FFB_MAX_CTXS)
440 return -EINVAL;
441
442 hwctx = fpriv->hw_state[idx - 1];
443 if (hwctx == NULL)
444 return -EINVAL;
445
446 if ((ctx.flags & _DRM_CONTEXT_2DONLY) == 0)
447 hwctx->is_2d_only = 0;
448 else
449 hwctx->is_2d_only = 1;
450
451 return 0;
452}
453
454int ffb_driver_getctx(struct inode *inode, struct file *filp, unsigned int cmd,
455 unsigned long arg)
456{
457 drm_file_t *priv = filp->private_data;
458 drm_device_t *dev = priv->dev;
459 ffb_dev_priv_t *fpriv = (ffb_dev_priv_t *) dev->dev_private;
460 struct ffb_hw_context *hwctx;
461 drm_ctx_t ctx;
462 int idx;
463
464 if (copy_from_user(&ctx, (drm_ctx_t __user *) arg, sizeof(ctx)))
465 return -EFAULT;
466
467 idx = ctx.handle;
468 if (idx <= 0 || idx >= FFB_MAX_CTXS)
469 return -EINVAL;
470
471 hwctx = fpriv->hw_state[idx - 1];
472 if (hwctx == NULL)
473 return -EINVAL;
474
475 if (hwctx->is_2d_only != 0)
476 ctx.flags = _DRM_CONTEXT_2DONLY;
477 else
478 ctx.flags = 0;
479
480 if (copy_to_user((drm_ctx_t __user *) arg, &ctx, sizeof(ctx)))
481 return -EFAULT;
482
483 return 0;
484}
485
486int ffb_driver_switchctx(struct inode *inode, struct file *filp,
487 unsigned int cmd, unsigned long arg)
488{
489 drm_file_t *priv = filp->private_data;
490 drm_device_t *dev = priv->dev;
491 drm_ctx_t ctx;
492
493 if (copy_from_user(&ctx, (drm_ctx_t __user *) arg, sizeof(ctx)))
494 return -EFAULT;
495 DRM_DEBUG("%d\n", ctx.handle);
496 return ffb_driver_context_switch(dev, dev->last_context, ctx.handle);
497}
498
499int ffb_driver_newctx(struct inode *inode, struct file *filp, unsigned int cmd,
500 unsigned long arg)
501{
502 drm_ctx_t ctx;
503
504 if (copy_from_user(&ctx, (drm_ctx_t __user *) arg, sizeof(ctx)))
505 return -EFAULT;
506 DRM_DEBUG("%d\n", ctx.handle);
507
508 return 0;
509}
510
511int ffb_driver_rmctx(struct inode *inode, struct file *filp, unsigned int cmd,
512 unsigned long arg)
513{
514 drm_ctx_t ctx;
515 drm_file_t *priv = filp->private_data;
516 drm_device_t *dev = priv->dev;
517 ffb_dev_priv_t *fpriv = (ffb_dev_priv_t *) dev->dev_private;
518 int idx;
519
520 if (copy_from_user(&ctx, (drm_ctx_t __user *) arg, sizeof(ctx)))
521 return -EFAULT;
522 DRM_DEBUG("%d\n", ctx.handle);
523
524 idx = ctx.handle - 1;
525 if (idx < 0 || idx >= FFB_MAX_CTXS)
526 return -EINVAL;
527
528 kfree(fpriv->hw_state[idx]);
529 fpriv->hw_state[idx] = NULL;
530 return 0;
531}
532
533void ffb_set_context_ioctls(void)
534{
535 DRM(ioctls)[DRM_IOCTL_NR(DRM_IOCTL_ADD_CTX)].func = ffb_driver_addctx;
536 DRM(ioctls)[DRM_IOCTL_NR(DRM_IOCTL_RM_CTX)].func = ffb_driver_rmctx;
537 DRM(ioctls)[DRM_IOCTL_NR(DRM_IOCTL_MOD_CTX)].func = ffb_driver_modctx;
538 DRM(ioctls)[DRM_IOCTL_NR(DRM_IOCTL_GET_CTX)].func = ffb_driver_getctx;
539 DRM(ioctls)[DRM_IOCTL_NR(DRM_IOCTL_SWITCH_CTX)].func =
540 ffb_driver_switchctx;
541 DRM(ioctls)[DRM_IOCTL_NR(DRM_IOCTL_NEW_CTX)].func = ffb_driver_newctx;
542 DRM(ioctls)[DRM_IOCTL_NR(DRM_IOCTL_RES_CTX)].func = ffb_driver_resctx;
543
544}
diff --git a/drivers/char/drm/ffb_drv.c b/drivers/char/drm/ffb_drv.c
deleted file mode 100644
index 9a19879e3b68..000000000000
--- a/drivers/char/drm/ffb_drv.c
+++ /dev/null
@@ -1,355 +0,0 @@
1/* $Id: ffb_drv.c,v 1.16 2001/10/18 16:00:24 davem Exp $
2 * ffb_drv.c: Creator/Creator3D direct rendering driver.
3 *
4 * Copyright (C) 2000 David S. Miller (davem@redhat.com)
5 */
6
7#include "ffb.h"
8#include "drmP.h"
9
10#include "ffb_drv.h"
11
12#include <linux/smp_lock.h>
13#include <asm/shmparam.h>
14#include <asm/oplib.h>
15#include <asm/upa.h>
16
17#define DRIVER_AUTHOR "David S. Miller"
18
19#define DRIVER_NAME "ffb"
20#define DRIVER_DESC "Creator/Creator3D"
21#define DRIVER_DATE "20000517"
22
23#define DRIVER_MAJOR 0
24#define DRIVER_MINOR 0
25#define DRIVER_PATCHLEVEL 1
26
27typedef struct _ffb_position_t {
28 int node;
29 int root;
30} ffb_position_t;
31
32static ffb_position_t *ffb_position;
33
34static void get_ffb_type(ffb_dev_priv_t * ffb_priv, int instance)
35{
36 volatile unsigned char *strap_bits;
37 unsigned char val;
38
39 strap_bits = (volatile unsigned char *)
40 (ffb_priv->card_phys_base + 0x00200000UL);
41
42 /* Don't ask, you have to read the value twice for whatever
43 * reason to get correct contents.
44 */
45 val = upa_readb(strap_bits);
46 val = upa_readb(strap_bits);
47 switch (val & 0x78) {
48 case (0x0 << 5) | (0x0 << 3):
49 ffb_priv->ffb_type = ffb1_prototype;
50 printk("ffb%d: Detected FFB1 pre-FCS prototype\n", instance);
51 break;
52 case (0x0 << 5) | (0x1 << 3):
53 ffb_priv->ffb_type = ffb1_standard;
54 printk("ffb%d: Detected FFB1\n", instance);
55 break;
56 case (0x0 << 5) | (0x3 << 3):
57 ffb_priv->ffb_type = ffb1_speedsort;
58 printk("ffb%d: Detected FFB1-SpeedSort\n", instance);
59 break;
60 case (0x1 << 5) | (0x0 << 3):
61 ffb_priv->ffb_type = ffb2_prototype;
62 printk("ffb%d: Detected FFB2/vertical pre-FCS prototype\n",
63 instance);
64 break;
65 case (0x1 << 5) | (0x1 << 3):
66 ffb_priv->ffb_type = ffb2_vertical;
67 printk("ffb%d: Detected FFB2/vertical\n", instance);
68 break;
69 case (0x1 << 5) | (0x2 << 3):
70 ffb_priv->ffb_type = ffb2_vertical_plus;
71 printk("ffb%d: Detected FFB2+/vertical\n", instance);
72 break;
73 case (0x2 << 5) | (0x0 << 3):
74 ffb_priv->ffb_type = ffb2_horizontal;
75 printk("ffb%d: Detected FFB2/horizontal\n", instance);
76 break;
77 case (0x2 << 5) | (0x2 << 3):
78 ffb_priv->ffb_type = ffb2_horizontal;
79 printk("ffb%d: Detected FFB2+/horizontal\n", instance);
80 break;
81 default:
82 ffb_priv->ffb_type = ffb2_vertical;
83 printk("ffb%d: Unknown boardID[%08x], assuming FFB2\n",
84 instance, val);
85 break;
86 };
87}
88
89static void ffb_apply_upa_parent_ranges(int parent,
90 struct linux_prom64_registers *regs)
91{
92 struct linux_prom64_ranges ranges[PROMREG_MAX];
93 char name[128];
94 int len, i;
95
96 prom_getproperty(parent, "name", name, sizeof(name));
97 if (strcmp(name, "upa") != 0)
98 return;
99
100 len =
101 prom_getproperty(parent, "ranges", (void *)ranges, sizeof(ranges));
102 if (len <= 0)
103 return;
104
105 len /= sizeof(struct linux_prom64_ranges);
106 for (i = 0; i < len; i++) {
107 struct linux_prom64_ranges *rng = &ranges[i];
108 u64 phys_addr = regs->phys_addr;
109
110 if (phys_addr >= rng->ot_child_base &&
111 phys_addr < (rng->ot_child_base + rng->or_size)) {
112 regs->phys_addr -= rng->ot_child_base;
113 regs->phys_addr += rng->ot_parent_base;
114 return;
115 }
116 }
117
118 return;
119}
120
121static int ffb_init_one(drm_device_t * dev, int prom_node, int parent_node,
122 int instance)
123{
124 struct linux_prom64_registers regs[2 * PROMREG_MAX];
125 ffb_dev_priv_t *ffb_priv = (ffb_dev_priv_t *) dev->dev_private;
126 int i;
127
128 ffb_priv->prom_node = prom_node;
129 if (prom_getproperty(ffb_priv->prom_node, "reg",
130 (void *)regs, sizeof(regs)) <= 0) {
131 return -EINVAL;
132 }
133 ffb_apply_upa_parent_ranges(parent_node, &regs[0]);
134 ffb_priv->card_phys_base = regs[0].phys_addr;
135 ffb_priv->regs = (ffb_fbcPtr)
136 (regs[0].phys_addr + 0x00600000UL);
137 get_ffb_type(ffb_priv, instance);
138 for (i = 0; i < FFB_MAX_CTXS; i++)
139 ffb_priv->hw_state[i] = NULL;
140
141 return 0;
142}
143
144static drm_map_t *ffb_find_map(struct file *filp, unsigned long off)
145{
146 drm_file_t *priv = filp->private_data;
147 drm_device_t *dev;
148 drm_map_list_t *r_list;
149 struct list_head *list;
150 drm_map_t *map;
151
152 if (!priv || (dev = priv->dev) == NULL)
153 return NULL;
154
155 list_for_each(list, &dev->maplist->head) {
156 r_list = (drm_map_list_t *) list;
157 map = r_list->map;
158 if (!map)
159 continue;
160 if (r_list->user_token == off)
161 return map;
162 }
163
164 return NULL;
165}
166
167unsigned long ffb_get_unmapped_area(struct file *filp,
168 unsigned long hint,
169 unsigned long len,
170 unsigned long pgoff, unsigned long flags)
171{
172 drm_map_t *map = ffb_find_map(filp, pgoff << PAGE_SHIFT);
173 unsigned long addr = -ENOMEM;
174
175 if (!map)
176 return get_unmapped_area(NULL, hint, len, pgoff, flags);
177
178 if (map->type == _DRM_FRAME_BUFFER || map->type == _DRM_REGISTERS) {
179#ifdef HAVE_ARCH_FB_UNMAPPED_AREA
180 addr = get_fb_unmapped_area(filp, hint, len, pgoff, flags);
181#else
182 addr = get_unmapped_area(NULL, hint, len, pgoff, flags);
183#endif
184 } else if (map->type == _DRM_SHM && SHMLBA > PAGE_SIZE) {
185 unsigned long slack = SHMLBA - PAGE_SIZE;
186
187 addr = get_unmapped_area(NULL, hint, len + slack, pgoff, flags);
188 if (!(addr & ~PAGE_MASK)) {
189 unsigned long kvirt = (unsigned long)map->handle;
190
191 if ((kvirt & (SHMLBA - 1)) != (addr & (SHMLBA - 1))) {
192 unsigned long koff, aoff;
193
194 koff = kvirt & (SHMLBA - 1);
195 aoff = addr & (SHMLBA - 1);
196 if (koff < aoff)
197 koff += SHMLBA;
198
199 addr += (koff - aoff);
200 }
201 }
202 } else {
203 addr = get_unmapped_area(NULL, hint, len, pgoff, flags);
204 }
205
206 return addr;
207}
208
209static int ffb_presetup(drm_device_t * dev)
210{
211 ffb_dev_priv_t *ffb_priv;
212 int ret = 0;
213 int i = 0;
214
215 /* Check for the case where no device was found. */
216 if (ffb_position == NULL)
217 return -ENODEV;
218
219 /* code used to use numdevs no numdevs anymore */
220 ffb_priv = kmalloc(sizeof(ffb_dev_priv_t), GFP_KERNEL);
221 if (!ffb_priv)
222 return -ENOMEM;
223 memset(ffb_priv, 0, sizeof(*ffb_priv));
224 dev->dev_private = ffb_priv;
225
226 ret = ffb_init_one(dev, ffb_position[i].node, ffb_position[i].root, i);
227 return ret;
228}
229
230static void ffb_driver_release(drm_device_t * dev, struct file *filp)
231{
232 ffb_dev_priv_t *fpriv = (ffb_dev_priv_t *) dev->dev_private;
233 int context = _DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock);
234 int idx;
235
236 idx = context - 1;
237 if (fpriv &&
238 context != DRM_KERNEL_CONTEXT && fpriv->hw_state[idx] != NULL) {
239 kfree(fpriv->hw_state[idx]);
240 fpriv->hw_state[idx] = NULL;
241 }
242}
243
244static void ffb_driver_pretakedown(drm_device_t * dev)
245{
246 kfree(dev->dev_private);
247}
248
249static int ffb_driver_postcleanup(drm_device_t * dev)
250{
251 kfree(ffb_position);
252 return 0;
253}
254
255static void ffb_driver_kernel_context_switch_unlock(struct drm_device *dev,
256 drm_lock_t * lock)
257{
258 dev->lock.filp = 0;
259 {
260 __volatile__ unsigned int *plock = &dev->lock.hw_lock->lock;
261 unsigned int old, new, prev, ctx;
262
263 ctx = lock->context;
264 do {
265 old = *plock;
266 new = ctx;
267 prev = cmpxchg(plock, old, new);
268 } while (prev != old);
269 }
270 wake_up_interruptible(&dev->lock.lock_queue);
271}
272
273static unsigned long ffb_driver_get_map_ofs(drm_map_t * map)
274{
275 return (map->offset & 0xffffffff);
276}
277
278static unsigned long ffb_driver_get_reg_ofs(drm_device_t * dev)
279{
280 ffb_dev_priv_t *ffb_priv = (ffb_dev_priv_t *) dev->dev_private;
281
282 if (ffb_priv)
283 return ffb_priv->card_phys_base;
284
285 return 0;
286}
287
288static int postinit(struct drm_device *dev, unsigned long flags)
289{
290 DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n",
291 DRIVER_NAME,
292 DRIVER_MAJOR,
293 DRIVER_MINOR, DRIVER_PATCHLEVEL, DRIVER_DATE, dev->minor);
294 return 0;
295}
296
297static int version(drm_version_t * version)
298{
299 int len;
300
301 version->version_major = DRIVER_MAJOR;
302 version->version_minor = DRIVER_MINOR;
303 version->version_patchlevel = DRIVER_PATCHLEVEL;
304 DRM_COPY(version->name, DRIVER_NAME);
305 DRM_COPY(version->date, DRIVER_DATE);
306 DRM_COPY(version->desc, DRIVER_DESC);
307 return 0;
308}
309
310static drm_ioctl_desc_t ioctls[] = {
311
312};
313
314static struct drm_driver driver = {
315 .driver_features = 0,
316 .dev_priv_size = sizeof(u32),
317 .release = ffb_driver_release,
318 .presetup = ffb_presetup,
319 .pretakedown = ffb_driver_pretakedown,
320 .postcleanup = ffb_driver_postcleanup,
321 .kernel_context_switch = ffb_driver_context_switch,
322 .kernel_context_switch_unlock = ffb_driver_kernel_context_switch_unlock,
323 .get_map_ofs = ffb_driver_get_map_ofs,
324 .get_reg_ofs = ffb_driver_get_reg_ofs,
325 .postinit = postinit,
326 .version = version,
327 .ioctls = ioctls,
328 .num_ioctls = DRM_ARRAY_SIZE(ioctls),
329 .fops = {
330 .owner = THIS_MODULE,
331 .open = drm_open,
332 .release = drm_release,
333 .ioctl = drm_ioctl,
334 .mmap = drm_mmap,
335 .poll = drm_poll,
336 .fasync = drm_fasync,
337 }
338 ,
339};
340
341static int __init ffb_init(void)
342{
343 return -ENODEV;
344}
345
346static void __exit ffb_exit(void)
347{
348}
349
350module_init(ffb_init);
351module_exit(ffb_exit);
352
353MODULE_AUTHOR(DRIVER_AUTHOR);
354MODULE_DESCRIPTION(DRIVER_DESC);
355MODULE_LICENSE("GPL and additional rights");
diff --git a/drivers/char/drm/ffb_drv.h b/drivers/char/drm/ffb_drv.h
deleted file mode 100644
index 582afa6dd2b4..000000000000
--- a/drivers/char/drm/ffb_drv.h
+++ /dev/null
@@ -1,379 +0,0 @@
1/* $Id: ffb_drv.h,v 1.1 2000/06/01 04:24:39 davem Exp $
2 * ffb_drv.h: Creator/Creator3D direct rendering driver.
3 *
4 * Copyright (C) 2000 David S. Miller (davem@redhat.com)
5 */
6
7/* Auxilliary clips. */
8typedef struct {
9 volatile unsigned int min;
10 volatile unsigned int max;
11} ffb_auxclip, *ffb_auxclipPtr;
12
13/* FFB register set. */
14typedef struct _ffb_fbc {
15 /* Next vertex registers, on the right we list which drawops
16 * use said register and the logical name the register has in
17 * that context.
18 *//* DESCRIPTION DRAWOP(NAME) */
19 /*0x00*/ unsigned int pad1[3];
20 /* Reserved */
21 /*0x0c*/ volatile unsigned int alpha;
22 /* ALPHA Transparency */
23 /*0x10*/ volatile unsigned int red;
24 /* RED */
25 /*0x14*/ volatile unsigned int green;
26 /* GREEN */
27 /*0x18*/ volatile unsigned int blue;
28 /* BLUE */
29 /*0x1c*/ volatile unsigned int z;
30 /* DEPTH */
31 /*0x20*/ volatile unsigned int y;
32 /* Y triangle(DOYF) */
33 /* aadot(DYF) */
34 /* ddline(DYF) */
35 /* aaline(DYF) */
36 /*0x24*/ volatile unsigned int x;
37 /* X triangle(DOXF) */
38 /* aadot(DXF) */
39 /* ddline(DXF) */
40 /* aaline(DXF) */
41 /*0x28*/ unsigned int pad2[2];
42 /* Reserved */
43 /*0x30*/ volatile unsigned int ryf;
44 /* Y (alias to DOYF) ddline(RYF) */
45 /* aaline(RYF) */
46 /* triangle(RYF) */
47 /*0x34*/ volatile unsigned int rxf;
48 /* X ddline(RXF) */
49 /* aaline(RXF) */
50 /* triangle(RXF) */
51 /*0x38*/ unsigned int pad3[2];
52 /* Reserved */
53 /*0x40*/ volatile unsigned int dmyf;
54 /* Y (alias to DOYF) triangle(DMYF) */
55 /*0x44*/ volatile unsigned int dmxf;
56 /* X triangle(DMXF) */
57 /*0x48*/ unsigned int pad4[2];
58 /* Reserved */
59 /*0x50*/ volatile unsigned int ebyi;
60 /* Y (alias to RYI) polygon(EBYI) */
61 /*0x54*/ volatile unsigned int ebxi;
62 /* X polygon(EBXI) */
63 /*0x58*/ unsigned int pad5[2];
64 /* Reserved */
65 /*0x60*/ volatile unsigned int by;
66 /* Y brline(RYI) */
67 /* fastfill(OP) */
68 /* polygon(YI) */
69 /* rectangle(YI) */
70 /* bcopy(SRCY) */
71 /* vscroll(SRCY) */
72 /*0x64*/ volatile unsigned int bx;
73 /* X brline(RXI) */
74 /* polygon(XI) */
75 /* rectangle(XI) */
76 /* bcopy(SRCX) */
77 /* vscroll(SRCX) */
78 /* fastfill(GO) */
79 /*0x68*/ volatile unsigned int dy;
80 /* destination Y fastfill(DSTY) */
81 /* bcopy(DSRY) */
82 /* vscroll(DSRY) */
83 /*0x6c*/ volatile unsigned int dx;
84 /* destination X fastfill(DSTX) */
85 /* bcopy(DSTX) */
86 /* vscroll(DSTX) */
87 /*0x70*/ volatile unsigned int bh;
88 /* Y (alias to RYI) brline(DYI) */
89 /* dot(DYI) */
90 /* polygon(ETYI) */
91 /* Height fastfill(H) */
92 /* bcopy(H) */
93 /* vscroll(H) */
94 /* Y count fastfill(NY) */
95 /*0x74*/ volatile unsigned int bw;
96 /* X dot(DXI) */
97 /* brline(DXI) */
98 /* polygon(ETXI) */
99 /* fastfill(W) */
100 /* bcopy(W) */
101 /* vscroll(W) */
102 /* fastfill(NX) */
103 /*0x78*/ unsigned int pad6[2];
104 /* Reserved */
105 /*0x80*/ unsigned int pad7[32];
106 /* Reserved */
107
108 /* Setup Unit's vertex state register */
109/*100*/ volatile unsigned int suvtx;
110 /*104*/ unsigned int pad8[63];
111 /* Reserved */
112
113 /* Frame Buffer Control Registers */
114 /*200*/ volatile unsigned int ppc;
115 /* Pixel Processor Control */
116 /*204*/ volatile unsigned int wid;
117 /* Current WID */
118 /*208*/ volatile unsigned int fg;
119 /* FG data */
120 /*20c*/ volatile unsigned int bg;
121 /* BG data */
122 /*210*/ volatile unsigned int consty;
123 /* Constant Y */
124 /*214*/ volatile unsigned int constz;
125 /* Constant Z */
126 /*218*/ volatile unsigned int xclip;
127 /* X Clip */
128 /*21c*/ volatile unsigned int dcss;
129 /* Depth Cue Scale Slope */
130 /*220*/ volatile unsigned int vclipmin;
131 /* Viewclip XY Min Bounds */
132 /*224*/ volatile unsigned int vclipmax;
133 /* Viewclip XY Max Bounds */
134 /*228*/ volatile unsigned int vclipzmin;
135 /* Viewclip Z Min Bounds */
136 /*22c*/ volatile unsigned int vclipzmax;
137 /* Viewclip Z Max Bounds */
138 /*230*/ volatile unsigned int dcsf;
139 /* Depth Cue Scale Front Bound */
140 /*234*/ volatile unsigned int dcsb;
141 /* Depth Cue Scale Back Bound */
142 /*238*/ volatile unsigned int dczf;
143 /* Depth Cue Z Front */
144 /*23c*/ volatile unsigned int dczb;
145 /* Depth Cue Z Back */
146 /*240*/ unsigned int pad9;
147 /* Reserved */
148 /*244*/ volatile unsigned int blendc;
149 /* Alpha Blend Control */
150 /*248*/ volatile unsigned int blendc1;
151 /* Alpha Blend Color 1 */
152 /*24c*/ volatile unsigned int blendc2;
153 /* Alpha Blend Color 2 */
154 /*250*/ volatile unsigned int fbramitc;
155 /* FB RAM Interleave Test Control */
156 /*254*/ volatile unsigned int fbc;
157 /* Frame Buffer Control */
158 /*258*/ volatile unsigned int rop;
159 /* Raster OPeration */
160 /*25c*/ volatile unsigned int cmp;
161 /* Frame Buffer Compare */
162 /*260*/ volatile unsigned int matchab;
163 /* Buffer AB Match Mask */
164 /*264*/ volatile unsigned int matchc;
165 /* Buffer C(YZ) Match Mask */
166 /*268*/ volatile unsigned int magnab;
167 /* Buffer AB Magnitude Mask */
168 /*26c*/ volatile unsigned int magnc;
169 /* Buffer C(YZ) Magnitude Mask */
170 /*270*/ volatile unsigned int fbcfg0;
171 /* Frame Buffer Config 0 */
172 /*274*/ volatile unsigned int fbcfg1;
173 /* Frame Buffer Config 1 */
174 /*278*/ volatile unsigned int fbcfg2;
175 /* Frame Buffer Config 2 */
176 /*27c*/ volatile unsigned int fbcfg3;
177 /* Frame Buffer Config 3 */
178 /*280*/ volatile unsigned int ppcfg;
179 /* Pixel Processor Config */
180 /*284*/ volatile unsigned int pick;
181 /* Picking Control */
182 /*288*/ volatile unsigned int fillmode;
183 /* FillMode */
184 /*28c*/ volatile unsigned int fbramwac;
185 /* FB RAM Write Address Control */
186 /*290*/ volatile unsigned int pmask;
187 /* RGB PlaneMask */
188 /*294*/ volatile unsigned int xpmask;
189 /* X PlaneMask */
190 /*298*/ volatile unsigned int ypmask;
191 /* Y PlaneMask */
192 /*29c*/ volatile unsigned int zpmask;
193 /* Z PlaneMask */
194 /*2a0*/ ffb_auxclip auxclip[4];
195 /* Auxilliary Viewport Clip */
196
197 /* New 3dRAM III support regs */
198/*2c0*/ volatile unsigned int rawblend2;
199/*2c4*/ volatile unsigned int rawpreblend;
200/*2c8*/ volatile unsigned int rawstencil;
201/*2cc*/ volatile unsigned int rawstencilctl;
202/*2d0*/ volatile unsigned int threedram1;
203/*2d4*/ volatile unsigned int threedram2;
204/*2d8*/ volatile unsigned int passin;
205/*2dc*/ volatile unsigned int rawclrdepth;
206/*2e0*/ volatile unsigned int rawpmask;
207/*2e4*/ volatile unsigned int rawcsrc;
208/*2e8*/ volatile unsigned int rawmatch;
209/*2ec*/ volatile unsigned int rawmagn;
210/*2f0*/ volatile unsigned int rawropblend;
211/*2f4*/ volatile unsigned int rawcmp;
212/*2f8*/ volatile unsigned int rawwac;
213/*2fc*/ volatile unsigned int fbramid;
214
215 /*300*/ volatile unsigned int drawop;
216 /* Draw OPeration */
217 /*304*/ unsigned int pad10[2];
218 /* Reserved */
219 /*30c*/ volatile unsigned int lpat;
220 /* Line Pattern control */
221 /*310*/ unsigned int pad11;
222 /* Reserved */
223 /*314*/ volatile unsigned int fontxy;
224 /* XY Font coordinate */
225 /*318*/ volatile unsigned int fontw;
226 /* Font Width */
227 /*31c*/ volatile unsigned int fontinc;
228 /* Font Increment */
229 /*320*/ volatile unsigned int font;
230 /* Font bits */
231 /*324*/ unsigned int pad12[3];
232 /* Reserved */
233/*330*/ volatile unsigned int blend2;
234/*334*/ volatile unsigned int preblend;
235/*338*/ volatile unsigned int stencil;
236/*33c*/ volatile unsigned int stencilctl;
237
238 /*340*/ unsigned int pad13[4];
239 /* Reserved */
240 /*350*/ volatile unsigned int dcss1;
241 /* Depth Cue Scale Slope 1 */
242 /*354*/ volatile unsigned int dcss2;
243 /* Depth Cue Scale Slope 2 */
244 /*358*/ volatile unsigned int dcss3;
245 /* Depth Cue Scale Slope 3 */
246/*35c*/ volatile unsigned int widpmask;
247/*360*/ volatile unsigned int dcs2;
248/*364*/ volatile unsigned int dcs3;
249/*368*/ volatile unsigned int dcs4;
250 /*36c*/ unsigned int pad14;
251 /* Reserved */
252/*370*/ volatile unsigned int dcd2;
253/*374*/ volatile unsigned int dcd3;
254/*378*/ volatile unsigned int dcd4;
255 /*37c*/ unsigned int pad15;
256 /* Reserved */
257 /*380*/ volatile unsigned int pattern[32];
258 /* area Pattern */
259 /*400*/ unsigned int pad16[8];
260 /* Reserved */
261 /*420*/ volatile unsigned int reset;
262 /* chip RESET */
263 /*424*/ unsigned int pad17[247];
264 /* Reserved */
265 /*800*/ volatile unsigned int devid;
266 /* Device ID */
267 /*804*/ unsigned int pad18[63];
268 /* Reserved */
269 /*900*/ volatile unsigned int ucsr;
270 /* User Control & Status Register */
271 /*904*/ unsigned int pad19[31];
272 /* Reserved */
273 /*980*/ volatile unsigned int mer;
274 /* Mode Enable Register */
275 /*984*/ unsigned int pad20[1439];
276 /* Reserved */
277} ffb_fbc, *ffb_fbcPtr;
278
279struct ffb_hw_context {
280 int is_2d_only;
281
282 unsigned int ppc;
283 unsigned int wid;
284 unsigned int fg;
285 unsigned int bg;
286 unsigned int consty;
287 unsigned int constz;
288 unsigned int xclip;
289 unsigned int dcss;
290 unsigned int vclipmin;
291 unsigned int vclipmax;
292 unsigned int vclipzmin;
293 unsigned int vclipzmax;
294 unsigned int dcsf;
295 unsigned int dcsb;
296 unsigned int dczf;
297 unsigned int dczb;
298 unsigned int blendc;
299 unsigned int blendc1;
300 unsigned int blendc2;
301 unsigned int fbc;
302 unsigned int rop;
303 unsigned int cmp;
304 unsigned int matchab;
305 unsigned int matchc;
306 unsigned int magnab;
307 unsigned int magnc;
308 unsigned int pmask;
309 unsigned int xpmask;
310 unsigned int ypmask;
311 unsigned int zpmask;
312 unsigned int auxclip0min;
313 unsigned int auxclip0max;
314 unsigned int auxclip1min;
315 unsigned int auxclip1max;
316 unsigned int auxclip2min;
317 unsigned int auxclip2max;
318 unsigned int auxclip3min;
319 unsigned int auxclip3max;
320 unsigned int drawop;
321 unsigned int lpat;
322 unsigned int fontxy;
323 unsigned int fontw;
324 unsigned int fontinc;
325 unsigned int area_pattern[32];
326 unsigned int ucsr;
327 unsigned int stencil;
328 unsigned int stencilctl;
329 unsigned int dcss1;
330 unsigned int dcss2;
331 unsigned int dcss3;
332 unsigned int dcs2;
333 unsigned int dcs3;
334 unsigned int dcs4;
335 unsigned int dcd2;
336 unsigned int dcd3;
337 unsigned int dcd4;
338 unsigned int mer;
339};
340
341#define FFB_MAX_CTXS 32
342
343enum ffb_chip_type {
344 ffb1_prototype = 0, /* Early pre-FCS FFB */
345 ffb1_standard, /* First FCS FFB, 100Mhz UPA, 66MHz gclk */
346 ffb1_speedsort, /* Second FCS FFB, 100Mhz UPA, 75MHz gclk */
347 ffb2_prototype, /* Early pre-FCS vertical FFB2 */
348 ffb2_vertical, /* First FCS FFB2/vertical, 100Mhz UPA, 100MHZ gclk,
349 75(SingleBuffer)/83(DoubleBuffer) MHz fclk */
350 ffb2_vertical_plus, /* Second FCS FFB2/vertical, same timings */
351 ffb2_horizontal, /* First FCS FFB2/horizontal, same timings as FFB2/vert */
352 ffb2_horizontal_plus, /* Second FCS FFB2/horizontal, same timings */
353 afb_m3, /* FCS Elite3D, 3 float chips */
354 afb_m6 /* FCS Elite3D, 6 float chips */
355};
356
357typedef struct ffb_dev_priv {
358 /* Misc software state. */
359 int prom_node;
360 enum ffb_chip_type ffb_type;
361 u64 card_phys_base;
362 struct miscdevice miscdev;
363
364 /* Controller registers. */
365 ffb_fbcPtr regs;
366
367 /* Context table. */
368 struct ffb_hw_context *hw_state[FFB_MAX_CTXS];
369} ffb_dev_priv_t;
370
371extern unsigned long ffb_get_unmapped_area(struct file *filp,
372 unsigned long hint,
373 unsigned long len,
374 unsigned long pgoff,
375 unsigned long flags);
376extern void ffb_set_context_ioctls(void);
377extern drm_ioctl_desc_t DRM(ioctls)[];
378
379extern int ffb_driver_context_switch(drm_device_t * dev, int old, int new);
diff --git a/drivers/char/generic_serial.c b/drivers/char/generic_serial.c
index 337bbcdcf13d..8ea02755b1c9 100644
--- a/drivers/char/generic_serial.c
+++ b/drivers/char/generic_serial.c
@@ -710,12 +710,6 @@ void gs_close(struct tty_struct * tty, struct file * filp)
710} 710}
711 711
712 712
713static unsigned int gs_baudrates[] = {
714 0, 50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800,
715 9600, 19200, 38400, 57600, 115200, 230400, 460800, 921600
716};
717
718
719void gs_set_termios (struct tty_struct * tty, 713void gs_set_termios (struct tty_struct * tty,
720 struct ktermios * old_termios) 714 struct ktermios * old_termios)
721{ 715{
@@ -771,7 +765,6 @@ void gs_set_termios (struct tty_struct * tty,
771 765
772 baudrate = tty_get_baud_rate(tty); 766 baudrate = tty_get_baud_rate(tty);
773 767
774 baudrate = gs_baudrates[baudrate];
775 if ((tiosp->c_cflag & CBAUD) == B38400) { 768 if ((tiosp->c_cflag & CBAUD) == B38400) {
776 if ( (port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI) 769 if ( (port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI)
777 baudrate = 57600; 770 baudrate = 57600;
diff --git a/drivers/char/vt_ioctl.c b/drivers/char/vt_ioctl.c
index 1fa2da8f4fbe..c9f2dd620e87 100644
--- a/drivers/char/vt_ioctl.c
+++ b/drivers/char/vt_ioctl.c
@@ -1039,10 +1039,22 @@ int vt_waitactive(int vt)
1039 1039
1040 add_wait_queue(&vt_activate_queue, &wait); 1040 add_wait_queue(&vt_activate_queue, &wait);
1041 for (;;) { 1041 for (;;) {
1042 set_current_state(TASK_INTERRUPTIBLE);
1043 retval = 0; 1042 retval = 0;
1044 if (vt == fg_console) 1043
1044 /*
1045 * Synchronize with redraw_screen(). By acquiring the console
1046 * semaphore we make sure that the console switch is completed
1047 * before we return. If we didn't wait for the semaphore, we
1048 * could return at a point where fg_console has already been
1049 * updated, but the console switch hasn't been completed.
1050 */
1051 acquire_console_sem();
1052 set_current_state(TASK_INTERRUPTIBLE);
1053 if (vt == fg_console) {
1054 release_console_sem();
1045 break; 1055 break;
1056 }
1057 release_console_sem();
1046 retval = -EINTR; 1058 retval = -EINTR;
1047 if (signal_pending(current)) 1059 if (signal_pending(current))
1048 break; 1060 break;
diff --git a/drivers/clocksource/acpi_pm.c b/drivers/clocksource/acpi_pm.c
index d42060ede930..5ac309ee7f05 100644
--- a/drivers/clocksource/acpi_pm.c
+++ b/drivers/clocksource/acpi_pm.c
@@ -90,7 +90,7 @@ __setup("acpi_pm_good", acpi_pm_good_setup);
90static inline void acpi_pm_need_workaround(void) 90static inline void acpi_pm_need_workaround(void)
91{ 91{
92 clocksource_acpi_pm.read = acpi_pm_read_slow; 92 clocksource_acpi_pm.read = acpi_pm_read_slow;
93 clocksource_acpi_pm.rating = 110; 93 clocksource_acpi_pm.rating = 120;
94} 94}
95 95
96/* 96/*
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index f52facc570f5..3162010900c9 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -1015,6 +1015,10 @@ static int cpufreq_remove_dev (struct sys_device * sys_dev)
1015{ 1015{
1016 unsigned int cpu = sys_dev->id; 1016 unsigned int cpu = sys_dev->id;
1017 int retval; 1017 int retval;
1018
1019 if (cpu_is_offline(cpu))
1020 return 0;
1021
1018 if (unlikely(lock_policy_rwsem_write(cpu))) 1022 if (unlikely(lock_policy_rwsem_write(cpu)))
1019 BUG(); 1023 BUG();
1020 1024
diff --git a/drivers/eisa/pci_eisa.c b/drivers/eisa/pci_eisa.c
index 9e913629ef39..74edb1d0110f 100644
--- a/drivers/eisa/pci_eisa.c
+++ b/drivers/eisa/pci_eisa.c
@@ -19,8 +19,8 @@
19/* There is only *one* pci_eisa device per machine, right ? */ 19/* There is only *one* pci_eisa device per machine, right ? */
20static struct eisa_root_device pci_eisa_root; 20static struct eisa_root_device pci_eisa_root;
21 21
22static int __devinit pci_eisa_init (struct pci_dev *pdev, 22static int __init pci_eisa_init(struct pci_dev *pdev,
23 const struct pci_device_id *ent) 23 const struct pci_device_id *ent)
24{ 24{
25 int rc; 25 int rc;
26 26
diff --git a/drivers/i2c/busses/i2c-amd8111.c b/drivers/i2c/busses/i2c-amd8111.c
index e15f9e37716a..0c70f8293341 100644
--- a/drivers/i2c/busses/i2c-amd8111.c
+++ b/drivers/i2c/busses/i2c-amd8111.c
@@ -254,7 +254,8 @@ static s32 amd8111_access(struct i2c_adapter * adap, u16 addr,
254 break; 254 break;
255 255
256 case I2C_SMBUS_BLOCK_PROC_CALL: 256 case I2C_SMBUS_BLOCK_PROC_CALL:
257 len = min_t(u8, data->block[0], 31); 257 len = min_t(u8, data->block[0],
258 I2C_SMBUS_BLOCK_MAX - 1);
258 amd_ec_write(smbus, AMD_SMB_CMD, command); 259 amd_ec_write(smbus, AMD_SMB_CMD, command);
259 amd_ec_write(smbus, AMD_SMB_BCNT, len); 260 amd_ec_write(smbus, AMD_SMB_BCNT, len);
260 for (i = 0; i < len; i++) 261 for (i = 0; i < len; i++)
diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c
index 6569a36985bd..a320e7d82c1f 100644
--- a/drivers/i2c/busses/i2c-i801.c
+++ b/drivers/i2c/busses/i2c-i801.c
@@ -97,6 +97,7 @@ static int i801_block_transaction(union i2c_smbus_data *data, char read_write,
97 int command, int hwpec); 97 int command, int hwpec);
98 98
99static unsigned long i801_smba; 99static unsigned long i801_smba;
100static unsigned char i801_original_hstcfg;
100static struct pci_driver i801_driver; 101static struct pci_driver i801_driver;
101static struct pci_dev *I801_dev; 102static struct pci_dev *I801_dev;
102static int isich4; 103static int isich4;
@@ -510,6 +511,7 @@ static int __devinit i801_probe(struct pci_dev *dev, const struct pci_device_id
510 } 511 }
511 512
512 pci_read_config_byte(I801_dev, SMBHSTCFG, &temp); 513 pci_read_config_byte(I801_dev, SMBHSTCFG, &temp);
514 i801_original_hstcfg = temp;
513 temp &= ~SMBHSTCFG_I2C_EN; /* SMBus timing */ 515 temp &= ~SMBHSTCFG_I2C_EN; /* SMBus timing */
514 if (!(temp & SMBHSTCFG_HST_EN)) { 516 if (!(temp & SMBHSTCFG_HST_EN)) {
515 dev_info(&dev->dev, "Enabling SMBus device\n"); 517 dev_info(&dev->dev, "Enabling SMBus device\n");
@@ -543,6 +545,7 @@ exit:
543static void __devexit i801_remove(struct pci_dev *dev) 545static void __devexit i801_remove(struct pci_dev *dev)
544{ 546{
545 i2c_del_adapter(&i801_adapter); 547 i2c_del_adapter(&i801_adapter);
548 pci_write_config_byte(I801_dev, SMBHSTCFG, i801_original_hstcfg);
546 pci_release_region(dev, SMBBAR); 549 pci_release_region(dev, SMBBAR);
547 /* 550 /*
548 * do not call pci_disable_device(dev) since it can cause hard hangs on 551 * do not call pci_disable_device(dev) since it can cause hard hangs on
@@ -550,11 +553,33 @@ static void __devexit i801_remove(struct pci_dev *dev)
550 */ 553 */
551} 554}
552 555
556#ifdef CONFIG_PM
557static int i801_suspend(struct pci_dev *dev, pm_message_t mesg)
558{
559 pci_save_state(dev);
560 pci_write_config_byte(dev, SMBHSTCFG, i801_original_hstcfg);
561 pci_set_power_state(dev, pci_choose_state(dev, mesg));
562 return 0;
563}
564
565static int i801_resume(struct pci_dev *dev)
566{
567 pci_set_power_state(dev, PCI_D0);
568 pci_restore_state(dev);
569 return pci_enable_device(dev);
570}
571#else
572#define i801_suspend NULL
573#define i801_resume NULL
574#endif
575
553static struct pci_driver i801_driver = { 576static struct pci_driver i801_driver = {
554 .name = "i801_smbus", 577 .name = "i801_smbus",
555 .id_table = i801_ids, 578 .id_table = i801_ids,
556 .probe = i801_probe, 579 .probe = i801_probe,
557 .remove = __devexit_p(i801_remove), 580 .remove = __devexit_p(i801_remove),
581 .suspend = i801_suspend,
582 .resume = i801_resume,
558}; 583};
559 584
560static int __init i2c_i801_init(void) 585static int __init i2c_i801_init(void)
diff --git a/drivers/i2c/chips/ds1374.c b/drivers/i2c/chips/ds1374.c
index 15edf40828b4..8a2ff0c114d9 100644
--- a/drivers/i2c/chips/ds1374.c
+++ b/drivers/i2c/chips/ds1374.c
@@ -207,6 +207,10 @@ static int ds1374_probe(struct i2c_adapter *adap, int addr, int kind)
207 client->driver = &ds1374_driver; 207 client->driver = &ds1374_driver;
208 208
209 ds1374_workqueue = create_singlethread_workqueue("ds1374"); 209 ds1374_workqueue = create_singlethread_workqueue("ds1374");
210 if (!ds1374_workqueue) {
211 kfree(client);
212 return -ENOMEM; /* most expected reason */
213 }
210 214
211 if ((rc = i2c_attach_client(client)) != 0) { 215 if ((rc = i2c_attach_client(client)) != 0) {
212 kfree(client); 216 kfree(client);
diff --git a/drivers/ide/Kconfig b/drivers/ide/Kconfig
index 8f1fd017679b..ca2e4f830c39 100644
--- a/drivers/ide/Kconfig
+++ b/drivers/ide/Kconfig
@@ -103,8 +103,10 @@ config BLK_DEV_IDE_SATA
103 ---help--- 103 ---help---
104 There are two drivers for Serial ATA controllers. 104 There are two drivers for Serial ATA controllers.
105 105
106 The main driver, "libata", exists inside the SCSI subsystem 106 The main driver, "libata", uses the SCSI subsystem
107 and supports most modern SATA controllers. 107 and supports most modern SATA controllers. In order to use it
108 you may take a look at "Serial ATA (prod) and Parallel ATA
109 (experimental) drivers".
108 110
109 The IDE driver (which you are currently configuring) supports 111 The IDE driver (which you are currently configuring) supports
110 a few first-generation SATA controllers. 112 a few first-generation SATA controllers.
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c
index c193553f6fe7..0e0280076fcd 100644
--- a/drivers/ide/ide-io.c
+++ b/drivers/ide/ide-io.c
@@ -519,21 +519,24 @@ static ide_startstop_t ide_ata_error(ide_drive_t *drive, struct request *rq, u8
519 if ((stat & DRQ_STAT) && rq_data_dir(rq) == READ && hwif->err_stops_fifo == 0) 519 if ((stat & DRQ_STAT) && rq_data_dir(rq) == READ && hwif->err_stops_fifo == 0)
520 try_to_flush_leftover_data(drive); 520 try_to_flush_leftover_data(drive);
521 521
522 if (rq->errors >= ERROR_MAX || blk_noretry_request(rq)) {
523 ide_kill_rq(drive, rq);
524 return ide_stopped;
525 }
526
522 if (hwif->INB(IDE_STATUS_REG) & (BUSY_STAT|DRQ_STAT)) 527 if (hwif->INB(IDE_STATUS_REG) & (BUSY_STAT|DRQ_STAT))
523 /* force an abort */ 528 rq->errors |= ERROR_RESET;
524 hwif->OUTB(WIN_IDLEIMMEDIATE, IDE_COMMAND_REG);
525 529
526 if (rq->errors >= ERROR_MAX || blk_noretry_request(rq)) 530 if ((rq->errors & ERROR_RESET) == ERROR_RESET) {
527 ide_kill_rq(drive, rq);
528 else {
529 if ((rq->errors & ERROR_RESET) == ERROR_RESET) {
530 ++rq->errors;
531 return ide_do_reset(drive);
532 }
533 if ((rq->errors & ERROR_RECAL) == ERROR_RECAL)
534 drive->special.b.recalibrate = 1;
535 ++rq->errors; 531 ++rq->errors;
532 return ide_do_reset(drive);
536 } 533 }
534
535 if ((rq->errors & ERROR_RECAL) == ERROR_RECAL)
536 drive->special.b.recalibrate = 1;
537
538 ++rq->errors;
539
537 return ide_stopped; 540 return ide_stopped;
538} 541}
539 542
@@ -1025,6 +1028,13 @@ static ide_startstop_t start_request (ide_drive_t *drive, struct request *rq)
1025 if (!drive->special.all) { 1028 if (!drive->special.all) {
1026 ide_driver_t *drv; 1029 ide_driver_t *drv;
1027 1030
1031 /*
1032 * We reset the drive so we need to issue a SETFEATURES.
1033 * Do it _after_ do_special() restored device parameters.
1034 */
1035 if (drive->current_speed == 0xff)
1036 ide_config_drive_speed(drive, drive->desired_speed);
1037
1028 if (rq->cmd_type == REQ_TYPE_ATA_CMD || 1038 if (rq->cmd_type == REQ_TYPE_ATA_CMD ||
1029 rq->cmd_type == REQ_TYPE_ATA_TASK || 1039 rq->cmd_type == REQ_TYPE_ATA_TASK ||
1030 rq->cmd_type == REQ_TYPE_ATA_TASKFILE) 1040 rq->cmd_type == REQ_TYPE_ATA_TASKFILE)
diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c
index bd513f5a2323..1ee53a551c3a 100644
--- a/drivers/ide/ide-iops.c
+++ b/drivers/ide/ide-iops.c
@@ -583,8 +583,12 @@ u8 eighty_ninty_three (ide_drive_t *drive)
583 if(!(drive->id->hw_config & 0x4000)) 583 if(!(drive->id->hw_config & 0x4000))
584 return 0; 584 return 0;
585#endif /* CONFIG_IDEDMA_IVB */ 585#endif /* CONFIG_IDEDMA_IVB */
586 if (!(drive->id->hw_config & 0x2000)) 586 /*
587 return 0; 587 * FIXME:
588 * - change master/slave IDENTIFY order
589 * - force bit13 (80c cable present) check
590 * (unless the slave device is pre-ATA3)
591 */
588 return 1; 592 return 1;
589} 593}
590 594
@@ -1090,6 +1094,9 @@ static void pre_reset(ide_drive_t *drive)
1090 if (HWIF(drive)->pre_reset != NULL) 1094 if (HWIF(drive)->pre_reset != NULL)
1091 HWIF(drive)->pre_reset(drive); 1095 HWIF(drive)->pre_reset(drive);
1092 1096
1097 if (drive->current_speed != 0xff)
1098 drive->desired_speed = drive->current_speed;
1099 drive->current_speed = 0xff;
1093} 1100}
1094 1101
1095/* 1102/*
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c
index 695610f0e3e4..a6f098fda884 100644
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -1124,17 +1124,40 @@ static int set_io_32bit(ide_drive_t *drive, int arg)
1124static int set_using_dma (ide_drive_t *drive, int arg) 1124static int set_using_dma (ide_drive_t *drive, int arg)
1125{ 1125{
1126#ifdef CONFIG_BLK_DEV_IDEDMA 1126#ifdef CONFIG_BLK_DEV_IDEDMA
1127 ide_hwif_t *hwif = drive->hwif;
1128 int err = -EPERM;
1129
1127 if (!drive->id || !(drive->id->capability & 1)) 1130 if (!drive->id || !(drive->id->capability & 1))
1128 return -EPERM; 1131 goto out;
1129 if (HWIF(drive)->ide_dma_check == NULL) 1132
1130 return -EPERM; 1133 if (hwif->ide_dma_check == NULL)
1134 goto out;
1135
1136 err = -EBUSY;
1137 if (ide_spin_wait_hwgroup(drive))
1138 goto out;
1139 /*
1140 * set ->busy flag, unlock and let it ride
1141 */
1142 hwif->hwgroup->busy = 1;
1143 spin_unlock_irq(&ide_lock);
1144
1145 err = 0;
1146
1131 if (arg) { 1147 if (arg) {
1132 if (ide_set_dma(drive)) 1148 if (ide_set_dma(drive) || hwif->ide_dma_on(drive))
1133 return -EIO; 1149 err = -EIO;
1134 if (HWIF(drive)->ide_dma_on(drive)) return -EIO;
1135 } else 1150 } else
1136 ide_dma_off(drive); 1151 ide_dma_off(drive);
1137 return 0; 1152
1153 /*
1154 * lock, clear ->busy flag and unlock before leaving
1155 */
1156 spin_lock_irq(&ide_lock);
1157 hwif->hwgroup->busy = 0;
1158 spin_unlock_irq(&ide_lock);
1159out:
1160 return err;
1138#else 1161#else
1139 return -EPERM; 1162 return -EPERM;
1140#endif 1163#endif
diff --git a/drivers/ide/pci/pdc202xx_new.c b/drivers/ide/pci/pdc202xx_new.c
index 6ceb25bc5a7b..ace98929cc3d 100644
--- a/drivers/ide/pci/pdc202xx_new.c
+++ b/drivers/ide/pci/pdc202xx_new.c
@@ -255,7 +255,7 @@ static int config_chipset_for_dma(ide_drive_t *drive)
255 printk(KERN_WARNING "%s reduced to Ultra33 mode.\n", drive->name); 255 printk(KERN_WARNING "%s reduced to Ultra33 mode.\n", drive->name);
256 } 256 }
257 257
258 if (drive->media != ide_disk) 258 if (drive->media != ide_disk && drive->media != ide_cdrom)
259 return 0; 259 return 0;
260 260
261 if (id->capability & 4) { 261 if (id->capability & 4) {
@@ -545,6 +545,7 @@ static void __devinit init_hwif_pdc202new(ide_hwif_t *hwif)
545 545
546 hwif->drives[0].autotune = hwif->drives[1].autotune = 1; 546 hwif->drives[0].autotune = hwif->drives[1].autotune = 1;
547 547
548 hwif->atapi_dma = 1;
548 hwif->ultra_mask = 0x7f; 549 hwif->ultra_mask = 0x7f;
549 hwif->mwdma_mask = 0x07; 550 hwif->mwdma_mask = 0x07;
550 551
diff --git a/drivers/ieee1394/eth1394.c b/drivers/ieee1394/eth1394.c
index a95313521985..03e44b337eb0 100644
--- a/drivers/ieee1394/eth1394.c
+++ b/drivers/ieee1394/eth1394.c
@@ -584,7 +584,10 @@ static void ether1394_add_host (struct hpsb_host *host)
584 } 584 }
585 585
586 SET_MODULE_OWNER(dev); 586 SET_MODULE_OWNER(dev);
587#if 0
588 /* FIXME - Is this the correct parent device anyway? */
587 SET_NETDEV_DEV(dev, &host->device); 589 SET_NETDEV_DEV(dev, &host->device);
590#endif
588 591
589 priv = netdev_priv(dev); 592 priv = netdev_priv(dev);
590 593
diff --git a/drivers/infiniband/hw/cxgb3/cxio_hal.c b/drivers/infiniband/hw/cxgb3/cxio_hal.c
index 818cf1aee8c7..f5e9aeec6f6e 100644
--- a/drivers/infiniband/hw/cxgb3/cxio_hal.c
+++ b/drivers/infiniband/hw/cxgb3/cxio_hal.c
@@ -498,9 +498,9 @@ static int cxio_hal_init_ctrl_qp(struct cxio_rdev *rdev_p)
498 u64 sge_cmd, ctx0, ctx1; 498 u64 sge_cmd, ctx0, ctx1;
499 u64 base_addr; 499 u64 base_addr;
500 struct t3_modify_qp_wr *wqe; 500 struct t3_modify_qp_wr *wqe;
501 struct sk_buff *skb = alloc_skb(sizeof(*wqe), GFP_KERNEL); 501 struct sk_buff *skb;
502
503 502
503 skb = alloc_skb(sizeof(*wqe), GFP_KERNEL);
504 if (!skb) { 504 if (!skb) {
505 PDBG("%s alloc_skb failed\n", __FUNCTION__); 505 PDBG("%s alloc_skb failed\n", __FUNCTION__);
506 return -ENOMEM; 506 return -ENOMEM;
@@ -508,7 +508,7 @@ static int cxio_hal_init_ctrl_qp(struct cxio_rdev *rdev_p)
508 err = cxio_hal_init_ctrl_cq(rdev_p); 508 err = cxio_hal_init_ctrl_cq(rdev_p);
509 if (err) { 509 if (err) {
510 PDBG("%s err %d initializing ctrl_cq\n", __FUNCTION__, err); 510 PDBG("%s err %d initializing ctrl_cq\n", __FUNCTION__, err);
511 return err; 511 goto err;
512 } 512 }
513 rdev_p->ctrl_qp.workq = dma_alloc_coherent( 513 rdev_p->ctrl_qp.workq = dma_alloc_coherent(
514 &(rdev_p->rnic_info.pdev->dev), 514 &(rdev_p->rnic_info.pdev->dev),
@@ -518,7 +518,8 @@ static int cxio_hal_init_ctrl_qp(struct cxio_rdev *rdev_p)
518 GFP_KERNEL); 518 GFP_KERNEL);
519 if (!rdev_p->ctrl_qp.workq) { 519 if (!rdev_p->ctrl_qp.workq) {
520 PDBG("%s dma_alloc_coherent failed\n", __FUNCTION__); 520 PDBG("%s dma_alloc_coherent failed\n", __FUNCTION__);
521 return -ENOMEM; 521 err = -ENOMEM;
522 goto err;
522 } 523 }
523 pci_unmap_addr_set(&rdev_p->ctrl_qp, mapping, 524 pci_unmap_addr_set(&rdev_p->ctrl_qp, mapping,
524 rdev_p->ctrl_qp.dma_addr); 525 rdev_p->ctrl_qp.dma_addr);
@@ -556,6 +557,9 @@ static int cxio_hal_init_ctrl_qp(struct cxio_rdev *rdev_p)
556 rdev_p->ctrl_qp.workq, 1 << T3_CTRL_QP_SIZE_LOG2); 557 rdev_p->ctrl_qp.workq, 1 << T3_CTRL_QP_SIZE_LOG2);
557 skb->priority = CPL_PRIORITY_CONTROL; 558 skb->priority = CPL_PRIORITY_CONTROL;
558 return (cxgb3_ofld_send(rdev_p->t3cdev_p, skb)); 559 return (cxgb3_ofld_send(rdev_p->t3cdev_p, skb));
560err:
561 kfree_skb(skb);
562 return err;
559} 563}
560 564
561static int cxio_hal_destroy_ctrl_qp(struct cxio_rdev *rdev_p) 565static int cxio_hal_destroy_ctrl_qp(struct cxio_rdev *rdev_p)
diff --git a/drivers/infiniband/hw/cxgb3/iwch_provider.c b/drivers/infiniband/hw/cxgb3/iwch_provider.c
index f2774ae906bf..24e0df04f7db 100644
--- a/drivers/infiniband/hw/cxgb3/iwch_provider.c
+++ b/drivers/infiniband/hw/cxgb3/iwch_provider.c
@@ -545,11 +545,14 @@ static int iwch_reregister_phys_mem(struct ib_mr *mr,
545 php = to_iwch_pd(pd); 545 php = to_iwch_pd(pd);
546 if (mr_rereg_mask & IB_MR_REREG_ACCESS) 546 if (mr_rereg_mask & IB_MR_REREG_ACCESS)
547 mh.attr.perms = iwch_ib_to_tpt_access(acc); 547 mh.attr.perms = iwch_ib_to_tpt_access(acc);
548 if (mr_rereg_mask & IB_MR_REREG_TRANS) 548 if (mr_rereg_mask & IB_MR_REREG_TRANS) {
549 ret = build_phys_page_list(buffer_list, num_phys_buf, 549 ret = build_phys_page_list(buffer_list, num_phys_buf,
550 iova_start, 550 iova_start,
551 &total_size, &npages, 551 &total_size, &npages,
552 &shift, &page_list); 552 &shift, &page_list);
553 if (ret)
554 return ret;
555 }
553 556
554 ret = iwch_reregister_mem(rhp, php, &mh, shift, page_list, npages); 557 ret = iwch_reregister_mem(rhp, php, &mh, shift, page_list, npages);
555 kfree(page_list); 558 kfree(page_list);
diff --git a/drivers/infiniband/hw/ehca/ehca_irq.c b/drivers/infiniband/hw/ehca/ehca_irq.c
index 20f36bf8b2b6..f284be1c9166 100644
--- a/drivers/infiniband/hw/ehca/ehca_irq.c
+++ b/drivers/infiniband/hw/ehca/ehca_irq.c
@@ -66,7 +66,9 @@
66static void queue_comp_task(struct ehca_cq *__cq); 66static void queue_comp_task(struct ehca_cq *__cq);
67 67
68static struct ehca_comp_pool* pool; 68static struct ehca_comp_pool* pool;
69#ifdef CONFIG_HOTPLUG_CPU
69static struct notifier_block comp_pool_callback_nb; 70static struct notifier_block comp_pool_callback_nb;
71#endif
70 72
71static inline void comp_event_callback(struct ehca_cq *cq) 73static inline void comp_event_callback(struct ehca_cq *cq)
72{ 74{
@@ -733,6 +735,7 @@ static void take_over_work(struct ehca_comp_pool *pool,
733 735
734} 736}
735 737
738#ifdef CONFIG_HOTPLUG_CPU
736static int comp_pool_callback(struct notifier_block *nfb, 739static int comp_pool_callback(struct notifier_block *nfb,
737 unsigned long action, 740 unsigned long action,
738 void *hcpu) 741 void *hcpu)
@@ -775,6 +778,7 @@ static int comp_pool_callback(struct notifier_block *nfb,
775 778
776 return NOTIFY_OK; 779 return NOTIFY_OK;
777} 780}
781#endif
778 782
779int ehca_create_comp_pool(void) 783int ehca_create_comp_pool(void)
780{ 784{
@@ -805,9 +809,11 @@ int ehca_create_comp_pool(void)
805 } 809 }
806 } 810 }
807 811
812#ifdef CONFIG_HOTPLUG_CPU
808 comp_pool_callback_nb.notifier_call = comp_pool_callback; 813 comp_pool_callback_nb.notifier_call = comp_pool_callback;
809 comp_pool_callback_nb.priority =0; 814 comp_pool_callback_nb.priority =0;
810 register_cpu_notifier(&comp_pool_callback_nb); 815 register_cpu_notifier(&comp_pool_callback_nb);
816#endif
811 817
812 printk(KERN_INFO "eHCA scaling code enabled\n"); 818 printk(KERN_INFO "eHCA scaling code enabled\n");
813 819
@@ -821,7 +827,9 @@ void ehca_destroy_comp_pool(void)
821 if (!ehca_scaling_code) 827 if (!ehca_scaling_code)
822 return; 828 return;
823 829
830#ifdef CONFIG_HOTPLUG_CPU
824 unregister_cpu_notifier(&comp_pool_callback_nb); 831 unregister_cpu_notifier(&comp_pool_callback_nb);
832#endif
825 833
826 for (i = 0; i < NR_CPUS; i++) { 834 for (i = 0; i < NR_CPUS; i++) {
827 if (cpu_online(i)) 835 if (cpu_online(i))
diff --git a/drivers/infiniband/hw/ipath/ipath_fs.c b/drivers/infiniband/hw/ipath/ipath_fs.c
index 5b40a846ff95..ed55979bfd34 100644
--- a/drivers/infiniband/hw/ipath/ipath_fs.c
+++ b/drivers/infiniband/hw/ipath/ipath_fs.c
@@ -451,12 +451,18 @@ bail:
451 return ret; 451 return ret;
452} 452}
453 453
454static void remove_file(struct dentry *parent, char *name) 454static int remove_file(struct dentry *parent, char *name)
455{ 455{
456 struct dentry *tmp; 456 struct dentry *tmp;
457 int ret;
457 458
458 tmp = lookup_one_len(name, parent, strlen(name)); 459 tmp = lookup_one_len(name, parent, strlen(name));
459 460
461 if (IS_ERR(tmp)) {
462 ret = PTR_ERR(tmp);
463 goto bail;
464 }
465
460 spin_lock(&dcache_lock); 466 spin_lock(&dcache_lock);
461 spin_lock(&tmp->d_lock); 467 spin_lock(&tmp->d_lock);
462 if (!(d_unhashed(tmp) && tmp->d_inode)) { 468 if (!(d_unhashed(tmp) && tmp->d_inode)) {
@@ -469,6 +475,14 @@ static void remove_file(struct dentry *parent, char *name)
469 spin_unlock(&tmp->d_lock); 475 spin_unlock(&tmp->d_lock);
470 spin_unlock(&dcache_lock); 476 spin_unlock(&dcache_lock);
471 } 477 }
478
479 ret = 0;
480bail:
481 /*
482 * We don't expect clients to care about the return value, but
483 * it's there if they need it.
484 */
485 return ret;
472} 486}
473 487
474static int remove_device_files(struct super_block *sb, 488static int remove_device_files(struct super_block *sb,
diff --git a/drivers/infiniband/hw/mthca/mthca_mr.c b/drivers/infiniband/hw/mthca/mthca_mr.c
index 8e4846b5c641..fdb576dcfaa8 100644
--- a/drivers/infiniband/hw/mthca/mthca_mr.c
+++ b/drivers/infiniband/hw/mthca/mthca_mr.c
@@ -881,8 +881,8 @@ int mthca_init_mr_table(struct mthca_dev *dev)
881 } 881 }
882 mpts = mtts = 1 << i; 882 mpts = mtts = 1 << i;
883 } else { 883 } else {
884 mpts = dev->limits.num_mtt_segs; 884 mtts = dev->limits.num_mtt_segs;
885 mtts = dev->limits.num_mpts; 885 mpts = dev->limits.num_mpts;
886 } 886 }
887 887
888 if (!mthca_is_memfree(dev) && 888 if (!mthca_is_memfree(dev) &&
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
index 3484e8ba24a4..e70492db74f6 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
@@ -452,7 +452,7 @@ void ipoib_cm_send(struct net_device *dev, struct sk_buff *skb, struct ipoib_cm_
452 skb->len, tx->mtu); 452 skb->len, tx->mtu);
453 ++priv->stats.tx_dropped; 453 ++priv->stats.tx_dropped;
454 ++priv->stats.tx_errors; 454 ++priv->stats.tx_errors;
455 ipoib_cm_skb_too_long(dev, skb, tx->mtu - INFINIBAND_ALEN); 455 ipoib_cm_skb_too_long(dev, skb, tx->mtu - IPOIB_ENCAP_LEN);
456 return; 456 return;
457 } 457 }
458 458
@@ -1095,7 +1095,7 @@ static void ipoib_cm_stale_task(struct work_struct *work)
1095 /* List if sorted by LRU, start from tail, 1095 /* List if sorted by LRU, start from tail,
1096 * stop when we see a recently used entry */ 1096 * stop when we see a recently used entry */
1097 p = list_entry(priv->cm.passive_ids.prev, typeof(*p), list); 1097 p = list_entry(priv->cm.passive_ids.prev, typeof(*p), list);
1098 if (time_after_eq(jiffies, p->jiffies + IPOIB_CM_RX_TIMEOUT)) 1098 if (time_before_eq(jiffies, p->jiffies + IPOIB_CM_RX_TIMEOUT))
1099 break; 1099 break;
1100 list_del_init(&p->list); 1100 list_del_init(&p->list);
1101 spin_unlock_irqrestore(&priv->lock, flags); 1101 spin_unlock_irqrestore(&priv->lock, flags);
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_ib.c b/drivers/infiniband/ulp/ipoib/ipoib_ib.c
index f2aa923ddbea..ba0ee5cf2ad7 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_ib.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_ib.c
@@ -328,9 +328,9 @@ void ipoib_send(struct net_device *dev, struct sk_buff *skb,
328 struct ipoib_tx_buf *tx_req; 328 struct ipoib_tx_buf *tx_req;
329 u64 addr; 329 u64 addr;
330 330
331 if (unlikely(skb->len > priv->mcast_mtu + INFINIBAND_ALEN)) { 331 if (unlikely(skb->len > priv->mcast_mtu + IPOIB_ENCAP_LEN)) {
332 ipoib_warn(priv, "packet len %d (> %d) too long to send, dropping\n", 332 ipoib_warn(priv, "packet len %d (> %d) too long to send, dropping\n",
333 skb->len, priv->mcast_mtu + INFINIBAND_ALEN); 333 skb->len, priv->mcast_mtu + IPOIB_ENCAP_LEN);
334 ++priv->stats.tx_dropped; 334 ++priv->stats.tx_dropped;
335 ++priv->stats.tx_errors; 335 ++priv->stats.tx_errors;
336 ipoib_cm_skb_too_long(dev, skb, priv->mcast_mtu); 336 ipoib_cm_skb_too_long(dev, skb, priv->mcast_mtu);
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
index f9dbc6f68145..f2a40ae8e7d0 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
@@ -380,7 +380,7 @@ static void path_rec_completion(int status,
380 struct net_device *dev = path->dev; 380 struct net_device *dev = path->dev;
381 struct ipoib_dev_priv *priv = netdev_priv(dev); 381 struct ipoib_dev_priv *priv = netdev_priv(dev);
382 struct ipoib_ah *ah = NULL; 382 struct ipoib_ah *ah = NULL;
383 struct ipoib_neigh *neigh; 383 struct ipoib_neigh *neigh, *tn;
384 struct sk_buff_head skqueue; 384 struct sk_buff_head skqueue;
385 struct sk_buff *skb; 385 struct sk_buff *skb;
386 unsigned long flags; 386 unsigned long flags;
@@ -418,7 +418,7 @@ static void path_rec_completion(int status,
418 while ((skb = __skb_dequeue(&path->queue))) 418 while ((skb = __skb_dequeue(&path->queue)))
419 __skb_queue_tail(&skqueue, skb); 419 __skb_queue_tail(&skqueue, skb);
420 420
421 list_for_each_entry(neigh, &path->neigh_list, list) { 421 list_for_each_entry_safe(neigh, tn, &path->neigh_list, list) {
422 kref_get(&path->ah->ref); 422 kref_get(&path->ah->ref);
423 neigh->ah = path->ah; 423 neigh->ah = path->ah;
424 memcpy(&neigh->dgid.raw, &path->pathrec.dgid.raw, 424 memcpy(&neigh->dgid.raw, &path->pathrec.dgid.raw,
@@ -814,7 +814,7 @@ static void ipoib_set_mcast_list(struct net_device *dev)
814 queue_work(ipoib_workqueue, &priv->restart_task); 814 queue_work(ipoib_workqueue, &priv->restart_task);
815} 815}
816 816
817static void ipoib_neigh_destructor(struct neighbour *n) 817static void ipoib_neigh_cleanup(struct neighbour *n)
818{ 818{
819 struct ipoib_neigh *neigh; 819 struct ipoib_neigh *neigh;
820 struct ipoib_dev_priv *priv = netdev_priv(n->dev); 820 struct ipoib_dev_priv *priv = netdev_priv(n->dev);
@@ -822,7 +822,7 @@ static void ipoib_neigh_destructor(struct neighbour *n)
822 struct ipoib_ah *ah = NULL; 822 struct ipoib_ah *ah = NULL;
823 823
824 ipoib_dbg(priv, 824 ipoib_dbg(priv,
825 "neigh_destructor for %06x " IPOIB_GID_FMT "\n", 825 "neigh_cleanup for %06x " IPOIB_GID_FMT "\n",
826 IPOIB_QPN(n->ha), 826 IPOIB_QPN(n->ha),
827 IPOIB_GID_RAW_ARG(n->ha + 4)); 827 IPOIB_GID_RAW_ARG(n->ha + 4));
828 828
@@ -874,7 +874,7 @@ void ipoib_neigh_free(struct net_device *dev, struct ipoib_neigh *neigh)
874 874
875static int ipoib_neigh_setup_dev(struct net_device *dev, struct neigh_parms *parms) 875static int ipoib_neigh_setup_dev(struct net_device *dev, struct neigh_parms *parms)
876{ 876{
877 parms->neigh_destructor = ipoib_neigh_destructor; 877 parms->neigh_cleanup = ipoib_neigh_cleanup;
878 878
879 return 0; 879 return 0;
880} 880}
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
index 56c87a81bb67..54fbead4de01 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
@@ -644,6 +644,9 @@ static int ipoib_mcast_leave(struct net_device *dev, struct ipoib_mcast *mcast)
644 struct ipoib_dev_priv *priv = netdev_priv(dev); 644 struct ipoib_dev_priv *priv = netdev_priv(dev);
645 int ret = 0; 645 int ret = 0;
646 646
647 if (test_and_clear_bit(IPOIB_MCAST_FLAG_BUSY, &mcast->flags))
648 ib_sa_free_multicast(mcast->mc);
649
647 if (test_and_clear_bit(IPOIB_MCAST_FLAG_ATTACHED, &mcast->flags)) { 650 if (test_and_clear_bit(IPOIB_MCAST_FLAG_ATTACHED, &mcast->flags)) {
648 ipoib_dbg_mcast(priv, "leaving MGID " IPOIB_GID_FMT "\n", 651 ipoib_dbg_mcast(priv, "leaving MGID " IPOIB_GID_FMT "\n",
649 IPOIB_GID_ARG(mcast->mcmember.mgid)); 652 IPOIB_GID_ARG(mcast->mcmember.mgid));
@@ -655,9 +658,6 @@ static int ipoib_mcast_leave(struct net_device *dev, struct ipoib_mcast *mcast)
655 ipoib_warn(priv, "ipoib_mcast_detach failed (result = %d)\n", ret); 658 ipoib_warn(priv, "ipoib_mcast_detach failed (result = %d)\n", ret);
656 } 659 }
657 660
658 if (test_and_clear_bit(IPOIB_MCAST_FLAG_BUSY, &mcast->flags))
659 ib_sa_free_multicast(mcast->mc);
660
661 return 0; 661 return 0;
662} 662}
663 663
diff --git a/drivers/infiniband/ulp/iser/iser_initiator.c b/drivers/infiniband/ulp/iser/iser_initiator.c
index 89e37283c836..278fcbccc2d9 100644
--- a/drivers/infiniband/ulp/iser/iser_initiator.c
+++ b/drivers/infiniband/ulp/iser/iser_initiator.c
@@ -658,6 +658,7 @@ void iser_ctask_rdma_finalize(struct iscsi_iser_cmd_task *iser_ctask)
658{ 658{
659 int deferred; 659 int deferred;
660 int is_rdma_aligned = 1; 660 int is_rdma_aligned = 1;
661 struct iser_regd_buf *regd;
661 662
662 /* if we were reading, copy back to unaligned sglist, 663 /* if we were reading, copy back to unaligned sglist,
663 * anyway dma_unmap and free the copy 664 * anyway dma_unmap and free the copy
@@ -672,20 +673,20 @@ void iser_ctask_rdma_finalize(struct iscsi_iser_cmd_task *iser_ctask)
672 } 673 }
673 674
674 if (iser_ctask->dir[ISER_DIR_IN]) { 675 if (iser_ctask->dir[ISER_DIR_IN]) {
675 deferred = iser_regd_buff_release 676 regd = &iser_ctask->rdma_regd[ISER_DIR_IN];
676 (&iser_ctask->rdma_regd[ISER_DIR_IN]); 677 deferred = iser_regd_buff_release(regd);
677 if (deferred) { 678 if (deferred) {
678 iser_err("References remain for BUF-IN rdma reg\n"); 679 iser_err("%d references remain for BUF-IN rdma reg\n",
679 BUG(); 680 atomic_read(&regd->ref_count));
680 } 681 }
681 } 682 }
682 683
683 if (iser_ctask->dir[ISER_DIR_OUT]) { 684 if (iser_ctask->dir[ISER_DIR_OUT]) {
684 deferred = iser_regd_buff_release 685 regd = &iser_ctask->rdma_regd[ISER_DIR_OUT];
685 (&iser_ctask->rdma_regd[ISER_DIR_OUT]); 686 deferred = iser_regd_buff_release(regd);
686 if (deferred) { 687 if (deferred) {
687 iser_err("References remain for BUF-OUT rdma reg\n"); 688 iser_err("%d references remain for BUF-OUT rdma reg\n",
688 BUG(); 689 atomic_read(&regd->ref_count));
689 } 690 }
690 } 691 }
691 692
diff --git a/drivers/isdn/gigaset/bas-gigaset.c b/drivers/isdn/gigaset/bas-gigaset.c
index 63e51dd6debe..00e31609a238 100644
--- a/drivers/isdn/gigaset/bas-gigaset.c
+++ b/drivers/isdn/gigaset/bas-gigaset.c
@@ -54,7 +54,7 @@ MODULE_PARM_DESC(cidmode, "Call-ID mode");
54#define USB_SX353_PRODUCT_ID 0x0022 54#define USB_SX353_PRODUCT_ID 0x0022
55 55
56/* table of devices that work with this driver */ 56/* table of devices that work with this driver */
57static struct usb_device_id gigaset_table [] = { 57static const struct usb_device_id gigaset_table [] = {
58 { USB_DEVICE(USB_GIGA_VENDOR_ID, USB_3070_PRODUCT_ID) }, 58 { USB_DEVICE(USB_GIGA_VENDOR_ID, USB_3070_PRODUCT_ID) },
59 { USB_DEVICE(USB_GIGA_VENDOR_ID, USB_3075_PRODUCT_ID) }, 59 { USB_DEVICE(USB_GIGA_VENDOR_ID, USB_3075_PRODUCT_ID) },
60 { USB_DEVICE(USB_GIGA_VENDOR_ID, USB_SX303_PRODUCT_ID) }, 60 { USB_DEVICE(USB_GIGA_VENDOR_ID, USB_SX303_PRODUCT_ID) },
@@ -2305,7 +2305,7 @@ static void gigaset_disconnect(struct usb_interface *interface)
2305 gigaset_unassign(cs); 2305 gigaset_unassign(cs);
2306} 2306}
2307 2307
2308static struct gigaset_ops gigops = { 2308static const struct gigaset_ops gigops = {
2309 gigaset_write_cmd, 2309 gigaset_write_cmd,
2310 gigaset_write_room, 2310 gigaset_write_room,
2311 gigaset_chars_in_buffer, 2311 gigaset_chars_in_buffer,
diff --git a/drivers/isdn/gigaset/common.c b/drivers/isdn/gigaset/common.c
index b460a73a7c85..6df336bdd571 100644
--- a/drivers/isdn/gigaset/common.c
+++ b/drivers/isdn/gigaset/common.c
@@ -944,8 +944,8 @@ static DEFINE_SPINLOCK(driver_lock);
944struct cardstate *gigaset_get_cs_by_id(int id) 944struct cardstate *gigaset_get_cs_by_id(int id)
945{ 945{
946 unsigned long flags; 946 unsigned long flags;
947 static struct cardstate *ret = NULL; 947 struct cardstate *ret = NULL;
948 static struct cardstate *cs; 948 struct cardstate *cs;
949 struct gigaset_driver *drv; 949 struct gigaset_driver *drv;
950 unsigned i; 950 unsigned i;
951 951
@@ -999,7 +999,7 @@ void gigaset_debugdrivers(void)
999static struct cardstate *gigaset_get_cs_by_minor(unsigned minor) 999static struct cardstate *gigaset_get_cs_by_minor(unsigned minor)
1000{ 1000{
1001 unsigned long flags; 1001 unsigned long flags;
1002 static struct cardstate *ret = NULL; 1002 struct cardstate *ret = NULL;
1003 struct gigaset_driver *drv; 1003 struct gigaset_driver *drv;
1004 unsigned index; 1004 unsigned index;
1005 1005
diff --git a/drivers/isdn/gigaset/ev-layer.c b/drivers/isdn/gigaset/ev-layer.c
index 4661e2c722bc..cec1ef342fcc 100644
--- a/drivers/isdn/gigaset/ev-layer.c
+++ b/drivers/isdn/gigaset/ev-layer.c
@@ -409,7 +409,7 @@ static struct reply_t tab_cid[] = /* no dle mode */ //FIXME
409}; 409};
410#endif 410#endif
411 411
412static struct resp_type_t resp_type[]= 412static const struct resp_type_t resp_type[] =
413{ 413{
414 /*{"", RSP_EMPTY, RT_NOTHING},*/ 414 /*{"", RSP_EMPTY, RT_NOTHING},*/
415 {"OK", RSP_OK, RT_NOTHING}, 415 {"OK", RSP_OK, RT_NOTHING},
@@ -511,7 +511,7 @@ void gigaset_handle_modem_response(struct cardstate *cs)
511 unsigned char *argv[MAX_REC_PARAMS + 1]; 511 unsigned char *argv[MAX_REC_PARAMS + 1];
512 int params; 512 int params;
513 int i, j; 513 int i, j;
514 struct resp_type_t *rt; 514 const struct resp_type_t *rt;
515 int curarg; 515 int curarg;
516 unsigned long flags; 516 unsigned long flags;
517 unsigned next, tail, head; 517 unsigned next, tail, head;
diff --git a/drivers/isdn/gigaset/isocdata.c b/drivers/isdn/gigaset/isocdata.c
index 8c0eb522dab1..e0505f238807 100644
--- a/drivers/isdn/gigaset/isocdata.c
+++ b/drivers/isdn/gigaset/isocdata.c
@@ -274,7 +274,7 @@ static inline void dump_bytes(enum debuglevel level, const char *tag,
274 * bit 12..10 = number of trailing '1' bits in result 274 * bit 12..10 = number of trailing '1' bits in result
275 * bit 14..13 = number of bits added by stuffing 275 * bit 14..13 = number of bits added by stuffing
276 */ 276 */
277static u16 stufftab[5 * 256] = { 277static const u16 stufftab[5 * 256] = {
278// previous 1s = 0: 278// previous 1s = 0:
279 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x000f, 279 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x000f,
280 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x201f, 280 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x201f,
@@ -629,7 +629,7 @@ static inline void hdlc_frag(struct bc_state *bcs, unsigned inbits)
629 * (replacing 8 by 7 to make it fit; the algorithm won't care) 629 * (replacing 8 by 7 to make it fit; the algorithm won't care)
630 * bit 7 set if there are 5 or more "interior" consecutive '1' bits 630 * bit 7 set if there are 5 or more "interior" consecutive '1' bits
631 */ 631 */
632static unsigned char bitcounts[256] = { 632static const unsigned char bitcounts[256] = {
633 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x04, 633 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x04,
634 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x05, 634 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x05,
635 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x04, 635 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x04,
diff --git a/drivers/isdn/gigaset/ser-gigaset.c b/drivers/isdn/gigaset/ser-gigaset.c
index c8b7db65e48f..ea44302e6e7e 100644
--- a/drivers/isdn/gigaset/ser-gigaset.c
+++ b/drivers/isdn/gigaset/ser-gigaset.c
@@ -459,7 +459,7 @@ static int gigaset_set_line_ctrl(struct cardstate *cs, unsigned cflag)
459 return -EINVAL; 459 return -EINVAL;
460} 460}
461 461
462static struct gigaset_ops ops = { 462static const struct gigaset_ops ops = {
463 gigaset_write_cmd, 463 gigaset_write_cmd,
464 gigaset_write_room, 464 gigaset_write_room,
465 gigaset_chars_in_buffer, 465 gigaset_chars_in_buffer,
diff --git a/drivers/isdn/gigaset/usb-gigaset.c b/drivers/isdn/gigaset/usb-gigaset.c
index 04f2ad7ba8b0..2baef349c12d 100644
--- a/drivers/isdn/gigaset/usb-gigaset.c
+++ b/drivers/isdn/gigaset/usb-gigaset.c
@@ -50,7 +50,7 @@ MODULE_PARM_DESC(cidmode, "Call-ID mode");
50#define USB_M105_PRODUCT_ID 0x0009 50#define USB_M105_PRODUCT_ID 0x0009
51 51
52/* table of devices that work with this driver */ 52/* table of devices that work with this driver */
53static struct usb_device_id gigaset_table [] = { 53static const struct usb_device_id gigaset_table [] = {
54 { USB_DEVICE(USB_M105_VENDOR_ID, USB_M105_PRODUCT_ID) }, 54 { USB_DEVICE(USB_M105_VENDOR_ID, USB_M105_PRODUCT_ID) },
55 { } /* Terminating entry */ 55 { } /* Terminating entry */
56}; 56};
@@ -860,7 +860,7 @@ static void gigaset_disconnect(struct usb_interface *interface)
860 gigaset_unassign(cs); 860 gigaset_unassign(cs);
861} 861}
862 862
863static struct gigaset_ops ops = { 863static const struct gigaset_ops ops = {
864 gigaset_write_cmd, 864 gigaset_write_cmd,
865 gigaset_write_room, 865 gigaset_write_room,
866 gigaset_chars_in_buffer, 866 gigaset_chars_in_buffer,
diff --git a/drivers/isdn/hisax/isar.c b/drivers/isdn/hisax/isar.c
index 9df9e3548cf1..c547a6665052 100644
--- a/drivers/isdn/hisax/isar.c
+++ b/drivers/isdn/hisax/isar.c
@@ -440,7 +440,7 @@ isar_bh(struct work_struct *work)
440{ 440{
441 struct BCState *bcs = container_of(work, struct BCState, tqueue); 441 struct BCState *bcs = container_of(work, struct BCState, tqueue);
442 442
443 BChannel_bh(bcs); 443 BChannel_bh(work);
444 if (test_and_clear_bit(B_LL_NOCARRIER, &bcs->event)) 444 if (test_and_clear_bit(B_LL_NOCARRIER, &bcs->event))
445 ll_deliver_faxstat(bcs, ISDN_FAX_CLASS1_NOCARR); 445 ll_deliver_faxstat(bcs, ISDN_FAX_CLASS1_NOCARR);
446 if (test_and_clear_bit(B_LL_CONNECT, &bcs->event)) 446 if (test_and_clear_bit(B_LL_CONNECT, &bcs->event))
diff --git a/drivers/kvm/vmx.c b/drivers/kvm/vmx.c
index bfa0ce42ea92..fbbf9d6b299f 100644
--- a/drivers/kvm/vmx.c
+++ b/drivers/kvm/vmx.c
@@ -618,7 +618,7 @@ static void fix_pmode_dataseg(int seg, struct kvm_save_segment *save)
618{ 618{
619 struct kvm_vmx_segment_field *sf = &kvm_vmx_segment_fields[seg]; 619 struct kvm_vmx_segment_field *sf = &kvm_vmx_segment_fields[seg];
620 620
621 if (vmcs_readl(sf->base) == save->base) { 621 if (vmcs_readl(sf->base) == save->base && (save->base & AR_S_MASK)) {
622 vmcs_write16(sf->selector, save->selector); 622 vmcs_write16(sf->selector, save->selector);
623 vmcs_writel(sf->base, save->base); 623 vmcs_writel(sf->base, save->base);
624 vmcs_write32(sf->limit, save->limit); 624 vmcs_write32(sf->limit, save->limit);
@@ -1888,6 +1888,27 @@ again:
1888 [cr2]"i"(offsetof(struct kvm_vcpu, cr2)) 1888 [cr2]"i"(offsetof(struct kvm_vcpu, cr2))
1889 : "cc", "memory" ); 1889 : "cc", "memory" );
1890 1890
1891 /*
1892 * Reload segment selectors ASAP. (it's needed for a functional
1893 * kernel: x86 relies on having __KERNEL_PDA in %fs and x86_64
1894 * relies on having 0 in %gs for the CPU PDA to work.)
1895 */
1896 if (fs_gs_ldt_reload_needed) {
1897 load_ldt(ldt_sel);
1898 load_fs(fs_sel);
1899 /*
1900 * If we have to reload gs, we must take care to
1901 * preserve our gs base.
1902 */
1903 local_irq_disable();
1904 load_gs(gs_sel);
1905#ifdef CONFIG_X86_64
1906 wrmsrl(MSR_GS_BASE, vmcs_readl(HOST_GS_BASE));
1907#endif
1908 local_irq_enable();
1909
1910 reload_tss();
1911 }
1891 ++kvm_stat.exits; 1912 ++kvm_stat.exits;
1892 1913
1893 save_msrs(vcpu->guest_msrs, NR_BAD_MSRS); 1914 save_msrs(vcpu->guest_msrs, NR_BAD_MSRS);
@@ -1905,22 +1926,6 @@ again:
1905 kvm_run->exit_reason = vmcs_read32(VM_INSTRUCTION_ERROR); 1926 kvm_run->exit_reason = vmcs_read32(VM_INSTRUCTION_ERROR);
1906 r = 0; 1927 r = 0;
1907 } else { 1928 } else {
1908 if (fs_gs_ldt_reload_needed) {
1909 load_ldt(ldt_sel);
1910 load_fs(fs_sel);
1911 /*
1912 * If we have to reload gs, we must take care to
1913 * preserve our gs base.
1914 */
1915 local_irq_disable();
1916 load_gs(gs_sel);
1917#ifdef CONFIG_X86_64
1918 wrmsrl(MSR_GS_BASE, vmcs_readl(HOST_GS_BASE));
1919#endif
1920 local_irq_enable();
1921
1922 reload_tss();
1923 }
1924 /* 1929 /*
1925 * Profile KVM exit RIPs: 1930 * Profile KVM exit RIPs:
1926 */ 1931 */
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 6c06e825cff5..509171ca7fa8 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -1318,6 +1318,7 @@ static int bind_rdev_to_array(mdk_rdev_t * rdev, mddev_t * mddev)
1318 char b[BDEVNAME_SIZE]; 1318 char b[BDEVNAME_SIZE];
1319 struct kobject *ko; 1319 struct kobject *ko;
1320 char *s; 1320 char *s;
1321 int err;
1321 1322
1322 if (rdev->mddev) { 1323 if (rdev->mddev) {
1323 MD_BUG(); 1324 MD_BUG();
@@ -1352,20 +1353,35 @@ static int bind_rdev_to_array(mdk_rdev_t * rdev, mddev_t * mddev)
1352 while ( (s=strchr(rdev->kobj.k_name, '/')) != NULL) 1353 while ( (s=strchr(rdev->kobj.k_name, '/')) != NULL)
1353 *s = '!'; 1354 *s = '!';
1354 1355
1355 list_add(&rdev->same_set, &mddev->disks);
1356 rdev->mddev = mddev; 1356 rdev->mddev = mddev;
1357 printk(KERN_INFO "md: bind<%s>\n", b); 1357 printk(KERN_INFO "md: bind<%s>\n", b);
1358 1358
1359 rdev->kobj.parent = &mddev->kobj; 1359 rdev->kobj.parent = &mddev->kobj;
1360 kobject_add(&rdev->kobj); 1360 if ((err = kobject_add(&rdev->kobj)))
1361 goto fail;
1361 1362
1362 if (rdev->bdev->bd_part) 1363 if (rdev->bdev->bd_part)
1363 ko = &rdev->bdev->bd_part->kobj; 1364 ko = &rdev->bdev->bd_part->kobj;
1364 else 1365 else
1365 ko = &rdev->bdev->bd_disk->kobj; 1366 ko = &rdev->bdev->bd_disk->kobj;
1366 sysfs_create_link(&rdev->kobj, ko, "block"); 1367 if ((err = sysfs_create_link(&rdev->kobj, ko, "block"))) {
1368 kobject_del(&rdev->kobj);
1369 goto fail;
1370 }
1371 list_add(&rdev->same_set, &mddev->disks);
1367 bd_claim_by_disk(rdev->bdev, rdev, mddev->gendisk); 1372 bd_claim_by_disk(rdev->bdev, rdev, mddev->gendisk);
1368 return 0; 1373 return 0;
1374
1375 fail:
1376 printk(KERN_WARNING "md: failed to register dev-%s for %s\n",
1377 b, mdname(mddev));
1378 return err;
1379}
1380
1381static void delayed_delete(struct work_struct *ws)
1382{
1383 mdk_rdev_t *rdev = container_of(ws, mdk_rdev_t, del_work);
1384 kobject_del(&rdev->kobj);
1369} 1385}
1370 1386
1371static void unbind_rdev_from_array(mdk_rdev_t * rdev) 1387static void unbind_rdev_from_array(mdk_rdev_t * rdev)
@@ -1380,7 +1396,12 @@ static void unbind_rdev_from_array(mdk_rdev_t * rdev)
1380 printk(KERN_INFO "md: unbind<%s>\n", bdevname(rdev->bdev,b)); 1396 printk(KERN_INFO "md: unbind<%s>\n", bdevname(rdev->bdev,b));
1381 rdev->mddev = NULL; 1397 rdev->mddev = NULL;
1382 sysfs_remove_link(&rdev->kobj, "block"); 1398 sysfs_remove_link(&rdev->kobj, "block");
1383 kobject_del(&rdev->kobj); 1399
1400 /* We need to delay this, otherwise we can deadlock when
1401 * writing to 'remove' to "dev/state"
1402 */
1403 INIT_WORK(&rdev->del_work, delayed_delete);
1404 schedule_work(&rdev->del_work);
1384} 1405}
1385 1406
1386/* 1407/*
@@ -2966,7 +2987,9 @@ static struct kobject *md_probe(dev_t dev, int *part, void *data)
2966 mddev->kobj.k_name = NULL; 2987 mddev->kobj.k_name = NULL;
2967 snprintf(mddev->kobj.name, KOBJ_NAME_LEN, "%s", "md"); 2988 snprintf(mddev->kobj.name, KOBJ_NAME_LEN, "%s", "md");
2968 mddev->kobj.ktype = &md_ktype; 2989 mddev->kobj.ktype = &md_ktype;
2969 kobject_register(&mddev->kobj); 2990 if (kobject_register(&mddev->kobj))
2991 printk(KERN_WARNING "md: cannot register %s/md - name in use\n",
2992 disk->disk_name);
2970 return NULL; 2993 return NULL;
2971} 2994}
2972 2995
@@ -3144,9 +3167,12 @@ static int do_md_run(mddev_t * mddev)
3144 bitmap_destroy(mddev); 3167 bitmap_destroy(mddev);
3145 return err; 3168 return err;
3146 } 3169 }
3147 if (mddev->pers->sync_request) 3170 if (mddev->pers->sync_request) {
3148 sysfs_create_group(&mddev->kobj, &md_redundancy_group); 3171 if (sysfs_create_group(&mddev->kobj, &md_redundancy_group))
3149 else if (mddev->ro == 2) /* auto-readonly not meaningful */ 3172 printk(KERN_WARNING
3173 "md: cannot register extra attributes for %s\n",
3174 mdname(mddev));
3175 } else if (mddev->ro == 2) /* auto-readonly not meaningful */
3150 mddev->ro = 0; 3176 mddev->ro = 0;
3151 3177
3152 atomic_set(&mddev->writes_pending,0); 3178 atomic_set(&mddev->writes_pending,0);
@@ -3160,7 +3186,9 @@ static int do_md_run(mddev_t * mddev)
3160 if (rdev->raid_disk >= 0) { 3186 if (rdev->raid_disk >= 0) {
3161 char nm[20]; 3187 char nm[20];
3162 sprintf(nm, "rd%d", rdev->raid_disk); 3188 sprintf(nm, "rd%d", rdev->raid_disk);
3163 sysfs_create_link(&mddev->kobj, &rdev->kobj, nm); 3189 if (sysfs_create_link(&mddev->kobj, &rdev->kobj, nm))
3190 printk("md: cannot register %s for %s\n",
3191 nm, mdname(mddev));
3164 } 3192 }
3165 3193
3166 set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); 3194 set_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
@@ -3325,6 +3353,7 @@ static int do_md_stop(mddev_t * mddev, int mode)
3325 mddev->queue->merge_bvec_fn = NULL; 3353 mddev->queue->merge_bvec_fn = NULL;
3326 mddev->queue->unplug_fn = NULL; 3354 mddev->queue->unplug_fn = NULL;
3327 mddev->queue->issue_flush_fn = NULL; 3355 mddev->queue->issue_flush_fn = NULL;
3356 mddev->queue->backing_dev_info.congested_fn = NULL;
3328 if (mddev->pers->sync_request) 3357 if (mddev->pers->sync_request)
3329 sysfs_remove_group(&mddev->kobj, &md_redundancy_group); 3358 sysfs_remove_group(&mddev->kobj, &md_redundancy_group);
3330 3359
@@ -3371,6 +3400,9 @@ static int do_md_stop(mddev_t * mddev, int mode)
3371 sysfs_remove_link(&mddev->kobj, nm); 3400 sysfs_remove_link(&mddev->kobj, nm);
3372 } 3401 }
3373 3402
3403 /* make sure all delayed_delete calls have finished */
3404 flush_scheduled_work();
3405
3374 export_array(mddev); 3406 export_array(mddev);
3375 3407
3376 mddev->array_size = 0; 3408 mddev->array_size = 0;
@@ -5385,8 +5417,12 @@ static int remove_and_add_spares(mddev_t *mddev)
5385 if (mddev->pers->hot_add_disk(mddev,rdev)) { 5417 if (mddev->pers->hot_add_disk(mddev,rdev)) {
5386 char nm[20]; 5418 char nm[20];
5387 sprintf(nm, "rd%d", rdev->raid_disk); 5419 sprintf(nm, "rd%d", rdev->raid_disk);
5388 sysfs_create_link(&mddev->kobj, 5420 if (sysfs_create_link(&mddev->kobj,
5389 &rdev->kobj, nm); 5421 &rdev->kobj, nm))
5422 printk(KERN_WARNING
5423 "md: cannot register "
5424 "%s for %s\n",
5425 nm, mdname(mddev));
5390 spares++; 5426 spares++;
5391 md_new_event(mddev); 5427 md_new_event(mddev);
5392 } else 5428 } else
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 54a1ad5eef42..8d59914f2057 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -3642,12 +3642,15 @@ static int run(mddev_t *mddev)
3642 } 3642 }
3643 3643
3644 /* Ok, everything is just fine now */ 3644 /* Ok, everything is just fine now */
3645 sysfs_create_group(&mddev->kobj, &raid5_attrs_group); 3645 if (sysfs_create_group(&mddev->kobj, &raid5_attrs_group))
3646 printk(KERN_WARNING
3647 "raid5: failed to create sysfs attributes for %s\n",
3648 mdname(mddev));
3646 3649
3647 mddev->queue->unplug_fn = raid5_unplug_device; 3650 mddev->queue->unplug_fn = raid5_unplug_device;
3648 mddev->queue->issue_flush_fn = raid5_issue_flush; 3651 mddev->queue->issue_flush_fn = raid5_issue_flush;
3649 mddev->queue->backing_dev_info.congested_fn = raid5_congested;
3650 mddev->queue->backing_dev_info.congested_data = mddev; 3652 mddev->queue->backing_dev_info.congested_data = mddev;
3653 mddev->queue->backing_dev_info.congested_fn = raid5_congested;
3651 3654
3652 mddev->array_size = mddev->size * (conf->previous_raid_disks - 3655 mddev->array_size = mddev->size * (conf->previous_raid_disks -
3653 conf->max_degraded); 3656 conf->max_degraded);
@@ -3678,6 +3681,7 @@ static int stop(mddev_t *mddev)
3678 mddev->thread = NULL; 3681 mddev->thread = NULL;
3679 shrink_stripes(conf); 3682 shrink_stripes(conf);
3680 kfree(conf->stripe_hashtbl); 3683 kfree(conf->stripe_hashtbl);
3684 mddev->queue->backing_dev_info.congested_fn = NULL;
3681 blk_sync_queue(mddev->queue); /* the unplug fn references 'conf'*/ 3685 blk_sync_queue(mddev->queue); /* the unplug fn references 'conf'*/
3682 sysfs_remove_group(&mddev->kobj, &raid5_attrs_group); 3686 sysfs_remove_group(&mddev->kobj, &raid5_attrs_group);
3683 kfree(conf->disks); 3687 kfree(conf->disks);
@@ -3950,7 +3954,12 @@ static int raid5_start_reshape(mddev_t *mddev)
3950 added_devices++; 3954 added_devices++;
3951 rdev->recovery_offset = 0; 3955 rdev->recovery_offset = 0;
3952 sprintf(nm, "rd%d", rdev->raid_disk); 3956 sprintf(nm, "rd%d", rdev->raid_disk);
3953 sysfs_create_link(&mddev->kobj, &rdev->kobj, nm); 3957 if (sysfs_create_link(&mddev->kobj,
3958 &rdev->kobj, nm))
3959 printk(KERN_WARNING
3960 "raid5: failed to create "
3961 " link %s for %s\n",
3962 nm, mdname(mddev));
3954 } else 3963 } else
3955 break; 3964 break;
3956 } 3965 }
@@ -4104,6 +4113,10 @@ static struct mdk_personality raid4_personality =
4104 .spare_active = raid5_spare_active, 4113 .spare_active = raid5_spare_active,
4105 .sync_request = sync_request, 4114 .sync_request = sync_request,
4106 .resize = raid5_resize, 4115 .resize = raid5_resize,
4116#ifdef CONFIG_MD_RAID5_RESHAPE
4117 .check_reshape = raid5_check_reshape,
4118 .start_reshape = raid5_start_reshape,
4119#endif
4107 .quiesce = raid5_quiesce, 4120 .quiesce = raid5_quiesce,
4108}; 4121};
4109 4122
diff --git a/drivers/media/common/ir-functions.c b/drivers/media/common/ir-functions.c
index cbf7c0564889..fcb194135627 100644
--- a/drivers/media/common/ir-functions.c
+++ b/drivers/media/common/ir-functions.c
@@ -310,13 +310,15 @@ void ir_rc5_timer_end(unsigned long data)
310 tv.tv_usec - ir->base_time.tv_usec; 310 tv.tv_usec - ir->base_time.tv_usec;
311 } 311 }
312 312
313 /* Allow some timmer jitter (RC5 is ~24ms anyway so this is ok) */ 313 /* signal we're ready to start a new code */
314 ir->active = 0;
315
316 /* Allow some timer jitter (RC5 is ~24ms anyway so this is ok) */
314 if (gap < 28000) { 317 if (gap < 28000) {
315 dprintk(1, "ir-common: spurious timer_end\n"); 318 dprintk(1, "ir-common: spurious timer_end\n");
316 return; 319 return;
317 } 320 }
318 321
319 ir->active = 0;
320 if (ir->last_bit < 20) { 322 if (ir->last_bit < 20) {
321 /* ignore spurious codes (caused by light/other remotes) */ 323 /* ignore spurious codes (caused by light/other remotes) */
322 dprintk(1, "ir-common: short code: %x\n", ir->code); 324 dprintk(1, "ir-common: short code: %x\n", ir->code);
diff --git a/drivers/media/dvb/dvb-core/dmxdev.c b/drivers/media/dvb/dvb-core/dmxdev.c
index fc77de45ca4d..a5c0e1a3e6d1 100644
--- a/drivers/media/dvb/dvb-core/dmxdev.c
+++ b/drivers/media/dvb/dvb-core/dmxdev.c
@@ -180,8 +180,7 @@ static int dvb_dvr_release(struct inode *inode, struct file *file)
180 struct dvb_device *dvbdev = file->private_data; 180 struct dvb_device *dvbdev = file->private_data;
181 struct dmxdev *dmxdev = dvbdev->priv; 181 struct dmxdev *dmxdev = dvbdev->priv;
182 182
183 if (mutex_lock_interruptible(&dmxdev->mutex)) 183 mutex_lock(&dmxdev->mutex);
184 return -ERESTARTSYS;
185 184
186 if ((file->f_flags & O_ACCMODE) == O_WRONLY) { 185 if ((file->f_flags & O_ACCMODE) == O_WRONLY) {
187 dmxdev->demux->disconnect_frontend(dmxdev->demux); 186 dmxdev->demux->disconnect_frontend(dmxdev->demux);
@@ -673,13 +672,8 @@ static int dvb_demux_open(struct inode *inode, struct file *file)
673static int dvb_dmxdev_filter_free(struct dmxdev *dmxdev, 672static int dvb_dmxdev_filter_free(struct dmxdev *dmxdev,
674 struct dmxdev_filter *dmxdevfilter) 673 struct dmxdev_filter *dmxdevfilter)
675{ 674{
676 if (mutex_lock_interruptible(&dmxdev->mutex)) 675 mutex_lock(&dmxdev->mutex);
677 return -ERESTARTSYS; 676 mutex_lock(&dmxdevfilter->mutex);
678
679 if (mutex_lock_interruptible(&dmxdevfilter->mutex)) {
680 mutex_unlock(&dmxdev->mutex);
681 return -ERESTARTSYS;
682 }
683 677
684 dvb_dmxdev_filter_stop(dmxdevfilter); 678 dvb_dmxdev_filter_stop(dmxdevfilter);
685 dvb_dmxdev_filter_reset(dmxdevfilter); 679 dvb_dmxdev_filter_reset(dmxdevfilter);
diff --git a/drivers/media/dvb/dvb-core/dvb_demux.c b/drivers/media/dvb/dvb-core/dvb_demux.c
index fcff5eab21a3..6d8d1c3df863 100644
--- a/drivers/media/dvb/dvb-core/dvb_demux.c
+++ b/drivers/media/dvb/dvb-core/dvb_demux.c
@@ -673,8 +673,7 @@ static int dmx_ts_feed_stop_filtering(struct dmx_ts_feed *ts_feed)
673 struct dvb_demux *demux = feed->demux; 673 struct dvb_demux *demux = feed->demux;
674 int ret; 674 int ret;
675 675
676 if (mutex_lock_interruptible(&demux->mutex)) 676 mutex_lock(&demux->mutex);
677 return -ERESTARTSYS;
678 677
679 if (feed->state < DMX_STATE_GO) { 678 if (feed->state < DMX_STATE_GO) {
680 mutex_unlock(&demux->mutex); 679 mutex_unlock(&demux->mutex);
@@ -748,8 +747,7 @@ static int dvbdmx_release_ts_feed(struct dmx_demux *dmx,
748 struct dvb_demux *demux = (struct dvb_demux *)dmx; 747 struct dvb_demux *demux = (struct dvb_demux *)dmx;
749 struct dvb_demux_feed *feed = (struct dvb_demux_feed *)ts_feed; 748 struct dvb_demux_feed *feed = (struct dvb_demux_feed *)ts_feed;
750 749
751 if (mutex_lock_interruptible(&demux->mutex)) 750 mutex_lock(&demux->mutex);
752 return -ERESTARTSYS;
753 751
754 if (feed->state == DMX_STATE_FREE) { 752 if (feed->state == DMX_STATE_FREE) {
755 mutex_unlock(&demux->mutex); 753 mutex_unlock(&demux->mutex);
@@ -916,8 +914,7 @@ static int dmx_section_feed_stop_filtering(struct dmx_section_feed *feed)
916 struct dvb_demux *dvbdmx = dvbdmxfeed->demux; 914 struct dvb_demux *dvbdmx = dvbdmxfeed->demux;
917 int ret; 915 int ret;
918 916
919 if (mutex_lock_interruptible(&dvbdmx->mutex)) 917 mutex_lock(&dvbdmx->mutex);
920 return -ERESTARTSYS;
921 918
922 if (!dvbdmx->stop_feed) { 919 if (!dvbdmx->stop_feed) {
923 mutex_unlock(&dvbdmx->mutex); 920 mutex_unlock(&dvbdmx->mutex);
@@ -942,8 +939,7 @@ static int dmx_section_feed_release_filter(struct dmx_section_feed *feed,
942 struct dvb_demux_feed *dvbdmxfeed = (struct dvb_demux_feed *)feed; 939 struct dvb_demux_feed *dvbdmxfeed = (struct dvb_demux_feed *)feed;
943 struct dvb_demux *dvbdmx = dvbdmxfeed->demux; 940 struct dvb_demux *dvbdmx = dvbdmxfeed->demux;
944 941
945 if (mutex_lock_interruptible(&dvbdmx->mutex)) 942 mutex_lock(&dvbdmx->mutex);
946 return -ERESTARTSYS;
947 943
948 if (dvbdmxfilter->feed != dvbdmxfeed) { 944 if (dvbdmxfilter->feed != dvbdmxfeed) {
949 mutex_unlock(&dvbdmx->mutex); 945 mutex_unlock(&dvbdmx->mutex);
@@ -1016,8 +1012,7 @@ static int dvbdmx_release_section_feed(struct dmx_demux *demux,
1016 struct dvb_demux_feed *dvbdmxfeed = (struct dvb_demux_feed *)feed; 1012 struct dvb_demux_feed *dvbdmxfeed = (struct dvb_demux_feed *)feed;
1017 struct dvb_demux *dvbdmx = (struct dvb_demux *)demux; 1013 struct dvb_demux *dvbdmx = (struct dvb_demux *)demux;
1018 1014
1019 if (mutex_lock_interruptible(&dvbdmx->mutex)) 1015 mutex_lock(&dvbdmx->mutex);
1020 return -ERESTARTSYS;
1021 1016
1022 if (dvbdmxfeed->state == DMX_STATE_FREE) { 1017 if (dvbdmxfeed->state == DMX_STATE_FREE) {
1023 mutex_unlock(&dvbdmx->mutex); 1018 mutex_unlock(&dvbdmx->mutex);
@@ -1126,8 +1121,7 @@ static int dvbdmx_connect_frontend(struct dmx_demux *demux,
1126 if (demux->frontend) 1121 if (demux->frontend)
1127 return -EINVAL; 1122 return -EINVAL;
1128 1123
1129 if (mutex_lock_interruptible(&dvbdemux->mutex)) 1124 mutex_lock(&dvbdemux->mutex);
1130 return -ERESTARTSYS;
1131 1125
1132 demux->frontend = frontend; 1126 demux->frontend = frontend;
1133 mutex_unlock(&dvbdemux->mutex); 1127 mutex_unlock(&dvbdemux->mutex);
@@ -1138,8 +1132,7 @@ static int dvbdmx_disconnect_frontend(struct dmx_demux *demux)
1138{ 1132{
1139 struct dvb_demux *dvbdemux = (struct dvb_demux *)demux; 1133 struct dvb_demux *dvbdemux = (struct dvb_demux *)demux;
1140 1134
1141 if (mutex_lock_interruptible(&dvbdemux->mutex)) 1135 mutex_lock(&dvbdemux->mutex);
1142 return -ERESTARTSYS;
1143 1136
1144 demux->frontend = NULL; 1137 demux->frontend = NULL;
1145 mutex_unlock(&dvbdemux->mutex); 1138 mutex_unlock(&dvbdemux->mutex);
diff --git a/drivers/media/dvb/dvb-core/dvbdev.c b/drivers/media/dvb/dvb-core/dvbdev.c
index 490337b5ee3e..14a372a0fe8b 100644
--- a/drivers/media/dvb/dvb-core/dvbdev.c
+++ b/drivers/media/dvb/dvb-core/dvbdev.c
@@ -203,8 +203,7 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev,
203 203
204 int id; 204 int id;
205 205
206 if (mutex_lock_interruptible(&dvbdev_register_lock)) 206 mutex_lock(&dvbdev_register_lock);
207 return -ERESTARTSYS;
208 207
209 if ((id = dvbdev_get_free_id (adap, type)) < 0){ 208 if ((id = dvbdev_get_free_id (adap, type)) < 0){
210 mutex_unlock(&dvbdev_register_lock); 209 mutex_unlock(&dvbdev_register_lock);
@@ -294,8 +293,7 @@ int dvb_register_adapter(struct dvb_adapter *adap, const char *name, struct modu
294{ 293{
295 int num; 294 int num;
296 295
297 if (mutex_lock_interruptible(&dvbdev_register_lock)) 296 mutex_lock(&dvbdev_register_lock);
298 return -ERESTARTSYS;
299 297
300 if ((num = dvbdev_get_free_adapter_num ()) < 0) { 298 if ((num = dvbdev_get_free_adapter_num ()) < 0) {
301 mutex_unlock(&dvbdev_register_lock); 299 mutex_unlock(&dvbdev_register_lock);
@@ -323,8 +321,7 @@ EXPORT_SYMBOL(dvb_register_adapter);
323 321
324int dvb_unregister_adapter(struct dvb_adapter *adap) 322int dvb_unregister_adapter(struct dvb_adapter *adap)
325{ 323{
326 if (mutex_lock_interruptible(&dvbdev_register_lock)) 324 mutex_lock(&dvbdev_register_lock);
327 return -ERESTARTSYS;
328 list_del (&adap->list_head); 325 list_del (&adap->list_head);
329 mutex_unlock(&dvbdev_register_lock); 326 mutex_unlock(&dvbdev_register_lock);
330 return 0; 327 return 0;
diff --git a/drivers/media/dvb/frontends/isl6421.c b/drivers/media/dvb/frontends/isl6421.c
index ef319369ec26..c967148a5945 100644
--- a/drivers/media/dvb/frontends/isl6421.c
+++ b/drivers/media/dvb/frontends/isl6421.c
@@ -122,6 +122,7 @@ struct dvb_frontend *isl6421_attach(struct dvb_frontend *fe, struct i2c_adapter
122 /* detect if it is present or not */ 122 /* detect if it is present or not */
123 if (isl6421_set_voltage(fe, SEC_VOLTAGE_OFF)) { 123 if (isl6421_set_voltage(fe, SEC_VOLTAGE_OFF)) {
124 kfree(isl6421); 124 kfree(isl6421);
125 fe->sec_priv = NULL;
125 return NULL; 126 return NULL;
126 } 127 }
127 128
diff --git a/drivers/media/dvb/frontends/nxt200x.c b/drivers/media/dvb/frontends/nxt200x.c
index 87c286ee6a00..b809f83d9563 100644
--- a/drivers/media/dvb/frontends/nxt200x.c
+++ b/drivers/media/dvb/frontends/nxt200x.c
@@ -562,7 +562,7 @@ static int nxt200x_setup_frontend_parameters (struct dvb_frontend* fe,
562 562
563 /* set input */ 563 /* set input */
564 if (state->config->set_pll_input) 564 if (state->config->set_pll_input)
565 state->config->set_pll_input(buf, 1); 565 state->config->set_pll_input(buf+1, 1);
566 break; 566 break;
567 case VSB_8: 567 case VSB_8:
568 /* Set non-punctured clock for VSB */ 568 /* Set non-punctured clock for VSB */
@@ -571,7 +571,7 @@ static int nxt200x_setup_frontend_parameters (struct dvb_frontend* fe,
571 571
572 /* set input */ 572 /* set input */
573 if (state->config->set_pll_input) 573 if (state->config->set_pll_input)
574 state->config->set_pll_input(buf, 0); 574 state->config->set_pll_input(buf+1, 0);
575 break; 575 break;
576 default: 576 default:
577 return -EINVAL; 577 return -EINVAL;
diff --git a/drivers/media/dvb/frontends/tda10086.c b/drivers/media/dvb/frontends/tda10086.c
index 4c27a2d90a38..ccc429cbbad0 100644
--- a/drivers/media/dvb/frontends/tda10086.c
+++ b/drivers/media/dvb/frontends/tda10086.c
@@ -212,7 +212,7 @@ static int tda10086_send_master_cmd (struct dvb_frontend* fe,
212 for(i=0; i< cmd->msg_len; i++) { 212 for(i=0; i< cmd->msg_len; i++) {
213 tda10086_write_byte(state, 0x48+i, cmd->msg[i]); 213 tda10086_write_byte(state, 0x48+i, cmd->msg[i]);
214 } 214 }
215 tda10086_write_byte(state, 0x36, 0x08 | ((cmd->msg_len + 1) << 4)); 215 tda10086_write_byte(state, 0x36, 0x08 | ((cmd->msg_len - 1) << 4));
216 216
217 tda10086_diseqc_wait(state); 217 tda10086_diseqc_wait(state);
218 218
diff --git a/drivers/media/dvb/pluto2/pluto2.c b/drivers/media/dvb/pluto2/pluto2.c
index ffda71dfdd65..058df5c10034 100644
--- a/drivers/media/dvb/pluto2/pluto2.c
+++ b/drivers/media/dvb/pluto2/pluto2.c
@@ -149,6 +149,15 @@ static inline void pluto_rw(struct pluto *pluto, u32 reg, u32 mask, u32 bits)
149 writel(val, &pluto->io_mem[reg]); 149 writel(val, &pluto->io_mem[reg]);
150} 150}
151 151
152static void pluto_write_tscr(struct pluto *pluto, u32 val)
153{
154 /* set the number of packets */
155 val &= ~TSCR_ADEF;
156 val |= TS_DMA_PACKETS / 2;
157
158 pluto_writereg(pluto, REG_TSCR, val);
159}
160
152static void pluto_setsda(void *data, int state) 161static void pluto_setsda(void *data, int state)
153{ 162{
154 struct pluto *pluto = data; 163 struct pluto *pluto = data;
@@ -213,11 +222,11 @@ static void pluto_reset_ts(struct pluto *pluto, int reenable)
213 222
214 if (val & TSCR_RSTN) { 223 if (val & TSCR_RSTN) {
215 val &= ~TSCR_RSTN; 224 val &= ~TSCR_RSTN;
216 pluto_writereg(pluto, REG_TSCR, val); 225 pluto_write_tscr(pluto, val);
217 } 226 }
218 if (reenable) { 227 if (reenable) {
219 val |= TSCR_RSTN; 228 val |= TSCR_RSTN;
220 pluto_writereg(pluto, REG_TSCR, val); 229 pluto_write_tscr(pluto, val);
221 } 230 }
222} 231}
223 232
@@ -339,7 +348,7 @@ static irqreturn_t pluto_irq(int irq, void *dev_id)
339 } 348 }
340 349
341 /* ACK the interrupt */ 350 /* ACK the interrupt */
342 pluto_writereg(pluto, REG_TSCR, tscr | TSCR_IACK); 351 pluto_write_tscr(pluto, tscr | TSCR_IACK);
343 352
344 return IRQ_HANDLED; 353 return IRQ_HANDLED;
345} 354}
@@ -348,9 +357,6 @@ static void __devinit pluto_enable_irqs(struct pluto *pluto)
348{ 357{
349 u32 val = pluto_readreg(pluto, REG_TSCR); 358 u32 val = pluto_readreg(pluto, REG_TSCR);
350 359
351 /* set the number of packets */
352 val &= ~TSCR_ADEF;
353 val |= TS_DMA_PACKETS / 2;
354 /* disable AFUL and LOCK interrupts */ 360 /* disable AFUL and LOCK interrupts */
355 val |= (TSCR_MSKA | TSCR_MSKL); 361 val |= (TSCR_MSKA | TSCR_MSKL);
356 /* enable DMA and OVERFLOW interrupts */ 362 /* enable DMA and OVERFLOW interrupts */
@@ -358,7 +364,7 @@ static void __devinit pluto_enable_irqs(struct pluto *pluto)
358 /* clear pending interrupts */ 364 /* clear pending interrupts */
359 val |= TSCR_IACK; 365 val |= TSCR_IACK;
360 366
361 pluto_writereg(pluto, REG_TSCR, val); 367 pluto_write_tscr(pluto, val);
362} 368}
363 369
364static void pluto_disable_irqs(struct pluto *pluto) 370static void pluto_disable_irqs(struct pluto *pluto)
@@ -370,7 +376,7 @@ static void pluto_disable_irqs(struct pluto *pluto)
370 /* clear pending interrupts */ 376 /* clear pending interrupts */
371 val |= TSCR_IACK; 377 val |= TSCR_IACK;
372 378
373 pluto_writereg(pluto, REG_TSCR, val); 379 pluto_write_tscr(pluto, val);
374} 380}
375 381
376static int __devinit pluto_hw_init(struct pluto *pluto) 382static int __devinit pluto_hw_init(struct pluto *pluto)
diff --git a/drivers/media/radio/Kconfig b/drivers/media/radio/Kconfig
index 920b63f8cf05..af66a5d5ecd8 100644
--- a/drivers/media/radio/Kconfig
+++ b/drivers/media/radio/Kconfig
@@ -3,7 +3,7 @@
3# 3#
4 4
5menu "Radio Adapters" 5menu "Radio Adapters"
6 depends on VIDEO_DEV!=n 6 depends on VIDEO_DEV
7 7
8config RADIO_CADET 8config RADIO_CADET
9 tristate "ADS Cadet AM/FM Tuner" 9 tristate "ADS Cadet AM/FM Tuner"
diff --git a/drivers/media/video/msp3400-driver.c b/drivers/media/video/msp3400-driver.c
index 2fb9fe6a1ae7..ba1af3c8525e 100644
--- a/drivers/media/video/msp3400-driver.c
+++ b/drivers/media/video/msp3400-driver.c
@@ -780,18 +780,16 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg)
780 return 0; 780 return 0;
781} 781}
782 782
783static int msp_suspend(struct device * dev, pm_message_t state) 783static int msp_suspend(struct i2c_client *client, pm_message_t state)
784{ 784{
785 struct i2c_client *client = container_of(dev, struct i2c_client, dev);
786 785
787 v4l_dbg(1, msp_debug, client, "suspend\n"); 786 v4l_dbg(1, msp_debug, client, "suspend\n");
788 msp_reset(client); 787 msp_reset(client);
789 return 0; 788 return 0;
790} 789}
791 790
792static int msp_resume(struct device * dev) 791static int msp_resume(struct i2c_client *client)
793{ 792{
794 struct i2c_client *client = container_of(dev, struct i2c_client, dev);
795 793
796 v4l_dbg(1, msp_debug, client, "resume\n"); 794 v4l_dbg(1, msp_debug, client, "resume\n");
797 msp_wake_thread(client); 795 msp_wake_thread(client);
@@ -825,7 +823,7 @@ static int msp_attach(struct i2c_adapter *adapter, int address, int kind)
825 if (msp_reset(client) == -1) { 823 if (msp_reset(client) == -1) {
826 v4l_dbg(1, msp_debug, client, "msp3400 not found\n"); 824 v4l_dbg(1, msp_debug, client, "msp3400 not found\n");
827 kfree(client); 825 kfree(client);
828 return -1; 826 return 0;
829 } 827 }
830 828
831 state = kmalloc(sizeof(*state), GFP_KERNEL); 829 state = kmalloc(sizeof(*state), GFP_KERNEL);
@@ -859,7 +857,7 @@ static int msp_attach(struct i2c_adapter *adapter, int address, int kind)
859 v4l_dbg(1, msp_debug, client, "not an msp3400 (cannot read chip version)\n"); 857 v4l_dbg(1, msp_debug, client, "not an msp3400 (cannot read chip version)\n");
860 kfree(state); 858 kfree(state);
861 kfree(client); 859 kfree(client);
862 return -1; 860 return 0;
863 } 861 }
864 862
865 msp_set_audio(client); 863 msp_set_audio(client);
@@ -996,11 +994,11 @@ static struct i2c_driver i2c_driver = {
996 .id = I2C_DRIVERID_MSP3400, 994 .id = I2C_DRIVERID_MSP3400,
997 .attach_adapter = msp_probe, 995 .attach_adapter = msp_probe,
998 .detach_client = msp_detach, 996 .detach_client = msp_detach,
997 .suspend = msp_suspend,
998 .resume = msp_resume,
999 .command = msp_command, 999 .command = msp_command,
1000 .driver = { 1000 .driver = {
1001 .name = "msp3400", 1001 .name = "msp3400",
1002 .suspend = msp_suspend,
1003 .resume = msp_resume,
1004 }, 1002 },
1005}; 1003};
1006 1004
diff --git a/drivers/media/video/saa7115.c b/drivers/media/video/saa7115.c
index 7735b6758921..4d5bbd859de1 100644
--- a/drivers/media/video/saa7115.c
+++ b/drivers/media/video/saa7115.c
@@ -961,7 +961,7 @@ static void saa711x_set_v4lstd(struct i2c_client *client, v4l2_std_id std)
961 reg |= 0x10; 961 reg |= 0x10;
962 } else if (std == V4L2_STD_NTSC_M_JP) { 962 } else if (std == V4L2_STD_NTSC_M_JP) {
963 reg |= 0x40; 963 reg |= 0x40;
964 } else if (std == V4L2_STD_SECAM) { 964 } else if (std & V4L2_STD_SECAM) {
965 reg |= 0x50; 965 reg |= 0x50;
966 } 966 }
967 saa711x_write(client, R_0E_CHROMA_CNTL_1, reg); 967 saa711x_write(client, R_0E_CHROMA_CNTL_1, reg);
diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c
index 7be73e3763de..15dbc6bf42a7 100644
--- a/drivers/media/video/tuner-core.c
+++ b/drivers/media/video/tuner-core.c
@@ -804,9 +804,8 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
804 return 0; 804 return 0;
805} 805}
806 806
807static int tuner_suspend(struct device *dev, pm_message_t state) 807static int tuner_suspend(struct i2c_client *c, pm_message_t state)
808{ 808{
809 struct i2c_client *c = container_of (dev, struct i2c_client, dev);
810 struct tuner *t = i2c_get_clientdata (c); 809 struct tuner *t = i2c_get_clientdata (c);
811 810
812 tuner_dbg ("suspend\n"); 811 tuner_dbg ("suspend\n");
@@ -814,9 +813,8 @@ static int tuner_suspend(struct device *dev, pm_message_t state)
814 return 0; 813 return 0;
815} 814}
816 815
817static int tuner_resume(struct device *dev) 816static int tuner_resume(struct i2c_client *c)
818{ 817{
819 struct i2c_client *c = container_of (dev, struct i2c_client, dev);
820 struct tuner *t = i2c_get_clientdata (c); 818 struct tuner *t = i2c_get_clientdata (c);
821 819
822 tuner_dbg ("resume\n"); 820 tuner_dbg ("resume\n");
@@ -837,10 +835,10 @@ static struct i2c_driver driver = {
837 .attach_adapter = tuner_probe, 835 .attach_adapter = tuner_probe,
838 .detach_client = tuner_detach, 836 .detach_client = tuner_detach,
839 .command = tuner_command, 837 .command = tuner_command,
838 .suspend = tuner_suspend,
839 .resume = tuner_resume,
840 .driver = { 840 .driver = {
841 .name = "tuner", 841 .name = "tuner",
842 .suspend = tuner_suspend,
843 .resume = tuner_resume,
844 }, 842 },
845}; 843};
846static struct i2c_client client_template = { 844static struct i2c_client client_template = {
diff --git a/drivers/message/fusion/mptsas.c b/drivers/message/fusion/mptsas.c
index 404c014db1bd..1d2d03f77894 100644
--- a/drivers/message/fusion/mptsas.c
+++ b/drivers/message/fusion/mptsas.c
@@ -815,7 +815,7 @@ mptsas_taskmgmt_complete(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
815static int 815static int
816mptsas_ioc_reset(MPT_ADAPTER *ioc, int reset_phase) 816mptsas_ioc_reset(MPT_ADAPTER *ioc, int reset_phase)
817{ 817{
818 MPT_SCSI_HOST *hd = (MPT_SCSI_HOST *)ioc->sh->hostdata; 818 MPT_SCSI_HOST *hd;
819 struct mptsas_target_reset_event *target_reset_list, *n; 819 struct mptsas_target_reset_event *target_reset_list, *n;
820 int rc; 820 int rc;
821 821
@@ -827,7 +827,10 @@ mptsas_ioc_reset(MPT_ADAPTER *ioc, int reset_phase)
827 if (reset_phase != MPT_IOC_POST_RESET) 827 if (reset_phase != MPT_IOC_POST_RESET)
828 goto out; 828 goto out;
829 829
830 if (!hd || !hd->ioc) 830 if (!ioc->sh || !ioc->sh->hostdata)
831 goto out;
832 hd = (MPT_SCSI_HOST *)ioc->sh->hostdata;
833 if (!hd->ioc)
831 goto out; 834 goto out;
832 835
833 if (list_empty(&hd->target_reset_list)) 836 if (list_empty(&hd->target_reset_list))
diff --git a/drivers/message/i2o/i2o_block.c b/drivers/message/i2o/i2o_block.c
index da9859f2caf2..b17c4b2bc9ef 100644
--- a/drivers/message/i2o/i2o_block.c
+++ b/drivers/message/i2o/i2o_block.c
@@ -390,13 +390,6 @@ static int i2o_block_prep_req_fn(struct request_queue *q, struct request *req)
390 return BLKPREP_KILL; 390 return BLKPREP_KILL;
391 } 391 }
392 392
393 /* request is already processed by us, so return */
394 if (blk_special_request(req)) {
395 osm_debug("REQ_SPECIAL already set!\n");
396 req->cmd_flags |= REQ_DONTPREP;
397 return BLKPREP_OK;
398 }
399
400 /* connect the i2o_block_request to the request */ 393 /* connect the i2o_block_request to the request */
401 if (!req->special) { 394 if (!req->special) {
402 ireq = i2o_block_request_alloc(); 395 ireq = i2o_block_request_alloc();
@@ -408,11 +401,8 @@ static int i2o_block_prep_req_fn(struct request_queue *q, struct request *req)
408 ireq->i2o_blk_dev = i2o_blk_dev; 401 ireq->i2o_blk_dev = i2o_blk_dev;
409 req->special = ireq; 402 req->special = ireq;
410 ireq->req = req; 403 ireq->req = req;
411 } else 404 }
412 ireq = req->special;
413
414 /* do not come back here */ 405 /* do not come back here */
415 req->cmd_type = REQ_TYPE_SPECIAL;
416 req->cmd_flags |= REQ_DONTPREP; 406 req->cmd_flags |= REQ_DONTPREP;
417 407
418 return BLKPREP_OK; 408 return BLKPREP_OK;
diff --git a/drivers/mfd/sm501.c b/drivers/mfd/sm501.c
index c707c8ebc1a2..b0b4458ae90b 100644
--- a/drivers/mfd/sm501.c
+++ b/drivers/mfd/sm501.c
@@ -319,7 +319,7 @@ int sm501_unit_power(struct device *dev, unsigned int unit, unsigned int to)
319 319
320 mode &= 3; /* get current power mode */ 320 mode &= 3; /* get current power mode */
321 321
322 if (unit > ARRAY_SIZE(sm->unit_power)) { 322 if (unit >= ARRAY_SIZE(sm->unit_power)) {
323 dev_err(dev, "%s: bad unit %d\n", __FUNCTION__, unit); 323 dev_err(dev, "%s: bad unit %d\n", __FUNCTION__, unit);
324 goto already; 324 goto already;
325 } 325 }
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 5ff0922e628c..c3f9f599f134 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -2372,22 +2372,23 @@ config CHELSIO_T1_NAPI
2372 when the driver is receiving lots of packets from the card. 2372 when the driver is receiving lots of packets from the card.
2373 2373
2374config CHELSIO_T3 2374config CHELSIO_T3
2375 tristate "Chelsio Communications T3 10Gb Ethernet support" 2375 tristate "Chelsio Communications T3 10Gb Ethernet support"
2376 depends on PCI 2376 depends on PCI
2377 help 2377 select FW_LOADER
2378 This driver supports Chelsio T3-based gigabit and 10Gb Ethernet 2378 help
2379 adapters. 2379 This driver supports Chelsio T3-based gigabit and 10Gb Ethernet
2380 adapters.
2380 2381
2381 For general information about Chelsio and our products, visit 2382 For general information about Chelsio and our products, visit
2382 our website at <http://www.chelsio.com>. 2383 our website at <http://www.chelsio.com>.
2383 2384
2384 For customer support, please visit our customer support page at 2385 For customer support, please visit our customer support page at
2385 <http://www.chelsio.com/support.htm>. 2386 <http://www.chelsio.com/support.htm>.
2386 2387
2387 Please send feedback to <linux-bugs@chelsio.com>. 2388 Please send feedback to <linux-bugs@chelsio.com>.
2388 2389
2389 To compile this driver as a module, choose M here: the module 2390 To compile this driver as a module, choose M here: the module
2390 will be called cxgb3. 2391 will be called cxgb3.
2391 2392
2392config EHEA 2393config EHEA
2393 tristate "eHEA Ethernet support" 2394 tristate "eHEA Ethernet support"
diff --git a/drivers/net/atl1/atl1_hw.c b/drivers/net/atl1/atl1_hw.c
index 314dbaabb642..69482e0d849b 100644
--- a/drivers/net/atl1/atl1_hw.c
+++ b/drivers/net/atl1/atl1_hw.c
@@ -334,7 +334,6 @@ u32 atl1_hash_mc_addr(struct atl1_hw *hw, u8 *mc_addr)
334 int i; 334 int i;
335 335
336 crc32 = ether_crc_le(6, mc_addr); 336 crc32 = ether_crc_le(6, mc_addr);
337 crc32 = ~crc32;
338 for (i = 0; i < 32; i++) 337 for (i = 0; i < 32; i++)
339 value |= (((crc32 >> i) & 1) << (31 - i)); 338 value |= (((crc32 >> i) & 1) << (31 - i));
340 339
diff --git a/drivers/net/atl1/atl1_main.c b/drivers/net/atl1/atl1_main.c
index dee3638ad744..8606eac5bec8 100644
--- a/drivers/net/atl1/atl1_main.c
+++ b/drivers/net/atl1/atl1_main.c
@@ -2320,6 +2320,16 @@ static void __devexit atl1_remove(struct pci_dev *pdev)
2320 return; 2320 return;
2321 2321
2322 adapter = netdev_priv(netdev); 2322 adapter = netdev_priv(netdev);
2323
2324 /* Some atl1 boards lack persistent storage for their MAC, and get it
2325 * from the BIOS during POST. If we've been messing with the MAC
2326 * address, we need to save the permanent one.
2327 */
2328 if (memcmp(adapter->hw.mac_addr, adapter->hw.perm_mac_addr, ETH_ALEN)) {
2329 memcpy(adapter->hw.mac_addr, adapter->hw.perm_mac_addr, ETH_ALEN);
2330 atl1_set_mac_addr(&adapter->hw);
2331 }
2332
2323 iowrite16(0, adapter->hw.hw_addr + REG_GPHY_ENABLE); 2333 iowrite16(0, adapter->hw.hw_addr + REG_GPHY_ENABLE);
2324 unregister_netdev(netdev); 2334 unregister_netdev(netdev);
2325 pci_iounmap(pdev, adapter->hw.hw_addr); 2335 pci_iounmap(pdev, adapter->hw.hw_addr);
diff --git a/drivers/net/b44.c b/drivers/net/b44.c
index aaada572732a..d742bfe24471 100644
--- a/drivers/net/b44.c
+++ b/drivers/net/b44.c
@@ -1709,7 +1709,7 @@ static void __b44_set_rx_mode(struct net_device *dev)
1709 bw32(bp, B44_RXCONFIG, val); 1709 bw32(bp, B44_RXCONFIG, val);
1710 } else { 1710 } else {
1711 unsigned char zero[6] = {0, 0, 0, 0, 0, 0}; 1711 unsigned char zero[6] = {0, 0, 0, 0, 0, 0};
1712 int i = 0; 1712 int i = 1;
1713 1713
1714 __b44_set_mac_addr(bp); 1714 __b44_set_mac_addr(bp);
1715 1715
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index c12e5ea61819..0b7aded8dcfd 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -54,8 +54,8 @@
54 54
55#define DRV_MODULE_NAME "bnx2" 55#define DRV_MODULE_NAME "bnx2"
56#define PFX DRV_MODULE_NAME ": " 56#define PFX DRV_MODULE_NAME ": "
57#define DRV_MODULE_VERSION "1.5.5" 57#define DRV_MODULE_VERSION "1.5.7"
58#define DRV_MODULE_RELDATE "February 1, 2007" 58#define DRV_MODULE_RELDATE "March 29, 2007"
59 59
60#define RUN_AT(x) (jiffies + (x)) 60#define RUN_AT(x) (jiffies + (x))
61 61
@@ -2033,8 +2033,8 @@ bnx2_has_work(struct bnx2 *bp)
2033 (sblk->status_tx_quick_consumer_index0 != bp->hw_tx_cons)) 2033 (sblk->status_tx_quick_consumer_index0 != bp->hw_tx_cons))
2034 return 1; 2034 return 1;
2035 2035
2036 if (((sblk->status_attn_bits & STATUS_ATTN_BITS_LINK_STATE) != 0) != 2036 if ((sblk->status_attn_bits & STATUS_ATTN_BITS_LINK_STATE) !=
2037 bp->link_up) 2037 (sblk->status_attn_bits_ack & STATUS_ATTN_BITS_LINK_STATE))
2038 return 1; 2038 return 1;
2039 2039
2040 return 0; 2040 return 0;
@@ -3099,20 +3099,18 @@ bnx2_nvram_write(struct bnx2 *bp, u32 offset, u8 *data_buf,
3099 3099
3100 if ((align_start = (offset32 & 3))) { 3100 if ((align_start = (offset32 & 3))) {
3101 offset32 &= ~3; 3101 offset32 &= ~3;
3102 len32 += (4 - align_start); 3102 len32 += align_start;
3103 if (len32 < 4)
3104 len32 = 4;
3103 if ((rc = bnx2_nvram_read(bp, offset32, start, 4))) 3105 if ((rc = bnx2_nvram_read(bp, offset32, start, 4)))
3104 return rc; 3106 return rc;
3105 } 3107 }
3106 3108
3107 if (len32 & 3) { 3109 if (len32 & 3) {
3108 if ((len32 > 4) || !align_start) { 3110 align_end = 4 - (len32 & 3);
3109 align_end = 4 - (len32 & 3); 3111 len32 += align_end;
3110 len32 += align_end; 3112 if ((rc = bnx2_nvram_read(bp, offset32 + len32 - 4, end, 4)))
3111 if ((rc = bnx2_nvram_read(bp, offset32 + len32 - 4, 3113 return rc;
3112 end, 4))) {
3113 return rc;
3114 }
3115 }
3116 } 3114 }
3117 3115
3118 if (align_start || align_end) { 3116 if (align_start || align_end) {
@@ -3187,17 +3185,17 @@ bnx2_nvram_write(struct bnx2 *bp, u32 offset, u8 *data_buf,
3187 if ((rc = bnx2_enable_nvram_write(bp)) != 0) 3185 if ((rc = bnx2_enable_nvram_write(bp)) != 0)
3188 goto nvram_write_end; 3186 goto nvram_write_end;
3189 3187
3190 /* Erase the page */
3191 if ((rc = bnx2_nvram_erase_page(bp, page_start)) != 0)
3192 goto nvram_write_end;
3193
3194 /* Re-enable the write again for the actual write */
3195 bnx2_enable_nvram_write(bp);
3196
3197 /* Loop to write back the buffer data from page_start to 3188 /* Loop to write back the buffer data from page_start to
3198 * data_start */ 3189 * data_start */
3199 i = 0; 3190 i = 0;
3200 if (bp->flash_info->buffered == 0) { 3191 if (bp->flash_info->buffered == 0) {
3192 /* Erase the page */
3193 if ((rc = bnx2_nvram_erase_page(bp, page_start)) != 0)
3194 goto nvram_write_end;
3195
3196 /* Re-enable the write again for the actual write */
3197 bnx2_enable_nvram_write(bp);
3198
3201 for (addr = page_start; addr < data_start; 3199 for (addr = page_start; addr < data_start;
3202 addr += 4, i += 4) { 3200 addr += 4, i += 4) {
3203 3201
diff --git a/drivers/net/cxgb3/common.h b/drivers/net/cxgb3/common.h
index e23deeb7d06d..97128d88eaef 100644
--- a/drivers/net/cxgb3/common.h
+++ b/drivers/net/cxgb3/common.h
@@ -112,8 +112,7 @@ enum {
112}; 112};
113 113
114enum { 114enum {
115 SUPPORTED_OFFLOAD = 1 << 24, 115 SUPPORTED_IRQ = 1 << 24
116 SUPPORTED_IRQ = 1 << 25
117}; 116};
118 117
119enum { /* adapter interrupt-maintained statistics */ 118enum { /* adapter interrupt-maintained statistics */
@@ -260,6 +259,10 @@ struct mac_stats {
260 unsigned long serdes_signal_loss; 259 unsigned long serdes_signal_loss;
261 unsigned long xaui_pcs_ctc_err; 260 unsigned long xaui_pcs_ctc_err;
262 unsigned long xaui_pcs_align_change; 261 unsigned long xaui_pcs_align_change;
262
263 unsigned long num_toggled; /* # times toggled TxEn due to stuck TX */
264 unsigned long num_resets; /* # times reset due to stuck TX */
265
263}; 266};
264 267
265struct tp_mib_stats { 268struct tp_mib_stats {
@@ -354,6 +357,9 @@ enum {
354 MC5_MODE_72_BIT = 2 357 MC5_MODE_72_BIT = 2
355}; 358};
356 359
360/* MC5 min active region size */
361enum { MC5_MIN_TIDS = 16 };
362
357struct vpd_params { 363struct vpd_params {
358 unsigned int cclk; 364 unsigned int cclk;
359 unsigned int mclk; 365 unsigned int mclk;
@@ -398,6 +404,13 @@ struct adapter_params {
398 unsigned int stats_update_period; /* MAC stats accumulation period */ 404 unsigned int stats_update_period; /* MAC stats accumulation period */
399 unsigned int linkpoll_period; /* link poll period in 0.1s */ 405 unsigned int linkpoll_period; /* link poll period in 0.1s */
400 unsigned int rev; /* chip revision */ 406 unsigned int rev; /* chip revision */
407 unsigned int offload;
408};
409
410enum { /* chip revisions */
411 T3_REV_A = 0,
412 T3_REV_B = 2,
413 T3_REV_B2 = 3,
401}; 414};
402 415
403struct trace_params { 416struct trace_params {
@@ -465,6 +478,10 @@ struct cmac {
465 struct adapter *adapter; 478 struct adapter *adapter;
466 unsigned int offset; 479 unsigned int offset;
467 unsigned int nucast; /* # of address filters for unicast MACs */ 480 unsigned int nucast; /* # of address filters for unicast MACs */
481 unsigned int tcnt;
482 unsigned int xcnt;
483 unsigned int toggle_cnt;
484 unsigned int txen;
468 struct mac_stats stats; 485 struct mac_stats stats;
469}; 486};
470 487
@@ -588,7 +605,7 @@ static inline int is_10G(const struct adapter *adap)
588 605
589static inline int is_offload(const struct adapter *adap) 606static inline int is_offload(const struct adapter *adap)
590{ 607{
591 return adapter_info(adap)->caps & SUPPORTED_OFFLOAD; 608 return adap->params.offload;
592} 609}
593 610
594static inline unsigned int core_ticks_per_usec(const struct adapter *adap) 611static inline unsigned int core_ticks_per_usec(const struct adapter *adap)
@@ -666,6 +683,7 @@ int t3_mac_set_address(struct cmac *mac, unsigned int idx, u8 addr[6]);
666int t3_mac_set_num_ucast(struct cmac *mac, int n); 683int t3_mac_set_num_ucast(struct cmac *mac, int n);
667const struct mac_stats *t3_mac_update_stats(struct cmac *mac); 684const struct mac_stats *t3_mac_update_stats(struct cmac *mac);
668int t3_mac_set_speed_duplex_fc(struct cmac *mac, int speed, int duplex, int fc); 685int t3_mac_set_speed_duplex_fc(struct cmac *mac, int speed, int duplex, int fc);
686int t3b2_mac_watchdog_task(struct cmac *mac);
669 687
670void t3_mc5_prep(struct adapter *adapter, struct mc5 *mc5, int mode); 688void t3_mc5_prep(struct adapter *adapter, struct mc5 *mc5, int mode);
671int t3_mc5_init(struct mc5 *mc5, unsigned int nservers, unsigned int nfilters, 689int t3_mc5_init(struct mc5 *mc5, unsigned int nservers, unsigned int nfilters,
diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c
index 7ff834e45d6b..26240fd5e768 100644
--- a/drivers/net/cxgb3/cxgb3_main.c
+++ b/drivers/net/cxgb3/cxgb3_main.c
@@ -42,6 +42,7 @@
42#include <linux/workqueue.h> 42#include <linux/workqueue.h>
43#include <linux/proc_fs.h> 43#include <linux/proc_fs.h>
44#include <linux/rtnetlink.h> 44#include <linux/rtnetlink.h>
45#include <linux/firmware.h>
45#include <asm/uaccess.h> 46#include <asm/uaccess.h>
46 47
47#include "common.h" 48#include "common.h"
@@ -184,16 +185,26 @@ void t3_os_link_changed(struct adapter *adapter, int port_id, int link_stat,
184 int speed, int duplex, int pause) 185 int speed, int duplex, int pause)
185{ 186{
186 struct net_device *dev = adapter->port[port_id]; 187 struct net_device *dev = adapter->port[port_id];
188 struct port_info *pi = netdev_priv(dev);
189 struct cmac *mac = &pi->mac;
187 190
188 /* Skip changes from disabled ports. */ 191 /* Skip changes from disabled ports. */
189 if (!netif_running(dev)) 192 if (!netif_running(dev))
190 return; 193 return;
191 194
192 if (link_stat != netif_carrier_ok(dev)) { 195 if (link_stat != netif_carrier_ok(dev)) {
193 if (link_stat) 196 if (link_stat) {
197 t3_set_reg_field(adapter,
198 A_XGM_TXFIFO_CFG + mac->offset,
199 F_ENDROPPKT, 0);
194 netif_carrier_on(dev); 200 netif_carrier_on(dev);
195 else 201 } else {
196 netif_carrier_off(dev); 202 netif_carrier_off(dev);
203 t3_set_reg_field(adapter,
204 A_XGM_TXFIFO_CFG + mac->offset,
205 F_ENDROPPKT, F_ENDROPPKT);
206 }
207
197 link_report(dev); 208 link_report(dev);
198 } 209 }
199} 210}
@@ -406,7 +417,7 @@ static void quiesce_rx(struct adapter *adap)
406static int setup_sge_qsets(struct adapter *adap) 417static int setup_sge_qsets(struct adapter *adap)
407{ 418{
408 int i, j, err, irq_idx = 0, qset_idx = 0, dummy_dev_idx = 0; 419 int i, j, err, irq_idx = 0, qset_idx = 0, dummy_dev_idx = 0;
409 unsigned int ntxq = is_offload(adap) ? SGE_TXQ_PER_SET : 1; 420 unsigned int ntxq = SGE_TXQ_PER_SET;
410 421
411 if (adap->params.rev > 0 && !(adap->flags & USING_MSI)) 422 if (adap->params.rev > 0 && !(adap->flags & USING_MSI))
412 irq_idx = -1; 423 irq_idx = -1;
@@ -484,12 +495,14 @@ static ssize_t show_##name(struct device *d, struct device_attribute *attr, \
484static ssize_t set_nfilters(struct net_device *dev, unsigned int val) 495static ssize_t set_nfilters(struct net_device *dev, unsigned int val)
485{ 496{
486 struct adapter *adap = dev->priv; 497 struct adapter *adap = dev->priv;
498 int min_tids = is_offload(adap) ? MC5_MIN_TIDS : 0;
487 499
488 if (adap->flags & FULL_INIT_DONE) 500 if (adap->flags & FULL_INIT_DONE)
489 return -EBUSY; 501 return -EBUSY;
490 if (val && adap->params.rev == 0) 502 if (val && adap->params.rev == 0)
491 return -EINVAL; 503 return -EINVAL;
492 if (val > t3_mc5_size(&adap->mc5) - adap->params.mc5.nservers) 504 if (val > t3_mc5_size(&adap->mc5) - adap->params.mc5.nservers -
505 min_tids)
493 return -EINVAL; 506 return -EINVAL;
494 adap->params.mc5.nfilters = val; 507 adap->params.mc5.nfilters = val;
495 return 0; 508 return 0;
@@ -507,7 +520,8 @@ static ssize_t set_nservers(struct net_device *dev, unsigned int val)
507 520
508 if (adap->flags & FULL_INIT_DONE) 521 if (adap->flags & FULL_INIT_DONE)
509 return -EBUSY; 522 return -EBUSY;
510 if (val > t3_mc5_size(&adap->mc5) - adap->params.mc5.nfilters) 523 if (val > t3_mc5_size(&adap->mc5) - adap->params.mc5.nfilters -
524 MC5_MIN_TIDS)
511 return -EINVAL; 525 return -EINVAL;
512 adap->params.mc5.nservers = val; 526 adap->params.mc5.nservers = val;
513 return 0; 527 return 0;
@@ -707,6 +721,28 @@ static void bind_qsets(struct adapter *adap)
707 } 721 }
708} 722}
709 723
724#define FW_FNAME "t3fw-%d.%d.%d.bin"
725
726static int upgrade_fw(struct adapter *adap)
727{
728 int ret;
729 char buf[64];
730 const struct firmware *fw;
731 struct device *dev = &adap->pdev->dev;
732
733 snprintf(buf, sizeof(buf), FW_FNAME, FW_VERSION_MAJOR,
734 FW_VERSION_MINOR, FW_VERSION_MICRO);
735 ret = request_firmware(&fw, buf, dev);
736 if (ret < 0) {
737 dev_err(dev, "could not upgrade firmware: unable to load %s\n",
738 buf);
739 return ret;
740 }
741 ret = t3_load_fw(adap, fw->data, fw->size);
742 release_firmware(fw);
743 return ret;
744}
745
710/** 746/**
711 * cxgb_up - enable the adapter 747 * cxgb_up - enable the adapter
712 * @adapter: adapter being enabled 748 * @adapter: adapter being enabled
@@ -723,6 +759,8 @@ static int cxgb_up(struct adapter *adap)
723 759
724 if (!(adap->flags & FULL_INIT_DONE)) { 760 if (!(adap->flags & FULL_INIT_DONE)) {
725 err = t3_check_fw_version(adap); 761 err = t3_check_fw_version(adap);
762 if (err == -EINVAL)
763 err = upgrade_fw(adap);
726 if (err) 764 if (err)
727 goto out; 765 goto out;
728 766
@@ -894,7 +932,7 @@ static int cxgb_open(struct net_device *dev)
894 return err; 932 return err;
895 933
896 set_bit(pi->port_id, &adapter->open_device_map); 934 set_bit(pi->port_id, &adapter->open_device_map);
897 if (!ofld_disable) { 935 if (is_offload(adapter) && !ofld_disable) {
898 err = offload_open(dev); 936 err = offload_open(dev);
899 if (err) 937 if (err)
900 printk(KERN_WARNING 938 printk(KERN_WARNING
@@ -1031,7 +1069,11 @@ static char stats_strings[][ETH_GSTRING_LEN] = {
1031 "VLANinsertions ", 1069 "VLANinsertions ",
1032 "TxCsumOffload ", 1070 "TxCsumOffload ",
1033 "RxCsumGood ", 1071 "RxCsumGood ",
1034 "RxDrops " 1072 "RxDrops ",
1073
1074 "CheckTXEnToggled ",
1075 "CheckResets ",
1076
1035}; 1077};
1036 1078
1037static int get_stats_count(struct net_device *dev) 1079static int get_stats_count(struct net_device *dev)
@@ -1145,6 +1187,9 @@ static void get_stats(struct net_device *dev, struct ethtool_stats *stats,
1145 *data++ = collect_sge_port_stats(adapter, pi, SGE_PSTAT_TX_CSUM); 1187 *data++ = collect_sge_port_stats(adapter, pi, SGE_PSTAT_TX_CSUM);
1146 *data++ = collect_sge_port_stats(adapter, pi, SGE_PSTAT_RX_CSUM_GOOD); 1188 *data++ = collect_sge_port_stats(adapter, pi, SGE_PSTAT_RX_CSUM_GOOD);
1147 *data++ = s->rx_cong_drops; 1189 *data++ = s->rx_cong_drops;
1190
1191 *data++ = s->num_toggled;
1192 *data++ = s->num_resets;
1148} 1193}
1149 1194
1150static inline void reg_block_dump(struct adapter *ap, void *buf, 1195static inline void reg_block_dump(struct adapter *ap, void *buf,
@@ -1362,23 +1407,27 @@ static int set_rx_csum(struct net_device *dev, u32 data)
1362 1407
1363static void get_sge_param(struct net_device *dev, struct ethtool_ringparam *e) 1408static void get_sge_param(struct net_device *dev, struct ethtool_ringparam *e)
1364{ 1409{
1365 struct adapter *adapter = dev->priv; 1410 const struct adapter *adapter = dev->priv;
1411 const struct port_info *pi = netdev_priv(dev);
1412 const struct qset_params *q = &adapter->params.sge.qset[pi->first_qset];
1366 1413
1367 e->rx_max_pending = MAX_RX_BUFFERS; 1414 e->rx_max_pending = MAX_RX_BUFFERS;
1368 e->rx_mini_max_pending = 0; 1415 e->rx_mini_max_pending = 0;
1369 e->rx_jumbo_max_pending = MAX_RX_JUMBO_BUFFERS; 1416 e->rx_jumbo_max_pending = MAX_RX_JUMBO_BUFFERS;
1370 e->tx_max_pending = MAX_TXQ_ENTRIES; 1417 e->tx_max_pending = MAX_TXQ_ENTRIES;
1371 1418
1372 e->rx_pending = adapter->params.sge.qset[0].fl_size; 1419 e->rx_pending = q->fl_size;
1373 e->rx_mini_pending = adapter->params.sge.qset[0].rspq_size; 1420 e->rx_mini_pending = q->rspq_size;
1374 e->rx_jumbo_pending = adapter->params.sge.qset[0].jumbo_size; 1421 e->rx_jumbo_pending = q->jumbo_size;
1375 e->tx_pending = adapter->params.sge.qset[0].txq_size[0]; 1422 e->tx_pending = q->txq_size[0];
1376} 1423}
1377 1424
1378static int set_sge_param(struct net_device *dev, struct ethtool_ringparam *e) 1425static int set_sge_param(struct net_device *dev, struct ethtool_ringparam *e)
1379{ 1426{
1380 int i; 1427 int i;
1428 struct qset_params *q;
1381 struct adapter *adapter = dev->priv; 1429 struct adapter *adapter = dev->priv;
1430 const struct port_info *pi = netdev_priv(dev);
1382 1431
1383 if (e->rx_pending > MAX_RX_BUFFERS || 1432 if (e->rx_pending > MAX_RX_BUFFERS ||
1384 e->rx_jumbo_pending > MAX_RX_JUMBO_BUFFERS || 1433 e->rx_jumbo_pending > MAX_RX_JUMBO_BUFFERS ||
@@ -1393,9 +1442,8 @@ static int set_sge_param(struct net_device *dev, struct ethtool_ringparam *e)
1393 if (adapter->flags & FULL_INIT_DONE) 1442 if (adapter->flags & FULL_INIT_DONE)
1394 return -EBUSY; 1443 return -EBUSY;
1395 1444
1396 for (i = 0; i < SGE_QSETS; ++i) { 1445 q = &adapter->params.sge.qset[pi->first_qset];
1397 struct qset_params *q = &adapter->params.sge.qset[i]; 1446 for (i = 0; i < pi->nqsets; ++i, ++q) {
1398
1399 q->rspq_size = e->rx_mini_pending; 1447 q->rspq_size = e->rx_mini_pending;
1400 q->fl_size = e->rx_pending; 1448 q->fl_size = e->rx_pending;
1401 q->jumbo_size = e->rx_jumbo_pending; 1449 q->jumbo_size = e->rx_jumbo_pending;
@@ -2067,6 +2115,40 @@ static void check_link_status(struct adapter *adapter)
2067 } 2115 }
2068} 2116}
2069 2117
2118static void check_t3b2_mac(struct adapter *adapter)
2119{
2120 int i;
2121
2122 rtnl_lock(); /* synchronize with ifdown */
2123 for_each_port(adapter, i) {
2124 struct net_device *dev = adapter->port[i];
2125 struct port_info *p = netdev_priv(dev);
2126 int status;
2127
2128 if (!netif_running(dev))
2129 continue;
2130
2131 status = 0;
2132 if (netif_running(dev) && netif_carrier_ok(dev))
2133 status = t3b2_mac_watchdog_task(&p->mac);
2134 if (status == 1)
2135 p->mac.stats.num_toggled++;
2136 else if (status == 2) {
2137 struct cmac *mac = &p->mac;
2138
2139 t3_mac_set_mtu(mac, dev->mtu);
2140 t3_mac_set_address(mac, 0, dev->dev_addr);
2141 cxgb_set_rxmode(dev);
2142 t3_link_start(&p->phy, mac, &p->link_config);
2143 t3_mac_enable(mac, MAC_DIRECTION_RX | MAC_DIRECTION_TX);
2144 t3_port_intr_enable(adapter, p->port_id);
2145 p->mac.stats.num_resets++;
2146 }
2147 }
2148 rtnl_unlock();
2149}
2150
2151
2070static void t3_adap_check_task(struct work_struct *work) 2152static void t3_adap_check_task(struct work_struct *work)
2071{ 2153{
2072 struct adapter *adapter = container_of(work, struct adapter, 2154 struct adapter *adapter = container_of(work, struct adapter,
@@ -2087,6 +2169,9 @@ static void t3_adap_check_task(struct work_struct *work)
2087 adapter->check_task_cnt = 0; 2169 adapter->check_task_cnt = 0;
2088 } 2170 }
2089 2171
2172 if (p->rev == T3_REV_B2)
2173 check_t3b2_mac(adapter);
2174
2090 /* Schedule the next check update if any port is active. */ 2175 /* Schedule the next check update if any port is active. */
2091 spin_lock(&adapter->work_lock); 2176 spin_lock(&adapter->work_lock);
2092 if (adapter->open_device_map & PORT_MASK) 2177 if (adapter->open_device_map & PORT_MASK)
@@ -2195,9 +2280,9 @@ static void __devinit print_port_info(struct adapter *adap,
2195 2280
2196 if (!test_bit(i, &adap->registered_device_map)) 2281 if (!test_bit(i, &adap->registered_device_map))
2197 continue; 2282 continue;
2198 printk(KERN_INFO "%s: %s %s RNIC (rev %d) %s%s\n", 2283 printk(KERN_INFO "%s: %s %s %sNIC (rev %d) %s%s\n",
2199 dev->name, ai->desc, pi->port_type->desc, 2284 dev->name, ai->desc, pi->port_type->desc,
2200 adap->params.rev, buf, 2285 is_offload(adap) ? "R" : "", adap->params.rev, buf,
2201 (adap->flags & USING_MSIX) ? " MSI-X" : 2286 (adap->flags & USING_MSIX) ? " MSI-X" :
2202 (adap->flags & USING_MSI) ? " MSI" : ""); 2287 (adap->flags & USING_MSI) ? " MSI" : "");
2203 if (adap->name == dev->name && adap->params.vpd.mclk) 2288 if (adap->name == dev->name && adap->params.vpd.mclk)
diff --git a/drivers/net/cxgb3/cxgb3_offload.c b/drivers/net/cxgb3/cxgb3_offload.c
index f6ed033efb56..eed7a48e3111 100644
--- a/drivers/net/cxgb3/cxgb3_offload.c
+++ b/drivers/net/cxgb3/cxgb3_offload.c
@@ -553,7 +553,9 @@ int cxgb3_alloc_atid(struct t3cdev *tdev, struct cxgb3_client *client,
553 struct tid_info *t = &(T3C_DATA(tdev))->tid_maps; 553 struct tid_info *t = &(T3C_DATA(tdev))->tid_maps;
554 554
555 spin_lock_bh(&t->atid_lock); 555 spin_lock_bh(&t->atid_lock);
556 if (t->afree) { 556 if (t->afree &&
557 t->atids_in_use + atomic_read(&t->tids_in_use) + MC5_MIN_TIDS <=
558 t->ntids) {
557 union active_open_entry *p = t->afree; 559 union active_open_entry *p = t->afree;
558 560
559 atid = (p - t->atid_tab) + t->atid_base; 561 atid = (p - t->atid_tab) + t->atid_base;
diff --git a/drivers/net/cxgb3/mc5.c b/drivers/net/cxgb3/mc5.c
index 644d62ea86a6..84c1ffa8e2d3 100644
--- a/drivers/net/cxgb3/mc5.c
+++ b/drivers/net/cxgb3/mc5.c
@@ -328,6 +328,9 @@ int t3_mc5_init(struct mc5 *mc5, unsigned int nservers, unsigned int nfilters,
328 unsigned int tcam_size = mc5->tcam_size; 328 unsigned int tcam_size = mc5->tcam_size;
329 struct adapter *adap = mc5->adapter; 329 struct adapter *adap = mc5->adapter;
330 330
331 if (!tcam_size)
332 return 0;
333
331 if (nroutes > MAX_ROUTES || nroutes + nservers + nfilters > tcam_size) 334 if (nroutes > MAX_ROUTES || nroutes + nservers + nfilters > tcam_size)
332 return -EINVAL; 335 return -EINVAL;
333 336
diff --git a/drivers/net/cxgb3/regs.h b/drivers/net/cxgb3/regs.h
index b56c5f52bcdc..f8be41c5a081 100644
--- a/drivers/net/cxgb3/regs.h
+++ b/drivers/net/cxgb3/regs.h
@@ -1206,6 +1206,14 @@
1206 1206
1207#define A_TP_RX_TRC_KEY0 0x120 1207#define A_TP_RX_TRC_KEY0 0x120
1208 1208
1209#define A_TP_TX_DROP_CNT_CH0 0x12d
1210
1211#define S_TXDROPCNTCH0RCVD 0
1212#define M_TXDROPCNTCH0RCVD 0xffff
1213#define V_TXDROPCNTCH0RCVD(x) ((x) << S_TXDROPCNTCH0RCVD)
1214#define G_TXDROPCNTCH0RCVD(x) (((x) >> S_TXDROPCNTCH0RCVD) & \
1215 M_TXDROPCNTCH0RCVD)
1216
1209#define A_ULPRX_CTL 0x500 1217#define A_ULPRX_CTL 0x500
1210 1218
1211#define S_ROUND_ROBIN 4 1219#define S_ROUND_ROBIN 4
@@ -1834,6 +1842,8 @@
1834#define V_TXPAUSEEN(x) ((x) << S_TXPAUSEEN) 1842#define V_TXPAUSEEN(x) ((x) << S_TXPAUSEEN)
1835#define F_TXPAUSEEN V_TXPAUSEEN(1U) 1843#define F_TXPAUSEEN V_TXPAUSEEN(1U)
1836 1844
1845#define A_XGM_TX_PAUSE_QUANTA 0x808
1846
1837#define A_XGM_RX_CTRL 0x80c 1847#define A_XGM_RX_CTRL 0x80c
1838 1848
1839#define S_RXEN 0 1849#define S_RXEN 0
@@ -1920,11 +1930,20 @@
1920 1930
1921#define A_XGM_TXFIFO_CFG 0x888 1931#define A_XGM_TXFIFO_CFG 0x888
1922 1932
1933#define S_TXIPG 13
1934#define M_TXIPG 0xff
1935#define V_TXIPG(x) ((x) << S_TXIPG)
1936#define G_TXIPG(x) (((x) >> S_TXIPG) & M_TXIPG)
1937
1923#define S_TXFIFOTHRESH 4 1938#define S_TXFIFOTHRESH 4
1924#define M_TXFIFOTHRESH 0x1ff 1939#define M_TXFIFOTHRESH 0x1ff
1925 1940
1926#define V_TXFIFOTHRESH(x) ((x) << S_TXFIFOTHRESH) 1941#define V_TXFIFOTHRESH(x) ((x) << S_TXFIFOTHRESH)
1927 1942
1943#define S_ENDROPPKT 21
1944#define V_ENDROPPKT(x) ((x) << S_ENDROPPKT)
1945#define F_ENDROPPKT V_ENDROPPKT(1U)
1946
1928#define A_XGM_SERDES_CTRL 0x890 1947#define A_XGM_SERDES_CTRL 0x890
1929#define A_XGM_SERDES_CTRL0 0x8e0 1948#define A_XGM_SERDES_CTRL0 0x8e0
1930 1949
@@ -2190,6 +2209,13 @@
2190 2209
2191#define A_XGM_RX_MAX_PKT_SIZE_ERR_CNT 0x9a4 2210#define A_XGM_RX_MAX_PKT_SIZE_ERR_CNT 0x9a4
2192 2211
2212#define A_XGM_TX_SPI4_SOP_EOP_CNT 0x9a8
2213
2214#define S_TXSPI4SOPCNT 16
2215#define M_TXSPI4SOPCNT 0xffff
2216#define V_TXSPI4SOPCNT(x) ((x) << S_TXSPI4SOPCNT)
2217#define G_TXSPI4SOPCNT(x) (((x) >> S_TXSPI4SOPCNT) & M_TXSPI4SOPCNT)
2218
2193#define A_XGM_RX_SPI4_SOP_EOP_CNT 0x9ac 2219#define A_XGM_RX_SPI4_SOP_EOP_CNT 0x9ac
2194 2220
2195#define XGMAC0_1_BASE_ADDR 0xa00 2221#define XGMAC0_1_BASE_ADDR 0xa00
diff --git a/drivers/net/cxgb3/sge.c b/drivers/net/cxgb3/sge.c
index c23783432e51..027ab2c3825c 100644
--- a/drivers/net/cxgb3/sge.c
+++ b/drivers/net/cxgb3/sge.c
@@ -2631,7 +2631,7 @@ int t3_sge_alloc_qset(struct adapter *adapter, unsigned int id, int nports,
2631 q->txq[TXQ_ETH].stop_thres = nports * 2631 q->txq[TXQ_ETH].stop_thres = nports *
2632 flits_to_desc(sgl_len(MAX_SKB_FRAGS + 1) + 3); 2632 flits_to_desc(sgl_len(MAX_SKB_FRAGS + 1) + 3);
2633 2633
2634 if (ntxq == 1) { 2634 if (!is_offload(adapter)) {
2635#ifdef USE_RX_PAGE 2635#ifdef USE_RX_PAGE
2636 q->fl[0].buf_size = RX_PAGE_SIZE; 2636 q->fl[0].buf_size = RX_PAGE_SIZE;
2637#else 2637#else
diff --git a/drivers/net/cxgb3/t3_hw.c b/drivers/net/cxgb3/t3_hw.c
index eaa7a2e89a30..d83f075ef2d7 100644
--- a/drivers/net/cxgb3/t3_hw.c
+++ b/drivers/net/cxgb3/t3_hw.c
@@ -438,23 +438,23 @@ static const struct adapter_info t3_adap_info[] = {
438 {2, 0, 0, 0, 438 {2, 0, 0, 0,
439 F_GPIO2_OEN | F_GPIO4_OEN | 439 F_GPIO2_OEN | F_GPIO4_OEN |
440 F_GPIO2_OUT_VAL | F_GPIO4_OUT_VAL, F_GPIO3 | F_GPIO5, 440 F_GPIO2_OUT_VAL | F_GPIO4_OUT_VAL, F_GPIO3 | F_GPIO5,
441 SUPPORTED_OFFLOAD, 441 0,
442 &mi1_mdio_ops, "Chelsio PE9000"}, 442 &mi1_mdio_ops, "Chelsio PE9000"},
443 {2, 0, 0, 0, 443 {2, 0, 0, 0,
444 F_GPIO2_OEN | F_GPIO4_OEN | 444 F_GPIO2_OEN | F_GPIO4_OEN |
445 F_GPIO2_OUT_VAL | F_GPIO4_OUT_VAL, F_GPIO3 | F_GPIO5, 445 F_GPIO2_OUT_VAL | F_GPIO4_OUT_VAL, F_GPIO3 | F_GPIO5,
446 SUPPORTED_OFFLOAD, 446 0,
447 &mi1_mdio_ops, "Chelsio T302"}, 447 &mi1_mdio_ops, "Chelsio T302"},
448 {1, 0, 0, 0, 448 {1, 0, 0, 0,
449 F_GPIO1_OEN | F_GPIO6_OEN | F_GPIO7_OEN | F_GPIO10_OEN | 449 F_GPIO1_OEN | F_GPIO6_OEN | F_GPIO7_OEN | F_GPIO10_OEN |
450 F_GPIO1_OUT_VAL | F_GPIO6_OUT_VAL | F_GPIO10_OUT_VAL, 0, 450 F_GPIO1_OUT_VAL | F_GPIO6_OUT_VAL | F_GPIO10_OUT_VAL, 0,
451 SUPPORTED_10000baseT_Full | SUPPORTED_AUI | SUPPORTED_OFFLOAD, 451 SUPPORTED_10000baseT_Full | SUPPORTED_AUI,
452 &mi1_mdio_ext_ops, "Chelsio T310"}, 452 &mi1_mdio_ext_ops, "Chelsio T310"},
453 {2, 0, 0, 0, 453 {2, 0, 0, 0,
454 F_GPIO1_OEN | F_GPIO2_OEN | F_GPIO4_OEN | F_GPIO5_OEN | F_GPIO6_OEN | 454 F_GPIO1_OEN | F_GPIO2_OEN | F_GPIO4_OEN | F_GPIO5_OEN | F_GPIO6_OEN |
455 F_GPIO7_OEN | F_GPIO10_OEN | F_GPIO11_OEN | F_GPIO1_OUT_VAL | 455 F_GPIO7_OEN | F_GPIO10_OEN | F_GPIO11_OEN | F_GPIO1_OUT_VAL |
456 F_GPIO5_OUT_VAL | F_GPIO6_OUT_VAL | F_GPIO10_OUT_VAL, 0, 456 F_GPIO5_OUT_VAL | F_GPIO6_OUT_VAL | F_GPIO10_OUT_VAL, 0,
457 SUPPORTED_10000baseT_Full | SUPPORTED_AUI | SUPPORTED_OFFLOAD, 457 SUPPORTED_10000baseT_Full | SUPPORTED_AUI,
458 &mi1_mdio_ext_ops, "Chelsio T320"}, 458 &mi1_mdio_ext_ops, "Chelsio T320"},
459}; 459};
460 460
@@ -681,7 +681,8 @@ enum {
681 SF_ERASE_SECTOR = 0xd8, /* erase sector */ 681 SF_ERASE_SECTOR = 0xd8, /* erase sector */
682 682
683 FW_FLASH_BOOT_ADDR = 0x70000, /* start address of FW in flash */ 683 FW_FLASH_BOOT_ADDR = 0x70000, /* start address of FW in flash */
684 FW_VERS_ADDR = 0x77ffc /* flash address holding FW version */ 684 FW_VERS_ADDR = 0x77ffc, /* flash address holding FW version */
685 FW_MIN_SIZE = 8 /* at least version and csum */
685}; 686};
686 687
687/** 688/**
@@ -935,7 +936,7 @@ int t3_load_fw(struct adapter *adapter, const u8 *fw_data, unsigned int size)
935 const u32 *p = (const u32 *)fw_data; 936 const u32 *p = (const u32 *)fw_data;
936 int ret, addr, fw_sector = FW_FLASH_BOOT_ADDR >> 16; 937 int ret, addr, fw_sector = FW_FLASH_BOOT_ADDR >> 16;
937 938
938 if (size & 3) 939 if ((size & 3) || size < FW_MIN_SIZE)
939 return -EINVAL; 940 return -EINVAL;
940 if (size > FW_VERS_ADDR + 8 - FW_FLASH_BOOT_ADDR) 941 if (size > FW_VERS_ADDR + 8 - FW_FLASH_BOOT_ADDR)
941 return -EFBIG; 942 return -EFBIG;
@@ -2899,6 +2900,9 @@ static int mc7_init(struct mc7 *mc7, unsigned int mc7_clock, int mem_type)
2899 struct adapter *adapter = mc7->adapter; 2900 struct adapter *adapter = mc7->adapter;
2900 const struct mc7_timing_params *p = &mc7_timings[mem_type]; 2901 const struct mc7_timing_params *p = &mc7_timings[mem_type];
2901 2902
2903 if (!mc7->size)
2904 return 0;
2905
2902 val = t3_read_reg(adapter, mc7->offset + A_MC7_CFG); 2906 val = t3_read_reg(adapter, mc7->offset + A_MC7_CFG);
2903 slow = val & F_SLOW; 2907 slow = val & F_SLOW;
2904 width = G_WIDTH(val); 2908 width = G_WIDTH(val);
@@ -3099,8 +3103,10 @@ int t3_init_hw(struct adapter *adapter, u32 fw_params)
3099 do { /* wait for uP to initialize */ 3103 do { /* wait for uP to initialize */
3100 msleep(20); 3104 msleep(20);
3101 } while (t3_read_reg(adapter, A_CIM_HOST_ACC_DATA) && --attempts); 3105 } while (t3_read_reg(adapter, A_CIM_HOST_ACC_DATA) && --attempts);
3102 if (!attempts) 3106 if (!attempts) {
3107 CH_ERR(adapter, "uP initialization timed out\n");
3103 goto out_err; 3108 goto out_err;
3109 }
3104 3110
3105 err = 0; 3111 err = 0;
3106out_err: 3112out_err:
@@ -3200,7 +3206,7 @@ static void __devinit mc7_prep(struct adapter *adapter, struct mc7 *mc7,
3200 mc7->name = name; 3206 mc7->name = name;
3201 mc7->offset = base_addr - MC7_PMRX_BASE_ADDR; 3207 mc7->offset = base_addr - MC7_PMRX_BASE_ADDR;
3202 cfg = t3_read_reg(adapter, mc7->offset + A_MC7_CFG); 3208 cfg = t3_read_reg(adapter, mc7->offset + A_MC7_CFG);
3203 mc7->size = mc7_calc_size(cfg); 3209 mc7->size = mc7->size = G_DEN(cfg) == M_DEN ? 0 : mc7_calc_size(cfg);
3204 mc7->width = G_WIDTH(cfg); 3210 mc7->width = G_WIDTH(cfg);
3205} 3211}
3206 3212
@@ -3227,6 +3233,7 @@ void early_hw_init(struct adapter *adapter, const struct adapter_info *ai)
3227 V_I2C_CLKDIV(adapter->params.vpd.cclk / 80 - 1)); 3233 V_I2C_CLKDIV(adapter->params.vpd.cclk / 80 - 1));
3228 t3_write_reg(adapter, A_T3DBG_GPIO_EN, 3234 t3_write_reg(adapter, A_T3DBG_GPIO_EN,
3229 ai->gpio_out | F_GPIO0_OEN | F_GPIO0_OUT_VAL); 3235 ai->gpio_out | F_GPIO0_OEN | F_GPIO0_OUT_VAL);
3236 t3_write_reg(adapter, A_MC5_DB_SERVER_INDEX, 0);
3230 3237
3231 if (adapter->params.rev == 0 || !uses_xaui(adapter)) 3238 if (adapter->params.rev == 0 || !uses_xaui(adapter))
3232 val |= F_ENRGMII; 3239 val |= F_ENRGMII;
@@ -3243,15 +3250,17 @@ void early_hw_init(struct adapter *adapter, const struct adapter_info *ai)
3243} 3250}
3244 3251
3245/* 3252/*
3246 * Reset the adapter. PCIe cards lose their config space during reset, PCI-X 3253 * Reset the adapter.
3254 * Older PCIe cards lose their config space during reset, PCI-X
3247 * ones don't. 3255 * ones don't.
3248 */ 3256 */
3249int t3_reset_adapter(struct adapter *adapter) 3257int t3_reset_adapter(struct adapter *adapter)
3250{ 3258{
3251 int i; 3259 int i, save_and_restore_pcie =
3260 adapter->params.rev < T3_REV_B2 && is_pcie(adapter);
3252 uint16_t devid = 0; 3261 uint16_t devid = 0;
3253 3262
3254 if (is_pcie(adapter)) 3263 if (save_and_restore_pcie)
3255 pci_save_state(adapter->pdev); 3264 pci_save_state(adapter->pdev);
3256 t3_write_reg(adapter, A_PL_RST, F_CRSTWRM | F_CRSTWRMMODE); 3265 t3_write_reg(adapter, A_PL_RST, F_CRSTWRM | F_CRSTWRMMODE);
3257 3266
@@ -3269,7 +3278,7 @@ int t3_reset_adapter(struct adapter *adapter)
3269 if (devid != 0x1425) 3278 if (devid != 0x1425)
3270 return -1; 3279 return -1;
3271 3280
3272 if (is_pcie(adapter)) 3281 if (save_and_restore_pcie)
3273 pci_restore_state(adapter->pdev); 3282 pci_restore_state(adapter->pdev);
3274 return 0; 3283 return 0;
3275} 3284}
@@ -3323,7 +3332,13 @@ int __devinit t3_prep_adapter(struct adapter *adapter,
3323 p->tx_num_pgs = pm_num_pages(p->chan_tx_size, p->tx_pg_size); 3332 p->tx_num_pgs = pm_num_pages(p->chan_tx_size, p->tx_pg_size);
3324 p->ntimer_qs = p->cm_size >= (128 << 20) || 3333 p->ntimer_qs = p->cm_size >= (128 << 20) ||
3325 adapter->params.rev > 0 ? 12 : 6; 3334 adapter->params.rev > 0 ? 12 : 6;
3335 }
3336
3337 adapter->params.offload = t3_mc7_size(&adapter->pmrx) &&
3338 t3_mc7_size(&adapter->pmtx) &&
3339 t3_mc7_size(&adapter->cm);
3326 3340
3341 if (is_offload(adapter)) {
3327 adapter->params.mc5.nservers = DEFAULT_NSERVERS; 3342 adapter->params.mc5.nservers = DEFAULT_NSERVERS;
3328 adapter->params.mc5.nfilters = adapter->params.rev > 0 ? 3343 adapter->params.mc5.nfilters = adapter->params.rev > 0 ?
3329 DEFAULT_NFILTERS : 0; 3344 DEFAULT_NFILTERS : 0;
diff --git a/drivers/net/cxgb3/version.h b/drivers/net/cxgb3/version.h
index 82278f850259..042e27e291cd 100644
--- a/drivers/net/cxgb3/version.h
+++ b/drivers/net/cxgb3/version.h
@@ -36,6 +36,9 @@
36#define DRV_NAME "cxgb3" 36#define DRV_NAME "cxgb3"
37/* Driver version */ 37/* Driver version */
38#define DRV_VERSION "1.0-ko" 38#define DRV_VERSION "1.0-ko"
39
40/* Firmware version */
39#define FW_VERSION_MAJOR 3 41#define FW_VERSION_MAJOR 3
40#define FW_VERSION_MINOR 2 42#define FW_VERSION_MINOR 3
43#define FW_VERSION_MICRO 0
41#endif /* __CHELSIO_VERSION_H */ 44#endif /* __CHELSIO_VERSION_H */
diff --git a/drivers/net/cxgb3/xgmac.c b/drivers/net/cxgb3/xgmac.c
index 907a272ae32d..94aaff005a35 100644
--- a/drivers/net/cxgb3/xgmac.c
+++ b/drivers/net/cxgb3/xgmac.c
@@ -124,9 +124,6 @@ int t3_mac_reset(struct cmac *mac)
124 xaui_serdes_reset(mac); 124 xaui_serdes_reset(mac);
125 } 125 }
126 126
127 if (adap->params.rev > 0)
128 t3_write_reg(adap, A_XGM_PAUSE_TIMER + oft, 0xf000);
129
130 val = F_MAC_RESET_; 127 val = F_MAC_RESET_;
131 if (is_10G(adap)) 128 if (is_10G(adap))
132 val |= F_PCS_RESET_; 129 val |= F_PCS_RESET_;
@@ -145,6 +142,58 @@ int t3_mac_reset(struct cmac *mac)
145 return 0; 142 return 0;
146} 143}
147 144
145int t3b2_mac_reset(struct cmac *mac)
146{
147 struct adapter *adap = mac->adapter;
148 unsigned int oft = mac->offset;
149 u32 val;
150
151 if (!macidx(mac))
152 t3_set_reg_field(adap, A_MPS_CFG, F_PORT0ACTIVE, 0);
153 else
154 t3_set_reg_field(adap, A_MPS_CFG, F_PORT1ACTIVE, 0);
155
156 t3_write_reg(adap, A_XGM_RESET_CTRL + oft, F_MAC_RESET_);
157 t3_read_reg(adap, A_XGM_RESET_CTRL + oft); /* flush */
158
159 msleep(10);
160
161 /* Check for xgm Rx fifo empty */
162 if (t3_wait_op_done(adap, A_XGM_RX_MAX_PKT_SIZE_ERR_CNT + oft,
163 0x80000000, 1, 5, 2)) {
164 CH_ERR(adap, "MAC %d Rx fifo drain failed\n",
165 macidx(mac));
166 return -1;
167 }
168
169 t3_write_reg(adap, A_XGM_RESET_CTRL + oft, 0);
170 t3_read_reg(adap, A_XGM_RESET_CTRL + oft); /* flush */
171
172 val = F_MAC_RESET_;
173 if (is_10G(adap))
174 val |= F_PCS_RESET_;
175 else if (uses_xaui(adap))
176 val |= F_PCS_RESET_ | F_XG2G_RESET_;
177 else
178 val |= F_RGMII_RESET_ | F_XG2G_RESET_;
179 t3_write_reg(adap, A_XGM_RESET_CTRL + oft, val);
180 t3_read_reg(adap, A_XGM_RESET_CTRL + oft); /* flush */
181 if ((val & F_PCS_RESET_) && adap->params.rev) {
182 msleep(1);
183 t3b_pcs_reset(mac);
184 }
185 t3_write_reg(adap, A_XGM_RX_CFG + oft,
186 F_DISPAUSEFRAMES | F_EN1536BFRAMES |
187 F_RMFCS | F_ENJUMBO | F_ENHASHMCAST);
188
189 if (!macidx(mac))
190 t3_set_reg_field(adap, A_MPS_CFG, 0, F_PORT0ACTIVE);
191 else
192 t3_set_reg_field(adap, A_MPS_CFG, 0, F_PORT1ACTIVE);
193
194 return 0;
195}
196
148/* 197/*
149 * Set the exact match register 'idx' to recognize the given Ethernet address. 198 * Set the exact match register 'idx' to recognize the given Ethernet address.
150 */ 199 */
@@ -251,9 +300,11 @@ int t3_mac_set_mtu(struct cmac *mac, unsigned int mtu)
251 * Adjust the PAUSE frame watermarks. We always set the LWM, and the 300 * Adjust the PAUSE frame watermarks. We always set the LWM, and the
252 * HWM only if flow-control is enabled. 301 * HWM only if flow-control is enabled.
253 */ 302 */
254 hwm = max(MAC_RXFIFO_SIZE - 3 * mtu, MAC_RXFIFO_SIZE / 2U); 303 hwm = max_t(unsigned int, MAC_RXFIFO_SIZE - 3 * mtu,
255 hwm = min(hwm, 3 * MAC_RXFIFO_SIZE / 4 + 1024); 304 MAC_RXFIFO_SIZE * 38 / 100);
256 lwm = hwm - 1024; 305 hwm = min(hwm, MAC_RXFIFO_SIZE - 8192);
306 lwm = min(3 * (int)mtu, MAC_RXFIFO_SIZE / 4);
307
257 v = t3_read_reg(adap, A_XGM_RXFIFO_CFG + mac->offset); 308 v = t3_read_reg(adap, A_XGM_RXFIFO_CFG + mac->offset);
258 v &= ~V_RXFIFOPAUSELWM(M_RXFIFOPAUSELWM); 309 v &= ~V_RXFIFOPAUSELWM(M_RXFIFOPAUSELWM);
259 v |= V_RXFIFOPAUSELWM(lwm / 8); 310 v |= V_RXFIFOPAUSELWM(lwm / 8);
@@ -270,7 +321,15 @@ int t3_mac_set_mtu(struct cmac *mac, unsigned int mtu)
270 thres = mtu > thres ? (mtu - thres + 7) / 8 : 0; 321 thres = mtu > thres ? (mtu - thres + 7) / 8 : 0;
271 thres = max(thres, 8U); /* need at least 8 */ 322 thres = max(thres, 8U); /* need at least 8 */
272 t3_set_reg_field(adap, A_XGM_TXFIFO_CFG + mac->offset, 323 t3_set_reg_field(adap, A_XGM_TXFIFO_CFG + mac->offset,
273 V_TXFIFOTHRESH(M_TXFIFOTHRESH), V_TXFIFOTHRESH(thres)); 324 V_TXFIFOTHRESH(M_TXFIFOTHRESH) | V_TXIPG(M_TXIPG),
325 V_TXFIFOTHRESH(thres) | V_TXIPG(1));
326
327 if (adap->params.rev > 0)
328 t3_write_reg(adap, A_XGM_PAUSE_TIMER + mac->offset,
329 (hwm - lwm) * 4 / 8);
330 t3_write_reg(adap, A_XGM_TX_PAUSE_QUANTA + mac->offset,
331 MAC_RXFIFO_SIZE * 4 * 8 / 512);
332
274 return 0; 333 return 0;
275} 334}
276 335
@@ -298,12 +357,6 @@ int t3_mac_set_speed_duplex_fc(struct cmac *mac, int speed, int duplex, int fc)
298 V_PORTSPEED(M_PORTSPEED), val); 357 V_PORTSPEED(M_PORTSPEED), val);
299 } 358 }
300 359
301 val = t3_read_reg(adap, A_XGM_RXFIFO_CFG + oft);
302 val &= ~V_RXFIFOPAUSEHWM(M_RXFIFOPAUSEHWM);
303 if (fc & PAUSE_TX)
304 val |= V_RXFIFOPAUSEHWM(G_RXFIFOPAUSELWM(val) + 128); /* +1KB */
305 t3_write_reg(adap, A_XGM_RXFIFO_CFG + oft, val);
306
307 t3_set_reg_field(adap, A_XGM_TX_CFG + oft, F_TXPAUSEEN, 360 t3_set_reg_field(adap, A_XGM_TX_CFG + oft, F_TXPAUSEEN,
308 (fc & PAUSE_RX) ? F_TXPAUSEEN : 0); 361 (fc & PAUSE_RX) ? F_TXPAUSEEN : 0);
309 return 0; 362 return 0;
@@ -318,9 +371,17 @@ int t3_mac_enable(struct cmac *mac, int which)
318 if (which & MAC_DIRECTION_TX) { 371 if (which & MAC_DIRECTION_TX) {
319 t3_write_reg(adap, A_XGM_TX_CTRL + oft, F_TXEN); 372 t3_write_reg(adap, A_XGM_TX_CTRL + oft, F_TXEN);
320 t3_write_reg(adap, A_TP_PIO_ADDR, A_TP_TX_DROP_CFG_CH0 + idx); 373 t3_write_reg(adap, A_TP_PIO_ADDR, A_TP_TX_DROP_CFG_CH0 + idx);
321 t3_write_reg(adap, A_TP_PIO_DATA, 0xbf000001); 374 t3_write_reg(adap, A_TP_PIO_DATA, 0xc0ede401);
322 t3_write_reg(adap, A_TP_PIO_ADDR, A_TP_TX_DROP_MODE); 375 t3_write_reg(adap, A_TP_PIO_ADDR, A_TP_TX_DROP_MODE);
323 t3_set_reg_field(adap, A_TP_PIO_DATA, 1 << idx, 1 << idx); 376 t3_set_reg_field(adap, A_TP_PIO_DATA, 1 << idx, 1 << idx);
377
378 t3_write_reg(adap, A_TP_PIO_ADDR, A_TP_TX_DROP_CNT_CH0 + idx);
379 mac->tcnt = (G_TXDROPCNTCH0RCVD(t3_read_reg(adap,
380 A_TP_PIO_DATA)));
381 mac->xcnt = (G_TXSPI4SOPCNT(t3_read_reg(adap,
382 A_XGM_TX_SPI4_SOP_EOP_CNT)));
383 mac->txen = F_TXEN;
384 mac->toggle_cnt = 0;
324 } 385 }
325 if (which & MAC_DIRECTION_RX) 386 if (which & MAC_DIRECTION_RX)
326 t3_write_reg(adap, A_XGM_RX_CTRL + oft, F_RXEN); 387 t3_write_reg(adap, A_XGM_RX_CTRL + oft, F_RXEN);
@@ -337,13 +398,50 @@ int t3_mac_disable(struct cmac *mac, int which)
337 t3_write_reg(adap, A_TP_PIO_ADDR, A_TP_TX_DROP_CFG_CH0 + idx); 398 t3_write_reg(adap, A_TP_PIO_ADDR, A_TP_TX_DROP_CFG_CH0 + idx);
338 t3_write_reg(adap, A_TP_PIO_DATA, 0xc000001f); 399 t3_write_reg(adap, A_TP_PIO_DATA, 0xc000001f);
339 t3_write_reg(adap, A_TP_PIO_ADDR, A_TP_TX_DROP_MODE); 400 t3_write_reg(adap, A_TP_PIO_ADDR, A_TP_TX_DROP_MODE);
340 t3_set_reg_field(adap, A_TP_PIO_DATA, 1 << idx, 0); 401 t3_set_reg_field(adap, A_TP_PIO_DATA, 1 << idx, 1 << idx);
402 mac->txen = 0;
341 } 403 }
342 if (which & MAC_DIRECTION_RX) 404 if (which & MAC_DIRECTION_RX)
343 t3_write_reg(adap, A_XGM_RX_CTRL + mac->offset, 0); 405 t3_write_reg(adap, A_XGM_RX_CTRL + mac->offset, 0);
344 return 0; 406 return 0;
345} 407}
346 408
409int t3b2_mac_watchdog_task(struct cmac *mac)
410{
411 struct adapter *adap = mac->adapter;
412 unsigned int tcnt, xcnt;
413 int status;
414
415 t3_write_reg(adap, A_TP_PIO_ADDR, A_TP_TX_DROP_CNT_CH0 + macidx(mac));
416 tcnt = (G_TXDROPCNTCH0RCVD(t3_read_reg(adap, A_TP_PIO_DATA)));
417 xcnt = (G_TXSPI4SOPCNT(t3_read_reg(adap,
418 A_XGM_TX_SPI4_SOP_EOP_CNT +
419 mac->offset)));
420
421 if (tcnt != mac->tcnt && xcnt == 0 && mac->xcnt == 0) {
422 if (mac->toggle_cnt > 4) {
423 t3b2_mac_reset(mac);
424 mac->toggle_cnt = 0;
425 status = 2;
426 } else {
427 t3_write_reg(adap, A_XGM_TX_CTRL + mac->offset, 0);
428 t3_read_reg(adap, A_XGM_TX_CTRL + mac->offset);
429 t3_write_reg(adap, A_XGM_TX_CTRL + mac->offset,
430 mac->txen);
431 t3_read_reg(adap, A_XGM_TX_CTRL + mac->offset);
432 mac->toggle_cnt++;
433 status = 1;
434 }
435 } else {
436 mac->toggle_cnt = 0;
437 status = 0;
438 }
439 mac->tcnt = tcnt;
440 mac->xcnt = xcnt;
441
442 return status;
443}
444
347/* 445/*
348 * This function is called periodically to accumulate the current values of the 446 * This function is called periodically to accumulate the current values of the
349 * RMON counters into the port statistics. Since the packet counters are only 447 * RMON counters into the port statistics. Since the packet counters are only
@@ -373,7 +471,11 @@ const struct mac_stats *t3_mac_update_stats(struct cmac *mac)
373 RMON_UPDATE(mac, rx_symbol_errs, RX_SYM_CODE_ERR_FRAMES); 471 RMON_UPDATE(mac, rx_symbol_errs, RX_SYM_CODE_ERR_FRAMES);
374 472
375 RMON_UPDATE(mac, rx_too_long, RX_OVERSIZE_FRAMES); 473 RMON_UPDATE(mac, rx_too_long, RX_OVERSIZE_FRAMES);
376 mac->stats.rx_too_long += RMON_READ(mac, A_XGM_RX_MAX_PKT_SIZE_ERR_CNT); 474
475 v = RMON_READ(mac, A_XGM_RX_MAX_PKT_SIZE_ERR_CNT);
476 if (mac->adapter->params.rev == T3_REV_B2)
477 v &= 0x7fffffff;
478 mac->stats.rx_too_long += v;
377 479
378 RMON_UPDATE(mac, rx_frames_64, RX_64B_FRAMES); 480 RMON_UPDATE(mac, rx_frames_64, RX_64B_FRAMES);
379 RMON_UPDATE(mac, rx_frames_65_127, RX_65_127B_FRAMES); 481 RMON_UPDATE(mac, rx_frames_65_127, RX_65_127B_FRAMES);
diff --git a/drivers/net/ewrk3.c b/drivers/net/ewrk3.c
index c8c41f0a47d6..714ea1176ec7 100644
--- a/drivers/net/ewrk3.c
+++ b/drivers/net/ewrk3.c
@@ -414,10 +414,9 @@ ewrk3_hw_init(struct net_device *dev, u_long iobase)
414 icr &= 0x70; 414 icr &= 0x70;
415 outb(icr, EWRK3_ICR); /* Disable all the IRQs */ 415 outb(icr, EWRK3_ICR); /* Disable all the IRQs */
416 416
417 if (nicsr == (CSR_TXD | CSR_RXD)) 417 if (nicsr != (CSR_TXD | CSR_RXD))
418 return -ENXIO; 418 return -ENXIO;
419 419
420
421 /* Check that the EEPROM is alive and well and not living on Pluto... */ 420 /* Check that the EEPROM is alive and well and not living on Pluto... */
422 for (chksum = 0, i = 0; i < EEPROM_MAX; i += 2) { 421 for (chksum = 0, i = 0; i < EEPROM_MAX; i += 2) {
423 union { 422 union {
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c
index 46e1697d9cfd..d04214e4e581 100644
--- a/drivers/net/forcedeth.c
+++ b/drivers/net/forcedeth.c
@@ -2050,9 +2050,10 @@ static void nv_tx_timeout(struct net_device *dev)
2050 nv_drain_tx(dev); 2050 nv_drain_tx(dev);
2051 nv_init_tx(dev); 2051 nv_init_tx(dev);
2052 setup_hw_rings(dev, NV_SETUP_TX_RING); 2052 setup_hw_rings(dev, NV_SETUP_TX_RING);
2053 netif_wake_queue(dev);
2054 } 2053 }
2055 2054
2055 netif_wake_queue(dev);
2056
2056 /* 4) restart tx engine */ 2057 /* 4) restart tx engine */
2057 nv_start_tx(dev); 2058 nv_start_tx(dev);
2058 spin_unlock_irq(&np->lock); 2059 spin_unlock_irq(&np->lock);
@@ -3536,7 +3537,10 @@ static void nv_do_nic_poll(unsigned long data)
3536 pci_push(base); 3537 pci_push(base);
3537 3538
3538 if (!using_multi_irqs(dev)) { 3539 if (!using_multi_irqs(dev)) {
3539 nv_nic_irq(0, dev); 3540 if (np->desc_ver == DESC_VER_3)
3541 nv_nic_irq_optimized(0, dev);
3542 else
3543 nv_nic_irq(0, dev);
3540 if (np->msi_flags & NV_MSI_X_ENABLED) 3544 if (np->msi_flags & NV_MSI_X_ENABLED)
3541 enable_irq_lockdep(np->msi_x_entry[NV_MSI_X_VECTOR_ALL].vector); 3545 enable_irq_lockdep(np->msi_x_entry[NV_MSI_X_VECTOR_ALL].vector);
3542 else 3546 else
diff --git a/drivers/net/ifb.c b/drivers/net/ifb.c
index ca2b21f9d444..07b4c0d7a75c 100644
--- a/drivers/net/ifb.c
+++ b/drivers/net/ifb.c
@@ -96,17 +96,24 @@ static void ri_tasklet(unsigned long dev)
96 skb->tc_verd = SET_TC_NCLS(skb->tc_verd); 96 skb->tc_verd = SET_TC_NCLS(skb->tc_verd);
97 stats->tx_packets++; 97 stats->tx_packets++;
98 stats->tx_bytes +=skb->len; 98 stats->tx_bytes +=skb->len;
99
100 skb->dev = __dev_get_by_index(skb->iif);
101 if (!skb->dev) {
102 dev_kfree_skb(skb);
103 stats->tx_dropped++;
104 break;
105 }
106 skb->iif = _dev->ifindex;
107
99 if (from & AT_EGRESS) { 108 if (from & AT_EGRESS) {
100 dp->st_rx_frm_egr++; 109 dp->st_rx_frm_egr++;
101 dev_queue_xmit(skb); 110 dev_queue_xmit(skb);
102 } else if (from & AT_INGRESS) { 111 } else if (from & AT_INGRESS) {
103
104 dp->st_rx_frm_ing++; 112 dp->st_rx_frm_ing++;
113 skb_pull(skb, skb->dev->hard_header_len);
105 netif_rx(skb); 114 netif_rx(skb);
106 } else { 115 } else
107 dev_kfree_skb(skb); 116 BUG();
108 stats->tx_dropped++;
109 }
110 } 117 }
111 118
112 if (netif_tx_trylock(_dev)) { 119 if (netif_tx_trylock(_dev)) {
@@ -157,26 +164,10 @@ static int ifb_xmit(struct sk_buff *skb, struct net_device *dev)
157 stats->rx_packets++; 164 stats->rx_packets++;
158 stats->rx_bytes+=skb->len; 165 stats->rx_bytes+=skb->len;
159 166
160 if (!from || !skb->input_dev) { 167 if (!(from & (AT_INGRESS|AT_EGRESS)) || !skb->iif) {
161dropped:
162 dev_kfree_skb(skb); 168 dev_kfree_skb(skb);
163 stats->rx_dropped++; 169 stats->rx_dropped++;
164 return ret; 170 return ret;
165 } else {
166 /*
167 * note we could be going
168 * ingress -> egress or
169 * egress -> ingress
170 */
171 skb->dev = skb->input_dev;
172 skb->input_dev = dev;
173 if (from & AT_INGRESS) {
174 skb_pull(skb, skb->dev->hard_header_len);
175 } else {
176 if (!(from & AT_EGRESS)) {
177 goto dropped;
178 }
179 }
180 } 171 }
181 172
182 if (skb_queue_len(&dp->rq) >= dev->tx_queue_len) { 173 if (skb_queue_len(&dp->rq) >= dev->tx_queue_len) {
diff --git a/drivers/net/irda/irda-usb.c b/drivers/net/irda/irda-usb.c
index 340ee99652eb..1d510bdc9b84 100644
--- a/drivers/net/irda/irda-usb.c
+++ b/drivers/net/irda/irda-usb.c
@@ -1057,6 +1057,8 @@ static int stir421x_fw_upload(struct irda_usb_cb *self,
1057 1057
1058 if (ret < 0) 1058 if (ret < 0)
1059 break; 1059 break;
1060
1061 mdelay(10);
1060 } 1062 }
1061 1063
1062 kfree(patch_block); 1064 kfree(patch_block);
diff --git a/drivers/net/irda/pxaficp_ir.c b/drivers/net/irda/pxaficp_ir.c
index 9137e239fac2..2272156af31e 100644
--- a/drivers/net/irda/pxaficp_ir.c
+++ b/drivers/net/irda/pxaficp_ir.c
@@ -321,15 +321,22 @@ static void pxa_irda_fir_dma_tx_irq(int channel, void *data)
321 pxa_irda_set_speed(si, si->newspeed); 321 pxa_irda_set_speed(si, si->newspeed);
322 si->newspeed = 0; 322 si->newspeed = 0;
323 } else { 323 } else {
324 int i = 64;
325
324 ICCR0 = 0; 326 ICCR0 = 0;
325 pxa_irda_fir_dma_rx_start(si); 327 pxa_irda_fir_dma_rx_start(si);
328 while ((ICSR1 & ICSR1_RNE) && i--)
329 (void)ICDR;
326 ICCR0 = ICCR0_ITR | ICCR0_RXE; 330 ICCR0 = ICCR0_ITR | ICCR0_RXE;
331
332 if (i < 0)
333 printk(KERN_ERR "pxa_ir: cannot clear Rx FIFO!\n");
327 } 334 }
328 netif_wake_queue(dev); 335 netif_wake_queue(dev);
329} 336}
330 337
331/* EIF(Error in FIFO/End in Frame) handler for FIR */ 338/* EIF(Error in FIFO/End in Frame) handler for FIR */
332static void pxa_irda_fir_irq_eif(struct pxa_irda *si, struct net_device *dev) 339static void pxa_irda_fir_irq_eif(struct pxa_irda *si, struct net_device *dev, int icsr0)
333{ 340{
334 unsigned int len, stat, data; 341 unsigned int len, stat, data;
335 342
@@ -350,7 +357,7 @@ static void pxa_irda_fir_irq_eif(struct pxa_irda *si, struct net_device *dev)
350 } 357 }
351 if (stat & ICSR1_ROR) { 358 if (stat & ICSR1_ROR) {
352 printk(KERN_DEBUG "pxa_ir: fir receive overrun\n"); 359 printk(KERN_DEBUG "pxa_ir: fir receive overrun\n");
353 si->stats.rx_frame_errors++; 360 si->stats.rx_over_errors++;
354 } 361 }
355 } else { 362 } else {
356 si->dma_rx_buff[len++] = data; 363 si->dma_rx_buff[len++] = data;
@@ -362,7 +369,15 @@ static void pxa_irda_fir_irq_eif(struct pxa_irda *si, struct net_device *dev)
362 369
363 if (stat & ICSR1_EOF) { 370 if (stat & ICSR1_EOF) {
364 /* end of frame. */ 371 /* end of frame. */
365 struct sk_buff *skb = alloc_skb(len+1,GFP_ATOMIC); 372 struct sk_buff *skb;
373
374 if (icsr0 & ICSR0_FRE) {
375 printk(KERN_ERR "pxa_ir: dropping erroneous frame\n");
376 si->stats.rx_dropped++;
377 return;
378 }
379
380 skb = alloc_skb(len+1,GFP_ATOMIC);
366 if (!skb) { 381 if (!skb) {
367 printk(KERN_ERR "pxa_ir: fir out of memory for receive skb\n"); 382 printk(KERN_ERR "pxa_ir: fir out of memory for receive skb\n");
368 si->stats.rx_dropped++; 383 si->stats.rx_dropped++;
@@ -392,7 +407,7 @@ static irqreturn_t pxa_irda_fir_irq(int irq, void *dev_id)
392{ 407{
393 struct net_device *dev = dev_id; 408 struct net_device *dev = dev_id;
394 struct pxa_irda *si = netdev_priv(dev); 409 struct pxa_irda *si = netdev_priv(dev);
395 int icsr0; 410 int icsr0, i = 64;
396 411
397 /* stop RX DMA */ 412 /* stop RX DMA */
398 DCSR(si->rxdma) &= ~DCSR_RUN; 413 DCSR(si->rxdma) &= ~DCSR_RUN;
@@ -412,13 +427,18 @@ static irqreturn_t pxa_irda_fir_irq(int irq, void *dev_id)
412 427
413 if (icsr0 & ICSR0_EIF) { 428 if (icsr0 & ICSR0_EIF) {
414 /* An error in FIFO occured, or there is a end of frame */ 429 /* An error in FIFO occured, or there is a end of frame */
415 pxa_irda_fir_irq_eif(si, dev); 430 pxa_irda_fir_irq_eif(si, dev, icsr0);
416 } 431 }
417 432
418 ICCR0 = 0; 433 ICCR0 = 0;
419 pxa_irda_fir_dma_rx_start(si); 434 pxa_irda_fir_dma_rx_start(si);
435 while ((ICSR1 & ICSR1_RNE) && i--)
436 (void)ICDR;
420 ICCR0 = ICCR0_ITR | ICCR0_RXE; 437 ICCR0 = ICCR0_ITR | ICCR0_RXE;
421 438
439 if (i < 0)
440 printk(KERN_ERR "pxa_ir: cannot clear Rx FIFO!\n");
441
422 return IRQ_HANDLED; 442 return IRQ_HANDLED;
423} 443}
424 444
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c
index 1ee27c360a4b..8015a7c5b0c9 100644
--- a/drivers/net/mv643xx_eth.c
+++ b/drivers/net/mv643xx_eth.c
@@ -1379,7 +1379,7 @@ static int mv643xx_eth_probe(struct platform_device *pdev)
1379 1379
1380 spin_lock_init(&mp->lock); 1380 spin_lock_init(&mp->lock);
1381 1381
1382 port_num = pd->port_number; 1382 port_num = mp->port_num = pd->port_number;
1383 1383
1384 /* set default config values */ 1384 /* set default config values */
1385 eth_port_uc_addr_get(dev, dev->dev_addr); 1385 eth_port_uc_addr_get(dev, dev->dev_addr);
@@ -1411,8 +1411,6 @@ static int mv643xx_eth_probe(struct platform_device *pdev)
1411 duplex = pd->duplex; 1411 duplex = pd->duplex;
1412 speed = pd->speed; 1412 speed = pd->speed;
1413 1413
1414 mp->port_num = port_num;
1415
1416 /* Hook up MII support for ethtool */ 1414 /* Hook up MII support for ethtool */
1417 mp->mii.dev = dev; 1415 mp->mii.dev = dev;
1418 mp->mii.mdio_read = mv643xx_mdio_read; 1416 mp->mii.mdio_read = mv643xx_mdio_read;
@@ -1516,9 +1514,23 @@ static int mv643xx_eth_shared_remove(struct platform_device *pdev)
1516 return 0; 1514 return 0;
1517} 1515}
1518 1516
1517static void mv643xx_eth_shutdown(struct platform_device *pdev)
1518{
1519 struct net_device *dev = platform_get_drvdata(pdev);
1520 struct mv643xx_private *mp = netdev_priv(dev);
1521 unsigned int port_num = mp->port_num;
1522
1523 /* Mask all interrupts on ethernet port */
1524 mv_write(MV643XX_ETH_INTERRUPT_MASK_REG(port_num), 0);
1525 mv_read (MV643XX_ETH_INTERRUPT_MASK_REG(port_num));
1526
1527 eth_port_reset(port_num);
1528}
1529
1519static struct platform_driver mv643xx_eth_driver = { 1530static struct platform_driver mv643xx_eth_driver = {
1520 .probe = mv643xx_eth_probe, 1531 .probe = mv643xx_eth_probe,
1521 .remove = mv643xx_eth_remove, 1532 .remove = mv643xx_eth_remove,
1533 .shutdown = mv643xx_eth_shutdown,
1522 .driver = { 1534 .driver = {
1523 .name = MV643XX_ETH_NAME, 1535 .name = MV643XX_ETH_NAME,
1524 }, 1536 },
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c
index ac02b3b60f92..c216e6a5d235 100644
--- a/drivers/net/myri10ge/myri10ge.c
+++ b/drivers/net/myri10ge/myri10ge.c
@@ -71,7 +71,7 @@
71#include "myri10ge_mcp.h" 71#include "myri10ge_mcp.h"
72#include "myri10ge_mcp_gen_header.h" 72#include "myri10ge_mcp_gen_header.h"
73 73
74#define MYRI10GE_VERSION_STR "1.2.0" 74#define MYRI10GE_VERSION_STR "1.3.0-1.227"
75 75
76MODULE_DESCRIPTION("Myricom 10G driver (10GbE)"); 76MODULE_DESCRIPTION("Myricom 10G driver (10GbE)");
77MODULE_AUTHOR("Maintainer: help@myri.com"); 77MODULE_AUTHOR("Maintainer: help@myri.com");
@@ -234,7 +234,7 @@ static int myri10ge_msi = 1; /* enable msi by default */
234module_param(myri10ge_msi, int, S_IRUGO | S_IWUSR); 234module_param(myri10ge_msi, int, S_IRUGO | S_IWUSR);
235MODULE_PARM_DESC(myri10ge_msi, "Enable Message Signalled Interrupts\n"); 235MODULE_PARM_DESC(myri10ge_msi, "Enable Message Signalled Interrupts\n");
236 236
237static int myri10ge_intr_coal_delay = 25; 237static int myri10ge_intr_coal_delay = 75;
238module_param(myri10ge_intr_coal_delay, int, S_IRUGO); 238module_param(myri10ge_intr_coal_delay, int, S_IRUGO);
239MODULE_PARM_DESC(myri10ge_intr_coal_delay, "Interrupt coalescing delay\n"); 239MODULE_PARM_DESC(myri10ge_intr_coal_delay, "Interrupt coalescing delay\n");
240 240
@@ -279,7 +279,7 @@ static int myri10ge_fill_thresh = 256;
279module_param(myri10ge_fill_thresh, int, S_IRUGO | S_IWUSR); 279module_param(myri10ge_fill_thresh, int, S_IRUGO | S_IWUSR);
280MODULE_PARM_DESC(myri10ge_fill_thresh, "Number of empty rx slots allowed\n"); 280MODULE_PARM_DESC(myri10ge_fill_thresh, "Number of empty rx slots allowed\n");
281 281
282static int myri10ge_wcfifo = 1; 282static int myri10ge_wcfifo = 0;
283module_param(myri10ge_wcfifo, int, S_IRUGO); 283module_param(myri10ge_wcfifo, int, S_IRUGO);
284MODULE_PARM_DESC(myri10ge_wcfifo, "Enable WC Fifo when WC is enabled\n"); 284MODULE_PARM_DESC(myri10ge_wcfifo, "Enable WC Fifo when WC is enabled\n");
285 285
@@ -905,6 +905,14 @@ myri10ge_alloc_rx_pages(struct myri10ge_priv *mgp, struct myri10ge_rx_buf *rx,
905 (rx->page_offset + bytes <= MYRI10GE_ALLOC_SIZE)) { 905 (rx->page_offset + bytes <= MYRI10GE_ALLOC_SIZE)) {
906 /* we can use part of previous page */ 906 /* we can use part of previous page */
907 get_page(rx->page); 907 get_page(rx->page);
908#if MYRI10GE_ALLOC_SIZE > 4096
909 /* Firmware cannot cross 4K boundary.. */
910 if ((rx->page_offset >> 12) !=
911 ((rx->page_offset + bytes - 1) >> 12)) {
912 rx->page_offset =
913 (rx->page_offset + bytes) & ~4095;
914 }
915#endif
908 } else { 916 } else {
909 /* we need a new page */ 917 /* we need a new page */
910 page = 918 page =
@@ -2007,10 +2015,9 @@ again:
2007 mss = 0; 2015 mss = 0;
2008 max_segments = MXGEFW_MAX_SEND_DESC; 2016 max_segments = MXGEFW_MAX_SEND_DESC;
2009 2017
2010 if (skb->len > (dev->mtu + ETH_HLEN)) { 2018 if (skb_is_gso(skb)) {
2011 mss = skb_shinfo(skb)->gso_size; 2019 mss = skb_shinfo(skb)->gso_size;
2012 if (mss != 0) 2020 max_segments = MYRI10GE_MAX_SEND_DESC_TSO;
2013 max_segments = MYRI10GE_MAX_SEND_DESC_TSO;
2014 } 2021 }
2015 2022
2016 if ((unlikely(avail < max_segments))) { 2023 if ((unlikely(avail < max_segments))) {
@@ -2483,6 +2490,8 @@ static void myri10ge_enable_ecrc(struct myri10ge_priv *mgp)
2483 2490
2484#define PCI_DEVICE_ID_INTEL_E5000_PCIE23 0x25f7 2491#define PCI_DEVICE_ID_INTEL_E5000_PCIE23 0x25f7
2485#define PCI_DEVICE_ID_INTEL_E5000_PCIE47 0x25fa 2492#define PCI_DEVICE_ID_INTEL_E5000_PCIE47 0x25fa
2493#define PCI_DEVICE_ID_SERVERWORKS_HT2100_PCIE_FIRST 0x140
2494#define PCI_DEVICE_ID_SERVERWORKS_HT2100_PCIE_LAST 0x142
2486 2495
2487static void myri10ge_select_firmware(struct myri10ge_priv *mgp) 2496static void myri10ge_select_firmware(struct myri10ge_priv *mgp)
2488{ 2497{
@@ -2514,6 +2523,12 @@ static void myri10ge_select_firmware(struct myri10ge_priv *mgp)
2514 ((bridge->vendor == PCI_VENDOR_ID_SERVERWORKS 2523 ((bridge->vendor == PCI_VENDOR_ID_SERVERWORKS
2515 && bridge->device == 2524 && bridge->device ==
2516 PCI_DEVICE_ID_SERVERWORKS_HT2000_PCIE) 2525 PCI_DEVICE_ID_SERVERWORKS_HT2000_PCIE)
2526 /* ServerWorks HT2100 */
2527 || (bridge->vendor == PCI_VENDOR_ID_SERVERWORKS
2528 && bridge->device >=
2529 PCI_DEVICE_ID_SERVERWORKS_HT2100_PCIE_FIRST
2530 && bridge->device <=
2531 PCI_DEVICE_ID_SERVERWORKS_HT2100_PCIE_LAST)
2517 /* All Intel E5000 PCIE ports */ 2532 /* All Intel E5000 PCIE ports */
2518 || (bridge->vendor == PCI_VENDOR_ID_INTEL 2533 || (bridge->vendor == PCI_VENDOR_ID_INTEL
2519 && bridge->device >= 2534 && bridge->device >=
diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c
index 229aa1c4fb79..eff965dc5fff 100644
--- a/drivers/net/netxen/netxen_nic_init.c
+++ b/drivers/net/netxen/netxen_nic_init.c
@@ -438,6 +438,7 @@ do_rom_fast_read_words(struct netxen_adapter *adapter, int addr,
438 438
439 for (addridx = addr; addridx < (addr + size); addridx += 4) { 439 for (addridx = addr; addridx < (addr + size); addridx += 4) {
440 ret = do_rom_fast_read(adapter, addridx, (int *)bytes); 440 ret = do_rom_fast_read(adapter, addridx, (int *)bytes);
441 *(int *)bytes = cpu_to_le32(*(int *)bytes);
441 if (ret != 0) 442 if (ret != 0)
442 break; 443 break;
443 bytes += 4; 444 bytes += 4;
@@ -497,7 +498,7 @@ static inline int do_rom_fast_write_words(struct netxen_adapter *adapter,
497 int timeout = 0; 498 int timeout = 0;
498 int data; 499 int data;
499 500
500 data = *(u32*)bytes; 501 data = le32_to_cpu((*(u32*)bytes));
501 502
502 ret = do_rom_fast_write(adapter, addridx, data); 503 ret = do_rom_fast_write(adapter, addridx, data);
503 if (ret < 0) 504 if (ret < 0)
diff --git a/drivers/net/pci-skeleton.c b/drivers/net/pci-skeleton.c
index 00ca0fdb837b..6ca4e4fa6b88 100644
--- a/drivers/net/pci-skeleton.c
+++ b/drivers/net/pci-skeleton.c
@@ -710,8 +710,8 @@ match:
710 tp->chipset, 710 tp->chipset,
711 rtl_chip_info[tp->chipset].name); 711 rtl_chip_info[tp->chipset].name);
712 712
713 i = register_netdev (dev); 713 rc = register_netdev (dev);
714 if (i) 714 if (rc)
715 goto err_out_unmap; 715 goto err_out_unmap;
716 716
717 DPRINTK ("EXIT, returning 0\n"); 717 DPRINTK ("EXIT, returning 0\n");
diff --git a/drivers/net/ppp_generic.c b/drivers/net/ppp_generic.c
index 11b575f89856..ef58e4128782 100644
--- a/drivers/net/ppp_generic.c
+++ b/drivers/net/ppp_generic.c
@@ -2544,6 +2544,9 @@ static void ppp_destroy_interface(struct ppp *ppp)
2544 ppp->active_filter = NULL; 2544 ppp->active_filter = NULL;
2545#endif /* CONFIG_PPP_FILTER */ 2545#endif /* CONFIG_PPP_FILTER */
2546 2546
2547 if (ppp->xmit_pending)
2548 kfree_skb(ppp->xmit_pending);
2549
2547 kfree(ppp); 2550 kfree(ppp);
2548} 2551}
2549 2552
diff --git a/drivers/net/qla3xxx.c b/drivers/net/qla3xxx.c
index d3f65dab306c..a8246eb2f8d9 100755
--- a/drivers/net/qla3xxx.c
+++ b/drivers/net/qla3xxx.c
@@ -1691,6 +1691,27 @@ static int ql_populate_free_queue(struct ql3_adapter *qdev)
1691/* 1691/*
1692 * Caller holds hw_lock. 1692 * Caller holds hw_lock.
1693 */ 1693 */
1694static void ql_update_small_bufq_prod_index(struct ql3_adapter *qdev)
1695{
1696 struct ql3xxx_port_registers __iomem *port_regs = qdev->mem_map_registers;
1697 if (qdev->small_buf_release_cnt >= 16) {
1698 while (qdev->small_buf_release_cnt >= 16) {
1699 qdev->small_buf_q_producer_index++;
1700
1701 if (qdev->small_buf_q_producer_index ==
1702 NUM_SBUFQ_ENTRIES)
1703 qdev->small_buf_q_producer_index = 0;
1704 qdev->small_buf_release_cnt -= 8;
1705 }
1706 wmb();
1707 writel(qdev->small_buf_q_producer_index,
1708 &port_regs->CommonRegs.rxSmallQProducerIndex);
1709 }
1710}
1711
1712/*
1713 * Caller holds hw_lock.
1714 */
1694static void ql_update_lrg_bufq_prod_index(struct ql3_adapter *qdev) 1715static void ql_update_lrg_bufq_prod_index(struct ql3_adapter *qdev)
1695{ 1716{
1696 struct bufq_addr_element *lrg_buf_q_ele; 1717 struct bufq_addr_element *lrg_buf_q_ele;
@@ -1732,13 +1753,10 @@ static void ql_update_lrg_bufq_prod_index(struct ql3_adapter *qdev)
1732 lrg_buf_q_ele = qdev->lrg_buf_q_virt_addr; 1753 lrg_buf_q_ele = qdev->lrg_buf_q_virt_addr;
1733 } 1754 }
1734 } 1755 }
1735 1756 wmb();
1736 qdev->lrg_buf_next_free = lrg_buf_q_ele; 1757 qdev->lrg_buf_next_free = lrg_buf_q_ele;
1737 1758 writel(qdev->lrg_buf_q_producer_index,
1738 ql_write_common_reg(qdev, 1759 &port_regs->CommonRegs.rxLargeQProducerIndex);
1739 &port_regs->CommonRegs.
1740 rxLargeQProducerIndex,
1741 qdev->lrg_buf_q_producer_index);
1742 } 1760 }
1743} 1761}
1744 1762
@@ -1915,17 +1933,18 @@ static void ql_process_macip_rx_intr(struct ql3_adapter *qdev,
1915 u16 checksum = le16_to_cpu(ib_ip_rsp_ptr->checksum); 1933 u16 checksum = le16_to_cpu(ib_ip_rsp_ptr->checksum);
1916 if (checksum & 1934 if (checksum &
1917 (IB_IP_IOCB_RSP_3032_ICE | 1935 (IB_IP_IOCB_RSP_3032_ICE |
1918 IB_IP_IOCB_RSP_3032_CE | 1936 IB_IP_IOCB_RSP_3032_CE)) {
1919 IB_IP_IOCB_RSP_3032_NUC)) {
1920 printk(KERN_ERR 1937 printk(KERN_ERR
1921 "%s: Bad checksum for this %s packet, checksum = %x.\n", 1938 "%s: Bad checksum for this %s packet, checksum = %x.\n",
1922 __func__, 1939 __func__,
1923 ((checksum & 1940 ((checksum &
1924 IB_IP_IOCB_RSP_3032_TCP) ? "TCP" : 1941 IB_IP_IOCB_RSP_3032_TCP) ? "TCP" :
1925 "UDP"),checksum); 1942 "UDP"),checksum);
1926 } else if (checksum & IB_IP_IOCB_RSP_3032_TCP) { 1943 } else if ((checksum & IB_IP_IOCB_RSP_3032_TCP) ||
1944 (checksum & IB_IP_IOCB_RSP_3032_UDP &&
1945 !(checksum & IB_IP_IOCB_RSP_3032_NUC))) {
1927 skb2->ip_summed = CHECKSUM_UNNECESSARY; 1946 skb2->ip_summed = CHECKSUM_UNNECESSARY;
1928 } 1947 }
1929 } 1948 }
1930 skb2->dev = qdev->ndev; 1949 skb2->dev = qdev->ndev;
1931 skb2->protocol = eth_type_trans(skb2, qdev->ndev); 1950 skb2->protocol = eth_type_trans(skb2, qdev->ndev);
@@ -1944,16 +1963,12 @@ static void ql_process_macip_rx_intr(struct ql3_adapter *qdev,
1944static int ql_tx_rx_clean(struct ql3_adapter *qdev, 1963static int ql_tx_rx_clean(struct ql3_adapter *qdev,
1945 int *tx_cleaned, int *rx_cleaned, int work_to_do) 1964 int *tx_cleaned, int *rx_cleaned, int work_to_do)
1946{ 1965{
1947 struct ql3xxx_port_registers __iomem *port_regs = qdev->mem_map_registers;
1948 struct net_rsp_iocb *net_rsp; 1966 struct net_rsp_iocb *net_rsp;
1949 struct net_device *ndev = qdev->ndev; 1967 struct net_device *ndev = qdev->ndev;
1950 unsigned long hw_flags;
1951 int work_done = 0; 1968 int work_done = 0;
1952 1969
1953 u32 rsp_producer_index = le32_to_cpu(*(qdev->prsp_producer_index));
1954
1955 /* While there are entries in the completion queue. */ 1970 /* While there are entries in the completion queue. */
1956 while ((rsp_producer_index != 1971 while ((le32_to_cpu(*(qdev->prsp_producer_index)) !=
1957 qdev->rsp_consumer_index) && (work_done < work_to_do)) { 1972 qdev->rsp_consumer_index) && (work_done < work_to_do)) {
1958 1973
1959 net_rsp = qdev->rsp_current; 1974 net_rsp = qdev->rsp_current;
@@ -2009,33 +2024,7 @@ static int ql_tx_rx_clean(struct ql3_adapter *qdev,
2009 work_done = *tx_cleaned + *rx_cleaned; 2024 work_done = *tx_cleaned + *rx_cleaned;
2010 } 2025 }
2011 2026
2012 if(work_done) { 2027 return work_done;
2013 spin_lock_irqsave(&qdev->hw_lock, hw_flags);
2014
2015 ql_update_lrg_bufq_prod_index(qdev);
2016
2017 if (qdev->small_buf_release_cnt >= 16) {
2018 while (qdev->small_buf_release_cnt >= 16) {
2019 qdev->small_buf_q_producer_index++;
2020
2021 if (qdev->small_buf_q_producer_index ==
2022 NUM_SBUFQ_ENTRIES)
2023 qdev->small_buf_q_producer_index = 0;
2024 qdev->small_buf_release_cnt -= 8;
2025 }
2026
2027 wmb();
2028 ql_write_common_reg(qdev,
2029 &port_regs->CommonRegs.
2030 rxSmallQProducerIndex,
2031 qdev->small_buf_q_producer_index);
2032
2033 }
2034
2035 spin_unlock_irqrestore(&qdev->hw_lock, hw_flags);
2036 }
2037
2038 return *tx_cleaned + *rx_cleaned;
2039} 2028}
2040 2029
2041static int ql_poll(struct net_device *ndev, int *budget) 2030static int ql_poll(struct net_device *ndev, int *budget)
@@ -2059,9 +2048,10 @@ quit_polling:
2059 netif_rx_complete(ndev); 2048 netif_rx_complete(ndev);
2060 2049
2061 spin_lock_irqsave(&qdev->hw_lock, hw_flags); 2050 spin_lock_irqsave(&qdev->hw_lock, hw_flags);
2062 ql_write_common_reg(qdev, 2051 ql_update_small_bufq_prod_index(qdev);
2063 &port_regs->CommonRegs.rspQConsumerIndex, 2052 ql_update_lrg_bufq_prod_index(qdev);
2064 qdev->rsp_consumer_index); 2053 writel(qdev->rsp_consumer_index,
2054 &port_regs->CommonRegs.rspQConsumerIndex);
2065 spin_unlock_irqrestore(&qdev->hw_lock, hw_flags); 2055 spin_unlock_irqrestore(&qdev->hw_lock, hw_flags);
2066 2056
2067 ql_enable_interrupts(qdev); 2057 ql_enable_interrupts(qdev);
@@ -2217,12 +2207,7 @@ static int ql_send_map(struct ql3_adapter *qdev,
2217 int seg_cnt, seg = 0; 2207 int seg_cnt, seg = 0;
2218 int frag_cnt = (int)skb_shinfo(skb)->nr_frags; 2208 int frag_cnt = (int)skb_shinfo(skb)->nr_frags;
2219 2209
2220 seg_cnt = tx_cb->seg_count = ql_get_seg_count(qdev, 2210 seg_cnt = tx_cb->seg_count;
2221 (skb_shinfo(skb)->nr_frags));
2222 if(seg_cnt == -1) {
2223 printk(KERN_ERR PFX"%s: invalid segment count!\n",__func__);
2224 return NETDEV_TX_BUSY;
2225 }
2226 /* 2211 /*
2227 * Map the skb buffer first. 2212 * Map the skb buffer first.
2228 */ 2213 */
@@ -2278,7 +2263,7 @@ static int ql_send_map(struct ql3_adapter *qdev,
2278 pci_unmap_addr_set(&tx_cb->map[seg], mapaddr, 2263 pci_unmap_addr_set(&tx_cb->map[seg], mapaddr,
2279 map); 2264 map);
2280 pci_unmap_len_set(&tx_cb->map[seg], maplen, 2265 pci_unmap_len_set(&tx_cb->map[seg], maplen,
2281 len); 2266 sizeof(struct oal));
2282 oal_entry = (struct oal_entry *)oal; 2267 oal_entry = (struct oal_entry *)oal;
2283 oal++; 2268 oal++;
2284 seg++; 2269 seg++;
@@ -2380,6 +2365,7 @@ static int ql3xxx_send(struct sk_buff *skb, struct net_device *ndev)
2380 } 2365 }
2381 2366
2382 mac_iocb_ptr = tx_cb->queue_entry; 2367 mac_iocb_ptr = tx_cb->queue_entry;
2368 memset((void *)mac_iocb_ptr, 0, sizeof(struct ob_mac_iocb_req));
2383 mac_iocb_ptr->opcode = qdev->mac_ob_opcode; 2369 mac_iocb_ptr->opcode = qdev->mac_ob_opcode;
2384 mac_iocb_ptr->flags = OB_MAC_IOCB_REQ_X; 2370 mac_iocb_ptr->flags = OB_MAC_IOCB_REQ_X;
2385 mac_iocb_ptr->flags |= qdev->mb_bit_mask; 2371 mac_iocb_ptr->flags |= qdev->mb_bit_mask;
@@ -3054,15 +3040,6 @@ static int ql_adapter_initialize(struct ql3_adapter *qdev)
3054 goto out; 3040 goto out;
3055 } 3041 }
3056 3042
3057 if (qdev->mac_index)
3058 ql_write_page0_reg(qdev,
3059 &port_regs->mac1MaxFrameLengthReg,
3060 qdev->max_frame_size);
3061 else
3062 ql_write_page0_reg(qdev,
3063 &port_regs->mac0MaxFrameLengthReg,
3064 qdev->max_frame_size);
3065
3066 value = qdev->nvram_data.tcpMaxWindowSize; 3043 value = qdev->nvram_data.tcpMaxWindowSize;
3067 ql_write_page0_reg(qdev, &port_regs->tcpMaxWindow, value); 3044 ql_write_page0_reg(qdev, &port_regs->tcpMaxWindow, value);
3068 3045
@@ -3082,6 +3059,14 @@ static int ql_adapter_initialize(struct ql3_adapter *qdev)
3082 ql_sem_unlock(qdev, QL_FLASH_SEM_MASK); 3059 ql_sem_unlock(qdev, QL_FLASH_SEM_MASK);
3083 } 3060 }
3084 3061
3062 if (qdev->mac_index)
3063 ql_write_page0_reg(qdev,
3064 &port_regs->mac1MaxFrameLengthReg,
3065 qdev->max_frame_size);
3066 else
3067 ql_write_page0_reg(qdev,
3068 &port_regs->mac0MaxFrameLengthReg,
3069 qdev->max_frame_size);
3085 3070
3086 if(ql_sem_spinlock(qdev, QL_PHY_GIO_SEM_MASK, 3071 if(ql_sem_spinlock(qdev, QL_PHY_GIO_SEM_MASK,
3087 (QL_RESOURCE_BITS_BASE_CODE | (qdev->mac_index) * 3072 (QL_RESOURCE_BITS_BASE_CODE | (qdev->mac_index) *
@@ -3152,7 +3137,8 @@ static int ql_adapter_initialize(struct ql3_adapter *qdev)
3152 if (qdev->device_id == QL3032_DEVICE_ID) { 3137 if (qdev->device_id == QL3032_DEVICE_ID) {
3153 value = 3138 value =
3154 (QL3032_PORT_CONTROL_EF | QL3032_PORT_CONTROL_KIE | 3139 (QL3032_PORT_CONTROL_EF | QL3032_PORT_CONTROL_KIE |
3155 QL3032_PORT_CONTROL_EIv6 | QL3032_PORT_CONTROL_EIv4); 3140 QL3032_PORT_CONTROL_EIv6 | QL3032_PORT_CONTROL_EIv4 |
3141 QL3032_PORT_CONTROL_ET);
3156 ql_write_page0_reg(qdev, &port_regs->functionControl, 3142 ql_write_page0_reg(qdev, &port_regs->functionControl,
3157 ((value << 16) | value)); 3143 ((value << 16) | value));
3158 } else { 3144 } else {
diff --git a/drivers/net/qla3xxx.h b/drivers/net/qla3xxx.h
index 34cd6580fd07..0203f88f0544 100755
--- a/drivers/net/qla3xxx.h
+++ b/drivers/net/qla3xxx.h
@@ -1014,8 +1014,7 @@ struct eeprom_data {
1014 1014
1015/* Transmit and Receive Buffers */ 1015/* Transmit and Receive Buffers */
1016#define NUM_LBUFQ_ENTRIES 128 1016#define NUM_LBUFQ_ENTRIES 128
1017#define JUMBO_NUM_LBUFQ_ENTRIES \ 1017#define JUMBO_NUM_LBUFQ_ENTRIES 32
1018(NUM_LBUFQ_ENTRIES/(JUMBO_MTU_SIZE/NORMAL_MTU_SIZE))
1019#define NUM_SBUFQ_ENTRIES 64 1018#define NUM_SBUFQ_ENTRIES 64
1020#define QL_SMALL_BUFFER_SIZE 32 1019#define QL_SMALL_BUFFER_SIZE 32
1021#define QL_ADDR_ELE_PER_BUFQ_ENTRY \ 1020#define QL_ADDR_ELE_PER_BUFQ_ENTRY \
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index 521b5f0618a4..6a77b8a92245 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -66,6 +66,7 @@ VERSION 2.2LK <2005/01/25>
66#include <linux/init.h> 66#include <linux/init.h>
67#include <linux/dma-mapping.h> 67#include <linux/dma-mapping.h>
68 68
69#include <asm/system.h>
69#include <asm/io.h> 70#include <asm/io.h>
70#include <asm/irq.h> 71#include <asm/irq.h>
71 72
@@ -486,6 +487,7 @@ static int rtl8169_rx_interrupt(struct net_device *, struct rtl8169_private *,
486 void __iomem *); 487 void __iomem *);
487static int rtl8169_change_mtu(struct net_device *dev, int new_mtu); 488static int rtl8169_change_mtu(struct net_device *dev, int new_mtu);
488static void rtl8169_down(struct net_device *dev); 489static void rtl8169_down(struct net_device *dev);
490static void rtl8169_rx_clear(struct rtl8169_private *tp);
489 491
490#ifdef CONFIG_R8169_NAPI 492#ifdef CONFIG_R8169_NAPI
491static int rtl8169_poll(struct net_device *dev, int *budget); 493static int rtl8169_poll(struct net_device *dev, int *budget);
@@ -1751,16 +1753,10 @@ static int rtl8169_open(struct net_device *dev)
1751{ 1753{
1752 struct rtl8169_private *tp = netdev_priv(dev); 1754 struct rtl8169_private *tp = netdev_priv(dev);
1753 struct pci_dev *pdev = tp->pci_dev; 1755 struct pci_dev *pdev = tp->pci_dev;
1754 int retval; 1756 int retval = -ENOMEM;
1755 1757
1756 rtl8169_set_rxbufsize(tp, dev);
1757
1758 retval =
1759 request_irq(dev->irq, rtl8169_interrupt, IRQF_SHARED, dev->name, dev);
1760 if (retval < 0)
1761 goto out;
1762 1758
1763 retval = -ENOMEM; 1759 rtl8169_set_rxbufsize(tp, dev);
1764 1760
1765 /* 1761 /*
1766 * Rx and Tx desscriptors needs 256 bytes alignment. 1762 * Rx and Tx desscriptors needs 256 bytes alignment.
@@ -1769,19 +1765,26 @@ static int rtl8169_open(struct net_device *dev)
1769 tp->TxDescArray = pci_alloc_consistent(pdev, R8169_TX_RING_BYTES, 1765 tp->TxDescArray = pci_alloc_consistent(pdev, R8169_TX_RING_BYTES,
1770 &tp->TxPhyAddr); 1766 &tp->TxPhyAddr);
1771 if (!tp->TxDescArray) 1767 if (!tp->TxDescArray)
1772 goto err_free_irq; 1768 goto out;
1773 1769
1774 tp->RxDescArray = pci_alloc_consistent(pdev, R8169_RX_RING_BYTES, 1770 tp->RxDescArray = pci_alloc_consistent(pdev, R8169_RX_RING_BYTES,
1775 &tp->RxPhyAddr); 1771 &tp->RxPhyAddr);
1776 if (!tp->RxDescArray) 1772 if (!tp->RxDescArray)
1777 goto err_free_tx; 1773 goto err_free_tx_0;
1778 1774
1779 retval = rtl8169_init_ring(dev); 1775 retval = rtl8169_init_ring(dev);
1780 if (retval < 0) 1776 if (retval < 0)
1781 goto err_free_rx; 1777 goto err_free_rx_1;
1782 1778
1783 INIT_DELAYED_WORK(&tp->task, NULL); 1779 INIT_DELAYED_WORK(&tp->task, NULL);
1784 1780
1781 smp_mb();
1782
1783 retval = request_irq(dev->irq, rtl8169_interrupt, IRQF_SHARED,
1784 dev->name, dev);
1785 if (retval < 0)
1786 goto err_release_ring_2;
1787
1785 rtl8169_hw_start(dev); 1788 rtl8169_hw_start(dev);
1786 1789
1787 rtl8169_request_timer(dev); 1790 rtl8169_request_timer(dev);
@@ -1790,14 +1793,14 @@ static int rtl8169_open(struct net_device *dev)
1790out: 1793out:
1791 return retval; 1794 return retval;
1792 1795
1793err_free_rx: 1796err_release_ring_2:
1797 rtl8169_rx_clear(tp);
1798err_free_rx_1:
1794 pci_free_consistent(pdev, R8169_RX_RING_BYTES, tp->RxDescArray, 1799 pci_free_consistent(pdev, R8169_RX_RING_BYTES, tp->RxDescArray,
1795 tp->RxPhyAddr); 1800 tp->RxPhyAddr);
1796err_free_tx: 1801err_free_tx_0:
1797 pci_free_consistent(pdev, R8169_TX_RING_BYTES, tp->TxDescArray, 1802 pci_free_consistent(pdev, R8169_TX_RING_BYTES, tp->TxDescArray,
1798 tp->TxPhyAddr); 1803 tp->TxPhyAddr);
1799err_free_irq:
1800 free_irq(dev->irq, dev);
1801 goto out; 1804 goto out;
1802} 1805}
1803 1806
@@ -2887,7 +2890,7 @@ static int rtl8169_suspend(struct pci_dev *pdev, pm_message_t state)
2887 void __iomem *ioaddr = tp->mmio_addr; 2890 void __iomem *ioaddr = tp->mmio_addr;
2888 2891
2889 if (!netif_running(dev)) 2892 if (!netif_running(dev))
2890 goto out; 2893 goto out_pci_suspend;
2891 2894
2892 netif_device_detach(dev); 2895 netif_device_detach(dev);
2893 netif_stop_queue(dev); 2896 netif_stop_queue(dev);
@@ -2901,10 +2904,11 @@ static int rtl8169_suspend(struct pci_dev *pdev, pm_message_t state)
2901 2904
2902 spin_unlock_irq(&tp->lock); 2905 spin_unlock_irq(&tp->lock);
2903 2906
2907out_pci_suspend:
2904 pci_save_state(pdev); 2908 pci_save_state(pdev);
2905 pci_enable_wake(pdev, pci_choose_state(pdev, state), tp->wol_enabled); 2909 pci_enable_wake(pdev, pci_choose_state(pdev, state), tp->wol_enabled);
2906 pci_set_power_state(pdev, pci_choose_state(pdev, state)); 2910 pci_set_power_state(pdev, pci_choose_state(pdev, state));
2907out: 2911
2908 return 0; 2912 return 0;
2909} 2913}
2910 2914
@@ -2912,15 +2916,15 @@ static int rtl8169_resume(struct pci_dev *pdev)
2912{ 2916{
2913 struct net_device *dev = pci_get_drvdata(pdev); 2917 struct net_device *dev = pci_get_drvdata(pdev);
2914 2918
2919 pci_set_power_state(pdev, PCI_D0);
2920 pci_restore_state(pdev);
2921 pci_enable_wake(pdev, PCI_D0, 0);
2922
2915 if (!netif_running(dev)) 2923 if (!netif_running(dev))
2916 goto out; 2924 goto out;
2917 2925
2918 netif_device_attach(dev); 2926 netif_device_attach(dev);
2919 2927
2920 pci_set_power_state(pdev, PCI_D0);
2921 pci_restore_state(pdev);
2922 pci_enable_wake(pdev, PCI_D0, 0);
2923
2924 rtl8169_schedule_work(dev, rtl8169_reset_task); 2928 rtl8169_schedule_work(dev, rtl8169_reset_task);
2925out: 2929out:
2926 return 0; 2930 return 0;
diff --git a/drivers/net/saa9730.c b/drivers/net/saa9730.c
index b269513cde45..143958f1ef0a 100644
--- a/drivers/net/saa9730.c
+++ b/drivers/net/saa9730.c
@@ -64,37 +64,37 @@ static unsigned int pci_irq_line;
64 64
65static void evm_saa9730_enable_lan_int(struct lan_saa9730_private *lp) 65static void evm_saa9730_enable_lan_int(struct lan_saa9730_private *lp)
66{ 66{
67 outl(readl(&lp->evm_saa9730_regs->InterruptBlock1) | EVM_LAN_INT, 67 writel(readl(&lp->evm_saa9730_regs->InterruptBlock1) | EVM_LAN_INT,
68 &lp->evm_saa9730_regs->InterruptBlock1); 68 &lp->evm_saa9730_regs->InterruptBlock1);
69 outl(readl(&lp->evm_saa9730_regs->InterruptStatus1) | EVM_LAN_INT, 69 writel(readl(&lp->evm_saa9730_regs->InterruptStatus1) | EVM_LAN_INT,
70 &lp->evm_saa9730_regs->InterruptStatus1); 70 &lp->evm_saa9730_regs->InterruptStatus1);
71 outl(readl(&lp->evm_saa9730_regs->InterruptEnable1) | EVM_LAN_INT | 71 writel(readl(&lp->evm_saa9730_regs->InterruptEnable1) | EVM_LAN_INT |
72 EVM_MASTER_EN, &lp->evm_saa9730_regs->InterruptEnable1); 72 EVM_MASTER_EN, &lp->evm_saa9730_regs->InterruptEnable1);
73} 73}
74 74
75static void evm_saa9730_disable_lan_int(struct lan_saa9730_private *lp) 75static void evm_saa9730_disable_lan_int(struct lan_saa9730_private *lp)
76{ 76{
77 outl(readl(&lp->evm_saa9730_regs->InterruptBlock1) & ~EVM_LAN_INT, 77 writel(readl(&lp->evm_saa9730_regs->InterruptBlock1) & ~EVM_LAN_INT,
78 &lp->evm_saa9730_regs->InterruptBlock1); 78 &lp->evm_saa9730_regs->InterruptBlock1);
79 outl(readl(&lp->evm_saa9730_regs->InterruptEnable1) & ~EVM_LAN_INT, 79 writel(readl(&lp->evm_saa9730_regs->InterruptEnable1) & ~EVM_LAN_INT,
80 &lp->evm_saa9730_regs->InterruptEnable1); 80 &lp->evm_saa9730_regs->InterruptEnable1);
81} 81}
82 82
83static void evm_saa9730_clear_lan_int(struct lan_saa9730_private *lp) 83static void evm_saa9730_clear_lan_int(struct lan_saa9730_private *lp)
84{ 84{
85 outl(EVM_LAN_INT, &lp->evm_saa9730_regs->InterruptStatus1); 85 writel(EVM_LAN_INT, &lp->evm_saa9730_regs->InterruptStatus1);
86} 86}
87 87
88static void evm_saa9730_block_lan_int(struct lan_saa9730_private *lp) 88static void evm_saa9730_block_lan_int(struct lan_saa9730_private *lp)
89{ 89{
90 outl(readl(&lp->evm_saa9730_regs->InterruptBlock1) & ~EVM_LAN_INT, 90 writel(readl(&lp->evm_saa9730_regs->InterruptBlock1) & ~EVM_LAN_INT,
91 &lp->evm_saa9730_regs->InterruptBlock1); 91 &lp->evm_saa9730_regs->InterruptBlock1);
92} 92}
93 93
94static void evm_saa9730_unblock_lan_int(struct lan_saa9730_private *lp) 94static void evm_saa9730_unblock_lan_int(struct lan_saa9730_private *lp)
95{ 95{
96 outl(readl(&lp->evm_saa9730_regs->InterruptBlock1) | EVM_LAN_INT, 96 writel(readl(&lp->evm_saa9730_regs->InterruptBlock1) | EVM_LAN_INT,
97 &lp->evm_saa9730_regs->InterruptBlock1); 97 &lp->evm_saa9730_regs->InterruptBlock1);
98} 98}
99 99
100static void __attribute_used__ show_saa9730_regs(struct lan_saa9730_private *lp) 100static void __attribute_used__ show_saa9730_regs(struct lan_saa9730_private *lp)
@@ -147,7 +147,7 @@ static void __attribute_used__ show_saa9730_regs(struct lan_saa9730_private *lp)
147 printk("lp->lan_saa9730_regs->RxStatus = %x\n", 147 printk("lp->lan_saa9730_regs->RxStatus = %x\n",
148 readl(&lp->lan_saa9730_regs->RxStatus)); 148 readl(&lp->lan_saa9730_regs->RxStatus));
149 for (i = 0; i < LAN_SAA9730_CAM_DWORDS; i++) { 149 for (i = 0; i < LAN_SAA9730_CAM_DWORDS; i++) {
150 outl(i, &lp->lan_saa9730_regs->CamAddress); 150 writel(i, &lp->lan_saa9730_regs->CamAddress);
151 printk("lp->lan_saa9730_regs->CamData = %x\n", 151 printk("lp->lan_saa9730_regs->CamData = %x\n",
152 readl(&lp->lan_saa9730_regs->CamData)); 152 readl(&lp->lan_saa9730_regs->CamData));
153 } 153 }
@@ -288,28 +288,27 @@ static int lan_saa9730_allocate_buffers(struct pci_dev *pdev,
288 * Set rx buffer A and rx buffer B to point to the first two buffer 288 * Set rx buffer A and rx buffer B to point to the first two buffer
289 * spaces. 289 * spaces.
290 */ 290 */
291 outl(lp->dma_addr + rxoffset, 291 writel(lp->dma_addr + rxoffset, &lp->lan_saa9730_regs->RxBuffA);
292 &lp->lan_saa9730_regs->RxBuffA); 292 writel(lp->dma_addr + rxoffset +
293 outl(lp->dma_addr + rxoffset + 293 LAN_SAA9730_PACKET_SIZE * LAN_SAA9730_RCV_Q_SIZE,
294 LAN_SAA9730_PACKET_SIZE * LAN_SAA9730_RCV_Q_SIZE, 294 &lp->lan_saa9730_regs->RxBuffB);
295 &lp->lan_saa9730_regs->RxBuffB);
296 295
297 /* 296 /*
298 * Set txm_buf_a and txm_buf_b to point to the first two buffer 297 * Set txm_buf_a and txm_buf_b to point to the first two buffer
299 * space 298 * space
300 */ 299 */
301 outl(lp->dma_addr + txoffset, 300 writel(lp->dma_addr + txoffset,
302 &lp->lan_saa9730_regs->TxBuffA); 301 &lp->lan_saa9730_regs->TxBuffA);
303 outl(lp->dma_addr + txoffset + 302 writel(lp->dma_addr + txoffset +
304 LAN_SAA9730_PACKET_SIZE * LAN_SAA9730_TXM_Q_SIZE, 303 LAN_SAA9730_PACKET_SIZE * LAN_SAA9730_TXM_Q_SIZE,
305 &lp->lan_saa9730_regs->TxBuffB); 304 &lp->lan_saa9730_regs->TxBuffB);
306 305
307 /* Set packet number */ 306 /* Set packet number */
308 outl((lp->DmaRcvPackets << PK_COUNT_RX_A_SHF) | 307 writel((lp->DmaRcvPackets << PK_COUNT_RX_A_SHF) |
309 (lp->DmaRcvPackets << PK_COUNT_RX_B_SHF) | 308 (lp->DmaRcvPackets << PK_COUNT_RX_B_SHF) |
310 (lp->DmaTxmPackets << PK_COUNT_TX_A_SHF) | 309 (lp->DmaTxmPackets << PK_COUNT_TX_A_SHF) |
311 (lp->DmaTxmPackets << PK_COUNT_TX_B_SHF), 310 (lp->DmaTxmPackets << PK_COUNT_TX_B_SHF),
312 &lp->lan_saa9730_regs->PacketCount); 311 &lp->lan_saa9730_regs->PacketCount);
313 312
314 return 0; 313 return 0;
315 314
@@ -326,10 +325,10 @@ static int lan_saa9730_cam_load(struct lan_saa9730_private *lp)
326 325
327 for (i = 0; i < LAN_SAA9730_CAM_DWORDS; i++) { 326 for (i = 0; i < LAN_SAA9730_CAM_DWORDS; i++) {
328 /* First set address to where data is written */ 327 /* First set address to where data is written */
329 outl(i, &lp->lan_saa9730_regs->CamAddress); 328 writel(i, &lp->lan_saa9730_regs->CamAddress);
330 outl((NetworkAddress[0] << 24) | (NetworkAddress[1] << 16) 329 writel((NetworkAddress[0] << 24) | (NetworkAddress[1] << 16) |
331 | (NetworkAddress[2] << 8) | NetworkAddress[3], 330 (NetworkAddress[2] << 8) | NetworkAddress[3],
332 &lp->lan_saa9730_regs->CamData); 331 &lp->lan_saa9730_regs->CamData);
333 NetworkAddress += 4; 332 NetworkAddress += 4;
334 } 333 }
335 return 0; 334 return 0;
@@ -365,8 +364,8 @@ static int lan_saa9730_mii_init(struct lan_saa9730_private *lp)
365 } 364 }
366 365
367 /* Now set the control and address register. */ 366 /* Now set the control and address register. */
368 outl(MD_CA_BUSY | PHY_STATUS | PHY_ADDRESS << MD_CA_PHY_SHF, 367 writel(MD_CA_BUSY | PHY_STATUS | PHY_ADDRESS << MD_CA_PHY_SHF,
369 &lp->lan_saa9730_regs->StationMgmtCtl); 368 &lp->lan_saa9730_regs->StationMgmtCtl);
370 369
371 /* check link status, spin here till station is not busy */ 370 /* check link status, spin here till station is not busy */
372 i = 0; 371 i = 0;
@@ -391,23 +390,23 @@ static int lan_saa9730_mii_init(struct lan_saa9730_private *lp)
391 /* Link is down, reset the PHY first. */ 390 /* Link is down, reset the PHY first. */
392 391
393 /* set PHY address = 'CONTROL' */ 392 /* set PHY address = 'CONTROL' */
394 outl(PHY_ADDRESS << MD_CA_PHY_SHF | MD_CA_WR | PHY_CONTROL, 393 writel(PHY_ADDRESS << MD_CA_PHY_SHF | MD_CA_WR | PHY_CONTROL,
395 &lp->lan_saa9730_regs->StationMgmtCtl); 394 &lp->lan_saa9730_regs->StationMgmtCtl);
396 395
397 /* Wait for 1 ms. */ 396 /* Wait for 1 ms. */
398 mdelay(1); 397 mdelay(1);
399 398
400 /* set 'CONTROL' = force reset and renegotiate */ 399 /* set 'CONTROL' = force reset and renegotiate */
401 outl(PHY_CONTROL_RESET | PHY_CONTROL_AUTO_NEG | 400 writel(PHY_CONTROL_RESET | PHY_CONTROL_AUTO_NEG |
402 PHY_CONTROL_RESTART_AUTO_NEG, 401 PHY_CONTROL_RESTART_AUTO_NEG,
403 &lp->lan_saa9730_regs->StationMgmtData); 402 &lp->lan_saa9730_regs->StationMgmtData);
404 403
405 /* Wait for 50 ms. */ 404 /* Wait for 50 ms. */
406 mdelay(50); 405 mdelay(50);
407 406
408 /* set 'BUSY' to start operation */ 407 /* set 'BUSY' to start operation */
409 outl(MD_CA_BUSY | PHY_ADDRESS << MD_CA_PHY_SHF | MD_CA_WR | 408 writel(MD_CA_BUSY | PHY_ADDRESS << MD_CA_PHY_SHF | MD_CA_WR |
410 PHY_CONTROL, &lp->lan_saa9730_regs->StationMgmtCtl); 409 PHY_CONTROL, &lp->lan_saa9730_regs->StationMgmtCtl);
411 410
412 /* await completion */ 411 /* await completion */
413 i = 0; 412 i = 0;
@@ -427,9 +426,9 @@ static int lan_saa9730_mii_init(struct lan_saa9730_private *lp)
427 426
428 for (l = 0; l < 2; l++) { 427 for (l = 0; l < 2; l++) {
429 /* set PHY address = 'STATUS' */ 428 /* set PHY address = 'STATUS' */
430 outl(MD_CA_BUSY | PHY_ADDRESS << MD_CA_PHY_SHF | 429 writel(MD_CA_BUSY | PHY_ADDRESS << MD_CA_PHY_SHF |
431 PHY_STATUS, 430 PHY_STATUS,
432 &lp->lan_saa9730_regs->StationMgmtCtl); 431 &lp->lan_saa9730_regs->StationMgmtCtl);
433 432
434 /* await completion */ 433 /* await completion */
435 i = 0; 434 i = 0;
@@ -462,35 +461,35 @@ static int lan_saa9730_mii_init(struct lan_saa9730_private *lp)
462static int lan_saa9730_control_init(struct lan_saa9730_private *lp) 461static int lan_saa9730_control_init(struct lan_saa9730_private *lp)
463{ 462{
464 /* Initialize DMA control register. */ 463 /* Initialize DMA control register. */
465 outl((LANMB_ANY << DMA_CTL_MAX_XFER_SHF) | 464 writel((LANMB_ANY << DMA_CTL_MAX_XFER_SHF) |
466 (LANEND_LITTLE << DMA_CTL_ENDIAN_SHF) | 465 (LANEND_LITTLE << DMA_CTL_ENDIAN_SHF) |
467 (LAN_SAA9730_RCV_Q_INT_THRESHOLD << DMA_CTL_RX_INT_COUNT_SHF) 466 (LAN_SAA9730_RCV_Q_INT_THRESHOLD << DMA_CTL_RX_INT_COUNT_SHF)
468 | DMA_CTL_RX_INT_TO_EN | DMA_CTL_RX_INT_EN | 467 | DMA_CTL_RX_INT_TO_EN | DMA_CTL_RX_INT_EN |
469 DMA_CTL_MAC_RX_INT_EN | DMA_CTL_MAC_TX_INT_EN, 468 DMA_CTL_MAC_RX_INT_EN | DMA_CTL_MAC_TX_INT_EN,
470 &lp->lan_saa9730_regs->LanDmaCtl); 469 &lp->lan_saa9730_regs->LanDmaCtl);
471 470
472 /* Initial MAC control register. */ 471 /* Initial MAC control register. */
473 outl((MACCM_MII << MAC_CONTROL_CONN_SHF) | MAC_CONTROL_FULL_DUP, 472 writel((MACCM_MII << MAC_CONTROL_CONN_SHF) | MAC_CONTROL_FULL_DUP,
474 &lp->lan_saa9730_regs->MacCtl); 473 &lp->lan_saa9730_regs->MacCtl);
475 474
476 /* Initialize CAM control register. */ 475 /* Initialize CAM control register. */
477 outl(CAM_CONTROL_COMP_EN | CAM_CONTROL_BROAD_ACC, 476 writel(CAM_CONTROL_COMP_EN | CAM_CONTROL_BROAD_ACC,
478 &lp->lan_saa9730_regs->CamCtl); 477 &lp->lan_saa9730_regs->CamCtl);
479 478
480 /* 479 /*
481 * Initialize CAM enable register, only turn on first entry, should 480 * Initialize CAM enable register, only turn on first entry, should
482 * contain own addr. 481 * contain own addr.
483 */ 482 */
484 outl(0x0001, &lp->lan_saa9730_regs->CamEnable); 483 writel(0x0001, &lp->lan_saa9730_regs->CamEnable);
485 484
486 /* Initialize Tx control register */ 485 /* Initialize Tx control register */
487 outl(TX_CTL_EN_COMP, &lp->lan_saa9730_regs->TxCtl); 486 writel(TX_CTL_EN_COMP, &lp->lan_saa9730_regs->TxCtl);
488 487
489 /* Initialize Rcv control register */ 488 /* Initialize Rcv control register */
490 outl(RX_CTL_STRIP_CRC, &lp->lan_saa9730_regs->RxCtl); 489 writel(RX_CTL_STRIP_CRC, &lp->lan_saa9730_regs->RxCtl);
491 490
492 /* Reset DMA engine */ 491 /* Reset DMA engine */
493 outl(DMA_TEST_SW_RESET, &lp->lan_saa9730_regs->DmaTest); 492 writel(DMA_TEST_SW_RESET, &lp->lan_saa9730_regs->DmaTest);
494 493
495 return 0; 494 return 0;
496} 495}
@@ -500,14 +499,14 @@ static int lan_saa9730_stop(struct lan_saa9730_private *lp)
500 int i; 499 int i;
501 500
502 /* Stop DMA first */ 501 /* Stop DMA first */
503 outl(readl(&lp->lan_saa9730_regs->LanDmaCtl) & 502 writel(readl(&lp->lan_saa9730_regs->LanDmaCtl) &
504 ~(DMA_CTL_EN_TX_DMA | DMA_CTL_EN_RX_DMA), 503 ~(DMA_CTL_EN_TX_DMA | DMA_CTL_EN_RX_DMA),
505 &lp->lan_saa9730_regs->LanDmaCtl); 504 &lp->lan_saa9730_regs->LanDmaCtl);
506 505
507 /* Set the SW Reset bits in DMA and MAC control registers */ 506 /* Set the SW Reset bits in DMA and MAC control registers */
508 outl(DMA_TEST_SW_RESET, &lp->lan_saa9730_regs->DmaTest); 507 writel(DMA_TEST_SW_RESET, &lp->lan_saa9730_regs->DmaTest);
509 outl(readl(&lp->lan_saa9730_regs->MacCtl) | MAC_CONTROL_RESET, 508 writel(readl(&lp->lan_saa9730_regs->MacCtl) | MAC_CONTROL_RESET,
510 &lp->lan_saa9730_regs->MacCtl); 509 &lp->lan_saa9730_regs->MacCtl);
511 510
512 /* 511 /*
513 * Wait for MAC reset to have finished. The reset bit is auto cleared 512 * Wait for MAC reset to have finished. The reset bit is auto cleared
@@ -532,8 +531,8 @@ static int lan_saa9730_dma_init(struct lan_saa9730_private *lp)
532 /* Stop lan controller. */ 531 /* Stop lan controller. */
533 lan_saa9730_stop(lp); 532 lan_saa9730_stop(lp);
534 533
535 outl(LAN_SAA9730_DEFAULT_TIME_OUT_CNT, 534 writel(LAN_SAA9730_DEFAULT_TIME_OUT_CNT,
536 &lp->lan_saa9730_regs->Timeout); 535 &lp->lan_saa9730_regs->Timeout);
537 536
538 return 0; 537 return 0;
539} 538}
@@ -552,19 +551,19 @@ static int lan_saa9730_start(struct lan_saa9730_private *lp)
552 lp->PendingTxmPacketIndex = 0; 551 lp->PendingTxmPacketIndex = 0;
553 lp->PendingTxmBufferIndex = 0; 552 lp->PendingTxmBufferIndex = 0;
554 553
555 outl(readl(&lp->lan_saa9730_regs->LanDmaCtl) | DMA_CTL_EN_TX_DMA | 554 writel(readl(&lp->lan_saa9730_regs->LanDmaCtl) | DMA_CTL_EN_TX_DMA |
556 DMA_CTL_EN_RX_DMA, &lp->lan_saa9730_regs->LanDmaCtl); 555 DMA_CTL_EN_RX_DMA, &lp->lan_saa9730_regs->LanDmaCtl);
557 556
558 /* For Tx, turn on MAC then DMA */ 557 /* For Tx, turn on MAC then DMA */
559 outl(readl(&lp->lan_saa9730_regs->TxCtl) | TX_CTL_TX_EN, 558 writel(readl(&lp->lan_saa9730_regs->TxCtl) | TX_CTL_TX_EN,
560 &lp->lan_saa9730_regs->TxCtl); 559 &lp->lan_saa9730_regs->TxCtl);
561 560
562 /* For Rx, turn on DMA then MAC */ 561 /* For Rx, turn on DMA then MAC */
563 outl(readl(&lp->lan_saa9730_regs->RxCtl) | RX_CTL_RX_EN, 562 writel(readl(&lp->lan_saa9730_regs->RxCtl) | RX_CTL_RX_EN,
564 &lp->lan_saa9730_regs->RxCtl); 563 &lp->lan_saa9730_regs->RxCtl);
565 564
566 /* Set Ok2Use to let hardware own the buffers. */ 565 /* Set Ok2Use to let hardware own the buffers. */
567 outl(OK2USE_RX_A | OK2USE_RX_B, &lp->lan_saa9730_regs->Ok2Use); 566 writel(OK2USE_RX_A | OK2USE_RX_B, &lp->lan_saa9730_regs->Ok2Use);
568 567
569 return 0; 568 return 0;
570} 569}
@@ -587,7 +586,7 @@ static int lan_saa9730_tx(struct net_device *dev)
587 printk("lan_saa9730_tx interrupt\n"); 586 printk("lan_saa9730_tx interrupt\n");
588 587
589 /* Clear interrupt. */ 588 /* Clear interrupt. */
590 outl(DMA_STATUS_MAC_TX_INT, &lp->lan_saa9730_regs->DmaStatus); 589 writel(DMA_STATUS_MAC_TX_INT, &lp->lan_saa9730_regs->DmaStatus);
591 590
592 while (1) { 591 while (1) {
593 pPacket = lp->TxmBuffer[lp->PendingTxmBufferIndex] 592 pPacket = lp->TxmBuffer[lp->PendingTxmBufferIndex]
@@ -660,8 +659,8 @@ static int lan_saa9730_rx(struct net_device *dev)
660 printk("lan_saa9730_rx interrupt\n"); 659 printk("lan_saa9730_rx interrupt\n");
661 660
662 /* Clear receive interrupts. */ 661 /* Clear receive interrupts. */
663 outl(DMA_STATUS_MAC_RX_INT | DMA_STATUS_RX_INT | 662 writel(DMA_STATUS_MAC_RX_INT | DMA_STATUS_RX_INT |
664 DMA_STATUS_RX_TO_INT, &lp->lan_saa9730_regs->DmaStatus); 663 DMA_STATUS_RX_TO_INT, &lp->lan_saa9730_regs->DmaStatus);
665 664
666 /* Address next packet */ 665 /* Address next packet */
667 BufferIndex = lp->NextRcvBufferIndex; 666 BufferIndex = lp->NextRcvBufferIndex;
@@ -725,8 +724,8 @@ static int lan_saa9730_rx(struct net_device *dev)
725 *pPacket = cpu_to_le32(RXSF_READY << RX_STAT_CTL_OWNER_SHF); 724 *pPacket = cpu_to_le32(RXSF_READY << RX_STAT_CTL_OWNER_SHF);
726 725
727 /* Make sure A or B is available to hardware as appropriate. */ 726 /* Make sure A or B is available to hardware as appropriate. */
728 outl(BufferIndex ? OK2USE_RX_B : OK2USE_RX_A, 727 writel(BufferIndex ? OK2USE_RX_B : OK2USE_RX_A,
729 &lp->lan_saa9730_regs->Ok2Use); 728 &lp->lan_saa9730_regs->Ok2Use);
730 729
731 /* Go to next packet in sequence. */ 730 /* Go to next packet in sequence. */
732 lp->NextRcvPacketIndex++; 731 lp->NextRcvPacketIndex++;
@@ -844,8 +843,8 @@ static int lan_saa9730_write(struct lan_saa9730_private *lp,
844 (len << TX_STAT_CTL_LENGTH_SHF)); 843 (len << TX_STAT_CTL_LENGTH_SHF));
845 844
846 /* Make sure A or B is available to hardware as appropriate. */ 845 /* Make sure A or B is available to hardware as appropriate. */
847 outl(BufferIndex ? OK2USE_TX_B : OK2USE_TX_A, 846 writel(BufferIndex ? OK2USE_TX_B : OK2USE_TX_A,
848 &lp->lan_saa9730_regs->Ok2Use); 847 &lp->lan_saa9730_regs->Ok2Use);
849 848
850 return 0; 849 return 0;
851} 850}
@@ -938,15 +937,15 @@ static void lan_saa9730_set_multicast(struct net_device *dev)
938 937
939 if (dev->flags & IFF_PROMISC) { 938 if (dev->flags & IFF_PROMISC) {
940 /* accept all packets */ 939 /* accept all packets */
941 outl(CAM_CONTROL_COMP_EN | CAM_CONTROL_STATION_ACC | 940 writel(CAM_CONTROL_COMP_EN | CAM_CONTROL_STATION_ACC |
942 CAM_CONTROL_GROUP_ACC | CAM_CONTROL_BROAD_ACC, 941 CAM_CONTROL_GROUP_ACC | CAM_CONTROL_BROAD_ACC,
943 &lp->lan_saa9730_regs->CamCtl); 942 &lp->lan_saa9730_regs->CamCtl);
944 } else { 943 } else {
945 if (dev->flags & IFF_ALLMULTI) { 944 if (dev->flags & IFF_ALLMULTI) {
946 /* accept all multicast packets */ 945 /* accept all multicast packets */
947 outl(CAM_CONTROL_COMP_EN | CAM_CONTROL_GROUP_ACC | 946 writel(CAM_CONTROL_COMP_EN | CAM_CONTROL_GROUP_ACC |
948 CAM_CONTROL_BROAD_ACC, 947 CAM_CONTROL_BROAD_ACC,
949 &lp->lan_saa9730_regs->CamCtl); 948 &lp->lan_saa9730_regs->CamCtl);
950 } else { 949 } else {
951 /* 950 /*
952 * Will handle the multicast stuff later. -carstenl 951 * Will handle the multicast stuff later. -carstenl
diff --git a/drivers/net/sb1250-mac.c b/drivers/net/sb1250-mac.c
index 1eae16b72b4b..103c3174ab54 100644
--- a/drivers/net/sb1250-mac.c
+++ b/drivers/net/sb1250-mac.c
@@ -243,7 +243,7 @@ struct sbmac_softc {
243 * Controller-specific things 243 * Controller-specific things
244 */ 244 */
245 245
246 volatile void __iomem *sbm_base; /* MAC's base address */ 246 void __iomem *sbm_base; /* MAC's base address */
247 sbmac_state_t sbm_state; /* current state */ 247 sbmac_state_t sbm_state; /* current state */
248 248
249 volatile void __iomem *sbm_macenable; /* MAC Enable Register */ 249 volatile void __iomem *sbm_macenable; /* MAC Enable Register */
diff --git a/drivers/net/sis190.c b/drivers/net/sis190.c
index b08508b35833..34463ce6f132 100644
--- a/drivers/net/sis190.c
+++ b/drivers/net/sis190.c
@@ -324,6 +324,7 @@ static struct mii_chip_info {
324 u32 feature; 324 u32 feature;
325} mii_chip_table[] = { 325} mii_chip_table[] = {
326 { "Broadcom PHY BCM5461", { 0x0020, 0x60c0 }, LAN, F_PHY_BCM5461 }, 326 { "Broadcom PHY BCM5461", { 0x0020, 0x60c0 }, LAN, F_PHY_BCM5461 },
327 { "Broadcom PHY AC131", { 0x0143, 0xbc70 }, LAN, 0 },
327 { "Agere PHY ET1101B", { 0x0282, 0xf010 }, LAN, 0 }, 328 { "Agere PHY ET1101B", { 0x0282, 0xf010 }, LAN, 0 },
328 { "Marvell PHY 88E1111", { 0x0141, 0x0cc0 }, LAN, F_PHY_88E1111 }, 329 { "Marvell PHY 88E1111", { 0x0141, 0x0cc0 }, LAN, F_PHY_88E1111 },
329 { "Realtek PHY RTL8201", { 0x0000, 0x8200 }, LAN, 0 }, 330 { "Realtek PHY RTL8201", { 0x0000, 0x8200 }, LAN, 0 },
diff --git a/drivers/net/skge.c b/drivers/net/skge.c
index 8fecf1b817f7..39c6677dff5e 100644
--- a/drivers/net/skge.c
+++ b/drivers/net/skge.c
@@ -105,7 +105,8 @@ static const int txqaddr[] = { Q_XA1, Q_XA2 };
105static const int rxqaddr[] = { Q_R1, Q_R2 }; 105static const int rxqaddr[] = { Q_R1, Q_R2 };
106static const u32 rxirqmask[] = { IS_R1_F, IS_R2_F }; 106static const u32 rxirqmask[] = { IS_R1_F, IS_R2_F };
107static const u32 txirqmask[] = { IS_XA1_F, IS_XA2_F }; 107static const u32 txirqmask[] = { IS_XA1_F, IS_XA2_F };
108static const u32 irqmask[] = { IS_R1_F|IS_XA1_F, IS_R2_F|IS_XA2_F }; 108static const u32 napimask[] = { IS_R1_F|IS_XA1_F, IS_R2_F|IS_XA2_F };
109static const u32 portmask[] = { IS_PORT_1, IS_PORT_2 };
109 110
110static int skge_get_regs_len(struct net_device *dev) 111static int skge_get_regs_len(struct net_device *dev)
111{ 112{
@@ -671,7 +672,7 @@ static void skge_led(struct skge_port *skge, enum led_mode mode)
671 struct skge_hw *hw = skge->hw; 672 struct skge_hw *hw = skge->hw;
672 int port = skge->port; 673 int port = skge->port;
673 674
674 mutex_lock(&hw->phy_mutex); 675 spin_lock_bh(&hw->phy_lock);
675 if (hw->chip_id == CHIP_ID_GENESIS) { 676 if (hw->chip_id == CHIP_ID_GENESIS) {
676 switch (mode) { 677 switch (mode) {
677 case LED_MODE_OFF: 678 case LED_MODE_OFF:
@@ -742,7 +743,7 @@ static void skge_led(struct skge_port *skge, enum led_mode mode)
742 PHY_M_LED_MO_RX(MO_LED_ON)); 743 PHY_M_LED_MO_RX(MO_LED_ON));
743 } 744 }
744 } 745 }
745 mutex_unlock(&hw->phy_mutex); 746 spin_unlock_bh(&hw->phy_lock);
746} 747}
747 748
748/* blink LED's for finding board */ 749/* blink LED's for finding board */
@@ -1316,7 +1317,7 @@ static void xm_phy_init(struct skge_port *skge)
1316 xm_phy_write(hw, port, PHY_XMAC_CTRL, ctrl); 1317 xm_phy_write(hw, port, PHY_XMAC_CTRL, ctrl);
1317 1318
1318 /* Poll PHY for status changes */ 1319 /* Poll PHY for status changes */
1319 schedule_delayed_work(&skge->link_thread, LINK_HZ); 1320 mod_timer(&skge->link_timer, jiffies + LINK_HZ);
1320} 1321}
1321 1322
1322static void xm_check_link(struct net_device *dev) 1323static void xm_check_link(struct net_device *dev)
@@ -1391,10 +1392,9 @@ static void xm_check_link(struct net_device *dev)
1391 * Since internal PHY is wired to a level triggered pin, can't 1392 * Since internal PHY is wired to a level triggered pin, can't
1392 * get an interrupt when carrier is detected. 1393 * get an interrupt when carrier is detected.
1393 */ 1394 */
1394static void xm_link_timer(struct work_struct *work) 1395static void xm_link_timer(unsigned long arg)
1395{ 1396{
1396 struct skge_port *skge = 1397 struct skge_port *skge = (struct skge_port *) arg;
1397 container_of(work, struct skge_port, link_thread.work);
1398 struct net_device *dev = skge->netdev; 1398 struct net_device *dev = skge->netdev;
1399 struct skge_hw *hw = skge->hw; 1399 struct skge_hw *hw = skge->hw;
1400 int port = skge->port; 1400 int port = skge->port;
@@ -1414,13 +1414,13 @@ static void xm_link_timer(struct work_struct *work)
1414 goto nochange; 1414 goto nochange;
1415 } 1415 }
1416 1416
1417 mutex_lock(&hw->phy_mutex); 1417 spin_lock(&hw->phy_lock);
1418 xm_check_link(dev); 1418 xm_check_link(dev);
1419 mutex_unlock(&hw->phy_mutex); 1419 spin_unlock(&hw->phy_lock);
1420 1420
1421nochange: 1421nochange:
1422 if (netif_running(dev)) 1422 if (netif_running(dev))
1423 schedule_delayed_work(&skge->link_thread, LINK_HZ); 1423 mod_timer(&skge->link_timer, jiffies + LINK_HZ);
1424} 1424}
1425 1425
1426static void genesis_mac_init(struct skge_hw *hw, int port) 1426static void genesis_mac_init(struct skge_hw *hw, int port)
@@ -2323,7 +2323,7 @@ static void skge_phy_reset(struct skge_port *skge)
2323 netif_stop_queue(skge->netdev); 2323 netif_stop_queue(skge->netdev);
2324 netif_carrier_off(skge->netdev); 2324 netif_carrier_off(skge->netdev);
2325 2325
2326 mutex_lock(&hw->phy_mutex); 2326 spin_lock_bh(&hw->phy_lock);
2327 if (hw->chip_id == CHIP_ID_GENESIS) { 2327 if (hw->chip_id == CHIP_ID_GENESIS) {
2328 genesis_reset(hw, port); 2328 genesis_reset(hw, port);
2329 genesis_mac_init(hw, port); 2329 genesis_mac_init(hw, port);
@@ -2331,7 +2331,7 @@ static void skge_phy_reset(struct skge_port *skge)
2331 yukon_reset(hw, port); 2331 yukon_reset(hw, port);
2332 yukon_init(hw, port); 2332 yukon_init(hw, port);
2333 } 2333 }
2334 mutex_unlock(&hw->phy_mutex); 2334 spin_unlock_bh(&hw->phy_lock);
2335 2335
2336 dev->set_multicast_list(dev); 2336 dev->set_multicast_list(dev);
2337} 2337}
@@ -2354,12 +2354,12 @@ static int skge_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
2354 /* fallthru */ 2354 /* fallthru */
2355 case SIOCGMIIREG: { 2355 case SIOCGMIIREG: {
2356 u16 val = 0; 2356 u16 val = 0;
2357 mutex_lock(&hw->phy_mutex); 2357 spin_lock_bh(&hw->phy_lock);
2358 if (hw->chip_id == CHIP_ID_GENESIS) 2358 if (hw->chip_id == CHIP_ID_GENESIS)
2359 err = __xm_phy_read(hw, skge->port, data->reg_num & 0x1f, &val); 2359 err = __xm_phy_read(hw, skge->port, data->reg_num & 0x1f, &val);
2360 else 2360 else
2361 err = __gm_phy_read(hw, skge->port, data->reg_num & 0x1f, &val); 2361 err = __gm_phy_read(hw, skge->port, data->reg_num & 0x1f, &val);
2362 mutex_unlock(&hw->phy_mutex); 2362 spin_unlock_bh(&hw->phy_lock);
2363 data->val_out = val; 2363 data->val_out = val;
2364 break; 2364 break;
2365 } 2365 }
@@ -2368,14 +2368,14 @@ static int skge_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
2368 if (!capable(CAP_NET_ADMIN)) 2368 if (!capable(CAP_NET_ADMIN))
2369 return -EPERM; 2369 return -EPERM;
2370 2370
2371 mutex_lock(&hw->phy_mutex); 2371 spin_lock_bh(&hw->phy_lock);
2372 if (hw->chip_id == CHIP_ID_GENESIS) 2372 if (hw->chip_id == CHIP_ID_GENESIS)
2373 err = xm_phy_write(hw, skge->port, data->reg_num & 0x1f, 2373 err = xm_phy_write(hw, skge->port, data->reg_num & 0x1f,
2374 data->val_in); 2374 data->val_in);
2375 else 2375 else
2376 err = gm_phy_write(hw, skge->port, data->reg_num & 0x1f, 2376 err = gm_phy_write(hw, skge->port, data->reg_num & 0x1f,
2377 data->val_in); 2377 data->val_in);
2378 mutex_unlock(&hw->phy_mutex); 2378 spin_unlock_bh(&hw->phy_lock);
2379 break; 2379 break;
2380 } 2380 }
2381 return err; 2381 return err;
@@ -2481,12 +2481,12 @@ static int skge_up(struct net_device *dev)
2481 goto free_rx_ring; 2481 goto free_rx_ring;
2482 2482
2483 /* Initialize MAC */ 2483 /* Initialize MAC */
2484 mutex_lock(&hw->phy_mutex); 2484 spin_lock_bh(&hw->phy_lock);
2485 if (hw->chip_id == CHIP_ID_GENESIS) 2485 if (hw->chip_id == CHIP_ID_GENESIS)
2486 genesis_mac_init(hw, port); 2486 genesis_mac_init(hw, port);
2487 else 2487 else
2488 yukon_mac_init(hw, port); 2488 yukon_mac_init(hw, port);
2489 mutex_unlock(&hw->phy_mutex); 2489 spin_unlock_bh(&hw->phy_lock);
2490 2490
2491 /* Configure RAMbuffers */ 2491 /* Configure RAMbuffers */
2492 chunk = hw->ram_size / ((hw->ports + 1)*2); 2492 chunk = hw->ram_size / ((hw->ports + 1)*2);
@@ -2504,6 +2504,11 @@ static int skge_up(struct net_device *dev)
2504 skge_write8(hw, Q_ADDR(rxqaddr[port], Q_CSR), CSR_START | CSR_IRQ_CL_F); 2504 skge_write8(hw, Q_ADDR(rxqaddr[port], Q_CSR), CSR_START | CSR_IRQ_CL_F);
2505 skge_led(skge, LED_MODE_ON); 2505 skge_led(skge, LED_MODE_ON);
2506 2506
2507 spin_lock_irq(&hw->hw_lock);
2508 hw->intr_mask |= portmask[port];
2509 skge_write32(hw, B0_IMSK, hw->intr_mask);
2510 spin_unlock_irq(&hw->hw_lock);
2511
2507 netif_poll_enable(dev); 2512 netif_poll_enable(dev);
2508 return 0; 2513 return 0;
2509 2514
@@ -2531,7 +2536,14 @@ static int skge_down(struct net_device *dev)
2531 2536
2532 netif_stop_queue(dev); 2537 netif_stop_queue(dev);
2533 if (hw->chip_id == CHIP_ID_GENESIS && hw->phy_type == SK_PHY_XMAC) 2538 if (hw->chip_id == CHIP_ID_GENESIS && hw->phy_type == SK_PHY_XMAC)
2534 cancel_delayed_work(&skge->link_thread); 2539 del_timer_sync(&skge->link_timer);
2540
2541 netif_poll_disable(dev);
2542
2543 spin_lock_irq(&hw->hw_lock);
2544 hw->intr_mask &= ~portmask[port];
2545 skge_write32(hw, B0_IMSK, hw->intr_mask);
2546 spin_unlock_irq(&hw->hw_lock);
2535 2547
2536 skge_write8(skge->hw, SK_REG(skge->port, LNK_LED_REG), LED_OFF); 2548 skge_write8(skge->hw, SK_REG(skge->port, LNK_LED_REG), LED_OFF);
2537 if (hw->chip_id == CHIP_ID_GENESIS) 2549 if (hw->chip_id == CHIP_ID_GENESIS)
@@ -2575,8 +2587,10 @@ static int skge_down(struct net_device *dev)
2575 2587
2576 skge_led(skge, LED_MODE_OFF); 2588 skge_led(skge, LED_MODE_OFF);
2577 2589
2578 netif_poll_disable(dev); 2590 netif_tx_lock_bh(dev);
2579 skge_tx_clean(dev); 2591 skge_tx_clean(dev);
2592 netif_tx_unlock_bh(dev);
2593
2580 skge_rx_clean(skge); 2594 skge_rx_clean(skge);
2581 2595
2582 kfree(skge->rx_ring.start); 2596 kfree(skge->rx_ring.start);
@@ -2721,7 +2735,6 @@ static void skge_tx_clean(struct net_device *dev)
2721 struct skge_port *skge = netdev_priv(dev); 2735 struct skge_port *skge = netdev_priv(dev);
2722 struct skge_element *e; 2736 struct skge_element *e;
2723 2737
2724 netif_tx_lock_bh(dev);
2725 for (e = skge->tx_ring.to_clean; e != skge->tx_ring.to_use; e = e->next) { 2738 for (e = skge->tx_ring.to_clean; e != skge->tx_ring.to_use; e = e->next) {
2726 struct skge_tx_desc *td = e->desc; 2739 struct skge_tx_desc *td = e->desc;
2727 skge_tx_free(skge, e, td->control); 2740 skge_tx_free(skge, e, td->control);
@@ -2730,7 +2743,6 @@ static void skge_tx_clean(struct net_device *dev)
2730 2743
2731 skge->tx_ring.to_clean = e; 2744 skge->tx_ring.to_clean = e;
2732 netif_wake_queue(dev); 2745 netif_wake_queue(dev);
2733 netif_tx_unlock_bh(dev);
2734} 2746}
2735 2747
2736static void skge_tx_timeout(struct net_device *dev) 2748static void skge_tx_timeout(struct net_device *dev)
@@ -3049,7 +3061,7 @@ static int skge_poll(struct net_device *dev, int *budget)
3049 3061
3050 spin_lock_irqsave(&hw->hw_lock, flags); 3062 spin_lock_irqsave(&hw->hw_lock, flags);
3051 __netif_rx_complete(dev); 3063 __netif_rx_complete(dev);
3052 hw->intr_mask |= irqmask[skge->port]; 3064 hw->intr_mask |= napimask[skge->port];
3053 skge_write32(hw, B0_IMSK, hw->intr_mask); 3065 skge_write32(hw, B0_IMSK, hw->intr_mask);
3054 skge_read32(hw, B0_IMSK); 3066 skge_read32(hw, B0_IMSK);
3055 spin_unlock_irqrestore(&hw->hw_lock, flags); 3067 spin_unlock_irqrestore(&hw->hw_lock, flags);
@@ -3160,28 +3172,29 @@ static void skge_error_irq(struct skge_hw *hw)
3160} 3172}
3161 3173
3162/* 3174/*
3163 * Interrupt from PHY are handled in work queue 3175 * Interrupt from PHY are handled in tasklet (softirq)
3164 * because accessing phy registers requires spin wait which might 3176 * because accessing phy registers requires spin wait which might
3165 * cause excess interrupt latency. 3177 * cause excess interrupt latency.
3166 */ 3178 */
3167static void skge_extirq(struct work_struct *work) 3179static void skge_extirq(unsigned long arg)
3168{ 3180{
3169 struct skge_hw *hw = container_of(work, struct skge_hw, phy_work); 3181 struct skge_hw *hw = (struct skge_hw *) arg;
3170 int port; 3182 int port;
3171 3183
3172 mutex_lock(&hw->phy_mutex);
3173 for (port = 0; port < hw->ports; port++) { 3184 for (port = 0; port < hw->ports; port++) {
3174 struct net_device *dev = hw->dev[port]; 3185 struct net_device *dev = hw->dev[port];
3175 struct skge_port *skge = netdev_priv(dev);
3176 3186
3177 if (netif_running(dev)) { 3187 if (netif_running(dev)) {
3188 struct skge_port *skge = netdev_priv(dev);
3189
3190 spin_lock(&hw->phy_lock);
3178 if (hw->chip_id != CHIP_ID_GENESIS) 3191 if (hw->chip_id != CHIP_ID_GENESIS)
3179 yukon_phy_intr(skge); 3192 yukon_phy_intr(skge);
3180 else if (hw->phy_type == SK_PHY_BCOM) 3193 else if (hw->phy_type == SK_PHY_BCOM)
3181 bcom_phy_intr(skge); 3194 bcom_phy_intr(skge);
3195 spin_unlock(&hw->phy_lock);
3182 } 3196 }
3183 } 3197 }
3184 mutex_unlock(&hw->phy_mutex);
3185 3198
3186 spin_lock_irq(&hw->hw_lock); 3199 spin_lock_irq(&hw->hw_lock);
3187 hw->intr_mask |= IS_EXT_REG; 3200 hw->intr_mask |= IS_EXT_REG;
@@ -3206,7 +3219,7 @@ static irqreturn_t skge_intr(int irq, void *dev_id)
3206 status &= hw->intr_mask; 3219 status &= hw->intr_mask;
3207 if (status & IS_EXT_REG) { 3220 if (status & IS_EXT_REG) {
3208 hw->intr_mask &= ~IS_EXT_REG; 3221 hw->intr_mask &= ~IS_EXT_REG;
3209 schedule_work(&hw->phy_work); 3222 tasklet_schedule(&hw->phy_task);
3210 } 3223 }
3211 3224
3212 if (status & (IS_XA1_F|IS_R1_F)) { 3225 if (status & (IS_XA1_F|IS_R1_F)) {
@@ -3282,23 +3295,28 @@ static int skge_set_mac_address(struct net_device *dev, void *p)
3282 3295
3283 memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN); 3296 memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
3284 3297
3285 /* disable Rx */ 3298 if (!netif_running(dev)) {
3286 ctrl = gma_read16(hw, port, GM_GP_CTRL); 3299 memcpy_toio(hw->regs + B2_MAC_1 + port*8, dev->dev_addr, ETH_ALEN);
3287 gma_write16(hw, port, GM_GP_CTRL, ctrl & ~GM_GPCR_RX_ENA); 3300 memcpy_toio(hw->regs + B2_MAC_2 + port*8, dev->dev_addr, ETH_ALEN);
3301 } else {
3302 /* disable Rx */
3303 spin_lock_bh(&hw->phy_lock);
3304 ctrl = gma_read16(hw, port, GM_GP_CTRL);
3305 gma_write16(hw, port, GM_GP_CTRL, ctrl & ~GM_GPCR_RX_ENA);
3288 3306
3289 memcpy_toio(hw->regs + B2_MAC_1 + port*8, dev->dev_addr, ETH_ALEN); 3307 memcpy_toio(hw->regs + B2_MAC_1 + port*8, dev->dev_addr, ETH_ALEN);
3290 memcpy_toio(hw->regs + B2_MAC_2 + port*8, dev->dev_addr, ETH_ALEN); 3308 memcpy_toio(hw->regs + B2_MAC_2 + port*8, dev->dev_addr, ETH_ALEN);
3291 3309
3292 if (netif_running(dev)) {
3293 if (hw->chip_id == CHIP_ID_GENESIS) 3310 if (hw->chip_id == CHIP_ID_GENESIS)
3294 xm_outaddr(hw, port, XM_SA, dev->dev_addr); 3311 xm_outaddr(hw, port, XM_SA, dev->dev_addr);
3295 else { 3312 else {
3296 gma_set_addr(hw, port, GM_SRC_ADDR_1L, dev->dev_addr); 3313 gma_set_addr(hw, port, GM_SRC_ADDR_1L, dev->dev_addr);
3297 gma_set_addr(hw, port, GM_SRC_ADDR_2L, dev->dev_addr); 3314 gma_set_addr(hw, port, GM_SRC_ADDR_2L, dev->dev_addr);
3298 } 3315 }
3299 }
3300 3316
3301 gma_write16(hw, port, GM_GP_CTRL, ctrl); 3317 gma_write16(hw, port, GM_GP_CTRL, ctrl);
3318 spin_unlock_bh(&hw->phy_lock);
3319 }
3302 3320
3303 return 0; 3321 return 0;
3304} 3322}
@@ -3413,10 +3431,9 @@ static int skge_reset(struct skge_hw *hw)
3413 else 3431 else
3414 hw->ram_size = t8 * 4096; 3432 hw->ram_size = t8 * 4096;
3415 3433
3416 hw->intr_mask = IS_HW_ERR | IS_PORT_1; 3434 hw->intr_mask = IS_HW_ERR;
3417 if (hw->ports > 1)
3418 hw->intr_mask |= IS_PORT_2;
3419 3435
3436 /* Use PHY IRQ for all but fiber based Genesis board */
3420 if (!(hw->chip_id == CHIP_ID_GENESIS && hw->phy_type == SK_PHY_XMAC)) 3437 if (!(hw->chip_id == CHIP_ID_GENESIS && hw->phy_type == SK_PHY_XMAC))
3421 hw->intr_mask |= IS_EXT_REG; 3438 hw->intr_mask |= IS_EXT_REG;
3422 3439
@@ -3484,14 +3501,12 @@ static int skge_reset(struct skge_hw *hw)
3484 3501
3485 skge_write32(hw, B0_IMSK, hw->intr_mask); 3502 skge_write32(hw, B0_IMSK, hw->intr_mask);
3486 3503
3487 mutex_lock(&hw->phy_mutex);
3488 for (i = 0; i < hw->ports; i++) { 3504 for (i = 0; i < hw->ports; i++) {
3489 if (hw->chip_id == CHIP_ID_GENESIS) 3505 if (hw->chip_id == CHIP_ID_GENESIS)
3490 genesis_reset(hw, i); 3506 genesis_reset(hw, i);
3491 else 3507 else
3492 yukon_reset(hw, i); 3508 yukon_reset(hw, i);
3493 } 3509 }
3494 mutex_unlock(&hw->phy_mutex);
3495 3510
3496 return 0; 3511 return 0;
3497} 3512}
@@ -3539,6 +3554,7 @@ static struct net_device *skge_devinit(struct skge_hw *hw, int port,
3539 skge->netdev = dev; 3554 skge->netdev = dev;
3540 skge->hw = hw; 3555 skge->hw = hw;
3541 skge->msg_enable = netif_msg_init(debug, default_msg); 3556 skge->msg_enable = netif_msg_init(debug, default_msg);
3557
3542 skge->tx_ring.count = DEFAULT_TX_RING_SIZE; 3558 skge->tx_ring.count = DEFAULT_TX_RING_SIZE;
3543 skge->rx_ring.count = DEFAULT_RX_RING_SIZE; 3559 skge->rx_ring.count = DEFAULT_RX_RING_SIZE;
3544 3560
@@ -3555,7 +3571,7 @@ static struct net_device *skge_devinit(struct skge_hw *hw, int port,
3555 skge->port = port; 3571 skge->port = port;
3556 3572
3557 /* Only used for Genesis XMAC */ 3573 /* Only used for Genesis XMAC */
3558 INIT_DELAYED_WORK(&skge->link_thread, xm_link_timer); 3574 setup_timer(&skge->link_timer, xm_link_timer, (unsigned long) skge);
3559 3575
3560 if (hw->chip_id != CHIP_ID_GENESIS) { 3576 if (hw->chip_id != CHIP_ID_GENESIS) {
3561 dev->features |= NETIF_F_IP_CSUM | NETIF_F_SG; 3577 dev->features |= NETIF_F_IP_CSUM | NETIF_F_SG;
@@ -3637,9 +3653,9 @@ static int __devinit skge_probe(struct pci_dev *pdev,
3637 } 3653 }
3638 3654
3639 hw->pdev = pdev; 3655 hw->pdev = pdev;
3640 mutex_init(&hw->phy_mutex);
3641 INIT_WORK(&hw->phy_work, skge_extirq);
3642 spin_lock_init(&hw->hw_lock); 3656 spin_lock_init(&hw->hw_lock);
3657 spin_lock_init(&hw->phy_lock);
3658 tasklet_init(&hw->phy_task, &skge_extirq, (unsigned long) hw);
3643 3659
3644 hw->regs = ioremap_nocache(pci_resource_start(pdev, 0), 0x4000); 3660 hw->regs = ioremap_nocache(pci_resource_start(pdev, 0), 0x4000);
3645 if (!hw->regs) { 3661 if (!hw->regs) {
@@ -3725,6 +3741,8 @@ static void __devexit skge_remove(struct pci_dev *pdev)
3725 dev0 = hw->dev[0]; 3741 dev0 = hw->dev[0];
3726 unregister_netdev(dev0); 3742 unregister_netdev(dev0);
3727 3743
3744 tasklet_disable(&hw->phy_task);
3745
3728 spin_lock_irq(&hw->hw_lock); 3746 spin_lock_irq(&hw->hw_lock);
3729 hw->intr_mask = 0; 3747 hw->intr_mask = 0;
3730 skge_write32(hw, B0_IMSK, 0); 3748 skge_write32(hw, B0_IMSK, 0);
diff --git a/drivers/net/skge.h b/drivers/net/skge.h
index e9354dfa7e9a..86467ae74d45 100644
--- a/drivers/net/skge.h
+++ b/drivers/net/skge.h
@@ -2424,8 +2424,8 @@ struct skge_hw {
2424 u32 ram_size; 2424 u32 ram_size;
2425 u32 ram_offset; 2425 u32 ram_offset;
2426 u16 phy_addr; 2426 u16 phy_addr;
2427 struct work_struct phy_work; 2427 spinlock_t phy_lock;
2428 struct mutex phy_mutex; 2428 struct tasklet_struct phy_task;
2429}; 2429};
2430 2430
2431enum pause_control { 2431enum pause_control {
@@ -2457,7 +2457,7 @@ struct skge_port {
2457 2457
2458 struct net_device_stats net_stats; 2458 struct net_device_stats net_stats;
2459 2459
2460 struct delayed_work link_thread; 2460 struct timer_list link_timer;
2461 enum pause_control flow_control; 2461 enum pause_control flow_control;
2462 enum pause_status flow_status; 2462 enum pause_status flow_status;
2463 u8 rx_csum; 2463 u8 rx_csum;
diff --git a/drivers/net/sun3lance.c b/drivers/net/sun3lance.c
index c62e85d89f41..7bee45b42a2c 100644
--- a/drivers/net/sun3lance.c
+++ b/drivers/net/sun3lance.c
@@ -336,13 +336,27 @@ static int __init lance_probe( struct net_device *dev)
336 336
337 /* XXX - leak? */ 337 /* XXX - leak? */
338 MEM = dvma_malloc_align(sizeof(struct lance_memory), 0x10000); 338 MEM = dvma_malloc_align(sizeof(struct lance_memory), 0x10000);
339 if (MEM == NULL) {
340#ifdef CONFIG_SUN3
341 iounmap((void __iomem *)ioaddr);
342#endif
343 printk(KERN_WARNING "SUN3 Lance couldn't allocate DVMA memory\n");
344 return 0;
345 }
339 346
340 lp->iobase = (volatile unsigned short *)ioaddr; 347 lp->iobase = (volatile unsigned short *)ioaddr;
341 dev->base_addr = (unsigned long)ioaddr; /* informational only */ 348 dev->base_addr = (unsigned long)ioaddr; /* informational only */
342 349
343 REGA(CSR0) = CSR0_STOP; 350 REGA(CSR0) = CSR0_STOP;
344 351
345 request_irq(LANCE_IRQ, lance_interrupt, IRQF_DISABLED, "SUN3 Lance", dev); 352 if (request_irq(LANCE_IRQ, lance_interrupt, IRQF_DISABLED, "SUN3 Lance", dev) < 0) {
353#ifdef CONFIG_SUN3
354 iounmap((void __iomem *)ioaddr);
355#endif
356 dvma_free((void *)MEM);
357 printk(KERN_WARNING "SUN3 Lance unable to allocate IRQ\n");
358 return 0;
359 }
346 dev->irq = (unsigned short)LANCE_IRQ; 360 dev->irq = (unsigned short)LANCE_IRQ;
347 361
348 362
diff --git a/drivers/net/sungem.c b/drivers/net/sungem.c
index 616be8d0fa85..08ea61db46fe 100644
--- a/drivers/net/sungem.c
+++ b/drivers/net/sungem.c
@@ -2530,6 +2530,35 @@ static struct net_device_stats *gem_get_stats(struct net_device *dev)
2530 return &gp->net_stats; 2530 return &gp->net_stats;
2531} 2531}
2532 2532
2533static int gem_set_mac_address(struct net_device *dev, void *addr)
2534{
2535 struct sockaddr *macaddr = (struct sockaddr *) addr;
2536 struct gem *gp = dev->priv;
2537 unsigned char *e = &dev->dev_addr[0];
2538
2539 if (!is_valid_ether_addr(macaddr->sa_data))
2540 return -EADDRNOTAVAIL;
2541
2542 if (!netif_running(dev) || !netif_device_present(dev)) {
2543 /* We'll just catch it later when the
2544 * device is up'd or resumed.
2545 */
2546 memcpy(dev->dev_addr, macaddr->sa_data, dev->addr_len);
2547 return 0;
2548 }
2549
2550 mutex_lock(&gp->pm_mutex);
2551 memcpy(dev->dev_addr, macaddr->sa_data, dev->addr_len);
2552 if (gp->running) {
2553 writel((e[4] << 8) | e[5], gp->regs + MAC_ADDR0);
2554 writel((e[2] << 8) | e[3], gp->regs + MAC_ADDR1);
2555 writel((e[0] << 8) | e[1], gp->regs + MAC_ADDR2);
2556 }
2557 mutex_unlock(&gp->pm_mutex);
2558
2559 return 0;
2560}
2561
2533static void gem_set_multicast(struct net_device *dev) 2562static void gem_set_multicast(struct net_device *dev)
2534{ 2563{
2535 struct gem *gp = dev->priv; 2564 struct gem *gp = dev->priv;
@@ -3122,6 +3151,7 @@ static int __devinit gem_init_one(struct pci_dev *pdev,
3122 dev->change_mtu = gem_change_mtu; 3151 dev->change_mtu = gem_change_mtu;
3123 dev->irq = pdev->irq; 3152 dev->irq = pdev->irq;
3124 dev->dma = 0; 3153 dev->dma = 0;
3154 dev->set_mac_address = gem_set_mac_address;
3125#ifdef CONFIG_NET_POLL_CONTROLLER 3155#ifdef CONFIG_NET_POLL_CONTROLLER
3126 dev->poll_controller = gem_poll_controller; 3156 dev->poll_controller = gem_poll_controller;
3127#endif 3157#endif
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 8c8f9f4d47a5..256969e1300c 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -64,8 +64,8 @@
64 64
65#define DRV_MODULE_NAME "tg3" 65#define DRV_MODULE_NAME "tg3"
66#define PFX DRV_MODULE_NAME ": " 66#define PFX DRV_MODULE_NAME ": "
67#define DRV_MODULE_VERSION "3.74" 67#define DRV_MODULE_VERSION "3.75"
68#define DRV_MODULE_RELDATE "February 20, 2007" 68#define DRV_MODULE_RELDATE "March 23, 2007"
69 69
70#define TG3_DEF_MAC_MODE 0 70#define TG3_DEF_MAC_MODE 0
71#define TG3_DEF_RX_MODE 0 71#define TG3_DEF_RX_MODE 0
@@ -3568,32 +3568,34 @@ static irqreturn_t tg3_interrupt(int irq, void *dev_id)
3568 * Reading the PCI State register will confirm whether the 3568 * Reading the PCI State register will confirm whether the
3569 * interrupt is ours and will flush the status block. 3569 * interrupt is ours and will flush the status block.
3570 */ 3570 */
3571 if ((sblk->status & SD_STATUS_UPDATED) || 3571 if (unlikely(!(sblk->status & SD_STATUS_UPDATED))) {
3572 !(tr32(TG3PCI_PCISTATE) & PCISTATE_INT_NOT_ACTIVE)) { 3572 if ((tp->tg3_flags & TG3_FLAG_CHIP_RESETTING) ||
3573 /* 3573 (tr32(TG3PCI_PCISTATE) & PCISTATE_INT_NOT_ACTIVE)) {
3574 * Writing any value to intr-mbox-0 clears PCI INTA# and 3574 handled = 0;
3575 * chip-internal interrupt pending events.
3576 * Writing non-zero to intr-mbox-0 additional tells the
3577 * NIC to stop sending us irqs, engaging "in-intr-handler"
3578 * event coalescing.
3579 */
3580 tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW,
3581 0x00000001);
3582 if (tg3_irq_sync(tp))
3583 goto out; 3575 goto out;
3584 sblk->status &= ~SD_STATUS_UPDATED;
3585 if (likely(tg3_has_work(tp))) {
3586 prefetch(&tp->rx_rcb[tp->rx_rcb_ptr]);
3587 netif_rx_schedule(dev); /* schedule NAPI poll */
3588 } else {
3589 /* No work, shared interrupt perhaps? re-enable
3590 * interrupts, and flush that PCI write
3591 */
3592 tw32_mailbox_f(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW,
3593 0x00000000);
3594 } 3576 }
3595 } else { /* shared interrupt */ 3577 }
3596 handled = 0; 3578
3579 /*
3580 * Writing any value to intr-mbox-0 clears PCI INTA# and
3581 * chip-internal interrupt pending events.
3582 * Writing non-zero to intr-mbox-0 additional tells the
3583 * NIC to stop sending us irqs, engaging "in-intr-handler"
3584 * event coalescing.
3585 */
3586 tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, 0x00000001);
3587 if (tg3_irq_sync(tp))
3588 goto out;
3589 sblk->status &= ~SD_STATUS_UPDATED;
3590 if (likely(tg3_has_work(tp))) {
3591 prefetch(&tp->rx_rcb[tp->rx_rcb_ptr]);
3592 netif_rx_schedule(dev); /* schedule NAPI poll */
3593 } else {
3594 /* No work, shared interrupt perhaps? re-enable
3595 * interrupts, and flush that PCI write
3596 */
3597 tw32_mailbox_f(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW,
3598 0x00000000);
3597 } 3599 }
3598out: 3600out:
3599 return IRQ_RETVAL(handled); 3601 return IRQ_RETVAL(handled);
@@ -3611,31 +3613,33 @@ static irqreturn_t tg3_interrupt_tagged(int irq, void *dev_id)
3611 * Reading the PCI State register will confirm whether the 3613 * Reading the PCI State register will confirm whether the
3612 * interrupt is ours and will flush the status block. 3614 * interrupt is ours and will flush the status block.
3613 */ 3615 */
3614 if ((sblk->status_tag != tp->last_tag) || 3616 if (unlikely(sblk->status_tag == tp->last_tag)) {
3615 !(tr32(TG3PCI_PCISTATE) & PCISTATE_INT_NOT_ACTIVE)) { 3617 if ((tp->tg3_flags & TG3_FLAG_CHIP_RESETTING) ||
3616 /* 3618 (tr32(TG3PCI_PCISTATE) & PCISTATE_INT_NOT_ACTIVE)) {
3617 * writing any value to intr-mbox-0 clears PCI INTA# and 3619 handled = 0;
3618 * chip-internal interrupt pending events.
3619 * writing non-zero to intr-mbox-0 additional tells the
3620 * NIC to stop sending us irqs, engaging "in-intr-handler"
3621 * event coalescing.
3622 */
3623 tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW,
3624 0x00000001);
3625 if (tg3_irq_sync(tp))
3626 goto out; 3620 goto out;
3627 if (netif_rx_schedule_prep(dev)) {
3628 prefetch(&tp->rx_rcb[tp->rx_rcb_ptr]);
3629 /* Update last_tag to mark that this status has been
3630 * seen. Because interrupt may be shared, we may be
3631 * racing with tg3_poll(), so only update last_tag
3632 * if tg3_poll() is not scheduled.
3633 */
3634 tp->last_tag = sblk->status_tag;
3635 __netif_rx_schedule(dev);
3636 } 3621 }
3637 } else { /* shared interrupt */ 3622 }
3638 handled = 0; 3623
3624 /*
3625 * writing any value to intr-mbox-0 clears PCI INTA# and
3626 * chip-internal interrupt pending events.
3627 * writing non-zero to intr-mbox-0 additional tells the
3628 * NIC to stop sending us irqs, engaging "in-intr-handler"
3629 * event coalescing.
3630 */
3631 tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, 0x00000001);
3632 if (tg3_irq_sync(tp))
3633 goto out;
3634 if (netif_rx_schedule_prep(dev)) {
3635 prefetch(&tp->rx_rcb[tp->rx_rcb_ptr]);
3636 /* Update last_tag to mark that this status has been
3637 * seen. Because interrupt may be shared, we may be
3638 * racing with tg3_poll(), so only update last_tag
3639 * if tg3_poll() is not scheduled.
3640 */
3641 tp->last_tag = sblk->status_tag;
3642 __netif_rx_schedule(dev);
3639 } 3643 }
3640out: 3644out:
3641 return IRQ_RETVAL(handled); 3645 return IRQ_RETVAL(handled);
@@ -4823,6 +4827,21 @@ static int tg3_chip_reset(struct tg3 *tp)
4823 if (write_op == tg3_write_flush_reg32) 4827 if (write_op == tg3_write_flush_reg32)
4824 tp->write32 = tg3_write32; 4828 tp->write32 = tg3_write32;
4825 4829
4830 /* Prevent the irq handler from reading or writing PCI registers
4831 * during chip reset when the memory enable bit in the PCI command
4832 * register may be cleared. The chip does not generate interrupt
4833 * at this time, but the irq handler may still be called due to irq
4834 * sharing or irqpoll.
4835 */
4836 tp->tg3_flags |= TG3_FLAG_CHIP_RESETTING;
4837 if (tp->hw_status) {
4838 tp->hw_status->status = 0;
4839 tp->hw_status->status_tag = 0;
4840 }
4841 tp->last_tag = 0;
4842 smp_mb();
4843 synchronize_irq(tp->pdev->irq);
4844
4826 /* do the reset */ 4845 /* do the reset */
4827 val = GRC_MISC_CFG_CORECLK_RESET; 4846 val = GRC_MISC_CFG_CORECLK_RESET;
4828 4847
@@ -4904,6 +4923,8 @@ static int tg3_chip_reset(struct tg3 *tp)
4904 4923
4905 pci_restore_state(tp->pdev); 4924 pci_restore_state(tp->pdev);
4906 4925
4926 tp->tg3_flags &= ~TG3_FLAG_CHIP_RESETTING;
4927
4907 /* Make sure PCI-X relaxed ordering bit is clear. */ 4928 /* Make sure PCI-X relaxed ordering bit is clear. */
4908 pci_read_config_dword(tp->pdev, TG3PCI_X_CAPS, &val); 4929 pci_read_config_dword(tp->pdev, TG3PCI_X_CAPS, &val);
4909 val &= ~PCIX_CAPS_RELAXED_ORDERING; 4930 val &= ~PCIX_CAPS_RELAXED_ORDERING;
@@ -6321,8 +6342,6 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
6321 RDMAC_MODE_ADDROFLOW_ENAB | RDMAC_MODE_FIFOOFLOW_ENAB | 6342 RDMAC_MODE_ADDROFLOW_ENAB | RDMAC_MODE_FIFOOFLOW_ENAB |
6322 RDMAC_MODE_FIFOURUN_ENAB | RDMAC_MODE_FIFOOREAD_ENAB | 6343 RDMAC_MODE_FIFOURUN_ENAB | RDMAC_MODE_FIFOOREAD_ENAB |
6323 RDMAC_MODE_LNGREAD_ENAB); 6344 RDMAC_MODE_LNGREAD_ENAB);
6324 if (tp->tg3_flags & TG3_FLAG_SPLIT_MODE)
6325 rdmac_mode |= RDMAC_MODE_SPLIT_ENABLE;
6326 6345
6327 /* If statement applies to 5705 and 5750 PCI devices only */ 6346 /* If statement applies to 5705 and 5750 PCI devices only */
6328 if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705 && 6347 if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705 &&
@@ -6495,9 +6514,6 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
6495 } else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) { 6514 } else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) {
6496 val &= ~(PCIX_CAPS_SPLIT_MASK | PCIX_CAPS_BURST_MASK); 6515 val &= ~(PCIX_CAPS_SPLIT_MASK | PCIX_CAPS_BURST_MASK);
6497 val |= (PCIX_CAPS_MAX_BURST_CPIOB << PCIX_CAPS_BURST_SHIFT); 6516 val |= (PCIX_CAPS_MAX_BURST_CPIOB << PCIX_CAPS_BURST_SHIFT);
6498 if (tp->tg3_flags & TG3_FLAG_SPLIT_MODE)
6499 val |= (tp->split_mode_max_reqs <<
6500 PCIX_CAPS_SPLIT_SHIFT);
6501 } 6517 }
6502 tw32(TG3PCI_X_CAPS, val); 6518 tw32(TG3PCI_X_CAPS, val);
6503 } 6519 }
@@ -10863,14 +10879,6 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
10863 grc_misc_cfg = tr32(GRC_MISC_CFG); 10879 grc_misc_cfg = tr32(GRC_MISC_CFG);
10864 grc_misc_cfg &= GRC_MISC_CFG_BOARD_ID_MASK; 10880 grc_misc_cfg &= GRC_MISC_CFG_BOARD_ID_MASK;
10865 10881
10866 /* Broadcom's driver says that CIOBE multisplit has a bug */
10867#if 0
10868 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704 &&
10869 grc_misc_cfg == GRC_MISC_CFG_BOARD_ID_5704CIOBE) {
10870 tp->tg3_flags |= TG3_FLAG_SPLIT_MODE;
10871 tp->split_mode_max_reqs = SPLIT_MODE_5704_MAX_REQ;
10872 }
10873#endif
10874 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705 && 10882 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705 &&
10875 (grc_misc_cfg == GRC_MISC_CFG_BOARD_ID_5788 || 10883 (grc_misc_cfg == GRC_MISC_CFG_BOARD_ID_5788 ||
10876 grc_misc_cfg == GRC_MISC_CFG_BOARD_ID_5788M)) 10884 grc_misc_cfg == GRC_MISC_CFG_BOARD_ID_5788M))
@@ -11968,14 +11976,12 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
11968 i == 5 ? '\n' : ':'); 11976 i == 5 ? '\n' : ':');
11969 11977
11970 printk(KERN_INFO "%s: RXcsums[%d] LinkChgREG[%d] " 11978 printk(KERN_INFO "%s: RXcsums[%d] LinkChgREG[%d] "
11971 "MIirq[%d] ASF[%d] Split[%d] WireSpeed[%d] " 11979 "MIirq[%d] ASF[%d] WireSpeed[%d] TSOcap[%d]\n",
11972 "TSOcap[%d] \n",
11973 dev->name, 11980 dev->name,
11974 (tp->tg3_flags & TG3_FLAG_RX_CHECKSUMS) != 0, 11981 (tp->tg3_flags & TG3_FLAG_RX_CHECKSUMS) != 0,
11975 (tp->tg3_flags & TG3_FLAG_USE_LINKCHG_REG) != 0, 11982 (tp->tg3_flags & TG3_FLAG_USE_LINKCHG_REG) != 0,
11976 (tp->tg3_flags & TG3_FLAG_USE_MI_INTERRUPT) != 0, 11983 (tp->tg3_flags & TG3_FLAG_USE_MI_INTERRUPT) != 0,
11977 (tp->tg3_flags & TG3_FLAG_ENABLE_ASF) != 0, 11984 (tp->tg3_flags & TG3_FLAG_ENABLE_ASF) != 0,
11978 (tp->tg3_flags & TG3_FLAG_SPLIT_MODE) != 0,
11979 (tp->tg3_flags2 & TG3_FLG2_NO_ETH_WIRE_SPEED) == 0, 11985 (tp->tg3_flags2 & TG3_FLG2_NO_ETH_WIRE_SPEED) == 0,
11980 (tp->tg3_flags2 & TG3_FLG2_TSO_CAPABLE) != 0); 11986 (tp->tg3_flags2 & TG3_FLG2_TSO_CAPABLE) != 0);
11981 printk(KERN_INFO "%s: dma_rwctrl[%08x] dma_mask[%d-bit]\n", 11987 printk(KERN_INFO "%s: dma_rwctrl[%08x] dma_mask[%d-bit]\n",
diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h
index 086892d8c1f1..d515ed23841b 100644
--- a/drivers/net/tg3.h
+++ b/drivers/net/tg3.h
@@ -2223,7 +2223,7 @@ struct tg3 {
2223#define TG3_FLAG_40BIT_DMA_BUG 0x08000000 2223#define TG3_FLAG_40BIT_DMA_BUG 0x08000000
2224#define TG3_FLAG_BROKEN_CHECKSUMS 0x10000000 2224#define TG3_FLAG_BROKEN_CHECKSUMS 0x10000000
2225#define TG3_FLAG_GOT_SERDES_FLOWCTL 0x20000000 2225#define TG3_FLAG_GOT_SERDES_FLOWCTL 0x20000000
2226#define TG3_FLAG_SPLIT_MODE 0x40000000 2226#define TG3_FLAG_CHIP_RESETTING 0x40000000
2227#define TG3_FLAG_INIT_COMPLETE 0x80000000 2227#define TG3_FLAG_INIT_COMPLETE 0x80000000
2228 u32 tg3_flags2; 2228 u32 tg3_flags2;
2229#define TG3_FLG2_RESTART_TIMER 0x00000001 2229#define TG3_FLG2_RESTART_TIMER 0x00000001
@@ -2262,9 +2262,6 @@ struct tg3 {
2262#define TG3_FLG2_NO_FWARE_REPORTED 0x40000000 2262#define TG3_FLG2_NO_FWARE_REPORTED 0x40000000
2263#define TG3_FLG2_PHY_ADJUST_TRIM 0x80000000 2263#define TG3_FLG2_PHY_ADJUST_TRIM 0x80000000
2264 2264
2265 u32 split_mode_max_reqs;
2266#define SPLIT_MODE_5704_MAX_REQ 3
2267
2268 struct timer_list timer; 2265 struct timer_list timer;
2269 u16 timer_counter; 2266 u16 timer_counter;
2270 u16 timer_multiplier; 2267 u16 timer_multiplier;
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index dab88b958d6e..639e1e6913bf 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -3607,7 +3607,6 @@ static int ucc_geth_start_xmit(struct sk_buff *skb, struct net_device *dev)
3607 if (bd == ugeth->confBd[txQ]) { 3607 if (bd == ugeth->confBd[txQ]) {
3608 if (!netif_queue_stopped(dev)) 3608 if (!netif_queue_stopped(dev))
3609 netif_stop_queue(dev); 3609 netif_stop_queue(dev);
3610 return NETDEV_TX_BUSY;
3611 } 3610 }
3612 3611
3613 ugeth->txBd[txQ] = bd; 3612 ugeth->txBd[txQ] = bd;
@@ -3623,7 +3622,7 @@ static int ucc_geth_start_xmit(struct sk_buff *skb, struct net_device *dev)
3623 3622
3624 spin_unlock_irq(&ugeth->lock); 3623 spin_unlock_irq(&ugeth->lock);
3625 3624
3626 return NETDEV_TX_OK; 3625 return 0;
3627} 3626}
3628 3627
3629static int ucc_geth_rx(struct ucc_geth_private *ugeth, u8 rxQ, int rx_work_limit) 3628static int ucc_geth_rx(struct ucc_geth_private *ugeth, u8 rxQ, int rx_work_limit)
diff --git a/drivers/net/wan/lmc/lmc_media.h b/drivers/net/wan/lmc/lmc_media.h
deleted file mode 100644
index ddcc00403563..000000000000
--- a/drivers/net/wan/lmc/lmc_media.h
+++ /dev/null
@@ -1,65 +0,0 @@
1#ifndef _LMC_MEDIA_H_
2#define _LMC_MEDIA_H_
3
4lmc_media_t lmc_ds3_media = {
5 lmc_ds3_init, /* special media init stuff */
6 lmc_ds3_default, /* reset to default state */
7 lmc_ds3_set_status, /* reset status to state provided */
8 lmc_dummy_set_1, /* set clock source */
9 lmc_dummy_set2_1, /* set line speed */
10 lmc_ds3_set_100ft, /* set cable length */
11 lmc_ds3_set_scram, /* set scrambler */
12 lmc_ds3_get_link_status, /* get link status */
13 lmc_dummy_set_1, /* set link status */
14 lmc_ds3_set_crc_length, /* set CRC length */
15 lmc_dummy_set_1, /* set T1 or E1 circuit type */
16 lmc_ds3_watchdog
17};
18
19lmc_media_t lmc_hssi_media = {
20 lmc_hssi_init, /* special media init stuff */
21 lmc_hssi_default, /* reset to default state */
22 lmc_hssi_set_status, /* reset status to state provided */
23 lmc_hssi_set_clock, /* set clock source */
24 lmc_dummy_set2_1, /* set line speed */
25 lmc_dummy_set_1, /* set cable length */
26 lmc_dummy_set_1, /* set scrambler */
27 lmc_hssi_get_link_status, /* get link status */
28 lmc_hssi_set_link_status, /* set link status */
29 lmc_hssi_set_crc_length, /* set CRC length */
30 lmc_dummy_set_1, /* set T1 or E1 circuit type */
31 lmc_hssi_watchdog
32};
33
34lmc_media_t lmc_ssi_media = { lmc_ssi_init, /* special media init stuff */
35 lmc_ssi_default, /* reset to default state */
36 lmc_ssi_set_status, /* reset status to state provided */
37 lmc_ssi_set_clock, /* set clock source */
38 lmc_ssi_set_speed, /* set line speed */
39 lmc_dummy_set_1, /* set cable length */
40 lmc_dummy_set_1, /* set scrambler */
41 lmc_ssi_get_link_status, /* get link status */
42 lmc_ssi_set_link_status, /* set link status */
43 lmc_ssi_set_crc_length, /* set CRC length */
44 lmc_dummy_set_1, /* set T1 or E1 circuit type */
45 lmc_ssi_watchdog
46};
47
48lmc_media_t lmc_t1_media = {
49 lmc_t1_init, /* special media init stuff */
50 lmc_t1_default, /* reset to default state */
51 lmc_t1_set_status, /* reset status to state provided */
52 lmc_t1_set_clock, /* set clock source */
53 lmc_dummy_set2_1, /* set line speed */
54 lmc_dummy_set_1, /* set cable length */
55 lmc_dummy_set_1, /* set scrambler */
56 lmc_t1_get_link_status, /* get link status */
57 lmc_dummy_set_1, /* set link status */
58 lmc_t1_set_crc_length, /* set CRC length */
59 lmc_t1_set_circuit_type, /* set T1 or E1 circuit type */
60 lmc_t1_watchdog
61};
62
63
64#endif
65
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c
index a8c2bfe26c27..2ada76a93cb6 100644
--- a/drivers/net/wireless/airo.c
+++ b/drivers/net/wireless/airo.c
@@ -2852,7 +2852,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port,
2852 if (rc) { 2852 if (rc) {
2853 airo_print_err(dev->name, "register interrupt %d failed, rc %d", 2853 airo_print_err(dev->name, "register interrupt %d failed, rc %d",
2854 irq, rc); 2854 irq, rc);
2855 goto err_out_unlink; 2855 goto err_out_nets;
2856 } 2856 }
2857 if (!is_pcmcia) { 2857 if (!is_pcmcia) {
2858 if (!request_region( dev->base_addr, 64, dev->name )) { 2858 if (!request_region( dev->base_addr, 64, dev->name )) {
@@ -2935,6 +2935,8 @@ err_out_res:
2935 release_region( dev->base_addr, 64 ); 2935 release_region( dev->base_addr, 64 );
2936err_out_irq: 2936err_out_irq:
2937 free_irq(dev->irq, dev); 2937 free_irq(dev->irq, dev);
2938err_out_nets:
2939 airo_networks_free(ai);
2938err_out_unlink: 2940err_out_unlink:
2939 del_airo_dev(dev); 2941 del_airo_dev(dev);
2940err_out_thr: 2942err_out_thr:
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_phy.c b/drivers/net/wireless/bcm43xx/bcm43xx_phy.c
index cae89258a640..d1e89be965cd 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx_phy.c
+++ b/drivers/net/wireless/bcm43xx/bcm43xx_phy.c
@@ -757,7 +757,7 @@ static void bcm43xx_phy_initb5(struct bcm43xx_private *bcm)
757 if (radio->version == 0x2050) 757 if (radio->version == 0x2050)
758 bcm43xx_phy_write(bcm, 0x0038, 0x0667); 758 bcm43xx_phy_write(bcm, 0x0038, 0x0667);
759 759
760 if (phy->type == BCM43xx_PHYTYPE_G) { 760 if (phy->connected) {
761 if (radio->version == 0x2050) { 761 if (radio->version == 0x2050) {
762 bcm43xx_radio_write16(bcm, 0x007A, 762 bcm43xx_radio_write16(bcm, 0x007A,
763 bcm43xx_radio_read16(bcm, 0x007A) 763 bcm43xx_radio_read16(bcm, 0x007A)
@@ -1192,7 +1192,7 @@ static void bcm43xx_phy_initg(struct bcm43xx_private *bcm)
1192 bcm43xx_phy_write(bcm, 0x0811, 0x0400); 1192 bcm43xx_phy_write(bcm, 0x0811, 0x0400);
1193 bcm43xx_phy_write(bcm, 0x0015, 0x00C0); 1193 bcm43xx_phy_write(bcm, 0x0015, 0x00C0);
1194 } 1194 }
1195 if (phy->connected) { 1195 if (phy->rev >= 2 && phy->connected) {
1196 tmp = bcm43xx_phy_read(bcm, 0x0400) & 0xFF; 1196 tmp = bcm43xx_phy_read(bcm, 0x0400) & 0xFF;
1197 if (tmp < 6) { 1197 if (tmp < 6) {
1198 bcm43xx_phy_write(bcm, 0x04C2, 0x1816); 1198 bcm43xx_phy_write(bcm, 0x04C2, 0x1816);
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_radio.c b/drivers/net/wireless/bcm43xx/bcm43xx_radio.c
index 32beb91b7164..4025dd0089d2 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx_radio.c
+++ b/drivers/net/wireless/bcm43xx/bcm43xx_radio.c
@@ -458,7 +458,7 @@ static void bcm43xx_calc_nrssi_offset(struct bcm43xx_private *bcm)
458 bcm43xx_phy_write(bcm, 0x005A, 0x0480); 458 bcm43xx_phy_write(bcm, 0x005A, 0x0480);
459 bcm43xx_phy_write(bcm, 0x0059, 0x0810); 459 bcm43xx_phy_write(bcm, 0x0059, 0x0810);
460 bcm43xx_phy_write(bcm, 0x0058, 0x000D); 460 bcm43xx_phy_write(bcm, 0x0058, 0x000D);
461 if (phy->rev == 0) { 461 if (phy->analog == 0) {
462 bcm43xx_phy_write(bcm, 0x0003, 0x0122); 462 bcm43xx_phy_write(bcm, 0x0003, 0x0122);
463 } else { 463 } else {
464 bcm43xx_phy_write(bcm, 0x000A, 464 bcm43xx_phy_write(bcm, 0x000A,
@@ -570,9 +570,9 @@ void bcm43xx_calc_nrssi_slope(struct bcm43xx_private *bcm)
570 nrssi0 = (s16)bcm43xx_phy_read(bcm, 0x0027); 570 nrssi0 = (s16)bcm43xx_phy_read(bcm, 0x0027);
571 bcm43xx_radio_write16(bcm, 0x007A, 571 bcm43xx_radio_write16(bcm, 0x007A,
572 bcm43xx_radio_read16(bcm, 0x007A) & 0x007F); 572 bcm43xx_radio_read16(bcm, 0x007A) & 0x007F);
573 if (phy->rev >= 2) { 573 if (phy->analog >= 2) {
574 bcm43xx_write16(bcm, 0x03E6, 0x0040); 574 bcm43xx_write16(bcm, 0x03E6, 0x0040);
575 } else if (phy->rev == 0) { 575 } else if (phy->analog == 0) {
576 bcm43xx_write16(bcm, 0x03E6, 0x0122); 576 bcm43xx_write16(bcm, 0x03E6, 0x0122);
577 } else { 577 } else {
578 bcm43xx_write16(bcm, BCM43xx_MMIO_CHANNEL_EXT, 578 bcm43xx_write16(bcm, BCM43xx_MMIO_CHANNEL_EXT,
@@ -596,7 +596,7 @@ void bcm43xx_calc_nrssi_slope(struct bcm43xx_private *bcm)
596 bcm43xx_phy_write(bcm, 0x0015, backup[5]); 596 bcm43xx_phy_write(bcm, 0x0015, backup[5]);
597 bcm43xx_phy_write(bcm, 0x002A, backup[6]); 597 bcm43xx_phy_write(bcm, 0x002A, backup[6]);
598 bcm43xx_synth_pu_workaround(bcm, radio->channel); 598 bcm43xx_synth_pu_workaround(bcm, radio->channel);
599 if (phy->rev != 0) 599 if (phy->analog != 0)
600 bcm43xx_write16(bcm, 0x03F4, backup[13]); 600 bcm43xx_write16(bcm, 0x03F4, backup[13]);
601 601
602 bcm43xx_phy_write(bcm, 0x0020, backup[7]); 602 bcm43xx_phy_write(bcm, 0x0020, backup[7]);
@@ -692,7 +692,7 @@ void bcm43xx_calc_nrssi_slope(struct bcm43xx_private *bcm)
692 692
693 bcm43xx_radio_write16(bcm, 0x007A, 693 bcm43xx_radio_write16(bcm, 0x007A,
694 bcm43xx_radio_read16(bcm, 0x007A) & 0x007F); 694 bcm43xx_radio_read16(bcm, 0x007A) & 0x007F);
695 if (phy->rev >= 2) { 695 if (phy->analog >= 2) {
696 bcm43xx_phy_write(bcm, 0x0003, 696 bcm43xx_phy_write(bcm, 0x0003,
697 (bcm43xx_phy_read(bcm, 0x0003) 697 (bcm43xx_phy_read(bcm, 0x0003)
698 & 0xFF9F) | 0x0040); 698 & 0xFF9F) | 0x0040);
@@ -882,10 +882,10 @@ static void _stack_save(u32 *_stackptr, size_t *stackidx,
882{ 882{
883 u32 *stackptr = &(_stackptr[*stackidx]); 883 u32 *stackptr = &(_stackptr[*stackidx]);
884 884
885 assert((offset & 0xF000) == 0x0000); 885 assert((offset & 0xE000) == 0x0000);
886 assert((id & 0xF0) == 0x00); 886 assert((id & 0xF8) == 0x00);
887 *stackptr = offset; 887 *stackptr = offset;
888 *stackptr |= ((u32)id) << 12; 888 *stackptr |= ((u32)id) << 13;
889 *stackptr |= ((u32)value) << 16; 889 *stackptr |= ((u32)value) << 16;
890 (*stackidx)++; 890 (*stackidx)++;
891 assert(*stackidx < BCM43xx_INTERFSTACK_SIZE); 891 assert(*stackidx < BCM43xx_INTERFSTACK_SIZE);
@@ -896,12 +896,12 @@ static u16 _stack_restore(u32 *stackptr,
896{ 896{
897 size_t i; 897 size_t i;
898 898
899 assert((offset & 0xF000) == 0x0000); 899 assert((offset & 0xE000) == 0x0000);
900 assert((id & 0xF0) == 0x00); 900 assert((id & 0xF8) == 0x00);
901 for (i = 0; i < BCM43xx_INTERFSTACK_SIZE; i++, stackptr++) { 901 for (i = 0; i < BCM43xx_INTERFSTACK_SIZE; i++, stackptr++) {
902 if ((*stackptr & 0x00000FFF) != offset) 902 if ((*stackptr & 0x00001FFF) != offset)
903 continue; 903 continue;
904 if (((*stackptr & 0x0000F000) >> 12) != id) 904 if (((*stackptr & 0x00007000) >> 13) != id)
905 continue; 905 continue;
906 return ((*stackptr & 0xFFFF0000) >> 16); 906 return ((*stackptr & 0xFFFF0000) >> 16);
907 } 907 }
@@ -1579,7 +1579,7 @@ void bcm43xx_radio_set_tx_iq(struct bcm43xx_private *bcm)
1579 1579
1580 for (i = 0; i < 5; i++) { 1580 for (i = 0; i < 5; i++) {
1581 for (j = 0; j < 5; j++) { 1581 for (j = 0; j < 5; j++) {
1582 if (tmp == (data_high[i] << 4 | data_low[j])) { 1582 if (tmp == (data_high[i] | data_low[j])) {
1583 bcm43xx_phy_write(bcm, 0x0069, (i - j) << 8 | 0x00C0); 1583 bcm43xx_phy_write(bcm, 0x0069, (i - j) << 8 | 0x00C0);
1584 return; 1584 return;
1585 } 1585 }
diff --git a/drivers/oprofile/event_buffer.c b/drivers/oprofile/event_buffer.c
index 00e937e9240e..e7fbac529935 100644
--- a/drivers/oprofile/event_buffer.c
+++ b/drivers/oprofile/event_buffer.c
@@ -70,11 +70,12 @@ void wake_up_buffer_waiter(void)
70int alloc_event_buffer(void) 70int alloc_event_buffer(void)
71{ 71{
72 int err = -ENOMEM; 72 int err = -ENOMEM;
73 unsigned long flags;
73 74
74 spin_lock(&oprofilefs_lock); 75 spin_lock_irqsave(&oprofilefs_lock, flags);
75 buffer_size = fs_buffer_size; 76 buffer_size = fs_buffer_size;
76 buffer_watershed = fs_buffer_watershed; 77 buffer_watershed = fs_buffer_watershed;
77 spin_unlock(&oprofilefs_lock); 78 spin_unlock_irqrestore(&oprofilefs_lock, flags);
78 79
79 if (buffer_watershed >= buffer_size) 80 if (buffer_watershed >= buffer_size)
80 return -EINVAL; 81 return -EINVAL;
diff --git a/drivers/oprofile/oprofilefs.c b/drivers/oprofile/oprofilefs.c
index 6e67b42ca46d..8543cb26cf34 100644
--- a/drivers/oprofile/oprofilefs.c
+++ b/drivers/oprofile/oprofilefs.c
@@ -65,6 +65,7 @@ ssize_t oprofilefs_ulong_to_user(unsigned long val, char __user * buf, size_t co
65int oprofilefs_ulong_from_user(unsigned long * val, char const __user * buf, size_t count) 65int oprofilefs_ulong_from_user(unsigned long * val, char const __user * buf, size_t count)
66{ 66{
67 char tmpbuf[TMPBUFSIZE]; 67 char tmpbuf[TMPBUFSIZE];
68 unsigned long flags;
68 69
69 if (!count) 70 if (!count)
70 return 0; 71 return 0;
@@ -77,9 +78,9 @@ int oprofilefs_ulong_from_user(unsigned long * val, char const __user * buf, siz
77 if (copy_from_user(tmpbuf, buf, count)) 78 if (copy_from_user(tmpbuf, buf, count))
78 return -EFAULT; 79 return -EFAULT;
79 80
80 spin_lock(&oprofilefs_lock); 81 spin_lock_irqsave(&oprofilefs_lock, flags);
81 *val = simple_strtoul(tmpbuf, NULL, 0); 82 *val = simple_strtoul(tmpbuf, NULL, 0);
82 spin_unlock(&oprofilefs_lock); 83 spin_unlock_irqrestore(&oprofilefs_lock, flags);
83 return 0; 84 return 0;
84} 85}
85 86
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index ad33e0159514..435c1958a7b7 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -94,6 +94,7 @@ static void msi_set_mask_bit(unsigned int irq, int flag)
94 int offset = entry->msi_attrib.entry_nr * PCI_MSIX_ENTRY_SIZE + 94 int offset = entry->msi_attrib.entry_nr * PCI_MSIX_ENTRY_SIZE +
95 PCI_MSIX_ENTRY_VECTOR_CTRL_OFFSET; 95 PCI_MSIX_ENTRY_VECTOR_CTRL_OFFSET;
96 writel(flag, entry->mask_base + offset); 96 writel(flag, entry->mask_base + offset);
97 readl(entry->mask_base + offset);
97 break; 98 break;
98 } 99 }
99 default: 100 default:
diff --git a/drivers/pci/pcie/portdrv_pci.c b/drivers/pci/pcie/portdrv_pci.c
index 0be5a0b30725..df383645e366 100644
--- a/drivers/pci/pcie/portdrv_pci.c
+++ b/drivers/pci/pcie/portdrv_pci.c
@@ -93,7 +93,7 @@ static int __devinit pcie_portdrv_probe (struct pci_dev *dev,
93 if (!dev->irq && dev->pin) { 93 if (!dev->irq && dev->pin) {
94 printk(KERN_WARNING 94 printk(KERN_WARNING
95 "%s->Dev[%04x:%04x] has invalid IRQ. Check vendor BIOS\n", 95 "%s->Dev[%04x:%04x] has invalid IRQ. Check vendor BIOS\n",
96 __FUNCTION__, dev->device, dev->vendor); 96 __FUNCTION__, dev->vendor, dev->device);
97 } 97 }
98 if (pcie_port_device_register(dev)) { 98 if (pcie_port_device_register(dev)) {
99 pci_disable_device(dev); 99 pci_disable_device(dev);
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 7f94fc098cd3..65d6f23ead41 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -963,6 +963,13 @@ DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8237, k8t_sound_ho
963 * bridge. Unfortunately, this device has no subvendor/subdevice ID. So it 963 * bridge. Unfortunately, this device has no subvendor/subdevice ID. So it
964 * becomes necessary to do this tweak in two steps -- I've chosen the Host 964 * becomes necessary to do this tweak in two steps -- I've chosen the Host
965 * bridge as trigger. 965 * bridge as trigger.
966 *
967 * Note that we used to unhide the SMBus that way on Toshiba laptops
968 * (Satellite A40 and Tecra M2) but then found that the thermal management
969 * was done by SMM code, which could cause unsynchronized concurrent
970 * accesses to the SMBus registers, with potentially bad effects. Thus you
971 * should be very careful when adding new entries: if SMM is accessing the
972 * Intel SMBus, this is a very good reason to leave it hidden.
966 */ 973 */
967static int asus_hides_smbus; 974static int asus_hides_smbus;
968 975
@@ -1040,17 +1047,6 @@ static void __init asus_hides_smbus_hostbridge(struct pci_dev *dev)
1040 case 0x099c: /* HP Compaq nx6110 */ 1047 case 0x099c: /* HP Compaq nx6110 */
1041 asus_hides_smbus = 1; 1048 asus_hides_smbus = 1;
1042 } 1049 }
1043 } else if (unlikely(dev->subsystem_vendor == PCI_VENDOR_ID_TOSHIBA)) {
1044 if (dev->device == PCI_DEVICE_ID_INTEL_82855GM_HB)
1045 switch(dev->subsystem_device) {
1046 case 0x0001: /* Toshiba Satellite A40 */
1047 asus_hides_smbus = 1;
1048 }
1049 else if (dev->device == PCI_DEVICE_ID_INTEL_82855PM_HB)
1050 switch(dev->subsystem_device) {
1051 case 0x0001: /* Toshiba Tecra M2 */
1052 asus_hides_smbus = 1;
1053 }
1054 } else if (unlikely(dev->subsystem_vendor == PCI_VENDOR_ID_SAMSUNG)) { 1050 } else if (unlikely(dev->subsystem_vendor == PCI_VENDOR_ID_SAMSUNG)) {
1055 if (dev->device == PCI_DEVICE_ID_INTEL_82855PM_HB) 1051 if (dev->device == PCI_DEVICE_ID_INTEL_82855PM_HB)
1056 switch(dev->subsystem_device) { 1052 switch(dev->subsystem_device) {
diff --git a/drivers/pcmcia/au1000_generic.c b/drivers/pcmcia/au1000_generic.c
index 551bde5d9430..b693367d38cd 100644
--- a/drivers/pcmcia/au1000_generic.c
+++ b/drivers/pcmcia/au1000_generic.c
@@ -372,7 +372,7 @@ int au1x00_pcmcia_socket_probe(struct device *dev, struct pcmcia_low_level *ops,
372 skt->socket.resource_ops = &pccard_static_ops; 372 skt->socket.resource_ops = &pccard_static_ops;
373 skt->socket.ops = &au1x00_pcmcia_operations; 373 skt->socket.ops = &au1x00_pcmcia_operations;
374 skt->socket.owner = ops->owner; 374 skt->socket.owner = ops->owner;
375 skt->socket.dev.dev = dev; 375 skt->socket.dev.parent = dev;
376 376
377 init_timer(&skt->poll_timer); 377 init_timer(&skt->poll_timer);
378 skt->poll_timer.function = au1x00_pcmcia_poll_event; 378 skt->poll_timer.function = au1x00_pcmcia_poll_event;
diff --git a/drivers/pcmcia/omap_cf.c b/drivers/pcmcia/omap_cf.c
index d77f75129f8a..2df216b00817 100644
--- a/drivers/pcmcia/omap_cf.c
+++ b/drivers/pcmcia/omap_cf.c
@@ -202,15 +202,14 @@ static struct pccard_operations omap_cf_ops = {
202 * "what chipselect is used". Boards could want more. 202 * "what chipselect is used". Boards could want more.
203 */ 203 */
204 204
205static int __devinit omap_cf_probe(struct device *dev) 205static int __init omap_cf_probe(struct platform_device *pdev)
206{ 206{
207 unsigned seg; 207 unsigned seg;
208 struct omap_cf_socket *cf; 208 struct omap_cf_socket *cf;
209 struct platform_device *pdev = to_platform_device(dev);
210 int irq; 209 int irq;
211 int status; 210 int status;
212 211
213 seg = (int) dev->platform_data; 212 seg = (int) pdev->dev.platform_data;
214 if (seg == 0 || seg > 3) 213 if (seg == 0 || seg > 3)
215 return -ENODEV; 214 return -ENODEV;
216 215
@@ -227,7 +226,7 @@ static int __devinit omap_cf_probe(struct device *dev)
227 cf->timer.data = (unsigned long) cf; 226 cf->timer.data = (unsigned long) cf;
228 227
229 cf->pdev = pdev; 228 cf->pdev = pdev;
230 dev_set_drvdata(dev, cf); 229 platform_set_drvdata(pdev, cf);
231 230
232 /* this primarily just shuts up irq handling noise */ 231 /* this primarily just shuts up irq handling noise */
233 status = request_irq(irq, omap_cf_irq, IRQF_SHARED, 232 status = request_irq(irq, omap_cf_irq, IRQF_SHARED,
@@ -291,7 +290,7 @@ static int __devinit omap_cf_probe(struct device *dev)
291 omap_cf_present() ? "present" : "(not present)"); 290 omap_cf_present() ? "present" : "(not present)");
292 291
293 cf->socket.owner = THIS_MODULE; 292 cf->socket.owner = THIS_MODULE;
294 cf->socket.dev.parent = dev; 293 cf->socket.dev.parent = &pdev->dev;
295 cf->socket.ops = &omap_cf_ops; 294 cf->socket.ops = &omap_cf_ops;
296 cf->socket.resource_ops = &pccard_static_ops; 295 cf->socket.resource_ops = &pccard_static_ops;
297 cf->socket.features = SS_CAP_PCCARD | SS_CAP_STATIC_MAP 296 cf->socket.features = SS_CAP_PCCARD | SS_CAP_STATIC_MAP
@@ -318,9 +317,9 @@ fail0:
318 return status; 317 return status;
319} 318}
320 319
321static int __devexit omap_cf_remove(struct device *dev) 320static int __exit omap_cf_remove(struct platform_device *pdev)
322{ 321{
323 struct omap_cf_socket *cf = dev_get_drvdata(dev); 322 struct omap_cf_socket *cf = platform_get_drvdata(pdev);
324 323
325 cf->active = 0; 324 cf->active = 0;
326 pcmcia_unregister_socket(&cf->socket); 325 pcmcia_unregister_socket(&cf->socket);
@@ -332,26 +331,36 @@ static int __devexit omap_cf_remove(struct device *dev)
332 return 0; 331 return 0;
333} 332}
334 333
335static struct device_driver omap_cf_driver = { 334static int omap_cf_suspend(struct platform_device *pdev, pm_message_t mesg)
336 .name = (char *) driver_name, 335{
337 .bus = &platform_bus_type, 336 return pcmcia_socket_dev_suspend(&pdev->dev, mesg);
338 .probe = omap_cf_probe, 337}
339 .remove = __devexit_p(omap_cf_remove), 338
340 .suspend = pcmcia_socket_dev_suspend, 339static int omap_cf_resume(struct platform_device *pdev)
341 .resume = pcmcia_socket_dev_resume, 340{
341 return pcmcia_socket_dev_resume(&pdev->dev);
342}
343
344static struct platform_driver omap_cf_driver = {
345 .driver = {
346 .name = (char *) driver_name,
347 },
348 .remove = __exit_p(omap_cf_remove),
349 .suspend = omap_cf_suspend,
350 .resume = omap_cf_resume,
342}; 351};
343 352
344static int __init omap_cf_init(void) 353static int __init omap_cf_init(void)
345{ 354{
346 if (cpu_is_omap16xx()) 355 if (cpu_is_omap16xx())
347 return driver_register(&omap_cf_driver); 356 return platform_driver_probe(&omap_cf_driver, omap_cf_probe);
348 return -ENODEV; 357 return -ENODEV;
349} 358}
350 359
351static void __exit omap_cf_exit(void) 360static void __exit omap_cf_exit(void)
352{ 361{
353 if (cpu_is_omap16xx()) 362 if (cpu_is_omap16xx())
354 driver_unregister(&omap_cf_driver); 363 platform_driver_unregister(&omap_cf_driver);
355} 364}
356 365
357module_init(omap_cf_init); 366module_init(omap_cf_init);
diff --git a/drivers/pnp/system.c b/drivers/pnp/system.c
index 2065e74bb63f..a8a95540b1ef 100644
--- a/drivers/pnp/system.c
+++ b/drivers/pnp/system.c
@@ -22,7 +22,7 @@ static const struct pnp_device_id pnp_dev_table[] = {
22 { "", 0 } 22 { "", 0 }
23}; 23};
24 24
25static void reserve_range(char *pnpid, int start, int end, int port) 25static void reserve_range(const char *pnpid, resource_size_t start, resource_size_t end, int port)
26{ 26{
27 struct resource *res; 27 struct resource *res;
28 char *regionid; 28 char *regionid;
@@ -32,9 +32,9 @@ static void reserve_range(char *pnpid, int start, int end, int port)
32 return; 32 return;
33 snprintf(regionid, 16, "pnp %s", pnpid); 33 snprintf(regionid, 16, "pnp %s", pnpid);
34 if (port) 34 if (port)
35 res = request_region(start,end-start+1,regionid); 35 res = request_region(start, end-start+1, regionid);
36 else 36 else
37 res = request_mem_region(start,end-start+1,regionid); 37 res = request_mem_region(start, end-start+1, regionid);
38 if (res == NULL) 38 if (res == NULL)
39 kfree(regionid); 39 kfree(regionid);
40 else 40 else
@@ -45,12 +45,13 @@ static void reserve_range(char *pnpid, int start, int end, int port)
45 * have double reservations. 45 * have double reservations.
46 */ 46 */
47 printk(KERN_INFO 47 printk(KERN_INFO
48 "pnp: %s: %s range 0x%x-0x%x %s reserved\n", 48 "pnp: %s: %s range 0x%llx-0x%llx %s reserved\n",
49 pnpid, port ? "ioport" : "iomem", start, end, 49 pnpid, port ? "ioport" : "iomem",
50 (unsigned long long)start, (unsigned long long)end,
50 NULL != res ? "has been" : "could not be"); 51 NULL != res ? "has been" : "could not be");
51} 52}
52 53
53static void reserve_resources_of_dev(struct pnp_dev *dev) 54static void reserve_resources_of_dev(const struct pnp_dev *dev)
54{ 55{
55 int i; 56 int i;
56 57
diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c
index 85bf795abdcc..7c0d60910077 100644
--- a/drivers/rtc/rtc-cmos.c
+++ b/drivers/rtc/rtc-cmos.c
@@ -59,6 +59,19 @@ struct cmos_rtc {
59 59
60static const char driver_name[] = "rtc_cmos"; 60static const char driver_name[] = "rtc_cmos";
61 61
62/* The RTC_INTR register may have e.g. RTC_PF set even if RTC_PIE is clear;
63 * always mask it against the irq enable bits in RTC_CONTROL. Bit values
64 * are the same: PF==PIE, AF=AIE, UF=UIE; so RTC_IRQMASK works with both.
65 */
66#define RTC_IRQMASK (RTC_PF | RTC_AF | RTC_UF)
67
68static inline int is_intr(u8 rtc_intr)
69{
70 if (!(rtc_intr & RTC_IRQF))
71 return 0;
72 return rtc_intr & RTC_IRQMASK;
73}
74
62/*----------------------------------------------------------------*/ 75/*----------------------------------------------------------------*/
63 76
64static int cmos_read_time(struct device *dev, struct rtc_time *t) 77static int cmos_read_time(struct device *dev, struct rtc_time *t)
@@ -188,7 +201,8 @@ static int cmos_set_alarm(struct device *dev, struct rtc_wkalrm *t)
188 rtc_control &= ~RTC_AIE; 201 rtc_control &= ~RTC_AIE;
189 CMOS_WRITE(rtc_control, RTC_CONTROL); 202 CMOS_WRITE(rtc_control, RTC_CONTROL);
190 rtc_intr = CMOS_READ(RTC_INTR_FLAGS); 203 rtc_intr = CMOS_READ(RTC_INTR_FLAGS);
191 if (rtc_intr) 204 rtc_intr &= (rtc_control & RTC_IRQMASK) | RTC_IRQF;
205 if (is_intr(rtc_intr))
192 rtc_update_irq(&cmos->rtc->class_dev, 1, rtc_intr); 206 rtc_update_irq(&cmos->rtc->class_dev, 1, rtc_intr);
193 207
194 /* update alarm */ 208 /* update alarm */
@@ -207,7 +221,8 @@ static int cmos_set_alarm(struct device *dev, struct rtc_wkalrm *t)
207 rtc_control |= RTC_AIE; 221 rtc_control |= RTC_AIE;
208 CMOS_WRITE(rtc_control, RTC_CONTROL); 222 CMOS_WRITE(rtc_control, RTC_CONTROL);
209 rtc_intr = CMOS_READ(RTC_INTR_FLAGS); 223 rtc_intr = CMOS_READ(RTC_INTR_FLAGS);
210 if (rtc_intr) 224 rtc_intr &= (rtc_control & RTC_IRQMASK) | RTC_IRQF;
225 if (is_intr(rtc_intr))
211 rtc_update_irq(&cmos->rtc->class_dev, 1, rtc_intr); 226 rtc_update_irq(&cmos->rtc->class_dev, 1, rtc_intr);
212 } 227 }
213 228
@@ -287,7 +302,8 @@ cmos_rtc_ioctl(struct device *dev, unsigned int cmd, unsigned long arg)
287 } 302 }
288 CMOS_WRITE(rtc_control, RTC_CONTROL); 303 CMOS_WRITE(rtc_control, RTC_CONTROL);
289 rtc_intr = CMOS_READ(RTC_INTR_FLAGS); 304 rtc_intr = CMOS_READ(RTC_INTR_FLAGS);
290 if (rtc_intr) 305 rtc_intr &= (rtc_control & RTC_IRQMASK) | RTC_IRQF;
306 if (is_intr(rtc_intr))
291 rtc_update_irq(&cmos->rtc->class_dev, 1, rtc_intr); 307 rtc_update_irq(&cmos->rtc->class_dev, 1, rtc_intr);
292 spin_unlock_irqrestore(&rtc_lock, flags); 308 spin_unlock_irqrestore(&rtc_lock, flags);
293 return 0; 309 return 0;
@@ -353,12 +369,10 @@ static irqreturn_t cmos_interrupt(int irq, void *p)
353 369
354 spin_lock(&rtc_lock); 370 spin_lock(&rtc_lock);
355 irqstat = CMOS_READ(RTC_INTR_FLAGS); 371 irqstat = CMOS_READ(RTC_INTR_FLAGS);
372 irqstat &= (CMOS_READ(RTC_CONTROL) & RTC_IRQMASK) | RTC_IRQF;
356 spin_unlock(&rtc_lock); 373 spin_unlock(&rtc_lock);
357 374
358 if (irqstat) { 375 if (is_intr(irqstat)) {
359 /* NOTE: irqstat may have e.g. RTC_PF set
360 * even when RTC_PIE is clear...
361 */
362 rtc_update_irq(p, 1, irqstat); 376 rtc_update_irq(p, 1, irqstat);
363 return IRQ_HANDLED; 377 return IRQ_HANDLED;
364 } else 378 } else
@@ -525,25 +539,26 @@ static int cmos_suspend(struct device *dev, pm_message_t mesg)
525{ 539{
526 struct cmos_rtc *cmos = dev_get_drvdata(dev); 540 struct cmos_rtc *cmos = dev_get_drvdata(dev);
527 int do_wake = device_may_wakeup(dev); 541 int do_wake = device_may_wakeup(dev);
528 unsigned char tmp, irqstat; 542 unsigned char tmp;
529 543
530 /* only the alarm might be a wakeup event source */ 544 /* only the alarm might be a wakeup event source */
531 spin_lock_irq(&rtc_lock); 545 spin_lock_irq(&rtc_lock);
532 cmos->suspend_ctrl = tmp = CMOS_READ(RTC_CONTROL); 546 cmos->suspend_ctrl = tmp = CMOS_READ(RTC_CONTROL);
533 if (tmp & (RTC_PIE|RTC_AIE|RTC_UIE)) { 547 if (tmp & (RTC_PIE|RTC_AIE|RTC_UIE)) {
548 unsigned char irqstat;
549
534 if (do_wake) 550 if (do_wake)
535 tmp &= ~(RTC_PIE|RTC_UIE); 551 tmp &= ~(RTC_PIE|RTC_UIE);
536 else 552 else
537 tmp &= ~(RTC_PIE|RTC_AIE|RTC_UIE); 553 tmp &= ~(RTC_PIE|RTC_AIE|RTC_UIE);
538 CMOS_WRITE(tmp, RTC_CONTROL); 554 CMOS_WRITE(tmp, RTC_CONTROL);
539 irqstat = CMOS_READ(RTC_INTR_FLAGS); 555 irqstat = CMOS_READ(RTC_INTR_FLAGS);
540 } else 556 irqstat &= (tmp & RTC_IRQMASK) | RTC_IRQF;
541 irqstat = 0; 557 if (is_intr(irqstat))
558 rtc_update_irq(&cmos->rtc->class_dev, 1, irqstat);
559 }
542 spin_unlock_irq(&rtc_lock); 560 spin_unlock_irq(&rtc_lock);
543 561
544 if (irqstat)
545 rtc_update_irq(&cmos->rtc->class_dev, 1, irqstat);
546
547 /* ACPI HOOK: enable ACPI_EVENT_RTC when (tmp & RTC_AIE) 562 /* ACPI HOOK: enable ACPI_EVENT_RTC when (tmp & RTC_AIE)
548 * ... it'd be best if we could do that under rtc_lock. 563 * ... it'd be best if we could do that under rtc_lock.
549 */ 564 */
@@ -573,9 +588,10 @@ static int cmos_resume(struct device *dev)
573 spin_lock_irq(&rtc_lock); 588 spin_lock_irq(&rtc_lock);
574 CMOS_WRITE(tmp, RTC_CONTROL); 589 CMOS_WRITE(tmp, RTC_CONTROL);
575 tmp = CMOS_READ(RTC_INTR_FLAGS); 590 tmp = CMOS_READ(RTC_INTR_FLAGS);
576 spin_unlock_irq(&rtc_lock); 591 tmp &= (cmos->suspend_ctrl & RTC_IRQMASK) | RTC_IRQF;
577 if (tmp) 592 if (is_intr(tmp))
578 rtc_update_irq(&cmos->rtc->class_dev, 1, tmp); 593 rtc_update_irq(&cmos->rtc->class_dev, 1, tmp);
594 spin_unlock_irq(&rtc_lock);
579 } 595 }
580 596
581 pr_debug("%s: resume, ctrl %02x\n", 597 pr_debug("%s: resume, ctrl %02x\n",
@@ -594,7 +610,7 @@ static int cmos_resume(struct device *dev)
594/*----------------------------------------------------------------*/ 610/*----------------------------------------------------------------*/
595 611
596/* The "CMOS" RTC normally lives on the platform_bus. On ACPI systems, 612/* The "CMOS" RTC normally lives on the platform_bus. On ACPI systems,
597 * the device node may alternatively be created as a PNP device. 613 * the device node will always be created as a PNPACPI device.
598 */ 614 */
599 615
600#ifdef CONFIG_PNPACPI 616#ifdef CONFIG_PNPACPI
@@ -673,7 +689,7 @@ module_exit(cmos_exit);
673/*----------------------------------------------------------------*/ 689/*----------------------------------------------------------------*/
674 690
675/* Platform setup should have set up an RTC device, when PNPACPI is 691/* Platform setup should have set up an RTC device, when PNPACPI is
676 * unavailable ... this is the normal case, common even on PCs. 692 * unavailable ... this could happen even on (older) PCs.
677 */ 693 */
678 694
679static int __init cmos_platform_probe(struct platform_device *pdev) 695static int __init cmos_platform_probe(struct platform_device *pdev)
diff --git a/drivers/s390/block/dasd_diag.c b/drivers/s390/block/dasd_diag.c
index ab782bb46ac1..e810e4a44ed4 100644
--- a/drivers/s390/block/dasd_diag.c
+++ b/drivers/s390/block/dasd_diag.c
@@ -65,7 +65,7 @@ static const u8 DASD_DIAG_CMS1[] = { 0xc3, 0xd4, 0xe2, 0xf1 };/* EBCDIC CMS1 */
65 * resulting condition code and DIAG return code. */ 65 * resulting condition code and DIAG return code. */
66static inline int dia250(void *iob, int cmd) 66static inline int dia250(void *iob, int cmd)
67{ 67{
68 register unsigned long reg0 asm ("0") = (unsigned long) iob; 68 register unsigned long reg2 asm ("2") = (unsigned long) iob;
69 typedef union { 69 typedef union {
70 struct dasd_diag_init_io init_io; 70 struct dasd_diag_init_io init_io;
71 struct dasd_diag_rw_io rw_io; 71 struct dasd_diag_rw_io rw_io;
@@ -74,15 +74,15 @@ static inline int dia250(void *iob, int cmd)
74 74
75 rc = 3; 75 rc = 3;
76 asm volatile( 76 asm volatile(
77 " diag 0,%2,0x250\n" 77 " diag 2,%2,0x250\n"
78 "0: ipm %0\n" 78 "0: ipm %0\n"
79 " srl %0,28\n" 79 " srl %0,28\n"
80 " or %0,1\n" 80 " or %0,3\n"
81 "1:\n" 81 "1:\n"
82 EX_TABLE(0b,1b) 82 EX_TABLE(0b,1b)
83 : "+d" (rc), "=m" (*(addr_type *) iob) 83 : "+d" (rc), "=m" (*(addr_type *) iob)
84 : "d" (cmd), "d" (reg0), "m" (*(addr_type *) iob) 84 : "d" (cmd), "d" (reg2), "m" (*(addr_type *) iob)
85 : "1", "cc"); 85 : "3", "cc");
86 return rc; 86 return rc;
87} 87}
88 88
diff --git a/drivers/s390/cio/device_status.c b/drivers/s390/cio/device_status.c
index 6b1caea622ea..aa96e6752592 100644
--- a/drivers/s390/cio/device_status.c
+++ b/drivers/s390/cio/device_status.c
@@ -221,6 +221,14 @@ ccw_device_accumulate_irb(struct ccw_device *cdev, struct irb *irb)
221 221
222 cdev_irb = &cdev->private->irb; 222 cdev_irb = &cdev->private->irb;
223 223
224 /*
225 * If the clear function had been performed, all formerly pending
226 * status at the subchannel has been cleared and we must not pass
227 * intermediate accumulated status to the device driver.
228 */
229 if (irb->scsw.fctl & SCSW_FCTL_CLEAR_FUNC)
230 memset(&cdev->private->irb, 0, sizeof(struct irb));
231
224 /* Copy bits which are valid only for the start function. */ 232 /* Copy bits which are valid only for the start function. */
225 if (irb->scsw.fctl & SCSW_FCTL_START_FUNC) { 233 if (irb->scsw.fctl & SCSW_FCTL_START_FUNC) {
226 /* Copy key. */ 234 /* Copy key. */
@@ -263,7 +271,11 @@ ccw_device_accumulate_irb(struct ccw_device *cdev, struct irb *irb)
263 cdev_irb->scsw.cpa = irb->scsw.cpa; 271 cdev_irb->scsw.cpa = irb->scsw.cpa;
264 /* Accumulate device status, but not the device busy flag. */ 272 /* Accumulate device status, but not the device busy flag. */
265 cdev_irb->scsw.dstat &= ~DEV_STAT_BUSY; 273 cdev_irb->scsw.dstat &= ~DEV_STAT_BUSY;
266 cdev_irb->scsw.dstat |= irb->scsw.dstat; 274 /* dstat is not always valid. */
275 if (irb->scsw.stctl &
276 (SCSW_STCTL_PRIM_STATUS | SCSW_STCTL_SEC_STATUS
277 | SCSW_STCTL_INTER_STATUS | SCSW_STCTL_ALERT_STATUS))
278 cdev_irb->scsw.dstat |= irb->scsw.dstat;
267 /* Accumulate subchannel status. */ 279 /* Accumulate subchannel status. */
268 cdev_irb->scsw.cstat |= irb->scsw.cstat; 280 cdev_irb->scsw.cstat |= irb->scsw.cstat;
269 /* Copy residual count if it is valid. */ 281 /* Copy residual count if it is valid. */
diff --git a/drivers/s390/crypto/ap_bus.c b/drivers/s390/crypto/ap_bus.c
index 181b51772b1b..bf37cdf43fae 100644
--- a/drivers/s390/crypto/ap_bus.c
+++ b/drivers/s390/crypto/ap_bus.c
@@ -505,6 +505,9 @@ static int ap_device_remove(struct device *dev)
505 spin_lock_bh(&ap_device_lock); 505 spin_lock_bh(&ap_device_lock);
506 list_del_init(&ap_dev->list); 506 list_del_init(&ap_dev->list);
507 spin_unlock_bh(&ap_device_lock); 507 spin_unlock_bh(&ap_device_lock);
508 spin_lock_bh(&ap_dev->lock);
509 atomic_sub(ap_dev->queue_count, &ap_poll_requests);
510 spin_unlock_bh(&ap_dev->lock);
508 return 0; 511 return 0;
509} 512}
510 513
@@ -757,10 +760,16 @@ static void ap_scan_bus(struct work_struct *unused)
757 (void *)(unsigned long)qid, 760 (void *)(unsigned long)qid,
758 __ap_scan_bus); 761 __ap_scan_bus);
759 rc = ap_query_queue(qid, &queue_depth, &device_type); 762 rc = ap_query_queue(qid, &queue_depth, &device_type);
760 if (dev && rc) { 763 if (dev) {
761 put_device(dev); 764 ap_dev = to_ap_dev(dev);
762 device_unregister(dev); 765 spin_lock_bh(&ap_dev->lock);
763 continue; 766 if (rc || ap_dev->unregistered) {
767 spin_unlock_bh(&ap_dev->lock);
768 put_device(dev);
769 device_unregister(dev);
770 continue;
771 } else
772 spin_unlock_bh(&ap_dev->lock);
764 } 773 }
765 if (dev) { 774 if (dev) {
766 put_device(dev); 775 put_device(dev);
@@ -861,6 +870,7 @@ static int ap_poll_read(struct ap_device *ap_dev, unsigned long *flags)
861 case AP_RESPONSE_NO_PENDING_REPLY: 870 case AP_RESPONSE_NO_PENDING_REPLY:
862 if (status.queue_empty) { 871 if (status.queue_empty) {
863 /* The card shouldn't forget requests but who knows. */ 872 /* The card shouldn't forget requests but who knows. */
873 atomic_sub(ap_dev->queue_count, &ap_poll_requests);
864 ap_dev->queue_count = 0; 874 ap_dev->queue_count = 0;
865 list_splice_init(&ap_dev->pendingq, &ap_dev->requestq); 875 list_splice_init(&ap_dev->pendingq, &ap_dev->requestq);
866 ap_dev->requestq_count += ap_dev->pendingq_count; 876 ap_dev->requestq_count += ap_dev->pendingq_count;
@@ -994,7 +1004,7 @@ void ap_queue_message(struct ap_device *ap_dev, struct ap_message *ap_msg)
994 ap_dev->unregistered = 1; 1004 ap_dev->unregistered = 1;
995 } else { 1005 } else {
996 ap_dev->drv->receive(ap_dev, ap_msg, ERR_PTR(-ENODEV)); 1006 ap_dev->drv->receive(ap_dev, ap_msg, ERR_PTR(-ENODEV));
997 rc = 0; 1007 rc = -ENODEV;
998 } 1008 }
999 spin_unlock_bh(&ap_dev->lock); 1009 spin_unlock_bh(&ap_dev->lock);
1000 if (rc == -ENODEV) 1010 if (rc == -ENODEV)
@@ -1044,18 +1054,12 @@ static void ap_poll_timeout(unsigned long unused)
1044 */ 1054 */
1045static int __ap_poll_all(struct ap_device *ap_dev, unsigned long *flags) 1055static int __ap_poll_all(struct ap_device *ap_dev, unsigned long *flags)
1046{ 1056{
1047 int rc;
1048
1049 spin_lock(&ap_dev->lock); 1057 spin_lock(&ap_dev->lock);
1050 if (!ap_dev->unregistered) { 1058 if (!ap_dev->unregistered) {
1051 rc = ap_poll_queue(ap_dev, flags); 1059 if (ap_poll_queue(ap_dev, flags))
1052 if (rc)
1053 ap_dev->unregistered = 1; 1060 ap_dev->unregistered = 1;
1054 } else 1061 }
1055 rc = 0;
1056 spin_unlock(&ap_dev->lock); 1062 spin_unlock(&ap_dev->lock);
1057 if (rc)
1058 device_unregister(&ap_dev->device);
1059 return 0; 1063 return 0;
1060} 1064}
1061 1065
diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c
index 8c81cec85298..60446b88f721 100644
--- a/drivers/scsi/gdth.c
+++ b/drivers/scsi/gdth.c
@@ -3091,6 +3091,7 @@ static int gdth_fill_raw_cmd(int hanum,Scsi_Cmnd *scp,unchar b)
3091 cmdp->u.raw64.direction = 3091 cmdp->u.raw64.direction =
3092 gdth_direction_tab[scp->cmnd[0]]==DOU ? GDTH_DATA_OUT:GDTH_DATA_IN; 3092 gdth_direction_tab[scp->cmnd[0]]==DOU ? GDTH_DATA_OUT:GDTH_DATA_IN;
3093 memcpy(cmdp->u.raw64.cmd,scp->cmnd,16); 3093 memcpy(cmdp->u.raw64.cmd,scp->cmnd,16);
3094 cmdp->u.raw64.sg_ranz = 0;
3094 } else { 3095 } else {
3095 cmdp->u.raw.reserved = 0; 3096 cmdp->u.raw.reserved = 0;
3096 cmdp->u.raw.mdisc_time = 0; 3097 cmdp->u.raw.mdisc_time = 0;
@@ -3107,6 +3108,7 @@ static int gdth_fill_raw_cmd(int hanum,Scsi_Cmnd *scp,unchar b)
3107 cmdp->u.raw.direction = 3108 cmdp->u.raw.direction =
3108 gdth_direction_tab[scp->cmnd[0]]==DOU ? GDTH_DATA_OUT:GDTH_DATA_IN; 3109 gdth_direction_tab[scp->cmnd[0]]==DOU ? GDTH_DATA_OUT:GDTH_DATA_IN;
3109 memcpy(cmdp->u.raw.cmd,scp->cmnd,12); 3110 memcpy(cmdp->u.raw.cmd,scp->cmnd,12);
3111 cmdp->u.raw.sg_ranz = 0;
3110 } 3112 }
3111 3113
3112 if (scp->use_sg) { 3114 if (scp->use_sg) {
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index 9d014e5a81c4..057fd7e0e379 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -1817,10 +1817,9 @@ static pci_ers_result_t lpfc_io_error_detected(struct pci_dev *pdev,
1817 struct lpfc_sli *psli = &phba->sli; 1817 struct lpfc_sli *psli = &phba->sli;
1818 struct lpfc_sli_ring *pring; 1818 struct lpfc_sli_ring *pring;
1819 1819
1820 if (state == pci_channel_io_perm_failure) { 1820 if (state == pci_channel_io_perm_failure)
1821 lpfc_pci_remove_one(pdev);
1822 return PCI_ERS_RESULT_DISCONNECT; 1821 return PCI_ERS_RESULT_DISCONNECT;
1823 } 1822
1824 pci_disable_device(pdev); 1823 pci_disable_device(pdev);
1825 /* 1824 /*
1826 * There may be I/Os dropped by the firmware. 1825 * There may be I/Os dropped by the firmware.
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index b8edcf5b5451..918bb6019540 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -716,7 +716,7 @@ static int scsi_send_eh_cmnd(struct scsi_cmnd *scmd, unsigned char *cmnd,
716 */ 716 */
717 if (copy_sense) { 717 if (copy_sense) {
718 if (!SCSI_SENSE_VALID(scmd)) { 718 if (!SCSI_SENSE_VALID(scmd)) {
719 memcpy(scmd->sense_buffer, scmd->request_buffer, 719 memcpy(scmd->sense_buffer, page_address(sgl.page),
720 sizeof(scmd->sense_buffer)); 720 sizeof(scmd->sense_buffer));
721 } 721 }
722 __free_page(sgl.page); 722 __free_page(sgl.page);
diff --git a/drivers/serial/8250_pnp.c b/drivers/serial/8250_pnp.c
index cde5db44abf6..301c8c0be9d7 100644
--- a/drivers/serial/8250_pnp.c
+++ b/drivers/serial/8250_pnp.c
@@ -340,6 +340,9 @@ static const struct pnp_device_id pnp_dev_table[] = {
340 { "FUJ02B8", 0 }, 340 { "FUJ02B8", 0 },
341 { "FUJ02B9", 0 }, 341 { "FUJ02B9", 0 },
342 { "FUJ02BC", 0 }, 342 { "FUJ02BC", 0 },
343 /* Fujitsu Wacom Tablet PC devices */
344 { "FUJ02E5", 0 },
345 { "FUJ02E6", 0 },
343 /* Rockwell's (PORALiNK) 33600 INT PNP */ 346 /* Rockwell's (PORALiNK) 33600 INT PNP */
344 { "WCI0003", 0 }, 347 { "WCI0003", 0 },
345 /* Unkown PnP modems */ 348 /* Unkown PnP modems */
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 2328128728be..6657331eed93 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -189,8 +189,8 @@ static DECLARE_MUTEX(board_lock);
189 * this is exported so that for example a USB or parport based adapter 189 * this is exported so that for example a USB or parport based adapter
190 * driver could add devices (which it would learn about out-of-band). 190 * driver could add devices (which it would learn about out-of-band).
191 */ 191 */
192struct spi_device *__init_or_module 192struct spi_device *spi_new_device(struct spi_master *master,
193spi_new_device(struct spi_master *master, struct spi_board_info *chip) 193 struct spi_board_info *chip)
194{ 194{
195 struct spi_device *proxy; 195 struct spi_device *proxy;
196 struct device *dev = master->cdev.dev; 196 struct device *dev = master->cdev.dev;
@@ -352,8 +352,7 @@ static struct class spi_master_class = {
352 * the master's methods before calling spi_register_master(); and (after errors 352 * the master's methods before calling spi_register_master(); and (after errors
353 * adding the device) calling spi_master_put() to prevent a memory leak. 353 * adding the device) calling spi_master_put() to prevent a memory leak.
354 */ 354 */
355struct spi_master * __init_or_module 355struct spi_master *spi_alloc_master(struct device *dev, unsigned size)
356spi_alloc_master(struct device *dev, unsigned size)
357{ 356{
358 struct spi_master *master; 357 struct spi_master *master;
359 358
@@ -392,8 +391,7 @@ EXPORT_SYMBOL_GPL(spi_alloc_master);
392 * After a successful return, the caller is responsible for calling 391 * After a successful return, the caller is responsible for calling
393 * spi_unregister_master(). 392 * spi_unregister_master().
394 */ 393 */
395int __init_or_module 394int spi_register_master(struct spi_master *master)
396spi_register_master(struct spi_master *master)
397{ 395{
398 static atomic_t dyn_bus_id = ATOMIC_INIT((1<<16) - 1); 396 static atomic_t dyn_bus_id = ATOMIC_INIT((1<<16) - 1);
399 struct device *dev = master->cdev.dev; 397 struct device *dev = master->cdev.dev;
diff --git a/drivers/tc/zs.c b/drivers/tc/zs.c
index 3d72aa5cfc71..3524e3fc08b9 100644
--- a/drivers/tc/zs.c
+++ b/drivers/tc/zs.c
@@ -70,7 +70,6 @@
70#include <asm/dec/machtype.h> 70#include <asm/dec/machtype.h>
71#include <asm/dec/serial.h> 71#include <asm/dec/serial.h>
72#include <asm/dec/system.h> 72#include <asm/dec/system.h>
73#include <asm/dec/tc.h>
74 73
75#ifdef CONFIG_KGDB 74#ifdef CONFIG_KGDB
76#include <asm/kgdb.h> 75#include <asm/kgdb.h>
diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
index 0e5c646cb4f6..f08ec85a6d64 100644
--- a/drivers/usb/core/quirks.c
+++ b/drivers/usb/core/quirks.c
@@ -30,7 +30,8 @@
30static const struct usb_device_id usb_quirk_list[] = { 30static const struct usb_device_id usb_quirk_list[] = {
31 /* HP 5300/5370C scanner */ 31 /* HP 5300/5370C scanner */
32 { USB_DEVICE(0x03f0, 0x0701), .driver_info = USB_QUIRK_STRING_FETCH_255 }, 32 { USB_DEVICE(0x03f0, 0x0701), .driver_info = USB_QUIRK_STRING_FETCH_255 },
33 33 /* Seiko Epson Corp - Perfection 1670 */
34 { USB_DEVICE(0x04b8, 0x011f), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
34 /* Elsa MicroLink 56k (V.250) */ 35 /* Elsa MicroLink 56k (V.250) */
35 { USB_DEVICE(0x05cc, 0x2267), .driver_info = USB_QUIRK_NO_AUTOSUSPEND }, 36 { USB_DEVICE(0x05cc, 0x2267), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
36 37
diff --git a/drivers/usb/gadget/omap_udc.c b/drivers/usb/gadget/omap_udc.c
index 8f9a2b615422..b394e63894d2 100644
--- a/drivers/usb/gadget/omap_udc.c
+++ b/drivers/usb/gadget/omap_udc.c
@@ -296,6 +296,15 @@ omap_free_request(struct usb_ep *ep, struct usb_request *_req)
296 296
297/*-------------------------------------------------------------------------*/ 297/*-------------------------------------------------------------------------*/
298 298
299/*
300 * dma-coherent memory allocation (for dma-capable endpoints)
301 *
302 * NOTE: the dma_*_coherent() API calls suck. Most implementations are
303 * (a) page-oriented, so small buffers lose big; and (b) asymmetric with
304 * respect to calls with irqs disabled: alloc is safe, free is not.
305 * We currently work around (b), but not (a).
306 */
307
299static void * 308static void *
300omap_alloc_buffer( 309omap_alloc_buffer(
301 struct usb_ep *_ep, 310 struct usb_ep *_ep,
@@ -307,6 +316,9 @@ omap_alloc_buffer(
307 void *retval; 316 void *retval;
308 struct omap_ep *ep; 317 struct omap_ep *ep;
309 318
319 if (!_ep)
320 return NULL;
321
310 ep = container_of(_ep, struct omap_ep, ep); 322 ep = container_of(_ep, struct omap_ep, ep);
311 if (use_dma && ep->has_dma) { 323 if (use_dma && ep->has_dma) {
312 static int warned; 324 static int warned;
@@ -326,6 +338,35 @@ omap_alloc_buffer(
326 return retval; 338 return retval;
327} 339}
328 340
341static DEFINE_SPINLOCK(buflock);
342static LIST_HEAD(buffers);
343
344struct free_record {
345 struct list_head list;
346 struct device *dev;
347 unsigned bytes;
348 dma_addr_t dma;
349};
350
351static void do_free(unsigned long ignored)
352{
353 spin_lock_irq(&buflock);
354 while (!list_empty(&buffers)) {
355 struct free_record *buf;
356
357 buf = list_entry(buffers.next, struct free_record, list);
358 list_del(&buf->list);
359 spin_unlock_irq(&buflock);
360
361 dma_free_coherent(buf->dev, buf->bytes, buf, buf->dma);
362
363 spin_lock_irq(&buflock);
364 }
365 spin_unlock_irq(&buflock);
366}
367
368static DECLARE_TASKLET(deferred_free, do_free, 0);
369
329static void omap_free_buffer( 370static void omap_free_buffer(
330 struct usb_ep *_ep, 371 struct usb_ep *_ep,
331 void *buf, 372 void *buf,
@@ -333,13 +374,29 @@ static void omap_free_buffer(
333 unsigned bytes 374 unsigned bytes
334) 375)
335{ 376{
336 struct omap_ep *ep; 377 if (!_ep) {
378 WARN_ON(1);
379 return;
380 }
337 381
338 ep = container_of(_ep, struct omap_ep, ep); 382 /* free memory into the right allocator */
339 if (use_dma && _ep && ep->has_dma) 383 if (dma != DMA_ADDR_INVALID) {
340 dma_free_coherent(ep->udc->gadget.dev.parent, bytes, buf, dma); 384 struct omap_ep *ep;
341 else 385 struct free_record *rec = buf;
342 kfree (buf); 386 unsigned long flags;
387
388 ep = container_of(_ep, struct omap_ep, ep);
389
390 rec->dev = ep->udc->gadget.dev.parent;
391 rec->bytes = bytes;
392 rec->dma = dma;
393
394 spin_lock_irqsave(&buflock, flags);
395 list_add_tail(&rec->list, &buffers);
396 tasklet_schedule(&deferred_free);
397 spin_unlock_irqrestore(&buflock, flags);
398 } else
399 kfree(buf);
343} 400}
344 401
345/*-------------------------------------------------------------------------*/ 402/*-------------------------------------------------------------------------*/
@@ -1691,12 +1748,38 @@ ep0out_status_stage:
1691 udc->ep0_pending = 0; 1748 udc->ep0_pending = 0;
1692 break; 1749 break;
1693 case USB_REQ_GET_STATUS: 1750 case USB_REQ_GET_STATUS:
1751 /* USB_ENDPOINT_HALT status? */
1752 if (u.r.bRequestType != (USB_DIR_IN|USB_RECIP_ENDPOINT))
1753 goto intf_status;
1754
1755 /* ep0 never stalls */
1756 if (!(w_index & 0xf))
1757 goto zero_status;
1758
1759 /* only active endpoints count */
1760 ep = &udc->ep[w_index & 0xf];
1761 if (w_index & USB_DIR_IN)
1762 ep += 16;
1763 if (!ep->desc)
1764 goto do_stall;
1765
1766 /* iso never stalls */
1767 if (ep->bmAttributes == USB_ENDPOINT_XFER_ISOC)
1768 goto zero_status;
1769
1770 /* FIXME don't assume non-halted endpoints!! */
1771 ERR("%s status, can't report\n", ep->ep.name);
1772 goto do_stall;
1773
1774intf_status:
1694 /* return interface status. if we were pedantic, 1775 /* return interface status. if we were pedantic,
1695 * we'd detect non-existent interfaces, and stall. 1776 * we'd detect non-existent interfaces, and stall.
1696 */ 1777 */
1697 if (u.r.bRequestType 1778 if (u.r.bRequestType
1698 != (USB_DIR_IN|USB_RECIP_INTERFACE)) 1779 != (USB_DIR_IN|USB_RECIP_INTERFACE))
1699 goto delegate; 1780 goto delegate;
1781
1782zero_status:
1700 /* return two zero bytes */ 1783 /* return two zero bytes */
1701 UDC_EP_NUM_REG = UDC_EP_SEL|UDC_EP_DIR; 1784 UDC_EP_NUM_REG = UDC_EP_SEL|UDC_EP_DIR;
1702 UDC_DATA_REG = 0; 1785 UDC_DATA_REG = 0;
@@ -2068,7 +2151,7 @@ static irqreturn_t omap_udc_iso_irq(int irq, void *_dev)
2068 2151
2069/*-------------------------------------------------------------------------*/ 2152/*-------------------------------------------------------------------------*/
2070 2153
2071static inline int machine_needs_vbus_session(void) 2154static inline int machine_without_vbus_sense(void)
2072{ 2155{
2073 return (machine_is_omap_innovator() 2156 return (machine_is_omap_innovator()
2074 || machine_is_omap_osk() 2157 || machine_is_omap_osk()
@@ -2156,7 +2239,7 @@ int usb_gadget_register_driver (struct usb_gadget_driver *driver)
2156 /* boards that don't have VBUS sensing can't autogate 48MHz; 2239 /* boards that don't have VBUS sensing can't autogate 48MHz;
2157 * can't enter deep sleep while a gadget driver is active. 2240 * can't enter deep sleep while a gadget driver is active.
2158 */ 2241 */
2159 if (machine_needs_vbus_session()) 2242 if (machine_without_vbus_sense())
2160 omap_vbus_session(&udc->gadget, 1); 2243 omap_vbus_session(&udc->gadget, 1);
2161 2244
2162done: 2245done:
@@ -2179,7 +2262,7 @@ int usb_gadget_unregister_driver (struct usb_gadget_driver *driver)
2179 if (udc->dc_clk != NULL) 2262 if (udc->dc_clk != NULL)
2180 omap_udc_enable_clock(1); 2263 omap_udc_enable_clock(1);
2181 2264
2182 if (machine_needs_vbus_session()) 2265 if (machine_without_vbus_sense())
2183 omap_vbus_session(&udc->gadget, 0); 2266 omap_vbus_session(&udc->gadget, 0);
2184 2267
2185 if (udc->transceiver) 2268 if (udc->transceiver)
@@ -2822,7 +2905,7 @@ static int __init omap_udc_probe(struct platform_device *pdev)
2822 hmc = HMC_1510; 2905 hmc = HMC_1510;
2823 type = "(unknown)"; 2906 type = "(unknown)";
2824 2907
2825 if (machine_is_omap_innovator() || machine_is_sx1()) { 2908 if (machine_without_vbus_sense()) {
2826 /* just set up software VBUS detect, and then 2909 /* just set up software VBUS detect, and then
2827 * later rig it so we always report VBUS. 2910 * later rig it so we always report VBUS.
2828 * FIXME without really sensing VBUS, we can't 2911 * FIXME without really sensing VBUS, we can't
diff --git a/drivers/usb/host/uhci-debug.c b/drivers/usb/host/uhci-debug.c
index 8d24d3dc0a61..1497371583b9 100644
--- a/drivers/usb/host/uhci-debug.c
+++ b/drivers/usb/host/uhci-debug.c
@@ -145,7 +145,8 @@ static int uhci_show_urbp(struct urb_priv *urbp, char *buf, int len, int space)
145 return out - buf; 145 return out - buf;
146} 146}
147 147
148static int uhci_show_qh(struct uhci_qh *qh, char *buf, int len, int space) 148static int uhci_show_qh(struct uhci_hcd *uhci,
149 struct uhci_qh *qh, char *buf, int len, int space)
149{ 150{
150 char *out = buf; 151 char *out = buf;
151 int i, nurbs; 152 int i, nurbs;
@@ -190,6 +191,9 @@ static int uhci_show_qh(struct uhci_qh *qh, char *buf, int len, int space)
190 191
191 if (list_empty(&qh->queue)) { 192 if (list_empty(&qh->queue)) {
192 out += sprintf(out, "%*s queue is empty\n", space, ""); 193 out += sprintf(out, "%*s queue is empty\n", space, "");
194 if (qh == uhci->skel_async_qh)
195 out += uhci_show_td(uhci->term_td, out,
196 len - (out - buf), 0);
193 } else { 197 } else {
194 struct urb_priv *urbp = list_entry(qh->queue.next, 198 struct urb_priv *urbp = list_entry(qh->queue.next,
195 struct urb_priv, node); 199 struct urb_priv, node);
@@ -343,6 +347,7 @@ static int uhci_sprint_schedule(struct uhci_hcd *uhci, char *buf, int len)
343 struct list_head *tmp, *head; 347 struct list_head *tmp, *head;
344 int nframes, nerrs; 348 int nframes, nerrs;
345 __le32 link; 349 __le32 link;
350 __le32 fsbr_link;
346 351
347 static const char * const qh_names[] = { 352 static const char * const qh_names[] = {
348 "unlink", "iso", "int128", "int64", "int32", "int16", 353 "unlink", "iso", "int128", "int64", "int32", "int16",
@@ -424,21 +429,22 @@ check_link:
424 429
425 out += sprintf(out, "Skeleton QHs\n"); 430 out += sprintf(out, "Skeleton QHs\n");
426 431
432 fsbr_link = 0;
427 for (i = 0; i < UHCI_NUM_SKELQH; ++i) { 433 for (i = 0; i < UHCI_NUM_SKELQH; ++i) {
428 int cnt = 0; 434 int cnt = 0;
429 __le32 fsbr_link = 0;
430 435
431 qh = uhci->skelqh[i]; 436 qh = uhci->skelqh[i];
432 out += sprintf(out, "- skel_%s_qh\n", qh_names[i]); \ 437 out += sprintf(out, "- skel_%s_qh\n", qh_names[i]); \
433 out += uhci_show_qh(qh, out, len - (out - buf), 4); 438 out += uhci_show_qh(uhci, qh, out, len - (out - buf), 4);
434 439
435 /* Last QH is the Terminating QH, it's different */ 440 /* Last QH is the Terminating QH, it's different */
436 if (i == SKEL_TERM) { 441 if (i == SKEL_TERM) {
437 if (qh_element(qh) != LINK_TO_TD(uhci->term_td)) 442 if (qh_element(qh) != LINK_TO_TD(uhci->term_td))
438 out += sprintf(out, " skel_term_qh element is not set to term_td!\n"); 443 out += sprintf(out, " skel_term_qh element is not set to term_td!\n");
439 if (link == LINK_TO_QH(uhci->skel_term_qh)) 444 link = fsbr_link;
440 goto check_qh_link; 445 if (!link)
441 continue; 446 link = LINK_TO_QH(uhci->skel_term_qh);
447 goto check_qh_link;
442 } 448 }
443 449
444 head = &qh->node; 450 head = &qh->node;
@@ -448,7 +454,7 @@ check_link:
448 qh = list_entry(tmp, struct uhci_qh, node); 454 qh = list_entry(tmp, struct uhci_qh, node);
449 tmp = tmp->next; 455 tmp = tmp->next;
450 if (++cnt <= 10) 456 if (++cnt <= 10)
451 out += uhci_show_qh(qh, out, 457 out += uhci_show_qh(uhci, qh, out,
452 len - (out - buf), 4); 458 len - (out - buf), 4);
453 if (!fsbr_link && qh->skel >= SKEL_FSBR) 459 if (!fsbr_link && qh->skel >= SKEL_FSBR)
454 fsbr_link = LINK_TO_QH(qh); 460 fsbr_link = LINK_TO_QH(qh);
@@ -463,8 +469,6 @@ check_link:
463 link = LINK_TO_QH(uhci->skel_async_qh); 469 link = LINK_TO_QH(uhci->skel_async_qh);
464 else if (!uhci->fsbr_is_on) 470 else if (!uhci->fsbr_is_on)
465 ; 471 ;
466 else if (fsbr_link)
467 link = fsbr_link;
468 else 472 else
469 link = LINK_TO_QH(uhci->skel_term_qh); 473 link = LINK_TO_QH(uhci->skel_term_qh);
470check_qh_link: 474check_qh_link:
@@ -573,8 +577,8 @@ static const struct file_operations uhci_debug_operations = {
573static inline void lprintk(char *buf) 577static inline void lprintk(char *buf)
574{} 578{}
575 579
576static inline int uhci_show_qh(struct uhci_qh *qh, char *buf, 580static inline int uhci_show_qh(struct uhci_hcd *uhci,
577 int len, int space) 581 struct uhci_qh *qh, char *buf, int len, int space)
578{ 582{
579 return 0; 583 return 0;
580} 584}
diff --git a/drivers/usb/host/uhci-hcd.c b/drivers/usb/host/uhci-hcd.c
index 44da4334f1d6..d22da26ff167 100644
--- a/drivers/usb/host/uhci-hcd.c
+++ b/drivers/usb/host/uhci-hcd.c
@@ -632,7 +632,8 @@ static int uhci_start(struct usb_hcd *hcd)
632 */ 632 */
633 for (i = SKEL_ISO + 1; i < SKEL_ASYNC; ++i) 633 for (i = SKEL_ISO + 1; i < SKEL_ASYNC; ++i)
634 uhci->skelqh[i]->link = LINK_TO_QH(uhci->skel_async_qh); 634 uhci->skelqh[i]->link = LINK_TO_QH(uhci->skel_async_qh);
635 uhci->skel_async_qh->link = uhci->skel_term_qh->link = UHCI_PTR_TERM; 635 uhci->skel_async_qh->link = UHCI_PTR_TERM;
636 uhci->skel_term_qh->link = LINK_TO_QH(uhci->skel_term_qh);
636 637
637 /* This dummy TD is to work around a bug in Intel PIIX controllers */ 638 /* This dummy TD is to work around a bug in Intel PIIX controllers */
638 uhci_fill_td(uhci->term_td, 0, uhci_explen(0) | 639 uhci_fill_td(uhci->term_td, 0, uhci_explen(0) |
diff --git a/drivers/usb/host/uhci-q.c b/drivers/usb/host/uhci-q.c
index f4ebdb3e488f..19a0cc02b9a2 100644
--- a/drivers/usb/host/uhci-q.c
+++ b/drivers/usb/host/uhci-q.c
@@ -45,43 +45,27 @@ static inline void uhci_clear_next_interrupt(struct uhci_hcd *uhci)
45 */ 45 */
46static void uhci_fsbr_on(struct uhci_hcd *uhci) 46static void uhci_fsbr_on(struct uhci_hcd *uhci)
47{ 47{
48 struct uhci_qh *fsbr_qh, *lqh, *tqh; 48 struct uhci_qh *lqh;
49 49
50 /* The terminating skeleton QH always points back to the first
51 * FSBR QH. Make the last async QH point to the terminating
52 * skeleton QH. */
50 uhci->fsbr_is_on = 1; 53 uhci->fsbr_is_on = 1;
51 lqh = list_entry(uhci->skel_async_qh->node.prev, 54 lqh = list_entry(uhci->skel_async_qh->node.prev,
52 struct uhci_qh, node); 55 struct uhci_qh, node);
53 56 lqh->link = LINK_TO_QH(uhci->skel_term_qh);
54 /* Find the first FSBR QH. Linear search through the list is
55 * acceptable because normally FSBR gets turned on as soon as
56 * one QH needs it. */
57 fsbr_qh = NULL;
58 list_for_each_entry_reverse(tqh, &uhci->skel_async_qh->node, node) {
59 if (tqh->skel < SKEL_FSBR)
60 break;
61 fsbr_qh = tqh;
62 }
63
64 /* No FSBR QH means we must insert the terminating skeleton QH */
65 if (!fsbr_qh) {
66 uhci->skel_term_qh->link = LINK_TO_QH(uhci->skel_term_qh);
67 wmb();
68 lqh->link = uhci->skel_term_qh->link;
69
70 /* Otherwise loop the last QH to the first FSBR QH */
71 } else
72 lqh->link = LINK_TO_QH(fsbr_qh);
73} 57}
74 58
75static void uhci_fsbr_off(struct uhci_hcd *uhci) 59static void uhci_fsbr_off(struct uhci_hcd *uhci)
76{ 60{
77 struct uhci_qh *lqh; 61 struct uhci_qh *lqh;
78 62
63 /* Remove the link from the last async QH to the terminating
64 * skeleton QH. */
79 uhci->fsbr_is_on = 0; 65 uhci->fsbr_is_on = 0;
80 lqh = list_entry(uhci->skel_async_qh->node.prev, 66 lqh = list_entry(uhci->skel_async_qh->node.prev,
81 struct uhci_qh, node); 67 struct uhci_qh, node);
82 68 lqh->link = UHCI_PTR_TERM;
83 /* End the async list normally and unlink the terminating QH */
84 lqh->link = uhci->skel_term_qh->link = UHCI_PTR_TERM;
85} 69}
86 70
87static void uhci_add_fsbr(struct uhci_hcd *uhci, struct urb *urb) 71static void uhci_add_fsbr(struct uhci_hcd *uhci, struct urb *urb)
@@ -464,9 +448,8 @@ static void link_interrupt(struct uhci_hcd *uhci, struct uhci_qh *qh)
464 */ 448 */
465static void link_async(struct uhci_hcd *uhci, struct uhci_qh *qh) 449static void link_async(struct uhci_hcd *uhci, struct uhci_qh *qh)
466{ 450{
467 struct uhci_qh *pqh, *lqh; 451 struct uhci_qh *pqh;
468 __le32 link_to_new_qh; 452 __le32 link_to_new_qh;
469 __le32 *extra_link = &link_to_new_qh;
470 453
471 /* Find the predecessor QH for our new one and insert it in the list. 454 /* Find the predecessor QH for our new one and insert it in the list.
472 * The list of QHs is expected to be short, so linear search won't 455 * The list of QHs is expected to be short, so linear search won't
@@ -476,31 +459,17 @@ static void link_async(struct uhci_hcd *uhci, struct uhci_qh *qh)
476 break; 459 break;
477 } 460 }
478 list_add(&qh->node, &pqh->node); 461 list_add(&qh->node, &pqh->node);
479 qh->link = pqh->link;
480
481 link_to_new_qh = LINK_TO_QH(qh);
482
483 /* If this is now the first FSBR QH, take special action */
484 if (uhci->fsbr_is_on && pqh->skel < SKEL_FSBR &&
485 qh->skel >= SKEL_FSBR) {
486 lqh = list_entry(uhci->skel_async_qh->node.prev,
487 struct uhci_qh, node);
488
489 /* If the new QH is also the last one, we must unlink
490 * the terminating skeleton QH and make the new QH point
491 * back to itself. */
492 if (qh == lqh) {
493 qh->link = link_to_new_qh;
494 extra_link = &uhci->skel_term_qh->link;
495
496 /* Otherwise the last QH must point to the new QH */
497 } else
498 extra_link = &lqh->link;
499 }
500 462
501 /* Link it into the schedule */ 463 /* Link it into the schedule */
464 qh->link = pqh->link;
502 wmb(); 465 wmb();
503 *extra_link = pqh->link = link_to_new_qh; 466 link_to_new_qh = LINK_TO_QH(qh);
467 pqh->link = link_to_new_qh;
468
469 /* If this is now the first FSBR QH, link the terminating skeleton
470 * QH to it. */
471 if (pqh->skel < SKEL_FSBR && qh->skel >= SKEL_FSBR)
472 uhci->skel_term_qh->link = link_to_new_qh;
504} 473}
505 474
506/* 475/*
@@ -561,31 +530,16 @@ static void unlink_interrupt(struct uhci_hcd *uhci, struct uhci_qh *qh)
561 */ 530 */
562static void unlink_async(struct uhci_hcd *uhci, struct uhci_qh *qh) 531static void unlink_async(struct uhci_hcd *uhci, struct uhci_qh *qh)
563{ 532{
564 struct uhci_qh *pqh, *lqh; 533 struct uhci_qh *pqh;
565 __le32 link_to_next_qh = qh->link; 534 __le32 link_to_next_qh = qh->link;
566 535
567 pqh = list_entry(qh->node.prev, struct uhci_qh, node); 536 pqh = list_entry(qh->node.prev, struct uhci_qh, node);
568
569 /* If this is the first FSBQ QH, take special action */
570 if (uhci->fsbr_is_on && pqh->skel < SKEL_FSBR &&
571 qh->skel >= SKEL_FSBR) {
572 lqh = list_entry(uhci->skel_async_qh->node.prev,
573 struct uhci_qh, node);
574
575 /* If this QH is also the last one, we must link in
576 * the terminating skeleton QH. */
577 if (qh == lqh) {
578 link_to_next_qh = LINK_TO_QH(uhci->skel_term_qh);
579 uhci->skel_term_qh->link = link_to_next_qh;
580 wmb();
581 qh->link = link_to_next_qh;
582
583 /* Otherwise the last QH must point to the new first FSBR QH */
584 } else
585 lqh->link = link_to_next_qh;
586 }
587
588 pqh->link = link_to_next_qh; 537 pqh->link = link_to_next_qh;
538
539 /* If this was the old first FSBR QH, link the terminating skeleton
540 * QH to the next (new first FSBR) QH. */
541 if (pqh->skel < SKEL_FSBR && qh->skel >= SKEL_FSBR)
542 uhci->skel_term_qh->link = link_to_next_qh;
589 mb(); 543 mb();
590} 544}
591 545
@@ -1217,7 +1171,7 @@ static int uhci_result_common(struct uhci_hcd *uhci, struct urb *urb)
1217 1171
1218 if (debug > 1 && errbuf) { 1172 if (debug > 1 && errbuf) {
1219 /* Print the chain for debugging */ 1173 /* Print the chain for debugging */
1220 uhci_show_qh(urbp->qh, errbuf, 1174 uhci_show_qh(uhci, urbp->qh, errbuf,
1221 ERRBUF_LEN, 0); 1175 ERRBUF_LEN, 0);
1222 lprintk(errbuf); 1176 lprintk(errbuf);
1223 } 1177 }
diff --git a/drivers/usb/serial/airprime.c b/drivers/usb/serial/airprime.c
index 7538c64a5097..39a498362594 100644
--- a/drivers/usb/serial/airprime.c
+++ b/drivers/usb/serial/airprime.c
@@ -18,7 +18,6 @@
18 18
19static struct usb_device_id id_table [] = { 19static struct usb_device_id id_table [] = {
20 { USB_DEVICE(0x0c88, 0x17da) }, /* Kyocera Wireless KPC650/Passport */ 20 { USB_DEVICE(0x0c88, 0x17da) }, /* Kyocera Wireless KPC650/Passport */
21 { USB_DEVICE(0x1410, 0x1100) }, /* ExpressCard34 Qualcomm 3G CDMA */
22 { USB_DEVICE(0x413c, 0x8115) }, /* Dell Wireless HSDPA 5500 */ 21 { USB_DEVICE(0x413c, 0x8115) }, /* Dell Wireless HSDPA 5500 */
23 { }, 22 { },
24}; 23};
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index 1633a0fd48e8..8ff9d54b21e6 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -879,6 +879,7 @@ static __u32 get_ftdi_divisor(struct usb_serial_port * port)
879 break; 879 break;
880 case FT232BM: /* FT232BM chip */ 880 case FT232BM: /* FT232BM chip */
881 case FT2232C: /* FT2232C chip */ 881 case FT2232C: /* FT2232C chip */
882 case FT232RL:
882 if (baud <= 3000000) { 883 if (baud <= 3000000) {
883 div_value = ftdi_232bm_baud_to_divisor(baud); 884 div_value = ftdi_232bm_baud_to_divisor(baud);
884 } else { 885 } else {
@@ -1021,9 +1022,12 @@ static void ftdi_determine_type(struct usb_serial_port *port)
1021 /* (It might be a BM because of the iSerialNumber bug, 1022 /* (It might be a BM because of the iSerialNumber bug,
1022 * but it will still work as an AM device.) */ 1023 * but it will still work as an AM device.) */
1023 priv->chip_type = FT8U232AM; 1024 priv->chip_type = FT8U232AM;
1024 } else { 1025 } else if (version < 0x600) {
1025 /* Assume its an FT232BM (or FT245BM) */ 1026 /* Assume its an FT232BM (or FT245BM) */
1026 priv->chip_type = FT232BM; 1027 priv->chip_type = FT232BM;
1028 } else {
1029 /* Assume its an FT232R */
1030 priv->chip_type = FT232RL;
1027 } 1031 }
1028 info("Detected %s", ftdi_chip_name[priv->chip_type]); 1032 info("Detected %s", ftdi_chip_name[priv->chip_type]);
1029} 1033}
diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c
index 53baeec8f265..4f8282ad7720 100644
--- a/drivers/usb/serial/generic.c
+++ b/drivers/usb/serial/generic.c
@@ -20,13 +20,14 @@
20#include <linux/usb/serial.h> 20#include <linux/usb/serial.h>
21#include <asm/uaccess.h> 21#include <asm/uaccess.h>
22 22
23static int generic_probe(struct usb_interface *interface,
24 const struct usb_device_id *id);
25
26 23
27static int debug; 24static int debug;
28 25
29#ifdef CONFIG_USB_SERIAL_GENERIC 26#ifdef CONFIG_USB_SERIAL_GENERIC
27
28static int generic_probe(struct usb_interface *interface,
29 const struct usb_device_id *id);
30
30static __u16 vendor = 0x05f9; 31static __u16 vendor = 0x05f9;
31static __u16 product = 0xffff; 32static __u16 product = 0xffff;
32 33
diff --git a/drivers/video/cg3.c b/drivers/video/cg3.c
index ada6f7e3a891..767c850f8eb7 100644
--- a/drivers/video/cg3.c
+++ b/drivers/video/cg3.c
@@ -186,8 +186,7 @@ static int cg3_setcolreg(unsigned regno,
186 * @blank_mode: the blank mode we want. 186 * @blank_mode: the blank mode we want.
187 * @info: frame buffer structure that represents a single frame buffer 187 * @info: frame buffer structure that represents a single frame buffer
188 */ 188 */
189static int 189static int cg3_blank(int blank, struct fb_info *info)
190cg3_blank(int blank, struct fb_info *info)
191{ 190{
192 struct cg3_par *par = (struct cg3_par *) info->par; 191 struct cg3_par *par = (struct cg3_par *) info->par;
193 struct cg3_regs __iomem *regs = par->regs; 192 struct cg3_regs __iomem *regs = par->regs;
@@ -251,8 +250,8 @@ static int cg3_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg)
251 * Initialisation 250 * Initialisation
252 */ 251 */
253 252
254static void 253static void __devinit cg3_init_fix(struct fb_info *info, int linebytes,
255cg3_init_fix(struct fb_info *info, int linebytes, struct device_node *dp) 254 struct device_node *dp)
256{ 255{
257 strlcpy(info->fix.id, dp->name, sizeof(info->fix.id)); 256 strlcpy(info->fix.id, dp->name, sizeof(info->fix.id));
258 257
@@ -264,8 +263,8 @@ cg3_init_fix(struct fb_info *info, int linebytes, struct device_node *dp)
264 info->fix.accel = FB_ACCEL_SUN_CGTHREE; 263 info->fix.accel = FB_ACCEL_SUN_CGTHREE;
265} 264}
266 265
267static void cg3_rdi_maybe_fixup_var(struct fb_var_screeninfo *var, 266static void __devinit cg3_rdi_maybe_fixup_var(struct fb_var_screeninfo *var,
268 struct device_node *dp) 267 struct device_node *dp)
269{ 268{
270 char *params; 269 char *params;
271 char *p; 270 char *p;
@@ -287,36 +286,36 @@ static void cg3_rdi_maybe_fixup_var(struct fb_var_screeninfo *var,
287 } 286 }
288} 287}
289 288
290static u8 cg3regvals_66hz[] __initdata = { /* 1152 x 900, 66 Hz */ 289static u8 cg3regvals_66hz[] __devinitdata = { /* 1152 x 900, 66 Hz */
291 0x14, 0xbb, 0x15, 0x2b, 0x16, 0x04, 0x17, 0x14, 290 0x14, 0xbb, 0x15, 0x2b, 0x16, 0x04, 0x17, 0x14,
292 0x18, 0xae, 0x19, 0x03, 0x1a, 0xa8, 0x1b, 0x24, 291 0x18, 0xae, 0x19, 0x03, 0x1a, 0xa8, 0x1b, 0x24,
293 0x1c, 0x01, 0x1d, 0x05, 0x1e, 0xff, 0x1f, 0x01, 292 0x1c, 0x01, 0x1d, 0x05, 0x1e, 0xff, 0x1f, 0x01,
294 0x10, 0x20, 0 293 0x10, 0x20, 0
295}; 294};
296 295
297static u8 cg3regvals_76hz[] __initdata = { /* 1152 x 900, 76 Hz */ 296static u8 cg3regvals_76hz[] __devinitdata = { /* 1152 x 900, 76 Hz */
298 0x14, 0xb7, 0x15, 0x27, 0x16, 0x03, 0x17, 0x0f, 297 0x14, 0xb7, 0x15, 0x27, 0x16, 0x03, 0x17, 0x0f,
299 0x18, 0xae, 0x19, 0x03, 0x1a, 0xae, 0x1b, 0x2a, 298 0x18, 0xae, 0x19, 0x03, 0x1a, 0xae, 0x1b, 0x2a,
300 0x1c, 0x01, 0x1d, 0x09, 0x1e, 0xff, 0x1f, 0x01, 299 0x1c, 0x01, 0x1d, 0x09, 0x1e, 0xff, 0x1f, 0x01,
301 0x10, 0x24, 0 300 0x10, 0x24, 0
302}; 301};
303 302
304static u8 cg3regvals_rdi[] __initdata = { /* 640 x 480, cgRDI */ 303static u8 cg3regvals_rdi[] __devinitdata = { /* 640 x 480, cgRDI */
305 0x14, 0x70, 0x15, 0x20, 0x16, 0x08, 0x17, 0x10, 304 0x14, 0x70, 0x15, 0x20, 0x16, 0x08, 0x17, 0x10,
306 0x18, 0x06, 0x19, 0x02, 0x1a, 0x31, 0x1b, 0x51, 305 0x18, 0x06, 0x19, 0x02, 0x1a, 0x31, 0x1b, 0x51,
307 0x1c, 0x06, 0x1d, 0x0c, 0x1e, 0xff, 0x1f, 0x01, 306 0x1c, 0x06, 0x1d, 0x0c, 0x1e, 0xff, 0x1f, 0x01,
308 0x10, 0x22, 0 307 0x10, 0x22, 0
309}; 308};
310 309
311static u8 *cg3_regvals[] __initdata = { 310static u8 *cg3_regvals[] __devinitdata = {
312 cg3regvals_66hz, cg3regvals_76hz, cg3regvals_rdi 311 cg3regvals_66hz, cg3regvals_76hz, cg3regvals_rdi
313}; 312};
314 313
315static u_char cg3_dacvals[] __initdata = { 314static u_char cg3_dacvals[] __devinitdata = {
316 4, 0xff, 5, 0x00, 6, 0x70, 7, 0x00, 0 315 4, 0xff, 5, 0x00, 6, 0x70, 7, 0x00, 0
317}; 316};
318 317
319static void cg3_do_default_mode(struct cg3_par *par) 318static void __devinit cg3_do_default_mode(struct cg3_par *par)
320{ 319{
321 enum cg3_type type; 320 enum cg3_type type;
322 u8 *p; 321 u8 *p;
@@ -433,7 +432,8 @@ static int __devinit cg3_init_one(struct of_device *op)
433 return 0; 432 return 0;
434} 433}
435 434
436static int __devinit cg3_probe(struct of_device *dev, const struct of_device_id *match) 435static int __devinit cg3_probe(struct of_device *dev,
436 const struct of_device_id *match)
437{ 437{
438 struct of_device *op = to_of_device(&dev->dev); 438 struct of_device *op = to_of_device(&dev->dev);
439 439
diff --git a/drivers/video/ffb.c b/drivers/video/ffb.c
index 15854aec3180..1d4e8354b561 100644
--- a/drivers/video/ffb.c
+++ b/drivers/video/ffb.c
@@ -336,14 +336,30 @@ struct ffb_dac {
336 u32 value2; 336 u32 value2;
337}; 337};
338 338
339#define FFB_DAC_UCTRL 0x1001 /* User Control */
340#define FFB_DAC_UCTRL_MANREV 0x00000f00 /* 4-bit Manufacturing Revision */
341#define FFB_DAC_UCTRL_MANREV_SHIFT 8
342#define FFB_DAC_TGEN 0x6000 /* Timing Generator */
343#define FFB_DAC_TGEN_VIDE 0x00000001 /* Video Enable */
344#define FFB_DAC_DID 0x8000 /* Device Identification */
345#define FFB_DAC_DID_PNUM 0x0ffff000 /* Device Part Number */
346#define FFB_DAC_DID_PNUM_SHIFT 12
347#define FFB_DAC_DID_REV 0xf0000000 /* Device Revision */
348#define FFB_DAC_DID_REV_SHIFT 28
349
350#define FFB_DAC_CUR_CTRL 0x100
351#define FFB_DAC_CUR_CTRL_P0 0x00000001
352#define FFB_DAC_CUR_CTRL_P1 0x00000002
353
339struct ffb_par { 354struct ffb_par {
340 spinlock_t lock; 355 spinlock_t lock;
341 struct ffb_fbc __iomem *fbc; 356 struct ffb_fbc __iomem *fbc;
342 struct ffb_dac __iomem *dac; 357 struct ffb_dac __iomem *dac;
343 358
344 u32 flags; 359 u32 flags;
345#define FFB_FLAG_AFB 0x00000001 360#define FFB_FLAG_AFB 0x00000001 /* AFB m3 or m6 */
346#define FFB_FLAG_BLANKED 0x00000002 361#define FFB_FLAG_BLANKED 0x00000002 /* screen is blanked */
362#define FFB_FLAG_INVCURSOR 0x00000004 /* DAC has inverted cursor logic */
347 363
348 u32 fg_cache __attribute__((aligned (8))); 364 u32 fg_cache __attribute__((aligned (8)));
349 u32 bg_cache; 365 u32 bg_cache;
@@ -354,7 +370,6 @@ struct ffb_par {
354 unsigned long physbase; 370 unsigned long physbase;
355 unsigned long fbsize; 371 unsigned long fbsize;
356 372
357 int dac_rev;
358 int board_type; 373 int board_type;
359}; 374};
360 375
@@ -426,11 +441,12 @@ static void ffb_switch_from_graph(struct ffb_par *par)
426 FFBWait(par); 441 FFBWait(par);
427 442
428 /* Disable cursor. */ 443 /* Disable cursor. */
429 upa_writel(0x100, &dac->type2); 444 upa_writel(FFB_DAC_CUR_CTRL, &dac->type2);
430 if (par->dac_rev <= 2) 445 if (par->flags & FFB_FLAG_INVCURSOR)
431 upa_writel(0, &dac->value2); 446 upa_writel(0, &dac->value2);
432 else 447 else
433 upa_writel(3, &dac->value2); 448 upa_writel((FFB_DAC_CUR_CTRL_P0 |
449 FFB_DAC_CUR_CTRL_P1), &dac->value2);
434 450
435 spin_unlock_irqrestore(&par->lock, flags); 451 spin_unlock_irqrestore(&par->lock, flags);
436} 452}
@@ -664,18 +680,18 @@ ffb_blank(int blank, struct fb_info *info)
664 struct ffb_par *par = (struct ffb_par *) info->par; 680 struct ffb_par *par = (struct ffb_par *) info->par;
665 struct ffb_dac __iomem *dac = par->dac; 681 struct ffb_dac __iomem *dac = par->dac;
666 unsigned long flags; 682 unsigned long flags;
667 u32 tmp; 683 u32 val;
684 int i;
668 685
669 spin_lock_irqsave(&par->lock, flags); 686 spin_lock_irqsave(&par->lock, flags);
670 687
671 FFBWait(par); 688 FFBWait(par);
672 689
690 upa_writel(FFB_DAC_TGEN, &dac->type);
691 val = upa_readl(&dac->value);
673 switch (blank) { 692 switch (blank) {
674 case FB_BLANK_UNBLANK: /* Unblanking */ 693 case FB_BLANK_UNBLANK: /* Unblanking */
675 upa_writel(0x6000, &dac->type); 694 val |= FFB_DAC_TGEN_VIDE;
676 tmp = (upa_readl(&dac->value) | 0x1);
677 upa_writel(0x6000, &dac->type);
678 upa_writel(tmp, &dac->value);
679 par->flags &= ~FFB_FLAG_BLANKED; 695 par->flags &= ~FFB_FLAG_BLANKED;
680 break; 696 break;
681 697
@@ -683,13 +699,16 @@ ffb_blank(int blank, struct fb_info *info)
683 case FB_BLANK_VSYNC_SUSPEND: /* VESA blank (vsync off) */ 699 case FB_BLANK_VSYNC_SUSPEND: /* VESA blank (vsync off) */
684 case FB_BLANK_HSYNC_SUSPEND: /* VESA blank (hsync off) */ 700 case FB_BLANK_HSYNC_SUSPEND: /* VESA blank (hsync off) */
685 case FB_BLANK_POWERDOWN: /* Poweroff */ 701 case FB_BLANK_POWERDOWN: /* Poweroff */
686 upa_writel(0x6000, &dac->type); 702 val &= ~FFB_DAC_TGEN_VIDE;
687 tmp = (upa_readl(&dac->value) & ~0x1);
688 upa_writel(0x6000, &dac->type);
689 upa_writel(tmp, &dac->value);
690 par->flags |= FFB_FLAG_BLANKED; 703 par->flags |= FFB_FLAG_BLANKED;
691 break; 704 break;
692 } 705 }
706 upa_writel(FFB_DAC_TGEN, &dac->type);
707 upa_writel(val, &dac->value);
708 for (i = 0; i < 10; i++) {
709 upa_writel(FFB_DAC_TGEN, &dac->type);
710 upa_readl(&dac->value);
711 }
693 712
694 spin_unlock_irqrestore(&par->lock, flags); 713 spin_unlock_irqrestore(&par->lock, flags);
695 714
@@ -894,6 +913,7 @@ static int ffb_init_one(struct of_device *op)
894 struct ffb_dac __iomem *dac; 913 struct ffb_dac __iomem *dac;
895 struct all_info *all; 914 struct all_info *all;
896 int err; 915 int err;
916 u32 dac_pnum, dac_rev, dac_mrev;
897 917
898 all = kzalloc(sizeof(*all), GFP_KERNEL); 918 all = kzalloc(sizeof(*all), GFP_KERNEL);
899 if (!all) 919 if (!all)
@@ -948,17 +968,31 @@ static int ffb_init_one(struct of_device *op)
948 if ((upa_readl(&fbc->ucsr) & FFB_UCSR_ALL_ERRORS) != 0) 968 if ((upa_readl(&fbc->ucsr) & FFB_UCSR_ALL_ERRORS) != 0)
949 upa_writel(FFB_UCSR_ALL_ERRORS, &fbc->ucsr); 969 upa_writel(FFB_UCSR_ALL_ERRORS, &fbc->ucsr);
950 970
951 ffb_switch_from_graph(&all->par);
952
953 dac = all->par.dac; 971 dac = all->par.dac;
954 upa_writel(0x8000, &dac->type); 972 upa_writel(FFB_DAC_DID, &dac->type);
955 all->par.dac_rev = upa_readl(&dac->value) >> 0x1c; 973 dac_pnum = upa_readl(&dac->value);
974 dac_rev = (dac_pnum & FFB_DAC_DID_REV) >> FFB_DAC_DID_REV_SHIFT;
975 dac_pnum = (dac_pnum & FFB_DAC_DID_PNUM) >> FFB_DAC_DID_PNUM_SHIFT;
976
977 upa_writel(FFB_DAC_UCTRL, &dac->type);
978 dac_mrev = upa_readl(&dac->value);
979 dac_mrev = (dac_mrev & FFB_DAC_UCTRL_MANREV) >>
980 FFB_DAC_UCTRL_MANREV_SHIFT;
956 981
957 /* Elite3D has different DAC revision numbering, and no DAC revisions 982 /* Elite3D has different DAC revision numbering, and no DAC revisions
958 * have the reversed meaning of cursor enable. 983 * have the reversed meaning of cursor enable. Otherwise, Pacifica 1
984 * ramdacs with manufacturing revision less than 3 have inverted
985 * cursor logic. We identify Pacifica 1 as not Pacifica 2, the
986 * latter having a part number value of 0x236e.
959 */ 987 */
960 if (all->par.flags & FFB_FLAG_AFB) 988 if ((all->par.flags & FFB_FLAG_AFB) || dac_pnum == 0x236e) {
961 all->par.dac_rev = 10; 989 all->par.flags &= ~FFB_FLAG_INVCURSOR;
990 } else {
991 if (dac_mrev < 3)
992 all->par.flags |= FFB_FLAG_INVCURSOR;
993 }
994
995 ffb_switch_from_graph(&all->par);
962 996
963 /* Unblank it just to be sure. When there are multiple 997 /* Unblank it just to be sure. When there are multiple
964 * FFB/AFB cards in the system, or it is not the OBP 998 * FFB/AFB cards in the system, or it is not the OBP
@@ -993,10 +1027,12 @@ static int ffb_init_one(struct of_device *op)
993 1027
994 dev_set_drvdata(&op->dev, all); 1028 dev_set_drvdata(&op->dev, all);
995 1029
996 printk("%s: %s at %016lx, type %d, DAC revision %d\n", 1030 printk("%s: %s at %016lx, type %d, "
1031 "DAC pnum[%x] rev[%d] manuf_rev[%d]\n",
997 dp->full_name, 1032 dp->full_name,
998 ((all->par.flags & FFB_FLAG_AFB) ? "AFB" : "FFB"), 1033 ((all->par.flags & FFB_FLAG_AFB) ? "AFB" : "FFB"),
999 all->par.physbase, all->par.board_type, all->par.dac_rev); 1034 all->par.physbase, all->par.board_type,
1035 dac_pnum, dac_rev, dac_mrev);
1000 1036
1001 return 0; 1037 return 0;
1002} 1038}
diff --git a/drivers/video/riva/fbdev.c b/drivers/video/riva/fbdev.c
index 1d1c7c624d7f..d7ece8d17a2c 100644
--- a/drivers/video/riva/fbdev.c
+++ b/drivers/video/riva/fbdev.c
@@ -285,8 +285,6 @@ static const struct riva_regs reg_template = {
285#define MAX_LEVEL 0x534 285#define MAX_LEVEL 0x534
286#define LEVEL_STEP ((MAX_LEVEL - MIN_LEVEL) / FB_BACKLIGHT_MAX) 286#define LEVEL_STEP ((MAX_LEVEL - MIN_LEVEL) / FB_BACKLIGHT_MAX)
287 287
288static struct backlight_properties riva_bl_data;
289
290static int riva_bl_get_level_brightness(struct riva_par *par, 288static int riva_bl_get_level_brightness(struct riva_par *par,
291 int level) 289 int level)
292{ 290{
@@ -372,7 +370,7 @@ static void riva_bl_init(struct riva_par *par)
372 FB_BACKLIGHT_MAX); 370 FB_BACKLIGHT_MAX);
373 371
374 bd->props.max_brightness = FB_BACKLIGHT_LEVELS - 1; 372 bd->props.max_brightness = FB_BACKLIGHT_LEVELS - 1;
375 bd->props.brightness = riva_bl_data.max_brightness; 373 bd->props.brightness = bd->props.max_brightness;
376 bd->props.power = FB_BLANK_UNBLANK; 374 bd->props.power = FB_BLANK_UNBLANK;
377 backlight_update_status(bd); 375 backlight_update_status(bd);
378 376
diff --git a/drivers/video/s3fb.c b/drivers/video/s3fb.c
index 98919a6975f0..3091b20124b4 100644
--- a/drivers/video/s3fb.c
+++ b/drivers/video/s3fb.c
@@ -1000,11 +1000,12 @@ err_enable_device:
1000static void __devexit s3_pci_remove(struct pci_dev *dev) 1000static void __devexit s3_pci_remove(struct pci_dev *dev)
1001{ 1001{
1002 struct fb_info *info = pci_get_drvdata(dev); 1002 struct fb_info *info = pci_get_drvdata(dev);
1003 struct s3fb_info *par = info->par;
1004 1003
1005 if (info) { 1004 if (info) {
1006 1005
1007#ifdef CONFIG_MTRR 1006#ifdef CONFIG_MTRR
1007 struct s3fb_info *par = info->par;
1008
1008 if (par->mtrr_reg >= 0) { 1009 if (par->mtrr_reg >= 0) {
1009 mtrr_del(par->mtrr_reg, 0, 0); 1010 mtrr_del(par->mtrr_reg, 0, 0);
1010 par->mtrr_reg = -1; 1011 par->mtrr_reg = -1;
diff --git a/fs/9p/v9fs_vfs.h b/fs/9p/v9fs_vfs.h
index 8ada4c5c5d70..6a82d39dc498 100644
--- a/fs/9p/v9fs_vfs.h
+++ b/fs/9p/v9fs_vfs.h
@@ -40,7 +40,6 @@
40extern struct file_system_type v9fs_fs_type; 40extern struct file_system_type v9fs_fs_type;
41extern const struct address_space_operations v9fs_addr_operations; 41extern const struct address_space_operations v9fs_addr_operations;
42extern const struct file_operations v9fs_file_operations; 42extern const struct file_operations v9fs_file_operations;
43extern const struct file_operations v9fs_cached_file_operations;
44extern const struct file_operations v9fs_dir_operations; 43extern const struct file_operations v9fs_dir_operations;
45extern struct dentry_operations v9fs_dentry_operations; 44extern struct dentry_operations v9fs_dentry_operations;
46extern struct dentry_operations v9fs_cached_dentry_operations; 45extern struct dentry_operations v9fs_cached_dentry_operations;
diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c
index 653dfa5b2531..c7b677253843 100644
--- a/fs/9p/vfs_file.c
+++ b/fs/9p/vfs_file.c
@@ -42,6 +42,8 @@
42#include "v9fs_vfs.h" 42#include "v9fs_vfs.h"
43#include "fid.h" 43#include "fid.h"
44 44
45static const struct file_operations v9fs_cached_file_operations;
46
45/** 47/**
46 * v9fs_file_open - open a file (or directory) 48 * v9fs_file_open - open a file (or directory)
47 * @inode: inode to be opened 49 * @inode: inode to be opened
@@ -245,7 +247,7 @@ v9fs_file_write(struct file *filp, const char __user * data,
245 return total; 247 return total;
246} 248}
247 249
248const struct file_operations v9fs_cached_file_operations = { 250static const struct file_operations v9fs_cached_file_operations = {
249 .llseek = generic_file_llseek, 251 .llseek = generic_file_llseek,
250 .read = do_sync_read, 252 .read = do_sync_read,
251 .aio_read = generic_file_aio_read, 253 .aio_read = generic_file_aio_read,
diff --git a/fs/aio.c b/fs/aio.c
index 0b4ee0a5c83e..e4598d6d49dd 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -136,7 +136,6 @@ static int aio_setup_ring(struct kioctx *ctx)
136 0); 136 0);
137 if (IS_ERR((void *)info->mmap_base)) { 137 if (IS_ERR((void *)info->mmap_base)) {
138 up_write(&ctx->mm->mmap_sem); 138 up_write(&ctx->mm->mmap_sem);
139 printk("mmap err: %ld\n", -info->mmap_base);
140 info->mmap_size = 0; 139 info->mmap_size = 0;
141 aio_free_ring(ctx); 140 aio_free_ring(ctx);
142 return -EAGAIN; 141 return -EAGAIN;
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index a2fceba7ef8e..9cc4f0a8aaae 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -1704,7 +1704,10 @@ static int elf_core_dump(long signr, struct pt_regs *regs, struct file *file)
1704 DUMP_SEEK(PAGE_SIZE); 1704 DUMP_SEEK(PAGE_SIZE);
1705 } else { 1705 } else {
1706 if (page == ZERO_PAGE(addr)) { 1706 if (page == ZERO_PAGE(addr)) {
1707 DUMP_SEEK(PAGE_SIZE); 1707 if (!dump_seek(file, PAGE_SIZE)) {
1708 page_cache_release(page);
1709 goto end_coredump;
1710 }
1708 } else { 1711 } else {
1709 void *kaddr; 1712 void *kaddr;
1710 flush_cache_page(vma, addr, 1713 flush_cache_page(vma, addr,
diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c
index 5810aa1339fd..f3ddca4a387b 100644
--- a/fs/binfmt_elf_fdpic.c
+++ b/fs/binfmt_elf_fdpic.c
@@ -179,6 +179,8 @@ static int load_elf_fdpic_binary(struct linux_binprm *bprm,
179 int executable_stack; 179 int executable_stack;
180 int retval, i; 180 int retval, i;
181 181
182 kdebug("____ LOAD %d ____", current->pid);
183
182 memset(&exec_params, 0, sizeof(exec_params)); 184 memset(&exec_params, 0, sizeof(exec_params));
183 memset(&interp_params, 0, sizeof(interp_params)); 185 memset(&interp_params, 0, sizeof(interp_params));
184 186
@@ -941,8 +943,11 @@ static int elf_fdpic_map_file_constdisp_on_uclinux(
941 943
942 if (mm) { 944 if (mm) {
943 if (phdr->p_flags & PF_X) { 945 if (phdr->p_flags & PF_X) {
944 mm->start_code = seg->addr; 946 if (!mm->start_code) {
945 mm->end_code = seg->addr + phdr->p_memsz; 947 mm->start_code = seg->addr;
948 mm->end_code = seg->addr +
949 phdr->p_memsz;
950 }
946 } else if (!mm->start_data) { 951 } else if (!mm->start_data) {
947 mm->start_data = seg->addr; 952 mm->start_data = seg->addr;
948#ifndef CONFIG_MMU 953#ifndef CONFIG_MMU
@@ -1123,8 +1128,10 @@ static int elf_fdpic_map_file_by_direct_mmap(struct elf_fdpic_params *params,
1123 1128
1124 if (mm) { 1129 if (mm) {
1125 if (phdr->p_flags & PF_X) { 1130 if (phdr->p_flags & PF_X) {
1126 mm->start_code = maddr; 1131 if (!mm->start_code) {
1127 mm->end_code = maddr + phdr->p_memsz; 1132 mm->start_code = maddr;
1133 mm->end_code = maddr + phdr->p_memsz;
1134 }
1128 } else if (!mm->start_data) { 1135 } else if (!mm->start_data) {
1129 mm->start_data = maddr; 1136 mm->start_data = maddr;
1130 mm->end_data = maddr + phdr->p_memsz; 1137 mm->end_data = maddr + phdr->p_memsz;
@@ -1473,8 +1480,8 @@ static int elf_fdpic_dump_segments(struct file *file, struct mm_struct *mm,
1473 DUMP_SEEK(file->f_pos + PAGE_SIZE); 1480 DUMP_SEEK(file->f_pos + PAGE_SIZE);
1474 } 1481 }
1475 else if (page == ZERO_PAGE(addr)) { 1482 else if (page == ZERO_PAGE(addr)) {
1476 DUMP_SEEK(file->f_pos + PAGE_SIZE);
1477 page_cache_release(page); 1483 page_cache_release(page);
1484 DUMP_SEEK(file->f_pos + PAGE_SIZE);
1478 } 1485 }
1479 else { 1486 else {
1480 void *kaddr; 1487 void *kaddr;
diff --git a/fs/char_dev.c b/fs/char_dev.c
index 78ced721554d..164a45cdaf5f 100644
--- a/fs/char_dev.c
+++ b/fs/char_dev.c
@@ -109,8 +109,6 @@ __register_chrdev_region(unsigned int major, unsigned int baseminor,
109 /* temporary */ 109 /* temporary */
110 if (major == 0) { 110 if (major == 0) {
111 for (i = ARRAY_SIZE(chrdevs)-1; i > 0; i--) { 111 for (i = ARRAY_SIZE(chrdevs)-1; i > 0; i--) {
112 if (is_lanana_major(i))
113 continue;
114 if (chrdevs[i] == NULL) 112 if (chrdevs[i] == NULL)
115 break; 113 break;
116 } 114 }
diff --git a/fs/cifs/CHANGES b/fs/cifs/CHANGES
index 6247628bdaed..5d1f4873d701 100644
--- a/fs/cifs/CHANGES
+++ b/fs/cifs/CHANGES
@@ -4,6 +4,12 @@ Fix mtime bouncing around from local idea of last write times to remote time.
4Fix hang (in i_size_read) when simultaneous size update of same remote file 4Fix hang (in i_size_read) when simultaneous size update of same remote file
5on smp system corrupts sequence number. Do not reread unnecessarily partial page 5on smp system corrupts sequence number. Do not reread unnecessarily partial page
6(which we are about to overwrite anyway) when writing out file opened rw. 6(which we are about to overwrite anyway) when writing out file opened rw.
7When DOS attribute of file on non-Unix server's file changes on the server side
8from read-only back to read-write, reflect this change in default file mode
9(we had been leaving a file's mode read-only until the inode were reloaded).
10Allow setting of attribute back to ATTR_NORMAL (removing readonly dos attribute
11when archive dos attribute not set and we are changing mode back to writeable
12on server which does not support the Unix Extensions).
7 13
8Version 1.47 14Version 1.47
9------------ 15------------
diff --git a/fs/cifs/cifspdu.h b/fs/cifs/cifspdu.h
index 3af76249dc8b..4d8948e8762c 100644
--- a/fs/cifs/cifspdu.h
+++ b/fs/cifs/cifspdu.h
@@ -1887,7 +1887,13 @@ typedef struct {
1887 calls including posix open 1887 calls including posix open
1888 and posix unlink */ 1888 and posix unlink */
1889#ifdef CONFIG_CIFS_POSIX 1889#ifdef CONFIG_CIFS_POSIX
1890#define CIFS_UNIX_CAP_MASK 0x0000003b 1890/* Can not set pathnames cap yet until we send new posix create SMB since
1891 otherwise server can treat such handles opened with older ntcreatex
1892 (by a new client which knows how to send posix path ops)
1893 as non-posix handles (can affect write behavior with byte range locks.
1894 We can add back in POSIX_PATH_OPS cap when Posix Create/Mkdir finished */
1895/* #define CIFS_UNIX_CAP_MASK 0x0000003b */
1896#define CIFS_UNIX_CAP_MASK 0x0000001b
1891#else 1897#else
1892#define CIFS_UNIX_CAP_MASK 0x00000013 1898#define CIFS_UNIX_CAP_MASK 0x00000013
1893#endif /* CONFIG_CIFS_POSIX */ 1899#endif /* CONFIG_CIFS_POSIX */
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index 86b9dbbd8441..f414526e476a 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -494,6 +494,12 @@ int cifs_get_inode_info(struct inode **pinode,
494 mode e.g. 555 */ 494 mode e.g. 555 */
495 if (cifsInfo->cifsAttrs & ATTR_READONLY) 495 if (cifsInfo->cifsAttrs & ATTR_READONLY)
496 inode->i_mode &= ~(S_IWUGO); 496 inode->i_mode &= ~(S_IWUGO);
497 else if ((inode->i_mode & S_IWUGO) == 0)
498 /* the ATTR_READONLY flag may have been */
499 /* changed on server -- set any w bits */
500 /* allowed by mnt_file_mode */
501 inode->i_mode |= (S_IWUGO &
502 cifs_sb->mnt_file_mode);
497 /* BB add code here - 503 /* BB add code here -
498 validate if device or weird share or device type? */ 504 validate if device or weird share or device type? */
499 } 505 }
@@ -1190,6 +1196,7 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
1190 struct cifsFileInfo *open_file = NULL; 1196 struct cifsFileInfo *open_file = NULL;
1191 FILE_BASIC_INFO time_buf; 1197 FILE_BASIC_INFO time_buf;
1192 int set_time = FALSE; 1198 int set_time = FALSE;
1199 int set_dosattr = FALSE;
1193 __u64 mode = 0xFFFFFFFFFFFFFFFFULL; 1200 __u64 mode = 0xFFFFFFFFFFFFFFFFULL;
1194 __u64 uid = 0xFFFFFFFFFFFFFFFFULL; 1201 __u64 uid = 0xFFFFFFFFFFFFFFFFULL;
1195 __u64 gid = 0xFFFFFFFFFFFFFFFFULL; 1202 __u64 gid = 0xFFFFFFFFFFFFFFFFULL;
@@ -1326,15 +1333,23 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
1326 else if (attrs->ia_valid & ATTR_MODE) { 1333 else if (attrs->ia_valid & ATTR_MODE) {
1327 rc = 0; 1334 rc = 0;
1328 if ((mode & S_IWUGO) == 0) /* not writeable */ { 1335 if ((mode & S_IWUGO) == 0) /* not writeable */ {
1329 if ((cifsInode->cifsAttrs & ATTR_READONLY) == 0) 1336 if ((cifsInode->cifsAttrs & ATTR_READONLY) == 0) {
1337 set_dosattr = TRUE;
1330 time_buf.Attributes = 1338 time_buf.Attributes =
1331 cpu_to_le32(cifsInode->cifsAttrs | 1339 cpu_to_le32(cifsInode->cifsAttrs |
1332 ATTR_READONLY); 1340 ATTR_READONLY);
1341 }
1333 } else if ((mode & S_IWUGO) == S_IWUGO) { 1342 } else if ((mode & S_IWUGO) == S_IWUGO) {
1334 if (cifsInode->cifsAttrs & ATTR_READONLY) 1343 if (cifsInode->cifsAttrs & ATTR_READONLY) {
1344 set_dosattr = TRUE;
1335 time_buf.Attributes = 1345 time_buf.Attributes =
1336 cpu_to_le32(cifsInode->cifsAttrs & 1346 cpu_to_le32(cifsInode->cifsAttrs &
1337 (~ATTR_READONLY)); 1347 (~ATTR_READONLY));
1348 /* Windows ignores set to zero */
1349 if(time_buf.Attributes == 0)
1350 time_buf.Attributes |=
1351 cpu_to_le32(ATTR_NORMAL);
1352 }
1338 } 1353 }
1339 /* BB to be implemented - 1354 /* BB to be implemented -
1340 via Windows security descriptors or streams */ 1355 via Windows security descriptors or streams */
@@ -1372,7 +1387,7 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
1372 } else 1387 } else
1373 time_buf.ChangeTime = 0; 1388 time_buf.ChangeTime = 0;
1374 1389
1375 if (set_time || time_buf.Attributes) { 1390 if (set_time || set_dosattr) {
1376 time_buf.CreationTime = 0; /* do not change */ 1391 time_buf.CreationTime = 0; /* do not change */
1377 /* In the future we should experiment - try setting timestamps 1392 /* In the future we should experiment - try setting timestamps
1378 via Handle (SetFileInfo) instead of by path */ 1393 via Handle (SetFileInfo) instead of by path */
diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c
index 44cfb528797d..2a374d5215ab 100644
--- a/fs/cifs/readdir.c
+++ b/fs/cifs/readdir.c
@@ -219,6 +219,10 @@ static void fill_in_inode(struct inode *tmp_inode, int new_buf_type,
219 tmp_inode->i_mode |= S_IFREG; 219 tmp_inode->i_mode |= S_IFREG;
220 if (attr & ATTR_READONLY) 220 if (attr & ATTR_READONLY)
221 tmp_inode->i_mode &= ~(S_IWUGO); 221 tmp_inode->i_mode &= ~(S_IWUGO);
222 else if ((tmp_inode->i_mode & S_IWUGO) == 0)
223 /* the ATTR_READONLY flag may have been changed on */
224 /* server -- set any w bits allowed by mnt_file_mode */
225 tmp_inode->i_mode |= (S_IWUGO & cifs_sb->mnt_file_mode);
222 } /* could add code here - to validate if device or weird share type? */ 226 } /* could add code here - to validate if device or weird share type? */
223 227
224 /* can not fill in nlink here as in qpathinfo version and Unx search */ 228 /* can not fill in nlink here as in qpathinfo version and Unx search */
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c
index c81c958b3e1d..8b1c5d8bf4ef 100644
--- a/fs/compat_ioctl.c
+++ b/fs/compat_ioctl.c
@@ -2553,11 +2553,15 @@ HANDLE_IOCTL(I2C_RDWR, do_i2c_rdwr_ioctl)
2553HANDLE_IOCTL(I2C_SMBUS, do_i2c_smbus_ioctl) 2553HANDLE_IOCTL(I2C_SMBUS, do_i2c_smbus_ioctl)
2554/* wireless */ 2554/* wireless */
2555HANDLE_IOCTL(SIOCGIWRANGE, do_wireless_ioctl) 2555HANDLE_IOCTL(SIOCGIWRANGE, do_wireless_ioctl)
2556HANDLE_IOCTL(SIOCGIWPRIV, do_wireless_ioctl)
2557HANDLE_IOCTL(SIOCGIWSTATS, do_wireless_ioctl)
2556HANDLE_IOCTL(SIOCSIWSPY, do_wireless_ioctl) 2558HANDLE_IOCTL(SIOCSIWSPY, do_wireless_ioctl)
2557HANDLE_IOCTL(SIOCGIWSPY, do_wireless_ioctl) 2559HANDLE_IOCTL(SIOCGIWSPY, do_wireless_ioctl)
2558HANDLE_IOCTL(SIOCSIWTHRSPY, do_wireless_ioctl) 2560HANDLE_IOCTL(SIOCSIWTHRSPY, do_wireless_ioctl)
2559HANDLE_IOCTL(SIOCGIWTHRSPY, do_wireless_ioctl) 2561HANDLE_IOCTL(SIOCGIWTHRSPY, do_wireless_ioctl)
2562HANDLE_IOCTL(SIOCSIWMLME, do_wireless_ioctl)
2560HANDLE_IOCTL(SIOCGIWAPLIST, do_wireless_ioctl) 2563HANDLE_IOCTL(SIOCGIWAPLIST, do_wireless_ioctl)
2564HANDLE_IOCTL(SIOCSIWSCAN, do_wireless_ioctl)
2561HANDLE_IOCTL(SIOCGIWSCAN, do_wireless_ioctl) 2565HANDLE_IOCTL(SIOCGIWSCAN, do_wireless_ioctl)
2562HANDLE_IOCTL(SIOCSIWESSID, do_wireless_ioctl) 2566HANDLE_IOCTL(SIOCSIWESSID, do_wireless_ioctl)
2563HANDLE_IOCTL(SIOCGIWESSID, do_wireless_ioctl) 2567HANDLE_IOCTL(SIOCGIWESSID, do_wireless_ioctl)
@@ -2565,6 +2569,11 @@ HANDLE_IOCTL(SIOCSIWNICKN, do_wireless_ioctl)
2565HANDLE_IOCTL(SIOCGIWNICKN, do_wireless_ioctl) 2569HANDLE_IOCTL(SIOCGIWNICKN, do_wireless_ioctl)
2566HANDLE_IOCTL(SIOCSIWENCODE, do_wireless_ioctl) 2570HANDLE_IOCTL(SIOCSIWENCODE, do_wireless_ioctl)
2567HANDLE_IOCTL(SIOCGIWENCODE, do_wireless_ioctl) 2571HANDLE_IOCTL(SIOCGIWENCODE, do_wireless_ioctl)
2572HANDLE_IOCTL(SIOCSIWGENIE, do_wireless_ioctl)
2573HANDLE_IOCTL(SIOCGIWGENIE, do_wireless_ioctl)
2574HANDLE_IOCTL(SIOCSIWENCODEEXT, do_wireless_ioctl)
2575HANDLE_IOCTL(SIOCGIWENCODEEXT, do_wireless_ioctl)
2576HANDLE_IOCTL(SIOCSIWPMKSA, do_wireless_ioctl)
2568HANDLE_IOCTL(SIOCSIFBR, old_bridge_ioctl) 2577HANDLE_IOCTL(SIOCSIFBR, old_bridge_ioctl)
2569HANDLE_IOCTL(SIOCGIFBR, old_bridge_ioctl) 2578HANDLE_IOCTL(SIOCGIFBR, old_bridge_ioctl)
2570HANDLE_IOCTL(RTC_IRQP_READ32, rtc_ioctl) 2579HANDLE_IOCTL(RTC_IRQP_READ32, rtc_ioctl)
diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c
index 8a824f4ce5c6..a5b150f7e8a2 100644
--- a/fs/ext3/inode.c
+++ b/fs/ext3/inode.c
@@ -1148,102 +1148,37 @@ static int do_journal_get_write_access(handle_t *handle,
1148 return ext3_journal_get_write_access(handle, bh); 1148 return ext3_journal_get_write_access(handle, bh);
1149} 1149}
1150 1150
1151/*
1152 * The idea of this helper function is following:
1153 * if prepare_write has allocated some blocks, but not all of them, the
1154 * transaction must include the content of the newly allocated blocks.
1155 * This content is expected to be set to zeroes by block_prepare_write().
1156 * 2006/10/14 SAW
1157 */
1158static int ext3_prepare_failure(struct file *file, struct page *page,
1159 unsigned from, unsigned to)
1160{
1161 struct address_space *mapping;
1162 struct buffer_head *bh, *head, *next;
1163 unsigned block_start, block_end;
1164 unsigned blocksize;
1165 int ret;
1166 handle_t *handle = ext3_journal_current_handle();
1167
1168 mapping = page->mapping;
1169 if (ext3_should_writeback_data(mapping->host)) {
1170 /* optimization: no constraints about data */
1171skip:
1172 return ext3_journal_stop(handle);
1173 }
1174
1175 head = page_buffers(page);
1176 blocksize = head->b_size;
1177 for ( bh = head, block_start = 0;
1178 bh != head || !block_start;
1179 block_start = block_end, bh = next)
1180 {
1181 next = bh->b_this_page;
1182 block_end = block_start + blocksize;
1183 if (block_end <= from)
1184 continue;
1185 if (block_start >= to) {
1186 block_start = to;
1187 break;
1188 }
1189 if (!buffer_mapped(bh))
1190 /* prepare_write failed on this bh */
1191 break;
1192 if (ext3_should_journal_data(mapping->host)) {
1193 ret = do_journal_get_write_access(handle, bh);
1194 if (ret) {
1195 ext3_journal_stop(handle);
1196 return ret;
1197 }
1198 }
1199 /*
1200 * block_start here becomes the first block where the current iteration
1201 * of prepare_write failed.
1202 */
1203 }
1204 if (block_start <= from)
1205 goto skip;
1206
1207 /* commit allocated and zeroed buffers */
1208 return mapping->a_ops->commit_write(file, page, from, block_start);
1209}
1210
1211static int ext3_prepare_write(struct file *file, struct page *page, 1151static int ext3_prepare_write(struct file *file, struct page *page,
1212 unsigned from, unsigned to) 1152 unsigned from, unsigned to)
1213{ 1153{
1214 struct inode *inode = page->mapping->host; 1154 struct inode *inode = page->mapping->host;
1215 int ret, ret2; 1155 int ret, needed_blocks = ext3_writepage_trans_blocks(inode);
1216 int needed_blocks = ext3_writepage_trans_blocks(inode);
1217 handle_t *handle; 1156 handle_t *handle;
1218 int retries = 0; 1157 int retries = 0;
1219 1158
1220retry: 1159retry:
1221 handle = ext3_journal_start(inode, needed_blocks); 1160 handle = ext3_journal_start(inode, needed_blocks);
1222 if (IS_ERR(handle)) 1161 if (IS_ERR(handle)) {
1223 return PTR_ERR(handle); 1162 ret = PTR_ERR(handle);
1163 goto out;
1164 }
1224 if (test_opt(inode->i_sb, NOBH) && ext3_should_writeback_data(inode)) 1165 if (test_opt(inode->i_sb, NOBH) && ext3_should_writeback_data(inode))
1225 ret = nobh_prepare_write(page, from, to, ext3_get_block); 1166 ret = nobh_prepare_write(page, from, to, ext3_get_block);
1226 else 1167 else
1227 ret = block_prepare_write(page, from, to, ext3_get_block); 1168 ret = block_prepare_write(page, from, to, ext3_get_block);
1228 if (ret) 1169 if (ret)
1229 goto failure; 1170 goto prepare_write_failed;
1230 1171
1231 if (ext3_should_journal_data(inode)) { 1172 if (ext3_should_journal_data(inode)) {
1232 ret = walk_page_buffers(handle, page_buffers(page), 1173 ret = walk_page_buffers(handle, page_buffers(page),
1233 from, to, NULL, do_journal_get_write_access); 1174 from, to, NULL, do_journal_get_write_access);
1234 if (ret)
1235 /* fatal error, just put the handle and return */
1236 journal_stop(handle);
1237 } 1175 }
1238 return ret; 1176prepare_write_failed:
1239 1177 if (ret)
1240failure: 1178 ext3_journal_stop(handle);
1241 ret2 = ext3_prepare_failure(file, page, from, to);
1242 if (ret2 < 0)
1243 return ret2;
1244 if (ret == -ENOSPC && ext3_should_retry_alloc(inode->i_sb, &retries)) 1179 if (ret == -ENOSPC && ext3_should_retry_alloc(inode->i_sb, &retries))
1245 goto retry; 1180 goto retry;
1246 /* retry number exceeded, or other error like -EDQUOT */ 1181out:
1247 return ret; 1182 return ret;
1248} 1183}
1249 1184
diff --git a/fs/ext3/xattr.c b/fs/ext3/xattr.c
index 12f7dda1232c..f58cbb26323e 100644
--- a/fs/ext3/xattr.c
+++ b/fs/ext3/xattr.c
@@ -495,7 +495,8 @@ ext3_xattr_release_block(handle_t *handle, struct inode *inode,
495 BHDR(bh)->h_refcount = cpu_to_le32( 495 BHDR(bh)->h_refcount = cpu_to_le32(
496 le32_to_cpu(BHDR(bh)->h_refcount) - 1); 496 le32_to_cpu(BHDR(bh)->h_refcount) - 1);
497 error = ext3_journal_dirty_metadata(handle, bh); 497 error = ext3_journal_dirty_metadata(handle, bh);
498 handle->h_sync = 1; 498 if (IS_SYNC(inode))
499 handle->h_sync = 1;
499 DQUOT_FREE_BLOCK(inode, 1); 500 DQUOT_FREE_BLOCK(inode, 1);
500 ea_bdebug(bh, "refcount now=%d; releasing", 501 ea_bdebug(bh, "refcount now=%d; releasing",
501 le32_to_cpu(BHDR(bh)->h_refcount)); 502 le32_to_cpu(BHDR(bh)->h_refcount));
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index fbff4b9e122a..810b6d6474bf 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -1147,102 +1147,37 @@ static int do_journal_get_write_access(handle_t *handle,
1147 return ext4_journal_get_write_access(handle, bh); 1147 return ext4_journal_get_write_access(handle, bh);
1148} 1148}
1149 1149
1150/*
1151 * The idea of this helper function is following:
1152 * if prepare_write has allocated some blocks, but not all of them, the
1153 * transaction must include the content of the newly allocated blocks.
1154 * This content is expected to be set to zeroes by block_prepare_write().
1155 * 2006/10/14 SAW
1156 */
1157static int ext4_prepare_failure(struct file *file, struct page *page,
1158 unsigned from, unsigned to)
1159{
1160 struct address_space *mapping;
1161 struct buffer_head *bh, *head, *next;
1162 unsigned block_start, block_end;
1163 unsigned blocksize;
1164 int ret;
1165 handle_t *handle = ext4_journal_current_handle();
1166
1167 mapping = page->mapping;
1168 if (ext4_should_writeback_data(mapping->host)) {
1169 /* optimization: no constraints about data */
1170skip:
1171 return ext4_journal_stop(handle);
1172 }
1173
1174 head = page_buffers(page);
1175 blocksize = head->b_size;
1176 for ( bh = head, block_start = 0;
1177 bh != head || !block_start;
1178 block_start = block_end, bh = next)
1179 {
1180 next = bh->b_this_page;
1181 block_end = block_start + blocksize;
1182 if (block_end <= from)
1183 continue;
1184 if (block_start >= to) {
1185 block_start = to;
1186 break;
1187 }
1188 if (!buffer_mapped(bh))
1189 /* prepare_write failed on this bh */
1190 break;
1191 if (ext4_should_journal_data(mapping->host)) {
1192 ret = do_journal_get_write_access(handle, bh);
1193 if (ret) {
1194 ext4_journal_stop(handle);
1195 return ret;
1196 }
1197 }
1198 /*
1199 * block_start here becomes the first block where the current iteration
1200 * of prepare_write failed.
1201 */
1202 }
1203 if (block_start <= from)
1204 goto skip;
1205
1206 /* commit allocated and zeroed buffers */
1207 return mapping->a_ops->commit_write(file, page, from, block_start);
1208}
1209
1210static int ext4_prepare_write(struct file *file, struct page *page, 1150static int ext4_prepare_write(struct file *file, struct page *page,
1211 unsigned from, unsigned to) 1151 unsigned from, unsigned to)
1212{ 1152{
1213 struct inode *inode = page->mapping->host; 1153 struct inode *inode = page->mapping->host;
1214 int ret, ret2; 1154 int ret, needed_blocks = ext4_writepage_trans_blocks(inode);
1215 int needed_blocks = ext4_writepage_trans_blocks(inode);
1216 handle_t *handle; 1155 handle_t *handle;
1217 int retries = 0; 1156 int retries = 0;
1218 1157
1219retry: 1158retry:
1220 handle = ext4_journal_start(inode, needed_blocks); 1159 handle = ext4_journal_start(inode, needed_blocks);
1221 if (IS_ERR(handle)) 1160 if (IS_ERR(handle)) {
1222 return PTR_ERR(handle); 1161 ret = PTR_ERR(handle);
1162 goto out;
1163 }
1223 if (test_opt(inode->i_sb, NOBH) && ext4_should_writeback_data(inode)) 1164 if (test_opt(inode->i_sb, NOBH) && ext4_should_writeback_data(inode))
1224 ret = nobh_prepare_write(page, from, to, ext4_get_block); 1165 ret = nobh_prepare_write(page, from, to, ext4_get_block);
1225 else 1166 else
1226 ret = block_prepare_write(page, from, to, ext4_get_block); 1167 ret = block_prepare_write(page, from, to, ext4_get_block);
1227 if (ret) 1168 if (ret)
1228 goto failure; 1169 goto prepare_write_failed;
1229 1170
1230 if (ext4_should_journal_data(inode)) { 1171 if (ext4_should_journal_data(inode)) {
1231 ret = walk_page_buffers(handle, page_buffers(page), 1172 ret = walk_page_buffers(handle, page_buffers(page),
1232 from, to, NULL, do_journal_get_write_access); 1173 from, to, NULL, do_journal_get_write_access);
1233 if (ret)
1234 /* fatal error, just put the handle and return */
1235 ext4_journal_stop(handle);
1236 } 1174 }
1237 return ret; 1175prepare_write_failed:
1238 1176 if (ret)
1239failure: 1177 ext4_journal_stop(handle);
1240 ret2 = ext4_prepare_failure(file, page, from, to);
1241 if (ret2 < 0)
1242 return ret2;
1243 if (ret == -ENOSPC && ext4_should_retry_alloc(inode->i_sb, &retries)) 1178 if (ret == -ENOSPC && ext4_should_retry_alloc(inode->i_sb, &retries))
1244 goto retry; 1179 goto retry;
1245 /* retry number exceeded, or other error like -EDQUOT */ 1180out:
1246 return ret; 1181 return ret;
1247} 1182}
1248 1183
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index 406bf61ed510..8890eba1db52 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -195,7 +195,7 @@ static struct dentry_operations fuse_dentry_operations = {
195 .d_revalidate = fuse_dentry_revalidate, 195 .d_revalidate = fuse_dentry_revalidate,
196}; 196};
197 197
198static int valid_mode(int m) 198int fuse_valid_type(int m)
199{ 199{
200 return S_ISREG(m) || S_ISDIR(m) || S_ISLNK(m) || S_ISCHR(m) || 200 return S_ISREG(m) || S_ISDIR(m) || S_ISLNK(m) || S_ISCHR(m) ||
201 S_ISBLK(m) || S_ISFIFO(m) || S_ISSOCK(m); 201 S_ISBLK(m) || S_ISFIFO(m) || S_ISSOCK(m);
@@ -248,7 +248,8 @@ static struct dentry *fuse_lookup(struct inode *dir, struct dentry *entry,
248 fuse_put_request(fc, req); 248 fuse_put_request(fc, req);
249 /* Zero nodeid is same as -ENOENT, but with valid timeout */ 249 /* Zero nodeid is same as -ENOENT, but with valid timeout */
250 if (!err && outarg.nodeid && 250 if (!err && outarg.nodeid &&
251 (invalid_nodeid(outarg.nodeid) || !valid_mode(outarg.attr.mode))) 251 (invalid_nodeid(outarg.nodeid) ||
252 !fuse_valid_type(outarg.attr.mode)))
252 err = -EIO; 253 err = -EIO;
253 if (!err && outarg.nodeid) { 254 if (!err && outarg.nodeid) {
254 inode = fuse_iget(dir->i_sb, outarg.nodeid, outarg.generation, 255 inode = fuse_iget(dir->i_sb, outarg.nodeid, outarg.generation,
diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h
index b98b20de7405..68ae87cbafab 100644
--- a/fs/fuse/fuse_i.h
+++ b/fs/fuse/fuse_i.h
@@ -552,3 +552,8 @@ int fuse_ctl_add_conn(struct fuse_conn *fc);
552 * Remove connection from control filesystem 552 * Remove connection from control filesystem
553 */ 553 */
554void fuse_ctl_remove_conn(struct fuse_conn *fc); 554void fuse_ctl_remove_conn(struct fuse_conn *fc);
555
556/**
557 * Is file type valid?
558 */
559int fuse_valid_type(int m);
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index 5ab8e50e7808..608db81219a0 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -330,6 +330,8 @@ static int parse_fuse_opt(char *opt, struct fuse_mount_data *d, int is_bdev)
330 case OPT_ROOTMODE: 330 case OPT_ROOTMODE:
331 if (match_octal(&args[0], &value)) 331 if (match_octal(&args[0], &value))
332 return 0; 332 return 0;
333 if (!fuse_valid_type(value))
334 return 0;
333 d->rootmode = value; 335 d->rootmode = value;
334 d->rootmode_present = 1; 336 d->rootmode_present = 1;
335 break; 337 break;
diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c
index 9baf69773ed1..fd301a910122 100644
--- a/fs/hostfs/hostfs_kern.c
+++ b/fs/hostfs/hostfs_kern.c
@@ -20,7 +20,6 @@
20#include "hostfs.h" 20#include "hostfs.h"
21#include "kern_util.h" 21#include "kern_util.h"
22#include "kern.h" 22#include "kern.h"
23#include "user_util.h"
24#include "init.h" 23#include "init.h"
25 24
26struct hostfs_inode_info { 25struct hostfs_inode_info {
@@ -939,7 +938,7 @@ static const struct address_space_operations hostfs_link_aops = {
939static int hostfs_fill_sb_common(struct super_block *sb, void *d, int silent) 938static int hostfs_fill_sb_common(struct super_block *sb, void *d, int silent)
940{ 939{
941 struct inode *root_inode; 940 struct inode *root_inode;
942 char *name, *data = d; 941 char *host_root_path, *req_root = d;
943 int err; 942 int err;
944 943
945 sb->s_blocksize = 1024; 944 sb->s_blocksize = 1024;
@@ -948,16 +947,16 @@ static int hostfs_fill_sb_common(struct super_block *sb, void *d, int silent)
948 sb->s_op = &hostfs_sbops; 947 sb->s_op = &hostfs_sbops;
949 948
950 /* NULL is printed as <NULL> by sprintf: avoid that. */ 949 /* NULL is printed as <NULL> by sprintf: avoid that. */
951 if (data == NULL) 950 if (req_root == NULL)
952 data = ""; 951 req_root = "";
953 952
954 err = -ENOMEM; 953 err = -ENOMEM;
955 name = kmalloc(strlen(root_ino) + 1 954 host_root_path = kmalloc(strlen(root_ino) + 1
956 + strlen(data) + 1, GFP_KERNEL); 955 + strlen(req_root) + 1, GFP_KERNEL);
957 if(name == NULL) 956 if(host_root_path == NULL)
958 goto out; 957 goto out;
959 958
960 sprintf(name, "%s/%s", root_ino, data); 959 sprintf(host_root_path, "%s/%s", root_ino, req_root);
961 960
962 root_inode = iget(sb, 0); 961 root_inode = iget(sb, 0);
963 if(root_inode == NULL) 962 if(root_inode == NULL)
@@ -967,10 +966,10 @@ static int hostfs_fill_sb_common(struct super_block *sb, void *d, int silent)
967 if(err) 966 if(err)
968 goto out_put; 967 goto out_put;
969 968
970 HOSTFS_I(root_inode)->host_filename = name; 969 HOSTFS_I(root_inode)->host_filename = host_root_path;
971 /* Avoid that in the error path, iput(root_inode) frees again name through 970 /* Avoid that in the error path, iput(root_inode) frees again
972 * hostfs_destroy_inode! */ 971 * host_root_path through hostfs_destroy_inode! */
973 name = NULL; 972 host_root_path = NULL;
974 973
975 err = -ENOMEM; 974 err = -ENOMEM;
976 sb->s_root = d_alloc_root(root_inode); 975 sb->s_root = d_alloc_root(root_inode);
@@ -990,7 +989,7 @@ static int hostfs_fill_sb_common(struct super_block *sb, void *d, int silent)
990 out_put: 989 out_put:
991 iput(root_inode); 990 iput(root_inode);
992 out_free: 991 out_free:
993 kfree(name); 992 kfree(host_root_path);
994 out: 993 out:
995 return(err); 994 return(err);
996} 995}
diff --git a/fs/nfsd/nfs3xdr.c b/fs/nfsd/nfs3xdr.c
index 6f677988c71d..7e4bb0af24d7 100644
--- a/fs/nfsd/nfs3xdr.c
+++ b/fs/nfsd/nfs3xdr.c
@@ -859,8 +859,8 @@ compose_entry_fh(struct nfsd3_readdirres *cd, struct svc_fh *fhp,
859#define NFS3_ENTRY_BAGGAGE (2 + 1 + 2 + 1) 859#define NFS3_ENTRY_BAGGAGE (2 + 1 + 2 + 1)
860#define NFS3_ENTRYPLUS_BAGGAGE (1 + 21 + 1 + (NFS3_FHSIZE >> 2)) 860#define NFS3_ENTRYPLUS_BAGGAGE (1 + 21 + 1 + (NFS3_FHSIZE >> 2))
861static int 861static int
862encode_entry(struct readdir_cd *ccd, const char *name, 862encode_entry(struct readdir_cd *ccd, const char *name, int namlen,
863 int namlen, off_t offset, ino_t ino, unsigned int d_type, int plus) 863 loff_t offset, ino_t ino, unsigned int d_type, int plus)
864{ 864{
865 struct nfsd3_readdirres *cd = container_of(ccd, struct nfsd3_readdirres, 865 struct nfsd3_readdirres *cd = container_of(ccd, struct nfsd3_readdirres,
866 common); 866 common);
@@ -880,7 +880,7 @@ encode_entry(struct readdir_cd *ccd, const char *name,
880 *cd->offset1 = htonl(offset64 & 0xffffffff); 880 *cd->offset1 = htonl(offset64 & 0xffffffff);
881 cd->offset1 = NULL; 881 cd->offset1 = NULL;
882 } else { 882 } else {
883 xdr_encode_hyper(cd->offset, (u64) offset); 883 xdr_encode_hyper(cd->offset, offset64);
884 } 884 }
885 } 885 }
886 886
diff --git a/fs/nfsd/nfs4acl.c b/fs/nfsd/nfs4acl.c
index 832673b14587..673a53c014a3 100644
--- a/fs/nfsd/nfs4acl.c
+++ b/fs/nfsd/nfs4acl.c
@@ -228,7 +228,7 @@ _posix_to_nfsv4_one(struct posix_acl *pacl, struct nfs4_acl *acl,
228 struct posix_acl_summary pas; 228 struct posix_acl_summary pas;
229 unsigned short deny; 229 unsigned short deny;
230 int eflag = ((flags & NFS4_ACL_TYPE_DEFAULT) ? 230 int eflag = ((flags & NFS4_ACL_TYPE_DEFAULT) ?
231 NFS4_INHERITANCE_FLAGS : 0); 231 NFS4_INHERITANCE_FLAGS | NFS4_ACE_INHERIT_ONLY_ACE : 0);
232 232
233 BUG_ON(pacl->a_count < 3); 233 BUG_ON(pacl->a_count < 3);
234 summarize_posix_acl(pacl, &pas); 234 summarize_posix_acl(pacl, &pas);
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 9e4067999209..af360705e551 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -750,9 +750,8 @@ nfsd4_setclientid(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
750 status = nfserr_clid_inuse; 750 status = nfserr_clid_inuse;
751 if (!cmp_creds(&conf->cl_cred, &rqstp->rq_cred) 751 if (!cmp_creds(&conf->cl_cred, &rqstp->rq_cred)
752 || conf->cl_addr != sin->sin_addr.s_addr) { 752 || conf->cl_addr != sin->sin_addr.s_addr) {
753 printk("NFSD: setclientid: string in use by client" 753 dprintk("NFSD: setclientid: string in use by client"
754 "(clientid %08x/%08x)\n", 754 "at %u.%u.%u.%u\n", NIPQUAD(conf->cl_addr));
755 conf->cl_clientid.cl_boot, conf->cl_clientid.cl_id);
756 goto out; 755 goto out;
757 } 756 }
758 } 757 }
@@ -3261,7 +3260,6 @@ __nfs4_state_shutdown(void)
3261 unhash_delegation(dp); 3260 unhash_delegation(dp);
3262 } 3261 }
3263 3262
3264 cancel_delayed_work(&laundromat_work);
3265 nfsd4_shutdown_recdir(); 3263 nfsd4_shutdown_recdir();
3266 nfs4_init = 0; 3264 nfs4_init = 0;
3267} 3265}
diff --git a/fs/ocfs2/dlm/dlmdomain.c b/fs/ocfs2/dlm/dlmdomain.c
index 6087c4749fee..c558442a0b44 100644
--- a/fs/ocfs2/dlm/dlmdomain.c
+++ b/fs/ocfs2/dlm/dlmdomain.c
@@ -138,8 +138,10 @@ static void dlm_unregister_domain_handlers(struct dlm_ctxt *dlm);
138 138
139void __dlm_unhash_lockres(struct dlm_lock_resource *lockres) 139void __dlm_unhash_lockres(struct dlm_lock_resource *lockres)
140{ 140{
141 hlist_del_init(&lockres->hash_node); 141 if (!hlist_unhashed(&lockres->hash_node)) {
142 dlm_lockres_put(lockres); 142 hlist_del_init(&lockres->hash_node);
143 dlm_lockres_put(lockres);
144 }
143} 145}
144 146
145void __dlm_insert_lockres(struct dlm_ctxt *dlm, 147void __dlm_insert_lockres(struct dlm_ctxt *dlm,
@@ -655,6 +657,8 @@ void dlm_unregister_domain(struct dlm_ctxt *dlm)
655 dlm_kick_thread(dlm, NULL); 657 dlm_kick_thread(dlm, NULL);
656 658
657 while (dlm_migrate_all_locks(dlm)) { 659 while (dlm_migrate_all_locks(dlm)) {
660 /* Give dlm_thread time to purge the lockres' */
661 msleep(500);
658 mlog(0, "%s: more migration to do\n", dlm->name); 662 mlog(0, "%s: more migration to do\n", dlm->name);
659 } 663 }
660 dlm_mark_domain_leaving(dlm); 664 dlm_mark_domain_leaving(dlm);
diff --git a/fs/ocfs2/dlm/dlmmaster.c b/fs/ocfs2/dlm/dlmmaster.c
index 9229e04362f6..6edffca99d98 100644
--- a/fs/ocfs2/dlm/dlmmaster.c
+++ b/fs/ocfs2/dlm/dlmmaster.c
@@ -2424,6 +2424,57 @@ static void dlm_deref_lockres_worker(struct dlm_work_item *item, void *data)
2424 dlm_lockres_put(res); 2424 dlm_lockres_put(res);
2425} 2425}
2426 2426
2427/* Checks whether the lockres can be migrated. Returns 0 if yes, < 0
2428 * if not. If 0, numlocks is set to the number of locks in the lockres.
2429 */
2430static int dlm_is_lockres_migrateable(struct dlm_ctxt *dlm,
2431 struct dlm_lock_resource *res,
2432 int *numlocks)
2433{
2434 int ret;
2435 int i;
2436 int count = 0;
2437 struct list_head *queue, *iter;
2438 struct dlm_lock *lock;
2439
2440 assert_spin_locked(&res->spinlock);
2441
2442 ret = -EINVAL;
2443 if (res->owner == DLM_LOCK_RES_OWNER_UNKNOWN) {
2444 mlog(0, "cannot migrate lockres with unknown owner!\n");
2445 goto leave;
2446 }
2447
2448 if (res->owner != dlm->node_num) {
2449 mlog(0, "cannot migrate lockres this node doesn't own!\n");
2450 goto leave;
2451 }
2452
2453 ret = 0;
2454 queue = &res->granted;
2455 for (i = 0; i < 3; i++) {
2456 list_for_each(iter, queue) {
2457 lock = list_entry(iter, struct dlm_lock, list);
2458 ++count;
2459 if (lock->ml.node == dlm->node_num) {
2460 mlog(0, "found a lock owned by this node still "
2461 "on the %s queue! will not migrate this "
2462 "lockres\n", (i == 0 ? "granted" :
2463 (i == 1 ? "converting" :
2464 "blocked")));
2465 ret = -ENOTEMPTY;
2466 goto leave;
2467 }
2468 }
2469 queue++;
2470 }
2471
2472 *numlocks = count;
2473 mlog(0, "migrateable lockres having %d locks\n", *numlocks);
2474
2475leave:
2476 return ret;
2477}
2427 2478
2428/* 2479/*
2429 * DLM_MIGRATE_LOCKRES 2480 * DLM_MIGRATE_LOCKRES
@@ -2437,14 +2488,12 @@ static int dlm_migrate_lockres(struct dlm_ctxt *dlm,
2437 struct dlm_master_list_entry *mle = NULL; 2488 struct dlm_master_list_entry *mle = NULL;
2438 struct dlm_master_list_entry *oldmle = NULL; 2489 struct dlm_master_list_entry *oldmle = NULL;
2439 struct dlm_migratable_lockres *mres = NULL; 2490 struct dlm_migratable_lockres *mres = NULL;
2440 int ret = -EINVAL; 2491 int ret = 0;
2441 const char *name; 2492 const char *name;
2442 unsigned int namelen; 2493 unsigned int namelen;
2443 int mle_added = 0; 2494 int mle_added = 0;
2444 struct list_head *queue, *iter; 2495 int numlocks;
2445 int i; 2496 int wake = 0;
2446 struct dlm_lock *lock;
2447 int empty = 1, wake = 0;
2448 2497
2449 if (!dlm_grab(dlm)) 2498 if (!dlm_grab(dlm))
2450 return -EINVAL; 2499 return -EINVAL;
@@ -2458,42 +2507,16 @@ static int dlm_migrate_lockres(struct dlm_ctxt *dlm,
2458 * ensure this lockres is a proper candidate for migration 2507 * ensure this lockres is a proper candidate for migration
2459 */ 2508 */
2460 spin_lock(&res->spinlock); 2509 spin_lock(&res->spinlock);
2461 if (res->owner == DLM_LOCK_RES_OWNER_UNKNOWN) { 2510 ret = dlm_is_lockres_migrateable(dlm, res, &numlocks);
2462 mlog(0, "cannot migrate lockres with unknown owner!\n"); 2511 if (ret < 0) {
2463 spin_unlock(&res->spinlock);
2464 goto leave;
2465 }
2466 if (res->owner != dlm->node_num) {
2467 mlog(0, "cannot migrate lockres this node doesn't own!\n");
2468 spin_unlock(&res->spinlock); 2512 spin_unlock(&res->spinlock);
2469 goto leave; 2513 goto leave;
2470 } 2514 }
2471 mlog(0, "checking queues...\n");
2472 queue = &res->granted;
2473 for (i=0; i<3; i++) {
2474 list_for_each(iter, queue) {
2475 lock = list_entry (iter, struct dlm_lock, list);
2476 empty = 0;
2477 if (lock->ml.node == dlm->node_num) {
2478 mlog(0, "found a lock owned by this node "
2479 "still on the %s queue! will not "
2480 "migrate this lockres\n",
2481 i==0 ? "granted" :
2482 (i==1 ? "converting" : "blocked"));
2483 spin_unlock(&res->spinlock);
2484 ret = -ENOTEMPTY;
2485 goto leave;
2486 }
2487 }
2488 queue++;
2489 }
2490 mlog(0, "all locks on this lockres are nonlocal. continuing\n");
2491 spin_unlock(&res->spinlock); 2515 spin_unlock(&res->spinlock);
2492 2516
2493 /* no work to do */ 2517 /* no work to do */
2494 if (empty) { 2518 if (numlocks == 0) {
2495 mlog(0, "no locks were found on this lockres! done!\n"); 2519 mlog(0, "no locks were found on this lockres! done!\n");
2496 ret = 0;
2497 goto leave; 2520 goto leave;
2498 } 2521 }
2499 2522
@@ -2729,6 +2752,7 @@ int dlm_empty_lockres(struct dlm_ctxt *dlm, struct dlm_lock_resource *res)
2729{ 2752{
2730 int ret; 2753 int ret;
2731 int lock_dropped = 0; 2754 int lock_dropped = 0;
2755 int numlocks;
2732 2756
2733 spin_lock(&res->spinlock); 2757 spin_lock(&res->spinlock);
2734 if (res->owner != dlm->node_num) { 2758 if (res->owner != dlm->node_num) {
@@ -2740,6 +2764,13 @@ int dlm_empty_lockres(struct dlm_ctxt *dlm, struct dlm_lock_resource *res)
2740 spin_unlock(&res->spinlock); 2764 spin_unlock(&res->spinlock);
2741 goto leave; 2765 goto leave;
2742 } 2766 }
2767
2768 /* No need to migrate a lockres having no locks */
2769 ret = dlm_is_lockres_migrateable(dlm, res, &numlocks);
2770 if (ret >= 0 && numlocks == 0) {
2771 spin_unlock(&res->spinlock);
2772 goto leave;
2773 }
2743 spin_unlock(&res->spinlock); 2774 spin_unlock(&res->spinlock);
2744 2775
2745 /* Wheee! Migrate lockres here! Will sleep so drop spinlock. */ 2776 /* Wheee! Migrate lockres here! Will sleep so drop spinlock. */
diff --git a/fs/ocfs2/dlm/dlmthread.c b/fs/ocfs2/dlm/dlmthread.c
index 6421a8fae1de..2b264c6ba039 100644
--- a/fs/ocfs2/dlm/dlmthread.c
+++ b/fs/ocfs2/dlm/dlmthread.c
@@ -256,20 +256,14 @@ static void dlm_run_purge_list(struct dlm_ctxt *dlm,
256 break; 256 break;
257 } 257 }
258 258
259 mlog(0, "removing lockres %.*s:%p from purgelist\n", 259 dlm_lockres_get(lockres);
260 lockres->lockname.len, lockres->lockname.name, lockres);
261 list_del_init(&lockres->purge);
262 dlm_lockres_put(lockres);
263 dlm->purge_count--;
264 260
265 /* This may drop and reacquire the dlm spinlock if it 261 /* This may drop and reacquire the dlm spinlock if it
266 * has to do migration. */ 262 * has to do migration. */
267 mlog(0, "calling dlm_purge_lockres!\n");
268 dlm_lockres_get(lockres);
269 if (dlm_purge_lockres(dlm, lockres)) 263 if (dlm_purge_lockres(dlm, lockres))
270 BUG(); 264 BUG();
265
271 dlm_lockres_put(lockres); 266 dlm_lockres_put(lockres);
272 mlog(0, "DONE calling dlm_purge_lockres!\n");
273 267
274 /* Avoid adding any scheduling latencies */ 268 /* Avoid adding any scheduling latencies */
275 cond_resched_lock(&dlm->spinlock); 269 cond_resched_lock(&dlm->spinlock);
diff --git a/fs/proc/Makefile b/fs/proc/Makefile
index a6b3a8f878f0..bce38e3f06cb 100644
--- a/fs/proc/Makefile
+++ b/fs/proc/Makefile
@@ -8,8 +8,9 @@ proc-y := nommu.o task_nommu.o
8proc-$(CONFIG_MMU) := mmu.o task_mmu.o 8proc-$(CONFIG_MMU) := mmu.o task_mmu.o
9 9
10proc-y += inode.o root.o base.o generic.o array.o \ 10proc-y += inode.o root.o base.o generic.o array.o \
11 proc_tty.o proc_misc.o proc_sysctl.o 11 proc_tty.o proc_misc.o
12 12
13proc-$(CONFIG_PROC_SYSCTL) += proc_sysctl.o
13proc-$(CONFIG_PROC_KCORE) += kcore.o 14proc-$(CONFIG_PROC_KCORE) += kcore.o
14proc-$(CONFIG_PROC_VMCORE) += vmcore.o 15proc-$(CONFIG_PROC_VMCORE) += vmcore.o
15proc-$(CONFIG_PROC_DEVICETREE) += proc_devtree.o 16proc-$(CONFIG_PROC_DEVICETREE) += proc_devtree.o
diff --git a/fs/proc/internal.h b/fs/proc/internal.h
index c932aa65e198..f771889183c3 100644
--- a/fs/proc/internal.h
+++ b/fs/proc/internal.h
@@ -11,7 +11,11 @@
11 11
12#include <linux/proc_fs.h> 12#include <linux/proc_fs.h>
13 13
14#ifdef CONFIG_PROC_SYSCTL
14extern int proc_sys_init(void); 15extern int proc_sys_init(void);
16#else
17static inline void proc_sys_init(void) { }
18#endif
15 19
16struct vmalloc_info { 20struct vmalloc_info {
17 unsigned long used; 21 unsigned long used;
diff --git a/fs/proc/root.c b/fs/proc/root.c
index 5834a744c2a9..41f17037f738 100644
--- a/fs/proc/root.c
+++ b/fs/proc/root.c
@@ -79,9 +79,7 @@ void __init proc_root_init(void)
79 proc_device_tree_init(); 79 proc_device_tree_init();
80#endif 80#endif
81 proc_bus = proc_mkdir("bus", NULL); 81 proc_bus = proc_mkdir("bus", NULL);
82#ifdef CONFIG_SYSCTL
83 proc_sys_init(); 82 proc_sys_init();
84#endif
85} 83}
86 84
87static int proc_root_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat 85static int proc_root_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat
diff --git a/fs/splice.c b/fs/splice.c
index 2fca6ebf4cc2..5428b0ff3b6f 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -576,76 +576,21 @@ static int pipe_to_file(struct pipe_inode_info *pipe, struct pipe_buffer *buf,
576 if (this_len + offset > PAGE_CACHE_SIZE) 576 if (this_len + offset > PAGE_CACHE_SIZE)
577 this_len = PAGE_CACHE_SIZE - offset; 577 this_len = PAGE_CACHE_SIZE - offset;
578 578
579 /*
580 * Reuse buf page, if SPLICE_F_MOVE is set and we are doing a full
581 * page.
582 */
583 if ((sd->flags & SPLICE_F_MOVE) && this_len == PAGE_CACHE_SIZE) {
584 /*
585 * If steal succeeds, buf->page is now pruned from the
586 * pagecache and we can reuse it. The page will also be
587 * locked on successful return.
588 */
589 if (buf->ops->steal(pipe, buf))
590 goto find_page;
591
592 page = buf->page;
593 if (add_to_page_cache(page, mapping, index, GFP_KERNEL)) {
594 unlock_page(page);
595 goto find_page;
596 }
597
598 page_cache_get(page);
599
600 if (!(buf->flags & PIPE_BUF_FLAG_LRU))
601 lru_cache_add(page);
602 } else {
603find_page: 579find_page:
604 page = find_lock_page(mapping, index); 580 page = find_lock_page(mapping, index);
605 if (!page) { 581 if (!page) {
606 ret = -ENOMEM; 582 ret = -ENOMEM;
607 page = page_cache_alloc_cold(mapping); 583 page = page_cache_alloc_cold(mapping);
608 if (unlikely(!page)) 584 if (unlikely(!page))
609 goto out_ret; 585 goto out_ret;
610
611 /*
612 * This will also lock the page
613 */
614 ret = add_to_page_cache_lru(page, mapping, index,
615 GFP_KERNEL);
616 if (unlikely(ret))
617 goto out;
618 }
619 586
620 /* 587 /*
621 * We get here with the page locked. If the page is also 588 * This will also lock the page
622 * uptodate, we don't need to do more. If it isn't, we
623 * may need to bring it in if we are not going to overwrite
624 * the full page.
625 */ 589 */
626 if (!PageUptodate(page)) { 590 ret = add_to_page_cache_lru(page, mapping, index,
627 if (this_len < PAGE_CACHE_SIZE) { 591 GFP_KERNEL);
628 ret = mapping->a_ops->readpage(file, page); 592 if (unlikely(ret))
629 if (unlikely(ret)) 593 goto out;
630 goto out;
631
632 lock_page(page);
633
634 if (!PageUptodate(page)) {
635 /*
636 * Page got invalidated, repeat.
637 */
638 if (!page->mapping) {
639 unlock_page(page);
640 page_cache_release(page);
641 goto find_page;
642 }
643 ret = -EIO;
644 goto out;
645 }
646 } else
647 SetPageUptodate(page);
648 }
649 } 594 }
650 595
651 ret = mapping->a_ops->prepare_write(file, page, offset, offset+this_len); 596 ret = mapping->a_ops->prepare_write(file, page, offset, offset+this_len);
@@ -682,18 +627,25 @@ find_page:
682 } 627 }
683 628
684 ret = mapping->a_ops->commit_write(file, page, offset, offset+this_len); 629 ret = mapping->a_ops->commit_write(file, page, offset, offset+this_len);
685 if (!ret) { 630 if (ret) {
631 if (ret == AOP_TRUNCATED_PAGE) {
632 page_cache_release(page);
633 goto find_page;
634 }
635 if (ret < 0)
636 goto out;
686 /* 637 /*
687 * Return the number of bytes written and mark page as 638 * Partial write has happened, so 'ret' already initialized by
688 * accessed, we are now done! 639 * number of bytes written, Where is nothing we have to do here.
689 */ 640 */
641 } else
690 ret = this_len; 642 ret = this_len;
691 mark_page_accessed(page); 643 /*
692 balance_dirty_pages_ratelimited(mapping); 644 * Return the number of bytes written and mark page as
693 } else if (ret == AOP_TRUNCATED_PAGE) { 645 * accessed, we are now done!
694 page_cache_release(page); 646 */
695 goto find_page; 647 mark_page_accessed(page);
696 } 648 balance_dirty_pages_ratelimited(mapping);
697out: 649out:
698 page_cache_release(page); 650 page_cache_release(page);
699 unlock_page(page); 651 unlock_page(page);
@@ -706,9 +658,9 @@ out_ret:
706 * key here is the 'actor' worker passed in that actually moves the data 658 * key here is the 'actor' worker passed in that actually moves the data
707 * to the wanted destination. See pipe_to_file/pipe_to_sendpage above. 659 * to the wanted destination. See pipe_to_file/pipe_to_sendpage above.
708 */ 660 */
709static ssize_t __splice_from_pipe(struct pipe_inode_info *pipe, 661ssize_t __splice_from_pipe(struct pipe_inode_info *pipe,
710 struct file *out, loff_t *ppos, size_t len, 662 struct file *out, loff_t *ppos, size_t len,
711 unsigned int flags, splice_actor *actor) 663 unsigned int flags, splice_actor *actor)
712{ 664{
713 int ret, do_wakeup, err; 665 int ret, do_wakeup, err;
714 struct splice_desc sd; 666 struct splice_desc sd;
@@ -802,6 +754,7 @@ static ssize_t __splice_from_pipe(struct pipe_inode_info *pipe,
802 754
803 return ret; 755 return ret;
804} 756}
757EXPORT_SYMBOL(__splice_from_pipe);
805 758
806ssize_t splice_from_pipe(struct pipe_inode_info *pipe, struct file *out, 759ssize_t splice_from_pipe(struct pipe_inode_info *pipe, struct file *out,
807 loff_t *ppos, size_t len, unsigned int flags, 760 loff_t *ppos, size_t len, unsigned int flags,
diff --git a/fs/xfs/linux-2.6/xfs_buf.c b/fs/xfs/linux-2.6/xfs_buf.c
index e2bea6a661f0..69e9e80735d2 100644
--- a/fs/xfs/linux-2.6/xfs_buf.c
+++ b/fs/xfs/linux-2.6/xfs_buf.c
@@ -1829,11 +1829,11 @@ xfs_buf_init(void)
1829 if (!xfs_buf_zone) 1829 if (!xfs_buf_zone)
1830 goto out_free_trace_buf; 1830 goto out_free_trace_buf;
1831 1831
1832 xfslogd_workqueue = create_freezeable_workqueue("xfslogd"); 1832 xfslogd_workqueue = create_workqueue("xfslogd");
1833 if (!xfslogd_workqueue) 1833 if (!xfslogd_workqueue)
1834 goto out_free_buf_zone; 1834 goto out_free_buf_zone;
1835 1835
1836 xfsdatad_workqueue = create_freezeable_workqueue("xfsdatad"); 1836 xfsdatad_workqueue = create_workqueue("xfsdatad");
1837 if (!xfsdatad_workqueue) 1837 if (!xfsdatad_workqueue)
1838 goto out_destroy_xfslogd_workqueue; 1838 goto out_destroy_xfslogd_workqueue;
1839 1839
diff --git a/include/acpi/acinterp.h b/include/acpi/acinterp.h
index 73967c8152d3..440983019993 100644
--- a/include/acpi/acinterp.h
+++ b/include/acpi/acinterp.h
@@ -446,14 +446,10 @@ acpi_ex_copy_integer_to_buffer_field(union acpi_operand_object *source_desc,
446/* 446/*
447 * exutils - interpreter/scanner utilities 447 * exutils - interpreter/scanner utilities
448 */ 448 */
449void acpi_ex_enter_interpreter(void); 449acpi_status acpi_ex_enter_interpreter(void);
450 450
451void acpi_ex_exit_interpreter(void); 451void acpi_ex_exit_interpreter(void);
452 452
453void acpi_ex_reacquire_interpreter(void);
454
455void acpi_ex_relinquish_interpreter(void);
456
457void acpi_ex_truncate_for32bit_table(union acpi_operand_object *obj_desc); 453void acpi_ex_truncate_for32bit_table(union acpi_operand_object *obj_desc);
458 454
459u8 acpi_ex_acquire_global_lock(u32 rule); 455u8 acpi_ex_acquire_global_lock(u32 rule);
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
index 72a6e2c3a536..56bf492e7acc 100644
--- a/include/acpi/actypes.h
+++ b/include/acpi/actypes.h
@@ -344,7 +344,7 @@ typedef u32 acpi_integer;
344 344
345/* 64-bit integers */ 345/* 64-bit integers */
346 346
347typedef u64 acpi_integer; 347typedef unsigned long long acpi_integer;
348#define ACPI_INTEGER_MAX ACPI_UINT64_MAX 348#define ACPI_INTEGER_MAX ACPI_UINT64_MAX
349#define ACPI_INTEGER_BIT_SIZE 64 349#define ACPI_INTEGER_BIT_SIZE 64
350#define ACPI_MAX_DECIMAL_DIGITS 20 /* 2^64 = 18,446,744,073,709,551,616 */ 350#define ACPI_MAX_DECIMAL_DIGITS 20 /* 2^64 = 18,446,744,073,709,551,616 */
diff --git a/include/asm-arm/arch-ixp4xx/io.h b/include/asm-arm/arch-ixp4xx/io.h
index b7b5414d9320..a41ba229c564 100644
--- a/include/asm-arm/arch-ixp4xx/io.h
+++ b/include/asm-arm/arch-ixp4xx/io.h
@@ -238,23 +238,6 @@ __ixp4xx_readsl(const volatile void __iomem *bus_addr, u32 *vaddr, u32 count)
238#define memcpy_fromio(a,c,l) _memcpy_fromio((a),(c),(l)) 238#define memcpy_fromio(a,c,l) _memcpy_fromio((a),(c),(l))
239#define memcpy_toio(c,a,l) _memcpy_toio((c),(a),(l)) 239#define memcpy_toio(c,a,l) _memcpy_toio((c),(a),(l))
240 240
241static inline int
242check_signature(const unsigned char __iomem *bus_addr, const unsigned char *signature,
243 int length)
244{
245 int retval = 0;
246 do {
247 if (readb(bus_addr) != *signature)
248 goto out;
249 bus_addr++;
250 signature++;
251 length--;
252 } while (length);
253 retval = 1;
254out:
255 return retval;
256}
257
258#endif 241#endif
259 242
260#ifndef CONFIG_PCI 243#ifndef CONFIG_PCI
diff --git a/include/asm-arm/arch-ns9xxx/clock.h b/include/asm-arm/arch-ns9xxx/clock.h
index 4371a485db47..a7c5ab3d9011 100644
--- a/include/asm-arm/arch-ns9xxx/clock.h
+++ b/include/asm-arm/arch-ns9xxx/clock.h
@@ -11,6 +11,7 @@
11#ifndef __ASM_ARCH_CLOCK_H 11#ifndef __ASM_ARCH_CLOCK_H
12#define __ASM_ARCH_CLOCK_H 12#define __ASM_ARCH_CLOCK_H
13 13
14static inline u32 ns9xxx_systemclock(void) __attribute__((const));
14static inline u32 ns9xxx_systemclock(void) 15static inline u32 ns9xxx_systemclock(void)
15{ 16{
16 /* 17 /*
@@ -19,17 +20,20 @@ static inline u32 ns9xxx_systemclock(void)
19 return 353894400; 20 return 353894400;
20} 21}
21 22
22static inline const u32 ns9xxx_cpuclock(void) 23static inline u32 ns9xxx_cpuclock(void) __attribute__((const));
24static inline u32 ns9xxx_cpuclock(void)
23{ 25{
24 return ns9xxx_systemclock() / 2; 26 return ns9xxx_systemclock() / 2;
25} 27}
26 28
27static inline const u32 ns9xxx_ahbclock(void) 29static inline u32 ns9xxx_ahbclock(void) __attribute__((const));
30static inline u32 ns9xxx_ahbclock(void)
28{ 31{
29 return ns9xxx_systemclock() / 4; 32 return ns9xxx_systemclock() / 4;
30} 33}
31 34
32static inline const u32 ns9xxx_bbusclock(void) 35static inline u32 ns9xxx_bbusclock(void) __attribute__((const));
36static inline u32 ns9xxx_bbusclock(void)
33{ 37{
34 return ns9xxx_systemclock() / 8; 38 return ns9xxx_systemclock() / 8;
35} 39}
diff --git a/include/asm-arm/arch-pxa/pxa-regs.h b/include/asm-arm/arch-pxa/pxa-regs.h
index aec835b6f057..139c9d954818 100644
--- a/include/asm-arm/arch-pxa/pxa-regs.h
+++ b/include/asm-arm/arch-pxa/pxa-regs.h
@@ -1476,7 +1476,7 @@
1476#define GPIO112_MMCCMD_MD (112 | GPIO_ALT_FN_1_OUT) 1476#define GPIO112_MMCCMD_MD (112 | GPIO_ALT_FN_1_OUT)
1477#define GPIO113_I2S_SYSCLK_MD (113 | GPIO_ALT_FN_1_OUT) 1477#define GPIO113_I2S_SYSCLK_MD (113 | GPIO_ALT_FN_1_OUT)
1478#define GPIO113_AC97_RESET_N_MD (113 | GPIO_ALT_FN_2_OUT) 1478#define GPIO113_AC97_RESET_N_MD (113 | GPIO_ALT_FN_2_OUT)
1479#define GPIO117_I2CSCL_MD (117 | GPIO_ALT_FN_1_OUT) 1479#define GPIO117_I2CSCL_MD (117 | GPIO_ALT_FN_1_IN)
1480#define GPIO118_I2CSDA_MD (118 | GPIO_ALT_FN_1_IN) 1480#define GPIO118_I2CSDA_MD (118 | GPIO_ALT_FN_1_IN)
1481 1481
1482/* 1482/*
diff --git a/include/asm-arm/system.h b/include/asm-arm/system.h
index f06d8a43fdee..69134c7518c1 100644
--- a/include/asm-arm/system.h
+++ b/include/asm-arm/system.h
@@ -3,6 +3,7 @@
3 3
4#ifdef __KERNEL__ 4#ifdef __KERNEL__
5 5
6#include <asm/memory.h>
6 7
7#define CPU_ARCH_UNKNOWN 0 8#define CPU_ARCH_UNKNOWN 0
8#define CPU_ARCH_ARMv3 1 9#define CPU_ARCH_ARMv3 1
@@ -154,7 +155,7 @@ extern unsigned int user_debug;
154#define vectors_high() (0) 155#define vectors_high() (0)
155#endif 156#endif
156 157
157#if __LINUX_ARM_ARCH__ >= 6 158#if defined(CONFIG_CPU_XSC3) || __LINUX_ARM_ARCH__ >= 6
158#define isb() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c5, 4" \ 159#define isb() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c5, 4" \
159 : : "r" (0) : "memory") 160 : : "r" (0) : "memory")
160#define dsb() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 4" \ 161#define dsb() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 4" \
@@ -168,22 +169,23 @@ extern unsigned int user_debug;
168#define dmb() __asm__ __volatile__ ("" : : : "memory") 169#define dmb() __asm__ __volatile__ ("" : : : "memory")
169#endif 170#endif
170 171
171#define mb() barrier() 172#ifndef CONFIG_SMP
172#define rmb() barrier() 173#define mb() do { if (arch_is_coherent()) dmb(); else barrier(); } while (0)
173#define wmb() barrier() 174#define rmb() do { if (arch_is_coherent()) dmb(); else barrier(); } while (0)
174#define read_barrier_depends() do { } while(0) 175#define wmb() do { if (arch_is_coherent()) dmb(); else barrier(); } while (0)
175 176#define smp_mb() barrier()
176#ifdef CONFIG_SMP 177#define smp_rmb() barrier()
177#define smp_mb() dmb() 178#define smp_wmb() barrier()
178#define smp_rmb() dmb()
179#define smp_wmb() dmb()
180#define smp_read_barrier_depends() read_barrier_depends()
181#else 179#else
182#define smp_mb() barrier() 180#define mb() dmb()
183#define smp_rmb() barrier() 181#define rmb() dmb()
184#define smp_wmb() barrier() 182#define wmb() dmb()
185#define smp_read_barrier_depends() read_barrier_depends() 183#define smp_mb() dmb()
186#endif /* CONFIG_SMP */ 184#define smp_rmb() dmb()
185#define smp_wmb() dmb()
186#endif
187#define read_barrier_depends() do { } while(0)
188#define smp_read_barrier_depends() do { } while(0)
187 189
188#define set_mb(var, value) do { var = value; smp_mb(); } while (0) 190#define set_mb(var, value) do { var = value; smp_mb(); } while (0)
189#define nop() __asm__ __volatile__("mov\tr0,r0\t@ nop\n\t"); 191#define nop() __asm__ __volatile__("mov\tr0,r0\t@ nop\n\t");
diff --git a/include/asm-arm/unistd.h b/include/asm-arm/unistd.h
index 0991b7bc3f78..c025ab47e4b9 100644
--- a/include/asm-arm/unistd.h
+++ b/include/asm-arm/unistd.h
@@ -372,7 +372,7 @@
372#define __NR_move_pages (__NR_SYSCALL_BASE+344) 372#define __NR_move_pages (__NR_SYSCALL_BASE+344)
373#define __NR_getcpu (__NR_SYSCALL_BASE+345) 373#define __NR_getcpu (__NR_SYSCALL_BASE+345)
374 /* 346 for epoll_pwait */ 374 /* 346 for epoll_pwait */
375#define __NR_sys_kexec_load (__NR_SYSCALL_BASE+347) 375#define __NR_kexec_load (__NR_SYSCALL_BASE+347)
376 376
377/* 377/*
378 * The following SWIs are ARM private. 378 * The following SWIs are ARM private.
diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h
index 00c23433b39f..6d7e279b1490 100644
--- a/include/asm-generic/pgtable.h
+++ b/include/asm-generic/pgtable.h
@@ -180,6 +180,7 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addres
180#ifndef __HAVE_ARCH_ENTER_LAZY_MMU_MODE 180#ifndef __HAVE_ARCH_ENTER_LAZY_MMU_MODE
181#define arch_enter_lazy_mmu_mode() do {} while (0) 181#define arch_enter_lazy_mmu_mode() do {} while (0)
182#define arch_leave_lazy_mmu_mode() do {} while (0) 182#define arch_leave_lazy_mmu_mode() do {} while (0)
183#define arch_flush_lazy_mmu_mode() do {} while (0)
183#endif 184#endif
184 185
185/* 186/*
@@ -193,6 +194,7 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addres
193#ifndef __HAVE_ARCH_ENTER_LAZY_CPU_MODE 194#ifndef __HAVE_ARCH_ENTER_LAZY_CPU_MODE
194#define arch_enter_lazy_cpu_mode() do {} while (0) 195#define arch_enter_lazy_cpu_mode() do {} while (0)
195#define arch_leave_lazy_cpu_mode() do {} while (0) 196#define arch_leave_lazy_cpu_mode() do {} while (0)
197#define arch_flush_lazy_cpu_mode() do {} while (0)
196#endif 198#endif
197 199
198/* 200/*
diff --git a/include/asm-i386/apic.h b/include/asm-i386/apic.h
index cc6b1652249a..a19810a08ae9 100644
--- a/include/asm-i386/apic.h
+++ b/include/asm-i386/apic.h
@@ -117,6 +117,7 @@ extern void enable_NMI_through_LVT0 (void * dummy);
117#define ARCH_APICTIMER_STOPS_ON_C3 1 117#define ARCH_APICTIMER_STOPS_ON_C3 1
118 118
119extern int timer_over_8254; 119extern int timer_over_8254;
120extern int local_apic_timer_c2_ok;
120 121
121#else /* !CONFIG_X86_LOCAL_APIC */ 122#else /* !CONFIG_X86_LOCAL_APIC */
122static inline void lapic_shutdown(void) { } 123static inline void lapic_shutdown(void) { }
diff --git a/include/asm-i386/cpufeature.h b/include/asm-i386/cpufeature.h
index 3f92b94e0d75..d1b8e4ab6c1a 100644
--- a/include/asm-i386/cpufeature.h
+++ b/include/asm-i386/cpufeature.h
@@ -75,6 +75,7 @@
75#define X86_FEATURE_ARCH_PERFMON (3*32+11) /* Intel Architectural PerfMon */ 75#define X86_FEATURE_ARCH_PERFMON (3*32+11) /* Intel Architectural PerfMon */
76#define X86_FEATURE_PEBS (3*32+12) /* Precise-Event Based Sampling */ 76#define X86_FEATURE_PEBS (3*32+12) /* Precise-Event Based Sampling */
77#define X86_FEATURE_BTS (3*32+13) /* Branch Trace Store */ 77#define X86_FEATURE_BTS (3*32+13) /* Branch Trace Store */
78#define X86_FEATURE_LAPIC_TIMER_BROKEN (3*32+ 14) /* lapic timer broken in C1 */
78 79
79/* Intel-defined CPU features, CPUID level 0x00000001 (ecx), word 4 */ 80/* Intel-defined CPU features, CPUID level 0x00000001 (ecx), word 4 */
80#define X86_FEATURE_XMM3 (4*32+ 0) /* Streaming SIMD Extensions-3 */ 81#define X86_FEATURE_XMM3 (4*32+ 0) /* Streaming SIMD Extensions-3 */
diff --git a/include/asm-i386/elf.h b/include/asm-i386/elf.h
index 8d33c9bb7c1c..952b3ee3c9bb 100644
--- a/include/asm-i386/elf.h
+++ b/include/asm-i386/elf.h
@@ -88,16 +88,16 @@ typedef struct user_fxsr_struct elf_fpxregset_t;
88 pr_reg[4] = regs->edi; \ 88 pr_reg[4] = regs->edi; \
89 pr_reg[5] = regs->ebp; \ 89 pr_reg[5] = regs->ebp; \
90 pr_reg[6] = regs->eax; \ 90 pr_reg[6] = regs->eax; \
91 pr_reg[7] = regs->xds; \ 91 pr_reg[7] = regs->xds & 0xffff; \
92 pr_reg[8] = regs->xes; \ 92 pr_reg[8] = regs->xes & 0xffff; \
93 pr_reg[9] = regs->xfs; \ 93 pr_reg[9] = regs->xfs & 0xffff; \
94 savesegment(gs,pr_reg[10]); \ 94 savesegment(gs,pr_reg[10]); \
95 pr_reg[11] = regs->orig_eax; \ 95 pr_reg[11] = regs->orig_eax; \
96 pr_reg[12] = regs->eip; \ 96 pr_reg[12] = regs->eip; \
97 pr_reg[13] = regs->xcs; \ 97 pr_reg[13] = regs->xcs & 0xffff; \
98 pr_reg[14] = regs->eflags; \ 98 pr_reg[14] = regs->eflags; \
99 pr_reg[15] = regs->esp; \ 99 pr_reg[15] = regs->esp; \
100 pr_reg[16] = regs->xss; 100 pr_reg[16] = regs->xss & 0xffff;
101 101
102/* This yields a mask that user programs can use to figure out what 102/* This yields a mask that user programs can use to figure out what
103 instruction set this CPU supports. This could be done in user space, 103 instruction set this CPU supports. This could be done in user space,
diff --git a/include/asm-i386/msr.h b/include/asm-i386/msr.h
index ec3b6803fd36..2ad3f30b1a68 100644
--- a/include/asm-i386/msr.h
+++ b/include/asm-i386/msr.h
@@ -275,6 +275,8 @@ static inline void wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h)
275#define MSR_K7_FID_VID_CTL 0xC0010041 275#define MSR_K7_FID_VID_CTL 0xC0010041
276#define MSR_K7_FID_VID_STATUS 0xC0010042 276#define MSR_K7_FID_VID_STATUS 0xC0010042
277 277
278#define MSR_K8_ENABLE_C1E 0xC0010055
279
278/* extended feature register */ 280/* extended feature register */
279#define MSR_EFER 0xc0000080 281#define MSR_EFER 0xc0000080
280 282
diff --git a/include/asm-i386/paravirt.h b/include/asm-i386/paravirt.h
index 46dc34ca887a..e63f1e444fcf 100644
--- a/include/asm-i386/paravirt.h
+++ b/include/asm-i386/paravirt.h
@@ -421,14 +421,17 @@ static inline void pmd_clear(pmd_t *pmdp)
421#define PARAVIRT_LAZY_NONE 0 421#define PARAVIRT_LAZY_NONE 0
422#define PARAVIRT_LAZY_MMU 1 422#define PARAVIRT_LAZY_MMU 1
423#define PARAVIRT_LAZY_CPU 2 423#define PARAVIRT_LAZY_CPU 2
424#define PARAVIRT_LAZY_FLUSH 3
424 425
425#define __HAVE_ARCH_ENTER_LAZY_CPU_MODE 426#define __HAVE_ARCH_ENTER_LAZY_CPU_MODE
426#define arch_enter_lazy_cpu_mode() paravirt_ops.set_lazy_mode(PARAVIRT_LAZY_CPU) 427#define arch_enter_lazy_cpu_mode() paravirt_ops.set_lazy_mode(PARAVIRT_LAZY_CPU)
427#define arch_leave_lazy_cpu_mode() paravirt_ops.set_lazy_mode(PARAVIRT_LAZY_NONE) 428#define arch_leave_lazy_cpu_mode() paravirt_ops.set_lazy_mode(PARAVIRT_LAZY_NONE)
429#define arch_flush_lazy_cpu_mode() paravirt_ops.set_lazy_mode(PARAVIRT_LAZY_FLUSH)
428 430
429#define __HAVE_ARCH_ENTER_LAZY_MMU_MODE 431#define __HAVE_ARCH_ENTER_LAZY_MMU_MODE
430#define arch_enter_lazy_mmu_mode() paravirt_ops.set_lazy_mode(PARAVIRT_LAZY_MMU) 432#define arch_enter_lazy_mmu_mode() paravirt_ops.set_lazy_mode(PARAVIRT_LAZY_MMU)
431#define arch_leave_lazy_mmu_mode() paravirt_ops.set_lazy_mode(PARAVIRT_LAZY_NONE) 433#define arch_leave_lazy_mmu_mode() paravirt_ops.set_lazy_mode(PARAVIRT_LAZY_NONE)
434#define arch_flush_lazy_mmu_mode() paravirt_ops.set_lazy_mode(PARAVIRT_LAZY_FLUSH)
432 435
433/* These all sit in the .parainstructions section to tell us what to patch. */ 436/* These all sit in the .parainstructions section to tell us what to patch. */
434struct paravirt_patch { 437struct paravirt_patch {
diff --git a/include/asm-i386/termbits.h b/include/asm-i386/termbits.h
index 12baf1d6343f..2e6237693814 100644
--- a/include/asm-i386/termbits.h
+++ b/include/asm-i386/termbits.h
@@ -144,7 +144,7 @@ struct ktermios {
144#define B3000000 0010015 144#define B3000000 0010015
145#define B3500000 0010016 145#define B3500000 0010016
146#define B4000000 0010017 146#define B4000000 0010017
147#define CIBAUD 002003600000 /* input baud rate (not used) */ 147#define CIBAUD 002003600000
148#define CMSPAR 010000000000 /* mark or space (stick) parity */ 148#define CMSPAR 010000000000 /* mark or space (stick) parity */
149#define CRTSCTS 020000000000 /* flow control */ 149#define CRTSCTS 020000000000 /* flow control */
150 150
diff --git a/include/asm-ia64/processor.h b/include/asm-ia64/processor.h
index 5830d36fd8e6..4f4ee1c2db2f 100644
--- a/include/asm-ia64/processor.h
+++ b/include/asm-ia64/processor.h
@@ -210,7 +210,7 @@ struct desc_struct {
210 unsigned int a, b; 210 unsigned int a, b;
211}; 211};
212 212
213#define desc_empty(desc) (!((desc)->a + (desc)->b)) 213#define desc_empty(desc) (!((desc)->a | (desc)->b))
214#define desc_equal(desc1, desc2) (((desc1)->a == (desc2)->a) && ((desc1)->b == (desc2)->b)) 214#define desc_equal(desc1, desc2) (((desc1)->a == (desc2)->a) && ((desc1)->b == (desc2)->b))
215 215
216#define GDT_ENTRY_TLS_ENTRIES 3 216#define GDT_ENTRY_TLS_ENTRIES 3
diff --git a/include/asm-mips/cacheflush.h b/include/asm-mips/cacheflush.h
index 0ddada3bb0b6..28d907d4347a 100644
--- a/include/asm-mips/cacheflush.h
+++ b/include/asm-mips/cacheflush.h
@@ -48,6 +48,15 @@ static inline void flush_dcache_page(struct page *page)
48#define flush_dcache_mmap_lock(mapping) do { } while (0) 48#define flush_dcache_mmap_lock(mapping) do { } while (0)
49#define flush_dcache_mmap_unlock(mapping) do { } while (0) 49#define flush_dcache_mmap_unlock(mapping) do { } while (0)
50 50
51#define ARCH_HAS_FLUSH_ANON_PAGE
52extern void __flush_anon_page(struct page *, unsigned long);
53static inline void flush_anon_page(struct vm_area_struct *vma,
54 struct page *page, unsigned long vmaddr)
55{
56 if (cpu_has_dc_aliases && PageAnon(page))
57 __flush_anon_page(page, vmaddr);
58}
59
51static inline void flush_icache_page(struct vm_area_struct *vma, 60static inline void flush_icache_page(struct vm_area_struct *vma,
52 struct page *page) 61 struct page *page)
53{ 62{
@@ -86,4 +95,7 @@ extern void (*flush_data_cache_page)(unsigned long addr);
86/* Run kernel code uncached, useful for cache probing functions. */ 95/* Run kernel code uncached, useful for cache probing functions. */
87unsigned long __init run_uncached(void *func); 96unsigned long __init run_uncached(void *func);
88 97
98extern void *kmap_coherent(struct page *page, unsigned long addr);
99extern void kunmap_coherent(struct page *page);
100
89#endif /* _ASM_CACHEFLUSH_H */ 101#endif /* _ASM_CACHEFLUSH_H */
diff --git a/include/asm-mips/delay.h b/include/asm-mips/delay.h
index ea77050f8e3a..223d156efb9f 100644
--- a/include/asm-mips/delay.h
+++ b/include/asm-mips/delay.h
@@ -79,7 +79,7 @@ static inline void __udelay(unsigned long usecs, unsigned long lpj)
79 __delay(usecs); 79 __delay(usecs);
80} 80}
81 81
82#define __udelay_val cpu_data[smp_processor_id()].udelay_val 82#define __udelay_val cpu_data[raw_smp_processor_id()].udelay_val
83 83
84#define udelay(usecs) __udelay((usecs),__udelay_val) 84#define udelay(usecs) __udelay((usecs),__udelay_val)
85 85
diff --git a/include/asm-mips/hazards.h b/include/asm-mips/hazards.h
index 50073157a617..e50c77e69cb5 100644
--- a/include/asm-mips/hazards.h
+++ b/include/asm-mips/hazards.h
@@ -52,6 +52,7 @@ ASMMACRO(tlb_probe_hazard,
52 _ehb 52 _ehb
53 ) 53 )
54ASMMACRO(irq_enable_hazard, 54ASMMACRO(irq_enable_hazard,
55 _ehb
55 ) 56 )
56ASMMACRO(irq_disable_hazard, 57ASMMACRO(irq_disable_hazard,
57 _ehb 58 _ehb
diff --git a/include/asm-mips/irqflags.h b/include/asm-mips/irqflags.h
index af3b07dfad4b..e459fa05db83 100644
--- a/include/asm-mips/irqflags.h
+++ b/include/asm-mips/irqflags.h
@@ -13,29 +13,9 @@
13 13
14#ifndef __ASSEMBLY__ 14#ifndef __ASSEMBLY__
15 15
16#include <linux/compiler.h>
16#include <asm/hazards.h> 17#include <asm/hazards.h>
17 18
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
39__asm__ ( 19__asm__ (
40 " .macro raw_local_irq_enable \n" 20 " .macro raw_local_irq_enable \n"
41 " .set push \n" 21 " .set push \n"
@@ -205,17 +185,28 @@ __asm__ (
205 " .set pop \n" 185 " .set pop \n"
206 " .endm \n"); 186 " .endm \n");
207 187
208#define raw_local_irq_restore(flags) \ 188extern void smtc_ipi_replay(void);
209do { \ 189
210 unsigned long __tmp1; \ 190static inline void raw_local_irq_restore(unsigned long flags)
211 \ 191{
212 __asm__ __volatile__( \ 192 unsigned long __tmp1;
213 "raw_local_irq_restore\t%0" \ 193
214 : "=r" (__tmp1) \ 194#ifdef CONFIG_MIPS_MT_SMTC_INSTANT_REPLAY
215 : "0" (flags) \ 195 /*
216 : "memory"); \ 196 * CONFIG_MIPS_MT_SMTC_INSTANT_REPLAY does prompt replay of deferred
217 irq_restore_epilog(flags); \ 197 * IPIs, at the cost of branch and call overhead on each
218} while(0) 198 * local_irq_restore()
199 */
200 if (unlikely(!(flags & 0x0400)))
201 smtc_ipi_replay();
202#endif
203
204 __asm__ __volatile__(
205 "raw_local_irq_restore\t%0"
206 : "=r" (__tmp1)
207 : "0" (flags)
208 : "memory");
209}
219 210
220static inline int raw_irqs_disabled_flags(unsigned long flags) 211static inline int raw_irqs_disabled_flags(unsigned long flags)
221{ 212{
diff --git a/include/asm-mips/marvell.h b/include/asm-mips/marvell.h
index df94955b098a..b6144bafc565 100644
--- a/include/asm-mips/marvell.h
+++ b/include/asm-mips/marvell.h
@@ -54,5 +54,6 @@ struct mv_pci_controller {
54}; 54};
55 55
56extern void ll_mv64340_irq(void); 56extern void ll_mv64340_irq(void);
57extern void mv64340_irq_init(unsigned int base);
57 58
58#endif /* __ASM_MIPS_MARVELL_H */ 59#endif /* __ASM_MIPS_MARVELL_H */
diff --git a/include/asm-mips/pgtable-64.h b/include/asm-mips/pgtable-64.h
index a5b18710b6a4..49f5a1a2dfcd 100644
--- a/include/asm-mips/pgtable-64.h
+++ b/include/asm-mips/pgtable-64.h
@@ -199,7 +199,7 @@ static inline unsigned long pud_page_vaddr(pud_t pud)
199{ 199{
200 return pud_val(pud); 200 return pud_val(pud);
201} 201}
202#define pud_phys(pud) (pud_val(pud) - PAGE_OFFSET) 202#define pud_phys(pud) virt_to_phys((void *)pud_val(pud))
203#define pud_page(pud) (pfn_to_page(pud_phys(pud) >> PAGE_SHIFT)) 203#define pud_page(pud) (pfn_to_page(pud_phys(pud) >> PAGE_SHIFT))
204 204
205/* Find an entry in the second-level page table.. */ 205/* Find an entry in the second-level page table.. */
diff --git a/include/asm-mips/pgtable.h b/include/asm-mips/pgtable.h
index 3fcfd7979de5..0d3295f57a95 100644
--- a/include/asm-mips/pgtable.h
+++ b/include/asm-mips/pgtable.h
@@ -75,7 +75,7 @@ extern void paging_init(void);
75 * Conversion functions: convert a page and protection to a page entry, 75 * Conversion functions: convert a page and protection to a page entry,
76 * and a page entry and page directory to the page they refer to. 76 * and a page entry and page directory to the page they refer to.
77 */ 77 */
78#define pmd_phys(pmd) (pmd_val(pmd) - PAGE_OFFSET) 78#define pmd_phys(pmd) virt_to_phys((void *)pmd_val(pmd))
79#define pmd_page(pmd) (pfn_to_page(pmd_phys(pmd) >> PAGE_SHIFT)) 79#define pmd_page(pmd) (pfn_to_page(pmd_phys(pmd) >> PAGE_SHIFT))
80#define pmd_page_vaddr(pmd) pmd_val(pmd) 80#define pmd_page_vaddr(pmd) pmd_val(pmd)
81 81
diff --git a/include/asm-mips/sgiarcs.h b/include/asm-mips/sgiarcs.h
index ddb859d05257..439bce7daa3a 100644
--- a/include/asm-mips/sgiarcs.h
+++ b/include/asm-mips/sgiarcs.h
@@ -459,7 +459,7 @@ struct linux_smonblock {
459 register signed int __a2 __asm__("$5") = (int) (long) (a2); \ 459 register signed int __a2 __asm__("$5") = (int) (long) (a2); \
460 register signed int __a3 __asm__("$6") = (int) (long) (a3); \ 460 register signed int __a3 __asm__("$6") = (int) (long) (a3); \
461 register signed int __a4 __asm__("$7") = (int) (long) (a4); \ 461 register signed int __a4 __asm__("$7") = (int) (long) (a4); \
462 register signed int __a5 = (a5); \ 462 register signed int __a5 = (int) (long) (a5); \
463 long __vec = (long) romvec->dest; \ 463 long __vec = (long) romvec->dest; \
464 __asm__ __volatile__( \ 464 __asm__ __volatile__( \
465 "dsubu\t$29, 32\n\t" \ 465 "dsubu\t$29, 32\n\t" \
diff --git a/include/asm-mips/sibyte/sb1250.h b/include/asm-mips/sibyte/sb1250.h
index dfb29e13bce0..494aa65dcfbd 100644
--- a/include/asm-mips/sibyte/sb1250.h
+++ b/include/asm-mips/sibyte/sb1250.h
@@ -67,6 +67,6 @@ extern void bcm1480_smp_finish(void);
67 67
68#endif 68#endif
69 69
70#define IOADDR(a) ((volatile void __iomem *)(IO_BASE + (a))) 70#define IOADDR(a) ((void __iomem *)(IO_BASE + (a)))
71 71
72#endif 72#endif
diff --git a/include/asm-mips/smtc_ipi.h b/include/asm-mips/smtc_ipi.h
index 360ea6d250c7..a52a4a7a36e0 100644
--- a/include/asm-mips/smtc_ipi.h
+++ b/include/asm-mips/smtc_ipi.h
@@ -65,12 +65,10 @@ static inline void smtc_ipi_nq(struct smtc_ipi_q *q, struct smtc_ipi *p)
65 spin_unlock_irqrestore(&q->lock, flags); 65 spin_unlock_irqrestore(&q->lock, flags);
66} 66}
67 67
68static inline struct smtc_ipi *smtc_ipi_dq(struct smtc_ipi_q *q) 68static inline struct smtc_ipi *__smtc_ipi_dq(struct smtc_ipi_q *q)
69{ 69{
70 struct smtc_ipi *p; 70 struct smtc_ipi *p;
71 long flags;
72 71
73 spin_lock_irqsave(&q->lock, flags);
74 if (q->head == NULL) 72 if (q->head == NULL)
75 p = NULL; 73 p = NULL;
76 else { 74 else {
@@ -81,7 +79,19 @@ static inline struct smtc_ipi *smtc_ipi_dq(struct smtc_ipi_q *q)
81 if (q->head == NULL) 79 if (q->head == NULL)
82 q->tail = NULL; 80 q->tail = NULL;
83 } 81 }
82
83 return p;
84}
85
86static inline struct smtc_ipi *smtc_ipi_dq(struct smtc_ipi_q *q)
87{
88 unsigned long flags;
89 struct smtc_ipi *p;
90
91 spin_lock_irqsave(&q->lock, flags);
92 p = __smtc_ipi_dq(q);
84 spin_unlock_irqrestore(&q->lock, flags); 93 spin_unlock_irqrestore(&q->lock, flags);
94
85 return p; 95 return p;
86} 96}
87 97
diff --git a/include/asm-powerpc/hvcall.h b/include/asm-powerpc/hvcall.h
index 60977806d2f4..62efd9d7a43d 100644
--- a/include/asm-powerpc/hvcall.h
+++ b/include/asm-powerpc/hvcall.h
@@ -237,6 +237,20 @@ long plpar_hcall_norets(unsigned long opcode, ...);
237long plpar_hcall(unsigned long opcode, unsigned long *retbuf, ...); 237long plpar_hcall(unsigned long opcode, unsigned long *retbuf, ...);
238 238
239/** 239/**
240 * plpar_hcall_raw: - Make a hypervisor call without calculating hcall stats
241 * @opcode: The hypervisor call to make.
242 * @retbuf: Buffer to store up to 4 return arguments in.
243 *
244 * This call supports up to 6 arguments and 4 return arguments. Use
245 * PLPAR_HCALL_BUFSIZE to size the return argument buffer.
246 *
247 * Used when phyp interface needs to be called in real mode. Similar to
248 * plpar_hcall, but plpar_hcall_raw works in real mode and does not
249 * calculate hypervisor call statistics.
250 */
251long plpar_hcall_raw(unsigned long opcode, unsigned long *retbuf, ...);
252
253/**
240 * plpar_hcall9: - Make a pseries hypervisor call with up to 9 return arguments 254 * plpar_hcall9: - Make a pseries hypervisor call with up to 9 return arguments
241 * @opcode: The hypervisor call to make. 255 * @opcode: The hypervisor call to make.
242 * @retbuf: Buffer to store up to 9 return arguments in. 256 * @retbuf: Buffer to store up to 9 return arguments in.
diff --git a/include/asm-powerpc/immap_qe.h b/include/asm-powerpc/immap_qe.h
index 9fdd0491f6a3..1020b7fc0129 100644
--- a/include/asm-powerpc/immap_qe.h
+++ b/include/asm-powerpc/immap_qe.h
@@ -258,8 +258,9 @@ struct ucc_slow {
258 u8 uccs; /* UCCx status register */ 258 u8 uccs; /* UCCx status register */
259 u8 res3[0x24]; 259 u8 res3[0x24];
260 __be16 utpt; 260 __be16 utpt;
261 u8 res4[0x52];
261 u8 guemr; /* UCC general extended mode register */ 262 u8 guemr; /* UCC general extended mode register */
262 u8 res4[0x200 - 0x091]; 263 u8 res5[0x200 - 0x091];
263} __attribute__ ((packed)); 264} __attribute__ ((packed));
264 265
265/* QE UCC Fast */ 266/* QE UCC Fast */
diff --git a/include/asm-s390/checksum.h b/include/asm-s390/checksum.h
index 0a3cd7ec8451..d5a8e7c1477c 100644
--- a/include/asm-s390/checksum.h
+++ b/include/asm-s390/checksum.h
@@ -121,50 +121,21 @@ csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
121 unsigned short len, unsigned short proto, 121 unsigned short len, unsigned short proto,
122 __wsum sum) 122 __wsum sum)
123{ 123{
124#ifndef __s390x__ 124 __u32 csum = (__force __u32)sum;
125 asm volatile( 125
126 " alr %0,%1\n" /* sum += saddr */ 126 csum += (__force __u32)saddr;
127 " brc 12,0f\n" 127 if (csum < (__force __u32)saddr)
128 " ahi %0,1\n" /* add carry */ 128 csum++;
129 "0:" 129
130 : "+&d" (sum) : "d" (saddr) : "cc"); 130 csum += (__force __u32)daddr;
131 asm volatile( 131 if (csum < (__force __u32)daddr)
132 " alr %0,%1\n" /* sum += daddr */ 132 csum++;
133 " brc 12,1f\n" 133
134 " ahi %0,1\n" /* add carry */ 134 csum += len + proto;
135 "1:" 135 if (csum < len + proto)
136 : "+&d" (sum) : "d" (daddr) : "cc"); 136 csum++;
137 asm volatile( 137
138 " alr %0,%1\n" /* sum += len + proto */ 138 return (__force __wsum)csum;
139 " brc 12,2f\n"
140 " ahi %0,1\n" /* add carry */
141 "2:"
142 : "+&d" (sum)
143 : "d" (len + proto)
144 : "cc");
145#else /* __s390x__ */
146 asm volatile(
147 " lgfr %0,%0\n"
148 " algr %0,%1\n" /* sum += saddr */
149 " brc 12,0f\n"
150 " aghi %0,1\n" /* add carry */
151 "0: algr %0,%2\n" /* sum += daddr */
152 " brc 12,1f\n"
153 " aghi %0,1\n" /* add carry */
154 "1: algfr %0,%3\n" /* sum += len + proto */
155 " brc 12,2f\n"
156 " aghi %0,1\n" /* add carry */
157 "2: srlg 0,%0,32\n"
158 " alr %0,0\n" /* fold to 32 bits */
159 " brc 12,3f\n"
160 " ahi %0,1\n" /* add carry */
161 "3: llgfr %0,%0"
162 : "+&d" (sum)
163 : "d" (saddr), "d" (daddr),
164 "d" (len + proto)
165 : "cc", "0");
166#endif /* __s390x__ */
167 return sum;
168} 139}
169 140
170/* 141/*
diff --git a/include/asm-sh/hp6xx.h b/include/asm-sh/hp6xx.h
index f35134c159dd..53ca5643d9c7 100644
--- a/include/asm-sh/hp6xx.h
+++ b/include/asm-sh/hp6xx.h
@@ -10,9 +10,9 @@
10 * 10 *
11 */ 11 */
12 12
13#define HP680_BTN_IRQ IRQ0_IRQ 13#define HP680_BTN_IRQ 32 /* IRQ0_IRQ */
14#define HP680_TS_IRQ IRQ3_IRQ 14#define HP680_TS_IRQ 35 /* IRQ3_IRQ */
15#define HP680_HD64461_IRQ IRQ4_IRQ 15#define HP680_HD64461_IRQ 36 /* IRQ4_IRQ */
16 16
17#define DAC_LCD_BRIGHTNESS 0 17#define DAC_LCD_BRIGHTNESS 0
18#define DAC_SPEAKER_VOLUME 1 18#define DAC_SPEAKER_VOLUME 1
diff --git a/include/asm-sh/system.h b/include/asm-sh/system.h
index b1e42e7f998b..4a6a19f4f8a4 100644
--- a/include/asm-sh/system.h
+++ b/include/asm-sh/system.h
@@ -7,6 +7,7 @@
7 */ 7 */
8 8
9#include <linux/irqflags.h> 9#include <linux/irqflags.h>
10#include <linux/compiler.h>
10#include <asm/types.h> 11#include <asm/types.h>
11 12
12/* 13/*
diff --git a/include/asm-sparc/a.out.h b/include/asm-sparc/a.out.h
index e4e83eb0161e..9090060a23e6 100644
--- a/include/asm-sparc/a.out.h
+++ b/include/asm-sparc/a.out.h
@@ -80,7 +80,7 @@ struct relocation_info /* used when header.a_machtype == M_SPARC */
80 unsigned long r_address; /* relocation addr */ 80 unsigned long r_address; /* relocation addr */
81 unsigned int r_index:24; /* segment index or symbol index */ 81 unsigned int r_index:24; /* segment index or symbol index */
82 unsigned int r_extern:1; /* if F, r_index==SEG#; if T, SYM idx */ 82 unsigned int r_extern:1; /* if F, r_index==SEG#; if T, SYM idx */
83 int r_pad:2; /* <unused> */ 83 unsigned int r_pad:2; /* <unused> */
84 enum reloc_type r_type:5; /* type of relocation to perform */ 84 enum reloc_type r_type:5; /* type of relocation to perform */
85 long r_addend; /* addend for relocation value */ 85 long r_addend; /* addend for relocation value */
86}; 86};
diff --git a/include/asm-sparc/mostek.h b/include/asm-sparc/mostek.h
index bd92a78f4937..958d0513a6d4 100644
--- a/include/asm-sparc/mostek.h
+++ b/include/asm-sparc/mostek.h
@@ -87,7 +87,7 @@ extern void __iomem *mstk48t02_regs;
87#define MSTK_DOW_MASK 0x07 87#define MSTK_DOW_MASK 0x07
88#define MSTK_DOM_MASK 0x3f 88#define MSTK_DOM_MASK 0x3f
89#define MSTK_MONTH_MASK 0x1f 89#define MSTK_MONTH_MASK 0x1f
90#define MSTK_YEAR_MASK 0xff 90#define MSTK_YEAR_MASK 0xffU
91 91
92/* Binary coded decimal conversion macros. */ 92/* Binary coded decimal conversion macros. */
93#define MSTK_REGVAL_TO_DECIMAL(x) (((x) & 0x0F) + 0x0A * ((x) >> 0x04)) 93#define MSTK_REGVAL_TO_DECIMAL(x) (((x) & 0x0F) + 0x0A * ((x) >> 0x04))
diff --git a/include/asm-sparc64/a.out.h b/include/asm-sparc64/a.out.h
index 35cb5c9e0c92..eb3b8e90b279 100644
--- a/include/asm-sparc64/a.out.h
+++ b/include/asm-sparc64/a.out.h
@@ -86,7 +86,7 @@ struct relocation_info /* used when header.a_machtype == M_SPARC */
86 unsigned int r_address; /* relocation addr */ 86 unsigned int r_address; /* relocation addr */
87 unsigned int r_index:24; /* segment index or symbol index */ 87 unsigned int r_index:24; /* segment index or symbol index */
88 unsigned int r_extern:1; /* if F, r_index==SEG#; if T, SYM idx */ 88 unsigned int r_extern:1; /* if F, r_index==SEG#; if T, SYM idx */
89 int r_pad:2; /* <unused> */ 89 unsigned int r_pad:2; /* <unused> */
90 enum reloc_type r_type:5; /* type of relocation to perform */ 90 enum reloc_type r_type:5; /* type of relocation to perform */
91 int r_addend; /* addend for relocation value */ 91 int r_addend; /* addend for relocation value */
92}; 92};
diff --git a/include/asm-sparc64/mostek.h b/include/asm-sparc64/mostek.h
index 09b5aba6678a..d14dd8988161 100644
--- a/include/asm-sparc64/mostek.h
+++ b/include/asm-sparc64/mostek.h
@@ -89,7 +89,7 @@ extern void __iomem *mstk48t02_regs;
89#define MSTK_DOW_MASK 0x07 89#define MSTK_DOW_MASK 0x07
90#define MSTK_DOM_MASK 0x3f 90#define MSTK_DOM_MASK 0x3f
91#define MSTK_MONTH_MASK 0x1f 91#define MSTK_MONTH_MASK 0x1f
92#define MSTK_YEAR_MASK 0xff 92#define MSTK_YEAR_MASK 0xffU
93 93
94/* Binary coded decimal conversion macros. */ 94/* Binary coded decimal conversion macros. */
95#define MSTK_REGVAL_TO_DECIMAL(x) (((x) & 0x0F) + 0x0A * ((x) >> 0x04)) 95#define MSTK_REGVAL_TO_DECIMAL(x) (((x) & 0x0F) + 0x0A * ((x) >> 0x04))
diff --git a/include/asm-um/common.lds.S b/include/asm-um/common.lds.S
index f0454516dd31..f5de80c31e88 100644
--- a/include/asm-um/common.lds.S
+++ b/include/asm-um/common.lds.S
@@ -15,6 +15,7 @@
15 PROVIDE (_unprotected_end = .); 15 PROVIDE (_unprotected_end = .);
16 16
17 . = ALIGN(4096); 17 . = ALIGN(4096);
18 .note : { *(.note.*) }
18 __start___ex_table = .; 19 __start___ex_table = .;
19 __ex_table : { *(__ex_table) } 20 __ex_table : { *(__ex_table) }
20 __stop___ex_table = .; 21 __stop___ex_table = .;
diff --git a/include/asm-um/delay.h b/include/asm-um/delay.h
index 0985bda66750..c71e32b6741e 100644
--- a/include/asm-um/delay.h
+++ b/include/asm-um/delay.h
@@ -1,9 +1,20 @@
1#ifndef __UM_DELAY_H 1#ifndef __UM_DELAY_H
2#define __UM_DELAY_H 2#define __UM_DELAY_H
3 3
4#include "asm/arch/delay.h"
5#include "asm/archparam.h"
6
7#define MILLION 1000000 4#define MILLION 1000000
8 5
6/* Undefined on purpose */
7extern void __bad_udelay(void);
8
9extern void __udelay(unsigned long usecs);
10extern void __delay(unsigned long loops);
11
12#define udelay(n) ((__builtin_constant_p(n) && (n) > 20000) ? \
13 __bad_udelay() : __udelay(n))
14
15/* It appears that ndelay is not used at all for UML, and has never been
16 * implemented. */
17extern void __unimplemented_ndelay(void);
18#define ndelay(n) __unimplemented_ndelay()
19
9#endif 20#endif
diff --git a/include/asm-um/pgtable-2level.h b/include/asm-um/pgtable-2level.h
index 6050e0eb257e..172a75fde512 100644
--- a/include/asm-um/pgtable-2level.h
+++ b/include/asm-um/pgtable-2level.h
@@ -45,12 +45,12 @@ static inline void pgd_mkuptodate(pgd_t pgd) { }
45 ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK)) 45 ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK))
46 46
47/* 47/*
48 * Bits 0 through 3 are taken 48 * Bits 0 through 4 are taken
49 */ 49 */
50#define PTE_FILE_MAX_BITS 28 50#define PTE_FILE_MAX_BITS 27
51 51
52#define pte_to_pgoff(pte) (pte_val(pte) >> 4) 52#define pte_to_pgoff(pte) (pte_val(pte) >> 5)
53 53
54#define pgoff_to_pte(off) ((pte_t) { ((off) << 4) + _PAGE_FILE }) 54#define pgoff_to_pte(off) ((pte_t) { ((off) << 5) + _PAGE_FILE })
55 55
56#endif 56#endif
diff --git a/include/asm-x86_64/apic.h b/include/asm-x86_64/apic.h
index e81d0f289f0b..7cfb39cbd918 100644
--- a/include/asm-x86_64/apic.h
+++ b/include/asm-x86_64/apic.h
@@ -102,5 +102,6 @@ void switch_ipi_to_APIC_timer(void *cpumask);
102#define ARCH_APICTIMER_STOPS_ON_C3 1 102#define ARCH_APICTIMER_STOPS_ON_C3 1
103 103
104extern unsigned boot_cpu_id; 104extern unsigned boot_cpu_id;
105extern int local_apic_timer_c2_ok;
105 106
106#endif /* __ASM_APIC_H */ 107#endif /* __ASM_APIC_H */
diff --git a/include/asm-x86_64/hw_irq.h b/include/asm-x86_64/hw_irq.h
index 2e4b7a5ed1c4..6153ae5df2e8 100644
--- a/include/asm-x86_64/hw_irq.h
+++ b/include/asm-x86_64/hw_irq.h
@@ -38,7 +38,7 @@
38#define IRQ_MOVE_CLEANUP_VECTOR FIRST_EXTERNAL_VECTOR 38#define IRQ_MOVE_CLEANUP_VECTOR FIRST_EXTERNAL_VECTOR
39 39
40/* 40/*
41 * Vectors 0x20-0x2f are used for ISA interrupts. 41 * Vectors 0x30-0x3f are used for ISA interrupts.
42 */ 42 */
43#define IRQ0_VECTOR FIRST_EXTERNAL_VECTOR + 0x10 43#define IRQ0_VECTOR FIRST_EXTERNAL_VECTOR + 0x10
44#define IRQ1_VECTOR IRQ0_VECTOR + 1 44#define IRQ1_VECTOR IRQ0_VECTOR + 1
diff --git a/include/linux/ata.h b/include/linux/ata.h
index c331da2da5f7..6caeb98e29dd 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -40,6 +40,7 @@ enum {
40 ATA_MAX_DEVICES = 2, /* per bus/port */ 40 ATA_MAX_DEVICES = 2, /* per bus/port */
41 ATA_MAX_PRD = 256, /* we could make these 256/256 */ 41 ATA_MAX_PRD = 256, /* we could make these 256/256 */
42 ATA_SECT_SIZE = 512, 42 ATA_SECT_SIZE = 512,
43 ATA_MAX_SECTORS_128 = 128,
43 ATA_MAX_SECTORS = 256, 44 ATA_MAX_SECTORS = 256,
44 ATA_MAX_SECTORS_LBA48 = 65535,/* TODO: 65536? */ 45 ATA_MAX_SECTORS_LBA48 = 65535,/* TODO: 65536? */
45 46
diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h
index 2275f2748708..81c07cd18643 100644
--- a/include/linux/bootmem.h
+++ b/include/linux/bootmem.h
@@ -108,7 +108,7 @@ static inline void *alloc_remap(int nid, unsigned long size)
108#endif /* CONFIG_HAVE_ARCH_ALLOC_REMAP */ 108#endif /* CONFIG_HAVE_ARCH_ALLOC_REMAP */
109 109
110extern unsigned long __meminitdata nr_kernel_pages; 110extern unsigned long __meminitdata nr_kernel_pages;
111extern unsigned long nr_all_pages; 111extern unsigned long __meminitdata nr_all_pages;
112 112
113extern void *alloc_large_system_hash(const char *tablename, 113extern void *alloc_large_system_hash(const char *tablename,
114 unsigned long bucketsize, 114 unsigned long bucketsize,
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index aca66984aafd..3b6949b41745 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -15,8 +15,8 @@
15# define __acquire(x) __context__(x,1) 15# define __acquire(x) __context__(x,1)
16# define __release(x) __context__(x,-1) 16# define __release(x) __context__(x,-1)
17# define __cond_lock(x,c) ((c) ? ({ __acquire(x); 1; }) : 0) 17# define __cond_lock(x,c) ((c) ? ({ __acquire(x); 1; }) : 0)
18extern void __chk_user_ptr(void __user *); 18extern void __chk_user_ptr(const void __user *);
19extern void __chk_io_ptr(void __iomem *); 19extern void __chk_io_ptr(const void __iomem *);
20#else 20#else
21# define __user 21# define __user
22# define __kernel 22# define __kernel
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index 769ddc6df492..c22b0dfcbcd2 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -127,9 +127,13 @@ static inline int cpu_is_offline(int cpu) { return 0; }
127#endif /* CONFIG_HOTPLUG_CPU */ 127#endif /* CONFIG_HOTPLUG_CPU */
128 128
129#ifdef CONFIG_SUSPEND_SMP 129#ifdef CONFIG_SUSPEND_SMP
130extern int suspend_cpu_hotplug;
131
130extern int disable_nonboot_cpus(void); 132extern int disable_nonboot_cpus(void);
131extern void enable_nonboot_cpus(void); 133extern void enable_nonboot_cpus(void);
132#else 134#else
135#define suspend_cpu_hotplug 0
136
133static inline int disable_nonboot_cpus(void) { return 0; } 137static inline int disable_nonboot_cpus(void) { return 0; }
134static inline void enable_nonboot_cpus(void) {} 138static inline void enable_nonboot_cpus(void) {}
135#endif 139#endif
diff --git a/include/linux/device.h b/include/linux/device.h
index caad9bba9652..5cf30e95c8b6 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -128,6 +128,7 @@ struct device_driver {
128 128
129 struct module * owner; 129 struct module * owner;
130 const char * mod_name; /* used for built-in modules */ 130 const char * mod_name; /* used for built-in modules */
131 struct module_kobject * mkobj;
131 132
132 int (*probe) (struct device * dev); 133 int (*probe) (struct device * dev);
133 int (*remove) (struct device * dev); 134 int (*remove) (struct device * dev);
diff --git a/include/linux/eventpoll.h b/include/linux/eventpoll.h
index 84cfa8bbdc36..d2a96cbf4f0e 100644
--- a/include/linux/eventpoll.h
+++ b/include/linux/eventpoll.h
@@ -31,12 +31,19 @@
31/* 31/*
32 * On x86-64 make the 64bit structure have the same alignment as the 32 * On x86-64 make the 64bit structure have the same alignment as the
33 * 32bit structure. This makes 32bit emulation easier. 33 * 32bit structure. This makes 32bit emulation easier.
34 *
35 * UML/x86_64 needs the same packing as x86_64 - UML + UML_X86 +
36 * 64_BIT adds up to UML/x86_64.
34 */ 37 */
35#ifdef __x86_64__ 38#ifdef __x86_64__
36#define EPOLL_PACKED __attribute__((packed)) 39#define EPOLL_PACKED __attribute__((packed))
37#else 40#else
41#if defined(CONFIG_UML) && defined(CONFIG_UML_X86) && defined(CONFIG_64BIT)
42#define EPOLL_PACKED __attribute__((packed))
43#else
38#define EPOLL_PACKED 44#define EPOLL_PACKED
39#endif 45#endif
46#endif
40 47
41struct epoll_event { 48struct epoll_event {
42 __u32 events; 49 __u32 events;
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h
index 5bdbc744e773..17c29dca8354 100644
--- a/include/linux/hrtimer.h
+++ b/include/linux/hrtimer.h
@@ -206,6 +206,7 @@ struct hrtimer_cpu_base {
206struct clock_event_device; 206struct clock_event_device;
207 207
208extern void clock_was_set(void); 208extern void clock_was_set(void);
209extern void hres_timers_resume(void);
209extern void hrtimer_interrupt(struct clock_event_device *dev); 210extern void hrtimer_interrupt(struct clock_event_device *dev);
210 211
211/* 212/*
@@ -236,6 +237,8 @@ static inline ktime_t hrtimer_cb_get_time(struct hrtimer *timer)
236 */ 237 */
237static inline void clock_was_set(void) { } 238static inline void clock_was_set(void) { }
238 239
240static inline void hres_timers_resume(void) { }
241
239/* 242/*
240 * In non high resolution mode the time reference is taken from 243 * In non high resolution mode the time reference is taken from
241 * the base softirq time variable. 244 * the base softirq time variable.
diff --git a/include/linux/ide.h b/include/linux/ide.h
index 34f2676b3c62..58564a199862 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -615,6 +615,7 @@ typedef struct ide_drive_s {
615 u8 init_speed; /* transfer rate set at boot */ 615 u8 init_speed; /* transfer rate set at boot */
616 u8 pio_speed; /* unused by core, used by some drivers for fallback from DMA */ 616 u8 pio_speed; /* unused by core, used by some drivers for fallback from DMA */
617 u8 current_speed; /* current transfer rate set */ 617 u8 current_speed; /* current transfer rate set */
618 u8 desired_speed; /* desired transfer rate set */
618 u8 dn; /* now wide spread use */ 619 u8 dn; /* now wide spread use */
619 u8 wcache; /* status of write cache */ 620 u8 wcache; /* status of write cache */
620 u8 acoustic; /* acoustic management */ 621 u8 acoustic; /* acoustic management */
diff --git a/include/linux/ipc.h b/include/linux/ipc.h
index 636094c29b16..6da6772c19ff 100644
--- a/include/linux/ipc.h
+++ b/include/linux/ipc.h
@@ -92,19 +92,16 @@ extern struct ipc_namespace init_ipc_ns;
92 92
93#ifdef CONFIG_SYSVIPC 93#ifdef CONFIG_SYSVIPC
94#define INIT_IPC_NS(ns) .ns = &init_ipc_ns, 94#define INIT_IPC_NS(ns) .ns = &init_ipc_ns,
95extern int copy_ipcs(unsigned long flags, struct task_struct *tsk);
95#else 96#else
96#define INIT_IPC_NS(ns) 97#define INIT_IPC_NS(ns)
98static inline int copy_ipcs(unsigned long flags, struct task_struct *tsk)
99{ return 0; }
97#endif 100#endif
98 101
99#ifdef CONFIG_IPC_NS 102#ifdef CONFIG_IPC_NS
100extern void free_ipc_ns(struct kref *kref); 103extern void free_ipc_ns(struct kref *kref);
101extern int copy_ipcs(unsigned long flags, struct task_struct *tsk);
102extern int unshare_ipcs(unsigned long flags, struct ipc_namespace **ns); 104extern int unshare_ipcs(unsigned long flags, struct ipc_namespace **ns);
103#else
104static inline int copy_ipcs(unsigned long flags, struct task_struct *tsk)
105{
106 return 0;
107}
108#endif 105#endif
109 106
110static inline struct ipc_namespace *get_ipc_ns(struct ipc_namespace *ns) 107static inline struct ipc_namespace *get_ipc_ns(struct ipc_namespace *ns)
diff --git a/include/linux/kdev_t.h b/include/linux/kdev_t.h
index 4c2c3737e415..2dacab8beccb 100644
--- a/include/linux/kdev_t.h
+++ b/include/linux/kdev_t.h
@@ -87,8 +87,6 @@ static inline unsigned sysv_minor(u32 dev)
87 return dev & 0x3ffff; 87 return dev & 0x3ffff;
88} 88}
89 89
90bool is_lanana_major(unsigned int major);
91
92#else /* __KERNEL__ */ 90#else /* __KERNEL__ */
93 91
94/* 92/*
diff --git a/include/linux/libata.h b/include/linux/libata.h
index e3f32f3189b2..0cfbcb6f08eb 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -311,15 +311,17 @@ enum {
311 ATA_HORKAGE_DIAGNOSTIC = (1 << 0), /* Failed boot diag */ 311 ATA_HORKAGE_DIAGNOSTIC = (1 << 0), /* Failed boot diag */
312 ATA_HORKAGE_NODMA = (1 << 1), /* DMA problems */ 312 ATA_HORKAGE_NODMA = (1 << 1), /* DMA problems */
313 ATA_HORKAGE_NONCQ = (1 << 2), /* Don't use NCQ */ 313 ATA_HORKAGE_NONCQ = (1 << 2), /* Don't use NCQ */
314 ATA_HORKAGE_MAX_SEC_128 = (1 << 3), /* Limit max sects to 128 */
315 ATA_HORKAGE_DMA_RW_ONLY = (1 << 4), /* ATAPI DMA for RW only */
314}; 316};
315 317
316enum hsm_task_states { 318enum hsm_task_states {
317 HSM_ST_IDLE, /* no command on going */ 319 HSM_ST_IDLE, /* no command on going */
320 HSM_ST_FIRST, /* (waiting the device to)
321 write CDB or first data block */
318 HSM_ST, /* (waiting the device to) transfer data */ 322 HSM_ST, /* (waiting the device to) transfer data */
319 HSM_ST_LAST, /* (waiting the device to) complete command */ 323 HSM_ST_LAST, /* (waiting the device to) complete command */
320 HSM_ST_ERR, /* error */ 324 HSM_ST_ERR, /* error */
321 HSM_ST_FIRST, /* (waiting the device to)
322 write CDB or first data block */
323}; 325};
324 326
325enum ata_completion_errors { 327enum ata_completion_errors {
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h
index 06fe93a3e916..14c937d345cb 100644
--- a/include/linux/lockdep.h
+++ b/include/linux/lockdep.h
@@ -245,7 +245,7 @@ extern void lock_release(struct lockdep_map *lock, int nested,
245 245
246# define INIT_LOCKDEP .lockdep_recursion = 0, 246# define INIT_LOCKDEP .lockdep_recursion = 0,
247 247
248#define lockdep_depth(tsk) ((tsk)->lockdep_depth) 248#define lockdep_depth(tsk) (debug_locks ? (tsk)->lockdep_depth : 0)
249 249
250#else /* !LOCKDEP */ 250#else /* !LOCKDEP */
251 251
diff --git a/include/linux/pipe_fs_i.h b/include/linux/pipe_fs_i.h
index 2e19478e9e84..8bcbc54e1b48 100644
--- a/include/linux/pipe_fs_i.h
+++ b/include/linux/pipe_fs_i.h
@@ -99,4 +99,8 @@ extern ssize_t splice_from_pipe(struct pipe_inode_info *, struct file *,
99 loff_t *, size_t, unsigned int, 99 loff_t *, size_t, unsigned int,
100 splice_actor *); 100 splice_actor *);
101 101
102extern ssize_t __splice_from_pipe(struct pipe_inode_info *, struct file *,
103 loff_t *, size_t, unsigned int,
104 splice_actor *);
105
102#endif 106#endif
diff --git a/include/linux/raid/md_k.h b/include/linux/raid/md_k.h
index 8245c282168b..de72c49747c8 100644
--- a/include/linux/raid/md_k.h
+++ b/include/linux/raid/md_k.h
@@ -104,6 +104,7 @@ struct mdk_rdev_s
104 * for reporting to userspace and storing 104 * for reporting to userspace and storing
105 * in superblock. 105 * in superblock.
106 */ 106 */
107 struct work_struct del_work; /* used for delayed sysfs removal */
107}; 108};
108 109
109struct mddev_s 110struct mddev_s
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 4ff3940210d8..82f43ad478c7 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -188,7 +188,7 @@ enum {
188 * @sk: Socket we are owned by 188 * @sk: Socket we are owned by
189 * @tstamp: Time we arrived 189 * @tstamp: Time we arrived
190 * @dev: Device we arrived on/are leaving by 190 * @dev: Device we arrived on/are leaving by
191 * @input_dev: Device we arrived on 191 * @iif: ifindex of device we arrived on
192 * @h: Transport layer header 192 * @h: Transport layer header
193 * @nh: Network layer header 193 * @nh: Network layer header
194 * @mac: Link layer header 194 * @mac: Link layer header
@@ -235,7 +235,8 @@ struct sk_buff {
235 struct sock *sk; 235 struct sock *sk;
236 struct skb_timeval tstamp; 236 struct skb_timeval tstamp;
237 struct net_device *dev; 237 struct net_device *dev;
238 struct net_device *input_dev; 238 int iif;
239 /* 4 byte hole on 64 bit*/
239 240
240 union { 241 union {
241 struct tcphdr *th; 242 struct tcphdr *th;
diff --git a/include/linux/utsname.h b/include/linux/utsname.h
index a4555fe3754c..e10267d402c5 100644
--- a/include/linux/utsname.h
+++ b/include/linux/utsname.h
@@ -70,6 +70,8 @@ static inline int unshare_utsname(unsigned long unshare_flags,
70 70
71static inline int copy_utsname(int flags, struct task_struct *tsk) 71static inline int copy_utsname(int flags, struct task_struct *tsk)
72{ 72{
73 if (flags & CLONE_NEWUTS)
74 return -EINVAL;
73 return 0; 75 return 0;
74} 76}
75static inline void put_uts_ns(struct uts_namespace *ns) 77static inline void put_uts_ns(struct uts_namespace *ns)
diff --git a/include/linux/wireless.h b/include/linux/wireless.h
index 447c52beb691..48759b2f57d7 100644
--- a/include/linux/wireless.h
+++ b/include/linux/wireless.h
@@ -1,10 +1,10 @@
1/* 1/*
2 * This file define a set of standard wireless extensions 2 * This file define a set of standard wireless extensions
3 * 3 *
4 * Version : 21 14.3.06 4 * Version : 22 16.3.07
5 * 5 *
6 * Authors : Jean Tourrilhes - HPL - <jt@hpl.hp.com> 6 * Authors : Jean Tourrilhes - HPL - <jt@hpl.hp.com>
7 * Copyright (c) 1997-2006 Jean Tourrilhes, All Rights Reserved. 7 * Copyright (c) 1997-2007 Jean Tourrilhes, All Rights Reserved.
8 */ 8 */
9 9
10#ifndef _LINUX_WIRELESS_H 10#ifndef _LINUX_WIRELESS_H
@@ -85,7 +85,7 @@
85 * (there is some stuff that will be added in the future...) 85 * (there is some stuff that will be added in the future...)
86 * I just plan to increment with each new version. 86 * I just plan to increment with each new version.
87 */ 87 */
88#define WIRELESS_EXT 21 88#define WIRELESS_EXT 22
89 89
90/* 90/*
91 * Changes : 91 * Changes :
@@ -221,6 +221,10 @@
221 * - Add IW_RETRY_SHORT/IW_RETRY_LONG retry modifiers 221 * - Add IW_RETRY_SHORT/IW_RETRY_LONG retry modifiers
222 * - Power/Retry relative values no longer * 100000 222 * - Power/Retry relative values no longer * 100000
223 * - Add explicit flag to tell stats are in 802.11k RCPI : IW_QUAL_RCPI 223 * - Add explicit flag to tell stats are in 802.11k RCPI : IW_QUAL_RCPI
224 *
225 * V21 to V22
226 * ----------
227 * - Prevent leaking of kernel space in stream on 64 bits.
224 */ 228 */
225 229
226/**************************** CONSTANTS ****************************/ 230/**************************** CONSTANTS ****************************/
@@ -1085,4 +1089,15 @@ struct iw_event
1085#define IW_EV_POINT_LEN (IW_EV_LCP_LEN + sizeof(struct iw_point) - \ 1089#define IW_EV_POINT_LEN (IW_EV_LCP_LEN + sizeof(struct iw_point) - \
1086 IW_EV_POINT_OFF) 1090 IW_EV_POINT_OFF)
1087 1091
1092/* Size of the Event prefix when packed in stream */
1093#define IW_EV_LCP_PK_LEN (4)
1094/* Size of the various events when packed in stream */
1095#define IW_EV_CHAR_PK_LEN (IW_EV_LCP_PK_LEN + IFNAMSIZ)
1096#define IW_EV_UINT_PK_LEN (IW_EV_LCP_PK_LEN + sizeof(__u32))
1097#define IW_EV_FREQ_PK_LEN (IW_EV_LCP_PK_LEN + sizeof(struct iw_freq))
1098#define IW_EV_PARAM_PK_LEN (IW_EV_LCP_PK_LEN + sizeof(struct iw_param))
1099#define IW_EV_ADDR_PK_LEN (IW_EV_LCP_PK_LEN + sizeof(struct sockaddr))
1100#define IW_EV_QUAL_PK_LEN (IW_EV_LCP_PK_LEN + sizeof(struct iw_quality))
1101#define IW_EV_POINT_PK_LEN (IW_EV_LCP_LEN + 4)
1102
1088#endif /* _LINUX_WIRELESS_H */ 1103#endif /* _LINUX_WIRELESS_H */
diff --git a/include/media/saa7146_vv.h b/include/media/saa7146_vv.h
index 83fe2e3d1e25..50e33b0e9349 100644
--- a/include/media/saa7146_vv.h
+++ b/include/media/saa7146_vv.h
@@ -239,7 +239,8 @@ void saa7146_res_free(struct saa7146_fh *fh, unsigned int bits);
239#define SAA7146_HPS_SYNC_PORT_B 0x01 239#define SAA7146_HPS_SYNC_PORT_B 0x01
240 240
241/* some memory sizes */ 241/* some memory sizes */
242#define SAA7146_CLIPPING_MEM (14*PAGE_SIZE) 242/* max. 16 clipping rectangles */
243#define SAA7146_CLIPPING_MEM (16 * 4 * sizeof(u32))
243 244
244/* some defines for the various clipping-modes */ 245/* some defines for the various clipping-modes */
245#define SAA7146_CLIPPING_RECT 0x4 246#define SAA7146_CLIPPING_RECT 0x4
diff --git a/include/net/fib_rules.h b/include/net/fib_rules.h
index bc3c26494c3d..d585ea9fa97d 100644
--- a/include/net/fib_rules.h
+++ b/include/net/fib_rules.h
@@ -34,6 +34,7 @@ struct fib_rules_ops
34 int family; 34 int family;
35 struct list_head list; 35 struct list_head list;
36 int rule_size; 36 int rule_size;
37 int addr_size;
37 38
38 int (*action)(struct fib_rule *, 39 int (*action)(struct fib_rule *,
39 struct flowi *, int, 40 struct flowi *, int,
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h
index 9eda572a2a65..cf355a3c2ad5 100644
--- a/include/net/ip6_fib.h
+++ b/include/net/ip6_fib.h
@@ -58,6 +58,7 @@ struct fib6_node
58 __u16 fn_bit; /* bit key */ 58 __u16 fn_bit; /* bit key */
59 __u16 fn_flags; 59 __u16 fn_flags;
60 __u32 fn_sernum; 60 __u32 fn_sernum;
61 struct rt6_info *rr_ptr;
61}; 62};
62 63
63#ifndef CONFIG_IPV6_SUBTREES 64#ifndef CONFIG_IPV6_SUBTREES
diff --git a/include/net/iw_handler.h b/include/net/iw_handler.h
index 10559e937d27..8a830188354d 100644
--- a/include/net/iw_handler.h
+++ b/include/net/iw_handler.h
@@ -1,10 +1,10 @@
1/* 1/*
2 * This file define the new driver API for Wireless Extensions 2 * This file define the new driver API for Wireless Extensions
3 * 3 *
4 * Version : 7 18.3.05 4 * Version : 8 16.3.07
5 * 5 *
6 * Authors : Jean Tourrilhes - HPL - <jt@hpl.hp.com> 6 * Authors : Jean Tourrilhes - HPL - <jt@hpl.hp.com>
7 * Copyright (c) 2001-2006 Jean Tourrilhes, All Rights Reserved. 7 * Copyright (c) 2001-2007 Jean Tourrilhes, All Rights Reserved.
8 */ 8 */
9 9
10#ifndef _IW_HANDLER_H 10#ifndef _IW_HANDLER_H
@@ -207,7 +207,7 @@
207 * will be needed... 207 * will be needed...
208 * I just plan to increment with each new version. 208 * I just plan to increment with each new version.
209 */ 209 */
210#define IW_HANDLER_VERSION 7 210#define IW_HANDLER_VERSION 8
211 211
212/* 212/*
213 * Changes : 213 * Changes :
@@ -239,6 +239,10 @@
239 * - Remove (struct iw_point *)->pointer from events and streams 239 * - Remove (struct iw_point *)->pointer from events and streams
240 * - Remove spy_offset from struct iw_handler_def 240 * - Remove spy_offset from struct iw_handler_def
241 * - Add "check" version of event macros for ieee802.11 stack 241 * - Add "check" version of event macros for ieee802.11 stack
242 *
243 * V7 to V8
244 * ----------
245 * - Prevent leaking of kernel space in stream on 64 bits.
242 */ 246 */
243 247
244/**************************** CONSTANTS ****************************/ 248/**************************** CONSTANTS ****************************/
@@ -500,7 +504,11 @@ iwe_stream_add_event(char * stream, /* Stream of events */
500 /* Check if it's possible */ 504 /* Check if it's possible */
501 if(likely((stream + event_len) < ends)) { 505 if(likely((stream + event_len) < ends)) {
502 iwe->len = event_len; 506 iwe->len = event_len;
503 memcpy(stream, (char *) iwe, event_len); 507 /* Beware of alignement issues on 64 bits */
508 memcpy(stream, (char *) iwe, IW_EV_LCP_PK_LEN);
509 memcpy(stream + IW_EV_LCP_LEN,
510 ((char *) iwe) + IW_EV_LCP_LEN,
511 event_len - IW_EV_LCP_LEN);
504 stream += event_len; 512 stream += event_len;
505 } 513 }
506 return stream; 514 return stream;
@@ -521,10 +529,10 @@ iwe_stream_add_point(char * stream, /* Stream of events */
521 /* Check if it's possible */ 529 /* Check if it's possible */
522 if(likely((stream + event_len) < ends)) { 530 if(likely((stream + event_len) < ends)) {
523 iwe->len = event_len; 531 iwe->len = event_len;
524 memcpy(stream, (char *) iwe, IW_EV_LCP_LEN); 532 memcpy(stream, (char *) iwe, IW_EV_LCP_PK_LEN);
525 memcpy(stream + IW_EV_LCP_LEN, 533 memcpy(stream + IW_EV_LCP_LEN,
526 ((char *) iwe) + IW_EV_LCP_LEN + IW_EV_POINT_OFF, 534 ((char *) iwe) + IW_EV_LCP_LEN + IW_EV_POINT_OFF,
527 IW_EV_POINT_LEN - IW_EV_LCP_LEN); 535 IW_EV_POINT_PK_LEN - IW_EV_LCP_PK_LEN);
528 memcpy(stream + IW_EV_POINT_LEN, extra, iwe->u.data.length); 536 memcpy(stream + IW_EV_POINT_LEN, extra, iwe->u.data.length);
529 stream += event_len; 537 stream += event_len;
530 } 538 }
@@ -574,7 +582,11 @@ iwe_stream_check_add_event(char * stream, /* Stream of events */
574 /* Check if it's possible, set error if not */ 582 /* Check if it's possible, set error if not */
575 if(likely((stream + event_len) < ends)) { 583 if(likely((stream + event_len) < ends)) {
576 iwe->len = event_len; 584 iwe->len = event_len;
577 memcpy(stream, (char *) iwe, event_len); 585 /* Beware of alignement issues on 64 bits */
586 memcpy(stream, (char *) iwe, IW_EV_LCP_PK_LEN);
587 memcpy(stream + IW_EV_LCP_LEN,
588 ((char *) iwe) + IW_EV_LCP_LEN,
589 event_len - IW_EV_LCP_LEN);
578 stream += event_len; 590 stream += event_len;
579 } else 591 } else
580 *perr = -E2BIG; 592 *perr = -E2BIG;
@@ -598,10 +610,10 @@ iwe_stream_check_add_point(char * stream, /* Stream of events */
598 /* Check if it's possible */ 610 /* Check if it's possible */
599 if(likely((stream + event_len) < ends)) { 611 if(likely((stream + event_len) < ends)) {
600 iwe->len = event_len; 612 iwe->len = event_len;
601 memcpy(stream, (char *) iwe, IW_EV_LCP_LEN); 613 memcpy(stream, (char *) iwe, IW_EV_LCP_PK_LEN);
602 memcpy(stream + IW_EV_LCP_LEN, 614 memcpy(stream + IW_EV_LCP_LEN,
603 ((char *) iwe) + IW_EV_LCP_LEN + IW_EV_POINT_OFF, 615 ((char *) iwe) + IW_EV_LCP_LEN + IW_EV_POINT_OFF,
604 IW_EV_POINT_LEN - IW_EV_LCP_LEN); 616 IW_EV_POINT_PK_LEN - IW_EV_LCP_PK_LEN);
605 memcpy(stream + IW_EV_POINT_LEN, extra, iwe->u.data.length); 617 memcpy(stream + IW_EV_POINT_LEN, extra, iwe->u.data.length);
606 stream += event_len; 618 stream += event_len;
607 } else 619 } else
diff --git a/include/net/neighbour.h b/include/net/neighbour.h
index 3725b93c52f3..ad7fe1121412 100644
--- a/include/net/neighbour.h
+++ b/include/net/neighbour.h
@@ -36,7 +36,7 @@ struct neigh_parms
36 struct net_device *dev; 36 struct net_device *dev;
37 struct neigh_parms *next; 37 struct neigh_parms *next;
38 int (*neigh_setup)(struct neighbour *); 38 int (*neigh_setup)(struct neighbour *);
39 void (*neigh_destructor)(struct neighbour *); 39 void (*neigh_cleanup)(struct neighbour *);
40 struct neigh_table *tbl; 40 struct neigh_table *tbl;
41 41
42 void *sysctl_table; 42 void *sysctl_table;
diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h
index b902d24a3256..02647fe3d74b 100644
--- a/include/net/pkt_cls.h
+++ b/include/net/pkt_cls.h
@@ -352,10 +352,13 @@ tcf_change_indev(struct tcf_proto *tp, char *indev, struct rtattr *indev_tlv)
352static inline int 352static inline int
353tcf_match_indev(struct sk_buff *skb, char *indev) 353tcf_match_indev(struct sk_buff *skb, char *indev)
354{ 354{
355 struct net_device *dev;
356
355 if (indev[0]) { 357 if (indev[0]) {
356 if (!skb->input_dev) 358 if (!skb->iif)
357 return 0; 359 return 0;
358 if (strcmp(indev, skb->input_dev->name)) 360 dev = __dev_get_by_index(skb->iif);
361 if (!dev || strcmp(indev, dev->name))
359 return 0; 362 return 0;
360 } 363 }
361 364
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index 31a8e88f1a74..f431acf3dcea 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -1002,6 +1002,7 @@ void sctp_transport_update_rto(struct sctp_transport *, __u32);
1002void sctp_transport_raise_cwnd(struct sctp_transport *, __u32, __u32); 1002void sctp_transport_raise_cwnd(struct sctp_transport *, __u32, __u32);
1003void sctp_transport_lower_cwnd(struct sctp_transport *, sctp_lower_cwnd_t); 1003void sctp_transport_lower_cwnd(struct sctp_transport *, sctp_lower_cwnd_t);
1004unsigned long sctp_transport_timeout(struct sctp_transport *); 1004unsigned long sctp_transport_timeout(struct sctp_transport *);
1005void sctp_transport_reset(struct sctp_transport *);
1005 1006
1006 1007
1007/* This is the structure we use to queue packets as they come into 1008/* This is the structure we use to queue packets as they come into
diff --git a/include/net/sctp/ulpqueue.h b/include/net/sctp/ulpqueue.h
index a43c8788b650..ab26ab3adae1 100644
--- a/include/net/sctp/ulpqueue.h
+++ b/include/net/sctp/ulpqueue.h
@@ -59,6 +59,7 @@ struct sctp_ulpq {
59/* Prototypes. */ 59/* Prototypes. */
60struct sctp_ulpq *sctp_ulpq_init(struct sctp_ulpq *, 60struct sctp_ulpq *sctp_ulpq_init(struct sctp_ulpq *,
61 struct sctp_association *); 61 struct sctp_association *);
62void sctp_ulpq_flush(struct sctp_ulpq *ulpq);
62void sctp_ulpq_free(struct sctp_ulpq *); 63void sctp_ulpq_free(struct sctp_ulpq *);
63 64
64/* Add a new DATA chunk for processing. */ 65/* Add a new DATA chunk for processing. */
diff --git a/ipc/util.c b/ipc/util.c
index 08a647965b9e..0b652387d169 100644
--- a/ipc/util.c
+++ b/ipc/util.c
@@ -144,6 +144,13 @@ void free_ipc_ns(struct kref *kref)
144 shm_exit_ns(ns); 144 shm_exit_ns(ns);
145 kfree(ns); 145 kfree(ns);
146} 146}
147#else
148int copy_ipcs(unsigned long flags, struct task_struct *tsk)
149{
150 if (flags & CLONE_NEWIPC)
151 return -EINVAL;
152 return 0;
153}
147#endif 154#endif
148 155
149/** 156/**
diff --git a/kernel/cpu.c b/kernel/cpu.c
index 3d4206ada5c9..36e70845cfc3 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -254,6 +254,12 @@ int __cpuinit cpu_up(unsigned int cpu)
254} 254}
255 255
256#ifdef CONFIG_SUSPEND_SMP 256#ifdef CONFIG_SUSPEND_SMP
257/* Needed to prevent the microcode driver from requesting firmware in its CPU
258 * hotplug notifier during the suspend/resume.
259 */
260int suspend_cpu_hotplug;
261EXPORT_SYMBOL(suspend_cpu_hotplug);
262
257static cpumask_t frozen_cpus; 263static cpumask_t frozen_cpus;
258 264
259int disable_nonboot_cpus(void) 265int disable_nonboot_cpus(void)
@@ -261,16 +267,8 @@ int disable_nonboot_cpus(void)
261 int cpu, first_cpu, error = 0; 267 int cpu, first_cpu, error = 0;
262 268
263 mutex_lock(&cpu_add_remove_lock); 269 mutex_lock(&cpu_add_remove_lock);
264 first_cpu = first_cpu(cpu_present_map); 270 suspend_cpu_hotplug = 1;
265 if (!cpu_online(first_cpu)) { 271 first_cpu = first_cpu(cpu_online_map);
266 error = _cpu_up(first_cpu);
267 if (error) {
268 printk(KERN_ERR "Could not bring CPU%d up.\n",
269 first_cpu);
270 goto out;
271 }
272 }
273
274 /* We take down all of the non-boot CPUs in one shot to avoid races 272 /* We take down all of the non-boot CPUs in one shot to avoid races
275 * with the userspace trying to use the CPU hotplug at the same time 273 * with the userspace trying to use the CPU hotplug at the same time
276 */ 274 */
@@ -296,7 +294,7 @@ int disable_nonboot_cpus(void)
296 } else { 294 } else {
297 printk(KERN_ERR "Non-boot CPUs are not disabled\n"); 295 printk(KERN_ERR "Non-boot CPUs are not disabled\n");
298 } 296 }
299out: 297 suspend_cpu_hotplug = 0;
300 mutex_unlock(&cpu_add_remove_lock); 298 mutex_unlock(&cpu_add_remove_lock);
301 return error; 299 return error;
302} 300}
@@ -308,20 +306,22 @@ void enable_nonboot_cpus(void)
308 /* Allow everyone to use the CPU hotplug again */ 306 /* Allow everyone to use the CPU hotplug again */
309 mutex_lock(&cpu_add_remove_lock); 307 mutex_lock(&cpu_add_remove_lock);
310 cpu_hotplug_disabled = 0; 308 cpu_hotplug_disabled = 0;
311 mutex_unlock(&cpu_add_remove_lock);
312 if (cpus_empty(frozen_cpus)) 309 if (cpus_empty(frozen_cpus))
313 return; 310 goto out;
314 311
312 suspend_cpu_hotplug = 1;
315 printk("Enabling non-boot CPUs ...\n"); 313 printk("Enabling non-boot CPUs ...\n");
316 for_each_cpu_mask(cpu, frozen_cpus) { 314 for_each_cpu_mask(cpu, frozen_cpus) {
317 error = cpu_up(cpu); 315 error = _cpu_up(cpu);
318 if (!error) { 316 if (!error) {
319 printk("CPU%d is up\n", cpu); 317 printk("CPU%d is up\n", cpu);
320 continue; 318 continue;
321 } 319 }
322 printk(KERN_WARNING "Error taking CPU%d up: %d\n", 320 printk(KERN_WARNING "Error taking CPU%d up: %d\n", cpu, error);
323 cpu, error);
324 } 321 }
325 cpus_clear(frozen_cpus); 322 cpus_clear(frozen_cpus);
323 suspend_cpu_hotplug = 0;
324out:
325 mutex_unlock(&cpu_add_remove_lock);
326} 326}
327#endif 327#endif
diff --git a/kernel/exit.c b/kernel/exit.c
index f132349c0325..b55ed4cc9104 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -790,7 +790,7 @@ static void exit_notify(struct task_struct *tsk)
790 790
791 pgrp = task_pgrp(tsk); 791 pgrp = task_pgrp(tsk);
792 if ((task_pgrp(t) != pgrp) && 792 if ((task_pgrp(t) != pgrp) &&
793 (task_session(t) != task_session(tsk)) && 793 (task_session(t) == task_session(tsk)) &&
794 will_become_orphaned_pgrp(pgrp, tsk) && 794 will_become_orphaned_pgrp(pgrp, tsk) &&
795 has_stopped_jobs(pgrp)) { 795 has_stopped_jobs(pgrp)) {
796 __kill_pgrp_info(SIGHUP, SEND_SIG_PRIV, pgrp); 796 __kill_pgrp_info(SIGHUP, SEND_SIG_PRIV, pgrp);
diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c
index 6a7938a0d513..b74860aaf5f1 100644
--- a/kernel/hrtimer.c
+++ b/kernel/hrtimer.c
@@ -459,6 +459,18 @@ void clock_was_set(void)
459} 459}
460 460
461/* 461/*
462 * During resume we might have to reprogram the high resolution timer
463 * interrupt (on the local CPU):
464 */
465void hres_timers_resume(void)
466{
467 WARN_ON_ONCE(num_online_cpus() > 1);
468
469 /* Retrigger the CPU local events: */
470 retrigger_next_event(NULL);
471}
472
473/*
462 * Check, whether the timer is on the callback pending list 474 * Check, whether the timer is on the callback pending list
463 */ 475 */
464static inline int hrtimer_cb_pending(const struct hrtimer *timer) 476static inline int hrtimer_cb_pending(const struct hrtimer *timer)
@@ -814,7 +826,12 @@ hrtimer_start(struct hrtimer *timer, ktime_t tim, const enum hrtimer_mode mode)
814 826
815 timer_stats_hrtimer_set_start_info(timer); 827 timer_stats_hrtimer_set_start_info(timer);
816 828
817 enqueue_hrtimer(timer, new_base, base == new_base); 829 /*
830 * Only allow reprogramming if the new base is on this CPU.
831 * (it might still be on another CPU if the timer was pending)
832 */
833 enqueue_hrtimer(timer, new_base,
834 new_base->cpu_base == &__get_cpu_var(hrtimer_bases));
818 835
819 unlock_hrtimer_base(timer, &flags); 836 unlock_hrtimer_base(timer, &flags);
820 837
diff --git a/kernel/irq/devres.c b/kernel/irq/devres.c
index 85a430da0fb6..d8ee241115f5 100644
--- a/kernel/irq/devres.c
+++ b/kernel/irq/devres.c
@@ -54,7 +54,7 @@ int devm_request_irq(struct device *dev, unsigned int irq,
54 54
55 rc = request_irq(irq, handler, irqflags, devname, dev_id); 55 rc = request_irq(irq, handler, irqflags, devname, dev_id);
56 if (rc) { 56 if (rc) {
57 kfree(dr); 57 devres_free(dr);
58 return rc; 58 return rc;
59 } 59 }
60 60
diff --git a/kernel/lockdep.c b/kernel/lockdep.c
index 8dc24c92dc6d..7065a687ac54 100644
--- a/kernel/lockdep.c
+++ b/kernel/lockdep.c
@@ -2742,6 +2742,10 @@ void debug_show_all_locks(void)
2742 int count = 10; 2742 int count = 10;
2743 int unlock = 1; 2743 int unlock = 1;
2744 2744
2745 if (unlikely(!debug_locks)) {
2746 printk("INFO: lockdep is turned off.\n");
2747 return;
2748 }
2745 printk("\nShowing all locks held in the system:\n"); 2749 printk("\nShowing all locks held in the system:\n");
2746 2750
2747 /* 2751 /*
@@ -2785,6 +2789,10 @@ EXPORT_SYMBOL_GPL(debug_show_all_locks);
2785 2789
2786void debug_show_held_locks(struct task_struct *task) 2790void debug_show_held_locks(struct task_struct *task)
2787{ 2791{
2792 if (unlikely(!debug_locks)) {
2793 printk("INFO: lockdep is turned off.\n");
2794 return;
2795 }
2788 lockdep_print_held_locks(task); 2796 lockdep_print_held_locks(task);
2789} 2797}
2790 2798
diff --git a/kernel/module.c b/kernel/module.c
index fbc51de6444e..dcdb32b8b13c 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -2384,8 +2384,13 @@ void module_add_driver(struct module *mod, struct device_driver *drv)
2384 2384
2385 /* Lookup built-in module entry in /sys/modules */ 2385 /* Lookup built-in module entry in /sys/modules */
2386 mkobj = kset_find_obj(&module_subsys.kset, drv->mod_name); 2386 mkobj = kset_find_obj(&module_subsys.kset, drv->mod_name);
2387 if (mkobj) 2387 if (mkobj) {
2388 mk = container_of(mkobj, struct module_kobject, kobj); 2388 mk = container_of(mkobj, struct module_kobject, kobj);
2389 /* remember our module structure */
2390 drv->mkobj = mk;
2391 /* kset_find_obj took a reference */
2392 kobject_put(mkobj);
2393 }
2389 } 2394 }
2390 2395
2391 if (!mk) 2396 if (!mk)
@@ -2405,17 +2410,22 @@ EXPORT_SYMBOL(module_add_driver);
2405 2410
2406void module_remove_driver(struct device_driver *drv) 2411void module_remove_driver(struct device_driver *drv)
2407{ 2412{
2413 struct module_kobject *mk = NULL;
2408 char *driver_name; 2414 char *driver_name;
2409 2415
2410 if (!drv) 2416 if (!drv)
2411 return; 2417 return;
2412 2418
2413 sysfs_remove_link(&drv->kobj, "module"); 2419 sysfs_remove_link(&drv->kobj, "module");
2414 if (drv->owner && drv->owner->mkobj.drivers_dir) { 2420
2421 if (drv->owner)
2422 mk = &drv->owner->mkobj;
2423 else if (drv->mkobj)
2424 mk = drv->mkobj;
2425 if (mk && mk->drivers_dir) {
2415 driver_name = make_driver_name(drv); 2426 driver_name = make_driver_name(drv);
2416 if (driver_name) { 2427 if (driver_name) {
2417 sysfs_remove_link(drv->owner->mkobj.drivers_dir, 2428 sysfs_remove_link(mk->drivers_dir, driver_name);
2418 driver_name);
2419 kfree(driver_name); 2429 kfree(driver_name);
2420 } 2430 }
2421 } 2431 }
diff --git a/kernel/power/disk.c b/kernel/power/disk.c
index 873cdf8ea5a4..aec19b063e3f 100644
--- a/kernel/power/disk.c
+++ b/kernel/power/disk.c
@@ -58,7 +58,6 @@ static inline int platform_prepare(void)
58 58
59static void power_down(suspend_disk_method_t mode) 59static void power_down(suspend_disk_method_t mode)
60{ 60{
61 disable_nonboot_cpus();
62 switch(mode) { 61 switch(mode) {
63 case PM_DISK_PLATFORM: 62 case PM_DISK_PLATFORM:
64 if (pm_ops && pm_ops->enter) { 63 if (pm_ops && pm_ops->enter) {
@@ -241,18 +240,11 @@ static int software_resume(void)
241 goto Done; 240 goto Done;
242 } 241 }
243 242
244 error = platform_prepare();
245 if (error) {
246 swsusp_free();
247 goto Thaw;
248 }
249
250 pr_debug("PM: Reading swsusp image.\n"); 243 pr_debug("PM: Reading swsusp image.\n");
251 244
252 error = swsusp_read(); 245 error = swsusp_read();
253 if (error) { 246 if (error) {
254 swsusp_free(); 247 swsusp_free();
255 platform_finish();
256 goto Thaw; 248 goto Thaw;
257 } 249 }
258 250
@@ -270,7 +262,6 @@ static int software_resume(void)
270 enable_nonboot_cpus(); 262 enable_nonboot_cpus();
271 Free: 263 Free:
272 swsusp_free(); 264 swsusp_free();
273 platform_finish();
274 device_resume(); 265 device_resume();
275 resume_console(); 266 resume_console();
276 Thaw: 267 Thaw:
diff --git a/kernel/power/swsusp.c b/kernel/power/swsusp.c
index 7fb834397a0d..175370824f37 100644
--- a/kernel/power/swsusp.c
+++ b/kernel/power/swsusp.c
@@ -229,13 +229,13 @@ int swsusp_shrink_memory(void)
229 size += highmem_size; 229 size += highmem_size;
230 for_each_zone (zone) 230 for_each_zone (zone)
231 if (populated_zone(zone)) { 231 if (populated_zone(zone)) {
232 tmp += snapshot_additional_pages(zone);
232 if (is_highmem(zone)) { 233 if (is_highmem(zone)) {
233 highmem_size -= 234 highmem_size -=
234 zone_page_state(zone, NR_FREE_PAGES); 235 zone_page_state(zone, NR_FREE_PAGES);
235 } else { 236 } else {
236 tmp -= zone_page_state(zone, NR_FREE_PAGES); 237 tmp -= zone_page_state(zone, NR_FREE_PAGES);
237 tmp += zone->lowmem_reserve[ZONE_NORMAL]; 238 tmp += zone->lowmem_reserve[ZONE_NORMAL];
238 tmp += snapshot_additional_pages(zone);
239 } 239 }
240 } 240 }
241 241
diff --git a/kernel/power/user.c b/kernel/power/user.c
index d6a8dcc26ae5..7cf6713b2325 100644
--- a/kernel/power/user.c
+++ b/kernel/power/user.c
@@ -368,9 +368,12 @@ static int snapshot_ioctl(struct inode *inode, struct file *filp,
368 if (error) { 368 if (error) {
369 printk(KERN_ERR "Failed to suspend some devices.\n"); 369 printk(KERN_ERR "Failed to suspend some devices.\n");
370 } else { 370 } else {
371 /* Enter S3, system is already frozen */ 371 error = disable_nonboot_cpus();
372 suspend_enter(PM_SUSPEND_MEM); 372 if (!error) {
373 373 /* Enter S3, system is already frozen */
374 suspend_enter(PM_SUSPEND_MEM);
375 enable_nonboot_cpus();
376 }
374 /* Wake up devices */ 377 /* Wake up devices */
375 device_resume(); 378 device_resume();
376 } 379 }
@@ -398,10 +401,9 @@ static int snapshot_ioctl(struct inode *inode, struct file *filp,
398 401
399 case PMOPS_ENTER: 402 case PMOPS_ENTER:
400 if (data->platform_suspend) { 403 if (data->platform_suspend) {
401 disable_nonboot_cpus();
402 kernel_shutdown_prepare(SYSTEM_SUSPEND_DISK); 404 kernel_shutdown_prepare(SYSTEM_SUSPEND_DISK);
403 error = pm_ops->enter(PM_SUSPEND_DISK); 405 error = pm_ops->enter(PM_SUSPEND_DISK);
404 enable_nonboot_cpus(); 406 error = 0;
405 } 407 }
406 break; 408 break;
407 409
diff --git a/kernel/sched.c b/kernel/sched.c
index a4ca632c477c..b9a683730148 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -4687,32 +4687,10 @@ out_unlock:
4687 return retval; 4687 return retval;
4688} 4688}
4689 4689
4690static inline struct task_struct *eldest_child(struct task_struct *p)
4691{
4692 if (list_empty(&p->children))
4693 return NULL;
4694 return list_entry(p->children.next,struct task_struct,sibling);
4695}
4696
4697static inline struct task_struct *older_sibling(struct task_struct *p)
4698{
4699 if (p->sibling.prev==&p->parent->children)
4700 return NULL;
4701 return list_entry(p->sibling.prev,struct task_struct,sibling);
4702}
4703
4704static inline struct task_struct *younger_sibling(struct task_struct *p)
4705{
4706 if (p->sibling.next==&p->parent->children)
4707 return NULL;
4708 return list_entry(p->sibling.next,struct task_struct,sibling);
4709}
4710
4711static const char stat_nam[] = "RSDTtZX"; 4690static const char stat_nam[] = "RSDTtZX";
4712 4691
4713static void show_task(struct task_struct *p) 4692static void show_task(struct task_struct *p)
4714{ 4693{
4715 struct task_struct *relative;
4716 unsigned long free = 0; 4694 unsigned long free = 0;
4717 unsigned state; 4695 unsigned state;
4718 4696
@@ -4738,19 +4716,7 @@ static void show_task(struct task_struct *p)
4738 free = (unsigned long)n - (unsigned long)end_of_stack(p); 4716 free = (unsigned long)n - (unsigned long)end_of_stack(p);
4739 } 4717 }
4740#endif 4718#endif
4741 printk("%5lu %5d %6d ", free, p->pid, p->parent->pid); 4719 printk("%5lu %5d %6d", free, p->pid, p->parent->pid);
4742 if ((relative = eldest_child(p)))
4743 printk("%5d ", relative->pid);
4744 else
4745 printk(" ");
4746 if ((relative = younger_sibling(p)))
4747 printk("%7d", relative->pid);
4748 else
4749 printk(" ");
4750 if ((relative = older_sibling(p)))
4751 printk(" %5d", relative->pid);
4752 else
4753 printk(" ");
4754 if (!p->mm) 4720 if (!p->mm)
4755 printk(" (L-TLB)\n"); 4721 printk(" (L-TLB)\n");
4756 else 4722 else
diff --git a/kernel/time.c b/kernel/time.c
index c6c80ea5d0ea..2f47888e46c9 100644
--- a/kernel/time.c
+++ b/kernel/time.c
@@ -635,6 +635,7 @@ timeval_to_jiffies(const struct timeval *value)
635 (((u64)usec * USEC_CONVERSION + USEC_ROUND) >> 635 (((u64)usec * USEC_CONVERSION + USEC_ROUND) >>
636 (USEC_JIFFIE_SC - SEC_JIFFIE_SC))) >> SEC_JIFFIE_SC; 636 (USEC_JIFFIE_SC - SEC_JIFFIE_SC))) >> SEC_JIFFIE_SC;
637} 637}
638EXPORT_SYMBOL(timeval_to_jiffies);
638 639
639void jiffies_to_timeval(const unsigned long jiffies, struct timeval *value) 640void jiffies_to_timeval(const unsigned long jiffies, struct timeval *value)
640{ 641{
@@ -649,6 +650,7 @@ void jiffies_to_timeval(const unsigned long jiffies, struct timeval *value)
649 tv_usec /= NSEC_PER_USEC; 650 tv_usec /= NSEC_PER_USEC;
650 value->tv_usec = tv_usec; 651 value->tv_usec = tv_usec;
651} 652}
653EXPORT_SYMBOL(jiffies_to_timeval);
652 654
653/* 655/*
654 * Convert jiffies/jiffies_64 to clock_t and back. 656 * Convert jiffies/jiffies_64 to clock_t and back.
diff --git a/kernel/time/clockevents.c b/kernel/time/clockevents.c
index 67932ea78c17..76212b2a99de 100644
--- a/kernel/time/clockevents.c
+++ b/kernel/time/clockevents.c
@@ -274,72 +274,3 @@ void clockevents_notify(unsigned long reason, void *arg)
274} 274}
275EXPORT_SYMBOL_GPL(clockevents_notify); 275EXPORT_SYMBOL_GPL(clockevents_notify);
276 276
277#ifdef CONFIG_SYSFS
278
279/**
280 * clockevents_show_registered - sysfs interface for listing clockevents
281 * @dev: unused
282 * @buf: char buffer to be filled with clock events list
283 *
284 * Provides sysfs interface for listing registered clock event devices
285 */
286static ssize_t clockevents_show_registered(struct sys_device *dev, char *buf)
287{
288 struct list_head *tmp;
289 char *p = buf;
290 int cpu;
291
292 spin_lock(&clockevents_lock);
293
294 list_for_each(tmp, &clockevent_devices) {
295 struct clock_event_device *ce;
296
297 ce = list_entry(tmp, struct clock_event_device, list);
298 p += sprintf(p, "%-20s F:%04x M:%d", ce->name,
299 ce->features, ce->mode);
300 p += sprintf(p, " C:");
301 if (!cpus_equal(ce->cpumask, cpu_possible_map)) {
302 for_each_cpu_mask(cpu, ce->cpumask)
303 p += sprintf(p, " %d", cpu);
304 } else {
305 /*
306 * FIXME: Add the cpu which is handling this sucker
307 */
308 }
309 p += sprintf(p, "\n");
310 }
311
312 spin_unlock(&clockevents_lock);
313
314 return p - buf;
315}
316
317/*
318 * Sysfs setup bits:
319 */
320static SYSDEV_ATTR(registered, 0600,
321 clockevents_show_registered, NULL);
322
323static struct sysdev_class clockevents_sysclass = {
324 set_kset_name("clockevents"),
325};
326
327static struct sys_device clockevents_sys_device = {
328 .id = 0,
329 .cls = &clockevents_sysclass,
330};
331
332static int __init clockevents_sysfs_init(void)
333{
334 int error = sysdev_class_register(&clockevents_sysclass);
335
336 if (!error)
337 error = sysdev_register(&clockevents_sys_device);
338 if (!error)
339 error = sysdev_create_file(
340 &clockevents_sys_device,
341 &attr_registered);
342 return error;
343}
344device_initcall(clockevents_sysfs_init);
345#endif
diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c
index 5b0e46b56fd0..fe5c7db24247 100644
--- a/kernel/time/clocksource.c
+++ b/kernel/time/clocksource.c
@@ -151,7 +151,8 @@ static void clocksource_check_watchdog(struct clocksource *cs)
151 watchdog_timer.expires = jiffies + WATCHDOG_INTERVAL; 151 watchdog_timer.expires = jiffies + WATCHDOG_INTERVAL;
152 add_timer(&watchdog_timer); 152 add_timer(&watchdog_timer);
153 } 153 }
154 } else if (cs->flags & CLOCK_SOURCE_IS_CONTINUOUS) { 154 } else {
155 if (cs->flags & CLOCK_SOURCE_IS_CONTINUOUS)
155 cs->flags |= CLOCK_SOURCE_VALID_FOR_HRES; 156 cs->flags |= CLOCK_SOURCE_VALID_FOR_HRES;
156 157
157 if (!watchdog || cs->rating > watchdog->rating) { 158 if (!watchdog || cs->rating > watchdog->rating) {
diff --git a/kernel/time/jiffies.c b/kernel/time/jiffies.c
index 3be8da8fed7e..4c256fdb8875 100644
--- a/kernel/time/jiffies.c
+++ b/kernel/time/jiffies.c
@@ -69,4 +69,4 @@ static int __init init_jiffies_clocksource(void)
69 return clocksource_register(&clocksource_jiffies); 69 return clocksource_register(&clocksource_jiffies);
70} 70}
71 71
72module_init(init_jiffies_clocksource); 72core_initcall(init_jiffies_clocksource);
diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c
index eb12509e00bd..cb25649c6f50 100644
--- a/kernel/time/ntp.c
+++ b/kernel/time/ntp.c
@@ -32,7 +32,7 @@ static u64 tick_length, tick_length_base;
32/* TIME_ERROR prevents overwriting the CMOS clock */ 32/* TIME_ERROR prevents overwriting the CMOS clock */
33static int time_state = TIME_OK; /* clock synchronization status */ 33static int time_state = TIME_OK; /* clock synchronization status */
34int time_status = STA_UNSYNC; /* clock status bits */ 34int time_status = STA_UNSYNC; /* clock status bits */
35static long time_offset; /* time adjustment (ns) */ 35static s64 time_offset; /* time adjustment (ns) */
36static long time_constant = 2; /* pll time constant */ 36static long time_constant = 2; /* pll time constant */
37long time_maxerror = NTP_PHASE_LIMIT; /* maximum error (us) */ 37long time_maxerror = NTP_PHASE_LIMIT; /* maximum error (us) */
38long time_esterror = NTP_PHASE_LIMIT; /* estimated error (us) */ 38long time_esterror = NTP_PHASE_LIMIT; /* estimated error (us) */
@@ -196,7 +196,7 @@ void __attribute__ ((weak)) notify_arch_cmos_timer(void)
196 */ 196 */
197int do_adjtimex(struct timex *txc) 197int do_adjtimex(struct timex *txc)
198{ 198{
199 long ltemp, mtemp, save_adjust; 199 long mtemp, save_adjust, rem;
200 s64 freq_adj, temp64; 200 s64 freq_adj, temp64;
201 int result; 201 int result;
202 202
@@ -277,14 +277,14 @@ int do_adjtimex(struct timex *txc)
277 time_adjust = txc->offset; 277 time_adjust = txc->offset;
278 } 278 }
279 else if (time_status & STA_PLL) { 279 else if (time_status & STA_PLL) {
280 ltemp = txc->offset * NSEC_PER_USEC; 280 time_offset = txc->offset * NSEC_PER_USEC;
281 281
282 /* 282 /*
283 * Scale the phase adjustment and 283 * Scale the phase adjustment and
284 * clamp to the operating range. 284 * clamp to the operating range.
285 */ 285 */
286 time_offset = min(ltemp, MAXPHASE * NSEC_PER_USEC); 286 time_offset = min(time_offset, (s64)MAXPHASE * NSEC_PER_USEC);
287 time_offset = max(time_offset, -MAXPHASE * NSEC_PER_USEC); 287 time_offset = max(time_offset, (s64)-MAXPHASE * NSEC_PER_USEC);
288 288
289 /* 289 /*
290 * Select whether the frequency is to be controlled 290 * Select whether the frequency is to be controlled
@@ -297,11 +297,11 @@ int do_adjtimex(struct timex *txc)
297 mtemp = xtime.tv_sec - time_reftime; 297 mtemp = xtime.tv_sec - time_reftime;
298 time_reftime = xtime.tv_sec; 298 time_reftime = xtime.tv_sec;
299 299
300 freq_adj = (s64)time_offset * mtemp; 300 freq_adj = time_offset * mtemp;
301 freq_adj = shift_right(freq_adj, time_constant * 2 + 301 freq_adj = shift_right(freq_adj, time_constant * 2 +
302 (SHIFT_PLL + 2) * 2 - SHIFT_NSEC); 302 (SHIFT_PLL + 2) * 2 - SHIFT_NSEC);
303 if (mtemp >= MINSEC && (time_status & STA_FLL || mtemp > MAXSEC)) { 303 if (mtemp >= MINSEC && (time_status & STA_FLL || mtemp > MAXSEC)) {
304 temp64 = (s64)time_offset << (SHIFT_NSEC - SHIFT_FLL); 304 temp64 = time_offset << (SHIFT_NSEC - SHIFT_FLL);
305 if (time_offset < 0) { 305 if (time_offset < 0) {
306 temp64 = -temp64; 306 temp64 = -temp64;
307 do_div(temp64, mtemp); 307 do_div(temp64, mtemp);
@@ -314,8 +314,10 @@ int do_adjtimex(struct timex *txc)
314 freq_adj += time_freq; 314 freq_adj += time_freq;
315 freq_adj = min(freq_adj, (s64)MAXFREQ_NSEC); 315 freq_adj = min(freq_adj, (s64)MAXFREQ_NSEC);
316 time_freq = max(freq_adj, (s64)-MAXFREQ_NSEC); 316 time_freq = max(freq_adj, (s64)-MAXFREQ_NSEC);
317 time_offset = (time_offset / NTP_INTERVAL_FREQ) 317 time_offset = div_long_long_rem_signed(time_offset,
318 << SHIFT_UPDATE; 318 NTP_INTERVAL_FREQ,
319 &rem);
320 time_offset <<= SHIFT_UPDATE;
319 } /* STA_PLL */ 321 } /* STA_PLL */
320 } /* txc->modes & ADJ_OFFSET */ 322 } /* txc->modes & ADJ_OFFSET */
321 if (txc->modes & ADJ_TICK) 323 if (txc->modes & ADJ_TICK)
@@ -328,12 +330,12 @@ leave: if ((time_status & (STA_UNSYNC|STA_CLOCKERR)) != 0)
328 result = TIME_ERROR; 330 result = TIME_ERROR;
329 331
330 if ((txc->modes & ADJ_OFFSET_SINGLESHOT) == ADJ_OFFSET_SINGLESHOT) 332 if ((txc->modes & ADJ_OFFSET_SINGLESHOT) == ADJ_OFFSET_SINGLESHOT)
331 txc->offset = save_adjust; 333 txc->offset = save_adjust;
332 else 334 else
333 txc->offset = shift_right(time_offset, SHIFT_UPDATE) 335 txc->offset = ((long)shift_right(time_offset, SHIFT_UPDATE)) *
334 * NTP_INTERVAL_FREQ / 1000; 336 NTP_INTERVAL_FREQ / 1000;
335 txc->freq = (time_freq / NSEC_PER_USEC) 337 txc->freq = (time_freq / NSEC_PER_USEC) <<
336 << (SHIFT_USEC - SHIFT_NSEC); 338 (SHIFT_USEC - SHIFT_NSEC);
337 txc->maxerror = time_maxerror; 339 txc->maxerror = time_maxerror;
338 txc->esterror = time_esterror; 340 txc->esterror = time_esterror;
339 txc->status = time_status; 341 txc->status = time_status;
diff --git a/kernel/time/timer_list.c b/kernel/time/timer_list.c
index f82c635c3d5c..59df5e8555a8 100644
--- a/kernel/time/timer_list.c
+++ b/kernel/time/timer_list.c
@@ -194,9 +194,9 @@ print_tickdevice(struct seq_file *m, struct tick_device *td)
194 return; 194 return;
195 } 195 }
196 SEQ_printf(m, "%s\n", dev->name); 196 SEQ_printf(m, "%s\n", dev->name);
197 SEQ_printf(m, " max_delta_ns: %ld\n", dev->max_delta_ns); 197 SEQ_printf(m, " max_delta_ns: %lu\n", dev->max_delta_ns);
198 SEQ_printf(m, " min_delta_ns: %ld\n", dev->min_delta_ns); 198 SEQ_printf(m, " min_delta_ns: %lu\n", dev->min_delta_ns);
199 SEQ_printf(m, " mult: %ld\n", dev->mult); 199 SEQ_printf(m, " mult: %lu\n", dev->mult);
200 SEQ_printf(m, " shift: %d\n", dev->shift); 200 SEQ_printf(m, " shift: %d\n", dev->shift);
201 SEQ_printf(m, " mode: %d\n", dev->mode); 201 SEQ_printf(m, " mode: %d\n", dev->mode);
202 SEQ_printf(m, " next_event: %Ld nsecs\n", 202 SEQ_printf(m, " next_event: %Ld nsecs\n",
diff --git a/kernel/timer.c b/kernel/timer.c
index 797cccb86431..dd6c2c1c561b 100644
--- a/kernel/timer.c
+++ b/kernel/timer.c
@@ -695,15 +695,28 @@ static unsigned long cmp_next_hrtimer_event(unsigned long now,
695{ 695{
696 ktime_t hr_delta = hrtimer_get_next_event(); 696 ktime_t hr_delta = hrtimer_get_next_event();
697 struct timespec tsdelta; 697 struct timespec tsdelta;
698 unsigned long delta;
698 699
699 if (hr_delta.tv64 == KTIME_MAX) 700 if (hr_delta.tv64 == KTIME_MAX)
700 return expires; 701 return expires;
701 702
702 if (hr_delta.tv64 <= TICK_NSEC) 703 /*
703 return now; 704 * Expired timer available, let it expire in the next tick
705 */
706 if (hr_delta.tv64 <= 0)
707 return now + 1;
704 708
705 tsdelta = ktime_to_timespec(hr_delta); 709 tsdelta = ktime_to_timespec(hr_delta);
706 now += timespec_to_jiffies(&tsdelta); 710 delta = timespec_to_jiffies(&tsdelta);
711 /*
712 * Take rounding errors in to account and make sure, that it
713 * expires in the next tick. Otherwise we go into an endless
714 * ping pong due to tick_nohz_stop_sched_tick() retriggering
715 * the timer softirq
716 */
717 if (delta < 1)
718 delta = 1;
719 now += delta;
707 if (time_before(now, expires)) 720 if (time_before(now, expires))
708 return now; 721 return now;
709 return expires; 722 return expires;
@@ -1003,7 +1016,7 @@ static int timekeeping_resume(struct sys_device *dev)
1003 clockevents_notify(CLOCK_EVT_NOTIFY_RESUME, NULL); 1016 clockevents_notify(CLOCK_EVT_NOTIFY_RESUME, NULL);
1004 1017
1005 /* Resume hrtimers */ 1018 /* Resume hrtimers */
1006 clock_was_set(); 1019 hres_timers_resume();
1007 1020
1008 return 0; 1021 return 0;
1009} 1022}
diff --git a/mm/bounce.c b/mm/bounce.c
index 643efbe82402..ad401fc57440 100644
--- a/mm/bounce.c
+++ b/mm/bounce.c
@@ -204,7 +204,7 @@ static void __blk_queue_bounce(request_queue_t *q, struct bio **bio_orig,
204 /* 204 /*
205 * is destination page below bounce pfn? 205 * is destination page below bounce pfn?
206 */ 206 */
207 if (page_to_pfn(page) < q->bounce_pfn) 207 if (page_to_pfn(page) <= q->bounce_pfn)
208 continue; 208 continue;
209 209
210 /* 210 /*
diff --git a/mm/filemap_xip.c b/mm/filemap_xip.c
index 9dd9fbb75139..cbb335813ec0 100644
--- a/mm/filemap_xip.c
+++ b/mm/filemap_xip.c
@@ -17,6 +17,29 @@
17#include "filemap.h" 17#include "filemap.h"
18 18
19/* 19/*
20 * We do use our own empty page to avoid interference with other users
21 * of ZERO_PAGE(), such as /dev/zero
22 */
23static struct page *__xip_sparse_page;
24
25static struct page *xip_sparse_page(void)
26{
27 if (!__xip_sparse_page) {
28 unsigned long zeroes = get_zeroed_page(GFP_HIGHUSER);
29 if (zeroes) {
30 static DEFINE_SPINLOCK(xip_alloc_lock);
31 spin_lock(&xip_alloc_lock);
32 if (!__xip_sparse_page)
33 __xip_sparse_page = virt_to_page(zeroes);
34 else
35 free_page(zeroes);
36 spin_unlock(&xip_alloc_lock);
37 }
38 }
39 return __xip_sparse_page;
40}
41
42/*
20 * This is a file read routine for execute in place files, and uses 43 * This is a file read routine for execute in place files, and uses
21 * the mapping->a_ops->get_xip_page() function for the actual low-level 44 * the mapping->a_ops->get_xip_page() function for the actual low-level
22 * stuff. 45 * stuff.
@@ -162,7 +185,7 @@ EXPORT_SYMBOL_GPL(xip_file_sendfile);
162 * xip_write 185 * xip_write
163 * 186 *
164 * This function walks all vmas of the address_space and unmaps the 187 * This function walks all vmas of the address_space and unmaps the
165 * ZERO_PAGE when found at pgoff. Should it go in rmap.c? 188 * __xip_sparse_page when found at pgoff.
166 */ 189 */
167static void 190static void
168__xip_unmap (struct address_space * mapping, 191__xip_unmap (struct address_space * mapping,
@@ -177,13 +200,16 @@ __xip_unmap (struct address_space * mapping,
177 spinlock_t *ptl; 200 spinlock_t *ptl;
178 struct page *page; 201 struct page *page;
179 202
203 page = __xip_sparse_page;
204 if (!page)
205 return;
206
180 spin_lock(&mapping->i_mmap_lock); 207 spin_lock(&mapping->i_mmap_lock);
181 vma_prio_tree_foreach(vma, &iter, &mapping->i_mmap, pgoff, pgoff) { 208 vma_prio_tree_foreach(vma, &iter, &mapping->i_mmap, pgoff, pgoff) {
182 mm = vma->vm_mm; 209 mm = vma->vm_mm;
183 address = vma->vm_start + 210 address = vma->vm_start +
184 ((pgoff - vma->vm_pgoff) << PAGE_SHIFT); 211 ((pgoff - vma->vm_pgoff) << PAGE_SHIFT);
185 BUG_ON(address < vma->vm_start || address >= vma->vm_end); 212 BUG_ON(address < vma->vm_start || address >= vma->vm_end);
186 page = ZERO_PAGE(0);
187 pte = page_check_address(page, mm, address, &ptl); 213 pte = page_check_address(page, mm, address, &ptl);
188 if (pte) { 214 if (pte) {
189 /* Nuke the page table entry. */ 215 /* Nuke the page table entry. */
@@ -222,16 +248,14 @@ xip_file_nopage(struct vm_area_struct * area,
222 + area->vm_pgoff; 248 + area->vm_pgoff;
223 249
224 size = (i_size_read(inode) + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT; 250 size = (i_size_read(inode) + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
225 if (pgoff >= size) { 251 if (pgoff >= size)
226 return NULL; 252 return NOPAGE_SIGBUS;
227 }
228 253
229 page = mapping->a_ops->get_xip_page(mapping, pgoff*(PAGE_SIZE/512), 0); 254 page = mapping->a_ops->get_xip_page(mapping, pgoff*(PAGE_SIZE/512), 0);
230 if (!IS_ERR(page)) { 255 if (!IS_ERR(page))
231 goto out; 256 goto out;
232 }
233 if (PTR_ERR(page) != -ENODATA) 257 if (PTR_ERR(page) != -ENODATA)
234 return NULL; 258 return NOPAGE_SIGBUS;
235 259
236 /* sparse block */ 260 /* sparse block */
237 if ((area->vm_flags & (VM_WRITE | VM_MAYWRITE)) && 261 if ((area->vm_flags & (VM_WRITE | VM_MAYWRITE)) &&
@@ -241,12 +265,14 @@ xip_file_nopage(struct vm_area_struct * area,
241 page = mapping->a_ops->get_xip_page (mapping, 265 page = mapping->a_ops->get_xip_page (mapping,
242 pgoff*(PAGE_SIZE/512), 1); 266 pgoff*(PAGE_SIZE/512), 1);
243 if (IS_ERR(page)) 267 if (IS_ERR(page))
244 return NULL; 268 return NOPAGE_SIGBUS;
245 /* unmap page at pgoff from all other vmas */ 269 /* unmap page at pgoff from all other vmas */
246 __xip_unmap(mapping, pgoff); 270 __xip_unmap(mapping, pgoff);
247 } else { 271 } else {
248 /* not shared and writable, use ZERO_PAGE() */ 272 /* not shared and writable, use xip_sparse_page() */
249 page = ZERO_PAGE(0); 273 page = xip_sparse_page();
274 if (!page)
275 return NOPAGE_OOM;
250 } 276 }
251 277
252out: 278out:
diff --git a/mm/madvise.c b/mm/madvise.c
index 77916e9fc52b..603c5257ed6e 100644
--- a/mm/madvise.c
+++ b/mm/madvise.c
@@ -159,9 +159,10 @@ static long madvise_remove(struct vm_area_struct *vma,
159 unsigned long start, unsigned long end) 159 unsigned long start, unsigned long end)
160{ 160{
161 struct address_space *mapping; 161 struct address_space *mapping;
162 loff_t offset, endoff; 162 loff_t offset, endoff;
163 int error;
163 164
164 *prev = vma; 165 *prev = NULL; /* tell sys_madvise we drop mmap_sem */
165 166
166 if (vma->vm_flags & (VM_LOCKED|VM_NONLINEAR|VM_HUGETLB)) 167 if (vma->vm_flags & (VM_LOCKED|VM_NONLINEAR|VM_HUGETLB))
167 return -EINVAL; 168 return -EINVAL;
@@ -180,7 +181,12 @@ static long madvise_remove(struct vm_area_struct *vma,
180 + ((loff_t)vma->vm_pgoff << PAGE_SHIFT); 181 + ((loff_t)vma->vm_pgoff << PAGE_SHIFT);
181 endoff = (loff_t)(end - vma->vm_start - 1) 182 endoff = (loff_t)(end - vma->vm_start - 1)
182 + ((loff_t)vma->vm_pgoff << PAGE_SHIFT); 183 + ((loff_t)vma->vm_pgoff << PAGE_SHIFT);
183 return vmtruncate_range(mapping->host, offset, endoff); 184
185 /* vmtruncate_range needs to take i_mutex and i_alloc_sem */
186 up_write(&current->mm->mmap_sem);
187 error = vmtruncate_range(mapping->host, offset, endoff);
188 down_write(&current->mm->mmap_sem);
189 return error;
184} 190}
185 191
186static long 192static long
@@ -315,12 +321,15 @@ asmlinkage long sys_madvise(unsigned long start, size_t len_in, int behavior)
315 if (error) 321 if (error)
316 goto out; 322 goto out;
317 start = tmp; 323 start = tmp;
318 if (start < prev->vm_end) 324 if (prev && start < prev->vm_end)
319 start = prev->vm_end; 325 start = prev->vm_end;
320 error = unmapped_error; 326 error = unmapped_error;
321 if (start >= end) 327 if (start >= end)
322 goto out; 328 goto out;
323 vma = prev->vm_next; 329 if (prev)
330 vma = prev->vm_next;
331 else /* madvise_remove dropped mmap_sem */
332 vma = find_vma(current->mm, start);
324 } 333 }
325out: 334out:
326 up_write(&current->mm->mmap_sem); 335 up_write(&current->mm->mmap_sem);
diff --git a/mm/nommu.c b/mm/nommu.c
index 23fb033e596d..cbbc13774819 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -826,6 +826,11 @@ unsigned long do_mmap_pgoff(struct file *file,
826 unsigned long pglen = (len + PAGE_SIZE - 1) >> PAGE_SHIFT; 826 unsigned long pglen = (len + PAGE_SIZE - 1) >> PAGE_SHIFT;
827 unsigned long vmpglen; 827 unsigned long vmpglen;
828 828
829 /* suppress VMA sharing for shared regions */
830 if (vm_flags & VM_SHARED &&
831 capabilities & BDI_CAP_MAP_DIRECT)
832 goto dont_share_VMAs;
833
829 for (rb = rb_first(&nommu_vma_tree); rb; rb = rb_next(rb)) { 834 for (rb = rb_first(&nommu_vma_tree); rb; rb = rb_next(rb)) {
830 vma = rb_entry(rb, struct vm_area_struct, vm_rb); 835 vma = rb_entry(rb, struct vm_area_struct, vm_rb);
831 836
@@ -859,6 +864,7 @@ unsigned long do_mmap_pgoff(struct file *file,
859 goto shared; 864 goto shared;
860 } 865 }
861 866
867 dont_share_VMAs:
862 vma = NULL; 868 vma = NULL;
863 869
864 /* obtain the address at which to make a shared mapping 870 /* obtain the address at which to make a shared mapping
@@ -1193,6 +1199,28 @@ void unmap_mapping_range(struct address_space *mapping,
1193EXPORT_SYMBOL(unmap_mapping_range); 1199EXPORT_SYMBOL(unmap_mapping_range);
1194 1200
1195/* 1201/*
1202 * ask for an unmapped area at which to create a mapping on a file
1203 */
1204unsigned long get_unmapped_area(struct file *file, unsigned long addr,
1205 unsigned long len, unsigned long pgoff,
1206 unsigned long flags)
1207{
1208 unsigned long (*get_area)(struct file *, unsigned long, unsigned long,
1209 unsigned long, unsigned long);
1210
1211 get_area = current->mm->get_unmapped_area;
1212 if (file && file->f_op && file->f_op->get_unmapped_area)
1213 get_area = file->f_op->get_unmapped_area;
1214
1215 if (!get_area)
1216 return -ENOSYS;
1217
1218 return get_area(file, addr, len, pgoff, flags);
1219}
1220
1221EXPORT_SYMBOL(get_unmapped_area);
1222
1223/*
1196 * Check that a process has enough memory to allocate a new virtual 1224 * Check that a process has enough memory to allocate a new virtual
1197 * mapping. 0 means there is enough memory for the allocation to 1225 * mapping. 0 means there is enough memory for the allocation to
1198 * succeed and -ENOMEM implies there is not. 1226 * succeed and -ENOMEM implies there is not.
diff --git a/mm/rmap.c b/mm/rmap.c
index 22ed3f71a674..b82146e6dfc9 100644
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -498,9 +498,9 @@ int page_mkclean(struct page *page)
498 struct address_space *mapping = page_mapping(page); 498 struct address_space *mapping = page_mapping(page);
499 if (mapping) 499 if (mapping)
500 ret = page_mkclean_file(mapping, page); 500 ret = page_mkclean_file(mapping, page);
501 if (page_test_and_clear_dirty(page))
502 ret = 1;
501 } 503 }
502 if (page_test_and_clear_dirty(page))
503 ret = 1;
504 504
505 return ret; 505 return ret;
506} 506}
diff --git a/mm/shmem.c b/mm/shmem.c
index b8c429a2d271..b2a35ebf071a 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -402,26 +402,38 @@ static swp_entry_t *shmem_swp_alloc(struct shmem_inode_info *info, unsigned long
402/* 402/*
403 * shmem_free_swp - free some swap entries in a directory 403 * shmem_free_swp - free some swap entries in a directory
404 * 404 *
405 * @dir: pointer to the directory 405 * @dir: pointer to the directory
406 * @edir: pointer after last entry of the directory 406 * @edir: pointer after last entry of the directory
407 * @punch_lock: pointer to spinlock when needed for the holepunch case
407 */ 408 */
408static int shmem_free_swp(swp_entry_t *dir, swp_entry_t *edir) 409static int shmem_free_swp(swp_entry_t *dir, swp_entry_t *edir,
410 spinlock_t *punch_lock)
409{ 411{
412 spinlock_t *punch_unlock = NULL;
410 swp_entry_t *ptr; 413 swp_entry_t *ptr;
411 int freed = 0; 414 int freed = 0;
412 415
413 for (ptr = dir; ptr < edir; ptr++) { 416 for (ptr = dir; ptr < edir; ptr++) {
414 if (ptr->val) { 417 if (ptr->val) {
418 if (unlikely(punch_lock)) {
419 punch_unlock = punch_lock;
420 punch_lock = NULL;
421 spin_lock(punch_unlock);
422 if (!ptr->val)
423 continue;
424 }
415 free_swap_and_cache(*ptr); 425 free_swap_and_cache(*ptr);
416 *ptr = (swp_entry_t){0}; 426 *ptr = (swp_entry_t){0};
417 freed++; 427 freed++;
418 } 428 }
419 } 429 }
430 if (punch_unlock)
431 spin_unlock(punch_unlock);
420 return freed; 432 return freed;
421} 433}
422 434
423static int shmem_map_and_free_swp(struct page *subdir, 435static int shmem_map_and_free_swp(struct page *subdir, int offset,
424 int offset, int limit, struct page ***dir) 436 int limit, struct page ***dir, spinlock_t *punch_lock)
425{ 437{
426 swp_entry_t *ptr; 438 swp_entry_t *ptr;
427 int freed = 0; 439 int freed = 0;
@@ -431,7 +443,8 @@ static int shmem_map_and_free_swp(struct page *subdir,
431 int size = limit - offset; 443 int size = limit - offset;
432 if (size > LATENCY_LIMIT) 444 if (size > LATENCY_LIMIT)
433 size = LATENCY_LIMIT; 445 size = LATENCY_LIMIT;
434 freed += shmem_free_swp(ptr+offset, ptr+offset+size); 446 freed += shmem_free_swp(ptr+offset, ptr+offset+size,
447 punch_lock);
435 if (need_resched()) { 448 if (need_resched()) {
436 shmem_swp_unmap(ptr); 449 shmem_swp_unmap(ptr);
437 if (*dir) { 450 if (*dir) {
@@ -481,7 +494,10 @@ static void shmem_truncate_range(struct inode *inode, loff_t start, loff_t end)
481 long nr_swaps_freed = 0; 494 long nr_swaps_freed = 0;
482 int offset; 495 int offset;
483 int freed; 496 int freed;
484 int punch_hole = 0; 497 int punch_hole;
498 spinlock_t *needs_lock;
499 spinlock_t *punch_lock;
500 unsigned long upper_limit;
485 501
486 inode->i_ctime = inode->i_mtime = CURRENT_TIME; 502 inode->i_ctime = inode->i_mtime = CURRENT_TIME;
487 idx = (start + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT; 503 idx = (start + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
@@ -492,11 +508,20 @@ static void shmem_truncate_range(struct inode *inode, loff_t start, loff_t end)
492 info->flags |= SHMEM_TRUNCATE; 508 info->flags |= SHMEM_TRUNCATE;
493 if (likely(end == (loff_t) -1)) { 509 if (likely(end == (loff_t) -1)) {
494 limit = info->next_index; 510 limit = info->next_index;
511 upper_limit = SHMEM_MAX_INDEX;
495 info->next_index = idx; 512 info->next_index = idx;
513 needs_lock = NULL;
514 punch_hole = 0;
496 } else { 515 } else {
497 limit = (end + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT; 516 if (end + 1 >= inode->i_size) { /* we may free a little more */
498 if (limit > info->next_index) 517 limit = (inode->i_size + PAGE_CACHE_SIZE - 1) >>
499 limit = info->next_index; 518 PAGE_CACHE_SHIFT;
519 upper_limit = SHMEM_MAX_INDEX;
520 } else {
521 limit = (end + 1) >> PAGE_CACHE_SHIFT;
522 upper_limit = limit;
523 }
524 needs_lock = &info->lock;
500 punch_hole = 1; 525 punch_hole = 1;
501 } 526 }
502 527
@@ -513,17 +538,30 @@ static void shmem_truncate_range(struct inode *inode, loff_t start, loff_t end)
513 size = limit; 538 size = limit;
514 if (size > SHMEM_NR_DIRECT) 539 if (size > SHMEM_NR_DIRECT)
515 size = SHMEM_NR_DIRECT; 540 size = SHMEM_NR_DIRECT;
516 nr_swaps_freed = shmem_free_swp(ptr+idx, ptr+size); 541 nr_swaps_freed = shmem_free_swp(ptr+idx, ptr+size, needs_lock);
517 } 542 }
518 543
519 /* 544 /*
520 * If there are no indirect blocks or we are punching a hole 545 * If there are no indirect blocks or we are punching a hole
521 * below indirect blocks, nothing to be done. 546 * below indirect blocks, nothing to be done.
522 */ 547 */
523 if (!topdir || (punch_hole && (limit <= SHMEM_NR_DIRECT))) 548 if (!topdir || limit <= SHMEM_NR_DIRECT)
524 goto done2; 549 goto done2;
525 550
526 BUG_ON(limit <= SHMEM_NR_DIRECT); 551 /*
552 * The truncation case has already dropped info->lock, and we're safe
553 * because i_size and next_index have already been lowered, preventing
554 * access beyond. But in the punch_hole case, we still need to take
555 * the lock when updating the swap directory, because there might be
556 * racing accesses by shmem_getpage(SGP_CACHE), shmem_unuse_inode or
557 * shmem_writepage. However, whenever we find we can remove a whole
558 * directory page (not at the misaligned start or end of the range),
559 * we first NULLify its pointer in the level above, and then have no
560 * need to take the lock when updating its contents: needs_lock and
561 * punch_lock (either pointing to info->lock or NULL) manage this.
562 */
563
564 upper_limit -= SHMEM_NR_DIRECT;
527 limit -= SHMEM_NR_DIRECT; 565 limit -= SHMEM_NR_DIRECT;
528 idx = (idx > SHMEM_NR_DIRECT)? (idx - SHMEM_NR_DIRECT): 0; 566 idx = (idx > SHMEM_NR_DIRECT)? (idx - SHMEM_NR_DIRECT): 0;
529 offset = idx % ENTRIES_PER_PAGE; 567 offset = idx % ENTRIES_PER_PAGE;
@@ -543,8 +581,14 @@ static void shmem_truncate_range(struct inode *inode, loff_t start, loff_t end)
543 if (*dir) { 581 if (*dir) {
544 diroff = ((idx - ENTRIES_PER_PAGEPAGE/2) % 582 diroff = ((idx - ENTRIES_PER_PAGEPAGE/2) %
545 ENTRIES_PER_PAGEPAGE) / ENTRIES_PER_PAGE; 583 ENTRIES_PER_PAGEPAGE) / ENTRIES_PER_PAGE;
546 if (!diroff && !offset) { 584 if (!diroff && !offset && upper_limit >= stage) {
547 *dir = NULL; 585 if (needs_lock) {
586 spin_lock(needs_lock);
587 *dir = NULL;
588 spin_unlock(needs_lock);
589 needs_lock = NULL;
590 } else
591 *dir = NULL;
548 nr_pages_to_free++; 592 nr_pages_to_free++;
549 list_add(&middir->lru, &pages_to_free); 593 list_add(&middir->lru, &pages_to_free);
550 } 594 }
@@ -570,39 +614,55 @@ static void shmem_truncate_range(struct inode *inode, loff_t start, loff_t end)
570 } 614 }
571 stage = idx + ENTRIES_PER_PAGEPAGE; 615 stage = idx + ENTRIES_PER_PAGEPAGE;
572 middir = *dir; 616 middir = *dir;
573 *dir = NULL; 617 if (punch_hole)
574 nr_pages_to_free++; 618 needs_lock = &info->lock;
575 list_add(&middir->lru, &pages_to_free); 619 if (upper_limit >= stage) {
620 if (needs_lock) {
621 spin_lock(needs_lock);
622 *dir = NULL;
623 spin_unlock(needs_lock);
624 needs_lock = NULL;
625 } else
626 *dir = NULL;
627 nr_pages_to_free++;
628 list_add(&middir->lru, &pages_to_free);
629 }
576 shmem_dir_unmap(dir); 630 shmem_dir_unmap(dir);
577 cond_resched(); 631 cond_resched();
578 dir = shmem_dir_map(middir); 632 dir = shmem_dir_map(middir);
579 diroff = 0; 633 diroff = 0;
580 } 634 }
635 punch_lock = needs_lock;
581 subdir = dir[diroff]; 636 subdir = dir[diroff];
582 if (subdir && page_private(subdir)) { 637 if (subdir && !offset && upper_limit-idx >= ENTRIES_PER_PAGE) {
638 if (needs_lock) {
639 spin_lock(needs_lock);
640 dir[diroff] = NULL;
641 spin_unlock(needs_lock);
642 punch_lock = NULL;
643 } else
644 dir[diroff] = NULL;
645 nr_pages_to_free++;
646 list_add(&subdir->lru, &pages_to_free);
647 }
648 if (subdir && page_private(subdir) /* has swap entries */) {
583 size = limit - idx; 649 size = limit - idx;
584 if (size > ENTRIES_PER_PAGE) 650 if (size > ENTRIES_PER_PAGE)
585 size = ENTRIES_PER_PAGE; 651 size = ENTRIES_PER_PAGE;
586 freed = shmem_map_and_free_swp(subdir, 652 freed = shmem_map_and_free_swp(subdir,
587 offset, size, &dir); 653 offset, size, &dir, punch_lock);
588 if (!dir) 654 if (!dir)
589 dir = shmem_dir_map(middir); 655 dir = shmem_dir_map(middir);
590 nr_swaps_freed += freed; 656 nr_swaps_freed += freed;
591 if (offset) 657 if (offset || punch_lock) {
592 spin_lock(&info->lock); 658 spin_lock(&info->lock);
593 set_page_private(subdir, page_private(subdir) - freed); 659 set_page_private(subdir,
594 if (offset) 660 page_private(subdir) - freed);
595 spin_unlock(&info->lock); 661 spin_unlock(&info->lock);
596 if (!punch_hole) 662 } else
597 BUG_ON(page_private(subdir) > offset); 663 BUG_ON(page_private(subdir) != freed);
598 }
599 if (offset)
600 offset = 0;
601 else if (subdir && !page_private(subdir)) {
602 dir[diroff] = NULL;
603 nr_pages_to_free++;
604 list_add(&subdir->lru, &pages_to_free);
605 } 664 }
665 offset = 0;
606 } 666 }
607done1: 667done1:
608 shmem_dir_unmap(dir); 668 shmem_dir_unmap(dir);
@@ -614,8 +674,16 @@ done2:
614 * generic_delete_inode did it, before we lowered next_index. 674 * generic_delete_inode did it, before we lowered next_index.
615 * Also, though shmem_getpage checks i_size before adding to 675 * Also, though shmem_getpage checks i_size before adding to
616 * cache, no recheck after: so fix the narrow window there too. 676 * cache, no recheck after: so fix the narrow window there too.
677 *
678 * Recalling truncate_inode_pages_range and unmap_mapping_range
679 * every time for punch_hole (which never got a chance to clear
680 * SHMEM_PAGEIN at the start of vmtruncate_range) is expensive,
681 * yet hardly ever necessary: try to optimize them out later.
617 */ 682 */
618 truncate_inode_pages_range(inode->i_mapping, start, end); 683 truncate_inode_pages_range(inode->i_mapping, start, end);
684 if (punch_hole)
685 unmap_mapping_range(inode->i_mapping, start,
686 end - start, 1);
619 } 687 }
620 688
621 spin_lock(&info->lock); 689 spin_lock(&info->lock);
diff --git a/mm/slab.c b/mm/slab.c
index 57f7aa420064..4cbac24ae2f1 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -1802,8 +1802,8 @@ static void check_poison_obj(struct kmem_cache *cachep, void *objp)
1802 /* Print header */ 1802 /* Print header */
1803 if (lines == 0) { 1803 if (lines == 0) {
1804 printk(KERN_ERR 1804 printk(KERN_ERR
1805 "Slab corruption: start=%p, len=%d\n", 1805 "Slab corruption: %s start=%p, len=%d\n",
1806 realobj, size); 1806 cachep->name, realobj, size);
1807 print_objinfo(cachep, objp, 0); 1807 print_objinfo(cachep, objp, 0);
1808 } 1808 }
1809 /* Hexdump the affected line */ 1809 /* Hexdump the affected line */
diff --git a/net/appletalk/ddp.c b/net/appletalk/ddp.c
index 113c175f1715..c8b7dc2c3257 100644
--- a/net/appletalk/ddp.c
+++ b/net/appletalk/ddp.c
@@ -1417,10 +1417,13 @@ static int atalk_rcv(struct sk_buff *skb, struct net_device *dev,
1417 /* 1417 /*
1418 * Size check to see if ddp->deh_len was crap 1418 * Size check to see if ddp->deh_len was crap
1419 * (Otherwise we'll detonate most spectacularly 1419 * (Otherwise we'll detonate most spectacularly
1420 * in the middle of recvmsg()). 1420 * in the middle of atalk_checksum() or recvmsg()).
1421 */ 1421 */
1422 if (skb->len < sizeof(*ddp)) 1422 if (skb->len < sizeof(*ddp) || skb->len < (len_hops & 1023)) {
1423 pr_debug("AppleTalk: dropping corrupted frame (deh_len=%u, "
1424 "skb->len=%u)\n", len_hops & 1023, skb->len);
1423 goto freeit; 1425 goto freeit;
1426 }
1424 1427
1425 /* 1428 /*
1426 * Any checksums. Note we don't do htons() on this == is assumed to be 1429 * Any checksums. Note we don't do htons() on this == is assumed to be
diff --git a/net/atm/clip.c b/net/atm/clip.c
index ebb5d0ce8b6f..8c3825816085 100644
--- a/net/atm/clip.c
+++ b/net/atm/clip.c
@@ -261,14 +261,6 @@ static void clip_pop(struct atm_vcc *vcc, struct sk_buff *skb)
261 spin_unlock_irqrestore(&PRIV(dev)->xoff_lock, flags); 261 spin_unlock_irqrestore(&PRIV(dev)->xoff_lock, flags);
262} 262}
263 263
264static void clip_neigh_destroy(struct neighbour *neigh)
265{
266 DPRINTK("clip_neigh_destroy (neigh %p)\n", neigh);
267 if (NEIGH2ENTRY(neigh)->vccs)
268 printk(KERN_CRIT "clip_neigh_destroy: vccs != NULL !!!\n");
269 NEIGH2ENTRY(neigh)->vccs = (void *) NEIGHBOR_DEAD;
270}
271
272static void clip_neigh_solicit(struct neighbour *neigh, struct sk_buff *skb) 264static void clip_neigh_solicit(struct neighbour *neigh, struct sk_buff *skb)
273{ 265{
274 DPRINTK("clip_neigh_solicit (neigh %p, skb %p)\n", neigh, skb); 266 DPRINTK("clip_neigh_solicit (neigh %p, skb %p)\n", neigh, skb);
@@ -342,7 +334,6 @@ static struct neigh_table clip_tbl = {
342 /* parameters are copied from ARP ... */ 334 /* parameters are copied from ARP ... */
343 .parms = { 335 .parms = {
344 .tbl = &clip_tbl, 336 .tbl = &clip_tbl,
345 .neigh_destructor = clip_neigh_destroy,
346 .base_reachable_time = 30 * HZ, 337 .base_reachable_time = 30 * HZ,
347 .retrans_time = 1 * HZ, 338 .retrans_time = 1 * HZ,
348 .gc_staletime = 60 * HZ, 339 .gc_staletime = 60 * HZ,
diff --git a/net/ax25/Kconfig b/net/ax25/Kconfig
index a8993a041724..43dd86fca4d3 100644
--- a/net/ax25/Kconfig
+++ b/net/ax25/Kconfig
@@ -1,30 +1,27 @@
1# 1#
2# Amateur Radio protocols and AX.25 device configuration 2# Amateur Radio protocols and AX.25 device configuration
3# 3#
4# 19971130 Now in an own category to make correct compilation of the
5# AX.25 stuff easier...
6# Joerg Reuter DL1BKE <jreuter@yaina.de>
7# 19980129 Moved to net/ax25/Config.in, sourcing device drivers.
8 4
9menuconfig HAMRADIO 5menuconfig HAMRADIO
10 depends on NET 6 depends on NET
11 bool "Amateur Radio support" 7 bool "Amateur Radio support"
12 help 8 help
13 If you want to connect your Linux box to an amateur radio, answer Y 9 If you want to connect your Linux box to an amateur radio, answer Y
14 here. You want to read <http://www.tapr.org/tapr/html/pkthome.html> and 10 here. You want to read <http://www.tapr.org/tapr/html/pkthome.html>
15 the AX25-HOWTO, available from <http://www.tldp.org/docs.html#howto>. 11 and more specifically about AX.25 on Linux
12 <http://www.linux-ax25.org/>.
16 13
17 Note that the answer to this question won't directly affect the 14 Note that the answer to this question won't directly affect the
18 kernel: saying N will just cause the configurator to skip all 15 kernel: saying N will just cause the configurator to skip all
19 the questions about amateur radio. 16 the questions about amateur radio.
20 17
21comment "Packet Radio protocols" 18comment "Packet Radio protocols"
22 depends on HAMRADIO && NET 19 depends on HAMRADIO
23 20
24config AX25 21config AX25
25 tristate "Amateur Radio AX.25 Level 2 protocol" 22 tristate "Amateur Radio AX.25 Level 2 protocol"
26 depends on HAMRADIO && NET 23 depends on HAMRADIO
27 ---help--- 24 help
28 This is the protocol used for computer communication over amateur 25 This is the protocol used for computer communication over amateur
29 radio. It is either used by itself for point-to-point links, or to 26 radio. It is either used by itself for point-to-point links, or to
30 carry other protocols such as tcp/ip. To use it, you need a device 27 carry other protocols such as tcp/ip. To use it, you need a device
@@ -52,6 +49,7 @@ config AX25
52 49
53config AX25_DAMA_SLAVE 50config AX25_DAMA_SLAVE
54 bool "AX.25 DAMA Slave support" 51 bool "AX.25 DAMA Slave support"
52 default y
55 depends on AX25 53 depends on AX25
56 help 54 help
57 DAMA is a mechanism to prevent collisions when doing AX.25 55 DAMA is a mechanism to prevent collisions when doing AX.25
@@ -59,23 +57,38 @@ config AX25_DAMA_SLAVE
59 from clients (called "slaves") and redistributes it to other slaves. 57 from clients (called "slaves") and redistributes it to other slaves.
60 If you say Y here, your Linux box will act as a DAMA slave; this is 58 If you say Y here, your Linux box will act as a DAMA slave; this is
61 transparent in that you don't have to do any special DAMA 59 transparent in that you don't have to do any special DAMA
62 configuration. (Linux cannot yet act as a DAMA server.) If unsure, 60 configuration. Linux cannot yet act as a DAMA server. This option
63 say N. 61 only compiles DAMA slave support into the kernel. It still needs to
62 be enabled at runtime. For more about DAMA see
63 <http://www.linux-ax25.org>. If unsure, say Y.
64
65# placeholder until implemented
66config AX25_DAMA_MASTER
67 bool 'AX.25 DAMA Master support'
68 depends on AX25_DAMA_SLAVE && BROKEN
69 help
70 DAMA is a mechanism to prevent collisions when doing AX.25
71 networking. A DAMA server (called "master") accepts incoming traffic
72 from clients (called "slaves") and redistributes it to other slaves.
73 If you say Y here, your Linux box will act as a DAMA master; this is
74 transparent in that you don't have to do any special DAMA
75 configuration. Linux cannot yet act as a DAMA server. This option
76 only compiles DAMA slave support into the kernel. It still needs to
77 be explicitly enabled, so if unsure, say Y.
64 78
65# bool ' AX.25 DAMA Master support' CONFIG_AX25_DAMA_MASTER
66config NETROM 79config NETROM
67 tristate "Amateur Radio NET/ROM protocol" 80 tristate "Amateur Radio NET/ROM protocol"
68 depends on AX25 81 depends on AX25
69 ---help--- 82 help
70 NET/ROM is a network layer protocol on top of AX.25 useful for 83 NET/ROM is a network layer protocol on top of AX.25 useful for
71 routing. 84 routing.
72 85
73 A comprehensive listing of all the software for Linux amateur radio 86 A comprehensive listing of all the software for Linux amateur radio
74 users as well as information about how to configure an AX.25 port is 87 users as well as information about how to configure an AX.25 port is
75 contained in the AX25-HOWTO, available from 88 contained in the Linux Ham Wiki, available from
76 <http://www.tldp.org/docs.html#howto>. You also might want to 89 <http://www.linux-ax25.org>. You also might want to check out the
77 check out the file <file:Documentation/networking/ax25.txt>. More 90 file <file:Documentation/networking/ax25.txt>. More information about
78 information about digital amateur radio in general is on the WWW at 91 digital amateur radio in general is on the WWW at
79 <http://www.tapr.org/tapr/html/pkthome.html>. 92 <http://www.tapr.org/tapr/html/pkthome.html>.
80 93
81 To compile this driver as a module, choose M here: the 94 To compile this driver as a module, choose M here: the
@@ -84,27 +97,25 @@ config NETROM
84config ROSE 97config ROSE
85 tristate "Amateur Radio X.25 PLP (Rose)" 98 tristate "Amateur Radio X.25 PLP (Rose)"
86 depends on AX25 99 depends on AX25
87 ---help--- 100 help
88 The Packet Layer Protocol (PLP) is a way to route packets over X.25 101 The Packet Layer Protocol (PLP) is a way to route packets over X.25
89 connections in general and amateur radio AX.25 connections in 102 connections in general and amateur radio AX.25 connections in
90 particular, essentially an alternative to NET/ROM. 103 particular, essentially an alternative to NET/ROM.
91 104
92 A comprehensive listing of all the software for Linux amateur radio 105 A comprehensive listing of all the software for Linux amateur radio
93 users as well as information about how to configure an AX.25 port is 106 users as well as information about how to configure an AX.25 port is
94 contained in the AX25-HOWTO, available from 107 contained in the Linux Ham Wiki, available from
95 <http://www.tldp.org/docs.html#howto>. You also might want to 108 <http://www.linux-ax25.org>. You also might want to check out the
96 check out the file <file:Documentation/networking/ax25.txt>. More 109 file <file:Documentation/networking/ax25.txt>. More information about
97 information about digital amateur radio in general is on the WWW at 110 digital amateur radio in general is on the WWW at
98 <http://www.tapr.org/tapr/html/pkthome.html>. 111 <http://www.tapr.org/tapr/html/pkthome.html>.
99 112
100 To compile this driver as a module, choose M here: the 113 To compile this driver as a module, choose M here: the
101 module will be called rose. 114 module will be called rose.
102 115
103
104menu "AX.25 network device drivers" 116menu "AX.25 network device drivers"
105 depends on HAMRADIO && NET && AX25!=n 117 depends on HAMRADIO && AX25
106 118
107source "drivers/net/hamradio/Kconfig" 119source "drivers/net/hamradio/Kconfig"
108 120
109endmenu 121endmenu
110
diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c
index 4c914df5fd06..d342e89b8bdd 100644
--- a/net/bluetooth/hidp/core.c
+++ b/net/bluetooth/hidp/core.c
@@ -319,7 +319,7 @@ static int __hidp_send_ctrl_message(struct hidp_session *session,
319 return 0; 319 return 0;
320} 320}
321 321
322static int inline hidp_send_ctrl_message(struct hidp_session *session, 322static inline int hidp_send_ctrl_message(struct hidp_session *session,
323 unsigned char hdr, unsigned char *data, int size) 323 unsigned char hdr, unsigned char *data, int size)
324{ 324{
325 int err; 325 int err;
@@ -679,6 +679,27 @@ static void hidp_close(struct hid_device *hid)
679{ 679{
680} 680}
681 681
682static const struct {
683 __u16 idVendor;
684 __u16 idProduct;
685 unsigned quirks;
686} hidp_blacklist[] = {
687 /* Apple wireless Mighty Mouse */
688 { 0x05ac, 0x030c, HID_QUIRK_MIGHTYMOUSE | HID_QUIRK_INVERT_HWHEEL },
689
690 { } /* Terminating entry */
691};
692
693static void hidp_setup_quirks(struct hid_device *hid)
694{
695 unsigned int n;
696
697 for (n = 0; hidp_blacklist[n].idVendor; n++)
698 if (hidp_blacklist[n].idVendor == le16_to_cpu(hid->vendor) &&
699 hidp_blacklist[n].idProduct == le16_to_cpu(hid->product))
700 hid->quirks = hidp_blacklist[n].quirks;
701}
702
682static inline void hidp_setup_hid(struct hidp_session *session, struct hidp_connadd_req *req) 703static inline void hidp_setup_hid(struct hidp_session *session, struct hidp_connadd_req *req)
683{ 704{
684 struct hid_device *hid = session->hid; 705 struct hid_device *hid = session->hid;
@@ -708,6 +729,8 @@ static inline void hidp_setup_hid(struct hidp_session *session, struct hidp_conn
708 729
709 hid->hidinput_input_event = hidp_hidinput_event; 730 hid->hidinput_input_event = hidp_hidinput_event;
710 731
732 hidp_setup_quirks(hid);
733
711 list_for_each_entry(report, &hid->report_enum[HID_INPUT_REPORT].report_list, list) 734 list_for_each_entry(report, &hid->report_enum[HID_INPUT_REPORT].report_list, list)
712 hidp_send_report(session, report); 735 hidp_send_report(session, report);
713 736
diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c
index def2e403f932..8d566c13cc73 100644
--- a/net/bridge/br_fdb.c
+++ b/net/bridge/br_fdb.c
@@ -197,8 +197,8 @@ struct net_bridge_fdb_entry *br_fdb_get(struct net_bridge *br,
197 197
198 rcu_read_lock(); 198 rcu_read_lock();
199 fdb = __br_fdb_get(br, addr); 199 fdb = __br_fdb_get(br, addr);
200 if (fdb) 200 if (fdb && !atomic_inc_not_zero(&fdb->use_count))
201 atomic_inc(&fdb->use_count); 201 fdb = NULL;
202 rcu_read_unlock(); 202 rcu_read_unlock();
203 return fdb; 203 return fdb;
204} 204}
diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c
index 7712d76f06ba..5439a3c46c3e 100644
--- a/net/bridge/br_netfilter.c
+++ b/net/bridge/br_netfilter.c
@@ -61,7 +61,7 @@ static int brnf_filter_vlan_tagged __read_mostly = 1;
61#define brnf_filter_vlan_tagged 1 61#define brnf_filter_vlan_tagged 1
62#endif 62#endif
63 63
64static __be16 inline vlan_proto(const struct sk_buff *skb) 64static inline __be16 vlan_proto(const struct sk_buff *skb)
65{ 65{
66 return vlan_eth_hdr(skb)->h_vlan_encapsulated_proto; 66 return vlan_eth_hdr(skb)->h_vlan_encapsulated_proto;
67} 67}
diff --git a/net/core/dev.c b/net/core/dev.c
index cf71614dae93..4dc93cc4d5b7 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -751,13 +751,10 @@ int dev_change_name(struct net_device *dev, char *newname)
751 else 751 else
752 strlcpy(dev->name, newname, IFNAMSIZ); 752 strlcpy(dev->name, newname, IFNAMSIZ);
753 753
754 err = device_rename(&dev->dev, dev->name); 754 device_rename(&dev->dev, dev->name);
755 if (!err) { 755 hlist_del(&dev->name_hlist);
756 hlist_del(&dev->name_hlist); 756 hlist_add_head(&dev->name_hlist, dev_name_hash(dev->name));
757 hlist_add_head(&dev->name_hlist, dev_name_hash(dev->name)); 757 raw_notifier_call_chain(&netdev_chain, NETDEV_CHANGENAME, dev);
758 raw_notifier_call_chain(&netdev_chain,
759 NETDEV_CHANGENAME, dev);
760 }
761 758
762 return err; 759 return err;
763} 760}
@@ -1741,8 +1738,8 @@ static int ing_filter(struct sk_buff *skb)
1741 if (dev->qdisc_ingress) { 1738 if (dev->qdisc_ingress) {
1742 __u32 ttl = (__u32) G_TC_RTTL(skb->tc_verd); 1739 __u32 ttl = (__u32) G_TC_RTTL(skb->tc_verd);
1743 if (MAX_RED_LOOP < ttl++) { 1740 if (MAX_RED_LOOP < ttl++) {
1744 printk(KERN_WARNING "Redir loop detected Dropping packet (%s->%s)\n", 1741 printk(KERN_WARNING "Redir loop detected Dropping packet (%d->%d)\n",
1745 skb->input_dev->name, skb->dev->name); 1742 skb->iif, skb->dev->ifindex);
1746 return TC_ACT_SHOT; 1743 return TC_ACT_SHOT;
1747 } 1744 }
1748 1745
@@ -1750,10 +1747,10 @@ static int ing_filter(struct sk_buff *skb)
1750 1747
1751 skb->tc_verd = SET_TC_AT(skb->tc_verd,AT_INGRESS); 1748 skb->tc_verd = SET_TC_AT(skb->tc_verd,AT_INGRESS);
1752 1749
1753 spin_lock(&dev->ingress_lock); 1750 spin_lock(&dev->queue_lock);
1754 if ((q = dev->qdisc_ingress) != NULL) 1751 if ((q = dev->qdisc_ingress) != NULL)
1755 result = q->enqueue(skb, q); 1752 result = q->enqueue(skb, q);
1756 spin_unlock(&dev->ingress_lock); 1753 spin_unlock(&dev->queue_lock);
1757 1754
1758 } 1755 }
1759 1756
@@ -1775,8 +1772,8 @@ int netif_receive_skb(struct sk_buff *skb)
1775 if (!skb->tstamp.off_sec) 1772 if (!skb->tstamp.off_sec)
1776 net_timestamp(skb); 1773 net_timestamp(skb);
1777 1774
1778 if (!skb->input_dev) 1775 if (!skb->iif)
1779 skb->input_dev = skb->dev; 1776 skb->iif = skb->dev->ifindex;
1780 1777
1781 orig_dev = skb_bond(skb); 1778 orig_dev = skb_bond(skb);
1782 1779
diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c
index 215f1bff048f..7174ced75efc 100644
--- a/net/core/fib_rules.c
+++ b/net/core/fib_rules.c
@@ -143,7 +143,7 @@ int fib_rules_lookup(struct fib_rules_ops *ops, struct flowi *fl,
143 } 143 }
144 } 144 }
145 145
146 err = -ENETUNREACH; 146 err = -ESRCH;
147out: 147out:
148 rcu_read_unlock(); 148 rcu_read_unlock();
149 149
@@ -152,6 +152,28 @@ out:
152 152
153EXPORT_SYMBOL_GPL(fib_rules_lookup); 153EXPORT_SYMBOL_GPL(fib_rules_lookup);
154 154
155static int validate_rulemsg(struct fib_rule_hdr *frh, struct nlattr **tb,
156 struct fib_rules_ops *ops)
157{
158 int err = -EINVAL;
159
160 if (frh->src_len)
161 if (tb[FRA_SRC] == NULL ||
162 frh->src_len > (ops->addr_size * 8) ||
163 nla_len(tb[FRA_SRC]) != ops->addr_size)
164 goto errout;
165
166 if (frh->dst_len)
167 if (tb[FRA_DST] == NULL ||
168 frh->dst_len > (ops->addr_size * 8) ||
169 nla_len(tb[FRA_DST]) != ops->addr_size)
170 goto errout;
171
172 err = 0;
173errout:
174 return err;
175}
176
155int fib_nl_newrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg) 177int fib_nl_newrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
156{ 178{
157 struct fib_rule_hdr *frh = nlmsg_data(nlh); 179 struct fib_rule_hdr *frh = nlmsg_data(nlh);
@@ -173,6 +195,10 @@ int fib_nl_newrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
173 if (err < 0) 195 if (err < 0)
174 goto errout; 196 goto errout;
175 197
198 err = validate_rulemsg(frh, tb, ops);
199 if (err < 0)
200 goto errout;
201
176 rule = kzalloc(ops->rule_size, GFP_KERNEL); 202 rule = kzalloc(ops->rule_size, GFP_KERNEL);
177 if (rule == NULL) { 203 if (rule == NULL) {
178 err = -ENOMEM; 204 err = -ENOMEM;
@@ -260,6 +286,10 @@ int fib_nl_delrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
260 if (err < 0) 286 if (err < 0)
261 goto errout; 287 goto errout;
262 288
289 err = validate_rulemsg(frh, tb, ops);
290 if (err < 0)
291 goto errout;
292
263 list_for_each_entry(rule, ops->rules_list, list) { 293 list_for_each_entry(rule, ops->rules_list, list) {
264 if (frh->action && (frh->action != rule->action)) 294 if (frh->action && (frh->action != rule->action))
265 continue; 295 continue;
@@ -374,7 +404,7 @@ int fib_rules_dump(struct sk_buff *skb, struct netlink_callback *cb, int family)
374 return -EAFNOSUPPORT; 404 return -EAFNOSUPPORT;
375 405
376 rcu_read_lock(); 406 rcu_read_lock();
377 list_for_each_entry(rule, ops->rules_list, list) { 407 list_for_each_entry_rcu(rule, ops->rules_list, list) {
378 if (idx < cb->args[0]) 408 if (idx < cb->args[0])
379 goto skip; 409 goto skip;
380 410
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index 3183142c6044..cfc60019cf92 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -140,6 +140,8 @@ static int neigh_forced_gc(struct neigh_table *tbl)
140 n->dead = 1; 140 n->dead = 1;
141 shrunk = 1; 141 shrunk = 1;
142 write_unlock(&n->lock); 142 write_unlock(&n->lock);
143 if (n->parms->neigh_cleanup)
144 n->parms->neigh_cleanup(n);
143 neigh_release(n); 145 neigh_release(n);
144 continue; 146 continue;
145 } 147 }
@@ -211,6 +213,8 @@ static void neigh_flush_dev(struct neigh_table *tbl, struct net_device *dev)
211 NEIGH_PRINTK2("neigh %p is stray.\n", n); 213 NEIGH_PRINTK2("neigh %p is stray.\n", n);
212 } 214 }
213 write_unlock(&n->lock); 215 write_unlock(&n->lock);
216 if (n->parms->neigh_cleanup)
217 n->parms->neigh_cleanup(n);
214 neigh_release(n); 218 neigh_release(n);
215 } 219 }
216 } 220 }
@@ -582,9 +586,6 @@ void neigh_destroy(struct neighbour *neigh)
582 kfree(hh); 586 kfree(hh);
583 } 587 }
584 588
585 if (neigh->parms->neigh_destructor)
586 (neigh->parms->neigh_destructor)(neigh);
587
588 skb_queue_purge(&neigh->arp_queue); 589 skb_queue_purge(&neigh->arp_queue);
589 590
590 dev_put(neigh->dev); 591 dev_put(neigh->dev);
@@ -675,6 +676,8 @@ static void neigh_periodic_timer(unsigned long arg)
675 *np = n->next; 676 *np = n->next;
676 n->dead = 1; 677 n->dead = 1;
677 write_unlock(&n->lock); 678 write_unlock(&n->lock);
679 if (n->parms->neigh_cleanup)
680 n->parms->neigh_cleanup(n);
678 neigh_release(n); 681 neigh_release(n);
679 continue; 682 continue;
680 } 683 }
@@ -2088,8 +2091,11 @@ void __neigh_for_each_release(struct neigh_table *tbl,
2088 } else 2091 } else
2089 np = &n->next; 2092 np = &n->next;
2090 write_unlock(&n->lock); 2093 write_unlock(&n->lock);
2091 if (release) 2094 if (release) {
2095 if (n->parms->neigh_cleanup)
2096 n->parms->neigh_cleanup(n);
2092 neigh_release(n); 2097 neigh_release(n);
2098 }
2093 } 2099 }
2094 } 2100 }
2095} 2101}
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 6055074c4b81..33ea8eac7fe0 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -621,7 +621,8 @@ static int rtnl_getlink(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
621 if (err < 0) 621 if (err < 0)
622 goto errout; 622 goto errout;
623 623
624 iw += IW_EV_POINT_OFF; 624 /* Payload is at an offset in buffer */
625 iw = iw_buf + IW_EV_POINT_OFF;
625 } 626 }
626#endif /* CONFIG_NET_WIRELESS_RTNETLINK */ 627#endif /* CONFIG_NET_WIRELESS_RTNETLINK */
627 628
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 702fa8f08747..87573ae35b02 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -496,7 +496,7 @@ struct sk_buff *skb_clone(struct sk_buff *skb, gfp_t gfp_mask)
496 n->tc_verd = SET_TC_VERD(skb->tc_verd,0); 496 n->tc_verd = SET_TC_VERD(skb->tc_verd,0);
497 n->tc_verd = CLR_TC_OK2MUNGE(n->tc_verd); 497 n->tc_verd = CLR_TC_OK2MUNGE(n->tc_verd);
498 n->tc_verd = CLR_TC_MUNGED(n->tc_verd); 498 n->tc_verd = CLR_TC_MUNGED(n->tc_verd);
499 C(input_dev); 499 C(iif);
500#endif 500#endif
501 skb_copy_secmark(n, skb); 501 skb_copy_secmark(n, skb);
502#endif 502#endif
diff --git a/net/core/sock.c b/net/core/sock.c
index 8d65d6478dcd..27c4f62382bd 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -808,7 +808,7 @@ lenout:
808 * 808 *
809 * (We also register the sk_lock with the lock validator.) 809 * (We also register the sk_lock with the lock validator.)
810 */ 810 */
811static void inline sock_lock_init(struct sock *sk) 811static inline void sock_lock_init(struct sock *sk)
812{ 812{
813 sock_lock_init_class_and_name(sk, 813 sock_lock_init_class_and_name(sk,
814 af_family_slock_key_strings[sk->sk_family], 814 af_family_slock_key_strings[sk->sk_family],
diff --git a/net/core/wireless.c b/net/core/wireless.c
index 9936ab11e6e0..b07fe270a508 100644
--- a/net/core/wireless.c
+++ b/net/core/wireless.c
@@ -2,7 +2,7 @@
2 * This file implement the Wireless Extensions APIs. 2 * This file implement the Wireless Extensions APIs.
3 * 3 *
4 * Authors : Jean Tourrilhes - HPL - <jt@hpl.hp.com> 4 * Authors : Jean Tourrilhes - HPL - <jt@hpl.hp.com>
5 * Copyright (c) 1997-2006 Jean Tourrilhes, All Rights Reserved. 5 * Copyright (c) 1997-2007 Jean Tourrilhes, All Rights Reserved.
6 * 6 *
7 * (As all part of the Linux kernel, this file is GPL) 7 * (As all part of the Linux kernel, this file is GPL)
8 */ 8 */
@@ -76,6 +76,9 @@
76 * o Change length in ESSID and NICK to strlen() instead of strlen()+1 76 * o Change length in ESSID and NICK to strlen() instead of strlen()+1
77 * o Make standard_ioctl_num and standard_event_num unsigned 77 * o Make standard_ioctl_num and standard_event_num unsigned
78 * o Remove (struct net_device *)->get_wireless_stats() 78 * o Remove (struct net_device *)->get_wireless_stats()
79 *
80 * v10 - 16.3.07 - Jean II
81 * o Prevent leaking of kernel space in stream on 64 bits.
79 */ 82 */
80 83
81/***************************** INCLUDES *****************************/ 84/***************************** INCLUDES *****************************/
@@ -427,6 +430,21 @@ static const int event_type_size[] = {
427 IW_EV_QUAL_LEN, /* IW_HEADER_TYPE_QUAL */ 430 IW_EV_QUAL_LEN, /* IW_HEADER_TYPE_QUAL */
428}; 431};
429 432
433/* Size (in bytes) of various events, as packed */
434static const int event_type_pk_size[] = {
435 IW_EV_LCP_PK_LEN, /* IW_HEADER_TYPE_NULL */
436 0,
437 IW_EV_CHAR_PK_LEN, /* IW_HEADER_TYPE_CHAR */
438 0,
439 IW_EV_UINT_PK_LEN, /* IW_HEADER_TYPE_UINT */
440 IW_EV_FREQ_PK_LEN, /* IW_HEADER_TYPE_FREQ */
441 IW_EV_ADDR_PK_LEN, /* IW_HEADER_TYPE_ADDR */
442 0,
443 IW_EV_POINT_PK_LEN, /* Without variable payload */
444 IW_EV_PARAM_PK_LEN, /* IW_HEADER_TYPE_PARAM */
445 IW_EV_QUAL_PK_LEN, /* IW_HEADER_TYPE_QUAL */
446};
447
430/************************ COMMON SUBROUTINES ************************/ 448/************************ COMMON SUBROUTINES ************************/
431/* 449/*
432 * Stuff that may be used in various place or doesn't fit in one 450 * Stuff that may be used in various place or doesn't fit in one
@@ -1217,7 +1235,7 @@ static int rtnetlink_standard_get(struct net_device * dev,
1217 memcpy(buffer + IW_EV_POINT_OFF, request, request_len); 1235 memcpy(buffer + IW_EV_POINT_OFF, request, request_len);
1218 /* Use our own copy of wrqu */ 1236 /* Use our own copy of wrqu */
1219 wrqu = (union iwreq_data *) (buffer + IW_EV_POINT_OFF 1237 wrqu = (union iwreq_data *) (buffer + IW_EV_POINT_OFF
1220 + IW_EV_LCP_LEN); 1238 + IW_EV_LCP_PK_LEN);
1221 1239
1222 /* No extra arguments. Trivial to handle */ 1240 /* No extra arguments. Trivial to handle */
1223 ret = handler(dev, &info, wrqu, NULL); 1241 ret = handler(dev, &info, wrqu, NULL);
@@ -1229,8 +1247,8 @@ static int rtnetlink_standard_get(struct net_device * dev,
1229 1247
1230 /* Get a temp copy of wrqu (skip pointer) */ 1248 /* Get a temp copy of wrqu (skip pointer) */
1231 memcpy(((char *) &wrqu_point) + IW_EV_POINT_OFF, 1249 memcpy(((char *) &wrqu_point) + IW_EV_POINT_OFF,
1232 ((char *) request) + IW_EV_LCP_LEN, 1250 ((char *) request) + IW_EV_LCP_PK_LEN,
1233 IW_EV_POINT_LEN - IW_EV_LCP_LEN); 1251 IW_EV_POINT_LEN - IW_EV_LCP_PK_LEN);
1234 1252
1235 /* Calculate space needed by arguments. Always allocate 1253 /* Calculate space needed by arguments. Always allocate
1236 * for max space. Easier, and won't last long... */ 1254 * for max space. Easier, and won't last long... */
@@ -1240,7 +1258,7 @@ static int rtnetlink_standard_get(struct net_device * dev,
1240 (wrqu_point.data.length > descr->max_tokens)) 1258 (wrqu_point.data.length > descr->max_tokens))
1241 extra_size = (wrqu_point.data.length 1259 extra_size = (wrqu_point.data.length
1242 * descr->token_size); 1260 * descr->token_size);
1243 buffer_size = extra_size + IW_EV_POINT_LEN + IW_EV_POINT_OFF; 1261 buffer_size = extra_size + IW_EV_POINT_PK_LEN + IW_EV_POINT_OFF;
1244#ifdef WE_RTNETLINK_DEBUG 1262#ifdef WE_RTNETLINK_DEBUG
1245 printk(KERN_DEBUG "%s (WE.r) : Malloc %d bytes (%d bytes)\n", 1263 printk(KERN_DEBUG "%s (WE.r) : Malloc %d bytes (%d bytes)\n",
1246 dev->name, extra_size, buffer_size); 1264 dev->name, extra_size, buffer_size);
@@ -1254,15 +1272,15 @@ static int rtnetlink_standard_get(struct net_device * dev,
1254 1272
1255 /* Put wrqu in the right place (just before extra). 1273 /* Put wrqu in the right place (just before extra).
1256 * Leave space for IWE header and dummy pointer... 1274 * Leave space for IWE header and dummy pointer...
1257 * Note that IW_EV_LCP_LEN==4 bytes, so it's still aligned... 1275 * Note that IW_EV_LCP_PK_LEN==4 bytes, so it's still aligned.
1258 */ 1276 */
1259 memcpy(buffer + IW_EV_LCP_LEN + IW_EV_POINT_OFF, 1277 memcpy(buffer + IW_EV_LCP_PK_LEN + IW_EV_POINT_OFF,
1260 ((char *) &wrqu_point) + IW_EV_POINT_OFF, 1278 ((char *) &wrqu_point) + IW_EV_POINT_OFF,
1261 IW_EV_POINT_LEN - IW_EV_LCP_LEN); 1279 IW_EV_POINT_PK_LEN - IW_EV_LCP_PK_LEN);
1262 wrqu = (union iwreq_data *) (buffer + IW_EV_LCP_LEN); 1280 wrqu = (union iwreq_data *) (buffer + IW_EV_LCP_PK_LEN);
1263 1281
1264 /* Extra comes logically after that. Offset +12 bytes. */ 1282 /* Extra comes logically after that. Offset +12 bytes. */
1265 extra = buffer + IW_EV_POINT_OFF + IW_EV_POINT_LEN; 1283 extra = buffer + IW_EV_POINT_OFF + IW_EV_POINT_PK_LEN;
1266 1284
1267 /* Call the handler */ 1285 /* Call the handler */
1268 ret = handler(dev, &info, wrqu, extra); 1286 ret = handler(dev, &info, wrqu, extra);
@@ -1270,11 +1288,11 @@ static int rtnetlink_standard_get(struct net_device * dev,
1270 /* Calculate real returned length */ 1288 /* Calculate real returned length */
1271 extra_size = (wrqu->data.length * descr->token_size); 1289 extra_size = (wrqu->data.length * descr->token_size);
1272 /* Re-adjust reply size */ 1290 /* Re-adjust reply size */
1273 request->len = extra_size + IW_EV_POINT_LEN; 1291 request->len = extra_size + IW_EV_POINT_PK_LEN;
1274 1292
1275 /* Put the iwe header where it should, i.e. scrap the 1293 /* Put the iwe header where it should, i.e. scrap the
1276 * dummy pointer. */ 1294 * dummy pointer. */
1277 memcpy(buffer + IW_EV_POINT_OFF, request, IW_EV_LCP_LEN); 1295 memcpy(buffer + IW_EV_POINT_OFF, request, IW_EV_LCP_PK_LEN);
1278 1296
1279#ifdef WE_RTNETLINK_DEBUG 1297#ifdef WE_RTNETLINK_DEBUG
1280 printk(KERN_DEBUG "%s (WE.r) : Reply 0x%04X, hdr_len %d, tokens %d, extra_size %d, buffer_size %d\n", dev->name, cmd, hdr_len, wrqu->data.length, extra_size, buffer_size); 1298 printk(KERN_DEBUG "%s (WE.r) : Reply 0x%04X, hdr_len %d, tokens %d, extra_size %d, buffer_size %d\n", dev->name, cmd, hdr_len, wrqu->data.length, extra_size, buffer_size);
@@ -1331,10 +1349,10 @@ static inline int rtnetlink_standard_set(struct net_device * dev,
1331#endif /* WE_RTNETLINK_DEBUG */ 1349#endif /* WE_RTNETLINK_DEBUG */
1332 1350
1333 /* Extract fixed header from request. This is properly aligned. */ 1351 /* Extract fixed header from request. This is properly aligned. */
1334 wrqu = &request->u; 1352 wrqu = (union iwreq_data *) (((char *) request) + IW_EV_LCP_PK_LEN);
1335 1353
1336 /* Check if wrqu is complete */ 1354 /* Check if wrqu is complete */
1337 hdr_len = event_type_size[descr->header_type]; 1355 hdr_len = event_type_pk_size[descr->header_type];
1338 if(request_len < hdr_len) { 1356 if(request_len < hdr_len) {
1339#ifdef WE_RTNETLINK_DEBUG 1357#ifdef WE_RTNETLINK_DEBUG
1340 printk(KERN_DEBUG 1358 printk(KERN_DEBUG
@@ -1359,7 +1377,7 @@ static inline int rtnetlink_standard_set(struct net_device * dev,
1359 1377
1360 /* Put wrqu in the right place (skip pointer) */ 1378 /* Put wrqu in the right place (skip pointer) */
1361 memcpy(((char *) &wrqu_point) + IW_EV_POINT_OFF, 1379 memcpy(((char *) &wrqu_point) + IW_EV_POINT_OFF,
1362 wrqu, IW_EV_POINT_LEN - IW_EV_LCP_LEN); 1380 wrqu, IW_EV_POINT_PK_LEN - IW_EV_LCP_PK_LEN);
1363 /* Don't forget about the event code... */ 1381 /* Don't forget about the event code... */
1364 wrqu = &wrqu_point; 1382 wrqu = &wrqu_point;
1365 1383
@@ -1483,7 +1501,7 @@ static inline int rtnetlink_private_get(struct net_device * dev,
1483 hdr_len = extra_size; 1501 hdr_len = extra_size;
1484 extra_size = 0; 1502 extra_size = 0;
1485 } else { 1503 } else {
1486 hdr_len = IW_EV_POINT_LEN; 1504 hdr_len = IW_EV_POINT_PK_LEN;
1487 } 1505 }
1488 1506
1489 /* Check if wrqu is complete */ 1507 /* Check if wrqu is complete */
@@ -1514,7 +1532,7 @@ static inline int rtnetlink_private_get(struct net_device * dev,
1514 memcpy(buffer + IW_EV_POINT_OFF, request, request_len); 1532 memcpy(buffer + IW_EV_POINT_OFF, request, request_len);
1515 /* Use our own copy of wrqu */ 1533 /* Use our own copy of wrqu */
1516 wrqu = (union iwreq_data *) (buffer + IW_EV_POINT_OFF 1534 wrqu = (union iwreq_data *) (buffer + IW_EV_POINT_OFF
1517 + IW_EV_LCP_LEN); 1535 + IW_EV_LCP_PK_LEN);
1518 1536
1519 /* No extra arguments. Trivial to handle */ 1537 /* No extra arguments. Trivial to handle */
1520 ret = handler(dev, &info, wrqu, (char *) wrqu); 1538 ret = handler(dev, &info, wrqu, (char *) wrqu);
@@ -1523,7 +1541,7 @@ static inline int rtnetlink_private_get(struct net_device * dev,
1523 char * extra; 1541 char * extra;
1524 1542
1525 /* Buffer for full reply */ 1543 /* Buffer for full reply */
1526 buffer_size = extra_size + IW_EV_POINT_LEN + IW_EV_POINT_OFF; 1544 buffer_size = extra_size + IW_EV_POINT_PK_LEN + IW_EV_POINT_OFF;
1527 1545
1528#ifdef WE_RTNETLINK_DEBUG 1546#ifdef WE_RTNETLINK_DEBUG
1529 printk(KERN_DEBUG "%s (WE.r) : Malloc %d bytes (%d bytes)\n", 1547 printk(KERN_DEBUG "%s (WE.r) : Malloc %d bytes (%d bytes)\n",
@@ -1538,15 +1556,15 @@ static inline int rtnetlink_private_get(struct net_device * dev,
1538 1556
1539 /* Put wrqu in the right place (just before extra). 1557 /* Put wrqu in the right place (just before extra).
1540 * Leave space for IWE header and dummy pointer... 1558 * Leave space for IWE header and dummy pointer...
1541 * Note that IW_EV_LCP_LEN==4 bytes, so it's still aligned... 1559 * Note that IW_EV_LCP_PK_LEN==4 bytes, so it's still aligned.
1542 */ 1560 */
1543 memcpy(buffer + IW_EV_LCP_LEN + IW_EV_POINT_OFF, 1561 memcpy(buffer + IW_EV_LCP_PK_LEN + IW_EV_POINT_OFF,
1544 ((char *) request) + IW_EV_LCP_LEN, 1562 ((char *) request) + IW_EV_LCP_PK_LEN,
1545 IW_EV_POINT_LEN - IW_EV_LCP_LEN); 1563 IW_EV_POINT_PK_LEN - IW_EV_LCP_PK_LEN);
1546 wrqu = (union iwreq_data *) (buffer + IW_EV_LCP_LEN); 1564 wrqu = (union iwreq_data *) (buffer + IW_EV_LCP_PK_LEN);
1547 1565
1548 /* Extra comes logically after that. Offset +12 bytes. */ 1566 /* Extra comes logically after that. Offset +12 bytes. */
1549 extra = buffer + IW_EV_POINT_OFF + IW_EV_POINT_LEN; 1567 extra = buffer + IW_EV_POINT_OFF + IW_EV_POINT_PK_LEN;
1550 1568
1551 /* Call the handler */ 1569 /* Call the handler */
1552 ret = handler(dev, &info, wrqu, extra); 1570 ret = handler(dev, &info, wrqu, extra);
@@ -1556,11 +1574,11 @@ static inline int rtnetlink_private_get(struct net_device * dev,
1556 if (!(descr->get_args & IW_PRIV_SIZE_FIXED)) 1574 if (!(descr->get_args & IW_PRIV_SIZE_FIXED))
1557 extra_size = adjust_priv_size(descr->get_args, wrqu); 1575 extra_size = adjust_priv_size(descr->get_args, wrqu);
1558 /* Re-adjust reply size */ 1576 /* Re-adjust reply size */
1559 request->len = extra_size + IW_EV_POINT_LEN; 1577 request->len = extra_size + IW_EV_POINT_PK_LEN;
1560 1578
1561 /* Put the iwe header where it should, i.e. scrap the 1579 /* Put the iwe header where it should, i.e. scrap the
1562 * dummy pointer. */ 1580 * dummy pointer. */
1563 memcpy(buffer + IW_EV_POINT_OFF, request, IW_EV_LCP_LEN); 1581 memcpy(buffer + IW_EV_POINT_OFF, request, IW_EV_LCP_PK_LEN);
1564 1582
1565#ifdef WE_RTNETLINK_DEBUG 1583#ifdef WE_RTNETLINK_DEBUG
1566 printk(KERN_DEBUG "%s (WE.r) : Reply 0x%04X, hdr_len %d, tokens %d, extra_size %d, buffer_size %d\n", dev->name, cmd, hdr_len, wrqu->data.length, extra_size, buffer_size); 1584 printk(KERN_DEBUG "%s (WE.r) : Reply 0x%04X, hdr_len %d, tokens %d, extra_size %d, buffer_size %d\n", dev->name, cmd, hdr_len, wrqu->data.length, extra_size, buffer_size);
@@ -1641,14 +1659,14 @@ static inline int rtnetlink_private_set(struct net_device * dev,
1641 /* Does it fits in wrqu ? */ 1659 /* Does it fits in wrqu ? */
1642 if((descr->set_args & IW_PRIV_SIZE_FIXED) && 1660 if((descr->set_args & IW_PRIV_SIZE_FIXED) &&
1643 (extra_size <= IFNAMSIZ)) { 1661 (extra_size <= IFNAMSIZ)) {
1644 hdr_len = IW_EV_LCP_LEN + extra_size; 1662 hdr_len = IW_EV_LCP_PK_LEN + extra_size;
1645 extra_size = 0; 1663 extra_size = 0;
1646 } else { 1664 } else {
1647 hdr_len = IW_EV_POINT_LEN; 1665 hdr_len = IW_EV_POINT_PK_LEN;
1648 } 1666 }
1649 1667
1650 /* Extract fixed header from request. This is properly aligned. */ 1668 /* Extract fixed header from request. This is properly aligned. */
1651 wrqu = &request->u; 1669 wrqu = (union iwreq_data *) (((char *) request) + IW_EV_LCP_PK_LEN);
1652 1670
1653 /* Check if wrqu is complete */ 1671 /* Check if wrqu is complete */
1654 if(request_len < hdr_len) { 1672 if(request_len < hdr_len) {
@@ -1675,7 +1693,7 @@ static inline int rtnetlink_private_set(struct net_device * dev,
1675 1693
1676 /* Put wrqu in the right place (skip pointer) */ 1694 /* Put wrqu in the right place (skip pointer) */
1677 memcpy(((char *) &wrqu_point) + IW_EV_POINT_OFF, 1695 memcpy(((char *) &wrqu_point) + IW_EV_POINT_OFF,
1678 wrqu, IW_EV_POINT_LEN - IW_EV_LCP_LEN); 1696 wrqu, IW_EV_POINT_PK_LEN - IW_EV_LCP_PK_LEN);
1679 1697
1680 /* Does it fits within bounds ? */ 1698 /* Does it fits within bounds ? */
1681 if(wrqu_point.data.length > (descr->set_args & 1699 if(wrqu_point.data.length > (descr->set_args &
@@ -1738,7 +1756,7 @@ int wireless_rtnetlink_get(struct net_device * dev,
1738 iw_handler handler; 1756 iw_handler handler;
1739 1757
1740 /* Check length */ 1758 /* Check length */
1741 if(len < IW_EV_LCP_LEN) { 1759 if(len < IW_EV_LCP_PK_LEN) {
1742 printk(KERN_DEBUG "%s (WE.r) : RtNetlink request too short (%d)\n", 1760 printk(KERN_DEBUG "%s (WE.r) : RtNetlink request too short (%d)\n",
1743 dev->name, len); 1761 dev->name, len);
1744 return -EINVAL; 1762 return -EINVAL;
@@ -1822,7 +1840,7 @@ int wireless_rtnetlink_set(struct net_device * dev,
1822 iw_handler handler; 1840 iw_handler handler;
1823 1841
1824 /* Check length */ 1842 /* Check length */
1825 if(len < IW_EV_LCP_LEN) { 1843 if(len < IW_EV_LCP_PK_LEN) {
1826 printk(KERN_DEBUG "%s (WE.r) : RtNetlink request too short (%d)\n", 1844 printk(KERN_DEBUG "%s (WE.r) : RtNetlink request too short (%d)\n",
1827 dev->name, len); 1845 dev->name, len);
1828 return -EINVAL; 1846 return -EINVAL;
diff --git a/net/dccp/dccp.h b/net/dccp/dccp.h
index a0e7cd183a5d..e33a9edb4036 100644
--- a/net/dccp/dccp.h
+++ b/net/dccp/dccp.h
@@ -191,7 +191,6 @@ extern void dccp_send_sync(struct sock *sk, const u64 seq,
191 const enum dccp_pkt_type pkt_type); 191 const enum dccp_pkt_type pkt_type);
192 192
193extern void dccp_write_xmit(struct sock *sk, int block); 193extern void dccp_write_xmit(struct sock *sk, int block);
194extern void dccp_write_xmit_timer(unsigned long data);
195extern void dccp_write_space(struct sock *sk); 194extern void dccp_write_space(struct sock *sk);
196 195
197extern void dccp_init_xmit_timers(struct sock *sk); 196extern void dccp_init_xmit_timers(struct sock *sk);
diff --git a/net/dccp/proto.c b/net/dccp/proto.c
index cf28c53a389a..6607b7b14f34 100644
--- a/net/dccp/proto.c
+++ b/net/dccp/proto.c
@@ -575,7 +575,7 @@ static int do_dccp_getsockopt(struct sock *sk, int level, int optname,
575 if (get_user(len, optlen)) 575 if (get_user(len, optlen))
576 return -EFAULT; 576 return -EFAULT;
577 577
578 if (len < sizeof(int)) 578 if (len < (int)sizeof(int))
579 return -EINVAL; 579 return -EINVAL;
580 580
581 dp = dccp_sk(sk); 581 dp = dccp_sk(sk);
@@ -589,9 +589,11 @@ static int do_dccp_getsockopt(struct sock *sk, int level, int optname,
589 (__be32 __user *)optval, optlen); 589 (__be32 __user *)optval, optlen);
590 case DCCP_SOCKOPT_SEND_CSCOV: 590 case DCCP_SOCKOPT_SEND_CSCOV:
591 val = dp->dccps_pcslen; 591 val = dp->dccps_pcslen;
592 len = sizeof(val);
592 break; 593 break;
593 case DCCP_SOCKOPT_RECV_CSCOV: 594 case DCCP_SOCKOPT_RECV_CSCOV:
594 val = dp->dccps_pcrlen; 595 val = dp->dccps_pcrlen;
596 len = sizeof(val);
595 break; 597 break;
596 case 128 ... 191: 598 case 128 ... 191:
597 return ccid_hc_rx_getsockopt(dp->dccps_hc_rx_ccid, sk, optname, 599 return ccid_hc_rx_getsockopt(dp->dccps_hc_rx_ccid, sk, optname,
diff --git a/net/dccp/timer.c b/net/dccp/timer.c
index b038a0a3ad40..0197a41c256a 100644
--- a/net/dccp/timer.c
+++ b/net/dccp/timer.c
@@ -262,7 +262,7 @@ out:
262} 262}
263 263
264/* Transmit-delay timer: used by the CCIDs to delay actual send time */ 264/* Transmit-delay timer: used by the CCIDs to delay actual send time */
265void dccp_write_xmit_timer(unsigned long data) 265static void dccp_write_xmit_timer(unsigned long data)
266{ 266{
267 struct sock *sk = (struct sock *)data; 267 struct sock *sk = (struct sock *)data;
268 struct dccp_sock *dp = dccp_sk(sk); 268 struct dccp_sock *dp = dccp_sk(sk);
diff --git a/net/decnet/dn_fib.c b/net/decnet/dn_fib.c
index 3cbfddc98430..82d58a977e6f 100644
--- a/net/decnet/dn_fib.c
+++ b/net/decnet/dn_fib.c
@@ -63,7 +63,7 @@ static struct
63{ 63{
64 int error; 64 int error;
65 u8 scope; 65 u8 scope;
66} dn_fib_props[RTA_MAX+1] = { 66} dn_fib_props[RTN_MAX+1] = {
67 [RTN_UNSPEC] = { .error = 0, .scope = RT_SCOPE_NOWHERE }, 67 [RTN_UNSPEC] = { .error = 0, .scope = RT_SCOPE_NOWHERE },
68 [RTN_UNICAST] = { .error = 0, .scope = RT_SCOPE_UNIVERSE }, 68 [RTN_UNICAST] = { .error = 0, .scope = RT_SCOPE_UNIVERSE },
69 [RTN_LOCAL] = { .error = 0, .scope = RT_SCOPE_HOST }, 69 [RTN_LOCAL] = { .error = 0, .scope = RT_SCOPE_HOST },
@@ -276,6 +276,9 @@ struct dn_fib_info *dn_fib_create_info(const struct rtmsg *r, struct dn_kern_rta
276 struct dn_fib_info *ofi; 276 struct dn_fib_info *ofi;
277 int nhs = 1; 277 int nhs = 1;
278 278
279 if (r->rtm_type > RTN_MAX)
280 goto err_inval;
281
279 if (dn_fib_props[r->rtm_type].scope > r->rtm_scope) 282 if (dn_fib_props[r->rtm_type].scope > r->rtm_scope)
280 goto err_inval; 283 goto err_inval;
281 284
diff --git a/net/decnet/dn_rules.c b/net/decnet/dn_rules.c
index b6c98ac93dc8..5e86dd542302 100644
--- a/net/decnet/dn_rules.c
+++ b/net/decnet/dn_rules.c
@@ -109,8 +109,6 @@ errout:
109 109
110static struct nla_policy dn_fib_rule_policy[FRA_MAX+1] __read_mostly = { 110static struct nla_policy dn_fib_rule_policy[FRA_MAX+1] __read_mostly = {
111 FRA_GENERIC_POLICY, 111 FRA_GENERIC_POLICY,
112 [FRA_SRC] = { .type = NLA_U16 },
113 [FRA_DST] = { .type = NLA_U16 },
114}; 112};
115 113
116static int dn_fib_rule_match(struct fib_rule *rule, struct flowi *fl, int flags) 114static int dn_fib_rule_match(struct fib_rule *rule, struct flowi *fl, int flags)
@@ -133,7 +131,7 @@ static int dn_fib_rule_configure(struct fib_rule *rule, struct sk_buff *skb,
133 int err = -EINVAL; 131 int err = -EINVAL;
134 struct dn_fib_rule *r = (struct dn_fib_rule *)rule; 132 struct dn_fib_rule *r = (struct dn_fib_rule *)rule;
135 133
136 if (frh->src_len > 16 || frh->dst_len > 16 || frh->tos) 134 if (frh->tos)
137 goto errout; 135 goto errout;
138 136
139 if (rule->table == RT_TABLE_UNSPEC) { 137 if (rule->table == RT_TABLE_UNSPEC) {
@@ -150,10 +148,10 @@ static int dn_fib_rule_configure(struct fib_rule *rule, struct sk_buff *skb,
150 } 148 }
151 } 149 }
152 150
153 if (tb[FRA_SRC]) 151 if (frh->src_len)
154 r->src = nla_get_le16(tb[FRA_SRC]); 152 r->src = nla_get_le16(tb[FRA_SRC]);
155 153
156 if (tb[FRA_DST]) 154 if (frh->dst_len)
157 r->dst = nla_get_le16(tb[FRA_DST]); 155 r->dst = nla_get_le16(tb[FRA_DST]);
158 156
159 r->src_len = frh->src_len; 157 r->src_len = frh->src_len;
@@ -176,10 +174,10 @@ static int dn_fib_rule_compare(struct fib_rule *rule, struct fib_rule_hdr *frh,
176 if (frh->dst_len && (r->dst_len != frh->dst_len)) 174 if (frh->dst_len && (r->dst_len != frh->dst_len))
177 return 0; 175 return 0;
178 176
179 if (tb[FRA_SRC] && (r->src != nla_get_le16(tb[FRA_SRC]))) 177 if (frh->src_len && (r->src != nla_get_le16(tb[FRA_SRC])))
180 return 0; 178 return 0;
181 179
182 if (tb[FRA_DST] && (r->dst != nla_get_le16(tb[FRA_DST]))) 180 if (frh->dst_len && (r->dst != nla_get_le16(tb[FRA_DST])))
183 return 0; 181 return 0;
184 182
185 return 1; 183 return 1;
@@ -249,6 +247,7 @@ int dn_fib_dump_rules(struct sk_buff *skb, struct netlink_callback *cb)
249static struct fib_rules_ops dn_fib_rules_ops = { 247static struct fib_rules_ops dn_fib_rules_ops = {
250 .family = AF_DECnet, 248 .family = AF_DECnet,
251 .rule_size = sizeof(struct dn_fib_rule), 249 .rule_size = sizeof(struct dn_fib_rule),
250 .addr_size = sizeof(u16),
252 .action = dn_fib_rule_action, 251 .action = dn_fib_rule_action,
253 .match = dn_fib_rule_match, 252 .match = dn_fib_rule_match,
254 .configure = dn_fib_rule_configure, 253 .configure = dn_fib_rule_configure,
diff --git a/net/ieee80211/Kconfig b/net/ieee80211/Kconfig
index a64be6cdf078..6ef766ef9618 100644
--- a/net/ieee80211/Kconfig
+++ b/net/ieee80211/Kconfig
@@ -38,7 +38,7 @@ config IEEE80211_CRYPT_WEP
38 Include software based cipher suites in support of IEEE 38 Include software based cipher suites in support of IEEE
39 802.11's WEP. This is needed for WEP as well as 802.1x. 39 802.11's WEP. This is needed for WEP as well as 802.1x.
40 40
41 This can be compiled as a modules and it will be called 41 This can be compiled as a module and it will be called
42 "ieee80211_crypt_wep". 42 "ieee80211_crypt_wep".
43 43
44config IEEE80211_CRYPT_CCMP 44config IEEE80211_CRYPT_CCMP
@@ -51,7 +51,7 @@ config IEEE80211_CRYPT_CCMP
51 (aka TGi, WPA, WPA2, WPA-PSK, etc.) for use with CCMP enabled 51 (aka TGi, WPA, WPA2, WPA-PSK, etc.) for use with CCMP enabled
52 networks. 52 networks.
53 53
54 This can be compiled as a modules and it will be called 54 This can be compiled as a module and it will be called
55 "ieee80211_crypt_ccmp". 55 "ieee80211_crypt_ccmp".
56 56
57config IEEE80211_CRYPT_TKIP 57config IEEE80211_CRYPT_TKIP
@@ -66,7 +66,7 @@ config IEEE80211_CRYPT_TKIP
66 (aka TGi, WPA, WPA2, WPA-PSK, etc.) for use with TKIP enabled 66 (aka TGi, WPA, WPA2, WPA-PSK, etc.) for use with TKIP enabled
67 networks. 67 networks.
68 68
69 This can be compiled as a modules and it will be called 69 This can be compiled as a module and it will be called
70 "ieee80211_crypt_tkip". 70 "ieee80211_crypt_tkip".
71 71
72source "net/ieee80211/softmac/Kconfig" 72source "net/ieee80211/softmac/Kconfig"
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index 1fba6439fc57..fc920f63452b 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -493,6 +493,11 @@ static int rtm_to_fib_config(struct sk_buff *skb, struct nlmsghdr *nlh,
493 cfg->fc_nlinfo.pid = NETLINK_CB(skb).pid; 493 cfg->fc_nlinfo.pid = NETLINK_CB(skb).pid;
494 cfg->fc_nlinfo.nlh = nlh; 494 cfg->fc_nlinfo.nlh = nlh;
495 495
496 if (cfg->fc_type > RTN_MAX) {
497 err = -EINVAL;
498 goto errout;
499 }
500
496 nlmsg_for_each_attr(attr, nlh, sizeof(struct rtmsg), remaining) { 501 nlmsg_for_each_attr(attr, nlh, sizeof(struct rtmsg), remaining) {
497 switch (attr->nla_type) { 502 switch (attr->nla_type) {
498 case RTA_DST: 503 case RTA_DST:
diff --git a/net/ipv4/fib_rules.c b/net/ipv4/fib_rules.c
index b837c33e0404..c660c074c76c 100644
--- a/net/ipv4/fib_rules.c
+++ b/net/ipv4/fib_rules.c
@@ -171,8 +171,6 @@ static struct fib_table *fib_empty_table(void)
171 171
172static struct nla_policy fib4_rule_policy[FRA_MAX+1] __read_mostly = { 172static struct nla_policy fib4_rule_policy[FRA_MAX+1] __read_mostly = {
173 FRA_GENERIC_POLICY, 173 FRA_GENERIC_POLICY,
174 [FRA_SRC] = { .type = NLA_U32 },
175 [FRA_DST] = { .type = NLA_U32 },
176 [FRA_FLOW] = { .type = NLA_U32 }, 174 [FRA_FLOW] = { .type = NLA_U32 },
177}; 175};
178 176
@@ -183,8 +181,7 @@ static int fib4_rule_configure(struct fib_rule *rule, struct sk_buff *skb,
183 int err = -EINVAL; 181 int err = -EINVAL;
184 struct fib4_rule *rule4 = (struct fib4_rule *) rule; 182 struct fib4_rule *rule4 = (struct fib4_rule *) rule;
185 183
186 if (frh->src_len > 32 || frh->dst_len > 32 || 184 if (frh->tos & ~IPTOS_TOS_MASK)
187 (frh->tos & ~IPTOS_TOS_MASK))
188 goto errout; 185 goto errout;
189 186
190 if (rule->table == RT_TABLE_UNSPEC) { 187 if (rule->table == RT_TABLE_UNSPEC) {
@@ -201,10 +198,10 @@ static int fib4_rule_configure(struct fib_rule *rule, struct sk_buff *skb,
201 } 198 }
202 } 199 }
203 200
204 if (tb[FRA_SRC]) 201 if (frh->src_len)
205 rule4->src = nla_get_be32(tb[FRA_SRC]); 202 rule4->src = nla_get_be32(tb[FRA_SRC]);
206 203
207 if (tb[FRA_DST]) 204 if (frh->dst_len)
208 rule4->dst = nla_get_be32(tb[FRA_DST]); 205 rule4->dst = nla_get_be32(tb[FRA_DST]);
209 206
210#ifdef CONFIG_NET_CLS_ROUTE 207#ifdef CONFIG_NET_CLS_ROUTE
@@ -242,10 +239,10 @@ static int fib4_rule_compare(struct fib_rule *rule, struct fib_rule_hdr *frh,
242 return 0; 239 return 0;
243#endif 240#endif
244 241
245 if (tb[FRA_SRC] && (rule4->src != nla_get_be32(tb[FRA_SRC]))) 242 if (frh->src_len && (rule4->src != nla_get_be32(tb[FRA_SRC])))
246 return 0; 243 return 0;
247 244
248 if (tb[FRA_DST] && (rule4->dst != nla_get_be32(tb[FRA_DST]))) 245 if (frh->dst_len && (rule4->dst != nla_get_be32(tb[FRA_DST])))
249 return 0; 246 return 0;
250 247
251 return 1; 248 return 1;
@@ -309,6 +306,7 @@ static size_t fib4_rule_nlmsg_payload(struct fib_rule *rule)
309static struct fib_rules_ops fib4_rules_ops = { 306static struct fib_rules_ops fib4_rules_ops = {
310 .family = AF_INET, 307 .family = AF_INET,
311 .rule_size = sizeof(struct fib4_rule), 308 .rule_size = sizeof(struct fib4_rule),
309 .addr_size = sizeof(u32),
312 .action = fib4_rule_action, 310 .action = fib4_rule_action,
313 .match = fib4_rule_match, 311 .match = fib4_rule_match,
314 .configure = fib4_rule_configure, 312 .configure = fib4_rule_configure,
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
index 2f1fdae6efa6..3dad12ee76c3 100644
--- a/net/ipv4/fib_semantics.c
+++ b/net/ipv4/fib_semantics.c
@@ -89,7 +89,7 @@ static const struct
89{ 89{
90 int error; 90 int error;
91 u8 scope; 91 u8 scope;
92} fib_props[RTA_MAX + 1] = { 92} fib_props[RTN_MAX + 1] = {
93 { 93 {
94 .error = 0, 94 .error = 0,
95 .scope = RT_SCOPE_NOWHERE, 95 .scope = RT_SCOPE_NOWHERE,
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
index ada9b3db507d..214c34732e84 100644
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
@@ -1123,6 +1123,9 @@ err:
1123 return fa_head; 1123 return fa_head;
1124} 1124}
1125 1125
1126/*
1127 * Caller must hold RTNL.
1128 */
1126static int fn_trie_insert(struct fib_table *tb, struct fib_config *cfg) 1129static int fn_trie_insert(struct fib_table *tb, struct fib_config *cfg)
1127{ 1130{
1128 struct trie *t = (struct trie *) tb->tb_data; 1131 struct trie *t = (struct trie *) tb->tb_data;
@@ -1540,6 +1543,9 @@ static int trie_leaf_remove(struct trie *t, t_key key)
1540 return 1; 1543 return 1;
1541} 1544}
1542 1545
1546/*
1547 * Caller must hold RTNL.
1548 */
1543static int fn_trie_delete(struct fib_table *tb, struct fib_config *cfg) 1549static int fn_trie_delete(struct fib_table *tb, struct fib_config *cfg)
1544{ 1550{
1545 struct trie *t = (struct trie *) tb->tb_data; 1551 struct trie *t = (struct trie *) tb->tb_data;
@@ -1718,6 +1724,9 @@ up:
1718 return NULL; /* Ready. Root of trie */ 1724 return NULL; /* Ready. Root of trie */
1719} 1725}
1720 1726
1727/*
1728 * Caller must hold RTNL.
1729 */
1721static int fn_trie_flush(struct fib_table *tb) 1730static int fn_trie_flush(struct fib_table *tb)
1722{ 1731{
1723 struct trie *t = (struct trie *) tb->tb_data; 1732 struct trie *t = (struct trie *) tb->tb_data;
diff --git a/net/ipv4/netfilter/ip_nat_standalone.c b/net/ipv4/netfilter/ip_nat_standalone.c
index adf25f9f70e1..6bcfdf6dfcc9 100644
--- a/net/ipv4/netfilter/ip_nat_standalone.c
+++ b/net/ipv4/netfilter/ip_nat_standalone.c
@@ -253,14 +253,17 @@ ip_nat_local_fn(unsigned int hooknum,
253 enum ip_conntrack_dir dir = CTINFO2DIR(ctinfo); 253 enum ip_conntrack_dir dir = CTINFO2DIR(ctinfo);
254 254
255 if (ct->tuplehash[dir].tuple.dst.ip != 255 if (ct->tuplehash[dir].tuple.dst.ip !=
256 ct->tuplehash[!dir].tuple.src.ip 256 ct->tuplehash[!dir].tuple.src.ip) {
257#ifdef CONFIG_XFRM
258 || ct->tuplehash[dir].tuple.dst.u.all !=
259 ct->tuplehash[!dir].tuple.src.u.all
260#endif
261 )
262 if (ip_route_me_harder(pskb, RTN_UNSPEC)) 257 if (ip_route_me_harder(pskb, RTN_UNSPEC))
263 ret = NF_DROP; 258 ret = NF_DROP;
259 }
260#ifdef CONFIG_XFRM
261 else if (ct->tuplehash[dir].tuple.dst.u.all !=
262 ct->tuplehash[!dir].tuple.src.u.all)
263 if (ip_xfrm_me_harder(pskb))
264 ret = NF_DROP;
265#endif
266
264 } 267 }
265 return ret; 268 return ret;
266} 269}
diff --git a/net/ipv4/netfilter/nf_nat_standalone.c b/net/ipv4/netfilter/nf_nat_standalone.c
index e4d3ef17d45b..15aa3db8cb33 100644
--- a/net/ipv4/netfilter/nf_nat_standalone.c
+++ b/net/ipv4/netfilter/nf_nat_standalone.c
@@ -245,14 +245,16 @@ nf_nat_local_fn(unsigned int hooknum,
245 enum ip_conntrack_dir dir = CTINFO2DIR(ctinfo); 245 enum ip_conntrack_dir dir = CTINFO2DIR(ctinfo);
246 246
247 if (ct->tuplehash[dir].tuple.dst.u3.ip != 247 if (ct->tuplehash[dir].tuple.dst.u3.ip !=
248 ct->tuplehash[!dir].tuple.src.u3.ip 248 ct->tuplehash[!dir].tuple.src.u3.ip) {
249#ifdef CONFIG_XFRM
250 || ct->tuplehash[dir].tuple.dst.u.all !=
251 ct->tuplehash[!dir].tuple.src.u.all
252#endif
253 )
254 if (ip_route_me_harder(pskb, RTN_UNSPEC)) 249 if (ip_route_me_harder(pskb, RTN_UNSPEC))
255 ret = NF_DROP; 250 ret = NF_DROP;
251 }
252#ifdef CONFIG_XFRM
253 else if (ct->tuplehash[dir].tuple.dst.u.all !=
254 ct->tuplehash[!dir].tuple.src.u.all)
255 if (ip_xfrm_me_harder(pskb))
256 ret = NF_DROP;
257#endif
256 } 258 }
257 return ret; 259 return ret;
258} 260}
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index dc151139b5af..688b95594f2e 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -1607,6 +1607,9 @@ u32 __tcp_select_window(struct sock *sk)
1607 */ 1607 */
1608 if (window <= free_space - mss || window > free_space) 1608 if (window <= free_space - mss || window > free_space)
1609 window = (free_space/mss)*mss; 1609 window = (free_space/mss)*mss;
1610 else if (mss == full_space &&
1611 free_space > window + full_space/2)
1612 window = free_space;
1610 } 1613 }
1611 1614
1612 return window; 1615 return window;
diff --git a/net/ipv4/xfrm4_mode_beet.c b/net/ipv4/xfrm4_mode_beet.c
index 89cf59ea7bbe..f68dfd8a0f5c 100644
--- a/net/ipv4/xfrm4_mode_beet.c
+++ b/net/ipv4/xfrm4_mode_beet.c
@@ -42,10 +42,9 @@ static int xfrm4_beet_output(struct xfrm_state *x, struct sk_buff *skb)
42 42
43 skb->nh.raw = skb_push(skb, x->props.header_len + hdrlen); 43 skb->nh.raw = skb_push(skb, x->props.header_len + hdrlen);
44 top_iph = skb->nh.iph; 44 top_iph = skb->nh.iph;
45 hdrlen = iph->ihl * 4 - optlen; 45 skb->h.raw += sizeof(*iph) - hdrlen;
46 skb->h.raw += hdrlen;
47 46
48 memmove(top_iph, iph, hdrlen); 47 memmove(top_iph, iph, sizeof(*iph));
49 if (unlikely(optlen)) { 48 if (unlikely(optlen)) {
50 struct ip_beet_phdr *ph; 49 struct ip_beet_phdr *ph;
51 50
@@ -55,6 +54,8 @@ static int xfrm4_beet_output(struct xfrm_state *x, struct sk_buff *skb)
55 ph->padlen = 4 - (optlen & 4); 54 ph->padlen = 4 - (optlen & 4);
56 ph->hdrlen = (optlen + ph->padlen + sizeof(*ph)) / 8; 55 ph->hdrlen = (optlen + ph->padlen + sizeof(*ph)) / 8;
57 ph->nexthdr = top_iph->protocol; 56 ph->nexthdr = top_iph->protocol;
57 if (ph->padlen)
58 memset(ph + 1, IPOPT_NOP, ph->padlen);
58 59
59 top_iph->protocol = IPPROTO_BEETPH; 60 top_iph->protocol = IPPROTO_BEETPH;
60 top_iph->ihl = sizeof(struct iphdr) / 4; 61 top_iph->ihl = sizeof(struct iphdr) / 4;
@@ -77,29 +78,32 @@ static int xfrm4_beet_input(struct xfrm_state *x, struct sk_buff *skb)
77 protocol = iph->protocol; 78 protocol = iph->protocol;
78 79
79 if (unlikely(iph->protocol == IPPROTO_BEETPH)) { 80 if (unlikely(iph->protocol == IPPROTO_BEETPH)) {
80 struct ip_beet_phdr *ph = (struct ip_beet_phdr*)(iph + 1); 81 struct ip_beet_phdr *ph;
81 82
82 if (!pskb_may_pull(skb, sizeof(*ph))) 83 if (!pskb_may_pull(skb, sizeof(*ph)))
83 goto out; 84 goto out;
85 ph = (struct ip_beet_phdr *)(skb->h.ipiph + 1);
84 86
85 phlen = ph->hdrlen * 8; 87 phlen = sizeof(*ph) + ph->padlen;
86 optlen = phlen - ph->padlen - sizeof(*ph); 88 optlen = ph->hdrlen * 8 - phlen;
87 if (optlen < 0 || optlen & 3 || optlen > 250) 89 if (optlen < 0 || optlen & 3 || optlen > 250)
88 goto out; 90 goto out;
89 91
90 if (!pskb_may_pull(skb, phlen)) 92 if (!pskb_may_pull(skb, phlen + optlen))
91 goto out; 93 goto out;
94 skb->len -= phlen + optlen;
92 95
93 ph_nexthdr = ph->nexthdr; 96 ph_nexthdr = ph->nexthdr;
94 } 97 }
95 98
96 skb_push(skb, sizeof(*iph) - phlen + optlen); 99 skb->nh.raw = skb->data + (phlen - sizeof(*iph));
97 memmove(skb->data, skb->nh.raw, sizeof(*iph)); 100 memmove(skb->nh.raw, iph, sizeof(*iph));
98 skb->nh.raw = skb->data; 101 skb->h.raw = skb->data + (phlen + optlen);
102 skb->data = skb->h.raw;
99 103
100 iph = skb->nh.iph; 104 iph = skb->nh.iph;
101 iph->ihl = (sizeof(*iph) + optlen) / 4; 105 iph->ihl = (sizeof(*iph) + optlen) / 4;
102 iph->tot_len = htons(skb->len); 106 iph->tot_len = htons(skb->len + iph->ihl * 4);
103 iph->daddr = x->sel.daddr.a4; 107 iph->daddr = x->sel.daddr.a4;
104 iph->saddr = x->sel.saddr.a4; 108 iph->saddr = x->sel.saddr.a4;
105 if (ph_nexthdr) 109 if (ph_nexthdr)
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index a7fee6b27320..7552663aa125 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -342,6 +342,9 @@ static struct inet6_dev * ipv6_add_dev(struct net_device *dev)
342 } 342 }
343#endif 343#endif
344 344
345 if (netif_running(dev) && netif_carrier_ok(dev))
346 ndev->if_flags |= IF_READY;
347
345 ipv6_mc_init_dev(ndev); 348 ipv6_mc_init_dev(ndev);
346 ndev->tstamp = jiffies; 349 ndev->tstamp = jiffies;
347#ifdef CONFIG_SYSCTL 350#ifdef CONFIG_SYSCTL
@@ -804,7 +807,7 @@ struct ipv6_saddr_score {
804#define IPV6_SADDR_SCORE_LABEL 0x0020 807#define IPV6_SADDR_SCORE_LABEL 0x0020
805#define IPV6_SADDR_SCORE_PRIVACY 0x0040 808#define IPV6_SADDR_SCORE_PRIVACY 0x0040
806 809
807static int inline ipv6_saddr_preferred(int type) 810static inline int ipv6_saddr_preferred(int type)
808{ 811{
809 if (type & (IPV6_ADDR_MAPPED|IPV6_ADDR_COMPATv4| 812 if (type & (IPV6_ADDR_MAPPED|IPV6_ADDR_COMPATv4|
810 IPV6_ADDR_LOOPBACK|IPV6_ADDR_RESERVED)) 813 IPV6_ADDR_LOOPBACK|IPV6_ADDR_RESERVED))
@@ -813,7 +816,7 @@ static int inline ipv6_saddr_preferred(int type)
813} 816}
814 817
815/* static matching label */ 818/* static matching label */
816static int inline ipv6_saddr_label(const struct in6_addr *addr, int type) 819static inline int ipv6_saddr_label(const struct in6_addr *addr, int type)
817{ 820{
818 /* 821 /*
819 * prefix (longest match) label 822 * prefix (longest match) label
@@ -3318,7 +3321,7 @@ errout:
3318 rtnl_set_sk_err(RTNLGRP_IPV6_IFADDR, err); 3321 rtnl_set_sk_err(RTNLGRP_IPV6_IFADDR, err);
3319} 3322}
3320 3323
3321static void inline ipv6_store_devconf(struct ipv6_devconf *cnf, 3324static inline void ipv6_store_devconf(struct ipv6_devconf *cnf,
3322 __s32 *array, int bytes) 3325 __s32 *array, int bytes)
3323{ 3326{
3324 BUG_ON(bytes < (DEVCONF_MAX * 4)); 3327 BUG_ON(bytes < (DEVCONF_MAX * 4));
diff --git a/net/ipv6/fib6_rules.c b/net/ipv6/fib6_rules.c
index 0862809ffcf7..ea3035b4e3e8 100644
--- a/net/ipv6/fib6_rules.c
+++ b/net/ipv6/fib6_rules.c
@@ -131,8 +131,6 @@ static int fib6_rule_match(struct fib_rule *rule, struct flowi *fl, int flags)
131 131
132static struct nla_policy fib6_rule_policy[FRA_MAX+1] __read_mostly = { 132static struct nla_policy fib6_rule_policy[FRA_MAX+1] __read_mostly = {
133 FRA_GENERIC_POLICY, 133 FRA_GENERIC_POLICY,
134 [FRA_SRC] = { .len = sizeof(struct in6_addr) },
135 [FRA_DST] = { .len = sizeof(struct in6_addr) },
136}; 134};
137 135
138static int fib6_rule_configure(struct fib_rule *rule, struct sk_buff *skb, 136static int fib6_rule_configure(struct fib_rule *rule, struct sk_buff *skb,
@@ -142,9 +140,6 @@ static int fib6_rule_configure(struct fib_rule *rule, struct sk_buff *skb,
142 int err = -EINVAL; 140 int err = -EINVAL;
143 struct fib6_rule *rule6 = (struct fib6_rule *) rule; 141 struct fib6_rule *rule6 = (struct fib6_rule *) rule;
144 142
145 if (frh->src_len > 128 || frh->dst_len > 128)
146 goto errout;
147
148 if (rule->action == FR_ACT_TO_TBL) { 143 if (rule->action == FR_ACT_TO_TBL) {
149 if (rule->table == RT6_TABLE_UNSPEC) 144 if (rule->table == RT6_TABLE_UNSPEC)
150 goto errout; 145 goto errout;
@@ -155,11 +150,11 @@ static int fib6_rule_configure(struct fib_rule *rule, struct sk_buff *skb,
155 } 150 }
156 } 151 }
157 152
158 if (tb[FRA_SRC]) 153 if (frh->src_len)
159 nla_memcpy(&rule6->src.addr, tb[FRA_SRC], 154 nla_memcpy(&rule6->src.addr, tb[FRA_SRC],
160 sizeof(struct in6_addr)); 155 sizeof(struct in6_addr));
161 156
162 if (tb[FRA_DST]) 157 if (frh->dst_len)
163 nla_memcpy(&rule6->dst.addr, tb[FRA_DST], 158 nla_memcpy(&rule6->dst.addr, tb[FRA_DST],
164 sizeof(struct in6_addr)); 159 sizeof(struct in6_addr));
165 160
@@ -186,11 +181,11 @@ static int fib6_rule_compare(struct fib_rule *rule, struct fib_rule_hdr *frh,
186 if (frh->tos && (rule6->tclass != frh->tos)) 181 if (frh->tos && (rule6->tclass != frh->tos))
187 return 0; 182 return 0;
188 183
189 if (tb[FRA_SRC] && 184 if (frh->src_len &&
190 nla_memcmp(tb[FRA_SRC], &rule6->src.addr, sizeof(struct in6_addr))) 185 nla_memcmp(tb[FRA_SRC], &rule6->src.addr, sizeof(struct in6_addr)))
191 return 0; 186 return 0;
192 187
193 if (tb[FRA_DST] && 188 if (frh->dst_len &&
194 nla_memcmp(tb[FRA_DST], &rule6->dst.addr, sizeof(struct in6_addr))) 189 nla_memcmp(tb[FRA_DST], &rule6->dst.addr, sizeof(struct in6_addr)))
195 return 0; 190 return 0;
196 191
@@ -240,6 +235,7 @@ static size_t fib6_rule_nlmsg_payload(struct fib_rule *rule)
240static struct fib_rules_ops fib6_rules_ops = { 235static struct fib_rules_ops fib6_rules_ops = {
241 .family = AF_INET6, 236 .family = AF_INET6,
242 .rule_size = sizeof(struct fib6_rule), 237 .rule_size = sizeof(struct fib6_rule),
238 .addr_size = sizeof(struct in6_addr),
243 .action = fib6_rule_action, 239 .action = fib6_rule_action,
244 .match = fib6_rule_match, 240 .match = fib6_rule_match,
245 .configure = fib6_rule_configure, 241 .configure = fib6_rule_configure,
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c
index f4d7be77eb0f..268f476ef3db 100644
--- a/net/ipv6/ip6_fib.c
+++ b/net/ipv6/ip6_fib.c
@@ -658,6 +658,10 @@ static int fib6_add_rt2node(struct fib6_node *fn, struct rt6_info *rt,
658 ins = &iter->u.dst.rt6_next; 658 ins = &iter->u.dst.rt6_next;
659 } 659 }
660 660
661 /* Reset round-robin state, if necessary */
662 if (ins == &fn->leaf)
663 fn->rr_ptr = NULL;
664
661 /* 665 /*
662 * insert node 666 * insert node
663 */ 667 */
@@ -1109,6 +1113,10 @@ static void fib6_del_route(struct fib6_node *fn, struct rt6_info **rtp,
1109 rt6_stats.fib_rt_entries--; 1113 rt6_stats.fib_rt_entries--;
1110 rt6_stats.fib_discarded_routes++; 1114 rt6_stats.fib_discarded_routes++;
1111 1115
1116 /* Reset round-robin state, if necessary */
1117 if (fn->rr_ptr == rt)
1118 fn->rr_ptr = NULL;
1119
1112 /* Adjust walkers */ 1120 /* Adjust walkers */
1113 read_lock(&fib6_walker_lock); 1121 read_lock(&fib6_walker_lock);
1114 FOR_WALKERS(w) { 1122 FOR_WALKERS(w) {
diff --git a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c
index 11bfc7c43182..61e7a6c8141d 100644
--- a/net/ipv6/ip6_input.c
+++ b/net/ipv6/ip6_input.c
@@ -108,8 +108,10 @@ int ipv6_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt
108 108
109 /* pkt_len may be zero if Jumbo payload option is present */ 109 /* pkt_len may be zero if Jumbo payload option is present */
110 if (pkt_len || hdr->nexthdr != NEXTHDR_HOP) { 110 if (pkt_len || hdr->nexthdr != NEXTHDR_HOP) {
111 if (pkt_len + sizeof(struct ipv6hdr) > skb->len) 111 if (pkt_len + sizeof(struct ipv6hdr) > skb->len) {
112 goto truncated; 112 IP6_INC_STATS_BH(idev, IPSTATS_MIB_INTRUNCATEDPKTS);
113 goto drop;
114 }
113 if (pskb_trim_rcsum(skb, pkt_len + sizeof(struct ipv6hdr))) { 115 if (pskb_trim_rcsum(skb, pkt_len + sizeof(struct ipv6hdr))) {
114 IP6_INC_STATS_BH(idev, IPSTATS_MIB_INHDRERRORS); 116 IP6_INC_STATS_BH(idev, IPSTATS_MIB_INHDRERRORS);
115 goto drop; 117 goto drop;
@@ -128,8 +130,6 @@ int ipv6_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt
128 rcu_read_unlock(); 130 rcu_read_unlock();
129 131
130 return NF_HOOK(PF_INET6,NF_IP6_PRE_ROUTING, skb, dev, NULL, ip6_rcv_finish); 132 return NF_HOOK(PF_INET6,NF_IP6_PRE_ROUTING, skb, dev, NULL, ip6_rcv_finish);
131truncated:
132 IP6_INC_STATS_BH(idev, IPSTATS_MIB_INTRUNCATEDPKTS);
133err: 133err:
134 IP6_INC_STATS_BH(idev, IPSTATS_MIB_INHDRERRORS); 134 IP6_INC_STATS_BH(idev, IPSTATS_MIB_INHDRERRORS);
135drop: 135drop:
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
index 306d5d83c068..203e069e7fe9 100644
--- a/net/ipv6/raw.c
+++ b/net/ipv6/raw.c
@@ -687,9 +687,9 @@ static int rawv6_sendmsg(struct kiocb *iocb, struct sock *sk,
687 int err; 687 int err;
688 688
689 /* Rough check on arithmetic overflow, 689 /* Rough check on arithmetic overflow,
690 better check is made in ip6_build_xmit 690 better check is made in ip6_append_data().
691 */ 691 */
692 if (len < 0) 692 if (len > INT_MAX)
693 return -EMSGSIZE; 693 return -EMSGSIZE;
694 694
695 /* Mirror BSD error message compatibility */ 695 /* Mirror BSD error message compatibility */
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 0e1f4b2cd3dd..ad9b285692ba 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -308,27 +308,18 @@ static inline void rt6_probe(struct rt6_info *rt)
308/* 308/*
309 * Default Router Selection (RFC 2461 6.3.6) 309 * Default Router Selection (RFC 2461 6.3.6)
310 */ 310 */
311static int inline rt6_check_dev(struct rt6_info *rt, int oif) 311static inline int rt6_check_dev(struct rt6_info *rt, int oif)
312{ 312{
313 struct net_device *dev = rt->rt6i_dev; 313 struct net_device *dev = rt->rt6i_dev;
314 int ret = 0; 314 if (!oif || dev->ifindex == oif)
315
316 if (!oif)
317 return 2;
318 if (dev->flags & IFF_LOOPBACK) {
319 if (!WARN_ON(rt->rt6i_idev == NULL) &&
320 rt->rt6i_idev->dev->ifindex == oif)
321 ret = 1;
322 else
323 return 0;
324 }
325 if (dev->ifindex == oif)
326 return 2; 315 return 2;
327 316 if ((dev->flags & IFF_LOOPBACK) &&
328 return ret; 317 rt->rt6i_idev && rt->rt6i_idev->dev->ifindex == oif)
318 return 1;
319 return 0;
329} 320}
330 321
331static int inline rt6_check_neigh(struct rt6_info *rt) 322static inline int rt6_check_neigh(struct rt6_info *rt)
332{ 323{
333 struct neighbour *neigh = rt->rt6i_nexthop; 324 struct neighbour *neigh = rt->rt6i_nexthop;
334 int m = 0; 325 int m = 0;
@@ -363,55 +354,76 @@ static int rt6_score_route(struct rt6_info *rt, int oif,
363 return m; 354 return m;
364} 355}
365 356
366static struct rt6_info *rt6_select(struct rt6_info **head, int oif, 357static struct rt6_info *find_match(struct rt6_info *rt, int oif, int strict,
367 int strict) 358 int *mpri, struct rt6_info *match)
359{
360 int m;
361
362 if (rt6_check_expired(rt))
363 goto out;
364
365 m = rt6_score_route(rt, oif, strict);
366 if (m < 0)
367 goto out;
368
369 if (m > *mpri) {
370 if (strict & RT6_LOOKUP_F_REACHABLE)
371 rt6_probe(match);
372 *mpri = m;
373 match = rt;
374 } else if (strict & RT6_LOOKUP_F_REACHABLE) {
375 rt6_probe(rt);
376 }
377
378out:
379 return match;
380}
381
382static struct rt6_info *find_rr_leaf(struct fib6_node *fn,
383 struct rt6_info *rr_head,
384 u32 metric, int oif, int strict)
368{ 385{
369 struct rt6_info *match = NULL, *last = NULL; 386 struct rt6_info *rt, *match;
370 struct rt6_info *rt, *rt0 = *head;
371 u32 metric;
372 int mpri = -1; 387 int mpri = -1;
373 388
374 RT6_TRACE("%s(head=%p(*head=%p), oif=%d)\n", 389 match = NULL;
375 __FUNCTION__, head, head ? *head : NULL, oif); 390 for (rt = rr_head; rt && rt->rt6i_metric == metric;
391 rt = rt->u.dst.rt6_next)
392 match = find_match(rt, oif, strict, &mpri, match);
393 for (rt = fn->leaf; rt && rt != rr_head && rt->rt6i_metric == metric;
394 rt = rt->u.dst.rt6_next)
395 match = find_match(rt, oif, strict, &mpri, match);
376 396
377 for (rt = rt0, metric = rt0->rt6i_metric; 397 return match;
378 rt && rt->rt6i_metric == metric && (!last || rt != rt0); 398}
379 rt = rt->u.dst.rt6_next) {
380 int m;
381 399
382 if (rt6_check_expired(rt)) 400static struct rt6_info *rt6_select(struct fib6_node *fn, int oif, int strict)
383 continue; 401{
402 struct rt6_info *match, *rt0;
384 403
385 last = rt; 404 RT6_TRACE("%s(fn->leaf=%p, oif=%d)\n",
405 __FUNCTION__, fn->leaf, oif);
386 406
387 m = rt6_score_route(rt, oif, strict); 407 rt0 = fn->rr_ptr;
388 if (m < 0) 408 if (!rt0)
389 continue; 409 fn->rr_ptr = rt0 = fn->leaf;
390 410
391 if (m > mpri) { 411 match = find_rr_leaf(fn, rt0, rt0->rt6i_metric, oif, strict);
392 if (strict & RT6_LOOKUP_F_REACHABLE)
393 rt6_probe(match);
394 match = rt;
395 mpri = m;
396 } else if (strict & RT6_LOOKUP_F_REACHABLE) {
397 rt6_probe(rt);
398 }
399 }
400 412
401 if (!match && 413 if (!match &&
402 (strict & RT6_LOOKUP_F_REACHABLE) && 414 (strict & RT6_LOOKUP_F_REACHABLE)) {
403 last && last != rt0) { 415 struct rt6_info *next = rt0->u.dst.rt6_next;
416
404 /* no entries matched; do round-robin */ 417 /* no entries matched; do round-robin */
405 static DEFINE_SPINLOCK(lock); 418 if (!next || next->rt6i_metric != rt0->rt6i_metric)
406 spin_lock(&lock); 419 next = fn->leaf;
407 *head = rt0->u.dst.rt6_next; 420
408 rt0->u.dst.rt6_next = last->u.dst.rt6_next; 421 if (next != rt0)
409 last->u.dst.rt6_next = rt0; 422 fn->rr_ptr = next;
410 spin_unlock(&lock);
411 } 423 }
412 424
413 RT6_TRACE("%s() => %p, score=%d\n", 425 RT6_TRACE("%s() => %p\n",
414 __FUNCTION__, match, mpri); 426 __FUNCTION__, match);
415 427
416 return (match ? match : &ip6_null_entry); 428 return (match ? match : &ip6_null_entry);
417} 429}
@@ -657,7 +669,7 @@ restart_2:
657 fn = fib6_lookup(&table->tb6_root, &fl->fl6_dst, &fl->fl6_src); 669 fn = fib6_lookup(&table->tb6_root, &fl->fl6_dst, &fl->fl6_src);
658 670
659restart: 671restart:
660 rt = rt6_select(&fn->leaf, fl->iif, strict | reachable); 672 rt = rt6_select(fn, fl->iif, strict | reachable);
661 BACKTRACK(&fl->fl6_src); 673 BACKTRACK(&fl->fl6_src);
662 if (rt == &ip6_null_entry || 674 if (rt == &ip6_null_entry ||
663 rt->rt6i_flags & RTF_CACHE) 675 rt->rt6i_flags & RTF_CACHE)
@@ -752,7 +764,7 @@ restart_2:
752 fn = fib6_lookup(&table->tb6_root, &fl->fl6_dst, &fl->fl6_src); 764 fn = fib6_lookup(&table->tb6_root, &fl->fl6_dst, &fl->fl6_src);
753 765
754restart: 766restart:
755 rt = rt6_select(&fn->leaf, fl->oif, strict | reachable); 767 rt = rt6_select(fn, fl->oif, strict | reachable);
756 BACKTRACK(&fl->fl6_src); 768 BACKTRACK(&fl->fl6_src);
757 if (rt == &ip6_null_entry || 769 if (rt == &ip6_null_entry ||
758 rt->rt6i_flags & RTF_CACHE) 770 rt->rt6i_flags & RTF_CACHE)
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index 0ad471909881..f590db57a7c9 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -615,7 +615,7 @@ do_udp_sendmsg:
615 return udp_sendmsg(iocb, sk, msg, len); 615 return udp_sendmsg(iocb, sk, msg, len);
616 616
617 /* Rough check on arithmetic overflow, 617 /* Rough check on arithmetic overflow,
618 better check is made in ip6_build_xmit 618 better check is made in ip6_append_data().
619 */ 619 */
620 if (len > INT_MAX - sizeof(struct udphdr)) 620 if (len > INT_MAX - sizeof(struct udphdr))
621 return -EMSGSIZE; 621 return -EMSGSIZE;
diff --git a/net/ipv6/xfrm6_tunnel.c b/net/ipv6/xfrm6_tunnel.c
index ee4b84a33ff4..93c42232aa39 100644
--- a/net/ipv6/xfrm6_tunnel.c
+++ b/net/ipv6/xfrm6_tunnel.c
@@ -58,7 +58,7 @@ static struct kmem_cache *xfrm6_tunnel_spi_kmem __read_mostly;
58static struct hlist_head xfrm6_tunnel_spi_byaddr[XFRM6_TUNNEL_SPI_BYADDR_HSIZE]; 58static struct hlist_head xfrm6_tunnel_spi_byaddr[XFRM6_TUNNEL_SPI_BYADDR_HSIZE];
59static struct hlist_head xfrm6_tunnel_spi_byspi[XFRM6_TUNNEL_SPI_BYSPI_HSIZE]; 59static struct hlist_head xfrm6_tunnel_spi_byspi[XFRM6_TUNNEL_SPI_BYSPI_HSIZE];
60 60
61static unsigned inline xfrm6_tunnel_spi_hash_byaddr(xfrm_address_t *addr) 61static inline unsigned xfrm6_tunnel_spi_hash_byaddr(xfrm_address_t *addr)
62{ 62{
63 unsigned h; 63 unsigned h;
64 64
@@ -70,7 +70,7 @@ static unsigned inline xfrm6_tunnel_spi_hash_byaddr(xfrm_address_t *addr)
70 return h; 70 return h;
71} 71}
72 72
73static unsigned inline xfrm6_tunnel_spi_hash_byspi(u32 spi) 73static inline unsigned xfrm6_tunnel_spi_hash_byspi(u32 spi)
74{ 74{
75 return spi % XFRM6_TUNNEL_SPI_BYSPI_HSIZE; 75 return spi % XFRM6_TUNNEL_SPI_BYSPI_HSIZE;
76} 76}
diff --git a/net/irda/irnet/irnet.h b/net/irda/irnet/irnet.h
index 873ae189e37a..bc2e15ce7004 100644
--- a/net/irda/irnet/irnet.h
+++ b/net/irda/irnet/irnet.h
@@ -419,7 +419,7 @@ typedef struct irnet_socket
419 u32 raccm; /* to please pppd - dummy) */ 419 u32 raccm; /* to please pppd - dummy) */
420 unsigned int flags; /* PPP flags (compression, ...) */ 420 unsigned int flags; /* PPP flags (compression, ...) */
421 unsigned int rbits; /* Unused receive flags ??? */ 421 unsigned int rbits; /* Unused receive flags ??? */
422 422 struct work_struct disconnect_work; /* Process context disconnection */
423 /* ------------------------ IrTTP part ------------------------ */ 423 /* ------------------------ IrTTP part ------------------------ */
424 /* We create a pseudo "socket" over the IrDA tranport */ 424 /* We create a pseudo "socket" over the IrDA tranport */
425 unsigned long ttp_open; /* Set when IrTTP is ready */ 425 unsigned long ttp_open; /* Set when IrTTP is ready */
diff --git a/net/irda/irnet/irnet_irda.c b/net/irda/irnet/irnet_irda.c
index c378e668af0c..a4f1439ffdd8 100644
--- a/net/irda/irnet/irnet_irda.c
+++ b/net/irda/irnet/irnet_irda.c
@@ -10,6 +10,27 @@
10 10
11#include "irnet_irda.h" /* Private header */ 11#include "irnet_irda.h" /* Private header */
12 12
13/*
14 * PPP disconnect work: we need to make sure we're in
15 * process context when calling ppp_unregister_channel().
16 */
17static void irnet_ppp_disconnect(struct work_struct *work)
18{
19 irnet_socket * self =
20 container_of(work, irnet_socket, disconnect_work);
21
22 if (self == NULL)
23 return;
24 /*
25 * If we were connected, cleanup & close the PPP
26 * channel, which will kill pppd (hangup) and the rest.
27 */
28 if (self->ppp_open && !self->ttp_open && !self->ttp_connect) {
29 ppp_unregister_channel(&self->chan);
30 self->ppp_open = 0;
31 }
32}
33
13/************************* CONTROL CHANNEL *************************/ 34/************************* CONTROL CHANNEL *************************/
14/* 35/*
15 * When ppp is not active, /dev/irnet act as a control channel. 36 * When ppp is not active, /dev/irnet act as a control channel.
@@ -499,6 +520,8 @@ irda_irnet_create(irnet_socket * self)
499#endif /* DISCOVERY_NOMASK */ 520#endif /* DISCOVERY_NOMASK */
500 self->tx_flow = FLOW_START; /* Flow control from IrTTP */ 521 self->tx_flow = FLOW_START; /* Flow control from IrTTP */
501 522
523 INIT_WORK(&self->disconnect_work, irnet_ppp_disconnect);
524
502 DEXIT(IRDA_SOCK_TRACE, "\n"); 525 DEXIT(IRDA_SOCK_TRACE, "\n");
503 return(0); 526 return(0);
504} 527}
@@ -1134,15 +1157,8 @@ irnet_disconnect_indication(void * instance,
1134 { 1157 {
1135 if(test_open) 1158 if(test_open)
1136 { 1159 {
1137#ifdef MISSING_PPP_API 1160 /* ppp_unregister_channel() wants a user context. */
1138 /* ppp_unregister_channel() wants a user context, which we 1161 schedule_work(&self->disconnect_work);
1139 * are guaranteed to NOT have here. What are we supposed
1140 * to do here ? Jean II */
1141 /* If we were connected, cleanup & close the PPP channel,
1142 * which will kill pppd (hangup) and the rest */
1143 ppp_unregister_channel(&self->chan);
1144 self->ppp_open = 0;
1145#endif
1146 } 1162 }
1147 else 1163 else
1148 { 1164 {
diff --git a/net/irda/irttp.c b/net/irda/irttp.c
index a7486b3bddcb..da3f2bc1b6f6 100644
--- a/net/irda/irttp.c
+++ b/net/irda/irttp.c
@@ -1455,6 +1455,7 @@ struct tsap_cb *irttp_dup(struct tsap_cb *orig, void *instance)
1455 1455
1456 /* Not everything should be copied */ 1456 /* Not everything should be copied */
1457 new->notify.instance = instance; 1457 new->notify.instance = instance;
1458 spin_lock_init(&new->lock);
1458 init_timer(&new->todo_timer); 1459 init_timer(&new->todo_timer);
1459 1460
1460 skb_queue_head_init(&new->rx_queue); 1461 skb_queue_head_init(&new->rx_queue);
diff --git a/net/netfilter/Kconfig b/net/netfilter/Kconfig
index 253fce3ad2d3..54698af6d0af 100644
--- a/net/netfilter/Kconfig
+++ b/net/netfilter/Kconfig
@@ -275,6 +275,7 @@ config NF_CT_NETLINK
275 tristate 'Connection tracking netlink interface (EXPERIMENTAL)' 275 tristate 'Connection tracking netlink interface (EXPERIMENTAL)'
276 depends on EXPERIMENTAL && NF_CONNTRACK && NETFILTER_NETLINK 276 depends on EXPERIMENTAL && NF_CONNTRACK && NETFILTER_NETLINK
277 depends on NF_CONNTRACK!=y || NETFILTER_NETLINK!=m 277 depends on NF_CONNTRACK!=y || NETFILTER_NETLINK!=m
278 depends on NF_NAT=n || NF_NAT
278 help 279 help
279 This option enables support for a netlink-based userspace interface 280 This option enables support for a netlink-based userspace interface
280 281
diff --git a/net/sched/Makefile b/net/sched/Makefile
index ff2d6e5e282c..020767a204d4 100644
--- a/net/sched/Makefile
+++ b/net/sched/Makefile
@@ -17,7 +17,6 @@ obj-$(CONFIG_NET_ACT_SIMP) += act_simple.o
17obj-$(CONFIG_NET_SCH_FIFO) += sch_fifo.o 17obj-$(CONFIG_NET_SCH_FIFO) += sch_fifo.o
18obj-$(CONFIG_NET_SCH_CBQ) += sch_cbq.o 18obj-$(CONFIG_NET_SCH_CBQ) += sch_cbq.o
19obj-$(CONFIG_NET_SCH_HTB) += sch_htb.o 19obj-$(CONFIG_NET_SCH_HTB) += sch_htb.o
20obj-$(CONFIG_NET_SCH_HPFQ) += sch_hpfq.o
21obj-$(CONFIG_NET_SCH_HFSC) += sch_hfsc.o 20obj-$(CONFIG_NET_SCH_HFSC) += sch_hfsc.o
22obj-$(CONFIG_NET_SCH_RED) += sch_red.o 21obj-$(CONFIG_NET_SCH_RED) += sch_red.o
23obj-$(CONFIG_NET_SCH_GRED) += sch_gred.o 22obj-$(CONFIG_NET_SCH_GRED) += sch_gred.o
diff --git a/net/sched/act_mirred.c b/net/sched/act_mirred.c
index 68f26cb278f9..3e93683e9ab3 100644
--- a/net/sched/act_mirred.c
+++ b/net/sched/act_mirred.c
@@ -198,7 +198,7 @@ bad_mirred:
198 skb2->tc_verd = SET_TC_FROM(skb2->tc_verd, at); 198 skb2->tc_verd = SET_TC_FROM(skb2->tc_verd, at);
199 199
200 skb2->dev = dev; 200 skb2->dev = dev;
201 skb2->input_dev = skb->dev; 201 skb2->iif = skb->dev->ifindex;
202 dev_queue_xmit(skb2); 202 dev_queue_xmit(skb2);
203 spin_unlock(&m->tcf_lock); 203 spin_unlock(&m->tcf_lock);
204 return m->tcf_action; 204 return m->tcf_action;
diff --git a/net/sched/cls_basic.c b/net/sched/cls_basic.c
index fad08e521c24..4a91f082a81d 100644
--- a/net/sched/cls_basic.c
+++ b/net/sched/cls_basic.c
@@ -81,6 +81,13 @@ static void basic_put(struct tcf_proto *tp, unsigned long f)
81 81
82static int basic_init(struct tcf_proto *tp) 82static int basic_init(struct tcf_proto *tp)
83{ 83{
84 struct basic_head *head;
85
86 head = kzalloc(sizeof(*head), GFP_KERNEL);
87 if (head == NULL)
88 return -ENOBUFS;
89 INIT_LIST_HEAD(&head->flist);
90 tp->root = head;
84 return 0; 91 return 0;
85} 92}
86 93
@@ -102,6 +109,7 @@ static void basic_destroy(struct tcf_proto *tp)
102 list_del(&f->link); 109 list_del(&f->link);
103 basic_delete_filter(tp, f); 110 basic_delete_filter(tp, f);
104 } 111 }
112 kfree(head);
105} 113}
106 114
107static int basic_delete(struct tcf_proto *tp, unsigned long arg) 115static int basic_delete(struct tcf_proto *tp, unsigned long arg)
@@ -176,15 +184,6 @@ static int basic_change(struct tcf_proto *tp, unsigned long base, u32 handle,
176 } 184 }
177 185
178 err = -ENOBUFS; 186 err = -ENOBUFS;
179 if (head == NULL) {
180 head = kzalloc(sizeof(*head), GFP_KERNEL);
181 if (head == NULL)
182 goto errout;
183
184 INIT_LIST_HEAD(&head->flist);
185 tp->root = head;
186 }
187
188 f = kzalloc(sizeof(*f), GFP_KERNEL); 187 f = kzalloc(sizeof(*f), GFP_KERNEL);
189 if (f == NULL) 188 if (f == NULL)
190 goto errout; 189 goto errout;
diff --git a/net/sched/cls_route.c b/net/sched/cls_route.c
index e85df07d8ce7..abc47cc48ad0 100644
--- a/net/sched/cls_route.c
+++ b/net/sched/cls_route.c
@@ -93,7 +93,7 @@ void route4_reset_fastmap(struct net_device *dev, struct route4_head *head, u32
93 spin_unlock_bh(&dev->queue_lock); 93 spin_unlock_bh(&dev->queue_lock);
94} 94}
95 95
96static void __inline__ 96static inline void
97route4_set_fastmap(struct route4_head *head, u32 id, int iif, 97route4_set_fastmap(struct route4_head *head, u32 id, int iif,
98 struct route4_filter *f) 98 struct route4_filter *f)
99{ 99{
diff --git a/net/sched/sch_hfsc.c b/net/sched/sch_hfsc.c
index 396deb71480f..407c6fb1ba14 100644
--- a/net/sched/sch_hfsc.c
+++ b/net/sched/sch_hfsc.c
@@ -1184,10 +1184,12 @@ hfsc_delete_class(struct Qdisc *sch, unsigned long arg)
1184 1184
1185 sch_tree_lock(sch); 1185 sch_tree_lock(sch);
1186 1186
1187 list_del(&cl->hlist);
1188 list_del(&cl->siblings); 1187 list_del(&cl->siblings);
1189 hfsc_adjust_levels(cl->cl_parent); 1188 hfsc_adjust_levels(cl->cl_parent);
1189
1190 hfsc_purge_queue(sch, cl); 1190 hfsc_purge_queue(sch, cl);
1191 list_del(&cl->hlist);
1192
1191 if (--cl->refcnt == 0) 1193 if (--cl->refcnt == 0)
1192 hfsc_destroy_class(sch, cl); 1194 hfsc_destroy_class(sch, cl);
1193 1195
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c
index 97cbb9aec946..3c3294d01041 100644
--- a/net/sched/sch_htb.c
+++ b/net/sched/sch_htb.c
@@ -1380,15 +1380,15 @@ static int htb_delete(struct Qdisc *sch, unsigned long arg)
1380 1380
1381 sch_tree_lock(sch); 1381 sch_tree_lock(sch);
1382 1382
1383 /* delete from hash and active; remainder in destroy_class */
1384 hlist_del_init(&cl->hlist);
1385
1386 if (!cl->level) { 1383 if (!cl->level) {
1387 qlen = cl->un.leaf.q->q.qlen; 1384 qlen = cl->un.leaf.q->q.qlen;
1388 qdisc_reset(cl->un.leaf.q); 1385 qdisc_reset(cl->un.leaf.q);
1389 qdisc_tree_decrease_qlen(cl->un.leaf.q, qlen); 1386 qdisc_tree_decrease_qlen(cl->un.leaf.q, qlen);
1390 } 1387 }
1391 1388
1389 /* delete from hash and active; remainder in destroy_class */
1390 hlist_del_init(&cl->hlist);
1391
1392 if (cl->prio_activity) 1392 if (cl->prio_activity)
1393 htb_deactivate(q, cl); 1393 htb_deactivate(q, cl);
1394 1394
diff --git a/net/sctp/associola.c b/net/sctp/associola.c
index fa82b73c965b..78d2ddb5ca18 100644
--- a/net/sctp/associola.c
+++ b/net/sctp/associola.c
@@ -1046,6 +1046,9 @@ void sctp_assoc_update(struct sctp_association *asoc,
1046 trans = list_entry(pos, struct sctp_transport, transports); 1046 trans = list_entry(pos, struct sctp_transport, transports);
1047 if (!sctp_assoc_lookup_paddr(new, &trans->ipaddr)) 1047 if (!sctp_assoc_lookup_paddr(new, &trans->ipaddr))
1048 sctp_assoc_del_peer(asoc, &trans->ipaddr); 1048 sctp_assoc_del_peer(asoc, &trans->ipaddr);
1049
1050 if (asoc->state >= SCTP_STATE_ESTABLISHED)
1051 sctp_transport_reset(trans);
1049 } 1052 }
1050 1053
1051 /* If the case is A (association restart), use 1054 /* If the case is A (association restart), use
@@ -1063,6 +1066,18 @@ void sctp_assoc_update(struct sctp_association *asoc,
1063 */ 1066 */
1064 sctp_ssnmap_clear(asoc->ssnmap); 1067 sctp_ssnmap_clear(asoc->ssnmap);
1065 1068
1069 /* Flush the ULP reassembly and ordered queue.
1070 * Any data there will now be stale and will
1071 * cause problems.
1072 */
1073 sctp_ulpq_flush(&asoc->ulpq);
1074
1075 /* reset the overall association error count so
1076 * that the restarted association doesn't get torn
1077 * down on the next retransmission timer.
1078 */
1079 asoc->overall_error_count = 0;
1080
1066 } else { 1081 } else {
1067 /* Add any peer addresses from the new association. */ 1082 /* Add any peer addresses from the new association. */
1068 list_for_each(pos, &new->peer.transport_addr_list) { 1083 list_for_each(pos, &new->peer.transport_addr_list) {
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
index 70c39eac0581..e9097cf614ba 100644
--- a/net/sctp/sm_statefuns.c
+++ b/net/sctp/sm_statefuns.c
@@ -4342,8 +4342,24 @@ sctp_disposition_t sctp_sf_do_prm_requestheartbeat(
4342 void *arg, 4342 void *arg,
4343 sctp_cmd_seq_t *commands) 4343 sctp_cmd_seq_t *commands)
4344{ 4344{
4345 return sctp_sf_heartbeat(ep, asoc, type, (struct sctp_transport *)arg, 4345 if (SCTP_DISPOSITION_NOMEM == sctp_sf_heartbeat(ep, asoc, type,
4346 commands); 4346 (struct sctp_transport *)arg, commands))
4347 return SCTP_DISPOSITION_NOMEM;
4348
4349 /*
4350 * RFC 2960 (bis), section 8.3
4351 *
4352 * D) Request an on-demand HEARTBEAT on a specific destination
4353 * transport address of a given association.
4354 *
4355 * The endpoint should increment the respective error counter of
4356 * the destination transport address each time a HEARTBEAT is sent
4357 * to that address and not acknowledged within one RTO.
4358 *
4359 */
4360 sctp_add_cmd_sf(commands, SCTP_CMD_TRANSPORT_RESET,
4361 SCTP_TRANSPORT(arg));
4362 return SCTP_DISPOSITION_CONSUME;
4347} 4363}
4348 4364
4349/* 4365/*
diff --git a/net/sctp/transport.c b/net/sctp/transport.c
index a596f5308cb1..4d8c2ab864fc 100644
--- a/net/sctp/transport.c
+++ b/net/sctp/transport.c
@@ -526,3 +526,35 @@ unsigned long sctp_transport_timeout(struct sctp_transport *t)
526 timeout += jiffies; 526 timeout += jiffies;
527 return timeout; 527 return timeout;
528} 528}
529
530/* Reset transport variables to their initial values */
531void sctp_transport_reset(struct sctp_transport *t)
532{
533 struct sctp_association *asoc = t->asoc;
534
535 /* RFC 2960 (bis), Section 5.2.4
536 * All the congestion control parameters (e.g., cwnd, ssthresh)
537 * related to this peer MUST be reset to their initial values
538 * (see Section 6.2.1)
539 */
540 t->cwnd = min(4*asoc->pathmtu, max_t(__u32, 2*asoc->pathmtu, 4380));
541 t->ssthresh = asoc->peer.i.a_rwnd;
542 t->rto = asoc->rto_initial;
543 t->rtt = 0;
544 t->srtt = 0;
545 t->rttvar = 0;
546
547 /* Reset these additional varibles so that we have a clean
548 * slate.
549 */
550 t->partial_bytes_acked = 0;
551 t->flight_size = 0;
552 t->error_count = 0;
553 t->rto_pending = 0;
554
555 /* Initialize the state information for SFR-CACC */
556 t->cacc.changeover_active = 0;
557 t->cacc.cycling_changeover = 0;
558 t->cacc.next_tsn_at_change = 0;
559 t->cacc.cacc_saw_newack = 0;
560}
diff --git a/net/sctp/ulpqueue.c b/net/sctp/ulpqueue.c
index f4759a9bdaee..bfb197e37da3 100644
--- a/net/sctp/ulpqueue.c
+++ b/net/sctp/ulpqueue.c
@@ -73,7 +73,7 @@ struct sctp_ulpq *sctp_ulpq_init(struct sctp_ulpq *ulpq,
73 73
74 74
75/* Flush the reassembly and ordering queues. */ 75/* Flush the reassembly and ordering queues. */
76static void sctp_ulpq_flush(struct sctp_ulpq *ulpq) 76void sctp_ulpq_flush(struct sctp_ulpq *ulpq)
77{ 77{
78 struct sk_buff *skb; 78 struct sk_buff *skb;
79 struct sctp_ulpevent *event; 79 struct sctp_ulpevent *event;
diff --git a/net/socket.c b/net/socket.c
index 9566e57ac7f5..ea8f81abc45c 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -1381,7 +1381,7 @@ asmlinkage long sys_accept(int fd, struct sockaddr __user *upeer_sockaddr,
1381 1381
1382 err = sock_attach_fd(newsock, newfile); 1382 err = sock_attach_fd(newsock, newfile);
1383 if (err < 0) 1383 if (err < 0)
1384 goto out_fd; 1384 goto out_fd_simple;
1385 1385
1386 err = security_socket_accept(sock, newsock); 1386 err = security_socket_accept(sock, newsock);
1387 if (err) 1387 if (err)
@@ -1414,6 +1414,11 @@ out_put:
1414 fput_light(sock->file, fput_needed); 1414 fput_light(sock->file, fput_needed);
1415out: 1415out:
1416 return err; 1416 return err;
1417out_fd_simple:
1418 sock_release(newsock);
1419 put_filp(newfile);
1420 put_unused_fd(newfd);
1421 goto out_put;
1417out_fd: 1422out_fd:
1418 fput(newfile); 1423 fput(newfile);
1419 put_unused_fd(newfd); 1424 put_unused_fd(newfd);
diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c
index f6e1eb1ea720..593f62ff8521 100644
--- a/net/sunrpc/svcsock.c
+++ b/net/sunrpc/svcsock.c
@@ -779,8 +779,8 @@ svc_udp_recvfrom(struct svc_rqst *rqstp)
779 } 779 }
780 780
781 clear_bit(SK_DATA, &svsk->sk_flags); 781 clear_bit(SK_DATA, &svsk->sk_flags);
782 while ((err == kernel_recvmsg(svsk->sk_sock, &msg, NULL, 782 while ((err = kernel_recvmsg(svsk->sk_sock, &msg, NULL,
783 0, 0, MSG_PEEK | MSG_DONTWAIT)) < 0 || 783 0, 0, MSG_PEEK | MSG_DONTWAIT)) < 0 ||
784 (skb = skb_recv_datagram(svsk->sk_sk, 0, 1, &err)) == NULL) { 784 (skb = skb_recv_datagram(svsk->sk_sk, 0, 1, &err)) == NULL) {
785 if (err == -EAGAIN) { 785 if (err == -EAGAIN) {
786 svc_sock_received(svsk); 786 svc_sock_received(svsk);
diff --git a/net/x25/x25_forward.c b/net/x25/x25_forward.c
index d339e0c810a8..8738ec7ce693 100644
--- a/net/x25/x25_forward.c
+++ b/net/x25/x25_forward.c
@@ -26,64 +26,66 @@ int x25_forward_call(struct x25_address *dest_addr, struct x25_neigh *from,
26 short same_lci = 0; 26 short same_lci = 0;
27 int rc = 0; 27 int rc = 0;
28 28
29 if ((rt = x25_get_route(dest_addr)) != NULL) { 29 if ((rt = x25_get_route(dest_addr)) == NULL)
30 goto out_no_route;
30 31
31 if ((neigh_new = x25_get_neigh(rt->dev)) == NULL) { 32 if ((neigh_new = x25_get_neigh(rt->dev)) == NULL) {
32 /* This shouldnt happen, if it occurs somehow 33 /* This shouldnt happen, if it occurs somehow
33 * do something sensible 34 * do something sensible
34 */
35 goto out_put_route;
36 }
37
38 /* Avoid a loop. This is the normal exit path for a
39 * system with only one x.25 iface and default route
40 */ 35 */
41 if (rt->dev == from->dev) { 36 goto out_put_route;
42 goto out_put_nb; 37 }
43 }
44 38
45 /* Remote end sending a call request on an already 39 /* Avoid a loop. This is the normal exit path for a
46 * established LCI? It shouldnt happen, just in case.. 40 * system with only one x.25 iface and default route
47 */ 41 */
48 read_lock_bh(&x25_forward_list_lock); 42 if (rt->dev == from->dev) {
49 list_for_each(entry, &x25_forward_list) { 43 goto out_put_nb;
50 x25_frwd = list_entry(entry, struct x25_forward, node); 44 }
51 if (x25_frwd->lci == lci) { 45
52 printk(KERN_WARNING "X.25: call request for lci which is already registered!, transmitting but not registering new pair\n"); 46 /* Remote end sending a call request on an already
53 same_lci = 1; 47 * established LCI? It shouldnt happen, just in case..
54 } 48 */
55 } 49 read_lock_bh(&x25_forward_list_lock);
56 read_unlock_bh(&x25_forward_list_lock); 50 list_for_each(entry, &x25_forward_list) {
57 51 x25_frwd = list_entry(entry, struct x25_forward, node);
58 /* Save the forwarding details for future traffic */ 52 if (x25_frwd->lci == lci) {
59 if (!same_lci){ 53 printk(KERN_WARNING "X.25: call request for lci which is already registered!, transmitting but not registering new pair\n");
60 if ((new_frwd = kmalloc(sizeof(struct x25_forward), 54 same_lci = 1;
61 GFP_ATOMIC)) == NULL){
62 rc = -ENOMEM;
63 goto out_put_nb;
64 }
65 new_frwd->lci = lci;
66 new_frwd->dev1 = rt->dev;
67 new_frwd->dev2 = from->dev;
68 write_lock_bh(&x25_forward_list_lock);
69 list_add(&new_frwd->node, &x25_forward_list);
70 write_unlock_bh(&x25_forward_list_lock);
71 } 55 }
56 }
57 read_unlock_bh(&x25_forward_list_lock);
72 58
73 /* Forward the call request */ 59 /* Save the forwarding details for future traffic */
74 if ( (skbn = skb_clone(skb, GFP_ATOMIC)) == NULL){ 60 if (!same_lci){
61 if ((new_frwd = kmalloc(sizeof(struct x25_forward),
62 GFP_ATOMIC)) == NULL){
63 rc = -ENOMEM;
75 goto out_put_nb; 64 goto out_put_nb;
76 } 65 }
77 x25_transmit_link(skbn, neigh_new); 66 new_frwd->lci = lci;
78 rc = 1; 67 new_frwd->dev1 = rt->dev;
68 new_frwd->dev2 = from->dev;
69 write_lock_bh(&x25_forward_list_lock);
70 list_add(&new_frwd->node, &x25_forward_list);
71 write_unlock_bh(&x25_forward_list_lock);
79 } 72 }
80 73
74 /* Forward the call request */
75 if ( (skbn = skb_clone(skb, GFP_ATOMIC)) == NULL){
76 goto out_put_nb;
77 }
78 x25_transmit_link(skbn, neigh_new);
79 rc = 1;
80
81 81
82out_put_nb: 82out_put_nb:
83 x25_neigh_put(neigh_new); 83 x25_neigh_put(neigh_new);
84 84
85out_put_route: 85out_put_route:
86 x25_route_put(rt); 86 x25_route_put(rt);
87
88out_no_route:
87 return rc; 89 return rc;
88} 90}
89 91
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index 0c3a70ac5075..785c3e39f062 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -2089,7 +2089,7 @@ void xfrm_audit_log(uid_t auid, u32 sid, int type, int result,
2089 sizeof(struct in6_addr)); 2089 sizeof(struct in6_addr));
2090 } 2090 }
2091 audit_log_format(audit_buf, 2091 audit_log_format(audit_buf,
2092 " src=" NIP6_FMT "dst=" NIP6_FMT, 2092 " src=" NIP6_FMT " dst=" NIP6_FMT,
2093 NIP6(saddr6), NIP6(daddr6)); 2093 NIP6(saddr6), NIP6(daddr6));
2094 } 2094 }
2095 break; 2095 break;
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
index 5c5f6dcab974..e3a0bcfa5df1 100644
--- a/net/xfrm/xfrm_state.c
+++ b/net/xfrm/xfrm_state.c
@@ -1371,7 +1371,8 @@ int xfrm_replay_check(struct xfrm_state *x, __be32 net_seq)
1371 return 0; 1371 return 0;
1372 1372
1373 diff = x->replay.seq - seq; 1373 diff = x->replay.seq - seq;
1374 if (diff >= x->props.replay_window) { 1374 if (diff >= min_t(unsigned int, x->props.replay_window,
1375 sizeof(x->replay.bitmap) * 8)) {
1375 x->stats.replay_window++; 1376 x->stats.replay_window++;
1376 return -EINVAL; 1377 return -EINVAL;
1377 } 1378 }
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
index 96789952f6a3..e81e2fb3d429 100644
--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -2025,7 +2025,7 @@ nlmsg_failure:
2025 return -1; 2025 return -1;
2026} 2026}
2027 2027
2028static int inline xfrm_sa_len(struct xfrm_state *x) 2028static inline int xfrm_sa_len(struct xfrm_state *x)
2029{ 2029{
2030 int l = 0; 2030 int l = 0;
2031 if (x->aalg) 2031 if (x->aalg)
diff --git a/scripts/basic/fixdep.c b/scripts/basic/fixdep.c
index 668a11a8b383..6bc7e7cfccf6 100644
--- a/scripts/basic/fixdep.c
+++ b/scripts/basic/fixdep.c
@@ -28,9 +28,11 @@
28 * the dependency on linux/autoconf.h by a dependency on every config 28 * the dependency on linux/autoconf.h by a dependency on every config
29 * option which is mentioned in any of the listed prequisites. 29 * option which is mentioned in any of the listed prequisites.
30 * 30 *
31 * To be exact, split-include populates a tree in include/config/, 31 * kconfig populates a tree in include/config/ with an empty file
32 * e.g. include/config/his/driver.h, which contains the #define/#undef 32 * for each config symbol and when the configuration is updated
33 * for the CONFIG_HIS_DRIVER option. 33 * the files representing changed config options are touched
34 * which then let make pick up the changes and the files that use
35 * the config symbols are rebuilt.
34 * 36 *
35 * So if the user changes his CONFIG_HIS_DRIVER option, only the objects 37 * So if the user changes his CONFIG_HIS_DRIVER option, only the objects
36 * which depend on "include/linux/config/his/driver.h" will be rebuilt, 38 * which depend on "include/linux/config/his/driver.h" will be rebuilt,
@@ -245,6 +247,8 @@ void parse_config_file(char *map, size_t len)
245 continue; 247 continue;
246 248
247 found: 249 found:
250 if (!memcmp(q - 7, "_MODULE", 7))
251 q -= 7;
248 use_config(p+7, q-p-7); 252 use_config(p+7, q-p-7);
249 } 253 }
250} 254}