aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.mailmap96
-rw-r--r--Documentation/kernel-parameters.txt8
-rw-r--r--Documentation/x86_64/boot-options.txt132
-rw-r--r--Documentation/x86_64/cpu-hotplug-spec2
-rw-r--r--Documentation/x86_64/kernel-stacks26
-rw-r--r--Documentation/x86_64/machinecheck70
-rw-r--r--Documentation/x86_64/mm.txt22
-rw-r--r--MAINTAINERS6
-rw-r--r--Makefile11
-rw-r--r--arch/arm/kernel/isa.c2
-rw-r--r--arch/frv/kernel/pm.c53
-rw-r--r--arch/frv/kernel/sysctl.c32
-rw-r--r--arch/i386/Kconfig18
-rw-r--r--arch/i386/Kconfig.cpu5
-rw-r--r--arch/i386/Kconfig.debug2
-rw-r--r--arch/i386/defconfig51
-rw-r--r--arch/i386/kernel/Makefile3
-rw-r--r--arch/i386/kernel/apic.c6
-rw-r--r--arch/i386/kernel/apm.c26
-rw-r--r--arch/i386/kernel/asm-offsets.c2
-rw-r--r--arch/i386/kernel/cpu/common.c14
-rw-r--r--arch/i386/kernel/cpu/cyrix.c52
-rw-r--r--arch/i386/kernel/cpu/mcheck/mce.c1
-rw-r--r--arch/i386/kernel/cpu/mcheck/mce.h2
-rw-r--r--arch/i386/kernel/cpu/mcheck/p4.c2
-rw-r--r--arch/i386/kernel/cpu/mtrr/if.c30
-rw-r--r--arch/i386/kernel/cpu/mtrr/main.c6
-rw-r--r--arch/i386/kernel/cpu/mtrr/mtrr.h2
-rw-r--r--arch/i386/kernel/cpu/proc.c14
-rw-r--r--arch/i386/kernel/cpu/transmeta.c5
-rw-r--r--arch/i386/kernel/cpuid.c7
-rw-r--r--arch/i386/kernel/e820.c18
-rw-r--r--arch/i386/kernel/entry.S78
-rw-r--r--arch/i386/kernel/head.S38
-rw-r--r--arch/i386/kernel/io_apic.c4
-rw-r--r--arch/i386/kernel/irq.c3
-rw-r--r--arch/i386/kernel/kprobes.c6
-rw-r--r--arch/i386/kernel/microcode.c2
-rw-r--r--arch/i386/kernel/msr.c13
-rw-r--r--arch/i386/kernel/nmi.c98
-rw-r--r--arch/i386/kernel/paravirt.c116
-rw-r--r--arch/i386/kernel/pcspeaker.c20
-rw-r--r--arch/i386/kernel/process.c99
-rw-r--r--arch/i386/kernel/ptrace.c16
-rw-r--r--arch/i386/kernel/setup.c35
-rw-r--r--arch/i386/kernel/signal.c16
-rw-r--r--arch/i386/kernel/smp.c7
-rw-r--r--arch/i386/kernel/smpboot.c16
-rw-r--r--arch/i386/kernel/sysenter.c2
-rw-r--r--arch/i386/kernel/time.c14
-rw-r--r--arch/i386/kernel/traps.c27
-rw-r--r--arch/i386/kernel/tsc.c26
-rw-r--r--arch/i386/kernel/vm86.c33
-rw-r--r--arch/i386/kernel/vmi.c949
-rw-r--r--arch/i386/kernel/vmitime.c499
-rw-r--r--arch/i386/kernel/vmlinux.lds.S7
-rw-r--r--arch/i386/math-emu/get_address.c14
-rw-r--r--arch/i386/math-emu/status_w.h8
-rw-r--r--arch/i386/mm/discontig.c1
-rw-r--r--arch/i386/mm/fault.c18
-rw-r--r--arch/i386/mm/init.c4
-rw-r--r--arch/i386/mm/pageattr.c2
-rw-r--r--arch/i386/mm/pgtable.c26
-rw-r--r--arch/i386/oprofile/op_model_ppro.c9
-rw-r--r--arch/i386/pci/Makefile2
-rw-r--r--arch/i386/pci/mmconfig-shared.c264
-rw-r--r--arch/i386/pci/mmconfig.c96
-rw-r--r--arch/i386/pci/pci.h10
-rw-r--r--arch/ia64/kernel/crash.c2
-rw-r--r--arch/ia64/kernel/irq_ia64.c2
-rw-r--r--arch/ia64/kernel/perfmon.c58
-rw-r--r--arch/ia64/sn/kernel/xpc_main.c88
-rw-r--r--arch/m68k/atari/stdma.c2
-rw-r--r--arch/mips/au1000/common/power.c46
-rw-r--r--arch/mips/lasat/sysctl.c147
-rw-r--r--arch/powerpc/kernel/idle.c13
-rw-r--r--arch/ppc/kernel/ppc_htab.c13
-rw-r--r--arch/ppc/syslib/i8259.c2
-rw-r--r--arch/s390/appldata/appldata.h3
-rw-r--r--arch/s390/appldata/appldata_base.c4
-rw-r--r--arch/s390/kernel/debug.c3
-rw-r--r--arch/s390/mm/cmm.c6
-rw-r--r--arch/sh64/kernel/traps.c51
-rw-r--r--arch/x86_64/Kconfig22
-rw-r--r--arch/x86_64/defconfig45
-rw-r--r--arch/x86_64/ia32/ia32_binfmt.c30
-rw-r--r--arch/x86_64/ia32/ia32_signal.c11
-rw-r--r--arch/x86_64/ia32/ia32entry.S1
-rw-r--r--arch/x86_64/kernel/Makefile2
-rw-r--r--arch/x86_64/kernel/acpi/sleep.c2
-rw-r--r--arch/x86_64/kernel/e820.c38
-rw-r--r--arch/x86_64/kernel/head.S20
-rw-r--r--arch/x86_64/kernel/io_apic.c24
-rw-r--r--arch/x86_64/kernel/ioport.c2
-rw-r--r--arch/x86_64/kernel/irq.c12
-rw-r--r--arch/x86_64/kernel/mce.c66
-rw-r--r--arch/x86_64/kernel/mce_amd.c44
-rw-r--r--arch/x86_64/kernel/nmi.c75
-rw-r--r--arch/x86_64/kernel/pci-calgary.c17
-rw-r--r--arch/x86_64/kernel/pci-dma.c28
-rw-r--r--arch/x86_64/kernel/pci-gart.c4
-rw-r--r--arch/x86_64/kernel/ptrace.c8
-rw-r--r--arch/x86_64/kernel/setup.c169
-rw-r--r--arch/x86_64/kernel/setup64.c1
-rw-r--r--arch/x86_64/kernel/stacktrace.c5
-rw-r--r--arch/x86_64/kernel/time.c14
-rw-r--r--arch/x86_64/kernel/vsyscall.c6
-rw-r--r--arch/x86_64/kernel/x8664_ksyms.c5
-rw-r--r--arch/x86_64/lib/Makefile2
-rw-r--r--arch/x86_64/lib/copy_user_nocache.S217
-rw-r--r--arch/x86_64/mm/fault.c18
-rw-r--r--arch/x86_64/mm/init.c24
-rw-r--r--arch/x86_64/mm/numa.c202
-rw-r--r--arch/x86_64/mm/pageattr.c4
-rw-r--r--arch/x86_64/pci/Makefile3
-rw-r--r--arch/x86_64/pci/mmconfig.c116
-rw-r--r--drivers/acorn/block/mfmhd.c1
-rw-r--r--drivers/acorn/char/i2c.c1
-rw-r--r--drivers/acpi/i2c_ec.c1
-rw-r--r--drivers/acpi/namespace/nsinit.c9
-rw-r--r--drivers/acpi/sleep/poweroff.c1
-rw-r--r--drivers/acpi/tables.c1
-rw-r--r--drivers/acpi/thermal.c3
-rw-r--r--drivers/ata/ahci.c1
-rw-r--r--drivers/ata/pata_mpiix.c2
-rw-r--r--drivers/ata/pata_pcmcia.c2
-rw-r--r--drivers/ata/pata_pdc2027x.c2
-rw-r--r--drivers/ata/pdc_adma.c1
-rw-r--r--drivers/ata/sata_inic162x.c2
-rw-r--r--drivers/ata/sata_mv.c1
-rw-r--r--drivers/ata/sata_promise.c1
-rw-r--r--drivers/ata/sata_qstor.c1
-rw-r--r--drivers/ata/sata_sx4.c1
-rw-r--r--drivers/atm/adummy.c1
-rw-r--r--drivers/atm/fore200e.c1
-rw-r--r--drivers/atm/idt77105.c1
-rw-r--r--drivers/atm/uPD98402.c1
-rw-r--r--drivers/atm/zatm.c1
-rw-r--r--drivers/block/acsi.c1
-rw-r--r--drivers/block/paride/pd.c1
-rw-r--r--drivers/block/umem.c1
-rw-r--r--drivers/bluetooth/bfusb.c1
-rw-r--r--drivers/bluetooth/bt3c_cs.c1
-rw-r--r--drivers/bluetooth/btuart_cs.c1
-rw-r--r--drivers/bluetooth/dtl1_cs.c1
-rw-r--r--drivers/bluetooth/hci_bcsp.c1
-rw-r--r--drivers/bluetooth/hci_h4.c1
-rw-r--r--drivers/bluetooth/hci_ldisc.c1
-rw-r--r--drivers/bluetooth/hci_usb.c1
-rw-r--r--drivers/cdrom/aztcd.c1
-rw-r--r--drivers/cdrom/cdrom.c4
-rw-r--r--drivers/cdrom/cm206.c1
-rw-r--r--drivers/cdrom/gscd.c1
-rw-r--r--drivers/cdrom/sjcd.c1
-rw-r--r--drivers/char/briq_panel.c1
-rw-r--r--drivers/char/drm/ffb_context.c1
-rw-r--r--drivers/char/drm/ffb_drv.c1
-rw-r--r--drivers/char/ds1620.c1
-rw-r--r--drivers/char/dsp56k.c1
-rw-r--r--drivers/char/hpet.c6
-rw-r--r--drivers/char/hvsi.c1
-rw-r--r--drivers/char/ipmi/ipmi_devintf.c1
-rw-r--r--drivers/char/ipmi/ipmi_msghandler.c1
-rw-r--r--drivers/char/ipmi/ipmi_poweroff.c2
-rw-r--r--drivers/char/nvram.c1
-rw-r--r--drivers/char/nwflash.c1
-rw-r--r--drivers/char/pty.c1
-rw-r--r--drivers/char/rtc.c8
-rw-r--r--drivers/char/ser_a2232.c1
-rw-r--r--drivers/char/sonypi.c1
-rw-r--r--drivers/char/tlclk.c1
-rw-r--r--drivers/char/toshiba.c1
-rw-r--r--drivers/char/tpm/tpm.c1
-rw-r--r--drivers/char/vc_screen.c1
-rw-r--r--drivers/char/vme_scc.c1
-rw-r--r--drivers/char/watchdog/rm9k_wdt.c2
-rw-r--r--drivers/cpufreq/cpufreq_conservative.c1
-rw-r--r--drivers/crypto/geode-aes.c1
-rw-r--r--drivers/fc4/fc_syms.c1
-rw-r--r--drivers/fc4/soc.c1
-rw-r--r--drivers/fc4/socal.c1
-rw-r--r--drivers/hid/hid-core.c1
-rw-r--r--drivers/i2c/busses/i2c-ali1535.c1
-rw-r--r--drivers/i2c/busses/i2c-ali15x3.c1
-rw-r--r--drivers/i2c/busses/i2c-amd756.c1
-rw-r--r--drivers/i2c/busses/i2c-amd8111.c1
-rw-r--r--drivers/i2c/busses/i2c-i801.c1
-rw-r--r--drivers/i2c/busses/i2c-iop3xx.c1
-rw-r--r--drivers/i2c/busses/i2c-nforce2.c1
-rw-r--r--drivers/i2c/busses/i2c-ocores.c1
-rw-r--r--drivers/i2c/busses/i2c-piix4.c1
-rw-r--r--drivers/i2c/busses/i2c-s3c2410.c1
-rw-r--r--drivers/i2c/busses/i2c-sis96x.c1
-rw-r--r--drivers/i2c/chips/eeprom.c1
-rw-r--r--drivers/ide/ide-proc.c1
-rw-r--r--drivers/ide/legacy/ide-cs.c1
-rw-r--r--drivers/ide/ppc/mpc8xx.c1
-rw-r--r--drivers/ide/ppc/pmac.c1
-rw-r--r--drivers/ieee1394/eth1394.c1
-rw-r--r--drivers/ieee1394/iso.c1
-rw-r--r--drivers/ieee1394/ohci1394.c1
-rw-r--r--drivers/infiniband/core/cache.c1
-rw-r--r--drivers/infiniband/hw/amso1100/c2.c2
-rw-r--r--drivers/infiniband/hw/ehca/ehca_eq.c4
-rw-r--r--drivers/input/ff-memless.c2
-rw-r--r--drivers/input/input.c1
-rw-r--r--drivers/input/keyboard/gpio_keys.c2
-rw-r--r--drivers/input/mouse/rpcmouse.c1
-rw-r--r--drivers/input/serio/hil_mlc.c1
-rw-r--r--drivers/input/serio/hp_sdc.c1
-rw-r--r--drivers/isdn/capi/capidrv.c1
-rw-r--r--drivers/isdn/hardware/avm/avm_cs.c1
-rw-r--r--drivers/isdn/hardware/eicon/divamnt.c1
-rw-r--r--drivers/isdn/hardware/eicon/divasmain.c1
-rw-r--r--drivers/isdn/hisax/avma1_cs.c1
-rw-r--r--drivers/isdn/hisax/elsa_cs.c1
-rw-r--r--drivers/isdn/hisax/hfc_usb.c1
-rw-r--r--drivers/isdn/hisax/sedlbauer_cs.c1
-rw-r--r--drivers/isdn/hisax/teles_cs.c1
-rw-r--r--drivers/isdn/hysdn/boardergo.c1
-rw-r--r--drivers/isdn/hysdn/hysdn_sched.c1
-rw-r--r--drivers/isdn/i4l/isdn_bsdcomp.c1
-rw-r--r--drivers/isdn/pcbit/callbacks.c1
-rw-r--r--drivers/isdn/pcbit/capi.c1
-rw-r--r--drivers/isdn/pcbit/drv.c1
-rw-r--r--drivers/isdn/pcbit/edss1.c1
-rw-r--r--drivers/isdn/pcbit/layer2.c1
-rw-r--r--drivers/isdn/pcbit/module.c1
-rw-r--r--drivers/kvm/vmx.c12
-rw-r--r--drivers/macintosh/mac_hid.c2
-rw-r--r--drivers/macintosh/macio-adb.c1
-rw-r--r--drivers/macintosh/via-cuda.c1
-rw-r--r--drivers/macintosh/via-macii.c1
-rw-r--r--drivers/macintosh/via-maciisi.c1
-rw-r--r--drivers/macintosh/via-pmu68k.c1
-rw-r--r--drivers/md/md.c2
-rw-r--r--drivers/media/dvb/dvb-core/dmxdev.c1
-rw-r--r--drivers/media/dvb/dvb-core/dvbdev.c1
-rw-r--r--drivers/media/dvb/ttpci/av7110_av.c1
-rw-r--r--drivers/media/dvb/ttpci/av7110_ca.c1
-rw-r--r--drivers/media/dvb/ttpci/av7110_hw.c1
-rw-r--r--drivers/media/dvb/ttpci/av7110_v4l.c1
-rw-r--r--drivers/media/radio/miropcm20-rds.c1
-rw-r--r--drivers/media/radio/radio-maestro.c1
-rw-r--r--drivers/media/radio/radio-maxiradio.c1
-rw-r--r--drivers/media/video/adv7170.c1
-rw-r--r--drivers/media/video/adv7175.c1
-rw-r--r--drivers/media/video/bt819.c1
-rw-r--r--drivers/media/video/bt856.c1
-rw-r--r--drivers/media/video/bt8xx/bttv-vbi.c1
-rw-r--r--drivers/media/video/cx88/cx88-tvaudio.c1
-rw-r--r--drivers/media/video/em28xx/em28xx-input.c1
-rw-r--r--drivers/media/video/indycam.c1
-rw-r--r--drivers/media/video/ir-kbd-i2c.c1
-rw-r--r--drivers/media/video/meye.c1
-rw-r--r--drivers/media/video/pms.c1
-rw-r--r--drivers/media/video/saa5246a.c1
-rw-r--r--drivers/media/video/saa7111.c1
-rw-r--r--drivers/media/video/saa7114.c1
-rw-r--r--drivers/media/video/saa711x.c1
-rw-r--r--drivers/media/video/saa7134/saa6752hs.c1
-rw-r--r--drivers/media/video/saa7134/saa7134-input.c1
-rw-r--r--drivers/media/video/saa7185.c1
-rw-r--r--drivers/media/video/saa7191.c1
-rw-r--r--drivers/media/video/tda7432.c1
-rw-r--r--drivers/media/video/tda9875.c1
-rw-r--r--drivers/media/video/tuner-core.c1
-rw-r--r--drivers/media/video/tvmixer.c1
-rw-r--r--drivers/media/video/usbvideo/ibmcam.c1
-rw-r--r--drivers/media/video/usbvideo/ultracam.c1
-rw-r--r--drivers/media/video/usbvision/usbvision-core.c1
-rw-r--r--drivers/media/video/usbvision/usbvision-i2c.c1
-rw-r--r--drivers/media/video/usbvision/usbvision-video.c1
-rw-r--r--drivers/media/video/v4l2-common.c1
-rw-r--r--drivers/media/video/videodev.c1
-rw-r--r--drivers/message/fusion/mptfc.c1
-rw-r--r--drivers/message/fusion/mptsas.c2
-rw-r--r--drivers/message/fusion/mptscsih.c1
-rw-r--r--drivers/message/fusion/mptspi.c1
-rw-r--r--drivers/misc/tifm_7xx1.c2
-rw-r--r--drivers/mmc/mmc_block.c1
-rw-r--r--drivers/mtd/chips/cfi_util.c1
-rw-r--r--drivers/mtd/devices/doc2001.c1
-rw-r--r--drivers/mtd/devices/doc2001plus.c1
-rw-r--r--drivers/mtd/devices/docecc.c1
-rw-r--r--drivers/mtd/devices/pmc551.c1
-rw-r--r--drivers/mtd/devices/slram.c1
-rw-r--r--drivers/mtd/ftl.c1
-rw-r--r--drivers/mtd/inftlmount.c1
-rw-r--r--drivers/mtd/mtdcore.c1
-rw-r--r--drivers/mtd/nand/cafe.c3
-rw-r--r--drivers/mtd/nftlcore.c1
-rw-r--r--drivers/net/7990.c2
-rw-r--r--drivers/net/arm/ether1.c1
-rw-r--r--drivers/net/arm/ether3.c1
-rw-r--r--drivers/net/arm/etherh.c1
-rw-r--r--drivers/net/au1000_eth.c1
-rw-r--r--drivers/net/bonding/bond_main.c1
-rw-r--r--drivers/net/bonding/bond_sysfs.c1
-rw-r--r--drivers/net/cris/eth_v10.c1
-rw-r--r--drivers/net/cxgb3/cxgb3_main.c3
-rw-r--r--drivers/net/ehea/ehea_main.c8
-rw-r--r--drivers/net/fec_8xx/fec_8xx-netta.c1
-rw-r--r--drivers/net/fec_8xx/fec_main.c1
-rw-r--r--drivers/net/fec_8xx/fec_mii.c1
-rw-r--r--drivers/net/fs_enet/fs_enet-main.c1
-rw-r--r--drivers/net/fs_enet/mac-fcc.c1
-rw-r--r--drivers/net/fs_enet/mac-fec.c1
-rw-r--r--drivers/net/fs_enet/mac-scc.c1
-rw-r--r--drivers/net/fs_enet/mii-bitbang.c1
-rw-r--r--drivers/net/fs_enet/mii-fec.c1
-rw-r--r--drivers/net/gianfar.c1
-rw-r--r--drivers/net/gianfar_ethtool.c1
-rw-r--r--drivers/net/gianfar_mii.c1
-rw-r--r--drivers/net/gianfar_sysfs.c1
-rw-r--r--drivers/net/ibm_emac/ibm_emac_core.c1
-rw-r--r--drivers/net/irda/ma600-sir.c1
-rw-r--r--drivers/net/macb.c2
-rw-r--r--drivers/net/meth.c1
-rw-r--r--drivers/net/mipsnet.c1
-rw-r--r--drivers/net/netxen/netxen_nic_main.c4
-rw-r--r--drivers/net/phy/cicada.c1
-rw-r--r--drivers/net/phy/davicom.c1
-rw-r--r--drivers/net/phy/fixed.c1
-rw-r--r--drivers/net/phy/lxt.c1
-rw-r--r--drivers/net/phy/marvell.c1
-rw-r--r--drivers/net/phy/mdio_bus.c1
-rw-r--r--drivers/net/phy/phy.c1
-rw-r--r--drivers/net/phy/phy_device.c1
-rw-r--r--drivers/net/phy/qsemi.c1
-rwxr-xr-xdrivers/net/qla3xxx.c4
-rw-r--r--drivers/net/s2io.c1
-rw-r--r--drivers/net/sc92031.c2
-rw-r--r--drivers/net/sungem_phy.c1
-rw-r--r--drivers/net/tsi108_eth.c1
-rw-r--r--drivers/net/ucc_geth.c4
-rw-r--r--drivers/net/ucc_geth_phy.c1
-rw-r--r--drivers/net/wan/cycx_drv.c1
-rw-r--r--drivers/net/wan/pci200syn.c1
-rw-r--r--drivers/net/wireless/arlan-proc.c4
-rw-r--r--drivers/net/wireless/atmel.c1
-rw-r--r--drivers/net/wireless/bcm43xx/bcm43xx_wx.c1
-rw-r--r--drivers/parisc/eisa.c1
-rw-r--r--drivers/parport/parport_cs.c1
-rw-r--r--drivers/parport/parport_gsc.c1
-rw-r--r--drivers/parport/procfs.c270
-rw-r--r--drivers/pci/hotplug/ibmphp_ebda.c1
-rw-r--r--drivers/pci/pcie/aer/aerdrv.c2
-rw-r--r--drivers/pci/syscall.c1
-rw-r--r--drivers/pcmcia/at91_cf.c1
-rw-r--r--drivers/pcmcia/cistpl.c1
-rw-r--r--drivers/pcmcia/i82365.c1
-rw-r--r--drivers/pcmcia/m32r_cfc.c1
-rw-r--r--drivers/pcmcia/m32r_pcc.c1
-rw-r--r--drivers/pcmcia/m8xx_pcmcia.c1
-rw-r--r--drivers/pcmcia/omap_cf.c1
-rw-r--r--drivers/pcmcia/pxa2xx_lubbock.c1
-rw-r--r--drivers/pcmcia/sa1100_badge4.c1
-rw-r--r--drivers/pcmcia/sa1100_cerf.c1
-rw-r--r--drivers/pcmcia/sa1100_h3600.c1
-rw-r--r--drivers/pcmcia/sa1100_jornada720.c1
-rw-r--r--drivers/pcmcia/sa1100_neponset.c1
-rw-r--r--drivers/pcmcia/sa1100_shannon.c1
-rw-r--r--drivers/pcmcia/sa1100_simpad.c1
-rw-r--r--drivers/pcmcia/vrc4171_card.c1
-rw-r--r--drivers/pcmcia/yenta_socket.c1
-rw-r--r--drivers/rapidio/rio-sysfs.c1
-rw-r--r--drivers/rtc/rtc-omap.c4
-rw-r--r--drivers/rtc/rtc-s3c.c4
-rw-r--r--drivers/s390/char/sclp_tty.c1
-rw-r--r--drivers/s390/char/sclp_vt220.c1
-rw-r--r--drivers/s390/net/ctcmain.c1
-rw-r--r--drivers/s390/net/netiucv.c1
-rw-r--r--drivers/sbus/char/cpwatchdog.c1
-rw-r--r--drivers/sbus/char/openprom.c1
-rw-r--r--drivers/sbus/char/uctrl.c1
-rw-r--r--drivers/sbus/char/vfc_dev.c1
-rw-r--r--drivers/scsi/53c700.c1
-rw-r--r--drivers/scsi/NCR53c406a.c1
-rw-r--r--drivers/scsi/a2091.c1
-rw-r--r--drivers/scsi/a3000.c1
-rw-r--r--drivers/scsi/aacraid/aachba.c1
-rw-r--r--drivers/scsi/aacraid/commctrl.c1
-rw-r--r--drivers/scsi/aacraid/comminit.c1
-rw-r--r--drivers/scsi/aacraid/dpcsup.c1
-rw-r--r--drivers/scsi/aacraid/rx.c1
-rw-r--r--drivers/scsi/aacraid/sa.c1
-rw-r--r--drivers/scsi/aha152x.c1
-rw-r--r--drivers/scsi/aic7xxx_old.c1
-rw-r--r--drivers/scsi/aic94xx/aic94xx_init.c2
-rw-r--r--drivers/scsi/amiga7xx.c1
-rw-r--r--drivers/scsi/arcmsr/arcmsr_hba.c2
-rw-r--r--drivers/scsi/arm/acornscsi.c1
-rw-r--r--drivers/scsi/arm/arxescsi.c1
-rw-r--r--drivers/scsi/arm/cumana_1.c1
-rw-r--r--drivers/scsi/arm/cumana_2.c1
-rw-r--r--drivers/scsi/arm/ecoscsi.c1
-rw-r--r--drivers/scsi/arm/eesox.c1
-rw-r--r--drivers/scsi/arm/fas216.c1
-rw-r--r--drivers/scsi/arm/oak.c1
-rw-r--r--drivers/scsi/arm/powertec.c1
-rw-r--r--drivers/scsi/atari_scsi.c1
-rw-r--r--drivers/scsi/bvme6000.c1
-rw-r--r--drivers/scsi/ch.c1
-rw-r--r--drivers/scsi/dtc.c1
-rw-r--r--drivers/scsi/eata_pio.c1
-rw-r--r--drivers/scsi/g_NCR5380.c1
-rw-r--r--drivers/scsi/gdth.c1
-rw-r--r--drivers/scsi/gvp11.c1
-rw-r--r--drivers/scsi/ibmvscsi/ibmvstgt.c2
-rw-r--r--drivers/scsi/initio.c1
-rw-r--r--drivers/scsi/lasi700.c1
-rw-r--r--drivers/scsi/mac_scsi.c1
-rw-r--r--drivers/scsi/mvme147.c1
-rw-r--r--drivers/scsi/mvme16x.c1
-rw-r--r--drivers/scsi/nsp32.c1
-rw-r--r--drivers/scsi/pas16.c1
-rw-r--r--drivers/scsi/pcmcia/aha152x_stub.c1
-rw-r--r--drivers/scsi/pcmcia/fdomain_stub.c1
-rw-r--r--drivers/scsi/pcmcia/nsp_cs.c1
-rw-r--r--drivers/scsi/pcmcia/qlogic_stub.c1
-rw-r--r--drivers/scsi/pcmcia/sym53c500_cs.c1
-rw-r--r--drivers/scsi/qla1280.c1
-rw-r--r--drivers/scsi/qla4xxx/ql4_os.c2
-rw-r--r--drivers/scsi/scsi.c1
-rw-r--r--drivers/scsi/scsi_debug.c1
-rw-r--r--drivers/scsi/scsi_sysctl.c2
-rw-r--r--drivers/scsi/scsi_transport_fc.c1
-rw-r--r--drivers/scsi/sd.c1
-rw-r--r--drivers/scsi/sr.c1
-rw-r--r--drivers/scsi/sr_ioctl.c1
-rw-r--r--drivers/scsi/stex.c1
-rw-r--r--drivers/scsi/sun3_scsi.c1
-rw-r--r--drivers/scsi/sun3_scsi_vme.c1
-rw-r--r--drivers/scsi/sym53c416.c1
-rw-r--r--drivers/scsi/t128.c1
-rw-r--r--drivers/scsi/tmscsim.c1
-rw-r--r--drivers/scsi/wd33c93.c1
-rw-r--r--drivers/serial/8250.c178
-rw-r--r--drivers/serial/8250_acorn.c3
-rw-r--r--drivers/serial/8250_pci.c6
-rw-r--r--drivers/serial/8250_pnp.c8
-rw-r--r--drivers/serial/Kconfig16
-rw-r--r--drivers/serial/Makefile1
-rw-r--r--drivers/serial/icom.c5
-rw-r--r--drivers/serial/ioc3_serial.c6
-rw-r--r--drivers/serial/ioc4_serial.c9
-rw-r--r--drivers/serial/ip22zilog.c9
-rw-r--r--drivers/serial/jsm/jsm_driver.c6
-rw-r--r--drivers/serial/jsm/jsm_tty.c12
-rw-r--r--drivers/serial/pnx8xxx_uart.c852
-rw-r--r--drivers/serial/serial_core.c18
-rw-r--r--drivers/serial/serial_cs.c4
-rw-r--r--drivers/serial/sunsab.c1
-rw-r--r--drivers/serial/sunsu.c1
-rw-r--r--drivers/serial/sunzilog.c1
-rw-r--r--drivers/spi/Kconfig7
-rw-r--r--drivers/spi/Makefile1
-rw-r--r--drivers/spi/atmel_spi.c678
-rw-r--r--drivers/spi/atmel_spi.h167
-rw-r--r--drivers/tc/lk201.c1
-rw-r--r--drivers/telephony/ixj_pcmcia.c1
-rw-r--r--drivers/usb/gadget/at91_udc.c1
-rw-r--r--drivers/usb/gadget/dummy_hcd.c1
-rw-r--r--drivers/usb/gadget/ether.c1
-rw-r--r--drivers/usb/gadget/goku_udc.c1
-rw-r--r--drivers/usb/gadget/net2280.c1
-rw-r--r--drivers/usb/gadget/omap_udc.c1
-rw-r--r--drivers/usb/gadget/pxa2xx_udc.c3
-rw-r--r--drivers/usb/gadget/serial.c1
-rw-r--r--drivers/usb/gadget/zero.c1
-rw-r--r--drivers/usb/host/hc_crisv10.c1
-rw-r--r--drivers/usb/host/ohci-ep93xx.c2
-rw-r--r--drivers/usb/host/ohci-pnx4008.c2
-rw-r--r--drivers/usb/host/ohci-pnx8550.c2
-rw-r--r--drivers/usb/host/sl811_cs.c1
-rw-r--r--drivers/usb/host/uhci-hcd.c1
-rw-r--r--drivers/usb/image/microtek.c1
-rw-r--r--drivers/usb/input/aiptek.c1
-rw-r--r--drivers/usb/input/hid-core.c1
-rw-r--r--drivers/usb/input/hid-pidff.c1
-rw-r--r--drivers/usb/misc/sisusbvga/sisusb.c1
-rw-r--r--drivers/usb/misc/sisusbvga/sisusb_con.c1
-rw-r--r--drivers/usb/net/asix.c1
-rw-r--r--drivers/usb/net/cdc_ether.c1
-rw-r--r--drivers/usb/net/cdc_subset.c1
-rw-r--r--drivers/usb/net/gl620a.c1
-rw-r--r--drivers/usb/net/kaweth.c1
-rw-r--r--drivers/usb/net/net1080.c1
-rw-r--r--drivers/usb/net/plusb.c1
-rw-r--r--drivers/usb/net/rndis_host.c1
-rw-r--r--drivers/usb/net/rtl8150.c1
-rw-r--r--drivers/usb/net/usbnet.c1
-rw-r--r--drivers/usb/net/zaurus.c1
-rw-r--r--drivers/usb/storage/datafab.c1
-rw-r--r--drivers/usb/storage/initializers.c1
-rw-r--r--drivers/usb/storage/jumpshot.c1
-rw-r--r--drivers/usb/storage/sddr09.c1
-rw-r--r--drivers/usb/storage/shuttle_usbat.c1
-rw-r--r--drivers/video/atafb.c1
-rw-r--r--drivers/video/aty/mach64_accel.c1
-rw-r--r--drivers/video/aty/mach64_gx.c1
-rw-r--r--drivers/video/aty/radeon_i2c.c1
-rw-r--r--drivers/video/console/fbcon.c1
-rw-r--r--drivers/video/console/mdacon.c1
-rw-r--r--drivers/video/console/vgacon.c1
-rw-r--r--drivers/video/fbmem.c1
-rw-r--r--drivers/video/g364fb.c1
-rw-r--r--drivers/video/hitfb.c1
-rw-r--r--drivers/video/hpfb.c1
-rw-r--r--drivers/video/i810/i810-i2c.c1
-rw-r--r--drivers/video/imxfb.c1
-rw-r--r--drivers/video/intelfb/intelfb_i2c.c1
-rw-r--r--drivers/video/intelfb/intelfbhw.c3
-rw-r--r--drivers/video/kyro/fbdev.c1
-rw-r--r--drivers/video/macfb.c1
-rw-r--r--drivers/video/maxinefb.c1
-rw-r--r--drivers/video/modedb.c1
-rw-r--r--drivers/video/nvidia/nv_i2c.c1
-rw-r--r--drivers/video/nvidia/nv_of.c1
-rw-r--r--drivers/video/pmag-aa-fb.c1
-rw-r--r--drivers/video/riva/rivafb-i2c.c1
-rw-r--r--drivers/video/savage/savagefb-i2c.c1
-rw-r--r--drivers/video/tgafb.c1
-rw-r--r--fs/afs/cell.c1
-rw-r--r--fs/afs/dir.c1
-rw-r--r--fs/afs/file.c1
-rw-r--r--fs/afs/inode.c1
-rw-r--r--fs/afs/main.c1
-rw-r--r--fs/afs/mntpt.c1
-rw-r--r--fs/afs/proc.c1
-rw-r--r--fs/binfmt_elf.c3
-rw-r--r--fs/coda/sysctl.c60
-rw-r--r--fs/dquot.c2
-rw-r--r--fs/ecryptfs/keystore.c1
-rw-r--r--fs/ext3/hash.c1
-rw-r--r--fs/ext3/resize.c1
-rw-r--r--fs/ext4/hash.c1
-rw-r--r--fs/ext4/resize.c1
-rw-r--r--fs/filesystems.c1
-rw-r--r--fs/gfs2/bmap.c1
-rw-r--r--fs/gfs2/dir.c1
-rw-r--r--fs/gfs2/eaops.c1
-rw-r--r--fs/gfs2/eattr.c1
-rw-r--r--fs/gfs2/glops.c1
-rw-r--r--fs/gfs2/lm.c1
-rw-r--r--fs/gfs2/main.c1
-rw-r--r--fs/gfs2/mount.c1
-rw-r--r--fs/gfs2/ondisk.c1
-rw-r--r--fs/gfs2/ops_dentry.c1
-rw-r--r--fs/gfs2/ops_export.c1
-rw-r--r--fs/gfs2/ops_file.c1
-rw-r--r--fs/gfs2/ops_inode.c1
-rw-r--r--fs/gfs2/ops_vm.c1
-rw-r--r--fs/gfs2/recovery.c1
-rw-r--r--fs/gfs2/rgrp.c1
-rw-r--r--fs/gfs2/util.c1
-rw-r--r--fs/hfsplus/catalog.c1
-rw-r--r--fs/hfsplus/dir.c1
-rw-r--r--fs/hfsplus/super.c1
-rw-r--r--fs/jffs2/compr_zlib.c1
-rw-r--r--fs/jffs2/dir.c1
-rw-r--r--fs/jffs2/summary.c1
-rw-r--r--fs/lockd/host.c1
-rw-r--r--fs/lockd/svc.c2
-rw-r--r--fs/nfs/nfs4renewd.c1
-rw-r--r--fs/nfs/sysctl.c2
-rw-r--r--fs/nfsd/export.c107
-rw-r--r--fs/nfsd/nfs3xdr.c31
-rw-r--r--fs/nfsd/nfs4idmap.c1
-rw-r--r--fs/nfsd/nfs4xdr.c10
-rw-r--r--fs/nfsd/nfsctl.c2
-rw-r--r--fs/nfsd/nfsfh.c145
-rw-r--r--fs/nfsd/nfsxdr.c19
-rw-r--r--fs/ntfs/sysctl.c34
-rw-r--r--fs/ocfs2/cluster/nodemanager.c6
-rw-r--r--fs/ocfs2/cluster/nodemanager.h3
-rw-r--r--fs/proc/Makefile2
-rw-r--r--fs/proc/generic.c2
-rw-r--r--fs/proc/inode.c1
-rw-r--r--fs/proc/internal.h2
-rw-r--r--fs/proc/proc_sysctl.c479
-rw-r--r--fs/proc/root.c14
-rw-r--r--fs/smbfs/symlink.c1
-rw-r--r--fs/ufs/balloc.c1
-rw-r--r--fs/ufs/dir.c1
-rw-r--r--fs/xattr_acl.c1
-rw-r--r--fs/xfs/linux-2.6/kmem.c1
-rw-r--r--fs/xfs/linux-2.6/xfs_sysctl.c2
-rw-r--r--include/asm-generic/pgtable.h13
-rw-r--r--include/asm-i386/apic.h2
-rw-r--r--include/asm-i386/bugs.h2
-rw-r--r--include/asm-i386/desc.h2
-rw-r--r--include/asm-i386/elf.h4
-rw-r--r--include/asm-i386/idle.h14
-rw-r--r--include/asm-i386/mce.h2
-rw-r--r--include/asm-i386/mmu_context.h2
-rw-r--r--include/asm-i386/paravirt.h168
-rw-r--r--include/asm-i386/pda.h12
-rw-r--r--include/asm-i386/pgalloc.h30
-rw-r--r--include/asm-i386/processor.h14
-rw-r--r--include/asm-i386/ptrace.h8
-rw-r--r--include/asm-i386/segment.h19
-rw-r--r--include/asm-i386/setup.h2
-rw-r--r--include/asm-i386/smp.h5
-rw-r--r--include/asm-i386/time.h1
-rw-r--r--include/asm-i386/timer.h3
-rw-r--r--include/asm-i386/vmi.h262
-rw-r--r--include/asm-i386/vmi_time.h103
-rw-r--r--include/asm-ia64/dma-mapping.h15
-rw-r--r--include/asm-x86_64/bitops.h2
-rw-r--r--include/asm-x86_64/dma-mapping.h3
-rw-r--r--include/asm-x86_64/e820.h2
-rw-r--r--include/asm-x86_64/hw_irq.h2
-rw-r--r--include/asm-x86_64/io.h2
-rw-r--r--include/asm-x86_64/io_apic.h14
-rw-r--r--include/asm-x86_64/mce.h2
-rw-r--r--include/asm-x86_64/mmzone.h18
-rw-r--r--include/asm-x86_64/mutex.h6
-rw-r--r--include/asm-x86_64/pgalloc.h5
-rw-r--r--include/asm-x86_64/pgtable.h9
-rw-r--r--include/asm-x86_64/uaccess.h14
-rw-r--r--include/asm-x86_64/vsyscall.h5
-rw-r--r--include/linux/binfmts.h1
-rw-r--r--include/linux/nfsd/export.h7
-rw-r--r--include/linux/nfsd/nfsd.h12
-rw-r--r--include/linux/nfsd/nfsfh.h99
-rw-r--r--include/linux/nmi.h9
-rw-r--r--include/linux/proc_fs.h2
-rw-r--r--include/linux/serial_core.h2
-rw-r--r--include/linux/serial_ip3106.h81
-rw-r--r--include/linux/serial_pnx8xxx.h81
-rw-r--r--include/linux/sunrpc/debug.h1
-rw-r--r--include/linux/sysctl.h27
-rw-r--r--include/linux/time.h2
-rw-r--r--init/Kconfig6
-rw-r--r--init/calibrate.c2
-rw-r--r--init/main.c86
-rw-r--r--init/version.c1
-rw-r--r--ipc/Makefile1
-rw-r--r--ipc/ipc_sysctl.c183
-rw-r--r--ipc/mqueue.c2
-rw-r--r--kernel/Makefile1
-rw-r--r--kernel/irq/manage.c2
-rw-r--r--kernel/kmod.c44
-rw-r--r--kernel/lockdep_proc.c1
-rw-r--r--kernel/mutex-debug.c1
-rw-r--r--kernel/resource.c1
-rw-r--r--kernel/sched.c7
-rw-r--r--kernel/sysctl.c591
-rw-r--r--kernel/timer.c4
-rw-r--r--kernel/utsname_sysctl.c146
-rw-r--r--net/802/fc.c1
-rw-r--r--net/802/fddi.c1
-rw-r--r--net/802/hippi.c1
-rw-r--r--net/appletalk/sysctl_net_atalk.c2
-rw-r--r--net/atm/addr.c1
-rw-r--r--net/atm/lec.c1
-rw-r--r--net/atm/raw.c1
-rw-r--r--net/ax25/ax25_addr.c1
-rw-r--r--net/ax25/ax25_dev.c1
-rw-r--r--net/ax25/ax25_ds_in.c1
-rw-r--r--net/ax25/ax25_ds_subr.c1
-rw-r--r--net/ax25/ax25_iface.c1
-rw-r--r--net/ax25/ax25_in.c1
-rw-r--r--net/ax25/ax25_ip.c1
-rw-r--r--net/ax25/ax25_out.c1
-rw-r--r--net/ax25/ax25_std_in.c1
-rw-r--r--net/ax25/ax25_std_subr.c1
-rw-r--r--net/ax25/ax25_std_timer.c1
-rw-r--r--net/ax25/ax25_subr.c1
-rw-r--r--net/ax25/ax25_uid.c1
-rw-r--r--net/ax25/sysctl_net_ax25.c2
-rw-r--r--net/bluetooth/bnep/sock.c1
-rw-r--r--net/bluetooth/cmtp/sock.c1
-rw-r--r--net/bluetooth/hci_conn.c1
-rw-r--r--net/bluetooth/hci_event.c1
-rw-r--r--net/bluetooth/hci_sock.c1
-rw-r--r--net/bluetooth/hidp/sock.c1
-rw-r--r--net/bridge/br_netfilter.c2
-rw-r--r--net/bridge/netfilter/ebtables.c1
-rw-r--r--net/compat.c1
-rw-r--r--net/core/dev_mcast.c1
-rw-r--r--net/core/dst.c1
-rw-r--r--net/core/filter.c1
-rw-r--r--net/core/iovec.c1
-rw-r--r--net/core/neighbour.c3
-rw-r--r--net/core/rtnetlink.c1
-rw-r--r--net/core/skbuff.c1
-rw-r--r--net/dccp/sysctl.c2
-rw-r--r--net/decnet/dn_dev.c7
-rw-r--r--net/decnet/dn_nsp_in.c1
-rw-r--r--net/decnet/dn_nsp_out.c1
-rw-r--r--net/decnet/sysctl_net_decnet.c2
-rw-r--r--net/econet/af_econet.c1
-rw-r--r--net/ethernet/eth.c1
-rw-r--r--net/ipv4/arp.c1
-rw-r--r--net/ipv4/devinet.c10
-rw-r--r--net/ipv4/fib_frontend.c1
-rw-r--r--net/ipv4/fib_hash.c1
-rw-r--r--net/ipv4/fib_trie.c1
-rw-r--r--net/ipv4/inetpeer.c1
-rw-r--r--net/ipv4/ip_forward.c1
-rw-r--r--net/ipv4/ip_gre.c1
-rw-r--r--net/ipv4/ip_output.c1
-rw-r--r--net/ipv4/ip_sockglue.c1
-rw-r--r--net/ipv4/ipip.c1
-rw-r--r--net/ipv4/ipmr.c1
-rw-r--r--net/ipv4/ipvs/ip_vs_ctl.c2
-rw-r--r--net/ipv4/ipvs/ip_vs_lblc.c2
-rw-r--r--net/ipv4/ipvs/ip_vs_lblcr.c2
-rw-r--r--net/ipv4/ipvs/ip_vs_sched.c1
-rw-r--r--net/ipv4/multipath_drr.c1
-rw-r--r--net/ipv4/multipath_random.c1
-rw-r--r--net/ipv4/multipath_rr.c1
-rw-r--r--net/ipv4/multipath_wrandom.c1
-rw-r--r--net/ipv4/netfilter/ip_conntrack_proto_generic.c1
-rw-r--r--net/ipv4/netfilter/ip_conntrack_proto_icmp.c1
-rw-r--r--net/ipv4/netfilter/ip_conntrack_proto_sctp.c3
-rw-r--r--net/ipv4/netfilter/ip_conntrack_proto_tcp.c1
-rw-r--r--net/ipv4/netfilter/ip_conntrack_proto_udp.c1
-rw-r--r--net/ipv4/netfilter/ip_conntrack_standalone.c2
-rw-r--r--net/ipv4/netfilter/ip_queue.c2
-rw-r--r--net/ipv4/netfilter/nf_conntrack_proto_icmp.c1
-rw-r--r--net/ipv4/protocol.c1
-rw-r--r--net/ipv4/route.c1
-rw-r--r--net/ipv6/addrconf.c10
-rw-r--r--net/ipv6/af_inet6.c1
-rw-r--r--net/ipv6/anycast.c1
-rw-r--r--net/ipv6/datagram.c1
-rw-r--r--net/ipv6/exthdrs.c1
-rw-r--r--net/ipv6/icmp.c1
-rw-r--r--net/ipv6/ip6_input.c1
-rw-r--r--net/ipv6/ipv6_sockglue.c1
-rw-r--r--net/ipv6/netfilter/ip6_queue.c2
-rw-r--r--net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c1
-rw-r--r--net/ipv6/proc.c1
-rw-r--r--net/ipv6/protocol.c1
-rw-r--r--net/ipv6/raw.c1
-rw-r--r--net/ipv6/sit.c1
-rw-r--r--net/ipv6/sysctl_net_ipv6.c2
-rw-r--r--net/ipv6/udp.c1
-rw-r--r--net/ipx/sysctl_net_ipx.c2
-rw-r--r--net/irda/ircomm/ircomm_core.c1
-rw-r--r--net/irda/ircomm/ircomm_event.c1
-rw-r--r--net/irda/ircomm/ircomm_lmp.c1
-rw-r--r--net/irda/ircomm/ircomm_param.c1
-rw-r--r--net/irda/ircomm/ircomm_ttp.c1
-rw-r--r--net/irda/ircomm/ircomm_tty_attach.c1
-rw-r--r--net/irda/ircomm/ircomm_tty_ioctl.c1
-rw-r--r--net/irda/irsysctl.c2
-rw-r--r--net/lapb/lapb_in.c1
-rw-r--r--net/lapb/lapb_out.c1
-rw-r--r--net/lapb/lapb_subr.c1
-rw-r--r--net/llc/sysctl_net_llc.c2
-rw-r--r--net/netfilter/nf_conntrack_proto_generic.c2
-rw-r--r--net/netfilter/nf_conntrack_proto_sctp.c1
-rw-r--r--net/netfilter/nf_conntrack_proto_tcp.c1
-rw-r--r--net/netfilter/nf_conntrack_proto_udp.c1
-rw-r--r--net/netfilter/nf_conntrack_standalone.c2
-rw-r--r--net/netfilter/nf_sysctl.c2
-rw-r--r--net/netfilter/nfnetlink.c1
-rw-r--r--net/netrom/nr_dev.c1
-rw-r--r--net/netrom/nr_in.c1
-rw-r--r--net/netrom/nr_out.c1
-rw-r--r--net/netrom/nr_route.c1
-rw-r--r--net/netrom/nr_subr.c1
-rw-r--r--net/netrom/sysctl_net_netrom.c2
-rw-r--r--net/packet/af_packet.c1
-rw-r--r--net/rose/rose_dev.c1
-rw-r--r--net/rose/rose_in.c1
-rw-r--r--net/rose/rose_out.c1
-rw-r--r--net/rose/rose_route.c1
-rw-r--r--net/rose/rose_subr.c1
-rw-r--r--net/rose/sysctl_net_rose.c2
-rw-r--r--net/rxrpc/sysctl.c2
-rw-r--r--net/rxrpc/transport.c1
-rw-r--r--net/sched/act_api.c1
-rw-r--r--net/sched/act_gact.c1
-rw-r--r--net/sched/act_ipt.c1
-rw-r--r--net/sched/act_mirred.c1
-rw-r--r--net/sched/act_pedit.c1
-rw-r--r--net/sched/act_police.c1
-rw-r--r--net/sched/cls_api.c1
-rw-r--r--net/sched/cls_basic.c1
-rw-r--r--net/sched/cls_fw.c1
-rw-r--r--net/sched/cls_route.c1
-rw-r--r--net/sched/cls_rsvp.c1
-rw-r--r--net/sched/cls_rsvp6.c1
-rw-r--r--net/sched/cls_u32.c1
-rw-r--r--net/sched/em_nbyte.c1
-rw-r--r--net/sched/em_text.c1
-rw-r--r--net/sched/ematch.c1
-rw-r--r--net/sched/sch_api.c1
-rw-r--r--net/sched/sch_cbq.c1
-rw-r--r--net/sched/sch_htb.c1
-rw-r--r--net/sched/sch_prio.c1
-rw-r--r--net/sched/sch_teql.c1
-rw-r--r--net/sctp/associola.c1
-rw-r--r--net/sctp/bind_addr.c1
-rw-r--r--net/sctp/endpointola.c1
-rw-r--r--net/sctp/ipv6.c1
-rw-r--r--net/sctp/sysctl.c2
-rw-r--r--net/sunrpc/auth_null.c1
-rw-r--r--net/sunrpc/stats.c1
-rw-r--r--net/sunrpc/sunrpc_syms.c6
-rw-r--r--net/sunrpc/svcauth.c1
-rw-r--r--net/sunrpc/svcauth_unix.c225
-rw-r--r--net/sunrpc/sysctl.c10
-rw-r--r--net/sunrpc/xprtsock.c10
-rw-r--r--net/unix/garbage.c1
-rw-r--r--net/unix/sysctl_net_unix.c2
-rw-r--r--net/x25/sysctl_net_x25.c2
-rw-r--r--scripts/kconfig/qconf.cc18
-rwxr-xr-xscripts/mkcompile_h2
-rwxr-xr-xscripts/mkuboot.sh11
-rw-r--r--scripts/mod/modpost.c10
-rw-r--r--security/keys/compat.c1
-rw-r--r--security/keys/user_defined.c1
-rw-r--r--security/security.c1
-rw-r--r--security/selinux/hooks.c48
-rw-r--r--security/selinux/ss/sidtab.c1
-rw-r--r--sound/core/misc.c1
-rw-r--r--sound/core/seq/instr/ainstr_fm.c1
-rw-r--r--sound/core/seq/instr/ainstr_gf1.c1
-rw-r--r--sound/core/seq/instr/ainstr_iw.c1
-rw-r--r--sound/core/seq/instr/ainstr_simple.c1
-rw-r--r--sound/core/seq/seq_virmidi.c1
-rw-r--r--sound/drivers/virmidi.c1
-rw-r--r--sound/isa/dt019x.c1
-rw-r--r--sound/oss/ac97_codec.c3
-rw-r--r--sound/oss/ad1889.c3
-rw-r--r--sound/oss/btaudio.c3
-rw-r--r--sound/oss/cs46xx.c9
-rw-r--r--sound/oss/dmasound/dac3550a.c3
-rw-r--r--sound/oss/dmasound/tas3001c.c3
-rw-r--r--sound/oss/dmasound/tas3004.c3
-rw-r--r--sound/oss/dmasound/tas_common.c3
-rw-r--r--sound/oss/emu10k1/main.c11
-rw-r--r--sound/oss/es1371.c3
-rw-r--r--sound/oss/hal2.c3
-rw-r--r--sound/oss/i810_audio.c9
-rw-r--r--sound/oss/kahlua.c3
-rw-r--r--sound/oss/nec_vrc5477.c3
-rw-r--r--sound/oss/opl3.c3
-rw-r--r--sound/oss/sb_card.c6
-rw-r--r--sound/oss/swarm_cs4297a.c13
-rw-r--r--sound/oss/trident.c9
-rw-r--r--sound/oss/waveartist.c4
-rw-r--r--sound/synth/emux/emux.c1
-rw-r--r--sound/synth/emux/emux_proc.c1
851 files changed, 8500 insertions, 3024 deletions
diff --git a/.mailmap b/.mailmap
new file mode 100644
index 000000000000..bf62dbea88e6
--- /dev/null
+++ b/.mailmap
@@ -0,0 +1,96 @@
1#
2# This list is used by git-shortlog to fix a few botched name translations
3# in the git archive, either because the author's full name was messed up
4# and/or not always written the same way, making contributions from the
5# same person appearing not to be so or badly displayed.
6#
7# repo-abbrev: /pub/scm/linux/kernel/git/
8#
9
10Aaron Durbin <adurbin@google.com>
11Adam Oldham <oldhamca@gmail.com>
12Adam Radford <aradford@gmail.com>
13Adrian Bunk <bunk@stusta.de>
14Alan Cox <alan@lxorguk.ukuu.org.uk>
15Alan Cox <root@hraefn.swansea.linux.org.uk>
16Aleksey Gorelov <aleksey_gorelov@phoenix.com>
17Al Viro <viro@ftp.linux.org.uk>
18Al Viro <viro@zenIV.linux.org.uk>
19Andreas Herrmann <aherrman@de.ibm.com>
20Andrew Morton <akpm@osdl.org>
21Andrew Vasquez <andrew.vasquez@qlogic.com>
22Andy Adamson <andros@citi.umich.edu>
23Arnaud Patard <arnaud.patard@rtp-net.org>
24Arnd Bergmann <arnd@arndb.de>
25Axel Dyks <xl@xlsigned.net>
26Ben Gardner <bgardner@wabtec.com>
27Ben M Cahill <ben.m.cahill@intel.com>
28Björn Steinbrink <B.Steinbrink@gmx.de>
29Brian Avery <b.avery@hp.com>
30Brian King <brking@us.ibm.com>
31Christoph Hellwig <hch@lst.de>
32Corey Minyard <minyard@acm.org>
33David Brownell <david-b@pacbell.net>
34David Woodhouse <dwmw2@shinybook.infradead.org>
35Domen Puncer <domen@coderock.org>
36Douglas Gilbert <dougg@torque.net>
37Ed L. Cashin <ecashin@coraid.com>
38Evgeniy Polyakov <johnpol@2ka.mipt.ru>
39Felipe W Damasio <felipewd@terra.com.br>
40Felix Kuhling <fxkuehl@gmx.de>
41Felix Moeller <felix@derklecks.de>
42Filipe Lautert <filipe@icewall.org>
43Franck Bui-Huu <vagabon.xyz@gmail.com>
44Frank Zago <fzago@systemfabricworks.com>
45Greg Kroah-Hartman <greg@echidna.(none)>
46Greg Kroah-Hartman <gregkh@suse.de>
47Greg Kroah-Hartman <greg@kroah.com>
48Henk Vergonet <Henk.Vergonet@gmail.com>
49Henrik Kretzschmar <henne@nachtwindheim.de>
50Herbert Xu <herbert@gondor.apana.org.au>
51Jacob Shin <Jacob.Shin@amd.com>
52James Bottomley <jejb@mulgrave.(none)>
53James Bottomley <jejb@titanic.il.steeleye.com>
54James E Wilson <wilson@specifix.com>
55James Ketrenos <jketreno@io.(none)>
56Jean Tourrilhes <jt@hpl.hp.com>
57Jeff Garzik <jgarzik@pretzel.yyz.us>
58Jens Axboe <axboe@suse.de>
59Jens Osterkamp <Jens.Osterkamp@de.ibm.com>
60John Stultz <johnstul@us.ibm.com>
61Juha Yrjola <at solidboot.com>
62Juha Yrjola <juha.yrjola@nokia.com>
63Juha Yrjola <juha.yrjola@solidboot.com>
64Kay Sievers <kay.sievers@vrfy.org>
65Kenneth W Chen <kenneth.w.chen@intel.com>
66Koushik <raghavendra.koushik@neterion.com>
67Leonid I Ananiev <leonid.i.ananiev@intel.com>
68Linas Vepstas <linas@austin.ibm.com>
69Matthieu CASTET <castet.matthieu@free.fr>
70Michel Dänzer <michel@tungstengraphics.com>
71Mitesh shah <mshah@teja.com>
72Morten Welinder <terra@gnome.org>
73Morten Welinder <welinder@anemone.rentec.com>
74Morten Welinder <welinder@darter.rentec.com>
75Morten Welinder <welinder@troll.com>
76Nguyen Anh Quynh <aquynh@gmail.com>
77Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
78Patrick Mochel <mochel@digitalimplant.org>
79Peter A Jonsson <pj@ludd.ltu.se>
80Praveen BP <praveenbp@ti.com>
81Rajesh Shah <rajesh.shah@intel.com>
82Ralf Baechle <ralf@linux-mips.org>
83Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
84Rémi Denis-Courmont <rdenis@simphalempin.com>
85Rudolf Marek <R.Marek@sh.cvut.cz>
86Rui Saraiva <rmps@joel.ist.utl.pt>
87Sachin P Sant <ssant@in.ibm.com>
88Sam Ravnborg <sam@mars.ravnborg.org>
89Simon Kelley <simon@thekelleys.org.uk>
90Stéphane Witzmann <stephane.witzmann@ubpmes.univ-bpclermont.fr>
91Stephen Hemminger <shemminger@osdl.org>
92Tejun Heo <htejun@gmail.com>
93Thomas Graf <tgraf@suug.ch>
94Tony Luck <tony.luck@intel.com>
95Tsuneo Yoshioka <Tsuneo.Yoshioka@f-secure.com>
96Valdis Kletnieks <Valdis.Kletnieks@vt.edu>
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index d25acd51e181..22b19962a1a2 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -104,6 +104,9 @@ loader, and have no meaning to the kernel directly.
104Do not modify the syntax of boot loader parameters without extreme 104Do not modify the syntax of boot loader parameters without extreme
105need or coordination with <Documentation/i386/boot.txt>. 105need or coordination with <Documentation/i386/boot.txt>.
106 106
107There are also arch-specific kernel-parameters not documented here.
108See for example <Documentation/x86_64/boot-options.txt>.
109
107Note that ALL kernel parameters listed below are CASE SENSITIVE, and that 110Note that ALL kernel parameters listed below are CASE SENSITIVE, and that
108a trailing = on the name of any parameter states that that parameter will 111a trailing = on the name of any parameter states that that parameter will
109be entered as an environment variable, whereas its absence indicates that 112be entered as an environment variable, whereas its absence indicates that
@@ -361,6 +364,11 @@ and is between 256 and 4096 characters. It is defined in the file
361 clocksource is not available, it defaults to PIT. 364 clocksource is not available, it defaults to PIT.
362 Format: { pit | tsc | cyclone | pmtmr } 365 Format: { pit | tsc | cyclone | pmtmr }
363 366
367 code_bytes [IA32] How many bytes of object code to print in an
368 oops report.
369 Range: 0 - 8192
370 Default: 64
371
364 disable_8254_timer 372 disable_8254_timer
365 enable_8254_timer 373 enable_8254_timer
366 [IA32/X86_64] Disable/Enable interrupt 0 timer routing 374 [IA32/X86_64] Disable/Enable interrupt 0 timer routing
diff --git a/Documentation/x86_64/boot-options.txt b/Documentation/x86_64/boot-options.txt
index 5c86ed6f0448..625a21db0c2a 100644
--- a/Documentation/x86_64/boot-options.txt
+++ b/Documentation/x86_64/boot-options.txt
@@ -180,40 +180,81 @@ PCI
180 pci=lastbus=NUMBER Scan upto NUMBER busses, no matter what the mptable says. 180 pci=lastbus=NUMBER Scan upto NUMBER busses, no matter what the mptable says.
181 pci=noacpi Don't use ACPI to set up PCI interrupt routing. 181 pci=noacpi Don't use ACPI to set up PCI interrupt routing.
182 182
183IOMMU 183IOMMU (input/output memory management unit)
184 184
185 iommu=[size][,noagp][,off][,force][,noforce][,leak][,memaper[=order]][,merge] 185 Currently four x86-64 PCI-DMA mapping implementations exist:
186 [,forcesac][,fullflush][,nomerge][,noaperture][,calgary] 186
187 size set size of iommu (in bytes) 187 1. <arch/x86_64/kernel/pci-nommu.c>: use no hardware/software IOMMU at all
188 noagp don't initialize the AGP driver and use full aperture. 188 (e.g. because you have < 3 GB memory).
189 off don't use the IOMMU 189 Kernel boot message: "PCI-DMA: Disabling IOMMU"
190 leak turn on simple iommu leak tracing (only when CONFIG_IOMMU_LEAK is on) 190
191 memaper[=order] allocate an own aperture over RAM with size 32MB^order. 191 2. <arch/x86_64/kernel/pci-gart.c>: AMD GART based hardware IOMMU.
192 noforce don't force IOMMU usage. Default. 192 Kernel boot message: "PCI-DMA: using GART IOMMU"
193 force Force IOMMU. 193
194 merge Do SG merging. Implies force (experimental) 194 3. <arch/x86_64/kernel/pci-swiotlb.c> : Software IOMMU implementation. Used
195 nomerge Don't do SG merging. 195 e.g. if there is no hardware IOMMU in the system and it is need because
196 forcesac For SAC mode for masks <40bits (experimental) 196 you have >3GB memory or told the kernel to us it (iommu=soft))
197 fullflush Flush IOMMU on each allocation (default) 197 Kernel boot message: "PCI-DMA: Using software bounce buffering
198 nofullflush Don't use IOMMU fullflush 198 for IO (SWIOTLB)"
199 allowed overwrite iommu off workarounds for specific chipsets. 199
200 soft Use software bounce buffering (default for Intel machines) 200 4. <arch/x86_64/pci-calgary.c> : IBM Calgary hardware IOMMU. Used in IBM
201 noaperture Don't touch the aperture for AGP. 201 pSeries and xSeries servers. This hardware IOMMU supports DMA address
202 allowdac Allow DMA >4GB 202 mapping with memory protection, etc.
203 When off all DMA over >4GB is forced through an IOMMU or bounce 203 Kernel boot message: "PCI-DMA: Using Calgary IOMMU"
204 buffering. 204
205 nodac Forbid DMA >4GB 205 iommu=[<size>][,noagp][,off][,force][,noforce][,leak[=<nr_of_leak_pages>]
206 panic Always panic when IOMMU overflows 206 [,memaper[=<order>]][,merge][,forcesac][,fullflush][,nomerge]
207 calgary Use the Calgary IOMMU if it is available 207 [,noaperture][,calgary]
208 208
209 swiotlb=pages[,force] 209 General iommu options:
210 210 off Don't initialize and use any kind of IOMMU.
211 pages Prereserve that many 128K pages for the software IO bounce buffering. 211 noforce Don't force hardware IOMMU usage when it is not needed.
212 force Force all IO through the software TLB. 212 (default).
213 213 force Force the use of the hardware IOMMU even when it is
214 calgary=[64k,128k,256k,512k,1M,2M,4M,8M] 214 not actually needed (e.g. because < 3 GB memory).
215 calgary=[translate_empty_slots] 215 soft Use software bounce buffering (SWIOTLB) (default for
216 calgary=[disable=<PCI bus number>] 216 Intel machines). This can be used to prevent the usage
217 of an available hardware IOMMU.
218
219 iommu options only relevant to the AMD GART hardware IOMMU:
220 <size> Set the size of the remapping area in bytes.
221 allowed Overwrite iommu off workarounds for specific chipsets.
222 fullflush Flush IOMMU on each allocation (default).
223 nofullflush Don't use IOMMU fullflush.
224 leak Turn on simple iommu leak tracing (only when
225 CONFIG_IOMMU_LEAK is on). Default number of leak pages
226 is 20.
227 memaper[=<order>] Allocate an own aperture over RAM with size 32MB<<order.
228 (default: order=1, i.e. 64MB)
229 merge Do scatter-gather (SG) merging. Implies "force"
230 (experimental).
231 nomerge Don't do scatter-gather (SG) merging.
232 noaperture Ask the IOMMU not to touch the aperture for AGP.
233 forcesac Force single-address cycle (SAC) mode for masks <40bits
234 (experimental).
235 noagp Don't initialize the AGP driver and use full aperture.
236 allowdac Allow double-address cycle (DAC) mode, i.e. DMA >4GB.
237 DAC is used with 32-bit PCI to push a 64-bit address in
238 two cycles. When off all DMA over >4GB is forced through
239 an IOMMU or software bounce buffering.
240 nodac Forbid DAC mode, i.e. DMA >4GB.
241 panic Always panic when IOMMU overflows.
242 calgary Use the Calgary IOMMU if it is available
243
244 iommu options only relevant to the software bounce buffering (SWIOTLB) IOMMU
245 implementation:
246 swiotlb=<pages>[,force]
247 <pages> Prereserve that many 128K pages for the software IO
248 bounce buffering.
249 force Force all IO through the software TLB.
250
251 Settings for the IBM Calgary hardware IOMMU currently found in IBM
252 pSeries and xSeries machines:
253
254 calgary=[64k,128k,256k,512k,1M,2M,4M,8M]
255 calgary=[translate_empty_slots]
256 calgary=[disable=<PCI bus number>]
257 panic Always panic when IOMMU overflows
217 258
218 64k,...,8M - Set the size of each PCI slot's translation table 259 64k,...,8M - Set the size of each PCI slot's translation table
219 when using the Calgary IOMMU. This is the size of the translation 260 when using the Calgary IOMMU. This is the size of the translation
@@ -234,14 +275,14 @@ IOMMU
234 275
235Debugging 276Debugging
236 277
237 oops=panic Always panic on oopses. Default is to just kill the process, 278 oops=panic Always panic on oopses. Default is to just kill the process,
238 but there is a small probability of deadlocking the machine. 279 but there is a small probability of deadlocking the machine.
239 This will also cause panics on machine check exceptions. 280 This will also cause panics on machine check exceptions.
240 Useful together with panic=30 to trigger a reboot. 281 Useful together with panic=30 to trigger a reboot.
241 282
242 kstack=N Print that many words from the kernel stack in oops dumps. 283 kstack=N Print N words from the kernel stack in oops dumps.
243 284
244 pagefaulttrace Dump all page faults. Only useful for extreme debugging 285 pagefaulttrace Dump all page faults. Only useful for extreme debugging
245 and will create a lot of output. 286 and will create a lot of output.
246 287
247 call_trace=[old|both|newfallback|new] 288 call_trace=[old|both|newfallback|new]
@@ -251,15 +292,8 @@ Debugging
251 newfallback: use new unwinder but fall back to old if it gets 292 newfallback: use new unwinder but fall back to old if it gets
252 stuck (default) 293 stuck (default)
253 294
254 call_trace=[old|both|newfallback|new] 295Miscellaneous
255 old: use old inexact backtracer
256 new: use new exact dwarf2 unwinder
257 both: print entries from both
258 newfallback: use new unwinder but fall back to old if it gets
259 stuck (default)
260
261Misc
262 296
263 noreplacement Don't replace instructions with more appropriate ones 297 noreplacement Don't replace instructions with more appropriate ones
264 for the CPU. This may be useful on asymmetric MP systems 298 for the CPU. This may be useful on asymmetric MP systems
265 where some CPU have less capabilities than the others. 299 where some CPUs have less capabilities than others.
diff --git a/Documentation/x86_64/cpu-hotplug-spec b/Documentation/x86_64/cpu-hotplug-spec
index 5c0fa345e556..3c23e0587db3 100644
--- a/Documentation/x86_64/cpu-hotplug-spec
+++ b/Documentation/x86_64/cpu-hotplug-spec
@@ -2,7 +2,7 @@ Firmware support for CPU hotplug under Linux/x86-64
2--------------------------------------------------- 2---------------------------------------------------
3 3
4Linux/x86-64 supports CPU hotplug now. For various reasons Linux wants to 4Linux/x86-64 supports CPU hotplug now. For various reasons Linux wants to
5know in advance boot time the maximum number of CPUs that could be plugged 5know in advance of boot time the maximum number of CPUs that could be plugged
6into the system. ACPI 3.0 currently has no official way to supply 6into the system. ACPI 3.0 currently has no official way to supply
7this information from the firmware to the operating system. 7this information from the firmware to the operating system.
8 8
diff --git a/Documentation/x86_64/kernel-stacks b/Documentation/x86_64/kernel-stacks
index bddfddd466ab..5ad65d51fb95 100644
--- a/Documentation/x86_64/kernel-stacks
+++ b/Documentation/x86_64/kernel-stacks
@@ -9,9 +9,9 @@ zombie. While the thread is in user space the kernel stack is empty
9except for the thread_info structure at the bottom. 9except for the thread_info structure at the bottom.
10 10
11In addition to the per thread stacks, there are specialized stacks 11In addition to the per thread stacks, there are specialized stacks
12associated with each cpu. These stacks are only used while the kernel 12associated with each CPU. These stacks are only used while the kernel
13is in control on that cpu, when a cpu returns to user space the 13is in control on that CPU; when a CPU returns to user space the
14specialized stacks contain no useful data. The main cpu stacks is 14specialized stacks contain no useful data. The main CPU stacks are:
15 15
16* Interrupt stack. IRQSTACKSIZE 16* Interrupt stack. IRQSTACKSIZE
17 17
@@ -32,17 +32,17 @@ x86_64 also has a feature which is not available on i386, the ability
32to automatically switch to a new stack for designated events such as 32to automatically switch to a new stack for designated events such as
33double fault or NMI, which makes it easier to handle these unusual 33double fault or NMI, which makes it easier to handle these unusual
34events on x86_64. This feature is called the Interrupt Stack Table 34events on x86_64. This feature is called the Interrupt Stack Table
35(IST). There can be up to 7 IST entries per cpu. The IST code is an 35(IST). There can be up to 7 IST entries per CPU. The IST code is an
36index into the Task State Segment (TSS), the IST entries in the TSS 36index into the Task State Segment (TSS). The IST entries in the TSS
37point to dedicated stacks, each stack can be a different size. 37point to dedicated stacks; each stack can be a different size.
38 38
39An IST is selected by an non-zero value in the IST field of an 39An IST is selected by a non-zero value in the IST field of an
40interrupt-gate descriptor. When an interrupt occurs and the hardware 40interrupt-gate descriptor. When an interrupt occurs and the hardware
41loads such a descriptor, the hardware automatically sets the new stack 41loads such a descriptor, the hardware automatically sets the new stack
42pointer based on the IST value, then invokes the interrupt handler. If 42pointer based on the IST value, then invokes the interrupt handler. If
43software wants to allow nested IST interrupts then the handler must 43software wants to allow nested IST interrupts then the handler must
44adjust the IST values on entry to and exit from the interrupt handler. 44adjust the IST values on entry to and exit from the interrupt handler.
45(this is occasionally done, e.g. for debug exceptions) 45(This is occasionally done, e.g. for debug exceptions.)
46 46
47Events with different IST codes (i.e. with different stacks) can be 47Events with different IST codes (i.e. with different stacks) can be
48nested. For example, a debug interrupt can safely be interrupted by an 48nested. For example, a debug interrupt can safely be interrupted by an
@@ -58,17 +58,17 @@ The currently assigned IST stacks are :-
58 58
59 Used for interrupt 12 - Stack Fault Exception (#SS). 59 Used for interrupt 12 - Stack Fault Exception (#SS).
60 60
61 This allows to recover from invalid stack segments. Rarely 61 This allows the CPU to recover from invalid stack segments. Rarely
62 happens. 62 happens.
63 63
64* DOUBLEFAULT_STACK. EXCEPTION_STKSZ (PAGE_SIZE). 64* DOUBLEFAULT_STACK. EXCEPTION_STKSZ (PAGE_SIZE).
65 65
66 Used for interrupt 8 - Double Fault Exception (#DF). 66 Used for interrupt 8 - Double Fault Exception (#DF).
67 67
68 Invoked when handling a exception causes another exception. Happens 68 Invoked when handling one exception causes another exception. Happens
69 when the kernel is very confused (e.g. kernel stack pointer corrupt) 69 when the kernel is very confused (e.g. kernel stack pointer corrupt).
70 Using a separate stack allows to recover from it well enough in many 70 Using a separate stack allows the kernel to recover from it well enough
71 cases to still output an oops. 71 in many cases to still output an oops.
72 72
73* NMI_STACK. EXCEPTION_STKSZ (PAGE_SIZE). 73* NMI_STACK. EXCEPTION_STKSZ (PAGE_SIZE).
74 74
diff --git a/Documentation/x86_64/machinecheck b/Documentation/x86_64/machinecheck
new file mode 100644
index 000000000000..068a6d9904b9
--- /dev/null
+++ b/Documentation/x86_64/machinecheck
@@ -0,0 +1,70 @@
1
2Configurable sysfs parameters for the x86-64 machine check code.
3
4Machine checks report internal hardware error conditions detected
5by the CPU. Uncorrected errors typically cause a machine check
6(often with panic), corrected ones cause a machine check log entry.
7
8Machine checks are organized in banks (normally associated with
9a hardware subsystem) and subevents in a bank. The exact meaning
10of the banks and subevent is CPU specific.
11
12mcelog knows how to decode them.
13
14When you see the "Machine check errors logged" message in the system
15log then mcelog should run to collect and decode machine check entries
16from /dev/mcelog. Normally mcelog should be run regularly from a cronjob.
17
18Each CPU has a directory in /sys/devices/system/machinecheck/machinecheckN
19(N = CPU number)
20
21The directory contains some configurable entries:
22
23Entries:
24
25bankNctl
26(N bank number)
27 64bit Hex bitmask enabling/disabling specific subevents for bank N
28 When a bit in the bitmask is zero then the respective
29 subevent will not be reported.
30 By default all events are enabled.
31 Note that BIOS maintain another mask to disable specific events
32 per bank. This is not visible here
33
34The following entries appear for each CPU, but they are truly shared
35between all CPUs.
36
37check_interval
38 How often to poll for corrected machine check errors, in seconds
39 (Note output is hexademical). Default 5 minutes.
40
41tolerant
42 Tolerance level. When a machine check exception occurs for a non
43 corrected machine check the kernel can take different actions.
44 Since machine check exceptions can happen any time it is sometimes
45 risky for the kernel to kill a process because it defies
46 normal kernel locking rules. The tolerance level configures
47 how hard the kernel tries to recover even at some risk of deadlock.
48
49 0: always panic,
50 1: panic if deadlock possible,
51 2: try to avoid panic,
52 3: never panic or exit (for testing only)
53
54 Default: 1
55
56 Note this only makes a difference if the CPU allows recovery
57 from a machine check exception. Current x86 CPUs generally do not.
58
59trigger
60 Program to run when a machine check event is detected.
61 This is an alternative to running mcelog regularly from cron
62 and allows to detect events faster.
63
64TBD document entries for AMD threshold interrupt configuration
65
66For more details about the x86 machine check architecture
67see the Intel and AMD architecture manuals from their developer websites.
68
69For more details about the architecture see
70see http://one.firstfloor.org/~andi/mce.pdf
diff --git a/Documentation/x86_64/mm.txt b/Documentation/x86_64/mm.txt
index 133561b9cb0c..f42798ed1c54 100644
--- a/Documentation/x86_64/mm.txt
+++ b/Documentation/x86_64/mm.txt
@@ -3,26 +3,26 @@
3 3
4Virtual memory map with 4 level page tables: 4Virtual memory map with 4 level page tables:
5 5
60000000000000000 - 00007fffffffffff (=47bits) user space, different per mm 60000000000000000 - 00007fffffffffff (=47 bits) user space, different per mm
7hole caused by [48:63] sign extension 7hole caused by [48:63] sign extension
8ffff800000000000 - ffff80ffffffffff (=40bits) guard hole 8ffff800000000000 - ffff80ffffffffff (=40 bits) guard hole
9ffff810000000000 - ffffc0ffffffffff (=46bits) direct mapping of all phys. memory 9ffff810000000000 - ffffc0ffffffffff (=46 bits) direct mapping of all phys. memory
10ffffc10000000000 - ffffc1ffffffffff (=40bits) hole 10ffffc10000000000 - ffffc1ffffffffff (=40 bits) hole
11ffffc20000000000 - ffffe1ffffffffff (=45bits) vmalloc/ioremap space 11ffffc20000000000 - ffffe1ffffffffff (=45 bits) vmalloc/ioremap space
12... unused hole ... 12... unused hole ...
13ffffffff80000000 - ffffffff82800000 (=40MB) kernel text mapping, from phys 0 13ffffffff80000000 - ffffffff82800000 (=40 MB) kernel text mapping, from phys 0
14... unused hole ... 14... unused hole ...
15ffffffff88000000 - fffffffffff00000 (=1919MB) module mapping space 15ffffffff88000000 - fffffffffff00000 (=1919 MB) module mapping space
16 16
17The direct mapping covers all memory in the system upto the highest 17The direct mapping covers all memory in the system up to the highest
18memory address (this means in some cases it can also include PCI memory 18memory address (this means in some cases it can also include PCI memory
19holes) 19holes).
20 20
21vmalloc space is lazily synchronized into the different PML4 pages of 21vmalloc space is lazily synchronized into the different PML4 pages of
22the processes using the page fault handler, with init_level4_pgt as 22the processes using the page fault handler, with init_level4_pgt as
23reference. 23reference.
24 24
25Current X86-64 implementations only support 40 bit of address space, 25Current X86-64 implementations only support 40 bits of address space,
26but we support upto 46bits. This expands into MBZ space in the page tables. 26but we support up to 46 bits. This expands into MBZ space in the page tables.
27 27
28-Andi Kleen, Jul 2004 28-Andi Kleen, Jul 2004
diff --git a/MAINTAINERS b/MAINTAINERS
index 93a338daedd8..b0fd71b3f66f 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -620,6 +620,11 @@ P: Haavard Skinnemoen
620M: hskinnemoen@atmel.com 620M: hskinnemoen@atmel.com
621S: Supported 621S: Supported
622 622
623ATMEL SPI DRIVER
624P: Haavard Skinnemoen
625M: hskinnemoen@atmel.com
626S: Supported
627
623ATMEL WIRELESS DRIVER 628ATMEL WIRELESS DRIVER
624P: Simon Kelley 629P: Simon Kelley
625M: simon@thekelleys.org.uk 630M: simon@thekelleys.org.uk
@@ -3774,6 +3779,7 @@ P: Andi Kleen
3774M: ak@suse.de 3779M: ak@suse.de
3775L: discuss@x86-64.org 3780L: discuss@x86-64.org
3776W: http://www.x86-64.org 3781W: http://www.x86-64.org
3782T: quilt ftp://ftp.firstfloor.org/pub/ak/x86_64/quilt-current
3777S: Maintained 3783S: Maintained
3778 3784
3779YAM DRIVER FOR AX.25 3785YAM DRIVER FOR AX.25
diff --git a/Makefile b/Makefile
index 7e4968fb2134..b6c8790925bf 100644
--- a/Makefile
+++ b/Makefile
@@ -825,9 +825,6 @@ include/config/kernel.release: include/config/auto.conf FORCE
825# Listed in dependency order 825# Listed in dependency order
826PHONY += prepare archprepare prepare0 prepare1 prepare2 prepare3 826PHONY += prepare archprepare prepare0 prepare1 prepare2 prepare3
827 827
828# prepare-all is deprecated, use prepare as valid replacement
829PHONY += prepare-all
830
831# prepare3 is used to check if we are building in a separate output directory, 828# prepare3 is used to check if we are building in a separate output directory,
832# and if so do: 829# and if so do:
833# 1) Check that make has not been executed in the kernel src $(srctree) 830# 1) Check that make has not been executed in the kernel src $(srctree)
@@ -860,7 +857,7 @@ prepare0: archprepare FORCE
860 $(Q)$(MAKE) $(build)=. 857 $(Q)$(MAKE) $(build)=.
861 858
862# All the preparing.. 859# All the preparing..
863prepare prepare-all: prepare0 860prepare: prepare0
864 861
865# Leave this as default for preprocessing vmlinux.lds.S, which is now 862# Leave this as default for preprocessing vmlinux.lds.S, which is now
866# done in arch/$(ARCH)/kernel/Makefile 863# done in arch/$(ARCH)/kernel/Makefile
@@ -931,6 +928,12 @@ headers_install: include/linux/version.h scripts_basic FORCE
931 $(Q)$(MAKE) $(build)=scripts scripts/unifdef 928 $(Q)$(MAKE) $(build)=scripts scripts/unifdef
932 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.headersinst obj=include 929 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.headersinst obj=include
933 930
931PHONY += headers_check_all
932headers_check_all: headers_install_all
933 $(Q)for arch in $(HDRARCHES); do \
934 $(MAKE) ARCH=$$arch -f $(srctree)/scripts/Makefile.headersinst obj=include BIASMDIR=-bi-$$arch HDRCHECK=1 ;\
935 done
936
934PHONY += headers_check 937PHONY += headers_check
935headers_check: headers_install 938headers_check: headers_install
936 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.headersinst obj=include HDRCHECK=1 939 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.headersinst obj=include HDRCHECK=1
diff --git a/arch/arm/kernel/isa.c b/arch/arm/kernel/isa.c
index 54bbd9fe255c..50a30bc91872 100644
--- a/arch/arm/kernel/isa.c
+++ b/arch/arm/kernel/isa.c
@@ -70,5 +70,5 @@ register_isa_ports(unsigned int membase, unsigned int portbase, unsigned int por
70 isa_membase = membase; 70 isa_membase = membase;
71 isa_portbase = portbase; 71 isa_portbase = portbase;
72 isa_portshift = portshift; 72 isa_portshift = portshift;
73 isa_sysctl_header = register_sysctl_table(ctl_bus, 0); 73 isa_sysctl_header = register_sysctl_table(ctl_bus);
74} 74}
diff --git a/arch/frv/kernel/pm.c b/arch/frv/kernel/pm.c
index ee677ced7b68..c57ce3f1f2e2 100644
--- a/arch/frv/kernel/pm.c
+++ b/arch/frv/kernel/pm.c
@@ -125,7 +125,6 @@ unsigned long sleep_phys_sp(void *sp)
125 * Use a temporary sysctl number. Horrid, but will be cleaned up in 2.6 125 * Use a temporary sysctl number. Horrid, but will be cleaned up in 2.6
126 * when all the PM interfaces exist nicely. 126 * when all the PM interfaces exist nicely.
127 */ 127 */
128#define CTL_PM 9899
129#define CTL_PM_SUSPEND 1 128#define CTL_PM_SUSPEND 1
130#define CTL_PM_CMODE 2 129#define CTL_PM_CMODE 2
131#define CTL_PM_P0 4 130#define CTL_PM_P0 4
@@ -402,17 +401,53 @@ static int cm_sysctl(ctl_table *table, int __user *name, int nlen,
402 401
403static struct ctl_table pm_table[] = 402static struct ctl_table pm_table[] =
404{ 403{
405 {CTL_PM_SUSPEND, "suspend", NULL, 0, 0200, NULL, &sysctl_pm_do_suspend}, 404 {
406 {CTL_PM_CMODE, "cmode", &clock_cmode_current, sizeof(int), 0644, NULL, &cmode_procctl, &cmode_sysctl, NULL}, 405 .ctl_name = CTL_PM_SUSPEND,
407 {CTL_PM_P0, "p0", &clock_p0_current, sizeof(int), 0644, NULL, &p0_procctl, &p0_sysctl, NULL}, 406 .procname = "suspend",
408 {CTL_PM_CM, "cm", &clock_cm_current, sizeof(int), 0644, NULL, &cm_procctl, &cm_sysctl, NULL}, 407 .data = NULL,
409 {0} 408 .maxlen = 0,
409 .mode = 0200,
410 .proc_handler = &sysctl_pm_do_suspend,
411 },
412 {
413 .ctl_name = CTL_PM_CMODE,
414 .procname = "cmode",
415 .data = &clock_cmode_current,
416 .maxlen = sizeof(int),
417 .mode = 0644,
418 .proc_handler = &cmode_procctl,
419 .strategy = &cmode_sysctl,
420 },
421 {
422 .ctl_name = CTL_PM_P0,
423 .procname = "p0",
424 .data = &clock_p0_current,
425 .maxlen = sizeof(int),
426 .mode = 0644,
427 .proc_handler = &p0_procctl,
428 .strategy = &p0_sysctl,
429 },
430 {
431 .ctl_name = CTL_PM_CM,
432 .procname = "cm",
433 .data = &clock_cm_current,
434 .maxlen = sizeof(int),
435 .mode = 0644,
436 .proc_handler = &cm_procctl,
437 .strategy = &cm_sysctl,
438 },
439 { .ctl_name = 0}
410}; 440};
411 441
412static struct ctl_table pm_dir_table[] = 442static struct ctl_table pm_dir_table[] =
413{ 443{
414 {CTL_PM, "pm", NULL, 0, 0555, pm_table}, 444 {
415 {0} 445 .ctl_name = CTL_PM,
446 .procname = "pm",
447 .mode = 0555,
448 .child = pm_table,
449 },
450 { .ctl_name = 0}
416}; 451};
417 452
418/* 453/*
@@ -420,7 +455,7 @@ static struct ctl_table pm_dir_table[] =
420 */ 455 */
421static int __init pm_init(void) 456static int __init pm_init(void)
422{ 457{
423 register_sysctl_table(pm_dir_table, 1); 458 register_sysctl_table(pm_dir_table);
424 return 0; 459 return 0;
425} 460}
426 461
diff --git a/arch/frv/kernel/sysctl.c b/arch/frv/kernel/sysctl.c
index ce676803eb6f..3e9d7e03fb95 100644
--- a/arch/frv/kernel/sysctl.c
+++ b/arch/frv/kernel/sysctl.c
@@ -175,22 +175,40 @@ static int procctl_frv_pin_cxnr(ctl_table *table, int write, struct file *filp,
175 */ 175 */
176static struct ctl_table frv_table[] = 176static struct ctl_table frv_table[] =
177{ 177{
178 { 1, "cache-mode", NULL, 0, 0644, NULL, &procctl_frv_cachemode }, 178 {
179 .ctl_name = 1,
180 .procname = "cache-mode",
181 .data = NULL,
182 .maxlen = 0,
183 .mode = 0644,
184 .proc_handler = &procctl_frv_cachemode,
185 },
179#ifdef CONFIG_MMU 186#ifdef CONFIG_MMU
180 { 2, "pin-cxnr", NULL, 0, 0644, NULL, &procctl_frv_pin_cxnr }, 187 {
188 .ctl_name = 2,
189 .procname = "pin-cxnr",
190 .data = NULL,
191 .maxlen = 0,
192 .mode = 0644,
193 .proc_handler = &procctl_frv_pin_cxnr
194 },
181#endif 195#endif
182 { 0 } 196 {}
183}; 197};
184 198
185/* 199/*
186 * Use a temporary sysctl number. Horrid, but will be cleaned up in 2.6 200 * Use a temporary sysctl number. Horrid, but will be cleaned up in 2.6
187 * when all the PM interfaces exist nicely. 201 * when all the PM interfaces exist nicely.
188 */ 202 */
189#define CTL_FRV 9898
190static struct ctl_table frv_dir_table[] = 203static struct ctl_table frv_dir_table[] =
191{ 204{
192 {CTL_FRV, "frv", NULL, 0, 0555, frv_table}, 205 {
193 {0} 206 .ctl_name = CTL_FRV,
207 .procname = "frv",
208 .mode = 0555,
209 .child = frv_table
210 },
211 {}
194}; 212};
195 213
196/* 214/*
@@ -198,7 +216,7 @@ static struct ctl_table frv_dir_table[] =
198 */ 216 */
199static int __init frv_sysctl_init(void) 217static int __init frv_sysctl_init(void)
200{ 218{
201 register_sysctl_table(frv_dir_table, 1); 219 register_sysctl_table(frv_dir_table);
202 return 0; 220 return 0;
203} 221}
204 222
diff --git a/arch/i386/Kconfig b/arch/i386/Kconfig
index 63d5e841caf5..595fb771366e 100644
--- a/arch/i386/Kconfig
+++ b/arch/i386/Kconfig
@@ -203,6 +203,15 @@ config PARAVIRT
203 However, when run without a hypervisor the kernel is 203 However, when run without a hypervisor the kernel is
204 theoretically slower. If in doubt, say N. 204 theoretically slower. If in doubt, say N.
205 205
206config VMI
207 bool "VMI Paravirt-ops support"
208 depends on PARAVIRT
209 default y
210 help
211 VMI provides a paravirtualized interface to multiple hypervisors
212 include VMware ESX server and Xen by connecting to a ROM module
213 provided by the hypervisor.
214
206config ACPI_SRAT 215config ACPI_SRAT
207 bool 216 bool
208 default y 217 default y
@@ -1263,3 +1272,12 @@ config X86_TRAMPOLINE
1263config KTIME_SCALAR 1272config KTIME_SCALAR
1264 bool 1273 bool
1265 default y 1274 default y
1275
1276config NO_IDLE_HZ
1277 bool
1278 depends on PARAVIRT
1279 default y
1280 help
1281 Switches the regular HZ timer off when the system is going idle.
1282 This helps a hypervisor detect that the Linux system is idle,
1283 reducing the overhead of idle systems.
diff --git a/arch/i386/Kconfig.cpu b/arch/i386/Kconfig.cpu
index 2aecfba4ac4f..b99c0e2a4e63 100644
--- a/arch/i386/Kconfig.cpu
+++ b/arch/i386/Kconfig.cpu
@@ -226,11 +226,6 @@ config X86_CMPXCHG
226 depends on !M386 226 depends on !M386
227 default y 227 default y
228 228
229config X86_XADD
230 bool
231 depends on !M386
232 default y
233
234config X86_L1_CACHE_SHIFT 229config X86_L1_CACHE_SHIFT
235 int 230 int
236 default "7" if MPENTIUM4 || X86_GENERIC 231 default "7" if MPENTIUM4 || X86_GENERIC
diff --git a/arch/i386/Kconfig.debug b/arch/i386/Kconfig.debug
index f68cc6f215f8..458bc1611933 100644
--- a/arch/i386/Kconfig.debug
+++ b/arch/i386/Kconfig.debug
@@ -87,7 +87,7 @@ config DOUBLEFAULT
87 87
88config DEBUG_PARAVIRT 88config DEBUG_PARAVIRT
89 bool "Enable some paravirtualization debugging" 89 bool "Enable some paravirtualization debugging"
90 default y 90 default n
91 depends on PARAVIRT && DEBUG_KERNEL 91 depends on PARAVIRT && DEBUG_KERNEL
92 help 92 help
93 Currently deliberately clobbers regs which are allowed to be 93 Currently deliberately clobbers regs which are allowed to be
diff --git a/arch/i386/defconfig b/arch/i386/defconfig
index bb0c376b62b3..5ae1e0bc8fd7 100644
--- a/arch/i386/defconfig
+++ b/arch/i386/defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.20-rc3 3# Linux kernel version: 2.6.20-git8
4# Fri Jan 5 11:54:46 2007 4# Tue Feb 13 11:25:18 2007
5# 5#
6CONFIG_X86_32=y 6CONFIG_X86_32=y
7CONFIG_GENERIC_TIME=y 7CONFIG_GENERIC_TIME=y
@@ -10,6 +10,7 @@ CONFIG_STACKTRACE_SUPPORT=y
10CONFIG_SEMAPHORE_SLEEPERS=y 10CONFIG_SEMAPHORE_SLEEPERS=y
11CONFIG_X86=y 11CONFIG_X86=y
12CONFIG_MMU=y 12CONFIG_MMU=y
13CONFIG_ZONE_DMA=y
13CONFIG_GENERIC_ISA_DMA=y 14CONFIG_GENERIC_ISA_DMA=y
14CONFIG_GENERIC_IOMAP=y 15CONFIG_GENERIC_IOMAP=y
15CONFIG_GENERIC_BUG=y 16CONFIG_GENERIC_BUG=y
@@ -139,7 +140,6 @@ CONFIG_MPENTIUMIII=y
139# CONFIG_MVIAC3_2 is not set 140# CONFIG_MVIAC3_2 is not set
140CONFIG_X86_GENERIC=y 141CONFIG_X86_GENERIC=y
141CONFIG_X86_CMPXCHG=y 142CONFIG_X86_CMPXCHG=y
142CONFIG_X86_XADD=y
143CONFIG_X86_L1_CACHE_SHIFT=7 143CONFIG_X86_L1_CACHE_SHIFT=7
144CONFIG_RWSEM_XCHGADD_ALGORITHM=y 144CONFIG_RWSEM_XCHGADD_ALGORITHM=y
145# CONFIG_ARCH_HAS_ILOG2_U32 is not set 145# CONFIG_ARCH_HAS_ILOG2_U32 is not set
@@ -198,6 +198,7 @@ CONFIG_FLAT_NODE_MEM_MAP=y
198# CONFIG_SPARSEMEM_STATIC is not set 198# CONFIG_SPARSEMEM_STATIC is not set
199CONFIG_SPLIT_PTLOCK_CPUS=4 199CONFIG_SPLIT_PTLOCK_CPUS=4
200CONFIG_RESOURCES_64BIT=y 200CONFIG_RESOURCES_64BIT=y
201CONFIG_ZONE_DMA_FLAG=1
201# CONFIG_HIGHPTE is not set 202# CONFIG_HIGHPTE is not set
202# CONFIG_MATH_EMULATION is not set 203# CONFIG_MATH_EMULATION is not set
203CONFIG_MTRR=y 204CONFIG_MTRR=y
@@ -211,6 +212,7 @@ CONFIG_HZ_250=y
211CONFIG_HZ=250 212CONFIG_HZ=250
212# CONFIG_KEXEC is not set 213# CONFIG_KEXEC is not set
213# CONFIG_CRASH_DUMP is not set 214# CONFIG_CRASH_DUMP is not set
215CONFIG_PHYSICAL_START=0x100000
214# CONFIG_RELOCATABLE is not set 216# CONFIG_RELOCATABLE is not set
215CONFIG_PHYSICAL_ALIGN=0x100000 217CONFIG_PHYSICAL_ALIGN=0x100000
216# CONFIG_HOTPLUG_CPU is not set 218# CONFIG_HOTPLUG_CPU is not set
@@ -229,13 +231,14 @@ CONFIG_PM_SYSFS_DEPRECATED=y
229# ACPI (Advanced Configuration and Power Interface) Support 231# ACPI (Advanced Configuration and Power Interface) Support
230# 232#
231CONFIG_ACPI=y 233CONFIG_ACPI=y
234CONFIG_ACPI_PROCFS=y
232CONFIG_ACPI_AC=y 235CONFIG_ACPI_AC=y
233CONFIG_ACPI_BATTERY=y 236CONFIG_ACPI_BATTERY=y
234CONFIG_ACPI_BUTTON=y 237CONFIG_ACPI_BUTTON=y
235# CONFIG_ACPI_VIDEO is not set
236# CONFIG_ACPI_HOTKEY is not set 238# CONFIG_ACPI_HOTKEY is not set
237CONFIG_ACPI_FAN=y 239CONFIG_ACPI_FAN=y
238# CONFIG_ACPI_DOCK is not set 240# CONFIG_ACPI_DOCK is not set
241# CONFIG_ACPI_BAY is not set
239CONFIG_ACPI_PROCESSOR=y 242CONFIG_ACPI_PROCESSOR=y
240CONFIG_ACPI_THERMAL=y 243CONFIG_ACPI_THERMAL=y
241# CONFIG_ACPI_ASUS is not set 244# CONFIG_ACPI_ASUS is not set
@@ -306,7 +309,6 @@ CONFIG_PCI_DIRECT=y
306CONFIG_PCI_MMCONFIG=y 309CONFIG_PCI_MMCONFIG=y
307# CONFIG_PCIEPORTBUS is not set 310# CONFIG_PCIEPORTBUS is not set
308CONFIG_PCI_MSI=y 311CONFIG_PCI_MSI=y
309# CONFIG_PCI_MULTITHREAD_PROBE is not set
310# CONFIG_PCI_DEBUG is not set 312# CONFIG_PCI_DEBUG is not set
311# CONFIG_HT_IRQ is not set 313# CONFIG_HT_IRQ is not set
312CONFIG_ISA_DMA_API=y 314CONFIG_ISA_DMA_API=y
@@ -347,6 +349,7 @@ CONFIG_UNIX=y
347CONFIG_XFRM=y 349CONFIG_XFRM=y
348# CONFIG_XFRM_USER is not set 350# CONFIG_XFRM_USER is not set
349# CONFIG_XFRM_SUB_POLICY is not set 351# CONFIG_XFRM_SUB_POLICY is not set
352# CONFIG_XFRM_MIGRATE is not set
350# CONFIG_NET_KEY is not set 353# CONFIG_NET_KEY is not set
351CONFIG_INET=y 354CONFIG_INET=y
352CONFIG_IP_MULTICAST=y 355CONFIG_IP_MULTICAST=y
@@ -446,6 +449,7 @@ CONFIG_STANDALONE=y
446CONFIG_PREVENT_FIRMWARE_BUILD=y 449CONFIG_PREVENT_FIRMWARE_BUILD=y
447CONFIG_FW_LOADER=y 450CONFIG_FW_LOADER=y
448# CONFIG_DEBUG_DRIVER is not set 451# CONFIG_DEBUG_DRIVER is not set
452# CONFIG_DEBUG_DEVRES is not set
449# CONFIG_SYS_HYPERVISOR is not set 453# CONFIG_SYS_HYPERVISOR is not set
450 454
451# 455#
@@ -466,8 +470,7 @@ CONFIG_FW_LOADER=y
466# 470#
467# Plug and Play support 471# Plug and Play support
468# 472#
469CONFIG_PNP=y 473# CONFIG_PNP is not set
470CONFIG_PNPACPI=y
471 474
472# 475#
473# Block devices 476# Block devices
@@ -515,6 +518,7 @@ CONFIG_BLK_DEV_IDECD=y
515# CONFIG_BLK_DEV_IDETAPE is not set 518# CONFIG_BLK_DEV_IDETAPE is not set
516# CONFIG_BLK_DEV_IDEFLOPPY is not set 519# CONFIG_BLK_DEV_IDEFLOPPY is not set
517# CONFIG_BLK_DEV_IDESCSI is not set 520# CONFIG_BLK_DEV_IDESCSI is not set
521CONFIG_BLK_DEV_IDEACPI=y
518# CONFIG_IDE_TASK_IOCTL is not set 522# CONFIG_IDE_TASK_IOCTL is not set
519 523
520# 524#
@@ -547,6 +551,7 @@ CONFIG_BLK_DEV_AMD74XX=y
547# CONFIG_BLK_DEV_JMICRON is not set 551# CONFIG_BLK_DEV_JMICRON is not set
548# CONFIG_BLK_DEV_SC1200 is not set 552# CONFIG_BLK_DEV_SC1200 is not set
549CONFIG_BLK_DEV_PIIX=y 553CONFIG_BLK_DEV_PIIX=y
554# CONFIG_BLK_DEV_IT8213 is not set
550# CONFIG_BLK_DEV_IT821X is not set 555# CONFIG_BLK_DEV_IT821X is not set
551# CONFIG_BLK_DEV_NS87415 is not set 556# CONFIG_BLK_DEV_NS87415 is not set
552# CONFIG_BLK_DEV_PDC202XX_OLD is not set 557# CONFIG_BLK_DEV_PDC202XX_OLD is not set
@@ -557,6 +562,7 @@ CONFIG_BLK_DEV_PIIX=y
557# CONFIG_BLK_DEV_SLC90E66 is not set 562# CONFIG_BLK_DEV_SLC90E66 is not set
558# CONFIG_BLK_DEV_TRM290 is not set 563# CONFIG_BLK_DEV_TRM290 is not set
559# CONFIG_BLK_DEV_VIA82CXXX is not set 564# CONFIG_BLK_DEV_VIA82CXXX is not set
565# CONFIG_BLK_DEV_TC86C001 is not set
560# CONFIG_IDE_ARM is not set 566# CONFIG_IDE_ARM is not set
561CONFIG_BLK_DEV_IDEDMA=y 567CONFIG_BLK_DEV_IDEDMA=y
562# CONFIG_IDEDMA_IVB is not set 568# CONFIG_IDEDMA_IVB is not set
@@ -655,6 +661,7 @@ CONFIG_AIC79XX_DEBUG_MASK=0
655# Serial ATA (prod) and Parallel ATA (experimental) drivers 661# Serial ATA (prod) and Parallel ATA (experimental) drivers
656# 662#
657CONFIG_ATA=y 663CONFIG_ATA=y
664# CONFIG_ATA_NONSTANDARD is not set
658CONFIG_SATA_AHCI=y 665CONFIG_SATA_AHCI=y
659CONFIG_SATA_SVW=y 666CONFIG_SATA_SVW=y
660CONFIG_ATA_PIIX=y 667CONFIG_ATA_PIIX=y
@@ -670,6 +677,7 @@ CONFIG_SATA_SIL=y
670# CONFIG_SATA_ULI is not set 677# CONFIG_SATA_ULI is not set
671CONFIG_SATA_VIA=y 678CONFIG_SATA_VIA=y
672# CONFIG_SATA_VITESSE is not set 679# CONFIG_SATA_VITESSE is not set
680# CONFIG_SATA_INIC162X is not set
673CONFIG_SATA_INTEL_COMBINED=y 681CONFIG_SATA_INTEL_COMBINED=y
674# CONFIG_PATA_ALI is not set 682# CONFIG_PATA_ALI is not set
675# CONFIG_PATA_AMD is not set 683# CONFIG_PATA_AMD is not set
@@ -687,6 +695,7 @@ CONFIG_SATA_INTEL_COMBINED=y
687# CONFIG_PATA_HPT3X2N is not set 695# CONFIG_PATA_HPT3X2N is not set
688# CONFIG_PATA_HPT3X3 is not set 696# CONFIG_PATA_HPT3X3 is not set
689# CONFIG_PATA_IT821X is not set 697# CONFIG_PATA_IT821X is not set
698# CONFIG_PATA_IT8213 is not set
690# CONFIG_PATA_JMICRON is not set 699# CONFIG_PATA_JMICRON is not set
691# CONFIG_PATA_TRIFLEX is not set 700# CONFIG_PATA_TRIFLEX is not set
692# CONFIG_PATA_MARVELL is not set 701# CONFIG_PATA_MARVELL is not set
@@ -739,9 +748,7 @@ CONFIG_IEEE1394=y
739# Subsystem Options 748# Subsystem Options
740# 749#
741# CONFIG_IEEE1394_VERBOSEDEBUG is not set 750# CONFIG_IEEE1394_VERBOSEDEBUG is not set
742# CONFIG_IEEE1394_OUI_DB is not set
743# CONFIG_IEEE1394_EXTRA_CONFIG_ROMS is not set 751# CONFIG_IEEE1394_EXTRA_CONFIG_ROMS is not set
744# CONFIG_IEEE1394_EXPORT_FULL_API is not set
745 752
746# 753#
747# Device Drivers 754# Device Drivers
@@ -767,6 +774,11 @@ CONFIG_IEEE1394_RAWIO=y
767# CONFIG_I2O is not set 774# CONFIG_I2O is not set
768 775
769# 776#
777# Macintosh device drivers
778#
779# CONFIG_MAC_EMUMOUSEBTN is not set
780
781#
770# Network device support 782# Network device support
771# 783#
772CONFIG_NETDEVICES=y 784CONFIG_NETDEVICES=y
@@ -833,6 +845,7 @@ CONFIG_8139TOO=y
833# CONFIG_SUNDANCE is not set 845# CONFIG_SUNDANCE is not set
834# CONFIG_TLAN is not set 846# CONFIG_TLAN is not set
835# CONFIG_VIA_RHINE is not set 847# CONFIG_VIA_RHINE is not set
848# CONFIG_SC92031 is not set
836 849
837# 850#
838# Ethernet (1000 Mbit) 851# Ethernet (1000 Mbit)
@@ -855,11 +868,13 @@ CONFIG_SKY2=y
855CONFIG_TIGON3=y 868CONFIG_TIGON3=y
856CONFIG_BNX2=y 869CONFIG_BNX2=y
857# CONFIG_QLA3XXX is not set 870# CONFIG_QLA3XXX is not set
871# CONFIG_ATL1 is not set
858 872
859# 873#
860# Ethernet (10000 Mbit) 874# Ethernet (10000 Mbit)
861# 875#
862# CONFIG_CHELSIO_T1 is not set 876# CONFIG_CHELSIO_T1 is not set
877# CONFIG_CHELSIO_T3 is not set
863# CONFIG_IXGB is not set 878# CONFIG_IXGB is not set
864# CONFIG_S2IO is not set 879# CONFIG_S2IO is not set
865# CONFIG_MYRI10GE is not set 880# CONFIG_MYRI10GE is not set
@@ -1090,6 +1105,7 @@ CONFIG_SOUND=y
1090# Open Sound System 1105# Open Sound System
1091# 1106#
1092CONFIG_SOUND_PRIME=y 1107CONFIG_SOUND_PRIME=y
1108CONFIG_OBSOLETE_OSS=y
1093# CONFIG_SOUND_BT878 is not set 1109# CONFIG_SOUND_BT878 is not set
1094# CONFIG_SOUND_ES1371 is not set 1110# CONFIG_SOUND_ES1371 is not set
1095CONFIG_SOUND_ICH=y 1111CONFIG_SOUND_ICH=y
@@ -1103,6 +1119,7 @@ CONFIG_SOUND_ICH=y
1103# HID Devices 1119# HID Devices
1104# 1120#
1105CONFIG_HID=y 1121CONFIG_HID=y
1122# CONFIG_HID_DEBUG is not set
1106 1123
1107# 1124#
1108# USB support 1125# USB support
@@ -1117,10 +1134,8 @@ CONFIG_USB=y
1117# Miscellaneous USB options 1134# Miscellaneous USB options
1118# 1135#
1119CONFIG_USB_DEVICEFS=y 1136CONFIG_USB_DEVICEFS=y
1120# CONFIG_USB_BANDWIDTH is not set
1121# CONFIG_USB_DYNAMIC_MINORS is not set 1137# CONFIG_USB_DYNAMIC_MINORS is not set
1122# CONFIG_USB_SUSPEND is not set 1138# CONFIG_USB_SUSPEND is not set
1123# CONFIG_USB_MULTITHREAD_PROBE is not set
1124# CONFIG_USB_OTG is not set 1139# CONFIG_USB_OTG is not set
1125 1140
1126# 1141#
@@ -1130,9 +1145,11 @@ CONFIG_USB_EHCI_HCD=y
1130# CONFIG_USB_EHCI_SPLIT_ISO is not set 1145# CONFIG_USB_EHCI_SPLIT_ISO is not set
1131# CONFIG_USB_EHCI_ROOT_HUB_TT is not set 1146# CONFIG_USB_EHCI_ROOT_HUB_TT is not set
1132# CONFIG_USB_EHCI_TT_NEWSCHED is not set 1147# CONFIG_USB_EHCI_TT_NEWSCHED is not set
1148# CONFIG_USB_EHCI_BIG_ENDIAN_MMIO is not set
1133# CONFIG_USB_ISP116X_HCD is not set 1149# CONFIG_USB_ISP116X_HCD is not set
1134CONFIG_USB_OHCI_HCD=y 1150CONFIG_USB_OHCI_HCD=y
1135# CONFIG_USB_OHCI_BIG_ENDIAN is not set 1151# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
1152# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
1136CONFIG_USB_OHCI_LITTLE_ENDIAN=y 1153CONFIG_USB_OHCI_LITTLE_ENDIAN=y
1137CONFIG_USB_UHCI_HCD=y 1154CONFIG_USB_UHCI_HCD=y
1138# CONFIG_USB_SL811_HCD is not set 1155# CONFIG_USB_SL811_HCD is not set
@@ -1183,6 +1200,7 @@ CONFIG_USB_HID=y
1183# CONFIG_USB_ATI_REMOTE2 is not set 1200# CONFIG_USB_ATI_REMOTE2 is not set
1184# CONFIG_USB_KEYSPAN_REMOTE is not set 1201# CONFIG_USB_KEYSPAN_REMOTE is not set
1185# CONFIG_USB_APPLETOUCH is not set 1202# CONFIG_USB_APPLETOUCH is not set
1203# CONFIG_USB_GTCO is not set
1186 1204
1187# 1205#
1188# USB Imaging devices 1206# USB Imaging devices
@@ -1288,6 +1306,10 @@ CONFIG_USB_MON=y
1288# 1306#
1289 1307
1290# 1308#
1309# Auxiliary Display support
1310#
1311
1312#
1291# Virtualization 1313# Virtualization
1292# 1314#
1293# CONFIG_KVM is not set 1315# CONFIG_KVM is not set
@@ -1480,6 +1502,7 @@ CONFIG_UNUSED_SYMBOLS=y
1480# CONFIG_DEBUG_FS is not set 1502# CONFIG_DEBUG_FS is not set
1481# CONFIG_HEADERS_CHECK is not set 1503# CONFIG_HEADERS_CHECK is not set
1482CONFIG_DEBUG_KERNEL=y 1504CONFIG_DEBUG_KERNEL=y
1505# CONFIG_DEBUG_SHIRQ is not set
1483CONFIG_LOG_BUF_SHIFT=18 1506CONFIG_LOG_BUF_SHIFT=18
1484CONFIG_DETECT_SOFTLOCKUP=y 1507CONFIG_DETECT_SOFTLOCKUP=y
1485# CONFIG_SCHEDSTATS is not set 1508# CONFIG_SCHEDSTATS is not set
@@ -1488,7 +1511,6 @@ CONFIG_DETECT_SOFTLOCKUP=y
1488# CONFIG_RT_MUTEX_TESTER is not set 1511# CONFIG_RT_MUTEX_TESTER is not set
1489# CONFIG_DEBUG_SPINLOCK is not set 1512# CONFIG_DEBUG_SPINLOCK is not set
1490# CONFIG_DEBUG_MUTEXES is not set 1513# CONFIG_DEBUG_MUTEXES is not set
1491# CONFIG_DEBUG_RWSEMS is not set
1492# CONFIG_DEBUG_LOCK_ALLOC is not set 1514# CONFIG_DEBUG_LOCK_ALLOC is not set
1493# CONFIG_PROVE_LOCKING is not set 1515# CONFIG_PROVE_LOCKING is not set
1494# CONFIG_DEBUG_SPINLOCK_SLEEP is not set 1516# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
@@ -1533,7 +1555,8 @@ CONFIG_CRC32=y
1533# CONFIG_LIBCRC32C is not set 1555# CONFIG_LIBCRC32C is not set
1534CONFIG_ZLIB_INFLATE=y 1556CONFIG_ZLIB_INFLATE=y
1535CONFIG_PLIST=y 1557CONFIG_PLIST=y
1536CONFIG_IOMAP_COPY=y 1558CONFIG_HAS_IOMEM=y
1559CONFIG_HAS_IOPORT=y
1537CONFIG_GENERIC_HARDIRQS=y 1560CONFIG_GENERIC_HARDIRQS=y
1538CONFIG_GENERIC_IRQ_PROBE=y 1561CONFIG_GENERIC_IRQ_PROBE=y
1539CONFIG_GENERIC_PENDING_IRQ=y 1562CONFIG_GENERIC_PENDING_IRQ=y
diff --git a/arch/i386/kernel/Makefile b/arch/i386/kernel/Makefile
index 1e8988e558c5..cbe4e601885c 100644
--- a/arch/i386/kernel/Makefile
+++ b/arch/i386/kernel/Makefile
@@ -40,8 +40,9 @@ obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
40obj-$(CONFIG_HPET_TIMER) += hpet.o 40obj-$(CONFIG_HPET_TIMER) += hpet.o
41obj-$(CONFIG_K8_NB) += k8.o 41obj-$(CONFIG_K8_NB) += k8.o
42 42
43# Make sure this is linked after any other paravirt_ops structs: see head.S 43obj-$(CONFIG_VMI) += vmi.o vmitime.o
44obj-$(CONFIG_PARAVIRT) += paravirt.o 44obj-$(CONFIG_PARAVIRT) += paravirt.o
45obj-y += pcspeaker.o
45 46
46EXTRA_AFLAGS := -traditional 47EXTRA_AFLAGS := -traditional
47 48
diff --git a/arch/i386/kernel/apic.c b/arch/i386/kernel/apic.c
index 776d9be26af9..f4159e0a7ae9 100644
--- a/arch/i386/kernel/apic.c
+++ b/arch/i386/kernel/apic.c
@@ -36,6 +36,7 @@
36#include <asm/hpet.h> 36#include <asm/hpet.h>
37#include <asm/i8253.h> 37#include <asm/i8253.h>
38#include <asm/nmi.h> 38#include <asm/nmi.h>
39#include <asm/idle.h>
39 40
40#include <mach_apic.h> 41#include <mach_apic.h>
41#include <mach_apicdef.h> 42#include <mach_apicdef.h>
@@ -1255,6 +1256,7 @@ fastcall void smp_apic_timer_interrupt(struct pt_regs *regs)
1255 * Besides, if we don't timer interrupts ignore the global 1256 * Besides, if we don't timer interrupts ignore the global
1256 * interrupt lock, which is the WrongThing (tm) to do. 1257 * interrupt lock, which is the WrongThing (tm) to do.
1257 */ 1258 */
1259 exit_idle();
1258 irq_enter(); 1260 irq_enter();
1259 smp_local_timer_interrupt(); 1261 smp_local_timer_interrupt();
1260 irq_exit(); 1262 irq_exit();
@@ -1305,6 +1307,7 @@ fastcall void smp_spurious_interrupt(struct pt_regs *regs)
1305{ 1307{
1306 unsigned long v; 1308 unsigned long v;
1307 1309
1310 exit_idle();
1308 irq_enter(); 1311 irq_enter();
1309 /* 1312 /*
1310 * Check if this really is a spurious interrupt and ACK it 1313 * Check if this really is a spurious interrupt and ACK it
@@ -1329,6 +1332,7 @@ fastcall void smp_error_interrupt(struct pt_regs *regs)
1329{ 1332{
1330 unsigned long v, v1; 1333 unsigned long v, v1;
1331 1334
1335 exit_idle();
1332 irq_enter(); 1336 irq_enter();
1333 /* First tickle the hardware, only then report what went on. -- REW */ 1337 /* First tickle the hardware, only then report what went on. -- REW */
1334 v = apic_read(APIC_ESR); 1338 v = apic_read(APIC_ESR);
@@ -1395,7 +1399,7 @@ int __init APIC_init_uniprocessor (void)
1395 if (!skip_ioapic_setup && nr_ioapics) 1399 if (!skip_ioapic_setup && nr_ioapics)
1396 setup_IO_APIC(); 1400 setup_IO_APIC();
1397#endif 1401#endif
1398 setup_boot_APIC_clock(); 1402 setup_boot_clock();
1399 1403
1400 return 0; 1404 return 0;
1401} 1405}
diff --git a/arch/i386/kernel/apm.c b/arch/i386/kernel/apm.c
index db99a8948dae..f9ba0af7ee1f 100644
--- a/arch/i386/kernel/apm.c
+++ b/arch/i386/kernel/apm.c
@@ -211,6 +211,7 @@
211#include <linux/slab.h> 211#include <linux/slab.h>
212#include <linux/stat.h> 212#include <linux/stat.h>
213#include <linux/proc_fs.h> 213#include <linux/proc_fs.h>
214#include <linux/seq_file.h>
214#include <linux/miscdevice.h> 215#include <linux/miscdevice.h>
215#include <linux/apm_bios.h> 216#include <linux/apm_bios.h>
216#include <linux/init.h> 217#include <linux/init.h>
@@ -1636,9 +1637,8 @@ static int do_open(struct inode * inode, struct file * filp)
1636 return 0; 1637 return 0;
1637} 1638}
1638 1639
1639static int apm_get_info(char *buf, char **start, off_t fpos, int length) 1640static int proc_apm_show(struct seq_file *m, void *v)
1640{ 1641{
1641 char * p;
1642 unsigned short bx; 1642 unsigned short bx;
1643 unsigned short cx; 1643 unsigned short cx;
1644 unsigned short dx; 1644 unsigned short dx;
@@ -1650,8 +1650,6 @@ static int apm_get_info(char *buf, char **start, off_t fpos, int length)
1650 int time_units = -1; 1650 int time_units = -1;
1651 char *units = "?"; 1651 char *units = "?";
1652 1652
1653 p = buf;
1654
1655 if ((num_online_cpus() == 1) && 1653 if ((num_online_cpus() == 1) &&
1656 !(error = apm_get_power_status(&bx, &cx, &dx))) { 1654 !(error = apm_get_power_status(&bx, &cx, &dx))) {
1657 ac_line_status = (bx >> 8) & 0xff; 1655 ac_line_status = (bx >> 8) & 0xff;
@@ -1705,7 +1703,7 @@ static int apm_get_info(char *buf, char **start, off_t fpos, int length)
1705 -1: Unknown 1703 -1: Unknown
1706 8) min = minutes; sec = seconds */ 1704 8) min = minutes; sec = seconds */
1707 1705
1708 p += sprintf(p, "%s %d.%d 0x%02x 0x%02x 0x%02x 0x%02x %d%% %d %s\n", 1706 seq_printf(m, "%s %d.%d 0x%02x 0x%02x 0x%02x 0x%02x %d%% %d %s\n",
1709 driver_version, 1707 driver_version,
1710 (apm_info.bios.version >> 8) & 0xff, 1708 (apm_info.bios.version >> 8) & 0xff,
1711 apm_info.bios.version & 0xff, 1709 apm_info.bios.version & 0xff,
@@ -1716,10 +1714,22 @@ static int apm_get_info(char *buf, char **start, off_t fpos, int length)
1716 percentage, 1714 percentage,
1717 time_units, 1715 time_units,
1718 units); 1716 units);
1717 return 0;
1718}
1719 1719
1720 return p - buf; 1720static int proc_apm_open(struct inode *inode, struct file *file)
1721{
1722 return single_open(file, proc_apm_show, NULL);
1721} 1723}
1722 1724
1725static const struct file_operations apm_file_ops = {
1726 .owner = THIS_MODULE,
1727 .open = proc_apm_open,
1728 .read = seq_read,
1729 .llseek = seq_lseek,
1730 .release = single_release,
1731};
1732
1723static int apm(void *unused) 1733static int apm(void *unused)
1724{ 1734{
1725 unsigned short bx; 1735 unsigned short bx;
@@ -2341,9 +2351,9 @@ static int __init apm_init(void)
2341 set_base(gdt[APM_DS >> 3], 2351 set_base(gdt[APM_DS >> 3],
2342 __va((unsigned long)apm_info.bios.dseg << 4)); 2352 __va((unsigned long)apm_info.bios.dseg << 4));
2343 2353
2344 apm_proc = create_proc_info_entry("apm", 0, NULL, apm_get_info); 2354 apm_proc = create_proc_entry("apm", 0, NULL);
2345 if (apm_proc) 2355 if (apm_proc)
2346 apm_proc->owner = THIS_MODULE; 2356 apm_proc->proc_fops = &apm_file_ops;
2347 2357
2348 kapmd_task = kthread_create(apm, NULL, "kapmd"); 2358 kapmd_task = kthread_create(apm, NULL, "kapmd");
2349 if (IS_ERR(kapmd_task)) { 2359 if (IS_ERR(kapmd_task)) {
diff --git a/arch/i386/kernel/asm-offsets.c b/arch/i386/kernel/asm-offsets.c
index 1b2f3cd33270..c37535163bfc 100644
--- a/arch/i386/kernel/asm-offsets.c
+++ b/arch/i386/kernel/asm-offsets.c
@@ -72,7 +72,7 @@ void foo(void)
72 OFFSET(PT_EAX, pt_regs, eax); 72 OFFSET(PT_EAX, pt_regs, eax);
73 OFFSET(PT_DS, pt_regs, xds); 73 OFFSET(PT_DS, pt_regs, xds);
74 OFFSET(PT_ES, pt_regs, xes); 74 OFFSET(PT_ES, pt_regs, xes);
75 OFFSET(PT_GS, pt_regs, xgs); 75 OFFSET(PT_FS, pt_regs, xfs);
76 OFFSET(PT_ORIG_EAX, pt_regs, orig_eax); 76 OFFSET(PT_ORIG_EAX, pt_regs, orig_eax);
77 OFFSET(PT_EIP, pt_regs, eip); 77 OFFSET(PT_EIP, pt_regs, eip);
78 OFFSET(PT_CS, pt_regs, xcs); 78 OFFSET(PT_CS, pt_regs, xcs);
diff --git a/arch/i386/kernel/cpu/common.c b/arch/i386/kernel/cpu/common.c
index 8a8bbdaaf38a..dcbbd0a8bfc2 100644
--- a/arch/i386/kernel/cpu/common.c
+++ b/arch/i386/kernel/cpu/common.c
@@ -605,7 +605,7 @@ void __init early_cpu_init(void)
605struct pt_regs * __devinit idle_regs(struct pt_regs *regs) 605struct pt_regs * __devinit idle_regs(struct pt_regs *regs)
606{ 606{
607 memset(regs, 0, sizeof(struct pt_regs)); 607 memset(regs, 0, sizeof(struct pt_regs));
608 regs->xgs = __KERNEL_PDA; 608 regs->xfs = __KERNEL_PDA;
609 return regs; 609 return regs;
610} 610}
611 611
@@ -662,12 +662,12 @@ struct i386_pda boot_pda = {
662 .pcurrent = &init_task, 662 .pcurrent = &init_task,
663}; 663};
664 664
665static inline void set_kernel_gs(void) 665static inline void set_kernel_fs(void)
666{ 666{
667 /* Set %gs for this CPU's PDA. Memory clobber is to create a 667 /* Set %fs for this CPU's PDA. Memory clobber is to create a
668 barrier with respect to any PDA operations, so the compiler 668 barrier with respect to any PDA operations, so the compiler
669 doesn't move any before here. */ 669 doesn't move any before here. */
670 asm volatile ("mov %0, %%gs" : : "r" (__KERNEL_PDA) : "memory"); 670 asm volatile ("mov %0, %%fs" : : "r" (__KERNEL_PDA) : "memory");
671} 671}
672 672
673/* Initialize the CPU's GDT and PDA. The boot CPU does this for 673/* Initialize the CPU's GDT and PDA. The boot CPU does this for
@@ -718,7 +718,7 @@ void __cpuinit cpu_set_gdt(int cpu)
718 the boot CPU, this will transition from the boot gdt+pda to 718 the boot CPU, this will transition from the boot gdt+pda to
719 the real ones). */ 719 the real ones). */
720 load_gdt(cpu_gdt_descr); 720 load_gdt(cpu_gdt_descr);
721 set_kernel_gs(); 721 set_kernel_fs();
722} 722}
723 723
724/* Common CPU init for both boot and secondary CPUs */ 724/* Common CPU init for both boot and secondary CPUs */
@@ -764,8 +764,8 @@ static void __cpuinit _cpu_init(int cpu, struct task_struct *curr)
764 __set_tss_desc(cpu, GDT_ENTRY_DOUBLEFAULT_TSS, &doublefault_tss); 764 __set_tss_desc(cpu, GDT_ENTRY_DOUBLEFAULT_TSS, &doublefault_tss);
765#endif 765#endif
766 766
767 /* Clear %fs. */ 767 /* Clear %gs. */
768 asm volatile ("mov %0, %%fs" : : "r" (0)); 768 asm volatile ("mov %0, %%gs" : : "r" (0));
769 769
770 /* Clear all 6 debug registers: */ 770 /* Clear all 6 debug registers: */
771 set_debugreg(0, 0); 771 set_debugreg(0, 0);
diff --git a/arch/i386/kernel/cpu/cyrix.c b/arch/i386/kernel/cpu/cyrix.c
index c0c3b59de32c..de27bd07bc9c 100644
--- a/arch/i386/kernel/cpu/cyrix.c
+++ b/arch/i386/kernel/cpu/cyrix.c
@@ -6,6 +6,7 @@
6#include <asm/io.h> 6#include <asm/io.h>
7#include <asm/processor.h> 7#include <asm/processor.h>
8#include <asm/timer.h> 8#include <asm/timer.h>
9#include <asm/pci-direct.h>
9 10
10#include "cpu.h" 11#include "cpu.h"
11 12
@@ -161,19 +162,19 @@ static void __cpuinit set_cx86_inc(void)
161static void __cpuinit geode_configure(void) 162static void __cpuinit geode_configure(void)
162{ 163{
163 unsigned long flags; 164 unsigned long flags;
164 u8 ccr3, ccr4; 165 u8 ccr3;
165 local_irq_save(flags); 166 local_irq_save(flags);
166 167
167 /* Suspend on halt power saving and enable #SUSP pin */ 168 /* Suspend on halt power saving and enable #SUSP pin */
168 setCx86(CX86_CCR2, getCx86(CX86_CCR2) | 0x88); 169 setCx86(CX86_CCR2, getCx86(CX86_CCR2) | 0x88);
169 170
170 ccr3 = getCx86(CX86_CCR3); 171 ccr3 = getCx86(CX86_CCR3);
171 setCx86(CX86_CCR3, (ccr3 & 0x0f) | 0x10); /* Enable */ 172 setCx86(CX86_CCR3, (ccr3 & 0x0f) | 0x10); /* enable MAPEN */
172
173 ccr4 = getCx86(CX86_CCR4);
174 ccr4 |= 0x38; /* FPU fast, DTE cache, Mem bypass */
175 173
176 setCx86(CX86_CCR3, ccr3); 174
175 /* FPU fast, DTE cache, Mem bypass */
176 setCx86(CX86_CCR4, getCx86(CX86_CCR4) | 0x38);
177 setCx86(CX86_CCR3, ccr3); /* disable MAPEN */
177 178
178 set_cx86_memwb(); 179 set_cx86_memwb();
179 set_cx86_reorder(); 180 set_cx86_reorder();
@@ -183,14 +184,6 @@ static void __cpuinit geode_configure(void)
183} 184}
184 185
185 186
186#ifdef CONFIG_PCI
187static struct pci_device_id __cpuinitdata cyrix_55x0[] = {
188 { PCI_DEVICE(PCI_VENDOR_ID_CYRIX, PCI_DEVICE_ID_CYRIX_5510) },
189 { PCI_DEVICE(PCI_VENDOR_ID_CYRIX, PCI_DEVICE_ID_CYRIX_5520) },
190 { },
191};
192#endif
193
194static void __cpuinit init_cyrix(struct cpuinfo_x86 *c) 187static void __cpuinit init_cyrix(struct cpuinfo_x86 *c)
195{ 188{
196 unsigned char dir0, dir0_msn, dir0_lsn, dir1 = 0; 189 unsigned char dir0, dir0_msn, dir0_lsn, dir1 = 0;
@@ -258,6 +251,8 @@ static void __cpuinit init_cyrix(struct cpuinfo_x86 *c)
258 251
259 case 4: /* MediaGX/GXm or Geode GXM/GXLV/GX1 */ 252 case 4: /* MediaGX/GXm or Geode GXM/GXLV/GX1 */
260#ifdef CONFIG_PCI 253#ifdef CONFIG_PCI
254 {
255 u32 vendor, device;
261 /* It isn't really a PCI quirk directly, but the cure is the 256 /* It isn't really a PCI quirk directly, but the cure is the
262 same. The MediaGX has deep magic SMM stuff that handles the 257 same. The MediaGX has deep magic SMM stuff that handles the
263 SB emulation. It thows away the fifo on disable_dma() which 258 SB emulation. It thows away the fifo on disable_dma() which
@@ -273,22 +268,34 @@ static void __cpuinit init_cyrix(struct cpuinfo_x86 *c)
273 printk(KERN_INFO "Working around Cyrix MediaGX virtual DMA bugs.\n"); 268 printk(KERN_INFO "Working around Cyrix MediaGX virtual DMA bugs.\n");
274 isa_dma_bridge_buggy = 2; 269 isa_dma_bridge_buggy = 2;
275 270
271 /* We do this before the PCI layer is running. However we
272 are safe here as we know the bridge must be a Cyrix
273 companion and must be present */
274 vendor = read_pci_config_16(0, 0, 0x12, PCI_VENDOR_ID);
275 device = read_pci_config_16(0, 0, 0x12, PCI_DEVICE_ID);
276 276
277 /* 277 /*
278 * The 5510/5520 companion chips have a funky PIT. 278 * The 5510/5520 companion chips have a funky PIT.
279 */ 279 */
280 if (pci_dev_present(cyrix_55x0)) 280 if (vendor == PCI_VENDOR_ID_CYRIX &&
281 (device == PCI_DEVICE_ID_CYRIX_5510 || device == PCI_DEVICE_ID_CYRIX_5520))
281 pit_latch_buggy = 1; 282 pit_latch_buggy = 1;
283 }
282#endif 284#endif
283 c->x86_cache_size=16; /* Yep 16K integrated cache thats it */ 285 c->x86_cache_size=16; /* Yep 16K integrated cache thats it */
284 286
285 /* GXm supports extended cpuid levels 'ala' AMD */ 287 /* GXm supports extended cpuid levels 'ala' AMD */
286 if (c->cpuid_level == 2) { 288 if (c->cpuid_level == 2) {
287 /* Enable cxMMX extensions (GX1 Datasheet 54) */ 289 /* Enable cxMMX extensions (GX1 Datasheet 54) */
288 setCx86(CX86_CCR7, getCx86(CX86_CCR7)|1); 290 setCx86(CX86_CCR7, getCx86(CX86_CCR7) | 1);
289 291
290 /* GXlv/GXm/GX1 */ 292 /*
291 if((dir1 >= 0x50 && dir1 <= 0x54) || dir1 >= 0x63) 293 * GXm : 0x30 ... 0x5f GXm datasheet 51
294 * GXlv: 0x6x GXlv datasheet 54
295 * ? : 0x7x
296 * GX1 : 0x8x GX1 datasheet 56
297 */
298 if((0x30 <= dir1 && dir1 <= 0x6f) || (0x80 <=dir1 && dir1 <= 0x8f))
292 geode_configure(); 299 geode_configure();
293 get_model_name(c); /* get CPU marketing name */ 300 get_model_name(c); /* get CPU marketing name */
294 return; 301 return;
@@ -415,15 +422,14 @@ static void __cpuinit cyrix_identify(struct cpuinfo_x86 * c)
415 422
416 if (dir0 == 5 || dir0 == 3) 423 if (dir0 == 5 || dir0 == 3)
417 { 424 {
418 unsigned char ccr3, ccr4; 425 unsigned char ccr3;
419 unsigned long flags; 426 unsigned long flags;
420 printk(KERN_INFO "Enabling CPUID on Cyrix processor.\n"); 427 printk(KERN_INFO "Enabling CPUID on Cyrix processor.\n");
421 local_irq_save(flags); 428 local_irq_save(flags);
422 ccr3 = getCx86(CX86_CCR3); 429 ccr3 = getCx86(CX86_CCR3);
423 setCx86(CX86_CCR3, (ccr3 & 0x0f) | 0x10); /* enable MAPEN */ 430 setCx86(CX86_CCR3, (ccr3 & 0x0f) | 0x10); /* enable MAPEN */
424 ccr4 = getCx86(CX86_CCR4); 431 setCx86(CX86_CCR4, getCx86(CX86_CCR4) | 0x80); /* enable cpuid */
425 setCx86(CX86_CCR4, ccr4 | 0x80); /* enable cpuid */ 432 setCx86(CX86_CCR3, ccr3); /* disable MAPEN */
426 setCx86(CX86_CCR3, ccr3); /* disable MAPEN */
427 local_irq_restore(flags); 433 local_irq_restore(flags);
428 } 434 }
429 } 435 }
diff --git a/arch/i386/kernel/cpu/mcheck/mce.c b/arch/i386/kernel/cpu/mcheck/mce.c
index d555bec0db99..4f10c62d180c 100644
--- a/arch/i386/kernel/cpu/mcheck/mce.c
+++ b/arch/i386/kernel/cpu/mcheck/mce.c
@@ -12,6 +12,7 @@
12 12
13#include <asm/processor.h> 13#include <asm/processor.h>
14#include <asm/system.h> 14#include <asm/system.h>
15#include <asm/mce.h>
15 16
16#include "mce.h" 17#include "mce.h"
17 18
diff --git a/arch/i386/kernel/cpu/mcheck/mce.h b/arch/i386/kernel/cpu/mcheck/mce.h
index 84fd4cf7d0fb..81fb6e2d35f3 100644
--- a/arch/i386/kernel/cpu/mcheck/mce.h
+++ b/arch/i386/kernel/cpu/mcheck/mce.h
@@ -1,4 +1,5 @@
1#include <linux/init.h> 1#include <linux/init.h>
2#include <asm/mce.h>
2 3
3void amd_mcheck_init(struct cpuinfo_x86 *c); 4void amd_mcheck_init(struct cpuinfo_x86 *c);
4void intel_p4_mcheck_init(struct cpuinfo_x86 *c); 5void intel_p4_mcheck_init(struct cpuinfo_x86 *c);
@@ -9,6 +10,5 @@ void winchip_mcheck_init(struct cpuinfo_x86 *c);
9/* Call the installed machine check handler for this CPU setup. */ 10/* Call the installed machine check handler for this CPU setup. */
10extern fastcall void (*machine_check_vector)(struct pt_regs *, long error_code); 11extern fastcall void (*machine_check_vector)(struct pt_regs *, long error_code);
11 12
12extern int mce_disabled;
13extern int nr_mce_banks; 13extern int nr_mce_banks;
14 14
diff --git a/arch/i386/kernel/cpu/mcheck/p4.c b/arch/i386/kernel/cpu/mcheck/p4.c
index 504434a46011..8359c19d3a23 100644
--- a/arch/i386/kernel/cpu/mcheck/p4.c
+++ b/arch/i386/kernel/cpu/mcheck/p4.c
@@ -12,6 +12,7 @@
12#include <asm/system.h> 12#include <asm/system.h>
13#include <asm/msr.h> 13#include <asm/msr.h>
14#include <asm/apic.h> 14#include <asm/apic.h>
15#include <asm/idle.h>
15 16
16#include <asm/therm_throt.h> 17#include <asm/therm_throt.h>
17 18
@@ -59,6 +60,7 @@ static void (*vendor_thermal_interrupt)(struct pt_regs *regs) = unexpected_therm
59 60
60fastcall void smp_thermal_interrupt(struct pt_regs *regs) 61fastcall void smp_thermal_interrupt(struct pt_regs *regs)
61{ 62{
63 exit_idle();
62 irq_enter(); 64 irq_enter();
63 vendor_thermal_interrupt(regs); 65 vendor_thermal_interrupt(regs);
64 irq_exit(); 66 irq_exit();
diff --git a/arch/i386/kernel/cpu/mtrr/if.c b/arch/i386/kernel/cpu/mtrr/if.c
index ee771f305f96..c7d8f1756745 100644
--- a/arch/i386/kernel/cpu/mtrr/if.c
+++ b/arch/i386/kernel/cpu/mtrr/if.c
@@ -211,6 +211,9 @@ mtrr_ioctl(struct file *file, unsigned int cmd, unsigned long __arg)
211 default: 211 default:
212 return -ENOTTY; 212 return -ENOTTY;
213 case MTRRIOC_ADD_ENTRY: 213 case MTRRIOC_ADD_ENTRY:
214#ifdef CONFIG_COMPAT
215 case MTRRIOC32_ADD_ENTRY:
216#endif
214 if (!capable(CAP_SYS_ADMIN)) 217 if (!capable(CAP_SYS_ADMIN))
215 return -EPERM; 218 return -EPERM;
216 err = 219 err =
@@ -218,21 +221,33 @@ mtrr_ioctl(struct file *file, unsigned int cmd, unsigned long __arg)
218 file, 0); 221 file, 0);
219 break; 222 break;
220 case MTRRIOC_SET_ENTRY: 223 case MTRRIOC_SET_ENTRY:
224#ifdef CONFIG_COMPAT
225 case MTRRIOC32_SET_ENTRY:
226#endif
221 if (!capable(CAP_SYS_ADMIN)) 227 if (!capable(CAP_SYS_ADMIN))
222 return -EPERM; 228 return -EPERM;
223 err = mtrr_add(sentry.base, sentry.size, sentry.type, 0); 229 err = mtrr_add(sentry.base, sentry.size, sentry.type, 0);
224 break; 230 break;
225 case MTRRIOC_DEL_ENTRY: 231 case MTRRIOC_DEL_ENTRY:
232#ifdef CONFIG_COMPAT
233 case MTRRIOC32_DEL_ENTRY:
234#endif
226 if (!capable(CAP_SYS_ADMIN)) 235 if (!capable(CAP_SYS_ADMIN))
227 return -EPERM; 236 return -EPERM;
228 err = mtrr_file_del(sentry.base, sentry.size, file, 0); 237 err = mtrr_file_del(sentry.base, sentry.size, file, 0);
229 break; 238 break;
230 case MTRRIOC_KILL_ENTRY: 239 case MTRRIOC_KILL_ENTRY:
240#ifdef CONFIG_COMPAT
241 case MTRRIOC32_KILL_ENTRY:
242#endif
231 if (!capable(CAP_SYS_ADMIN)) 243 if (!capable(CAP_SYS_ADMIN))
232 return -EPERM; 244 return -EPERM;
233 err = mtrr_del(-1, sentry.base, sentry.size); 245 err = mtrr_del(-1, sentry.base, sentry.size);
234 break; 246 break;
235 case MTRRIOC_GET_ENTRY: 247 case MTRRIOC_GET_ENTRY:
248#ifdef CONFIG_COMPAT
249 case MTRRIOC32_GET_ENTRY:
250#endif
236 if (gentry.regnum >= num_var_ranges) 251 if (gentry.regnum >= num_var_ranges)
237 return -EINVAL; 252 return -EINVAL;
238 mtrr_if->get(gentry.regnum, &gentry.base, &size, &type); 253 mtrr_if->get(gentry.regnum, &gentry.base, &size, &type);
@@ -249,6 +264,9 @@ mtrr_ioctl(struct file *file, unsigned int cmd, unsigned long __arg)
249 264
250 break; 265 break;
251 case MTRRIOC_ADD_PAGE_ENTRY: 266 case MTRRIOC_ADD_PAGE_ENTRY:
267#ifdef CONFIG_COMPAT
268 case MTRRIOC32_ADD_PAGE_ENTRY:
269#endif
252 if (!capable(CAP_SYS_ADMIN)) 270 if (!capable(CAP_SYS_ADMIN))
253 return -EPERM; 271 return -EPERM;
254 err = 272 err =
@@ -256,21 +274,33 @@ mtrr_ioctl(struct file *file, unsigned int cmd, unsigned long __arg)
256 file, 1); 274 file, 1);
257 break; 275 break;
258 case MTRRIOC_SET_PAGE_ENTRY: 276 case MTRRIOC_SET_PAGE_ENTRY:
277#ifdef CONFIG_COMPAT
278 case MTRRIOC32_SET_PAGE_ENTRY:
279#endif
259 if (!capable(CAP_SYS_ADMIN)) 280 if (!capable(CAP_SYS_ADMIN))
260 return -EPERM; 281 return -EPERM;
261 err = mtrr_add_page(sentry.base, sentry.size, sentry.type, 0); 282 err = mtrr_add_page(sentry.base, sentry.size, sentry.type, 0);
262 break; 283 break;
263 case MTRRIOC_DEL_PAGE_ENTRY: 284 case MTRRIOC_DEL_PAGE_ENTRY:
285#ifdef CONFIG_COMPAT
286 case MTRRIOC32_DEL_PAGE_ENTRY:
287#endif
264 if (!capable(CAP_SYS_ADMIN)) 288 if (!capable(CAP_SYS_ADMIN))
265 return -EPERM; 289 return -EPERM;
266 err = mtrr_file_del(sentry.base, sentry.size, file, 1); 290 err = mtrr_file_del(sentry.base, sentry.size, file, 1);
267 break; 291 break;
268 case MTRRIOC_KILL_PAGE_ENTRY: 292 case MTRRIOC_KILL_PAGE_ENTRY:
293#ifdef CONFIG_COMPAT
294 case MTRRIOC32_KILL_PAGE_ENTRY:
295#endif
269 if (!capable(CAP_SYS_ADMIN)) 296 if (!capable(CAP_SYS_ADMIN))
270 return -EPERM; 297 return -EPERM;
271 err = mtrr_del_page(-1, sentry.base, sentry.size); 298 err = mtrr_del_page(-1, sentry.base, sentry.size);
272 break; 299 break;
273 case MTRRIOC_GET_PAGE_ENTRY: 300 case MTRRIOC_GET_PAGE_ENTRY:
301#ifdef CONFIG_COMPAT
302 case MTRRIOC32_GET_PAGE_ENTRY:
303#endif
274 if (gentry.regnum >= num_var_ranges) 304 if (gentry.regnum >= num_var_ranges)
275 return -EINVAL; 305 return -EINVAL;
276 mtrr_if->get(gentry.regnum, &gentry.base, &size, &type); 306 mtrr_if->get(gentry.regnum, &gentry.base, &size, &type);
diff --git a/arch/i386/kernel/cpu/mtrr/main.c b/arch/i386/kernel/cpu/mtrr/main.c
index 16bb7ea87145..0acfb6a5a220 100644
--- a/arch/i386/kernel/cpu/mtrr/main.c
+++ b/arch/i386/kernel/cpu/mtrr/main.c
@@ -50,7 +50,7 @@ u32 num_var_ranges = 0;
50unsigned int *usage_table; 50unsigned int *usage_table;
51static DEFINE_MUTEX(mtrr_mutex); 51static DEFINE_MUTEX(mtrr_mutex);
52 52
53u32 size_or_mask, size_and_mask; 53u64 size_or_mask, size_and_mask;
54 54
55static struct mtrr_ops * mtrr_ops[X86_VENDOR_NUM] = {}; 55static struct mtrr_ops * mtrr_ops[X86_VENDOR_NUM] = {};
56 56
@@ -662,8 +662,8 @@ void __init mtrr_bp_init(void)
662 boot_cpu_data.x86_mask == 0x4)) 662 boot_cpu_data.x86_mask == 0x4))
663 phys_addr = 36; 663 phys_addr = 36;
664 664
665 size_or_mask = ~((1 << (phys_addr - PAGE_SHIFT)) - 1); 665 size_or_mask = ~((1ULL << (phys_addr - PAGE_SHIFT)) - 1);
666 size_and_mask = ~size_or_mask & 0xfff00000; 666 size_and_mask = ~size_or_mask & 0xfffff00000ULL;
667 } else if (boot_cpu_data.x86_vendor == X86_VENDOR_CENTAUR && 667 } else if (boot_cpu_data.x86_vendor == X86_VENDOR_CENTAUR &&
668 boot_cpu_data.x86 == 6) { 668 boot_cpu_data.x86 == 6) {
669 /* VIA C* family have Intel style MTRRs, but 669 /* VIA C* family have Intel style MTRRs, but
diff --git a/arch/i386/kernel/cpu/mtrr/mtrr.h b/arch/i386/kernel/cpu/mtrr/mtrr.h
index d61ea9db6cfe..289dfe6030e3 100644
--- a/arch/i386/kernel/cpu/mtrr/mtrr.h
+++ b/arch/i386/kernel/cpu/mtrr/mtrr.h
@@ -84,7 +84,7 @@ void get_mtrr_state(void);
84 84
85extern void set_mtrr_ops(struct mtrr_ops * ops); 85extern void set_mtrr_ops(struct mtrr_ops * ops);
86 86
87extern u32 size_or_mask, size_and_mask; 87extern u64 size_or_mask, size_and_mask;
88extern struct mtrr_ops * mtrr_if; 88extern struct mtrr_ops * mtrr_if;
89 89
90#define is_cpu(vnd) (mtrr_if && mtrr_if->vendor == X86_VENDOR_##vnd) 90#define is_cpu(vnd) (mtrr_if && mtrr_if->vendor == X86_VENDOR_##vnd)
diff --git a/arch/i386/kernel/cpu/proc.c b/arch/i386/kernel/cpu/proc.c
index 6624d8583c42..47e3ebbfb28d 100644
--- a/arch/i386/kernel/cpu/proc.c
+++ b/arch/i386/kernel/cpu/proc.c
@@ -29,7 +29,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
29 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 29 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
30 NULL, NULL, NULL, "syscall", NULL, NULL, NULL, NULL, 30 NULL, NULL, NULL, "syscall", NULL, NULL, NULL, NULL,
31 NULL, NULL, NULL, "mp", "nx", NULL, "mmxext", NULL, 31 NULL, NULL, NULL, "mp", "nx", NULL, "mmxext", NULL,
32 NULL, "fxsr_opt", "rdtscp", NULL, NULL, "lm", "3dnowext", "3dnow", 32 NULL, "fxsr_opt", "pdpe1gb", "rdtscp", NULL, "lm", "3dnowext", "3dnow",
33 33
34 /* Transmeta-defined */ 34 /* Transmeta-defined */
35 "recovery", "longrun", NULL, "lrti", NULL, NULL, NULL, NULL, 35 "recovery", "longrun", NULL, "lrti", NULL, NULL, NULL, NULL,
@@ -47,7 +47,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
47 /* Intel-defined (#2) */ 47 /* Intel-defined (#2) */
48 "pni", NULL, NULL, "monitor", "ds_cpl", "vmx", "smx", "est", 48 "pni", NULL, NULL, "monitor", "ds_cpl", "vmx", "smx", "est",
49 "tm2", "ssse3", "cid", NULL, NULL, "cx16", "xtpr", NULL, 49 "tm2", "ssse3", "cid", NULL, NULL, "cx16", "xtpr", NULL,
50 NULL, NULL, "dca", NULL, NULL, NULL, NULL, NULL, 50 NULL, NULL, "dca", NULL, NULL, NULL, NULL, "popcnt",
51 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 51 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
52 52
53 /* VIA/Cyrix/Centaur-defined */ 53 /* VIA/Cyrix/Centaur-defined */
@@ -57,8 +57,9 @@ static int show_cpuinfo(struct seq_file *m, void *v)
57 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 57 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
58 58
59 /* AMD-defined (#2) */ 59 /* AMD-defined (#2) */
60 "lahf_lm", "cmp_legacy", "svm", NULL, "cr8legacy", NULL, NULL, NULL, 60 "lahf_lm", "cmp_legacy", "svm", "extapic", "cr8legacy", "abm",
61 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 61 "sse4a", "misalignsse",
62 "3dnowprefetch", "osvw", "ibs", NULL, NULL, NULL, NULL, NULL,
62 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 63 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
63 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 64 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
64 }; 65 };
@@ -69,8 +70,11 @@ static int show_cpuinfo(struct seq_file *m, void *v)
69 "ttp", /* thermal trip */ 70 "ttp", /* thermal trip */
70 "tm", 71 "tm",
71 "stc", 72 "stc",
73 "100mhzsteps",
74 "hwpstate",
72 NULL, 75 NULL,
73 /* nothing */ /* constant_tsc - moved to flags */ 76 NULL, /* constant_tsc - moved to flags */
77 /* nothing */
74 }; 78 };
75 struct cpuinfo_x86 *c = v; 79 struct cpuinfo_x86 *c = v;
76 int i, n = c - cpu_data; 80 int i, n = c - cpu_data;
diff --git a/arch/i386/kernel/cpu/transmeta.c b/arch/i386/kernel/cpu/transmeta.c
index 4056fb7d2cdf..5678d46863c6 100644
--- a/arch/i386/kernel/cpu/transmeta.c
+++ b/arch/i386/kernel/cpu/transmeta.c
@@ -9,7 +9,7 @@ static void __cpuinit init_transmeta(struct cpuinfo_x86 *c)
9{ 9{
10 unsigned int cap_mask, uk, max, dummy; 10 unsigned int cap_mask, uk, max, dummy;
11 unsigned int cms_rev1, cms_rev2; 11 unsigned int cms_rev1, cms_rev2;
12 unsigned int cpu_rev, cpu_freq, cpu_flags, new_cpu_rev; 12 unsigned int cpu_rev, cpu_freq = 0, cpu_flags, new_cpu_rev;
13 char cpu_info[65]; 13 char cpu_info[65];
14 14
15 get_model_name(c); /* Same as AMD/Cyrix */ 15 get_model_name(c); /* Same as AMD/Cyrix */
@@ -72,6 +72,9 @@ static void __cpuinit init_transmeta(struct cpuinfo_x86 *c)
72 wrmsr(0x80860004, ~0, uk); 72 wrmsr(0x80860004, ~0, uk);
73 c->x86_capability[0] = cpuid_edx(0x00000001); 73 c->x86_capability[0] = cpuid_edx(0x00000001);
74 wrmsr(0x80860004, cap_mask, uk); 74 wrmsr(0x80860004, cap_mask, uk);
75
76 /* All Transmeta CPUs have a constant TSC */
77 set_bit(X86_FEATURE_CONSTANT_TSC, c->x86_capability);
75 78
76 /* If we can run i686 user-space code, call us an i686 */ 79 /* If we can run i686 user-space code, call us an i686 */
77#define USER686 (X86_FEATURE_TSC|X86_FEATURE_CX8|X86_FEATURE_CMOV) 80#define USER686 (X86_FEATURE_TSC|X86_FEATURE_CX8|X86_FEATURE_CMOV)
diff --git a/arch/i386/kernel/cpuid.c b/arch/i386/kernel/cpuid.c
index 4da75fa3208d..eeae0d992337 100644
--- a/arch/i386/kernel/cpuid.c
+++ b/arch/i386/kernel/cpuid.c
@@ -48,7 +48,6 @@ static struct class *cpuid_class;
48#ifdef CONFIG_SMP 48#ifdef CONFIG_SMP
49 49
50struct cpuid_command { 50struct cpuid_command {
51 int cpu;
52 u32 reg; 51 u32 reg;
53 u32 *data; 52 u32 *data;
54}; 53};
@@ -57,8 +56,7 @@ static void cpuid_smp_cpuid(void *cmd_block)
57{ 56{
58 struct cpuid_command *cmd = (struct cpuid_command *)cmd_block; 57 struct cpuid_command *cmd = (struct cpuid_command *)cmd_block;
59 58
60 if (cmd->cpu == smp_processor_id()) 59 cpuid(cmd->reg, &cmd->data[0], &cmd->data[1], &cmd->data[2],
61 cpuid(cmd->reg, &cmd->data[0], &cmd->data[1], &cmd->data[2],
62 &cmd->data[3]); 60 &cmd->data[3]);
63} 61}
64 62
@@ -70,11 +68,10 @@ static inline void do_cpuid(int cpu, u32 reg, u32 * data)
70 if (cpu == smp_processor_id()) { 68 if (cpu == smp_processor_id()) {
71 cpuid(reg, &data[0], &data[1], &data[2], &data[3]); 69 cpuid(reg, &data[0], &data[1], &data[2], &data[3]);
72 } else { 70 } else {
73 cmd.cpu = cpu;
74 cmd.reg = reg; 71 cmd.reg = reg;
75 cmd.data = data; 72 cmd.data = data;
76 73
77 smp_call_function(cpuid_smp_cpuid, &cmd, 1, 1); 74 smp_call_function_single(cpu, cpuid_smp_cpuid, &cmd, 1, 1);
78 } 75 }
79 preempt_enable(); 76 preempt_enable();
80} 77}
diff --git a/arch/i386/kernel/e820.c b/arch/i386/kernel/e820.c
index f391abcf7da9..70f39560846a 100644
--- a/arch/i386/kernel/e820.c
+++ b/arch/i386/kernel/e820.c
@@ -14,6 +14,7 @@
14#include <asm/pgtable.h> 14#include <asm/pgtable.h>
15#include <asm/page.h> 15#include <asm/page.h>
16#include <asm/e820.h> 16#include <asm/e820.h>
17#include <asm/setup.h>
17 18
18#ifdef CONFIG_EFI 19#ifdef CONFIG_EFI
19int efi_enabled = 0; 20int efi_enabled = 0;
@@ -156,21 +157,22 @@ static struct resource standard_io_resources[] = { {
156 .flags = IORESOURCE_BUSY | IORESOURCE_IO 157 .flags = IORESOURCE_BUSY | IORESOURCE_IO
157} }; 158} };
158 159
159static int romsignature(const unsigned char *x) 160#define ROMSIGNATURE 0xaa55
161
162static int __init romsignature(const unsigned char *rom)
160{ 163{
161 unsigned short sig; 164 unsigned short sig;
162 int ret = 0; 165
163 if (probe_kernel_address((const unsigned short *)x, sig) == 0) 166 return probe_kernel_address((const unsigned short *)rom, sig) == 0 &&
164 ret = (sig == 0xaa55); 167 sig == ROMSIGNATURE;
165 return ret;
166} 168}
167 169
168static int __init romchecksum(unsigned char *rom, unsigned long length) 170static int __init romchecksum(unsigned char *rom, unsigned long length)
169{ 171{
170 unsigned char *p, sum = 0; 172 unsigned char sum;
171 173
172 for (p = rom; p < rom + length; p++) 174 for (sum = 0; length; length--)
173 sum += *p; 175 sum += *rom++;
174 return sum == 0; 176 return sum == 0;
175} 177}
176 178
diff --git a/arch/i386/kernel/entry.S b/arch/i386/kernel/entry.S
index 5e47683fc63a..18bddcb8e9e8 100644
--- a/arch/i386/kernel/entry.S
+++ b/arch/i386/kernel/entry.S
@@ -30,7 +30,7 @@
30 * 18(%esp) - %eax 30 * 18(%esp) - %eax
31 * 1C(%esp) - %ds 31 * 1C(%esp) - %ds
32 * 20(%esp) - %es 32 * 20(%esp) - %es
33 * 24(%esp) - %gs 33 * 24(%esp) - %fs
34 * 28(%esp) - orig_eax 34 * 28(%esp) - orig_eax
35 * 2C(%esp) - %eip 35 * 2C(%esp) - %eip
36 * 30(%esp) - %cs 36 * 30(%esp) - %cs
@@ -99,9 +99,9 @@ VM_MASK = 0x00020000
99 99
100#define SAVE_ALL \ 100#define SAVE_ALL \
101 cld; \ 101 cld; \
102 pushl %gs; \ 102 pushl %fs; \
103 CFI_ADJUST_CFA_OFFSET 4;\ 103 CFI_ADJUST_CFA_OFFSET 4;\
104 /*CFI_REL_OFFSET gs, 0;*/\ 104 /*CFI_REL_OFFSET fs, 0;*/\
105 pushl %es; \ 105 pushl %es; \
106 CFI_ADJUST_CFA_OFFSET 4;\ 106 CFI_ADJUST_CFA_OFFSET 4;\
107 /*CFI_REL_OFFSET es, 0;*/\ 107 /*CFI_REL_OFFSET es, 0;*/\
@@ -133,7 +133,7 @@ VM_MASK = 0x00020000
133 movl %edx, %ds; \ 133 movl %edx, %ds; \
134 movl %edx, %es; \ 134 movl %edx, %es; \
135 movl $(__KERNEL_PDA), %edx; \ 135 movl $(__KERNEL_PDA), %edx; \
136 movl %edx, %gs 136 movl %edx, %fs
137 137
138#define RESTORE_INT_REGS \ 138#define RESTORE_INT_REGS \
139 popl %ebx; \ 139 popl %ebx; \
@@ -166,9 +166,9 @@ VM_MASK = 0x00020000
1662: popl %es; \ 1662: popl %es; \
167 CFI_ADJUST_CFA_OFFSET -4;\ 167 CFI_ADJUST_CFA_OFFSET -4;\
168 /*CFI_RESTORE es;*/\ 168 /*CFI_RESTORE es;*/\
1693: popl %gs; \ 1693: popl %fs; \
170 CFI_ADJUST_CFA_OFFSET -4;\ 170 CFI_ADJUST_CFA_OFFSET -4;\
171 /*CFI_RESTORE gs;*/\ 171 /*CFI_RESTORE fs;*/\
172.pushsection .fixup,"ax"; \ 172.pushsection .fixup,"ax"; \
1734: movl $0,(%esp); \ 1734: movl $0,(%esp); \
174 jmp 1b; \ 174 jmp 1b; \
@@ -227,6 +227,7 @@ ENTRY(ret_from_fork)
227 CFI_ADJUST_CFA_OFFSET -4 227 CFI_ADJUST_CFA_OFFSET -4
228 jmp syscall_exit 228 jmp syscall_exit
229 CFI_ENDPROC 229 CFI_ENDPROC
230END(ret_from_fork)
230 231
231/* 232/*
232 * Return to user mode is not as complex as all this looks, 233 * Return to user mode is not as complex as all this looks,
@@ -258,6 +259,7 @@ ENTRY(resume_userspace)
258 # int/exception return? 259 # int/exception return?
259 jne work_pending 260 jne work_pending
260 jmp restore_all 261 jmp restore_all
262END(ret_from_exception)
261 263
262#ifdef CONFIG_PREEMPT 264#ifdef CONFIG_PREEMPT
263ENTRY(resume_kernel) 265ENTRY(resume_kernel)
@@ -272,6 +274,7 @@ need_resched:
272 jz restore_all 274 jz restore_all
273 call preempt_schedule_irq 275 call preempt_schedule_irq
274 jmp need_resched 276 jmp need_resched
277END(resume_kernel)
275#endif 278#endif
276 CFI_ENDPROC 279 CFI_ENDPROC
277 280
@@ -349,16 +352,17 @@ sysenter_past_esp:
349 movl PT_OLDESP(%esp), %ecx 352 movl PT_OLDESP(%esp), %ecx
350 xorl %ebp,%ebp 353 xorl %ebp,%ebp
351 TRACE_IRQS_ON 354 TRACE_IRQS_ON
3521: mov PT_GS(%esp), %gs 3551: mov PT_FS(%esp), %fs
353 ENABLE_INTERRUPTS_SYSEXIT 356 ENABLE_INTERRUPTS_SYSEXIT
354 CFI_ENDPROC 357 CFI_ENDPROC
355.pushsection .fixup,"ax" 358.pushsection .fixup,"ax"
3562: movl $0,PT_GS(%esp) 3592: movl $0,PT_FS(%esp)
357 jmp 1b 360 jmp 1b
358.section __ex_table,"a" 361.section __ex_table,"a"
359 .align 4 362 .align 4
360 .long 1b,2b 363 .long 1b,2b
361.popsection 364.popsection
365ENDPROC(sysenter_entry)
362 366
363 # system call handler stub 367 # system call handler stub
364ENTRY(system_call) 368ENTRY(system_call)
@@ -459,6 +463,7 @@ ldt_ss:
459 CFI_ADJUST_CFA_OFFSET -8 463 CFI_ADJUST_CFA_OFFSET -8
460 jmp restore_nocheck 464 jmp restore_nocheck
461 CFI_ENDPROC 465 CFI_ENDPROC
466ENDPROC(system_call)
462 467
463 # perform work that needs to be done immediately before resumption 468 # perform work that needs to be done immediately before resumption
464 ALIGN 469 ALIGN
@@ -504,6 +509,7 @@ work_notifysig_v86:
504 xorl %edx, %edx 509 xorl %edx, %edx
505 call do_notify_resume 510 call do_notify_resume
506 jmp resume_userspace_sig 511 jmp resume_userspace_sig
512END(work_pending)
507 513
508 # perform syscall exit tracing 514 # perform syscall exit tracing
509 ALIGN 515 ALIGN
@@ -519,6 +525,7 @@ syscall_trace_entry:
519 cmpl $(nr_syscalls), %eax 525 cmpl $(nr_syscalls), %eax
520 jnae syscall_call 526 jnae syscall_call
521 jmp syscall_exit 527 jmp syscall_exit
528END(syscall_trace_entry)
522 529
523 # perform syscall exit tracing 530 # perform syscall exit tracing
524 ALIGN 531 ALIGN
@@ -532,6 +539,7 @@ syscall_exit_work:
532 movl $1, %edx 539 movl $1, %edx
533 call do_syscall_trace 540 call do_syscall_trace
534 jmp resume_userspace 541 jmp resume_userspace
542END(syscall_exit_work)
535 CFI_ENDPROC 543 CFI_ENDPROC
536 544
537 RING0_INT_FRAME # can't unwind into user space anyway 545 RING0_INT_FRAME # can't unwind into user space anyway
@@ -542,15 +550,17 @@ syscall_fault:
542 GET_THREAD_INFO(%ebp) 550 GET_THREAD_INFO(%ebp)
543 movl $-EFAULT,PT_EAX(%esp) 551 movl $-EFAULT,PT_EAX(%esp)
544 jmp resume_userspace 552 jmp resume_userspace
553END(syscall_fault)
545 554
546syscall_badsys: 555syscall_badsys:
547 movl $-ENOSYS,PT_EAX(%esp) 556 movl $-ENOSYS,PT_EAX(%esp)
548 jmp resume_userspace 557 jmp resume_userspace
558END(syscall_badsys)
549 CFI_ENDPROC 559 CFI_ENDPROC
550 560
551#define FIXUP_ESPFIX_STACK \ 561#define FIXUP_ESPFIX_STACK \
552 /* since we are on a wrong stack, we cant make it a C code :( */ \ 562 /* since we are on a wrong stack, we cant make it a C code :( */ \
553 movl %gs:PDA_cpu, %ebx; \ 563 movl %fs:PDA_cpu, %ebx; \
554 PER_CPU(cpu_gdt_descr, %ebx); \ 564 PER_CPU(cpu_gdt_descr, %ebx); \
555 movl GDS_address(%ebx), %ebx; \ 565 movl GDS_address(%ebx), %ebx; \
556 GET_DESC_BASE(GDT_ENTRY_ESPFIX_SS, %ebx, %eax, %ax, %al, %ah); \ 566 GET_DESC_BASE(GDT_ENTRY_ESPFIX_SS, %ebx, %eax, %ax, %al, %ah); \
@@ -581,9 +591,9 @@ syscall_badsys:
581ENTRY(interrupt) 591ENTRY(interrupt)
582.text 592.text
583 593
584vector=0
585ENTRY(irq_entries_start) 594ENTRY(irq_entries_start)
586 RING0_INT_FRAME 595 RING0_INT_FRAME
596vector=0
587.rept NR_IRQS 597.rept NR_IRQS
588 ALIGN 598 ALIGN
589 .if vector 599 .if vector
@@ -592,11 +602,16 @@ ENTRY(irq_entries_start)
5921: pushl $~(vector) 6021: pushl $~(vector)
593 CFI_ADJUST_CFA_OFFSET 4 603 CFI_ADJUST_CFA_OFFSET 4
594 jmp common_interrupt 604 jmp common_interrupt
595.data 605 .previous
596 .long 1b 606 .long 1b
597.text 607 .text
598vector=vector+1 608vector=vector+1
599.endr 609.endr
610END(irq_entries_start)
611
612.previous
613END(interrupt)
614.previous
600 615
601/* 616/*
602 * the CPU automatically disables interrupts when executing an IRQ vector, 617 * the CPU automatically disables interrupts when executing an IRQ vector,
@@ -609,6 +624,7 @@ common_interrupt:
609 movl %esp,%eax 624 movl %esp,%eax
610 call do_IRQ 625 call do_IRQ
611 jmp ret_from_intr 626 jmp ret_from_intr
627ENDPROC(common_interrupt)
612 CFI_ENDPROC 628 CFI_ENDPROC
613 629
614#define BUILD_INTERRUPT(name, nr) \ 630#define BUILD_INTERRUPT(name, nr) \
@@ -621,18 +637,24 @@ ENTRY(name) \
621 movl %esp,%eax; \ 637 movl %esp,%eax; \
622 call smp_/**/name; \ 638 call smp_/**/name; \
623 jmp ret_from_intr; \ 639 jmp ret_from_intr; \
624 CFI_ENDPROC 640 CFI_ENDPROC; \
641ENDPROC(name)
625 642
626/* The include is where all of the SMP etc. interrupts come from */ 643/* The include is where all of the SMP etc. interrupts come from */
627#include "entry_arch.h" 644#include "entry_arch.h"
628 645
646/* This alternate entry is needed because we hijack the apic LVTT */
647#if defined(CONFIG_VMI) && defined(CONFIG_X86_LOCAL_APIC)
648BUILD_INTERRUPT(apic_vmi_timer_interrupt,LOCAL_TIMER_VECTOR)
649#endif
650
629KPROBE_ENTRY(page_fault) 651KPROBE_ENTRY(page_fault)
630 RING0_EC_FRAME 652 RING0_EC_FRAME
631 pushl $do_page_fault 653 pushl $do_page_fault
632 CFI_ADJUST_CFA_OFFSET 4 654 CFI_ADJUST_CFA_OFFSET 4
633 ALIGN 655 ALIGN
634error_code: 656error_code:
635 /* the function address is in %gs's slot on the stack */ 657 /* the function address is in %fs's slot on the stack */
636 pushl %es 658 pushl %es
637 CFI_ADJUST_CFA_OFFSET 4 659 CFI_ADJUST_CFA_OFFSET 4
638 /*CFI_REL_OFFSET es, 0*/ 660 /*CFI_REL_OFFSET es, 0*/
@@ -661,20 +683,20 @@ error_code:
661 CFI_ADJUST_CFA_OFFSET 4 683 CFI_ADJUST_CFA_OFFSET 4
662 CFI_REL_OFFSET ebx, 0 684 CFI_REL_OFFSET ebx, 0
663 cld 685 cld
664 pushl %gs 686 pushl %fs
665 CFI_ADJUST_CFA_OFFSET 4 687 CFI_ADJUST_CFA_OFFSET 4
666 /*CFI_REL_OFFSET gs, 0*/ 688 /*CFI_REL_OFFSET fs, 0*/
667 movl $(__KERNEL_PDA), %ecx 689 movl $(__KERNEL_PDA), %ecx
668 movl %ecx, %gs 690 movl %ecx, %fs
669 UNWIND_ESPFIX_STACK 691 UNWIND_ESPFIX_STACK
670 popl %ecx 692 popl %ecx
671 CFI_ADJUST_CFA_OFFSET -4 693 CFI_ADJUST_CFA_OFFSET -4
672 /*CFI_REGISTER es, ecx*/ 694 /*CFI_REGISTER es, ecx*/
673 movl PT_GS(%esp), %edi # get the function address 695 movl PT_FS(%esp), %edi # get the function address
674 movl PT_ORIG_EAX(%esp), %edx # get the error code 696 movl PT_ORIG_EAX(%esp), %edx # get the error code
675 movl $-1, PT_ORIG_EAX(%esp) # no syscall to restart 697 movl $-1, PT_ORIG_EAX(%esp) # no syscall to restart
676 mov %ecx, PT_GS(%esp) 698 mov %ecx, PT_FS(%esp)
677 /*CFI_REL_OFFSET gs, ES*/ 699 /*CFI_REL_OFFSET fs, ES*/
678 movl $(__USER_DS), %ecx 700 movl $(__USER_DS), %ecx
679 movl %ecx, %ds 701 movl %ecx, %ds
680 movl %ecx, %es 702 movl %ecx, %es
@@ -692,6 +714,7 @@ ENTRY(coprocessor_error)
692 CFI_ADJUST_CFA_OFFSET 4 714 CFI_ADJUST_CFA_OFFSET 4
693 jmp error_code 715 jmp error_code
694 CFI_ENDPROC 716 CFI_ENDPROC
717END(coprocessor_error)
695 718
696ENTRY(simd_coprocessor_error) 719ENTRY(simd_coprocessor_error)
697 RING0_INT_FRAME 720 RING0_INT_FRAME
@@ -701,6 +724,7 @@ ENTRY(simd_coprocessor_error)
701 CFI_ADJUST_CFA_OFFSET 4 724 CFI_ADJUST_CFA_OFFSET 4
702 jmp error_code 725 jmp error_code
703 CFI_ENDPROC 726 CFI_ENDPROC
727END(simd_coprocessor_error)
704 728
705ENTRY(device_not_available) 729ENTRY(device_not_available)
706 RING0_INT_FRAME 730 RING0_INT_FRAME
@@ -721,6 +745,7 @@ device_not_available_emulate:
721 CFI_ADJUST_CFA_OFFSET -4 745 CFI_ADJUST_CFA_OFFSET -4
722 jmp ret_from_exception 746 jmp ret_from_exception
723 CFI_ENDPROC 747 CFI_ENDPROC
748END(device_not_available)
724 749
725/* 750/*
726 * Debug traps and NMI can happen at the one SYSENTER instruction 751 * Debug traps and NMI can happen at the one SYSENTER instruction
@@ -864,10 +889,12 @@ ENTRY(native_iret)
864 .align 4 889 .align 4
865 .long 1b,iret_exc 890 .long 1b,iret_exc
866.previous 891.previous
892END(native_iret)
867 893
868ENTRY(native_irq_enable_sysexit) 894ENTRY(native_irq_enable_sysexit)
869 sti 895 sti
870 sysexit 896 sysexit
897END(native_irq_enable_sysexit)
871#endif 898#endif
872 899
873KPROBE_ENTRY(int3) 900KPROBE_ENTRY(int3)
@@ -890,6 +917,7 @@ ENTRY(overflow)
890 CFI_ADJUST_CFA_OFFSET 4 917 CFI_ADJUST_CFA_OFFSET 4
891 jmp error_code 918 jmp error_code
892 CFI_ENDPROC 919 CFI_ENDPROC
920END(overflow)
893 921
894ENTRY(bounds) 922ENTRY(bounds)
895 RING0_INT_FRAME 923 RING0_INT_FRAME
@@ -899,6 +927,7 @@ ENTRY(bounds)
899 CFI_ADJUST_CFA_OFFSET 4 927 CFI_ADJUST_CFA_OFFSET 4
900 jmp error_code 928 jmp error_code
901 CFI_ENDPROC 929 CFI_ENDPROC
930END(bounds)
902 931
903ENTRY(invalid_op) 932ENTRY(invalid_op)
904 RING0_INT_FRAME 933 RING0_INT_FRAME
@@ -908,6 +937,7 @@ ENTRY(invalid_op)
908 CFI_ADJUST_CFA_OFFSET 4 937 CFI_ADJUST_CFA_OFFSET 4
909 jmp error_code 938 jmp error_code
910 CFI_ENDPROC 939 CFI_ENDPROC
940END(invalid_op)
911 941
912ENTRY(coprocessor_segment_overrun) 942ENTRY(coprocessor_segment_overrun)
913 RING0_INT_FRAME 943 RING0_INT_FRAME
@@ -917,6 +947,7 @@ ENTRY(coprocessor_segment_overrun)
917 CFI_ADJUST_CFA_OFFSET 4 947 CFI_ADJUST_CFA_OFFSET 4
918 jmp error_code 948 jmp error_code
919 CFI_ENDPROC 949 CFI_ENDPROC
950END(coprocessor_segment_overrun)
920 951
921ENTRY(invalid_TSS) 952ENTRY(invalid_TSS)
922 RING0_EC_FRAME 953 RING0_EC_FRAME
@@ -924,6 +955,7 @@ ENTRY(invalid_TSS)
924 CFI_ADJUST_CFA_OFFSET 4 955 CFI_ADJUST_CFA_OFFSET 4
925 jmp error_code 956 jmp error_code
926 CFI_ENDPROC 957 CFI_ENDPROC
958END(invalid_TSS)
927 959
928ENTRY(segment_not_present) 960ENTRY(segment_not_present)
929 RING0_EC_FRAME 961 RING0_EC_FRAME
@@ -931,6 +963,7 @@ ENTRY(segment_not_present)
931 CFI_ADJUST_CFA_OFFSET 4 963 CFI_ADJUST_CFA_OFFSET 4
932 jmp error_code 964 jmp error_code
933 CFI_ENDPROC 965 CFI_ENDPROC
966END(segment_not_present)
934 967
935ENTRY(stack_segment) 968ENTRY(stack_segment)
936 RING0_EC_FRAME 969 RING0_EC_FRAME
@@ -938,6 +971,7 @@ ENTRY(stack_segment)
938 CFI_ADJUST_CFA_OFFSET 4 971 CFI_ADJUST_CFA_OFFSET 4
939 jmp error_code 972 jmp error_code
940 CFI_ENDPROC 973 CFI_ENDPROC
974END(stack_segment)
941 975
942KPROBE_ENTRY(general_protection) 976KPROBE_ENTRY(general_protection)
943 RING0_EC_FRAME 977 RING0_EC_FRAME
@@ -953,6 +987,7 @@ ENTRY(alignment_check)
953 CFI_ADJUST_CFA_OFFSET 4 987 CFI_ADJUST_CFA_OFFSET 4
954 jmp error_code 988 jmp error_code
955 CFI_ENDPROC 989 CFI_ENDPROC
990END(alignment_check)
956 991
957ENTRY(divide_error) 992ENTRY(divide_error)
958 RING0_INT_FRAME 993 RING0_INT_FRAME
@@ -962,6 +997,7 @@ ENTRY(divide_error)
962 CFI_ADJUST_CFA_OFFSET 4 997 CFI_ADJUST_CFA_OFFSET 4
963 jmp error_code 998 jmp error_code
964 CFI_ENDPROC 999 CFI_ENDPROC
1000END(divide_error)
965 1001
966#ifdef CONFIG_X86_MCE 1002#ifdef CONFIG_X86_MCE
967ENTRY(machine_check) 1003ENTRY(machine_check)
@@ -972,6 +1008,7 @@ ENTRY(machine_check)
972 CFI_ADJUST_CFA_OFFSET 4 1008 CFI_ADJUST_CFA_OFFSET 4
973 jmp error_code 1009 jmp error_code
974 CFI_ENDPROC 1010 CFI_ENDPROC
1011END(machine_check)
975#endif 1012#endif
976 1013
977ENTRY(spurious_interrupt_bug) 1014ENTRY(spurious_interrupt_bug)
@@ -982,6 +1019,7 @@ ENTRY(spurious_interrupt_bug)
982 CFI_ADJUST_CFA_OFFSET 4 1019 CFI_ADJUST_CFA_OFFSET 4
983 jmp error_code 1020 jmp error_code
984 CFI_ENDPROC 1021 CFI_ENDPROC
1022END(spurious_interrupt_bug)
985 1023
986ENTRY(kernel_thread_helper) 1024ENTRY(kernel_thread_helper)
987 pushl $0 # fake return address for unwinder 1025 pushl $0 # fake return address for unwinder
diff --git a/arch/i386/kernel/head.S b/arch/i386/kernel/head.S
index cb9abdfced9b..3fa7f9389afe 100644
--- a/arch/i386/kernel/head.S
+++ b/arch/i386/kernel/head.S
@@ -53,6 +53,7 @@
53 * any particular GDT layout, because we load our own as soon as we 53 * any particular GDT layout, because we load our own as soon as we
54 * can. 54 * can.
55 */ 55 */
56.section .text.head,"ax",@progbits
56ENTRY(startup_32) 57ENTRY(startup_32)
57 58
58#ifdef CONFIG_PARAVIRT 59#ifdef CONFIG_PARAVIRT
@@ -141,16 +142,25 @@ page_pde_offset = (__PAGE_OFFSET >> 20);
141 jb 10b 142 jb 10b
142 movl %edi,(init_pg_tables_end - __PAGE_OFFSET) 143 movl %edi,(init_pg_tables_end - __PAGE_OFFSET)
143 144
144#ifdef CONFIG_SMP
145 xorl %ebx,%ebx /* This is the boot CPU (BSP) */ 145 xorl %ebx,%ebx /* This is the boot CPU (BSP) */
146 jmp 3f 146 jmp 3f
147
148/* 147/*
149 * Non-boot CPU entry point; entered from trampoline.S 148 * Non-boot CPU entry point; entered from trampoline.S
150 * We can't lgdt here, because lgdt itself uses a data segment, but 149 * We can't lgdt here, because lgdt itself uses a data segment, but
151 * we know the trampoline has already loaded the boot_gdt_table GDT 150 * we know the trampoline has already loaded the boot_gdt_table GDT
152 * for us. 151 * for us.
152 *
153 * If cpu hotplug is not supported then this code can go in init section
154 * which will be freed later
153 */ 155 */
156
157#ifdef CONFIG_HOTPLUG_CPU
158.section .text,"ax",@progbits
159#else
160.section .init.text,"ax",@progbits
161#endif
162
163#ifdef CONFIG_SMP
154ENTRY(startup_32_smp) 164ENTRY(startup_32_smp)
155 cld 165 cld
156 movl $(__BOOT_DS),%eax 166 movl $(__BOOT_DS),%eax
@@ -208,8 +218,8 @@ ENTRY(startup_32_smp)
208 xorl %ebx,%ebx 218 xorl %ebx,%ebx
209 incl %ebx 219 incl %ebx
210 220
2113:
212#endif /* CONFIG_SMP */ 221#endif /* CONFIG_SMP */
2223:
213 223
214/* 224/*
215 * Enable paging 225 * Enable paging
@@ -309,7 +319,7 @@ is386: movl $2,%ecx # set MP
309 319
310 call check_x87 320 call check_x87
311 call setup_pda 321 call setup_pda
312 lgdt cpu_gdt_descr 322 lgdt early_gdt_descr
313 lidt idt_descr 323 lidt idt_descr
314 ljmp $(__KERNEL_CS),$1f 324 ljmp $(__KERNEL_CS),$1f
3151: movl $(__KERNEL_DS),%eax # reload all the segment registers 3251: movl $(__KERNEL_DS),%eax # reload all the segment registers
@@ -319,12 +329,12 @@ is386: movl $2,%ecx # set MP
319 movl %eax,%ds 329 movl %eax,%ds
320 movl %eax,%es 330 movl %eax,%es
321 331
322 xorl %eax,%eax # Clear FS and LDT 332 xorl %eax,%eax # Clear GS and LDT
323 movl %eax,%fs 333 movl %eax,%gs
324 lldt %ax 334 lldt %ax
325 335
326 movl $(__KERNEL_PDA),%eax 336 movl $(__KERNEL_PDA),%eax
327 mov %eax,%gs 337 mov %eax,%fs
328 338
329 cld # gcc2 wants the direction flag cleared at all times 339 cld # gcc2 wants the direction flag cleared at all times
330 pushl $0 # fake return address for unwinder 340 pushl $0 # fake return address for unwinder
@@ -360,12 +370,12 @@ check_x87:
360 * cpu_gdt_table and boot_pda; for secondary CPUs, these will be 370 * cpu_gdt_table and boot_pda; for secondary CPUs, these will be
361 * that CPU's GDT and PDA. 371 * that CPU's GDT and PDA.
362 */ 372 */
363setup_pda: 373ENTRY(setup_pda)
364 /* get the PDA pointer */ 374 /* get the PDA pointer */
365 movl start_pda, %eax 375 movl start_pda, %eax
366 376
367 /* slot the PDA address into the GDT */ 377 /* slot the PDA address into the GDT */
368 mov cpu_gdt_descr+2, %ecx 378 mov early_gdt_descr+2, %ecx
369 mov %ax, (__KERNEL_PDA+0+2)(%ecx) /* base & 0x0000ffff */ 379 mov %ax, (__KERNEL_PDA+0+2)(%ecx) /* base & 0x0000ffff */
370 shr $16, %eax 380 shr $16, %eax
371 mov %al, (__KERNEL_PDA+4+0)(%ecx) /* base & 0x00ff0000 */ 381 mov %al, (__KERNEL_PDA+4+0)(%ecx) /* base & 0x00ff0000 */
@@ -492,6 +502,7 @@ ignore_int:
492#endif 502#endif
493 iret 503 iret
494 504
505.section .text
495#ifdef CONFIG_PARAVIRT 506#ifdef CONFIG_PARAVIRT
496startup_paravirt: 507startup_paravirt:
497 cld 508 cld
@@ -502,10 +513,11 @@ startup_paravirt:
502 pushl %ecx 513 pushl %ecx
503 pushl %eax 514 pushl %eax
504 515
505 /* paravirt.o is last in link, and that probe fn never returns */
506 pushl $__start_paravirtprobe 516 pushl $__start_paravirtprobe
5071: 5171:
508 movl 0(%esp), %eax 518 movl 0(%esp), %eax
519 cmpl $__stop_paravirtprobe, %eax
520 je unhandled_paravirt
509 pushl (%eax) 521 pushl (%eax)
510 movl 8(%esp), %eax 522 movl 8(%esp), %eax
511 call *(%esp) 523 call *(%esp)
@@ -517,6 +529,10 @@ startup_paravirt:
517 529
518 addl $4, (%esp) 530 addl $4, (%esp)
519 jmp 1b 531 jmp 1b
532
533unhandled_paravirt:
534 /* Nothing wanted us: we're screwed. */
535 ud2
520#endif 536#endif
521 537
522/* 538/*
@@ -581,7 +597,7 @@ idt_descr:
581 597
582# boot GDT descriptor (later on used by CPU#0): 598# boot GDT descriptor (later on used by CPU#0):
583 .word 0 # 32 bit align gdt_desc.address 599 .word 0 # 32 bit align gdt_desc.address
584ENTRY(cpu_gdt_descr) 600ENTRY(early_gdt_descr)
585 .word GDT_ENTRIES*8-1 601 .word GDT_ENTRIES*8-1
586 .long cpu_gdt_table 602 .long cpu_gdt_table
587 603
diff --git a/arch/i386/kernel/io_apic.c b/arch/i386/kernel/io_apic.c
index ba8d302a0b72..e30ccedad0b9 100644
--- a/arch/i386/kernel/io_apic.c
+++ b/arch/i386/kernel/io_apic.c
@@ -1920,7 +1920,7 @@ static void __init setup_ioapic_ids_from_mpc(void)
1920static void __init setup_ioapic_ids_from_mpc(void) { } 1920static void __init setup_ioapic_ids_from_mpc(void) { }
1921#endif 1921#endif
1922 1922
1923static int no_timer_check __initdata; 1923int no_timer_check __initdata;
1924 1924
1925static int __init notimercheck(char *s) 1925static int __init notimercheck(char *s)
1926{ 1926{
@@ -2310,7 +2310,7 @@ static inline void __init check_timer(void)
2310 2310
2311 disable_8259A_irq(0); 2311 disable_8259A_irq(0);
2312 set_irq_chip_and_handler_name(0, &lapic_chip, handle_fasteoi_irq, 2312 set_irq_chip_and_handler_name(0, &lapic_chip, handle_fasteoi_irq,
2313 "fasteio"); 2313 "fasteoi");
2314 apic_write_around(APIC_LVT0, APIC_DM_FIXED | vector); /* Fixed mode */ 2314 apic_write_around(APIC_LVT0, APIC_DM_FIXED | vector); /* Fixed mode */
2315 enable_8259A_irq(0); 2315 enable_8259A_irq(0);
2316 2316
diff --git a/arch/i386/kernel/irq.c b/arch/i386/kernel/irq.c
index 3201d421090a..5785d84103a6 100644
--- a/arch/i386/kernel/irq.c
+++ b/arch/i386/kernel/irq.c
@@ -19,6 +19,8 @@
19#include <linux/cpu.h> 19#include <linux/cpu.h>
20#include <linux/delay.h> 20#include <linux/delay.h>
21 21
22#include <asm/idle.h>
23
22DEFINE_PER_CPU(irq_cpustat_t, irq_stat) ____cacheline_internodealigned_in_smp; 24DEFINE_PER_CPU(irq_cpustat_t, irq_stat) ____cacheline_internodealigned_in_smp;
23EXPORT_PER_CPU_SYMBOL(irq_stat); 25EXPORT_PER_CPU_SYMBOL(irq_stat);
24 26
@@ -61,6 +63,7 @@ fastcall unsigned int do_IRQ(struct pt_regs *regs)
61 union irq_ctx *curctx, *irqctx; 63 union irq_ctx *curctx, *irqctx;
62 u32 *isp; 64 u32 *isp;
63#endif 65#endif
66 exit_idle();
64 67
65 if (unlikely((unsigned)irq >= NR_IRQS)) { 68 if (unlikely((unsigned)irq >= NR_IRQS)) {
66 printk(KERN_EMERG "%s: cannot handle IRQ %d\n", 69 printk(KERN_EMERG "%s: cannot handle IRQ %d\n",
diff --git a/arch/i386/kernel/kprobes.c b/arch/i386/kernel/kprobes.c
index af1d53344993..b545bc746fce 100644
--- a/arch/i386/kernel/kprobes.c
+++ b/arch/i386/kernel/kprobes.c
@@ -363,7 +363,7 @@ no_kprobe:
363 " pushf\n" 363 " pushf\n"
364 /* skip cs, eip, orig_eax */ 364 /* skip cs, eip, orig_eax */
365 " subl $12, %esp\n" 365 " subl $12, %esp\n"
366 " pushl %gs\n" 366 " pushl %fs\n"
367 " pushl %ds\n" 367 " pushl %ds\n"
368 " pushl %es\n" 368 " pushl %es\n"
369 " pushl %eax\n" 369 " pushl %eax\n"
@@ -387,7 +387,7 @@ no_kprobe:
387 " popl %edi\n" 387 " popl %edi\n"
388 " popl %ebp\n" 388 " popl %ebp\n"
389 " popl %eax\n" 389 " popl %eax\n"
390 /* skip eip, orig_eax, es, ds, gs */ 390 /* skip eip, orig_eax, es, ds, fs */
391 " addl $20, %esp\n" 391 " addl $20, %esp\n"
392 " popf\n" 392 " popf\n"
393 " ret\n"); 393 " ret\n");
@@ -408,7 +408,7 @@ fastcall void *__kprobes trampoline_handler(struct pt_regs *regs)
408 spin_lock_irqsave(&kretprobe_lock, flags); 408 spin_lock_irqsave(&kretprobe_lock, flags);
409 head = kretprobe_inst_table_head(current); 409 head = kretprobe_inst_table_head(current);
410 /* fixup registers */ 410 /* fixup registers */
411 regs->xcs = __KERNEL_CS; 411 regs->xcs = __KERNEL_CS | get_kernel_rpl();
412 regs->eip = trampoline_address; 412 regs->eip = trampoline_address;
413 regs->orig_eax = 0xffffffff; 413 regs->orig_eax = 0xffffffff;
414 414
diff --git a/arch/i386/kernel/microcode.c b/arch/i386/kernel/microcode.c
index 381252bae3d8..b8f16633a6ec 100644
--- a/arch/i386/kernel/microcode.c
+++ b/arch/i386/kernel/microcode.c
@@ -384,7 +384,7 @@ static int do_microcode_update (void)
384{ 384{
385 long cursor = 0; 385 long cursor = 0;
386 int error = 0; 386 int error = 0;
387 void *new_mc; 387 void *new_mc = NULL;
388 int cpu; 388 int cpu;
389 cpumask_t old; 389 cpumask_t old;
390 390
diff --git a/arch/i386/kernel/msr.c b/arch/i386/kernel/msr.c
index 4e14264f392a..bcaa6e9b6197 100644
--- a/arch/i386/kernel/msr.c
+++ b/arch/i386/kernel/msr.c
@@ -68,7 +68,6 @@ static inline int rdmsr_eio(u32 reg, u32 *eax, u32 *edx)
68#ifdef CONFIG_SMP 68#ifdef CONFIG_SMP
69 69
70struct msr_command { 70struct msr_command {
71 int cpu;
72 int err; 71 int err;
73 u32 reg; 72 u32 reg;
74 u32 data[2]; 73 u32 data[2];
@@ -78,16 +77,14 @@ static void msr_smp_wrmsr(void *cmd_block)
78{ 77{
79 struct msr_command *cmd = (struct msr_command *)cmd_block; 78 struct msr_command *cmd = (struct msr_command *)cmd_block;
80 79
81 if (cmd->cpu == smp_processor_id()) 80 cmd->err = wrmsr_eio(cmd->reg, cmd->data[0], cmd->data[1]);
82 cmd->err = wrmsr_eio(cmd->reg, cmd->data[0], cmd->data[1]);
83} 81}
84 82
85static void msr_smp_rdmsr(void *cmd_block) 83static void msr_smp_rdmsr(void *cmd_block)
86{ 84{
87 struct msr_command *cmd = (struct msr_command *)cmd_block; 85 struct msr_command *cmd = (struct msr_command *)cmd_block;
88 86
89 if (cmd->cpu == smp_processor_id()) 87 cmd->err = rdmsr_eio(cmd->reg, &cmd->data[0], &cmd->data[1]);
90 cmd->err = rdmsr_eio(cmd->reg, &cmd->data[0], &cmd->data[1]);
91} 88}
92 89
93static inline int do_wrmsr(int cpu, u32 reg, u32 eax, u32 edx) 90static inline int do_wrmsr(int cpu, u32 reg, u32 eax, u32 edx)
@@ -99,12 +96,11 @@ static inline int do_wrmsr(int cpu, u32 reg, u32 eax, u32 edx)
99 if (cpu == smp_processor_id()) { 96 if (cpu == smp_processor_id()) {
100 ret = wrmsr_eio(reg, eax, edx); 97 ret = wrmsr_eio(reg, eax, edx);
101 } else { 98 } else {
102 cmd.cpu = cpu;
103 cmd.reg = reg; 99 cmd.reg = reg;
104 cmd.data[0] = eax; 100 cmd.data[0] = eax;
105 cmd.data[1] = edx; 101 cmd.data[1] = edx;
106 102
107 smp_call_function(msr_smp_wrmsr, &cmd, 1, 1); 103 smp_call_function_single(cpu, msr_smp_wrmsr, &cmd, 1, 1);
108 ret = cmd.err; 104 ret = cmd.err;
109 } 105 }
110 preempt_enable(); 106 preempt_enable();
@@ -120,10 +116,9 @@ static inline int do_rdmsr(int cpu, u32 reg, u32 * eax, u32 * edx)
120 if (cpu == smp_processor_id()) { 116 if (cpu == smp_processor_id()) {
121 ret = rdmsr_eio(reg, eax, edx); 117 ret = rdmsr_eio(reg, eax, edx);
122 } else { 118 } else {
123 cmd.cpu = cpu;
124 cmd.reg = reg; 119 cmd.reg = reg;
125 120
126 smp_call_function(msr_smp_rdmsr, &cmd, 1, 1); 121 smp_call_function_single(cpu, msr_smp_rdmsr, &cmd, 1, 1);
127 122
128 *eax = cmd.data[0]; 123 *eax = cmd.data[0];
129 *edx = cmd.data[1]; 124 *edx = cmd.data[1];
diff --git a/arch/i386/kernel/nmi.c b/arch/i386/kernel/nmi.c
index 1a6f8bb8881c..5d8a07c20281 100644
--- a/arch/i386/kernel/nmi.c
+++ b/arch/i386/kernel/nmi.c
@@ -185,7 +185,8 @@ static __cpuinit inline int nmi_known_cpu(void)
185{ 185{
186 switch (boot_cpu_data.x86_vendor) { 186 switch (boot_cpu_data.x86_vendor) {
187 case X86_VENDOR_AMD: 187 case X86_VENDOR_AMD:
188 return ((boot_cpu_data.x86 == 15) || (boot_cpu_data.x86 == 6)); 188 return ((boot_cpu_data.x86 == 15) || (boot_cpu_data.x86 == 6)
189 || (boot_cpu_data.x86 == 16));
189 case X86_VENDOR_INTEL: 190 case X86_VENDOR_INTEL:
190 if (cpu_has(&boot_cpu_data, X86_FEATURE_ARCH_PERFMON)) 191 if (cpu_has(&boot_cpu_data, X86_FEATURE_ARCH_PERFMON))
191 return 1; 192 return 1;
@@ -216,6 +217,28 @@ static __init void nmi_cpu_busy(void *data)
216} 217}
217#endif 218#endif
218 219
220static unsigned int adjust_for_32bit_ctr(unsigned int hz)
221{
222 u64 counter_val;
223 unsigned int retval = hz;
224
225 /*
226 * On Intel CPUs with P6/ARCH_PERFMON only 32 bits in the counter
227 * are writable, with higher bits sign extending from bit 31.
228 * So, we can only program the counter with 31 bit values and
229 * 32nd bit should be 1, for 33.. to be 1.
230 * Find the appropriate nmi_hz
231 */
232 counter_val = (u64)cpu_khz * 1000;
233 do_div(counter_val, retval);
234 if (counter_val > 0x7fffffffULL) {
235 u64 count = (u64)cpu_khz * 1000;
236 do_div(count, 0x7fffffffUL);
237 retval = count + 1;
238 }
239 return retval;
240}
241
219static int __init check_nmi_watchdog(void) 242static int __init check_nmi_watchdog(void)
220{ 243{
221 unsigned int *prev_nmi_count; 244 unsigned int *prev_nmi_count;
@@ -281,18 +304,10 @@ static int __init check_nmi_watchdog(void)
281 struct nmi_watchdog_ctlblk *wd = &__get_cpu_var(nmi_watchdog_ctlblk); 304 struct nmi_watchdog_ctlblk *wd = &__get_cpu_var(nmi_watchdog_ctlblk);
282 305
283 nmi_hz = 1; 306 nmi_hz = 1;
284 /* 307
285 * On Intel CPUs with ARCH_PERFMON only 32 bits in the counter 308 if (wd->perfctr_msr == MSR_P6_PERFCTR0 ||
286 * are writable, with higher bits sign extending from bit 31. 309 wd->perfctr_msr == MSR_ARCH_PERFMON_PERFCTR0) {
287 * So, we can only program the counter with 31 bit values and 310 nmi_hz = adjust_for_32bit_ctr(nmi_hz);
288 * 32nd bit should be 1, for 33.. to be 1.
289 * Find the appropriate nmi_hz
290 */
291 if (wd->perfctr_msr == MSR_ARCH_PERFMON_PERFCTR0 &&
292 ((u64)cpu_khz * 1000) > 0x7fffffffULL) {
293 u64 count = (u64)cpu_khz * 1000;
294 do_div(count, 0x7fffffffUL);
295 nmi_hz = count + 1;
296 } 311 }
297 } 312 }
298 313
@@ -369,6 +384,34 @@ void enable_timer_nmi_watchdog(void)
369 } 384 }
370} 385}
371 386
387static void __acpi_nmi_disable(void *__unused)
388{
389 apic_write_around(APIC_LVT0, APIC_DM_NMI | APIC_LVT_MASKED);
390}
391
392/*
393 * Disable timer based NMIs on all CPUs:
394 */
395void acpi_nmi_disable(void)
396{
397 if (atomic_read(&nmi_active) && nmi_watchdog == NMI_IO_APIC)
398 on_each_cpu(__acpi_nmi_disable, NULL, 0, 1);
399}
400
401static void __acpi_nmi_enable(void *__unused)
402{
403 apic_write_around(APIC_LVT0, APIC_DM_NMI);
404}
405
406/*
407 * Enable timer based NMIs on all CPUs:
408 */
409void acpi_nmi_enable(void)
410{
411 if (atomic_read(&nmi_active) && nmi_watchdog == NMI_IO_APIC)
412 on_each_cpu(__acpi_nmi_enable, NULL, 0, 1);
413}
414
372#ifdef CONFIG_PM 415#ifdef CONFIG_PM
373 416
374static int nmi_pm_active; /* nmi_active before suspend */ 417static int nmi_pm_active; /* nmi_active before suspend */
@@ -442,6 +485,17 @@ static void write_watchdog_counter(unsigned int perfctr_msr, const char *descr)
442 wrmsrl(perfctr_msr, 0 - count); 485 wrmsrl(perfctr_msr, 0 - count);
443} 486}
444 487
488static void write_watchdog_counter32(unsigned int perfctr_msr,
489 const char *descr)
490{
491 u64 count = (u64)cpu_khz * 1000;
492
493 do_div(count, nmi_hz);
494 if(descr)
495 Dprintk("setting %s to -0x%08Lx\n", descr, count);
496 wrmsr(perfctr_msr, (u32)(-count), 0);
497}
498
445/* Note that these events don't tick when the CPU idles. This means 499/* Note that these events don't tick when the CPU idles. This means
446 the frequency varies with CPU load. */ 500 the frequency varies with CPU load. */
447 501
@@ -531,7 +585,8 @@ static int setup_p6_watchdog(void)
531 585
532 /* setup the timer */ 586 /* setup the timer */
533 wrmsr(evntsel_msr, evntsel, 0); 587 wrmsr(evntsel_msr, evntsel, 0);
534 write_watchdog_counter(perfctr_msr, "P6_PERFCTR0"); 588 nmi_hz = adjust_for_32bit_ctr(nmi_hz);
589 write_watchdog_counter32(perfctr_msr, "P6_PERFCTR0");
535 apic_write(APIC_LVTPC, APIC_DM_NMI); 590 apic_write(APIC_LVTPC, APIC_DM_NMI);
536 evntsel |= P6_EVNTSEL0_ENABLE; 591 evntsel |= P6_EVNTSEL0_ENABLE;
537 wrmsr(evntsel_msr, evntsel, 0); 592 wrmsr(evntsel_msr, evntsel, 0);
@@ -704,7 +759,8 @@ static int setup_intel_arch_watchdog(void)
704 759
705 /* setup the timer */ 760 /* setup the timer */
706 wrmsr(evntsel_msr, evntsel, 0); 761 wrmsr(evntsel_msr, evntsel, 0);
707 write_watchdog_counter(perfctr_msr, "INTEL_ARCH_PERFCTR0"); 762 nmi_hz = adjust_for_32bit_ctr(nmi_hz);
763 write_watchdog_counter32(perfctr_msr, "INTEL_ARCH_PERFCTR0");
708 apic_write(APIC_LVTPC, APIC_DM_NMI); 764 apic_write(APIC_LVTPC, APIC_DM_NMI);
709 evntsel |= ARCH_PERFMON_EVENTSEL0_ENABLE; 765 evntsel |= ARCH_PERFMON_EVENTSEL0_ENABLE;
710 wrmsr(evntsel_msr, evntsel, 0); 766 wrmsr(evntsel_msr, evntsel, 0);
@@ -762,7 +818,8 @@ void setup_apic_nmi_watchdog (void *unused)
762 if (nmi_watchdog == NMI_LOCAL_APIC) { 818 if (nmi_watchdog == NMI_LOCAL_APIC) {
763 switch (boot_cpu_data.x86_vendor) { 819 switch (boot_cpu_data.x86_vendor) {
764 case X86_VENDOR_AMD: 820 case X86_VENDOR_AMD:
765 if (boot_cpu_data.x86 != 6 && boot_cpu_data.x86 != 15) 821 if (boot_cpu_data.x86 != 6 && boot_cpu_data.x86 != 15 &&
822 boot_cpu_data.x86 != 16)
766 return; 823 return;
767 if (!setup_k7_watchdog()) 824 if (!setup_k7_watchdog())
768 return; 825 return;
@@ -956,6 +1013,8 @@ __kprobes int nmi_watchdog_tick(struct pt_regs * regs, unsigned reason)
956 dummy &= ~P4_CCCR_OVF; 1013 dummy &= ~P4_CCCR_OVF;
957 wrmsrl(wd->cccr_msr, dummy); 1014 wrmsrl(wd->cccr_msr, dummy);
958 apic_write(APIC_LVTPC, APIC_DM_NMI); 1015 apic_write(APIC_LVTPC, APIC_DM_NMI);
1016 /* start the cycle over again */
1017 write_watchdog_counter(wd->perfctr_msr, NULL);
959 } 1018 }
960 else if (wd->perfctr_msr == MSR_P6_PERFCTR0 || 1019 else if (wd->perfctr_msr == MSR_P6_PERFCTR0 ||
961 wd->perfctr_msr == MSR_ARCH_PERFMON_PERFCTR0) { 1020 wd->perfctr_msr == MSR_ARCH_PERFMON_PERFCTR0) {
@@ -964,9 +1023,12 @@ __kprobes int nmi_watchdog_tick(struct pt_regs * regs, unsigned reason)
964 * other P6 variant. 1023 * other P6 variant.
965 * ArchPerfom/Core Duo also needs this */ 1024 * ArchPerfom/Core Duo also needs this */
966 apic_write(APIC_LVTPC, APIC_DM_NMI); 1025 apic_write(APIC_LVTPC, APIC_DM_NMI);
1026 /* P6/ARCH_PERFMON has 32 bit counter write */
1027 write_watchdog_counter32(wd->perfctr_msr, NULL);
1028 } else {
1029 /* start the cycle over again */
1030 write_watchdog_counter(wd->perfctr_msr, NULL);
967 } 1031 }
968 /* start the cycle over again */
969 write_watchdog_counter(wd->perfctr_msr, NULL);
970 rc = 1; 1032 rc = 1;
971 } else if (nmi_watchdog == NMI_IO_APIC) { 1033 } else if (nmi_watchdog == NMI_IO_APIC) {
972 /* don't know how to accurately check for this. 1034 /* don't know how to accurately check for this.
diff --git a/arch/i386/kernel/paravirt.c b/arch/i386/kernel/paravirt.c
index e55fd05da0f5..c156ecfa3872 100644
--- a/arch/i386/kernel/paravirt.c
+++ b/arch/i386/kernel/paravirt.c
@@ -92,7 +92,7 @@ static unsigned native_patch(u8 type, u16 clobbers, void *insns, unsigned len)
92 return insn_len; 92 return insn_len;
93} 93}
94 94
95static fastcall unsigned long native_get_debugreg(int regno) 95static unsigned long native_get_debugreg(int regno)
96{ 96{
97 unsigned long val = 0; /* Damn you, gcc! */ 97 unsigned long val = 0; /* Damn you, gcc! */
98 98
@@ -115,7 +115,7 @@ static fastcall unsigned long native_get_debugreg(int regno)
115 return val; 115 return val;
116} 116}
117 117
118static fastcall void native_set_debugreg(int regno, unsigned long value) 118static void native_set_debugreg(int regno, unsigned long value)
119{ 119{
120 switch (regno) { 120 switch (regno) {
121 case 0: 121 case 0:
@@ -146,55 +146,55 @@ void init_IRQ(void)
146 paravirt_ops.init_IRQ(); 146 paravirt_ops.init_IRQ();
147} 147}
148 148
149static fastcall void native_clts(void) 149static void native_clts(void)
150{ 150{
151 asm volatile ("clts"); 151 asm volatile ("clts");
152} 152}
153 153
154static fastcall unsigned long native_read_cr0(void) 154static unsigned long native_read_cr0(void)
155{ 155{
156 unsigned long val; 156 unsigned long val;
157 asm volatile("movl %%cr0,%0\n\t" :"=r" (val)); 157 asm volatile("movl %%cr0,%0\n\t" :"=r" (val));
158 return val; 158 return val;
159} 159}
160 160
161static fastcall void native_write_cr0(unsigned long val) 161static void native_write_cr0(unsigned long val)
162{ 162{
163 asm volatile("movl %0,%%cr0": :"r" (val)); 163 asm volatile("movl %0,%%cr0": :"r" (val));
164} 164}
165 165
166static fastcall unsigned long native_read_cr2(void) 166static unsigned long native_read_cr2(void)
167{ 167{
168 unsigned long val; 168 unsigned long val;
169 asm volatile("movl %%cr2,%0\n\t" :"=r" (val)); 169 asm volatile("movl %%cr2,%0\n\t" :"=r" (val));
170 return val; 170 return val;
171} 171}
172 172
173static fastcall void native_write_cr2(unsigned long val) 173static void native_write_cr2(unsigned long val)
174{ 174{
175 asm volatile("movl %0,%%cr2": :"r" (val)); 175 asm volatile("movl %0,%%cr2": :"r" (val));
176} 176}
177 177
178static fastcall unsigned long native_read_cr3(void) 178static unsigned long native_read_cr3(void)
179{ 179{
180 unsigned long val; 180 unsigned long val;
181 asm volatile("movl %%cr3,%0\n\t" :"=r" (val)); 181 asm volatile("movl %%cr3,%0\n\t" :"=r" (val));
182 return val; 182 return val;
183} 183}
184 184
185static fastcall void native_write_cr3(unsigned long val) 185static void native_write_cr3(unsigned long val)
186{ 186{
187 asm volatile("movl %0,%%cr3": :"r" (val)); 187 asm volatile("movl %0,%%cr3": :"r" (val));
188} 188}
189 189
190static fastcall unsigned long native_read_cr4(void) 190static unsigned long native_read_cr4(void)
191{ 191{
192 unsigned long val; 192 unsigned long val;
193 asm volatile("movl %%cr4,%0\n\t" :"=r" (val)); 193 asm volatile("movl %%cr4,%0\n\t" :"=r" (val));
194 return val; 194 return val;
195} 195}
196 196
197static fastcall unsigned long native_read_cr4_safe(void) 197static unsigned long native_read_cr4_safe(void)
198{ 198{
199 unsigned long val; 199 unsigned long val;
200 /* This could fault if %cr4 does not exist */ 200 /* This could fault if %cr4 does not exist */
@@ -207,51 +207,51 @@ static fastcall unsigned long native_read_cr4_safe(void)
207 return val; 207 return val;
208} 208}
209 209
210static fastcall void native_write_cr4(unsigned long val) 210static void native_write_cr4(unsigned long val)
211{ 211{
212 asm volatile("movl %0,%%cr4": :"r" (val)); 212 asm volatile("movl %0,%%cr4": :"r" (val));
213} 213}
214 214
215static fastcall unsigned long native_save_fl(void) 215static unsigned long native_save_fl(void)
216{ 216{
217 unsigned long f; 217 unsigned long f;
218 asm volatile("pushfl ; popl %0":"=g" (f): /* no input */); 218 asm volatile("pushfl ; popl %0":"=g" (f): /* no input */);
219 return f; 219 return f;
220} 220}
221 221
222static fastcall void native_restore_fl(unsigned long f) 222static void native_restore_fl(unsigned long f)
223{ 223{
224 asm volatile("pushl %0 ; popfl": /* no output */ 224 asm volatile("pushl %0 ; popfl": /* no output */
225 :"g" (f) 225 :"g" (f)
226 :"memory", "cc"); 226 :"memory", "cc");
227} 227}
228 228
229static fastcall void native_irq_disable(void) 229static void native_irq_disable(void)
230{ 230{
231 asm volatile("cli": : :"memory"); 231 asm volatile("cli": : :"memory");
232} 232}
233 233
234static fastcall void native_irq_enable(void) 234static void native_irq_enable(void)
235{ 235{
236 asm volatile("sti": : :"memory"); 236 asm volatile("sti": : :"memory");
237} 237}
238 238
239static fastcall void native_safe_halt(void) 239static void native_safe_halt(void)
240{ 240{
241 asm volatile("sti; hlt": : :"memory"); 241 asm volatile("sti; hlt": : :"memory");
242} 242}
243 243
244static fastcall void native_halt(void) 244static void native_halt(void)
245{ 245{
246 asm volatile("hlt": : :"memory"); 246 asm volatile("hlt": : :"memory");
247} 247}
248 248
249static fastcall void native_wbinvd(void) 249static void native_wbinvd(void)
250{ 250{
251 asm volatile("wbinvd": : :"memory"); 251 asm volatile("wbinvd": : :"memory");
252} 252}
253 253
254static fastcall unsigned long long native_read_msr(unsigned int msr, int *err) 254static unsigned long long native_read_msr(unsigned int msr, int *err)
255{ 255{
256 unsigned long long val; 256 unsigned long long val;
257 257
@@ -270,7 +270,7 @@ static fastcall unsigned long long native_read_msr(unsigned int msr, int *err)
270 return val; 270 return val;
271} 271}
272 272
273static fastcall int native_write_msr(unsigned int msr, unsigned long long val) 273static int native_write_msr(unsigned int msr, unsigned long long val)
274{ 274{
275 int err; 275 int err;
276 asm volatile("2: wrmsr ; xorl %0,%0\n" 276 asm volatile("2: wrmsr ; xorl %0,%0\n"
@@ -288,53 +288,53 @@ static fastcall int native_write_msr(unsigned int msr, unsigned long long val)
288 return err; 288 return err;
289} 289}
290 290
291static fastcall unsigned long long native_read_tsc(void) 291static unsigned long long native_read_tsc(void)
292{ 292{
293 unsigned long long val; 293 unsigned long long val;
294 asm volatile("rdtsc" : "=A" (val)); 294 asm volatile("rdtsc" : "=A" (val));
295 return val; 295 return val;
296} 296}
297 297
298static fastcall unsigned long long native_read_pmc(void) 298static unsigned long long native_read_pmc(void)
299{ 299{
300 unsigned long long val; 300 unsigned long long val;
301 asm volatile("rdpmc" : "=A" (val)); 301 asm volatile("rdpmc" : "=A" (val));
302 return val; 302 return val;
303} 303}
304 304
305static fastcall void native_load_tr_desc(void) 305static void native_load_tr_desc(void)
306{ 306{
307 asm volatile("ltr %w0"::"q" (GDT_ENTRY_TSS*8)); 307 asm volatile("ltr %w0"::"q" (GDT_ENTRY_TSS*8));
308} 308}
309 309
310static fastcall void native_load_gdt(const struct Xgt_desc_struct *dtr) 310static void native_load_gdt(const struct Xgt_desc_struct *dtr)
311{ 311{
312 asm volatile("lgdt %0"::"m" (*dtr)); 312 asm volatile("lgdt %0"::"m" (*dtr));
313} 313}
314 314
315static fastcall void native_load_idt(const struct Xgt_desc_struct *dtr) 315static void native_load_idt(const struct Xgt_desc_struct *dtr)
316{ 316{
317 asm volatile("lidt %0"::"m" (*dtr)); 317 asm volatile("lidt %0"::"m" (*dtr));
318} 318}
319 319
320static fastcall void native_store_gdt(struct Xgt_desc_struct *dtr) 320static void native_store_gdt(struct Xgt_desc_struct *dtr)
321{ 321{
322 asm ("sgdt %0":"=m" (*dtr)); 322 asm ("sgdt %0":"=m" (*dtr));
323} 323}
324 324
325static fastcall void native_store_idt(struct Xgt_desc_struct *dtr) 325static void native_store_idt(struct Xgt_desc_struct *dtr)
326{ 326{
327 asm ("sidt %0":"=m" (*dtr)); 327 asm ("sidt %0":"=m" (*dtr));
328} 328}
329 329
330static fastcall unsigned long native_store_tr(void) 330static unsigned long native_store_tr(void)
331{ 331{
332 unsigned long tr; 332 unsigned long tr;
333 asm ("str %0":"=r" (tr)); 333 asm ("str %0":"=r" (tr));
334 return tr; 334 return tr;
335} 335}
336 336
337static fastcall void native_load_tls(struct thread_struct *t, unsigned int cpu) 337static void native_load_tls(struct thread_struct *t, unsigned int cpu)
338{ 338{
339#define C(i) get_cpu_gdt_table(cpu)[GDT_ENTRY_TLS_MIN + i] = t->tls_array[i] 339#define C(i) get_cpu_gdt_table(cpu)[GDT_ENTRY_TLS_MIN + i] = t->tls_array[i]
340 C(0); C(1); C(2); 340 C(0); C(1); C(2);
@@ -348,22 +348,22 @@ static inline void native_write_dt_entry(void *dt, int entry, u32 entry_low, u32
348 lp[1] = entry_high; 348 lp[1] = entry_high;
349} 349}
350 350
351static fastcall void native_write_ldt_entry(void *dt, int entrynum, u32 low, u32 high) 351static void native_write_ldt_entry(void *dt, int entrynum, u32 low, u32 high)
352{ 352{
353 native_write_dt_entry(dt, entrynum, low, high); 353 native_write_dt_entry(dt, entrynum, low, high);
354} 354}
355 355
356static fastcall void native_write_gdt_entry(void *dt, int entrynum, u32 low, u32 high) 356static void native_write_gdt_entry(void *dt, int entrynum, u32 low, u32 high)
357{ 357{
358 native_write_dt_entry(dt, entrynum, low, high); 358 native_write_dt_entry(dt, entrynum, low, high);
359} 359}
360 360
361static fastcall void native_write_idt_entry(void *dt, int entrynum, u32 low, u32 high) 361static void native_write_idt_entry(void *dt, int entrynum, u32 low, u32 high)
362{ 362{
363 native_write_dt_entry(dt, entrynum, low, high); 363 native_write_dt_entry(dt, entrynum, low, high);
364} 364}
365 365
366static fastcall void native_load_esp0(struct tss_struct *tss, 366static void native_load_esp0(struct tss_struct *tss,
367 struct thread_struct *thread) 367 struct thread_struct *thread)
368{ 368{
369 tss->esp0 = thread->esp0; 369 tss->esp0 = thread->esp0;
@@ -375,12 +375,12 @@ static fastcall void native_load_esp0(struct tss_struct *tss,
375 } 375 }
376} 376}
377 377
378static fastcall void native_io_delay(void) 378static void native_io_delay(void)
379{ 379{
380 asm volatile("outb %al,$0x80"); 380 asm volatile("outb %al,$0x80");
381} 381}
382 382
383static fastcall void native_flush_tlb(void) 383static void native_flush_tlb(void)
384{ 384{
385 __native_flush_tlb(); 385 __native_flush_tlb();
386} 386}
@@ -389,49 +389,49 @@ static fastcall void native_flush_tlb(void)
389 * Global pages have to be flushed a bit differently. Not a real 389 * Global pages have to be flushed a bit differently. Not a real
390 * performance problem because this does not happen often. 390 * performance problem because this does not happen often.
391 */ 391 */
392static fastcall void native_flush_tlb_global(void) 392static void native_flush_tlb_global(void)
393{ 393{
394 __native_flush_tlb_global(); 394 __native_flush_tlb_global();
395} 395}
396 396
397static fastcall void native_flush_tlb_single(u32 addr) 397static void native_flush_tlb_single(u32 addr)
398{ 398{
399 __native_flush_tlb_single(addr); 399 __native_flush_tlb_single(addr);
400} 400}
401 401
402#ifndef CONFIG_X86_PAE 402#ifndef CONFIG_X86_PAE
403static fastcall void native_set_pte(pte_t *ptep, pte_t pteval) 403static void native_set_pte(pte_t *ptep, pte_t pteval)
404{ 404{
405 *ptep = pteval; 405 *ptep = pteval;
406} 406}
407 407
408static fastcall void native_set_pte_at(struct mm_struct *mm, u32 addr, pte_t *ptep, pte_t pteval) 408static void native_set_pte_at(struct mm_struct *mm, u32 addr, pte_t *ptep, pte_t pteval)
409{ 409{
410 *ptep = pteval; 410 *ptep = pteval;
411} 411}
412 412
413static fastcall void native_set_pmd(pmd_t *pmdp, pmd_t pmdval) 413static void native_set_pmd(pmd_t *pmdp, pmd_t pmdval)
414{ 414{
415 *pmdp = pmdval; 415 *pmdp = pmdval;
416} 416}
417 417
418#else /* CONFIG_X86_PAE */ 418#else /* CONFIG_X86_PAE */
419 419
420static fastcall void native_set_pte(pte_t *ptep, pte_t pte) 420static void native_set_pte(pte_t *ptep, pte_t pte)
421{ 421{
422 ptep->pte_high = pte.pte_high; 422 ptep->pte_high = pte.pte_high;
423 smp_wmb(); 423 smp_wmb();
424 ptep->pte_low = pte.pte_low; 424 ptep->pte_low = pte.pte_low;
425} 425}
426 426
427static fastcall void native_set_pte_at(struct mm_struct *mm, u32 addr, pte_t *ptep, pte_t pte) 427static void native_set_pte_at(struct mm_struct *mm, u32 addr, pte_t *ptep, pte_t pte)
428{ 428{
429 ptep->pte_high = pte.pte_high; 429 ptep->pte_high = pte.pte_high;
430 smp_wmb(); 430 smp_wmb();
431 ptep->pte_low = pte.pte_low; 431 ptep->pte_low = pte.pte_low;
432} 432}
433 433
434static fastcall void native_set_pte_present(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pte) 434static void native_set_pte_present(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pte)
435{ 435{
436 ptep->pte_low = 0; 436 ptep->pte_low = 0;
437 smp_wmb(); 437 smp_wmb();
@@ -440,29 +440,29 @@ static fastcall void native_set_pte_present(struct mm_struct *mm, unsigned long
440 ptep->pte_low = pte.pte_low; 440 ptep->pte_low = pte.pte_low;
441} 441}
442 442
443static fastcall void native_set_pte_atomic(pte_t *ptep, pte_t pteval) 443static void native_set_pte_atomic(pte_t *ptep, pte_t pteval)
444{ 444{
445 set_64bit((unsigned long long *)ptep,pte_val(pteval)); 445 set_64bit((unsigned long long *)ptep,pte_val(pteval));
446} 446}
447 447
448static fastcall void native_set_pmd(pmd_t *pmdp, pmd_t pmdval) 448static void native_set_pmd(pmd_t *pmdp, pmd_t pmdval)
449{ 449{
450 set_64bit((unsigned long long *)pmdp,pmd_val(pmdval)); 450 set_64bit((unsigned long long *)pmdp,pmd_val(pmdval));
451} 451}
452 452
453static fastcall void native_set_pud(pud_t *pudp, pud_t pudval) 453static void native_set_pud(pud_t *pudp, pud_t pudval)
454{ 454{
455 *pudp = pudval; 455 *pudp = pudval;
456} 456}
457 457
458static fastcall void native_pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) 458static void native_pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
459{ 459{
460 ptep->pte_low = 0; 460 ptep->pte_low = 0;
461 smp_wmb(); 461 smp_wmb();
462 ptep->pte_high = 0; 462 ptep->pte_high = 0;
463} 463}
464 464
465static fastcall void native_pmd_clear(pmd_t *pmd) 465static void native_pmd_clear(pmd_t *pmd)
466{ 466{
467 u32 *tmp = (u32 *)pmd; 467 u32 *tmp = (u32 *)pmd;
468 *tmp = 0; 468 *tmp = 0;
@@ -472,8 +472,8 @@ static fastcall void native_pmd_clear(pmd_t *pmd)
472#endif /* CONFIG_X86_PAE */ 472#endif /* CONFIG_X86_PAE */
473 473
474/* These are in entry.S */ 474/* These are in entry.S */
475extern fastcall void native_iret(void); 475extern void native_iret(void);
476extern fastcall void native_irq_enable_sysexit(void); 476extern void native_irq_enable_sysexit(void);
477 477
478static int __init print_banner(void) 478static int __init print_banner(void)
479{ 479{
@@ -482,9 +482,6 @@ static int __init print_banner(void)
482} 482}
483core_initcall(print_banner); 483core_initcall(print_banner);
484 484
485/* We simply declare start_kernel to be the paravirt probe of last resort. */
486paravirt_probe(start_kernel);
487
488struct paravirt_ops paravirt_ops = { 485struct paravirt_ops paravirt_ops = {
489 .name = "bare hardware", 486 .name = "bare hardware",
490 .paravirt_enabled = 0, 487 .paravirt_enabled = 0,
@@ -544,12 +541,21 @@ struct paravirt_ops paravirt_ops = {
544 .apic_write = native_apic_write, 541 .apic_write = native_apic_write,
545 .apic_write_atomic = native_apic_write_atomic, 542 .apic_write_atomic = native_apic_write_atomic,
546 .apic_read = native_apic_read, 543 .apic_read = native_apic_read,
544 .setup_boot_clock = setup_boot_APIC_clock,
545 .setup_secondary_clock = setup_secondary_APIC_clock,
547#endif 546#endif
547 .set_lazy_mode = (void *)native_nop,
548 548
549 .flush_tlb_user = native_flush_tlb, 549 .flush_tlb_user = native_flush_tlb,
550 .flush_tlb_kernel = native_flush_tlb_global, 550 .flush_tlb_kernel = native_flush_tlb_global,
551 .flush_tlb_single = native_flush_tlb_single, 551 .flush_tlb_single = native_flush_tlb_single,
552 552
553 .alloc_pt = (void *)native_nop,
554 .alloc_pd = (void *)native_nop,
555 .alloc_pd_clone = (void *)native_nop,
556 .release_pt = (void *)native_nop,
557 .release_pd = (void *)native_nop,
558
553 .set_pte = native_set_pte, 559 .set_pte = native_set_pte,
554 .set_pte_at = native_set_pte_at, 560 .set_pte_at = native_set_pte_at,
555 .set_pmd = native_set_pmd, 561 .set_pmd = native_set_pmd,
@@ -565,6 +571,8 @@ struct paravirt_ops paravirt_ops = {
565 571
566 .irq_enable_sysexit = native_irq_enable_sysexit, 572 .irq_enable_sysexit = native_irq_enable_sysexit,
567 .iret = native_iret, 573 .iret = native_iret,
574
575 .startup_ipi_hook = (void *)native_nop,
568}; 576};
569 577
570/* 578/*
diff --git a/arch/i386/kernel/pcspeaker.c b/arch/i386/kernel/pcspeaker.c
new file mode 100644
index 000000000000..bc1f2d3ea277
--- /dev/null
+++ b/arch/i386/kernel/pcspeaker.c
@@ -0,0 +1,20 @@
1#include <linux/platform_device.h>
2#include <linux/errno.h>
3#include <linux/init.h>
4
5static __init int add_pcspkr(void)
6{
7 struct platform_device *pd;
8 int ret;
9
10 pd = platform_device_alloc("pcspkr", -1);
11 if (!pd)
12 return -ENOMEM;
13
14 ret = platform_device_add(pd);
15 if (ret)
16 platform_device_put(pd);
17
18 return ret;
19}
20device_initcall(add_pcspkr);
diff --git a/arch/i386/kernel/process.c b/arch/i386/kernel/process.c
index c641056233a6..7845d480c293 100644
--- a/arch/i386/kernel/process.c
+++ b/arch/i386/kernel/process.c
@@ -48,6 +48,7 @@
48#include <asm/i387.h> 48#include <asm/i387.h>
49#include <asm/desc.h> 49#include <asm/desc.h>
50#include <asm/vm86.h> 50#include <asm/vm86.h>
51#include <asm/idle.h>
51#ifdef CONFIG_MATH_EMULATION 52#ifdef CONFIG_MATH_EMULATION
52#include <asm/math_emu.h> 53#include <asm/math_emu.h>
53#endif 54#endif
@@ -80,6 +81,42 @@ void (*pm_idle)(void);
80EXPORT_SYMBOL(pm_idle); 81EXPORT_SYMBOL(pm_idle);
81static DEFINE_PER_CPU(unsigned int, cpu_idle_state); 82static DEFINE_PER_CPU(unsigned int, cpu_idle_state);
82 83
84static ATOMIC_NOTIFIER_HEAD(idle_notifier);
85
86void idle_notifier_register(struct notifier_block *n)
87{
88 atomic_notifier_chain_register(&idle_notifier, n);
89}
90
91void idle_notifier_unregister(struct notifier_block *n)
92{
93 atomic_notifier_chain_unregister(&idle_notifier, n);
94}
95
96static DEFINE_PER_CPU(volatile unsigned long, idle_state);
97
98void enter_idle(void)
99{
100 /* needs to be atomic w.r.t. interrupts, not against other CPUs */
101 __set_bit(0, &__get_cpu_var(idle_state));
102 atomic_notifier_call_chain(&idle_notifier, IDLE_START, NULL);
103}
104
105static void __exit_idle(void)
106{
107 /* needs to be atomic w.r.t. interrupts, not against other CPUs */
108 if (__test_and_clear_bit(0, &__get_cpu_var(idle_state)) == 0)
109 return;
110 atomic_notifier_call_chain(&idle_notifier, IDLE_END, NULL);
111}
112
113void exit_idle(void)
114{
115 if (current->pid)
116 return;
117 __exit_idle();
118}
119
83void disable_hlt(void) 120void disable_hlt(void)
84{ 121{
85 hlt_counter++; 122 hlt_counter++;
@@ -130,6 +167,7 @@ EXPORT_SYMBOL(default_idle);
130 */ 167 */
131static void poll_idle (void) 168static void poll_idle (void)
132{ 169{
170 local_irq_enable();
133 cpu_relax(); 171 cpu_relax();
134} 172}
135 173
@@ -189,7 +227,16 @@ void cpu_idle(void)
189 play_dead(); 227 play_dead();
190 228
191 __get_cpu_var(irq_stat).idle_timestamp = jiffies; 229 __get_cpu_var(irq_stat).idle_timestamp = jiffies;
230
231 /*
232 * Idle routines should keep interrupts disabled
233 * from here on, until they go to idle.
234 * Otherwise, idle callbacks can misfire.
235 */
236 local_irq_disable();
237 enter_idle();
192 idle(); 238 idle();
239 __exit_idle();
193 } 240 }
194 preempt_enable_no_resched(); 241 preempt_enable_no_resched();
195 schedule(); 242 schedule();
@@ -243,7 +290,11 @@ void mwait_idle_with_hints(unsigned long eax, unsigned long ecx)
243 __monitor((void *)&current_thread_info()->flags, 0, 0); 290 __monitor((void *)&current_thread_info()->flags, 0, 0);
244 smp_mb(); 291 smp_mb();
245 if (!need_resched()) 292 if (!need_resched())
246 __mwait(eax, ecx); 293 __sti_mwait(eax, ecx);
294 else
295 local_irq_enable();
296 } else {
297 local_irq_enable();
247 } 298 }
248} 299}
249 300
@@ -308,8 +359,8 @@ void show_regs(struct pt_regs * regs)
308 regs->eax,regs->ebx,regs->ecx,regs->edx); 359 regs->eax,regs->ebx,regs->ecx,regs->edx);
309 printk("ESI: %08lx EDI: %08lx EBP: %08lx", 360 printk("ESI: %08lx EDI: %08lx EBP: %08lx",
310 regs->esi, regs->edi, regs->ebp); 361 regs->esi, regs->edi, regs->ebp);
311 printk(" DS: %04x ES: %04x GS: %04x\n", 362 printk(" DS: %04x ES: %04x FS: %04x\n",
312 0xffff & regs->xds,0xffff & regs->xes, 0xffff & regs->xgs); 363 0xffff & regs->xds,0xffff & regs->xes, 0xffff & regs->xfs);
313 364
314 cr0 = read_cr0(); 365 cr0 = read_cr0();
315 cr2 = read_cr2(); 366 cr2 = read_cr2();
@@ -340,7 +391,7 @@ int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
340 391
341 regs.xds = __USER_DS; 392 regs.xds = __USER_DS;
342 regs.xes = __USER_DS; 393 regs.xes = __USER_DS;
343 regs.xgs = __KERNEL_PDA; 394 regs.xfs = __KERNEL_PDA;
344 regs.orig_eax = -1; 395 regs.orig_eax = -1;
345 regs.eip = (unsigned long) kernel_thread_helper; 396 regs.eip = (unsigned long) kernel_thread_helper;
346 regs.xcs = __KERNEL_CS | get_kernel_rpl(); 397 regs.xcs = __KERNEL_CS | get_kernel_rpl();
@@ -425,7 +476,7 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long esp,
425 476
426 p->thread.eip = (unsigned long) ret_from_fork; 477 p->thread.eip = (unsigned long) ret_from_fork;
427 478
428 savesegment(fs,p->thread.fs); 479 savesegment(gs,p->thread.gs);
429 480
430 tsk = current; 481 tsk = current;
431 if (unlikely(test_tsk_thread_flag(tsk, TIF_IO_BITMAP))) { 482 if (unlikely(test_tsk_thread_flag(tsk, TIF_IO_BITMAP))) {
@@ -501,8 +552,8 @@ void dump_thread(struct pt_regs * regs, struct user * dump)
501 dump->regs.eax = regs->eax; 552 dump->regs.eax = regs->eax;
502 dump->regs.ds = regs->xds; 553 dump->regs.ds = regs->xds;
503 dump->regs.es = regs->xes; 554 dump->regs.es = regs->xes;
504 savesegment(fs,dump->regs.fs); 555 dump->regs.fs = regs->xfs;
505 dump->regs.gs = regs->xgs; 556 savesegment(gs,dump->regs.gs);
506 dump->regs.orig_eax = regs->orig_eax; 557 dump->regs.orig_eax = regs->orig_eax;
507 dump->regs.eip = regs->eip; 558 dump->regs.eip = regs->eip;
508 dump->regs.cs = regs->xcs; 559 dump->regs.cs = regs->xcs;
@@ -653,7 +704,7 @@ struct task_struct fastcall * __switch_to(struct task_struct *prev_p, struct tas
653 load_esp0(tss, next); 704 load_esp0(tss, next);
654 705
655 /* 706 /*
656 * Save away %fs. No need to save %gs, as it was saved on the 707 * Save away %gs. No need to save %fs, as it was saved on the
657 * stack on entry. No need to save %es and %ds, as those are 708 * stack on entry. No need to save %es and %ds, as those are
658 * always kernel segments while inside the kernel. Doing this 709 * always kernel segments while inside the kernel. Doing this
659 * before setting the new TLS descriptors avoids the situation 710 * before setting the new TLS descriptors avoids the situation
@@ -662,7 +713,7 @@ struct task_struct fastcall * __switch_to(struct task_struct *prev_p, struct tas
662 * used %fs or %gs (it does not today), or if the kernel is 713 * used %fs or %gs (it does not today), or if the kernel is
663 * running inside of a hypervisor layer. 714 * running inside of a hypervisor layer.
664 */ 715 */
665 savesegment(fs, prev->fs); 716 savesegment(gs, prev->gs);
666 717
667 /* 718 /*
668 * Load the per-thread Thread-Local Storage descriptor. 719 * Load the per-thread Thread-Local Storage descriptor.
@@ -670,14 +721,13 @@ struct task_struct fastcall * __switch_to(struct task_struct *prev_p, struct tas
670 load_TLS(next, cpu); 721 load_TLS(next, cpu);
671 722
672 /* 723 /*
673 * Restore %fs if needed. 724 * Restore IOPL if needed. In normal use, the flags restore
674 * 725 * in the switch assembly will handle this. But if the kernel
675 * Glibc normally makes %fs be zero. 726 * is running virtualized at a non-zero CPL, the popf will
727 * not restore flags, so it must be done in a separate step.
676 */ 728 */
677 if (unlikely(prev->fs | next->fs)) 729 if (get_kernel_rpl() && unlikely(prev->iopl != next->iopl))
678 loadsegment(fs, next->fs); 730 set_iopl_mask(next->iopl);
679
680 write_pda(pcurrent, next_p);
681 731
682 /* 732 /*
683 * Now maybe handle debug registers and/or IO bitmaps 733 * Now maybe handle debug registers and/or IO bitmaps
@@ -688,6 +738,15 @@ struct task_struct fastcall * __switch_to(struct task_struct *prev_p, struct tas
688 738
689 disable_tsc(prev_p, next_p); 739 disable_tsc(prev_p, next_p);
690 740
741 /*
742 * Leave lazy mode, flushing any hypercalls made here.
743 * This must be done before restoring TLS segments so
744 * the GDT and LDT are properly updated, and must be
745 * done before math_state_restore, so the TS bit is up
746 * to date.
747 */
748 arch_leave_lazy_cpu_mode();
749
691 /* If the task has used fpu the last 5 timeslices, just do a full 750 /* If the task has used fpu the last 5 timeslices, just do a full
692 * restore of the math state immediately to avoid the trap; the 751 * restore of the math state immediately to avoid the trap; the
693 * chances of needing FPU soon are obviously high now 752 * chances of needing FPU soon are obviously high now
@@ -695,6 +754,14 @@ struct task_struct fastcall * __switch_to(struct task_struct *prev_p, struct tas
695 if (next_p->fpu_counter > 5) 754 if (next_p->fpu_counter > 5)
696 math_state_restore(); 755 math_state_restore();
697 756
757 /*
758 * Restore %gs if needed (which is common)
759 */
760 if (prev->gs | next->gs)
761 loadsegment(gs, next->gs);
762
763 write_pda(pcurrent, next_p);
764
698 return prev_p; 765 return prev_p;
699} 766}
700 767
diff --git a/arch/i386/kernel/ptrace.c b/arch/i386/kernel/ptrace.c
index af8aabe85800..4a8f8a259723 100644
--- a/arch/i386/kernel/ptrace.c
+++ b/arch/i386/kernel/ptrace.c
@@ -89,14 +89,14 @@ static int putreg(struct task_struct *child,
89 unsigned long regno, unsigned long value) 89 unsigned long regno, unsigned long value)
90{ 90{
91 switch (regno >> 2) { 91 switch (regno >> 2) {
92 case FS: 92 case GS:
93 if (value && (value & 3) != 3) 93 if (value && (value & 3) != 3)
94 return -EIO; 94 return -EIO;
95 child->thread.fs = value; 95 child->thread.gs = value;
96 return 0; 96 return 0;
97 case DS: 97 case DS:
98 case ES: 98 case ES:
99 case GS: 99 case FS:
100 if (value && (value & 3) != 3) 100 if (value && (value & 3) != 3)
101 return -EIO; 101 return -EIO;
102 value &= 0xffff; 102 value &= 0xffff;
@@ -112,7 +112,7 @@ static int putreg(struct task_struct *child,
112 value |= get_stack_long(child, EFL_OFFSET) & ~FLAG_MASK; 112 value |= get_stack_long(child, EFL_OFFSET) & ~FLAG_MASK;
113 break; 113 break;
114 } 114 }
115 if (regno > ES*4) 115 if (regno > FS*4)
116 regno -= 1*4; 116 regno -= 1*4;
117 put_stack_long(child, regno, value); 117 put_stack_long(child, regno, value);
118 return 0; 118 return 0;
@@ -124,18 +124,18 @@ static unsigned long getreg(struct task_struct *child,
124 unsigned long retval = ~0UL; 124 unsigned long retval = ~0UL;
125 125
126 switch (regno >> 2) { 126 switch (regno >> 2) {
127 case FS: 127 case GS:
128 retval = child->thread.fs; 128 retval = child->thread.gs;
129 break; 129 break;
130 case DS: 130 case DS:
131 case ES: 131 case ES:
132 case GS: 132 case FS:
133 case SS: 133 case SS:
134 case CS: 134 case CS:
135 retval = 0xffff; 135 retval = 0xffff;
136 /* fall through */ 136 /* fall through */
137 default: 137 default:
138 if (regno > ES*4) 138 if (regno > FS*4)
139 regno -= 1*4; 139 regno -= 1*4;
140 retval &= get_stack_long(child, regno); 140 retval &= get_stack_long(child, regno);
141 } 141 }
diff --git a/arch/i386/kernel/setup.c b/arch/i386/kernel/setup.c
index 4694ac980cd2..122623dcc6e1 100644
--- a/arch/i386/kernel/setup.c
+++ b/arch/i386/kernel/setup.c
@@ -33,7 +33,6 @@
33#include <linux/initrd.h> 33#include <linux/initrd.h>
34#include <linux/bootmem.h> 34#include <linux/bootmem.h>
35#include <linux/seq_file.h> 35#include <linux/seq_file.h>
36#include <linux/platform_device.h>
37#include <linux/console.h> 36#include <linux/console.h>
38#include <linux/mca.h> 37#include <linux/mca.h>
39#include <linux/root_dev.h> 38#include <linux/root_dev.h>
@@ -60,6 +59,7 @@
60#include <asm/io_apic.h> 59#include <asm/io_apic.h>
61#include <asm/ist.h> 60#include <asm/ist.h>
62#include <asm/io.h> 61#include <asm/io.h>
62#include <asm/vmi.h>
63#include <setup_arch.h> 63#include <setup_arch.h>
64#include <bios_ebda.h> 64#include <bios_ebda.h>
65 65
@@ -581,6 +581,14 @@ void __init setup_arch(char **cmdline_p)
581 581
582 max_low_pfn = setup_memory(); 582 max_low_pfn = setup_memory();
583 583
584#ifdef CONFIG_VMI
585 /*
586 * Must be after max_low_pfn is determined, and before kernel
587 * pagetables are setup.
588 */
589 vmi_init();
590#endif
591
584 /* 592 /*
585 * NOTE: before this point _nobody_ is allowed to allocate 593 * NOTE: before this point _nobody_ is allowed to allocate
586 * any memory using the bootmem allocator. Although the 594 * any memory using the bootmem allocator. Although the
@@ -651,28 +659,3 @@ void __init setup_arch(char **cmdline_p)
651#endif 659#endif
652 tsc_init(); 660 tsc_init();
653} 661}
654
655static __init int add_pcspkr(void)
656{
657 struct platform_device *pd;
658 int ret;
659
660 pd = platform_device_alloc("pcspkr", -1);
661 if (!pd)
662 return -ENOMEM;
663
664 ret = platform_device_add(pd);
665 if (ret)
666 platform_device_put(pd);
667
668 return ret;
669}
670device_initcall(add_pcspkr);
671
672/*
673 * Local Variables:
674 * mode:c
675 * c-file-style:"k&r"
676 * c-basic-offset:8
677 * End:
678 */
diff --git a/arch/i386/kernel/signal.c b/arch/i386/kernel/signal.c
index 65d7620eaa09..4f99e870c986 100644
--- a/arch/i386/kernel/signal.c
+++ b/arch/i386/kernel/signal.c
@@ -21,6 +21,7 @@
21#include <linux/suspend.h> 21#include <linux/suspend.h>
22#include <linux/ptrace.h> 22#include <linux/ptrace.h>
23#include <linux/elf.h> 23#include <linux/elf.h>
24#include <linux/binfmts.h>
24#include <asm/processor.h> 25#include <asm/processor.h>
25#include <asm/ucontext.h> 26#include <asm/ucontext.h>
26#include <asm/uaccess.h> 27#include <asm/uaccess.h>
@@ -128,8 +129,8 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc, int *peax
128 X86_EFLAGS_TF | X86_EFLAGS_SF | X86_EFLAGS_ZF | \ 129 X86_EFLAGS_TF | X86_EFLAGS_SF | X86_EFLAGS_ZF | \
129 X86_EFLAGS_AF | X86_EFLAGS_PF | X86_EFLAGS_CF) 130 X86_EFLAGS_AF | X86_EFLAGS_PF | X86_EFLAGS_CF)
130 131
131 COPY_SEG(gs); 132 GET_SEG(gs);
132 GET_SEG(fs); 133 COPY_SEG(fs);
133 COPY_SEG(es); 134 COPY_SEG(es);
134 COPY_SEG(ds); 135 COPY_SEG(ds);
135 COPY(edi); 136 COPY(edi);
@@ -244,9 +245,9 @@ setup_sigcontext(struct sigcontext __user *sc, struct _fpstate __user *fpstate,
244{ 245{
245 int tmp, err = 0; 246 int tmp, err = 0;
246 247
247 err |= __put_user(regs->xgs, (unsigned int __user *)&sc->gs); 248 err |= __put_user(regs->xfs, (unsigned int __user *)&sc->fs);
248 savesegment(fs, tmp); 249 savesegment(gs, tmp);
249 err |= __put_user(tmp, (unsigned int __user *)&sc->fs); 250 err |= __put_user(tmp, (unsigned int __user *)&sc->gs);
250 251
251 err |= __put_user(regs->xes, (unsigned int __user *)&sc->es); 252 err |= __put_user(regs->xes, (unsigned int __user *)&sc->es);
252 err |= __put_user(regs->xds, (unsigned int __user *)&sc->ds); 253 err |= __put_user(regs->xds, (unsigned int __user *)&sc->ds);
@@ -349,7 +350,10 @@ static int setup_frame(int sig, struct k_sigaction *ka,
349 goto give_sigsegv; 350 goto give_sigsegv;
350 } 351 }
351 352
352 restorer = (void *)VDSO_SYM(&__kernel_sigreturn); 353 if (current->binfmt->hasvdso)
354 restorer = (void *)VDSO_SYM(&__kernel_sigreturn);
355 else
356 restorer = (void *)&frame->retcode;
353 if (ka->sa.sa_flags & SA_RESTORER) 357 if (ka->sa.sa_flags & SA_RESTORER)
354 restorer = ka->sa.sa_restorer; 358 restorer = ka->sa.sa_restorer;
355 359
diff --git a/arch/i386/kernel/smp.c b/arch/i386/kernel/smp.c
index 5285aff8367f..9bd9637ae692 100644
--- a/arch/i386/kernel/smp.c
+++ b/arch/i386/kernel/smp.c
@@ -23,6 +23,7 @@
23 23
24#include <asm/mtrr.h> 24#include <asm/mtrr.h>
25#include <asm/tlbflush.h> 25#include <asm/tlbflush.h>
26#include <asm/idle.h>
26#include <mach_apic.h> 27#include <mach_apic.h>
27 28
28/* 29/*
@@ -374,8 +375,7 @@ static void flush_tlb_others(cpumask_t cpumask, struct mm_struct *mm,
374 /* 375 /*
375 * i'm not happy about this global shared spinlock in the 376 * i'm not happy about this global shared spinlock in the
376 * MM hot path, but we'll see how contended it is. 377 * MM hot path, but we'll see how contended it is.
377 * Temporarily this turns IRQs off, so that lockups are 378 * AK: x86-64 has a faster method that could be ported.
378 * detected by the NMI watchdog.
379 */ 379 */
380 spin_lock(&tlbstate_lock); 380 spin_lock(&tlbstate_lock);
381 381
@@ -400,7 +400,7 @@ static void flush_tlb_others(cpumask_t cpumask, struct mm_struct *mm,
400 400
401 while (!cpus_empty(flush_cpumask)) 401 while (!cpus_empty(flush_cpumask))
402 /* nothing. lockup detection does not belong here */ 402 /* nothing. lockup detection does not belong here */
403 mb(); 403 cpu_relax();
404 404
405 flush_mm = NULL; 405 flush_mm = NULL;
406 flush_va = 0; 406 flush_va = 0;
@@ -624,6 +624,7 @@ fastcall void smp_call_function_interrupt(struct pt_regs *regs)
624 /* 624 /*
625 * At this point the info structure may be out of scope unless wait==1 625 * At this point the info structure may be out of scope unless wait==1
626 */ 626 */
627 exit_idle();
627 irq_enter(); 628 irq_enter();
628 (*func)(info); 629 (*func)(info);
629 irq_exit(); 630 irq_exit();
diff --git a/arch/i386/kernel/smpboot.c b/arch/i386/kernel/smpboot.c
index 8c6c8c52b95c..f46a4d095e6c 100644
--- a/arch/i386/kernel/smpboot.c
+++ b/arch/i386/kernel/smpboot.c
@@ -63,6 +63,7 @@
63#include <mach_apic.h> 63#include <mach_apic.h>
64#include <mach_wakecpu.h> 64#include <mach_wakecpu.h>
65#include <smpboot_hooks.h> 65#include <smpboot_hooks.h>
66#include <asm/vmi.h>
66 67
67/* Set if we find a B stepping CPU */ 68/* Set if we find a B stepping CPU */
68static int __devinitdata smp_b_stepping; 69static int __devinitdata smp_b_stepping;
@@ -545,12 +546,15 @@ static void __cpuinit start_secondary(void *unused)
545 * booting is too fragile that we want to limit the 546 * booting is too fragile that we want to limit the
546 * things done here to the most necessary things. 547 * things done here to the most necessary things.
547 */ 548 */
549#ifdef CONFIG_VMI
550 vmi_bringup();
551#endif
548 secondary_cpu_init(); 552 secondary_cpu_init();
549 preempt_disable(); 553 preempt_disable();
550 smp_callin(); 554 smp_callin();
551 while (!cpu_isset(smp_processor_id(), smp_commenced_mask)) 555 while (!cpu_isset(smp_processor_id(), smp_commenced_mask))
552 rep_nop(); 556 rep_nop();
553 setup_secondary_APIC_clock(); 557 setup_secondary_clock();
554 if (nmi_watchdog == NMI_IO_APIC) { 558 if (nmi_watchdog == NMI_IO_APIC) {
555 disable_8259A_irq(0); 559 disable_8259A_irq(0);
556 enable_NMI_through_LVT0(NULL); 560 enable_NMI_through_LVT0(NULL);
@@ -619,7 +623,6 @@ extern struct {
619 unsigned short ss; 623 unsigned short ss;
620} stack_start; 624} stack_start;
621extern struct i386_pda *start_pda; 625extern struct i386_pda *start_pda;
622extern struct Xgt_desc_struct cpu_gdt_descr;
623 626
624#ifdef CONFIG_NUMA 627#ifdef CONFIG_NUMA
625 628
@@ -835,6 +838,13 @@ wakeup_secondary_cpu(int phys_apicid, unsigned long start_eip)
835 num_starts = 0; 838 num_starts = 0;
836 839
837 /* 840 /*
841 * Paravirt / VMI wants a startup IPI hook here to set up the
842 * target processor state.
843 */
844 startup_ipi_hook(phys_apicid, (unsigned long) start_secondary,
845 (unsigned long) stack_start.esp);
846
847 /*
838 * Run STARTUP IPI loop. 848 * Run STARTUP IPI loop.
839 */ 849 */
840 Dprintk("#startup loops: %d.\n", num_starts); 850 Dprintk("#startup loops: %d.\n", num_starts);
@@ -1320,7 +1330,7 @@ static void __init smp_boot_cpus(unsigned int max_cpus)
1320 1330
1321 smpboot_setup_io_apic(); 1331 smpboot_setup_io_apic();
1322 1332
1323 setup_boot_APIC_clock(); 1333 setup_boot_clock();
1324 1334
1325 /* 1335 /*
1326 * Synchronize the TSC with the AP 1336 * Synchronize the TSC with the AP
diff --git a/arch/i386/kernel/sysenter.c b/arch/i386/kernel/sysenter.c
index bc882a2b1db6..13ca54a85a1c 100644
--- a/arch/i386/kernel/sysenter.c
+++ b/arch/i386/kernel/sysenter.c
@@ -78,7 +78,7 @@ int __init sysenter_setup(void)
78 syscall_pages[0] = virt_to_page(syscall_page); 78 syscall_pages[0] = virt_to_page(syscall_page);
79 79
80#ifdef CONFIG_COMPAT_VDSO 80#ifdef CONFIG_COMPAT_VDSO
81 __set_fixmap(FIX_VDSO, __pa(syscall_page), PAGE_READONLY); 81 __set_fixmap(FIX_VDSO, __pa(syscall_page), PAGE_READONLY_EXEC);
82 printk("Compat vDSO mapped to %08lx.\n", __fix_to_virt(FIX_VDSO)); 82 printk("Compat vDSO mapped to %08lx.\n", __fix_to_virt(FIX_VDSO));
83#endif 83#endif
84 84
diff --git a/arch/i386/kernel/time.c b/arch/i386/kernel/time.c
index c505b16c0990..a4f67a6e6821 100644
--- a/arch/i386/kernel/time.c
+++ b/arch/i386/kernel/time.c
@@ -131,15 +131,13 @@ unsigned long profile_pc(struct pt_regs *regs)
131 unsigned long pc = instruction_pointer(regs); 131 unsigned long pc = instruction_pointer(regs);
132 132
133#ifdef CONFIG_SMP 133#ifdef CONFIG_SMP
134 if (!user_mode_vm(regs) && in_lock_functions(pc)) { 134 if (!v8086_mode(regs) && SEGMENT_IS_KERNEL_CODE(regs->xcs) &&
135 in_lock_functions(pc)) {
135#ifdef CONFIG_FRAME_POINTER 136#ifdef CONFIG_FRAME_POINTER
136 return *(unsigned long *)(regs->ebp + 4); 137 return *(unsigned long *)(regs->ebp + 4);
137#else 138#else
138 unsigned long *sp; 139 unsigned long *sp = (unsigned long *)&regs->esp;
139 if ((regs->xcs & 3) == 0) 140
140 sp = (unsigned long *)&regs->esp;
141 else
142 sp = (unsigned long *)regs->esp;
143 /* Return address is either directly at stack pointer 141 /* Return address is either directly at stack pointer
144 or above a saved eflags. Eflags has bits 22-31 zero, 142 or above a saved eflags. Eflags has bits 22-31 zero,
145 kernel addresses don't. */ 143 kernel addresses don't. */
@@ -232,6 +230,7 @@ EXPORT_SYMBOL(get_cmos_time);
232static void sync_cmos_clock(unsigned long dummy); 230static void sync_cmos_clock(unsigned long dummy);
233 231
234static DEFINE_TIMER(sync_cmos_timer, sync_cmos_clock, 0, 0); 232static DEFINE_TIMER(sync_cmos_timer, sync_cmos_clock, 0, 0);
233int no_sync_cmos_clock;
235 234
236static void sync_cmos_clock(unsigned long dummy) 235static void sync_cmos_clock(unsigned long dummy)
237{ 236{
@@ -275,7 +274,8 @@ static void sync_cmos_clock(unsigned long dummy)
275 274
276void notify_arch_cmos_timer(void) 275void notify_arch_cmos_timer(void)
277{ 276{
278 mod_timer(&sync_cmos_timer, jiffies + 1); 277 if (!no_sync_cmos_clock)
278 mod_timer(&sync_cmos_timer, jiffies + 1);
279} 279}
280 280
281static long clock_cmos_diff; 281static long clock_cmos_diff;
diff --git a/arch/i386/kernel/traps.c b/arch/i386/kernel/traps.c
index 0efad8aeb41a..af0d3f70a817 100644
--- a/arch/i386/kernel/traps.c
+++ b/arch/i386/kernel/traps.c
@@ -94,6 +94,7 @@ asmlinkage void spurious_interrupt_bug(void);
94asmlinkage void machine_check(void); 94asmlinkage void machine_check(void);
95 95
96int kstack_depth_to_print = 24; 96int kstack_depth_to_print = 24;
97static unsigned int code_bytes = 64;
97ATOMIC_NOTIFIER_HEAD(i386die_chain); 98ATOMIC_NOTIFIER_HEAD(i386die_chain);
98 99
99int register_die_notifier(struct notifier_block *nb) 100int register_die_notifier(struct notifier_block *nb)
@@ -291,10 +292,11 @@ void show_registers(struct pt_regs *regs)
291 int i; 292 int i;
292 int in_kernel = 1; 293 int in_kernel = 1;
293 unsigned long esp; 294 unsigned long esp;
294 unsigned short ss; 295 unsigned short ss, gs;
295 296
296 esp = (unsigned long) (&regs->esp); 297 esp = (unsigned long) (&regs->esp);
297 savesegment(ss, ss); 298 savesegment(ss, ss);
299 savesegment(gs, gs);
298 if (user_mode_vm(regs)) { 300 if (user_mode_vm(regs)) {
299 in_kernel = 0; 301 in_kernel = 0;
300 esp = regs->esp; 302 esp = regs->esp;
@@ -313,8 +315,8 @@ void show_registers(struct pt_regs *regs)
313 regs->eax, regs->ebx, regs->ecx, regs->edx); 315 regs->eax, regs->ebx, regs->ecx, regs->edx);
314 printk(KERN_EMERG "esi: %08lx edi: %08lx ebp: %08lx esp: %08lx\n", 316 printk(KERN_EMERG "esi: %08lx edi: %08lx ebp: %08lx esp: %08lx\n",
315 regs->esi, regs->edi, regs->ebp, esp); 317 regs->esi, regs->edi, regs->ebp, esp);
316 printk(KERN_EMERG "ds: %04x es: %04x ss: %04x\n", 318 printk(KERN_EMERG "ds: %04x es: %04x fs: %04x gs: %04x ss: %04x\n",
317 regs->xds & 0xffff, regs->xes & 0xffff, ss); 319 regs->xds & 0xffff, regs->xes & 0xffff, regs->xfs & 0xffff, gs, ss);
318 printk(KERN_EMERG "Process %.*s (pid: %d, ti=%p task=%p task.ti=%p)", 320 printk(KERN_EMERG "Process %.*s (pid: %d, ti=%p task=%p task.ti=%p)",
319 TASK_COMM_LEN, current->comm, current->pid, 321 TASK_COMM_LEN, current->comm, current->pid,
320 current_thread_info(), current, current->thread_info); 322 current_thread_info(), current, current->thread_info);
@@ -324,7 +326,8 @@ void show_registers(struct pt_regs *regs)
324 */ 326 */
325 if (in_kernel) { 327 if (in_kernel) {
326 u8 *eip; 328 u8 *eip;
327 int code_bytes = 64; 329 unsigned int code_prologue = code_bytes * 43 / 64;
330 unsigned int code_len = code_bytes;
328 unsigned char c; 331 unsigned char c;
329 332
330 printk("\n" KERN_EMERG "Stack: "); 333 printk("\n" KERN_EMERG "Stack: ");
@@ -332,14 +335,14 @@ void show_registers(struct pt_regs *regs)
332 335
333 printk(KERN_EMERG "Code: "); 336 printk(KERN_EMERG "Code: ");
334 337
335 eip = (u8 *)regs->eip - 43; 338 eip = (u8 *)regs->eip - code_prologue;
336 if (eip < (u8 *)PAGE_OFFSET || 339 if (eip < (u8 *)PAGE_OFFSET ||
337 probe_kernel_address(eip, c)) { 340 probe_kernel_address(eip, c)) {
338 /* try starting at EIP */ 341 /* try starting at EIP */
339 eip = (u8 *)regs->eip; 342 eip = (u8 *)regs->eip;
340 code_bytes = 32; 343 code_len = code_len - code_prologue + 1;
341 } 344 }
342 for (i = 0; i < code_bytes; i++, eip++) { 345 for (i = 0; i < code_len; i++, eip++) {
343 if (eip < (u8 *)PAGE_OFFSET || 346 if (eip < (u8 *)PAGE_OFFSET ||
344 probe_kernel_address(eip, c)) { 347 probe_kernel_address(eip, c)) {
345 printk(" Bad EIP value."); 348 printk(" Bad EIP value.");
@@ -1191,3 +1194,13 @@ static int __init kstack_setup(char *s)
1191 return 1; 1194 return 1;
1192} 1195}
1193__setup("kstack=", kstack_setup); 1196__setup("kstack=", kstack_setup);
1197
1198static int __init code_bytes_setup(char *s)
1199{
1200 code_bytes = simple_strtoul(s, NULL, 0);
1201 if (code_bytes > 8192)
1202 code_bytes = 8192;
1203
1204 return 1;
1205}
1206__setup("code_bytes=", code_bytes_setup);
diff --git a/arch/i386/kernel/tsc.c b/arch/i386/kernel/tsc.c
index 2cfc7b09b925..46f752a8bbf3 100644
--- a/arch/i386/kernel/tsc.c
+++ b/arch/i386/kernel/tsc.c
@@ -23,6 +23,7 @@
23 * an extra value to store the TSC freq 23 * an extra value to store the TSC freq
24 */ 24 */
25unsigned int tsc_khz; 25unsigned int tsc_khz;
26unsigned long long (*custom_sched_clock)(void);
26 27
27int tsc_disable; 28int tsc_disable;
28 29
@@ -107,14 +108,14 @@ unsigned long long sched_clock(void)
107{ 108{
108 unsigned long long this_offset; 109 unsigned long long this_offset;
109 110
111 if (unlikely(custom_sched_clock))
112 return (*custom_sched_clock)();
113
110 /* 114 /*
111 * in the NUMA case we dont use the TSC as they are not 115 * Fall back to jiffies if there's no TSC available:
112 * synchronized across all CPUs.
113 */ 116 */
114#ifndef CONFIG_NUMA 117 if (unlikely(tsc_disable))
115 if (!cpu_khz || check_tsc_unstable()) 118 /* No locking but a rare wrong value is not a big deal: */
116#endif
117 /* no locking but a rare wrong value is not a big deal */
118 return (jiffies_64 - INITIAL_JIFFIES) * (1000000000 / HZ); 119 return (jiffies_64 - INITIAL_JIFFIES) * (1000000000 / HZ);
119 120
120 /* read the Time Stamp Counter: */ 121 /* read the Time Stamp Counter: */
@@ -194,13 +195,13 @@ EXPORT_SYMBOL(recalibrate_cpu_khz);
194void __init tsc_init(void) 195void __init tsc_init(void)
195{ 196{
196 if (!cpu_has_tsc || tsc_disable) 197 if (!cpu_has_tsc || tsc_disable)
197 return; 198 goto out_no_tsc;
198 199
199 cpu_khz = calculate_cpu_khz(); 200 cpu_khz = calculate_cpu_khz();
200 tsc_khz = cpu_khz; 201 tsc_khz = cpu_khz;
201 202
202 if (!cpu_khz) 203 if (!cpu_khz)
203 return; 204 goto out_no_tsc;
204 205
205 printk("Detected %lu.%03lu MHz processor.\n", 206 printk("Detected %lu.%03lu MHz processor.\n",
206 (unsigned long)cpu_khz / 1000, 207 (unsigned long)cpu_khz / 1000,
@@ -208,6 +209,15 @@ void __init tsc_init(void)
208 209
209 set_cyc2ns_scale(cpu_khz); 210 set_cyc2ns_scale(cpu_khz);
210 use_tsc_delay(); 211 use_tsc_delay();
212 return;
213
214out_no_tsc:
215 /*
216 * Set the tsc_disable flag if there's no TSC support, this
217 * makes it a fast flag for the kernel to see whether it
218 * should be using the TSC.
219 */
220 tsc_disable = 1;
211} 221}
212 222
213#ifdef CONFIG_CPU_FREQ 223#ifdef CONFIG_CPU_FREQ
diff --git a/arch/i386/kernel/vm86.c b/arch/i386/kernel/vm86.c
index be2f96e67f78..d1b8f2b7aea6 100644
--- a/arch/i386/kernel/vm86.c
+++ b/arch/i386/kernel/vm86.c
@@ -96,12 +96,12 @@ static int copy_vm86_regs_to_user(struct vm86_regs __user *user,
96{ 96{
97 int ret = 0; 97 int ret = 0;
98 98
99 /* kernel_vm86_regs is missing xfs, so copy everything up to 99 /* kernel_vm86_regs is missing xgs, so copy everything up to
100 (but not including) xgs, and then rest after xgs. */ 100 (but not including) orig_eax, and then rest including orig_eax. */
101 ret += copy_to_user(user, regs, offsetof(struct kernel_vm86_regs, pt.xgs)); 101 ret += copy_to_user(user, regs, offsetof(struct kernel_vm86_regs, pt.orig_eax));
102 ret += copy_to_user(&user->__null_gs, &regs->pt.xgs, 102 ret += copy_to_user(&user->orig_eax, &regs->pt.orig_eax,
103 sizeof(struct kernel_vm86_regs) - 103 sizeof(struct kernel_vm86_regs) -
104 offsetof(struct kernel_vm86_regs, pt.xgs)); 104 offsetof(struct kernel_vm86_regs, pt.orig_eax));
105 105
106 return ret; 106 return ret;
107} 107}
@@ -113,12 +113,13 @@ static int copy_vm86_regs_from_user(struct kernel_vm86_regs *regs,
113{ 113{
114 int ret = 0; 114 int ret = 0;
115 115
116 ret += copy_from_user(regs, user, offsetof(struct kernel_vm86_regs, pt.xgs)); 116 /* copy eax-xfs inclusive */
117 ret += copy_from_user(&regs->pt.xgs, &user->__null_gs, 117 ret += copy_from_user(regs, user, offsetof(struct kernel_vm86_regs, pt.orig_eax));
118 /* copy orig_eax-__gsh+extra */
119 ret += copy_from_user(&regs->pt.orig_eax, &user->orig_eax,
118 sizeof(struct kernel_vm86_regs) - 120 sizeof(struct kernel_vm86_regs) -
119 offsetof(struct kernel_vm86_regs, pt.xgs) + 121 offsetof(struct kernel_vm86_regs, pt.orig_eax) +
120 extra); 122 extra);
121
122 return ret; 123 return ret;
123} 124}
124 125
@@ -157,8 +158,8 @@ struct pt_regs * fastcall save_v86_state(struct kernel_vm86_regs * regs)
157 158
158 ret = KVM86->regs32; 159 ret = KVM86->regs32;
159 160
160 loadsegment(fs, current->thread.saved_fs); 161 ret->xfs = current->thread.saved_fs;
161 ret->xgs = current->thread.saved_gs; 162 loadsegment(gs, current->thread.saved_gs);
162 163
163 return ret; 164 return ret;
164} 165}
@@ -285,9 +286,9 @@ static void do_sys_vm86(struct kernel_vm86_struct *info, struct task_struct *tsk
285 */ 286 */
286 info->regs.pt.xds = 0; 287 info->regs.pt.xds = 0;
287 info->regs.pt.xes = 0; 288 info->regs.pt.xes = 0;
288 info->regs.pt.xgs = 0; 289 info->regs.pt.xfs = 0;
289 290
290/* we are clearing fs later just before "jmp resume_userspace", 291/* we are clearing gs later just before "jmp resume_userspace",
291 * because it is not saved/restored. 292 * because it is not saved/restored.
292 */ 293 */
293 294
@@ -321,8 +322,8 @@ static void do_sys_vm86(struct kernel_vm86_struct *info, struct task_struct *tsk
321 */ 322 */
322 info->regs32->eax = 0; 323 info->regs32->eax = 0;
323 tsk->thread.saved_esp0 = tsk->thread.esp0; 324 tsk->thread.saved_esp0 = tsk->thread.esp0;
324 savesegment(fs, tsk->thread.saved_fs); 325 tsk->thread.saved_fs = info->regs32->xfs;
325 tsk->thread.saved_gs = info->regs32->xgs; 326 savesegment(gs, tsk->thread.saved_gs);
326 327
327 tss = &per_cpu(init_tss, get_cpu()); 328 tss = &per_cpu(init_tss, get_cpu());
328 tsk->thread.esp0 = (unsigned long) &info->VM86_TSS_ESP0; 329 tsk->thread.esp0 = (unsigned long) &info->VM86_TSS_ESP0;
@@ -342,7 +343,7 @@ static void do_sys_vm86(struct kernel_vm86_struct *info, struct task_struct *tsk
342 __asm__ __volatile__( 343 __asm__ __volatile__(
343 "movl %0,%%esp\n\t" 344 "movl %0,%%esp\n\t"
344 "movl %1,%%ebp\n\t" 345 "movl %1,%%ebp\n\t"
345 "mov %2, %%fs\n\t" 346 "mov %2, %%gs\n\t"
346 "jmp resume_userspace" 347 "jmp resume_userspace"
347 : /* no outputs */ 348 : /* no outputs */
348 :"r" (&info->regs), "r" (task_thread_info(tsk)), "r" (0)); 349 :"r" (&info->regs), "r" (task_thread_info(tsk)), "r" (0));
diff --git a/arch/i386/kernel/vmi.c b/arch/i386/kernel/vmi.c
new file mode 100644
index 000000000000..bb5a7abf949c
--- /dev/null
+++ b/arch/i386/kernel/vmi.c
@@ -0,0 +1,949 @@
1/*
2 * VMI specific paravirt-ops implementation
3 *
4 * Copyright (C) 2005, VMware, Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
14 * NON INFRINGEMENT. See the GNU General Public License for more
15 * details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 *
21 * Send feedback to zach@vmware.com
22 *
23 */
24
25#include <linux/module.h>
26#include <linux/license.h>
27#include <linux/cpu.h>
28#include <linux/bootmem.h>
29#include <linux/mm.h>
30#include <asm/vmi.h>
31#include <asm/io.h>
32#include <asm/fixmap.h>
33#include <asm/apicdef.h>
34#include <asm/apic.h>
35#include <asm/processor.h>
36#include <asm/timer.h>
37#include <asm/vmi_time.h>
38
39/* Convenient for calling VMI functions indirectly in the ROM */
40typedef u32 __attribute__((regparm(1))) (VROMFUNC)(void);
41typedef u64 __attribute__((regparm(2))) (VROMLONGFUNC)(int);
42
43#define call_vrom_func(rom,func) \
44 (((VROMFUNC *)(rom->func))())
45
46#define call_vrom_long_func(rom,func,arg) \
47 (((VROMLONGFUNC *)(rom->func)) (arg))
48
49static struct vrom_header *vmi_rom;
50static int license_gplok;
51static int disable_nodelay;
52static int disable_pge;
53static int disable_pse;
54static int disable_sep;
55static int disable_tsc;
56static int disable_mtrr;
57
58/* Cached VMI operations */
59struct {
60 void (*cpuid)(void /* non-c */);
61 void (*_set_ldt)(u32 selector);
62 void (*set_tr)(u32 selector);
63 void (*set_kernel_stack)(u32 selector, u32 esp0);
64 void (*allocate_page)(u32, u32, u32, u32, u32);
65 void (*release_page)(u32, u32);
66 void (*set_pte)(pte_t, pte_t *, unsigned);
67 void (*update_pte)(pte_t *, unsigned);
68 void (*set_linear_mapping)(int, u32, u32, u32);
69 void (*flush_tlb)(int);
70 void (*set_initial_ap_state)(int, int);
71 void (*halt)(void);
72} vmi_ops;
73
74/* XXX move this to alternative.h */
75extern struct paravirt_patch __start_parainstructions[],
76 __stop_parainstructions[];
77
78/*
79 * VMI patching routines.
80 */
81#define MNEM_CALL 0xe8
82#define MNEM_JMP 0xe9
83#define MNEM_RET 0xc3
84
85static char irq_save_disable_callout[] = {
86 MNEM_CALL, 0, 0, 0, 0,
87 MNEM_CALL, 0, 0, 0, 0,
88 MNEM_RET
89};
90#define IRQ_PATCH_INT_MASK 0
91#define IRQ_PATCH_DISABLE 5
92
93static inline void patch_offset(unsigned char *eip, unsigned char *dest)
94{
95 *(unsigned long *)(eip+1) = dest-eip-5;
96}
97
98static unsigned patch_internal(int call, unsigned len, void *insns)
99{
100 u64 reloc;
101 struct vmi_relocation_info *const rel = (struct vmi_relocation_info *)&reloc;
102 reloc = call_vrom_long_func(vmi_rom, get_reloc, call);
103 switch(rel->type) {
104 case VMI_RELOCATION_CALL_REL:
105 BUG_ON(len < 5);
106 *(char *)insns = MNEM_CALL;
107 patch_offset(insns, rel->eip);
108 return 5;
109
110 case VMI_RELOCATION_JUMP_REL:
111 BUG_ON(len < 5);
112 *(char *)insns = MNEM_JMP;
113 patch_offset(insns, rel->eip);
114 return 5;
115
116 case VMI_RELOCATION_NOP:
117 /* obliterate the whole thing */
118 return 0;
119
120 case VMI_RELOCATION_NONE:
121 /* leave native code in place */
122 break;
123
124 default:
125 BUG();
126 }
127 return len;
128}
129
130/*
131 * Apply patch if appropriate, return length of new instruction
132 * sequence. The callee does nop padding for us.
133 */
134static unsigned vmi_patch(u8 type, u16 clobbers, void *insns, unsigned len)
135{
136 switch (type) {
137 case PARAVIRT_IRQ_DISABLE:
138 return patch_internal(VMI_CALL_DisableInterrupts, len, insns);
139 case PARAVIRT_IRQ_ENABLE:
140 return patch_internal(VMI_CALL_EnableInterrupts, len, insns);
141 case PARAVIRT_RESTORE_FLAGS:
142 return patch_internal(VMI_CALL_SetInterruptMask, len, insns);
143 case PARAVIRT_SAVE_FLAGS:
144 return patch_internal(VMI_CALL_GetInterruptMask, len, insns);
145 case PARAVIRT_SAVE_FLAGS_IRQ_DISABLE:
146 if (len >= 10) {
147 patch_internal(VMI_CALL_GetInterruptMask, len, insns);
148 patch_internal(VMI_CALL_DisableInterrupts, len-5, insns+5);
149 return 10;
150 } else {
151 /*
152 * You bastards didn't leave enough room to
153 * patch save_flags_irq_disable inline. Patch
154 * to a helper
155 */
156 BUG_ON(len < 5);
157 *(char *)insns = MNEM_CALL;
158 patch_offset(insns, irq_save_disable_callout);
159 return 5;
160 }
161 case PARAVIRT_INTERRUPT_RETURN:
162 return patch_internal(VMI_CALL_IRET, len, insns);
163 case PARAVIRT_STI_SYSEXIT:
164 return patch_internal(VMI_CALL_SYSEXIT, len, insns);
165 default:
166 break;
167 }
168 return len;
169}
170
171/* CPUID has non-C semantics, and paravirt-ops API doesn't match hardware ISA */
172static void vmi_cpuid(unsigned int *eax, unsigned int *ebx,
173 unsigned int *ecx, unsigned int *edx)
174{
175 int override = 0;
176 if (*eax == 1)
177 override = 1;
178 asm volatile ("call *%6"
179 : "=a" (*eax),
180 "=b" (*ebx),
181 "=c" (*ecx),
182 "=d" (*edx)
183 : "0" (*eax), "2" (*ecx), "r" (vmi_ops.cpuid));
184 if (override) {
185 if (disable_pse)
186 *edx &= ~X86_FEATURE_PSE;
187 if (disable_pge)
188 *edx &= ~X86_FEATURE_PGE;
189 if (disable_sep)
190 *edx &= ~X86_FEATURE_SEP;
191 if (disable_tsc)
192 *edx &= ~X86_FEATURE_TSC;
193 if (disable_mtrr)
194 *edx &= ~X86_FEATURE_MTRR;
195 }
196}
197
198static inline void vmi_maybe_load_tls(struct desc_struct *gdt, int nr, struct desc_struct *new)
199{
200 if (gdt[nr].a != new->a || gdt[nr].b != new->b)
201 write_gdt_entry(gdt, nr, new->a, new->b);
202}
203
204static void vmi_load_tls(struct thread_struct *t, unsigned int cpu)
205{
206 struct desc_struct *gdt = get_cpu_gdt_table(cpu);
207 vmi_maybe_load_tls(gdt, GDT_ENTRY_TLS_MIN + 0, &t->tls_array[0]);
208 vmi_maybe_load_tls(gdt, GDT_ENTRY_TLS_MIN + 1, &t->tls_array[1]);
209 vmi_maybe_load_tls(gdt, GDT_ENTRY_TLS_MIN + 2, &t->tls_array[2]);
210}
211
212static void vmi_set_ldt(const void *addr, unsigned entries)
213{
214 unsigned cpu = smp_processor_id();
215 u32 low, high;
216
217 pack_descriptor(&low, &high, (unsigned long)addr,
218 entries * sizeof(struct desc_struct) - 1,
219 DESCTYPE_LDT, 0);
220 write_gdt_entry(get_cpu_gdt_table(cpu), GDT_ENTRY_LDT, low, high);
221 vmi_ops._set_ldt(entries ? GDT_ENTRY_LDT*sizeof(struct desc_struct) : 0);
222}
223
224static void vmi_set_tr(void)
225{
226 vmi_ops.set_tr(GDT_ENTRY_TSS*sizeof(struct desc_struct));
227}
228
229static void vmi_load_esp0(struct tss_struct *tss,
230 struct thread_struct *thread)
231{
232 tss->esp0 = thread->esp0;
233
234 /* This can only happen when SEP is enabled, no need to test "SEP"arately */
235 if (unlikely(tss->ss1 != thread->sysenter_cs)) {
236 tss->ss1 = thread->sysenter_cs;
237 wrmsr(MSR_IA32_SYSENTER_CS, thread->sysenter_cs, 0);
238 }
239 vmi_ops.set_kernel_stack(__KERNEL_DS, tss->esp0);
240}
241
242static void vmi_flush_tlb_user(void)
243{
244 vmi_ops.flush_tlb(VMI_FLUSH_TLB);
245}
246
247static void vmi_flush_tlb_kernel(void)
248{
249 vmi_ops.flush_tlb(VMI_FLUSH_TLB | VMI_FLUSH_GLOBAL);
250}
251
252/* Stub to do nothing at all; used for delays and unimplemented calls */
253static void vmi_nop(void)
254{
255}
256
257/* For NO_IDLE_HZ, we stop the clock when halting the kernel */
258#ifdef CONFIG_NO_IDLE_HZ
259static fastcall void vmi_safe_halt(void)
260{
261 int idle = vmi_stop_hz_timer();
262 vmi_ops.halt();
263 if (idle) {
264 local_irq_disable();
265 vmi_account_time_restart_hz_timer();
266 local_irq_enable();
267 }
268}
269#endif
270
271#ifdef CONFIG_DEBUG_PAGE_TYPE
272
273#ifdef CONFIG_X86_PAE
274#define MAX_BOOT_PTS (2048+4+1)
275#else
276#define MAX_BOOT_PTS (1024+1)
277#endif
278
279/*
280 * During boot, mem_map is not yet available in paging_init, so stash
281 * all the boot page allocations here.
282 */
283static struct {
284 u32 pfn;
285 int type;
286} boot_page_allocations[MAX_BOOT_PTS];
287static int num_boot_page_allocations;
288static int boot_allocations_applied;
289
290void vmi_apply_boot_page_allocations(void)
291{
292 int i;
293 BUG_ON(!mem_map);
294 for (i = 0; i < num_boot_page_allocations; i++) {
295 struct page *page = pfn_to_page(boot_page_allocations[i].pfn);
296 page->type = boot_page_allocations[i].type;
297 page->type = boot_page_allocations[i].type &
298 ~(VMI_PAGE_ZEROED | VMI_PAGE_CLONE);
299 }
300 boot_allocations_applied = 1;
301}
302
303static void record_page_type(u32 pfn, int type)
304{
305 BUG_ON(num_boot_page_allocations >= MAX_BOOT_PTS);
306 boot_page_allocations[num_boot_page_allocations].pfn = pfn;
307 boot_page_allocations[num_boot_page_allocations].type = type;
308 num_boot_page_allocations++;
309}
310
311static void check_zeroed_page(u32 pfn, int type, struct page *page)
312{
313 u32 *ptr;
314 int i;
315 int limit = PAGE_SIZE / sizeof(int);
316
317 if (page_address(page))
318 ptr = (u32 *)page_address(page);
319 else
320 ptr = (u32 *)__va(pfn << PAGE_SHIFT);
321 /*
322 * When cloning the root in non-PAE mode, only the userspace
323 * pdes need to be zeroed.
324 */
325 if (type & VMI_PAGE_CLONE)
326 limit = USER_PTRS_PER_PGD;
327 for (i = 0; i < limit; i++)
328 BUG_ON(ptr[i]);
329}
330
331/*
332 * We stash the page type into struct page so we can verify the page
333 * types are used properly.
334 */
335static void vmi_set_page_type(u32 pfn, int type)
336{
337 /* PAE can have multiple roots per page - don't track */
338 if (PTRS_PER_PMD > 1 && (type & VMI_PAGE_PDP))
339 return;
340
341 if (boot_allocations_applied) {
342 struct page *page = pfn_to_page(pfn);
343 if (type != VMI_PAGE_NORMAL)
344 BUG_ON(page->type);
345 else
346 BUG_ON(page->type == VMI_PAGE_NORMAL);
347 page->type = type & ~(VMI_PAGE_ZEROED | VMI_PAGE_CLONE);
348 if (type & VMI_PAGE_ZEROED)
349 check_zeroed_page(pfn, type, page);
350 } else {
351 record_page_type(pfn, type);
352 }
353}
354
355static void vmi_check_page_type(u32 pfn, int type)
356{
357 /* PAE can have multiple roots per page - skip checks */
358 if (PTRS_PER_PMD > 1 && (type & VMI_PAGE_PDP))
359 return;
360
361 type &= ~(VMI_PAGE_ZEROED | VMI_PAGE_CLONE);
362 if (boot_allocations_applied) {
363 struct page *page = pfn_to_page(pfn);
364 BUG_ON((page->type ^ type) & VMI_PAGE_PAE);
365 BUG_ON(type == VMI_PAGE_NORMAL && page->type);
366 BUG_ON((type & page->type) == 0);
367 }
368}
369#else
370#define vmi_set_page_type(p,t) do { } while (0)
371#define vmi_check_page_type(p,t) do { } while (0)
372#endif
373
374static void vmi_allocate_pt(u32 pfn)
375{
376 vmi_set_page_type(pfn, VMI_PAGE_L1);
377 vmi_ops.allocate_page(pfn, VMI_PAGE_L1, 0, 0, 0);
378}
379
380static void vmi_allocate_pd(u32 pfn)
381{
382 /*
383 * This call comes in very early, before mem_map is setup.
384 * It is called only for swapper_pg_dir, which already has
385 * data on it.
386 */
387 vmi_set_page_type(pfn, VMI_PAGE_L2);
388 vmi_ops.allocate_page(pfn, VMI_PAGE_L2, 0, 0, 0);
389}
390
391static void vmi_allocate_pd_clone(u32 pfn, u32 clonepfn, u32 start, u32 count)
392{
393 vmi_set_page_type(pfn, VMI_PAGE_L2 | VMI_PAGE_CLONE);
394 vmi_check_page_type(clonepfn, VMI_PAGE_L2);
395 vmi_ops.allocate_page(pfn, VMI_PAGE_L2 | VMI_PAGE_CLONE, clonepfn, start, count);
396}
397
398static void vmi_release_pt(u32 pfn)
399{
400 vmi_ops.release_page(pfn, VMI_PAGE_L1);
401 vmi_set_page_type(pfn, VMI_PAGE_NORMAL);
402}
403
404static void vmi_release_pd(u32 pfn)
405{
406 vmi_ops.release_page(pfn, VMI_PAGE_L2);
407 vmi_set_page_type(pfn, VMI_PAGE_NORMAL);
408}
409
410/*
411 * Helper macros for MMU update flags. We can defer updates until a flush
412 * or page invalidation only if the update is to the current address space
413 * (otherwise, there is no flush). We must check against init_mm, since
414 * this could be a kernel update, which usually passes init_mm, although
415 * sometimes this check can be skipped if we know the particular function
416 * is only called on user mode PTEs. We could change the kernel to pass
417 * current->active_mm here, but in particular, I was unsure if changing
418 * mm/highmem.c to do this would still be correct on other architectures.
419 */
420#define is_current_as(mm, mustbeuser) ((mm) == current->active_mm || \
421 (!mustbeuser && (mm) == &init_mm))
422#define vmi_flags_addr(mm, addr, level, user) \
423 ((level) | (is_current_as(mm, user) ? \
424 (VMI_PAGE_CURRENT_AS | ((addr) & VMI_PAGE_VA_MASK)) : 0))
425#define vmi_flags_addr_defer(mm, addr, level, user) \
426 ((level) | (is_current_as(mm, user) ? \
427 (VMI_PAGE_DEFER | VMI_PAGE_CURRENT_AS | ((addr) & VMI_PAGE_VA_MASK)) : 0))
428
429static void vmi_update_pte(struct mm_struct *mm, u32 addr, pte_t *ptep)
430{
431 vmi_check_page_type(__pa(ptep) >> PAGE_SHIFT, VMI_PAGE_PTE);
432 vmi_ops.update_pte(ptep, vmi_flags_addr(mm, addr, VMI_PAGE_PT, 0));
433}
434
435static void vmi_update_pte_defer(struct mm_struct *mm, u32 addr, pte_t *ptep)
436{
437 vmi_check_page_type(__pa(ptep) >> PAGE_SHIFT, VMI_PAGE_PTE);
438 vmi_ops.update_pte(ptep, vmi_flags_addr_defer(mm, addr, VMI_PAGE_PT, 0));
439}
440
441static void vmi_set_pte(pte_t *ptep, pte_t pte)
442{
443 /* XXX because of set_pmd_pte, this can be called on PT or PD layers */
444 vmi_check_page_type(__pa(ptep) >> PAGE_SHIFT, VMI_PAGE_PTE | VMI_PAGE_PD);
445 vmi_ops.set_pte(pte, ptep, VMI_PAGE_PT);
446}
447
448static void vmi_set_pte_at(struct mm_struct *mm, u32 addr, pte_t *ptep, pte_t pte)
449{
450 vmi_check_page_type(__pa(ptep) >> PAGE_SHIFT, VMI_PAGE_PTE);
451 vmi_ops.set_pte(pte, ptep, vmi_flags_addr(mm, addr, VMI_PAGE_PT, 0));
452}
453
454static void vmi_set_pmd(pmd_t *pmdp, pmd_t pmdval)
455{
456#ifdef CONFIG_X86_PAE
457 const pte_t pte = { pmdval.pmd, pmdval.pmd >> 32 };
458 vmi_check_page_type(__pa(pmdp) >> PAGE_SHIFT, VMI_PAGE_PMD);
459#else
460 const pte_t pte = { pmdval.pud.pgd.pgd };
461 vmi_check_page_type(__pa(pmdp) >> PAGE_SHIFT, VMI_PAGE_PGD);
462#endif
463 vmi_ops.set_pte(pte, (pte_t *)pmdp, VMI_PAGE_PD);
464}
465
466#ifdef CONFIG_X86_PAE
467
468static void vmi_set_pte_atomic(pte_t *ptep, pte_t pteval)
469{
470 /*
471 * XXX This is called from set_pmd_pte, but at both PT
472 * and PD layers so the VMI_PAGE_PT flag is wrong. But
473 * it is only called for large page mapping changes,
474 * the Xen backend, doesn't support large pages, and the
475 * ESX backend doesn't depend on the flag.
476 */
477 set_64bit((unsigned long long *)ptep,pte_val(pteval));
478 vmi_ops.update_pte(ptep, VMI_PAGE_PT);
479}
480
481static void vmi_set_pte_present(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pte)
482{
483 vmi_check_page_type(__pa(ptep) >> PAGE_SHIFT, VMI_PAGE_PTE);
484 vmi_ops.set_pte(pte, ptep, vmi_flags_addr_defer(mm, addr, VMI_PAGE_PT, 1));
485}
486
487static void vmi_set_pud(pud_t *pudp, pud_t pudval)
488{
489 /* Um, eww */
490 const pte_t pte = { pudval.pgd.pgd, pudval.pgd.pgd >> 32 };
491 vmi_check_page_type(__pa(pudp) >> PAGE_SHIFT, VMI_PAGE_PGD);
492 vmi_ops.set_pte(pte, (pte_t *)pudp, VMI_PAGE_PDP);
493}
494
495static void vmi_pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
496{
497 const pte_t pte = { 0 };
498 vmi_check_page_type(__pa(ptep) >> PAGE_SHIFT, VMI_PAGE_PTE);
499 vmi_ops.set_pte(pte, ptep, vmi_flags_addr(mm, addr, VMI_PAGE_PT, 0));
500}
501
502void vmi_pmd_clear(pmd_t *pmd)
503{
504 const pte_t pte = { 0 };
505 vmi_check_page_type(__pa(pmd) >> PAGE_SHIFT, VMI_PAGE_PMD);
506 vmi_ops.set_pte(pte, (pte_t *)pmd, VMI_PAGE_PD);
507}
508#endif
509
510#ifdef CONFIG_SMP
511struct vmi_ap_state ap;
512extern void setup_pda(void);
513
514static void __init /* XXX cpu hotplug */
515vmi_startup_ipi_hook(int phys_apicid, unsigned long start_eip,
516 unsigned long start_esp)
517{
518 /* Default everything to zero. This is fine for most GPRs. */
519 memset(&ap, 0, sizeof(struct vmi_ap_state));
520
521 ap.gdtr_limit = GDT_SIZE - 1;
522 ap.gdtr_base = (unsigned long) get_cpu_gdt_table(phys_apicid);
523
524 ap.idtr_limit = IDT_ENTRIES * 8 - 1;
525 ap.idtr_base = (unsigned long) idt_table;
526
527 ap.ldtr = 0;
528
529 ap.cs = __KERNEL_CS;
530 ap.eip = (unsigned long) start_eip;
531 ap.ss = __KERNEL_DS;
532 ap.esp = (unsigned long) start_esp;
533
534 ap.ds = __USER_DS;
535 ap.es = __USER_DS;
536 ap.fs = __KERNEL_PDA;
537 ap.gs = 0;
538
539 ap.eflags = 0;
540
541 setup_pda();
542
543#ifdef CONFIG_X86_PAE
544 /* efer should match BSP efer. */
545 if (cpu_has_nx) {
546 unsigned l, h;
547 rdmsr(MSR_EFER, l, h);
548 ap.efer = (unsigned long long) h << 32 | l;
549 }
550#endif
551
552 ap.cr3 = __pa(swapper_pg_dir);
553 /* Protected mode, paging, AM, WP, NE, MP. */
554 ap.cr0 = 0x80050023;
555 ap.cr4 = mmu_cr4_features;
556 vmi_ops.set_initial_ap_state(__pa(&ap), phys_apicid);
557}
558#endif
559
560static inline int __init check_vmi_rom(struct vrom_header *rom)
561{
562 struct pci_header *pci;
563 struct pnp_header *pnp;
564 const char *manufacturer = "UNKNOWN";
565 const char *product = "UNKNOWN";
566 const char *license = "unspecified";
567
568 if (rom->rom_signature != 0xaa55)
569 return 0;
570 if (rom->vrom_signature != VMI_SIGNATURE)
571 return 0;
572 if (rom->api_version_maj != VMI_API_REV_MAJOR ||
573 rom->api_version_min+1 < VMI_API_REV_MINOR+1) {
574 printk(KERN_WARNING "VMI: Found mismatched rom version %d.%d\n",
575 rom->api_version_maj,
576 rom->api_version_min);
577 return 0;
578 }
579
580 /*
581 * Relying on the VMI_SIGNATURE field is not 100% safe, so check
582 * the PCI header and device type to make sure this is really a
583 * VMI device.
584 */
585 if (!rom->pci_header_offs) {
586 printk(KERN_WARNING "VMI: ROM does not contain PCI header.\n");
587 return 0;
588 }
589
590 pci = (struct pci_header *)((char *)rom+rom->pci_header_offs);
591 if (pci->vendorID != PCI_VENDOR_ID_VMWARE ||
592 pci->deviceID != PCI_DEVICE_ID_VMWARE_VMI) {
593 /* Allow it to run... anyways, but warn */
594 printk(KERN_WARNING "VMI: ROM from unknown manufacturer\n");
595 }
596
597 if (rom->pnp_header_offs) {
598 pnp = (struct pnp_header *)((char *)rom+rom->pnp_header_offs);
599 if (pnp->manufacturer_offset)
600 manufacturer = (const char *)rom+pnp->manufacturer_offset;
601 if (pnp->product_offset)
602 product = (const char *)rom+pnp->product_offset;
603 }
604
605 if (rom->license_offs)
606 license = (char *)rom+rom->license_offs;
607
608 printk(KERN_INFO "VMI: Found %s %s, API version %d.%d, ROM version %d.%d\n",
609 manufacturer, product,
610 rom->api_version_maj, rom->api_version_min,
611 pci->rom_version_maj, pci->rom_version_min);
612
613 license_gplok = license_is_gpl_compatible(license);
614 if (!license_gplok) {
615 printk(KERN_WARNING "VMI: ROM license '%s' taints kernel... "
616 "inlining disabled\n",
617 license);
618 add_taint(TAINT_PROPRIETARY_MODULE);
619 }
620 return 1;
621}
622
623/*
624 * Probe for the VMI option ROM
625 */
626static inline int __init probe_vmi_rom(void)
627{
628 unsigned long base;
629
630 /* VMI ROM is in option ROM area, check signature */
631 for (base = 0xC0000; base < 0xE0000; base += 2048) {
632 struct vrom_header *romstart;
633 romstart = (struct vrom_header *)isa_bus_to_virt(base);
634 if (check_vmi_rom(romstart)) {
635 vmi_rom = romstart;
636 return 1;
637 }
638 }
639 return 0;
640}
641
642/*
643 * VMI setup common to all processors
644 */
645void vmi_bringup(void)
646{
647 /* We must establish the lowmem mapping for MMU ops to work */
648 if (vmi_rom)
649 vmi_ops.set_linear_mapping(0, __PAGE_OFFSET, max_low_pfn, 0);
650}
651
652/*
653 * Return a pointer to the VMI function or a NOP stub
654 */
655static void *vmi_get_function(int vmicall)
656{
657 u64 reloc;
658 const struct vmi_relocation_info *rel = (struct vmi_relocation_info *)&reloc;
659 reloc = call_vrom_long_func(vmi_rom, get_reloc, vmicall);
660 BUG_ON(rel->type == VMI_RELOCATION_JUMP_REL);
661 if (rel->type == VMI_RELOCATION_CALL_REL)
662 return (void *)rel->eip;
663 else
664 return (void *)vmi_nop;
665}
666
667/*
668 * Helper macro for making the VMI paravirt-ops fill code readable.
669 * For unimplemented operations, fall back to default.
670 */
671#define para_fill(opname, vmicall) \
672do { \
673 reloc = call_vrom_long_func(vmi_rom, get_reloc, \
674 VMI_CALL_##vmicall); \
675 if (rel->type != VMI_RELOCATION_NONE) { \
676 BUG_ON(rel->type != VMI_RELOCATION_CALL_REL); \
677 paravirt_ops.opname = (void *)rel->eip; \
678 } \
679} while (0)
680
681/*
682 * Activate the VMI interface and switch into paravirtualized mode
683 */
684static inline int __init activate_vmi(void)
685{
686 short kernel_cs;
687 u64 reloc;
688 const struct vmi_relocation_info *rel = (struct vmi_relocation_info *)&reloc;
689
690 if (call_vrom_func(vmi_rom, vmi_init) != 0) {
691 printk(KERN_ERR "VMI ROM failed to initialize!");
692 return 0;
693 }
694 savesegment(cs, kernel_cs);
695
696 paravirt_ops.paravirt_enabled = 1;
697 paravirt_ops.kernel_rpl = kernel_cs & SEGMENT_RPL_MASK;
698
699 paravirt_ops.patch = vmi_patch;
700 paravirt_ops.name = "vmi";
701
702 /*
703 * Many of these operations are ABI compatible with VMI.
704 * This means we can fill in the paravirt-ops with direct
705 * pointers into the VMI ROM. If the calling convention for
706 * these operations changes, this code needs to be updated.
707 *
708 * Exceptions
709 * CPUID paravirt-op uses pointers, not the native ISA
710 * halt has no VMI equivalent; all VMI halts are "safe"
711 * no MSR support yet - just trap and emulate. VMI uses the
712 * same ABI as the native ISA, but Linux wants exceptions
713 * from bogus MSR read / write handled
714 * rdpmc is not yet used in Linux
715 */
716
717 /* CPUID is special, so very special */
718 reloc = call_vrom_long_func(vmi_rom, get_reloc, VMI_CALL_CPUID);
719 if (rel->type != VMI_RELOCATION_NONE) {
720 BUG_ON(rel->type != VMI_RELOCATION_CALL_REL);
721 vmi_ops.cpuid = (void *)rel->eip;
722 paravirt_ops.cpuid = vmi_cpuid;
723 }
724
725 para_fill(clts, CLTS);
726 para_fill(get_debugreg, GetDR);
727 para_fill(set_debugreg, SetDR);
728 para_fill(read_cr0, GetCR0);
729 para_fill(read_cr2, GetCR2);
730 para_fill(read_cr3, GetCR3);
731 para_fill(read_cr4, GetCR4);
732 para_fill(write_cr0, SetCR0);
733 para_fill(write_cr2, SetCR2);
734 para_fill(write_cr3, SetCR3);
735 para_fill(write_cr4, SetCR4);
736 para_fill(save_fl, GetInterruptMask);
737 para_fill(restore_fl, SetInterruptMask);
738 para_fill(irq_disable, DisableInterrupts);
739 para_fill(irq_enable, EnableInterrupts);
740 /* irq_save_disable !!! sheer pain */
741 patch_offset(&irq_save_disable_callout[IRQ_PATCH_INT_MASK],
742 (char *)paravirt_ops.save_fl);
743 patch_offset(&irq_save_disable_callout[IRQ_PATCH_DISABLE],
744 (char *)paravirt_ops.irq_disable);
745#ifndef CONFIG_NO_IDLE_HZ
746 para_fill(safe_halt, Halt);
747#else
748 vmi_ops.halt = vmi_get_function(VMI_CALL_Halt);
749 paravirt_ops.safe_halt = vmi_safe_halt;
750#endif
751 para_fill(wbinvd, WBINVD);
752 /* paravirt_ops.read_msr = vmi_rdmsr */
753 /* paravirt_ops.write_msr = vmi_wrmsr */
754 para_fill(read_tsc, RDTSC);
755 /* paravirt_ops.rdpmc = vmi_rdpmc */
756
757 /* TR interface doesn't pass TR value */
758 reloc = call_vrom_long_func(vmi_rom, get_reloc, VMI_CALL_SetTR);
759 if (rel->type != VMI_RELOCATION_NONE) {
760 BUG_ON(rel->type != VMI_RELOCATION_CALL_REL);
761 vmi_ops.set_tr = (void *)rel->eip;
762 paravirt_ops.load_tr_desc = vmi_set_tr;
763 }
764
765 /* LDT is special, too */
766 reloc = call_vrom_long_func(vmi_rom, get_reloc, VMI_CALL_SetLDT);
767 if (rel->type != VMI_RELOCATION_NONE) {
768 BUG_ON(rel->type != VMI_RELOCATION_CALL_REL);
769 vmi_ops._set_ldt = (void *)rel->eip;
770 paravirt_ops.set_ldt = vmi_set_ldt;
771 }
772
773 para_fill(load_gdt, SetGDT);
774 para_fill(load_idt, SetIDT);
775 para_fill(store_gdt, GetGDT);
776 para_fill(store_idt, GetIDT);
777 para_fill(store_tr, GetTR);
778 paravirt_ops.load_tls = vmi_load_tls;
779 para_fill(write_ldt_entry, WriteLDTEntry);
780 para_fill(write_gdt_entry, WriteGDTEntry);
781 para_fill(write_idt_entry, WriteIDTEntry);
782 reloc = call_vrom_long_func(vmi_rom, get_reloc,
783 VMI_CALL_UpdateKernelStack);
784 if (rel->type != VMI_RELOCATION_NONE) {
785 BUG_ON(rel->type != VMI_RELOCATION_CALL_REL);
786 vmi_ops.set_kernel_stack = (void *)rel->eip;
787 paravirt_ops.load_esp0 = vmi_load_esp0;
788 }
789
790 para_fill(set_iopl_mask, SetIOPLMask);
791 paravirt_ops.io_delay = (void *)vmi_nop;
792 if (!disable_nodelay) {
793 paravirt_ops.const_udelay = (void *)vmi_nop;
794 }
795
796 para_fill(set_lazy_mode, SetLazyMode);
797
798 reloc = call_vrom_long_func(vmi_rom, get_reloc, VMI_CALL_FlushTLB);
799 if (rel->type != VMI_RELOCATION_NONE) {
800 vmi_ops.flush_tlb = (void *)rel->eip;
801 paravirt_ops.flush_tlb_user = vmi_flush_tlb_user;
802 paravirt_ops.flush_tlb_kernel = vmi_flush_tlb_kernel;
803 }
804 para_fill(flush_tlb_single, InvalPage);
805
806 /*
807 * Until a standard flag format can be agreed on, we need to
808 * implement these as wrappers in Linux. Get the VMI ROM
809 * function pointers for the two backend calls.
810 */
811#ifdef CONFIG_X86_PAE
812 vmi_ops.set_pte = vmi_get_function(VMI_CALL_SetPxELong);
813 vmi_ops.update_pte = vmi_get_function(VMI_CALL_UpdatePxELong);
814#else
815 vmi_ops.set_pte = vmi_get_function(VMI_CALL_SetPxE);
816 vmi_ops.update_pte = vmi_get_function(VMI_CALL_UpdatePxE);
817#endif
818 vmi_ops.set_linear_mapping = vmi_get_function(VMI_CALL_SetLinearMapping);
819 vmi_ops.allocate_page = vmi_get_function(VMI_CALL_AllocatePage);
820 vmi_ops.release_page = vmi_get_function(VMI_CALL_ReleasePage);
821
822 paravirt_ops.alloc_pt = vmi_allocate_pt;
823 paravirt_ops.alloc_pd = vmi_allocate_pd;
824 paravirt_ops.alloc_pd_clone = vmi_allocate_pd_clone;
825 paravirt_ops.release_pt = vmi_release_pt;
826 paravirt_ops.release_pd = vmi_release_pd;
827 paravirt_ops.set_pte = vmi_set_pte;
828 paravirt_ops.set_pte_at = vmi_set_pte_at;
829 paravirt_ops.set_pmd = vmi_set_pmd;
830 paravirt_ops.pte_update = vmi_update_pte;
831 paravirt_ops.pte_update_defer = vmi_update_pte_defer;
832#ifdef CONFIG_X86_PAE
833 paravirt_ops.set_pte_atomic = vmi_set_pte_atomic;
834 paravirt_ops.set_pte_present = vmi_set_pte_present;
835 paravirt_ops.set_pud = vmi_set_pud;
836 paravirt_ops.pte_clear = vmi_pte_clear;
837 paravirt_ops.pmd_clear = vmi_pmd_clear;
838#endif
839 /*
840 * These MUST always be patched. Don't support indirect jumps
841 * through these operations, as the VMI interface may use either
842 * a jump or a call to get to these operations, depending on
843 * the backend. They are performance critical anyway, so requiring
844 * a patch is not a big problem.
845 */
846 paravirt_ops.irq_enable_sysexit = (void *)0xfeedbab0;
847 paravirt_ops.iret = (void *)0xbadbab0;
848
849#ifdef CONFIG_SMP
850 paravirt_ops.startup_ipi_hook = vmi_startup_ipi_hook;
851 vmi_ops.set_initial_ap_state = vmi_get_function(VMI_CALL_SetInitialAPState);
852#endif
853
854#ifdef CONFIG_X86_LOCAL_APIC
855 paravirt_ops.apic_read = vmi_get_function(VMI_CALL_APICRead);
856 paravirt_ops.apic_write = vmi_get_function(VMI_CALL_APICWrite);
857 paravirt_ops.apic_write_atomic = vmi_get_function(VMI_CALL_APICWrite);
858#endif
859
860 /*
861 * Check for VMI timer functionality by probing for a cycle frequency method
862 */
863 reloc = call_vrom_long_func(vmi_rom, get_reloc, VMI_CALL_GetCycleFrequency);
864 if (rel->type != VMI_RELOCATION_NONE) {
865 vmi_timer_ops.get_cycle_frequency = (void *)rel->eip;
866 vmi_timer_ops.get_cycle_counter =
867 vmi_get_function(VMI_CALL_GetCycleCounter);
868 vmi_timer_ops.get_wallclock =
869 vmi_get_function(VMI_CALL_GetWallclockTime);
870 vmi_timer_ops.wallclock_updated =
871 vmi_get_function(VMI_CALL_WallclockUpdated);
872 vmi_timer_ops.set_alarm = vmi_get_function(VMI_CALL_SetAlarm);
873 vmi_timer_ops.cancel_alarm =
874 vmi_get_function(VMI_CALL_CancelAlarm);
875 paravirt_ops.time_init = vmi_time_init;
876 paravirt_ops.get_wallclock = vmi_get_wallclock;
877 paravirt_ops.set_wallclock = vmi_set_wallclock;
878#ifdef CONFIG_X86_LOCAL_APIC
879 paravirt_ops.setup_boot_clock = vmi_timer_setup_boot_alarm;
880 paravirt_ops.setup_secondary_clock = vmi_timer_setup_secondary_alarm;
881#endif
882 custom_sched_clock = vmi_sched_clock;
883 }
884
885 /*
886 * Alternative instruction rewriting doesn't happen soon enough
887 * to convert VMI_IRET to a call instead of a jump; so we have
888 * to do this before IRQs get reenabled. Fortunately, it is
889 * idempotent.
890 */
891 apply_paravirt(__start_parainstructions, __stop_parainstructions);
892
893 vmi_bringup();
894
895 return 1;
896}
897
898#undef para_fill
899
900void __init vmi_init(void)
901{
902 unsigned long flags;
903
904 if (!vmi_rom)
905 probe_vmi_rom();
906 else
907 check_vmi_rom(vmi_rom);
908
909 /* In case probing for or validating the ROM failed, basil */
910 if (!vmi_rom)
911 return;
912
913 reserve_top_address(-vmi_rom->virtual_top);
914
915 local_irq_save(flags);
916 activate_vmi();
917#ifdef CONFIG_SMP
918 no_timer_check = 1;
919#endif
920 local_irq_restore(flags & X86_EFLAGS_IF);
921}
922
923static int __init parse_vmi(char *arg)
924{
925 if (!arg)
926 return -EINVAL;
927
928 if (!strcmp(arg, "disable_nodelay"))
929 disable_nodelay = 1;
930 else if (!strcmp(arg, "disable_pge")) {
931 clear_bit(X86_FEATURE_PGE, boot_cpu_data.x86_capability);
932 disable_pge = 1;
933 } else if (!strcmp(arg, "disable_pse")) {
934 clear_bit(X86_FEATURE_PSE, boot_cpu_data.x86_capability);
935 disable_pse = 1;
936 } else if (!strcmp(arg, "disable_sep")) {
937 clear_bit(X86_FEATURE_SEP, boot_cpu_data.x86_capability);
938 disable_sep = 1;
939 } else if (!strcmp(arg, "disable_tsc")) {
940 clear_bit(X86_FEATURE_TSC, boot_cpu_data.x86_capability);
941 disable_tsc = 1;
942 } else if (!strcmp(arg, "disable_mtrr")) {
943 clear_bit(X86_FEATURE_MTRR, boot_cpu_data.x86_capability);
944 disable_mtrr = 1;
945 }
946 return 0;
947}
948
949early_param("vmi", parse_vmi);
diff --git a/arch/i386/kernel/vmitime.c b/arch/i386/kernel/vmitime.c
new file mode 100644
index 000000000000..2e2d8dbcbd68
--- /dev/null
+++ b/arch/i386/kernel/vmitime.c
@@ -0,0 +1,499 @@
1/*
2 * VMI paravirtual timer support routines.
3 *
4 * Copyright (C) 2005, VMware, Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
14 * NON INFRINGEMENT. See the GNU General Public License for more
15 * details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 *
21 * Send feedback to dhecht@vmware.com
22 *
23 */
24
25/*
26 * Portions of this code from arch/i386/kernel/timers/timer_tsc.c.
27 * Portions of the CONFIG_NO_IDLE_HZ code from arch/s390/kernel/time.c.
28 * See comments there for proper credits.
29 */
30
31#include <linux/spinlock.h>
32#include <linux/init.h>
33#include <linux/errno.h>
34#include <linux/jiffies.h>
35#include <linux/interrupt.h>
36#include <linux/kernel_stat.h>
37#include <linux/rcupdate.h>
38#include <linux/clocksource.h>
39
40#include <asm/timer.h>
41#include <asm/io.h>
42#include <asm/apic.h>
43#include <asm/div64.h>
44#include <asm/timer.h>
45#include <asm/desc.h>
46
47#include <asm/vmi.h>
48#include <asm/vmi_time.h>
49
50#include <mach_timer.h>
51#include <io_ports.h>
52
53#ifdef CONFIG_X86_LOCAL_APIC
54#define VMI_ALARM_WIRING VMI_ALARM_WIRED_LVTT
55#else
56#define VMI_ALARM_WIRING VMI_ALARM_WIRED_IRQ0
57#endif
58
59/* Cached VMI operations */
60struct vmi_timer_ops vmi_timer_ops;
61
62#ifdef CONFIG_NO_IDLE_HZ
63
64/* /proc/sys/kernel/hz_timer state. */
65int sysctl_hz_timer;
66
67/* Some stats */
68static DEFINE_PER_CPU(unsigned long, vmi_idle_no_hz_irqs);
69static DEFINE_PER_CPU(unsigned long, vmi_idle_no_hz_jiffies);
70static DEFINE_PER_CPU(unsigned long, idle_start_jiffies);
71
72#endif /* CONFIG_NO_IDLE_HZ */
73
74/* Number of alarms per second. By default this is CONFIG_VMI_ALARM_HZ. */
75static int alarm_hz = CONFIG_VMI_ALARM_HZ;
76
77/* Cache of the value get_cycle_frequency / HZ. */
78static signed long long cycles_per_jiffy;
79
80/* Cache of the value get_cycle_frequency / alarm_hz. */
81static signed long long cycles_per_alarm;
82
83/* The number of cycles accounted for by the 'jiffies'/'xtime' count.
84 * Protected by xtime_lock. */
85static unsigned long long real_cycles_accounted_system;
86
87/* The number of cycles accounted for by update_process_times(), per cpu. */
88static DEFINE_PER_CPU(unsigned long long, process_times_cycles_accounted_cpu);
89
90/* The number of stolen cycles accounted, per cpu. */
91static DEFINE_PER_CPU(unsigned long long, stolen_cycles_accounted_cpu);
92
93/* Clock source. */
94static cycle_t read_real_cycles(void)
95{
96 return vmi_timer_ops.get_cycle_counter(VMI_CYCLES_REAL);
97}
98
99static cycle_t read_available_cycles(void)
100{
101 return vmi_timer_ops.get_cycle_counter(VMI_CYCLES_AVAILABLE);
102}
103
104#if 0
105static cycle_t read_stolen_cycles(void)
106{
107 return vmi_timer_ops.get_cycle_counter(VMI_CYCLES_STOLEN);
108}
109#endif /* 0 */
110
111static struct clocksource clocksource_vmi = {
112 .name = "vmi-timer",
113 .rating = 450,
114 .read = read_real_cycles,
115 .mask = CLOCKSOURCE_MASK(64),
116 .mult = 0, /* to be set */
117 .shift = 22,
118 .is_continuous = 1,
119};
120
121
122/* Timer interrupt handler. */
123static irqreturn_t vmi_timer_interrupt(int irq, void *dev_id);
124
125static struct irqaction vmi_timer_irq = {
126 vmi_timer_interrupt,
127 SA_INTERRUPT,
128 CPU_MASK_NONE,
129 "VMI-alarm",
130 NULL,
131 NULL
132};
133
134/* Alarm rate */
135static int __init vmi_timer_alarm_rate_setup(char* str)
136{
137 int alarm_rate;
138 if (get_option(&str, &alarm_rate) == 1 && alarm_rate > 0) {
139 alarm_hz = alarm_rate;
140 printk(KERN_WARNING "VMI timer alarm HZ set to %d\n", alarm_hz);
141 }
142 return 1;
143}
144__setup("vmi_timer_alarm_hz=", vmi_timer_alarm_rate_setup);
145
146
147/* Initialization */
148static void vmi_get_wallclock_ts(struct timespec *ts)
149{
150 unsigned long long wallclock;
151 wallclock = vmi_timer_ops.get_wallclock(); // nsec units
152 ts->tv_nsec = do_div(wallclock, 1000000000);
153 ts->tv_sec = wallclock;
154}
155
156static void update_xtime_from_wallclock(void)
157{
158 struct timespec ts;
159 vmi_get_wallclock_ts(&ts);
160 do_settimeofday(&ts);
161}
162
163unsigned long vmi_get_wallclock(void)
164{
165 struct timespec ts;
166 vmi_get_wallclock_ts(&ts);
167 return ts.tv_sec;
168}
169
170int vmi_set_wallclock(unsigned long now)
171{
172 return -1;
173}
174
175unsigned long long vmi_sched_clock(void)
176{
177 return read_available_cycles();
178}
179
180void __init vmi_time_init(void)
181{
182 unsigned long long cycles_per_sec, cycles_per_msec;
183 unsigned long flags;
184
185 local_irq_save(flags);
186 setup_irq(0, &vmi_timer_irq);
187#ifdef CONFIG_X86_LOCAL_APIC
188 set_intr_gate(LOCAL_TIMER_VECTOR, apic_vmi_timer_interrupt);
189#endif
190
191 no_sync_cmos_clock = 1;
192
193 vmi_get_wallclock_ts(&xtime);
194 set_normalized_timespec(&wall_to_monotonic,
195 -xtime.tv_sec, -xtime.tv_nsec);
196
197 real_cycles_accounted_system = read_real_cycles();
198 update_xtime_from_wallclock();
199 per_cpu(process_times_cycles_accounted_cpu, 0) = read_available_cycles();
200
201 cycles_per_sec = vmi_timer_ops.get_cycle_frequency();
202
203 cycles_per_jiffy = cycles_per_sec;
204 (void)do_div(cycles_per_jiffy, HZ);
205 cycles_per_alarm = cycles_per_sec;
206 (void)do_div(cycles_per_alarm, alarm_hz);
207 cycles_per_msec = cycles_per_sec;
208 (void)do_div(cycles_per_msec, 1000);
209 cpu_khz = cycles_per_msec;
210
211 printk(KERN_WARNING "VMI timer cycles/sec = %llu ; cycles/jiffy = %llu ;"
212 "cycles/alarm = %llu\n", cycles_per_sec, cycles_per_jiffy,
213 cycles_per_alarm);
214
215 clocksource_vmi.mult = clocksource_khz2mult(cycles_per_msec,
216 clocksource_vmi.shift);
217 if (clocksource_register(&clocksource_vmi))
218 printk(KERN_WARNING "Error registering VMITIME clocksource.");
219
220 /* Disable PIT. */
221 outb_p(0x3a, PIT_MODE); /* binary, mode 5, LSB/MSB, ch 0 */
222
223 /* schedule the alarm. do this in phase with process_times_cycles_accounted_cpu
224 * reduce the latency calling update_process_times. */
225 vmi_timer_ops.set_alarm(
226 VMI_ALARM_WIRED_IRQ0 | VMI_ALARM_IS_PERIODIC | VMI_CYCLES_AVAILABLE,
227 per_cpu(process_times_cycles_accounted_cpu, 0) + cycles_per_alarm,
228 cycles_per_alarm);
229
230 local_irq_restore(flags);
231}
232
233#ifdef CONFIG_X86_LOCAL_APIC
234
235void __init vmi_timer_setup_boot_alarm(void)
236{
237 local_irq_disable();
238
239 /* Route the interrupt to the correct vector. */
240 apic_write_around(APIC_LVTT, LOCAL_TIMER_VECTOR);
241
242 /* Cancel the IRQ0 wired alarm, and setup the LVTT alarm. */
243 vmi_timer_ops.cancel_alarm(VMI_CYCLES_AVAILABLE);
244 vmi_timer_ops.set_alarm(
245 VMI_ALARM_WIRED_LVTT | VMI_ALARM_IS_PERIODIC | VMI_CYCLES_AVAILABLE,
246 per_cpu(process_times_cycles_accounted_cpu, 0) + cycles_per_alarm,
247 cycles_per_alarm);
248 local_irq_enable();
249}
250
251/* Initialize the time accounting variables for an AP on an SMP system.
252 * Also, set the local alarm for the AP. */
253void __init vmi_timer_setup_secondary_alarm(void)
254{
255 int cpu = smp_processor_id();
256
257 /* Route the interrupt to the correct vector. */
258 apic_write_around(APIC_LVTT, LOCAL_TIMER_VECTOR);
259
260 per_cpu(process_times_cycles_accounted_cpu, cpu) = read_available_cycles();
261
262 vmi_timer_ops.set_alarm(
263 VMI_ALARM_WIRED_LVTT | VMI_ALARM_IS_PERIODIC | VMI_CYCLES_AVAILABLE,
264 per_cpu(process_times_cycles_accounted_cpu, cpu) + cycles_per_alarm,
265 cycles_per_alarm);
266}
267
268#endif
269
270/* Update system wide (real) time accounting (e.g. jiffies, xtime). */
271static void vmi_account_real_cycles(unsigned long long cur_real_cycles)
272{
273 long long cycles_not_accounted;
274
275 write_seqlock(&xtime_lock);
276
277 cycles_not_accounted = cur_real_cycles - real_cycles_accounted_system;
278 while (cycles_not_accounted >= cycles_per_jiffy) {
279 /* systems wide jiffies and wallclock. */
280 do_timer(1);
281
282 cycles_not_accounted -= cycles_per_jiffy;
283 real_cycles_accounted_system += cycles_per_jiffy;
284 }
285
286 if (vmi_timer_ops.wallclock_updated())
287 update_xtime_from_wallclock();
288
289 write_sequnlock(&xtime_lock);
290}
291
292/* Update per-cpu process times. */
293static void vmi_account_process_times_cycles(struct pt_regs *regs, int cpu,
294 unsigned long long cur_process_times_cycles)
295{
296 long long cycles_not_accounted;
297 cycles_not_accounted = cur_process_times_cycles -
298 per_cpu(process_times_cycles_accounted_cpu, cpu);
299
300 while (cycles_not_accounted >= cycles_per_jiffy) {
301 /* Account time to the current process. This includes
302 * calling into the scheduler to decrement the timeslice
303 * and possibly reschedule.*/
304 update_process_times(user_mode(regs));
305 /* XXX handle /proc/profile multiplier. */
306 profile_tick(CPU_PROFILING);
307
308 cycles_not_accounted -= cycles_per_jiffy;
309 per_cpu(process_times_cycles_accounted_cpu, cpu) += cycles_per_jiffy;
310 }
311}
312
313#ifdef CONFIG_NO_IDLE_HZ
314/* Update per-cpu idle times. Used when a no-hz halt is ended. */
315static void vmi_account_no_hz_idle_cycles(int cpu,
316 unsigned long long cur_process_times_cycles)
317{
318 long long cycles_not_accounted;
319 unsigned long no_idle_hz_jiffies = 0;
320
321 cycles_not_accounted = cur_process_times_cycles -
322 per_cpu(process_times_cycles_accounted_cpu, cpu);
323
324 while (cycles_not_accounted >= cycles_per_jiffy) {
325 no_idle_hz_jiffies++;
326 cycles_not_accounted -= cycles_per_jiffy;
327 per_cpu(process_times_cycles_accounted_cpu, cpu) += cycles_per_jiffy;
328 }
329 /* Account time to the idle process. */
330 account_steal_time(idle_task(cpu), jiffies_to_cputime(no_idle_hz_jiffies));
331}
332#endif
333
334/* Update per-cpu stolen time. */
335static void vmi_account_stolen_cycles(int cpu,
336 unsigned long long cur_real_cycles,
337 unsigned long long cur_avail_cycles)
338{
339 long long stolen_cycles_not_accounted;
340 unsigned long stolen_jiffies = 0;
341
342 if (cur_real_cycles < cur_avail_cycles)
343 return;
344
345 stolen_cycles_not_accounted = cur_real_cycles - cur_avail_cycles -
346 per_cpu(stolen_cycles_accounted_cpu, cpu);
347
348 while (stolen_cycles_not_accounted >= cycles_per_jiffy) {
349 stolen_jiffies++;
350 stolen_cycles_not_accounted -= cycles_per_jiffy;
351 per_cpu(stolen_cycles_accounted_cpu, cpu) += cycles_per_jiffy;
352 }
353 /* HACK: pass NULL to force time onto cpustat->steal. */
354 account_steal_time(NULL, jiffies_to_cputime(stolen_jiffies));
355}
356
357/* Body of either IRQ0 interrupt handler (UP no local-APIC) or
358 * local-APIC LVTT interrupt handler (UP & local-APIC or SMP). */
359static void vmi_local_timer_interrupt(int cpu)
360{
361 unsigned long long cur_real_cycles, cur_process_times_cycles;
362
363 cur_real_cycles = read_real_cycles();
364 cur_process_times_cycles = read_available_cycles();
365 /* Update system wide (real) time state (xtime, jiffies). */
366 vmi_account_real_cycles(cur_real_cycles);
367 /* Update per-cpu process times. */
368 vmi_account_process_times_cycles(get_irq_regs(), cpu, cur_process_times_cycles);
369 /* Update time stolen from this cpu by the hypervisor. */
370 vmi_account_stolen_cycles(cpu, cur_real_cycles, cur_process_times_cycles);
371}
372
373#ifdef CONFIG_NO_IDLE_HZ
374
375/* Must be called only from idle loop, with interrupts disabled. */
376int vmi_stop_hz_timer(void)
377{
378 /* Note that cpu_set, cpu_clear are (SMP safe) atomic on x86. */
379
380 unsigned long seq, next;
381 unsigned long long real_cycles_expiry;
382 int cpu = smp_processor_id();
383 int idle;
384
385 BUG_ON(!irqs_disabled());
386 if (sysctl_hz_timer != 0)
387 return 0;
388
389 cpu_set(cpu, nohz_cpu_mask);
390 smp_mb();
391 if (rcu_needs_cpu(cpu) || local_softirq_pending() ||
392 (next = next_timer_interrupt(), time_before_eq(next, jiffies))) {
393 cpu_clear(cpu, nohz_cpu_mask);
394 next = jiffies;
395 idle = 0;
396 } else
397 idle = 1;
398
399 /* Convert jiffies to the real cycle counter. */
400 do {
401 seq = read_seqbegin(&xtime_lock);
402 real_cycles_expiry = real_cycles_accounted_system +
403 (long)(next - jiffies) * cycles_per_jiffy;
404 } while (read_seqretry(&xtime_lock, seq));
405
406 /* This cpu is going idle. Disable the periodic alarm. */
407 if (idle) {
408 vmi_timer_ops.cancel_alarm(VMI_CYCLES_AVAILABLE);
409 per_cpu(idle_start_jiffies, cpu) = jiffies;
410 }
411
412 /* Set the real time alarm to expire at the next event. */
413 vmi_timer_ops.set_alarm(
414 VMI_ALARM_WIRING | VMI_ALARM_IS_ONESHOT | VMI_CYCLES_REAL,
415 real_cycles_expiry, 0);
416
417 return idle;
418}
419
420static void vmi_reenable_hz_timer(int cpu)
421{
422 /* For /proc/vmi/info idle_hz stat. */
423 per_cpu(vmi_idle_no_hz_jiffies, cpu) += jiffies - per_cpu(idle_start_jiffies, cpu);
424 per_cpu(vmi_idle_no_hz_irqs, cpu)++;
425
426 /* Don't bother explicitly cancelling the one-shot alarm -- at
427 * worse we will receive a spurious timer interrupt. */
428 vmi_timer_ops.set_alarm(
429 VMI_ALARM_WIRING | VMI_ALARM_IS_PERIODIC | VMI_CYCLES_AVAILABLE,
430 per_cpu(process_times_cycles_accounted_cpu, cpu) + cycles_per_alarm,
431 cycles_per_alarm);
432 /* Indicate this cpu is no longer nohz idle. */
433 cpu_clear(cpu, nohz_cpu_mask);
434}
435
436/* Called from interrupt handlers when (local) HZ timer is disabled. */
437void vmi_account_time_restart_hz_timer(void)
438{
439 unsigned long long cur_real_cycles, cur_process_times_cycles;
440 int cpu = smp_processor_id();
441
442 BUG_ON(!irqs_disabled());
443 /* Account the time during which the HZ timer was disabled. */
444 cur_real_cycles = read_real_cycles();
445 cur_process_times_cycles = read_available_cycles();
446 /* Update system wide (real) time state (xtime, jiffies). */
447 vmi_account_real_cycles(cur_real_cycles);
448 /* Update per-cpu idle times. */
449 vmi_account_no_hz_idle_cycles(cpu, cur_process_times_cycles);
450 /* Update time stolen from this cpu by the hypervisor. */
451 vmi_account_stolen_cycles(cpu, cur_real_cycles, cur_process_times_cycles);
452 /* Reenable the hz timer. */
453 vmi_reenable_hz_timer(cpu);
454}
455
456#endif /* CONFIG_NO_IDLE_HZ */
457
458/* UP (and no local-APIC) VMI-timer alarm interrupt handler.
459 * Handler for IRQ0. Not used when SMP or X86_LOCAL_APIC after
460 * APIC setup and setup_boot_vmi_alarm() is called. */
461static irqreturn_t vmi_timer_interrupt(int irq, void *dev_id)
462{
463 vmi_local_timer_interrupt(smp_processor_id());
464 return IRQ_HANDLED;
465}
466
467#ifdef CONFIG_X86_LOCAL_APIC
468
469/* SMP VMI-timer alarm interrupt handler. Handler for LVTT vector.
470 * Also used in UP when CONFIG_X86_LOCAL_APIC.
471 * The wrapper code is from arch/i386/kernel/apic.c#smp_apic_timer_interrupt. */
472void smp_apic_vmi_timer_interrupt(struct pt_regs *regs)
473{
474 struct pt_regs *old_regs = set_irq_regs(regs);
475 int cpu = smp_processor_id();
476
477 /*
478 * the NMI deadlock-detector uses this.
479 */
480 per_cpu(irq_stat,cpu).apic_timer_irqs++;
481
482 /*
483 * NOTE! We'd better ACK the irq immediately,
484 * because timer handling can be slow.
485 */
486 ack_APIC_irq();
487
488 /*
489 * update_process_times() expects us to have done irq_enter().
490 * Besides, if we don't timer interrupts ignore the global
491 * interrupt lock, which is the WrongThing (tm) to do.
492 */
493 irq_enter();
494 vmi_local_timer_interrupt(cpu);
495 irq_exit();
496 set_irq_regs(old_regs);
497}
498
499#endif /* CONFIG_X86_LOCAL_APIC */
diff --git a/arch/i386/kernel/vmlinux.lds.S b/arch/i386/kernel/vmlinux.lds.S
index 5038a73d554e..ca51610955df 100644
--- a/arch/i386/kernel/vmlinux.lds.S
+++ b/arch/i386/kernel/vmlinux.lds.S
@@ -37,9 +37,14 @@ SECTIONS
37{ 37{
38 . = LOAD_OFFSET + LOAD_PHYSICAL_ADDR; 38 . = LOAD_OFFSET + LOAD_PHYSICAL_ADDR;
39 phys_startup_32 = startup_32 - LOAD_OFFSET; 39 phys_startup_32 = startup_32 - LOAD_OFFSET;
40
41 .text.head : AT(ADDR(.text.head) - LOAD_OFFSET) {
42 _text = .; /* Text and read-only data */
43 *(.text.head)
44 } :text = 0x9090
45
40 /* read-only */ 46 /* read-only */
41 .text : AT(ADDR(.text) - LOAD_OFFSET) { 47 .text : AT(ADDR(.text) - LOAD_OFFSET) {
42 _text = .; /* Text and read-only data */
43 *(.text) 48 *(.text)
44 SCHED_TEXT 49 SCHED_TEXT
45 LOCK_TEXT 50 LOCK_TEXT
diff --git a/arch/i386/math-emu/get_address.c b/arch/i386/math-emu/get_address.c
index 9819b705efa4..2e2c51a8bd3a 100644
--- a/arch/i386/math-emu/get_address.c
+++ b/arch/i386/math-emu/get_address.c
@@ -56,15 +56,14 @@ static int reg_offset_vm86[] = {
56#define VM86_REG_(x) (*(unsigned short *) \ 56#define VM86_REG_(x) (*(unsigned short *) \
57 (reg_offset_vm86[((unsigned)x)]+(u_char *) FPU_info)) 57 (reg_offset_vm86[((unsigned)x)]+(u_char *) FPU_info))
58 58
59/* These are dummy, fs and gs are not saved on the stack. */ 59/* This dummy, gs is not saved on the stack. */
60#define ___FS ___ds
61#define ___GS ___ds 60#define ___GS ___ds
62 61
63static int reg_offset_pm[] = { 62static int reg_offset_pm[] = {
64 offsetof(struct info,___cs), 63 offsetof(struct info,___cs),
65 offsetof(struct info,___ds), 64 offsetof(struct info,___ds),
66 offsetof(struct info,___es), 65 offsetof(struct info,___es),
67 offsetof(struct info,___FS), 66 offsetof(struct info,___fs),
68 offsetof(struct info,___GS), 67 offsetof(struct info,___GS),
69 offsetof(struct info,___ss), 68 offsetof(struct info,___ss),
70 offsetof(struct info,___ds) 69 offsetof(struct info,___ds)
@@ -169,13 +168,10 @@ static long pm_address(u_char FPU_modrm, u_char segment,
169 168
170 switch ( segment ) 169 switch ( segment )
171 { 170 {
172 /* fs and gs aren't used by the kernel, so they still have their 171 /* gs isn't used by the kernel, so it still has its
173 user-space values. */ 172 user-space value. */
174 case PREFIX_FS_-1:
175 /* N.B. - movl %seg, mem is a 2 byte write regardless of prefix */
176 savesegment(fs, addr->selector);
177 break;
178 case PREFIX_GS_-1: 173 case PREFIX_GS_-1:
174 /* N.B. - movl %seg, mem is a 2 byte write regardless of prefix */
179 savesegment(gs, addr->selector); 175 savesegment(gs, addr->selector);
180 break; 176 break;
181 default: 177 default:
diff --git a/arch/i386/math-emu/status_w.h b/arch/i386/math-emu/status_w.h
index 78d7b7689dd6..59e73302aa60 100644
--- a/arch/i386/math-emu/status_w.h
+++ b/arch/i386/math-emu/status_w.h
@@ -48,9 +48,11 @@
48 48
49#define status_word() \ 49#define status_word() \
50 ((partial_status & ~SW_Top & 0xffff) | ((top << SW_Top_Shift) & SW_Top)) 50 ((partial_status & ~SW_Top & 0xffff) | ((top << SW_Top_Shift) & SW_Top))
51#define setcc(cc) ({ \ 51static inline void setcc(int cc)
52 partial_status &= ~(SW_C0|SW_C1|SW_C2|SW_C3); \ 52{
53 partial_status |= (cc) & (SW_C0|SW_C1|SW_C2|SW_C3); }) 53 partial_status &= ~(SW_C0|SW_C1|SW_C2|SW_C3);
54 partial_status |= (cc) & (SW_C0|SW_C1|SW_C2|SW_C3);
55}
54 56
55#ifdef PECULIAR_486 57#ifdef PECULIAR_486
56 /* Default, this conveys no information, but an 80486 does it. */ 58 /* Default, this conveys no information, but an 80486 does it. */
diff --git a/arch/i386/mm/discontig.c b/arch/i386/mm/discontig.c
index e0c390d6ceb5..aa58720f6871 100644
--- a/arch/i386/mm/discontig.c
+++ b/arch/i386/mm/discontig.c
@@ -101,7 +101,6 @@ extern void find_max_pfn(void);
101extern void add_one_highpage_init(struct page *, int, int); 101extern void add_one_highpage_init(struct page *, int, int);
102 102
103extern struct e820map e820; 103extern struct e820map e820;
104extern unsigned long init_pg_tables_end;
105extern unsigned long highend_pfn, highstart_pfn; 104extern unsigned long highend_pfn, highstart_pfn;
106extern unsigned long max_low_pfn; 105extern unsigned long max_low_pfn;
107extern unsigned long totalram_pages; 106extern unsigned long totalram_pages;
diff --git a/arch/i386/mm/fault.c b/arch/i386/mm/fault.c
index cba9b3894a33..b8c4e259fc8b 100644
--- a/arch/i386/mm/fault.c
+++ b/arch/i386/mm/fault.c
@@ -46,17 +46,17 @@ int unregister_page_fault_notifier(struct notifier_block *nb)
46} 46}
47EXPORT_SYMBOL_GPL(unregister_page_fault_notifier); 47EXPORT_SYMBOL_GPL(unregister_page_fault_notifier);
48 48
49static inline int notify_page_fault(enum die_val val, const char *str, 49static inline int notify_page_fault(struct pt_regs *regs, long err)
50 struct pt_regs *regs, long err, int trap, int sig)
51{ 50{
52 struct die_args args = { 51 struct die_args args = {
53 .regs = regs, 52 .regs = regs,
54 .str = str, 53 .str = "page fault",
55 .err = err, 54 .err = err,
56 .trapnr = trap, 55 .trapnr = 14,
57 .signr = sig 56 .signr = SIGSEGV
58 }; 57 };
59 return atomic_notifier_call_chain(&notify_page_fault_chain, val, &args); 58 return atomic_notifier_call_chain(&notify_page_fault_chain,
59 DIE_PAGE_FAULT, &args);
60} 60}
61 61
62/* 62/*
@@ -327,8 +327,7 @@ fastcall void __kprobes do_page_fault(struct pt_regs *regs,
327 if (unlikely(address >= TASK_SIZE)) { 327 if (unlikely(address >= TASK_SIZE)) {
328 if (!(error_code & 0x0000000d) && vmalloc_fault(address) >= 0) 328 if (!(error_code & 0x0000000d) && vmalloc_fault(address) >= 0)
329 return; 329 return;
330 if (notify_page_fault(DIE_PAGE_FAULT, "page fault", regs, error_code, 14, 330 if (notify_page_fault(regs, error_code) == NOTIFY_STOP)
331 SIGSEGV) == NOTIFY_STOP)
332 return; 331 return;
333 /* 332 /*
334 * Don't take the mm semaphore here. If we fixup a prefetch 333 * Don't take the mm semaphore here. If we fixup a prefetch
@@ -337,8 +336,7 @@ fastcall void __kprobes do_page_fault(struct pt_regs *regs,
337 goto bad_area_nosemaphore; 336 goto bad_area_nosemaphore;
338 } 337 }
339 338
340 if (notify_page_fault(DIE_PAGE_FAULT, "page fault", regs, error_code, 14, 339 if (notify_page_fault(regs, error_code) == NOTIFY_STOP)
341 SIGSEGV) == NOTIFY_STOP)
342 return; 340 return;
343 341
344 /* It's safe to allow irq's after cr2 has been saved and the vmalloc 342 /* It's safe to allow irq's after cr2 has been saved and the vmalloc
diff --git a/arch/i386/mm/init.c b/arch/i386/mm/init.c
index c5c5ea700cc7..ae436882af7a 100644
--- a/arch/i386/mm/init.c
+++ b/arch/i386/mm/init.c
@@ -62,6 +62,7 @@ static pmd_t * __init one_md_table_init(pgd_t *pgd)
62 62
63#ifdef CONFIG_X86_PAE 63#ifdef CONFIG_X86_PAE
64 pmd_table = (pmd_t *) alloc_bootmem_low_pages(PAGE_SIZE); 64 pmd_table = (pmd_t *) alloc_bootmem_low_pages(PAGE_SIZE);
65 paravirt_alloc_pd(__pa(pmd_table) >> PAGE_SHIFT);
65 set_pgd(pgd, __pgd(__pa(pmd_table) | _PAGE_PRESENT)); 66 set_pgd(pgd, __pgd(__pa(pmd_table) | _PAGE_PRESENT));
66 pud = pud_offset(pgd, 0); 67 pud = pud_offset(pgd, 0);
67 if (pmd_table != pmd_offset(pud, 0)) 68 if (pmd_table != pmd_offset(pud, 0))
@@ -82,6 +83,7 @@ static pte_t * __init one_page_table_init(pmd_t *pmd)
82{ 83{
83 if (pmd_none(*pmd)) { 84 if (pmd_none(*pmd)) {
84 pte_t *page_table = (pte_t *) alloc_bootmem_low_pages(PAGE_SIZE); 85 pte_t *page_table = (pte_t *) alloc_bootmem_low_pages(PAGE_SIZE);
86 paravirt_alloc_pt(__pa(page_table) >> PAGE_SHIFT);
85 set_pmd(pmd, __pmd(__pa(page_table) | _PAGE_TABLE)); 87 set_pmd(pmd, __pmd(__pa(page_table) | _PAGE_TABLE));
86 if (page_table != pte_offset_kernel(pmd, 0)) 88 if (page_table != pte_offset_kernel(pmd, 0))
87 BUG(); 89 BUG();
@@ -345,6 +347,8 @@ static void __init pagetable_init (void)
345 /* Init entries of the first-level page table to the zero page */ 347 /* Init entries of the first-level page table to the zero page */
346 for (i = 0; i < PTRS_PER_PGD; i++) 348 for (i = 0; i < PTRS_PER_PGD; i++)
347 set_pgd(pgd_base + i, __pgd(__pa(empty_zero_page) | _PAGE_PRESENT)); 349 set_pgd(pgd_base + i, __pgd(__pa(empty_zero_page) | _PAGE_PRESENT));
350#else
351 paravirt_alloc_pd(__pa(swapper_pg_dir) >> PAGE_SHIFT);
348#endif 352#endif
349 353
350 /* Enable PSE if available */ 354 /* Enable PSE if available */
diff --git a/arch/i386/mm/pageattr.c b/arch/i386/mm/pageattr.c
index e223b1d4981c..412ebbd8adb0 100644
--- a/arch/i386/mm/pageattr.c
+++ b/arch/i386/mm/pageattr.c
@@ -60,6 +60,7 @@ static struct page *split_large_page(unsigned long address, pgprot_t prot,
60 address = __pa(address); 60 address = __pa(address);
61 addr = address & LARGE_PAGE_MASK; 61 addr = address & LARGE_PAGE_MASK;
62 pbase = (pte_t *)page_address(base); 62 pbase = (pte_t *)page_address(base);
63 paravirt_alloc_pt(page_to_pfn(base));
63 for (i = 0; i < PTRS_PER_PTE; i++, addr += PAGE_SIZE) { 64 for (i = 0; i < PTRS_PER_PTE; i++, addr += PAGE_SIZE) {
64 set_pte(&pbase[i], pfn_pte(addr >> PAGE_SHIFT, 65 set_pte(&pbase[i], pfn_pte(addr >> PAGE_SHIFT,
65 addr == address ? prot : ref_prot)); 66 addr == address ? prot : ref_prot));
@@ -172,6 +173,7 @@ __change_page_attr(struct page *page, pgprot_t prot)
172 if (!PageReserved(kpte_page)) { 173 if (!PageReserved(kpte_page)) {
173 if (cpu_has_pse && (page_private(kpte_page) == 0)) { 174 if (cpu_has_pse && (page_private(kpte_page) == 0)) {
174 ClearPagePrivate(kpte_page); 175 ClearPagePrivate(kpte_page);
176 paravirt_release_pt(page_to_pfn(kpte_page));
175 list_add(&kpte_page->lru, &df_list); 177 list_add(&kpte_page->lru, &df_list);
176 revert_page(kpte_page, address); 178 revert_page(kpte_page, address);
177 } 179 }
diff --git a/arch/i386/mm/pgtable.c b/arch/i386/mm/pgtable.c
index f349eaf450b0..fa0cfbd551e1 100644
--- a/arch/i386/mm/pgtable.c
+++ b/arch/i386/mm/pgtable.c
@@ -171,6 +171,8 @@ void __set_fixmap (enum fixed_addresses idx, unsigned long phys, pgprot_t flags)
171void reserve_top_address(unsigned long reserve) 171void reserve_top_address(unsigned long reserve)
172{ 172{
173 BUG_ON(fixmaps > 0); 173 BUG_ON(fixmaps > 0);
174 printk(KERN_INFO "Reserving virtual address space above 0x%08x\n",
175 (int)-reserve);
174#ifdef CONFIG_COMPAT_VDSO 176#ifdef CONFIG_COMPAT_VDSO
175 BUG_ON(reserve != 0); 177 BUG_ON(reserve != 0);
176#else 178#else
@@ -248,9 +250,15 @@ void pgd_ctor(void *pgd, struct kmem_cache *cache, unsigned long unused)
248 clone_pgd_range((pgd_t *)pgd + USER_PTRS_PER_PGD, 250 clone_pgd_range((pgd_t *)pgd + USER_PTRS_PER_PGD,
249 swapper_pg_dir + USER_PTRS_PER_PGD, 251 swapper_pg_dir + USER_PTRS_PER_PGD,
250 KERNEL_PGD_PTRS); 252 KERNEL_PGD_PTRS);
253
251 if (PTRS_PER_PMD > 1) 254 if (PTRS_PER_PMD > 1)
252 return; 255 return;
253 256
257 /* must happen under lock */
258 paravirt_alloc_pd_clone(__pa(pgd) >> PAGE_SHIFT,
259 __pa(swapper_pg_dir) >> PAGE_SHIFT,
260 USER_PTRS_PER_PGD, PTRS_PER_PGD - USER_PTRS_PER_PGD);
261
254 pgd_list_add(pgd); 262 pgd_list_add(pgd);
255 spin_unlock_irqrestore(&pgd_lock, flags); 263 spin_unlock_irqrestore(&pgd_lock, flags);
256} 264}
@@ -260,6 +268,7 @@ void pgd_dtor(void *pgd, struct kmem_cache *cache, unsigned long unused)
260{ 268{
261 unsigned long flags; /* can be called from interrupt context */ 269 unsigned long flags; /* can be called from interrupt context */
262 270
271 paravirt_release_pd(__pa(pgd) >> PAGE_SHIFT);
263 spin_lock_irqsave(&pgd_lock, flags); 272 spin_lock_irqsave(&pgd_lock, flags);
264 pgd_list_del(pgd); 273 pgd_list_del(pgd);
265 spin_unlock_irqrestore(&pgd_lock, flags); 274 spin_unlock_irqrestore(&pgd_lock, flags);
@@ -277,13 +286,18 @@ pgd_t *pgd_alloc(struct mm_struct *mm)
277 pmd_t *pmd = kmem_cache_alloc(pmd_cache, GFP_KERNEL); 286 pmd_t *pmd = kmem_cache_alloc(pmd_cache, GFP_KERNEL);
278 if (!pmd) 287 if (!pmd)
279 goto out_oom; 288 goto out_oom;
289 paravirt_alloc_pd(__pa(pmd) >> PAGE_SHIFT);
280 set_pgd(&pgd[i], __pgd(1 + __pa(pmd))); 290 set_pgd(&pgd[i], __pgd(1 + __pa(pmd)));
281 } 291 }
282 return pgd; 292 return pgd;
283 293
284out_oom: 294out_oom:
285 for (i--; i >= 0; i--) 295 for (i--; i >= 0; i--) {
286 kmem_cache_free(pmd_cache, (void *)__va(pgd_val(pgd[i])-1)); 296 pgd_t pgdent = pgd[i];
297 void* pmd = (void *)__va(pgd_val(pgdent)-1);
298 paravirt_release_pd(__pa(pmd) >> PAGE_SHIFT);
299 kmem_cache_free(pmd_cache, pmd);
300 }
287 kmem_cache_free(pgd_cache, pgd); 301 kmem_cache_free(pgd_cache, pgd);
288 return NULL; 302 return NULL;
289} 303}
@@ -294,8 +308,12 @@ void pgd_free(pgd_t *pgd)
294 308
295 /* in the PAE case user pgd entries are overwritten before usage */ 309 /* in the PAE case user pgd entries are overwritten before usage */
296 if (PTRS_PER_PMD > 1) 310 if (PTRS_PER_PMD > 1)
297 for (i = 0; i < USER_PTRS_PER_PGD; ++i) 311 for (i = 0; i < USER_PTRS_PER_PGD; ++i) {
298 kmem_cache_free(pmd_cache, (void *)__va(pgd_val(pgd[i])-1)); 312 pgd_t pgdent = pgd[i];
313 void* pmd = (void *)__va(pgd_val(pgdent)-1);
314 paravirt_release_pd(__pa(pmd) >> PAGE_SHIFT);
315 kmem_cache_free(pmd_cache, pmd);
316 }
299 /* in the non-PAE case, free_pgtables() clears user pgd entries */ 317 /* in the non-PAE case, free_pgtables() clears user pgd entries */
300 kmem_cache_free(pgd_cache, pgd); 318 kmem_cache_free(pgd_cache, pgd);
301} 319}
diff --git a/arch/i386/oprofile/op_model_ppro.c b/arch/i386/oprofile/op_model_ppro.c
index ca2447e05e15..c554f52cb808 100644
--- a/arch/i386/oprofile/op_model_ppro.c
+++ b/arch/i386/oprofile/op_model_ppro.c
@@ -24,7 +24,8 @@
24 24
25#define CTR_IS_RESERVED(msrs,c) (msrs->counters[(c)].addr ? 1 : 0) 25#define CTR_IS_RESERVED(msrs,c) (msrs->counters[(c)].addr ? 1 : 0)
26#define CTR_READ(l,h,msrs,c) do {rdmsr(msrs->counters[(c)].addr, (l), (h));} while (0) 26#define CTR_READ(l,h,msrs,c) do {rdmsr(msrs->counters[(c)].addr, (l), (h));} while (0)
27#define CTR_WRITE(l,msrs,c) do {wrmsr(msrs->counters[(c)].addr, -(u32)(l), -1);} while (0) 27#define CTR_32BIT_WRITE(l,msrs,c) \
28 do {wrmsr(msrs->counters[(c)].addr, -(u32)(l), 0);} while (0)
28#define CTR_OVERFLOWED(n) (!((n) & (1U<<31))) 29#define CTR_OVERFLOWED(n) (!((n) & (1U<<31)))
29 30
30#define CTRL_IS_RESERVED(msrs,c) (msrs->controls[(c)].addr ? 1 : 0) 31#define CTRL_IS_RESERVED(msrs,c) (msrs->controls[(c)].addr ? 1 : 0)
@@ -79,7 +80,7 @@ static void ppro_setup_ctrs(struct op_msrs const * const msrs)
79 for (i = 0; i < NUM_COUNTERS; ++i) { 80 for (i = 0; i < NUM_COUNTERS; ++i) {
80 if (unlikely(!CTR_IS_RESERVED(msrs,i))) 81 if (unlikely(!CTR_IS_RESERVED(msrs,i)))
81 continue; 82 continue;
82 CTR_WRITE(1, msrs, i); 83 CTR_32BIT_WRITE(1, msrs, i);
83 } 84 }
84 85
85 /* enable active counters */ 86 /* enable active counters */
@@ -87,7 +88,7 @@ static void ppro_setup_ctrs(struct op_msrs const * const msrs)
87 if ((counter_config[i].enabled) && (CTR_IS_RESERVED(msrs,i))) { 88 if ((counter_config[i].enabled) && (CTR_IS_RESERVED(msrs,i))) {
88 reset_value[i] = counter_config[i].count; 89 reset_value[i] = counter_config[i].count;
89 90
90 CTR_WRITE(counter_config[i].count, msrs, i); 91 CTR_32BIT_WRITE(counter_config[i].count, msrs, i);
91 92
92 CTRL_READ(low, high, msrs, i); 93 CTRL_READ(low, high, msrs, i);
93 CTRL_CLEAR(low); 94 CTRL_CLEAR(low);
@@ -116,7 +117,7 @@ static int ppro_check_ctrs(struct pt_regs * const regs,
116 CTR_READ(low, high, msrs, i); 117 CTR_READ(low, high, msrs, i);
117 if (CTR_OVERFLOWED(low)) { 118 if (CTR_OVERFLOWED(low)) {
118 oprofile_add_sample(regs, i); 119 oprofile_add_sample(regs, i);
119 CTR_WRITE(reset_value[i], msrs, i); 120 CTR_32BIT_WRITE(reset_value[i], msrs, i);
120 } 121 }
121 } 122 }
122 123
diff --git a/arch/i386/pci/Makefile b/arch/i386/pci/Makefile
index 1594d2f55c8f..44650e03308b 100644
--- a/arch/i386/pci/Makefile
+++ b/arch/i386/pci/Makefile
@@ -1,7 +1,7 @@
1obj-y := i386.o init.o 1obj-y := i386.o init.o
2 2
3obj-$(CONFIG_PCI_BIOS) += pcbios.o 3obj-$(CONFIG_PCI_BIOS) += pcbios.o
4obj-$(CONFIG_PCI_MMCONFIG) += mmconfig.o direct.o 4obj-$(CONFIG_PCI_MMCONFIG) += mmconfig.o direct.o mmconfig-shared.o
5obj-$(CONFIG_PCI_DIRECT) += direct.o 5obj-$(CONFIG_PCI_DIRECT) += direct.o
6 6
7pci-y := fixup.o 7pci-y := fixup.o
diff --git a/arch/i386/pci/mmconfig-shared.c b/arch/i386/pci/mmconfig-shared.c
new file mode 100644
index 000000000000..747d8c63b0c4
--- /dev/null
+++ b/arch/i386/pci/mmconfig-shared.c
@@ -0,0 +1,264 @@
1/*
2 * mmconfig-shared.c - Low-level direct PCI config space access via
3 * MMCONFIG - common code between i386 and x86-64.
4 *
5 * This code does:
6 * - known chipset handling
7 * - ACPI decoding and validation
8 *
9 * Per-architecture code takes care of the mappings and accesses
10 * themselves.
11 */
12
13#include <linux/pci.h>
14#include <linux/init.h>
15#include <linux/acpi.h>
16#include <linux/bitmap.h>
17#include <asm/e820.h>
18
19#include "pci.h"
20
21/* aperture is up to 256MB but BIOS may reserve less */
22#define MMCONFIG_APER_MIN (2 * 1024*1024)
23#define MMCONFIG_APER_MAX (256 * 1024*1024)
24
25DECLARE_BITMAP(pci_mmcfg_fallback_slots, 32*PCI_MMCFG_MAX_CHECK_BUS);
26
27/* K8 systems have some devices (typically in the builtin northbridge)
28 that are only accessible using type1
29 Normally this can be expressed in the MCFG by not listing them
30 and assigning suitable _SEGs, but this isn't implemented in some BIOS.
31 Instead try to discover all devices on bus 0 that are unreachable using MM
32 and fallback for them. */
33static void __init unreachable_devices(void)
34{
35 int i, bus;
36 /* Use the max bus number from ACPI here? */
37 for (bus = 0; bus < PCI_MMCFG_MAX_CHECK_BUS; bus++) {
38 for (i = 0; i < 32; i++) {
39 unsigned int devfn = PCI_DEVFN(i, 0);
40 u32 val1, val2;
41
42 pci_conf1_read(0, bus, devfn, 0, 4, &val1);
43 if (val1 == 0xffffffff)
44 continue;
45
46 if (pci_mmcfg_arch_reachable(0, bus, devfn)) {
47 raw_pci_ops->read(0, bus, devfn, 0, 4, &val2);
48 if (val1 == val2)
49 continue;
50 }
51 set_bit(i + 32 * bus, pci_mmcfg_fallback_slots);
52 printk(KERN_NOTICE "PCI: No mmconfig possible on device"
53 " %02x:%02x\n", bus, i);
54 }
55 }
56}
57
58static const char __init *pci_mmcfg_e7520(void)
59{
60 u32 win;
61 pci_conf1_read(0, 0, PCI_DEVFN(0,0), 0xce, 2, &win);
62
63 pci_mmcfg_config_num = 1;
64 pci_mmcfg_config = kzalloc(sizeof(pci_mmcfg_config[0]), GFP_KERNEL);
65 if (!pci_mmcfg_config)
66 return NULL;
67 pci_mmcfg_config[0].address = (win & 0xf000) << 16;
68 pci_mmcfg_config[0].pci_segment = 0;
69 pci_mmcfg_config[0].start_bus_number = 0;
70 pci_mmcfg_config[0].end_bus_number = 255;
71
72 return "Intel Corporation E7520 Memory Controller Hub";
73}
74
75static const char __init *pci_mmcfg_intel_945(void)
76{
77 u32 pciexbar, mask = 0, len = 0;
78
79 pci_mmcfg_config_num = 1;
80
81 pci_conf1_read(0, 0, PCI_DEVFN(0,0), 0x48, 4, &pciexbar);
82
83 /* Enable bit */
84 if (!(pciexbar & 1))
85 pci_mmcfg_config_num = 0;
86
87 /* Size bits */
88 switch ((pciexbar >> 1) & 3) {
89 case 0:
90 mask = 0xf0000000U;
91 len = 0x10000000U;
92 break;
93 case 1:
94 mask = 0xf8000000U;
95 len = 0x08000000U;
96 break;
97 case 2:
98 mask = 0xfc000000U;
99 len = 0x04000000U;
100 break;
101 default:
102 pci_mmcfg_config_num = 0;
103 }
104
105 /* Errata #2, things break when not aligned on a 256Mb boundary */
106 /* Can only happen in 64M/128M mode */
107
108 if ((pciexbar & mask) & 0x0fffffffU)
109 pci_mmcfg_config_num = 0;
110
111 if (pci_mmcfg_config_num) {
112 pci_mmcfg_config = kzalloc(sizeof(pci_mmcfg_config[0]), GFP_KERNEL);
113 if (!pci_mmcfg_config)
114 return NULL;
115 pci_mmcfg_config[0].address = pciexbar & mask;
116 pci_mmcfg_config[0].pci_segment = 0;
117 pci_mmcfg_config[0].start_bus_number = 0;
118 pci_mmcfg_config[0].end_bus_number = (len >> 20) - 1;
119 }
120
121 return "Intel Corporation 945G/GZ/P/PL Express Memory Controller Hub";
122}
123
124struct pci_mmcfg_hostbridge_probe {
125 u32 vendor;
126 u32 device;
127 const char *(*probe)(void);
128};
129
130static struct pci_mmcfg_hostbridge_probe pci_mmcfg_probes[] __initdata = {
131 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_E7520_MCH, pci_mmcfg_e7520 },
132 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82945G_HB, pci_mmcfg_intel_945 },
133};
134
135static int __init pci_mmcfg_check_hostbridge(void)
136{
137 u32 l;
138 u16 vendor, device;
139 int i;
140 const char *name;
141
142 pci_conf1_read(0, 0, PCI_DEVFN(0,0), 0, 4, &l);
143 vendor = l & 0xffff;
144 device = (l >> 16) & 0xffff;
145
146 pci_mmcfg_config_num = 0;
147 pci_mmcfg_config = NULL;
148 name = NULL;
149
150 for (i = 0; !name && i < ARRAY_SIZE(pci_mmcfg_probes); i++) {
151 if (pci_mmcfg_probes[i].vendor == vendor &&
152 pci_mmcfg_probes[i].device == device)
153 name = pci_mmcfg_probes[i].probe();
154 }
155
156 if (name) {
157 printk(KERN_INFO "PCI: Found %s %s MMCONFIG support.\n",
158 name, pci_mmcfg_config_num ? "with" : "without");
159 }
160
161 return name != NULL;
162}
163
164static void __init pci_mmcfg_insert_resources(void)
165{
166#define PCI_MMCFG_RESOURCE_NAME_LEN 19
167 int i;
168 struct resource *res;
169 char *names;
170 unsigned num_buses;
171
172 res = kcalloc(PCI_MMCFG_RESOURCE_NAME_LEN + sizeof(*res),
173 pci_mmcfg_config_num, GFP_KERNEL);
174 if (!res) {
175 printk(KERN_ERR "PCI: Unable to allocate MMCONFIG resources\n");
176 return;
177 }
178
179 names = (void *)&res[pci_mmcfg_config_num];
180 for (i = 0; i < pci_mmcfg_config_num; i++, res++) {
181 struct acpi_mcfg_allocation *cfg = &pci_mmcfg_config[i];
182 num_buses = cfg->end_bus_number - cfg->start_bus_number + 1;
183 res->name = names;
184 snprintf(names, PCI_MMCFG_RESOURCE_NAME_LEN, "PCI MMCONFIG %u",
185 cfg->pci_segment);
186 res->start = cfg->address;
187 res->end = res->start + (num_buses << 20) - 1;
188 res->flags = IORESOURCE_MEM | IORESOURCE_BUSY;
189 insert_resource(&iomem_resource, res);
190 names += PCI_MMCFG_RESOURCE_NAME_LEN;
191 }
192}
193
194static void __init pci_mmcfg_reject_broken(int type)
195{
196 typeof(pci_mmcfg_config[0]) *cfg;
197
198 if ((pci_mmcfg_config_num == 0) ||
199 (pci_mmcfg_config == NULL) ||
200 (pci_mmcfg_config[0].address == 0))
201 return;
202
203 cfg = &pci_mmcfg_config[0];
204
205 /*
206 * Handle more broken MCFG tables on Asus etc.
207 * They only contain a single entry for bus 0-0.
208 */
209 if (pci_mmcfg_config_num == 1 &&
210 cfg->pci_segment == 0 &&
211 (cfg->start_bus_number | cfg->end_bus_number) == 0) {
212 printk(KERN_ERR "PCI: start and end of bus number is 0. "
213 "Rejected as broken MCFG.\n");
214 goto reject;
215 }
216
217 /*
218 * Only do this check when type 1 works. If it doesn't work
219 * assume we run on a Mac and always use MCFG
220 */
221 if (type == 1 && !e820_all_mapped(cfg->address,
222 cfg->address + MMCONFIG_APER_MIN,
223 E820_RESERVED)) {
224 printk(KERN_ERR "PCI: BIOS Bug: MCFG area at %Lx is not"
225 " E820-reserved\n", cfg->address);
226 goto reject;
227 }
228 return;
229
230reject:
231 printk(KERN_ERR "PCI: Not using MMCONFIG.\n");
232 kfree(pci_mmcfg_config);
233 pci_mmcfg_config = NULL;
234 pci_mmcfg_config_num = 0;
235}
236
237void __init pci_mmcfg_init(int type)
238{
239 int known_bridge = 0;
240
241 if ((pci_probe & PCI_PROBE_MMCONF) == 0)
242 return;
243
244 if (type == 1 && pci_mmcfg_check_hostbridge())
245 known_bridge = 1;
246
247 if (!known_bridge) {
248 acpi_table_parse(ACPI_SIG_MCFG, acpi_parse_mcfg);
249 pci_mmcfg_reject_broken(type);
250 }
251
252 if ((pci_mmcfg_config_num == 0) ||
253 (pci_mmcfg_config == NULL) ||
254 (pci_mmcfg_config[0].address == 0))
255 return;
256
257 if (pci_mmcfg_arch_init()) {
258 if (type == 1)
259 unreachable_devices();
260 if (known_bridge)
261 pci_mmcfg_insert_resources();
262 pci_probe = (pci_probe & ~PCI_PROBE_MASK) | PCI_PROBE_MMCONF;
263 }
264}
diff --git a/arch/i386/pci/mmconfig.c b/arch/i386/pci/mmconfig.c
index 5700220dcf5f..bb1afd9e589d 100644
--- a/arch/i386/pci/mmconfig.c
+++ b/arch/i386/pci/mmconfig.c
@@ -15,55 +15,33 @@
15#include <asm/e820.h> 15#include <asm/e820.h>
16#include "pci.h" 16#include "pci.h"
17 17
18/* aperture is up to 256MB but BIOS may reserve less */
19#define MMCONFIG_APER_MIN (2 * 1024*1024)
20#define MMCONFIG_APER_MAX (256 * 1024*1024)
21
22/* Assume systems with more busses have correct MCFG */ 18/* Assume systems with more busses have correct MCFG */
23#define MAX_CHECK_BUS 16
24
25#define mmcfg_virt_addr ((void __iomem *) fix_to_virt(FIX_PCIE_MCFG)) 19#define mmcfg_virt_addr ((void __iomem *) fix_to_virt(FIX_PCIE_MCFG))
26 20
27/* The base address of the last MMCONFIG device accessed */ 21/* The base address of the last MMCONFIG device accessed */
28static u32 mmcfg_last_accessed_device; 22static u32 mmcfg_last_accessed_device;
29static int mmcfg_last_accessed_cpu; 23static int mmcfg_last_accessed_cpu;
30 24
31static DECLARE_BITMAP(fallback_slots, MAX_CHECK_BUS*32);
32
33/* 25/*
34 * Functions for accessing PCI configuration space with MMCONFIG accesses 26 * Functions for accessing PCI configuration space with MMCONFIG accesses
35 */ 27 */
36static u32 get_base_addr(unsigned int seg, int bus, unsigned devfn) 28static u32 get_base_addr(unsigned int seg, int bus, unsigned devfn)
37{ 29{
38 int cfg_num = -1;
39 struct acpi_mcfg_allocation *cfg; 30 struct acpi_mcfg_allocation *cfg;
31 int cfg_num;
40 32
41 if (seg == 0 && bus < MAX_CHECK_BUS && 33 if (seg == 0 && bus < PCI_MMCFG_MAX_CHECK_BUS &&
42 test_bit(PCI_SLOT(devfn) + 32*bus, fallback_slots)) 34 test_bit(PCI_SLOT(devfn) + 32*bus, pci_mmcfg_fallback_slots))
43 return 0; 35 return 0;
44 36
45 while (1) { 37 for (cfg_num = 0; cfg_num < pci_mmcfg_config_num; cfg_num++) {
46 ++cfg_num;
47 if (cfg_num >= pci_mmcfg_config_num) {
48 break;
49 }
50 cfg = &pci_mmcfg_config[cfg_num]; 38 cfg = &pci_mmcfg_config[cfg_num];
51 if (cfg->pci_segment != seg) 39 if (cfg->pci_segment == seg &&
52 continue; 40 (cfg->start_bus_number <= bus) &&
53 if ((cfg->start_bus_number <= bus) &&
54 (cfg->end_bus_number >= bus)) 41 (cfg->end_bus_number >= bus))
55 return cfg->address; 42 return cfg->address;
56 } 43 }
57 44
58 /* Handle more broken MCFG tables on Asus etc.
59 They only contain a single entry for bus 0-0. Assume
60 this applies to all busses. */
61 cfg = &pci_mmcfg_config[0];
62 if (pci_mmcfg_config_num == 1 &&
63 cfg->pci_segment == 0 &&
64 (cfg->start_bus_number | cfg->end_bus_number) == 0)
65 return cfg->address;
66
67 /* Fall back to type 0 */ 45 /* Fall back to type 0 */
68 return 0; 46 return 0;
69} 47}
@@ -158,67 +136,15 @@ static struct pci_raw_ops pci_mmcfg = {
158 .write = pci_mmcfg_write, 136 .write = pci_mmcfg_write,
159}; 137};
160 138
161/* K8 systems have some devices (typically in the builtin northbridge) 139int __init pci_mmcfg_arch_reachable(unsigned int seg, unsigned int bus,
162 that are only accessible using type1 140 unsigned int devfn)
163 Normally this can be expressed in the MCFG by not listing them
164 and assigning suitable _SEGs, but this isn't implemented in some BIOS.
165 Instead try to discover all devices on bus 0 that are unreachable using MM
166 and fallback for them. */
167static __init void unreachable_devices(void)
168{ 141{
169 int i, k; 142 return get_base_addr(seg, bus, devfn) != 0;
170 unsigned long flags;
171
172 for (k = 0; k < MAX_CHECK_BUS; k++) {
173 for (i = 0; i < 32; i++) {
174 u32 val1;
175 u32 addr;
176
177 pci_conf1_read(0, k, PCI_DEVFN(i, 0), 0, 4, &val1);
178 if (val1 == 0xffffffff)
179 continue;
180
181 /* Locking probably not needed, but safer */
182 spin_lock_irqsave(&pci_config_lock, flags);
183 addr = get_base_addr(0, k, PCI_DEVFN(i, 0));
184 if (addr != 0)
185 pci_exp_set_dev_base(addr, k, PCI_DEVFN(i, 0));
186 if (addr == 0 ||
187 readl((u32 __iomem *)mmcfg_virt_addr) != val1) {
188 set_bit(i + 32*k, fallback_slots);
189 printk(KERN_NOTICE
190 "PCI: No mmconfig possible on %x:%x\n", k, i);
191 }
192 spin_unlock_irqrestore(&pci_config_lock, flags);
193 }
194 }
195} 143}
196 144
197void __init pci_mmcfg_init(int type) 145int __init pci_mmcfg_arch_init(void)
198{ 146{
199 if ((pci_probe & PCI_PROBE_MMCONF) == 0)
200 return;
201
202 acpi_table_parse(ACPI_SIG_MCFG, acpi_parse_mcfg);
203 if ((pci_mmcfg_config_num == 0) ||
204 (pci_mmcfg_config == NULL) ||
205 (pci_mmcfg_config[0].address == 0))
206 return;
207
208 /* Only do this check when type 1 works. If it doesn't work
209 assume we run on a Mac and always use MCFG */
210 if (type == 1 && !e820_all_mapped(pci_mmcfg_config[0].address,
211 pci_mmcfg_config[0].address + MMCONFIG_APER_MIN,
212 E820_RESERVED)) {
213 printk(KERN_ERR "PCI: BIOS Bug: MCFG area at %lx is not E820-reserved\n",
214 (unsigned long)pci_mmcfg_config[0].address);
215 printk(KERN_ERR "PCI: Not using MMCONFIG.\n");
216 return;
217 }
218
219 printk(KERN_INFO "PCI: Using MMCONFIG\n"); 147 printk(KERN_INFO "PCI: Using MMCONFIG\n");
220 raw_pci_ops = &pci_mmcfg; 148 raw_pci_ops = &pci_mmcfg;
221 pci_probe = (pci_probe & ~PCI_PROBE_MASK) | PCI_PROBE_MMCONF; 149 return 1;
222
223 unreachable_devices();
224} 150}
diff --git a/arch/i386/pci/pci.h b/arch/i386/pci/pci.h
index a0a25180b61a..e58bae2076ad 100644
--- a/arch/i386/pci/pci.h
+++ b/arch/i386/pci/pci.h
@@ -94,3 +94,13 @@ extern void pci_pcbios_init(void);
94extern void pci_mmcfg_init(int type); 94extern void pci_mmcfg_init(int type);
95extern void pcibios_sort(void); 95extern void pcibios_sort(void);
96 96
97/* pci-mmconfig.c */
98
99/* Verify the first 16 busses. We assume that systems with more busses
100 get MCFG right. */
101#define PCI_MMCFG_MAX_CHECK_BUS 16
102extern DECLARE_BITMAP(pci_mmcfg_fallback_slots, 32*PCI_MMCFG_MAX_CHECK_BUS);
103
104extern int __init pci_mmcfg_arch_reachable(unsigned int seg, unsigned int bus,
105 unsigned int devfn);
106extern int __init pci_mmcfg_arch_init(void);
diff --git a/arch/ia64/kernel/crash.c b/arch/ia64/kernel/crash.c
index 37bb16f07fc3..5cdd2f5fa064 100644
--- a/arch/ia64/kernel/crash.c
+++ b/arch/ia64/kernel/crash.c
@@ -222,7 +222,7 @@ machine_crash_setup(void)
222 if((ret = register_die_notifier(&kdump_init_notifier_nb)) != 0) 222 if((ret = register_die_notifier(&kdump_init_notifier_nb)) != 0)
223 return ret; 223 return ret;
224#ifdef CONFIG_SYSCTL 224#ifdef CONFIG_SYSCTL
225 register_sysctl_table(sys_table, 0); 225 register_sysctl_table(sys_table);
226#endif 226#endif
227 return 0; 227 return 0;
228} 228}
diff --git a/arch/ia64/kernel/irq_ia64.c b/arch/ia64/kernel/irq_ia64.c
index ba3ba8bc50be..456f57b087ca 100644
--- a/arch/ia64/kernel/irq_ia64.c
+++ b/arch/ia64/kernel/irq_ia64.c
@@ -275,7 +275,7 @@ static struct irqaction ipi_irqaction = {
275 275
276static struct irqaction resched_irqaction = { 276static struct irqaction resched_irqaction = {
277 .handler = dummy_handler, 277 .handler = dummy_handler,
278 .flags = SA_INTERRUPT, 278 .flags = IRQF_DISABLED,
279 .name = "resched" 279 .name = "resched"
280}; 280};
281#endif 281#endif
diff --git a/arch/ia64/kernel/perfmon.c b/arch/ia64/kernel/perfmon.c
index 9860794a68fb..2ecb20b551e1 100644
--- a/arch/ia64/kernel/perfmon.c
+++ b/arch/ia64/kernel/perfmon.c
@@ -521,19 +521,57 @@ pfm_sysctl_t pfm_sysctl;
521EXPORT_SYMBOL(pfm_sysctl); 521EXPORT_SYMBOL(pfm_sysctl);
522 522
523static ctl_table pfm_ctl_table[]={ 523static ctl_table pfm_ctl_table[]={
524 {1, "debug", &pfm_sysctl.debug, sizeof(int), 0666, NULL, &proc_dointvec, NULL,}, 524 {
525 {2, "debug_ovfl", &pfm_sysctl.debug_ovfl, sizeof(int), 0666, NULL, &proc_dointvec, NULL,}, 525 .ctl_name = CTL_UNNUMBERED,
526 {3, "fastctxsw", &pfm_sysctl.fastctxsw, sizeof(int), 0600, NULL, &proc_dointvec, NULL,}, 526 .procname = "debug",
527 {4, "expert_mode", &pfm_sysctl.expert_mode, sizeof(int), 0600, NULL, &proc_dointvec, NULL,}, 527 .data = &pfm_sysctl.debug,
528 { 0, }, 528 .maxlen = sizeof(int),
529 .mode = 0666,
530 .proc_handler = &proc_dointvec,
531 },
532 {
533 .ctl_name = CTL_UNNUMBERED,
534 .procname = "debug_ovfl",
535 .data = &pfm_sysctl.debug_ovfl,
536 .maxlen = sizeof(int),
537 .mode = 0666,
538 .proc_handler = &proc_dointvec,
539 },
540 {
541 .ctl_name = CTL_UNNUMBERED,
542 .procname = "fastctxsw",
543 .data = &pfm_sysctl.fastctxsw,
544 .maxlen = sizeof(int),
545 .mode = 0600,
546 .proc_handler = &proc_dointvec,
547 },
548 {
549 .ctl_name = CTL_UNNUMBERED,
550 .procname = "expert_mode",
551 .data = &pfm_sysctl.expert_mode,
552 .maxlen = sizeof(int),
553 .mode = 0600,
554 .proc_handler = &proc_dointvec,
555 },
556 {}
529}; 557};
530static ctl_table pfm_sysctl_dir[] = { 558static ctl_table pfm_sysctl_dir[] = {
531 {1, "perfmon", NULL, 0, 0755, pfm_ctl_table, }, 559 {
532 {0,}, 560 .ctl_name = CTL_UNNUMBERED,
561 .procname = "perfmon",
562 .mode = 0755,
563 .child = pfm_ctl_table,
564 },
565 {}
533}; 566};
534static ctl_table pfm_sysctl_root[] = { 567static ctl_table pfm_sysctl_root[] = {
535 {1, "kernel", NULL, 0, 0755, pfm_sysctl_dir, }, 568 {
536 {0,}, 569 .ctl_name = CTL_KERN,
570 .procname = "kernel",
571 .mode = 0755,
572 .child = pfm_sysctl_dir,
573 },
574 {}
537}; 575};
538static struct ctl_table_header *pfm_sysctl_header; 576static struct ctl_table_header *pfm_sysctl_header;
539 577
@@ -6688,7 +6726,7 @@ pfm_init(void)
6688 /* 6726 /*
6689 * create /proc/sys/kernel/perfmon (for debugging purposes) 6727 * create /proc/sys/kernel/perfmon (for debugging purposes)
6690 */ 6728 */
6691 pfm_sysctl_header = register_sysctl_table(pfm_sysctl_root, 0); 6729 pfm_sysctl_header = register_sysctl_table(pfm_sysctl_root);
6692 6730
6693 /* 6731 /*
6694 * initialize all our spinlocks 6732 * initialize all our spinlocks
diff --git a/arch/ia64/sn/kernel/xpc_main.c b/arch/ia64/sn/kernel/xpc_main.c
index 7a387d237363..68355ef6f841 100644
--- a/arch/ia64/sn/kernel/xpc_main.c
+++ b/arch/ia64/sn/kernel/xpc_main.c
@@ -101,67 +101,57 @@ static int xpc_disengage_request_max_timelimit = 120;
101 101
102static ctl_table xpc_sys_xpc_hb_dir[] = { 102static ctl_table xpc_sys_xpc_hb_dir[] = {
103 { 103 {
104 1, 104 .ctl_name = CTL_UNNUMBERED,
105 "hb_interval", 105 .procname = "hb_interval",
106 &xpc_hb_interval, 106 .data = &xpc_hb_interval,
107 sizeof(int), 107 .maxlen = sizeof(int),
108 0644, 108 .mode = 0644,
109 NULL, 109 .proc_handler = &proc_dointvec_minmax,
110 &proc_dointvec_minmax, 110 .strategy = &sysctl_intvec,
111 &sysctl_intvec, 111 .extra1 = &xpc_hb_min_interval,
112 NULL, 112 .extra2 = &xpc_hb_max_interval
113 &xpc_hb_min_interval,
114 &xpc_hb_max_interval
115 }, 113 },
116 { 114 {
117 2, 115 .ctl_name = CTL_UNNUMBERED,
118 "hb_check_interval", 116 .procname = "hb_check_interval",
119 &xpc_hb_check_interval, 117 .data = &xpc_hb_check_interval,
120 sizeof(int), 118 .maxlen = sizeof(int),
121 0644, 119 .mode = 0644,
122 NULL, 120 .proc_handler = &proc_dointvec_minmax,
123 &proc_dointvec_minmax, 121 .strategy = &sysctl_intvec,
124 &sysctl_intvec, 122 .extra1 = &xpc_hb_check_min_interval,
125 NULL, 123 .extra2 = &xpc_hb_check_max_interval
126 &xpc_hb_check_min_interval,
127 &xpc_hb_check_max_interval
128 }, 124 },
129 {0} 125 {}
130}; 126};
131static ctl_table xpc_sys_xpc_dir[] = { 127static ctl_table xpc_sys_xpc_dir[] = {
132 { 128 {
133 1, 129 .ctl_name = CTL_UNNUMBERED,
134 "hb", 130 .procname = "hb",
135 NULL, 131 .mode = 0555,
136 0, 132 .child = xpc_sys_xpc_hb_dir
137 0555,
138 xpc_sys_xpc_hb_dir
139 }, 133 },
140 { 134 {
141 2, 135 .ctl_name = CTL_UNNUMBERED,
142 "disengage_request_timelimit", 136 .procname = "disengage_request_timelimit",
143 &xpc_disengage_request_timelimit, 137 .data = &xpc_disengage_request_timelimit,
144 sizeof(int), 138 .maxlen = sizeof(int),
145 0644, 139 .mode = 0644,
146 NULL, 140 .proc_handler = &proc_dointvec_minmax,
147 &proc_dointvec_minmax, 141 .strategy = &sysctl_intvec,
148 &sysctl_intvec, 142 .extra1 = &xpc_disengage_request_min_timelimit,
149 NULL, 143 .extra2 = &xpc_disengage_request_max_timelimit
150 &xpc_disengage_request_min_timelimit,
151 &xpc_disengage_request_max_timelimit
152 }, 144 },
153 {0} 145 {}
154}; 146};
155static ctl_table xpc_sys_dir[] = { 147static ctl_table xpc_sys_dir[] = {
156 { 148 {
157 1, 149 .ctl_name = CTL_UNNUMBERED,
158 "xpc", 150 .procname = "xpc",
159 NULL, 151 .mode = 0555,
160 0, 152 .child = xpc_sys_xpc_dir
161 0555,
162 xpc_sys_xpc_dir
163 }, 153 },
164 {0} 154 {}
165}; 155};
166static struct ctl_table_header *xpc_sysctl; 156static struct ctl_table_header *xpc_sysctl;
167 157
@@ -1251,7 +1241,7 @@ xpc_init(void)
1251 snprintf(xpc_part->bus_id, BUS_ID_SIZE, "part"); 1241 snprintf(xpc_part->bus_id, BUS_ID_SIZE, "part");
1252 snprintf(xpc_chan->bus_id, BUS_ID_SIZE, "chan"); 1242 snprintf(xpc_chan->bus_id, BUS_ID_SIZE, "chan");
1253 1243
1254 xpc_sysctl = register_sysctl_table(xpc_sys_dir, 1); 1244 xpc_sysctl = register_sysctl_table(xpc_sys_dir);
1255 1245
1256 /* 1246 /*
1257 * The first few fields of each entry of xpc_partitions[] need to 1247 * The first few fields of each entry of xpc_partitions[] need to
diff --git a/arch/m68k/atari/stdma.c b/arch/m68k/atari/stdma.c
index d01deb46ebbc..ab3fd5202b24 100644
--- a/arch/m68k/atari/stdma.c
+++ b/arch/m68k/atari/stdma.c
@@ -174,7 +174,7 @@ int stdma_islocked(void)
174void __init stdma_init(void) 174void __init stdma_init(void)
175{ 175{
176 stdma_isr = NULL; 176 stdma_isr = NULL;
177 request_irq(IRQ_MFP_FDC, stdma_int, IRQ_TYPE_SLOW | SA_SHIRQ, 177 request_irq(IRQ_MFP_FDC, stdma_int, IRQ_TYPE_SLOW | IRQF_SHARED,
178 "ST-DMA: floppy/ACSI/IDE/Falcon-SCSI", stdma_int); 178 "ST-DMA: floppy/ACSI/IDE/Falcon-SCSI", stdma_int);
179} 179}
180 180
diff --git a/arch/mips/au1000/common/power.c b/arch/mips/au1000/common/power.c
index 7504a6364616..3901e8e04755 100644
--- a/arch/mips/au1000/common/power.c
+++ b/arch/mips/au1000/common/power.c
@@ -62,12 +62,6 @@ extern unsigned long save_local_and_disable(int controller);
62extern void restore_local_and_enable(int controller, unsigned long mask); 62extern void restore_local_and_enable(int controller, unsigned long mask);
63extern void local_enable_irq(unsigned int irq_nr); 63extern void local_enable_irq(unsigned int irq_nr);
64 64
65/* Quick acpi hack. This will have to change! */
66#define CTL_ACPI 9999
67#define ACPI_S1_SLP_TYP 19
68#define ACPI_SLEEP 21
69
70
71static DEFINE_SPINLOCK(pm_lock); 65static DEFINE_SPINLOCK(pm_lock);
72 66
73/* We need to save/restore a bunch of core registers that are 67/* We need to save/restore a bunch of core registers that are
@@ -425,15 +419,41 @@ static int pm_do_freq(ctl_table * ctl, int write, struct file *file,
425 419
426 420
427static struct ctl_table pm_table[] = { 421static struct ctl_table pm_table[] = {
428 {ACPI_S1_SLP_TYP, "suspend", NULL, 0, 0600, NULL, &pm_do_suspend}, 422 {
429 {ACPI_SLEEP, "sleep", NULL, 0, 0600, NULL, &pm_do_sleep}, 423 .ctl_name = CTL_UNNUMBERED,
430 {CTL_ACPI, "freq", NULL, 0, 0600, NULL, &pm_do_freq}, 424 .procname = "suspend",
431 {0} 425 .data = NULL,
426 .maxlen = 0,
427 .mode = 0600,
428 .proc_handler = &pm_do_suspend
429 },
430 {
431 .ctl_name = CTL_UNNUMBERED,
432 .procname = "sleep",
433 .data = NULL,
434 .maxlen = 0,
435 .mode = 0600,
436 .proc_handler = &pm_do_sleep
437 },
438 {
439 .ctl_name = CTL_UNNUMBERED,
440 .procname = "freq",
441 .data = NULL,
442 .maxlen = 0,
443 .mode = 0600,
444 .proc_handler = &pm_do_freq
445 },
446 {}
432}; 447};
433 448
434static struct ctl_table pm_dir_table[] = { 449static struct ctl_table pm_dir_table[] = {
435 {CTL_ACPI, "pm", NULL, 0, 0555, pm_table}, 450 {
436 {0} 451 .ctl_name = CTL_UNNUMBERED,
452 .procname = "pm",
453 .mode = 0555,
454 .child = pm_table
455 },
456 {}
437}; 457};
438 458
439/* 459/*
@@ -441,7 +461,7 @@ static struct ctl_table pm_dir_table[] = {
441 */ 461 */
442static int __init pm_init(void) 462static int __init pm_init(void)
443{ 463{
444 register_sysctl_table(pm_dir_table, 1); 464 register_sysctl_table(pm_dir_table);
445 return 0; 465 return 0;
446} 466}
447 467
diff --git a/arch/mips/lasat/sysctl.c b/arch/mips/lasat/sysctl.c
index 12878359f2c8..699ab1886ceb 100644
--- a/arch/mips/lasat/sysctl.c
+++ b/arch/mips/lasat/sysctl.c
@@ -302,42 +302,129 @@ extern int lasat_boot_to_service;
302#ifdef CONFIG_SYSCTL 302#ifdef CONFIG_SYSCTL
303 303
304static ctl_table lasat_table[] = { 304static ctl_table lasat_table[] = {
305 {LASAT_CPU_HZ, "cpu-hz", &lasat_board_info.li_cpu_hz, sizeof(int), 305 {
306 0444, NULL, &proc_dointvec, &sysctl_intvec}, 306 .ctl_name = CTL_UNNUMBERED,
307 {LASAT_BUS_HZ, "bus-hz", &lasat_board_info.li_bus_hz, sizeof(int), 307 .procname = "cpu-hz",
308 0444, NULL, &proc_dointvec, &sysctl_intvec}, 308 .data = &lasat_board_info.li_cpu_hz,
309 {LASAT_MODEL, "bmid", &lasat_board_info.li_bmid, sizeof(int), 309 .maxlen = sizeof(int),
310 0444, NULL, &proc_dointvec, &sysctl_intvec}, 310 .mode = 0444,
311 {LASAT_PRID, "prid", &lasat_board_info.li_prid, sizeof(int), 311 .proc_handler = &proc_dointvec,
312 0644, NULL, &proc_lasat_eeprom_value, &sysctl_lasat_eeprom_value}, 312 .strategy = &sysctl_intvec
313 },
314 {
315 .ctl_name = CTL_UNNUMBERED,
316 .procname = "bus-hz",
317 .data = &lasat_board_info.li_bus_hz,
318 .maxlen = sizeof(int),
319 .mode = 0444,
320 .proc_handler = &proc_dointvec,
321 .strategy = &sysctl_intvec
322 },
323 {
324 .ctl_name = CTL_UNNUMBERED,
325 .procname = "bmid",
326 .data = &lasat_board_info.li_bmid,
327 .maxlen = sizeof(int),
328 .mode = 0444,
329 .proc_handler = &proc_dointvec,
330 .strategy = &sysctl_intvec
331 },
332 {
333 .ctl_name = CTL_UNNUMBERED,
334 .procname = "prid",
335 .data = &lasat_board_info.li_prid,
336 .maxlen = sizeof(int),
337 .mode = 0644,
338 .proc_handler = &proc_lasat_eeprom_value,
339 .strategy = &sysctl_lasat_eeprom_value
340 },
313#ifdef CONFIG_INET 341#ifdef CONFIG_INET
314 {LASAT_IPADDR, "ipaddr", &lasat_board_info.li_eeprom_info.ipaddr, sizeof(int), 342 {
315 0644, NULL, &proc_lasat_ip, &sysctl_lasat_intvec}, 343 .ctl_name = CTL_UNNUMBERED,
316 {LASAT_NETMASK, "netmask", &lasat_board_info.li_eeprom_info.netmask, sizeof(int), 344 .procname = "ipaddr",
317 0644, NULL, &proc_lasat_ip, &sysctl_lasat_intvec}, 345 .data = &lasat_board_info.li_eeprom_info.ipaddr,
318 {LASAT_BCAST, "bcastaddr", &lasat_bcastaddr, 346 .maxlen = sizeof(int),
319 sizeof(lasat_bcastaddr), 0600, NULL, 347 .mode = 0644,
320 &proc_dostring, &sysctl_string}, 348 .proc_handler = &proc_lasat_ip,
349 .strategy = &sysctl_lasat_intvec
350 },
351 {
352 .ctl_name = LASAT_NETMASK,
353 .procname = "netmask",
354 .data = &lasat_board_info.li_eeprom_info.netmask,
355 .maxlen = sizeof(int),
356 .mode = 0644,
357 .proc_handler = &proc_lasat_ip,
358 .strategy = &sysctl_lasat_intvec
359 },
360 {
361 .ctl_name = CTL_UNNUMBERED,
362 .procname = "bcastaddr",
363 .data = &lasat_bcastaddr,
364 .maxlen = sizeof(lasat_bcastaddr),
365 .mode = 0600,
366 .proc_handler = &proc_dostring,
367 .strategy = &sysctl_string
368 },
321#endif 369#endif
322 {LASAT_PASSWORD, "passwd_hash", &lasat_board_info.li_eeprom_info.passwd_hash, sizeof(lasat_board_info.li_eeprom_info.passwd_hash), 370 {
323 0600, NULL, &proc_dolasatstring, &sysctl_lasatstring}, 371 .ctl_name = CTL_UNNUMBERED,
324 {LASAT_SBOOT, "boot-service", &lasat_boot_to_service, sizeof(int), 372 .procname = "passwd_hash",
325 0644, NULL, &proc_dointvec, &sysctl_intvec}, 373 .data = &lasat_board_info.li_eeprom_info.passwd_hash,
374 .maxlen = sizeof(lasat_board_info.li_eeprom_info.passwd_hash),
375 .mode = 0600,
376 .proc_handler = &proc_dolasatstring,
377 .strategy = &sysctl_lasatstring
378 },
379 {
380 .ctl_name = CTL_UNNUMBERED,
381 .procname = "boot-service",
382 .data = &lasat_boot_to_service,
383 .maxlen = sizeof(int),
384 .mode = 0644,
385 .proc_handler = &proc_dointvec,
386 .strategy = &sysctl_intvec
387 },
326#ifdef CONFIG_DS1603 388#ifdef CONFIG_DS1603
327 {LASAT_RTC, "rtc", &rtctmp, sizeof(int), 389 {
328 0644, NULL, &proc_dolasatrtc, &sysctl_lasat_rtc}, 390 .ctl_name = CTL_UNNUMBERED,
391 .procname = "rtc",
392 .data = &rtctmp,
393 .maxlen = sizeof(int),
394 .mode = 0644,
395 .proc_handler = &proc_dolasatrtc,
396 .strategy = &sysctl_lasat_rtc
397 },
329#endif 398#endif
330 {LASAT_NAMESTR, "namestr", &lasat_board_info.li_namestr, sizeof(lasat_board_info.li_namestr), 399 {
331 0444, NULL, &proc_dostring, &sysctl_string}, 400 .ctl_name = CTL_UNNUMBERED,
332 {LASAT_TYPESTR, "typestr", &lasat_board_info.li_typestr, sizeof(lasat_board_info.li_typestr), 401 .procname = "namestr",
333 0444, NULL, &proc_dostring, &sysctl_string}, 402 .data = &lasat_board_info.li_namestr,
334 {0} 403 .maxlen = sizeof(lasat_board_info.li_namestr),
404 .mode = 0444,
405 .proc_handler = &proc_dostring,
406 .strategy = &sysctl_string
407 },
408 {
409 .ctl_name = CTL_UNNUMBERED,
410 .procname = "typestr",
411 .data = &lasat_board_info.li_typestr,
412 .maxlen = sizeof(lasat_board_info.li_typestr),
413 .mode = 0444,
414 .proc_handler = &proc_dostring,
415 .strategy = &sysctl_string
416 },
417 {}
335}; 418};
336 419
337#define CTL_LASAT 1 // CTL_ANY ???
338static ctl_table lasat_root_table[] = { 420static ctl_table lasat_root_table[] = {
339 { CTL_LASAT, "lasat", NULL, 0, 0555, lasat_table }, 421 {
340 { 0 } 422 .ctl_name = CTL_UNNUMBERED,
423 .procname = "lasat",
424 .mode = 0555,
425 .child = lasat_table
426 },
427 {}
341}; 428};
342 429
343static int __init lasat_register_sysctl(void) 430static int __init lasat_register_sysctl(void)
@@ -345,7 +432,7 @@ static int __init lasat_register_sysctl(void)
345 struct ctl_table_header *lasat_table_header; 432 struct ctl_table_header *lasat_table_header;
346 433
347 lasat_table_header = 434 lasat_table_header =
348 register_sysctl_table(lasat_root_table, 0); 435 register_sysctl_table(lasat_root_table);
349 436
350 return 0; 437 return 0;
351} 438}
diff --git a/arch/powerpc/kernel/idle.c b/arch/powerpc/kernel/idle.c
index 8994af327b47..6e7f50967bab 100644
--- a/arch/powerpc/kernel/idle.c
+++ b/arch/powerpc/kernel/idle.c
@@ -110,17 +110,22 @@ static ctl_table powersave_nap_ctl_table[]={
110 .mode = 0644, 110 .mode = 0644,
111 .proc_handler = &proc_dointvec, 111 .proc_handler = &proc_dointvec,
112 }, 112 },
113 { 0, }, 113 {}
114}; 114};
115static ctl_table powersave_nap_sysctl_root[] = { 115static ctl_table powersave_nap_sysctl_root[] = {
116 { 1, "kernel", NULL, 0, 0755, powersave_nap_ctl_table, }, 116 {
117 { 0,}, 117 .ctl_name = CTL_KERN,
118 .procname = "kernel",
119 .mode = 0755,
120 .child = powersave_nap_ctl_table,
121 },
122 {}
118}; 123};
119 124
120static int __init 125static int __init
121register_powersave_nap_sysctl(void) 126register_powersave_nap_sysctl(void)
122{ 127{
123 register_sysctl_table(powersave_nap_sysctl_root, 0); 128 register_sysctl_table(powersave_nap_sysctl_root);
124 129
125 return 0; 130 return 0;
126} 131}
diff --git a/arch/ppc/kernel/ppc_htab.c b/arch/ppc/kernel/ppc_htab.c
index bd129d3c2cc1..0a7e42d54eaf 100644
--- a/arch/ppc/kernel/ppc_htab.c
+++ b/arch/ppc/kernel/ppc_htab.c
@@ -442,17 +442,22 @@ static ctl_table htab_ctl_table[]={
442 .mode = 0644, 442 .mode = 0644,
443 .proc_handler = &proc_dol2crvec, 443 .proc_handler = &proc_dol2crvec,
444 }, 444 },
445 { 0, }, 445 {}
446}; 446};
447static ctl_table htab_sysctl_root[] = { 447static ctl_table htab_sysctl_root[] = {
448 { 1, "kernel", NULL, 0, 0755, htab_ctl_table, }, 448 {
449 { 0,}, 449 .ctl_name = CTL_KERN,
450 .procname = "kernel",
451 .mode = 0555,
452 .child = htab_ctl_table,
453 },
454 {}
450}; 455};
451 456
452static int __init 457static int __init
453register_ppc_htab_sysctl(void) 458register_ppc_htab_sysctl(void)
454{ 459{
455 register_sysctl_table(htab_sysctl_root, 0); 460 register_sysctl_table(htab_sysctl_root);
456 461
457 return 0; 462 return 0;
458} 463}
diff --git a/arch/ppc/syslib/i8259.c b/arch/ppc/syslib/i8259.c
index a43dda5a8334..1e5a00a4b5f5 100644
--- a/arch/ppc/syslib/i8259.c
+++ b/arch/ppc/syslib/i8259.c
@@ -154,7 +154,7 @@ static struct resource pic_edgectrl_iores = {
154 154
155static struct irqaction i8259_irqaction = { 155static struct irqaction i8259_irqaction = {
156 .handler = no_action, 156 .handler = no_action,
157 .flags = SA_INTERRUPT, 157 .flags = IRQF_DISABLED,
158 .mask = CPU_MASK_NONE, 158 .mask = CPU_MASK_NONE,
159 .name = "82c59 secondary cascade", 159 .name = "82c59 secondary cascade",
160}; 160};
diff --git a/arch/s390/appldata/appldata.h b/arch/s390/appldata/appldata.h
index 0429481dea63..4069b81f7f1d 100644
--- a/arch/s390/appldata/appldata.h
+++ b/arch/s390/appldata/appldata.h
@@ -21,8 +21,7 @@
21#define APPLDATA_RECORD_NET_SUM_ID 0x03 /* must be < 256 ! */ 21#define APPLDATA_RECORD_NET_SUM_ID 0x03 /* must be < 256 ! */
22#define APPLDATA_RECORD_PROC_ID 0x04 22#define APPLDATA_RECORD_PROC_ID 0x04
23 23
24#define CTL_APPLDATA 2120 /* sysctl IDs, must be unique */ 24#define CTL_APPLDATA_TIMER 2121 /* sysctl IDs, must be unique */
25#define CTL_APPLDATA_TIMER 2121
26#define CTL_APPLDATA_INTERVAL 2122 25#define CTL_APPLDATA_INTERVAL 2122
27#define CTL_APPLDATA_MEM 2123 26#define CTL_APPLDATA_MEM 2123
28#define CTL_APPLDATA_OS 2124 27#define CTL_APPLDATA_OS 2124
diff --git a/arch/s390/appldata/appldata_base.c b/arch/s390/appldata/appldata_base.c
index c9da7d16145e..0c3cf4b16ae4 100644
--- a/arch/s390/appldata/appldata_base.c
+++ b/arch/s390/appldata/appldata_base.c
@@ -506,7 +506,7 @@ int appldata_register_ops(struct appldata_ops *ops)
506 506
507 ops->ctl_table[3].ctl_name = 0; 507 ops->ctl_table[3].ctl_name = 0;
508 508
509 ops->sysctl_header = register_sysctl_table(ops->ctl_table,1); 509 ops->sysctl_header = register_sysctl_table(ops->ctl_table);
510 510
511 P_INFO("%s-ops registered!\n", ops->name); 511 P_INFO("%s-ops registered!\n", ops->name);
512 return 0; 512 return 0;
@@ -606,7 +606,7 @@ static int __init appldata_init(void)
606 /* Register cpu hotplug notifier */ 606 /* Register cpu hotplug notifier */
607 register_hotcpu_notifier(&appldata_nb); 607 register_hotcpu_notifier(&appldata_nb);
608 608
609 appldata_sysctl_header = register_sysctl_table(appldata_dir_table, 1); 609 appldata_sysctl_header = register_sysctl_table(appldata_dir_table);
610#ifdef MODULE 610#ifdef MODULE
611 appldata_dir_table[0].de->owner = THIS_MODULE; 611 appldata_dir_table[0].de->owner = THIS_MODULE;
612 appldata_table[0].de->owner = THIS_MODULE; 612 appldata_table[0].de->owner = THIS_MODULE;
diff --git a/arch/s390/kernel/debug.c b/arch/s390/kernel/debug.c
index 51653d82d7df..eca3fe595ff4 100644
--- a/arch/s390/kernel/debug.c
+++ b/arch/s390/kernel/debug.c
@@ -852,7 +852,6 @@ debug_finish_entry(debug_info_t * id, debug_entry_t* active, int level,
852static int debug_stoppable=1; 852static int debug_stoppable=1;
853static int debug_active=1; 853static int debug_active=1;
854 854
855#define CTL_S390DBF 5677
856#define CTL_S390DBF_STOPPABLE 5678 855#define CTL_S390DBF_STOPPABLE 5678
857#define CTL_S390DBF_ACTIVE 5679 856#define CTL_S390DBF_ACTIVE 5679
858 857
@@ -1054,7 +1053,7 @@ __init debug_init(void)
1054{ 1053{
1055 int rc = 0; 1054 int rc = 0;
1056 1055
1057 s390dbf_sysctl_header = register_sysctl_table(s390dbf_dir_table, 1); 1056 s390dbf_sysctl_header = register_sysctl_table(s390dbf_dir_table);
1058 down(&debug_lock); 1057 down(&debug_lock);
1059 debug_debugfs_root_entry = debugfs_create_dir(DEBUG_DIR_ROOT,NULL); 1058 debug_debugfs_root_entry = debugfs_create_dir(DEBUG_DIR_ROOT,NULL);
1060 printk(KERN_INFO "debug: Initialization complete\n"); 1059 printk(KERN_INFO "debug: Initialization complete\n");
diff --git a/arch/s390/mm/cmm.c b/arch/s390/mm/cmm.c
index f93a056869bc..c5b2f4f078bc 100644
--- a/arch/s390/mm/cmm.c
+++ b/arch/s390/mm/cmm.c
@@ -256,10 +256,6 @@ cmm_skip_blanks(char *cp, char **endp)
256} 256}
257 257
258#ifdef CONFIG_CMM_PROC 258#ifdef CONFIG_CMM_PROC
259/* These will someday get removed. */
260#define VM_CMM_PAGES 1111
261#define VM_CMM_TIMED_PAGES 1112
262#define VM_CMM_TIMEOUT 1113
263 259
264static struct ctl_table cmm_table[]; 260static struct ctl_table cmm_table[];
265 261
@@ -422,7 +418,7 @@ cmm_init (void)
422 int rc = -ENOMEM; 418 int rc = -ENOMEM;
423 419
424#ifdef CONFIG_CMM_PROC 420#ifdef CONFIG_CMM_PROC
425 cmm_sysctl_header = register_sysctl_table(cmm_dir_table, 1); 421 cmm_sysctl_header = register_sysctl_table(cmm_dir_table);
426 if (!cmm_sysctl_header) 422 if (!cmm_sysctl_header)
427 goto out; 423 goto out;
428#endif 424#endif
diff --git a/arch/sh64/kernel/traps.c b/arch/sh64/kernel/traps.c
index 224b7f5b9224..c346d7ef9280 100644
--- a/arch/sh64/kernel/traps.c
+++ b/arch/sh64/kernel/traps.c
@@ -910,30 +910,57 @@ static int misaligned_fixup(struct pt_regs *regs)
910} 910}
911 911
912static ctl_table unaligned_table[] = { 912static ctl_table unaligned_table[] = {
913 {1, "kernel_reports", &kernel_mode_unaligned_fixup_count, 913 {
914 sizeof(int), 0644, NULL, &proc_dointvec}, 914 .ctl_name = CTL_UNNUMBERED,
915 .procname = "kernel_reports",
916 .data = &kernel_mode_unaligned_fixup_count,
917 .maxlen = sizeof(int),
918 .mode = 0644,
919 .proc_handler = &proc_dointvec
920 },
915#if defined(CONFIG_SH64_USER_MISALIGNED_FIXUP) 921#if defined(CONFIG_SH64_USER_MISALIGNED_FIXUP)
916 {2, "user_reports", &user_mode_unaligned_fixup_count, 922 {
917 sizeof(int), 0644, NULL, &proc_dointvec}, 923 .ctl_name = CTL_UNNUMBERED,
918 {3, "user_enable", &user_mode_unaligned_fixup_enable, 924 .procname = "user_reports",
919 sizeof(int), 0644, NULL, &proc_dointvec}, 925 .data = &user_mode_unaligned_fixup_count,
926 .maxlen = sizeof(int),
927 .mode = 0644,
928 .proc_handler = &proc_dointvec
929 },
930 {
931 .ctl_name = CTL_UNNUMBERED,
932 .procname = "user_enable",
933 .data = &user_mode_unaligned_fixup_enable,
934 .maxlen = sizeof(int),
935 .mode = 0644,
936 .proc_handler = &proc_dointvec},
920#endif 937#endif
921 {0} 938 {}
922}; 939};
923 940
924static ctl_table unaligned_root[] = { 941static ctl_table unaligned_root[] = {
925 {1, "unaligned_fixup", NULL, 0, 0555, unaligned_table}, 942 {
926 {0} 943 .ctl_name = CTL_UNNUMBERED,
944 .procname = "unaligned_fixup",
945 .mode = 0555,
946 unaligned_table
947 },
948 {}
927}; 949};
928 950
929static ctl_table sh64_root[] = { 951static ctl_table sh64_root[] = {
930 {1, "sh64", NULL, 0, 0555, unaligned_root}, 952 {
931 {0} 953 .ctl_name = CTL_UNNUMBERED,
954 .procname = "sh64",
955 .mode = 0555,
956 .child = unaligned_root
957 },
958 {}
932}; 959};
933static struct ctl_table_header *sysctl_header; 960static struct ctl_table_header *sysctl_header;
934static int __init init_sysctl(void) 961static int __init init_sysctl(void)
935{ 962{
936 sysctl_header = register_sysctl_table(sh64_root, 0); 963 sysctl_header = register_sysctl_table(sh64_root);
937 return 0; 964 return 0;
938} 965}
939 966
diff --git a/arch/x86_64/Kconfig b/arch/x86_64/Kconfig
index 02dd39457bcf..7982cbc3bc94 100644
--- a/arch/x86_64/Kconfig
+++ b/arch/x86_64/Kconfig
@@ -152,18 +152,18 @@ config MPSC
152 Optimize for Intel Pentium 4 and older Nocona/Dempsey Xeon CPUs 152 Optimize for Intel Pentium 4 and older Nocona/Dempsey Xeon CPUs
153 with Intel Extended Memory 64 Technology(EM64T). For details see 153 with Intel Extended Memory 64 Technology(EM64T). For details see
154 <http://www.intel.com/technology/64bitextensions/>. 154 <http://www.intel.com/technology/64bitextensions/>.
155 Note the the latest Xeons (Xeon 51xx and 53xx) are not based on the 155 Note that the latest Xeons (Xeon 51xx and 53xx) are not based on the
156 Netburst core and shouldn't use this option. You can distingush them 156 Netburst core and shouldn't use this option. You can distinguish them
157 using the cpu family field 157 using the cpu family field
158 in /proc/cpuinfo. Family 15 is a older Xeon, Family 6 a newer one 158 in /proc/cpuinfo. Family 15 is an older Xeon, Family 6 a newer one
159 (this rule only applies to system that support EM64T) 159 (this rule only applies to systems that support EM64T)
160 160
161config MCORE2 161config MCORE2
162 bool "Intel Core2 / newer Xeon" 162 bool "Intel Core2 / newer Xeon"
163 help 163 help
164 Optimize for Intel Core2 and newer Xeons (51xx) 164 Optimize for Intel Core2 and newer Xeons (51xx)
165 You can distingush the newer Xeons from the older ones using 165 You can distinguish the newer Xeons from the older ones using
166 the cpu family field in /proc/cpuinfo. 15 is a older Xeon 166 the cpu family field in /proc/cpuinfo. 15 is an older Xeon
167 (use CONFIG_MPSC then), 6 is a newer one. This rule only 167 (use CONFIG_MPSC then), 6 is a newer one. This rule only
168 applies to CPUs that support EM64T. 168 applies to CPUs that support EM64T.
169 169
@@ -458,8 +458,8 @@ config IOMMU
458 on systems with more than 3GB. This is usually needed for USB, 458 on systems with more than 3GB. This is usually needed for USB,
459 sound, many IDE/SATA chipsets and some other devices. 459 sound, many IDE/SATA chipsets and some other devices.
460 Provides a driver for the AMD Athlon64/Opteron/Turion/Sempron GART 460 Provides a driver for the AMD Athlon64/Opteron/Turion/Sempron GART
461 based IOMMU and a software bounce buffer based IOMMU used on Intel 461 based hardware IOMMU and a software bounce buffer based IOMMU used
462 systems and as fallback. 462 on Intel systems and as fallback.
463 The code is only active when needed (enough memory and limited 463 The code is only active when needed (enough memory and limited
464 device) unless CONFIG_IOMMU_DEBUG or iommu=force is specified 464 device) unless CONFIG_IOMMU_DEBUG or iommu=force is specified
465 too. 465 too.
@@ -496,6 +496,12 @@ config CALGARY_IOMMU_ENABLED_BY_DEFAULT
496# need this always selected by IOMMU for the VIA workaround 496# need this always selected by IOMMU for the VIA workaround
497config SWIOTLB 497config SWIOTLB
498 bool 498 bool
499 help
500 Support for software bounce buffers used on x86-64 systems
501 which don't have a hardware IOMMU (e.g. the current generation
502 of Intel's x86-64 CPUs). Using this PCI devices which can only
503 access 32-bits of memory can be used on systems with more than
504 3 GB of memory. If unsure, say Y.
499 505
500config X86_MCE 506config X86_MCE
501 bool "Machine check support" if EMBEDDED 507 bool "Machine check support" if EMBEDDED
diff --git a/arch/x86_64/defconfig b/arch/x86_64/defconfig
index 69584c295305..293a4a4c609e 100644
--- a/arch/x86_64/defconfig
+++ b/arch/x86_64/defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.20-rc3 3# Linux kernel version: 2.6.20-git8
4# Fri Jan 5 11:54:41 2007 4# Tue Feb 13 11:25:16 2007
5# 5#
6CONFIG_X86_64=y 6CONFIG_X86_64=y
7CONFIG_64BIT=y 7CONFIG_64BIT=y
@@ -11,6 +11,7 @@ CONFIG_LOCKDEP_SUPPORT=y
11CONFIG_STACKTRACE_SUPPORT=y 11CONFIG_STACKTRACE_SUPPORT=y
12CONFIG_SEMAPHORE_SLEEPERS=y 12CONFIG_SEMAPHORE_SLEEPERS=y
13CONFIG_MMU=y 13CONFIG_MMU=y
14CONFIG_ZONE_DMA=y
14CONFIG_RWSEM_GENERIC_SPINLOCK=y 15CONFIG_RWSEM_GENERIC_SPINLOCK=y
15CONFIG_GENERIC_HWEIGHT=y 16CONFIG_GENERIC_HWEIGHT=y
16CONFIG_GENERIC_CALIBRATE_DELAY=y 17CONFIG_GENERIC_CALIBRATE_DELAY=y
@@ -153,6 +154,7 @@ CONFIG_NEED_MULTIPLE_NODES=y
153CONFIG_SPLIT_PTLOCK_CPUS=4 154CONFIG_SPLIT_PTLOCK_CPUS=4
154CONFIG_MIGRATION=y 155CONFIG_MIGRATION=y
155CONFIG_RESOURCES_64BIT=y 156CONFIG_RESOURCES_64BIT=y
157CONFIG_ZONE_DMA_FLAG=1
156CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID=y 158CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID=y
157CONFIG_OUT_OF_LINE_PFN_TO_PAGE=y 159CONFIG_OUT_OF_LINE_PFN_TO_PAGE=y
158CONFIG_NR_CPUS=32 160CONFIG_NR_CPUS=32
@@ -201,13 +203,14 @@ CONFIG_ACPI=y
201CONFIG_ACPI_SLEEP=y 203CONFIG_ACPI_SLEEP=y
202CONFIG_ACPI_SLEEP_PROC_FS=y 204CONFIG_ACPI_SLEEP_PROC_FS=y
203CONFIG_ACPI_SLEEP_PROC_SLEEP=y 205CONFIG_ACPI_SLEEP_PROC_SLEEP=y
206CONFIG_ACPI_PROCFS=y
204CONFIG_ACPI_AC=y 207CONFIG_ACPI_AC=y
205CONFIG_ACPI_BATTERY=y 208CONFIG_ACPI_BATTERY=y
206CONFIG_ACPI_BUTTON=y 209CONFIG_ACPI_BUTTON=y
207# CONFIG_ACPI_VIDEO is not set
208# CONFIG_ACPI_HOTKEY is not set 210# CONFIG_ACPI_HOTKEY is not set
209CONFIG_ACPI_FAN=y 211CONFIG_ACPI_FAN=y
210# CONFIG_ACPI_DOCK is not set 212# CONFIG_ACPI_DOCK is not set
213# CONFIG_ACPI_BAY is not set
211CONFIG_ACPI_PROCESSOR=y 214CONFIG_ACPI_PROCESSOR=y
212CONFIG_ACPI_HOTPLUG_CPU=y 215CONFIG_ACPI_HOTPLUG_CPU=y
213CONFIG_ACPI_THERMAL=y 216CONFIG_ACPI_THERMAL=y
@@ -263,7 +266,6 @@ CONFIG_PCI_MMCONFIG=y
263CONFIG_PCIEPORTBUS=y 266CONFIG_PCIEPORTBUS=y
264CONFIG_PCIEAER=y 267CONFIG_PCIEAER=y
265CONFIG_PCI_MSI=y 268CONFIG_PCI_MSI=y
266# CONFIG_PCI_MULTITHREAD_PROBE is not set
267# CONFIG_PCI_DEBUG is not set 269# CONFIG_PCI_DEBUG is not set
268# CONFIG_HT_IRQ is not set 270# CONFIG_HT_IRQ is not set
269 271
@@ -398,6 +400,7 @@ CONFIG_STANDALONE=y
398CONFIG_PREVENT_FIRMWARE_BUILD=y 400CONFIG_PREVENT_FIRMWARE_BUILD=y
399CONFIG_FW_LOADER=y 401CONFIG_FW_LOADER=y
400# CONFIG_DEBUG_DRIVER is not set 402# CONFIG_DEBUG_DRIVER is not set
403# CONFIG_DEBUG_DEVRES is not set
401# CONFIG_SYS_HYPERVISOR is not set 404# CONFIG_SYS_HYPERVISOR is not set
402 405
403# 406#
@@ -466,6 +469,7 @@ CONFIG_BLK_DEV_IDECD=y
466# CONFIG_BLK_DEV_IDETAPE is not set 469# CONFIG_BLK_DEV_IDETAPE is not set
467# CONFIG_BLK_DEV_IDEFLOPPY is not set 470# CONFIG_BLK_DEV_IDEFLOPPY is not set
468# CONFIG_BLK_DEV_IDESCSI is not set 471# CONFIG_BLK_DEV_IDESCSI is not set
472CONFIG_BLK_DEV_IDEACPI=y
469# CONFIG_IDE_TASK_IOCTL is not set 473# CONFIG_IDE_TASK_IOCTL is not set
470 474
471# 475#
@@ -497,6 +501,7 @@ CONFIG_BLK_DEV_ATIIXP=y
497# CONFIG_BLK_DEV_JMICRON is not set 501# CONFIG_BLK_DEV_JMICRON is not set
498# CONFIG_BLK_DEV_SC1200 is not set 502# CONFIG_BLK_DEV_SC1200 is not set
499CONFIG_BLK_DEV_PIIX=y 503CONFIG_BLK_DEV_PIIX=y
504# CONFIG_BLK_DEV_IT8213 is not set
500# CONFIG_BLK_DEV_IT821X is not set 505# CONFIG_BLK_DEV_IT821X is not set
501# CONFIG_BLK_DEV_NS87415 is not set 506# CONFIG_BLK_DEV_NS87415 is not set
502# CONFIG_BLK_DEV_PDC202XX_OLD is not set 507# CONFIG_BLK_DEV_PDC202XX_OLD is not set
@@ -507,6 +512,7 @@ CONFIG_BLK_DEV_PDC202XX_NEW=y
507# CONFIG_BLK_DEV_SLC90E66 is not set 512# CONFIG_BLK_DEV_SLC90E66 is not set
508# CONFIG_BLK_DEV_TRM290 is not set 513# CONFIG_BLK_DEV_TRM290 is not set
509# CONFIG_BLK_DEV_VIA82CXXX is not set 514# CONFIG_BLK_DEV_VIA82CXXX is not set
515# CONFIG_BLK_DEV_TC86C001 is not set
510# CONFIG_IDE_ARM is not set 516# CONFIG_IDE_ARM is not set
511CONFIG_BLK_DEV_IDEDMA=y 517CONFIG_BLK_DEV_IDEDMA=y
512# CONFIG_IDEDMA_IVB is not set 518# CONFIG_IDEDMA_IVB is not set
@@ -599,6 +605,7 @@ CONFIG_MEGARAID_SAS=y
599# Serial ATA (prod) and Parallel ATA (experimental) drivers 605# Serial ATA (prod) and Parallel ATA (experimental) drivers
600# 606#
601CONFIG_ATA=y 607CONFIG_ATA=y
608# CONFIG_ATA_NONSTANDARD is not set
602CONFIG_SATA_AHCI=y 609CONFIG_SATA_AHCI=y
603CONFIG_SATA_SVW=y 610CONFIG_SATA_SVW=y
604CONFIG_ATA_PIIX=y 611CONFIG_ATA_PIIX=y
@@ -614,6 +621,7 @@ CONFIG_SATA_SIL=y
614# CONFIG_SATA_ULI is not set 621# CONFIG_SATA_ULI is not set
615CONFIG_SATA_VIA=y 622CONFIG_SATA_VIA=y
616# CONFIG_SATA_VITESSE is not set 623# CONFIG_SATA_VITESSE is not set
624# CONFIG_SATA_INIC162X is not set
617CONFIG_SATA_INTEL_COMBINED=y 625CONFIG_SATA_INTEL_COMBINED=y
618# CONFIG_PATA_ALI is not set 626# CONFIG_PATA_ALI is not set
619# CONFIG_PATA_AMD is not set 627# CONFIG_PATA_AMD is not set
@@ -630,6 +638,7 @@ CONFIG_SATA_INTEL_COMBINED=y
630# CONFIG_PATA_HPT3X2N is not set 638# CONFIG_PATA_HPT3X2N is not set
631# CONFIG_PATA_HPT3X3 is not set 639# CONFIG_PATA_HPT3X3 is not set
632# CONFIG_PATA_IT821X is not set 640# CONFIG_PATA_IT821X is not set
641# CONFIG_PATA_IT8213 is not set
633# CONFIG_PATA_JMICRON is not set 642# CONFIG_PATA_JMICRON is not set
634# CONFIG_PATA_TRIFLEX is not set 643# CONFIG_PATA_TRIFLEX is not set
635# CONFIG_PATA_MARVELL is not set 644# CONFIG_PATA_MARVELL is not set
@@ -682,9 +691,7 @@ CONFIG_IEEE1394=y
682# Subsystem Options 691# Subsystem Options
683# 692#
684# CONFIG_IEEE1394_VERBOSEDEBUG is not set 693# CONFIG_IEEE1394_VERBOSEDEBUG is not set
685# CONFIG_IEEE1394_OUI_DB is not set
686# CONFIG_IEEE1394_EXTRA_CONFIG_ROMS is not set 694# CONFIG_IEEE1394_EXTRA_CONFIG_ROMS is not set
687# CONFIG_IEEE1394_EXPORT_FULL_API is not set
688 695
689# 696#
690# Device Drivers 697# Device Drivers
@@ -707,6 +714,11 @@ CONFIG_IEEE1394_RAWIO=y
707# CONFIG_I2O is not set 714# CONFIG_I2O is not set
708 715
709# 716#
717# Macintosh device drivers
718#
719# CONFIG_MAC_EMUMOUSEBTN is not set
720
721#
710# Network device support 722# Network device support
711# 723#
712CONFIG_NETDEVICES=y 724CONFIG_NETDEVICES=y
@@ -774,6 +786,7 @@ CONFIG_8139TOO=y
774# CONFIG_EPIC100 is not set 786# CONFIG_EPIC100 is not set
775# CONFIG_SUNDANCE is not set 787# CONFIG_SUNDANCE is not set
776# CONFIG_VIA_RHINE is not set 788# CONFIG_VIA_RHINE is not set
789# CONFIG_SC92031 is not set
777 790
778# 791#
779# Ethernet (1000 Mbit) 792# Ethernet (1000 Mbit)
@@ -795,11 +808,13 @@ CONFIG_E1000=y
795CONFIG_TIGON3=y 808CONFIG_TIGON3=y
796CONFIG_BNX2=y 809CONFIG_BNX2=y
797# CONFIG_QLA3XXX is not set 810# CONFIG_QLA3XXX is not set
811# CONFIG_ATL1 is not set
798 812
799# 813#
800# Ethernet (10000 Mbit) 814# Ethernet (10000 Mbit)
801# 815#
802# CONFIG_CHELSIO_T1 is not set 816# CONFIG_CHELSIO_T1 is not set
817# CONFIG_CHELSIO_T3 is not set
803# CONFIG_IXGB is not set 818# CONFIG_IXGB is not set
804CONFIG_S2IO=m 819CONFIG_S2IO=m
805# CONFIG_S2IO_NAPI is not set 820# CONFIG_S2IO_NAPI is not set
@@ -1115,6 +1130,7 @@ CONFIG_SOUND=y
1115# Open Sound System 1130# Open Sound System
1116# 1131#
1117CONFIG_SOUND_PRIME=y 1132CONFIG_SOUND_PRIME=y
1133CONFIG_OBSOLETE_OSS=y
1118# CONFIG_SOUND_BT878 is not set 1134# CONFIG_SOUND_BT878 is not set
1119# CONFIG_SOUND_ES1371 is not set 1135# CONFIG_SOUND_ES1371 is not set
1120CONFIG_SOUND_ICH=y 1136CONFIG_SOUND_ICH=y
@@ -1128,6 +1144,7 @@ CONFIG_SOUND_ICH=y
1128# HID Devices 1144# HID Devices
1129# 1145#
1130CONFIG_HID=y 1146CONFIG_HID=y
1147# CONFIG_HID_DEBUG is not set
1131 1148
1132# 1149#
1133# USB support 1150# USB support
@@ -1142,10 +1159,8 @@ CONFIG_USB=y
1142# Miscellaneous USB options 1159# Miscellaneous USB options
1143# 1160#
1144CONFIG_USB_DEVICEFS=y 1161CONFIG_USB_DEVICEFS=y
1145# CONFIG_USB_BANDWIDTH is not set
1146# CONFIG_USB_DYNAMIC_MINORS is not set 1162# CONFIG_USB_DYNAMIC_MINORS is not set
1147# CONFIG_USB_SUSPEND is not set 1163# CONFIG_USB_SUSPEND is not set
1148# CONFIG_USB_MULTITHREAD_PROBE is not set
1149# CONFIG_USB_OTG is not set 1164# CONFIG_USB_OTG is not set
1150 1165
1151# 1166#
@@ -1155,9 +1170,11 @@ CONFIG_USB_EHCI_HCD=y
1155# CONFIG_USB_EHCI_SPLIT_ISO is not set 1170# CONFIG_USB_EHCI_SPLIT_ISO is not set
1156# CONFIG_USB_EHCI_ROOT_HUB_TT is not set 1171# CONFIG_USB_EHCI_ROOT_HUB_TT is not set
1157# CONFIG_USB_EHCI_TT_NEWSCHED is not set 1172# CONFIG_USB_EHCI_TT_NEWSCHED is not set
1173# CONFIG_USB_EHCI_BIG_ENDIAN_MMIO is not set
1158# CONFIG_USB_ISP116X_HCD is not set 1174# CONFIG_USB_ISP116X_HCD is not set
1159CONFIG_USB_OHCI_HCD=y 1175CONFIG_USB_OHCI_HCD=y
1160# CONFIG_USB_OHCI_BIG_ENDIAN is not set 1176# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
1177# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
1161CONFIG_USB_OHCI_LITTLE_ENDIAN=y 1178CONFIG_USB_OHCI_LITTLE_ENDIAN=y
1162CONFIG_USB_UHCI_HCD=y 1179CONFIG_USB_UHCI_HCD=y
1163# CONFIG_USB_SL811_HCD is not set 1180# CONFIG_USB_SL811_HCD is not set
@@ -1208,6 +1225,7 @@ CONFIG_USB_HID=y
1208# CONFIG_USB_ATI_REMOTE2 is not set 1225# CONFIG_USB_ATI_REMOTE2 is not set
1209# CONFIG_USB_KEYSPAN_REMOTE is not set 1226# CONFIG_USB_KEYSPAN_REMOTE is not set
1210# CONFIG_USB_APPLETOUCH is not set 1227# CONFIG_USB_APPLETOUCH is not set
1228# CONFIG_USB_GTCO is not set
1211 1229
1212# 1230#
1213# USB Imaging devices 1231# USB Imaging devices
@@ -1313,6 +1331,10 @@ CONFIG_USB_MON=y
1313# 1331#
1314 1332
1315# 1333#
1334# Auxiliary Display support
1335#
1336
1337#
1316# Virtualization 1338# Virtualization
1317# 1339#
1318# CONFIG_KVM is not set 1340# CONFIG_KVM is not set
@@ -1512,6 +1534,7 @@ CONFIG_UNUSED_SYMBOLS=y
1512CONFIG_DEBUG_FS=y 1534CONFIG_DEBUG_FS=y
1513# CONFIG_HEADERS_CHECK is not set 1535# CONFIG_HEADERS_CHECK is not set
1514CONFIG_DEBUG_KERNEL=y 1536CONFIG_DEBUG_KERNEL=y
1537# CONFIG_DEBUG_SHIRQ is not set
1515CONFIG_LOG_BUF_SHIFT=18 1538CONFIG_LOG_BUF_SHIFT=18
1516CONFIG_DETECT_SOFTLOCKUP=y 1539CONFIG_DETECT_SOFTLOCKUP=y
1517# CONFIG_SCHEDSTATS is not set 1540# CONFIG_SCHEDSTATS is not set
@@ -1520,7 +1543,6 @@ CONFIG_DETECT_SOFTLOCKUP=y
1520# CONFIG_RT_MUTEX_TESTER is not set 1543# CONFIG_RT_MUTEX_TESTER is not set
1521# CONFIG_DEBUG_SPINLOCK is not set 1544# CONFIG_DEBUG_SPINLOCK is not set
1522# CONFIG_DEBUG_MUTEXES is not set 1545# CONFIG_DEBUG_MUTEXES is not set
1523# CONFIG_DEBUG_RWSEMS is not set
1524# CONFIG_DEBUG_LOCK_ALLOC is not set 1546# CONFIG_DEBUG_LOCK_ALLOC is not set
1525# CONFIG_PROVE_LOCKING is not set 1547# CONFIG_PROVE_LOCKING is not set
1526# CONFIG_DEBUG_SPINLOCK_SLEEP is not set 1548# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
@@ -1560,4 +1582,5 @@ CONFIG_CRC32=y
1560# CONFIG_LIBCRC32C is not set 1582# CONFIG_LIBCRC32C is not set
1561CONFIG_ZLIB_INFLATE=y 1583CONFIG_ZLIB_INFLATE=y
1562CONFIG_PLIST=y 1584CONFIG_PLIST=y
1563CONFIG_IOMAP_COPY=y 1585CONFIG_HAS_IOMEM=y
1586CONFIG_HAS_IOPORT=y
diff --git a/arch/x86_64/ia32/ia32_binfmt.c b/arch/x86_64/ia32/ia32_binfmt.c
index 6efe04f3cbca..071100ea1251 100644
--- a/arch/x86_64/ia32/ia32_binfmt.c
+++ b/arch/x86_64/ia32/ia32_binfmt.c
@@ -344,20 +344,30 @@ EXPORT_SYMBOL(ia32_setup_arg_pages);
344#include <linux/sysctl.h> 344#include <linux/sysctl.h>
345 345
346static ctl_table abi_table2[] = { 346static ctl_table abi_table2[] = {
347 { 99, "vsyscall32", &sysctl_vsyscall32, sizeof(int), 0644, NULL, 347 {
348 proc_dointvec }, 348 .ctl_name = 99,
349 { 0, } 349 .procname = "vsyscall32",
350}; 350 .data = &sysctl_vsyscall32,
351 .maxlen = sizeof(int),
352 .mode = 0644,
353 .proc_handler = proc_dointvec
354 },
355 {}
356};
351 357
352static ctl_table abi_root_table2[] = { 358static ctl_table abi_root_table2[] = {
353 { .ctl_name = CTL_ABI, .procname = "abi", .mode = 0555, 359 {
354 .child = abi_table2 }, 360 .ctl_name = CTL_ABI,
355 { 0 }, 361 .procname = "abi",
356}; 362 .mode = 0555,
363 .child = abi_table2
364 },
365 {}
366};
357 367
358static __init int ia32_binfmt_init(void) 368static __init int ia32_binfmt_init(void)
359{ 369{
360 register_sysctl_table(abi_root_table2, 1); 370 register_sysctl_table(abi_root_table2);
361 return 0; 371 return 0;
362} 372}
363__initcall(ia32_binfmt_init); 373__initcall(ia32_binfmt_init);
diff --git a/arch/x86_64/ia32/ia32_signal.c b/arch/x86_64/ia32/ia32_signal.c
index ff499ef2a1ba..359eacc38509 100644
--- a/arch/x86_64/ia32/ia32_signal.c
+++ b/arch/x86_64/ia32/ia32_signal.c
@@ -21,6 +21,7 @@
21#include <linux/stddef.h> 21#include <linux/stddef.h>
22#include <linux/personality.h> 22#include <linux/personality.h>
23#include <linux/compat.h> 23#include <linux/compat.h>
24#include <linux/binfmts.h>
24#include <asm/ucontext.h> 25#include <asm/ucontext.h>
25#include <asm/uaccess.h> 26#include <asm/uaccess.h>
26#include <asm/i387.h> 27#include <asm/i387.h>
@@ -449,7 +450,11 @@ int ia32_setup_frame(int sig, struct k_sigaction *ka,
449 450
450 /* Return stub is in 32bit vsyscall page */ 451 /* Return stub is in 32bit vsyscall page */
451 { 452 {
452 void __user *restorer = VSYSCALL32_SIGRETURN; 453 void __user *restorer;
454 if (current->binfmt->hasvdso)
455 restorer = VSYSCALL32_SIGRETURN;
456 else
457 restorer = (void *)&frame->retcode;
453 if (ka->sa.sa_flags & SA_RESTORER) 458 if (ka->sa.sa_flags & SA_RESTORER)
454 restorer = ka->sa.sa_restorer; 459 restorer = ka->sa.sa_restorer;
455 err |= __put_user(ptr_to_compat(restorer), &frame->pretcode); 460 err |= __put_user(ptr_to_compat(restorer), &frame->pretcode);
@@ -495,7 +500,7 @@ int ia32_setup_frame(int sig, struct k_sigaction *ka,
495 ptrace_notify(SIGTRAP); 500 ptrace_notify(SIGTRAP);
496 501
497#if DEBUG_SIG 502#if DEBUG_SIG
498 printk("SIG deliver (%s:%d): sp=%p pc=%p ra=%p\n", 503 printk("SIG deliver (%s:%d): sp=%p pc=%lx ra=%u\n",
499 current->comm, current->pid, frame, regs->rip, frame->pretcode); 504 current->comm, current->pid, frame, regs->rip, frame->pretcode);
500#endif 505#endif
501 506
@@ -601,7 +606,7 @@ int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
601 ptrace_notify(SIGTRAP); 606 ptrace_notify(SIGTRAP);
602 607
603#if DEBUG_SIG 608#if DEBUG_SIG
604 printk("SIG deliver (%s:%d): sp=%p pc=%p ra=%p\n", 609 printk("SIG deliver (%s:%d): sp=%p pc=%lx ra=%u\n",
605 current->comm, current->pid, frame, regs->rip, frame->pretcode); 610 current->comm, current->pid, frame, regs->rip, frame->pretcode);
606#endif 611#endif
607 612
diff --git a/arch/x86_64/ia32/ia32entry.S b/arch/x86_64/ia32/ia32entry.S
index 5f32cf4de5fb..eda7a0d4dc15 100644
--- a/arch/x86_64/ia32/ia32entry.S
+++ b/arch/x86_64/ia32/ia32entry.S
@@ -718,4 +718,5 @@ ia32_sys_call_table:
718 .quad compat_sys_vmsplice 718 .quad compat_sys_vmsplice
719 .quad compat_sys_move_pages 719 .quad compat_sys_move_pages
720 .quad sys_getcpu 720 .quad sys_getcpu
721 .quad sys_epoll_pwait
721ia32_syscall_end: 722ia32_syscall_end:
diff --git a/arch/x86_64/kernel/Makefile b/arch/x86_64/kernel/Makefile
index 3c7cbff04d3d..ae399458024b 100644
--- a/arch/x86_64/kernel/Makefile
+++ b/arch/x86_64/kernel/Makefile
@@ -43,6 +43,7 @@ obj-$(CONFIG_PCI) += early-quirks.o
43 43
44obj-y += topology.o 44obj-y += topology.o
45obj-y += intel_cacheinfo.o 45obj-y += intel_cacheinfo.o
46obj-y += pcspeaker.o
46 47
47CFLAGS_vsyscall.o := $(PROFILING) -g0 48CFLAGS_vsyscall.o := $(PROFILING) -g0
48 49
@@ -56,3 +57,4 @@ quirks-y += ../../i386/kernel/quirks.o
56i8237-y += ../../i386/kernel/i8237.o 57i8237-y += ../../i386/kernel/i8237.o
57msr-$(subst m,y,$(CONFIG_X86_MSR)) += ../../i386/kernel/msr.o 58msr-$(subst m,y,$(CONFIG_X86_MSR)) += ../../i386/kernel/msr.o
58alternative-y += ../../i386/kernel/alternative.o 59alternative-y += ../../i386/kernel/alternative.o
60pcspeaker-y += ../../i386/kernel/pcspeaker.o
diff --git a/arch/x86_64/kernel/acpi/sleep.c b/arch/x86_64/kernel/acpi/sleep.c
index 5ebf62c7a3d2..23178ce6c783 100644
--- a/arch/x86_64/kernel/acpi/sleep.c
+++ b/arch/x86_64/kernel/acpi/sleep.c
@@ -58,7 +58,7 @@ unsigned long acpi_wakeup_address = 0;
58unsigned long acpi_video_flags; 58unsigned long acpi_video_flags;
59extern char wakeup_start, wakeup_end; 59extern char wakeup_start, wakeup_end;
60 60
61extern unsigned long FASTCALL(acpi_copy_wakeup_routine(unsigned long)); 61extern unsigned long acpi_copy_wakeup_routine(unsigned long);
62 62
63static pgd_t low_ptr; 63static pgd_t low_ptr;
64 64
diff --git a/arch/x86_64/kernel/e820.c b/arch/x86_64/kernel/e820.c
index 6fe191c58084..4651fd22b213 100644
--- a/arch/x86_64/kernel/e820.c
+++ b/arch/x86_64/kernel/e820.c
@@ -83,6 +83,13 @@ static inline int bad_addr(unsigned long *addrp, unsigned long size)
83 return 1; 83 return 1;
84 } 84 }
85 85
86#ifdef CONFIG_NUMA
87 /* NUMA memory to node map */
88 if (last >= nodemap_addr && addr < nodemap_addr + nodemap_size) {
89 *addrp = nodemap_addr + nodemap_size;
90 return 1;
91 }
92#endif
86 /* XXX ramdisk image here? */ 93 /* XXX ramdisk image here? */
87 return 0; 94 return 0;
88} 95}
@@ -184,6 +191,37 @@ unsigned long __init e820_end_of_ram(void)
184} 191}
185 192
186/* 193/*
194 * Find the hole size in the range.
195 */
196unsigned long __init e820_hole_size(unsigned long start, unsigned long end)
197{
198 unsigned long ram = 0;
199 int i;
200
201 for (i = 0; i < e820.nr_map; i++) {
202 struct e820entry *ei = &e820.map[i];
203 unsigned long last, addr;
204
205 if (ei->type != E820_RAM ||
206 ei->addr+ei->size <= start ||
207 ei->addr >= end)
208 continue;
209
210 addr = round_up(ei->addr, PAGE_SIZE);
211 if (addr < start)
212 addr = start;
213
214 last = round_down(ei->addr + ei->size, PAGE_SIZE);
215 if (last >= end)
216 last = end;
217
218 if (last > addr)
219 ram += last - addr;
220 }
221 return ((end - start) - ram);
222}
223
224/*
187 * Mark e820 reserved areas as busy for the resource manager. 225 * Mark e820 reserved areas as busy for the resource manager.
188 */ 226 */
189void __init e820_reserve_resources(void) 227void __init e820_reserve_resources(void)
diff --git a/arch/x86_64/kernel/head.S b/arch/x86_64/kernel/head.S
index 1e6f80870679..598a4d0351fc 100644
--- a/arch/x86_64/kernel/head.S
+++ b/arch/x86_64/kernel/head.S
@@ -163,6 +163,20 @@ startup_64:
163 */ 163 */
164 lgdt cpu_gdt_descr 164 lgdt cpu_gdt_descr
165 165
166 /* set up data segments. actually 0 would do too */
167 movl $__KERNEL_DS,%eax
168 movl %eax,%ds
169 movl %eax,%ss
170 movl %eax,%es
171
172 /*
173 * We don't really need to load %fs or %gs, but load them anyway
174 * to kill any stale realmode selectors. This allows execution
175 * under VT hardware.
176 */
177 movl %eax,%fs
178 movl %eax,%gs
179
166 /* 180 /*
167 * Setup up a dummy PDA. this is just for some early bootup code 181 * Setup up a dummy PDA. this is just for some early bootup code
168 * that does in_interrupt() 182 * that does in_interrupt()
@@ -173,12 +187,6 @@ startup_64:
173 shrq $32,%rdx 187 shrq $32,%rdx
174 wrmsr 188 wrmsr
175 189
176 /* set up data segments. actually 0 would do too */
177 movl $__KERNEL_DS,%eax
178 movl %eax,%ds
179 movl %eax,%ss
180 movl %eax,%es
181
182 /* esi is pointer to real mode structure with interesting info. 190 /* esi is pointer to real mode structure with interesting info.
183 pass it to C */ 191 pass it to C */
184 movl %esi, %edi 192 movl %esi, %edi
diff --git a/arch/x86_64/kernel/io_apic.c b/arch/x86_64/kernel/io_apic.c
index 6be6730acb5c..566e64d966c4 100644
--- a/arch/x86_64/kernel/io_apic.c
+++ b/arch/x86_64/kernel/io_apic.c
@@ -831,7 +831,7 @@ static void __init setup_IO_APIC_irq(int apic, int pin, int idx, int irq)
831 entry.delivery_mode = INT_DELIVERY_MODE; 831 entry.delivery_mode = INT_DELIVERY_MODE;
832 entry.dest_mode = INT_DEST_MODE; 832 entry.dest_mode = INT_DEST_MODE;
833 entry.mask = 0; /* enable IRQ */ 833 entry.mask = 0; /* enable IRQ */
834 entry.dest.logical.logical_dest = cpu_mask_to_apicid(TARGET_CPUS); 834 entry.dest = cpu_mask_to_apicid(TARGET_CPUS);
835 835
836 entry.trigger = irq_trigger(idx); 836 entry.trigger = irq_trigger(idx);
837 entry.polarity = irq_polarity(idx); 837 entry.polarity = irq_polarity(idx);
@@ -839,7 +839,7 @@ static void __init setup_IO_APIC_irq(int apic, int pin, int idx, int irq)
839 if (irq_trigger(idx)) { 839 if (irq_trigger(idx)) {
840 entry.trigger = 1; 840 entry.trigger = 1;
841 entry.mask = 1; 841 entry.mask = 1;
842 entry.dest.logical.logical_dest = cpu_mask_to_apicid(TARGET_CPUS); 842 entry.dest = cpu_mask_to_apicid(TARGET_CPUS);
843 } 843 }
844 844
845 if (!apic && !IO_APIC_IRQ(irq)) 845 if (!apic && !IO_APIC_IRQ(irq))
@@ -851,7 +851,7 @@ static void __init setup_IO_APIC_irq(int apic, int pin, int idx, int irq)
851 if (vector < 0) 851 if (vector < 0)
852 return; 852 return;
853 853
854 entry.dest.logical.logical_dest = cpu_mask_to_apicid(mask); 854 entry.dest = cpu_mask_to_apicid(mask);
855 entry.vector = vector; 855 entry.vector = vector;
856 856
857 ioapic_register_intr(irq, vector, IOAPIC_AUTO); 857 ioapic_register_intr(irq, vector, IOAPIC_AUTO);
@@ -920,7 +920,7 @@ static void __init setup_ExtINT_IRQ0_pin(unsigned int apic, unsigned int pin, in
920 */ 920 */
921 entry.dest_mode = INT_DEST_MODE; 921 entry.dest_mode = INT_DEST_MODE;
922 entry.mask = 0; /* unmask IRQ now */ 922 entry.mask = 0; /* unmask IRQ now */
923 entry.dest.logical.logical_dest = cpu_mask_to_apicid(TARGET_CPUS); 923 entry.dest = cpu_mask_to_apicid(TARGET_CPUS);
924 entry.delivery_mode = INT_DELIVERY_MODE; 924 entry.delivery_mode = INT_DELIVERY_MODE;
925 entry.polarity = 0; 925 entry.polarity = 0;
926 entry.trigger = 0; 926 entry.trigger = 0;
@@ -1020,18 +1020,17 @@ void __apicdebuginit print_IO_APIC(void)
1020 1020
1021 printk(KERN_DEBUG ".... IRQ redirection table:\n"); 1021 printk(KERN_DEBUG ".... IRQ redirection table:\n");
1022 1022
1023 printk(KERN_DEBUG " NR Log Phy Mask Trig IRR Pol" 1023 printk(KERN_DEBUG " NR Dst Mask Trig IRR Pol"
1024 " Stat Dest Deli Vect: \n"); 1024 " Stat Dmod Deli Vect: \n");
1025 1025
1026 for (i = 0; i <= reg_01.bits.entries; i++) { 1026 for (i = 0; i <= reg_01.bits.entries; i++) {
1027 struct IO_APIC_route_entry entry; 1027 struct IO_APIC_route_entry entry;
1028 1028
1029 entry = ioapic_read_entry(apic, i); 1029 entry = ioapic_read_entry(apic, i);
1030 1030
1031 printk(KERN_DEBUG " %02x %03X %02X ", 1031 printk(KERN_DEBUG " %02x %03X ",
1032 i, 1032 i,
1033 entry.dest.logical.logical_dest, 1033 entry.dest
1034 entry.dest.physical.physical_dest
1035 ); 1034 );
1036 1035
1037 printk("%1d %1d %1d %1d %1d %1d %1d %02X\n", 1036 printk("%1d %1d %1d %1d %1d %1d %1d %02X\n",
@@ -1293,8 +1292,7 @@ void disable_IO_APIC(void)
1293 entry.dest_mode = 0; /* Physical */ 1292 entry.dest_mode = 0; /* Physical */
1294 entry.delivery_mode = dest_ExtINT; /* ExtInt */ 1293 entry.delivery_mode = dest_ExtINT; /* ExtInt */
1295 entry.vector = 0; 1294 entry.vector = 0;
1296 entry.dest.physical.physical_dest = 1295 entry.dest = GET_APIC_ID(apic_read(APIC_ID));
1297 GET_APIC_ID(apic_read(APIC_ID));
1298 1296
1299 /* 1297 /*
1300 * Add it to the IO-APIC irq-routing table: 1298 * Add it to the IO-APIC irq-routing table:
@@ -1556,7 +1554,7 @@ static inline void unlock_ExtINT_logic(void)
1556 1554
1557 entry1.dest_mode = 0; /* physical delivery */ 1555 entry1.dest_mode = 0; /* physical delivery */
1558 entry1.mask = 0; /* unmask IRQ now */ 1556 entry1.mask = 0; /* unmask IRQ now */
1559 entry1.dest.physical.physical_dest = hard_smp_processor_id(); 1557 entry1.dest = hard_smp_processor_id();
1560 entry1.delivery_mode = dest_ExtINT; 1558 entry1.delivery_mode = dest_ExtINT;
1561 entry1.polarity = entry0.polarity; 1559 entry1.polarity = entry0.polarity;
1562 entry1.trigger = 0; 1560 entry1.trigger = 0;
@@ -2131,7 +2129,7 @@ int io_apic_set_pci_routing (int ioapic, int pin, int irq, int triggering, int p
2131 2129
2132 entry.delivery_mode = INT_DELIVERY_MODE; 2130 entry.delivery_mode = INT_DELIVERY_MODE;
2133 entry.dest_mode = INT_DEST_MODE; 2131 entry.dest_mode = INT_DEST_MODE;
2134 entry.dest.logical.logical_dest = cpu_mask_to_apicid(mask); 2132 entry.dest = cpu_mask_to_apicid(mask);
2135 entry.trigger = triggering; 2133 entry.trigger = triggering;
2136 entry.polarity = polarity; 2134 entry.polarity = polarity;
2137 entry.mask = 1; /* Disabled (masked) */ 2135 entry.mask = 1; /* Disabled (masked) */
diff --git a/arch/x86_64/kernel/ioport.c b/arch/x86_64/kernel/ioport.c
index fe063d3cfe42..745b1f0f494e 100644
--- a/arch/x86_64/kernel/ioport.c
+++ b/arch/x86_64/kernel/ioport.c
@@ -114,6 +114,6 @@ asmlinkage long sys_iopl(unsigned int level, struct pt_regs *regs)
114 if (!capable(CAP_SYS_RAWIO)) 114 if (!capable(CAP_SYS_RAWIO))
115 return -EPERM; 115 return -EPERM;
116 } 116 }
117 regs->eflags = (regs->eflags &~ 0x3000UL) | (level << 12); 117 regs->eflags = (regs->eflags &~ X86_EFLAGS_IOPL) | (level << 12);
118 return 0; 118 return 0;
119} 119}
diff --git a/arch/x86_64/kernel/irq.c b/arch/x86_64/kernel/irq.c
index 0c06af6c13bc..3bc30d2c13d3 100644
--- a/arch/x86_64/kernel/irq.c
+++ b/arch/x86_64/kernel/irq.c
@@ -18,6 +18,7 @@
18#include <asm/uaccess.h> 18#include <asm/uaccess.h>
19#include <asm/io_apic.h> 19#include <asm/io_apic.h>
20#include <asm/idle.h> 20#include <asm/idle.h>
21#include <asm/smp.h>
21 22
22atomic_t irq_err_count; 23atomic_t irq_err_count;
23 24
@@ -120,9 +121,14 @@ asmlinkage unsigned int do_IRQ(struct pt_regs *regs)
120 121
121 if (likely(irq < NR_IRQS)) 122 if (likely(irq < NR_IRQS))
122 generic_handle_irq(irq); 123 generic_handle_irq(irq);
123 else if (printk_ratelimit()) 124 else {
124 printk(KERN_EMERG "%s: %d.%d No irq handler for vector\n", 125 if (!disable_apic)
125 __func__, smp_processor_id(), vector); 126 ack_APIC_irq();
127
128 if (printk_ratelimit())
129 printk(KERN_EMERG "%s: %d.%d No irq handler for vector\n",
130 __func__, smp_processor_id(), vector);
131 }
126 132
127 irq_exit(); 133 irq_exit();
128 134
diff --git a/arch/x86_64/kernel/mce.c b/arch/x86_64/kernel/mce.c
index bdb54a2c9f18..8011a8e1c7d4 100644
--- a/arch/x86_64/kernel/mce.c
+++ b/arch/x86_64/kernel/mce.c
@@ -19,6 +19,7 @@
19#include <linux/cpu.h> 19#include <linux/cpu.h>
20#include <linux/percpu.h> 20#include <linux/percpu.h>
21#include <linux/ctype.h> 21#include <linux/ctype.h>
22#include <linux/kmod.h>
22#include <asm/processor.h> 23#include <asm/processor.h>
23#include <asm/msr.h> 24#include <asm/msr.h>
24#include <asm/mce.h> 25#include <asm/mce.h>
@@ -42,6 +43,10 @@ static unsigned long console_logged;
42static int notify_user; 43static int notify_user;
43static int rip_msr; 44static int rip_msr;
44static int mce_bootlog = 1; 45static int mce_bootlog = 1;
46static atomic_t mce_events;
47
48static char trigger[128];
49static char *trigger_argv[2] = { trigger, NULL };
45 50
46/* 51/*
47 * Lockless MCE logging infrastructure. 52 * Lockless MCE logging infrastructure.
@@ -57,6 +62,7 @@ struct mce_log mcelog = {
57void mce_log(struct mce *mce) 62void mce_log(struct mce *mce)
58{ 63{
59 unsigned next, entry; 64 unsigned next, entry;
65 atomic_inc(&mce_events);
60 mce->finished = 0; 66 mce->finished = 0;
61 wmb(); 67 wmb();
62 for (;;) { 68 for (;;) {
@@ -161,6 +167,17 @@ static inline void mce_get_rip(struct mce *m, struct pt_regs *regs)
161 } 167 }
162} 168}
163 169
170static void do_mce_trigger(void)
171{
172 static atomic_t mce_logged;
173 int events = atomic_read(&mce_events);
174 if (events != atomic_read(&mce_logged) && trigger[0]) {
175 /* Small race window, but should be harmless. */
176 atomic_set(&mce_logged, events);
177 call_usermodehelper(trigger, trigger_argv, NULL, -1);
178 }
179}
180
164/* 181/*
165 * The actual machine check handler 182 * The actual machine check handler
166 */ 183 */
@@ -234,8 +251,12 @@ void do_machine_check(struct pt_regs * regs, long error_code)
234 } 251 }
235 252
236 /* Never do anything final in the polling timer */ 253 /* Never do anything final in the polling timer */
237 if (!regs) 254 if (!regs) {
255 /* Normal interrupt context here. Call trigger for any new
256 events. */
257 do_mce_trigger();
238 goto out; 258 goto out;
259 }
239 260
240 /* If we didn't find an uncorrectable error, pick 261 /* If we didn't find an uncorrectable error, pick
241 the last one (shouldn't happen, just being safe). */ 262 the last one (shouldn't happen, just being safe). */
@@ -606,17 +627,42 @@ DEFINE_PER_CPU(struct sys_device, device_mce);
606 } \ 627 } \
607 static SYSDEV_ATTR(name, 0644, show_ ## name, set_ ## name); 628 static SYSDEV_ATTR(name, 0644, show_ ## name, set_ ## name);
608 629
630/* TBD should generate these dynamically based on number of available banks */
609ACCESSOR(bank0ctl,bank[0],mce_restart()) 631ACCESSOR(bank0ctl,bank[0],mce_restart())
610ACCESSOR(bank1ctl,bank[1],mce_restart()) 632ACCESSOR(bank1ctl,bank[1],mce_restart())
611ACCESSOR(bank2ctl,bank[2],mce_restart()) 633ACCESSOR(bank2ctl,bank[2],mce_restart())
612ACCESSOR(bank3ctl,bank[3],mce_restart()) 634ACCESSOR(bank3ctl,bank[3],mce_restart())
613ACCESSOR(bank4ctl,bank[4],mce_restart()) 635ACCESSOR(bank4ctl,bank[4],mce_restart())
614ACCESSOR(bank5ctl,bank[5],mce_restart()) 636ACCESSOR(bank5ctl,bank[5],mce_restart())
615static struct sysdev_attribute * bank_attributes[NR_BANKS] = { 637
616 &attr_bank0ctl, &attr_bank1ctl, &attr_bank2ctl, 638static ssize_t show_trigger(struct sys_device *s, char *buf)
617 &attr_bank3ctl, &attr_bank4ctl, &attr_bank5ctl}; 639{
640 strcpy(buf, trigger);
641 strcat(buf, "\n");
642 return strlen(trigger) + 1;
643}
644
645static ssize_t set_trigger(struct sys_device *s,const char *buf,size_t siz)
646{
647 char *p;
648 int len;
649 strncpy(trigger, buf, sizeof(trigger));
650 trigger[sizeof(trigger)-1] = 0;
651 len = strlen(trigger);
652 p = strchr(trigger, '\n');
653 if (*p) *p = 0;
654 return len;
655}
656
657static SYSDEV_ATTR(trigger, 0644, show_trigger, set_trigger);
618ACCESSOR(tolerant,tolerant,) 658ACCESSOR(tolerant,tolerant,)
619ACCESSOR(check_interval,check_interval,mce_restart()) 659ACCESSOR(check_interval,check_interval,mce_restart())
660static struct sysdev_attribute *mce_attributes[] = {
661 &attr_bank0ctl, &attr_bank1ctl, &attr_bank2ctl,
662 &attr_bank3ctl, &attr_bank4ctl, &attr_bank5ctl,
663 &attr_tolerant, &attr_check_interval, &attr_trigger,
664 NULL
665};
620 666
621/* Per cpu sysdev init. All of the cpus still share the same ctl bank */ 667/* Per cpu sysdev init. All of the cpus still share the same ctl bank */
622static __cpuinit int mce_create_device(unsigned int cpu) 668static __cpuinit int mce_create_device(unsigned int cpu)
@@ -632,11 +678,9 @@ static __cpuinit int mce_create_device(unsigned int cpu)
632 err = sysdev_register(&per_cpu(device_mce,cpu)); 678 err = sysdev_register(&per_cpu(device_mce,cpu));
633 679
634 if (!err) { 680 if (!err) {
635 for (i = 0; i < banks; i++) 681 for (i = 0; mce_attributes[i]; i++)
636 sysdev_create_file(&per_cpu(device_mce,cpu), 682 sysdev_create_file(&per_cpu(device_mce,cpu),
637 bank_attributes[i]); 683 mce_attributes[i]);
638 sysdev_create_file(&per_cpu(device_mce,cpu), &attr_tolerant);
639 sysdev_create_file(&per_cpu(device_mce,cpu), &attr_check_interval);
640 } 684 }
641 return err; 685 return err;
642} 686}
@@ -645,11 +689,9 @@ static void mce_remove_device(unsigned int cpu)
645{ 689{
646 int i; 690 int i;
647 691
648 for (i = 0; i < banks; i++) 692 for (i = 0; mce_attributes[i]; i++)
649 sysdev_remove_file(&per_cpu(device_mce,cpu), 693 sysdev_remove_file(&per_cpu(device_mce,cpu),
650 bank_attributes[i]); 694 mce_attributes[i]);
651 sysdev_remove_file(&per_cpu(device_mce,cpu), &attr_tolerant);
652 sysdev_remove_file(&per_cpu(device_mce,cpu), &attr_check_interval);
653 sysdev_unregister(&per_cpu(device_mce,cpu)); 695 sysdev_unregister(&per_cpu(device_mce,cpu));
654 memset(&per_cpu(device_mce, cpu).kobj, 0, sizeof(struct kobject)); 696 memset(&per_cpu(device_mce, cpu).kobj, 0, sizeof(struct kobject));
655} 697}
diff --git a/arch/x86_64/kernel/mce_amd.c b/arch/x86_64/kernel/mce_amd.c
index 93c707257637..d0bd5d66e103 100644
--- a/arch/x86_64/kernel/mce_amd.c
+++ b/arch/x86_64/kernel/mce_amd.c
@@ -37,6 +37,8 @@
37#define THRESHOLD_MAX 0xFFF 37#define THRESHOLD_MAX 0xFFF
38#define INT_TYPE_APIC 0x00020000 38#define INT_TYPE_APIC 0x00020000
39#define MASK_VALID_HI 0x80000000 39#define MASK_VALID_HI 0x80000000
40#define MASK_CNTP_HI 0x40000000
41#define MASK_LOCKED_HI 0x20000000
40#define MASK_LVTOFF_HI 0x00F00000 42#define MASK_LVTOFF_HI 0x00F00000
41#define MASK_COUNT_EN_HI 0x00080000 43#define MASK_COUNT_EN_HI 0x00080000
42#define MASK_INT_TYPE_HI 0x00060000 44#define MASK_INT_TYPE_HI 0x00060000
@@ -122,14 +124,17 @@ void __cpuinit mce_amd_feature_init(struct cpuinfo_x86 *c)
122 for (block = 0; block < NR_BLOCKS; ++block) { 124 for (block = 0; block < NR_BLOCKS; ++block) {
123 if (block == 0) 125 if (block == 0)
124 address = MSR_IA32_MC0_MISC + bank * 4; 126 address = MSR_IA32_MC0_MISC + bank * 4;
125 else if (block == 1) 127 else if (block == 1) {
126 address = MCG_XBLK_ADDR 128 address = (low & MASK_BLKPTR_LO) >> 21;
127 + ((low & MASK_BLKPTR_LO) >> 21); 129 if (!address)
130 break;
131 address += MCG_XBLK_ADDR;
132 }
128 else 133 else
129 ++address; 134 ++address;
130 135
131 if (rdmsr_safe(address, &low, &high)) 136 if (rdmsr_safe(address, &low, &high))
132 continue; 137 break;
133 138
134 if (!(high & MASK_VALID_HI)) { 139 if (!(high & MASK_VALID_HI)) {
135 if (block) 140 if (block)
@@ -138,8 +143,8 @@ void __cpuinit mce_amd_feature_init(struct cpuinfo_x86 *c)
138 break; 143 break;
139 } 144 }
140 145
141 if (!(high & MASK_VALID_HI >> 1) || 146 if (!(high & MASK_CNTP_HI) ||
142 (high & MASK_VALID_HI >> 2)) 147 (high & MASK_LOCKED_HI))
143 continue; 148 continue;
144 149
145 if (!block) 150 if (!block)
@@ -187,17 +192,22 @@ asmlinkage void mce_threshold_interrupt(void)
187 192
188 /* assume first bank caused it */ 193 /* assume first bank caused it */
189 for (bank = 0; bank < NR_BANKS; ++bank) { 194 for (bank = 0; bank < NR_BANKS; ++bank) {
195 if (!(per_cpu(bank_map, m.cpu) & (1 << bank)))
196 continue;
190 for (block = 0; block < NR_BLOCKS; ++block) { 197 for (block = 0; block < NR_BLOCKS; ++block) {
191 if (block == 0) 198 if (block == 0)
192 address = MSR_IA32_MC0_MISC + bank * 4; 199 address = MSR_IA32_MC0_MISC + bank * 4;
193 else if (block == 1) 200 else if (block == 1) {
194 address = MCG_XBLK_ADDR 201 address = (low & MASK_BLKPTR_LO) >> 21;
195 + ((low & MASK_BLKPTR_LO) >> 21); 202 if (!address)
203 break;
204 address += MCG_XBLK_ADDR;
205 }
196 else 206 else
197 ++address; 207 ++address;
198 208
199 if (rdmsr_safe(address, &low, &high)) 209 if (rdmsr_safe(address, &low, &high))
200 continue; 210 break;
201 211
202 if (!(high & MASK_VALID_HI)) { 212 if (!(high & MASK_VALID_HI)) {
203 if (block) 213 if (block)
@@ -206,10 +216,14 @@ asmlinkage void mce_threshold_interrupt(void)
206 break; 216 break;
207 } 217 }
208 218
209 if (!(high & MASK_VALID_HI >> 1) || 219 if (!(high & MASK_CNTP_HI) ||
210 (high & MASK_VALID_HI >> 2)) 220 (high & MASK_LOCKED_HI))
211 continue; 221 continue;
212 222
223 /* Log the machine check that caused the threshold
224 event. */
225 do_machine_check(NULL, 0);
226
213 if (high & MASK_OVERFLOW_HI) { 227 if (high & MASK_OVERFLOW_HI) {
214 rdmsrl(address, m.misc); 228 rdmsrl(address, m.misc);
215 rdmsrl(MSR_IA32_MC0_STATUS + bank * 4, 229 rdmsrl(MSR_IA32_MC0_STATUS + bank * 4,
@@ -385,7 +399,7 @@ static __cpuinit int allocate_threshold_blocks(unsigned int cpu,
385 return 0; 399 return 0;
386 400
387 if (rdmsr_safe(address, &low, &high)) 401 if (rdmsr_safe(address, &low, &high))
388 goto recurse; 402 return 0;
389 403
390 if (!(high & MASK_VALID_HI)) { 404 if (!(high & MASK_VALID_HI)) {
391 if (block) 405 if (block)
@@ -394,8 +408,8 @@ static __cpuinit int allocate_threshold_blocks(unsigned int cpu,
394 return 0; 408 return 0;
395 } 409 }
396 410
397 if (!(high & MASK_VALID_HI >> 1) || 411 if (!(high & MASK_CNTP_HI) ||
398 (high & MASK_VALID_HI >> 2)) 412 (high & MASK_LOCKED_HI))
399 goto recurse; 413 goto recurse;
400 414
401 b = kzalloc(sizeof(struct threshold_block), GFP_KERNEL); 415 b = kzalloc(sizeof(struct threshold_block), GFP_KERNEL);
diff --git a/arch/x86_64/kernel/nmi.c b/arch/x86_64/kernel/nmi.c
index 9cb42ecb7f89..486f4c61a948 100644
--- a/arch/x86_64/kernel/nmi.c
+++ b/arch/x86_64/kernel/nmi.c
@@ -172,7 +172,7 @@ static __cpuinit inline int nmi_known_cpu(void)
172{ 172{
173 switch (boot_cpu_data.x86_vendor) { 173 switch (boot_cpu_data.x86_vendor) {
174 case X86_VENDOR_AMD: 174 case X86_VENDOR_AMD:
175 return boot_cpu_data.x86 == 15; 175 return boot_cpu_data.x86 == 15 || boot_cpu_data.x86 == 16;
176 case X86_VENDOR_INTEL: 176 case X86_VENDOR_INTEL:
177 if (cpu_has(&boot_cpu_data, X86_FEATURE_ARCH_PERFMON)) 177 if (cpu_has(&boot_cpu_data, X86_FEATURE_ARCH_PERFMON))
178 return 1; 178 return 1;
@@ -214,6 +214,23 @@ static __init void nmi_cpu_busy(void *data)
214} 214}
215#endif 215#endif
216 216
217static unsigned int adjust_for_32bit_ctr(unsigned int hz)
218{
219 unsigned int retval = hz;
220
221 /*
222 * On Intel CPUs with ARCH_PERFMON only 32 bits in the counter
223 * are writable, with higher bits sign extending from bit 31.
224 * So, we can only program the counter with 31 bit values and
225 * 32nd bit should be 1, for 33.. to be 1.
226 * Find the appropriate nmi_hz
227 */
228 if ((((u64)cpu_khz * 1000) / retval) > 0x7fffffffULL) {
229 retval = ((u64)cpu_khz * 1000) / 0x7fffffffUL + 1;
230 }
231 return retval;
232}
233
217int __init check_nmi_watchdog (void) 234int __init check_nmi_watchdog (void)
218{ 235{
219 int *counts; 236 int *counts;
@@ -268,17 +285,8 @@ int __init check_nmi_watchdog (void)
268 struct nmi_watchdog_ctlblk *wd = &__get_cpu_var(nmi_watchdog_ctlblk); 285 struct nmi_watchdog_ctlblk *wd = &__get_cpu_var(nmi_watchdog_ctlblk);
269 286
270 nmi_hz = 1; 287 nmi_hz = 1;
271 /* 288 if (wd->perfctr_msr == MSR_ARCH_PERFMON_PERFCTR0)
272 * On Intel CPUs with ARCH_PERFMON only 32 bits in the counter 289 nmi_hz = adjust_for_32bit_ctr(nmi_hz);
273 * are writable, with higher bits sign extending from bit 31.
274 * So, we can only program the counter with 31 bit values and
275 * 32nd bit should be 1, for 33.. to be 1.
276 * Find the appropriate nmi_hz
277 */
278 if (wd->perfctr_msr == MSR_ARCH_PERFMON_PERFCTR0 &&
279 ((u64)cpu_khz * 1000) > 0x7fffffffULL) {
280 nmi_hz = ((u64)cpu_khz * 1000) / 0x7fffffffUL + 1;
281 }
282 } 290 }
283 291
284 kfree(counts); 292 kfree(counts);
@@ -360,6 +368,33 @@ void enable_timer_nmi_watchdog(void)
360 } 368 }
361} 369}
362 370
371static void __acpi_nmi_disable(void *__unused)
372{
373 apic_write(APIC_LVT0, APIC_DM_NMI | APIC_LVT_MASKED);
374}
375
376/*
377 * Disable timer based NMIs on all CPUs:
378 */
379void acpi_nmi_disable(void)
380{
381 if (atomic_read(&nmi_active) && nmi_watchdog == NMI_IO_APIC)
382 on_each_cpu(__acpi_nmi_disable, NULL, 0, 1);
383}
384
385static void __acpi_nmi_enable(void *__unused)
386{
387 apic_write(APIC_LVT0, APIC_DM_NMI);
388}
389
390/*
391 * Enable timer based NMIs on all CPUs:
392 */
393void acpi_nmi_enable(void)
394{
395 if (atomic_read(&nmi_active) && nmi_watchdog == NMI_IO_APIC)
396 on_each_cpu(__acpi_nmi_enable, NULL, 0, 1);
397}
363#ifdef CONFIG_PM 398#ifdef CONFIG_PM
364 399
365static int nmi_pm_active; /* nmi_active before suspend */ 400static int nmi_pm_active; /* nmi_active before suspend */
@@ -634,7 +669,9 @@ static int setup_intel_arch_watchdog(void)
634 669
635 /* setup the timer */ 670 /* setup the timer */
636 wrmsr(evntsel_msr, evntsel, 0); 671 wrmsr(evntsel_msr, evntsel, 0);
637 wrmsrl(perfctr_msr, -((u64)cpu_khz * 1000 / nmi_hz)); 672
673 nmi_hz = adjust_for_32bit_ctr(nmi_hz);
674 wrmsr(perfctr_msr, (u32)(-((u64)cpu_khz * 1000 / nmi_hz)), 0);
638 675
639 apic_write(APIC_LVTPC, APIC_DM_NMI); 676 apic_write(APIC_LVTPC, APIC_DM_NMI);
640 evntsel |= ARCH_PERFMON_EVENTSEL0_ENABLE; 677 evntsel |= ARCH_PERFMON_EVENTSEL0_ENABLE;
@@ -855,15 +892,23 @@ int __kprobes nmi_watchdog_tick(struct pt_regs * regs, unsigned reason)
855 dummy &= ~P4_CCCR_OVF; 892 dummy &= ~P4_CCCR_OVF;
856 wrmsrl(wd->cccr_msr, dummy); 893 wrmsrl(wd->cccr_msr, dummy);
857 apic_write(APIC_LVTPC, APIC_DM_NMI); 894 apic_write(APIC_LVTPC, APIC_DM_NMI);
895 /* start the cycle over again */
896 wrmsrl(wd->perfctr_msr,
897 -((u64)cpu_khz * 1000 / nmi_hz));
858 } else if (wd->perfctr_msr == MSR_ARCH_PERFMON_PERFCTR0) { 898 } else if (wd->perfctr_msr == MSR_ARCH_PERFMON_PERFCTR0) {
859 /* 899 /*
860 * ArchPerfom/Core Duo needs to re-unmask 900 * ArchPerfom/Core Duo needs to re-unmask
861 * the apic vector 901 * the apic vector
862 */ 902 */
863 apic_write(APIC_LVTPC, APIC_DM_NMI); 903 apic_write(APIC_LVTPC, APIC_DM_NMI);
904 /* ARCH_PERFMON has 32 bit counter writes */
905 wrmsr(wd->perfctr_msr,
906 (u32)(-((u64)cpu_khz * 1000 / nmi_hz)), 0);
907 } else {
908 /* start the cycle over again */
909 wrmsrl(wd->perfctr_msr,
910 -((u64)cpu_khz * 1000 / nmi_hz));
864 } 911 }
865 /* start the cycle over again */
866 wrmsrl(wd->perfctr_msr, -((u64)cpu_khz * 1000 / nmi_hz));
867 rc = 1; 912 rc = 1;
868 } else if (nmi_watchdog == NMI_IO_APIC) { 913 } else if (nmi_watchdog == NMI_IO_APIC) {
869 /* don't know how to accurately check for this. 914 /* don't know how to accurately check for this.
diff --git a/arch/x86_64/kernel/pci-calgary.c b/arch/x86_64/kernel/pci-calgary.c
index 3d65b1d4c2b3..04480c3b68f5 100644
--- a/arch/x86_64/kernel/pci-calgary.c
+++ b/arch/x86_64/kernel/pci-calgary.c
@@ -138,6 +138,8 @@ static const unsigned long phb_debug_offsets[] = {
138 138
139#define PHB_DEBUG_STUFF_OFFSET 0x0020 139#define PHB_DEBUG_STUFF_OFFSET 0x0020
140 140
141#define EMERGENCY_PAGES 32 /* = 128KB */
142
141unsigned int specified_table_size = TCE_TABLE_SIZE_UNSPECIFIED; 143unsigned int specified_table_size = TCE_TABLE_SIZE_UNSPECIFIED;
142static int translate_empty_slots __read_mostly = 0; 144static int translate_empty_slots __read_mostly = 0;
143static int calgary_detected __read_mostly = 0; 145static int calgary_detected __read_mostly = 0;
@@ -296,6 +298,16 @@ static void __iommu_free(struct iommu_table *tbl, dma_addr_t dma_addr,
296{ 298{
297 unsigned long entry; 299 unsigned long entry;
298 unsigned long badbit; 300 unsigned long badbit;
301 unsigned long badend;
302
303 /* were we called with bad_dma_address? */
304 badend = bad_dma_address + (EMERGENCY_PAGES * PAGE_SIZE);
305 if (unlikely((dma_addr >= bad_dma_address) && (dma_addr < badend))) {
306 printk(KERN_ERR "Calgary: driver tried unmapping bad DMA "
307 "address 0x%Lx\n", dma_addr);
308 WARN_ON(1);
309 return;
310 }
299 311
300 entry = dma_addr >> PAGE_SHIFT; 312 entry = dma_addr >> PAGE_SHIFT;
301 313
@@ -656,8 +668,8 @@ static void __init calgary_reserve_regions(struct pci_dev *dev)
656 u64 start; 668 u64 start;
657 struct iommu_table *tbl = dev->sysdata; 669 struct iommu_table *tbl = dev->sysdata;
658 670
659 /* reserve bad_dma_address in case it's a legal address */ 671 /* reserve EMERGENCY_PAGES from bad_dma_address and up */
660 iommu_range_reserve(tbl, bad_dma_address, 1); 672 iommu_range_reserve(tbl, bad_dma_address, EMERGENCY_PAGES);
661 673
662 /* avoid the BIOS/VGA first 640KB-1MB region */ 674 /* avoid the BIOS/VGA first 640KB-1MB region */
663 start = (640 * 1024); 675 start = (640 * 1024);
@@ -1176,6 +1188,7 @@ int __init calgary_iommu_init(void)
1176 } 1188 }
1177 1189
1178 force_iommu = 1; 1190 force_iommu = 1;
1191 bad_dma_address = 0x0;
1179 dma_ops = &calgary_dma_ops; 1192 dma_ops = &calgary_dma_ops;
1180 1193
1181 return 0; 1194 return 0;
diff --git a/arch/x86_64/kernel/pci-dma.c b/arch/x86_64/kernel/pci-dma.c
index 683b7a5c1ab3..651ccfb06697 100644
--- a/arch/x86_64/kernel/pci-dma.c
+++ b/arch/x86_64/kernel/pci-dma.c
@@ -223,30 +223,10 @@ int dma_set_mask(struct device *dev, u64 mask)
223} 223}
224EXPORT_SYMBOL(dma_set_mask); 224EXPORT_SYMBOL(dma_set_mask);
225 225
226/* iommu=[size][,noagp][,off][,force][,noforce][,leak][,memaper[=order]][,merge] 226/*
227 [,forcesac][,fullflush][,nomerge][,biomerge] 227 * See <Documentation/x86_64/boot-options.txt> for the iommu kernel parameter
228 size set size of iommu (in bytes) 228 * documentation.
229 noagp don't initialize the AGP driver and use full aperture. 229 */
230 off don't use the IOMMU
231 leak turn on simple iommu leak tracing (only when CONFIG_IOMMU_LEAK is on)
232 memaper[=order] allocate an own aperture over RAM with size 32MB^order.
233 noforce don't force IOMMU usage. Default.
234 force Force IOMMU.
235 merge Do lazy merging. This may improve performance on some block devices.
236 Implies force (experimental)
237 biomerge Do merging at the BIO layer. This is more efficient than merge,
238 but should be only done with very big IOMMUs. Implies merge,force.
239 nomerge Don't do SG merging.
240 forcesac For SAC mode for masks <40bits (experimental)
241 fullflush Flush IOMMU on each allocation (default)
242 nofullflush Don't use IOMMU fullflush
243 allowed overwrite iommu off workarounds for specific chipsets.
244 soft Use software bounce buffering (default for Intel machines)
245 noaperture Don't touch the aperture for AGP.
246 allowdac Allow DMA >4GB
247 nodac Forbid DMA >4GB
248 panic Force panic when IOMMU overflows
249*/
250__init int iommu_setup(char *p) 230__init int iommu_setup(char *p)
251{ 231{
252 iommu_merge = 1; 232 iommu_merge = 1;
diff --git a/arch/x86_64/kernel/pci-gart.c b/arch/x86_64/kernel/pci-gart.c
index fc1960f1f243..030eb3753358 100644
--- a/arch/x86_64/kernel/pci-gart.c
+++ b/arch/x86_64/kernel/pci-gart.c
@@ -185,7 +185,7 @@ static void iommu_full(struct device *dev, size_t size, int dir)
185static inline int need_iommu(struct device *dev, unsigned long addr, size_t size) 185static inline int need_iommu(struct device *dev, unsigned long addr, size_t size)
186{ 186{
187 u64 mask = *dev->dma_mask; 187 u64 mask = *dev->dma_mask;
188 int high = addr + size >= mask; 188 int high = addr + size > mask;
189 int mmu = high; 189 int mmu = high;
190 if (force_iommu) 190 if (force_iommu)
191 mmu = 1; 191 mmu = 1;
@@ -195,7 +195,7 @@ static inline int need_iommu(struct device *dev, unsigned long addr, size_t size
195static inline int nonforced_iommu(struct device *dev, unsigned long addr, size_t size) 195static inline int nonforced_iommu(struct device *dev, unsigned long addr, size_t size)
196{ 196{
197 u64 mask = *dev->dma_mask; 197 u64 mask = *dev->dma_mask;
198 int high = addr + size >= mask; 198 int high = addr + size > mask;
199 int mmu = high; 199 int mmu = high;
200 return mmu; 200 return mmu;
201} 201}
diff --git a/arch/x86_64/kernel/ptrace.c b/arch/x86_64/kernel/ptrace.c
index addc14af0c56..4326a690a509 100644
--- a/arch/x86_64/kernel/ptrace.c
+++ b/arch/x86_64/kernel/ptrace.c
@@ -536,8 +536,12 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
536 } 536 }
537 ret = 0; 537 ret = 0;
538 for (ui = 0; ui < sizeof(struct user_regs_struct); ui += sizeof(long)) { 538 for (ui = 0; ui < sizeof(struct user_regs_struct); ui += sizeof(long)) {
539 ret |= __get_user(tmp, (unsigned long __user *) data); 539 ret = __get_user(tmp, (unsigned long __user *) data);
540 putreg(child, ui, tmp); 540 if (ret)
541 break;
542 ret = putreg(child, ui, tmp);
543 if (ret)
544 break;
541 data += sizeof(long); 545 data += sizeof(long);
542 } 546 }
543 break; 547 break;
diff --git a/arch/x86_64/kernel/setup.c b/arch/x86_64/kernel/setup.c
index 60477244d1a3..3d98b696881d 100644
--- a/arch/x86_64/kernel/setup.c
+++ b/arch/x86_64/kernel/setup.c
@@ -138,128 +138,6 @@ struct resource code_resource = {
138 .flags = IORESOURCE_RAM, 138 .flags = IORESOURCE_RAM,
139}; 139};
140 140
141#define IORESOURCE_ROM (IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM)
142
143static struct resource system_rom_resource = {
144 .name = "System ROM",
145 .start = 0xf0000,
146 .end = 0xfffff,
147 .flags = IORESOURCE_ROM,
148};
149
150static struct resource extension_rom_resource = {
151 .name = "Extension ROM",
152 .start = 0xe0000,
153 .end = 0xeffff,
154 .flags = IORESOURCE_ROM,
155};
156
157static struct resource adapter_rom_resources[] = {
158 { .name = "Adapter ROM", .start = 0xc8000, .end = 0,
159 .flags = IORESOURCE_ROM },
160 { .name = "Adapter ROM", .start = 0, .end = 0,
161 .flags = IORESOURCE_ROM },
162 { .name = "Adapter ROM", .start = 0, .end = 0,
163 .flags = IORESOURCE_ROM },
164 { .name = "Adapter ROM", .start = 0, .end = 0,
165 .flags = IORESOURCE_ROM },
166 { .name = "Adapter ROM", .start = 0, .end = 0,
167 .flags = IORESOURCE_ROM },
168 { .name = "Adapter ROM", .start = 0, .end = 0,
169 .flags = IORESOURCE_ROM }
170};
171
172static struct resource video_rom_resource = {
173 .name = "Video ROM",
174 .start = 0xc0000,
175 .end = 0xc7fff,
176 .flags = IORESOURCE_ROM,
177};
178
179static struct resource video_ram_resource = {
180 .name = "Video RAM area",
181 .start = 0xa0000,
182 .end = 0xbffff,
183 .flags = IORESOURCE_RAM,
184};
185
186#define romsignature(x) (*(unsigned short *)(x) == 0xaa55)
187
188static int __init romchecksum(unsigned char *rom, unsigned long length)
189{
190 unsigned char *p, sum = 0;
191
192 for (p = rom; p < rom + length; p++)
193 sum += *p;
194 return sum == 0;
195}
196
197static void __init probe_roms(void)
198{
199 unsigned long start, length, upper;
200 unsigned char *rom;
201 int i;
202
203 /* video rom */
204 upper = adapter_rom_resources[0].start;
205 for (start = video_rom_resource.start; start < upper; start += 2048) {
206 rom = isa_bus_to_virt(start);
207 if (!romsignature(rom))
208 continue;
209
210 video_rom_resource.start = start;
211
212 /* 0 < length <= 0x7f * 512, historically */
213 length = rom[2] * 512;
214
215 /* if checksum okay, trust length byte */
216 if (length && romchecksum(rom, length))
217 video_rom_resource.end = start + length - 1;
218
219 request_resource(&iomem_resource, &video_rom_resource);
220 break;
221 }
222
223 start = (video_rom_resource.end + 1 + 2047) & ~2047UL;
224 if (start < upper)
225 start = upper;
226
227 /* system rom */
228 request_resource(&iomem_resource, &system_rom_resource);
229 upper = system_rom_resource.start;
230
231 /* check for extension rom (ignore length byte!) */
232 rom = isa_bus_to_virt(extension_rom_resource.start);
233 if (romsignature(rom)) {
234 length = extension_rom_resource.end - extension_rom_resource.start + 1;
235 if (romchecksum(rom, length)) {
236 request_resource(&iomem_resource, &extension_rom_resource);
237 upper = extension_rom_resource.start;
238 }
239 }
240
241 /* check for adapter roms on 2k boundaries */
242 for (i = 0; i < ARRAY_SIZE(adapter_rom_resources) && start < upper;
243 start += 2048) {
244 rom = isa_bus_to_virt(start);
245 if (!romsignature(rom))
246 continue;
247
248 /* 0 < length <= 0x7f * 512, historically */
249 length = rom[2] * 512;
250
251 /* but accept any length that fits if checksum okay */
252 if (!length || start + length > upper || !romchecksum(rom, length))
253 continue;
254
255 adapter_rom_resources[i].start = start;
256 adapter_rom_resources[i].end = start + length - 1;
257 request_resource(&iomem_resource, &adapter_rom_resources[i]);
258
259 start = adapter_rom_resources[i++].end & ~2047UL;
260 }
261}
262
263#ifdef CONFIG_PROC_VMCORE 141#ifdef CONFIG_PROC_VMCORE
264/* elfcorehdr= specifies the location of elf core header 142/* elfcorehdr= specifies the location of elf core header
265 * stored by the crashed kernel. This option will be passed 143 * stored by the crashed kernel. This option will be passed
@@ -444,6 +322,11 @@ void __init setup_arch(char **cmdline_p)
444 /* reserve ebda region */ 322 /* reserve ebda region */
445 if (ebda_addr) 323 if (ebda_addr)
446 reserve_bootmem_generic(ebda_addr, ebda_size); 324 reserve_bootmem_generic(ebda_addr, ebda_size);
325#ifdef CONFIG_NUMA
326 /* reserve nodemap region */
327 if (nodemap_addr)
328 reserve_bootmem_generic(nodemap_addr, nodemap_size);
329#endif
447 330
448#ifdef CONFIG_SMP 331#ifdef CONFIG_SMP
449 /* 332 /*
@@ -519,15 +402,11 @@ void __init setup_arch(char **cmdline_p)
519 init_apic_mappings(); 402 init_apic_mappings();
520 403
521 /* 404 /*
522 * Request address space for all standard RAM and ROM resources 405 * We trust e820 completely. No explicit ROM probing in memory.
523 * and also for regions reported as reserved by the e820. 406 */
524 */
525 probe_roms();
526 e820_reserve_resources(); 407 e820_reserve_resources();
527 e820_mark_nosave_regions(); 408 e820_mark_nosave_regions();
528 409
529 request_resource(&iomem_resource, &video_ram_resource);
530
531 { 410 {
532 unsigned i; 411 unsigned i;
533 /* request I/O space for devices used on all i[345]86 PCs */ 412 /* request I/O space for devices used on all i[345]86 PCs */
@@ -1063,7 +942,8 @@ static int show_cpuinfo(struct seq_file *m, void *v)
1063 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 942 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
1064 NULL, NULL, NULL, "syscall", NULL, NULL, NULL, NULL, 943 NULL, NULL, NULL, "syscall", NULL, NULL, NULL, NULL,
1065 NULL, NULL, NULL, NULL, "nx", NULL, "mmxext", NULL, 944 NULL, NULL, NULL, NULL, "nx", NULL, "mmxext", NULL,
1066 NULL, "fxsr_opt", NULL, "rdtscp", NULL, "lm", "3dnowext", "3dnow", 945 NULL, "fxsr_opt", "pdpe1gb", "rdtscp", NULL, "lm",
946 "3dnowext", "3dnow",
1067 947
1068 /* Transmeta-defined */ 948 /* Transmeta-defined */
1069 "recovery", "longrun", NULL, "lrti", NULL, NULL, NULL, NULL, 949 "recovery", "longrun", NULL, "lrti", NULL, NULL, NULL, NULL,
@@ -1081,7 +961,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
1081 /* Intel-defined (#2) */ 961 /* Intel-defined (#2) */
1082 "pni", NULL, NULL, "monitor", "ds_cpl", "vmx", "smx", "est", 962 "pni", NULL, NULL, "monitor", "ds_cpl", "vmx", "smx", "est",
1083 "tm2", "ssse3", "cid", NULL, NULL, "cx16", "xtpr", NULL, 963 "tm2", "ssse3", "cid", NULL, NULL, "cx16", "xtpr", NULL,
1084 NULL, NULL, "dca", NULL, NULL, NULL, NULL, NULL, 964 NULL, NULL, "dca", NULL, NULL, NULL, NULL, "popcnt",
1085 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 965 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
1086 966
1087 /* VIA/Cyrix/Centaur-defined */ 967 /* VIA/Cyrix/Centaur-defined */
@@ -1091,8 +971,10 @@ static int show_cpuinfo(struct seq_file *m, void *v)
1091 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 971 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
1092 972
1093 /* AMD-defined (#2) */ 973 /* AMD-defined (#2) */
1094 "lahf_lm", "cmp_legacy", "svm", NULL, "cr8_legacy", NULL, NULL, NULL, 974 "lahf_lm", "cmp_legacy", "svm", "extapic", "cr8_legacy",
1095 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 975 "altmovcr8", "abm", "sse4a",
976 "misalignsse", "3dnowprefetch",
977 "osvw", "ibs", NULL, NULL, NULL, NULL,
1096 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 978 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
1097 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 979 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
1098 }; 980 };
@@ -1103,6 +985,9 @@ static int show_cpuinfo(struct seq_file *m, void *v)
1103 "ttp", /* thermal trip */ 985 "ttp", /* thermal trip */
1104 "tm", 986 "tm",
1105 "stc", 987 "stc",
988 "100mhzsteps",
989 "hwpstate",
990 NULL, /* tsc invariant mapped to constant_tsc */
1106 NULL, 991 NULL,
1107 /* nothing */ /* constant_tsc - moved to flags */ 992 /* nothing */ /* constant_tsc - moved to flags */
1108 }; 993 };
@@ -1219,23 +1104,3 @@ struct seq_operations cpuinfo_op = {
1219 .stop = c_stop, 1104 .stop = c_stop,
1220 .show = show_cpuinfo, 1105 .show = show_cpuinfo,
1221}; 1106};
1222
1223#if defined(CONFIG_INPUT_PCSPKR) || defined(CONFIG_INPUT_PCSPKR_MODULE)
1224#include <linux/platform_device.h>
1225static __init int add_pcspkr(void)
1226{
1227 struct platform_device *pd;
1228 int ret;
1229
1230 pd = platform_device_alloc("pcspkr", -1);
1231 if (!pd)
1232 return -ENOMEM;
1233
1234 ret = platform_device_add(pd);
1235 if (ret)
1236 platform_device_put(pd);
1237
1238 return ret;
1239}
1240device_initcall(add_pcspkr);
1241#endif
diff --git a/arch/x86_64/kernel/setup64.c b/arch/x86_64/kernel/setup64.c
index 8c4b80fe71a1..6a70b55f719d 100644
--- a/arch/x86_64/kernel/setup64.c
+++ b/arch/x86_64/kernel/setup64.c
@@ -37,7 +37,6 @@ struct desc_ptr idt_descr = { 256 * 16 - 1, (unsigned long) idt_table };
37char boot_cpu_stack[IRQSTACKSIZE] __attribute__((section(".bss.page_aligned"))); 37char boot_cpu_stack[IRQSTACKSIZE] __attribute__((section(".bss.page_aligned")));
38 38
39unsigned long __supported_pte_mask __read_mostly = ~0UL; 39unsigned long __supported_pte_mask __read_mostly = ~0UL;
40EXPORT_SYMBOL(__supported_pte_mask);
41static int do_not_nx __cpuinitdata = 0; 40static int do_not_nx __cpuinitdata = 0;
42 41
43/* noexec=on|off 42/* noexec=on|off
diff --git a/arch/x86_64/kernel/stacktrace.c b/arch/x86_64/kernel/stacktrace.c
index 6026b31d037e..65ac2c6b34a6 100644
--- a/arch/x86_64/kernel/stacktrace.c
+++ b/arch/x86_64/kernel/stacktrace.c
@@ -32,7 +32,7 @@ static void save_stack_address(void *data, unsigned long addr)
32 trace->skip--; 32 trace->skip--;
33 return; 33 return;
34 } 34 }
35 if (trace->nr_entries < trace->max_entries - 1) 35 if (trace->nr_entries < trace->max_entries)
36 trace->entries[trace->nr_entries++] = addr; 36 trace->entries[trace->nr_entries++] = addr;
37} 37}
38 38
@@ -49,7 +49,8 @@ static struct stacktrace_ops save_stack_ops = {
49void save_stack_trace(struct stack_trace *trace, struct task_struct *task) 49void save_stack_trace(struct stack_trace *trace, struct task_struct *task)
50{ 50{
51 dump_trace(task, NULL, NULL, &save_stack_ops, trace); 51 dump_trace(task, NULL, NULL, &save_stack_ops, trace);
52 trace->entries[trace->nr_entries++] = ULONG_MAX; 52 if (trace->nr_entries < trace->max_entries)
53 trace->entries[trace->nr_entries++] = ULONG_MAX;
53} 54}
54EXPORT_SYMBOL(save_stack_trace); 55EXPORT_SYMBOL(save_stack_trace);
55 56
diff --git a/arch/x86_64/kernel/time.c b/arch/x86_64/kernel/time.c
index 335cc91c49b7..3cc6886f1fb7 100644
--- a/arch/x86_64/kernel/time.c
+++ b/arch/x86_64/kernel/time.c
@@ -657,6 +657,7 @@ core_initcall(cpufreq_tsc);
657 657
658#define TICK_COUNT 100000000 658#define TICK_COUNT 100000000
659#define TICK_MIN 5000 659#define TICK_MIN 5000
660#define MAX_READ_RETRIES 5
660 661
661/* 662/*
662 * Some platforms take periodic SMI interrupts with 5ms duration. Make sure none 663 * Some platforms take periodic SMI interrupts with 5ms duration. Make sure none
@@ -664,13 +665,17 @@ core_initcall(cpufreq_tsc);
664 */ 665 */
665static void __init read_hpet_tsc(int *hpet, int *tsc) 666static void __init read_hpet_tsc(int *hpet, int *tsc)
666{ 667{
667 int tsc1, tsc2, hpet1; 668 int tsc1, tsc2, hpet1, retries = 0;
669 static int msg;
668 670
669 do { 671 do {
670 tsc1 = get_cycles_sync(); 672 tsc1 = get_cycles_sync();
671 hpet1 = hpet_readl(HPET_COUNTER); 673 hpet1 = hpet_readl(HPET_COUNTER);
672 tsc2 = get_cycles_sync(); 674 tsc2 = get_cycles_sync();
673 } while (tsc2 - tsc1 > TICK_MIN); 675 } while (tsc2 - tsc1 > TICK_MIN && retries++ < MAX_READ_RETRIES);
676 if (retries >= MAX_READ_RETRIES && !msg++)
677 printk(KERN_WARNING
678 "hpet.c: exceeded max retries to read HPET & TSC\n");
674 *hpet = hpet1; 679 *hpet = hpet1;
675 *tsc = tsc2; 680 *tsc = tsc2;
676} 681}
@@ -1221,8 +1226,9 @@ static void hpet_rtc_timer_reinit(void)
1221 if (PIE_on) 1226 if (PIE_on)
1222 PIE_count += lost_ints; 1227 PIE_count += lost_ints;
1223 1228
1224 printk(KERN_WARNING "rtc: lost some interrupts at %ldHz.\n", 1229 if (printk_ratelimit())
1225 hpet_rtc_int_freq); 1230 printk(KERN_WARNING "rtc: lost some interrupts at %ldHz.\n",
1231 hpet_rtc_int_freq);
1226 } 1232 }
1227} 1233}
1228 1234
diff --git a/arch/x86_64/kernel/vsyscall.c b/arch/x86_64/kernel/vsyscall.c
index 2433d6fc68b1..313dc6ad780b 100644
--- a/arch/x86_64/kernel/vsyscall.c
+++ b/arch/x86_64/kernel/vsyscall.c
@@ -235,13 +235,13 @@ static ctl_table kernel_table2[] = {
235 .data = &sysctl_vsyscall, .maxlen = sizeof(int), .mode = 0644, 235 .data = &sysctl_vsyscall, .maxlen = sizeof(int), .mode = 0644,
236 .strategy = vsyscall_sysctl_nostrat, 236 .strategy = vsyscall_sysctl_nostrat,
237 .proc_handler = vsyscall_sysctl_change }, 237 .proc_handler = vsyscall_sysctl_change },
238 { 0, } 238 {}
239}; 239};
240 240
241static ctl_table kernel_root_table2[] = { 241static ctl_table kernel_root_table2[] = {
242 { .ctl_name = CTL_KERN, .procname = "kernel", .mode = 0555, 242 { .ctl_name = CTL_KERN, .procname = "kernel", .mode = 0555,
243 .child = kernel_table2 }, 243 .child = kernel_table2 },
244 { 0 }, 244 {}
245}; 245};
246 246
247#endif 247#endif
@@ -301,7 +301,7 @@ static int __init vsyscall_init(void)
301 BUG_ON((unsigned long) &vgetcpu != VSYSCALL_ADDR(__NR_vgetcpu)); 301 BUG_ON((unsigned long) &vgetcpu != VSYSCALL_ADDR(__NR_vgetcpu));
302 map_vsyscall(); 302 map_vsyscall();
303#ifdef CONFIG_SYSCTL 303#ifdef CONFIG_SYSCTL
304 register_sysctl_table(kernel_root_table2, 0); 304 register_sysctl_table(kernel_root_table2);
305#endif 305#endif
306 on_each_cpu(cpu_vsyscall_init, NULL, 0, 1); 306 on_each_cpu(cpu_vsyscall_init, NULL, 0, 1);
307 hotcpu_notifier(cpu_vsyscall_notifier, 0); 307 hotcpu_notifier(cpu_vsyscall_notifier, 0);
diff --git a/arch/x86_64/kernel/x8664_ksyms.c b/arch/x86_64/kernel/x8664_ksyms.c
index 6d77e4797a47..0dffae69f4ad 100644
--- a/arch/x86_64/kernel/x8664_ksyms.c
+++ b/arch/x86_64/kernel/x8664_ksyms.c
@@ -26,6 +26,7 @@ EXPORT_SYMBOL(__put_user_4);
26EXPORT_SYMBOL(__put_user_8); 26EXPORT_SYMBOL(__put_user_8);
27 27
28EXPORT_SYMBOL(copy_user_generic); 28EXPORT_SYMBOL(copy_user_generic);
29EXPORT_SYMBOL(__copy_user_nocache);
29EXPORT_SYMBOL(copy_from_user); 30EXPORT_SYMBOL(copy_from_user);
30EXPORT_SYMBOL(copy_to_user); 31EXPORT_SYMBOL(copy_to_user);
31EXPORT_SYMBOL(__copy_from_user_inatomic); 32EXPORT_SYMBOL(__copy_from_user_inatomic);
@@ -34,8 +35,8 @@ EXPORT_SYMBOL(copy_page);
34EXPORT_SYMBOL(clear_page); 35EXPORT_SYMBOL(clear_page);
35 36
36#ifdef CONFIG_SMP 37#ifdef CONFIG_SMP
37extern void FASTCALL( __write_lock_failed(rwlock_t *rw)); 38extern void __write_lock_failed(rwlock_t *rw);
38extern void FASTCALL( __read_lock_failed(rwlock_t *rw)); 39extern void __read_lock_failed(rwlock_t *rw);
39EXPORT_SYMBOL(__write_lock_failed); 40EXPORT_SYMBOL(__write_lock_failed);
40EXPORT_SYMBOL(__read_lock_failed); 41EXPORT_SYMBOL(__read_lock_failed);
41#endif 42#endif
diff --git a/arch/x86_64/lib/Makefile b/arch/x86_64/lib/Makefile
index b78d4170fce2..8d5f835af481 100644
--- a/arch/x86_64/lib/Makefile
+++ b/arch/x86_64/lib/Makefile
@@ -9,4 +9,4 @@ obj-y := io.o iomap_copy.o
9lib-y := csum-partial.o csum-copy.o csum-wrappers.o delay.o \ 9lib-y := csum-partial.o csum-copy.o csum-wrappers.o delay.o \
10 usercopy.o getuser.o putuser.o \ 10 usercopy.o getuser.o putuser.o \
11 thunk.o clear_page.o copy_page.o bitstr.o bitops.o 11 thunk.o clear_page.o copy_page.o bitstr.o bitops.o
12lib-y += memcpy.o memmove.o memset.o copy_user.o rwlock.o 12lib-y += memcpy.o memmove.o memset.o copy_user.o rwlock.o copy_user_nocache.o
diff --git a/arch/x86_64/lib/copy_user_nocache.S b/arch/x86_64/lib/copy_user_nocache.S
new file mode 100644
index 000000000000..4620efb12f13
--- /dev/null
+++ b/arch/x86_64/lib/copy_user_nocache.S
@@ -0,0 +1,217 @@
1/* Copyright 2002 Andi Kleen, SuSE Labs.
2 * Subject to the GNU Public License v2.
3 *
4 * Functions to copy from and to user space.
5 */
6
7#include <linux/linkage.h>
8#include <asm/dwarf2.h>
9
10#define FIX_ALIGNMENT 1
11
12#include <asm/current.h>
13#include <asm/asm-offsets.h>
14#include <asm/thread_info.h>
15#include <asm/cpufeature.h>
16
17/*
18 * copy_user_nocache - Uncached memory copy with exception handling
19 * This will force destination/source out of cache for more performance.
20 *
21 * Input:
22 * rdi destination
23 * rsi source
24 * rdx count
25 * rcx zero flag when 1 zero on exception
26 *
27 * Output:
28 * eax uncopied bytes or 0 if successful.
29 */
30ENTRY(__copy_user_nocache)
31 CFI_STARTPROC
32 pushq %rbx
33 CFI_ADJUST_CFA_OFFSET 8
34 CFI_REL_OFFSET rbx, 0
35 pushq %rcx /* save zero flag */
36 CFI_ADJUST_CFA_OFFSET 8
37 CFI_REL_OFFSET rcx, 0
38
39 xorl %eax,%eax /* zero for the exception handler */
40
41#ifdef FIX_ALIGNMENT
42 /* check for bad alignment of destination */
43 movl %edi,%ecx
44 andl $7,%ecx
45 jnz .Lbad_alignment
46.Lafter_bad_alignment:
47#endif
48
49 movq %rdx,%rcx
50
51 movl $64,%ebx
52 shrq $6,%rdx
53 decq %rdx
54 js .Lhandle_tail
55
56 .p2align 4
57.Lloop:
58.Ls1: movq (%rsi),%r11
59.Ls2: movq 1*8(%rsi),%r8
60.Ls3: movq 2*8(%rsi),%r9
61.Ls4: movq 3*8(%rsi),%r10
62.Ld1: movnti %r11,(%rdi)
63.Ld2: movnti %r8,1*8(%rdi)
64.Ld3: movnti %r9,2*8(%rdi)
65.Ld4: movnti %r10,3*8(%rdi)
66
67.Ls5: movq 4*8(%rsi),%r11
68.Ls6: movq 5*8(%rsi),%r8
69.Ls7: movq 6*8(%rsi),%r9
70.Ls8: movq 7*8(%rsi),%r10
71.Ld5: movnti %r11,4*8(%rdi)
72.Ld6: movnti %r8,5*8(%rdi)
73.Ld7: movnti %r9,6*8(%rdi)
74.Ld8: movnti %r10,7*8(%rdi)
75
76 dec %rdx
77
78 leaq 64(%rsi),%rsi
79 leaq 64(%rdi),%rdi
80
81 jns .Lloop
82
83 .p2align 4
84.Lhandle_tail:
85 movl %ecx,%edx
86 andl $63,%ecx
87 shrl $3,%ecx
88 jz .Lhandle_7
89 movl $8,%ebx
90 .p2align 4
91.Lloop_8:
92.Ls9: movq (%rsi),%r8
93.Ld9: movnti %r8,(%rdi)
94 decl %ecx
95 leaq 8(%rdi),%rdi
96 leaq 8(%rsi),%rsi
97 jnz .Lloop_8
98
99.Lhandle_7:
100 movl %edx,%ecx
101 andl $7,%ecx
102 jz .Lende
103 .p2align 4
104.Lloop_1:
105.Ls10: movb (%rsi),%bl
106.Ld10: movb %bl,(%rdi)
107 incq %rdi
108 incq %rsi
109 decl %ecx
110 jnz .Lloop_1
111
112 CFI_REMEMBER_STATE
113.Lende:
114 popq %rcx
115 CFI_ADJUST_CFA_OFFSET -8
116 CFI_RESTORE %rcx
117 popq %rbx
118 CFI_ADJUST_CFA_OFFSET -8
119 CFI_RESTORE rbx
120 ret
121 CFI_RESTORE_STATE
122
123#ifdef FIX_ALIGNMENT
124 /* align destination */
125 .p2align 4
126.Lbad_alignment:
127 movl $8,%r9d
128 subl %ecx,%r9d
129 movl %r9d,%ecx
130 cmpq %r9,%rdx
131 jz .Lhandle_7
132 js .Lhandle_7
133.Lalign_1:
134.Ls11: movb (%rsi),%bl
135.Ld11: movb %bl,(%rdi)
136 incq %rsi
137 incq %rdi
138 decl %ecx
139 jnz .Lalign_1
140 subq %r9,%rdx
141 jmp .Lafter_bad_alignment
142#endif
143
144 /* table sorted by exception address */
145 .section __ex_table,"a"
146 .align 8
147 .quad .Ls1,.Ls1e
148 .quad .Ls2,.Ls2e
149 .quad .Ls3,.Ls3e
150 .quad .Ls4,.Ls4e
151 .quad .Ld1,.Ls1e
152 .quad .Ld2,.Ls2e
153 .quad .Ld3,.Ls3e
154 .quad .Ld4,.Ls4e
155 .quad .Ls5,.Ls5e
156 .quad .Ls6,.Ls6e
157 .quad .Ls7,.Ls7e
158 .quad .Ls8,.Ls8e
159 .quad .Ld5,.Ls5e
160 .quad .Ld6,.Ls6e
161 .quad .Ld7,.Ls7e
162 .quad .Ld8,.Ls8e
163 .quad .Ls9,.Le_quad
164 .quad .Ld9,.Le_quad
165 .quad .Ls10,.Le_byte
166 .quad .Ld10,.Le_byte
167#ifdef FIX_ALIGNMENT
168 .quad .Ls11,.Lzero_rest
169 .quad .Ld11,.Lzero_rest
170#endif
171 .quad .Le5,.Le_zero
172 .previous
173
174 /* compute 64-offset for main loop. 8 bytes accuracy with error on the
175 pessimistic side. this is gross. it would be better to fix the
176 interface. */
177 /* eax: zero, ebx: 64 */
178.Ls1e: addl $8,%eax
179.Ls2e: addl $8,%eax
180.Ls3e: addl $8,%eax
181.Ls4e: addl $8,%eax
182.Ls5e: addl $8,%eax
183.Ls6e: addl $8,%eax
184.Ls7e: addl $8,%eax
185.Ls8e: addl $8,%eax
186 addq %rbx,%rdi /* +64 */
187 subq %rax,%rdi /* correct destination with computed offset */
188
189 shlq $6,%rdx /* loop counter * 64 (stride length) */
190 addq %rax,%rdx /* add offset to loopcnt */
191 andl $63,%ecx /* remaining bytes */
192 addq %rcx,%rdx /* add them */
193 jmp .Lzero_rest
194
195 /* exception on quad word loop in tail handling */
196 /* ecx: loopcnt/8, %edx: length, rdi: correct */
197.Le_quad:
198 shll $3,%ecx
199 andl $7,%edx
200 addl %ecx,%edx
201 /* edx: bytes to zero, rdi: dest, eax:zero */
202.Lzero_rest:
203 cmpl $0,(%rsp) /* zero flag set? */
204 jz .Le_zero
205 movq %rdx,%rcx
206.Le_byte:
207 xorl %eax,%eax
208.Le5: rep
209 stosb
210 /* when there is another exception while zeroing the rest just return */
211.Le_zero:
212 movq %rdx,%rax
213 jmp .Lende
214 CFI_ENDPROC
215ENDPROC(__copy_user_nocache)
216
217
diff --git a/arch/x86_64/mm/fault.c b/arch/x86_64/mm/fault.c
index 49e8cf2e06f8..6ada7231f3ab 100644
--- a/arch/x86_64/mm/fault.c
+++ b/arch/x86_64/mm/fault.c
@@ -56,17 +56,17 @@ int unregister_page_fault_notifier(struct notifier_block *nb)
56} 56}
57EXPORT_SYMBOL_GPL(unregister_page_fault_notifier); 57EXPORT_SYMBOL_GPL(unregister_page_fault_notifier);
58 58
59static inline int notify_page_fault(enum die_val val, const char *str, 59static inline int notify_page_fault(struct pt_regs *regs, long err)
60 struct pt_regs *regs, long err, int trap, int sig)
61{ 60{
62 struct die_args args = { 61 struct die_args args = {
63 .regs = regs, 62 .regs = regs,
64 .str = str, 63 .str = "page fault",
65 .err = err, 64 .err = err,
66 .trapnr = trap, 65 .trapnr = 14,
67 .signr = sig 66 .signr = SIGSEGV
68 }; 67 };
69 return atomic_notifier_call_chain(&notify_page_fault_chain, val, &args); 68 return atomic_notifier_call_chain(&notify_page_fault_chain,
69 DIE_PAGE_FAULT, &args);
70} 70}
71 71
72/* Sometimes the CPU reports invalid exceptions on prefetch. 72/* Sometimes the CPU reports invalid exceptions on prefetch.
@@ -355,8 +355,7 @@ asmlinkage void __kprobes do_page_fault(struct pt_regs *regs,
355 if (vmalloc_fault(address) >= 0) 355 if (vmalloc_fault(address) >= 0)
356 return; 356 return;
357 } 357 }
358 if (notify_page_fault(DIE_PAGE_FAULT, "page fault", regs, error_code, 14, 358 if (notify_page_fault(regs, error_code) == NOTIFY_STOP)
359 SIGSEGV) == NOTIFY_STOP)
360 return; 359 return;
361 /* 360 /*
362 * Don't take the mm semaphore here. If we fixup a prefetch 361 * Don't take the mm semaphore here. If we fixup a prefetch
@@ -365,8 +364,7 @@ asmlinkage void __kprobes do_page_fault(struct pt_regs *regs,
365 goto bad_area_nosemaphore; 364 goto bad_area_nosemaphore;
366 } 365 }
367 366
368 if (notify_page_fault(DIE_PAGE_FAULT, "page fault", regs, error_code, 14, 367 if (notify_page_fault(regs, error_code) == NOTIFY_STOP)
369 SIGSEGV) == NOTIFY_STOP)
370 return; 368 return;
371 369
372 if (likely(regs->eflags & X86_EFLAGS_IF)) 370 if (likely(regs->eflags & X86_EFLAGS_IF))
diff --git a/arch/x86_64/mm/init.c b/arch/x86_64/mm/init.c
index 2968b90ef8ad..ec31534eb104 100644
--- a/arch/x86_64/mm/init.c
+++ b/arch/x86_64/mm/init.c
@@ -711,20 +711,30 @@ int kern_addr_valid(unsigned long addr)
711extern int exception_trace, page_fault_trace; 711extern int exception_trace, page_fault_trace;
712 712
713static ctl_table debug_table2[] = { 713static ctl_table debug_table2[] = {
714 { 99, "exception-trace", &exception_trace, sizeof(int), 0644, NULL, 714 {
715 proc_dointvec }, 715 .ctl_name = 99,
716 { 0, } 716 .procname = "exception-trace",
717 .data = &exception_trace,
718 .maxlen = sizeof(int),
719 .mode = 0644,
720 .proc_handler = proc_dointvec
721 },
722 {}
717}; 723};
718 724
719static ctl_table debug_root_table2[] = { 725static ctl_table debug_root_table2[] = {
720 { .ctl_name = CTL_DEBUG, .procname = "debug", .mode = 0555, 726 {
721 .child = debug_table2 }, 727 .ctl_name = CTL_DEBUG,
722 { 0 }, 728 .procname = "debug",
729 .mode = 0555,
730 .child = debug_table2
731 },
732 {}
723}; 733};
724 734
725static __init int x8664_sysctl_init(void) 735static __init int x8664_sysctl_init(void)
726{ 736{
727 register_sysctl_table(debug_root_table2, 1); 737 register_sysctl_table(debug_root_table2);
728 return 0; 738 return 0;
729} 739}
730__initcall(x8664_sysctl_init); 740__initcall(x8664_sysctl_init);
diff --git a/arch/x86_64/mm/numa.c b/arch/x86_64/mm/numa.c
index 2ee2e003606c..41b8fb069924 100644
--- a/arch/x86_64/mm/numa.c
+++ b/arch/x86_64/mm/numa.c
@@ -36,6 +36,8 @@ unsigned char apicid_to_node[MAX_LOCAL_APIC] __cpuinitdata = {
36cpumask_t node_to_cpumask[MAX_NUMNODES] __read_mostly; 36cpumask_t node_to_cpumask[MAX_NUMNODES] __read_mostly;
37 37
38int numa_off __initdata; 38int numa_off __initdata;
39unsigned long __initdata nodemap_addr;
40unsigned long __initdata nodemap_size;
39 41
40 42
41/* 43/*
@@ -52,34 +54,88 @@ populate_memnodemap(const struct bootnode *nodes, int numnodes, int shift)
52 int res = -1; 54 int res = -1;
53 unsigned long addr, end; 55 unsigned long addr, end;
54 56
55 if (shift >= 64) 57 memset(memnodemap, 0xff, memnodemapsize);
56 return -1;
57 memset(memnodemap, 0xff, sizeof(memnodemap));
58 for (i = 0; i < numnodes; i++) { 58 for (i = 0; i < numnodes; i++) {
59 addr = nodes[i].start; 59 addr = nodes[i].start;
60 end = nodes[i].end; 60 end = nodes[i].end;
61 if (addr >= end) 61 if (addr >= end)
62 continue; 62 continue;
63 if ((end >> shift) >= NODEMAPSIZE) 63 if ((end >> shift) >= memnodemapsize)
64 return 0; 64 return 0;
65 do { 65 do {
66 if (memnodemap[addr >> shift] != 0xff) 66 if (memnodemap[addr >> shift] != 0xff)
67 return -1; 67 return -1;
68 memnodemap[addr >> shift] = i; 68 memnodemap[addr >> shift] = i;
69 addr += (1UL << shift); 69 addr += (1UL << shift);
70 } while (addr < end); 70 } while (addr < end);
71 res = 1; 71 res = 1;
72 } 72 }
73 return res; 73 return res;
74} 74}
75 75
76int __init compute_hash_shift(struct bootnode *nodes, int numnodes) 76static int __init allocate_cachealigned_memnodemap(void)
77{ 77{
78 int shift = 20; 78 unsigned long pad, pad_addr;
79
80 memnodemap = memnode.embedded_map;
81 if (memnodemapsize <= 48)
82 return 0;
83
84 pad = L1_CACHE_BYTES - 1;
85 pad_addr = 0x8000;
86 nodemap_size = pad + memnodemapsize;
87 nodemap_addr = find_e820_area(pad_addr, end_pfn<<PAGE_SHIFT,
88 nodemap_size);
89 if (nodemap_addr == -1UL) {
90 printk(KERN_ERR
91 "NUMA: Unable to allocate Memory to Node hash map\n");
92 nodemap_addr = nodemap_size = 0;
93 return -1;
94 }
95 pad_addr = (nodemap_addr + pad) & ~pad;
96 memnodemap = phys_to_virt(pad_addr);
97
98 printk(KERN_DEBUG "NUMA: Allocated memnodemap from %lx - %lx\n",
99 nodemap_addr, nodemap_addr + nodemap_size);
100 return 0;
101}
79 102
80 while (populate_memnodemap(nodes, numnodes, shift + 1) >= 0) 103/*
81 shift++; 104 * The LSB of all start and end addresses in the node map is the value of the
105 * maximum possible shift.
106 */
107static int __init
108extract_lsb_from_nodes (const struct bootnode *nodes, int numnodes)
109{
110 int i, nodes_used = 0;
111 unsigned long start, end;
112 unsigned long bitfield = 0, memtop = 0;
113
114 for (i = 0; i < numnodes; i++) {
115 start = nodes[i].start;
116 end = nodes[i].end;
117 if (start >= end)
118 continue;
119 bitfield |= start;
120 nodes_used++;
121 if (end > memtop)
122 memtop = end;
123 }
124 if (nodes_used <= 1)
125 i = 63;
126 else
127 i = find_first_bit(&bitfield, sizeof(unsigned long)*8);
128 memnodemapsize = (memtop >> i)+1;
129 return i;
130}
131
132int __init compute_hash_shift(struct bootnode *nodes, int numnodes)
133{
134 int shift;
82 135
136 shift = extract_lsb_from_nodes(nodes, numnodes);
137 if (allocate_cachealigned_memnodemap())
138 return -1;
83 printk(KERN_DEBUG "NUMA: Using %d for the hash shift.\n", 139 printk(KERN_DEBUG "NUMA: Using %d for the hash shift.\n",
84 shift); 140 shift);
85 141
@@ -216,31 +272,113 @@ void __init numa_init_array(void)
216} 272}
217 273
218#ifdef CONFIG_NUMA_EMU 274#ifdef CONFIG_NUMA_EMU
275/* Numa emulation */
219int numa_fake __initdata = 0; 276int numa_fake __initdata = 0;
220 277
221/* Numa emulation */ 278/*
279 * This function is used to find out if the start and end correspond to
280 * different zones.
281 */
282int zone_cross_over(unsigned long start, unsigned long end)
283{
284 if ((start < (MAX_DMA32_PFN << PAGE_SHIFT)) &&
285 (end >= (MAX_DMA32_PFN << PAGE_SHIFT)))
286 return 1;
287 return 0;
288}
289
222static int __init numa_emulation(unsigned long start_pfn, unsigned long end_pfn) 290static int __init numa_emulation(unsigned long start_pfn, unsigned long end_pfn)
223{ 291{
224 int i; 292 int i, big;
225 struct bootnode nodes[MAX_NUMNODES]; 293 struct bootnode nodes[MAX_NUMNODES];
226 unsigned long sz = ((end_pfn - start_pfn)<<PAGE_SHIFT) / numa_fake; 294 unsigned long sz, old_sz;
295 unsigned long hole_size;
296 unsigned long start, end;
297 unsigned long max_addr = (end_pfn << PAGE_SHIFT);
298
299 start = (start_pfn << PAGE_SHIFT);
300 hole_size = e820_hole_size(start, max_addr);
301 sz = (max_addr - start - hole_size) / numa_fake;
227 302
228 /* Kludge needed for the hash function */ 303 /* Kludge needed for the hash function */
229 if (hweight64(sz) > 1) {
230 unsigned long x = 1;
231 while ((x << 1) < sz)
232 x <<= 1;
233 if (x < sz/2)
234 printk(KERN_ERR "Numa emulation unbalanced. Complain to maintainer\n");
235 sz = x;
236 }
237 304
305 old_sz = sz;
306 /*
307 * Round down to the nearest FAKE_NODE_MIN_SIZE.
308 */
309 sz &= FAKE_NODE_MIN_HASH_MASK;
310
311 /*
312 * We ensure that each node is at least 64MB big. Smaller than this
313 * size can cause VM hiccups.
314 */
315 if (sz == 0) {
316 printk(KERN_INFO "Not enough memory for %d nodes. Reducing "
317 "the number of nodes\n", numa_fake);
318 numa_fake = (max_addr - start - hole_size) / FAKE_NODE_MIN_SIZE;
319 printk(KERN_INFO "Number of fake nodes will be = %d\n",
320 numa_fake);
321 sz = FAKE_NODE_MIN_SIZE;
322 }
323 /*
324 * Find out how many nodes can get an extra NODE_MIN_SIZE granule.
325 * This logic ensures the extra memory gets distributed among as many
326 * nodes as possible (as compared to one single node getting all that
327 * extra memory.
328 */
329 big = ((old_sz - sz) * numa_fake) / FAKE_NODE_MIN_SIZE;
330 printk(KERN_INFO "Fake node Size: %luMB hole_size: %luMB big nodes: "
331 "%d\n",
332 (sz >> 20), (hole_size >> 20), big);
238 memset(&nodes,0,sizeof(nodes)); 333 memset(&nodes,0,sizeof(nodes));
334 end = start;
239 for (i = 0; i < numa_fake; i++) { 335 for (i = 0; i < numa_fake; i++) {
240 nodes[i].start = (start_pfn<<PAGE_SHIFT) + i*sz; 336 /*
337 * In case we are not able to allocate enough memory for all
338 * the nodes, we reduce the number of fake nodes.
339 */
340 if (end >= max_addr) {
341 numa_fake = i - 1;
342 break;
343 }
344 start = nodes[i].start = end;
345 /*
346 * Final node can have all the remaining memory.
347 */
241 if (i == numa_fake-1) 348 if (i == numa_fake-1)
242 sz = (end_pfn<<PAGE_SHIFT) - nodes[i].start; 349 sz = max_addr - start;
243 nodes[i].end = nodes[i].start + sz; 350 end = nodes[i].start + sz;
351 /*
352 * Fir "big" number of nodes get extra granule.
353 */
354 if (i < big)
355 end += FAKE_NODE_MIN_SIZE;
356 /*
357 * Iterate over the range to ensure that this node gets at
358 * least sz amount of RAM (excluding holes)
359 */
360 while ((end - start - e820_hole_size(start, end)) < sz) {
361 end += FAKE_NODE_MIN_SIZE;
362 if (end >= max_addr)
363 break;
364 }
365 /*
366 * Look at the next node to make sure there is some real memory
367 * to map. Bad things happen when the only memory present
368 * in a zone on a fake node is IO hole.
369 */
370 while (e820_hole_size(end, end + FAKE_NODE_MIN_SIZE) > 0) {
371 if (zone_cross_over(start, end + sz)) {
372 end = (MAX_DMA32_PFN << PAGE_SHIFT);
373 break;
374 }
375 if (end >= max_addr)
376 break;
377 end += FAKE_NODE_MIN_SIZE;
378 }
379 if (end > max_addr)
380 end = max_addr;
381 nodes[i].end = end;
244 printk(KERN_INFO "Faking node %d at %016Lx-%016Lx (%LuMB)\n", 382 printk(KERN_INFO "Faking node %d at %016Lx-%016Lx (%LuMB)\n",
245 i, 383 i,
246 nodes[i].start, nodes[i].end, 384 nodes[i].start, nodes[i].end,
@@ -290,6 +428,7 @@ void __init numa_initmem_init(unsigned long start_pfn, unsigned long end_pfn)
290 end_pfn << PAGE_SHIFT); 428 end_pfn << PAGE_SHIFT);
291 /* setup dummy node covering all memory */ 429 /* setup dummy node covering all memory */
292 memnode_shift = 63; 430 memnode_shift = 63;
431 memnodemap = memnode.embedded_map;
293 memnodemap[0] = 0; 432 memnodemap[0] = 0;
294 nodes_clear(node_online_map); 433 nodes_clear(node_online_map);
295 node_set_online(0); 434 node_set_online(0);
@@ -321,20 +460,6 @@ unsigned long __init numa_free_all_bootmem(void)
321 return pages; 460 return pages;
322} 461}
323 462
324#ifdef CONFIG_SPARSEMEM
325static void __init arch_sparse_init(void)
326{
327 int i;
328
329 for_each_online_node(i)
330 memory_present(i, node_start_pfn(i), node_end_pfn(i));
331
332 sparse_init();
333}
334#else
335#define arch_sparse_init() do {} while (0)
336#endif
337
338void __init paging_init(void) 463void __init paging_init(void)
339{ 464{
340 int i; 465 int i;
@@ -344,7 +469,8 @@ void __init paging_init(void)
344 max_zone_pfns[ZONE_DMA32] = MAX_DMA32_PFN; 469 max_zone_pfns[ZONE_DMA32] = MAX_DMA32_PFN;
345 max_zone_pfns[ZONE_NORMAL] = end_pfn; 470 max_zone_pfns[ZONE_NORMAL] = end_pfn;
346 471
347 arch_sparse_init(); 472 sparse_memory_present_with_active_regions(MAX_NUMNODES);
473 sparse_init();
348 474
349 for_each_online_node(i) { 475 for_each_online_node(i) {
350 setup_node_zones(i); 476 setup_node_zones(i);
diff --git a/arch/x86_64/mm/pageattr.c b/arch/x86_64/mm/pageattr.c
index ccb91dd996a9..65c5eaa59905 100644
--- a/arch/x86_64/mm/pageattr.c
+++ b/arch/x86_64/mm/pageattr.c
@@ -107,6 +107,7 @@ static void revert_page(unsigned long address, pgprot_t ref_prot)
107 pud_t *pud; 107 pud_t *pud;
108 pmd_t *pmd; 108 pmd_t *pmd;
109 pte_t large_pte; 109 pte_t large_pte;
110 unsigned long pfn;
110 111
111 pgd = pgd_offset_k(address); 112 pgd = pgd_offset_k(address);
112 BUG_ON(pgd_none(*pgd)); 113 BUG_ON(pgd_none(*pgd));
@@ -114,7 +115,8 @@ static void revert_page(unsigned long address, pgprot_t ref_prot)
114 BUG_ON(pud_none(*pud)); 115 BUG_ON(pud_none(*pud));
115 pmd = pmd_offset(pud, address); 116 pmd = pmd_offset(pud, address);
116 BUG_ON(pmd_val(*pmd) & _PAGE_PSE); 117 BUG_ON(pmd_val(*pmd) & _PAGE_PSE);
117 large_pte = mk_pte_phys(__pa(address) & LARGE_PAGE_MASK, ref_prot); 118 pfn = (__pa(address) & LARGE_PAGE_MASK) >> PAGE_SHIFT;
119 large_pte = pfn_pte(pfn, ref_prot);
118 large_pte = pte_mkhuge(large_pte); 120 large_pte = pte_mkhuge(large_pte);
119 set_pte((pte_t *)pmd, large_pte); 121 set_pte((pte_t *)pmd, large_pte);
120} 122}
diff --git a/arch/x86_64/pci/Makefile b/arch/x86_64/pci/Makefile
index 149aba05a5b8..c9eddc8859c0 100644
--- a/arch/x86_64/pci/Makefile
+++ b/arch/x86_64/pci/Makefile
@@ -11,7 +11,7 @@ obj-y += fixup.o init.o
11obj-$(CONFIG_ACPI) += acpi.o 11obj-$(CONFIG_ACPI) += acpi.o
12obj-y += legacy.o irq.o common.o early.o 12obj-y += legacy.o irq.o common.o early.o
13# mmconfig has a 64bit special 13# mmconfig has a 64bit special
14obj-$(CONFIG_PCI_MMCONFIG) += mmconfig.o direct.o 14obj-$(CONFIG_PCI_MMCONFIG) += mmconfig.o direct.o mmconfig-shared.o
15 15
16obj-$(CONFIG_NUMA) += k8-bus.o 16obj-$(CONFIG_NUMA) += k8-bus.o
17 17
@@ -24,3 +24,4 @@ fixup-y += ../../i386/pci/fixup.o
24i386-y += ../../i386/pci/i386.o 24i386-y += ../../i386/pci/i386.o
25init-y += ../../i386/pci/init.o 25init-y += ../../i386/pci/init.o
26early-y += ../../i386/pci/early.o 26early-y += ../../i386/pci/early.o
27mmconfig-shared-y += ../../i386/pci/mmconfig-shared.o
diff --git a/arch/x86_64/pci/mmconfig.c b/arch/x86_64/pci/mmconfig.c
index faabb6e87f12..65d82736987e 100644
--- a/arch/x86_64/pci/mmconfig.c
+++ b/arch/x86_64/pci/mmconfig.c
@@ -13,16 +13,6 @@
13 13
14#include "pci.h" 14#include "pci.h"
15 15
16/* aperture is up to 256MB but BIOS may reserve less */
17#define MMCONFIG_APER_MIN (2 * 1024*1024)
18#define MMCONFIG_APER_MAX (256 * 1024*1024)
19
20/* Verify the first 16 busses. We assume that systems with more busses
21 get MCFG right. */
22#define MAX_CHECK_BUS 16
23
24static DECLARE_BITMAP(fallback_slots, 32*MAX_CHECK_BUS);
25
26/* Static virtual mapping of the MMCONFIG aperture */ 16/* Static virtual mapping of the MMCONFIG aperture */
27struct mmcfg_virt { 17struct mmcfg_virt {
28 struct acpi_mcfg_allocation *cfg; 18 struct acpi_mcfg_allocation *cfg;
@@ -32,30 +22,17 @@ static struct mmcfg_virt *pci_mmcfg_virt;
32 22
33static char __iomem *get_virt(unsigned int seg, unsigned bus) 23static char __iomem *get_virt(unsigned int seg, unsigned bus)
34{ 24{
35 int cfg_num = -1;
36 struct acpi_mcfg_allocation *cfg; 25 struct acpi_mcfg_allocation *cfg;
26 int cfg_num;
37 27
38 while (1) { 28 for (cfg_num = 0; cfg_num < pci_mmcfg_config_num; cfg_num++) {
39 ++cfg_num;
40 if (cfg_num >= pci_mmcfg_config_num)
41 break;
42 cfg = pci_mmcfg_virt[cfg_num].cfg; 29 cfg = pci_mmcfg_virt[cfg_num].cfg;
43 if (cfg->pci_segment != seg) 30 if (cfg->pci_segment == seg &&
44 continue; 31 (cfg->start_bus_number <= bus) &&
45 if ((cfg->start_bus_number <= bus) &&
46 (cfg->end_bus_number >= bus)) 32 (cfg->end_bus_number >= bus))
47 return pci_mmcfg_virt[cfg_num].virt; 33 return pci_mmcfg_virt[cfg_num].virt;
48 } 34 }
49 35
50 /* Handle more broken MCFG tables on Asus etc.
51 They only contain a single entry for bus 0-0. Assume
52 this applies to all busses. */
53 cfg = &pci_mmcfg_config[0];
54 if (pci_mmcfg_config_num == 1 &&
55 cfg->pci_segment == 0 &&
56 (cfg->start_bus_number | cfg->end_bus_number) == 0)
57 return pci_mmcfg_virt[0].virt;
58
59 /* Fall back to type 0 */ 36 /* Fall back to type 0 */
60 return NULL; 37 return NULL;
61} 38}
@@ -63,8 +40,8 @@ static char __iomem *get_virt(unsigned int seg, unsigned bus)
63static char __iomem *pci_dev_base(unsigned int seg, unsigned int bus, unsigned int devfn) 40static char __iomem *pci_dev_base(unsigned int seg, unsigned int bus, unsigned int devfn)
64{ 41{
65 char __iomem *addr; 42 char __iomem *addr;
66 if (seg == 0 && bus < MAX_CHECK_BUS && 43 if (seg == 0 && bus < PCI_MMCFG_MAX_CHECK_BUS &&
67 test_bit(32*bus + PCI_SLOT(devfn), fallback_slots)) 44 test_bit(32*bus + PCI_SLOT(devfn), pci_mmcfg_fallback_slots))
68 return NULL; 45 return NULL;
69 addr = get_virt(seg, bus); 46 addr = get_virt(seg, bus);
70 if (!addr) 47 if (!addr)
@@ -135,79 +112,46 @@ static struct pci_raw_ops pci_mmcfg = {
135 .write = pci_mmcfg_write, 112 .write = pci_mmcfg_write,
136}; 113};
137 114
138/* K8 systems have some devices (typically in the builtin northbridge) 115static void __iomem * __init mcfg_ioremap(struct acpi_mcfg_allocation *cfg)
139 that are only accessible using type1
140 Normally this can be expressed in the MCFG by not listing them
141 and assigning suitable _SEGs, but this isn't implemented in some BIOS.
142 Instead try to discover all devices on bus 0 that are unreachable using MM
143 and fallback for them. */
144static __init void unreachable_devices(void)
145{ 116{
146 int i, k; 117 void __iomem *addr;
147 /* Use the max bus number from ACPI here? */ 118 u32 size;
148 for (k = 0; k < MAX_CHECK_BUS; k++) { 119
149 for (i = 0; i < 32; i++) { 120 size = (cfg->end_bus_number + 1) << 20;
150 u32 val1; 121 addr = ioremap_nocache(cfg->address, size);
151 char __iomem *addr; 122 if (addr) {
152 123 printk(KERN_INFO "PCI: Using MMCONFIG at %Lx - %Lx\n",
153 pci_conf1_read(0, k, PCI_DEVFN(i,0), 0, 4, &val1); 124 cfg->address, cfg->address + size - 1);
154 if (val1 == 0xffffffff)
155 continue;
156 addr = pci_dev_base(0, k, PCI_DEVFN(i, 0));
157 if (addr == NULL|| readl(addr) != val1) {
158 set_bit(i + 32*k, fallback_slots);
159 printk(KERN_NOTICE "PCI: No mmconfig possible"
160 " on device %02x:%02x\n", k, i);
161 }
162 }
163 } 125 }
126 return addr;
164} 127}
165 128
166void __init pci_mmcfg_init(int type) 129int __init pci_mmcfg_arch_reachable(unsigned int seg, unsigned int bus,
130 unsigned int devfn)
167{ 131{
168 int i; 132 return pci_dev_base(seg, bus, devfn) != NULL;
169 133}
170 if ((pci_probe & PCI_PROBE_MMCONF) == 0)
171 return;
172
173 acpi_table_parse(ACPI_SIG_MCFG, acpi_parse_mcfg);
174 if ((pci_mmcfg_config_num == 0) ||
175 (pci_mmcfg_config == NULL) ||
176 (pci_mmcfg_config[0].address == 0))
177 return;
178
179 /* Only do this check when type 1 works. If it doesn't work
180 assume we run on a Mac and always use MCFG */
181 if (type == 1 && !e820_all_mapped(pci_mmcfg_config[0].address,
182 pci_mmcfg_config[0].address + MMCONFIG_APER_MIN,
183 E820_RESERVED)) {
184 printk(KERN_ERR "PCI: BIOS Bug: MCFG area at %lx is not E820-reserved\n",
185 (unsigned long)pci_mmcfg_config[0].address);
186 printk(KERN_ERR "PCI: Not using MMCONFIG.\n");
187 return;
188 }
189 134
190 pci_mmcfg_virt = kmalloc(sizeof(*pci_mmcfg_virt) * pci_mmcfg_config_num, GFP_KERNEL); 135int __init pci_mmcfg_arch_init(void)
136{
137 int i;
138 pci_mmcfg_virt = kmalloc(sizeof(*pci_mmcfg_virt) *
139 pci_mmcfg_config_num, GFP_KERNEL);
191 if (pci_mmcfg_virt == NULL) { 140 if (pci_mmcfg_virt == NULL) {
192 printk(KERN_ERR "PCI: Can not allocate memory for mmconfig structures\n"); 141 printk(KERN_ERR "PCI: Can not allocate memory for mmconfig structures\n");
193 return; 142 return 0;
194 } 143 }
144
195 for (i = 0; i < pci_mmcfg_config_num; ++i) { 145 for (i = 0; i < pci_mmcfg_config_num; ++i) {
196 pci_mmcfg_virt[i].cfg = &pci_mmcfg_config[i]; 146 pci_mmcfg_virt[i].cfg = &pci_mmcfg_config[i];
197 pci_mmcfg_virt[i].virt = ioremap_nocache(pci_mmcfg_config[i].address, 147 pci_mmcfg_virt[i].virt = mcfg_ioremap(&pci_mmcfg_config[i]);
198 MMCONFIG_APER_MAX);
199 if (!pci_mmcfg_virt[i].virt) { 148 if (!pci_mmcfg_virt[i].virt) {
200 printk(KERN_ERR "PCI: Cannot map mmconfig aperture for " 149 printk(KERN_ERR "PCI: Cannot map mmconfig aperture for "
201 "segment %d\n", 150 "segment %d\n",
202 pci_mmcfg_config[i].pci_segment); 151 pci_mmcfg_config[i].pci_segment);
203 return; 152 return 0;
204 } 153 }
205 printk(KERN_INFO "PCI: Using MMCONFIG at %lx\n",
206 (unsigned long)pci_mmcfg_config[i].address);
207 } 154 }
208
209 unreachable_devices();
210
211 raw_pci_ops = &pci_mmcfg; 155 raw_pci_ops = &pci_mmcfg;
212 pci_probe = (pci_probe & ~PCI_PROBE_MASK) | PCI_PROBE_MMCONF; 156 return 1;
213} 157}
diff --git a/drivers/acorn/block/mfmhd.c b/drivers/acorn/block/mfmhd.c
index 7fde8f4daebf..689a4c3542ba 100644
--- a/drivers/acorn/block/mfmhd.c
+++ b/drivers/acorn/block/mfmhd.c
@@ -99,7 +99,6 @@
99 */ 99 */
100 100
101#include <linux/module.h> 101#include <linux/module.h>
102#include <linux/sched.h>
103#include <linux/fs.h> 102#include <linux/fs.h>
104#include <linux/interrupt.h> 103#include <linux/interrupt.h>
105#include <linux/kernel.h> 104#include <linux/kernel.h>
diff --git a/drivers/acorn/char/i2c.c b/drivers/acorn/char/i2c.c
index 157d8b73bb64..d276fd14d63a 100644
--- a/drivers/acorn/char/i2c.c
+++ b/drivers/acorn/char/i2c.c
@@ -14,7 +14,6 @@
14 */ 14 */
15#include <linux/capability.h> 15#include <linux/capability.h>
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/sched.h>
18#include <linux/time.h> 17#include <linux/time.h>
19#include <linux/miscdevice.h> 18#include <linux/miscdevice.h>
20#include <linux/rtc.h> 19#include <linux/rtc.h>
diff --git a/drivers/acpi/i2c_ec.c b/drivers/acpi/i2c_ec.c
index bb54b6cdb30b..76ec8b63e69f 100644
--- a/drivers/acpi/i2c_ec.c
+++ b/drivers/acpi/i2c_ec.c
@@ -14,7 +14,6 @@
14#include <linux/slab.h> 14#include <linux/slab.h>
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/stddef.h> 16#include <linux/stddef.h>
17#include <linux/sched.h>
18#include <linux/init.h> 17#include <linux/init.h>
19#include <linux/i2c.h> 18#include <linux/i2c.h>
20#include <linux/acpi.h> 19#include <linux/acpi.h>
diff --git a/drivers/acpi/namespace/nsinit.c b/drivers/acpi/namespace/nsinit.c
index 326af8fc0ce7..33db2241044e 100644
--- a/drivers/acpi/namespace/nsinit.c
+++ b/drivers/acpi/namespace/nsinit.c
@@ -45,6 +45,7 @@
45#include <acpi/acnamesp.h> 45#include <acpi/acnamesp.h>
46#include <acpi/acdispat.h> 46#include <acpi/acdispat.h>
47#include <acpi/acinterp.h> 47#include <acpi/acinterp.h>
48#include <linux/nmi.h>
48 49
49#define _COMPONENT ACPI_NAMESPACE 50#define _COMPONENT ACPI_NAMESPACE
50ACPI_MODULE_NAME("nsinit") 51ACPI_MODULE_NAME("nsinit")
@@ -534,7 +535,15 @@ acpi_ns_init_one_device(acpi_handle obj_handle,
534 info->parameter_type = ACPI_PARAM_ARGS; 535 info->parameter_type = ACPI_PARAM_ARGS;
535 info->flags = ACPI_IGNORE_RETURN_VALUE; 536 info->flags = ACPI_IGNORE_RETURN_VALUE;
536 537
538 /*
539 * Some hardware relies on this being executed as atomically
540 * as possible (without an NMI being received in the middle of
541 * this) - so disable NMIs and initialize the device:
542 */
543 acpi_nmi_disable();
537 status = acpi_ns_evaluate(info); 544 status = acpi_ns_evaluate(info);
545 acpi_nmi_enable();
546
538 if (ACPI_SUCCESS(status)) { 547 if (ACPI_SUCCESS(status)) {
539 walk_info->num_INI++; 548 walk_info->num_INI++;
540 549
diff --git a/drivers/acpi/sleep/poweroff.c b/drivers/acpi/sleep/poweroff.c
index 47fb4b394eec..d9801eff6489 100644
--- a/drivers/acpi/sleep/poweroff.c
+++ b/drivers/acpi/sleep/poweroff.c
@@ -12,7 +12,6 @@
12#include <linux/pm.h> 12#include <linux/pm.h>
13#include <linux/init.h> 13#include <linux/init.h>
14#include <acpi/acpi_bus.h> 14#include <acpi/acpi_bus.h>
15#include <linux/sched.h>
16#include <linux/sysdev.h> 15#include <linux/sysdev.h>
17#include <asm/io.h> 16#include <asm/io.h>
18#include "sleep.h" 17#include "sleep.h"
diff --git a/drivers/acpi/tables.c b/drivers/acpi/tables.c
index ba4cb200314a..45bd17313c4a 100644
--- a/drivers/acpi/tables.c
+++ b/drivers/acpi/tables.c
@@ -25,7 +25,6 @@
25 25
26#include <linux/init.h> 26#include <linux/init.h>
27#include <linux/kernel.h> 27#include <linux/kernel.h>
28#include <linux/sched.h>
29#include <linux/smp.h> 28#include <linux/smp.h>
30#include <linux/string.h> 29#include <linux/string.h>
31#include <linux/types.h> 30#include <linux/types.h>
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c
index f76d3168c2b2..986afd470a14 100644
--- a/drivers/acpi/thermal.c
+++ b/drivers/acpi/thermal.c
@@ -36,7 +36,8 @@
36#include <linux/init.h> 36#include <linux/init.h>
37#include <linux/types.h> 37#include <linux/types.h>
38#include <linux/proc_fs.h> 38#include <linux/proc_fs.h>
39#include <linux/sched.h> 39#include <linux/timer.h>
40#include <linux/jiffies.h>
40#include <linux/kmod.h> 41#include <linux/kmod.h>
41#include <linux/seq_file.h> 42#include <linux/seq_file.h>
42#include <asm/uaccess.h> 43#include <asm/uaccess.h>
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 92cdb0c5171f..6a3543e06241 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -39,7 +39,6 @@
39#include <linux/blkdev.h> 39#include <linux/blkdev.h>
40#include <linux/delay.h> 40#include <linux/delay.h>
41#include <linux/interrupt.h> 41#include <linux/interrupt.h>
42#include <linux/sched.h>
43#include <linux/dma-mapping.h> 42#include <linux/dma-mapping.h>
44#include <linux/device.h> 43#include <linux/device.h>
45#include <scsi/scsi_host.h> 44#include <scsi/scsi_host.h>
diff --git a/drivers/ata/pata_mpiix.c b/drivers/ata/pata_mpiix.c
index ca8c965179b1..f2e7115f7ab9 100644
--- a/drivers/ata/pata_mpiix.c
+++ b/drivers/ata/pata_mpiix.c
@@ -241,7 +241,7 @@ static int mpiix_init_one(struct pci_dev *dev, const struct pci_device_id *id)
241 probe.port_ops = &mpiix_port_ops; 241 probe.port_ops = &mpiix_port_ops;
242 probe.sht = &mpiix_sht; 242 probe.sht = &mpiix_sht;
243 probe.pio_mask = 0x1F; 243 probe.pio_mask = 0x1F;
244 probe.irq_flags = SA_SHIRQ; 244 probe.irq_flags = IRQF_SHARED;
245 probe.port_flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST; 245 probe.port_flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST;
246 probe.n_ports = 1; 246 probe.n_ports = 1;
247 247
diff --git a/drivers/ata/pata_pcmcia.c b/drivers/ata/pata_pcmcia.c
index acfc09f9abd9..36468ec6454c 100644
--- a/drivers/ata/pata_pcmcia.c
+++ b/drivers/ata/pata_pcmcia.c
@@ -264,7 +264,7 @@ next_entry:
264 ae.n_ports = 1; 264 ae.n_ports = 1;
265 ae.pio_mask = 1; /* ISA so PIO 0 cycles */ 265 ae.pio_mask = 1; /* ISA so PIO 0 cycles */
266 ae.irq = pdev->irq.AssignedIRQ; 266 ae.irq = pdev->irq.AssignedIRQ;
267 ae.irq_flags = SA_SHIRQ; 267 ae.irq_flags = IRQF_SHARED;
268 ae.port_flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST; 268 ae.port_flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST;
269 ae.port[0].cmd_addr = io_addr; 269 ae.port[0].cmd_addr = io_addr;
270 ae.port[0].altstatus_addr = ctl_addr; 270 ae.port[0].altstatus_addr = ctl_addr;
diff --git a/drivers/ata/pata_pdc2027x.c b/drivers/ata/pata_pdc2027x.c
index ffa7f47fbb20..61537873d28e 100644
--- a/drivers/ata/pata_pdc2027x.c
+++ b/drivers/ata/pata_pdc2027x.c
@@ -796,7 +796,7 @@ static int __devinit pdc2027x_init_one(struct pci_dev *pdev, const struct pci_de
796 probe_ent->port_ops = pdc2027x_port_info[board_idx].port_ops; 796 probe_ent->port_ops = pdc2027x_port_info[board_idx].port_ops;
797 797
798 probe_ent->irq = pdev->irq; 798 probe_ent->irq = pdev->irq;
799 probe_ent->irq_flags = SA_SHIRQ; 799 probe_ent->irq_flags = IRQF_SHARED;
800 probe_ent->iomap = pcim_iomap_table(pdev); 800 probe_ent->iomap = pcim_iomap_table(pdev);
801 801
802 mmio_base = probe_ent->iomap[PDC_MMIO_BAR]; 802 mmio_base = probe_ent->iomap[PDC_MMIO_BAR];
diff --git a/drivers/ata/pdc_adma.c b/drivers/ata/pdc_adma.c
index b4ed8ce553e6..857ac23217ab 100644
--- a/drivers/ata/pdc_adma.c
+++ b/drivers/ata/pdc_adma.c
@@ -39,7 +39,6 @@
39#include <linux/blkdev.h> 39#include <linux/blkdev.h>
40#include <linux/delay.h> 40#include <linux/delay.h>
41#include <linux/interrupt.h> 41#include <linux/interrupt.h>
42#include <linux/sched.h>
43#include <linux/device.h> 42#include <linux/device.h>
44#include <scsi/scsi_host.h> 43#include <scsi/scsi_host.h>
45#include <linux/libata.h> 44#include <linux/libata.h>
diff --git a/drivers/ata/sata_inic162x.c b/drivers/ata/sata_inic162x.c
index c5335f422801..31b636fac98e 100644
--- a/drivers/ata/sata_inic162x.c
+++ b/drivers/ata/sata_inic162x.c
@@ -710,7 +710,7 @@ static int inic_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
710 probe_ent->n_ports = NR_PORTS; 710 probe_ent->n_ports = NR_PORTS;
711 711
712 probe_ent->irq = pdev->irq; 712 probe_ent->irq = pdev->irq;
713 probe_ent->irq_flags = SA_SHIRQ; 713 probe_ent->irq_flags = IRQF_SHARED;
714 714
715 probe_ent->iomap = iomap; 715 probe_ent->iomap = iomap;
716 716
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
index 769eca52442c..d689df52eae3 100644
--- a/drivers/ata/sata_mv.c
+++ b/drivers/ata/sata_mv.c
@@ -28,7 +28,6 @@
28#include <linux/blkdev.h> 28#include <linux/blkdev.h>
29#include <linux/delay.h> 29#include <linux/delay.h>
30#include <linux/interrupt.h> 30#include <linux/interrupt.h>
31#include <linux/sched.h>
32#include <linux/dma-mapping.h> 31#include <linux/dma-mapping.h>
33#include <linux/device.h> 32#include <linux/device.h>
34#include <scsi/scsi_host.h> 33#include <scsi/scsi_host.h>
diff --git a/drivers/ata/sata_promise.c b/drivers/ata/sata_promise.c
index 3be4cc338d7b..b2e2e695c92e 100644
--- a/drivers/ata/sata_promise.c
+++ b/drivers/ata/sata_promise.c
@@ -37,7 +37,6 @@
37#include <linux/blkdev.h> 37#include <linux/blkdev.h>
38#include <linux/delay.h> 38#include <linux/delay.h>
39#include <linux/interrupt.h> 39#include <linux/interrupt.h>
40#include <linux/sched.h>
41#include <linux/device.h> 40#include <linux/device.h>
42#include <scsi/scsi.h> 41#include <scsi/scsi.h>
43#include <scsi/scsi_host.h> 42#include <scsi/scsi_host.h>
diff --git a/drivers/ata/sata_qstor.c b/drivers/ata/sata_qstor.c
index bfa35ede6551..6097d8f2a0c0 100644
--- a/drivers/ata/sata_qstor.c
+++ b/drivers/ata/sata_qstor.c
@@ -34,7 +34,6 @@
34#include <linux/blkdev.h> 34#include <linux/blkdev.h>
35#include <linux/delay.h> 35#include <linux/delay.h>
36#include <linux/interrupt.h> 36#include <linux/interrupt.h>
37#include <linux/sched.h>
38#include <linux/device.h> 37#include <linux/device.h>
39#include <scsi/scsi_host.h> 38#include <scsi/scsi_host.h>
40#include <linux/libata.h> 39#include <linux/libata.h>
diff --git a/drivers/ata/sata_sx4.c b/drivers/ata/sata_sx4.c
index 06e87a377382..0ebd77b080d6 100644
--- a/drivers/ata/sata_sx4.c
+++ b/drivers/ata/sata_sx4.c
@@ -37,7 +37,6 @@
37#include <linux/blkdev.h> 37#include <linux/blkdev.h>
38#include <linux/delay.h> 38#include <linux/delay.h>
39#include <linux/interrupt.h> 39#include <linux/interrupt.h>
40#include <linux/sched.h>
41#include <linux/device.h> 40#include <linux/device.h>
42#include <scsi/scsi_host.h> 41#include <scsi/scsi_host.h>
43#include <scsi/scsi_cmnd.h> 42#include <scsi/scsi_cmnd.h>
diff --git a/drivers/atm/adummy.c b/drivers/atm/adummy.c
index ac2c10822be0..8d60c4eb54fe 100644
--- a/drivers/atm/adummy.c
+++ b/drivers/atm/adummy.c
@@ -13,7 +13,6 @@
13#include <linux/delay.h> 13#include <linux/delay.h>
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/mm.h> 15#include <linux/mm.h>
16#include <linux/sched.h>
17#include <linux/timer.h> 16#include <linux/timer.h>
18#include <linux/interrupt.h> 17#include <linux/interrupt.h>
19#include <asm/io.h> 18#include <asm/io.h>
diff --git a/drivers/atm/fore200e.c b/drivers/atm/fore200e.c
index 4aeb3d062ff6..a7c0ed3107e3 100644
--- a/drivers/atm/fore200e.c
+++ b/drivers/atm/fore200e.c
@@ -29,7 +29,6 @@
29#include <linux/slab.h> 29#include <linux/slab.h>
30#include <linux/init.h> 30#include <linux/init.h>
31#include <linux/capability.h> 31#include <linux/capability.h>
32#include <linux/sched.h>
33#include <linux/interrupt.h> 32#include <linux/interrupt.h>
34#include <linux/bitops.h> 33#include <linux/bitops.h>
35#include <linux/pci.h> 34#include <linux/pci.h>
diff --git a/drivers/atm/idt77105.c b/drivers/atm/idt77105.c
index 325325afabec..0bd657f5dd2a 100644
--- a/drivers/atm/idt77105.c
+++ b/drivers/atm/idt77105.c
@@ -4,7 +4,6 @@
4 4
5 5
6#include <linux/module.h> 6#include <linux/module.h>
7#include <linux/sched.h>
8#include <linux/kernel.h> 7#include <linux/kernel.h>
9#include <linux/mm.h> 8#include <linux/mm.h>
10#include <linux/errno.h> 9#include <linux/errno.h>
diff --git a/drivers/atm/uPD98402.c b/drivers/atm/uPD98402.c
index 9504cce51bfb..fc8cb07c2477 100644
--- a/drivers/atm/uPD98402.c
+++ b/drivers/atm/uPD98402.c
@@ -4,7 +4,6 @@
4 4
5 5
6#include <linux/module.h> 6#include <linux/module.h>
7#include <linux/sched.h> /* for jiffies */
8#include <linux/mm.h> 7#include <linux/mm.h>
9#include <linux/errno.h> 8#include <linux/errno.h>
10#include <linux/atmdev.h> 9#include <linux/atmdev.h>
diff --git a/drivers/atm/zatm.c b/drivers/atm/zatm.c
index 756d4f760da3..0d7091e2077f 100644
--- a/drivers/atm/zatm.c
+++ b/drivers/atm/zatm.c
@@ -4,7 +4,6 @@
4 4
5 5
6#include <linux/module.h> 6#include <linux/module.h>
7#include <linux/sched.h>
8#include <linux/kernel.h> 7#include <linux/kernel.h>
9#include <linux/mm.h> 8#include <linux/mm.h>
10#include <linux/pci.h> 9#include <linux/pci.h>
diff --git a/drivers/block/acsi.c b/drivers/block/acsi.c
index 706cdc6a69ec..e3d9152e231a 100644
--- a/drivers/block/acsi.c
+++ b/drivers/block/acsi.c
@@ -46,7 +46,6 @@
46#include <linux/module.h> 46#include <linux/module.h>
47#include <linux/errno.h> 47#include <linux/errno.h>
48#include <linux/signal.h> 48#include <linux/signal.h>
49#include <linux/sched.h>
50#include <linux/timer.h> 49#include <linux/timer.h>
51#include <linux/fs.h> 50#include <linux/fs.h>
52#include <linux/kernel.h> 51#include <linux/kernel.h>
diff --git a/drivers/block/paride/pd.c b/drivers/block/paride/pd.c
index 9d9bff23f426..99e2c8ce1cc4 100644
--- a/drivers/block/paride/pd.c
+++ b/drivers/block/paride/pd.c
@@ -153,7 +153,6 @@ enum {D_PRT, D_PRO, D_UNI, D_MOD, D_GEO, D_SBY, D_DLY, D_SLV};
153#include <linux/blkpg.h> 153#include <linux/blkpg.h>
154#include <linux/kernel.h> 154#include <linux/kernel.h>
155#include <asm/uaccess.h> 155#include <asm/uaccess.h>
156#include <linux/sched.h>
157#include <linux/workqueue.h> 156#include <linux/workqueue.h>
158 157
159static DEFINE_SPINLOCK(pd_lock); 158static DEFINE_SPINLOCK(pd_lock);
diff --git a/drivers/block/umem.c b/drivers/block/umem.c
index 30f16bd83650..dff3766f117f 100644
--- a/drivers/block/umem.c
+++ b/drivers/block/umem.c
@@ -35,7 +35,6 @@
35 */ 35 */
36 36
37//#define DEBUG /* uncomment if you want debugging info (pr_debug) */ 37//#define DEBUG /* uncomment if you want debugging info (pr_debug) */
38#include <linux/sched.h>
39#include <linux/fs.h> 38#include <linux/fs.h>
40#include <linux/bio.h> 39#include <linux/bio.h>
41#include <linux/kernel.h> 40#include <linux/kernel.h>
diff --git a/drivers/bluetooth/bfusb.c b/drivers/bluetooth/bfusb.c
index 31ade991aa91..27cceb6f5652 100644
--- a/drivers/bluetooth/bfusb.c
+++ b/drivers/bluetooth/bfusb.c
@@ -27,7 +27,6 @@
27#include <linux/init.h> 27#include <linux/init.h>
28#include <linux/slab.h> 28#include <linux/slab.h>
29#include <linux/types.h> 29#include <linux/types.h>
30#include <linux/sched.h>
31#include <linux/errno.h> 30#include <linux/errno.h>
32#include <linux/skbuff.h> 31#include <linux/skbuff.h>
33 32
diff --git a/drivers/bluetooth/bt3c_cs.c b/drivers/bluetooth/bt3c_cs.c
index aae3abace586..34e5555cb917 100644
--- a/drivers/bluetooth/bt3c_cs.c
+++ b/drivers/bluetooth/bt3c_cs.c
@@ -27,7 +27,6 @@
27#include <linux/init.h> 27#include <linux/init.h>
28#include <linux/slab.h> 28#include <linux/slab.h>
29#include <linux/types.h> 29#include <linux/types.h>
30#include <linux/sched.h>
31#include <linux/delay.h> 30#include <linux/delay.h>
32#include <linux/errno.h> 31#include <linux/errno.h>
33#include <linux/ptrace.h> 32#include <linux/ptrace.h>
diff --git a/drivers/bluetooth/btuart_cs.c b/drivers/bluetooth/btuart_cs.c
index 92648ef2f5d0..c1bce75148fe 100644
--- a/drivers/bluetooth/btuart_cs.c
+++ b/drivers/bluetooth/btuart_cs.c
@@ -26,7 +26,6 @@
26#include <linux/init.h> 26#include <linux/init.h>
27#include <linux/slab.h> 27#include <linux/slab.h>
28#include <linux/types.h> 28#include <linux/types.h>
29#include <linux/sched.h>
30#include <linux/delay.h> 29#include <linux/delay.h>
31#include <linux/errno.h> 30#include <linux/errno.h>
32#include <linux/ptrace.h> 31#include <linux/ptrace.h>
diff --git a/drivers/bluetooth/dtl1_cs.c b/drivers/bluetooth/dtl1_cs.c
index 77b99eecbc49..459aa97937ab 100644
--- a/drivers/bluetooth/dtl1_cs.c
+++ b/drivers/bluetooth/dtl1_cs.c
@@ -26,7 +26,6 @@
26#include <linux/init.h> 26#include <linux/init.h>
27#include <linux/slab.h> 27#include <linux/slab.h>
28#include <linux/types.h> 28#include <linux/types.h>
29#include <linux/sched.h>
30#include <linux/delay.h> 29#include <linux/delay.h>
31#include <linux/errno.h> 30#include <linux/errno.h>
32#include <linux/ptrace.h> 31#include <linux/ptrace.h>
diff --git a/drivers/bluetooth/hci_bcsp.c b/drivers/bluetooth/hci_bcsp.c
index 5e2c31882003..d66064ccb31c 100644
--- a/drivers/bluetooth/hci_bcsp.c
+++ b/drivers/bluetooth/hci_bcsp.c
@@ -26,7 +26,6 @@
26 26
27#include <linux/kernel.h> 27#include <linux/kernel.h>
28#include <linux/init.h> 28#include <linux/init.h>
29#include <linux/sched.h>
30#include <linux/types.h> 29#include <linux/types.h>
31#include <linux/fcntl.h> 30#include <linux/fcntl.h>
32#include <linux/interrupt.h> 31#include <linux/interrupt.h>
diff --git a/drivers/bluetooth/hci_h4.c b/drivers/bluetooth/hci_h4.c
index ad62abbbb739..34f0afc42407 100644
--- a/drivers/bluetooth/hci_h4.c
+++ b/drivers/bluetooth/hci_h4.c
@@ -27,7 +27,6 @@
27 27
28#include <linux/kernel.h> 28#include <linux/kernel.h>
29#include <linux/init.h> 29#include <linux/init.h>
30#include <linux/sched.h>
31#include <linux/types.h> 30#include <linux/types.h>
32#include <linux/fcntl.h> 31#include <linux/fcntl.h>
33#include <linux/interrupt.h> 32#include <linux/interrupt.h>
diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c
index 420b645c4c9f..0f4203b499af 100644
--- a/drivers/bluetooth/hci_ldisc.c
+++ b/drivers/bluetooth/hci_ldisc.c
@@ -27,7 +27,6 @@
27 27
28#include <linux/kernel.h> 28#include <linux/kernel.h>
29#include <linux/init.h> 29#include <linux/init.h>
30#include <linux/sched.h>
31#include <linux/types.h> 30#include <linux/types.h>
32#include <linux/fcntl.h> 31#include <linux/fcntl.h>
33#include <linux/interrupt.h> 32#include <linux/interrupt.h>
diff --git a/drivers/bluetooth/hci_usb.c b/drivers/bluetooth/hci_usb.c
index 6bdf593081d8..406af579ac3a 100644
--- a/drivers/bluetooth/hci_usb.c
+++ b/drivers/bluetooth/hci_usb.c
@@ -35,7 +35,6 @@
35 35
36#include <linux/kernel.h> 36#include <linux/kernel.h>
37#include <linux/init.h> 37#include <linux/init.h>
38#include <linux/sched.h>
39#include <linux/unistd.h> 38#include <linux/unistd.h>
40#include <linux/types.h> 39#include <linux/types.h>
41#include <linux/interrupt.h> 40#include <linux/interrupt.h>
diff --git a/drivers/cdrom/aztcd.c b/drivers/cdrom/aztcd.c
index ec469497c10f..1f9fb7a96703 100644
--- a/drivers/cdrom/aztcd.c
+++ b/drivers/cdrom/aztcd.c
@@ -170,7 +170,6 @@
170 170
171#include <linux/module.h> 171#include <linux/module.h>
172#include <linux/errno.h> 172#include <linux/errno.h>
173#include <linux/sched.h>
174#include <linux/mm.h> 173#include <linux/mm.h>
175#include <linux/timer.h> 174#include <linux/timer.h>
176#include <linux/fs.h> 175#include <linux/fs.h>
diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c
index 3105dddf59f1..b36f44d4d1bf 100644
--- a/drivers/cdrom/cdrom.c
+++ b/drivers/cdrom/cdrom.c
@@ -3553,9 +3553,7 @@ static void cdrom_sysctl_register(void)
3553 if (initialized == 1) 3553 if (initialized == 1)
3554 return; 3554 return;
3555 3555
3556 cdrom_sysctl_header = register_sysctl_table(cdrom_root_table, 1); 3556 cdrom_sysctl_header = register_sysctl_table(cdrom_root_table);
3557 if (cdrom_root_table->ctl_name && cdrom_root_table->child->de)
3558 cdrom_root_table->child->de->owner = THIS_MODULE;
3559 3557
3560 /* set the defaults */ 3558 /* set the defaults */
3561 cdrom_sysctl_settings.autoclose = autoclose; 3559 cdrom_sysctl_settings.autoclose = autoclose;
diff --git a/drivers/cdrom/cm206.c b/drivers/cdrom/cm206.c
index b6c61bbb20e1..230131163240 100644
--- a/drivers/cdrom/cm206.c
+++ b/drivers/cdrom/cm206.c
@@ -183,7 +183,6 @@ History:
183#include <linux/errno.h> /* These include what we really need */ 183#include <linux/errno.h> /* These include what we really need */
184#include <linux/delay.h> 184#include <linux/delay.h>
185#include <linux/string.h> 185#include <linux/string.h>
186#include <linux/sched.h>
187#include <linux/interrupt.h> 186#include <linux/interrupt.h>
188#include <linux/timer.h> 187#include <linux/timer.h>
189#include <linux/cdrom.h> 188#include <linux/cdrom.h>
diff --git a/drivers/cdrom/gscd.c b/drivers/cdrom/gscd.c
index fa7082489765..b3ab6e9b8df1 100644
--- a/drivers/cdrom/gscd.c
+++ b/drivers/cdrom/gscd.c
@@ -53,7 +53,6 @@
53#include <linux/slab.h> 53#include <linux/slab.h>
54#include <linux/errno.h> 54#include <linux/errno.h>
55#include <linux/signal.h> 55#include <linux/signal.h>
56#include <linux/sched.h>
57#include <linux/timer.h> 56#include <linux/timer.h>
58#include <linux/fs.h> 57#include <linux/fs.h>
59#include <linux/mm.h> 58#include <linux/mm.h>
diff --git a/drivers/cdrom/sjcd.c b/drivers/cdrom/sjcd.c
index bf5aef4e555b..5409fca5bbfc 100644
--- a/drivers/cdrom/sjcd.c
+++ b/drivers/cdrom/sjcd.c
@@ -60,7 +60,6 @@
60 60
61#include <linux/module.h> 61#include <linux/module.h>
62#include <linux/errno.h> 62#include <linux/errno.h>
63#include <linux/sched.h>
64#include <linux/mm.h> 63#include <linux/mm.h>
65#include <linux/timer.h> 64#include <linux/timer.h>
66#include <linux/fs.h> 65#include <linux/fs.h>
diff --git a/drivers/char/briq_panel.c b/drivers/char/briq_panel.c
index 7f60a18ef76b..8dcf9d20f449 100644
--- a/drivers/char/briq_panel.c
+++ b/drivers/char/briq_panel.c
@@ -8,7 +8,6 @@
8 8
9#include <linux/types.h> 9#include <linux/types.h>
10#include <linux/errno.h> 10#include <linux/errno.h>
11#include <linux/sched.h>
12#include <linux/tty.h> 11#include <linux/tty.h>
13#include <linux/timer.h> 12#include <linux/timer.h>
14#include <linux/kernel.h> 13#include <linux/kernel.h>
diff --git a/drivers/char/drm/ffb_context.c b/drivers/char/drm/ffb_context.c
index 1383727b443a..ac9ab40d57aa 100644
--- a/drivers/char/drm/ffb_context.c
+++ b/drivers/char/drm/ffb_context.c
@@ -7,7 +7,6 @@
7 * for authors. 7 * for authors.
8 */ 8 */
9 9
10#include <linux/sched.h>
11#include <asm/upa.h> 10#include <asm/upa.h>
12 11
13#include "ffb.h" 12#include "ffb.h"
diff --git a/drivers/char/drm/ffb_drv.c b/drivers/char/drm/ffb_drv.c
index dd45111a4854..9a19879e3b68 100644
--- a/drivers/char/drm/ffb_drv.c
+++ b/drivers/char/drm/ffb_drv.c
@@ -9,7 +9,6 @@
9 9
10#include "ffb_drv.h" 10#include "ffb_drv.h"
11 11
12#include <linux/sched.h>
13#include <linux/smp_lock.h> 12#include <linux/smp_lock.h>
14#include <asm/shmparam.h> 13#include <asm/shmparam.h>
15#include <asm/oplib.h> 14#include <asm/oplib.h>
diff --git a/drivers/char/ds1620.c b/drivers/char/ds1620.c
index 48cb8f0e8ebf..3d7efc26aad6 100644
--- a/drivers/char/ds1620.c
+++ b/drivers/char/ds1620.c
@@ -3,7 +3,6 @@
3 * thermometer driver (as used in the Rebel.com NetWinder) 3 * thermometer driver (as used in the Rebel.com NetWinder)
4 */ 4 */
5#include <linux/module.h> 5#include <linux/module.h>
6#include <linux/sched.h>
7#include <linux/miscdevice.h> 6#include <linux/miscdevice.h>
8#include <linux/smp_lock.h> 7#include <linux/smp_lock.h>
9#include <linux/delay.h> 8#include <linux/delay.h>
diff --git a/drivers/char/dsp56k.c b/drivers/char/dsp56k.c
index 06f2dbf17710..db984e481d4c 100644
--- a/drivers/char/dsp56k.c
+++ b/drivers/char/dsp56k.c
@@ -25,7 +25,6 @@
25 25
26#include <linux/module.h> 26#include <linux/module.h>
27#include <linux/slab.h> /* for kmalloc() and kfree() */ 27#include <linux/slab.h> /* for kmalloc() and kfree() */
28#include <linux/sched.h> /* for struct wait_queue etc */
29#include <linux/major.h> 28#include <linux/major.h>
30#include <linux/types.h> 29#include <linux/types.h>
31#include <linux/errno.h> 30#include <linux/errno.h>
diff --git a/drivers/char/hpet.c b/drivers/char/hpet.c
index 20dc3be5ecfc..0be700f4e8fd 100644
--- a/drivers/char/hpet.c
+++ b/drivers/char/hpet.c
@@ -703,7 +703,7 @@ int hpet_control(struct hpet_task *tp, unsigned int cmd, unsigned long arg)
703 703
704static ctl_table hpet_table[] = { 704static ctl_table hpet_table[] = {
705 { 705 {
706 .ctl_name = 1, 706 .ctl_name = CTL_UNNUMBERED,
707 .procname = "max-user-freq", 707 .procname = "max-user-freq",
708 .data = &hpet_max_freq, 708 .data = &hpet_max_freq,
709 .maxlen = sizeof(int), 709 .maxlen = sizeof(int),
@@ -715,7 +715,7 @@ static ctl_table hpet_table[] = {
715 715
716static ctl_table hpet_root[] = { 716static ctl_table hpet_root[] = {
717 { 717 {
718 .ctl_name = 1, 718 .ctl_name = CTL_UNNUMBERED,
719 .procname = "hpet", 719 .procname = "hpet",
720 .maxlen = 0, 720 .maxlen = 0,
721 .mode = 0555, 721 .mode = 0555,
@@ -1018,7 +1018,7 @@ static int __init hpet_init(void)
1018 if (result < 0) 1018 if (result < 0)
1019 return -ENODEV; 1019 return -ENODEV;
1020 1020
1021 sysctl_header = register_sysctl_table(dev_root, 0); 1021 sysctl_header = register_sysctl_table(dev_root);
1022 1022
1023 result = acpi_bus_register_driver(&hpet_acpi_driver); 1023 result = acpi_bus_register_driver(&hpet_acpi_driver);
1024 if (result < 0) { 1024 if (result < 0) {
diff --git a/drivers/char/hvsi.c b/drivers/char/hvsi.c
index d7806834fc17..50315d6364fd 100644
--- a/drivers/char/hvsi.c
+++ b/drivers/char/hvsi.c
@@ -39,7 +39,6 @@
39#include <linux/module.h> 39#include <linux/module.h>
40#include <linux/major.h> 40#include <linux/major.h>
41#include <linux/kernel.h> 41#include <linux/kernel.h>
42#include <linux/sched.h>
43#include <linux/spinlock.h> 42#include <linux/spinlock.h>
44#include <linux/sysrq.h> 43#include <linux/sysrq.h>
45#include <linux/tty.h> 44#include <linux/tty.h>
diff --git a/drivers/char/ipmi/ipmi_devintf.c b/drivers/char/ipmi/ipmi_devintf.c
index ff2d052177cb..c2aa44ee6eb6 100644
--- a/drivers/char/ipmi/ipmi_devintf.c
+++ b/drivers/char/ipmi/ipmi_devintf.c
@@ -35,7 +35,6 @@
35#include <linux/moduleparam.h> 35#include <linux/moduleparam.h>
36#include <linux/errno.h> 36#include <linux/errno.h>
37#include <asm/system.h> 37#include <asm/system.h>
38#include <linux/sched.h>
39#include <linux/poll.h> 38#include <linux/poll.h>
40#include <linux/spinlock.h> 39#include <linux/spinlock.h>
41#include <linux/slab.h> 40#include <linux/slab.h>
diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c
index 3aff5e99b674..8e222f2b80cc 100644
--- a/drivers/char/ipmi/ipmi_msghandler.c
+++ b/drivers/char/ipmi/ipmi_msghandler.c
@@ -34,7 +34,6 @@
34#include <linux/module.h> 34#include <linux/module.h>
35#include <linux/errno.h> 35#include <linux/errno.h>
36#include <asm/system.h> 36#include <asm/system.h>
37#include <linux/sched.h>
38#include <linux/poll.h> 37#include <linux/poll.h>
39#include <linux/spinlock.h> 38#include <linux/spinlock.h>
40#include <linux/mutex.h> 39#include <linux/mutex.h>
diff --git a/drivers/char/ipmi/ipmi_poweroff.c b/drivers/char/ipmi/ipmi_poweroff.c
index 9d23136e598a..e02893b7b300 100644
--- a/drivers/char/ipmi/ipmi_poweroff.c
+++ b/drivers/char/ipmi/ipmi_poweroff.c
@@ -686,7 +686,7 @@ static int ipmi_poweroff_init (void)
686 printk(KERN_INFO PFX "Power cycle is enabled.\n"); 686 printk(KERN_INFO PFX "Power cycle is enabled.\n");
687 687
688#ifdef CONFIG_PROC_FS 688#ifdef CONFIG_PROC_FS
689 ipmi_table_header = register_sysctl_table(ipmi_root_table, 1); 689 ipmi_table_header = register_sysctl_table(ipmi_root_table);
690 if (!ipmi_table_header) { 690 if (!ipmi_table_header) {
691 printk(KERN_ERR PFX "Unable to register powercycle sysctl\n"); 691 printk(KERN_ERR PFX "Unable to register powercycle sysctl\n");
692 rv = -ENOMEM; 692 rv = -ENOMEM;
diff --git a/drivers/char/nvram.c b/drivers/char/nvram.c
index a39f19c35a6a..204deaa0de80 100644
--- a/drivers/char/nvram.c
+++ b/drivers/char/nvram.c
@@ -37,7 +37,6 @@
37#define NVRAM_VERSION "1.2" 37#define NVRAM_VERSION "1.2"
38 38
39#include <linux/module.h> 39#include <linux/module.h>
40#include <linux/sched.h>
41#include <linux/smp_lock.h> 40#include <linux/smp_lock.h>
42#include <linux/nvram.h> 41#include <linux/nvram.h>
43 42
diff --git a/drivers/char/nwflash.c b/drivers/char/nwflash.c
index 206cf6f50695..ba012c2bdf7a 100644
--- a/drivers/char/nwflash.c
+++ b/drivers/char/nwflash.c
@@ -21,7 +21,6 @@
21#include <linux/mm.h> 21#include <linux/mm.h>
22#include <linux/delay.h> 22#include <linux/delay.h>
23#include <linux/proc_fs.h> 23#include <linux/proc_fs.h>
24#include <linux/sched.h>
25#include <linux/miscdevice.h> 24#include <linux/miscdevice.h>
26#include <linux/spinlock.h> 25#include <linux/spinlock.h>
27#include <linux/rwsem.h> 26#include <linux/rwsem.h>
diff --git a/drivers/char/pty.c b/drivers/char/pty.c
index c07a1b5cd05d..de14aea34e11 100644
--- a/drivers/char/pty.c
+++ b/drivers/char/pty.c
@@ -14,7 +14,6 @@
14#include <linux/module.h> /* For EXPORT_SYMBOL */ 14#include <linux/module.h> /* For EXPORT_SYMBOL */
15 15
16#include <linux/errno.h> 16#include <linux/errno.h>
17#include <linux/sched.h>
18#include <linux/interrupt.h> 17#include <linux/interrupt.h>
19#include <linux/tty.h> 18#include <linux/tty.h>
20#include <linux/tty_flip.h> 19#include <linux/tty_flip.h>
diff --git a/drivers/char/rtc.c b/drivers/char/rtc.c
index b6d3072dce5a..c7dac9b13351 100644
--- a/drivers/char/rtc.c
+++ b/drivers/char/rtc.c
@@ -282,7 +282,7 @@ irqreturn_t rtc_interrupt(int irq, void *dev_id)
282 */ 282 */
283static ctl_table rtc_table[] = { 283static ctl_table rtc_table[] = {
284 { 284 {
285 .ctl_name = 1, 285 .ctl_name = CTL_UNNUMBERED,
286 .procname = "max-user-freq", 286 .procname = "max-user-freq",
287 .data = &rtc_max_user_freq, 287 .data = &rtc_max_user_freq,
288 .maxlen = sizeof(int), 288 .maxlen = sizeof(int),
@@ -294,9 +294,8 @@ static ctl_table rtc_table[] = {
294 294
295static ctl_table rtc_root[] = { 295static ctl_table rtc_root[] = {
296 { 296 {
297 .ctl_name = 1, 297 .ctl_name = CTL_UNNUMBERED,
298 .procname = "rtc", 298 .procname = "rtc",
299 .maxlen = 0,
300 .mode = 0555, 299 .mode = 0555,
301 .child = rtc_table, 300 .child = rtc_table,
302 }, 301 },
@@ -307,7 +306,6 @@ static ctl_table dev_root[] = {
307 { 306 {
308 .ctl_name = CTL_DEV, 307 .ctl_name = CTL_DEV,
309 .procname = "dev", 308 .procname = "dev",
310 .maxlen = 0,
311 .mode = 0555, 309 .mode = 0555,
312 .child = rtc_root, 310 .child = rtc_root,
313 }, 311 },
@@ -318,7 +316,7 @@ static struct ctl_table_header *sysctl_header;
318 316
319static int __init init_sysctl(void) 317static int __init init_sysctl(void)
320{ 318{
321 sysctl_header = register_sysctl_table(dev_root, 0); 319 sysctl_header = register_sysctl_table(dev_root);
322 return 0; 320 return 0;
323} 321}
324 322
diff --git a/drivers/char/ser_a2232.c b/drivers/char/ser_a2232.c
index 75de5f66517a..3c869145bfdc 100644
--- a/drivers/char/ser_a2232.c
+++ b/drivers/char/ser_a2232.c
@@ -86,7 +86,6 @@
86#include <linux/module.h> 86#include <linux/module.h>
87 87
88#include <linux/types.h> 88#include <linux/types.h>
89#include <linux/sched.h>
90#include <linux/interrupt.h> 89#include <linux/interrupt.h>
91#include <linux/kernel.h> 90#include <linux/kernel.h>
92#include <linux/errno.h> 91#include <linux/errno.h>
diff --git a/drivers/char/sonypi.c b/drivers/char/sonypi.c
index 17d54e1331b2..78237577b05a 100644
--- a/drivers/char/sonypi.c
+++ b/drivers/char/sonypi.c
@@ -36,7 +36,6 @@
36#include <linux/module.h> 36#include <linux/module.h>
37#include <linux/input.h> 37#include <linux/input.h>
38#include <linux/pci.h> 38#include <linux/pci.h>
39#include <linux/sched.h>
40#include <linux/init.h> 39#include <linux/init.h>
41#include <linux/interrupt.h> 40#include <linux/interrupt.h>
42#include <linux/miscdevice.h> 41#include <linux/miscdevice.h>
diff --git a/drivers/char/tlclk.c b/drivers/char/tlclk.c
index 4fac2bdf6215..35e58030d296 100644
--- a/drivers/char/tlclk.c
+++ b/drivers/char/tlclk.c
@@ -29,7 +29,6 @@
29 29
30#include <linux/module.h> 30#include <linux/module.h>
31#include <linux/init.h> 31#include <linux/init.h>
32#include <linux/sched.h>
33#include <linux/kernel.h> /* printk() */ 32#include <linux/kernel.h> /* printk() */
34#include <linux/fs.h> /* everything... */ 33#include <linux/fs.h> /* everything... */
35#include <linux/errno.h> /* error codes */ 34#include <linux/errno.h> /* error codes */
diff --git a/drivers/char/toshiba.c b/drivers/char/toshiba.c
index c346ec5a3dc9..5422f999636f 100644
--- a/drivers/char/toshiba.c
+++ b/drivers/char/toshiba.c
@@ -58,7 +58,6 @@
58 58
59#include <linux/module.h> 59#include <linux/module.h>
60#include <linux/kernel.h> 60#include <linux/kernel.h>
61#include <linux/sched.h>
62#include <linux/types.h> 61#include <linux/types.h>
63#include <linux/fcntl.h> 62#include <linux/fcntl.h>
64#include <linux/miscdevice.h> 63#include <linux/miscdevice.h>
diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c
index 2f572b97c16d..e5a254a434f8 100644
--- a/drivers/char/tpm/tpm.c
+++ b/drivers/char/tpm/tpm.c
@@ -23,7 +23,6 @@
23 * 23 *
24 */ 24 */
25 25
26#include <linux/sched.h>
27#include <linux/poll.h> 26#include <linux/poll.h>
28#include <linux/spinlock.h> 27#include <linux/spinlock.h>
29#include "tpm.h" 28#include "tpm.h"
diff --git a/drivers/char/vc_screen.c b/drivers/char/vc_screen.c
index 26776517f04c..791930320a13 100644
--- a/drivers/char/vc_screen.c
+++ b/drivers/char/vc_screen.c
@@ -25,7 +25,6 @@
25#include <linux/major.h> 25#include <linux/major.h>
26#include <linux/errno.h> 26#include <linux/errno.h>
27#include <linux/tty.h> 27#include <linux/tty.h>
28#include <linux/sched.h>
29#include <linux/interrupt.h> 28#include <linux/interrupt.h>
30#include <linux/mm.h> 29#include <linux/mm.h>
31#include <linux/init.h> 30#include <linux/init.h>
diff --git a/drivers/char/vme_scc.c b/drivers/char/vme_scc.c
index e01317cb1a0e..bef6d886d4fb 100644
--- a/drivers/char/vme_scc.c
+++ b/drivers/char/vme_scc.c
@@ -17,7 +17,6 @@
17#include <linux/kdev_t.h> 17#include <linux/kdev_t.h>
18#include <asm/io.h> 18#include <asm/io.h>
19#include <linux/kernel.h> 19#include <linux/kernel.h>
20#include <linux/sched.h>
21#include <linux/ioport.h> 20#include <linux/ioport.h>
22#include <linux/interrupt.h> 21#include <linux/interrupt.h>
23#include <linux/errno.h> 22#include <linux/errno.h>
diff --git a/drivers/char/watchdog/rm9k_wdt.c b/drivers/char/watchdog/rm9k_wdt.c
index b4678839d3bb..5c921e471564 100644
--- a/drivers/char/watchdog/rm9k_wdt.c
+++ b/drivers/char/watchdog/rm9k_wdt.c
@@ -192,7 +192,7 @@ static int wdt_gpi_open(struct inode *inode, struct file *file)
192 locked = 0; 192 locked = 0;
193 } 193 }
194 194
195 res = request_irq(wd_irq, wdt_gpi_irqhdl, SA_SHIRQ | SA_INTERRUPT, 195 res = request_irq(wd_irq, wdt_gpi_irqhdl, IRQF_SHARED | IRQF_DISABLED,
196 wdt_gpi_name, &miscdev); 196 wdt_gpi_name, &miscdev);
197 if (unlikely(res)) 197 if (unlikely(res))
198 return res; 198 return res;
diff --git a/drivers/cpufreq/cpufreq_conservative.c b/drivers/cpufreq/cpufreq_conservative.c
index eef0270c6f3d..05d6c22ba07c 100644
--- a/drivers/cpufreq/cpufreq_conservative.c
+++ b/drivers/cpufreq/cpufreq_conservative.c
@@ -23,7 +23,6 @@
23#include <linux/fs.h> 23#include <linux/fs.h>
24#include <linux/sysfs.h> 24#include <linux/sysfs.h>
25#include <linux/cpu.h> 25#include <linux/cpu.h>
26#include <linux/sched.h>
27#include <linux/kmod.h> 26#include <linux/kmod.h>
28#include <linux/workqueue.h> 27#include <linux/workqueue.h>
29#include <linux/jiffies.h> 28#include <linux/jiffies.h>
diff --git a/drivers/crypto/geode-aes.c b/drivers/crypto/geode-aes.c
index 31ea405f2eeb..0eb62841e9b0 100644
--- a/drivers/crypto/geode-aes.c
+++ b/drivers/crypto/geode-aes.c
@@ -8,7 +8,6 @@
8 8
9#include <linux/module.h> 9#include <linux/module.h>
10#include <linux/kernel.h> 10#include <linux/kernel.h>
11#include <linux/sched.h>
12#include <linux/pci.h> 11#include <linux/pci.h>
13#include <linux/pci_ids.h> 12#include <linux/pci_ids.h>
14#include <linux/crypto.h> 13#include <linux/crypto.h>
diff --git a/drivers/fc4/fc_syms.c b/drivers/fc4/fc_syms.c
index 8700a8076d04..bd3918ddf7ac 100644
--- a/drivers/fc4/fc_syms.c
+++ b/drivers/fc4/fc_syms.c
@@ -6,7 +6,6 @@
6 6
7#ifdef CONFIG_MODULES 7#ifdef CONFIG_MODULES
8 8
9#include <linux/sched.h>
10#include <linux/types.h> 9#include <linux/types.h>
11#include <linux/string.h> 10#include <linux/string.h>
12#include <linux/kernel.h> 11#include <linux/kernel.h>
diff --git a/drivers/fc4/soc.c b/drivers/fc4/soc.c
index b09dfc78e5a2..d517734462e6 100644
--- a/drivers/fc4/soc.c
+++ b/drivers/fc4/soc.c
@@ -22,7 +22,6 @@ static char *version =
22 22
23#include <linux/module.h> 23#include <linux/module.h>
24#include <linux/kernel.h> 24#include <linux/kernel.h>
25#include <linux/sched.h>
26#include <linux/types.h> 25#include <linux/types.h>
27#include <linux/fcntl.h> 26#include <linux/fcntl.h>
28#include <linux/interrupt.h> 27#include <linux/interrupt.h>
diff --git a/drivers/fc4/socal.c b/drivers/fc4/socal.c
index a6b1ae256e16..c903ebfab526 100644
--- a/drivers/fc4/socal.c
+++ b/drivers/fc4/socal.c
@@ -17,7 +17,6 @@ static char *version =
17 17
18#include <linux/module.h> 18#include <linux/module.h>
19#include <linux/kernel.h> 19#include <linux/kernel.h>
20#include <linux/sched.h>
21#include <linux/types.h> 20#include <linux/types.h>
22#include <linux/fcntl.h> 21#include <linux/fcntl.h>
23#include <linux/interrupt.h> 22#include <linux/interrupt.h>
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 8c7d48eff7b7..7452399501b4 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -18,7 +18,6 @@
18#include <linux/slab.h> 18#include <linux/slab.h>
19#include <linux/init.h> 19#include <linux/init.h>
20#include <linux/kernel.h> 20#include <linux/kernel.h>
21#include <linux/sched.h>
22#include <linux/list.h> 21#include <linux/list.h>
23#include <linux/mm.h> 22#include <linux/mm.h>
24#include <linux/smp_lock.h> 23#include <linux/smp_lock.h>
diff --git a/drivers/i2c/busses/i2c-ali1535.c b/drivers/i2c/busses/i2c-ali1535.c
index 0b0a87b8d107..6fd8ad7faa06 100644
--- a/drivers/i2c/busses/i2c-ali1535.c
+++ b/drivers/i2c/busses/i2c-ali1535.c
@@ -57,7 +57,6 @@
57#include <linux/pci.h> 57#include <linux/pci.h>
58#include <linux/kernel.h> 58#include <linux/kernel.h>
59#include <linux/stddef.h> 59#include <linux/stddef.h>
60#include <linux/sched.h>
61#include <linux/delay.h> 60#include <linux/delay.h>
62#include <linux/ioport.h> 61#include <linux/ioport.h>
63#include <linux/i2c.h> 62#include <linux/i2c.h>
diff --git a/drivers/i2c/busses/i2c-ali15x3.c b/drivers/i2c/busses/i2c-ali15x3.c
index c537441ac038..e4e0df106812 100644
--- a/drivers/i2c/busses/i2c-ali15x3.c
+++ b/drivers/i2c/busses/i2c-ali15x3.c
@@ -64,7 +64,6 @@
64#include <linux/pci.h> 64#include <linux/pci.h>
65#include <linux/kernel.h> 65#include <linux/kernel.h>
66#include <linux/stddef.h> 66#include <linux/stddef.h>
67#include <linux/sched.h>
68#include <linux/ioport.h> 67#include <linux/ioport.h>
69#include <linux/delay.h> 68#include <linux/delay.h>
70#include <linux/i2c.h> 69#include <linux/i2c.h>
diff --git a/drivers/i2c/busses/i2c-amd756.c b/drivers/i2c/busses/i2c-amd756.c
index 91fbc0ee439c..fa6155a54cc3 100644
--- a/drivers/i2c/busses/i2c-amd756.c
+++ b/drivers/i2c/busses/i2c-amd756.c
@@ -42,7 +42,6 @@
42#include <linux/kernel.h> 42#include <linux/kernel.h>
43#include <linux/delay.h> 43#include <linux/delay.h>
44#include <linux/stddef.h> 44#include <linux/stddef.h>
45#include <linux/sched.h>
46#include <linux/ioport.h> 45#include <linux/ioport.h>
47#include <linux/i2c.h> 46#include <linux/i2c.h>
48#include <linux/init.h> 47#include <linux/init.h>
diff --git a/drivers/i2c/busses/i2c-amd8111.c b/drivers/i2c/busses/i2c-amd8111.c
index 14ad9912f204..5bba3fb50d71 100644
--- a/drivers/i2c/busses/i2c-amd8111.c
+++ b/drivers/i2c/busses/i2c-amd8111.c
@@ -12,7 +12,6 @@
12#include <linux/pci.h> 12#include <linux/pci.h>
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/stddef.h> 14#include <linux/stddef.h>
15#include <linux/sched.h>
16#include <linux/ioport.h> 15#include <linux/ioport.h>
17#include <linux/init.h> 16#include <linux/init.h>
18#include <linux/i2c.h> 17#include <linux/i2c.h>
diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c
index 8c3569a9775b..21f2671f7220 100644
--- a/drivers/i2c/busses/i2c-i801.c
+++ b/drivers/i2c/busses/i2c-i801.c
@@ -48,7 +48,6 @@
48#include <linux/kernel.h> 48#include <linux/kernel.h>
49#include <linux/stddef.h> 49#include <linux/stddef.h>
50#include <linux/delay.h> 50#include <linux/delay.h>
51#include <linux/sched.h>
52#include <linux/ioport.h> 51#include <linux/ioport.h>
53#include <linux/init.h> 52#include <linux/init.h>
54#include <linux/i2c.h> 53#include <linux/i2c.h>
diff --git a/drivers/i2c/busses/i2c-iop3xx.c b/drivers/i2c/busses/i2c-iop3xx.c
index d108ab4974cc..20ee4f7c53a0 100644
--- a/drivers/i2c/busses/i2c-iop3xx.c
+++ b/drivers/i2c/busses/i2c-iop3xx.c
@@ -36,7 +36,6 @@
36#include <linux/slab.h> 36#include <linux/slab.h>
37#include <linux/init.h> 37#include <linux/init.h>
38#include <linux/errno.h> 38#include <linux/errno.h>
39#include <linux/sched.h>
40#include <linux/platform_device.h> 39#include <linux/platform_device.h>
41#include <linux/i2c.h> 40#include <linux/i2c.h>
42 41
diff --git a/drivers/i2c/busses/i2c-nforce2.c b/drivers/i2c/busses/i2c-nforce2.c
index 653555184a64..1514ec5b77f8 100644
--- a/drivers/i2c/busses/i2c-nforce2.c
+++ b/drivers/i2c/busses/i2c-nforce2.c
@@ -44,7 +44,6 @@
44#include <linux/pci.h> 44#include <linux/pci.h>
45#include <linux/kernel.h> 45#include <linux/kernel.h>
46#include <linux/stddef.h> 46#include <linux/stddef.h>
47#include <linux/sched.h>
48#include <linux/ioport.h> 47#include <linux/ioport.h>
49#include <linux/init.h> 48#include <linux/init.h>
50#include <linux/i2c.h> 49#include <linux/i2c.h>
diff --git a/drivers/i2c/busses/i2c-ocores.c b/drivers/i2c/busses/i2c-ocores.c
index f28a76d1c0af..e417c2c3ca22 100644
--- a/drivers/i2c/busses/i2c-ocores.c
+++ b/drivers/i2c/busses/i2c-ocores.c
@@ -11,7 +11,6 @@
11 11
12#include <linux/kernel.h> 12#include <linux/kernel.h>
13#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/sched.h>
15#include <linux/init.h> 14#include <linux/init.h>
16#include <linux/errno.h> 15#include <linux/errno.h>
17#include <linux/platform_device.h> 16#include <linux/platform_device.h>
diff --git a/drivers/i2c/busses/i2c-piix4.c b/drivers/i2c/busses/i2c-piix4.c
index 03d0aeea0189..d888293c1a9c 100644
--- a/drivers/i2c/busses/i2c-piix4.c
+++ b/drivers/i2c/busses/i2c-piix4.c
@@ -35,7 +35,6 @@
35#include <linux/kernel.h> 35#include <linux/kernel.h>
36#include <linux/delay.h> 36#include <linux/delay.h>
37#include <linux/stddef.h> 37#include <linux/stddef.h>
38#include <linux/sched.h>
39#include <linux/ioport.h> 38#include <linux/ioport.h>
40#include <linux/i2c.h> 39#include <linux/i2c.h>
41#include <linux/init.h> 40#include <linux/init.h>
diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c
index 4ca6de209b8b..556f244aae76 100644
--- a/drivers/i2c/busses/i2c-s3c2410.c
+++ b/drivers/i2c/busses/i2c-s3c2410.c
@@ -28,7 +28,6 @@
28#include <linux/init.h> 28#include <linux/init.h>
29#include <linux/time.h> 29#include <linux/time.h>
30#include <linux/interrupt.h> 30#include <linux/interrupt.h>
31#include <linux/sched.h>
32#include <linux/delay.h> 31#include <linux/delay.h>
33#include <linux/errno.h> 32#include <linux/errno.h>
34#include <linux/err.h> 33#include <linux/err.h>
diff --git a/drivers/i2c/busses/i2c-sis96x.c b/drivers/i2c/busses/i2c-sis96x.c
index 869a635d37e9..73dae449fb23 100644
--- a/drivers/i2c/busses/i2c-sis96x.c
+++ b/drivers/i2c/busses/i2c-sis96x.c
@@ -37,7 +37,6 @@
37#include <linux/kernel.h> 37#include <linux/kernel.h>
38#include <linux/delay.h> 38#include <linux/delay.h>
39#include <linux/stddef.h> 39#include <linux/stddef.h>
40#include <linux/sched.h>
41#include <linux/ioport.h> 40#include <linux/ioport.h>
42#include <linux/i2c.h> 41#include <linux/i2c.h>
43#include <linux/init.h> 42#include <linux/init.h>
diff --git a/drivers/i2c/chips/eeprom.c b/drivers/i2c/chips/eeprom.c
index cec3a0c3894d..bfce13c8f1ff 100644
--- a/drivers/i2c/chips/eeprom.c
+++ b/drivers/i2c/chips/eeprom.c
@@ -30,7 +30,6 @@
30#include <linux/init.h> 30#include <linux/init.h>
31#include <linux/module.h> 31#include <linux/module.h>
32#include <linux/slab.h> 32#include <linux/slab.h>
33#include <linux/sched.h>
34#include <linux/jiffies.h> 33#include <linux/jiffies.h>
35#include <linux/i2c.h> 34#include <linux/i2c.h>
36#include <linux/mutex.h> 35#include <linux/mutex.h>
diff --git a/drivers/ide/ide-proc.c b/drivers/ide/ide-proc.c
index 30a5780f4185..afb71c66b6f3 100644
--- a/drivers/ide/ide-proc.c
+++ b/drivers/ide/ide-proc.c
@@ -26,7 +26,6 @@
26 26
27#include <asm/uaccess.h> 27#include <asm/uaccess.h>
28#include <linux/errno.h> 28#include <linux/errno.h>
29#include <linux/sched.h>
30#include <linux/proc_fs.h> 29#include <linux/proc_fs.h>
31#include <linux/stat.h> 30#include <linux/stat.h>
32#include <linux/mm.h> 31#include <linux/mm.h>
diff --git a/drivers/ide/legacy/ide-cs.c b/drivers/ide/legacy/ide-cs.c
index 7efd28ac21ed..a5023cdbdc58 100644
--- a/drivers/ide/legacy/ide-cs.c
+++ b/drivers/ide/legacy/ide-cs.c
@@ -34,7 +34,6 @@
34#include <linux/module.h> 34#include <linux/module.h>
35#include <linux/kernel.h> 35#include <linux/kernel.h>
36#include <linux/init.h> 36#include <linux/init.h>
37#include <linux/sched.h>
38#include <linux/ptrace.h> 37#include <linux/ptrace.h>
39#include <linux/slab.h> 38#include <linux/slab.h>
40#include <linux/string.h> 39#include <linux/string.h>
diff --git a/drivers/ide/ppc/mpc8xx.c b/drivers/ide/ppc/mpc8xx.c
index 0ac9da3a7378..82de2d781f2e 100644
--- a/drivers/ide/ppc/mpc8xx.c
+++ b/drivers/ide/ppc/mpc8xx.c
@@ -12,7 +12,6 @@
12 */ 12 */
13 13
14#include <linux/errno.h> 14#include <linux/errno.h>
15#include <linux/sched.h>
16#include <linux/kernel.h> 15#include <linux/kernel.h>
17#include <linux/mm.h> 16#include <linux/mm.h>
18#include <linux/stddef.h> 17#include <linux/stddef.h>
diff --git a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c
index 91c5344a945d..d8ea23710bf0 100644
--- a/drivers/ide/ppc/pmac.c
+++ b/drivers/ide/ppc/pmac.c
@@ -24,7 +24,6 @@
24 */ 24 */
25#include <linux/types.h> 25#include <linux/types.h>
26#include <linux/kernel.h> 26#include <linux/kernel.h>
27#include <linux/sched.h>
28#include <linux/init.h> 27#include <linux/init.h>
29#include <linux/delay.h> 28#include <linux/delay.h>
30#include <linux/ide.h> 29#include <linux/ide.h>
diff --git a/drivers/ieee1394/eth1394.c b/drivers/ieee1394/eth1394.c
index 97e5c3dd044d..a95313521985 100644
--- a/drivers/ieee1394/eth1394.c
+++ b/drivers/ieee1394/eth1394.c
@@ -43,7 +43,6 @@
43 43
44#include <linux/module.h> 44#include <linux/module.h>
45 45
46#include <linux/sched.h>
47#include <linux/kernel.h> 46#include <linux/kernel.h>
48#include <linux/slab.h> 47#include <linux/slab.h>
49#include <linux/errno.h> 48#include <linux/errno.h>
diff --git a/drivers/ieee1394/iso.c b/drivers/ieee1394/iso.c
index 08bd15d2a7b6..c6227e51136d 100644
--- a/drivers/ieee1394/iso.c
+++ b/drivers/ieee1394/iso.c
@@ -10,7 +10,6 @@
10 */ 10 */
11 11
12#include <linux/pci.h> 12#include <linux/pci.h>
13#include <linux/sched.h>
14#include <linux/slab.h> 13#include <linux/slab.h>
15 14
16#include "hosts.h" 15#include "hosts.h"
diff --git a/drivers/ieee1394/ohci1394.c b/drivers/ieee1394/ohci1394.c
index 5729e412cc4a..e982d60ac4b7 100644
--- a/drivers/ieee1394/ohci1394.c
+++ b/drivers/ieee1394/ohci1394.c
@@ -102,7 +102,6 @@
102#include <asm/pgtable.h> 102#include <asm/pgtable.h>
103#include <asm/page.h> 103#include <asm/page.h>
104#include <asm/irq.h> 104#include <asm/irq.h>
105#include <linux/sched.h>
106#include <linux/types.h> 105#include <linux/types.h>
107#include <linux/vmalloc.h> 106#include <linux/vmalloc.h>
108#include <linux/init.h> 107#include <linux/init.h>
diff --git a/drivers/infiniband/core/cache.c b/drivers/infiniband/core/cache.c
index 98272fbbfb31..558c9a0fc8b9 100644
--- a/drivers/infiniband/core/cache.c
+++ b/drivers/infiniband/core/cache.c
@@ -38,7 +38,6 @@
38#include <linux/module.h> 38#include <linux/module.h>
39#include <linux/errno.h> 39#include <linux/errno.h>
40#include <linux/slab.h> 40#include <linux/slab.h>
41#include <linux/sched.h> /* INIT_WORK, schedule_work(), flush_scheduled_work() */
42 41
43#include <rdma/ib_cache.h> 42#include <rdma/ib_cache.h>
44 43
diff --git a/drivers/infiniband/hw/amso1100/c2.c b/drivers/infiniband/hw/amso1100/c2.c
index 27fe242ed435..59243d9aedd6 100644
--- a/drivers/infiniband/hw/amso1100/c2.c
+++ b/drivers/infiniband/hw/amso1100/c2.c
@@ -1073,7 +1073,7 @@ static int __devinit c2_probe(struct pci_dev *pcidev,
1073 0xffffc000) / sizeof(struct c2_rxp_desc); 1073 0xffffc000) / sizeof(struct c2_rxp_desc);
1074 1074
1075 /* Request an interrupt line for the driver */ 1075 /* Request an interrupt line for the driver */
1076 ret = request_irq(pcidev->irq, c2_interrupt, SA_SHIRQ, DRV_NAME, c2dev); 1076 ret = request_irq(pcidev->irq, c2_interrupt, IRQF_SHARED, DRV_NAME, c2dev);
1077 if (ret) { 1077 if (ret) {
1078 printk(KERN_ERR PFX "%s: requested IRQ %u is busy\n", 1078 printk(KERN_ERR PFX "%s: requested IRQ %u is busy\n",
1079 pci_name(pcidev), pcidev->irq); 1079 pci_name(pcidev), pcidev->irq);
diff --git a/drivers/infiniband/hw/ehca/ehca_eq.c b/drivers/infiniband/hw/ehca/ehca_eq.c
index 5281dec66f12..24ceab0bae4a 100644
--- a/drivers/infiniband/hw/ehca/ehca_eq.c
+++ b/drivers/infiniband/hw/ehca/ehca_eq.c
@@ -122,7 +122,7 @@ int ehca_create_eq(struct ehca_shca *shca,
122 /* register interrupt handlers and initialize work queues */ 122 /* register interrupt handlers and initialize work queues */
123 if (type == EHCA_EQ) { 123 if (type == EHCA_EQ) {
124 ret = ibmebus_request_irq(NULL, eq->ist, ehca_interrupt_eq, 124 ret = ibmebus_request_irq(NULL, eq->ist, ehca_interrupt_eq,
125 SA_INTERRUPT, "ehca_eq", 125 IRQF_DISABLED, "ehca_eq",
126 (void *)shca); 126 (void *)shca);
127 if (ret < 0) 127 if (ret < 0)
128 ehca_err(ib_dev, "Can't map interrupt handler."); 128 ehca_err(ib_dev, "Can't map interrupt handler.");
@@ -130,7 +130,7 @@ int ehca_create_eq(struct ehca_shca *shca,
130 tasklet_init(&eq->interrupt_task, ehca_tasklet_eq, (long)shca); 130 tasklet_init(&eq->interrupt_task, ehca_tasklet_eq, (long)shca);
131 } else if (type == EHCA_NEQ) { 131 } else if (type == EHCA_NEQ) {
132 ret = ibmebus_request_irq(NULL, eq->ist, ehca_interrupt_neq, 132 ret = ibmebus_request_irq(NULL, eq->ist, ehca_interrupt_neq,
133 SA_INTERRUPT, "ehca_neq", 133 IRQF_DISABLED, "ehca_neq",
134 (void *)shca); 134 (void *)shca);
135 if (ret < 0) 135 if (ret < 0)
136 ehca_err(ib_dev, "Can't map interrupt handler."); 136 ehca_err(ib_dev, "Can't map interrupt handler.");
diff --git a/drivers/input/ff-memless.c b/drivers/input/ff-memless.c
index eba18b6ac5e4..d226d935b0dc 100644
--- a/drivers/input/ff-memless.c
+++ b/drivers/input/ff-memless.c
@@ -29,7 +29,7 @@
29#include <linux/module.h> 29#include <linux/module.h>
30#include <linux/mutex.h> 30#include <linux/mutex.h>
31#include <linux/spinlock.h> 31#include <linux/spinlock.h>
32#include <linux/sched.h> 32#include <linux/jiffies.h>
33 33
34#include "fixp-arith.h" 34#include "fixp-arith.h"
35 35
diff --git a/drivers/input/input.c b/drivers/input/input.c
index 14d4c0493c36..efa1b1f75393 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -11,7 +11,6 @@
11 */ 11 */
12 12
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/sched.h>
15#include <linux/smp_lock.h> 14#include <linux/smp_lock.h>
16#include <linux/input.h> 15#include <linux/input.h>
17#include <linux/module.h> 16#include <linux/module.h>
diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
index 3a8f1b427a7f..7ad479e4e3b3 100644
--- a/drivers/input/keyboard/gpio_keys.c
+++ b/drivers/input/keyboard/gpio_keys.c
@@ -78,7 +78,7 @@ static int __devinit gpio_keys_probe(struct platform_device *pdev)
78 int irq = IRQ_GPIO(pdata->buttons[i].gpio); 78 int irq = IRQ_GPIO(pdata->buttons[i].gpio);
79 79
80 set_irq_type(irq, IRQ_TYPE_EDGE_BOTH); 80 set_irq_type(irq, IRQ_TYPE_EDGE_BOTH);
81 error = request_irq(irq, gpio_keys_isr, SA_SAMPLE_RANDOM, 81 error = request_irq(irq, gpio_keys_isr, IRQF_SAMPLE_RANDOM,
82 pdata->buttons[i].desc ? pdata->buttons[i].desc : "gpio_keys", 82 pdata->buttons[i].desc ? pdata->buttons[i].desc : "gpio_keys",
83 pdev); 83 pdev);
84 if (error) { 84 if (error) {
diff --git a/drivers/input/mouse/rpcmouse.c b/drivers/input/mouse/rpcmouse.c
index fbdcfd8eb4e9..355efd0423e7 100644
--- a/drivers/input/mouse/rpcmouse.c
+++ b/drivers/input/mouse/rpcmouse.c
@@ -18,7 +18,6 @@
18 */ 18 */
19 19
20#include <linux/module.h> 20#include <linux/module.h>
21#include <linux/sched.h>
22#include <linux/ptrace.h> 21#include <linux/ptrace.h>
23#include <linux/interrupt.h> 22#include <linux/interrupt.h>
24#include <linux/init.h> 23#include <linux/init.h>
diff --git a/drivers/input/serio/hil_mlc.c b/drivers/input/serio/hil_mlc.c
index 49e11e2c1d5d..4fa93ff30919 100644
--- a/drivers/input/serio/hil_mlc.c
+++ b/drivers/input/serio/hil_mlc.c
@@ -59,7 +59,6 @@
59#include <linux/init.h> 59#include <linux/init.h>
60#include <linux/interrupt.h> 60#include <linux/interrupt.h>
61#include <linux/timer.h> 61#include <linux/timer.h>
62#include <linux/sched.h>
63#include <linux/list.h> 62#include <linux/list.h>
64 63
65MODULE_AUTHOR("Brian S. Julin <bri@calyx.com>"); 64MODULE_AUTHOR("Brian S. Julin <bri@calyx.com>");
diff --git a/drivers/input/serio/hp_sdc.c b/drivers/input/serio/hp_sdc.c
index 9907ad3bea23..b57370dc4e3d 100644
--- a/drivers/input/serio/hp_sdc.c
+++ b/drivers/input/serio/hp_sdc.c
@@ -62,7 +62,6 @@
62 */ 62 */
63 63
64#include <linux/hp_sdc.h> 64#include <linux/hp_sdc.h>
65#include <linux/sched.h>
66#include <linux/errno.h> 65#include <linux/errno.h>
67#include <linux/init.h> 66#include <linux/init.h>
68#include <linux/module.h> 67#include <linux/module.h>
diff --git a/drivers/isdn/capi/capidrv.c b/drivers/isdn/capi/capidrv.c
index 8cec9c3898ec..2a49cea0a223 100644
--- a/drivers/isdn/capi/capidrv.c
+++ b/drivers/isdn/capi/capidrv.c
@@ -13,7 +13,6 @@
13#include <linux/errno.h> 13#include <linux/errno.h>
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/major.h> 15#include <linux/major.h>
16#include <linux/sched.h>
17#include <linux/slab.h> 16#include <linux/slab.h>
18#include <linux/fcntl.h> 17#include <linux/fcntl.h>
19#include <linux/fs.h> 18#include <linux/fs.h>
diff --git a/drivers/isdn/hardware/avm/avm_cs.c b/drivers/isdn/hardware/avm/avm_cs.c
index eba10466ccc6..a5b941c327f7 100644
--- a/drivers/isdn/hardware/avm/avm_cs.c
+++ b/drivers/isdn/hardware/avm/avm_cs.c
@@ -12,7 +12,6 @@
12#include <linux/module.h> 12#include <linux/module.h>
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/sched.h>
16#include <linux/ptrace.h> 15#include <linux/ptrace.h>
17#include <linux/slab.h> 16#include <linux/slab.h>
18#include <linux/string.h> 17#include <linux/string.h>
diff --git a/drivers/isdn/hardware/eicon/divamnt.c b/drivers/isdn/hardware/eicon/divamnt.c
index 6b2940ed0776..4aba5c502d8e 100644
--- a/drivers/isdn/hardware/eicon/divamnt.c
+++ b/drivers/isdn/hardware/eicon/divamnt.c
@@ -13,7 +13,6 @@
13#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/sched.h>
17#include <linux/smp_lock.h> 16#include <linux/smp_lock.h>
18#include <linux/poll.h> 17#include <linux/poll.h>
19#include <asm/uaccess.h> 18#include <asm/uaccess.h>
diff --git a/drivers/isdn/hardware/eicon/divasmain.c b/drivers/isdn/hardware/eicon/divasmain.c
index b365e44072c0..5e862e244117 100644
--- a/drivers/isdn/hardware/eicon/divasmain.c
+++ b/drivers/isdn/hardware/eicon/divasmain.c
@@ -12,7 +12,6 @@
12#include <linux/module.h> 12#include <linux/module.h>
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/sched.h>
16#include <asm/uaccess.h> 15#include <asm/uaccess.h>
17#include <asm/io.h> 16#include <asm/io.h>
18#include <linux/ioport.h> 17#include <linux/ioport.h>
diff --git a/drivers/isdn/hisax/avma1_cs.c b/drivers/isdn/hisax/avma1_cs.c
index 9e70c206779e..fc6cc2c065b8 100644
--- a/drivers/isdn/hisax/avma1_cs.c
+++ b/drivers/isdn/hisax/avma1_cs.c
@@ -14,7 +14,6 @@
14 14
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/sched.h>
18#include <linux/ptrace.h> 17#include <linux/ptrace.h>
19#include <linux/slab.h> 18#include <linux/slab.h>
20#include <linux/string.h> 19#include <linux/string.h>
diff --git a/drivers/isdn/hisax/elsa_cs.c b/drivers/isdn/hisax/elsa_cs.c
index 79ab9dda7d08..db7e64424afe 100644
--- a/drivers/isdn/hisax/elsa_cs.c
+++ b/drivers/isdn/hisax/elsa_cs.c
@@ -38,7 +38,6 @@
38#include <linux/module.h> 38#include <linux/module.h>
39#include <linux/kernel.h> 39#include <linux/kernel.h>
40#include <linux/init.h> 40#include <linux/init.h>
41#include <linux/sched.h>
42#include <linux/ptrace.h> 41#include <linux/ptrace.h>
43#include <linux/slab.h> 42#include <linux/slab.h>
44#include <linux/string.h> 43#include <linux/string.h>
diff --git a/drivers/isdn/hisax/hfc_usb.c b/drivers/isdn/hisax/hfc_usb.c
index 42bbae2a646c..9f44d3e69fb0 100644
--- a/drivers/isdn/hisax/hfc_usb.c
+++ b/drivers/isdn/hisax/hfc_usb.c
@@ -38,7 +38,6 @@
38#include <linux/usb.h> 38#include <linux/usb.h>
39#include <linux/kernel.h> 39#include <linux/kernel.h>
40#include <linux/smp_lock.h> 40#include <linux/smp_lock.h>
41#include <linux/sched.h>
42#include "hisax.h" 41#include "hisax.h"
43#include "hisax_if.h" 42#include "hisax_if.h"
44#include "hfc_usb.h" 43#include "hfc_usb.h"
diff --git a/drivers/isdn/hisax/sedlbauer_cs.c b/drivers/isdn/hisax/sedlbauer_cs.c
index 45debde05fbd..439cb530def8 100644
--- a/drivers/isdn/hisax/sedlbauer_cs.c
+++ b/drivers/isdn/hisax/sedlbauer_cs.c
@@ -38,7 +38,6 @@
38#include <linux/kernel.h> 38#include <linux/kernel.h>
39#include <linux/module.h> 39#include <linux/module.h>
40#include <linux/init.h> 40#include <linux/init.h>
41#include <linux/sched.h>
42#include <linux/ptrace.h> 41#include <linux/ptrace.h>
43#include <linux/slab.h> 42#include <linux/slab.h>
44#include <linux/string.h> 43#include <linux/string.h>
diff --git a/drivers/isdn/hisax/teles_cs.c b/drivers/isdn/hisax/teles_cs.c
index 3e3e18239ec7..ab4bd455450e 100644
--- a/drivers/isdn/hisax/teles_cs.c
+++ b/drivers/isdn/hisax/teles_cs.c
@@ -19,7 +19,6 @@
19#include <linux/kernel.h> 19#include <linux/kernel.h>
20#include <linux/module.h> 20#include <linux/module.h>
21#include <linux/init.h> 21#include <linux/init.h>
22#include <linux/sched.h>
23#include <linux/ptrace.h> 22#include <linux/ptrace.h>
24#include <linux/slab.h> 23#include <linux/slab.h>
25#include <linux/string.h> 24#include <linux/string.h>
diff --git a/drivers/isdn/hysdn/boardergo.c b/drivers/isdn/hysdn/boardergo.c
index a1206498a1cf..84dccd526ac0 100644
--- a/drivers/isdn/hysdn/boardergo.c
+++ b/drivers/isdn/hysdn/boardergo.c
@@ -14,7 +14,6 @@
14 * 14 *
15 */ 15 */
16 16
17#include <linux/sched.h>
18#include <linux/signal.h> 17#include <linux/signal.h>
19#include <linux/kernel.h> 18#include <linux/kernel.h>
20#include <linux/ioport.h> 19#include <linux/ioport.h>
diff --git a/drivers/isdn/hysdn/hysdn_sched.c b/drivers/isdn/hysdn/hysdn_sched.c
index 18758772b744..b7b5aa4748a0 100644
--- a/drivers/isdn/hysdn/hysdn_sched.c
+++ b/drivers/isdn/hysdn/hysdn_sched.c
@@ -11,7 +11,6 @@
11 * 11 *
12 */ 12 */
13 13
14#include <linux/sched.h>
15#include <linux/signal.h> 14#include <linux/signal.h>
16#include <linux/kernel.h> 15#include <linux/kernel.h>
17#include <linux/ioport.h> 16#include <linux/ioport.h>
diff --git a/drivers/isdn/i4l/isdn_bsdcomp.c b/drivers/isdn/i4l/isdn_bsdcomp.c
index a20f33b4a220..90a23795db7e 100644
--- a/drivers/isdn/i4l/isdn_bsdcomp.c
+++ b/drivers/isdn/i4l/isdn_bsdcomp.c
@@ -56,7 +56,6 @@
56#include <linux/module.h> 56#include <linux/module.h>
57#include <linux/init.h> 57#include <linux/init.h>
58#include <linux/kernel.h> 58#include <linux/kernel.h>
59#include <linux/sched.h>
60#include <linux/types.h> 59#include <linux/types.h>
61#include <linux/fcntl.h> 60#include <linux/fcntl.h>
62#include <linux/interrupt.h> 61#include <linux/interrupt.h>
diff --git a/drivers/isdn/pcbit/callbacks.c b/drivers/isdn/pcbit/callbacks.c
index f151f36c8255..43ecd0f54235 100644
--- a/drivers/isdn/pcbit/callbacks.c
+++ b/drivers/isdn/pcbit/callbacks.c
@@ -15,7 +15,6 @@
15 * NULL pointer dereference in cb_in_1 (originally fixed in 2.0) 15 * NULL pointer dereference in cb_in_1 (originally fixed in 2.0)
16 */ 16 */
17 17
18#include <linux/sched.h>
19#include <linux/string.h> 18#include <linux/string.h>
20#include <linux/kernel.h> 19#include <linux/kernel.h>
21 20
diff --git a/drivers/isdn/pcbit/capi.c b/drivers/isdn/pcbit/capi.c
index bef321d0e51d..47c59e95898d 100644
--- a/drivers/isdn/pcbit/capi.c
+++ b/drivers/isdn/pcbit/capi.c
@@ -27,7 +27,6 @@
27 * encode our number in CallerPN and ConnectedPN 27 * encode our number in CallerPN and ConnectedPN
28 */ 28 */
29 29
30#include <linux/sched.h>
31#include <linux/string.h> 30#include <linux/string.h>
32#include <linux/kernel.h> 31#include <linux/kernel.h>
33 32
diff --git a/drivers/isdn/pcbit/drv.c b/drivers/isdn/pcbit/drv.c
index 386c5ce64844..8c66bcb953a1 100644
--- a/drivers/isdn/pcbit/drv.c
+++ b/drivers/isdn/pcbit/drv.c
@@ -19,7 +19,6 @@
19 19
20#include <linux/module.h> 20#include <linux/module.h>
21 21
22#include <linux/sched.h>
23 22
24#include <linux/kernel.h> 23#include <linux/kernel.h>
25 24
diff --git a/drivers/isdn/pcbit/edss1.c b/drivers/isdn/pcbit/edss1.c
index 1ad8b07efd8b..37e9626cebf6 100644
--- a/drivers/isdn/pcbit/edss1.c
+++ b/drivers/isdn/pcbit/edss1.c
@@ -15,7 +15,6 @@
15 * move state/event descriptions to a user space logger 15 * move state/event descriptions to a user space logger
16 */ 16 */
17 17
18#include <linux/sched.h>
19#include <linux/string.h> 18#include <linux/string.h>
20#include <linux/kernel.h> 19#include <linux/kernel.h>
21 20
diff --git a/drivers/isdn/pcbit/layer2.c b/drivers/isdn/pcbit/layer2.c
index 58eee50c8e26..5ba2a879df14 100644
--- a/drivers/isdn/pcbit/layer2.c
+++ b/drivers/isdn/pcbit/layer2.c
@@ -24,7 +24,6 @@
24 * re-write/remove debug printks 24 * re-write/remove debug printks
25 */ 25 */
26 26
27#include <linux/sched.h>
28#include <linux/string.h> 27#include <linux/string.h>
29#include <linux/kernel.h> 28#include <linux/kernel.h>
30#include <linux/types.h> 29#include <linux/types.h>
diff --git a/drivers/isdn/pcbit/module.c b/drivers/isdn/pcbit/module.c
index 7b7b1777f09b..04ea241ff176 100644
--- a/drivers/isdn/pcbit/module.c
+++ b/drivers/isdn/pcbit/module.c
@@ -11,7 +11,6 @@
11 11
12#include <linux/module.h> 12#include <linux/module.h>
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/sched.h>
15#include <linux/string.h> 14#include <linux/string.h>
16#include <linux/kernel.h> 15#include <linux/kernel.h>
17#include <linux/skbuff.h> 16#include <linux/skbuff.h>
diff --git a/drivers/kvm/vmx.c b/drivers/kvm/vmx.c
index 1e640b899175..fd4e91734388 100644
--- a/drivers/kvm/vmx.c
+++ b/drivers/kvm/vmx.c
@@ -1879,12 +1879,6 @@ again:
1879 1879
1880 asm ("mov %0, %%ds; mov %0, %%es" : : "r"(__USER_DS)); 1880 asm ("mov %0, %%ds; mov %0, %%es" : : "r"(__USER_DS));
1881 1881
1882 /*
1883 * Profile KVM exit RIPs:
1884 */
1885 if (unlikely(prof_on == KVM_PROFILING))
1886 profile_hit(KVM_PROFILING, (void *)vmcs_readl(GUEST_RIP));
1887
1888 kvm_run->exit_type = 0; 1882 kvm_run->exit_type = 0;
1889 if (fail) { 1883 if (fail) {
1890 kvm_run->exit_type = KVM_EXIT_TYPE_FAIL_ENTRY; 1884 kvm_run->exit_type = KVM_EXIT_TYPE_FAIL_ENTRY;
@@ -1907,6 +1901,12 @@ again:
1907 1901
1908 reload_tss(); 1902 reload_tss();
1909 } 1903 }
1904 /*
1905 * Profile KVM exit RIPs:
1906 */
1907 if (unlikely(prof_on == KVM_PROFILING))
1908 profile_hit(KVM_PROFILING, (void *)vmcs_readl(GUEST_RIP));
1909
1910 vcpu->launched = 1; 1910 vcpu->launched = 1;
1911 kvm_run->exit_type = KVM_EXIT_TYPE_VM_EXIT; 1911 kvm_run->exit_type = KVM_EXIT_TYPE_VM_EXIT;
1912 r = kvm_handle_exit(kvm_run, vcpu); 1912 r = kvm_handle_exit(kvm_run, vcpu);
diff --git a/drivers/macintosh/mac_hid.c b/drivers/macintosh/mac_hid.c
index f632cec9ce45..c1fd816e9f09 100644
--- a/drivers/macintosh/mac_hid.c
+++ b/drivers/macintosh/mac_hid.c
@@ -138,7 +138,7 @@ int __init mac_hid_init(void)
138 return err; 138 return err;
139 139
140#if defined(CONFIG_SYSCTL) 140#if defined(CONFIG_SYSCTL)
141 mac_hid_sysctl_header = register_sysctl_table(mac_hid_root_dir, 1); 141 mac_hid_sysctl_header = register_sysctl_table(mac_hid_root_dir);
142#endif /* CONFIG_SYSCTL */ 142#endif /* CONFIG_SYSCTL */
143 143
144 return 0; 144 return 0;
diff --git a/drivers/macintosh/macio-adb.c b/drivers/macintosh/macio-adb.c
index 797cef72258f..026b67f4f659 100644
--- a/drivers/macintosh/macio-adb.c
+++ b/drivers/macintosh/macio-adb.c
@@ -6,7 +6,6 @@
6#include <linux/errno.h> 6#include <linux/errno.h>
7#include <linux/kernel.h> 7#include <linux/kernel.h>
8#include <linux/delay.h> 8#include <linux/delay.h>
9#include <linux/sched.h>
10#include <linux/spinlock.h> 9#include <linux/spinlock.h>
11#include <linux/interrupt.h> 10#include <linux/interrupt.h>
12#include <asm/prom.h> 11#include <asm/prom.h>
diff --git a/drivers/macintosh/via-cuda.c b/drivers/macintosh/via-cuda.c
index 3797f503cd6c..d58fcf6cca0a 100644
--- a/drivers/macintosh/via-cuda.c
+++ b/drivers/macintosh/via-cuda.c
@@ -13,7 +13,6 @@
13#include <linux/errno.h> 13#include <linux/errno.h>
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/delay.h> 15#include <linux/delay.h>
16#include <linux/sched.h>
17#include <linux/adb.h> 16#include <linux/adb.h>
18#include <linux/cuda.h> 17#include <linux/cuda.h>
19#include <linux/spinlock.h> 18#include <linux/spinlock.h>
diff --git a/drivers/macintosh/via-macii.c b/drivers/macintosh/via-macii.c
index 175b3e56e375..1b3bad62a1be 100644
--- a/drivers/macintosh/via-macii.c
+++ b/drivers/macintosh/via-macii.c
@@ -19,7 +19,6 @@
19#include <linux/errno.h> 19#include <linux/errno.h>
20#include <linux/kernel.h> 20#include <linux/kernel.h>
21#include <linux/delay.h> 21#include <linux/delay.h>
22#include <linux/sched.h>
23#include <linux/adb.h> 22#include <linux/adb.h>
24#include <linux/interrupt.h> 23#include <linux/interrupt.h>
25#include <linux/init.h> 24#include <linux/init.h>
diff --git a/drivers/macintosh/via-maciisi.c b/drivers/macintosh/via-maciisi.c
index 10051db48d23..2dc788042707 100644
--- a/drivers/macintosh/via-maciisi.c
+++ b/drivers/macintosh/via-maciisi.c
@@ -18,7 +18,6 @@
18#include <linux/types.h> 18#include <linux/types.h>
19#include <linux/errno.h> 19#include <linux/errno.h>
20#include <linux/kernel.h> 20#include <linux/kernel.h>
21#include <linux/sched.h>
22#include <linux/adb.h> 21#include <linux/adb.h>
23#include <linux/cuda.h> 22#include <linux/cuda.h>
24#include <linux/delay.h> 23#include <linux/delay.h>
diff --git a/drivers/macintosh/via-pmu68k.c b/drivers/macintosh/via-pmu68k.c
index 54baee57d2f8..356c7216a179 100644
--- a/drivers/macintosh/via-pmu68k.c
+++ b/drivers/macintosh/via-pmu68k.c
@@ -22,7 +22,6 @@
22#include <linux/errno.h> 22#include <linux/errno.h>
23#include <linux/kernel.h> 23#include <linux/kernel.h>
24#include <linux/delay.h> 24#include <linux/delay.h>
25#include <linux/sched.h>
26#include <linux/miscdevice.h> 25#include <linux/miscdevice.h>
27#include <linux/blkdev.h> 26#include <linux/blkdev.h>
28#include <linux/pci.h> 27#include <linux/pci.h>
diff --git a/drivers/md/md.c b/drivers/md/md.c
index e85fa75a7912..05febfd9f071 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -5581,7 +5581,7 @@ static int __init md_init(void)
5581 md_probe, NULL, NULL); 5581 md_probe, NULL, NULL);
5582 5582
5583 register_reboot_notifier(&md_notifier); 5583 register_reboot_notifier(&md_notifier);
5584 raid_table_header = register_sysctl_table(raid_root_table, 1); 5584 raid_table_header = register_sysctl_table(raid_root_table);
5585 5585
5586 md_geninit(); 5586 md_geninit();
5587 return (0); 5587 return (0);
diff --git a/drivers/media/dvb/dvb-core/dmxdev.c b/drivers/media/dvb/dvb-core/dmxdev.c
index 988499dfddf8..fc77de45ca4d 100644
--- a/drivers/media/dvb/dvb-core/dmxdev.c
+++ b/drivers/media/dvb/dvb-core/dmxdev.c
@@ -25,7 +25,6 @@
25#include <linux/vmalloc.h> 25#include <linux/vmalloc.h>
26#include <linux/module.h> 26#include <linux/module.h>
27#include <linux/moduleparam.h> 27#include <linux/moduleparam.h>
28#include <linux/sched.h>
29#include <linux/poll.h> 28#include <linux/poll.h>
30#include <linux/ioctl.h> 29#include <linux/ioctl.h>
31#include <linux/wait.h> 30#include <linux/wait.h>
diff --git a/drivers/media/dvb/dvb-core/dvbdev.c b/drivers/media/dvb/dvb-core/dvbdev.c
index 40774feb8953..826b47f155a0 100644
--- a/drivers/media/dvb/dvb-core/dvbdev.c
+++ b/drivers/media/dvb/dvb-core/dvbdev.c
@@ -27,7 +27,6 @@
27#include <linux/module.h> 27#include <linux/module.h>
28#include <linux/moduleparam.h> 28#include <linux/moduleparam.h>
29#include <linux/kernel.h> 29#include <linux/kernel.h>
30#include <linux/sched.h>
31#include <linux/init.h> 30#include <linux/init.h>
32#include <linux/slab.h> 31#include <linux/slab.h>
33#include <linux/device.h> 32#include <linux/device.h>
diff --git a/drivers/media/dvb/ttpci/av7110_av.c b/drivers/media/dvb/ttpci/av7110_av.c
index 8c577cf30fb3..795e6e95915c 100644
--- a/drivers/media/dvb/ttpci/av7110_av.c
+++ b/drivers/media/dvb/ttpci/av7110_av.c
@@ -31,7 +31,6 @@
31#include <linux/types.h> 31#include <linux/types.h>
32#include <linux/kernel.h> 32#include <linux/kernel.h>
33#include <linux/string.h> 33#include <linux/string.h>
34#include <linux/sched.h>
35#include <linux/delay.h> 34#include <linux/delay.h>
36#include <linux/smp_lock.h> 35#include <linux/smp_lock.h>
37#include <linux/fs.h> 36#include <linux/fs.h>
diff --git a/drivers/media/dvb/ttpci/av7110_ca.c b/drivers/media/dvb/ttpci/av7110_ca.c
index dd9aee314e0a..4251a97d420e 100644
--- a/drivers/media/dvb/ttpci/av7110_ca.c
+++ b/drivers/media/dvb/ttpci/av7110_ca.c
@@ -29,7 +29,6 @@
29 */ 29 */
30 30
31#include <linux/kernel.h> 31#include <linux/kernel.h>
32#include <linux/sched.h>
33#include <linux/types.h> 32#include <linux/types.h>
34#include <linux/delay.h> 33#include <linux/delay.h>
35#include <linux/fs.h> 34#include <linux/fs.h>
diff --git a/drivers/media/dvb/ttpci/av7110_hw.c b/drivers/media/dvb/ttpci/av7110_hw.c
index 37de2e88a273..4d7150e15d1e 100644
--- a/drivers/media/dvb/ttpci/av7110_hw.c
+++ b/drivers/media/dvb/ttpci/av7110_hw.c
@@ -32,7 +32,6 @@
32#include <linux/types.h> 32#include <linux/types.h>
33#include <linux/kernel.h> 33#include <linux/kernel.h>
34#include <linux/string.h> 34#include <linux/string.h>
35#include <linux/sched.h>
36#include <linux/delay.h> 35#include <linux/delay.h>
37#include <linux/smp_lock.h> 36#include <linux/smp_lock.h>
38#include <linux/fs.h> 37#include <linux/fs.h>
diff --git a/drivers/media/dvb/ttpci/av7110_v4l.c b/drivers/media/dvb/ttpci/av7110_v4l.c
index 10cfe3131e72..dbfd5e7b4be0 100644
--- a/drivers/media/dvb/ttpci/av7110_v4l.c
+++ b/drivers/media/dvb/ttpci/av7110_v4l.c
@@ -26,7 +26,6 @@
26 */ 26 */
27 27
28#include <linux/kernel.h> 28#include <linux/kernel.h>
29#include <linux/sched.h>
30#include <linux/types.h> 29#include <linux/types.h>
31#include <linux/delay.h> 30#include <linux/delay.h>
32#include <linux/fs.h> 31#include <linux/fs.h>
diff --git a/drivers/media/radio/miropcm20-rds.c b/drivers/media/radio/miropcm20-rds.c
index c93490ec96bb..aed11477378b 100644
--- a/drivers/media/radio/miropcm20-rds.c
+++ b/drivers/media/radio/miropcm20-rds.c
@@ -14,7 +14,6 @@
14#include <linux/slab.h> 14#include <linux/slab.h>
15#include <linux/fs.h> 15#include <linux/fs.h>
16#include <linux/miscdevice.h> 16#include <linux/miscdevice.h>
17#include <linux/sched.h> /* current, TASK_*, schedule_timeout() */
18#include <linux/delay.h> 17#include <linux/delay.h>
19#include <asm/uaccess.h> 18#include <asm/uaccess.h>
20#include "miropcm20-rds-core.h" 19#include "miropcm20-rds-core.h"
diff --git a/drivers/media/radio/radio-maestro.c b/drivers/media/radio/radio-maestro.c
index 9bba6eb10925..e67b7f258029 100644
--- a/drivers/media/radio/radio-maestro.c
+++ b/drivers/media/radio/radio-maestro.c
@@ -22,7 +22,6 @@
22#include <linux/init.h> 22#include <linux/init.h>
23#include <linux/ioport.h> 23#include <linux/ioport.h>
24#include <linux/delay.h> 24#include <linux/delay.h>
25#include <linux/sched.h>
26#include <asm/io.h> 25#include <asm/io.h>
27#include <asm/uaccess.h> 26#include <asm/uaccess.h>
28#include <linux/mutex.h> 27#include <linux/mutex.h>
diff --git a/drivers/media/radio/radio-maxiradio.c b/drivers/media/radio/radio-maxiradio.c
index 00a2f31d2af3..6beeb74004b1 100644
--- a/drivers/media/radio/radio-maxiradio.c
+++ b/drivers/media/radio/radio-maxiradio.c
@@ -35,7 +35,6 @@
35#include <linux/init.h> 35#include <linux/init.h>
36#include <linux/ioport.h> 36#include <linux/ioport.h>
37#include <linux/delay.h> 37#include <linux/delay.h>
38#include <linux/sched.h>
39#include <asm/io.h> 38#include <asm/io.h>
40#include <asm/uaccess.h> 39#include <asm/uaccess.h>
41#include <linux/mutex.h> 40#include <linux/mutex.h>
diff --git a/drivers/media/video/adv7170.c b/drivers/media/video/adv7170.c
index 48709582a186..2aa9ce920607 100644
--- a/drivers/media/video/adv7170.c
+++ b/drivers/media/video/adv7170.c
@@ -42,7 +42,6 @@
42#include <asm/io.h> 42#include <asm/io.h>
43#include <asm/pgtable.h> 43#include <asm/pgtable.h>
44#include <asm/page.h> 44#include <asm/page.h>
45#include <linux/sched.h>
46#include <linux/types.h> 45#include <linux/types.h>
47 46
48#include <linux/videodev.h> 47#include <linux/videodev.h>
diff --git a/drivers/media/video/adv7175.c b/drivers/media/video/adv7175.c
index 68e7d7aff5e6..a3246a283aa4 100644
--- a/drivers/media/video/adv7175.c
+++ b/drivers/media/video/adv7175.c
@@ -38,7 +38,6 @@
38#include <asm/io.h> 38#include <asm/io.h>
39#include <asm/pgtable.h> 39#include <asm/pgtable.h>
40#include <asm/page.h> 40#include <asm/page.h>
41#include <linux/sched.h>
42#include <linux/types.h> 41#include <linux/types.h>
43 42
44#include <linux/videodev.h> 43#include <linux/videodev.h>
diff --git a/drivers/media/video/bt819.c b/drivers/media/video/bt819.c
index e7b38fdd5e3c..68673863d5c9 100644
--- a/drivers/media/video/bt819.c
+++ b/drivers/media/video/bt819.c
@@ -42,7 +42,6 @@
42#include <asm/io.h> 42#include <asm/io.h>
43#include <asm/pgtable.h> 43#include <asm/pgtable.h>
44#include <asm/page.h> 44#include <asm/page.h>
45#include <linux/sched.h>
46#include <linux/types.h> 45#include <linux/types.h>
47 46
48#include <linux/videodev.h> 47#include <linux/videodev.h>
diff --git a/drivers/media/video/bt856.c b/drivers/media/video/bt856.c
index af3b61d4fa7d..42e2299dcb22 100644
--- a/drivers/media/video/bt856.c
+++ b/drivers/media/video/bt856.c
@@ -42,7 +42,6 @@
42#include <asm/io.h> 42#include <asm/io.h>
43#include <asm/pgtable.h> 43#include <asm/pgtable.h>
44#include <asm/page.h> 44#include <asm/page.h>
45#include <linux/sched.h>
46#include <linux/types.h> 45#include <linux/types.h>
47 46
48#include <linux/videodev.h> 47#include <linux/videodev.h>
diff --git a/drivers/media/video/bt8xx/bttv-vbi.c b/drivers/media/video/bt8xx/bttv-vbi.c
index 63676e7bd635..6fc6b0260056 100644
--- a/drivers/media/video/bt8xx/bttv-vbi.c
+++ b/drivers/media/video/bt8xx/bttv-vbi.c
@@ -25,7 +25,6 @@
25#include <linux/errno.h> 25#include <linux/errno.h>
26#include <linux/fs.h> 26#include <linux/fs.h>
27#include <linux/kernel.h> 27#include <linux/kernel.h>
28#include <linux/sched.h>
29#include <linux/interrupt.h> 28#include <linux/interrupt.h>
30#include <linux/kdev_t.h> 29#include <linux/kdev_t.h>
31#include <asm/io.h> 30#include <asm/io.h>
diff --git a/drivers/media/video/cx88/cx88-tvaudio.c b/drivers/media/video/cx88/cx88-tvaudio.c
index 2bd84d351a18..063df03dcf2e 100644
--- a/drivers/media/video/cx88/cx88-tvaudio.c
+++ b/drivers/media/video/cx88/cx88-tvaudio.c
@@ -46,7 +46,6 @@
46#include <linux/pci.h> 46#include <linux/pci.h>
47#include <linux/signal.h> 47#include <linux/signal.h>
48#include <linux/ioport.h> 48#include <linux/ioport.h>
49#include <linux/sched.h>
50#include <linux/types.h> 49#include <linux/types.h>
51#include <linux/interrupt.h> 50#include <linux/interrupt.h>
52#include <linux/vmalloc.h> 51#include <linux/vmalloc.h>
diff --git a/drivers/media/video/em28xx/em28xx-input.c b/drivers/media/video/em28xx/em28xx-input.c
index 3ffb5684f127..55d45b0032cf 100644
--- a/drivers/media/video/em28xx/em28xx-input.c
+++ b/drivers/media/video/em28xx/em28xx-input.c
@@ -25,7 +25,6 @@
25#include <linux/moduleparam.h> 25#include <linux/moduleparam.h>
26#include <linux/init.h> 26#include <linux/init.h>
27#include <linux/delay.h> 27#include <linux/delay.h>
28#include <linux/sched.h>
29#include <linux/interrupt.h> 28#include <linux/interrupt.h>
30#include <linux/input.h> 29#include <linux/input.h>
31#include <linux/usb.h> 30#include <linux/usb.h>
diff --git a/drivers/media/video/indycam.c b/drivers/media/video/indycam.c
index 7420b79e987a..5c2c4029ff86 100644
--- a/drivers/media/video/indycam.c
+++ b/drivers/media/video/indycam.c
@@ -17,7 +17,6 @@
17#include <linux/major.h> 17#include <linux/major.h>
18#include <linux/module.h> 18#include <linux/module.h>
19#include <linux/mm.h> 19#include <linux/mm.h>
20#include <linux/sched.h>
21#include <linux/slab.h> 20#include <linux/slab.h>
22 21
23#include <linux/videodev.h> 22#include <linux/videodev.h>
diff --git a/drivers/media/video/ir-kbd-i2c.c b/drivers/media/video/ir-kbd-i2c.c
index 59edf58204de..210582d420f8 100644
--- a/drivers/media/video/ir-kbd-i2c.c
+++ b/drivers/media/video/ir-kbd-i2c.c
@@ -31,7 +31,6 @@
31#include <linux/moduleparam.h> 31#include <linux/moduleparam.h>
32#include <linux/init.h> 32#include <linux/init.h>
33#include <linux/kernel.h> 33#include <linux/kernel.h>
34#include <linux/sched.h>
35#include <linux/string.h> 34#include <linux/string.h>
36#include <linux/timer.h> 35#include <linux/timer.h>
37#include <linux/delay.h> 36#include <linux/delay.h>
diff --git a/drivers/media/video/meye.c b/drivers/media/video/meye.c
index 9528e10c2828..98681da5e3b9 100644
--- a/drivers/media/video/meye.c
+++ b/drivers/media/video/meye.c
@@ -28,7 +28,6 @@
28 */ 28 */
29#include <linux/module.h> 29#include <linux/module.h>
30#include <linux/pci.h> 30#include <linux/pci.h>
31#include <linux/sched.h>
32#include <linux/init.h> 31#include <linux/init.h>
33#include <linux/videodev.h> 32#include <linux/videodev.h>
34#include <media/v4l2-common.h> 33#include <media/v4l2-common.h>
diff --git a/drivers/media/video/pms.c b/drivers/media/video/pms.c
index d38d3dc4a012..b5a67f0dd19f 100644
--- a/drivers/media/video/pms.c
+++ b/drivers/media/video/pms.c
@@ -28,7 +28,6 @@
28#include <linux/ioport.h> 28#include <linux/ioport.h>
29#include <linux/init.h> 29#include <linux/init.h>
30#include <asm/io.h> 30#include <asm/io.h>
31#include <linux/sched.h>
32#include <linux/videodev.h> 31#include <linux/videodev.h>
33#include <media/v4l2-common.h> 32#include <media/v4l2-common.h>
34#include <linux/mutex.h> 33#include <linux/mutex.h>
diff --git a/drivers/media/video/saa5246a.c b/drivers/media/video/saa5246a.c
index 0b5d159895bf..76f5f5d49dae 100644
--- a/drivers/media/video/saa5246a.c
+++ b/drivers/media/video/saa5246a.c
@@ -40,7 +40,6 @@
40 40
41#include <linux/module.h> 41#include <linux/module.h>
42#include <linux/kernel.h> 42#include <linux/kernel.h>
43#include <linux/sched.h>
44#include <linux/mm.h> 43#include <linux/mm.h>
45#include <linux/init.h> 44#include <linux/init.h>
46#include <linux/i2c.h> 45#include <linux/i2c.h>
diff --git a/drivers/media/video/saa7111.c b/drivers/media/video/saa7111.c
index 686fd4746205..44dc7479119c 100644
--- a/drivers/media/video/saa7111.c
+++ b/drivers/media/video/saa7111.c
@@ -41,7 +41,6 @@
41#include <asm/io.h> 41#include <asm/io.h>
42#include <asm/pgtable.h> 42#include <asm/pgtable.h>
43#include <asm/page.h> 43#include <asm/page.h>
44#include <linux/sched.h>
45#include <linux/types.h> 44#include <linux/types.h>
46 45
47#include <linux/videodev.h> 46#include <linux/videodev.h>
diff --git a/drivers/media/video/saa7114.c b/drivers/media/video/saa7114.c
index 90398ab8252e..2ce3321ab995 100644
--- a/drivers/media/video/saa7114.c
+++ b/drivers/media/video/saa7114.c
@@ -44,7 +44,6 @@
44#include <asm/io.h> 44#include <asm/io.h>
45#include <asm/pgtable.h> 45#include <asm/pgtable.h>
46#include <asm/page.h> 46#include <asm/page.h>
47#include <linux/sched.h>
48#include <linux/types.h> 47#include <linux/types.h>
49 48
50#include <linux/videodev.h> 49#include <linux/videodev.h>
diff --git a/drivers/media/video/saa711x.c b/drivers/media/video/saa711x.c
index 708fae51e8ee..269d7114a93a 100644
--- a/drivers/media/video/saa711x.c
+++ b/drivers/media/video/saa711x.c
@@ -35,7 +35,6 @@
35#include <asm/io.h> 35#include <asm/io.h>
36#include <asm/pgtable.h> 36#include <asm/pgtable.h>
37#include <asm/page.h> 37#include <asm/page.h>
38#include <linux/sched.h>
39#include <linux/types.h> 38#include <linux/types.h>
40#include <asm/uaccess.h> 39#include <asm/uaccess.h>
41#include <linux/videodev.h> 40#include <linux/videodev.h>
diff --git a/drivers/media/video/saa7134/saa6752hs.c b/drivers/media/video/saa7134/saa6752hs.c
index afc8f352b8e7..57f1f5d409e0 100644
--- a/drivers/media/video/saa7134/saa6752hs.c
+++ b/drivers/media/video/saa7134/saa6752hs.c
@@ -1,6 +1,5 @@
1#include <linux/module.h> 1#include <linux/module.h>
2#include <linux/kernel.h> 2#include <linux/kernel.h>
3#include <linux/sched.h>
4#include <linux/string.h> 3#include <linux/string.h>
5#include <linux/timer.h> 4#include <linux/timer.h>
6#include <linux/delay.h> 5#include <linux/delay.h>
diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c
index 60b38defd9bc..e4252683a597 100644
--- a/drivers/media/video/saa7134/saa7134-input.c
+++ b/drivers/media/video/saa7134/saa7134-input.c
@@ -22,7 +22,6 @@
22#include <linux/moduleparam.h> 22#include <linux/moduleparam.h>
23#include <linux/init.h> 23#include <linux/init.h>
24#include <linux/delay.h> 24#include <linux/delay.h>
25#include <linux/sched.h>
26#include <linux/interrupt.h> 25#include <linux/interrupt.h>
27#include <linux/input.h> 26#include <linux/input.h>
28 27
diff --git a/drivers/media/video/saa7185.c b/drivers/media/video/saa7185.c
index 9c308410856d..e0fdb1ab7580 100644
--- a/drivers/media/video/saa7185.c
+++ b/drivers/media/video/saa7185.c
@@ -38,7 +38,6 @@
38#include <asm/io.h> 38#include <asm/io.h>
39#include <asm/pgtable.h> 39#include <asm/pgtable.h>
40#include <asm/page.h> 40#include <asm/page.h>
41#include <linux/sched.h>
42#include <linux/types.h> 41#include <linux/types.h>
43 42
44#include <linux/videodev.h> 43#include <linux/videodev.h>
diff --git a/drivers/media/video/saa7191.c b/drivers/media/video/saa7191.c
index 746cadb8f1c4..8615a6081a5d 100644
--- a/drivers/media/video/saa7191.c
+++ b/drivers/media/video/saa7191.c
@@ -17,7 +17,6 @@
17#include <linux/major.h> 17#include <linux/major.h>
18#include <linux/module.h> 18#include <linux/module.h>
19#include <linux/mm.h> 19#include <linux/mm.h>
20#include <linux/sched.h>
21#include <linux/slab.h> 20#include <linux/slab.h>
22 21
23#include <linux/videodev.h> 22#include <linux/videodev.h>
diff --git a/drivers/media/video/tda7432.c b/drivers/media/video/tda7432.c
index 78e043ac9ea0..d1ccc064206f 100644
--- a/drivers/media/video/tda7432.c
+++ b/drivers/media/video/tda7432.c
@@ -38,7 +38,6 @@
38#include <linux/module.h> 38#include <linux/module.h>
39#include <linux/init.h> 39#include <linux/init.h>
40#include <linux/kernel.h> 40#include <linux/kernel.h>
41#include <linux/sched.h>
42#include <linux/string.h> 41#include <linux/string.h>
43#include <linux/timer.h> 42#include <linux/timer.h>
44#include <linux/delay.h> 43#include <linux/delay.h>
diff --git a/drivers/media/video/tda9875.c b/drivers/media/video/tda9875.c
index 827633b3bb43..00f0e8b6e03b 100644
--- a/drivers/media/video/tda9875.c
+++ b/drivers/media/video/tda9875.c
@@ -19,7 +19,6 @@
19 19
20#include <linux/module.h> 20#include <linux/module.h>
21#include <linux/kernel.h> 21#include <linux/kernel.h>
22#include <linux/sched.h>
23#include <linux/string.h> 22#include <linux/string.h>
24#include <linux/timer.h> 23#include <linux/timer.h>
25#include <linux/delay.h> 24#include <linux/delay.h>
diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c
index ee4a493032d6..7be73e3763de 100644
--- a/drivers/media/video/tuner-core.c
+++ b/drivers/media/video/tuner-core.c
@@ -7,7 +7,6 @@
7#include <linux/module.h> 7#include <linux/module.h>
8#include <linux/moduleparam.h> 8#include <linux/moduleparam.h>
9#include <linux/kernel.h> 9#include <linux/kernel.h>
10#include <linux/sched.h>
11#include <linux/string.h> 10#include <linux/string.h>
12#include <linux/timer.h> 11#include <linux/timer.h>
13#include <linux/delay.h> 12#include <linux/delay.h>
diff --git a/drivers/media/video/tvmixer.c b/drivers/media/video/tvmixer.c
index e2747bd373fd..7ea9132a1965 100644
--- a/drivers/media/video/tvmixer.c
+++ b/drivers/media/video/tvmixer.c
@@ -4,7 +4,6 @@
4#include <linux/module.h> 4#include <linux/module.h>
5#include <linux/moduleparam.h> 5#include <linux/moduleparam.h>
6#include <linux/kernel.h> 6#include <linux/kernel.h>
7#include <linux/sched.h>
8#include <linux/string.h> 7#include <linux/string.h>
9#include <linux/timer.h> 8#include <linux/timer.h>
10#include <linux/delay.h> 9#include <linux/delay.h>
diff --git a/drivers/media/video/usbvideo/ibmcam.c b/drivers/media/video/usbvideo/ibmcam.c
index 76f771b6a32f..14db95e10cfe 100644
--- a/drivers/media/video/usbvideo/ibmcam.c
+++ b/drivers/media/video/usbvideo/ibmcam.c
@@ -15,7 +15,6 @@
15 */ 15 */
16 16
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/sched.h>
19#include <linux/module.h> 18#include <linux/module.h>
20#include <linux/init.h> 19#include <linux/init.h>
21 20
diff --git a/drivers/media/video/usbvideo/ultracam.c b/drivers/media/video/usbvideo/ultracam.c
index 10c58b4a2e5b..95453c108d40 100644
--- a/drivers/media/video/usbvideo/ultracam.c
+++ b/drivers/media/video/usbvideo/ultracam.c
@@ -6,7 +6,6 @@
6 */ 6 */
7 7
8#include <linux/kernel.h> 8#include <linux/kernel.h>
9#include <linux/sched.h>
10#include <linux/module.h> 9#include <linux/module.h>
11#include <linux/init.h> 10#include <linux/init.h>
12 11
diff --git a/drivers/media/video/usbvision/usbvision-core.c b/drivers/media/video/usbvision/usbvision-core.c
index a807d971e273..901f664dc6db 100644
--- a/drivers/media/video/usbvision/usbvision-core.c
+++ b/drivers/media/video/usbvision/usbvision-core.c
@@ -24,7 +24,6 @@
24 */ 24 */
25 25
26#include <linux/kernel.h> 26#include <linux/kernel.h>
27#include <linux/sched.h>
28#include <linux/list.h> 27#include <linux/list.h>
29#include <linux/timer.h> 28#include <linux/timer.h>
30#include <linux/slab.h> 29#include <linux/slab.h>
diff --git a/drivers/media/video/usbvision/usbvision-i2c.c b/drivers/media/video/usbvision/usbvision-i2c.c
index a242b76aea89..609e1fd9c784 100644
--- a/drivers/media/video/usbvision/usbvision-i2c.c
+++ b/drivers/media/video/usbvision/usbvision-i2c.c
@@ -34,7 +34,6 @@
34#include <asm/uaccess.h> 34#include <asm/uaccess.h>
35#include <linux/ioport.h> 35#include <linux/ioport.h>
36#include <linux/errno.h> 36#include <linux/errno.h>
37#include <linux/sched.h>
38#include <linux/usb.h> 37#include <linux/usb.h>
39#include <linux/i2c.h> 38#include <linux/i2c.h>
40#include "usbvision.h" 39#include "usbvision.h"
diff --git a/drivers/media/video/usbvision/usbvision-video.c b/drivers/media/video/usbvision/usbvision-video.c
index 4eb7330b96f8..af33653f0db8 100644
--- a/drivers/media/video/usbvision/usbvision-video.c
+++ b/drivers/media/video/usbvision/usbvision-video.c
@@ -46,7 +46,6 @@
46 46
47#include <linux/version.h> 47#include <linux/version.h>
48#include <linux/kernel.h> 48#include <linux/kernel.h>
49#include <linux/sched.h>
50#include <linux/list.h> 49#include <linux/list.h>
51#include <linux/timer.h> 50#include <linux/timer.h>
52#include <linux/slab.h> 51#include <linux/slab.h>
diff --git a/drivers/media/video/v4l2-common.c b/drivers/media/video/v4l2-common.c
index b87d571e0463..b8ee37ded3c9 100644
--- a/drivers/media/video/v4l2-common.c
+++ b/drivers/media/video/v4l2-common.c
@@ -47,7 +47,6 @@
47#include <linux/module.h> 47#include <linux/module.h>
48#include <linux/types.h> 48#include <linux/types.h>
49#include <linux/kernel.h> 49#include <linux/kernel.h>
50#include <linux/sched.h>
51#include <linux/smp_lock.h> 50#include <linux/smp_lock.h>
52#include <linux/mm.h> 51#include <linux/mm.h>
53#include <linux/string.h> 52#include <linux/string.h>
diff --git a/drivers/media/video/videodev.c b/drivers/media/video/videodev.c
index 30c3822692fb..a786c1f5b960 100644
--- a/drivers/media/video/videodev.c
+++ b/drivers/media/video/videodev.c
@@ -30,7 +30,6 @@
30#include <linux/module.h> 30#include <linux/module.h>
31#include <linux/types.h> 31#include <linux/types.h>
32#include <linux/kernel.h> 32#include <linux/kernel.h>
33#include <linux/sched.h>
34#include <linux/smp_lock.h> 33#include <linux/smp_lock.h>
35#include <linux/mm.h> 34#include <linux/mm.h>
36#include <linux/string.h> 35#include <linux/string.h>
diff --git a/drivers/message/fusion/mptfc.c b/drivers/message/fusion/mptfc.c
index b7d4c7265ec6..0caaf6403993 100644
--- a/drivers/message/fusion/mptfc.c
+++ b/drivers/message/fusion/mptfc.c
@@ -53,7 +53,6 @@
53#include <linux/delay.h> /* for mdelay */ 53#include <linux/delay.h> /* for mdelay */
54#include <linux/interrupt.h> /* needed for in_interrupt() proto */ 54#include <linux/interrupt.h> /* needed for in_interrupt() proto */
55#include <linux/reboot.h> /* notifier code */ 55#include <linux/reboot.h> /* notifier code */
56#include <linux/sched.h>
57#include <linux/workqueue.h> 56#include <linux/workqueue.h>
58#include <linux/sort.h> 57#include <linux/sort.h>
59 58
diff --git a/drivers/message/fusion/mptsas.c b/drivers/message/fusion/mptsas.c
index 84b8b485e95b..404c014db1bd 100644
--- a/drivers/message/fusion/mptsas.c
+++ b/drivers/message/fusion/mptsas.c
@@ -48,7 +48,7 @@
48#include <linux/kernel.h> 48#include <linux/kernel.h>
49#include <linux/init.h> 49#include <linux/init.h>
50#include <linux/errno.h> 50#include <linux/errno.h>
51#include <linux/sched.h> 51#include <linux/jiffies.h>
52#include <linux/workqueue.h> 52#include <linux/workqueue.h>
53#include <linux/delay.h> /* for mdelay */ 53#include <linux/delay.h> /* for mdelay */
54 54
diff --git a/drivers/message/fusion/mptscsih.c b/drivers/message/fusion/mptscsih.c
index c417ae0b5fe6..2a3e9e66d4ef 100644
--- a/drivers/message/fusion/mptscsih.c
+++ b/drivers/message/fusion/mptscsih.c
@@ -54,7 +54,6 @@
54#include <linux/delay.h> /* for mdelay */ 54#include <linux/delay.h> /* for mdelay */
55#include <linux/interrupt.h> /* needed for in_interrupt() proto */ 55#include <linux/interrupt.h> /* needed for in_interrupt() proto */
56#include <linux/reboot.h> /* notifier code */ 56#include <linux/reboot.h> /* notifier code */
57#include <linux/sched.h>
58#include <linux/workqueue.h> 57#include <linux/workqueue.h>
59 58
60#include <scsi/scsi.h> 59#include <scsi/scsi.h>
diff --git a/drivers/message/fusion/mptspi.c b/drivers/message/fusion/mptspi.c
index c31a9e3c8a26..85f21b54cb7d 100644
--- a/drivers/message/fusion/mptspi.c
+++ b/drivers/message/fusion/mptspi.c
@@ -54,7 +54,6 @@
54#include <linux/delay.h> /* for mdelay */ 54#include <linux/delay.h> /* for mdelay */
55#include <linux/interrupt.h> /* needed for in_interrupt() proto */ 55#include <linux/interrupt.h> /* needed for in_interrupt() proto */
56#include <linux/reboot.h> /* notifier code */ 56#include <linux/reboot.h> /* notifier code */
57#include <linux/sched.h>
58#include <linux/workqueue.h> 57#include <linux/workqueue.h>
59#include <linux/raid_class.h> 58#include <linux/raid_class.h>
60 59
diff --git a/drivers/misc/tifm_7xx1.c b/drivers/misc/tifm_7xx1.c
index e21e490fedb0..bc60e2fc3c2c 100644
--- a/drivers/misc/tifm_7xx1.c
+++ b/drivers/misc/tifm_7xx1.c
@@ -367,7 +367,7 @@ static int tifm_7xx1_probe(struct pci_dev *dev,
367 if (!fm->addr) 367 if (!fm->addr)
368 goto err_out_free; 368 goto err_out_free;
369 369
370 rc = request_irq(dev->irq, tifm_7xx1_isr, SA_SHIRQ, DRIVER_NAME, fm); 370 rc = request_irq(dev->irq, tifm_7xx1_isr, IRQF_SHARED, DRIVER_NAME, fm);
371 if (rc) 371 if (rc)
372 goto err_out_unmap; 372 goto err_out_unmap;
373 373
diff --git a/drivers/mmc/mmc_block.c b/drivers/mmc/mmc_block.c
index 05ba8ace70e7..86439a0bb271 100644
--- a/drivers/mmc/mmc_block.c
+++ b/drivers/mmc/mmc_block.c
@@ -20,7 +20,6 @@
20#include <linux/module.h> 20#include <linux/module.h>
21#include <linux/init.h> 21#include <linux/init.h>
22 22
23#include <linux/sched.h>
24#include <linux/kernel.h> 23#include <linux/kernel.h>
25#include <linux/fs.h> 24#include <linux/fs.h>
26#include <linux/errno.h> 25#include <linux/errno.h>
diff --git a/drivers/mtd/chips/cfi_util.c b/drivers/mtd/chips/cfi_util.c
index d8e7a026ba5a..2e51496c248e 100644
--- a/drivers/mtd/chips/cfi_util.c
+++ b/drivers/mtd/chips/cfi_util.c
@@ -14,7 +14,6 @@
14#include <linux/module.h> 14#include <linux/module.h>
15#include <linux/types.h> 15#include <linux/types.h>
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <linux/sched.h>
18#include <asm/io.h> 17#include <asm/io.h>
19#include <asm/byteorder.h> 18#include <asm/byteorder.h>
20 19
diff --git a/drivers/mtd/devices/doc2001.c b/drivers/mtd/devices/doc2001.c
index 0e2a9326f717..fe71a12c2627 100644
--- a/drivers/mtd/devices/doc2001.c
+++ b/drivers/mtd/devices/doc2001.c
@@ -16,7 +16,6 @@
16#include <linux/pci.h> 16#include <linux/pci.h>
17#include <linux/delay.h> 17#include <linux/delay.h>
18#include <linux/slab.h> 18#include <linux/slab.h>
19#include <linux/sched.h>
20#include <linux/init.h> 19#include <linux/init.h>
21#include <linux/types.h> 20#include <linux/types.h>
22#include <linux/bitops.h> 21#include <linux/bitops.h>
diff --git a/drivers/mtd/devices/doc2001plus.c b/drivers/mtd/devices/doc2001plus.c
index 92dbb47f2ac3..ba4db686285a 100644
--- a/drivers/mtd/devices/doc2001plus.c
+++ b/drivers/mtd/devices/doc2001plus.c
@@ -20,7 +20,6 @@
20#include <linux/pci.h> 20#include <linux/pci.h>
21#include <linux/delay.h> 21#include <linux/delay.h>
22#include <linux/slab.h> 22#include <linux/slab.h>
23#include <linux/sched.h>
24#include <linux/init.h> 23#include <linux/init.h>
25#include <linux/types.h> 24#include <linux/types.h>
26#include <linux/bitops.h> 25#include <linux/bitops.h>
diff --git a/drivers/mtd/devices/docecc.c b/drivers/mtd/devices/docecc.c
index cd3db72bef96..52b5d638077f 100644
--- a/drivers/mtd/devices/docecc.c
+++ b/drivers/mtd/devices/docecc.c
@@ -32,7 +32,6 @@
32#include <linux/pci.h> 32#include <linux/pci.h>
33#include <linux/delay.h> 33#include <linux/delay.h>
34#include <linux/slab.h> 34#include <linux/slab.h>
35#include <linux/sched.h>
36#include <linux/init.h> 35#include <linux/init.h>
37#include <linux/types.h> 36#include <linux/types.h>
38 37
diff --git a/drivers/mtd/devices/pmc551.c b/drivers/mtd/devices/pmc551.c
index 354e1657cc26..a4873ab84e6b 100644
--- a/drivers/mtd/devices/pmc551.c
+++ b/drivers/mtd/devices/pmc551.c
@@ -86,7 +86,6 @@
86#include <linux/module.h> 86#include <linux/module.h>
87#include <asm/uaccess.h> 87#include <asm/uaccess.h>
88#include <linux/types.h> 88#include <linux/types.h>
89#include <linux/sched.h>
90#include <linux/init.h> 89#include <linux/init.h>
91#include <linux/ptrace.h> 90#include <linux/ptrace.h>
92#include <linux/slab.h> 91#include <linux/slab.h>
diff --git a/drivers/mtd/devices/slram.c b/drivers/mtd/devices/slram.c
index 5f49248a4856..d293add1857c 100644
--- a/drivers/mtd/devices/slram.c
+++ b/drivers/mtd/devices/slram.c
@@ -35,7 +35,6 @@
35#include <asm/uaccess.h> 35#include <asm/uaccess.h>
36#include <linux/types.h> 36#include <linux/types.h>
37#include <linux/kernel.h> 37#include <linux/kernel.h>
38#include <linux/sched.h>
39#include <linux/ptrace.h> 38#include <linux/ptrace.h>
40#include <linux/slab.h> 39#include <linux/slab.h>
41#include <linux/string.h> 40#include <linux/string.h>
diff --git a/drivers/mtd/ftl.c b/drivers/mtd/ftl.c
index 24235d4f1d23..c815d0f38577 100644
--- a/drivers/mtd/ftl.c
+++ b/drivers/mtd/ftl.c
@@ -61,7 +61,6 @@
61/*#define PSYCHO_DEBUG */ 61/*#define PSYCHO_DEBUG */
62 62
63#include <linux/kernel.h> 63#include <linux/kernel.h>
64#include <linux/sched.h>
65#include <linux/ptrace.h> 64#include <linux/ptrace.h>
66#include <linux/slab.h> 65#include <linux/slab.h>
67#include <linux/string.h> 66#include <linux/string.h>
diff --git a/drivers/mtd/inftlmount.c b/drivers/mtd/inftlmount.c
index 8f6006f1a519..acf3ba223298 100644
--- a/drivers/mtd/inftlmount.c
+++ b/drivers/mtd/inftlmount.c
@@ -34,7 +34,6 @@
34#include <linux/pci.h> 34#include <linux/pci.h>
35#include <linux/delay.h> 35#include <linux/delay.h>
36#include <linux/slab.h> 36#include <linux/slab.h>
37#include <linux/sched.h>
38#include <linux/init.h> 37#include <linux/init.h>
39#include <linux/mtd/mtd.h> 38#include <linux/mtd/mtd.h>
40#include <linux/mtd/nftl.h> 39#include <linux/mtd/nftl.h>
diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
index 7070110aba2a..c153b64a8300 100644
--- a/drivers/mtd/mtdcore.c
+++ b/drivers/mtd/mtdcore.c
@@ -8,7 +8,6 @@
8 8
9#include <linux/module.h> 9#include <linux/module.h>
10#include <linux/kernel.h> 10#include <linux/kernel.h>
11#include <linux/sched.h>
12#include <linux/ptrace.h> 11#include <linux/ptrace.h>
13#include <linux/slab.h> 12#include <linux/slab.h>
14#include <linux/string.h> 13#include <linux/string.h>
diff --git a/drivers/mtd/nand/cafe.c b/drivers/mtd/nand/cafe.c
index 65f9bd3ceebf..08cb060dfa3d 100644
--- a/drivers/mtd/nand/cafe.c
+++ b/drivers/mtd/nand/cafe.c
@@ -597,7 +597,8 @@ static int __devinit cafe_nand_probe(struct pci_dev *pdev,
597 cafe_writel(cafe, 0xffffffff, NAND_TIMING3); 597 cafe_writel(cafe, 0xffffffff, NAND_TIMING3);
598 } 598 }
599 cafe_writel(cafe, 0xffffffff, NAND_IRQ_MASK); 599 cafe_writel(cafe, 0xffffffff, NAND_IRQ_MASK);
600 err = request_irq(pdev->irq, &cafe_nand_interrupt, SA_SHIRQ, "CAFE NAND", mtd); 600 err = request_irq(pdev->irq, &cafe_nand_interrupt, IRQF_SHARED,
601 "CAFE NAND", mtd);
601 if (err) { 602 if (err) {
602 dev_warn(&pdev->dev, "Could not register IRQ %d\n", pdev->irq); 603 dev_warn(&pdev->dev, "Could not register IRQ %d\n", pdev->irq);
603 604
diff --git a/drivers/mtd/nftlcore.c b/drivers/mtd/nftlcore.c
index 4b1ba4fcfcd3..e6ef7d7f9f14 100644
--- a/drivers/mtd/nftlcore.c
+++ b/drivers/mtd/nftlcore.c
@@ -20,7 +20,6 @@
20#include <linux/pci.h> 20#include <linux/pci.h>
21#include <linux/delay.h> 21#include <linux/delay.h>
22#include <linux/slab.h> 22#include <linux/slab.h>
23#include <linux/sched.h>
24#include <linux/init.h> 23#include <linux/init.h>
25#include <linux/hdreg.h> 24#include <linux/hdreg.h>
26 25
diff --git a/drivers/net/7990.c b/drivers/net/7990.c
index 2d5ba076471c..1b3d11ed6cff 100644
--- a/drivers/net/7990.c
+++ b/drivers/net/7990.c
@@ -500,7 +500,7 @@ int lance_open (struct net_device *dev)
500 int res; 500 int res;
501 501
502 /* Install the Interrupt handler. Or we could shunt this out to specific drivers? */ 502 /* Install the Interrupt handler. Or we could shunt this out to specific drivers? */
503 if (request_irq(lp->irq, lance_interrupt, SA_SHIRQ, lp->name, dev)) 503 if (request_irq(lp->irq, lance_interrupt, IRQF_SHARED, lp->name, dev))
504 return -EAGAIN; 504 return -EAGAIN;
505 505
506 res = lance_reset(dev); 506 res = lance_reset(dev);
diff --git a/drivers/net/arm/ether1.c b/drivers/net/arm/ether1.c
index d6da3ce9ad79..a2921882eba8 100644
--- a/drivers/net/arm/ether1.c
+++ b/drivers/net/arm/ether1.c
@@ -33,7 +33,6 @@
33 33
34#include <linux/module.h> 34#include <linux/module.h>
35#include <linux/kernel.h> 35#include <linux/kernel.h>
36#include <linux/sched.h>
37#include <linux/types.h> 36#include <linux/types.h>
38#include <linux/fcntl.h> 37#include <linux/fcntl.h>
39#include <linux/interrupt.h> 38#include <linux/interrupt.h>
diff --git a/drivers/net/arm/ether3.c b/drivers/net/arm/ether3.c
index 4fc234785d56..841178343a07 100644
--- a/drivers/net/arm/ether3.c
+++ b/drivers/net/arm/ether3.c
@@ -48,7 +48,6 @@
48 48
49#include <linux/module.h> 49#include <linux/module.h>
50#include <linux/kernel.h> 50#include <linux/kernel.h>
51#include <linux/sched.h>
52#include <linux/types.h> 51#include <linux/types.h>
53#include <linux/fcntl.h> 52#include <linux/fcntl.h>
54#include <linux/interrupt.h> 53#include <linux/interrupt.h>
diff --git a/drivers/net/arm/etherh.c b/drivers/net/arm/etherh.c
index 72c41f5907f2..61f574aa3a99 100644
--- a/drivers/net/arm/etherh.c
+++ b/drivers/net/arm/etherh.c
@@ -28,7 +28,6 @@
28 28
29#include <linux/module.h> 29#include <linux/module.h>
30#include <linux/kernel.h> 30#include <linux/kernel.h>
31#include <linux/sched.h>
32#include <linux/types.h> 31#include <linux/types.h>
33#include <linux/fcntl.h> 32#include <linux/fcntl.h>
34#include <linux/interrupt.h> 33#include <linux/interrupt.h>
diff --git a/drivers/net/au1000_eth.c b/drivers/net/au1000_eth.c
index f0b6879a1c7d..69ae229b680e 100644
--- a/drivers/net/au1000_eth.c
+++ b/drivers/net/au1000_eth.c
@@ -37,7 +37,6 @@
37 37
38#include <linux/module.h> 38#include <linux/module.h>
39#include <linux/kernel.h> 39#include <linux/kernel.h>
40#include <linux/sched.h>
41#include <linux/string.h> 40#include <linux/string.h>
42#include <linux/timer.h> 41#include <linux/timer.h>
43#include <linux/errno.h> 42#include <linux/errno.h>
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 61a6fa465d71..a7c8f98a890c 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -35,7 +35,6 @@
35 35
36#include <linux/kernel.h> 36#include <linux/kernel.h>
37#include <linux/module.h> 37#include <linux/module.h>
38#include <linux/sched.h>
39#include <linux/types.h> 38#include <linux/types.h>
40#include <linux/fcntl.h> 39#include <linux/fcntl.h>
41#include <linux/interrupt.h> 40#include <linux/interrupt.h>
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c
index 878f7aabeeac..a122baa5c7bb 100644
--- a/drivers/net/bonding/bond_sysfs.c
+++ b/drivers/net/bonding/bond_sysfs.c
@@ -22,7 +22,6 @@
22 */ 22 */
23#include <linux/kernel.h> 23#include <linux/kernel.h>
24#include <linux/module.h> 24#include <linux/module.h>
25#include <linux/sched.h>
26#include <linux/device.h> 25#include <linux/device.h>
27#include <linux/sysdev.h> 26#include <linux/sysdev.h>
28#include <linux/fs.h> 27#include <linux/fs.h>
diff --git a/drivers/net/cris/eth_v10.c b/drivers/net/cris/eth_v10.c
index a03d781f6d0a..8eb571276000 100644
--- a/drivers/net/cris/eth_v10.c
+++ b/drivers/net/cris/eth_v10.c
@@ -222,7 +222,6 @@
222#include <linux/module.h> 222#include <linux/module.h>
223 223
224#include <linux/kernel.h> 224#include <linux/kernel.h>
225#include <linux/sched.h>
226#include <linux/delay.h> 225#include <linux/delay.h>
227#include <linux/types.h> 226#include <linux/types.h>
228#include <linux/fcntl.h> 227#include <linux/fcntl.h>
diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c
index c67f7d3c2f92..43583ed655ab 100644
--- a/drivers/net/cxgb3/cxgb3_main.c
+++ b/drivers/net/cxgb3/cxgb3_main.c
@@ -757,7 +757,8 @@ static int cxgb_up(struct adapter *adap)
757 t3_intr_handler(adap, 757 t3_intr_handler(adap,
758 adap->sge.qs[0].rspq. 758 adap->sge.qs[0].rspq.
759 polling), 759 polling),
760 (adap->flags & USING_MSI) ? 0 : SA_SHIRQ, 760 (adap->flags & USING_MSI) ?
761 0 : IRQF_SHARED,
761 adap->name, adap))) 762 adap->name, adap)))
762 goto irq_err; 763 goto irq_err;
763 764
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c
index 9de2d38a5321..38b2fa424b2d 100644
--- a/drivers/net/ehea/ehea_main.c
+++ b/drivers/net/ehea/ehea_main.c
@@ -882,7 +882,7 @@ static int ehea_reg_interrupts(struct net_device *dev)
882 , "%s-recv%d", dev->name, i); 882 , "%s-recv%d", dev->name, i);
883 ret = ibmebus_request_irq(NULL, pr->recv_eq->attr.ist1, 883 ret = ibmebus_request_irq(NULL, pr->recv_eq->attr.ist1,
884 ehea_recv_irq_handler, 884 ehea_recv_irq_handler,
885 SA_INTERRUPT, pr->int_recv_name, pr); 885 IRQF_DISABLED, pr->int_recv_name, pr);
886 if (ret) { 886 if (ret) {
887 ehea_error("failed registering irq for ehea_recv_int:" 887 ehea_error("failed registering irq for ehea_recv_int:"
888 "port_res_nr:%d, ist=%X", i, 888 "port_res_nr:%d, ist=%X", i,
@@ -899,7 +899,7 @@ static int ehea_reg_interrupts(struct net_device *dev)
899 899
900 ret = ibmebus_request_irq(NULL, port->qp_eq->attr.ist1, 900 ret = ibmebus_request_irq(NULL, port->qp_eq->attr.ist1,
901 ehea_qp_aff_irq_handler, 901 ehea_qp_aff_irq_handler,
902 SA_INTERRUPT, port->int_aff_name, port); 902 IRQF_DISABLED, port->int_aff_name, port);
903 if (ret) { 903 if (ret) {
904 ehea_error("failed registering irq for qp_aff_irq_handler:" 904 ehea_error("failed registering irq for qp_aff_irq_handler:"
905 "ist=%X", port->qp_eq->attr.ist1); 905 "ist=%X", port->qp_eq->attr.ist1);
@@ -916,7 +916,7 @@ static int ehea_reg_interrupts(struct net_device *dev)
916 "%s-send%d", dev->name, i); 916 "%s-send%d", dev->name, i);
917 ret = ibmebus_request_irq(NULL, pr->send_eq->attr.ist1, 917 ret = ibmebus_request_irq(NULL, pr->send_eq->attr.ist1,
918 ehea_send_irq_handler, 918 ehea_send_irq_handler,
919 SA_INTERRUPT, pr->int_send_name, 919 IRQF_DISABLED, pr->int_send_name,
920 pr); 920 pr);
921 if (ret) { 921 if (ret) {
922 ehea_error("failed registering irq for ehea_send " 922 ehea_error("failed registering irq for ehea_send "
@@ -2539,7 +2539,7 @@ static int __devinit ehea_probe(struct ibmebus_dev *dev,
2539 (unsigned long)adapter); 2539 (unsigned long)adapter);
2540 2540
2541 ret = ibmebus_request_irq(NULL, adapter->neq->attr.ist1, 2541 ret = ibmebus_request_irq(NULL, adapter->neq->attr.ist1,
2542 ehea_interrupt_neq, SA_INTERRUPT, 2542 ehea_interrupt_neq, IRQF_DISABLED,
2543 "ehea_neq", adapter); 2543 "ehea_neq", adapter);
2544 if (ret) { 2544 if (ret) {
2545 dev_err(&dev->ofdev.dev, "requesting NEQ IRQ failed"); 2545 dev_err(&dev->ofdev.dev, "requesting NEQ IRQ failed");
diff --git a/drivers/net/fec_8xx/fec_8xx-netta.c b/drivers/net/fec_8xx/fec_8xx-netta.c
index 790d9dbe42dd..e492eb84f948 100644
--- a/drivers/net/fec_8xx/fec_8xx-netta.c
+++ b/drivers/net/fec_8xx/fec_8xx-netta.c
@@ -4,7 +4,6 @@
4 4
5#include <linux/kernel.h> 5#include <linux/kernel.h>
6#include <linux/types.h> 6#include <linux/types.h>
7#include <linux/sched.h>
8#include <linux/string.h> 7#include <linux/string.h>
9#include <linux/ptrace.h> 8#include <linux/ptrace.h>
10#include <linux/errno.h> 9#include <linux/errno.h>
diff --git a/drivers/net/fec_8xx/fec_main.c b/drivers/net/fec_8xx/fec_main.c
index 8e7a56fadfd2..77f747a5afa7 100644
--- a/drivers/net/fec_8xx/fec_main.c
+++ b/drivers/net/fec_8xx/fec_main.c
@@ -13,7 +13,6 @@
13#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/types.h> 15#include <linux/types.h>
16#include <linux/sched.h>
17#include <linux/string.h> 16#include <linux/string.h>
18#include <linux/ptrace.h> 17#include <linux/ptrace.h>
19#include <linux/errno.h> 18#include <linux/errno.h>
diff --git a/drivers/net/fec_8xx/fec_mii.c b/drivers/net/fec_8xx/fec_mii.c
index d3c16b85d9a4..e79700abf7b6 100644
--- a/drivers/net/fec_8xx/fec_mii.c
+++ b/drivers/net/fec_8xx/fec_mii.c
@@ -13,7 +13,6 @@
13#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/types.h> 14#include <linux/types.h>
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/sched.h>
17#include <linux/string.h> 16#include <linux/string.h>
18#include <linux/ptrace.h> 17#include <linux/ptrace.h>
19#include <linux/errno.h> 18#include <linux/errno.h>
diff --git a/drivers/net/fs_enet/fs_enet-main.c b/drivers/net/fs_enet/fs_enet-main.c
index 889d3a13e95e..4a05c14bf7ec 100644
--- a/drivers/net/fs_enet/fs_enet-main.c
+++ b/drivers/net/fs_enet/fs_enet-main.c
@@ -18,7 +18,6 @@
18#include <linux/module.h> 18#include <linux/module.h>
19#include <linux/kernel.h> 19#include <linux/kernel.h>
20#include <linux/types.h> 20#include <linux/types.h>
21#include <linux/sched.h>
22#include <linux/string.h> 21#include <linux/string.h>
23#include <linux/ptrace.h> 22#include <linux/ptrace.h>
24#include <linux/errno.h> 23#include <linux/errno.h>
diff --git a/drivers/net/fs_enet/mac-fcc.c b/drivers/net/fs_enet/mac-fcc.c
index 1ff2597b8495..8545e84fc9a0 100644
--- a/drivers/net/fs_enet/mac-fcc.c
+++ b/drivers/net/fs_enet/mac-fcc.c
@@ -15,7 +15,6 @@
15#include <linux/module.h> 15#include <linux/module.h>
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <linux/types.h> 17#include <linux/types.h>
18#include <linux/sched.h>
19#include <linux/string.h> 18#include <linux/string.h>
20#include <linux/ptrace.h> 19#include <linux/ptrace.h>
21#include <linux/errno.h> 20#include <linux/errno.h>
diff --git a/drivers/net/fs_enet/mac-fec.c b/drivers/net/fs_enet/mac-fec.c
index ff6839477306..cdcfb96f360f 100644
--- a/drivers/net/fs_enet/mac-fec.c
+++ b/drivers/net/fs_enet/mac-fec.c
@@ -15,7 +15,6 @@
15#include <linux/module.h> 15#include <linux/module.h>
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <linux/types.h> 17#include <linux/types.h>
18#include <linux/sched.h>
19#include <linux/string.h> 18#include <linux/string.h>
20#include <linux/ptrace.h> 19#include <linux/ptrace.h>
21#include <linux/errno.h> 20#include <linux/errno.h>
diff --git a/drivers/net/fs_enet/mac-scc.c b/drivers/net/fs_enet/mac-scc.c
index afd7fca7c6c4..65925b5a224f 100644
--- a/drivers/net/fs_enet/mac-scc.c
+++ b/drivers/net/fs_enet/mac-scc.c
@@ -15,7 +15,6 @@
15#include <linux/module.h> 15#include <linux/module.h>
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <linux/types.h> 17#include <linux/types.h>
18#include <linux/sched.h>
19#include <linux/string.h> 18#include <linux/string.h>
20#include <linux/ptrace.h> 19#include <linux/ptrace.h>
21#include <linux/errno.h> 20#include <linux/errno.h>
diff --git a/drivers/net/fs_enet/mii-bitbang.c b/drivers/net/fs_enet/mii-bitbang.c
index 0b9b8b5c847c..f91447837fd4 100644
--- a/drivers/net/fs_enet/mii-bitbang.c
+++ b/drivers/net/fs_enet/mii-bitbang.c
@@ -16,7 +16,6 @@
16#include <linux/module.h> 16#include <linux/module.h>
17#include <linux/types.h> 17#include <linux/types.h>
18#include <linux/kernel.h> 18#include <linux/kernel.h>
19#include <linux/sched.h>
20#include <linux/string.h> 19#include <linux/string.h>
21#include <linux/ptrace.h> 20#include <linux/ptrace.h>
22#include <linux/errno.h> 21#include <linux/errno.h>
diff --git a/drivers/net/fs_enet/mii-fec.c b/drivers/net/fs_enet/mii-fec.c
index baaae3dbf2e6..235b177fb9ac 100644
--- a/drivers/net/fs_enet/mii-fec.c
+++ b/drivers/net/fs_enet/mii-fec.c
@@ -15,7 +15,6 @@
15#include <linux/module.h> 15#include <linux/module.h>
16#include <linux/types.h> 16#include <linux/types.h>
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/sched.h>
19#include <linux/string.h> 18#include <linux/string.h>
20#include <linux/ptrace.h> 19#include <linux/ptrace.h>
21#include <linux/errno.h> 20#include <linux/errno.h>
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index baa35144134c..1be4a84dce0e 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -65,7 +65,6 @@
65 */ 65 */
66 66
67#include <linux/kernel.h> 67#include <linux/kernel.h>
68#include <linux/sched.h>
69#include <linux/string.h> 68#include <linux/string.h>
70#include <linux/errno.h> 69#include <linux/errno.h>
71#include <linux/unistd.h> 70#include <linux/unistd.h>
diff --git a/drivers/net/gianfar_ethtool.c b/drivers/net/gianfar_ethtool.c
index 0d6943d67096..7b411c1514db 100644
--- a/drivers/net/gianfar_ethtool.c
+++ b/drivers/net/gianfar_ethtool.c
@@ -16,7 +16,6 @@
16 */ 16 */
17 17
18#include <linux/kernel.h> 18#include <linux/kernel.h>
19#include <linux/sched.h>
20#include <linux/string.h> 19#include <linux/string.h>
21#include <linux/errno.h> 20#include <linux/errno.h>
22#include <linux/slab.h> 21#include <linux/slab.h>
diff --git a/drivers/net/gianfar_mii.c b/drivers/net/gianfar_mii.c
index ff684d4be96d..bcc6b82f4a33 100644
--- a/drivers/net/gianfar_mii.c
+++ b/drivers/net/gianfar_mii.c
@@ -17,7 +17,6 @@
17 */ 17 */
18 18
19#include <linux/kernel.h> 19#include <linux/kernel.h>
20#include <linux/sched.h>
21#include <linux/string.h> 20#include <linux/string.h>
22#include <linux/errno.h> 21#include <linux/errno.h>
23#include <linux/unistd.h> 22#include <linux/unistd.h>
diff --git a/drivers/net/gianfar_sysfs.c b/drivers/net/gianfar_sysfs.c
index 9dd387fb3d74..45ffb5d0ca33 100644
--- a/drivers/net/gianfar_sysfs.c
+++ b/drivers/net/gianfar_sysfs.c
@@ -20,7 +20,6 @@
20 */ 20 */
21 21
22#include <linux/kernel.h> 22#include <linux/kernel.h>
23#include <linux/sched.h>
24#include <linux/string.h> 23#include <linux/string.h>
25#include <linux/errno.h> 24#include <linux/errno.h>
26#include <linux/unistd.h> 25#include <linux/unistd.h>
diff --git a/drivers/net/ibm_emac/ibm_emac_core.c b/drivers/net/ibm_emac/ibm_emac_core.c
index ffeafb28f782..dd8ad8746825 100644
--- a/drivers/net/ibm_emac/ibm_emac_core.c
+++ b/drivers/net/ibm_emac/ibm_emac_core.c
@@ -21,7 +21,6 @@
21 21
22#include <linux/module.h> 22#include <linux/module.h>
23#include <linux/kernel.h> 23#include <linux/kernel.h>
24#include <linux/sched.h>
25#include <linux/string.h> 24#include <linux/string.h>
26#include <linux/errno.h> 25#include <linux/errno.h>
27#include <linux/interrupt.h> 26#include <linux/interrupt.h>
diff --git a/drivers/net/irda/ma600-sir.c b/drivers/net/irda/ma600-sir.c
index ebed168b7da6..809906d94762 100644
--- a/drivers/net/irda/ma600-sir.c
+++ b/drivers/net/irda/ma600-sir.c
@@ -34,7 +34,6 @@
34#include <linux/module.h> 34#include <linux/module.h>
35#include <linux/delay.h> 35#include <linux/delay.h>
36#include <linux/init.h> 36#include <linux/init.h>
37#include <linux/sched.h>
38 37
39#include <net/irda/irda.h> 38#include <net/irda/irda.h>
40 39
diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index e67361e2bf5d..a41418b3c518 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -1077,7 +1077,7 @@ static int __devinit macb_probe(struct platform_device *pdev)
1077 } 1077 }
1078 1078
1079 dev->irq = platform_get_irq(pdev, 0); 1079 dev->irq = platform_get_irq(pdev, 0);
1080 err = request_irq(dev->irq, macb_interrupt, SA_SAMPLE_RANDOM, 1080 err = request_irq(dev->irq, macb_interrupt, IRQF_SAMPLE_RANDOM,
1081 dev->name, dev); 1081 dev->name, dev);
1082 if (err) { 1082 if (err) {
1083 printk(KERN_ERR 1083 printk(KERN_ERR
diff --git a/drivers/net/meth.c b/drivers/net/meth.c
index e1d97cdf649e..d38b7c723620 100644
--- a/drivers/net/meth.c
+++ b/drivers/net/meth.c
@@ -11,7 +11,6 @@
11#include <linux/module.h> 11#include <linux/module.h>
12#include <linux/init.h> 12#include <linux/init.h>
13 13
14#include <linux/sched.h>
15#include <linux/kernel.h> /* printk() */ 14#include <linux/kernel.h> /* printk() */
16#include <linux/delay.h> 15#include <linux/delay.h>
17#include <linux/slab.h> 16#include <linux/slab.h>
diff --git a/drivers/net/mipsnet.c b/drivers/net/mipsnet.c
index c9469985bd71..f42b9e201937 100644
--- a/drivers/net/mipsnet.c
+++ b/drivers/net/mipsnet.c
@@ -10,7 +10,6 @@
10#include <linux/kernel.h> 10#include <linux/kernel.h>
11#include <linux/module.h> 11#include <linux/module.h>
12#include <linux/netdevice.h> 12#include <linux/netdevice.h>
13#include <linux/sched.h>
14#include <linux/etherdevice.h> 13#include <linux/etherdevice.h>
15#include <linux/netdevice.h> 14#include <linux/netdevice.h>
16#include <linux/platform_device.h> 15#include <linux/platform_device.h>
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c
index 69c1b9d23a1a..36ba6a1aa363 100644
--- a/drivers/net/netxen/netxen_nic_main.c
+++ b/drivers/net/netxen/netxen_nic_main.c
@@ -619,8 +619,8 @@ static int netxen_nic_open(struct net_device *netdev)
619 } 619 }
620 adapter->irq = adapter->ahw.pdev->irq; 620 adapter->irq = adapter->ahw.pdev->irq;
621 err = request_irq(adapter->ahw.pdev->irq, &netxen_intr, 621 err = request_irq(adapter->ahw.pdev->irq, &netxen_intr,
622 SA_SHIRQ | SA_SAMPLE_RANDOM, netdev->name, 622 IRQF_SHARED | IRQF_SAMPLE_RANDOM,
623 adapter); 623 netdev->name, adapter);
624 if (err) { 624 if (err) {
625 printk(KERN_ERR "request_irq failed with: %d\n", err); 625 printk(KERN_ERR "request_irq failed with: %d\n", err);
626 netxen_free_hw_resources(adapter); 626 netxen_free_hw_resources(adapter);
diff --git a/drivers/net/phy/cicada.c b/drivers/net/phy/cicada.c
index ae60e6e4107c..a1bd599c8a5b 100644
--- a/drivers/net/phy/cicada.c
+++ b/drivers/net/phy/cicada.c
@@ -14,7 +14,6 @@
14 * 14 *
15 */ 15 */
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <linux/sched.h>
18#include <linux/string.h> 17#include <linux/string.h>
19#include <linux/errno.h> 18#include <linux/errno.h>
20#include <linux/unistd.h> 19#include <linux/unistd.h>
diff --git a/drivers/net/phy/davicom.c b/drivers/net/phy/davicom.c
index aa7983f55838..519baa38be8d 100644
--- a/drivers/net/phy/davicom.c
+++ b/drivers/net/phy/davicom.c
@@ -14,7 +14,6 @@
14 * 14 *
15 */ 15 */
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <linux/sched.h>
18#include <linux/string.h> 17#include <linux/string.h>
19#include <linux/errno.h> 18#include <linux/errno.h>
20#include <linux/unistd.h> 19#include <linux/unistd.h>
diff --git a/drivers/net/phy/fixed.c b/drivers/net/phy/fixed.c
index 86135397f430..66da91bb1388 100644
--- a/drivers/net/phy/fixed.c
+++ b/drivers/net/phy/fixed.c
@@ -14,7 +14,6 @@
14 * 14 *
15 */ 15 */
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <linux/sched.h>
18#include <linux/string.h> 17#include <linux/string.h>
19#include <linux/errno.h> 18#include <linux/errno.h>
20#include <linux/unistd.h> 19#include <linux/unistd.h>
diff --git a/drivers/net/phy/lxt.c b/drivers/net/phy/lxt.c
index 69d2325f848c..4cf3324ba166 100644
--- a/drivers/net/phy/lxt.c
+++ b/drivers/net/phy/lxt.c
@@ -14,7 +14,6 @@
14 * 14 *
15 */ 15 */
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <linux/sched.h>
18#include <linux/string.h> 17#include <linux/string.h>
19#include <linux/errno.h> 18#include <linux/errno.h>
20#include <linux/unistd.h> 19#include <linux/unistd.h>
diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
index 0ad253282d0d..f4d4eb659cad 100644
--- a/drivers/net/phy/marvell.c
+++ b/drivers/net/phy/marvell.c
@@ -14,7 +14,6 @@
14 * 14 *
15 */ 15 */
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <linux/sched.h>
18#include <linux/string.h> 17#include <linux/string.h>
19#include <linux/errno.h> 18#include <linux/errno.h>
20#include <linux/unistd.h> 19#include <linux/unistd.h>
diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
index cf6660c93ffa..b31ce278bf35 100644
--- a/drivers/net/phy/mdio_bus.c
+++ b/drivers/net/phy/mdio_bus.c
@@ -14,7 +14,6 @@
14 * 14 *
15 */ 15 */
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <linux/sched.h>
18#include <linux/string.h> 17#include <linux/string.h>
19#include <linux/errno.h> 18#include <linux/errno.h>
20#include <linux/unistd.h> 19#include <linux/unistd.h>
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 9765fa661467..c94a1fb3a4be 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -16,7 +16,6 @@
16 * 16 *
17 */ 17 */
18#include <linux/kernel.h> 18#include <linux/kernel.h>
19#include <linux/sched.h>
20#include <linux/string.h> 19#include <linux/string.h>
21#include <linux/errno.h> 20#include <linux/errno.h>
22#include <linux/unistd.h> 21#include <linux/unistd.h>
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index a4d7529ef415..fdf45fdb6731 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -15,7 +15,6 @@
15 * 15 *
16 */ 16 */
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/sched.h>
19#include <linux/string.h> 18#include <linux/string.h>
20#include <linux/errno.h> 19#include <linux/errno.h>
21#include <linux/unistd.h> 20#include <linux/unistd.h>
diff --git a/drivers/net/phy/qsemi.c b/drivers/net/phy/qsemi.c
index 2b50e1739aa5..23062d067231 100644
--- a/drivers/net/phy/qsemi.c
+++ b/drivers/net/phy/qsemi.c
@@ -14,7 +14,6 @@
14 * 14 *
15 */ 15 */
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <linux/sched.h>
18#include <linux/string.h> 17#include <linux/string.h>
19#include <linux/errno.h> 18#include <linux/errno.h>
20#include <linux/unistd.h> 19#include <linux/unistd.h>
diff --git a/drivers/net/qla3xxx.c b/drivers/net/qla3xxx.c
index 2429b274f0b0..a142cdfd947b 100755
--- a/drivers/net/qla3xxx.c
+++ b/drivers/net/qla3xxx.c
@@ -3228,7 +3228,7 @@ static int ql_adapter_up(struct ql3_adapter *qdev)
3228{ 3228{
3229 struct net_device *ndev = qdev->ndev; 3229 struct net_device *ndev = qdev->ndev;
3230 int err; 3230 int err;
3231 unsigned long irq_flags = SA_SAMPLE_RANDOM | SA_SHIRQ; 3231 unsigned long irq_flags = IRQF_SAMPLE_RANDOM | IRQF_SHARED;
3232 unsigned long hw_flags; 3232 unsigned long hw_flags;
3233 3233
3234 if (ql_alloc_mem_resources(qdev)) { 3234 if (ql_alloc_mem_resources(qdev)) {
@@ -3247,7 +3247,7 @@ static int ql_adapter_up(struct ql3_adapter *qdev)
3247 } else { 3247 } else {
3248 printk(KERN_INFO PFX "%s: MSI Enabled...\n", qdev->ndev->name); 3248 printk(KERN_INFO PFX "%s: MSI Enabled...\n", qdev->ndev->name);
3249 set_bit(QL_MSI_ENABLED,&qdev->flags); 3249 set_bit(QL_MSI_ENABLED,&qdev->flags);
3250 irq_flags &= ~SA_SHIRQ; 3250 irq_flags &= ~IRQF_SHARED;
3251 } 3251 }
3252 } 3252 }
3253 3253
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c
index 8646b64994ab..e8e0d94e9bdd 100644
--- a/drivers/net/s2io.c
+++ b/drivers/net/s2io.c
@@ -59,7 +59,6 @@
59#include <linux/stddef.h> 59#include <linux/stddef.h>
60#include <linux/ioctl.h> 60#include <linux/ioctl.h>
61#include <linux/timex.h> 61#include <linux/timex.h>
62#include <linux/sched.h>
63#include <linux/ethtool.h> 62#include <linux/ethtool.h>
64#include <linux/workqueue.h> 63#include <linux/workqueue.h>
65#include <linux/if_vlan.h> 64#include <linux/if_vlan.h>
diff --git a/drivers/net/sc92031.c b/drivers/net/sc92031.c
index 7f800feaa9a2..4a926f20b6ea 100644
--- a/drivers/net/sc92031.c
+++ b/drivers/net/sc92031.c
@@ -1035,7 +1035,7 @@ static int sc92031_open(struct net_device *dev)
1035 priv->tx_head = priv->tx_tail = 0; 1035 priv->tx_head = priv->tx_tail = 0;
1036 1036
1037 err = request_irq(pdev->irq, sc92031_interrupt, 1037 err = request_irq(pdev->irq, sc92031_interrupt,
1038 SA_SHIRQ, dev->name, dev); 1038 IRQF_SHARED, dev->name, dev);
1039 if (unlikely(err < 0)) 1039 if (unlikely(err < 0))
1040 goto out_request_irq; 1040 goto out_request_irq;
1041 1041
diff --git a/drivers/net/sungem_phy.c b/drivers/net/sungem_phy.c
index d21991ee88c4..701ba4f3b69d 100644
--- a/drivers/net/sungem_phy.c
+++ b/drivers/net/sungem_phy.c
@@ -22,7 +22,6 @@
22#include <linux/module.h> 22#include <linux/module.h>
23 23
24#include <linux/kernel.h> 24#include <linux/kernel.h>
25#include <linux/sched.h>
26#include <linux/types.h> 25#include <linux/types.h>
27#include <linux/netdevice.h> 26#include <linux/netdevice.h>
28#include <linux/etherdevice.h> 27#include <linux/etherdevice.h>
diff --git a/drivers/net/tsi108_eth.c b/drivers/net/tsi108_eth.c
index 893808ab3742..d92c5c597e16 100644
--- a/drivers/net/tsi108_eth.c
+++ b/drivers/net/tsi108_eth.c
@@ -38,7 +38,6 @@
38#include <linux/etherdevice.h> 38#include <linux/etherdevice.h>
39#include <linux/skbuff.h> 39#include <linux/skbuff.h>
40#include <linux/slab.h> 40#include <linux/slab.h>
41#include <linux/sched.h>
42#include <linux/spinlock.h> 41#include <linux/spinlock.h>
43#include <linux/delay.h> 42#include <linux/delay.h>
44#include <linux/crc32.h> 43#include <linux/crc32.h>
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index 31c97a6591a4..a2fc2bbcf97f 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -3939,8 +3939,8 @@ static void ugeth_phy_startup_timer(unsigned long data)
3939 /* Grab the PHY interrupt, if necessary/possible */ 3939 /* Grab the PHY interrupt, if necessary/possible */
3940 if (ugeth->ug_info->board_flags & FSL_UGETH_BRD_HAS_PHY_INTR) { 3940 if (ugeth->ug_info->board_flags & FSL_UGETH_BRD_HAS_PHY_INTR) {
3941 if (request_irq(ugeth->ug_info->phy_interrupt, 3941 if (request_irq(ugeth->ug_info->phy_interrupt,
3942 phy_interrupt, 3942 phy_interrupt, IRQF_SHARED,
3943 SA_SHIRQ, "phy_interrupt", mii_info->dev) < 0) { 3943 "phy_interrupt", mii_info->dev) < 0) {
3944 ugeth_err("%s: Can't get IRQ %d (PHY)", 3944 ugeth_err("%s: Can't get IRQ %d (PHY)",
3945 mii_info->dev->name, 3945 mii_info->dev->name,
3946 ugeth->ug_info->phy_interrupt); 3946 ugeth->ug_info->phy_interrupt);
diff --git a/drivers/net/ucc_geth_phy.c b/drivers/net/ucc_geth_phy.c
index 6fda6d88be49..9373d895b9ec 100644
--- a/drivers/net/ucc_geth_phy.c
+++ b/drivers/net/ucc_geth_phy.c
@@ -18,7 +18,6 @@
18 */ 18 */
19 19
20#include <linux/kernel.h> 20#include <linux/kernel.h>
21#include <linux/sched.h>
22#include <linux/string.h> 21#include <linux/string.h>
23#include <linux/errno.h> 22#include <linux/errno.h>
24#include <linux/slab.h> 23#include <linux/slab.h>
diff --git a/drivers/net/wan/cycx_drv.c b/drivers/net/wan/cycx_drv.c
index e6d005726aad..d347d59db656 100644
--- a/drivers/net/wan/cycx_drv.c
+++ b/drivers/net/wan/cycx_drv.c
@@ -53,7 +53,6 @@
53#include <linux/kernel.h> /* printk(), and other useful stuff */ 53#include <linux/kernel.h> /* printk(), and other useful stuff */
54#include <linux/stddef.h> /* offsetof(), etc. */ 54#include <linux/stddef.h> /* offsetof(), etc. */
55#include <linux/errno.h> /* return codes */ 55#include <linux/errno.h> /* return codes */
56#include <linux/sched.h> /* for jiffies, HZ, etc. */
57#include <linux/cycx_drv.h> /* API definitions */ 56#include <linux/cycx_drv.h> /* API definitions */
58#include <linux/cycx_cfm.h> /* CYCX firmware module definitions */ 57#include <linux/cycx_cfm.h> /* CYCX firmware module definitions */
59#include <linux/delay.h> /* udelay, msleep_interruptible */ 58#include <linux/delay.h> /* udelay, msleep_interruptible */
diff --git a/drivers/net/wan/pci200syn.c b/drivers/net/wan/pci200syn.c
index a6b9c33b68e4..ca06a00d9d86 100644
--- a/drivers/net/wan/pci200syn.c
+++ b/drivers/net/wan/pci200syn.c
@@ -17,7 +17,6 @@
17#include <linux/module.h> 17#include <linux/module.h>
18#include <linux/kernel.h> 18#include <linux/kernel.h>
19#include <linux/slab.h> 19#include <linux/slab.h>
20#include <linux/sched.h>
21#include <linux/types.h> 20#include <linux/types.h>
22#include <linux/fcntl.h> 21#include <linux/fcntl.h>
23#include <linux/in.h> 22#include <linux/in.h>
diff --git a/drivers/net/wireless/arlan-proc.c b/drivers/net/wireless/arlan-proc.c
index 5fa985435ffa..015abd928ab0 100644
--- a/drivers/net/wireless/arlan-proc.c
+++ b/drivers/net/wireless/arlan-proc.c
@@ -1216,7 +1216,7 @@ static ctl_table arlan_table[MAX_ARLANS + 1] =
1216static ctl_table arlan_root_table[] = 1216static ctl_table arlan_root_table[] =
1217{ 1217{
1218 { 1218 {
1219 .ctl_name = 254, 1219 .ctl_name = CTL_ARLAN,
1220 .procname = "arlan", 1220 .procname = "arlan",
1221 .maxlen = 0, 1221 .maxlen = 0,
1222 .mode = 0555, 1222 .mode = 0555,
@@ -1244,7 +1244,7 @@ int __init init_arlan_proc(void)
1244 return 0; 1244 return 0;
1245 for (i = 0; i < MAX_ARLANS && arlan_device[i]; i++) 1245 for (i = 0; i < MAX_ARLANS && arlan_device[i]; i++)
1246 arlan_table[i].ctl_name = i + 1; 1246 arlan_table[i].ctl_name = i + 1;
1247 arlan_device_sysctl_header = register_sysctl_table(arlan_root_table, 0); 1247 arlan_device_sysctl_header = register_sysctl_table(arlan_root_table);
1248 if (!arlan_device_sysctl_header) 1248 if (!arlan_device_sysctl_header)
1249 return -1; 1249 return -1;
1250 1250
diff --git a/drivers/net/wireless/atmel.c b/drivers/net/wireless/atmel.c
index 10bcb48e80d0..23eba698aec5 100644
--- a/drivers/net/wireless/atmel.c
+++ b/drivers/net/wireless/atmel.c
@@ -42,7 +42,6 @@
42#include <linux/init.h> 42#include <linux/init.h>
43 43
44#include <linux/kernel.h> 44#include <linux/kernel.h>
45#include <linux/sched.h>
46#include <linux/ptrace.h> 45#include <linux/ptrace.h>
47#include <linux/slab.h> 46#include <linux/slab.h>
48#include <linux/string.h> 47#include <linux/string.h>
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_wx.c b/drivers/net/wireless/bcm43xx/bcm43xx_wx.c
index a659442b9c15..d2ca949174fe 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx_wx.c
+++ b/drivers/net/wireless/bcm43xx/bcm43xx_wx.c
@@ -33,7 +33,6 @@
33#include <net/ieee80211softmac.h> 33#include <net/ieee80211softmac.h>
34#include <net/ieee80211softmac_wx.h> 34#include <net/ieee80211softmac_wx.h>
35#include <linux/capability.h> 35#include <linux/capability.h>
36#include <linux/sched.h> /* for capable() */
37#include <linux/delay.h> 36#include <linux/delay.h>
38 37
39#include "bcm43xx.h" 38#include "bcm43xx.h"
diff --git a/drivers/parisc/eisa.c b/drivers/parisc/eisa.c
index e97cecbc4d18..309076b39853 100644
--- a/drivers/parisc/eisa.c
+++ b/drivers/parisc/eisa.c
@@ -33,7 +33,6 @@
33#include <linux/kernel.h> 33#include <linux/kernel.h>
34#include <linux/module.h> 34#include <linux/module.h>
35#include <linux/pci.h> 35#include <linux/pci.h>
36#include <linux/sched.h>
37#include <linux/spinlock.h> 36#include <linux/spinlock.h>
38#include <linux/eisa.h> 37#include <linux/eisa.h>
39 38
diff --git a/drivers/parport/parport_cs.c b/drivers/parport/parport_cs.c
index e60b4bf6bae8..316c06f4423c 100644
--- a/drivers/parport/parport_cs.c
+++ b/drivers/parport/parport_cs.c
@@ -37,7 +37,6 @@
37#include <linux/kernel.h> 37#include <linux/kernel.h>
38#include <linux/module.h> 38#include <linux/module.h>
39#include <linux/init.h> 39#include <linux/init.h>
40#include <linux/sched.h>
41#include <linux/ptrace.h> 40#include <linux/ptrace.h>
42#include <linux/slab.h> 41#include <linux/slab.h>
43#include <linux/string.h> 42#include <linux/string.h>
diff --git a/drivers/parport/parport_gsc.c b/drivers/parport/parport_gsc.c
index a7c5ead9a3d3..17bf9937d276 100644
--- a/drivers/parport/parport_gsc.c
+++ b/drivers/parport/parport_gsc.c
@@ -23,7 +23,6 @@
23 23
24#include <linux/module.h> 24#include <linux/module.h>
25#include <linux/init.h> 25#include <linux/init.h>
26#include <linux/sched.h>
27#include <linux/delay.h> 26#include <linux/delay.h>
28#include <linux/errno.h> 27#include <linux/errno.h>
29#include <linux/interrupt.h> 28#include <linux/interrupt.h>
diff --git a/drivers/parport/procfs.c b/drivers/parport/procfs.c
index 2e744a274517..bdbdab9285ca 100644
--- a/drivers/parport/procfs.c
+++ b/drivers/parport/procfs.c
@@ -233,12 +233,12 @@ static int do_hardware_modes (ctl_table *table, int write,
233 return copy_to_user(result, buffer, len) ? -EFAULT : 0; 233 return copy_to_user(result, buffer, len) ? -EFAULT : 0;
234} 234}
235 235
236#define PARPORT_PORT_DIR(child) { 0, NULL, NULL, 0, 0555, child } 236#define PARPORT_PORT_DIR(CHILD) { .ctl_name = 0, .procname = NULL, .mode = 0555, .child = CHILD }
237#define PARPORT_PARPORT_DIR(child) { DEV_PARPORT, "parport", \ 237#define PARPORT_PARPORT_DIR(CHILD) { .ctl_name = DEV_PARPORT, .procname = "parport", \
238 NULL, 0, 0555, child } 238 .mode = 0555, .child = CHILD }
239#define PARPORT_DEV_DIR(child) { CTL_DEV, "dev", NULL, 0, 0555, child } 239#define PARPORT_DEV_DIR(CHILD) { .ctl_name = CTL_DEV, .procname = "dev", .mode = 0555, .child = CHILD }
240#define PARPORT_DEVICES_ROOT_DIR { DEV_PARPORT_DEVICES, "devices", \ 240#define PARPORT_DEVICES_ROOT_DIR { .ctl_name = DEV_PARPORT_DEVICES, .procname = "devices", \
241 NULL, 0, 0555, NULL } 241 .mode = 0555, .child = NULL }
242 242
243static const unsigned long parport_min_timeslice_value = 243static const unsigned long parport_min_timeslice_value =
244PARPORT_MIN_TIMESLICE_VALUE; 244PARPORT_MIN_TIMESLICE_VALUE;
@@ -263,50 +263,118 @@ struct parport_sysctl_table {
263}; 263};
264 264
265static const struct parport_sysctl_table parport_sysctl_template = { 265static const struct parport_sysctl_table parport_sysctl_template = {
266 NULL, 266 .sysctl_header = NULL,
267 { 267 {
268 { DEV_PARPORT_SPINTIME, "spintime", 268 {
269 NULL, sizeof(int), 0644, NULL, 269 .ctl_name = DEV_PARPORT_SPINTIME,
270 &proc_dointvec_minmax, NULL, NULL, 270 .procname = "spintime",
271 (void*) &parport_min_spintime_value, 271 .data = NULL,
272 (void*) &parport_max_spintime_value }, 272 .maxlen = sizeof(int),
273 { DEV_PARPORT_BASE_ADDR, "base-addr", 273 .mode = 0644,
274 NULL, 0, 0444, NULL, 274 .proc_handler = &proc_dointvec_minmax,
275 &do_hardware_base_addr }, 275 .extra1 = (void*) &parport_min_spintime_value,
276 { DEV_PARPORT_IRQ, "irq", 276 .extra2 = (void*) &parport_max_spintime_value
277 NULL, 0, 0444, NULL, 277 },
278 &do_hardware_irq }, 278 {
279 { DEV_PARPORT_DMA, "dma", 279 .ctl_name = DEV_PARPORT_BASE_ADDR,
280 NULL, 0, 0444, NULL, 280 .procname = "base-addr",
281 &do_hardware_dma }, 281 .data = NULL,
282 { DEV_PARPORT_MODES, "modes", 282 .maxlen = 0,
283 NULL, 0, 0444, NULL, 283 .mode = 0444,
284 &do_hardware_modes }, 284 .proc_handler = &do_hardware_base_addr
285 },
286 {
287 .ctl_name = DEV_PARPORT_IRQ,
288 .procname = "irq",
289 .data = NULL,
290 .maxlen = 0,
291 .mode = 0444,
292 .proc_handler = &do_hardware_irq
293 },
294 {
295 .ctl_name = DEV_PARPORT_DMA,
296 .procname = "dma",
297 .data = NULL,
298 .maxlen = 0,
299 .mode = 0444,
300 .proc_handler = &do_hardware_dma
301 },
302 {
303 .ctl_name = DEV_PARPORT_MODES,
304 .procname = "modes",
305 .data = NULL,
306 .maxlen = 0,
307 .mode = 0444,
308 .proc_handler = &do_hardware_modes
309 },
285 PARPORT_DEVICES_ROOT_DIR, 310 PARPORT_DEVICES_ROOT_DIR,
286#ifdef CONFIG_PARPORT_1284 311#ifdef CONFIG_PARPORT_1284
287 { DEV_PARPORT_AUTOPROBE, "autoprobe", 312 {
288 NULL, 0, 0444, NULL, 313 .ctl_name = DEV_PARPORT_AUTOPROBE,
289 &do_autoprobe }, 314 .procname = "autoprobe",
290 { DEV_PARPORT_AUTOPROBE + 1, "autoprobe0", 315 .data = NULL,
291 NULL, 0, 0444, NULL, 316 .maxlen = 0,
292 &do_autoprobe }, 317 .mode = 0444,
293 { DEV_PARPORT_AUTOPROBE + 2, "autoprobe1", 318 .proc_handler = &do_autoprobe
294 NULL, 0, 0444, NULL, 319 },
295 &do_autoprobe }, 320 {
296 { DEV_PARPORT_AUTOPROBE + 3, "autoprobe2", 321 .ctl_name = DEV_PARPORT_AUTOPROBE + 1,
297 NULL, 0, 0444, NULL, 322 .procname = "autoprobe0",
298 &do_autoprobe }, 323 .data = NULL,
299 { DEV_PARPORT_AUTOPROBE + 4, "autoprobe3", 324 .maxlen = 0,
300 NULL, 0, 0444, NULL, 325 .mode = 0444,
301 &do_autoprobe }, 326 .proc_handler = &do_autoprobe
327 },
328 {
329 .ctl_name = DEV_PARPORT_AUTOPROBE + 2,
330 .procname = "autoprobe1",
331 .data = NULL,
332 .maxlen = 0,
333 .mode = 0444,
334 .proc_handler = &do_autoprobe
335 },
336 {
337 .ctl_name = DEV_PARPORT_AUTOPROBE + 3,
338 .procname = "autoprobe2",
339 .data = NULL,
340 .maxlen = 0,
341 .mode = 0444,
342 .proc_handler = &do_autoprobe
343 },
344 {
345 .ctl_name = DEV_PARPORT_AUTOPROBE + 4,
346 .procname = "autoprobe3",
347 .data = NULL,
348 .maxlen = 0,
349 .mode = 0444,
350 .proc_handler = &do_autoprobe
351 },
302#endif /* IEEE 1284 support */ 352#endif /* IEEE 1284 support */
303 {0} 353 {}
304 }, 354 },
305 { {DEV_PARPORT_DEVICES_ACTIVE, "active", NULL, 0, 0444, NULL, 355 {
306 &do_active_device }, {0}}, 356 {
307 { PARPORT_PORT_DIR(NULL), {0}}, 357 .ctl_name = DEV_PARPORT_DEVICES_ACTIVE,
308 { PARPORT_PARPORT_DIR(NULL), {0}}, 358 .procname = "active",
309 { PARPORT_DEV_DIR(NULL), {0}} 359 .data = NULL,
360 .maxlen = 0,
361 .mode = 0444,
362 .proc_handler = &do_active_device
363 },
364 {}
365 },
366 {
367 PARPORT_PORT_DIR(NULL),
368 {}
369 },
370 {
371 PARPORT_PARPORT_DIR(NULL),
372 {}
373 },
374 {
375 PARPORT_DEV_DIR(NULL),
376 {}
377 }
310}; 378};
311 379
312struct parport_device_sysctl_table 380struct parport_device_sysctl_table
@@ -322,19 +390,46 @@ struct parport_device_sysctl_table
322 390
323static const struct parport_device_sysctl_table 391static const struct parport_device_sysctl_table
324parport_device_sysctl_template = { 392parport_device_sysctl_template = {
325 NULL, 393 .sysctl_header = NULL,
394 {
395 {
396 .ctl_name = DEV_PARPORT_DEVICE_TIMESLICE,
397 .procname = "timeslice",
398 .data = NULL,
399 .maxlen = sizeof(int),
400 .mode = 0644,
401 .proc_handler = &proc_doulongvec_ms_jiffies_minmax,
402 .extra1 = (void*) &parport_min_timeslice_value,
403 .extra2 = (void*) &parport_max_timeslice_value
404 },
405 },
406 {
407 {
408 .ctl_name = 0,
409 .procname = NULL,
410 .data = NULL,
411 .maxlen = 0,
412 .mode = 0555,
413 .child = NULL
414 },
415 {}
416 },
326 { 417 {
327 { DEV_PARPORT_DEVICE_TIMESLICE, "timeslice", 418 PARPORT_DEVICES_ROOT_DIR,
328 NULL, sizeof(int), 0644, NULL, 419 {}
329 &proc_doulongvec_ms_jiffies_minmax, NULL, NULL, 420 },
330 (void*) &parport_min_timeslice_value, 421 {
331 (void*) &parport_max_timeslice_value }, 422 PARPORT_PORT_DIR(NULL),
423 {}
332 }, 424 },
333 { {0, NULL, NULL, 0, 0555, NULL}, {0}}, 425 {
334 { PARPORT_DEVICES_ROOT_DIR, {0}}, 426 PARPORT_PARPORT_DIR(NULL),
335 { PARPORT_PORT_DIR(NULL), {0}}, 427 {}
336 { PARPORT_PARPORT_DIR(NULL), {0}}, 428 },
337 { PARPORT_DEV_DIR(NULL), {0}} 429 {
430 PARPORT_DEV_DIR(NULL),
431 {}
432 }
338}; 433};
339 434
340struct parport_default_sysctl_table 435struct parport_default_sysctl_table
@@ -351,28 +446,47 @@ extern int parport_default_spintime;
351 446
352static struct parport_default_sysctl_table 447static struct parport_default_sysctl_table
353parport_default_sysctl_table = { 448parport_default_sysctl_table = {
354 NULL, 449 .sysctl_header = NULL,
450 {
451 {
452 .ctl_name = DEV_PARPORT_DEFAULT_TIMESLICE,
453 .procname = "timeslice",
454 .data = &parport_default_timeslice,
455 .maxlen = sizeof(parport_default_timeslice),
456 .mode = 0644,
457 .proc_handler = &proc_doulongvec_ms_jiffies_minmax,
458 .extra1 = (void*) &parport_min_timeslice_value,
459 .extra2 = (void*) &parport_max_timeslice_value
460 },
461 {
462 .ctl_name = DEV_PARPORT_DEFAULT_SPINTIME,
463 .procname = "spintime",
464 .data = &parport_default_spintime,
465 .maxlen = sizeof(parport_default_spintime),
466 .mode = 0644,
467 .proc_handler = &proc_dointvec_minmax,
468 .extra1 = (void*) &parport_min_spintime_value,
469 .extra2 = (void*) &parport_max_spintime_value
470 },
471 {}
472 },
355 { 473 {
356 { DEV_PARPORT_DEFAULT_TIMESLICE, "timeslice", 474 {
357 &parport_default_timeslice, 475 .ctl_name = DEV_PARPORT_DEFAULT,
358 sizeof(parport_default_timeslice), 0644, NULL, 476 .procname = "default",
359 &proc_doulongvec_ms_jiffies_minmax, NULL, NULL, 477 .mode = 0555,
360 (void*) &parport_min_timeslice_value, 478 .child = parport_default_sysctl_table.vars
361 (void*) &parport_max_timeslice_value }, 479 },
362 { DEV_PARPORT_DEFAULT_SPINTIME, "spintime", 480 {}
363 &parport_default_spintime,
364 sizeof(parport_default_spintime), 0644, NULL,
365 &proc_dointvec_minmax, NULL, NULL,
366 (void*) &parport_min_spintime_value,
367 (void*) &parport_max_spintime_value },
368 {0}
369 }, 481 },
370 { { DEV_PARPORT_DEFAULT, "default", NULL, 0, 0555,
371 parport_default_sysctl_table.vars },{0}},
372 { 482 {
373 PARPORT_PARPORT_DIR(parport_default_sysctl_table.default_dir), 483 PARPORT_PARPORT_DIR(parport_default_sysctl_table.default_dir),
374 {0}}, 484 {}
375 { PARPORT_DEV_DIR(parport_default_sysctl_table.parport_dir), {0}} 485 },
486 {
487 PARPORT_DEV_DIR(parport_default_sysctl_table.parport_dir),
488 {}
489 }
376}; 490};
377 491
378 492
@@ -404,7 +518,7 @@ int parport_proc_register(struct parport *port)
404 t->parport_dir[0].child = t->port_dir; 518 t->parport_dir[0].child = t->port_dir;
405 t->dev_dir[0].child = t->parport_dir; 519 t->dev_dir[0].child = t->parport_dir;
406 520
407 t->sysctl_header = register_sysctl_table(t->dev_dir, 0); 521 t->sysctl_header = register_sysctl_table(t->dev_dir);
408 if (t->sysctl_header == NULL) { 522 if (t->sysctl_header == NULL) {
409 kfree(t); 523 kfree(t);
410 t = NULL; 524 t = NULL;
@@ -460,7 +574,7 @@ int parport_device_proc_register(struct pardevice *device)
460 t->device_dir[0].child = t->vars; 574 t->device_dir[0].child = t->vars;
461 t->vars[0].data = &device->timeslice; 575 t->vars[0].data = &device->timeslice;
462 576
463 t->sysctl_header = register_sysctl_table(t->dev_dir, 0); 577 t->sysctl_header = register_sysctl_table(t->dev_dir);
464 if (t->sysctl_header == NULL) { 578 if (t->sysctl_header == NULL) {
465 kfree(t); 579 kfree(t);
466 t = NULL; 580 t = NULL;
@@ -483,7 +597,7 @@ int parport_device_proc_unregister(struct pardevice *device)
483static int __init parport_default_proc_register(void) 597static int __init parport_default_proc_register(void)
484{ 598{
485 parport_default_sysctl_table.sysctl_header = 599 parport_default_sysctl_table.sysctl_header =
486 register_sysctl_table(parport_default_sysctl_table.dev_dir, 0); 600 register_sysctl_table(parport_default_sysctl_table.dev_dir);
487 return 0; 601 return 0;
488} 602}
489 603
diff --git a/drivers/pci/hotplug/ibmphp_ebda.c b/drivers/pci/hotplug/ibmphp_ebda.c
index 05e4f5a1927a..600ed7b67ae7 100644
--- a/drivers/pci/hotplug/ibmphp_ebda.c
+++ b/drivers/pci/hotplug/ibmphp_ebda.c
@@ -28,7 +28,6 @@
28 */ 28 */
29 29
30#include <linux/module.h> 30#include <linux/module.h>
31#include <linux/sched.h>
32#include <linux/errno.h> 31#include <linux/errno.h>
33#include <linux/mm.h> 32#include <linux/mm.h>
34#include <linux/slab.h> 33#include <linux/slab.h>
diff --git a/drivers/pci/pcie/aer/aerdrv.c b/drivers/pci/pcie/aer/aerdrv.c
index 6f5fabbd14e5..b164de050d4f 100644
--- a/drivers/pci/pcie/aer/aerdrv.c
+++ b/drivers/pci/pcie/aer/aerdrv.c
@@ -220,7 +220,7 @@ static int __devinit aer_probe (struct pcie_device *dev,
220 } 220 }
221 221
222 /* Request IRQ ISR */ 222 /* Request IRQ ISR */
223 if ((status = request_irq(dev->irq, aer_irq, SA_SHIRQ, "aerdrv", 223 if ((status = request_irq(dev->irq, aer_irq, IRQF_SHARED, "aerdrv",
224 dev))) { 224 dev))) {
225 printk(KERN_DEBUG "%s: Request ISR fails on PCIE device[%s]\n", 225 printk(KERN_DEBUG "%s: Request ISR fails on PCIE device[%s]\n",
226 __FUNCTION__, device->bus_id); 226 __FUNCTION__, device->bus_id);
diff --git a/drivers/pci/syscall.c b/drivers/pci/syscall.c
index 87fafc08cb9d..9d37fec27f24 100644
--- a/drivers/pci/syscall.c
+++ b/drivers/pci/syscall.c
@@ -7,7 +7,6 @@
7 * magic northbridge registers.. 7 * magic northbridge registers..
8 */ 8 */
9 9
10#include <linux/sched.h>
11#include <linux/errno.h> 10#include <linux/errno.h>
12#include <linux/pci.h> 11#include <linux/pci.h>
13#include <linux/smp_lock.h> 12#include <linux/smp_lock.h>
diff --git a/drivers/pcmcia/at91_cf.c b/drivers/pcmcia/at91_cf.c
index 3334f22a86c0..b31862837534 100644
--- a/drivers/pcmcia/at91_cf.c
+++ b/drivers/pcmcia/at91_cf.c
@@ -11,7 +11,6 @@
11 11
12#include <linux/module.h> 12#include <linux/module.h>
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/sched.h>
15#include <linux/platform_device.h> 14#include <linux/platform_device.h>
16#include <linux/errno.h> 15#include <linux/errno.h>
17#include <linux/init.h> 16#include <linux/init.h>
diff --git a/drivers/pcmcia/cistpl.c b/drivers/pcmcia/cistpl.c
index 912c03e5eb0a..d154dee76e7f 100644
--- a/drivers/pcmcia/cistpl.c
+++ b/drivers/pcmcia/cistpl.c
@@ -21,7 +21,6 @@
21#include <linux/timer.h> 21#include <linux/timer.h>
22#include <linux/slab.h> 22#include <linux/slab.h>
23#include <linux/mm.h> 23#include <linux/mm.h>
24#include <linux/sched.h>
25#include <linux/pci.h> 24#include <linux/pci.h>
26#include <linux/ioport.h> 25#include <linux/ioport.h>
27#include <asm/io.h> 26#include <asm/io.h>
diff --git a/drivers/pcmcia/i82365.c b/drivers/pcmcia/i82365.c
index 72ff2f615b33..71b33707117f 100644
--- a/drivers/pcmcia/i82365.c
+++ b/drivers/pcmcia/i82365.c
@@ -40,7 +40,6 @@
40#include <linux/kernel.h> 40#include <linux/kernel.h>
41#include <linux/errno.h> 41#include <linux/errno.h>
42#include <linux/timer.h> 42#include <linux/timer.h>
43#include <linux/sched.h>
44#include <linux/slab.h> 43#include <linux/slab.h>
45#include <linux/ioport.h> 44#include <linux/ioport.h>
46#include <linux/delay.h> 45#include <linux/delay.h>
diff --git a/drivers/pcmcia/m32r_cfc.c b/drivers/pcmcia/m32r_cfc.c
index 3c22ac4625c2..e4a94108aab9 100644
--- a/drivers/pcmcia/m32r_cfc.c
+++ b/drivers/pcmcia/m32r_cfc.c
@@ -16,7 +16,6 @@
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <linux/errno.h> 17#include <linux/errno.h>
18#include <linux/timer.h> 18#include <linux/timer.h>
19#include <linux/sched.h>
20#include <linux/slab.h> 19#include <linux/slab.h>
21#include <linux/ioport.h> 20#include <linux/ioport.h>
22#include <linux/delay.h> 21#include <linux/delay.h>
diff --git a/drivers/pcmcia/m32r_pcc.c b/drivers/pcmcia/m32r_pcc.c
index 4dbef0762376..67d28ee80f22 100644
--- a/drivers/pcmcia/m32r_pcc.c
+++ b/drivers/pcmcia/m32r_pcc.c
@@ -16,7 +16,6 @@
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <linux/errno.h> 17#include <linux/errno.h>
18#include <linux/timer.h> 18#include <linux/timer.h>
19#include <linux/sched.h>
20#include <linux/slab.h> 19#include <linux/slab.h>
21#include <linux/ioport.h> 20#include <linux/ioport.h>
22#include <linux/delay.h> 21#include <linux/delay.h>
diff --git a/drivers/pcmcia/m8xx_pcmcia.c b/drivers/pcmcia/m8xx_pcmcia.c
index 3b72be880401..d059c9196172 100644
--- a/drivers/pcmcia/m8xx_pcmcia.c
+++ b/drivers/pcmcia/m8xx_pcmcia.c
@@ -46,7 +46,6 @@
46 46
47#include <linux/kernel.h> 47#include <linux/kernel.h>
48#include <linux/errno.h> 48#include <linux/errno.h>
49#include <linux/sched.h>
50#include <linux/slab.h> 49#include <linux/slab.h>
51#include <linux/timer.h> 50#include <linux/timer.h>
52#include <linux/ioport.h> 51#include <linux/ioport.h>
diff --git a/drivers/pcmcia/omap_cf.c b/drivers/pcmcia/omap_cf.c
index e65a6b8188f6..76f7cbc62a8b 100644
--- a/drivers/pcmcia/omap_cf.c
+++ b/drivers/pcmcia/omap_cf.c
@@ -11,7 +11,6 @@
11 11
12#include <linux/module.h> 12#include <linux/module.h>
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/sched.h>
15#include <linux/platform_device.h> 14#include <linux/platform_device.h>
16#include <linux/errno.h> 15#include <linux/errno.h>
17#include <linux/init.h> 16#include <linux/init.h>
diff --git a/drivers/pcmcia/pxa2xx_lubbock.c b/drivers/pcmcia/pxa2xx_lubbock.c
index a92f11143c43..5e9b9a3fd027 100644
--- a/drivers/pcmcia/pxa2xx_lubbock.c
+++ b/drivers/pcmcia/pxa2xx_lubbock.c
@@ -16,7 +16,6 @@
16 */ 16 */
17#include <linux/module.h> 17#include <linux/module.h>
18#include <linux/kernel.h> 18#include <linux/kernel.h>
19#include <linux/sched.h>
20#include <linux/device.h> 19#include <linux/device.h>
21#include <linux/errno.h> 20#include <linux/errno.h>
22#include <linux/init.h> 21#include <linux/init.h>
diff --git a/drivers/pcmcia/sa1100_badge4.c b/drivers/pcmcia/sa1100_badge4.c
index 19b1e1276220..62bfc7566ec2 100644
--- a/drivers/pcmcia/sa1100_badge4.c
+++ b/drivers/pcmcia/sa1100_badge4.c
@@ -14,7 +14,6 @@
14 */ 14 */
15#include <linux/module.h> 15#include <linux/module.h>
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <linux/sched.h>
18#include <linux/device.h> 17#include <linux/device.h>
19#include <linux/errno.h> 18#include <linux/errno.h>
20#include <linux/init.h> 19#include <linux/init.h>
diff --git a/drivers/pcmcia/sa1100_cerf.c b/drivers/pcmcia/sa1100_cerf.c
index eb89928f2338..549a1529fe35 100644
--- a/drivers/pcmcia/sa1100_cerf.c
+++ b/drivers/pcmcia/sa1100_cerf.c
@@ -7,7 +7,6 @@
7 */ 7 */
8#include <linux/module.h> 8#include <linux/module.h>
9#include <linux/kernel.h> 9#include <linux/kernel.h>
10#include <linux/sched.h>
11#include <linux/device.h> 10#include <linux/device.h>
12#include <linux/init.h> 11#include <linux/init.h>
13#include <linux/delay.h> 12#include <linux/delay.h>
diff --git a/drivers/pcmcia/sa1100_h3600.c b/drivers/pcmcia/sa1100_h3600.c
index 64fd5e37f2d2..e5491879acd9 100644
--- a/drivers/pcmcia/sa1100_h3600.c
+++ b/drivers/pcmcia/sa1100_h3600.c
@@ -6,7 +6,6 @@
6 */ 6 */
7#include <linux/module.h> 7#include <linux/module.h>
8#include <linux/kernel.h> 8#include <linux/kernel.h>
9#include <linux/sched.h>
10#include <linux/device.h> 9#include <linux/device.h>
11#include <linux/interrupt.h> 10#include <linux/interrupt.h>
12#include <linux/init.h> 11#include <linux/init.h>
diff --git a/drivers/pcmcia/sa1100_jornada720.c b/drivers/pcmcia/sa1100_jornada720.c
index 7a87298bae99..af485ae38602 100644
--- a/drivers/pcmcia/sa1100_jornada720.c
+++ b/drivers/pcmcia/sa1100_jornada720.c
@@ -6,7 +6,6 @@
6 */ 6 */
7#include <linux/module.h> 7#include <linux/module.h>
8#include <linux/kernel.h> 8#include <linux/kernel.h>
9#include <linux/sched.h>
10#include <linux/device.h> 9#include <linux/device.h>
11#include <linux/errno.h> 10#include <linux/errno.h>
12#include <linux/init.h> 11#include <linux/init.h>
diff --git a/drivers/pcmcia/sa1100_neponset.c b/drivers/pcmcia/sa1100_neponset.c
index 5e34b3e8e5db..5bc9e9532b9d 100644
--- a/drivers/pcmcia/sa1100_neponset.c
+++ b/drivers/pcmcia/sa1100_neponset.c
@@ -5,7 +5,6 @@
5 */ 5 */
6#include <linux/module.h> 6#include <linux/module.h>
7#include <linux/kernel.h> 7#include <linux/kernel.h>
8#include <linux/sched.h>
9#include <linux/device.h> 8#include <linux/device.h>
10#include <linux/errno.h> 9#include <linux/errno.h>
11#include <linux/init.h> 10#include <linux/init.h>
diff --git a/drivers/pcmcia/sa1100_shannon.c b/drivers/pcmcia/sa1100_shannon.c
index 7bc9e59c761f..9456f5478d09 100644
--- a/drivers/pcmcia/sa1100_shannon.c
+++ b/drivers/pcmcia/sa1100_shannon.c
@@ -6,7 +6,6 @@
6 */ 6 */
7#include <linux/module.h> 7#include <linux/module.h>
8#include <linux/kernel.h> 8#include <linux/kernel.h>
9#include <linux/sched.h>
10#include <linux/device.h> 9#include <linux/device.h>
11#include <linux/init.h> 10#include <linux/init.h>
12 11
diff --git a/drivers/pcmcia/sa1100_simpad.c b/drivers/pcmcia/sa1100_simpad.c
index c2ecf1185e9e..04d6f7f75f78 100644
--- a/drivers/pcmcia/sa1100_simpad.c
+++ b/drivers/pcmcia/sa1100_simpad.c
@@ -6,7 +6,6 @@
6 */ 6 */
7#include <linux/module.h> 7#include <linux/module.h>
8#include <linux/kernel.h> 8#include <linux/kernel.h>
9#include <linux/sched.h>
10#include <linux/device.h> 9#include <linux/device.h>
11#include <linux/init.h> 10#include <linux/init.h>
12 11
diff --git a/drivers/pcmcia/vrc4171_card.c b/drivers/pcmcia/vrc4171_card.c
index e90d8e8c5fd6..206e26c91807 100644
--- a/drivers/pcmcia/vrc4171_card.c
+++ b/drivers/pcmcia/vrc4171_card.c
@@ -22,7 +22,6 @@
22#include <linux/interrupt.h> 22#include <linux/interrupt.h>
23#include <linux/module.h> 23#include <linux/module.h>
24#include <linux/spinlock.h> 24#include <linux/spinlock.h>
25#include <linux/sched.h>
26#include <linux/types.h> 25#include <linux/types.h>
27#include <linux/platform_device.h> 26#include <linux/platform_device.h>
28 27
diff --git a/drivers/pcmcia/yenta_socket.c b/drivers/pcmcia/yenta_socket.c
index a61d768f6e0e..20853a03202d 100644
--- a/drivers/pcmcia/yenta_socket.c
+++ b/drivers/pcmcia/yenta_socket.c
@@ -12,7 +12,6 @@
12 */ 12 */
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/pci.h> 14#include <linux/pci.h>
15#include <linux/sched.h>
16#include <linux/workqueue.h> 15#include <linux/workqueue.h>
17#include <linux/interrupt.h> 16#include <linux/interrupt.h>
18#include <linux/delay.h> 17#include <linux/delay.h>
diff --git a/drivers/rapidio/rio-sysfs.c b/drivers/rapidio/rio-sysfs.c
index 5687b8fcbf93..eed91434417d 100644
--- a/drivers/rapidio/rio-sysfs.c
+++ b/drivers/rapidio/rio-sysfs.c
@@ -14,7 +14,6 @@
14#include <linux/rio.h> 14#include <linux/rio.h>
15#include <linux/rio_drv.h> 15#include <linux/rio_drv.h>
16#include <linux/stat.h> 16#include <linux/stat.h>
17#include <linux/sched.h> /* for capable() */
18 17
19#include "rio.h" 18#include "rio.h"
20 19
diff --git a/drivers/rtc/rtc-omap.c b/drivers/rtc/rtc-omap.c
index d59880d44fba..9de8d67f4f8d 100644
--- a/drivers/rtc/rtc-omap.c
+++ b/drivers/rtc/rtc-omap.c
@@ -417,13 +417,13 @@ static int __devinit omap_rtc_probe(struct platform_device *pdev)
417 rtc_write(OMAP_RTC_STATUS_ALARM, OMAP_RTC_STATUS_REG); 417 rtc_write(OMAP_RTC_STATUS_ALARM, OMAP_RTC_STATUS_REG);
418 418
419 /* handle periodic and alarm irqs */ 419 /* handle periodic and alarm irqs */
420 if (request_irq(omap_rtc_timer, rtc_irq, SA_INTERRUPT, 420 if (request_irq(omap_rtc_timer, rtc_irq, IRQF_DISABLED,
421 rtc->class_dev.class_id, &rtc->class_dev)) { 421 rtc->class_dev.class_id, &rtc->class_dev)) {
422 pr_debug("%s: RTC timer interrupt IRQ%d already claimed\n", 422 pr_debug("%s: RTC timer interrupt IRQ%d already claimed\n",
423 pdev->name, omap_rtc_timer); 423 pdev->name, omap_rtc_timer);
424 goto fail0; 424 goto fail0;
425 } 425 }
426 if (request_irq(omap_rtc_alarm, rtc_irq, SA_INTERRUPT, 426 if (request_irq(omap_rtc_alarm, rtc_irq, IRQF_DISABLED,
427 rtc->class_dev.class_id, &rtc->class_dev)) { 427 rtc->class_dev.class_id, &rtc->class_dev)) {
428 pr_debug("%s: RTC alarm interrupt IRQ%d already claimed\n", 428 pr_debug("%s: RTC alarm interrupt IRQ%d already claimed\n",
429 pdev->name, omap_rtc_alarm); 429 pdev->name, omap_rtc_alarm);
diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
index f406a2b55aea..9a79a24a7487 100644
--- a/drivers/rtc/rtc-s3c.c
+++ b/drivers/rtc/rtc-s3c.c
@@ -350,7 +350,7 @@ static int s3c_rtc_open(struct device *dev)
350 int ret; 350 int ret;
351 351
352 ret = request_irq(s3c_rtc_alarmno, s3c_rtc_alarmirq, 352 ret = request_irq(s3c_rtc_alarmno, s3c_rtc_alarmirq,
353 SA_INTERRUPT, "s3c2410-rtc alarm", rtc_dev); 353 IRQF_DISABLED, "s3c2410-rtc alarm", rtc_dev);
354 354
355 if (ret) { 355 if (ret) {
356 dev_err(dev, "IRQ%d error %d\n", s3c_rtc_alarmno, ret); 356 dev_err(dev, "IRQ%d error %d\n", s3c_rtc_alarmno, ret);
@@ -358,7 +358,7 @@ static int s3c_rtc_open(struct device *dev)
358 } 358 }
359 359
360 ret = request_irq(s3c_rtc_tickno, s3c_rtc_tickirq, 360 ret = request_irq(s3c_rtc_tickno, s3c_rtc_tickirq,
361 SA_INTERRUPT, "s3c2410-rtc tick", rtc_dev); 361 IRQF_DISABLED, "s3c2410-rtc tick", rtc_dev);
362 362
363 if (ret) { 363 if (ret) {
364 dev_err(dev, "IRQ%d error %d\n", s3c_rtc_tickno, ret); 364 dev_err(dev, "IRQ%d error %d\n", s3c_rtc_tickno, ret);
diff --git a/drivers/s390/char/sclp_tty.c b/drivers/s390/char/sclp_tty.c
index 90536f60bf50..076816b9d528 100644
--- a/drivers/s390/char/sclp_tty.c
+++ b/drivers/s390/char/sclp_tty.c
@@ -13,7 +13,6 @@
13#include <linux/tty.h> 13#include <linux/tty.h>
14#include <linux/tty_driver.h> 14#include <linux/tty_driver.h>
15#include <linux/tty_flip.h> 15#include <linux/tty_flip.h>
16#include <linux/sched.h>
17#include <linux/wait.h> 16#include <linux/wait.h>
18#include <linux/slab.h> 17#include <linux/slab.h>
19#include <linux/err.h> 18#include <linux/err.h>
diff --git a/drivers/s390/char/sclp_vt220.c b/drivers/s390/char/sclp_vt220.c
index 544f137d70d7..f77dc33b5f8d 100644
--- a/drivers/s390/char/sclp_vt220.c
+++ b/drivers/s390/char/sclp_vt220.c
@@ -16,7 +16,6 @@
16#include <linux/tty.h> 16#include <linux/tty.h>
17#include <linux/tty_driver.h> 17#include <linux/tty_driver.h>
18#include <linux/tty_flip.h> 18#include <linux/tty_flip.h>
19#include <linux/sched.h>
20#include <linux/errno.h> 19#include <linux/errno.h>
21#include <linux/mm.h> 20#include <linux/mm.h>
22#include <linux/major.h> 21#include <linux/major.h>
diff --git a/drivers/s390/net/ctcmain.c b/drivers/s390/net/ctcmain.c
index 5a84fbbc6611..0d6d5fcc128b 100644
--- a/drivers/s390/net/ctcmain.c
+++ b/drivers/s390/net/ctcmain.c
@@ -45,7 +45,6 @@
45#include <linux/types.h> 45#include <linux/types.h>
46#include <linux/interrupt.h> 46#include <linux/interrupt.h>
47#include <linux/timer.h> 47#include <linux/timer.h>
48#include <linux/sched.h>
49#include <linux/bitops.h> 48#include <linux/bitops.h>
50 49
51#include <linux/signal.h> 50#include <linux/signal.h>
diff --git a/drivers/s390/net/netiucv.c b/drivers/s390/net/netiucv.c
index 6387b483f2bf..594320ca1b7c 100644
--- a/drivers/s390/net/netiucv.c
+++ b/drivers/s390/net/netiucv.c
@@ -41,7 +41,6 @@
41#include <linux/types.h> 41#include <linux/types.h>
42#include <linux/interrupt.h> 42#include <linux/interrupt.h>
43#include <linux/timer.h> 43#include <linux/timer.h>
44#include <linux/sched.h>
45#include <linux/bitops.h> 44#include <linux/bitops.h>
46 45
47#include <linux/signal.h> 46#include <linux/signal.h>
diff --git a/drivers/sbus/char/cpwatchdog.c b/drivers/sbus/char/cpwatchdog.c
index 0cfd1e4c032c..022e869c44dd 100644
--- a/drivers/sbus/char/cpwatchdog.c
+++ b/drivers/sbus/char/cpwatchdog.c
@@ -20,7 +20,6 @@
20#include <linux/major.h> 20#include <linux/major.h>
21#include <linux/init.h> 21#include <linux/init.h>
22#include <linux/miscdevice.h> 22#include <linux/miscdevice.h>
23#include <linux/sched.h>
24#include <linux/interrupt.h> 23#include <linux/interrupt.h>
25#include <linux/ioport.h> 24#include <linux/ioport.h>
26#include <linux/timer.h> 25#include <linux/timer.h>
diff --git a/drivers/sbus/char/openprom.c b/drivers/sbus/char/openprom.c
index e8776230782b..eec28c142a59 100644
--- a/drivers/sbus/char/openprom.c
+++ b/drivers/sbus/char/openprom.c
@@ -31,7 +31,6 @@
31 31
32#include <linux/module.h> 32#include <linux/module.h>
33#include <linux/kernel.h> 33#include <linux/kernel.h>
34#include <linux/sched.h>
35#include <linux/errno.h> 34#include <linux/errno.h>
36#include <linux/slab.h> 35#include <linux/slab.h>
37#include <linux/string.h> 36#include <linux/string.h>
diff --git a/drivers/sbus/char/uctrl.c b/drivers/sbus/char/uctrl.c
index 4d1a505e9e74..45cf5bc0bbee 100644
--- a/drivers/sbus/char/uctrl.c
+++ b/drivers/sbus/char/uctrl.c
@@ -5,7 +5,6 @@
5 */ 5 */
6 6
7#include <linux/module.h> 7#include <linux/module.h>
8#include <linux/sched.h>
9#include <linux/errno.h> 8#include <linux/errno.h>
10#include <linux/delay.h> 9#include <linux/delay.h>
11#include <linux/interrupt.h> 10#include <linux/interrupt.h>
diff --git a/drivers/sbus/char/vfc_dev.c b/drivers/sbus/char/vfc_dev.c
index 37a04a0cecfa..8bfb67ccdcd4 100644
--- a/drivers/sbus/char/vfc_dev.c
+++ b/drivers/sbus/char/vfc_dev.c
@@ -19,7 +19,6 @@
19#include <linux/string.h> 19#include <linux/string.h>
20#include <linux/slab.h> 20#include <linux/slab.h>
21#include <linux/errno.h> 21#include <linux/errno.h>
22#include <linux/sched.h>
23#include <linux/fs.h> 22#include <linux/fs.h>
24#include <linux/smp_lock.h> 23#include <linux/smp_lock.h>
25#include <linux/delay.h> 24#include <linux/delay.h>
diff --git a/drivers/scsi/53c700.c b/drivers/scsi/53c700.c
index 88e061d13d0b..cb02656eb54c 100644
--- a/drivers/scsi/53c700.c
+++ b/drivers/scsi/53c700.c
@@ -121,7 +121,6 @@
121#include <linux/delay.h> 121#include <linux/delay.h>
122#include <linux/spinlock.h> 122#include <linux/spinlock.h>
123#include <linux/completion.h> 123#include <linux/completion.h>
124#include <linux/sched.h>
125#include <linux/init.h> 124#include <linux/init.h>
126#include <linux/proc_fs.h> 125#include <linux/proc_fs.h>
127#include <linux/blkdev.h> 126#include <linux/blkdev.h>
diff --git a/drivers/scsi/NCR53c406a.c b/drivers/scsi/NCR53c406a.c
index 8578555d58fd..7c0b17f86903 100644
--- a/drivers/scsi/NCR53c406a.c
+++ b/drivers/scsi/NCR53c406a.c
@@ -41,7 +41,6 @@
41 41
42#include <linux/errno.h> 42#include <linux/errno.h>
43#include <linux/ioport.h> 43#include <linux/ioport.h>
44#include <linux/sched.h>
45#include <linux/interrupt.h> 44#include <linux/interrupt.h>
46#include <linux/proc_fs.h> 45#include <linux/proc_fs.h>
47#include <linux/stat.h> 46#include <linux/stat.h>
diff --git a/drivers/scsi/a2091.c b/drivers/scsi/a2091.c
index f77016d31cab..b7c5385e2efe 100644
--- a/drivers/scsi/a2091.c
+++ b/drivers/scsi/a2091.c
@@ -1,7 +1,6 @@
1#include <linux/types.h> 1#include <linux/types.h>
2#include <linux/mm.h> 2#include <linux/mm.h>
3#include <linux/blkdev.h> 3#include <linux/blkdev.h>
4#include <linux/sched.h>
5#include <linux/init.h> 4#include <linux/init.h>
6#include <linux/interrupt.h> 5#include <linux/interrupt.h>
7 6
diff --git a/drivers/scsi/a3000.c b/drivers/scsi/a3000.c
index 1299bc8edef1..796f1c4d772e 100644
--- a/drivers/scsi/a3000.c
+++ b/drivers/scsi/a3000.c
@@ -1,7 +1,6 @@
1#include <linux/types.h> 1#include <linux/types.h>
2#include <linux/mm.h> 2#include <linux/mm.h>
3#include <linux/blkdev.h> 3#include <linux/blkdev.h>
4#include <linux/sched.h>
5#include <linux/ioport.h> 4#include <linux/ioport.h>
6#include <linux/init.h> 5#include <linux/init.h>
7#include <linux/spinlock.h> 6#include <linux/spinlock.h>
diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
index ddb33b06e0ef..d789e61bdc49 100644
--- a/drivers/scsi/aacraid/aachba.c
+++ b/drivers/scsi/aacraid/aachba.c
@@ -26,7 +26,6 @@
26#include <linux/kernel.h> 26#include <linux/kernel.h>
27#include <linux/init.h> 27#include <linux/init.h>
28#include <linux/types.h> 28#include <linux/types.h>
29#include <linux/sched.h>
30#include <linux/pci.h> 29#include <linux/pci.h>
31#include <linux/spinlock.h> 30#include <linux/spinlock.h>
32#include <linux/slab.h> 31#include <linux/slab.h>
diff --git a/drivers/scsi/aacraid/commctrl.c b/drivers/scsi/aacraid/commctrl.c
index da1d3a9212f8..e21070f4eac1 100644
--- a/drivers/scsi/aacraid/commctrl.c
+++ b/drivers/scsi/aacraid/commctrl.c
@@ -31,7 +31,6 @@
31#include <linux/kernel.h> 31#include <linux/kernel.h>
32#include <linux/init.h> 32#include <linux/init.h>
33#include <linux/types.h> 33#include <linux/types.h>
34#include <linux/sched.h>
35#include <linux/pci.h> 34#include <linux/pci.h>
36#include <linux/spinlock.h> 35#include <linux/spinlock.h>
37#include <linux/slab.h> 36#include <linux/slab.h>
diff --git a/drivers/scsi/aacraid/comminit.c b/drivers/scsi/aacraid/comminit.c
index df67ba686023..ae34768987a4 100644
--- a/drivers/scsi/aacraid/comminit.c
+++ b/drivers/scsi/aacraid/comminit.c
@@ -32,7 +32,6 @@
32#include <linux/kernel.h> 32#include <linux/kernel.h>
33#include <linux/init.h> 33#include <linux/init.h>
34#include <linux/types.h> 34#include <linux/types.h>
35#include <linux/sched.h>
36#include <linux/pci.h> 35#include <linux/pci.h>
37#include <linux/spinlock.h> 36#include <linux/spinlock.h>
38#include <linux/slab.h> 37#include <linux/slab.h>
diff --git a/drivers/scsi/aacraid/dpcsup.c b/drivers/scsi/aacraid/dpcsup.c
index 8335f07b7720..d38b628be1ad 100644
--- a/drivers/scsi/aacraid/dpcsup.c
+++ b/drivers/scsi/aacraid/dpcsup.c
@@ -32,7 +32,6 @@
32#include <linux/kernel.h> 32#include <linux/kernel.h>
33#include <linux/init.h> 33#include <linux/init.h>
34#include <linux/types.h> 34#include <linux/types.h>
35#include <linux/sched.h>
36#include <linux/pci.h> 35#include <linux/pci.h>
37#include <linux/spinlock.h> 36#include <linux/spinlock.h>
38#include <linux/slab.h> 37#include <linux/slab.h>
diff --git a/drivers/scsi/aacraid/rx.c b/drivers/scsi/aacraid/rx.c
index c632d9354a26..d242e2611d67 100644
--- a/drivers/scsi/aacraid/rx.c
+++ b/drivers/scsi/aacraid/rx.c
@@ -31,7 +31,6 @@
31#include <linux/kernel.h> 31#include <linux/kernel.h>
32#include <linux/init.h> 32#include <linux/init.h>
33#include <linux/types.h> 33#include <linux/types.h>
34#include <linux/sched.h>
35#include <linux/pci.h> 34#include <linux/pci.h>
36#include <linux/spinlock.h> 35#include <linux/spinlock.h>
37#include <linux/slab.h> 36#include <linux/slab.h>
diff --git a/drivers/scsi/aacraid/sa.c b/drivers/scsi/aacraid/sa.c
index 8535db068c2f..6f1a1780efce 100644
--- a/drivers/scsi/aacraid/sa.c
+++ b/drivers/scsi/aacraid/sa.c
@@ -31,7 +31,6 @@
31#include <linux/kernel.h> 31#include <linux/kernel.h>
32#include <linux/init.h> 32#include <linux/init.h>
33#include <linux/types.h> 33#include <linux/types.h>
34#include <linux/sched.h>
35#include <linux/pci.h> 34#include <linux/pci.h>
36#include <linux/spinlock.h> 35#include <linux/spinlock.h>
37#include <linux/slab.h> 36#include <linux/slab.h>
diff --git a/drivers/scsi/aha152x.c b/drivers/scsi/aha152x.c
index 0cec742d12e9..4b4d1233ce8a 100644
--- a/drivers/scsi/aha152x.c
+++ b/drivers/scsi/aha152x.c
@@ -236,7 +236,6 @@
236 **************************************************************************/ 236 **************************************************************************/
237 237
238#include <linux/module.h> 238#include <linux/module.h>
239#include <linux/sched.h>
240#include <asm/irq.h> 239#include <asm/irq.h>
241#include <linux/io.h> 240#include <linux/io.h>
242#include <linux/blkdev.h> 241#include <linux/blkdev.h>
diff --git a/drivers/scsi/aic7xxx_old.c b/drivers/scsi/aic7xxx_old.c
index 7d1fec620948..a988d5abf702 100644
--- a/drivers/scsi/aic7xxx_old.c
+++ b/drivers/scsi/aic7xxx_old.c
@@ -229,7 +229,6 @@
229#include <linux/kernel.h> 229#include <linux/kernel.h>
230#include <linux/ioport.h> 230#include <linux/ioport.h>
231#include <linux/delay.h> 231#include <linux/delay.h>
232#include <linux/sched.h>
233#include <linux/pci.h> 232#include <linux/pci.h>
234#include <linux/proc_fs.h> 233#include <linux/proc_fs.h>
235#include <linux/blkdev.h> 234#include <linux/blkdev.h>
diff --git a/drivers/scsi/aic94xx/aic94xx_init.c b/drivers/scsi/aic94xx/aic94xx_init.c
index bc7744e35ad0..27852b43b904 100644
--- a/drivers/scsi/aic94xx/aic94xx_init.c
+++ b/drivers/scsi/aic94xx/aic94xx_init.c
@@ -653,7 +653,7 @@ static int __devinit asd_pci_probe(struct pci_dev *dev,
653 if (use_msi) 653 if (use_msi)
654 pci_enable_msi(asd_ha->pcidev); 654 pci_enable_msi(asd_ha->pcidev);
655 655
656 err = request_irq(asd_ha->pcidev->irq, asd_hw_isr, SA_SHIRQ, 656 err = request_irq(asd_ha->pcidev->irq, asd_hw_isr, IRQF_SHARED,
657 ASD_DRIVER_NAME, asd_ha); 657 ASD_DRIVER_NAME, asd_ha);
658 if (err) { 658 if (err) {
659 asd_printk("couldn't get irq %d for %s\n", 659 asd_printk("couldn't get irq %d for %s\n",
diff --git a/drivers/scsi/amiga7xx.c b/drivers/scsi/amiga7xx.c
index 9099d531d5a4..d5d3c4d5a253 100644
--- a/drivers/scsi/amiga7xx.c
+++ b/drivers/scsi/amiga7xx.c
@@ -10,7 +10,6 @@
10#include <linux/types.h> 10#include <linux/types.h>
11#include <linux/mm.h> 11#include <linux/mm.h>
12#include <linux/blkdev.h> 12#include <linux/blkdev.h>
13#include <linux/sched.h>
14#include <linux/zorro.h> 13#include <linux/zorro.h>
15#include <linux/stat.h> 14#include <linux/stat.h>
16 15
diff --git a/drivers/scsi/arcmsr/arcmsr_hba.c b/drivers/scsi/arcmsr/arcmsr_hba.c
index 086cc97eee8c..8b46158cc045 100644
--- a/drivers/scsi/arcmsr/arcmsr_hba.c
+++ b/drivers/scsi/arcmsr/arcmsr_hba.c
@@ -322,7 +322,7 @@ static int arcmsr_probe(struct pci_dev *pdev,
322 goto out_iounmap; 322 goto out_iounmap;
323 323
324 error = request_irq(pdev->irq, arcmsr_do_interrupt, 324 error = request_irq(pdev->irq, arcmsr_do_interrupt,
325 SA_INTERRUPT | SA_SHIRQ, "arcmsr", acb); 325 IRQF_DISABLED | IRQF_SHARED, "arcmsr", acb);
326 if (error) 326 if (error)
327 goto out_free_ccb_pool; 327 goto out_free_ccb_pool;
328 328
diff --git a/drivers/scsi/arm/acornscsi.c b/drivers/scsi/arm/acornscsi.c
index 9cf902b7a126..eceacf6d49ea 100644
--- a/drivers/scsi/arm/acornscsi.c
+++ b/drivers/scsi/arm/acornscsi.c
@@ -131,7 +131,6 @@
131 131
132#include <linux/module.h> 132#include <linux/module.h>
133#include <linux/kernel.h> 133#include <linux/kernel.h>
134#include <linux/sched.h>
135#include <linux/string.h> 134#include <linux/string.h>
136#include <linux/signal.h> 135#include <linux/signal.h>
137#include <linux/errno.h> 136#include <linux/errno.h>
diff --git a/drivers/scsi/arm/arxescsi.c b/drivers/scsi/arm/arxescsi.c
index 4385e9e3ded6..7e132c5bacf8 100644
--- a/drivers/scsi/arm/arxescsi.c
+++ b/drivers/scsi/arm/arxescsi.c
@@ -23,7 +23,6 @@
23#include <linux/kernel.h> 23#include <linux/kernel.h>
24#include <linux/string.h> 24#include <linux/string.h>
25#include <linux/ioport.h> 25#include <linux/ioport.h>
26#include <linux/sched.h>
27#include <linux/proc_fs.h> 26#include <linux/proc_fs.h>
28#include <linux/unistd.h> 27#include <linux/unistd.h>
29#include <linux/stat.h> 28#include <linux/stat.h>
diff --git a/drivers/scsi/arm/cumana_1.c b/drivers/scsi/arm/cumana_1.c
index 3bdfc36481ae..cf9a21cea6d9 100644
--- a/drivers/scsi/arm/cumana_1.c
+++ b/drivers/scsi/arm/cumana_1.c
@@ -5,7 +5,6 @@
5 */ 5 */
6#include <linux/module.h> 6#include <linux/module.h>
7#include <linux/signal.h> 7#include <linux/signal.h>
8#include <linux/sched.h>
9#include <linux/ioport.h> 8#include <linux/ioport.h>
10#include <linux/delay.h> 9#include <linux/delay.h>
11#include <linux/blkdev.h> 10#include <linux/blkdev.h>
diff --git a/drivers/scsi/arm/cumana_2.c b/drivers/scsi/arm/cumana_2.c
index 19edd9c853d9..d2d51dc51ab8 100644
--- a/drivers/scsi/arm/cumana_2.c
+++ b/drivers/scsi/arm/cumana_2.c
@@ -21,7 +21,6 @@
21#include <linux/kernel.h> 21#include <linux/kernel.h>
22#include <linux/string.h> 22#include <linux/string.h>
23#include <linux/ioport.h> 23#include <linux/ioport.h>
24#include <linux/sched.h>
25#include <linux/proc_fs.h> 24#include <linux/proc_fs.h>
26#include <linux/delay.h> 25#include <linux/delay.h>
27#include <linux/interrupt.h> 26#include <linux/interrupt.h>
diff --git a/drivers/scsi/arm/ecoscsi.c b/drivers/scsi/arm/ecoscsi.c
index 6adcccbf444b..378e7af0c5d6 100644
--- a/drivers/scsi/arm/ecoscsi.c
+++ b/drivers/scsi/arm/ecoscsi.c
@@ -23,7 +23,6 @@
23 23
24#include <linux/module.h> 24#include <linux/module.h>
25#include <linux/signal.h> 25#include <linux/signal.h>
26#include <linux/sched.h>
27#include <linux/ioport.h> 26#include <linux/ioport.h>
28#include <linux/delay.h> 27#include <linux/delay.h>
29#include <linux/init.h> 28#include <linux/init.h>
diff --git a/drivers/scsi/arm/eesox.c b/drivers/scsi/arm/eesox.c
index 3f876fb75469..4677152142d9 100644
--- a/drivers/scsi/arm/eesox.c
+++ b/drivers/scsi/arm/eesox.c
@@ -27,7 +27,6 @@
27#include <linux/kernel.h> 27#include <linux/kernel.h>
28#include <linux/string.h> 28#include <linux/string.h>
29#include <linux/ioport.h> 29#include <linux/ioport.h>
30#include <linux/sched.h>
31#include <linux/proc_fs.h> 30#include <linux/proc_fs.h>
32#include <linux/delay.h> 31#include <linux/delay.h>
33#include <linux/interrupt.h> 32#include <linux/interrupt.h>
diff --git a/drivers/scsi/arm/fas216.c b/drivers/scsi/arm/fas216.c
index e05f0c2fc912..2969cc0ff259 100644
--- a/drivers/scsi/arm/fas216.c
+++ b/drivers/scsi/arm/fas216.c
@@ -39,7 +39,6 @@
39#include <linux/kernel.h> 39#include <linux/kernel.h>
40#include <linux/string.h> 40#include <linux/string.h>
41#include <linux/ioport.h> 41#include <linux/ioport.h>
42#include <linux/sched.h>
43#include <linux/proc_fs.h> 42#include <linux/proc_fs.h>
44#include <linux/delay.h> 43#include <linux/delay.h>
45#include <linux/bitops.h> 44#include <linux/bitops.h>
diff --git a/drivers/scsi/arm/oak.c b/drivers/scsi/arm/oak.c
index d806b024c3bd..c21b8392c928 100644
--- a/drivers/scsi/arm/oak.c
+++ b/drivers/scsi/arm/oak.c
@@ -6,7 +6,6 @@
6 6
7#include <linux/module.h> 7#include <linux/module.h>
8#include <linux/signal.h> 8#include <linux/signal.h>
9#include <linux/sched.h>
10#include <linux/ioport.h> 9#include <linux/ioport.h>
11#include <linux/delay.h> 10#include <linux/delay.h>
12#include <linux/blkdev.h> 11#include <linux/blkdev.h>
diff --git a/drivers/scsi/arm/powertec.c b/drivers/scsi/arm/powertec.c
index ce159c15bc86..f9cd20bfb958 100644
--- a/drivers/scsi/arm/powertec.c
+++ b/drivers/scsi/arm/powertec.c
@@ -12,7 +12,6 @@
12#include <linux/kernel.h> 12#include <linux/kernel.h>
13#include <linux/string.h> 13#include <linux/string.h>
14#include <linux/ioport.h> 14#include <linux/ioport.h>
15#include <linux/sched.h>
16#include <linux/proc_fs.h> 15#include <linux/proc_fs.h>
17#include <linux/delay.h> 16#include <linux/delay.h>
18#include <linux/interrupt.h> 17#include <linux/interrupt.h>
diff --git a/drivers/scsi/atari_scsi.c b/drivers/scsi/atari_scsi.c
index dfb1bcfae82e..642de7b2b7a2 100644
--- a/drivers/scsi/atari_scsi.c
+++ b/drivers/scsi/atari_scsi.c
@@ -86,7 +86,6 @@
86#include <linux/delay.h> 86#include <linux/delay.h>
87#include <linux/mm.h> 87#include <linux/mm.h>
88#include <linux/blkdev.h> 88#include <linux/blkdev.h>
89#include <linux/sched.h>
90#include <linux/interrupt.h> 89#include <linux/interrupt.h>
91#include <linux/init.h> 90#include <linux/init.h>
92#include <linux/nvram.h> 91#include <linux/nvram.h>
diff --git a/drivers/scsi/bvme6000.c b/drivers/scsi/bvme6000.c
index 2958b8c2bfb7..599b400a3c43 100644
--- a/drivers/scsi/bvme6000.c
+++ b/drivers/scsi/bvme6000.c
@@ -6,7 +6,6 @@
6#include <linux/types.h> 6#include <linux/types.h>
7#include <linux/mm.h> 7#include <linux/mm.h>
8#include <linux/blkdev.h> 8#include <linux/blkdev.h>
9#include <linux/sched.h>
10#include <linux/zorro.h> 9#include <linux/zorro.h>
11 10
12#include <asm/setup.h> 11#include <asm/setup.h>
diff --git a/drivers/scsi/ch.c b/drivers/scsi/ch.c
index d02759f13469..2a2cc6cf1182 100644
--- a/drivers/scsi/ch.c
+++ b/drivers/scsi/ch.c
@@ -11,7 +11,6 @@
11#include <linux/init.h> 11#include <linux/init.h>
12#include <linux/fs.h> 12#include <linux/fs.h>
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/sched.h>
15#include <linux/mm.h> 14#include <linux/mm.h>
16#include <linux/major.h> 15#include <linux/major.h>
17#include <linux/string.h> 16#include <linux/string.h>
diff --git a/drivers/scsi/dtc.c b/drivers/scsi/dtc.c
index 54756722dd5f..9d52e45c7d36 100644
--- a/drivers/scsi/dtc.c
+++ b/drivers/scsi/dtc.c
@@ -75,7 +75,6 @@
75#include <asm/system.h> 75#include <asm/system.h>
76#include <linux/module.h> 76#include <linux/module.h>
77#include <linux/signal.h> 77#include <linux/signal.h>
78#include <linux/sched.h>
79#include <linux/blkdev.h> 78#include <linux/blkdev.h>
80#include <linux/delay.h> 79#include <linux/delay.h>
81#include <linux/stat.h> 80#include <linux/stat.h>
diff --git a/drivers/scsi/eata_pio.c b/drivers/scsi/eata_pio.c
index 2dbb66d2f0a7..f33ad01064a9 100644
--- a/drivers/scsi/eata_pio.c
+++ b/drivers/scsi/eata_pio.c
@@ -48,7 +48,6 @@
48 48
49#include <linux/module.h> 49#include <linux/module.h>
50#include <linux/kernel.h> 50#include <linux/kernel.h>
51#include <linux/sched.h>
52#include <linux/string.h> 51#include <linux/string.h>
53#include <linux/ioport.h> 52#include <linux/ioport.h>
54#include <linux/slab.h> 53#include <linux/slab.h>
diff --git a/drivers/scsi/g_NCR5380.c b/drivers/scsi/g_NCR5380.c
index cdd893bb4e28..880f70d24e65 100644
--- a/drivers/scsi/g_NCR5380.c
+++ b/drivers/scsi/g_NCR5380.c
@@ -103,7 +103,6 @@
103#include <asm/system.h> 103#include <asm/system.h>
104#include <asm/io.h> 104#include <asm/io.h>
105#include <linux/signal.h> 105#include <linux/signal.h>
106#include <linux/sched.h>
107#include <linux/blkdev.h> 106#include <linux/blkdev.h>
108#include "scsi.h" 107#include "scsi.h"
109#include <scsi/scsi_host.h> 108#include <scsi/scsi_host.h>
diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c
index a1992928e671..8c81cec85298 100644
--- a/drivers/scsi/gdth.c
+++ b/drivers/scsi/gdth.c
@@ -387,7 +387,6 @@
387#include <linux/ctype.h> 387#include <linux/ctype.h>
388#include <linux/ioport.h> 388#include <linux/ioport.h>
389#include <linux/delay.h> 389#include <linux/delay.h>
390#include <linux/sched.h>
391#include <linux/interrupt.h> 390#include <linux/interrupt.h>
392#include <linux/in.h> 391#include <linux/in.h>
393#include <linux/proc_fs.h> 392#include <linux/proc_fs.h>
diff --git a/drivers/scsi/gvp11.c b/drivers/scsi/gvp11.c
index 2f6c1137a6e5..37741e9b5c3b 100644
--- a/drivers/scsi/gvp11.c
+++ b/drivers/scsi/gvp11.c
@@ -1,7 +1,6 @@
1#include <linux/types.h> 1#include <linux/types.h>
2#include <linux/mm.h> 2#include <linux/mm.h>
3#include <linux/blkdev.h> 3#include <linux/blkdev.h>
4#include <linux/sched.h>
5#include <linux/init.h> 4#include <linux/init.h>
6#include <linux/interrupt.h> 5#include <linux/interrupt.h>
7 6
diff --git a/drivers/scsi/ibmvscsi/ibmvstgt.c b/drivers/scsi/ibmvscsi/ibmvstgt.c
index e28260f05d6b..4368ca0e8270 100644
--- a/drivers/scsi/ibmvscsi/ibmvstgt.c
+++ b/drivers/scsi/ibmvscsi/ibmvstgt.c
@@ -580,7 +580,7 @@ static int crq_queue_create(struct crq_queue *queue, struct srp_target *target)
580 } 580 }
581 581
582 err = request_irq(vport->dma_dev->irq, &ibmvstgt_interrupt, 582 err = request_irq(vport->dma_dev->irq, &ibmvstgt_interrupt,
583 SA_INTERRUPT, "ibmvstgt", target); 583 IRQF_DISABLED, "ibmvstgt", target);
584 if (err) 584 if (err)
585 goto req_irq_failed; 585 goto req_irq_failed;
586 586
diff --git a/drivers/scsi/initio.c b/drivers/scsi/initio.c
index d561663fb4e4..7e7635ca78f1 100644
--- a/drivers/scsi/initio.c
+++ b/drivers/scsi/initio.c
@@ -123,7 +123,6 @@
123#include <linux/string.h> 123#include <linux/string.h>
124#include <linux/interrupt.h> 124#include <linux/interrupt.h>
125#include <linux/ioport.h> 125#include <linux/ioport.h>
126#include <linux/sched.h>
127#include <linux/slab.h> 126#include <linux/slab.h>
128#include <linux/jiffies.h> 127#include <linux/jiffies.h>
129#include <linux/dma-mapping.h> 128#include <linux/dma-mapping.h>
diff --git a/drivers/scsi/lasi700.c b/drivers/scsi/lasi700.c
index 2aae1b081fcf..5c32a69e41ba 100644
--- a/drivers/scsi/lasi700.c
+++ b/drivers/scsi/lasi700.c
@@ -38,7 +38,6 @@
38#include <linux/stat.h> 38#include <linux/stat.h>
39#include <linux/mm.h> 39#include <linux/mm.h>
40#include <linux/blkdev.h> 40#include <linux/blkdev.h>
41#include <linux/sched.h>
42#include <linux/ioport.h> 41#include <linux/ioport.h>
43#include <linux/dma-mapping.h> 42#include <linux/dma-mapping.h>
44 43
diff --git a/drivers/scsi/mac_scsi.c b/drivers/scsi/mac_scsi.c
index a942a21dd87e..cdbcaa5ad6cf 100644
--- a/drivers/scsi/mac_scsi.c
+++ b/drivers/scsi/mac_scsi.c
@@ -36,7 +36,6 @@
36 36
37#include <linux/module.h> 37#include <linux/module.h>
38#include <linux/signal.h> 38#include <linux/signal.h>
39#include <linux/sched.h>
40#include <linux/ioport.h> 39#include <linux/ioport.h>
41#include <linux/init.h> 40#include <linux/init.h>
42#include <linux/blkdev.h> 41#include <linux/blkdev.h>
diff --git a/drivers/scsi/mvme147.c b/drivers/scsi/mvme147.c
index 1ddd7a11a958..be41aadccae5 100644
--- a/drivers/scsi/mvme147.c
+++ b/drivers/scsi/mvme147.c
@@ -1,7 +1,6 @@
1#include <linux/types.h> 1#include <linux/types.h>
2#include <linux/mm.h> 2#include <linux/mm.h>
3#include <linux/blkdev.h> 3#include <linux/blkdev.h>
4#include <linux/sched.h>
5#include <linux/interrupt.h> 4#include <linux/interrupt.h>
6 5
7#include <asm/page.h> 6#include <asm/page.h>
diff --git a/drivers/scsi/mvme16x.c b/drivers/scsi/mvme16x.c
index 890e9e232dab..575fe6f7e0ec 100644
--- a/drivers/scsi/mvme16x.c
+++ b/drivers/scsi/mvme16x.c
@@ -6,7 +6,6 @@
6#include <linux/types.h> 6#include <linux/types.h>
7#include <linux/mm.h> 7#include <linux/mm.h>
8#include <linux/blkdev.h> 8#include <linux/blkdev.h>
9#include <linux/sched.h>
10 9
11#include <asm/page.h> 10#include <asm/page.h>
12#include <asm/pgtable.h> 11#include <asm/pgtable.h>
diff --git a/drivers/scsi/nsp32.c b/drivers/scsi/nsp32.c
index 7c13f6f4a4c6..f6f561d26bf0 100644
--- a/drivers/scsi/nsp32.c
+++ b/drivers/scsi/nsp32.c
@@ -27,7 +27,6 @@
27#include <linux/module.h> 27#include <linux/module.h>
28#include <linux/init.h> 28#include <linux/init.h>
29#include <linux/kernel.h> 29#include <linux/kernel.h>
30#include <linux/sched.h>
31#include <linux/slab.h> 30#include <linux/slab.h>
32#include <linux/string.h> 31#include <linux/string.h>
33#include <linux/timer.h> 32#include <linux/timer.h>
diff --git a/drivers/scsi/pas16.c b/drivers/scsi/pas16.c
index 1434209a8ac5..ee5965659971 100644
--- a/drivers/scsi/pas16.c
+++ b/drivers/scsi/pas16.c
@@ -116,7 +116,6 @@
116#include <asm/system.h> 116#include <asm/system.h>
117#include <linux/signal.h> 117#include <linux/signal.h>
118#include <linux/proc_fs.h> 118#include <linux/proc_fs.h>
119#include <linux/sched.h>
120#include <asm/io.h> 119#include <asm/io.h>
121#include <asm/dma.h> 120#include <asm/dma.h>
122#include <linux/blkdev.h> 121#include <linux/blkdev.h>
diff --git a/drivers/scsi/pcmcia/aha152x_stub.c b/drivers/scsi/pcmcia/aha152x_stub.c
index aad362ba02e0..370802d24acd 100644
--- a/drivers/scsi/pcmcia/aha152x_stub.c
+++ b/drivers/scsi/pcmcia/aha152x_stub.c
@@ -37,7 +37,6 @@
37#include <linux/module.h> 37#include <linux/module.h>
38#include <linux/init.h> 38#include <linux/init.h>
39#include <linux/kernel.h> 39#include <linux/kernel.h>
40#include <linux/sched.h>
41#include <linux/slab.h> 40#include <linux/slab.h>
42#include <linux/string.h> 41#include <linux/string.h>
43#include <linux/ioport.h> 42#include <linux/ioport.h>
diff --git a/drivers/scsi/pcmcia/fdomain_stub.c b/drivers/scsi/pcmcia/fdomain_stub.c
index a1c5f265069f..4b82b2021981 100644
--- a/drivers/scsi/pcmcia/fdomain_stub.c
+++ b/drivers/scsi/pcmcia/fdomain_stub.c
@@ -34,7 +34,6 @@
34#include <linux/module.h> 34#include <linux/module.h>
35#include <linux/init.h> 35#include <linux/init.h>
36#include <linux/kernel.h> 36#include <linux/kernel.h>
37#include <linux/sched.h>
38#include <linux/slab.h> 37#include <linux/slab.h>
39#include <linux/string.h> 38#include <linux/string.h>
40#include <linux/ioport.h> 39#include <linux/ioport.h>
diff --git a/drivers/scsi/pcmcia/nsp_cs.c b/drivers/scsi/pcmcia/nsp_cs.c
index e16fe361436e..c6f8c6e65e05 100644
--- a/drivers/scsi/pcmcia/nsp_cs.c
+++ b/drivers/scsi/pcmcia/nsp_cs.c
@@ -31,7 +31,6 @@
31#include <linux/module.h> 31#include <linux/module.h>
32#include <linux/kernel.h> 32#include <linux/kernel.h>
33#include <linux/init.h> 33#include <linux/init.h>
34#include <linux/sched.h>
35#include <linux/slab.h> 34#include <linux/slab.h>
36#include <linux/string.h> 35#include <linux/string.h>
37#include <linux/timer.h> 36#include <linux/timer.h>
diff --git a/drivers/scsi/pcmcia/qlogic_stub.c b/drivers/scsi/pcmcia/qlogic_stub.c
index 9d431fe7f47f..697cfb76c3a4 100644
--- a/drivers/scsi/pcmcia/qlogic_stub.c
+++ b/drivers/scsi/pcmcia/qlogic_stub.c
@@ -34,7 +34,6 @@
34#include <linux/module.h> 34#include <linux/module.h>
35#include <linux/init.h> 35#include <linux/init.h>
36#include <linux/kernel.h> 36#include <linux/kernel.h>
37#include <linux/sched.h>
38#include <linux/slab.h> 37#include <linux/slab.h>
39#include <linux/string.h> 38#include <linux/string.h>
40#include <linux/ioport.h> 39#include <linux/ioport.h>
diff --git a/drivers/scsi/pcmcia/sym53c500_cs.c b/drivers/scsi/pcmcia/sym53c500_cs.c
index 5b458d2478f7..ffe75c431b25 100644
--- a/drivers/scsi/pcmcia/sym53c500_cs.c
+++ b/drivers/scsi/pcmcia/sym53c500_cs.c
@@ -54,7 +54,6 @@
54#include <linux/init.h> 54#include <linux/init.h>
55#include <linux/interrupt.h> 55#include <linux/interrupt.h>
56#include <linux/kernel.h> 56#include <linux/kernel.h>
57#include <linux/sched.h>
58#include <linux/slab.h> 57#include <linux/slab.h>
59#include <linux/string.h> 58#include <linux/string.h>
60#include <linux/ioport.h> 59#include <linux/ioport.h>
diff --git a/drivers/scsi/qla1280.c b/drivers/scsi/qla1280.c
index 1548d42a3b43..6777e8a69153 100644
--- a/drivers/scsi/qla1280.c
+++ b/drivers/scsi/qla1280.c
@@ -341,7 +341,6 @@
341#include <linux/ioport.h> 341#include <linux/ioport.h>
342#include <linux/delay.h> 342#include <linux/delay.h>
343#include <linux/timer.h> 343#include <linux/timer.h>
344#include <linux/sched.h>
345#include <linux/pci.h> 344#include <linux/pci.h>
346#include <linux/proc_fs.h> 345#include <linux/proc_fs.h>
347#include <linux/stat.h> 346#include <linux/stat.h>
diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
index 81fb7bd44f01..0bfddf893ed0 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -1270,7 +1270,7 @@ static int __devinit qla4xxx_probe_adapter(struct pci_dev *pdev,
1270 INIT_WORK(&ha->dpc_work, qla4xxx_do_dpc); 1270 INIT_WORK(&ha->dpc_work, qla4xxx_do_dpc);
1271 1271
1272 ret = request_irq(pdev->irq, qla4xxx_intr_handler, 1272 ret = request_irq(pdev->irq, qla4xxx_intr_handler,
1273 SA_INTERRUPT|SA_SHIRQ, "qla4xxx", ha); 1273 IRQF_DISABLED | IRQF_SHARED, "qla4xxx", ha);
1274 if (ret) { 1274 if (ret) {
1275 dev_warn(&ha->pdev->dev, "Failed to reserve interrupt %d" 1275 dev_warn(&ha->pdev->dev, "Failed to reserve interrupt %d"
1276 " already in use.\n", pdev->irq); 1276 " already in use.\n", pdev->irq);
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index f33e2eb9f1b9..1c89ee3e69ba 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -40,7 +40,6 @@
40#include <linux/module.h> 40#include <linux/module.h>
41#include <linux/moduleparam.h> 41#include <linux/moduleparam.h>
42#include <linux/kernel.h> 42#include <linux/kernel.h>
43#include <linux/sched.h>
44#include <linux/timer.h> 43#include <linux/timer.h>
45#include <linux/string.h> 44#include <linux/string.h>
46#include <linux/slab.h> 45#include <linux/slab.h>
diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index 5adbbeedec38..3e2930b7ee23 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -28,7 +28,6 @@
28#include <linux/module.h> 28#include <linux/module.h>
29 29
30#include <linux/kernel.h> 30#include <linux/kernel.h>
31#include <linux/sched.h>
32#include <linux/errno.h> 31#include <linux/errno.h>
33#include <linux/timer.h> 32#include <linux/timer.h>
34#include <linux/types.h> 33#include <linux/types.h>
diff --git a/drivers/scsi/scsi_sysctl.c b/drivers/scsi/scsi_sysctl.c
index 04d06c25132b..6cfaaa2d0c81 100644
--- a/drivers/scsi/scsi_sysctl.c
+++ b/drivers/scsi/scsi_sysctl.c
@@ -41,7 +41,7 @@ static struct ctl_table_header *scsi_table_header;
41 41
42int __init scsi_init_sysctl(void) 42int __init scsi_init_sysctl(void)
43{ 43{
44 scsi_table_header = register_sysctl_table(scsi_root_table, 1); 44 scsi_table_header = register_sysctl_table(scsi_root_table);
45 if (!scsi_table_header) 45 if (!scsi_table_header)
46 return -ENOMEM; 46 return -ENOMEM;
47 return 0; 47 return 0;
diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c
index 3571ce8934e7..0d3c10f2134c 100644
--- a/drivers/scsi/scsi_transport_fc.c
+++ b/drivers/scsi/scsi_transport_fc.c
@@ -26,7 +26,6 @@
26 */ 26 */
27#include <linux/module.h> 27#include <linux/module.h>
28#include <linux/init.h> 28#include <linux/init.h>
29#include <linux/sched.h> /* workqueue stuff, HZ */
30#include <scsi/scsi_device.h> 29#include <scsi/scsi_device.h>
31#include <scsi/scsi_host.h> 30#include <scsi/scsi_host.h>
32#include <scsi/scsi_transport.h> 31#include <scsi/scsi_transport.h>
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index b781a90d6699..3f048bd6326d 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -35,7 +35,6 @@
35#include <linux/module.h> 35#include <linux/module.h>
36#include <linux/fs.h> 36#include <linux/fs.h>
37#include <linux/kernel.h> 37#include <linux/kernel.h>
38#include <linux/sched.h>
39#include <linux/mm.h> 38#include <linux/mm.h>
40#include <linux/bio.h> 39#include <linux/bio.h>
41#include <linux/genhd.h> 40#include <linux/genhd.h>
diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c
index 89e9b36b1788..1857d68e7195 100644
--- a/drivers/scsi/sr.c
+++ b/drivers/scsi/sr.c
@@ -35,7 +35,6 @@
35#include <linux/module.h> 35#include <linux/module.h>
36#include <linux/fs.h> 36#include <linux/fs.h>
37#include <linux/kernel.h> 37#include <linux/kernel.h>
38#include <linux/sched.h>
39#include <linux/mm.h> 38#include <linux/mm.h>
40#include <linux/bio.h> 39#include <linux/bio.h>
41#include <linux/string.h> 40#include <linux/string.h>
diff --git a/drivers/scsi/sr_ioctl.c b/drivers/scsi/sr_ioctl.c
index 0578ba42718b..e1589f91706a 100644
--- a/drivers/scsi/sr_ioctl.c
+++ b/drivers/scsi/sr_ioctl.c
@@ -1,5 +1,4 @@
1#include <linux/kernel.h> 1#include <linux/kernel.h>
2#include <linux/sched.h>
3#include <linux/mm.h> 2#include <linux/mm.h>
4#include <linux/fs.h> 3#include <linux/fs.h>
5#include <linux/errno.h> 4#include <linux/errno.h>
diff --git a/drivers/scsi/stex.c b/drivers/scsi/stex.c
index ba6bcdaf2a6a..69be1324b114 100644
--- a/drivers/scsi/stex.c
+++ b/drivers/scsi/stex.c
@@ -17,7 +17,6 @@
17#include <linux/errno.h> 17#include <linux/errno.h>
18#include <linux/kernel.h> 18#include <linux/kernel.h>
19#include <linux/delay.h> 19#include <linux/delay.h>
20#include <linux/sched.h>
21#include <linux/time.h> 20#include <linux/time.h>
22#include <linux/pci.h> 21#include <linux/pci.h>
23#include <linux/blkdev.h> 22#include <linux/blkdev.h>
diff --git a/drivers/scsi/sun3_scsi.c b/drivers/scsi/sun3_scsi.c
index 69ee3e4a820e..5e46d842c6f9 100644
--- a/drivers/scsi/sun3_scsi.c
+++ b/drivers/scsi/sun3_scsi.c
@@ -58,7 +58,6 @@
58 58
59#include <linux/module.h> 59#include <linux/module.h>
60#include <linux/signal.h> 60#include <linux/signal.h>
61#include <linux/sched.h>
62#include <linux/ioport.h> 61#include <linux/ioport.h>
63#include <linux/init.h> 62#include <linux/init.h>
64#include <linux/blkdev.h> 63#include <linux/blkdev.h>
diff --git a/drivers/scsi/sun3_scsi_vme.c b/drivers/scsi/sun3_scsi_vme.c
index bb0c9fd99e68..7cb4a31453e6 100644
--- a/drivers/scsi/sun3_scsi_vme.c
+++ b/drivers/scsi/sun3_scsi_vme.c
@@ -20,7 +20,6 @@
20 20
21#include <linux/module.h> 21#include <linux/module.h>
22#include <linux/signal.h> 22#include <linux/signal.h>
23#include <linux/sched.h>
24#include <linux/ioport.h> 23#include <linux/ioport.h>
25#include <linux/init.h> 24#include <linux/init.h>
26#include <linux/blkdev.h> 25#include <linux/blkdev.h>
diff --git a/drivers/scsi/sym53c416.c b/drivers/scsi/sym53c416.c
index 32c883f1efa1..2ca950582bc3 100644
--- a/drivers/scsi/sym53c416.c
+++ b/drivers/scsi/sym53c416.c
@@ -32,7 +32,6 @@
32#include <linux/init.h> 32#include <linux/init.h>
33#include <linux/string.h> 33#include <linux/string.h>
34#include <linux/ioport.h> 34#include <linux/ioport.h>
35#include <linux/sched.h>
36#include <linux/interrupt.h> 35#include <linux/interrupt.h>
37#include <linux/delay.h> 36#include <linux/delay.h>
38#include <linux/proc_fs.h> 37#include <linux/proc_fs.h>
diff --git a/drivers/scsi/t128.c b/drivers/scsi/t128.c
index 0b7a70f61e0d..248d60b8d899 100644
--- a/drivers/scsi/t128.c
+++ b/drivers/scsi/t128.c
@@ -108,7 +108,6 @@
108 108
109#include <asm/system.h> 109#include <asm/system.h>
110#include <linux/signal.h> 110#include <linux/signal.h>
111#include <linux/sched.h>
112#include <linux/io.h> 111#include <linux/io.h>
113#include <linux/blkdev.h> 112#include <linux/blkdev.h>
114#include <linux/interrupt.h> 113#include <linux/interrupt.h>
diff --git a/drivers/scsi/tmscsim.c b/drivers/scsi/tmscsim.c
index fa5382e354be..a583e89238fc 100644
--- a/drivers/scsi/tmscsim.c
+++ b/drivers/scsi/tmscsim.c
@@ -221,7 +221,6 @@
221#include <linux/module.h> 221#include <linux/module.h>
222#include <linux/delay.h> 222#include <linux/delay.h>
223#include <linux/signal.h> 223#include <linux/signal.h>
224#include <linux/sched.h>
225#include <linux/errno.h> 224#include <linux/errno.h>
226#include <linux/kernel.h> 225#include <linux/kernel.h>
227#include <linux/ioport.h> 226#include <linux/ioport.h>
diff --git a/drivers/scsi/wd33c93.c b/drivers/scsi/wd33c93.c
index 2083454db511..835751600e93 100644
--- a/drivers/scsi/wd33c93.c
+++ b/drivers/scsi/wd33c93.c
@@ -73,7 +73,6 @@
73 73
74#include <linux/module.h> 74#include <linux/module.h>
75 75
76#include <linux/sched.h>
77#include <linux/string.h> 76#include <linux/string.h>
78#include <linux/delay.h> 77#include <linux/delay.h>
79#include <linux/init.h> 78#include <linux/init.h>
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c
index 2964ca9df5a0..98ec86185328 100644
--- a/drivers/serial/8250.c
+++ b/drivers/serial/8250.c
@@ -364,6 +364,23 @@ serial_out(struct uart_8250_port *up, int offset, int value)
364 } 364 }
365} 365}
366 366
367static void
368serial_out_sync(struct uart_8250_port *up, int offset, int value)
369{
370 switch (up->port.iotype) {
371 case UPIO_MEM:
372 case UPIO_MEM32:
373#ifdef CONFIG_SERIAL_8250_AU1X00
374 case UPIO_AU:
375#endif
376 serial_out(up, offset, value);
377 serial_in(up, UART_LCR); /* safe, no side-effects */
378 break;
379 default:
380 serial_out(up, offset, value);
381 }
382}
383
367/* 384/*
368 * We used to support using pause I/O for certain machines. We 385 * We used to support using pause I/O for certain machines. We
369 * haven't supported this for a while, but just in case it's badly 386 * haven't supported this for a while, but just in case it's badly
@@ -1045,7 +1062,7 @@ static void autoconfig(struct uart_8250_port *up, unsigned int probeflags)
1045#endif 1062#endif
1046 serial_outp(up, UART_MCR, save_mcr); 1063 serial_outp(up, UART_MCR, save_mcr);
1047 serial8250_clear_fifos(up); 1064 serial8250_clear_fifos(up);
1048 (void)serial_in(up, UART_RX); 1065 serial_in(up, UART_RX);
1049 if (up->capabilities & UART_CAP_UUE) 1066 if (up->capabilities & UART_CAP_UUE)
1050 serial_outp(up, UART_IER, UART_IER_UUE); 1067 serial_outp(up, UART_IER, UART_IER_UUE);
1051 else 1068 else
@@ -1451,6 +1468,12 @@ static void serial_unlink_irq_chain(struct uart_8250_port *up)
1451 serial_do_unlink(i, up); 1468 serial_do_unlink(i, up);
1452} 1469}
1453 1470
1471/* Base timer interval for polling */
1472static inline int poll_timeout(int timeout)
1473{
1474 return timeout > 6 ? (timeout / 2 - 2) : 1;
1475}
1476
1454/* 1477/*
1455 * This function is used to handle ports that do not have an 1478 * This function is used to handle ports that do not have an
1456 * interrupt. This doesn't work very well for 16450's, but gives 1479 * interrupt. This doesn't work very well for 16450's, but gives
@@ -1460,16 +1483,51 @@ static void serial_unlink_irq_chain(struct uart_8250_port *up)
1460static void serial8250_timeout(unsigned long data) 1483static void serial8250_timeout(unsigned long data)
1461{ 1484{
1462 struct uart_8250_port *up = (struct uart_8250_port *)data; 1485 struct uart_8250_port *up = (struct uart_8250_port *)data;
1463 unsigned int timeout;
1464 unsigned int iir; 1486 unsigned int iir;
1465 1487
1466 iir = serial_in(up, UART_IIR); 1488 iir = serial_in(up, UART_IIR);
1467 if (!(iir & UART_IIR_NO_INT)) 1489 if (!(iir & UART_IIR_NO_INT))
1468 serial8250_handle_port(up); 1490 serial8250_handle_port(up);
1491 mod_timer(&up->timer, jiffies + poll_timeout(up->port.timeout));
1492}
1493
1494static void serial8250_backup_timeout(unsigned long data)
1495{
1496 struct uart_8250_port *up = (struct uart_8250_port *)data;
1497 unsigned int iir, ier = 0;
1498
1499 /*
1500 * Must disable interrupts or else we risk racing with the interrupt
1501 * based handler.
1502 */
1503 if (is_real_interrupt(up->port.irq)) {
1504 ier = serial_in(up, UART_IER);
1505 serial_out(up, UART_IER, 0);
1506 }
1469 1507
1470 timeout = up->port.timeout; 1508 iir = serial_in(up, UART_IIR);
1471 timeout = timeout > 6 ? (timeout / 2 - 2) : 1; 1509
1472 mod_timer(&up->timer, jiffies + timeout); 1510 /*
1511 * This should be a safe test for anyone who doesn't trust the
1512 * IIR bits on their UART, but it's specifically designed for
1513 * the "Diva" UART used on the management processor on many HP
1514 * ia64 and parisc boxes.
1515 */
1516 if ((iir & UART_IIR_NO_INT) && (up->ier & UART_IER_THRI) &&
1517 (!uart_circ_empty(&up->port.info->xmit) || up->port.x_char) &&
1518 (serial_in(up, UART_LSR) & UART_LSR_THRE)) {
1519 iir &= ~(UART_IIR_ID | UART_IIR_NO_INT);
1520 iir |= UART_IIR_THRI;
1521 }
1522
1523 if (!(iir & UART_IIR_NO_INT))
1524 serial8250_handle_port(up);
1525
1526 if (is_real_interrupt(up->port.irq))
1527 serial_out(up, UART_IER, ier);
1528
1529 /* Standard timer interval plus 0.2s to keep the port running */
1530 mod_timer(&up->timer, jiffies + poll_timeout(up->port.timeout) + HZ/5);
1473} 1531}
1474 1532
1475static unsigned int serial8250_tx_empty(struct uart_port *port) 1533static unsigned int serial8250_tx_empty(struct uart_port *port)
@@ -1540,6 +1598,37 @@ static void serial8250_break_ctl(struct uart_port *port, int break_state)
1540 spin_unlock_irqrestore(&up->port.lock, flags); 1598 spin_unlock_irqrestore(&up->port.lock, flags);
1541} 1599}
1542 1600
1601#define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE)
1602
1603/*
1604 * Wait for transmitter & holding register to empty
1605 */
1606static inline void wait_for_xmitr(struct uart_8250_port *up, int bits)
1607{
1608 unsigned int status, tmout = 10000;
1609
1610 /* Wait up to 10ms for the character(s) to be sent. */
1611 do {
1612 status = serial_in(up, UART_LSR);
1613
1614 if (status & UART_LSR_BI)
1615 up->lsr_break_flag = UART_LSR_BI;
1616
1617 if (--tmout == 0)
1618 break;
1619 udelay(1);
1620 } while ((status & bits) != bits);
1621
1622 /* Wait up to 1s for flow control if necessary */
1623 if (up->port.flags & UPF_CONS_FLOW) {
1624 tmout = 1000000;
1625 while (!(serial_in(up, UART_MSR) & UART_MSR_CTS) && --tmout) {
1626 udelay(1);
1627 touch_nmi_watchdog();
1628 }
1629 }
1630}
1631
1543static int serial8250_startup(struct uart_port *port) 1632static int serial8250_startup(struct uart_port *port)
1544{ 1633{
1545 struct uart_8250_port *up = (struct uart_8250_port *)port; 1634 struct uart_8250_port *up = (struct uart_8250_port *)port;
@@ -1613,18 +1702,50 @@ static int serial8250_startup(struct uart_port *port)
1613 serial_outp(up, UART_LCR, 0); 1702 serial_outp(up, UART_LCR, 0);
1614 } 1703 }
1615 1704
1705 if (is_real_interrupt(up->port.irq)) {
1706 /*
1707 * Test for UARTs that do not reassert THRE when the
1708 * transmitter is idle and the interrupt has already
1709 * been cleared. Real 16550s should always reassert
1710 * this interrupt whenever the transmitter is idle and
1711 * the interrupt is enabled. Delays are necessary to
1712 * allow register changes to become visible.
1713 */
1714 spin_lock_irqsave(&up->port.lock, flags);
1715
1716 wait_for_xmitr(up, UART_LSR_THRE);
1717 serial_out_sync(up, UART_IER, UART_IER_THRI);
1718 udelay(1); /* allow THRE to set */
1719 serial_in(up, UART_IIR);
1720 serial_out(up, UART_IER, 0);
1721 serial_out_sync(up, UART_IER, UART_IER_THRI);
1722 udelay(1); /* allow a working UART time to re-assert THRE */
1723 iir = serial_in(up, UART_IIR);
1724 serial_out(up, UART_IER, 0);
1725
1726 spin_unlock_irqrestore(&up->port.lock, flags);
1727
1728 /*
1729 * If the interrupt is not reasserted, setup a timer to
1730 * kick the UART on a regular basis.
1731 */
1732 if (iir & UART_IIR_NO_INT) {
1733 pr_debug("ttyS%d - using backup timer\n", port->line);
1734 up->timer.function = serial8250_backup_timeout;
1735 up->timer.data = (unsigned long)up;
1736 mod_timer(&up->timer, jiffies +
1737 poll_timeout(up->port.timeout) + HZ/5);
1738 }
1739 }
1740
1616 /* 1741 /*
1617 * If the "interrupt" for this port doesn't correspond with any 1742 * If the "interrupt" for this port doesn't correspond with any
1618 * hardware interrupt, we use a timer-based system. The original 1743 * hardware interrupt, we use a timer-based system. The original
1619 * driver used to do this with IRQ0. 1744 * driver used to do this with IRQ0.
1620 */ 1745 */
1621 if (!is_real_interrupt(up->port.irq)) { 1746 if (!is_real_interrupt(up->port.irq)) {
1622 unsigned int timeout = up->port.timeout;
1623
1624 timeout = timeout > 6 ? (timeout / 2 - 2) : 1;
1625
1626 up->timer.data = (unsigned long)up; 1747 up->timer.data = (unsigned long)up;
1627 mod_timer(&up->timer, jiffies + timeout); 1748 mod_timer(&up->timer, jiffies + poll_timeout(up->port.timeout));
1628 } else { 1749 } else {
1629 retval = serial_link_irq_chain(up); 1750 retval = serial_link_irq_chain(up);
1630 if (retval) 1751 if (retval)
@@ -1740,9 +1861,9 @@ static void serial8250_shutdown(struct uart_port *port)
1740 */ 1861 */
1741 (void) serial_in(up, UART_RX); 1862 (void) serial_in(up, UART_RX);
1742 1863
1743 if (!is_real_interrupt(up->port.irq)) 1864 del_timer_sync(&up->timer);
1744 del_timer_sync(&up->timer); 1865 up->timer.function = serial8250_timeout;
1745 else 1866 if (is_real_interrupt(up->port.irq))
1746 serial_unlink_irq_chain(up); 1867 serial_unlink_irq_chain(up);
1747} 1868}
1748 1869
@@ -2212,37 +2333,6 @@ serial8250_register_ports(struct uart_driver *drv, struct device *dev)
2212 2333
2213#ifdef CONFIG_SERIAL_8250_CONSOLE 2334#ifdef CONFIG_SERIAL_8250_CONSOLE
2214 2335
2215#define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE)
2216
2217/*
2218 * Wait for transmitter & holding register to empty
2219 */
2220static inline void wait_for_xmitr(struct uart_8250_port *up, int bits)
2221{
2222 unsigned int status, tmout = 10000;
2223
2224 /* Wait up to 10ms for the character(s) to be sent. */
2225 do {
2226 status = serial_in(up, UART_LSR);
2227
2228 if (status & UART_LSR_BI)
2229 up->lsr_break_flag = UART_LSR_BI;
2230
2231 if (--tmout == 0)
2232 break;
2233 udelay(1);
2234 } while ((status & bits) != bits);
2235
2236 /* Wait up to 1s for flow control if necessary */
2237 if (up->port.flags & UPF_CONS_FLOW) {
2238 tmout = 1000000;
2239 while (!(serial_in(up, UART_MSR) & UART_MSR_CTS) && --tmout) {
2240 udelay(1);
2241 touch_nmi_watchdog();
2242 }
2243 }
2244}
2245
2246static void serial8250_console_putchar(struct uart_port *port, int ch) 2336static void serial8250_console_putchar(struct uart_port *port, int ch)
2247{ 2337{
2248 struct uart_8250_port *up = (struct uart_8250_port *)port; 2338 struct uart_8250_port *up = (struct uart_8250_port *)port;
diff --git a/drivers/serial/8250_acorn.c b/drivers/serial/8250_acorn.c
index ef8cc8a70c60..562ba745a044 100644
--- a/drivers/serial/8250_acorn.c
+++ b/drivers/serial/8250_acorn.c
@@ -47,11 +47,10 @@ serial_card_probe(struct expansion_card *ec, const struct ecard_id *id)
47 unsigned long bus_addr; 47 unsigned long bus_addr;
48 unsigned int i; 48 unsigned int i;
49 49
50 info = kmalloc(sizeof(struct serial_card_info), GFP_KERNEL); 50 info = kzalloc(sizeof(struct serial_card_info), GFP_KERNEL);
51 if (!info) 51 if (!info)
52 return -ENOMEM; 52 return -ENOMEM;
53 53
54 memset(info, 0, sizeof(struct serial_card_info));
55 info->num_ports = type->num_ports; 54 info->num_ports = type->num_ports;
56 55
57 bus_addr = ecard_resource_start(ec, type->type); 56 bus_addr = ecard_resource_start(ec, type->type);
diff --git a/drivers/serial/8250_pci.c b/drivers/serial/8250_pci.c
index a2dac378bda9..6d7d616e9ccd 100644
--- a/drivers/serial/8250_pci.c
+++ b/drivers/serial/8250_pci.c
@@ -16,7 +16,6 @@
16#include <linux/module.h> 16#include <linux/module.h>
17#include <linux/init.h> 17#include <linux/init.h>
18#include <linux/pci.h> 18#include <linux/pci.h>
19#include <linux/sched.h>
20#include <linux/string.h> 19#include <linux/string.h>
21#include <linux/kernel.h> 20#include <linux/kernel.h>
22#include <linux/slab.h> 21#include <linux/slab.h>
@@ -1628,7 +1627,7 @@ pciserial_init_ports(struct pci_dev *dev, struct pciserial_board *board)
1628 nr_ports = rc; 1627 nr_ports = rc;
1629 } 1628 }
1630 1629
1631 priv = kmalloc(sizeof(struct serial_private) + 1630 priv = kzalloc(sizeof(struct serial_private) +
1632 sizeof(unsigned int) * nr_ports, 1631 sizeof(unsigned int) * nr_ports,
1633 GFP_KERNEL); 1632 GFP_KERNEL);
1634 if (!priv) { 1633 if (!priv) {
@@ -1636,9 +1635,6 @@ pciserial_init_ports(struct pci_dev *dev, struct pciserial_board *board)
1636 goto err_deinit; 1635 goto err_deinit;
1637 } 1636 }
1638 1637
1639 memset(priv, 0, sizeof(struct serial_private) +
1640 sizeof(unsigned int) * nr_ports);
1641
1642 priv->dev = dev; 1638 priv->dev = dev;
1643 priv->quirk = quirk; 1639 priv->quirk = quirk;
1644 1640
diff --git a/drivers/serial/8250_pnp.c b/drivers/serial/8250_pnp.c
index d3d6b82706b5..cde5db44abf6 100644
--- a/drivers/serial/8250_pnp.c
+++ b/drivers/serial/8250_pnp.c
@@ -450,11 +450,11 @@ serial_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id *dev_id)
450 port.dev = &dev->dev; 450 port.dev = &dev->dev;
451 451
452 line = serial8250_register_port(&port); 452 line = serial8250_register_port(&port);
453 if (line < 0)
454 return -ENODEV;
453 455
454 if (line >= 0) 456 pnp_set_drvdata(dev, (void *)((long)line + 1));
455 pnp_set_drvdata(dev, (void *)((long)line + 1)); 457 return 0;
456 return line >= 0 ? 0 : -ENODEV;
457
458} 458}
459 459
460static void __devexit serial_pnp_remove(struct pnp_dev *dev) 460static void __devexit serial_pnp_remove(struct pnp_dev *dev)
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
index d0edbaacb1f7..e8dd71df9165 100644
--- a/drivers/serial/Kconfig
+++ b/drivers/serial/Kconfig
@@ -686,6 +686,22 @@ config SERIAL_SH_SCI_CONSOLE
686 depends on SERIAL_SH_SCI=y 686 depends on SERIAL_SH_SCI=y
687 select SERIAL_CORE_CONSOLE 687 select SERIAL_CORE_CONSOLE
688 688
689config SERIAL_PNX8XXX
690 bool "Enable PNX8XXX SoCs' UART Support"
691 depends on MIPS && SOC_PNX8550
692 select SERIAL_CORE
693 help
694 If you have a MIPS-based Philips SoC such as PNX8550 or PNX8330
695 and you want to use serial ports, say Y. Otherwise, say N.
696
697config SERIAL_PNX8XXX_CONSOLE
698 bool "Enable PNX8XX0 serial console"
699 depends on SERIAL_PNX8XXX
700 select SERIAL_CORE_CONSOLE
701 help
702 If you have a MIPS-based Philips SoC such as PNX8550 or PNX8330
703 and you want to use serial console, say Y. Otherwise, say N.
704
689config SERIAL_CORE 705config SERIAL_CORE
690 tristate 706 tristate
691 707
diff --git a/drivers/serial/Makefile b/drivers/serial/Makefile
index f3f82587b5fa..6b3560c5749a 100644
--- a/drivers/serial/Makefile
+++ b/drivers/serial/Makefile
@@ -25,6 +25,7 @@ obj-$(CONFIG_SERIAL_AMBA_PL010) += amba-pl010.o
25obj-$(CONFIG_SERIAL_AMBA_PL011) += amba-pl011.o 25obj-$(CONFIG_SERIAL_AMBA_PL011) += amba-pl011.o
26obj-$(CONFIG_SERIAL_CLPS711X) += clps711x.o 26obj-$(CONFIG_SERIAL_CLPS711X) += clps711x.o
27obj-$(CONFIG_SERIAL_PXA) += pxa.o 27obj-$(CONFIG_SERIAL_PXA) += pxa.o
28obj-$(CONFIG_SERIAL_PNX8XXX) += pnx8xxx_uart.o
28obj-$(CONFIG_SERIAL_SA1100) += sa1100.o 29obj-$(CONFIG_SERIAL_SA1100) += sa1100.o
29obj-$(CONFIG_SERIAL_S3C2410) += s3c2410.o 30obj-$(CONFIG_SERIAL_S3C2410) += s3c2410.o
30obj-$(CONFIG_SERIAL_SUNCORE) += suncore.o 31obj-$(CONFIG_SERIAL_SUNCORE) += suncore.o
diff --git a/drivers/serial/icom.c b/drivers/serial/icom.c
index 71e6a24d8c28..41431d0d5512 100644
--- a/drivers/serial/icom.c
+++ b/drivers/serial/icom.c
@@ -27,7 +27,6 @@
27#include <linux/kernel.h> 27#include <linux/kernel.h>
28#include <linux/errno.h> 28#include <linux/errno.h>
29#include <linux/signal.h> 29#include <linux/signal.h>
30#include <linux/sched.h>
31#include <linux/timer.h> 30#include <linux/timer.h>
32#include <linux/interrupt.h> 31#include <linux/interrupt.h>
33#include <linux/tty.h> 32#include <linux/tty.h>
@@ -1417,14 +1416,12 @@ static int __devinit icom_alloc_adapter(struct icom_adapter
1417 struct list_head *tmp; 1416 struct list_head *tmp;
1418 1417
1419 icom_adapter = (struct icom_adapter *) 1418 icom_adapter = (struct icom_adapter *)
1420 kmalloc(sizeof(struct icom_adapter), GFP_KERNEL); 1419 kzalloc(sizeof(struct icom_adapter), GFP_KERNEL);
1421 1420
1422 if (!icom_adapter) { 1421 if (!icom_adapter) {
1423 return -ENOMEM; 1422 return -ENOMEM;
1424 } 1423 }
1425 1424
1426 memset(icom_adapter, 0, sizeof(struct icom_adapter));
1427
1428 list_for_each(tmp, &icom_adapter_head) { 1425 list_for_each(tmp, &icom_adapter_head) {
1429 cur_adapter_entry = 1426 cur_adapter_entry =
1430 list_entry(tmp, struct icom_adapter, 1427 list_entry(tmp, struct icom_adapter,
diff --git a/drivers/serial/ioc3_serial.c b/drivers/serial/ioc3_serial.c
index 9cc0be932316..168073f12cec 100644
--- a/drivers/serial/ioc3_serial.c
+++ b/drivers/serial/ioc3_serial.c
@@ -2019,13 +2019,12 @@ ioc3uart_probe(struct ioc3_submodule *is, struct ioc3_driver_data *idd)
2019 2019
2020 DPRINT_CONFIG(("%s (0x%p, 0x%p)\n", __FUNCTION__, is, idd)); 2020 DPRINT_CONFIG(("%s (0x%p, 0x%p)\n", __FUNCTION__, is, idd));
2021 2021
2022 card_ptr = kmalloc(sizeof(struct ioc3_card), GFP_KERNEL); 2022 card_ptr = kzalloc(sizeof(struct ioc3_card), GFP_KERNEL);
2023 if (!card_ptr) { 2023 if (!card_ptr) {
2024 printk(KERN_WARNING "ioc3_attach_one" 2024 printk(KERN_WARNING "ioc3_attach_one"
2025 ": unable to get memory for the IOC3\n"); 2025 ": unable to get memory for the IOC3\n");
2026 return -ENOMEM; 2026 return -ENOMEM;
2027 } 2027 }
2028 memset(card_ptr, 0, sizeof(struct ioc3_card));
2029 idd->data[is->id] = card_ptr; 2028 idd->data[is->id] = card_ptr;
2030 Submodule_slot = is->id; 2029 Submodule_slot = is->id;
2031 2030
@@ -2040,13 +2039,12 @@ ioc3uart_probe(struct ioc3_submodule *is, struct ioc3_driver_data *idd)
2040 2039
2041 /* Create port structures for each port */ 2040 /* Create port structures for each port */
2042 for (phys_port = 0; phys_port < PORTS_PER_CARD; phys_port++) { 2041 for (phys_port = 0; phys_port < PORTS_PER_CARD; phys_port++) {
2043 port = kmalloc(sizeof(struct ioc3_port), GFP_KERNEL); 2042 port = kzalloc(sizeof(struct ioc3_port), GFP_KERNEL);
2044 if (!port) { 2043 if (!port) {
2045 printk(KERN_WARNING 2044 printk(KERN_WARNING
2046 "IOC3 serial memory not available for port\n"); 2045 "IOC3 serial memory not available for port\n");
2047 goto out4; 2046 goto out4;
2048 } 2047 }
2049 memset(port, 0, sizeof(struct ioc3_port));
2050 spin_lock_init(&port->ip_lock); 2048 spin_lock_init(&port->ip_lock);
2051 2049
2052 /* we need to remember the previous ones, to point back to 2050 /* we need to remember the previous ones, to point back to
diff --git a/drivers/serial/ioc4_serial.c b/drivers/serial/ioc4_serial.c
index f540212e7409..0c179384fb0c 100644
--- a/drivers/serial/ioc4_serial.c
+++ b/drivers/serial/ioc4_serial.c
@@ -1076,13 +1076,12 @@ static int inline ioc4_attach_local(struct ioc4_driver_data *idd)
1076 /* Create port structures for each port */ 1076 /* Create port structures for each port */
1077 for (port_number = 0; port_number < IOC4_NUM_SERIAL_PORTS; 1077 for (port_number = 0; port_number < IOC4_NUM_SERIAL_PORTS;
1078 port_number++) { 1078 port_number++) {
1079 port = kmalloc(sizeof(struct ioc4_port), GFP_KERNEL); 1079 port = kzalloc(sizeof(struct ioc4_port), GFP_KERNEL);
1080 if (!port) { 1080 if (!port) {
1081 printk(KERN_WARNING 1081 printk(KERN_WARNING
1082 "IOC4 serial memory not available for port\n"); 1082 "IOC4 serial memory not available for port\n");
1083 return -ENOMEM; 1083 return -ENOMEM;
1084 } 1084 }
1085 memset(port, 0, sizeof(struct ioc4_port));
1086 spin_lock_init(&port->ip_lock); 1085 spin_lock_init(&port->ip_lock);
1087 1086
1088 /* we need to remember the previous ones, to point back to 1087 /* we need to remember the previous ones, to point back to
@@ -2811,7 +2810,7 @@ ioc4_serial_attach_one(struct ioc4_driver_data *idd)
2811 (void *)serial)); 2810 (void *)serial));
2812 2811
2813 /* Get memory for the new card */ 2812 /* Get memory for the new card */
2814 control = kmalloc(sizeof(struct ioc4_control), GFP_KERNEL); 2813 control = kzalloc(sizeof(struct ioc4_control), GFP_KERNEL);
2815 2814
2816 if (!control) { 2815 if (!control) {
2817 printk(KERN_WARNING "ioc4_attach_one" 2816 printk(KERN_WARNING "ioc4_attach_one"
@@ -2819,11 +2818,10 @@ ioc4_serial_attach_one(struct ioc4_driver_data *idd)
2819 ret = -ENOMEM; 2818 ret = -ENOMEM;
2820 goto out2; 2819 goto out2;
2821 } 2820 }
2822 memset(control, 0, sizeof(struct ioc4_control));
2823 idd->idd_serial_data = control; 2821 idd->idd_serial_data = control;
2824 2822
2825 /* Allocate the soft structure */ 2823 /* Allocate the soft structure */
2826 soft = kmalloc(sizeof(struct ioc4_soft), GFP_KERNEL); 2824 soft = kzalloc(sizeof(struct ioc4_soft), GFP_KERNEL);
2827 if (!soft) { 2825 if (!soft) {
2828 printk(KERN_WARNING 2826 printk(KERN_WARNING
2829 "ioc4 (%p): unable to get memory for the soft struct\n", 2827 "ioc4 (%p): unable to get memory for the soft struct\n",
@@ -2831,7 +2829,6 @@ ioc4_serial_attach_one(struct ioc4_driver_data *idd)
2831 ret = -ENOMEM; 2829 ret = -ENOMEM;
2832 goto out3; 2830 goto out3;
2833 } 2831 }
2834 memset(soft, 0, sizeof(struct ioc4_soft));
2835 2832
2836 spin_lock_init(&soft->is_ir_lock); 2833 spin_lock_init(&soft->is_ir_lock);
2837 soft->is_ioc4_misc_addr = idd->idd_misc_regs; 2834 soft->is_ioc4_misc_addr = idd->idd_misc_regs;
diff --git a/drivers/serial/ip22zilog.c b/drivers/serial/ip22zilog.c
index 0746c9446ae0..c3abfb39f316 100644
--- a/drivers/serial/ip22zilog.c
+++ b/drivers/serial/ip22zilog.c
@@ -14,7 +14,6 @@
14 */ 14 */
15#include <linux/module.h> 15#include <linux/module.h>
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <linux/sched.h>
18#include <linux/errno.h> 17#include <linux/errno.h>
19#include <linux/delay.h> 18#include <linux/delay.h>
20#include <linux/tty.h> 19#include <linux/tty.h>
@@ -922,13 +921,7 @@ static int zilog_irq = -1;
922 921
923static void * __init alloc_one_table(unsigned long size) 922static void * __init alloc_one_table(unsigned long size)
924{ 923{
925 void *ret; 924 return kzalloc(size, GFP_KERNEL);
926
927 ret = kmalloc(size, GFP_KERNEL);
928 if (ret != NULL)
929 memset(ret, 0, size);
930
931 return ret;
932} 925}
933 926
934static void __init ip22zilog_alloc_tables(void) 927static void __init ip22zilog_alloc_tables(void)
diff --git a/drivers/serial/jsm/jsm_driver.c b/drivers/serial/jsm/jsm_driver.c
index 244f63be3a03..81792e6eeb2d 100644
--- a/drivers/serial/jsm/jsm_driver.c
+++ b/drivers/serial/jsm/jsm_driver.c
@@ -71,14 +71,13 @@ static int jsm_probe_one(struct pci_dev *pdev, const struct pci_device_id *ent)
71 goto out_disable_device; 71 goto out_disable_device;
72 } 72 }
73 73
74 brd = kmalloc(sizeof(struct jsm_board), GFP_KERNEL); 74 brd = kzalloc(sizeof(struct jsm_board), GFP_KERNEL);
75 if (!brd) { 75 if (!brd) {
76 dev_err(&pdev->dev, 76 dev_err(&pdev->dev,
77 "memory allocation for board structure failed\n"); 77 "memory allocation for board structure failed\n");
78 rc = -ENOMEM; 78 rc = -ENOMEM;
79 goto out_release_regions; 79 goto out_release_regions;
80 } 80 }
81 memset(brd, 0, sizeof(struct jsm_board));
82 81
83 /* store the info for the board we've found */ 82 /* store the info for the board we've found */
84 brd->boardnum = adapter_count++; 83 brd->boardnum = adapter_count++;
@@ -152,7 +151,7 @@ static int jsm_probe_one(struct pci_dev *pdev, const struct pci_device_id *ent)
152 * Okay to malloc with GFP_KERNEL, we are not at interrupt 151 * Okay to malloc with GFP_KERNEL, we are not at interrupt
153 * context, and there are no locks held. 152 * context, and there are no locks held.
154 */ 153 */
155 brd->flipbuf = kmalloc(MYFLIPLEN, GFP_KERNEL); 154 brd->flipbuf = kzalloc(MYFLIPLEN, GFP_KERNEL);
156 if (!brd->flipbuf) { 155 if (!brd->flipbuf) {
157 /* XXX: leaking all resources from jsm_tty_init and 156 /* XXX: leaking all resources from jsm_tty_init and
158 jsm_uart_port_init here! */ 157 jsm_uart_port_init here! */
@@ -160,7 +159,6 @@ static int jsm_probe_one(struct pci_dev *pdev, const struct pci_device_id *ent)
160 retval = -ENOMEM; 159 retval = -ENOMEM;
161 goto out_free_irq; 160 goto out_free_irq;
162 } 161 }
163 memset(brd->flipbuf, 0, MYFLIPLEN);
164 162
165 pci_set_drvdata(pdev, brd); 163 pci_set_drvdata(pdev, brd);
166 164
diff --git a/drivers/serial/jsm/jsm_tty.c b/drivers/serial/jsm/jsm_tty.c
index 7cf1c60027f8..be22bbdbc8e5 100644
--- a/drivers/serial/jsm/jsm_tty.c
+++ b/drivers/serial/jsm/jsm_tty.c
@@ -194,31 +194,28 @@ static int jsm_tty_open(struct uart_port *port)
194 /* Drop locks, as malloc with GFP_KERNEL can sleep */ 194 /* Drop locks, as malloc with GFP_KERNEL can sleep */
195 195
196 if (!channel->ch_rqueue) { 196 if (!channel->ch_rqueue) {
197 channel->ch_rqueue = (u8 *) kmalloc(RQUEUESIZE, GFP_KERNEL); 197 channel->ch_rqueue = kzalloc(RQUEUESIZE, GFP_KERNEL);
198 if (!channel->ch_rqueue) { 198 if (!channel->ch_rqueue) {
199 jsm_printk(INIT, ERR, &channel->ch_bd->pci_dev, 199 jsm_printk(INIT, ERR, &channel->ch_bd->pci_dev,
200 "unable to allocate read queue buf"); 200 "unable to allocate read queue buf");
201 return -ENOMEM; 201 return -ENOMEM;
202 } 202 }
203 memset(channel->ch_rqueue, 0, RQUEUESIZE);
204 } 203 }
205 if (!channel->ch_equeue) { 204 if (!channel->ch_equeue) {
206 channel->ch_equeue = (u8 *) kmalloc(EQUEUESIZE, GFP_KERNEL); 205 channel->ch_equeue = kzalloc(EQUEUESIZE, GFP_KERNEL);
207 if (!channel->ch_equeue) { 206 if (!channel->ch_equeue) {
208 jsm_printk(INIT, ERR, &channel->ch_bd->pci_dev, 207 jsm_printk(INIT, ERR, &channel->ch_bd->pci_dev,
209 "unable to allocate error queue buf"); 208 "unable to allocate error queue buf");
210 return -ENOMEM; 209 return -ENOMEM;
211 } 210 }
212 memset(channel->ch_equeue, 0, EQUEUESIZE);
213 } 211 }
214 if (!channel->ch_wqueue) { 212 if (!channel->ch_wqueue) {
215 channel->ch_wqueue = (u8 *) kmalloc(WQUEUESIZE, GFP_KERNEL); 213 channel->ch_wqueue = kzalloc(WQUEUESIZE, GFP_KERNEL);
216 if (!channel->ch_wqueue) { 214 if (!channel->ch_wqueue) {
217 jsm_printk(INIT, ERR, &channel->ch_bd->pci_dev, 215 jsm_printk(INIT, ERR, &channel->ch_bd->pci_dev,
218 "unable to allocate write queue buf"); 216 "unable to allocate write queue buf");
219 return -ENOMEM; 217 return -ENOMEM;
220 } 218 }
221 memset(channel->ch_wqueue, 0, WQUEUESIZE);
222 } 219 }
223 220
224 channel->ch_flags &= ~(CH_OPENING); 221 channel->ch_flags &= ~(CH_OPENING);
@@ -392,13 +389,12 @@ int jsm_tty_init(struct jsm_board *brd)
392 * Okay to malloc with GFP_KERNEL, we are not at 389 * Okay to malloc with GFP_KERNEL, we are not at
393 * interrupt context, and there are no locks held. 390 * interrupt context, and there are no locks held.
394 */ 391 */
395 brd->channels[i] = kmalloc(sizeof(struct jsm_channel), GFP_KERNEL); 392 brd->channels[i] = kzalloc(sizeof(struct jsm_channel), GFP_KERNEL);
396 if (!brd->channels[i]) { 393 if (!brd->channels[i]) {
397 jsm_printk(CORE, ERR, &brd->pci_dev, 394 jsm_printk(CORE, ERR, &brd->pci_dev,
398 "%s:%d Unable to allocate memory for channel struct\n", 395 "%s:%d Unable to allocate memory for channel struct\n",
399 __FILE__, __LINE__); 396 __FILE__, __LINE__);
400 } 397 }
401 memset(brd->channels[i], 0, sizeof(struct jsm_channel));
402 } 398 }
403 } 399 }
404 400
diff --git a/drivers/serial/pnx8xxx_uart.c b/drivers/serial/pnx8xxx_uart.c
new file mode 100644
index 000000000000..8d01c59e8d04
--- /dev/null
+++ b/drivers/serial/pnx8xxx_uart.c
@@ -0,0 +1,852 @@
1/*
2 * UART driver for PNX8XXX SoCs
3 *
4 * Author: Per Hallsmark per.hallsmark@mvista.com
5 * Ported to 2.6 kernel by EmbeddedAlley
6 * Reworked by Vitaly Wool <vitalywool@gmail.com>
7 *
8 * Based on drivers/char/serial.c, by Linus Torvalds, Theodore Ts'o.
9 * Copyright (C) 2000 Deep Blue Solutions Ltd.
10 *
11 * This file is licensed under the terms of the GNU General Public License
12 * version 2. This program is licensed "as is" without any warranty of
13 * any kind, whether express or implied.
14 *
15 */
16
17#if defined(CONFIG_SERIAL_PNX8XXX_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
18#define SUPPORT_SYSRQ
19#endif
20
21#include <linux/module.h>
22#include <linux/ioport.h>
23#include <linux/init.h>
24#include <linux/console.h>
25#include <linux/sysrq.h>
26#include <linux/device.h>
27#include <linux/platform_device.h>
28#include <linux/tty.h>
29#include <linux/tty_flip.h>
30#include <linux/serial_core.h>
31#include <linux/serial.h>
32#include <linux/serial_pnx8xxx.h>
33
34#include <asm/io.h>
35#include <asm/irq.h>
36
37/* We'll be using StrongARM sa1100 serial port major/minor */
38#define SERIAL_PNX8XXX_MAJOR 204
39#define MINOR_START 5
40
41#define NR_PORTS 2
42
43#define PNX8XXX_ISR_PASS_LIMIT 256
44
45/*
46 * Convert from ignore_status_mask or read_status_mask to FIFO
47 * and interrupt status bits
48 */
49#define SM_TO_FIFO(x) ((x) >> 10)
50#define SM_TO_ISTAT(x) ((x) & 0x000001ff)
51#define FIFO_TO_SM(x) ((x) << 10)
52#define ISTAT_TO_SM(x) ((x) & 0x000001ff)
53
54/*
55 * This is the size of our serial port register set.
56 */
57#define UART_PORT_SIZE 0x1000
58
59/*
60 * This determines how often we check the modem status signals
61 * for any change. They generally aren't connected to an IRQ
62 * so we have to poll them. We also check immediately before
63 * filling the TX fifo incase CTS has been dropped.
64 */
65#define MCTRL_TIMEOUT (250*HZ/1000)
66
67extern struct pnx8xxx_port pnx8xxx_ports[];
68
69static inline int serial_in(struct pnx8xxx_port *sport, int offset)
70{
71 return (__raw_readl(sport->port.membase + offset));
72}
73
74static inline void serial_out(struct pnx8xxx_port *sport, int offset, int value)
75{
76 __raw_writel(value, sport->port.membase + offset);
77}
78
79/*
80 * Handle any change of modem status signal since we were last called.
81 */
82static void pnx8xxx_mctrl_check(struct pnx8xxx_port *sport)
83{
84 unsigned int status, changed;
85
86 status = sport->port.ops->get_mctrl(&sport->port);
87 changed = status ^ sport->old_status;
88
89 if (changed == 0)
90 return;
91
92 sport->old_status = status;
93
94 if (changed & TIOCM_RI)
95 sport->port.icount.rng++;
96 if (changed & TIOCM_DSR)
97 sport->port.icount.dsr++;
98 if (changed & TIOCM_CAR)
99 uart_handle_dcd_change(&sport->port, status & TIOCM_CAR);
100 if (changed & TIOCM_CTS)
101 uart_handle_cts_change(&sport->port, status & TIOCM_CTS);
102
103 wake_up_interruptible(&sport->port.info->delta_msr_wait);
104}
105
106/*
107 * This is our per-port timeout handler, for checking the
108 * modem status signals.
109 */
110static void pnx8xxx_timeout(unsigned long data)
111{
112 struct pnx8xxx_port *sport = (struct pnx8xxx_port *)data;
113 unsigned long flags;
114
115 if (sport->port.info) {
116 spin_lock_irqsave(&sport->port.lock, flags);
117 pnx8xxx_mctrl_check(sport);
118 spin_unlock_irqrestore(&sport->port.lock, flags);
119
120 mod_timer(&sport->timer, jiffies + MCTRL_TIMEOUT);
121 }
122}
123
124/*
125 * interrupts disabled on entry
126 */
127static void pnx8xxx_stop_tx(struct uart_port *port)
128{
129 struct pnx8xxx_port *sport = (struct pnx8xxx_port *)port;
130 u32 ien;
131
132 /* Disable TX intr */
133 ien = serial_in(sport, PNX8XXX_IEN);
134 serial_out(sport, PNX8XXX_IEN, ien & ~PNX8XXX_UART_INT_ALLTX);
135
136 /* Clear all pending TX intr */
137 serial_out(sport, PNX8XXX_ICLR, PNX8XXX_UART_INT_ALLTX);
138}
139
140/*
141 * interrupts may not be disabled on entry
142 */
143static void pnx8xxx_start_tx(struct uart_port *port)
144{
145 struct pnx8xxx_port *sport = (struct pnx8xxx_port *)port;
146 u32 ien;
147
148 /* Clear all pending TX intr */
149 serial_out(sport, PNX8XXX_ICLR, PNX8XXX_UART_INT_ALLTX);
150
151 /* Enable TX intr */
152 ien = serial_in(sport, PNX8XXX_IEN);
153 serial_out(sport, PNX8XXX_IEN, ien | PNX8XXX_UART_INT_ALLTX);
154}
155
156/*
157 * Interrupts enabled
158 */
159static void pnx8xxx_stop_rx(struct uart_port *port)
160{
161 struct pnx8xxx_port *sport = (struct pnx8xxx_port *)port;
162 u32 ien;
163
164 /* Disable RX intr */
165 ien = serial_in(sport, PNX8XXX_IEN);
166 serial_out(sport, PNX8XXX_IEN, ien & ~PNX8XXX_UART_INT_ALLRX);
167
168 /* Clear all pending RX intr */
169 serial_out(sport, PNX8XXX_ICLR, PNX8XXX_UART_INT_ALLRX);
170}
171
172/*
173 * Set the modem control timer to fire immediately.
174 */
175static void pnx8xxx_enable_ms(struct uart_port *port)
176{
177 struct pnx8xxx_port *sport = (struct pnx8xxx_port *)port;
178
179 mod_timer(&sport->timer, jiffies);
180}
181
182static void pnx8xxx_rx_chars(struct pnx8xxx_port *sport)
183{
184 struct tty_struct *tty = sport->port.info->tty;
185 unsigned int status, ch, flg;
186
187 status = FIFO_TO_SM(serial_in(sport, PNX8XXX_FIFO)) |
188 ISTAT_TO_SM(serial_in(sport, PNX8XXX_ISTAT));
189 while (status & FIFO_TO_SM(PNX8XXX_UART_FIFO_RXFIFO)) {
190 ch = serial_in(sport, PNX8XXX_FIFO);
191
192 sport->port.icount.rx++;
193
194 flg = TTY_NORMAL;
195
196 /*
197 * note that the error handling code is
198 * out of the main execution path
199 */
200 if (status & (FIFO_TO_SM(PNX8XXX_UART_FIFO_RXFE |
201 PNX8XXX_UART_FIFO_RXPAR) |
202 ISTAT_TO_SM(PNX8XXX_UART_INT_RXOVRN))) {
203 if (status & FIFO_TO_SM(PNX8XXX_UART_FIFO_RXPAR))
204 sport->port.icount.parity++;
205 else if (status & FIFO_TO_SM(PNX8XXX_UART_FIFO_RXFE))
206 sport->port.icount.frame++;
207 if (status & ISTAT_TO_SM(PNX8XXX_UART_INT_RXOVRN))
208 sport->port.icount.overrun++;
209
210 status &= sport->port.read_status_mask;
211
212 if (status & FIFO_TO_SM(PNX8XXX_UART_FIFO_RXPAR))
213 flg = TTY_PARITY;
214 else if (status & FIFO_TO_SM(PNX8XXX_UART_FIFO_RXFE))
215 flg = TTY_FRAME;
216
217#ifdef SUPPORT_SYSRQ
218 sport->port.sysrq = 0;
219#endif
220 }
221
222 if (uart_handle_sysrq_char(&sport->port, ch))
223 goto ignore_char;
224
225 uart_insert_char(&sport->port, status,
226 ISTAT_TO_SM(PNX8XXX_UART_INT_RXOVRN), ch, flg);
227
228 ignore_char:
229 serial_out(sport, PNX8XXX_LCR, serial_in(sport, PNX8XXX_LCR) |
230 PNX8XXX_UART_LCR_RX_NEXT);
231 status = FIFO_TO_SM(serial_in(sport, PNX8XXX_FIFO)) |
232 ISTAT_TO_SM(serial_in(sport, PNX8XXX_ISTAT));
233 }
234 tty_flip_buffer_push(tty);
235}
236
237static void pnx8xxx_tx_chars(struct pnx8xxx_port *sport)
238{
239 struct circ_buf *xmit = &sport->port.info->xmit;
240
241 if (sport->port.x_char) {
242 serial_out(sport, PNX8XXX_FIFO, sport->port.x_char);
243 sport->port.icount.tx++;
244 sport->port.x_char = 0;
245 return;
246 }
247
248 /*
249 * Check the modem control lines before
250 * transmitting anything.
251 */
252 pnx8xxx_mctrl_check(sport);
253
254 if (uart_circ_empty(xmit) || uart_tx_stopped(&sport->port)) {
255 pnx8xxx_stop_tx(&sport->port);
256 return;
257 }
258
259 /*
260 * TX while bytes available
261 */
262 while (((serial_in(sport, PNX8XXX_FIFO) &
263 PNX8XXX_UART_FIFO_TXFIFO) >> 16) < 16) {
264 serial_out(sport, PNX8XXX_FIFO, xmit->buf[xmit->tail]);
265 xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
266 sport->port.icount.tx++;
267 if (uart_circ_empty(xmit))
268 break;
269 }
270
271 if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
272 uart_write_wakeup(&sport->port);
273
274 if (uart_circ_empty(xmit))
275 pnx8xxx_stop_tx(&sport->port);
276}
277
278static irqreturn_t pnx8xxx_int(int irq, void *dev_id)
279{
280 struct pnx8xxx_port *sport = dev_id;
281 unsigned int status;
282
283 spin_lock(&sport->port.lock);
284 /* Get the interrupts */
285 status = serial_in(sport, PNX8XXX_ISTAT) & serial_in(sport, PNX8XXX_IEN);
286
287 /* Break signal received */
288 if (status & PNX8XXX_UART_INT_BREAK) {
289 sport->port.icount.brk++;
290 uart_handle_break(&sport->port);
291 }
292
293 /* Byte received */
294 if (status & PNX8XXX_UART_INT_RX)
295 pnx8xxx_rx_chars(sport);
296
297 /* TX holding register empty - transmit a byte */
298 if (status & PNX8XXX_UART_INT_TX)
299 pnx8xxx_tx_chars(sport);
300
301 /* Clear the ISTAT register */
302 serial_out(sport, PNX8XXX_ICLR, status);
303
304 spin_unlock(&sport->port.lock);
305 return IRQ_HANDLED;
306}
307
308/*
309 * Return TIOCSER_TEMT when transmitter is not busy.
310 */
311static unsigned int pnx8xxx_tx_empty(struct uart_port *port)
312{
313 struct pnx8xxx_port *sport = (struct pnx8xxx_port *)port;
314
315 return serial_in(sport, PNX8XXX_FIFO) & PNX8XXX_UART_FIFO_TXFIFO_STA ? 0 : TIOCSER_TEMT;
316}
317
318static unsigned int pnx8xxx_get_mctrl(struct uart_port *port)
319{
320 struct pnx8xxx_port *sport = (struct pnx8xxx_port *)port;
321 unsigned int mctrl = TIOCM_DSR;
322 unsigned int msr;
323
324 /* REVISIT */
325
326 msr = serial_in(sport, PNX8XXX_MCR);
327
328 mctrl |= msr & PNX8XXX_UART_MCR_CTS ? TIOCM_CTS : 0;
329 mctrl |= msr & PNX8XXX_UART_MCR_DCD ? TIOCM_CAR : 0;
330
331 return mctrl;
332}
333
334static void pnx8xxx_set_mctrl(struct uart_port *port, unsigned int mctrl)
335{
336#if 0 /* FIXME */
337 struct pnx8xxx_port *sport = (struct pnx8xxx_port *)port;
338 unsigned int msr;
339#endif
340}
341
342/*
343 * Interrupts always disabled.
344 */
345static void pnx8xxx_break_ctl(struct uart_port *port, int break_state)
346{
347 struct pnx8xxx_port *sport = (struct pnx8xxx_port *)port;
348 unsigned long flags;
349 unsigned int lcr;
350
351 spin_lock_irqsave(&sport->port.lock, flags);
352 lcr = serial_in(sport, PNX8XXX_LCR);
353 if (break_state == -1)
354 lcr |= PNX8XXX_UART_LCR_TXBREAK;
355 else
356 lcr &= ~PNX8XXX_UART_LCR_TXBREAK;
357 serial_out(sport, PNX8XXX_LCR, lcr);
358 spin_unlock_irqrestore(&sport->port.lock, flags);
359}
360
361static int pnx8xxx_startup(struct uart_port *port)
362{
363 struct pnx8xxx_port *sport = (struct pnx8xxx_port *)port;
364 int retval;
365
366 /*
367 * Allocate the IRQ
368 */
369 retval = request_irq(sport->port.irq, pnx8xxx_int, 0,
370 "pnx8xxx-uart", sport);
371 if (retval)
372 return retval;
373
374 /*
375 * Finally, clear and enable interrupts
376 */
377
378 serial_out(sport, PNX8XXX_ICLR, PNX8XXX_UART_INT_ALLRX |
379 PNX8XXX_UART_INT_ALLTX);
380
381 serial_out(sport, PNX8XXX_IEN, serial_in(sport, PNX8XXX_IEN) |
382 PNX8XXX_UART_INT_ALLRX |
383 PNX8XXX_UART_INT_ALLTX);
384
385 /*
386 * Enable modem status interrupts
387 */
388 spin_lock_irq(&sport->port.lock);
389 pnx8xxx_enable_ms(&sport->port);
390 spin_unlock_irq(&sport->port.lock);
391
392 return 0;
393}
394
395static void pnx8xxx_shutdown(struct uart_port *port)
396{
397 struct pnx8xxx_port *sport = (struct pnx8xxx_port *)port;
398 int lcr;
399
400 /*
401 * Stop our timer.
402 */
403 del_timer_sync(&sport->timer);
404
405 /*
406 * Disable all interrupts
407 */
408 serial_out(sport, PNX8XXX_IEN, 0);
409
410 /*
411 * Reset the Tx and Rx FIFOS, disable the break condition
412 */
413 lcr = serial_in(sport, PNX8XXX_LCR);
414 lcr &= ~PNX8XXX_UART_LCR_TXBREAK;
415 lcr |= PNX8XXX_UART_LCR_TX_RST | PNX8XXX_UART_LCR_RX_RST;
416 serial_out(sport, PNX8XXX_LCR, lcr);
417
418 /*
419 * Clear all interrupts
420 */
421 serial_out(sport, PNX8XXX_ICLR, PNX8XXX_UART_INT_ALLRX |
422 PNX8XXX_UART_INT_ALLTX);
423
424 /*
425 * Free the interrupt
426 */
427 free_irq(sport->port.irq, sport);
428}
429
430static void
431pnx8xxx_set_termios(struct uart_port *port, struct ktermios *termios,
432 struct ktermios *old)
433{
434 struct pnx8xxx_port *sport = (struct pnx8xxx_port *)port;
435 unsigned long flags;
436 unsigned int lcr_fcr, old_ien, baud, quot;
437 unsigned int old_csize = old ? old->c_cflag & CSIZE : CS8;
438
439 /*
440 * We only support CS7 and CS8.
441 */
442 while ((termios->c_cflag & CSIZE) != CS7 &&
443 (termios->c_cflag & CSIZE) != CS8) {
444 termios->c_cflag &= ~CSIZE;
445 termios->c_cflag |= old_csize;
446 old_csize = CS8;
447 }
448
449 if ((termios->c_cflag & CSIZE) == CS8)
450 lcr_fcr = PNX8XXX_UART_LCR_8BIT;
451 else
452 lcr_fcr = 0;
453
454 if (termios->c_cflag & CSTOPB)
455 lcr_fcr |= PNX8XXX_UART_LCR_2STOPB;
456 if (termios->c_cflag & PARENB) {
457 lcr_fcr |= PNX8XXX_UART_LCR_PAREN;
458 if (!(termios->c_cflag & PARODD))
459 lcr_fcr |= PNX8XXX_UART_LCR_PAREVN;
460 }
461
462 /*
463 * Ask the core to calculate the divisor for us.
464 */
465 baud = uart_get_baud_rate(port, termios, old, 0, port->uartclk/16);
466 quot = uart_get_divisor(port, baud);
467
468 spin_lock_irqsave(&sport->port.lock, flags);
469
470 sport->port.read_status_mask = ISTAT_TO_SM(PNX8XXX_UART_INT_RXOVRN) |
471 ISTAT_TO_SM(PNX8XXX_UART_INT_EMPTY) |
472 ISTAT_TO_SM(PNX8XXX_UART_INT_RX);
473 if (termios->c_iflag & INPCK)
474 sport->port.read_status_mask |=
475 FIFO_TO_SM(PNX8XXX_UART_FIFO_RXFE) |
476 FIFO_TO_SM(PNX8XXX_UART_FIFO_RXPAR);
477 if (termios->c_iflag & (BRKINT | PARMRK))
478 sport->port.read_status_mask |=
479 ISTAT_TO_SM(PNX8XXX_UART_INT_BREAK);
480
481 /*
482 * Characters to ignore
483 */
484 sport->port.ignore_status_mask = 0;
485 if (termios->c_iflag & IGNPAR)
486 sport->port.ignore_status_mask |=
487 FIFO_TO_SM(PNX8XXX_UART_FIFO_RXFE) |
488 FIFO_TO_SM(PNX8XXX_UART_FIFO_RXPAR);
489 if (termios->c_iflag & IGNBRK) {
490 sport->port.ignore_status_mask |=
491 ISTAT_TO_SM(PNX8XXX_UART_INT_BREAK);
492 /*
493 * If we're ignoring parity and break indicators,
494 * ignore overruns too (for real raw support).
495 */
496 if (termios->c_iflag & IGNPAR)
497 sport->port.ignore_status_mask |=
498 ISTAT_TO_SM(PNX8XXX_UART_INT_RXOVRN);
499 }
500
501 /*
502 * ignore all characters if CREAD is not set
503 */
504 if ((termios->c_cflag & CREAD) == 0)
505 sport->port.ignore_status_mask |=
506 ISTAT_TO_SM(PNX8XXX_UART_INT_RX);
507
508 del_timer_sync(&sport->timer);
509
510 /*
511 * Update the per-port timeout.
512 */
513 uart_update_timeout(port, termios->c_cflag, baud);
514
515 /*
516 * disable interrupts and drain transmitter
517 */
518 old_ien = serial_in(sport, PNX8XXX_IEN);
519 serial_out(sport, PNX8XXX_IEN, old_ien & ~(PNX8XXX_UART_INT_ALLTX |
520 PNX8XXX_UART_INT_ALLRX));
521
522 while (serial_in(sport, PNX8XXX_FIFO) & PNX8XXX_UART_FIFO_TXFIFO_STA)
523 barrier();
524
525 /* then, disable everything */
526 serial_out(sport, PNX8XXX_IEN, 0);
527
528 /* Reset the Rx and Tx FIFOs too */
529 lcr_fcr |= PNX8XXX_UART_LCR_TX_RST;
530 lcr_fcr |= PNX8XXX_UART_LCR_RX_RST;
531
532 /* set the parity, stop bits and data size */
533 serial_out(sport, PNX8XXX_LCR, lcr_fcr);
534
535 /* set the baud rate */
536 quot -= 1;
537 serial_out(sport, PNX8XXX_BAUD, quot);
538
539 serial_out(sport, PNX8XXX_ICLR, -1);
540
541 serial_out(sport, PNX8XXX_IEN, old_ien);
542
543 if (UART_ENABLE_MS(&sport->port, termios->c_cflag))
544 pnx8xxx_enable_ms(&sport->port);
545
546 spin_unlock_irqrestore(&sport->port.lock, flags);
547}
548
549static const char *pnx8xxx_type(struct uart_port *port)
550{
551 struct pnx8xxx_port *sport = (struct pnx8xxx_port *)port;
552
553 return sport->port.type == PORT_PNX8XXX ? "PNX8XXX" : NULL;
554}
555
556/*
557 * Release the memory region(s) being used by 'port'.
558 */
559static void pnx8xxx_release_port(struct uart_port *port)
560{
561 struct pnx8xxx_port *sport = (struct pnx8xxx_port *)port;
562
563 release_mem_region(sport->port.mapbase, UART_PORT_SIZE);
564}
565
566/*
567 * Request the memory region(s) being used by 'port'.
568 */
569static int pnx8xxx_request_port(struct uart_port *port)
570{
571 struct pnx8xxx_port *sport = (struct pnx8xxx_port *)port;
572 return request_mem_region(sport->port.mapbase, UART_PORT_SIZE,
573 "pnx8xxx-uart") != NULL ? 0 : -EBUSY;
574}
575
576/*
577 * Configure/autoconfigure the port.
578 */
579static void pnx8xxx_config_port(struct uart_port *port, int flags)
580{
581 struct pnx8xxx_port *sport = (struct pnx8xxx_port *)port;
582
583 if (flags & UART_CONFIG_TYPE &&
584 pnx8xxx_request_port(&sport->port) == 0)
585 sport->port.type = PORT_PNX8XXX;
586}
587
588/*
589 * Verify the new serial_struct (for TIOCSSERIAL).
590 * The only change we allow are to the flags and type, and
591 * even then only between PORT_PNX8XXX and PORT_UNKNOWN
592 */
593static int
594pnx8xxx_verify_port(struct uart_port *port, struct serial_struct *ser)
595{
596 struct pnx8xxx_port *sport = (struct pnx8xxx_port *)port;
597 int ret = 0;
598
599 if (ser->type != PORT_UNKNOWN && ser->type != PORT_PNX8XXX)
600 ret = -EINVAL;
601 if (sport->port.irq != ser->irq)
602 ret = -EINVAL;
603 if (ser->io_type != SERIAL_IO_MEM)
604 ret = -EINVAL;
605 if (sport->port.uartclk / 16 != ser->baud_base)
606 ret = -EINVAL;
607 if ((void *)sport->port.mapbase != ser->iomem_base)
608 ret = -EINVAL;
609 if (sport->port.iobase != ser->port)
610 ret = -EINVAL;
611 if (ser->hub6 != 0)
612 ret = -EINVAL;
613 return ret;
614}
615
616static struct uart_ops pnx8xxx_pops = {
617 .tx_empty = pnx8xxx_tx_empty,
618 .set_mctrl = pnx8xxx_set_mctrl,
619 .get_mctrl = pnx8xxx_get_mctrl,
620 .stop_tx = pnx8xxx_stop_tx,
621 .start_tx = pnx8xxx_start_tx,
622 .stop_rx = pnx8xxx_stop_rx,
623 .enable_ms = pnx8xxx_enable_ms,
624 .break_ctl = pnx8xxx_break_ctl,
625 .startup = pnx8xxx_startup,
626 .shutdown = pnx8xxx_shutdown,
627 .set_termios = pnx8xxx_set_termios,
628 .type = pnx8xxx_type,
629 .release_port = pnx8xxx_release_port,
630 .request_port = pnx8xxx_request_port,
631 .config_port = pnx8xxx_config_port,
632 .verify_port = pnx8xxx_verify_port,
633};
634
635
636/*
637 * Setup the PNX8XXX serial ports.
638 *
639 * Note also that we support "console=ttySx" where "x" is either 0 or 1.
640 */
641static void __init pnx8xxx_init_ports(void)
642{
643 static int first = 1;
644 int i;
645
646 if (!first)
647 return;
648 first = 0;
649
650 for (i = 0; i < NR_PORTS; i++) {
651 init_timer(&pnx8xxx_ports[i].timer);
652 pnx8xxx_ports[i].timer.function = pnx8xxx_timeout;
653 pnx8xxx_ports[i].timer.data = (unsigned long)&pnx8xxx_ports[i];
654 pnx8xxx_ports[i].port.ops = &pnx8xxx_pops;
655 }
656}
657
658#ifdef CONFIG_SERIAL_PNX8XXX_CONSOLE
659
660static void pnx8xxx_console_putchar(struct uart_port *port, int ch)
661{
662 struct pnx8xxx_port *sport = (struct pnx8xxx_port *)port;
663 int status;
664
665 do {
666 /* Wait for UART_TX register to empty */
667 status = serial_in(sport, PNX8XXX_FIFO);
668 } while (status & PNX8XXX_UART_FIFO_TXFIFO);
669 serial_out(sport, PNX8XXX_FIFO, ch);
670}
671
672/*
673 * Interrupts are disabled on entering
674 */static void
675pnx8xxx_console_write(struct console *co, const char *s, unsigned int count)
676{
677 struct pnx8xxx_port *sport = &pnx8xxx_ports[co->index];
678 unsigned int old_ien, status;
679
680 /*
681 * First, save IEN and then disable interrupts
682 */
683 old_ien = serial_in(sport, PNX8XXX_IEN);
684 serial_out(sport, PNX8XXX_IEN, old_ien & ~(PNX8XXX_UART_INT_ALLTX |
685 PNX8XXX_UART_INT_ALLRX));
686
687 uart_console_write(&sport->port, s, count, pnx8xxx_console_putchar);
688
689 /*
690 * Finally, wait for transmitter to become empty
691 * and restore IEN
692 */
693 do {
694 /* Wait for UART_TX register to empty */
695 status = serial_in(sport, PNX8XXX_FIFO);
696 } while (status & PNX8XXX_UART_FIFO_TXFIFO);
697
698 /* Clear TX and EMPTY interrupt */
699 serial_out(sport, PNX8XXX_ICLR, PNX8XXX_UART_INT_TX |
700 PNX8XXX_UART_INT_EMPTY);
701
702 serial_out(sport, PNX8XXX_IEN, old_ien);
703}
704
705static int __init
706pnx8xxx_console_setup(struct console *co, char *options)
707{
708 struct pnx8xxx_port *sport;
709 int baud = 38400;
710 int bits = 8;
711 int parity = 'n';
712 int flow = 'n';
713
714 /*
715 * Check whether an invalid uart number has been specified, and
716 * if so, search for the first available port that does have
717 * console support.
718 */
719 if (co->index == -1 || co->index >= NR_PORTS)
720 co->index = 0;
721 sport = &pnx8xxx_ports[co->index];
722
723 if (options)
724 uart_parse_options(options, &baud, &parity, &bits, &flow);
725
726 return uart_set_options(&sport->port, co, baud, parity, bits, flow);
727}
728
729static struct uart_driver pnx8xxx_reg;
730static struct console pnx8xxx_console = {
731 .name = "ttyS",
732 .write = pnx8xxx_console_write,
733 .device = uart_console_device,
734 .setup = pnx8xxx_console_setup,
735 .flags = CON_PRINTBUFFER,
736 .index = -1,
737 .data = &pnx8xxx_reg,
738};
739
740static int __init pnx8xxx_rs_console_init(void)
741{
742 pnx8xxx_init_ports();
743 register_console(&pnx8xxx_console);
744 return 0;
745}
746console_initcall(pnx8xxx_rs_console_init);
747
748#define PNX8XXX_CONSOLE &pnx8xxx_console
749#else
750#define PNX8XXX_CONSOLE NULL
751#endif
752
753static struct uart_driver pnx8xxx_reg = {
754 .owner = THIS_MODULE,
755 .driver_name = "ttyS",
756 .dev_name = "ttyS",
757 .major = SERIAL_PNX8XXX_MAJOR,
758 .minor = MINOR_START,
759 .nr = NR_PORTS,
760 .cons = PNX8XXX_CONSOLE,
761};
762
763static int pnx8xxx_serial_suspend(struct platform_device *pdev, pm_message_t state)
764{
765 struct pnx8xxx_port *sport = platform_get_drvdata(pdev);
766
767 return uart_suspend_port(&pnx8xxx_reg, &sport->port);
768}
769
770static int pnx8xxx_serial_resume(struct platform_device *pdev)
771{
772 struct pnx8xxx_port *sport = platform_get_drvdata(pdev);
773
774 return uart_resume_port(&pnx8xxx_reg, &sport->port);
775}
776
777static int pnx8xxx_serial_probe(struct platform_device *pdev)
778{
779 struct resource *res = pdev->resource;
780 int i;
781
782 for (i = 0; i < pdev->num_resources; i++, res++) {
783 if (!(res->flags & IORESOURCE_MEM))
784 continue;
785
786 for (i = 0; i < NR_PORTS; i++) {
787 if (pnx8xxx_ports[i].port.mapbase != res->start)
788 continue;
789
790 pnx8xxx_ports[i].port.dev = &pdev->dev;
791 uart_add_one_port(&pnx8xxx_reg, &pnx8xxx_ports[i].port);
792 platform_set_drvdata(pdev, &pnx8xxx_ports[i]);
793 break;
794 }
795 }
796
797 return 0;
798}
799
800static int pnx8xxx_serial_remove(struct platform_device *pdev)
801{
802 struct pnx8xxx_port *sport = platform_get_drvdata(pdev);
803
804 platform_set_drvdata(pdev, NULL);
805
806 if (sport)
807 uart_remove_one_port(&pnx8xxx_reg, &sport->port);
808
809 return 0;
810}
811
812static struct platform_driver pnx8xxx_serial_driver = {
813 .driver = {
814 .name = "pnx8xxx-uart",
815 .owner = THIS_MODULE,
816 },
817 .probe = pnx8xxx_serial_probe,
818 .remove = pnx8xxx_serial_remove,
819 .suspend = pnx8xxx_serial_suspend,
820 .resume = pnx8xxx_serial_resume,
821};
822
823static int __init pnx8xxx_serial_init(void)
824{
825 int ret;
826
827 printk(KERN_INFO "Serial: PNX8XXX driver $Revision: 1.2 $\n");
828
829 pnx8xxx_init_ports();
830
831 ret = uart_register_driver(&pnx8xxx_reg);
832 if (ret == 0) {
833 ret = platform_driver_register(&pnx8xxx_serial_driver);
834 if (ret)
835 uart_unregister_driver(&pnx8xxx_reg);
836 }
837 return ret;
838}
839
840static void __exit pnx8xxx_serial_exit(void)
841{
842 platform_driver_unregister(&pnx8xxx_serial_driver);
843 uart_unregister_driver(&pnx8xxx_reg);
844}
845
846module_init(pnx8xxx_serial_init);
847module_exit(pnx8xxx_serial_exit);
848
849MODULE_AUTHOR("Embedded Alley Solutions, Inc.");
850MODULE_DESCRIPTION("PNX8XXX SoCs serial port driver");
851MODULE_LICENSE("GPL");
852MODULE_ALIAS_CHARDEV_MAJOR(SERIAL_PNX8XXX_MAJOR);
diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c
index f84982e508c7..0422c0f1f852 100644
--- a/drivers/serial/serial_core.c
+++ b/drivers/serial/serial_core.c
@@ -1523,9 +1523,8 @@ static struct uart_state *uart_get(struct uart_driver *drv, int line)
1523 } 1523 }
1524 1524
1525 if (!state->info) { 1525 if (!state->info) {
1526 state->info = kmalloc(sizeof(struct uart_info), GFP_KERNEL); 1526 state->info = kzalloc(sizeof(struct uart_info), GFP_KERNEL);
1527 if (state->info) { 1527 if (state->info) {
1528 memset(state->info, 0, sizeof(struct uart_info));
1529 init_waitqueue_head(&state->info->open_wait); 1528 init_waitqueue_head(&state->info->open_wait);
1530 init_waitqueue_head(&state->info->delta_msr_wait); 1529 init_waitqueue_head(&state->info->delta_msr_wait);
1531 1530
@@ -1660,6 +1659,7 @@ static const char *uart_type(struct uart_port *port)
1660static int uart_line_info(char *buf, struct uart_driver *drv, int i) 1659static int uart_line_info(char *buf, struct uart_driver *drv, int i)
1661{ 1660{
1662 struct uart_state *state = drv->state + i; 1661 struct uart_state *state = drv->state + i;
1662 int pm_state;
1663 struct uart_port *port = state->port; 1663 struct uart_port *port = state->port;
1664 char stat_buf[32]; 1664 char stat_buf[32];
1665 unsigned int status; 1665 unsigned int status;
@@ -1682,9 +1682,16 @@ static int uart_line_info(char *buf, struct uart_driver *drv, int i)
1682 1682
1683 if(capable(CAP_SYS_ADMIN)) 1683 if(capable(CAP_SYS_ADMIN))
1684 { 1684 {
1685 mutex_lock(&state->mutex);
1686 pm_state = state->pm_state;
1687 if (pm_state)
1688 uart_change_pm(state, 0);
1685 spin_lock_irq(&port->lock); 1689 spin_lock_irq(&port->lock);
1686 status = port->ops->get_mctrl(port); 1690 status = port->ops->get_mctrl(port);
1687 spin_unlock_irq(&port->lock); 1691 spin_unlock_irq(&port->lock);
1692 if (pm_state)
1693 uart_change_pm(state, pm_state);
1694 mutex_unlock(&state->mutex);
1688 1695
1689 ret += sprintf(buf + ret, " tx:%d rx:%d", 1696 ret += sprintf(buf + ret, " tx:%d rx:%d",
1690 port->icount.tx, port->icount.rx); 1697 port->icount.tx, port->icount.rx);
@@ -2100,6 +2107,9 @@ uart_configure_port(struct uart_driver *drv, struct uart_state *state,
2100 2107
2101 uart_report_port(drv, port); 2108 uart_report_port(drv, port);
2102 2109
2110 /* Power up port for set_mctrl() */
2111 uart_change_pm(state, 0);
2112
2103 /* 2113 /*
2104 * Ensure that the modem control lines are de-activated. 2114 * Ensure that the modem control lines are de-activated.
2105 * We probably don't need a spinlock around this, but 2115 * We probably don't need a spinlock around this, but
@@ -2167,13 +2177,11 @@ int uart_register_driver(struct uart_driver *drv)
2167 * Maybe we should be using a slab cache for this, especially if 2177 * Maybe we should be using a slab cache for this, especially if
2168 * we have a large number of ports to handle. 2178 * we have a large number of ports to handle.
2169 */ 2179 */
2170 drv->state = kmalloc(sizeof(struct uart_state) * drv->nr, GFP_KERNEL); 2180 drv->state = kzalloc(sizeof(struct uart_state) * drv->nr, GFP_KERNEL);
2171 retval = -ENOMEM; 2181 retval = -ENOMEM;
2172 if (!drv->state) 2182 if (!drv->state)
2173 goto out; 2183 goto out;
2174 2184
2175 memset(drv->state, 0, sizeof(struct uart_state) * drv->nr);
2176
2177 normal = alloc_tty_driver(drv->nr); 2185 normal = alloc_tty_driver(drv->nr);
2178 if (!normal) 2186 if (!normal)
2179 goto out; 2187 goto out;
diff --git a/drivers/serial/serial_cs.c b/drivers/serial/serial_cs.c
index 431433f4dd6d..c2f1012449da 100644
--- a/drivers/serial/serial_cs.c
+++ b/drivers/serial/serial_cs.c
@@ -35,7 +35,6 @@
35#include <linux/moduleparam.h> 35#include <linux/moduleparam.h>
36#include <linux/kernel.h> 36#include <linux/kernel.h>
37#include <linux/init.h> 37#include <linux/init.h>
38#include <linux/sched.h>
39#include <linux/ptrace.h> 38#include <linux/ptrace.h>
40#include <linux/slab.h> 39#include <linux/slab.h>
41#include <linux/string.h> 40#include <linux/string.h>
@@ -334,10 +333,9 @@ static int serial_probe(struct pcmcia_device *link)
334 DEBUG(0, "serial_attach()\n"); 333 DEBUG(0, "serial_attach()\n");
335 334
336 /* Create new serial device */ 335 /* Create new serial device */
337 info = kmalloc(sizeof (*info), GFP_KERNEL); 336 info = kzalloc(sizeof (*info), GFP_KERNEL);
338 if (!info) 337 if (!info)
339 return -ENOMEM; 338 return -ENOMEM;
340 memset(info, 0, sizeof (*info));
341 info->p_dev = link; 339 info->p_dev = link;
342 link->priv = info; 340 link->priv = info;
343 341
diff --git a/drivers/serial/sunsab.c b/drivers/serial/sunsab.c
index 145d6236954b..deb9ab4b5a0b 100644
--- a/drivers/serial/sunsab.c
+++ b/drivers/serial/sunsab.c
@@ -17,7 +17,6 @@
17 17
18#include <linux/module.h> 18#include <linux/module.h>
19#include <linux/kernel.h> 19#include <linux/kernel.h>
20#include <linux/sched.h>
21#include <linux/errno.h> 20#include <linux/errno.h>
22#include <linux/tty.h> 21#include <linux/tty.h>
23#include <linux/tty_flip.h> 22#include <linux/tty_flip.h>
diff --git a/drivers/serial/sunsu.c b/drivers/serial/sunsu.c
index 3ec3df21816b..96a852aa1903 100644
--- a/drivers/serial/sunsu.c
+++ b/drivers/serial/sunsu.c
@@ -17,7 +17,6 @@
17 17
18#include <linux/module.h> 18#include <linux/module.h>
19#include <linux/kernel.h> 19#include <linux/kernel.h>
20#include <linux/sched.h>
21#include <linux/spinlock.h> 20#include <linux/spinlock.h>
22#include <linux/errno.h> 21#include <linux/errno.h>
23#include <linux/tty.h> 22#include <linux/tty.h>
diff --git a/drivers/serial/sunzilog.c b/drivers/serial/sunzilog.c
index 244f796dc625..da73205e54cd 100644
--- a/drivers/serial/sunzilog.c
+++ b/drivers/serial/sunzilog.c
@@ -14,7 +14,6 @@
14 14
15#include <linux/module.h> 15#include <linux/module.h>
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <linux/sched.h>
18#include <linux/errno.h> 17#include <linux/errno.h>
19#include <linux/delay.h> 18#include <linux/delay.h>
20#include <linux/tty.h> 19#include <linux/tty.h>
diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
index 9052f4c3493b..7e54e48efd5c 100644
--- a/drivers/spi/Kconfig
+++ b/drivers/spi/Kconfig
@@ -51,6 +51,13 @@ config SPI_MASTER
51comment "SPI Master Controller Drivers" 51comment "SPI Master Controller Drivers"
52 depends on SPI_MASTER 52 depends on SPI_MASTER
53 53
54config SPI_ATMEL
55 tristate "Atmel SPI Controller"
56 depends on (ARCH_AT91 || AVR32) && SPI_MASTER
57 help
58 This selects a driver for the Atmel SPI Controller, present on
59 many AT32 (AVR32) and AT91 (ARM) chips.
60
54config SPI_BITBANG 61config SPI_BITBANG
55 tristate "Bitbanging SPI master" 62 tristate "Bitbanging SPI master"
56 depends on SPI_MASTER && EXPERIMENTAL 63 depends on SPI_MASTER && EXPERIMENTAL
diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile
index bf271fe4e536..3c280ad89202 100644
--- a/drivers/spi/Makefile
+++ b/drivers/spi/Makefile
@@ -12,6 +12,7 @@ obj-$(CONFIG_SPI_MASTER) += spi.o
12 12
13# SPI master controller drivers (bus) 13# SPI master controller drivers (bus)
14obj-$(CONFIG_SPI_BITBANG) += spi_bitbang.o 14obj-$(CONFIG_SPI_BITBANG) += spi_bitbang.o
15obj-$(CONFIG_SPI_ATMEL) += atmel_spi.o
15obj-$(CONFIG_SPI_BUTTERFLY) += spi_butterfly.o 16obj-$(CONFIG_SPI_BUTTERFLY) += spi_butterfly.o
16obj-$(CONFIG_SPI_IMX) += spi_imx.o 17obj-$(CONFIG_SPI_IMX) += spi_imx.o
17obj-$(CONFIG_SPI_PXA2XX) += pxa2xx_spi.o 18obj-$(CONFIG_SPI_PXA2XX) += pxa2xx_spi.o
diff --git a/drivers/spi/atmel_spi.c b/drivers/spi/atmel_spi.c
new file mode 100644
index 000000000000..c2a9fef58edc
--- /dev/null
+++ b/drivers/spi/atmel_spi.c
@@ -0,0 +1,678 @@
1/*
2 * Driver for Atmel AT32 and AT91 SPI Controllers
3 *
4 * Copyright (C) 2006 Atmel Corporation
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/clk.h>
14#include <linux/module.h>
15#include <linux/platform_device.h>
16#include <linux/delay.h>
17#include <linux/dma-mapping.h>
18#include <linux/err.h>
19#include <linux/interrupt.h>
20#include <linux/spi/spi.h>
21
22#include <asm/io.h>
23#include <asm/arch/board.h>
24#include <asm/arch/gpio.h>
25
26#include "atmel_spi.h"
27
28/*
29 * The core SPI transfer engine just talks to a register bank to set up
30 * DMA transfers; transfer queue progress is driven by IRQs. The clock
31 * framework provides the base clock, subdivided for each spi_device.
32 *
33 * Newer controllers, marked with "new_1" flag, have:
34 * - CR.LASTXFER
35 * - SPI_MR.DIV32 may become FDIV or must-be-zero (here: always zero)
36 * - SPI_SR.TXEMPTY, SPI_SR.NSSR (and corresponding irqs)
37 * - SPI_CSRx.CSAAT
38 * - SPI_CSRx.SBCR allows faster clocking
39 */
40struct atmel_spi {
41 spinlock_t lock;
42
43 void __iomem *regs;
44 int irq;
45 struct clk *clk;
46 struct platform_device *pdev;
47 unsigned new_1:1;
48
49 u8 stopping;
50 struct list_head queue;
51 struct spi_transfer *current_transfer;
52 unsigned long remaining_bytes;
53
54 void *buffer;
55 dma_addr_t buffer_dma;
56};
57
58#define BUFFER_SIZE PAGE_SIZE
59#define INVALID_DMA_ADDRESS 0xffffffff
60
61/*
62 * Earlier SPI controllers (e.g. on at91rm9200) have a design bug whereby
63 * they assume that spi slave device state will not change on deselect, so
64 * that automagic deselection is OK. Not so! Workaround uses nCSx pins
65 * as GPIOs; or newer controllers have CSAAT and friends.
66 *
67 * Since the CSAAT functionality is a bit weird on newer controllers
68 * as well, we use GPIO to control nCSx pins on all controllers.
69 */
70
71static inline void cs_activate(struct spi_device *spi)
72{
73 unsigned gpio = (unsigned) spi->controller_data;
74 unsigned active = spi->mode & SPI_CS_HIGH;
75
76 dev_dbg(&spi->dev, "activate %u%s\n", gpio, active ? " (high)" : "");
77 gpio_set_value(gpio, active);
78}
79
80static inline void cs_deactivate(struct spi_device *spi)
81{
82 unsigned gpio = (unsigned) spi->controller_data;
83 unsigned active = spi->mode & SPI_CS_HIGH;
84
85 dev_dbg(&spi->dev, "DEactivate %u%s\n", gpio, active ? " (low)" : "");
86 gpio_set_value(gpio, !active);
87}
88
89/*
90 * Submit next transfer for DMA.
91 * lock is held, spi irq is blocked
92 */
93static void atmel_spi_next_xfer(struct spi_master *master,
94 struct spi_message *msg)
95{
96 struct atmel_spi *as = spi_master_get_devdata(master);
97 struct spi_transfer *xfer;
98 u32 len;
99 dma_addr_t tx_dma, rx_dma;
100
101 xfer = as->current_transfer;
102 if (!xfer || as->remaining_bytes == 0) {
103 if (xfer)
104 xfer = list_entry(xfer->transfer_list.next,
105 struct spi_transfer, transfer_list);
106 else
107 xfer = list_entry(msg->transfers.next,
108 struct spi_transfer, transfer_list);
109 as->remaining_bytes = xfer->len;
110 as->current_transfer = xfer;
111 }
112
113 len = as->remaining_bytes;
114
115 tx_dma = xfer->tx_dma;
116 rx_dma = xfer->rx_dma;
117
118 /* use scratch buffer only when rx or tx data is unspecified */
119 if (rx_dma == INVALID_DMA_ADDRESS) {
120 rx_dma = as->buffer_dma;
121 if (len > BUFFER_SIZE)
122 len = BUFFER_SIZE;
123 }
124 if (tx_dma == INVALID_DMA_ADDRESS) {
125 tx_dma = as->buffer_dma;
126 if (len > BUFFER_SIZE)
127 len = BUFFER_SIZE;
128 memset(as->buffer, 0, len);
129 dma_sync_single_for_device(&as->pdev->dev,
130 as->buffer_dma, len, DMA_TO_DEVICE);
131 }
132
133 spi_writel(as, RPR, rx_dma);
134 spi_writel(as, TPR, tx_dma);
135
136 as->remaining_bytes -= len;
137 if (msg->spi->bits_per_word > 8)
138 len >>= 1;
139
140 /* REVISIT: when xfer->delay_usecs == 0, the PDC "next transfer"
141 * mechanism might help avoid the IRQ latency between transfers
142 *
143 * We're also waiting for ENDRX before we start the next
144 * transfer because we need to handle some difficult timing
145 * issues otherwise. If we wait for ENDTX in one transfer and
146 * then starts waiting for ENDRX in the next, it's difficult
147 * to tell the difference between the ENDRX interrupt we're
148 * actually waiting for and the ENDRX interrupt of the
149 * previous transfer.
150 *
151 * It should be doable, though. Just not now...
152 */
153 spi_writel(as, TNCR, 0);
154 spi_writel(as, RNCR, 0);
155 spi_writel(as, IER, SPI_BIT(ENDRX) | SPI_BIT(OVRES));
156
157 dev_dbg(&msg->spi->dev,
158 " start xfer %p: len %u tx %p/%08x rx %p/%08x imr %03x\n",
159 xfer, xfer->len, xfer->tx_buf, xfer->tx_dma,
160 xfer->rx_buf, xfer->rx_dma, spi_readl(as, IMR));
161
162 spi_writel(as, TCR, len);
163 spi_writel(as, RCR, len);
164 spi_writel(as, PTCR, SPI_BIT(TXTEN) | SPI_BIT(RXTEN));
165}
166
167static void atmel_spi_next_message(struct spi_master *master)
168{
169 struct atmel_spi *as = spi_master_get_devdata(master);
170 struct spi_message *msg;
171 u32 mr;
172
173 BUG_ON(as->current_transfer);
174
175 msg = list_entry(as->queue.next, struct spi_message, queue);
176
177 /* Select the chip */
178 mr = spi_readl(as, MR);
179 mr = SPI_BFINS(PCS, ~(1 << msg->spi->chip_select), mr);
180 spi_writel(as, MR, mr);
181 cs_activate(msg->spi);
182
183 atmel_spi_next_xfer(master, msg);
184}
185
186static void
187atmel_spi_dma_map_xfer(struct atmel_spi *as, struct spi_transfer *xfer)
188{
189 xfer->tx_dma = xfer->rx_dma = INVALID_DMA_ADDRESS;
190 if (xfer->tx_buf)
191 xfer->tx_dma = dma_map_single(&as->pdev->dev,
192 (void *) xfer->tx_buf, xfer->len,
193 DMA_TO_DEVICE);
194 if (xfer->rx_buf)
195 xfer->rx_dma = dma_map_single(&as->pdev->dev,
196 xfer->rx_buf, xfer->len,
197 DMA_FROM_DEVICE);
198}
199
200static void atmel_spi_dma_unmap_xfer(struct spi_master *master,
201 struct spi_transfer *xfer)
202{
203 if (xfer->tx_dma != INVALID_DMA_ADDRESS)
204 dma_unmap_single(master->cdev.dev, xfer->tx_dma,
205 xfer->len, DMA_TO_DEVICE);
206 if (xfer->rx_dma != INVALID_DMA_ADDRESS)
207 dma_unmap_single(master->cdev.dev, xfer->rx_dma,
208 xfer->len, DMA_FROM_DEVICE);
209}
210
211static void
212atmel_spi_msg_done(struct spi_master *master, struct atmel_spi *as,
213 struct spi_message *msg, int status)
214{
215 cs_deactivate(msg->spi);
216 list_del(&msg->queue);
217 msg->status = status;
218
219 dev_dbg(master->cdev.dev,
220 "xfer complete: %u bytes transferred\n",
221 msg->actual_length);
222
223 spin_unlock(&as->lock);
224 msg->complete(msg->context);
225 spin_lock(&as->lock);
226
227 as->current_transfer = NULL;
228
229 /* continue if needed */
230 if (list_empty(&as->queue) || as->stopping)
231 spi_writel(as, PTCR, SPI_BIT(RXTDIS) | SPI_BIT(TXTDIS));
232 else
233 atmel_spi_next_message(master);
234}
235
236static irqreturn_t
237atmel_spi_interrupt(int irq, void *dev_id)
238{
239 struct spi_master *master = dev_id;
240 struct atmel_spi *as = spi_master_get_devdata(master);
241 struct spi_message *msg;
242 struct spi_transfer *xfer;
243 u32 status, pending, imr;
244 int ret = IRQ_NONE;
245
246 spin_lock(&as->lock);
247
248 xfer = as->current_transfer;
249 msg = list_entry(as->queue.next, struct spi_message, queue);
250
251 imr = spi_readl(as, IMR);
252 status = spi_readl(as, SR);
253 pending = status & imr;
254
255 if (pending & SPI_BIT(OVRES)) {
256 int timeout;
257
258 ret = IRQ_HANDLED;
259
260 spi_writel(as, IDR, (SPI_BIT(ENDTX) | SPI_BIT(ENDRX)
261 | SPI_BIT(OVRES)));
262
263 /*
264 * When we get an overrun, we disregard the current
265 * transfer. Data will not be copied back from any
266 * bounce buffer and msg->actual_len will not be
267 * updated with the last xfer.
268 *
269 * We will also not process any remaning transfers in
270 * the message.
271 *
272 * First, stop the transfer and unmap the DMA buffers.
273 */
274 spi_writel(as, PTCR, SPI_BIT(RXTDIS) | SPI_BIT(TXTDIS));
275 if (!msg->is_dma_mapped)
276 atmel_spi_dma_unmap_xfer(master, xfer);
277
278 /* REVISIT: udelay in irq is unfriendly */
279 if (xfer->delay_usecs)
280 udelay(xfer->delay_usecs);
281
282 dev_warn(master->cdev.dev, "fifo overrun (%u/%u remaining)\n",
283 spi_readl(as, TCR), spi_readl(as, RCR));
284
285 /*
286 * Clean up DMA registers and make sure the data
287 * registers are empty.
288 */
289 spi_writel(as, RNCR, 0);
290 spi_writel(as, TNCR, 0);
291 spi_writel(as, RCR, 0);
292 spi_writel(as, TCR, 0);
293 for (timeout = 1000; timeout; timeout--)
294 if (spi_readl(as, SR) & SPI_BIT(TXEMPTY))
295 break;
296 if (!timeout)
297 dev_warn(master->cdev.dev,
298 "timeout waiting for TXEMPTY");
299 while (spi_readl(as, SR) & SPI_BIT(RDRF))
300 spi_readl(as, RDR);
301
302 /* Clear any overrun happening while cleaning up */
303 spi_readl(as, SR);
304
305 atmel_spi_msg_done(master, as, msg, -EIO);
306 } else if (pending & SPI_BIT(ENDRX)) {
307 ret = IRQ_HANDLED;
308
309 spi_writel(as, IDR, pending);
310
311 if (as->remaining_bytes == 0) {
312 msg->actual_length += xfer->len;
313
314 if (!msg->is_dma_mapped)
315 atmel_spi_dma_unmap_xfer(master, xfer);
316
317 /* REVISIT: udelay in irq is unfriendly */
318 if (xfer->delay_usecs)
319 udelay(xfer->delay_usecs);
320
321 if (msg->transfers.prev == &xfer->transfer_list) {
322 /* report completed message */
323 atmel_spi_msg_done(master, as, msg, 0);
324 } else {
325 if (xfer->cs_change) {
326 cs_deactivate(msg->spi);
327 udelay(1);
328 cs_activate(msg->spi);
329 }
330
331 /*
332 * Not done yet. Submit the next transfer.
333 *
334 * FIXME handle protocol options for xfer
335 */
336 atmel_spi_next_xfer(master, msg);
337 }
338 } else {
339 /*
340 * Keep going, we still have data to send in
341 * the current transfer.
342 */
343 atmel_spi_next_xfer(master, msg);
344 }
345 }
346
347 spin_unlock(&as->lock);
348
349 return ret;
350}
351
352#define MODEBITS (SPI_CPOL | SPI_CPHA | SPI_CS_HIGH)
353
354static int atmel_spi_setup(struct spi_device *spi)
355{
356 struct atmel_spi *as;
357 u32 scbr, csr;
358 unsigned int bits = spi->bits_per_word;
359 unsigned long bus_hz, sck_hz;
360 unsigned int npcs_pin;
361 int ret;
362
363 as = spi_master_get_devdata(spi->master);
364
365 if (as->stopping)
366 return -ESHUTDOWN;
367
368 if (spi->chip_select > spi->master->num_chipselect) {
369 dev_dbg(&spi->dev,
370 "setup: invalid chipselect %u (%u defined)\n",
371 spi->chip_select, spi->master->num_chipselect);
372 return -EINVAL;
373 }
374
375 if (bits == 0)
376 bits = 8;
377 if (bits < 8 || bits > 16) {
378 dev_dbg(&spi->dev,
379 "setup: invalid bits_per_word %u (8 to 16)\n",
380 bits);
381 return -EINVAL;
382 }
383
384 if (spi->mode & ~MODEBITS) {
385 dev_dbg(&spi->dev, "setup: unsupported mode bits %x\n",
386 spi->mode & ~MODEBITS);
387 return -EINVAL;
388 }
389
390 /* speed zero convention is used by some upper layers */
391 bus_hz = clk_get_rate(as->clk);
392 if (spi->max_speed_hz) {
393 /* assume div32/fdiv/mbz == 0 */
394 if (!as->new_1)
395 bus_hz /= 2;
396 scbr = ((bus_hz + spi->max_speed_hz - 1)
397 / spi->max_speed_hz);
398 if (scbr >= (1 << SPI_SCBR_SIZE)) {
399 dev_dbg(&spi->dev, "setup: %d Hz too slow, scbr %u\n",
400 spi->max_speed_hz, scbr);
401 return -EINVAL;
402 }
403 } else
404 scbr = 0xff;
405 sck_hz = bus_hz / scbr;
406
407 csr = SPI_BF(SCBR, scbr) | SPI_BF(BITS, bits - 8);
408 if (spi->mode & SPI_CPOL)
409 csr |= SPI_BIT(CPOL);
410 if (!(spi->mode & SPI_CPHA))
411 csr |= SPI_BIT(NCPHA);
412
413 /* TODO: DLYBS and DLYBCT */
414 csr |= SPI_BF(DLYBS, 10);
415 csr |= SPI_BF(DLYBCT, 10);
416
417 /* chipselect must have been muxed as GPIO (e.g. in board setup) */
418 npcs_pin = (unsigned int)spi->controller_data;
419 if (!spi->controller_state) {
420 ret = gpio_request(npcs_pin, "spi_npcs");
421 if (ret)
422 return ret;
423 spi->controller_state = (void *)npcs_pin;
424 gpio_direction_output(npcs_pin);
425 }
426
427 dev_dbg(&spi->dev,
428 "setup: %lu Hz bpw %u mode 0x%x -> csr%d %08x\n",
429 sck_hz, bits, spi->mode, spi->chip_select, csr);
430
431 spi_writel(as, CSR0 + 4 * spi->chip_select, csr);
432
433 return 0;
434}
435
436static int atmel_spi_transfer(struct spi_device *spi, struct spi_message *msg)
437{
438 struct atmel_spi *as;
439 struct spi_transfer *xfer;
440 unsigned long flags;
441 struct device *controller = spi->master->cdev.dev;
442
443 as = spi_master_get_devdata(spi->master);
444
445 dev_dbg(controller, "new message %p submitted for %s\n",
446 msg, spi->dev.bus_id);
447
448 if (unlikely(list_empty(&msg->transfers)
449 || !spi->max_speed_hz))
450 return -EINVAL;
451
452 if (as->stopping)
453 return -ESHUTDOWN;
454
455 list_for_each_entry(xfer, &msg->transfers, transfer_list) {
456 if (!(xfer->tx_buf || xfer->rx_buf)) {
457 dev_dbg(&spi->dev, "missing rx or tx buf\n");
458 return -EINVAL;
459 }
460
461 /* FIXME implement these protocol options!! */
462 if (xfer->bits_per_word || xfer->speed_hz) {
463 dev_dbg(&spi->dev, "no protocol options yet\n");
464 return -ENOPROTOOPT;
465 }
466 }
467
468 /* scrub dcache "early" */
469 if (!msg->is_dma_mapped) {
470 list_for_each_entry(xfer, &msg->transfers, transfer_list)
471 atmel_spi_dma_map_xfer(as, xfer);
472 }
473
474 list_for_each_entry(xfer, &msg->transfers, transfer_list) {
475 dev_dbg(controller,
476 " xfer %p: len %u tx %p/%08x rx %p/%08x\n",
477 xfer, xfer->len,
478 xfer->tx_buf, xfer->tx_dma,
479 xfer->rx_buf, xfer->rx_dma);
480 }
481
482 msg->status = -EINPROGRESS;
483 msg->actual_length = 0;
484
485 spin_lock_irqsave(&as->lock, flags);
486 list_add_tail(&msg->queue, &as->queue);
487 if (!as->current_transfer)
488 atmel_spi_next_message(spi->master);
489 spin_unlock_irqrestore(&as->lock, flags);
490
491 return 0;
492}
493
494static void atmel_spi_cleanup(const struct spi_device *spi)
495{
496 if (spi->controller_state)
497 gpio_free((unsigned int)spi->controller_data);
498}
499
500/*-------------------------------------------------------------------------*/
501
502static int __init atmel_spi_probe(struct platform_device *pdev)
503{
504 struct resource *regs;
505 int irq;
506 struct clk *clk;
507 int ret;
508 struct spi_master *master;
509 struct atmel_spi *as;
510
511 regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
512 if (!regs)
513 return -ENXIO;
514
515 irq = platform_get_irq(pdev, 0);
516 if (irq < 0)
517 return irq;
518
519 clk = clk_get(&pdev->dev, "spi_clk");
520 if (IS_ERR(clk))
521 return PTR_ERR(clk);
522
523 /* setup spi core then atmel-specific driver state */
524 ret = -ENOMEM;
525 master = spi_alloc_master(&pdev->dev, sizeof *as);
526 if (!master)
527 goto out_free;
528
529 master->bus_num = pdev->id;
530 master->num_chipselect = 4;
531 master->setup = atmel_spi_setup;
532 master->transfer = atmel_spi_transfer;
533 master->cleanup = atmel_spi_cleanup;
534 platform_set_drvdata(pdev, master);
535
536 as = spi_master_get_devdata(master);
537
538 as->buffer = dma_alloc_coherent(&pdev->dev, BUFFER_SIZE,
539 &as->buffer_dma, GFP_KERNEL);
540 if (!as->buffer)
541 goto out_free;
542
543 spin_lock_init(&as->lock);
544 INIT_LIST_HEAD(&as->queue);
545 as->pdev = pdev;
546 as->regs = ioremap(regs->start, (regs->end - regs->start) + 1);
547 if (!as->regs)
548 goto out_free_buffer;
549 as->irq = irq;
550 as->clk = clk;
551#ifdef CONFIG_ARCH_AT91
552 if (!cpu_is_at91rm9200())
553 as->new_1 = 1;
554#endif
555
556 ret = request_irq(irq, atmel_spi_interrupt, 0,
557 pdev->dev.bus_id, master);
558 if (ret)
559 goto out_unmap_regs;
560
561 /* Initialize the hardware */
562 clk_enable(clk);
563 spi_writel(as, CR, SPI_BIT(SWRST));
564 spi_writel(as, MR, SPI_BIT(MSTR) | SPI_BIT(MODFDIS));
565 spi_writel(as, PTCR, SPI_BIT(RXTDIS) | SPI_BIT(TXTDIS));
566 spi_writel(as, CR, SPI_BIT(SPIEN));
567
568 /* go! */
569 dev_info(&pdev->dev, "Atmel SPI Controller at 0x%08lx (irq %d)\n",
570 (unsigned long)regs->start, irq);
571
572 ret = spi_register_master(master);
573 if (ret)
574 goto out_reset_hw;
575
576 return 0;
577
578out_reset_hw:
579 spi_writel(as, CR, SPI_BIT(SWRST));
580 clk_disable(clk);
581 free_irq(irq, master);
582out_unmap_regs:
583 iounmap(as->regs);
584out_free_buffer:
585 dma_free_coherent(&pdev->dev, BUFFER_SIZE, as->buffer,
586 as->buffer_dma);
587out_free:
588 clk_put(clk);
589 spi_master_put(master);
590 return ret;
591}
592
593static int __exit atmel_spi_remove(struct platform_device *pdev)
594{
595 struct spi_master *master = platform_get_drvdata(pdev);
596 struct atmel_spi *as = spi_master_get_devdata(master);
597 struct spi_message *msg;
598
599 /* reset the hardware and block queue progress */
600 spin_lock_irq(&as->lock);
601 as->stopping = 1;
602 spi_writel(as, CR, SPI_BIT(SWRST));
603 spi_readl(as, SR);
604 spin_unlock_irq(&as->lock);
605
606 /* Terminate remaining queued transfers */
607 list_for_each_entry(msg, &as->queue, queue) {
608 /* REVISIT unmapping the dma is a NOP on ARM and AVR32
609 * but we shouldn't depend on that...
610 */
611 msg->status = -ESHUTDOWN;
612 msg->complete(msg->context);
613 }
614
615 dma_free_coherent(&pdev->dev, BUFFER_SIZE, as->buffer,
616 as->buffer_dma);
617
618 clk_disable(as->clk);
619 clk_put(as->clk);
620 free_irq(as->irq, master);
621 iounmap(as->regs);
622
623 spi_unregister_master(master);
624
625 return 0;
626}
627
628#ifdef CONFIG_PM
629
630static int atmel_spi_suspend(struct platform_device *pdev, pm_message_t mesg)
631{
632 struct spi_master *master = platform_get_drvdata(pdev);
633 struct atmel_spi *as = spi_master_get_devdata(master);
634
635 clk_disable(as->clk);
636 return 0;
637}
638
639static int atmel_spi_resume(struct platform_device *pdev)
640{
641 struct spi_master *master = platform_get_drvdata(pdev);
642 struct atmel_spi *as = spi_master_get_devdata(master);
643
644 clk_enable(as->clk);
645 return 0;
646}
647
648#else
649#define atmel_spi_suspend NULL
650#define atmel_spi_resume NULL
651#endif
652
653
654static struct platform_driver atmel_spi_driver = {
655 .driver = {
656 .name = "atmel_spi",
657 .owner = THIS_MODULE,
658 },
659 .suspend = atmel_spi_suspend,
660 .resume = atmel_spi_resume,
661 .remove = __exit_p(atmel_spi_remove),
662};
663
664static int __init atmel_spi_init(void)
665{
666 return platform_driver_probe(&atmel_spi_driver, atmel_spi_probe);
667}
668module_init(atmel_spi_init);
669
670static void __exit atmel_spi_exit(void)
671{
672 platform_driver_unregister(&atmel_spi_driver);
673}
674module_exit(atmel_spi_exit);
675
676MODULE_DESCRIPTION("Atmel AT32/AT91 SPI Controller driver");
677MODULE_AUTHOR("Haavard Skinnemoen <hskinnemoen@atmel.com>");
678MODULE_LICENSE("GPL");
diff --git a/drivers/spi/atmel_spi.h b/drivers/spi/atmel_spi.h
new file mode 100644
index 000000000000..6e06b6ad3a45
--- /dev/null
+++ b/drivers/spi/atmel_spi.h
@@ -0,0 +1,167 @@
1/*
2 * Register definitions for Atmel Serial Peripheral Interface (SPI)
3 *
4 * Copyright (C) 2006 Atmel Corporation
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#ifndef __ATMEL_SPI_H__
11#define __ATMEL_SPI_H__
12
13/* SPI register offsets */
14#define SPI_CR 0x0000
15#define SPI_MR 0x0004
16#define SPI_RDR 0x0008
17#define SPI_TDR 0x000c
18#define SPI_SR 0x0010
19#define SPI_IER 0x0014
20#define SPI_IDR 0x0018
21#define SPI_IMR 0x001c
22#define SPI_CSR0 0x0030
23#define SPI_CSR1 0x0034
24#define SPI_CSR2 0x0038
25#define SPI_CSR3 0x003c
26#define SPI_RPR 0x0100
27#define SPI_RCR 0x0104
28#define SPI_TPR 0x0108
29#define SPI_TCR 0x010c
30#define SPI_RNPR 0x0110
31#define SPI_RNCR 0x0114
32#define SPI_TNPR 0x0118
33#define SPI_TNCR 0x011c
34#define SPI_PTCR 0x0120
35#define SPI_PTSR 0x0124
36
37/* Bitfields in CR */
38#define SPI_SPIEN_OFFSET 0
39#define SPI_SPIEN_SIZE 1
40#define SPI_SPIDIS_OFFSET 1
41#define SPI_SPIDIS_SIZE 1
42#define SPI_SWRST_OFFSET 7
43#define SPI_SWRST_SIZE 1
44#define SPI_LASTXFER_OFFSET 24
45#define SPI_LASTXFER_SIZE 1
46
47/* Bitfields in MR */
48#define SPI_MSTR_OFFSET 0
49#define SPI_MSTR_SIZE 1
50#define SPI_PS_OFFSET 1
51#define SPI_PS_SIZE 1
52#define SPI_PCSDEC_OFFSET 2
53#define SPI_PCSDEC_SIZE 1
54#define SPI_FDIV_OFFSET 3
55#define SPI_FDIV_SIZE 1
56#define SPI_MODFDIS_OFFSET 4
57#define SPI_MODFDIS_SIZE 1
58#define SPI_LLB_OFFSET 7
59#define SPI_LLB_SIZE 1
60#define SPI_PCS_OFFSET 16
61#define SPI_PCS_SIZE 4
62#define SPI_DLYBCS_OFFSET 24
63#define SPI_DLYBCS_SIZE 8
64
65/* Bitfields in RDR */
66#define SPI_RD_OFFSET 0
67#define SPI_RD_SIZE 16
68
69/* Bitfields in TDR */
70#define SPI_TD_OFFSET 0
71#define SPI_TD_SIZE 16
72
73/* Bitfields in SR */
74#define SPI_RDRF_OFFSET 0
75#define SPI_RDRF_SIZE 1
76#define SPI_TDRE_OFFSET 1
77#define SPI_TDRE_SIZE 1
78#define SPI_MODF_OFFSET 2
79#define SPI_MODF_SIZE 1
80#define SPI_OVRES_OFFSET 3
81#define SPI_OVRES_SIZE 1
82#define SPI_ENDRX_OFFSET 4
83#define SPI_ENDRX_SIZE 1
84#define SPI_ENDTX_OFFSET 5
85#define SPI_ENDTX_SIZE 1
86#define SPI_RXBUFF_OFFSET 6
87#define SPI_RXBUFF_SIZE 1
88#define SPI_TXBUFE_OFFSET 7
89#define SPI_TXBUFE_SIZE 1
90#define SPI_NSSR_OFFSET 8
91#define SPI_NSSR_SIZE 1
92#define SPI_TXEMPTY_OFFSET 9
93#define SPI_TXEMPTY_SIZE 1
94#define SPI_SPIENS_OFFSET 16
95#define SPI_SPIENS_SIZE 1
96
97/* Bitfields in CSR0 */
98#define SPI_CPOL_OFFSET 0
99#define SPI_CPOL_SIZE 1
100#define SPI_NCPHA_OFFSET 1
101#define SPI_NCPHA_SIZE 1
102#define SPI_CSAAT_OFFSET 3
103#define SPI_CSAAT_SIZE 1
104#define SPI_BITS_OFFSET 4
105#define SPI_BITS_SIZE 4
106#define SPI_SCBR_OFFSET 8
107#define SPI_SCBR_SIZE 8
108#define SPI_DLYBS_OFFSET 16
109#define SPI_DLYBS_SIZE 8
110#define SPI_DLYBCT_OFFSET 24
111#define SPI_DLYBCT_SIZE 8
112
113/* Bitfields in RCR */
114#define SPI_RXCTR_OFFSET 0
115#define SPI_RXCTR_SIZE 16
116
117/* Bitfields in TCR */
118#define SPI_TXCTR_OFFSET 0
119#define SPI_TXCTR_SIZE 16
120
121/* Bitfields in RNCR */
122#define SPI_RXNCR_OFFSET 0
123#define SPI_RXNCR_SIZE 16
124
125/* Bitfields in TNCR */
126#define SPI_TXNCR_OFFSET 0
127#define SPI_TXNCR_SIZE 16
128
129/* Bitfields in PTCR */
130#define SPI_RXTEN_OFFSET 0
131#define SPI_RXTEN_SIZE 1
132#define SPI_RXTDIS_OFFSET 1
133#define SPI_RXTDIS_SIZE 1
134#define SPI_TXTEN_OFFSET 8
135#define SPI_TXTEN_SIZE 1
136#define SPI_TXTDIS_OFFSET 9
137#define SPI_TXTDIS_SIZE 1
138
139/* Constants for BITS */
140#define SPI_BITS_8_BPT 0
141#define SPI_BITS_9_BPT 1
142#define SPI_BITS_10_BPT 2
143#define SPI_BITS_11_BPT 3
144#define SPI_BITS_12_BPT 4
145#define SPI_BITS_13_BPT 5
146#define SPI_BITS_14_BPT 6
147#define SPI_BITS_15_BPT 7
148#define SPI_BITS_16_BPT 8
149
150/* Bit manipulation macros */
151#define SPI_BIT(name) \
152 (1 << SPI_##name##_OFFSET)
153#define SPI_BF(name,value) \
154 (((value) & ((1 << SPI_##name##_SIZE) - 1)) << SPI_##name##_OFFSET)
155#define SPI_BFEXT(name,value) \
156 (((value) >> SPI_##name##_OFFSET) & ((1 << SPI_##name##_SIZE) - 1))
157#define SPI_BFINS(name,value,old) \
158 ( ((old) & ~(((1 << SPI_##name##_SIZE) - 1) << SPI_##name##_OFFSET)) \
159 | SPI_BF(name,value))
160
161/* Register access macros */
162#define spi_readl(port,reg) \
163 __raw_readl((port)->regs + SPI_##reg)
164#define spi_writel(port,reg,value) \
165 __raw_writel((value), (port)->regs + SPI_##reg)
166
167#endif /* __ATMEL_SPI_H__ */
diff --git a/drivers/tc/lk201.c b/drivers/tc/lk201.c
index 757dec9c7ee9..a90c255f079d 100644
--- a/drivers/tc/lk201.c
+++ b/drivers/tc/lk201.c
@@ -10,7 +10,6 @@
10 10
11 11
12#include <linux/errno.h> 12#include <linux/errno.h>
13#include <linux/sched.h>
14#include <linux/tty.h> 13#include <linux/tty.h>
15#include <linux/kernel.h> 14#include <linux/kernel.h>
16#include <linux/init.h> 15#include <linux/init.h>
diff --git a/drivers/telephony/ixj_pcmcia.c b/drivers/telephony/ixj_pcmcia.c
index 164a5dcf1f1e..3e658dc7c2d8 100644
--- a/drivers/telephony/ixj_pcmcia.c
+++ b/drivers/telephony/ixj_pcmcia.c
@@ -3,7 +3,6 @@
3#include <linux/module.h> 3#include <linux/module.h>
4 4
5#include <linux/init.h> 5#include <linux/init.h>
6#include <linux/sched.h>
7#include <linux/kernel.h> /* printk() */ 6#include <linux/kernel.h> /* printk() */
8#include <linux/fs.h> /* everything... */ 7#include <linux/fs.h> /* everything... */
9#include <linux/errno.h> /* error codes */ 8#include <linux/errno.h> /* error codes */
diff --git a/drivers/usb/gadget/at91_udc.c b/drivers/usb/gadget/at91_udc.c
index f39050145f1f..36b36e0175fc 100644
--- a/drivers/usb/gadget/at91_udc.c
+++ b/drivers/usb/gadget/at91_udc.c
@@ -30,7 +30,6 @@
30#include <linux/platform_device.h> 30#include <linux/platform_device.h>
31#include <linux/delay.h> 31#include <linux/delay.h>
32#include <linux/ioport.h> 32#include <linux/ioport.h>
33#include <linux/sched.h>
34#include <linux/slab.h> 33#include <linux/slab.h>
35#include <linux/smp_lock.h> 34#include <linux/smp_lock.h>
36#include <linux/errno.h> 35#include <linux/errno.h>
diff --git a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c
index 3c2bc075ef4f..7d7909cf2558 100644
--- a/drivers/usb/gadget/dummy_hcd.c
+++ b/drivers/usb/gadget/dummy_hcd.c
@@ -40,7 +40,6 @@
40#include <linux/kernel.h> 40#include <linux/kernel.h>
41#include <linux/delay.h> 41#include <linux/delay.h>
42#include <linux/ioport.h> 42#include <linux/ioport.h>
43#include <linux/sched.h>
44#include <linux/slab.h> 43#include <linux/slab.h>
45#include <linux/smp_lock.h> 44#include <linux/smp_lock.h>
46#include <linux/errno.h> 45#include <linux/errno.h>
diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c
index 22e3c9443641..04e6b8508fb6 100644
--- a/drivers/usb/gadget/ether.c
+++ b/drivers/usb/gadget/ether.c
@@ -27,7 +27,6 @@
27#include <linux/kernel.h> 27#include <linux/kernel.h>
28#include <linux/delay.h> 28#include <linux/delay.h>
29#include <linux/ioport.h> 29#include <linux/ioport.h>
30#include <linux/sched.h>
31#include <linux/slab.h> 30#include <linux/slab.h>
32#include <linux/smp_lock.h> 31#include <linux/smp_lock.h>
33#include <linux/errno.h> 32#include <linux/errno.h>
diff --git a/drivers/usb/gadget/goku_udc.c b/drivers/usb/gadget/goku_udc.c
index e873cf488246..7b3a326b57ab 100644
--- a/drivers/usb/gadget/goku_udc.c
+++ b/drivers/usb/gadget/goku_udc.c
@@ -29,7 +29,6 @@
29#include <linux/pci.h> 29#include <linux/pci.h>
30#include <linux/delay.h> 30#include <linux/delay.h>
31#include <linux/ioport.h> 31#include <linux/ioport.h>
32#include <linux/sched.h>
33#include <linux/slab.h> 32#include <linux/slab.h>
34#include <linux/smp_lock.h> 33#include <linux/smp_lock.h>
35#include <linux/errno.h> 34#include <linux/errno.h>
diff --git a/drivers/usb/gadget/net2280.c b/drivers/usb/gadget/net2280.c
index 7617ff7bd5ac..49d737725f70 100644
--- a/drivers/usb/gadget/net2280.c
+++ b/drivers/usb/gadget/net2280.c
@@ -53,7 +53,6 @@
53#include <linux/kernel.h> 53#include <linux/kernel.h>
54#include <linux/delay.h> 54#include <linux/delay.h>
55#include <linux/ioport.h> 55#include <linux/ioport.h>
56#include <linux/sched.h>
57#include <linux/slab.h> 56#include <linux/slab.h>
58#include <linux/smp_lock.h> 57#include <linux/smp_lock.h>
59#include <linux/errno.h> 58#include <linux/errno.h>
diff --git a/drivers/usb/gadget/omap_udc.c b/drivers/usb/gadget/omap_udc.c
index 140104341db4..8f9a2b615422 100644
--- a/drivers/usb/gadget/omap_udc.c
+++ b/drivers/usb/gadget/omap_udc.c
@@ -28,7 +28,6 @@
28#include <linux/types.h> 28#include <linux/types.h>
29#include <linux/errno.h> 29#include <linux/errno.h>
30#include <linux/delay.h> 30#include <linux/delay.h>
31#include <linux/sched.h>
32#include <linux/slab.h> 31#include <linux/slab.h>
33#include <linux/init.h> 32#include <linux/init.h>
34#include <linux/timer.h> 33#include <linux/timer.h>
diff --git a/drivers/usb/gadget/pxa2xx_udc.c b/drivers/usb/gadget/pxa2xx_udc.c
index 0d225369847d..27904a56494b 100644
--- a/drivers/usb/gadget/pxa2xx_udc.c
+++ b/drivers/usb/gadget/pxa2xx_udc.c
@@ -33,7 +33,6 @@
33#include <linux/types.h> 33#include <linux/types.h>
34#include <linux/errno.h> 34#include <linux/errno.h>
35#include <linux/delay.h> 35#include <linux/delay.h>
36#include <linux/sched.h>
37#include <linux/slab.h> 36#include <linux/slab.h>
38#include <linux/init.h> 37#include <linux/init.h>
39#include <linux/timer.h> 38#include <linux/timer.h>
@@ -2614,7 +2613,7 @@ lubbock_fail0:
2614#endif 2613#endif
2615 if (vbus_irq) { 2614 if (vbus_irq) {
2616 retval = request_irq(vbus_irq, udc_vbus_irq, 2615 retval = request_irq(vbus_irq, udc_vbus_irq,
2617 SA_INTERRUPT | SA_SAMPLE_RANDOM, 2616 IRQF_DISABLED | IRQF_SAMPLE_RANDOM,
2618 driver_name, dev); 2617 driver_name, dev);
2619 if (retval != 0) { 2618 if (retval != 0) {
2620 printk(KERN_ERR "%s: can't get irq %i, err %d\n", 2619 printk(KERN_ERR "%s: can't get irq %i, err %d\n",
diff --git a/drivers/usb/gadget/serial.c b/drivers/usb/gadget/serial.c
index 6c742a909225..e6c19aa4bef3 100644
--- a/drivers/usb/gadget/serial.c
+++ b/drivers/usb/gadget/serial.c
@@ -21,7 +21,6 @@
21#include <linux/kernel.h> 21#include <linux/kernel.h>
22#include <linux/delay.h> 22#include <linux/delay.h>
23#include <linux/ioport.h> 23#include <linux/ioport.h>
24#include <linux/sched.h>
25#include <linux/slab.h> 24#include <linux/slab.h>
26#include <linux/smp_lock.h> 25#include <linux/smp_lock.h>
27#include <linux/errno.h> 26#include <linux/errno.h>
diff --git a/drivers/usb/gadget/zero.c b/drivers/usb/gadget/zero.c
index ebe04e0d2879..8c85e33f74a4 100644
--- a/drivers/usb/gadget/zero.c
+++ b/drivers/usb/gadget/zero.c
@@ -66,7 +66,6 @@
66#include <linux/kernel.h> 66#include <linux/kernel.h>
67#include <linux/delay.h> 67#include <linux/delay.h>
68#include <linux/ioport.h> 68#include <linux/ioport.h>
69#include <linux/sched.h>
70#include <linux/slab.h> 69#include <linux/slab.h>
71#include <linux/smp_lock.h> 70#include <linux/smp_lock.h>
72#include <linux/errno.h> 71#include <linux/errno.h>
diff --git a/drivers/usb/host/hc_crisv10.c b/drivers/usb/host/hc_crisv10.c
index f0ffb8907f29..32f7caf24747 100644
--- a/drivers/usb/host/hc_crisv10.c
+++ b/drivers/usb/host/hc_crisv10.c
@@ -7,7 +7,6 @@
7#include <linux/kernel.h> 7#include <linux/kernel.h>
8#include <linux/delay.h> 8#include <linux/delay.h>
9#include <linux/ioport.h> 9#include <linux/ioport.h>
10#include <linux/sched.h>
11#include <linux/slab.h> 10#include <linux/slab.h>
12#include <linux/errno.h> 11#include <linux/errno.h>
13#include <linux/unistd.h> 12#include <linux/unistd.h>
diff --git a/drivers/usb/host/ohci-ep93xx.c b/drivers/usb/host/ohci-ep93xx.c
index 44c60fba76e1..a68ce9d3c525 100644
--- a/drivers/usb/host/ohci-ep93xx.c
+++ b/drivers/usb/host/ohci-ep93xx.c
@@ -78,7 +78,7 @@ static int usb_hcd_ep93xx_probe(const struct hc_driver *driver,
78 78
79 ohci_hcd_init(hcd_to_ohci(hcd)); 79 ohci_hcd_init(hcd_to_ohci(hcd));
80 80
81 retval = usb_add_hcd(hcd, pdev->resource[1].start, SA_INTERRUPT); 81 retval = usb_add_hcd(hcd, pdev->resource[1].start, IRQF_DISABLED);
82 if (retval == 0) 82 if (retval == 0)
83 return retval; 83 return retval;
84 84
diff --git a/drivers/usb/host/ohci-pnx4008.c b/drivers/usb/host/ohci-pnx4008.c
index 893b172384da..d601bbb9387b 100644
--- a/drivers/usb/host/ohci-pnx4008.c
+++ b/drivers/usb/host/ohci-pnx4008.c
@@ -421,7 +421,7 @@ static int __devinit usb_hcd_pnx4008_probe(struct platform_device *pdev)
421 ohci_hcd_init(ohci); 421 ohci_hcd_init(ohci);
422 422
423 dev_info(&pdev->dev, "at 0x%p, irq %d\n", hcd->regs, hcd->irq); 423 dev_info(&pdev->dev, "at 0x%p, irq %d\n", hcd->regs, hcd->irq);
424 ret = usb_add_hcd(hcd, irq, SA_INTERRUPT); 424 ret = usb_add_hcd(hcd, irq, IRQF_DISABLED);
425 if (ret == 0) 425 if (ret == 0)
426 return ret; 426 return ret;
427 427
diff --git a/drivers/usb/host/ohci-pnx8550.c b/drivers/usb/host/ohci-pnx8550.c
index de45eb0051a7..85fdfd2a7ad0 100644
--- a/drivers/usb/host/ohci-pnx8550.c
+++ b/drivers/usb/host/ohci-pnx8550.c
@@ -107,7 +107,7 @@ int usb_hcd_pnx8550_probe (const struct hc_driver *driver,
107 107
108 ohci_hcd_init(hcd_to_ohci(hcd)); 108 ohci_hcd_init(hcd_to_ohci(hcd));
109 109
110 retval = usb_add_hcd(hcd, dev->resource[1].start, SA_INTERRUPT); 110 retval = usb_add_hcd(hcd, dev->resource[1].start, IRQF_DISABLED);
111 if (retval == 0) 111 if (retval == 0)
112 return retval; 112 return retval;
113 113
diff --git a/drivers/usb/host/sl811_cs.c b/drivers/usb/host/sl811_cs.c
index ac9f11d19817..2d0e73b20099 100644
--- a/drivers/usb/host/sl811_cs.c
+++ b/drivers/usb/host/sl811_cs.c
@@ -13,7 +13,6 @@
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/module.h> 14#include <linux/module.h>
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/sched.h>
17#include <linux/ptrace.h> 16#include <linux/ptrace.h>
18#include <linux/slab.h> 17#include <linux/slab.h>
19#include <linux/string.h> 18#include <linux/string.h>
diff --git a/drivers/usb/host/uhci-hcd.c b/drivers/usb/host/uhci-hcd.c
index 49b9d390b95f..ded4df30a631 100644
--- a/drivers/usb/host/uhci-hcd.c
+++ b/drivers/usb/host/uhci-hcd.c
@@ -28,7 +28,6 @@
28#include <linux/init.h> 28#include <linux/init.h>
29#include <linux/delay.h> 29#include <linux/delay.h>
30#include <linux/ioport.h> 30#include <linux/ioport.h>
31#include <linux/sched.h>
32#include <linux/slab.h> 31#include <linux/slab.h>
33#include <linux/errno.h> 32#include <linux/errno.h>
34#include <linux/unistd.h> 33#include <linux/unistd.h>
diff --git a/drivers/usb/image/microtek.c b/drivers/usb/image/microtek.c
index 8ccddf74534a..896cb2b71020 100644
--- a/drivers/usb/image/microtek.c
+++ b/drivers/usb/image/microtek.c
@@ -121,7 +121,6 @@
121 121
122#include <linux/module.h> 122#include <linux/module.h>
123#include <linux/kernel.h> 123#include <linux/kernel.h>
124#include <linux/sched.h>
125#include <linux/signal.h> 124#include <linux/signal.h>
126#include <linux/errno.h> 125#include <linux/errno.h>
127#include <linux/random.h> 126#include <linux/random.h>
diff --git a/drivers/usb/input/aiptek.c b/drivers/usb/input/aiptek.c
index 9f52429ce654..f857935e615c 100644
--- a/drivers/usb/input/aiptek.c
+++ b/drivers/usb/input/aiptek.c
@@ -76,7 +76,6 @@
76#include <linux/module.h> 76#include <linux/module.h>
77#include <linux/init.h> 77#include <linux/init.h>
78#include <linux/usb/input.h> 78#include <linux/usb/input.h>
79#include <linux/sched.h>
80#include <asm/uaccess.h> 79#include <asm/uaccess.h>
81#include <asm/unaligned.h> 80#include <asm/unaligned.h>
82 81
diff --git a/drivers/usb/input/hid-core.c b/drivers/usb/input/hid-core.c
index 84983d1b7164..4d8ed3d71a15 100644
--- a/drivers/usb/input/hid-core.c
+++ b/drivers/usb/input/hid-core.c
@@ -18,7 +18,6 @@
18#include <linux/slab.h> 18#include <linux/slab.h>
19#include <linux/init.h> 19#include <linux/init.h>
20#include <linux/kernel.h> 20#include <linux/kernel.h>
21#include <linux/sched.h>
22#include <linux/list.h> 21#include <linux/list.h>
23#include <linux/mm.h> 22#include <linux/mm.h>
24#include <linux/smp_lock.h> 23#include <linux/smp_lock.h>
diff --git a/drivers/usb/input/hid-pidff.c b/drivers/usb/input/hid-pidff.c
index cbd2d53fefff..f5a90e950e6b 100644
--- a/drivers/usb/input/hid-pidff.c
+++ b/drivers/usb/input/hid-pidff.c
@@ -24,7 +24,6 @@
24 24
25#define debug(format, arg...) pr_debug("hid-pidff: " format "\n" , ## arg) 25#define debug(format, arg...) pr_debug("hid-pidff: " format "\n" , ## arg)
26 26
27#include <linux/sched.h>
28#include <linux/input.h> 27#include <linux/input.h>
29#include <linux/usb.h> 28#include <linux/usb.h>
30 29
diff --git a/drivers/usb/misc/sisusbvga/sisusb.c b/drivers/usb/misc/sisusbvga/sisusb.c
index 0398908b15d4..6f8b134a79cb 100644
--- a/drivers/usb/misc/sisusbvga/sisusb.c
+++ b/drivers/usb/misc/sisusbvga/sisusb.c
@@ -40,7 +40,6 @@
40#include <linux/module.h> 40#include <linux/module.h>
41#include <linux/kernel.h> 41#include <linux/kernel.h>
42#include <linux/signal.h> 42#include <linux/signal.h>
43#include <linux/sched.h>
44#include <linux/errno.h> 43#include <linux/errno.h>
45#include <linux/poll.h> 44#include <linux/poll.h>
46#include <linux/init.h> 45#include <linux/init.h>
diff --git a/drivers/usb/misc/sisusbvga/sisusb_con.c b/drivers/usb/misc/sisusbvga/sisusb_con.c
index 9148694627d5..1730d8642a47 100644
--- a/drivers/usb/misc/sisusbvga/sisusb_con.c
+++ b/drivers/usb/misc/sisusbvga/sisusb_con.c
@@ -51,7 +51,6 @@
51#include <linux/module.h> 51#include <linux/module.h>
52#include <linux/kernel.h> 52#include <linux/kernel.h>
53#include <linux/signal.h> 53#include <linux/signal.h>
54#include <linux/sched.h>
55#include <linux/fs.h> 54#include <linux/fs.h>
56#include <linux/tty.h> 55#include <linux/tty.h>
57#include <linux/console.h> 56#include <linux/console.h>
diff --git a/drivers/usb/net/asix.c b/drivers/usb/net/asix.c
index 4206df2d61b7..bd357e178e55 100644
--- a/drivers/usb/net/asix.c
+++ b/drivers/usb/net/asix.c
@@ -25,7 +25,6 @@
25 25
26#include <linux/module.h> 26#include <linux/module.h>
27#include <linux/kmod.h> 27#include <linux/kmod.h>
28#include <linux/sched.h>
29#include <linux/init.h> 28#include <linux/init.h>
30#include <linux/netdevice.h> 29#include <linux/netdevice.h>
31#include <linux/etherdevice.h> 30#include <linux/etherdevice.h>
diff --git a/drivers/usb/net/cdc_ether.c b/drivers/usb/net/cdc_ether.c
index e5cdafa258dd..5a21f06bf8a5 100644
--- a/drivers/usb/net/cdc_ether.c
+++ b/drivers/usb/net/cdc_ether.c
@@ -22,7 +22,6 @@
22// #define VERBOSE // more; success messages 22// #define VERBOSE // more; success messages
23 23
24#include <linux/module.h> 24#include <linux/module.h>
25#include <linux/sched.h>
26#include <linux/init.h> 25#include <linux/init.h>
27#include <linux/netdevice.h> 26#include <linux/netdevice.h>
28#include <linux/etherdevice.h> 27#include <linux/etherdevice.h>
diff --git a/drivers/usb/net/cdc_subset.c b/drivers/usb/net/cdc_subset.c
index e2fae85851a3..ae8fb06cf38e 100644
--- a/drivers/usb/net/cdc_subset.c
+++ b/drivers/usb/net/cdc_subset.c
@@ -19,7 +19,6 @@
19 19
20#include <linux/module.h> 20#include <linux/module.h>
21#include <linux/kmod.h> 21#include <linux/kmod.h>
22#include <linux/sched.h>
23#include <linux/init.h> 22#include <linux/init.h>
24#include <linux/netdevice.h> 23#include <linux/netdevice.h>
25#include <linux/etherdevice.h> 24#include <linux/etherdevice.h>
diff --git a/drivers/usb/net/gl620a.c b/drivers/usb/net/gl620a.c
index 31e5fe363fdc..d257a8e026d6 100644
--- a/drivers/usb/net/gl620a.c
+++ b/drivers/usb/net/gl620a.c
@@ -22,7 +22,6 @@
22// #define VERBOSE // more; success messages 22// #define VERBOSE // more; success messages
23 23
24#include <linux/module.h> 24#include <linux/module.h>
25#include <linux/sched.h>
26#include <linux/init.h> 25#include <linux/init.h>
27#include <linux/netdevice.h> 26#include <linux/netdevice.h>
28#include <linux/etherdevice.h> 27#include <linux/etherdevice.h>
diff --git a/drivers/usb/net/kaweth.c b/drivers/usb/net/kaweth.c
index 36a989160a68..de95268ae4b8 100644
--- a/drivers/usb/net/kaweth.c
+++ b/drivers/usb/net/kaweth.c
@@ -46,7 +46,6 @@
46 */ 46 */
47 47
48#include <linux/module.h> 48#include <linux/module.h>
49#include <linux/sched.h>
50#include <linux/slab.h> 49#include <linux/slab.h>
51#include <linux/string.h> 50#include <linux/string.h>
52#include <linux/init.h> 51#include <linux/init.h>
diff --git a/drivers/usb/net/net1080.c b/drivers/usb/net/net1080.c
index 493635954513..ccebfdef4751 100644
--- a/drivers/usb/net/net1080.c
+++ b/drivers/usb/net/net1080.c
@@ -21,7 +21,6 @@
21// #define VERBOSE // more; success messages 21// #define VERBOSE // more; success messages
22 22
23#include <linux/module.h> 23#include <linux/module.h>
24#include <linux/sched.h>
25#include <linux/init.h> 24#include <linux/init.h>
26#include <linux/netdevice.h> 25#include <linux/netdevice.h>
27#include <linux/etherdevice.h> 26#include <linux/etherdevice.h>
diff --git a/drivers/usb/net/plusb.c b/drivers/usb/net/plusb.c
index 5d17cdfc7bab..45300939d185 100644
--- a/drivers/usb/net/plusb.c
+++ b/drivers/usb/net/plusb.c
@@ -21,7 +21,6 @@
21// #define VERBOSE // more; success messages 21// #define VERBOSE // more; success messages
22 22
23#include <linux/module.h> 23#include <linux/module.h>
24#include <linux/sched.h>
25#include <linux/init.h> 24#include <linux/init.h>
26#include <linux/netdevice.h> 25#include <linux/netdevice.h>
27#include <linux/etherdevice.h> 26#include <linux/etherdevice.h>
diff --git a/drivers/usb/net/rndis_host.c b/drivers/usb/net/rndis_host.c
index be888d2d813c..39a21c74fdf4 100644
--- a/drivers/usb/net/rndis_host.c
+++ b/drivers/usb/net/rndis_host.c
@@ -21,7 +21,6 @@
21// #define VERBOSE // more; success messages 21// #define VERBOSE // more; success messages
22 22
23#include <linux/module.h> 23#include <linux/module.h>
24#include <linux/sched.h>
25#include <linux/init.h> 24#include <linux/init.h>
26#include <linux/netdevice.h> 25#include <linux/netdevice.h>
27#include <linux/etherdevice.h> 26#include <linux/etherdevice.h>
diff --git a/drivers/usb/net/rtl8150.c b/drivers/usb/net/rtl8150.c
index 670262a38a0f..ea153dc9b0ac 100644
--- a/drivers/usb/net/rtl8150.c
+++ b/drivers/usb/net/rtl8150.c
@@ -6,7 +6,6 @@
6 * version 2 as published by the Free Software Foundation. 6 * version 2 as published by the Free Software Foundation.
7 */ 7 */
8 8
9#include <linux/sched.h>
10#include <linux/init.h> 9#include <linux/init.h>
11#include <linux/signal.h> 10#include <linux/signal.h>
12#include <linux/slab.h> 11#include <linux/slab.h>
diff --git a/drivers/usb/net/usbnet.c b/drivers/usb/net/usbnet.c
index 6e39e9988259..43ba61abfcc5 100644
--- a/drivers/usb/net/usbnet.c
+++ b/drivers/usb/net/usbnet.c
@@ -34,7 +34,6 @@
34// #define VERBOSE // more; success messages 34// #define VERBOSE // more; success messages
35 35
36#include <linux/module.h> 36#include <linux/module.h>
37#include <linux/sched.h>
38#include <linux/init.h> 37#include <linux/init.h>
39#include <linux/netdevice.h> 38#include <linux/netdevice.h>
40#include <linux/etherdevice.h> 39#include <linux/etherdevice.h>
diff --git a/drivers/usb/net/zaurus.c b/drivers/usb/net/zaurus.c
index 144566bda583..9f98e8ce487a 100644
--- a/drivers/usb/net/zaurus.c
+++ b/drivers/usb/net/zaurus.c
@@ -21,7 +21,6 @@
21// #define VERBOSE // more; success messages 21// #define VERBOSE // more; success messages
22 22
23#include <linux/module.h> 23#include <linux/module.h>
24#include <linux/sched.h>
25#include <linux/init.h> 24#include <linux/init.h>
26#include <linux/netdevice.h> 25#include <linux/netdevice.h>
27#include <linux/ethtool.h> 26#include <linux/ethtool.h>
diff --git a/drivers/usb/storage/datafab.c b/drivers/usb/storage/datafab.c
index 01d8971ad7db..c87ad1bae1d6 100644
--- a/drivers/usb/storage/datafab.c
+++ b/drivers/usb/storage/datafab.c
@@ -50,7 +50,6 @@
50 * in that routine. 50 * in that routine.
51 */ 51 */
52 52
53#include <linux/sched.h>
54#include <linux/errno.h> 53#include <linux/errno.h>
55#include <linux/slab.h> 54#include <linux/slab.h>
56 55
diff --git a/drivers/usb/storage/initializers.c b/drivers/usb/storage/initializers.c
index 5b06f9240d05..3a41740cad97 100644
--- a/drivers/usb/storage/initializers.c
+++ b/drivers/usb/storage/initializers.c
@@ -37,7 +37,6 @@
37 * 675 Mass Ave, Cambridge, MA 02139, USA. 37 * 675 Mass Ave, Cambridge, MA 02139, USA.
38 */ 38 */
39 39
40#include <linux/sched.h>
41#include <linux/errno.h> 40#include <linux/errno.h>
42 41
43#include "usb.h" 42#include "usb.h"
diff --git a/drivers/usb/storage/jumpshot.c b/drivers/usb/storage/jumpshot.c
index 5031aa98f6a9..003fcf545888 100644
--- a/drivers/usb/storage/jumpshot.c
+++ b/drivers/usb/storage/jumpshot.c
@@ -47,7 +47,6 @@
47 * in that routine. 47 * in that routine.
48 */ 48 */
49 49
50#include <linux/sched.h>
51#include <linux/errno.h> 50#include <linux/errno.h>
52#include <linux/slab.h> 51#include <linux/slab.h>
53 52
diff --git a/drivers/usb/storage/sddr09.c b/drivers/usb/storage/sddr09.c
index e3528eca29a5..b2ed2a3e6fca 100644
--- a/drivers/usb/storage/sddr09.c
+++ b/drivers/usb/storage/sddr09.c
@@ -41,7 +41,6 @@
41 * EF: compute checksum (?) 41 * EF: compute checksum (?)
42 */ 42 */
43 43
44#include <linux/sched.h>
45#include <linux/errno.h> 44#include <linux/errno.h>
46#include <linux/slab.h> 45#include <linux/slab.h>
47 46
diff --git a/drivers/usb/storage/shuttle_usbat.c b/drivers/usb/storage/shuttle_usbat.c
index 8fcec01dc622..5e27297c0175 100644
--- a/drivers/usb/storage/shuttle_usbat.c
+++ b/drivers/usb/storage/shuttle_usbat.c
@@ -43,7 +43,6 @@
43 * 675 Mass Ave, Cambridge, MA 02139, USA. 43 * 675 Mass Ave, Cambridge, MA 02139, USA.
44 */ 44 */
45 45
46#include <linux/sched.h>
47#include <linux/errno.h> 46#include <linux/errno.h>
48#include <linux/slab.h> 47#include <linux/slab.h>
49#include <linux/cdrom.h> 48#include <linux/cdrom.h>
diff --git a/drivers/video/atafb.c b/drivers/video/atafb.c
index 602db660bc73..bffe2b946344 100644
--- a/drivers/video/atafb.c
+++ b/drivers/video/atafb.c
@@ -49,7 +49,6 @@
49 49
50#include <linux/module.h> 50#include <linux/module.h>
51#include <linux/kernel.h> 51#include <linux/kernel.h>
52#include <linux/sched.h>
53#include <linux/errno.h> 52#include <linux/errno.h>
54#include <linux/string.h> 53#include <linux/string.h>
55#include <linux/mm.h> 54#include <linux/mm.h>
diff --git a/drivers/video/aty/mach64_accel.c b/drivers/video/aty/mach64_accel.c
index 1490e5e1c232..a8f60c33863c 100644
--- a/drivers/video/aty/mach64_accel.c
+++ b/drivers/video/aty/mach64_accel.c
@@ -3,7 +3,6 @@
3 * ATI Mach64 Hardware Acceleration 3 * ATI Mach64 Hardware Acceleration
4 */ 4 */
5 5
6#include <linux/sched.h>
7#include <linux/delay.h> 6#include <linux/delay.h>
8#include <linux/fb.h> 7#include <linux/fb.h>
9#include <video/mach64.h> 8#include <video/mach64.h>
diff --git a/drivers/video/aty/mach64_gx.c b/drivers/video/aty/mach64_gx.c
index 2045639cb671..10c988aef58e 100644
--- a/drivers/video/aty/mach64_gx.c
+++ b/drivers/video/aty/mach64_gx.c
@@ -5,7 +5,6 @@
5 5
6#include <linux/delay.h> 6#include <linux/delay.h>
7#include <linux/fb.h> 7#include <linux/fb.h>
8#include <linux/sched.h>
9 8
10#include <asm/io.h> 9#include <asm/io.h>
11 10
diff --git a/drivers/video/aty/radeon_i2c.c b/drivers/video/aty/radeon_i2c.c
index e7c5b219ad1b..508479920705 100644
--- a/drivers/video/aty/radeon_i2c.c
+++ b/drivers/video/aty/radeon_i2c.c
@@ -1,6 +1,5 @@
1#include <linux/module.h> 1#include <linux/module.h>
2#include <linux/kernel.h> 2#include <linux/kernel.h>
3#include <linux/sched.h>
4#include <linux/delay.h> 3#include <linux/delay.h>
5#include <linux/pci.h> 4#include <linux/pci.h>
6#include <linux/fb.h> 5#include <linux/fb.h>
diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c
index ce5ac268074e..be3f2c3f132c 100644
--- a/drivers/video/console/fbcon.c
+++ b/drivers/video/console/fbcon.c
@@ -60,7 +60,6 @@
60 60
61#include <linux/module.h> 61#include <linux/module.h>
62#include <linux/types.h> 62#include <linux/types.h>
63#include <linux/sched.h>
64#include <linux/fs.h> 63#include <linux/fs.h>
65#include <linux/kernel.h> 64#include <linux/kernel.h>
66#include <linux/delay.h> /* MSch: for IRQ probe */ 65#include <linux/delay.h> /* MSch: for IRQ probe */
diff --git a/drivers/video/console/mdacon.c b/drivers/video/console/mdacon.c
index eb4d03fa5391..124ecbe6f88c 100644
--- a/drivers/video/console/mdacon.c
+++ b/drivers/video/console/mdacon.c
@@ -27,7 +27,6 @@
27 */ 27 */
28 28
29#include <linux/types.h> 29#include <linux/types.h>
30#include <linux/sched.h>
31#include <linux/fs.h> 30#include <linux/fs.h>
32#include <linux/kernel.h> 31#include <linux/kernel.h>
33#include <linux/module.h> 32#include <linux/module.h>
diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c
index 4a9bde2c839b..91a20785108a 100644
--- a/drivers/video/console/vgacon.c
+++ b/drivers/video/console/vgacon.c
@@ -35,7 +35,6 @@
35 35
36#include <linux/module.h> 36#include <linux/module.h>
37#include <linux/types.h> 37#include <linux/types.h>
38#include <linux/sched.h>
39#include <linux/fs.h> 38#include <linux/fs.h>
40#include <linux/kernel.h> 39#include <linux/kernel.h>
41#include <linux/console.h> 40#include <linux/console.h>
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c
index 3cfea315a48f..28225265159a 100644
--- a/drivers/video/fbmem.c
+++ b/drivers/video/fbmem.c
@@ -16,7 +16,6 @@
16#include <linux/compat.h> 16#include <linux/compat.h>
17#include <linux/types.h> 17#include <linux/types.h>
18#include <linux/errno.h> 18#include <linux/errno.h>
19#include <linux/sched.h>
20#include <linux/smp_lock.h> 19#include <linux/smp_lock.h>
21#include <linux/kernel.h> 20#include <linux/kernel.h>
22#include <linux/major.h> 21#include <linux/major.h>
diff --git a/drivers/video/g364fb.c b/drivers/video/g364fb.c
index 1b981b635675..ca93a75f2997 100644
--- a/drivers/video/g364fb.c
+++ b/drivers/video/g364fb.c
@@ -16,7 +16,6 @@
16 16
17#include <linux/module.h> 17#include <linux/module.h>
18#include <linux/console.h> 18#include <linux/console.h>
19#include <linux/sched.h>
20#include <linux/kernel.h> 19#include <linux/kernel.h>
21#include <linux/errno.h> 20#include <linux/errno.h>
22#include <linux/string.h> 21#include <linux/string.h>
diff --git a/drivers/video/hitfb.c b/drivers/video/hitfb.c
index 3dc49424dc75..756c0ce85911 100644
--- a/drivers/video/hitfb.c
+++ b/drivers/video/hitfb.c
@@ -13,7 +13,6 @@
13 13
14#include <linux/module.h> 14#include <linux/module.h>
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/sched.h>
17#include <linux/errno.h> 16#include <linux/errno.h>
18#include <linux/string.h> 17#include <linux/string.h>
19#include <linux/mm.h> 18#include <linux/mm.h>
diff --git a/drivers/video/hpfb.c b/drivers/video/hpfb.c
index 9ab9b839a0f5..b18486ad8e17 100644
--- a/drivers/video/hpfb.c
+++ b/drivers/video/hpfb.c
@@ -7,7 +7,6 @@
7 7
8#include <linux/module.h> 8#include <linux/module.h>
9#include <linux/kernel.h> 9#include <linux/kernel.h>
10#include <linux/sched.h>
11#include <linux/errno.h> 10#include <linux/errno.h>
12#include <linux/string.h> 11#include <linux/string.h>
13#include <linux/mm.h> 12#include <linux/mm.h>
diff --git a/drivers/video/i810/i810-i2c.c b/drivers/video/i810/i810-i2c.c
index 961f4d404467..7787c3322ffb 100644
--- a/drivers/video/i810/i810-i2c.c
+++ b/drivers/video/i810/i810-i2c.c
@@ -10,7 +10,6 @@
10 */ 10 */
11#include <linux/module.h> 11#include <linux/module.h>
12#include <linux/kernel.h> 12#include <linux/kernel.h>
13#include <linux/sched.h>
14#include <linux/delay.h> 13#include <linux/delay.h>
15#include <linux/pci.h> 14#include <linux/pci.h>
16#include <linux/fb.h> 15#include <linux/fb.h>
diff --git a/drivers/video/imxfb.c b/drivers/video/imxfb.c
index 0f9b2fdc28b1..267c1ff9ebd9 100644
--- a/drivers/video/imxfb.c
+++ b/drivers/video/imxfb.c
@@ -20,7 +20,6 @@
20 20
21#include <linux/module.h> 21#include <linux/module.h>
22#include <linux/kernel.h> 22#include <linux/kernel.h>
23#include <linux/sched.h>
24#include <linux/errno.h> 23#include <linux/errno.h>
25#include <linux/string.h> 24#include <linux/string.h>
26#include <linux/interrupt.h> 25#include <linux/interrupt.h>
diff --git a/drivers/video/intelfb/intelfb_i2c.c b/drivers/video/intelfb/intelfb_i2c.c
index 33bc41f50540..f4ede5f6b588 100644
--- a/drivers/video/intelfb/intelfb_i2c.c
+++ b/drivers/video/intelfb/intelfb_i2c.c
@@ -27,7 +27,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
27 27
28#include <linux/module.h> 28#include <linux/module.h>
29#include <linux/kernel.h> 29#include <linux/kernel.h>
30#include <linux/sched.h>
31#include <linux/delay.h> 30#include <linux/delay.h>
32#include <linux/pci.h> 31#include <linux/pci.h>
33#include <linux/fb.h> 32#include <linux/fb.h>
diff --git a/drivers/video/intelfb/intelfbhw.c b/drivers/video/intelfb/intelfbhw.c
index a95836839e1e..c1eb18bf0883 100644
--- a/drivers/video/intelfb/intelfbhw.c
+++ b/drivers/video/intelfb/intelfbhw.c
@@ -1990,7 +1990,8 @@ int
1990intelfbhw_enable_irq(struct intelfb_info *dinfo, int reenable) { 1990intelfbhw_enable_irq(struct intelfb_info *dinfo, int reenable) {
1991 1991
1992 if (!test_and_set_bit(0, &dinfo->irq_flags)) { 1992 if (!test_and_set_bit(0, &dinfo->irq_flags)) {
1993 if (request_irq(dinfo->pdev->irq, intelfbhw_irq, SA_SHIRQ, "intelfb", dinfo)) { 1993 if (request_irq(dinfo->pdev->irq, intelfbhw_irq, IRQF_SHARED,
1994 "intelfb", dinfo)) {
1994 clear_bit(0, &dinfo->irq_flags); 1995 clear_bit(0, &dinfo->irq_flags);
1995 return -EINVAL; 1996 return -EINVAL;
1996 } 1997 }
diff --git a/drivers/video/kyro/fbdev.c b/drivers/video/kyro/fbdev.c
index f0d614a80f1f..1c5579907397 100644
--- a/drivers/video/kyro/fbdev.c
+++ b/drivers/video/kyro/fbdev.c
@@ -12,7 +12,6 @@
12#include <linux/module.h> 12#include <linux/module.h>
13#include <linux/types.h> 13#include <linux/types.h>
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/sched.h>
16#include <linux/mm.h> 15#include <linux/mm.h>
17#include <linux/errno.h> 16#include <linux/errno.h>
18#include <linux/string.h> 17#include <linux/string.h>
diff --git a/drivers/video/macfb.c b/drivers/video/macfb.c
index 180d94c2b4d2..f7d647dda978 100644
--- a/drivers/video/macfb.c
+++ b/drivers/video/macfb.c
@@ -20,7 +20,6 @@
20 20
21#include <linux/module.h> 21#include <linux/module.h>
22#include <linux/kernel.h> 22#include <linux/kernel.h>
23#include <linux/sched.h>
24#include <linux/errno.h> 23#include <linux/errno.h>
25#include <linux/string.h> 24#include <linux/string.h>
26#include <linux/mm.h> 25#include <linux/mm.h>
diff --git a/drivers/video/maxinefb.c b/drivers/video/maxinefb.c
index 38c8d38de4fd..5e91c2b30af9 100644
--- a/drivers/video/maxinefb.c
+++ b/drivers/video/maxinefb.c
@@ -25,7 +25,6 @@
25 25
26#include <linux/module.h> 26#include <linux/module.h>
27#include <linux/kernel.h> 27#include <linux/kernel.h>
28#include <linux/sched.h>
29#include <linux/errno.h> 28#include <linux/errno.h>
30#include <linux/string.h> 29#include <linux/string.h>
31#include <linux/mm.h> 30#include <linux/mm.h>
diff --git a/drivers/video/modedb.c b/drivers/video/modedb.c
index 5162eab95539..3e517940c5a5 100644
--- a/drivers/video/modedb.c
+++ b/drivers/video/modedb.c
@@ -13,7 +13,6 @@
13 13
14#include <linux/module.h> 14#include <linux/module.h>
15#include <linux/fb.h> 15#include <linux/fb.h>
16#include <linux/sched.h>
17 16
18#undef DEBUG 17#undef DEBUG
19 18
diff --git a/drivers/video/nvidia/nv_i2c.c b/drivers/video/nvidia/nv_i2c.c
index 8454adf2d178..b8588973e400 100644
--- a/drivers/video/nvidia/nv_i2c.c
+++ b/drivers/video/nvidia/nv_i2c.c
@@ -12,7 +12,6 @@
12 12
13#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/sched.h>
16#include <linux/delay.h> 15#include <linux/delay.h>
17#include <linux/pci.h> 16#include <linux/pci.h>
18#include <linux/fb.h> 17#include <linux/fb.h>
diff --git a/drivers/video/nvidia/nv_of.c b/drivers/video/nvidia/nv_of.c
index 181875fe35c6..163a774a1b30 100644
--- a/drivers/video/nvidia/nv_of.c
+++ b/drivers/video/nvidia/nv_of.c
@@ -12,7 +12,6 @@
12 12
13#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/sched.h>
16#include <linux/delay.h> 15#include <linux/delay.h>
17#include <linux/pci.h> 16#include <linux/pci.h>
18#include <linux/fb.h> 17#include <linux/fb.h>
diff --git a/drivers/video/pmag-aa-fb.c b/drivers/video/pmag-aa-fb.c
index 68ca3cc40770..a864438b6008 100644
--- a/drivers/video/pmag-aa-fb.c
+++ b/drivers/video/pmag-aa-fb.c
@@ -24,7 +24,6 @@
24 */ 24 */
25#include <linux/module.h> 25#include <linux/module.h>
26#include <linux/kernel.h> 26#include <linux/kernel.h>
27#include <linux/sched.h>
28#include <linux/errno.h> 27#include <linux/errno.h>
29#include <linux/string.h> 28#include <linux/string.h>
30#include <linux/timer.h> 29#include <linux/timer.h>
diff --git a/drivers/video/riva/rivafb-i2c.c b/drivers/video/riva/rivafb-i2c.c
index 01b85e3b0ae1..0405e839ff93 100644
--- a/drivers/video/riva/rivafb-i2c.c
+++ b/drivers/video/riva/rivafb-i2c.c
@@ -14,7 +14,6 @@
14 14
15#include <linux/module.h> 15#include <linux/module.h>
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <linux/sched.h>
18#include <linux/delay.h> 17#include <linux/delay.h>
19#include <linux/pci.h> 18#include <linux/pci.h>
20#include <linux/fb.h> 19#include <linux/fb.h>
diff --git a/drivers/video/savage/savagefb-i2c.c b/drivers/video/savage/savagefb-i2c.c
index 1411f3b6a009..8db066ccca6b 100644
--- a/drivers/video/savage/savagefb-i2c.c
+++ b/drivers/video/savage/savagefb-i2c.c
@@ -12,7 +12,6 @@
12 12
13#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/sched.h>
16#include <linux/delay.h> 15#include <linux/delay.h>
17#include <linux/pci.h> 16#include <linux/pci.h>
18#include <linux/fb.h> 17#include <linux/fb.h>
diff --git a/drivers/video/tgafb.c b/drivers/video/tgafb.c
index b604859b4ddb..7478d0e3e211 100644
--- a/drivers/video/tgafb.c
+++ b/drivers/video/tgafb.c
@@ -13,7 +13,6 @@
13 13
14#include <linux/module.h> 14#include <linux/module.h>
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/sched.h>
17#include <linux/errno.h> 16#include <linux/errno.h>
18#include <linux/string.h> 17#include <linux/string.h>
19#include <linux/mm.h> 18#include <linux/mm.h>
diff --git a/fs/afs/cell.c b/fs/afs/cell.c
index bfc1fd22d5b1..1fc578372759 100644
--- a/fs/afs/cell.c
+++ b/fs/afs/cell.c
@@ -10,7 +10,6 @@
10 */ 10 */
11 11
12#include <linux/module.h> 12#include <linux/module.h>
13#include <linux/sched.h>
14#include <linux/slab.h> 13#include <linux/slab.h>
15#include <rxrpc/peer.h> 14#include <rxrpc/peer.h>
16#include <rxrpc/connection.h> 15#include <rxrpc/connection.h>
diff --git a/fs/afs/dir.c b/fs/afs/dir.c
index 9908462bcadc..b6dc2ebe47a8 100644
--- a/fs/afs/dir.c
+++ b/fs/afs/dir.c
@@ -12,7 +12,6 @@
12#include <linux/kernel.h> 12#include <linux/kernel.h>
13#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/sched.h>
16#include <linux/slab.h> 15#include <linux/slab.h>
17#include <linux/fs.h> 16#include <linux/fs.h>
18#include <linux/pagemap.h> 17#include <linux/pagemap.h>
diff --git a/fs/afs/file.c b/fs/afs/file.c
index eeff14c3f748..b17634541f67 100644
--- a/fs/afs/file.c
+++ b/fs/afs/file.c
@@ -12,7 +12,6 @@
12#include <linux/kernel.h> 12#include <linux/kernel.h>
13#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/sched.h>
16#include <linux/slab.h> 15#include <linux/slab.h>
17#include <linux/fs.h> 16#include <linux/fs.h>
18#include <linux/pagemap.h> 17#include <linux/pagemap.h>
diff --git a/fs/afs/inode.c b/fs/afs/inode.c
index 6f37754906c2..9d9bca6c28b5 100644
--- a/fs/afs/inode.c
+++ b/fs/afs/inode.c
@@ -16,7 +16,6 @@
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <linux/module.h> 17#include <linux/module.h>
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/sched.h>
20#include <linux/slab.h> 19#include <linux/slab.h>
21#include <linux/fs.h> 20#include <linux/fs.h>
22#include <linux/pagemap.h> 21#include <linux/pagemap.h>
diff --git a/fs/afs/main.c b/fs/afs/main.c
index 913c689bdb35..f2704ba53857 100644
--- a/fs/afs/main.c
+++ b/fs/afs/main.c
@@ -12,7 +12,6 @@
12#include <linux/module.h> 12#include <linux/module.h>
13#include <linux/moduleparam.h> 13#include <linux/moduleparam.h>
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/sched.h>
16#include <linux/completion.h> 15#include <linux/completion.h>
17#include <rxrpc/rxrpc.h> 16#include <rxrpc/rxrpc.h>
18#include <rxrpc/transport.h> 17#include <rxrpc/transport.h>
diff --git a/fs/afs/mntpt.c b/fs/afs/mntpt.c
index fdf23b2a2112..68495f0de7b3 100644
--- a/fs/afs/mntpt.c
+++ b/fs/afs/mntpt.c
@@ -12,7 +12,6 @@
12#include <linux/kernel.h> 12#include <linux/kernel.h>
13#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/sched.h>
16#include <linux/slab.h> 15#include <linux/slab.h>
17#include <linux/fs.h> 16#include <linux/fs.h>
18#include <linux/pagemap.h> 17#include <linux/pagemap.h>
diff --git a/fs/afs/proc.c b/fs/afs/proc.c
index 86463ec9ccb4..ae6b85b1e484 100644
--- a/fs/afs/proc.c
+++ b/fs/afs/proc.c
@@ -9,7 +9,6 @@
9 * 2 of the License, or (at your option) any later version. 9 * 2 of the License, or (at your option) any later version.
10 */ 10 */
11 11
12#include <linux/sched.h>
13#include <linux/slab.h> 12#include <linux/slab.h>
14#include <linux/module.h> 13#include <linux/module.h>
15#include <linux/proc_fs.h> 14#include <linux/proc_fs.h>
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index 669dbe5b0317..51db1182b27e 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -76,7 +76,8 @@ static struct linux_binfmt elf_format = {
76 .load_binary = load_elf_binary, 76 .load_binary = load_elf_binary,
77 .load_shlib = load_elf_library, 77 .load_shlib = load_elf_library,
78 .core_dump = elf_core_dump, 78 .core_dump = elf_core_dump,
79 .min_coredump = ELF_EXEC_PAGESIZE 79 .min_coredump = ELF_EXEC_PAGESIZE,
80 .hasvdso = 1
80}; 81};
81 82
82#define BAD_ADDR(x) ((unsigned long)(x) >= TASK_SIZE) 83#define BAD_ADDR(x) ((unsigned long)(x) >= TASK_SIZE)
diff --git a/fs/coda/sysctl.c b/fs/coda/sysctl.c
index db3b1a9c9a5b..c57a1fa7cf23 100644
--- a/fs/coda/sysctl.c
+++ b/fs/coda/sysctl.c
@@ -33,8 +33,6 @@
33 33
34static struct ctl_table_header *fs_table_header; 34static struct ctl_table_header *fs_table_header;
35 35
36#define FS_CODA 1 /* Coda file system */
37
38#define CODA_TIMEOUT 3 /* timeout on upcalls to become intrble */ 36#define CODA_TIMEOUT 3 /* timeout on upcalls to become intrble */
39#define CODA_HARD 5 /* mount type "hard" or "soft" */ 37#define CODA_HARD 5 /* mount type "hard" or "soft" */
40#define CODA_VFS 6 /* vfs statistics */ 38#define CODA_VFS 6 /* vfs statistics */
@@ -183,17 +181,57 @@ static const struct file_operations proc_cache_inv_stats_fops = {
183}; 181};
184 182
185static ctl_table coda_table[] = { 183static ctl_table coda_table[] = {
186 {CODA_TIMEOUT, "timeout", &coda_timeout, sizeof(int), 0644, NULL, &proc_dointvec}, 184 {
187 {CODA_HARD, "hard", &coda_hard, sizeof(int), 0644, NULL, &proc_dointvec}, 185 .ctl_name = CTL_UNNUMBERED,
188 {CODA_VFS, "vfs_stats", NULL, 0, 0644, NULL, &do_reset_coda_vfs_stats}, 186 .procname = "timeout",
189 {CODA_CACHE_INV, "cache_inv_stats", NULL, 0, 0644, NULL, &do_reset_coda_cache_inv_stats}, 187 .data = &coda_timeout,
190 {CODA_FAKE_STATFS, "fake_statfs", &coda_fake_statfs, sizeof(int), 0600, NULL, &proc_dointvec}, 188 .maxlen = sizeof(int),
191 { 0 } 189 .mode = 0644,
190 .proc_handler = &proc_dointvec
191 },
192 {
193 .ctl_name = CTL_UNNUMBERED,
194 .procname = "hard",
195 .data = &coda_hard,
196 .maxlen = sizeof(int),
197 .mode = 0644,
198 .proc_handler = &proc_dointvec
199 },
200 {
201 .ctl_name = CTL_UNNUMBERED,
202 .procname = "vfs_stats",
203 .data = NULL,
204 .maxlen = 0,
205 .mode = 0644,
206 .proc_handler = &do_reset_coda_vfs_stats
207 },
208 {
209 .ctl_name = CTL_UNNUMBERED,
210 .procname = "cache_inv_stats",
211 .data = NULL,
212 .maxlen = 0,
213 .mode = 0644,
214 .proc_handler = &do_reset_coda_cache_inv_stats
215 },
216 {
217 .ctl_name = CTL_UNNUMBERED,
218 .procname = "fake_statfs",
219 .data = &coda_fake_statfs,
220 .maxlen = sizeof(int),
221 .mode = 0600,
222 .proc_handler = &proc_dointvec
223 },
224 {}
192}; 225};
193 226
194static ctl_table fs_table[] = { 227static ctl_table fs_table[] = {
195 {FS_CODA, "coda", NULL, 0, 0555, coda_table}, 228 {
196 {0} 229 .ctl_name = CTL_UNNUMBERED,
230 .procname = "coda",
231 .mode = 0555,
232 .child = coda_table
233 },
234 {}
197}; 235};
198 236
199 237
@@ -233,7 +271,7 @@ void coda_sysctl_init(void)
233 271
234#ifdef CONFIG_SYSCTL 272#ifdef CONFIG_SYSCTL
235 if ( !fs_table_header ) 273 if ( !fs_table_header )
236 fs_table_header = register_sysctl_table(fs_table, 0); 274 fs_table_header = register_sysctl_table(fs_table);
237#endif 275#endif
238} 276}
239 277
diff --git a/fs/dquot.c b/fs/dquot.c
index 9eb166f91489..b16f991662c1 100644
--- a/fs/dquot.c
+++ b/fs/dquot.c
@@ -1841,7 +1841,7 @@ static int __init dquot_init(void)
1841 1841
1842 printk(KERN_NOTICE "VFS: Disk quotas %s\n", __DQUOT_VERSION__); 1842 printk(KERN_NOTICE "VFS: Disk quotas %s\n", __DQUOT_VERSION__);
1843 1843
1844 register_sysctl_table(sys_table, 0); 1844 register_sysctl_table(sys_table);
1845 1845
1846 dquot_cachep = kmem_cache_create("dquot", 1846 dquot_cachep = kmem_cache_create("dquot",
1847 sizeof(struct dquot), sizeof(unsigned long) * 4, 1847 sizeof(struct dquot), sizeof(unsigned long) * 4,
diff --git a/fs/ecryptfs/keystore.c b/fs/ecryptfs/keystore.c
index c209f67e7a26..81156e95ef8e 100644
--- a/fs/ecryptfs/keystore.c
+++ b/fs/ecryptfs/keystore.c
@@ -26,7 +26,6 @@
26 */ 26 */
27 27
28#include <linux/string.h> 28#include <linux/string.h>
29#include <linux/sched.h>
30#include <linux/syscalls.h> 29#include <linux/syscalls.h>
31#include <linux/pagemap.h> 30#include <linux/pagemap.h>
32#include <linux/key.h> 31#include <linux/key.h>
diff --git a/fs/ext3/hash.c b/fs/ext3/hash.c
index deeb27b5ba83..c30e149fbd2e 100644
--- a/fs/ext3/hash.c
+++ b/fs/ext3/hash.c
@@ -11,7 +11,6 @@
11 11
12#include <linux/fs.h> 12#include <linux/fs.h>
13#include <linux/jbd.h> 13#include <linux/jbd.h>
14#include <linux/sched.h>
15#include <linux/ext3_fs.h> 14#include <linux/ext3_fs.h>
16#include <linux/cryptohash.h> 15#include <linux/cryptohash.h>
17 16
diff --git a/fs/ext3/resize.c b/fs/ext3/resize.c
index b73cba12f79c..ecf89904c113 100644
--- a/fs/ext3/resize.c
+++ b/fs/ext3/resize.c
@@ -11,7 +11,6 @@
11 11
12#define EXT3FS_DEBUG 12#define EXT3FS_DEBUG
13 13
14#include <linux/sched.h>
15#include <linux/smp_lock.h> 14#include <linux/smp_lock.h>
16#include <linux/ext3_jbd.h> 15#include <linux/ext3_jbd.h>
17 16
diff --git a/fs/ext4/hash.c b/fs/ext4/hash.c
index a67966385e06..1555024e3b36 100644
--- a/fs/ext4/hash.c
+++ b/fs/ext4/hash.c
@@ -11,7 +11,6 @@
11 11
12#include <linux/fs.h> 12#include <linux/fs.h>
13#include <linux/jbd2.h> 13#include <linux/jbd2.h>
14#include <linux/sched.h>
15#include <linux/ext4_fs.h> 14#include <linux/ext4_fs.h>
16#include <linux/cryptohash.h> 15#include <linux/cryptohash.h>
17 16
diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c
index 4fe49c3661b2..ea99f6c97f56 100644
--- a/fs/ext4/resize.c
+++ b/fs/ext4/resize.c
@@ -11,7 +11,6 @@
11 11
12#define EXT4FS_DEBUG 12#define EXT4FS_DEBUG
13 13
14#include <linux/sched.h>
15#include <linux/smp_lock.h> 14#include <linux/smp_lock.h>
16#include <linux/ext4_jbd2.h> 15#include <linux/ext4_jbd2.h>
17 16
diff --git a/fs/filesystems.c b/fs/filesystems.c
index e3fa77c6ed56..7a4f61aa05f8 100644
--- a/fs/filesystems.c
+++ b/fs/filesystems.c
@@ -12,7 +12,6 @@
12#include <linux/kmod.h> 12#include <linux/kmod.h>
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/module.h> 14#include <linux/module.h>
15#include <linux/sched.h> /* for 'current' */
16#include <asm/uaccess.h> 15#include <asm/uaccess.h>
17 16
18/* 17/*
diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c
index 113f6c9110c7..c53a5d2d0590 100644
--- a/fs/gfs2/bmap.c
+++ b/fs/gfs2/bmap.c
@@ -7,7 +7,6 @@
7 * of the GNU General Public License version 2. 7 * of the GNU General Public License version 2.
8 */ 8 */
9 9
10#include <linux/sched.h>
11#include <linux/slab.h> 10#include <linux/slab.h>
12#include <linux/spinlock.h> 11#include <linux/spinlock.h>
13#include <linux/completion.h> 12#include <linux/completion.h>
diff --git a/fs/gfs2/dir.c b/fs/gfs2/dir.c
index c93ca8f361b5..82a1ac7895a2 100644
--- a/fs/gfs2/dir.c
+++ b/fs/gfs2/dir.c
@@ -53,7 +53,6 @@
53 * but never before the maximum hash table size has been reached. 53 * but never before the maximum hash table size has been reached.
54 */ 54 */
55 55
56#include <linux/sched.h>
57#include <linux/slab.h> 56#include <linux/slab.h>
58#include <linux/spinlock.h> 57#include <linux/spinlock.h>
59#include <linux/buffer_head.h> 58#include <linux/buffer_head.h>
diff --git a/fs/gfs2/eaops.c b/fs/gfs2/eaops.c
index cd747c00f670..c1f44009853f 100644
--- a/fs/gfs2/eaops.c
+++ b/fs/gfs2/eaops.c
@@ -7,7 +7,6 @@
7 * of the GNU General Public License version 2. 7 * of the GNU General Public License version 2.
8 */ 8 */
9 9
10#include <linux/sched.h>
11#include <linux/slab.h> 10#include <linux/slab.h>
12#include <linux/spinlock.h> 11#include <linux/spinlock.h>
13#include <linux/completion.h> 12#include <linux/completion.h>
diff --git a/fs/gfs2/eattr.c b/fs/gfs2/eattr.c
index 0c83c7f4dda8..5b83ca6acab1 100644
--- a/fs/gfs2/eattr.c
+++ b/fs/gfs2/eattr.c
@@ -7,7 +7,6 @@
7 * of the GNU General Public License version 2. 7 * of the GNU General Public License version 2.
8 */ 8 */
9 9
10#include <linux/sched.h>
11#include <linux/slab.h> 10#include <linux/slab.h>
12#include <linux/spinlock.h> 11#include <linux/spinlock.h>
13#include <linux/completion.h> 12#include <linux/completion.h>
diff --git a/fs/gfs2/glops.c b/fs/gfs2/glops.c
index c4b0391b7aa2..46af55355513 100644
--- a/fs/gfs2/glops.c
+++ b/fs/gfs2/glops.c
@@ -7,7 +7,6 @@
7 * of the GNU General Public License version 2. 7 * of the GNU General Public License version 2.
8 */ 8 */
9 9
10#include <linux/sched.h>
11#include <linux/slab.h> 10#include <linux/slab.h>
12#include <linux/spinlock.h> 11#include <linux/spinlock.h>
13#include <linux/completion.h> 12#include <linux/completion.h>
diff --git a/fs/gfs2/lm.c b/fs/gfs2/lm.c
index e30673dd37e0..cfcc39b86a53 100644
--- a/fs/gfs2/lm.c
+++ b/fs/gfs2/lm.c
@@ -7,7 +7,6 @@
7 * of the GNU General Public License version 2. 7 * of the GNU General Public License version 2.
8 */ 8 */
9 9
10#include <linux/sched.h>
11#include <linux/slab.h> 10#include <linux/slab.h>
12#include <linux/spinlock.h> 11#include <linux/spinlock.h>
13#include <linux/completion.h> 12#include <linux/completion.h>
diff --git a/fs/gfs2/main.c b/fs/gfs2/main.c
index 7c1a9e22a526..6e8a59809abf 100644
--- a/fs/gfs2/main.c
+++ b/fs/gfs2/main.c
@@ -7,7 +7,6 @@
7 * of the GNU General Public License version 2. 7 * of the GNU General Public License version 2.
8 */ 8 */
9 9
10#include <linux/sched.h>
11#include <linux/slab.h> 10#include <linux/slab.h>
12#include <linux/spinlock.h> 11#include <linux/spinlock.h>
13#include <linux/completion.h> 12#include <linux/completion.h>
diff --git a/fs/gfs2/mount.c b/fs/gfs2/mount.c
index ef3092e29607..32caecd20300 100644
--- a/fs/gfs2/mount.c
+++ b/fs/gfs2/mount.c
@@ -7,7 +7,6 @@
7 * of the GNU General Public License version 2. 7 * of the GNU General Public License version 2.
8 */ 8 */
9 9
10#include <linux/sched.h>
11#include <linux/slab.h> 10#include <linux/slab.h>
12#include <linux/spinlock.h> 11#include <linux/spinlock.h>
13#include <linux/completion.h> 12#include <linux/completion.h>
diff --git a/fs/gfs2/ondisk.c b/fs/gfs2/ondisk.c
index f2495f1e21ad..d9ecfd23a49e 100644
--- a/fs/gfs2/ondisk.c
+++ b/fs/gfs2/ondisk.c
@@ -7,7 +7,6 @@
7 * of the GNU General Public License version 2. 7 * of the GNU General Public License version 2.
8 */ 8 */
9 9
10#include <linux/sched.h>
11#include <linux/slab.h> 10#include <linux/slab.h>
12#include <linux/spinlock.h> 11#include <linux/spinlock.h>
13#include <linux/completion.h> 12#include <linux/completion.h>
diff --git a/fs/gfs2/ops_dentry.c b/fs/gfs2/ops_dentry.c
index 9187eb174b43..c6bac6b69420 100644
--- a/fs/gfs2/ops_dentry.c
+++ b/fs/gfs2/ops_dentry.c
@@ -7,7 +7,6 @@
7 * of the GNU General Public License version 2. 7 * of the GNU General Public License version 2.
8 */ 8 */
9 9
10#include <linux/sched.h>
11#include <linux/slab.h> 10#include <linux/slab.h>
12#include <linux/spinlock.h> 11#include <linux/spinlock.h>
13#include <linux/completion.h> 12#include <linux/completion.h>
diff --git a/fs/gfs2/ops_export.c b/fs/gfs2/ops_export.c
index 4855e8cca622..1de05b63d43a 100644
--- a/fs/gfs2/ops_export.c
+++ b/fs/gfs2/ops_export.c
@@ -7,7 +7,6 @@
7 * of the GNU General Public License version 2. 7 * of the GNU General Public License version 2.
8 */ 8 */
9 9
10#include <linux/sched.h>
11#include <linux/slab.h> 10#include <linux/slab.h>
12#include <linux/spinlock.h> 11#include <linux/spinlock.h>
13#include <linux/completion.h> 12#include <linux/completion.h>
diff --git a/fs/gfs2/ops_file.c b/fs/gfs2/ops_file.c
index c996aa739a05..b50180e22779 100644
--- a/fs/gfs2/ops_file.c
+++ b/fs/gfs2/ops_file.c
@@ -7,7 +7,6 @@
7 * of the GNU General Public License version 2. 7 * of the GNU General Public License version 2.
8 */ 8 */
9 9
10#include <linux/sched.h>
11#include <linux/slab.h> 10#include <linux/slab.h>
12#include <linux/spinlock.h> 11#include <linux/spinlock.h>
13#include <linux/completion.h> 12#include <linux/completion.h>
diff --git a/fs/gfs2/ops_inode.c b/fs/gfs2/ops_inode.c
index 60f47bf2e8e8..d85f6e05cb95 100644
--- a/fs/gfs2/ops_inode.c
+++ b/fs/gfs2/ops_inode.c
@@ -7,7 +7,6 @@
7 * of the GNU General Public License version 2. 7 * of the GNU General Public License version 2.
8 */ 8 */
9 9
10#include <linux/sched.h>
11#include <linux/slab.h> 10#include <linux/slab.h>
12#include <linux/spinlock.h> 11#include <linux/spinlock.h>
13#include <linux/completion.h> 12#include <linux/completion.h>
diff --git a/fs/gfs2/ops_vm.c b/fs/gfs2/ops_vm.c
index 14b380fb0602..aa0dbd2aac1b 100644
--- a/fs/gfs2/ops_vm.c
+++ b/fs/gfs2/ops_vm.c
@@ -7,7 +7,6 @@
7 * of the GNU General Public License version 2. 7 * of the GNU General Public License version 2.
8 */ 8 */
9 9
10#include <linux/sched.h>
11#include <linux/slab.h> 10#include <linux/slab.h>
12#include <linux/spinlock.h> 11#include <linux/spinlock.h>
13#include <linux/completion.h> 12#include <linux/completion.h>
diff --git a/fs/gfs2/recovery.c b/fs/gfs2/recovery.c
index d0c806b85c86..8bc182c7e2ef 100644
--- a/fs/gfs2/recovery.c
+++ b/fs/gfs2/recovery.c
@@ -7,7 +7,6 @@
7 * of the GNU General Public License version 2. 7 * of the GNU General Public License version 2.
8 */ 8 */
9 9
10#include <linux/sched.h>
11#include <linux/slab.h> 10#include <linux/slab.h>
12#include <linux/spinlock.h> 11#include <linux/spinlock.h>
13#include <linux/completion.h> 12#include <linux/completion.h>
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c
index ff0846528d54..8d9c08b5c4b6 100644
--- a/fs/gfs2/rgrp.c
+++ b/fs/gfs2/rgrp.c
@@ -7,7 +7,6 @@
7 * of the GNU General Public License version 2. 7 * of the GNU General Public License version 2.
8 */ 8 */
9 9
10#include <linux/sched.h>
11#include <linux/slab.h> 10#include <linux/slab.h>
12#include <linux/spinlock.h> 11#include <linux/spinlock.h>
13#include <linux/completion.h> 12#include <linux/completion.h>
diff --git a/fs/gfs2/util.c b/fs/gfs2/util.c
index e5707a9f78c2..601eaa1b9ed6 100644
--- a/fs/gfs2/util.c
+++ b/fs/gfs2/util.c
@@ -7,7 +7,6 @@
7 * of the GNU General Public License version 2. 7 * of the GNU General Public License version 2.
8 */ 8 */
9 9
10#include <linux/sched.h>
11#include <linux/slab.h> 10#include <linux/slab.h>
12#include <linux/spinlock.h> 11#include <linux/spinlock.h>
13#include <linux/completion.h> 12#include <linux/completion.h>
diff --git a/fs/hfsplus/catalog.c b/fs/hfsplus/catalog.c
index f2d7c49ce759..ba117c445e78 100644
--- a/fs/hfsplus/catalog.c
+++ b/fs/hfsplus/catalog.c
@@ -8,7 +8,6 @@
8 * Handling of catalog records 8 * Handling of catalog records
9 */ 9 */
10 10
11#include <linux/sched.h>
12 11
13#include "hfsplus_fs.h" 12#include "hfsplus_fs.h"
14#include "hfsplus_raw.h" 13#include "hfsplus_raw.h"
diff --git a/fs/hfsplus/dir.c b/fs/hfsplus/dir.c
index 78137007ccc1..80b5682a2273 100644
--- a/fs/hfsplus/dir.c
+++ b/fs/hfsplus/dir.c
@@ -10,7 +10,6 @@
10 10
11#include <linux/errno.h> 11#include <linux/errno.h>
12#include <linux/fs.h> 12#include <linux/fs.h>
13#include <linux/sched.h>
14#include <linux/slab.h> 13#include <linux/slab.h>
15#include <linux/random.h> 14#include <linux/random.h>
16 15
diff --git a/fs/hfsplus/super.c b/fs/hfsplus/super.c
index 5a282f64c637..1a97f9293447 100644
--- a/fs/hfsplus/super.c
+++ b/fs/hfsplus/super.c
@@ -11,7 +11,6 @@
11#include <linux/init.h> 11#include <linux/init.h>
12#include <linux/pagemap.h> 12#include <linux/pagemap.h>
13#include <linux/fs.h> 13#include <linux/fs.h>
14#include <linux/sched.h>
15#include <linux/slab.h> 14#include <linux/slab.h>
16#include <linux/vfs.h> 15#include <linux/vfs.h>
17#include <linux/nls.h> 16#include <linux/nls.h>
diff --git a/fs/jffs2/compr_zlib.c b/fs/jffs2/compr_zlib.c
index 3681d0728ac7..0c1fc6e20b43 100644
--- a/fs/jffs2/compr_zlib.c
+++ b/fs/jffs2/compr_zlib.c
@@ -16,7 +16,6 @@
16#endif 16#endif
17 17
18#include <linux/kernel.h> 18#include <linux/kernel.h>
19#include <linux/sched.h>
20#include <linux/slab.h> 19#include <linux/slab.h>
21#include <linux/zlib.h> 20#include <linux/zlib.h>
22#include <linux/zutil.h> 21#include <linux/zutil.h>
diff --git a/fs/jffs2/dir.c b/fs/jffs2/dir.c
index cdbe2fe14e2d..9fa2e27f0641 100644
--- a/fs/jffs2/dir.c
+++ b/fs/jffs2/dir.c
@@ -13,7 +13,6 @@
13 13
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/slab.h> 15#include <linux/slab.h>
16#include <linux/sched.h>
17#include <linux/fs.h> 16#include <linux/fs.h>
18#include <linux/crc32.h> 17#include <linux/crc32.h>
19#include <linux/jffs2.h> 18#include <linux/jffs2.h>
diff --git a/fs/jffs2/summary.c b/fs/jffs2/summary.c
index 25265965bdc1..30f888414ce7 100644
--- a/fs/jffs2/summary.c
+++ b/fs/jffs2/summary.c
@@ -14,7 +14,6 @@
14 */ 14 */
15 15
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <linux/sched.h>
18#include <linux/slab.h> 17#include <linux/slab.h>
19#include <linux/mtd/mtd.h> 18#include <linux/mtd/mtd.h>
20#include <linux/pagemap.h> 19#include <linux/pagemap.h>
diff --git a/fs/lockd/host.c b/fs/lockd/host.c
index 22d403208973..ad21c0713efa 100644
--- a/fs/lockd/host.c
+++ b/fs/lockd/host.c
@@ -9,7 +9,6 @@
9 */ 9 */
10 10
11#include <linux/types.h> 11#include <linux/types.h>
12#include <linux/sched.h>
13#include <linux/slab.h> 12#include <linux/slab.h>
14#include <linux/in.h> 13#include <linux/in.h>
15#include <linux/sunrpc/clnt.h> 14#include <linux/sunrpc/clnt.h>
diff --git a/fs/lockd/svc.c b/fs/lockd/svc.c
index 80fcacc1acf9..50cb8daba4e5 100644
--- a/fs/lockd/svc.c
+++ b/fs/lockd/svc.c
@@ -512,7 +512,7 @@ module_param(nsm_use_hostnames, bool, 0644);
512 512
513static int __init init_nlm(void) 513static int __init init_nlm(void)
514{ 514{
515 nlm_sysctl_table = register_sysctl_table(nlm_sysctl_root, 0); 515 nlm_sysctl_table = register_sysctl_table(nlm_sysctl_root);
516 return nlm_sysctl_table ? 0 : -ENOMEM; 516 return nlm_sysctl_table ? 0 : -ENOMEM;
517} 517}
518 518
diff --git a/fs/nfs/nfs4renewd.c b/fs/nfs/nfs4renewd.c
index 823298561c0a..f5f4430fb2a4 100644
--- a/fs/nfs/nfs4renewd.c
+++ b/fs/nfs/nfs4renewd.c
@@ -43,7 +43,6 @@
43 * child task framework of the RPC layer? 43 * child task framework of the RPC layer?
44 */ 44 */
45 45
46#include <linux/sched.h>
47#include <linux/smp_lock.h> 46#include <linux/smp_lock.h>
48#include <linux/mm.h> 47#include <linux/mm.h>
49#include <linux/pagemap.h> 48#include <linux/pagemap.h>
diff --git a/fs/nfs/sysctl.c b/fs/nfs/sysctl.c
index 3ea50ac64820..fcdcafbb3293 100644
--- a/fs/nfs/sysctl.c
+++ b/fs/nfs/sysctl.c
@@ -75,7 +75,7 @@ static ctl_table nfs_cb_sysctl_root[] = {
75 75
76int nfs_register_sysctl(void) 76int nfs_register_sysctl(void)
77{ 77{
78 nfs_callback_sysctl_table = register_sysctl_table(nfs_cb_sysctl_root, 0); 78 nfs_callback_sysctl_table = register_sysctl_table(nfs_cb_sysctl_root);
79 if (nfs_callback_sysctl_table == NULL) 79 if (nfs_callback_sysctl_table == NULL)
80 return -ENOMEM; 80 return -ENOMEM;
81 return 0; 81 return 0;
diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c
index 49c310b84923..6f24768272a1 100644
--- a/fs/nfsd/export.c
+++ b/fs/nfsd/export.c
@@ -16,7 +16,6 @@
16 16
17#include <linux/unistd.h> 17#include <linux/unistd.h>
18#include <linux/slab.h> 18#include <linux/slab.h>
19#include <linux/sched.h>
20#include <linux/stat.h> 19#include <linux/stat.h>
21#include <linux/in.h> 20#include <linux/in.h>
22#include <linux/seq_file.h> 21#include <linux/seq_file.h>
@@ -190,18 +189,17 @@ static int expkey_show(struct seq_file *m,
190 struct cache_head *h) 189 struct cache_head *h)
191{ 190{
192 struct svc_expkey *ek ; 191 struct svc_expkey *ek ;
192 int i;
193 193
194 if (h ==NULL) { 194 if (h ==NULL) {
195 seq_puts(m, "#domain fsidtype fsid [path]\n"); 195 seq_puts(m, "#domain fsidtype fsid [path]\n");
196 return 0; 196 return 0;
197 } 197 }
198 ek = container_of(h, struct svc_expkey, h); 198 ek = container_of(h, struct svc_expkey, h);
199 seq_printf(m, "%s %d 0x%08x", ek->ek_client->name, 199 seq_printf(m, "%s %d 0x", ek->ek_client->name,
200 ek->ek_fsidtype, ek->ek_fsid[0]); 200 ek->ek_fsidtype);
201 if (ek->ek_fsidtype != 1) 201 for (i=0; i < key_len(ek->ek_fsidtype)/4; i++)
202 seq_printf(m, "%08x", ek->ek_fsid[1]); 202 seq_printf(m, "%08x", ek->ek_fsid[i]);
203 if (ek->ek_fsidtype == 2)
204 seq_printf(m, "%08x", ek->ek_fsid[2]);
205 if (test_bit(CACHE_VALID, &h->flags) && 203 if (test_bit(CACHE_VALID, &h->flags) &&
206 !test_bit(CACHE_NEGATIVE, &h->flags)) { 204 !test_bit(CACHE_NEGATIVE, &h->flags)) {
207 seq_printf(m, " "); 205 seq_printf(m, " ");
@@ -232,9 +230,8 @@ static inline void expkey_init(struct cache_head *cnew,
232 kref_get(&item->ek_client->ref); 230 kref_get(&item->ek_client->ref);
233 new->ek_client = item->ek_client; 231 new->ek_client = item->ek_client;
234 new->ek_fsidtype = item->ek_fsidtype; 232 new->ek_fsidtype = item->ek_fsidtype;
235 new->ek_fsid[0] = item->ek_fsid[0]; 233
236 new->ek_fsid[1] = item->ek_fsid[1]; 234 memcpy(new->ek_fsid, item->ek_fsid, sizeof(new->ek_fsid));
237 new->ek_fsid[2] = item->ek_fsid[2];
238} 235}
239 236
240static inline void expkey_update(struct cache_head *cnew, 237static inline void expkey_update(struct cache_head *cnew,
@@ -363,7 +360,7 @@ static struct svc_export *svc_export_update(struct svc_export *new,
363 struct svc_export *old); 360 struct svc_export *old);
364static struct svc_export *svc_export_lookup(struct svc_export *); 361static struct svc_export *svc_export_lookup(struct svc_export *);
365 362
366static int check_export(struct inode *inode, int flags) 363static int check_export(struct inode *inode, int flags, unsigned char *uuid)
367{ 364{
368 365
369 /* We currently export only dirs and regular files. 366 /* We currently export only dirs and regular files.
@@ -376,12 +373,13 @@ static int check_export(struct inode *inode, int flags)
376 /* There are two requirements on a filesystem to be exportable. 373 /* There are two requirements on a filesystem to be exportable.
377 * 1: We must be able to identify the filesystem from a number. 374 * 1: We must be able to identify the filesystem from a number.
378 * either a device number (so FS_REQUIRES_DEV needed) 375 * either a device number (so FS_REQUIRES_DEV needed)
379 * or an FSID number (so NFSEXP_FSID needed). 376 * or an FSID number (so NFSEXP_FSID or ->uuid is needed).
380 * 2: We must be able to find an inode from a filehandle. 377 * 2: We must be able to find an inode from a filehandle.
381 * This means that s_export_op must be set. 378 * This means that s_export_op must be set.
382 */ 379 */
383 if (!(inode->i_sb->s_type->fs_flags & FS_REQUIRES_DEV) && 380 if (!(inode->i_sb->s_type->fs_flags & FS_REQUIRES_DEV) &&
384 !(flags & NFSEXP_FSID)) { 381 !(flags & NFSEXP_FSID) &&
382 uuid == NULL) {
385 dprintk("exp_export: export of non-dev fs without fsid\n"); 383 dprintk("exp_export: export of non-dev fs without fsid\n");
386 return -EINVAL; 384 return -EINVAL;
387 } 385 }
@@ -406,10 +404,6 @@ fsloc_parse(char **mesg, char *buf, struct nfsd4_fs_locations *fsloc)
406 int len; 404 int len;
407 int migrated, i, err; 405 int migrated, i, err;
408 406
409 len = qword_get(mesg, buf, PAGE_SIZE);
410 if (len != 5 || memcmp(buf, "fsloc", 5))
411 return 0;
412
413 /* listsize */ 407 /* listsize */
414 err = get_int(mesg, &fsloc->locations_count); 408 err = get_int(mesg, &fsloc->locations_count);
415 if (err) 409 if (err)
@@ -520,6 +514,8 @@ static int svc_export_parse(struct cache_detail *cd, char *mesg, int mlen)
520 exp.ex_fslocs.locations_count = 0; 514 exp.ex_fslocs.locations_count = 0;
521 exp.ex_fslocs.migrated = 0; 515 exp.ex_fslocs.migrated = 0;
522 516
517 exp.ex_uuid = NULL;
518
523 /* flags */ 519 /* flags */
524 err = get_int(&mesg, &an_int); 520 err = get_int(&mesg, &an_int);
525 if (err == -ENOENT) 521 if (err == -ENOENT)
@@ -543,12 +539,33 @@ static int svc_export_parse(struct cache_detail *cd, char *mesg, int mlen)
543 if (err) goto out; 539 if (err) goto out;
544 exp.ex_fsid = an_int; 540 exp.ex_fsid = an_int;
545 541
546 err = check_export(nd.dentry->d_inode, exp.ex_flags); 542 while ((len = qword_get(&mesg, buf, PAGE_SIZE)) > 0) {
547 if (err) goto out; 543 if (strcmp(buf, "fsloc") == 0)
544 err = fsloc_parse(&mesg, buf, &exp.ex_fslocs);
545 else if (strcmp(buf, "uuid") == 0) {
546 /* expect a 16 byte uuid encoded as \xXXXX... */
547 len = qword_get(&mesg, buf, PAGE_SIZE);
548 if (len != 16)
549 err = -EINVAL;
550 else {
551 exp.ex_uuid =
552 kmemdup(buf, 16, GFP_KERNEL);
553 if (exp.ex_uuid == NULL)
554 err = -ENOMEM;
555 }
556 } else
557 /* quietly ignore unknown words and anything
558 * following. Newer user-space can try to set
559 * new values, then see what the result was.
560 */
561 break;
562 if (err)
563 goto out;
564 }
548 565
549 err = fsloc_parse(&mesg, buf, &exp.ex_fslocs); 566 err = check_export(nd.dentry->d_inode, exp.ex_flags,
550 if (err) 567 exp.ex_uuid);
551 goto out; 568 if (err) goto out;
552 } 569 }
553 570
554 expp = svc_export_lookup(&exp); 571 expp = svc_export_lookup(&exp);
@@ -562,6 +579,8 @@ static int svc_export_parse(struct cache_detail *cd, char *mesg, int mlen)
562 else 579 else
563 exp_put(expp); 580 exp_put(expp);
564 out: 581 out:
582 nfsd4_fslocs_free(&exp.ex_fslocs);
583 kfree(exp.ex_uuid);
565 kfree(exp.ex_path); 584 kfree(exp.ex_path);
566 if (nd.dentry) 585 if (nd.dentry)
567 path_release(&nd); 586 path_release(&nd);
@@ -591,9 +610,19 @@ static int svc_export_show(struct seq_file *m,
591 seq_escape(m, exp->ex_client->name, " \t\n\\"); 610 seq_escape(m, exp->ex_client->name, " \t\n\\");
592 seq_putc(m, '('); 611 seq_putc(m, '(');
593 if (test_bit(CACHE_VALID, &h->flags) && 612 if (test_bit(CACHE_VALID, &h->flags) &&
594 !test_bit(CACHE_NEGATIVE, &h->flags)) 613 !test_bit(CACHE_NEGATIVE, &h->flags)) {
595 exp_flags(m, exp->ex_flags, exp->ex_fsid, 614 exp_flags(m, exp->ex_flags, exp->ex_fsid,
596 exp->ex_anon_uid, exp->ex_anon_gid, &exp->ex_fslocs); 615 exp->ex_anon_uid, exp->ex_anon_gid, &exp->ex_fslocs);
616 if (exp->ex_uuid) {
617 int i;
618 seq_puts(m, ",uuid=");
619 for (i=0; i<16; i++) {
620 if ((i&3) == 0 && i)
621 seq_putc(m, ':');
622 seq_printf(m, "%02x", exp->ex_uuid[i]);
623 }
624 }
625 }
597 seq_puts(m, ")\n"); 626 seq_puts(m, ")\n");
598 return 0; 627 return 0;
599} 628}
@@ -630,6 +659,8 @@ static void export_update(struct cache_head *cnew, struct cache_head *citem)
630 new->ex_anon_uid = item->ex_anon_uid; 659 new->ex_anon_uid = item->ex_anon_uid;
631 new->ex_anon_gid = item->ex_anon_gid; 660 new->ex_anon_gid = item->ex_anon_gid;
632 new->ex_fsid = item->ex_fsid; 661 new->ex_fsid = item->ex_fsid;
662 new->ex_uuid = item->ex_uuid;
663 item->ex_uuid = NULL;
633 new->ex_path = item->ex_path; 664 new->ex_path = item->ex_path;
634 item->ex_path = NULL; 665 item->ex_path = NULL;
635 new->ex_fslocs.locations = item->ex_fslocs.locations; 666 new->ex_fslocs.locations = item->ex_fslocs.locations;
@@ -752,11 +783,11 @@ exp_get_key(svc_client *clp, dev_t dev, ino_t ino)
752 u32 fsidv[3]; 783 u32 fsidv[3];
753 784
754 if (old_valid_dev(dev)) { 785 if (old_valid_dev(dev)) {
755 mk_fsid_v0(fsidv, dev, ino); 786 mk_fsid(FSID_DEV, fsidv, dev, ino, 0, NULL);
756 return exp_find_key(clp, 0, fsidv, NULL); 787 return exp_find_key(clp, FSID_DEV, fsidv, NULL);
757 } 788 }
758 mk_fsid_v3(fsidv, dev, ino); 789 mk_fsid(FSID_ENCODE_DEV, fsidv, dev, ino, 0, NULL);
759 return exp_find_key(clp, 3, fsidv, NULL); 790 return exp_find_key(clp, FSID_ENCODE_DEV, fsidv, NULL);
760} 791}
761 792
762/* 793/*
@@ -767,9 +798,9 @@ exp_get_fsid_key(svc_client *clp, int fsid)
767{ 798{
768 u32 fsidv[2]; 799 u32 fsidv[2];
769 800
770 mk_fsid_v1(fsidv, fsid); 801 mk_fsid(FSID_NUM, fsidv, 0, 0, fsid, NULL);
771 802
772 return exp_find_key(clp, 1, fsidv, NULL); 803 return exp_find_key(clp, FSID_NUM, fsidv, NULL);
773} 804}
774 805
775svc_export * 806svc_export *
@@ -883,8 +914,8 @@ static int exp_fsid_hash(svc_client *clp, struct svc_export *exp)
883 if ((exp->ex_flags & NFSEXP_FSID) == 0) 914 if ((exp->ex_flags & NFSEXP_FSID) == 0)
884 return 0; 915 return 0;
885 916
886 mk_fsid_v1(fsid, exp->ex_fsid); 917 mk_fsid(FSID_NUM, fsid, 0, 0, exp->ex_fsid, NULL);
887 return exp_set_key(clp, 1, fsid, exp); 918 return exp_set_key(clp, FSID_NUM, fsid, exp);
888} 919}
889 920
890static int exp_hash(struct auth_domain *clp, struct svc_export *exp) 921static int exp_hash(struct auth_domain *clp, struct svc_export *exp)
@@ -894,11 +925,11 @@ static int exp_hash(struct auth_domain *clp, struct svc_export *exp)
894 dev_t dev = inode->i_sb->s_dev; 925 dev_t dev = inode->i_sb->s_dev;
895 926
896 if (old_valid_dev(dev)) { 927 if (old_valid_dev(dev)) {
897 mk_fsid_v0(fsid, dev, inode->i_ino); 928 mk_fsid(FSID_DEV, fsid, dev, inode->i_ino, 0, NULL);
898 return exp_set_key(clp, 0, fsid, exp); 929 return exp_set_key(clp, FSID_DEV, fsid, exp);
899 } 930 }
900 mk_fsid_v3(fsid, dev, inode->i_ino); 931 mk_fsid(FSID_ENCODE_DEV, fsid, dev, inode->i_ino, 0, NULL);
901 return exp_set_key(clp, 3, fsid, exp); 932 return exp_set_key(clp, FSID_ENCODE_DEV, fsid, exp);
902} 933}
903 934
904static void exp_unhash(struct svc_export *exp) 935static void exp_unhash(struct svc_export *exp)
@@ -977,7 +1008,7 @@ exp_export(struct nfsctl_export *nxp)
977 goto finish; 1008 goto finish;
978 } 1009 }
979 1010
980 err = check_export(nd.dentry->d_inode, nxp->ex_flags); 1011 err = check_export(nd.dentry->d_inode, nxp->ex_flags, NULL);
981 if (err) goto finish; 1012 if (err) goto finish;
982 1013
983 err = -ENOMEM; 1014 err = -ENOMEM;
@@ -1170,9 +1201,9 @@ exp_pseudoroot(struct auth_domain *clp, struct svc_fh *fhp,
1170 __be32 rv; 1201 __be32 rv;
1171 u32 fsidv[2]; 1202 u32 fsidv[2];
1172 1203
1173 mk_fsid_v1(fsidv, 0); 1204 mk_fsid(FSID_NUM, fsidv, 0, 0, 0, NULL);
1174 1205
1175 exp = exp_find(clp, 1, fsidv, creq); 1206 exp = exp_find(clp, FSID_NUM, fsidv, creq);
1176 if (IS_ERR(exp)) 1207 if (IS_ERR(exp))
1177 return nfserrno(PTR_ERR(exp)); 1208 return nfserrno(PTR_ERR(exp));
1178 if (exp == NULL) 1209 if (exp == NULL)
diff --git a/fs/nfsd/nfs3xdr.c b/fs/nfsd/nfs3xdr.c
index e695660921ec..6f677988c71d 100644
--- a/fs/nfsd/nfs3xdr.c
+++ b/fs/nfsd/nfs3xdr.c
@@ -149,6 +149,27 @@ decode_sattr3(__be32 *p, struct iattr *iap)
149 return p; 149 return p;
150} 150}
151 151
152static __be32 *encode_fsid(__be32 *p, struct svc_fh *fhp)
153{
154 u64 f;
155 switch(fsid_source(fhp)) {
156 default:
157 case FSIDSOURCE_DEV:
158 p = xdr_encode_hyper(p, (u64)huge_encode_dev
159 (fhp->fh_dentry->d_inode->i_sb->s_dev));
160 break;
161 case FSIDSOURCE_FSID:
162 p = xdr_encode_hyper(p, (u64) fhp->fh_export->ex_fsid);
163 break;
164 case FSIDSOURCE_UUID:
165 f = ((u64*)fhp->fh_export->ex_uuid)[0];
166 f ^= ((u64*)fhp->fh_export->ex_uuid)[1];
167 p = xdr_encode_hyper(p, f);
168 break;
169 }
170 return p;
171}
172
152static __be32 * 173static __be32 *
153encode_fattr3(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp, 174encode_fattr3(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp,
154 struct kstat *stat) 175 struct kstat *stat)
@@ -169,10 +190,7 @@ encode_fattr3(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp,
169 p = xdr_encode_hyper(p, ((u64)stat->blocks) << 9); 190 p = xdr_encode_hyper(p, ((u64)stat->blocks) << 9);
170 *p++ = htonl((u32) MAJOR(stat->rdev)); 191 *p++ = htonl((u32) MAJOR(stat->rdev));
171 *p++ = htonl((u32) MINOR(stat->rdev)); 192 *p++ = htonl((u32) MINOR(stat->rdev));
172 if (is_fsid(fhp, rqstp->rq_reffh)) 193 p = encode_fsid(p, fhp);
173 p = xdr_encode_hyper(p, (u64) fhp->fh_export->ex_fsid);
174 else
175 p = xdr_encode_hyper(p, (u64) huge_encode_dev(stat->dev));
176 p = xdr_encode_hyper(p, (u64) stat->ino); 194 p = xdr_encode_hyper(p, (u64) stat->ino);
177 p = encode_time3(p, &stat->atime); 195 p = encode_time3(p, &stat->atime);
178 lease_get_mtime(dentry->d_inode, &time); 196 lease_get_mtime(dentry->d_inode, &time);
@@ -203,10 +221,7 @@ encode_saved_post_attr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp)
203 p = xdr_encode_hyper(p, ((u64)fhp->fh_post_blocks) << 9); 221 p = xdr_encode_hyper(p, ((u64)fhp->fh_post_blocks) << 9);
204 *p++ = fhp->fh_post_rdev[0]; 222 *p++ = fhp->fh_post_rdev[0];
205 *p++ = fhp->fh_post_rdev[1]; 223 *p++ = fhp->fh_post_rdev[1];
206 if (is_fsid(fhp, rqstp->rq_reffh)) 224 p = encode_fsid(p, fhp);
207 p = xdr_encode_hyper(p, (u64) fhp->fh_export->ex_fsid);
208 else
209 p = xdr_encode_hyper(p, (u64)huge_encode_dev(inode->i_sb->s_dev));
210 p = xdr_encode_hyper(p, (u64) inode->i_ino); 225 p = xdr_encode_hyper(p, (u64) inode->i_ino);
211 p = encode_time3(p, &fhp->fh_post_atime); 226 p = encode_time3(p, &fhp->fh_post_atime);
212 p = encode_time3(p, &fhp->fh_post_mtime); 227 p = encode_time3(p, &fhp->fh_post_mtime);
diff --git a/fs/nfsd/nfs4idmap.c b/fs/nfsd/nfs4idmap.c
index b1902ebaab41..e4a83d727afd 100644
--- a/fs/nfsd/nfs4idmap.c
+++ b/fs/nfsd/nfs4idmap.c
@@ -50,7 +50,6 @@
50#include <linux/sunrpc/cache.h> 50#include <linux/sunrpc/cache.h>
51#include <linux/nfsd_idmap.h> 51#include <linux/nfsd_idmap.h>
52#include <linux/list.h> 52#include <linux/list.h>
53#include <linux/sched.h>
54#include <linux/time.h> 53#include <linux/time.h>
55#include <linux/seq_file.h> 54#include <linux/seq_file.h>
56#include <linux/sunrpc/svcauth.h> 55#include <linux/sunrpc/svcauth.h>
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index 18aa9440df14..0efba557fb55 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -1563,14 +1563,20 @@ nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp,
1563 if (exp->ex_fslocs.migrated) { 1563 if (exp->ex_fslocs.migrated) {
1564 WRITE64(NFS4_REFERRAL_FSID_MAJOR); 1564 WRITE64(NFS4_REFERRAL_FSID_MAJOR);
1565 WRITE64(NFS4_REFERRAL_FSID_MINOR); 1565 WRITE64(NFS4_REFERRAL_FSID_MINOR);
1566 } else if (is_fsid(fhp, rqstp->rq_reffh)) { 1566 } else switch(fsid_source(fhp)) {
1567 case FSIDSOURCE_FSID:
1567 WRITE64((u64)exp->ex_fsid); 1568 WRITE64((u64)exp->ex_fsid);
1568 WRITE64((u64)0); 1569 WRITE64((u64)0);
1569 } else { 1570 break;
1571 case FSIDSOURCE_DEV:
1570 WRITE32(0); 1572 WRITE32(0);
1571 WRITE32(MAJOR(stat.dev)); 1573 WRITE32(MAJOR(stat.dev));
1572 WRITE32(0); 1574 WRITE32(0);
1573 WRITE32(MINOR(stat.dev)); 1575 WRITE32(MINOR(stat.dev));
1576 break;
1577 case FSIDSOURCE_UUID:
1578 WRITEMEM(exp->ex_uuid, 16);
1579 break;
1574 } 1580 }
1575 } 1581 }
1576 if (bmval0 & FATTR4_WORD0_UNIQUE_HANDLES) { 1582 if (bmval0 & FATTR4_WORD0_UNIQUE_HANDLES) {
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
index eedf2e3990a9..71c686dc7257 100644
--- a/fs/nfsd/nfsctl.c
+++ b/fs/nfsd/nfsctl.c
@@ -123,7 +123,7 @@ static ssize_t nfsctl_transaction_write(struct file *file, const char __user *bu
123 return PTR_ERR(data); 123 return PTR_ERR(data);
124 124
125 rv = write_op[ino](file, data, size); 125 rv = write_op[ino](file, data, size);
126 if (rv>0) { 126 if (rv >= 0) {
127 simple_transaction_set(file, rv); 127 simple_transaction_set(file, rv);
128 rv = size; 128 rv = size;
129 } 129 }
diff --git a/fs/nfsd/nfsfh.c b/fs/nfsd/nfsfh.c
index a0b4282cb284..c2660cbfcd96 100644
--- a/fs/nfsd/nfsfh.c
+++ b/fs/nfsd/nfsfh.c
@@ -9,7 +9,6 @@
9 * ... and again Southern-Winter 2001 to support export_operations 9 * ... and again Southern-Winter 2001 to support export_operations
10 */ 10 */
11 11
12#include <linux/sched.h>
13#include <linux/slab.h> 12#include <linux/slab.h>
14#include <linux/smp_lock.h> 13#include <linux/smp_lock.h>
15#include <linux/fs.h> 14#include <linux/fs.h>
@@ -119,9 +118,6 @@ fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, int access)
119 118
120 dprintk("nfsd: fh_verify(%s)\n", SVCFH_fmt(fhp)); 119 dprintk("nfsd: fh_verify(%s)\n", SVCFH_fmt(fhp));
121 120
122 /* keep this filehandle for possible reference when encoding attributes */
123 rqstp->rq_reffh = fh;
124
125 if (!fhp->fh_dentry) { 121 if (!fhp->fh_dentry) {
126 __u32 *datap=NULL; 122 __u32 *datap=NULL;
127 __u32 tfh[3]; /* filehandle fragment for oldstyle filehandles */ 123 __u32 tfh[3]; /* filehandle fragment for oldstyle filehandles */
@@ -146,10 +142,10 @@ fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, int access)
146 } 142 }
147 len = key_len(fh->fh_fsid_type) / 4; 143 len = key_len(fh->fh_fsid_type) / 4;
148 if (len == 0) goto out; 144 if (len == 0) goto out;
149 if (fh->fh_fsid_type == 2) { 145 if (fh->fh_fsid_type == FSID_MAJOR_MINOR) {
150 /* deprecated, convert to type 3 */ 146 /* deprecated, convert to type 3 */
151 len = 3; 147 len = key_len(FSID_ENCODE_DEV)/4;
152 fh->fh_fsid_type = 3; 148 fh->fh_fsid_type = FSID_ENCODE_DEV;
153 fh->fh_fsid[0] = new_encode_dev(MKDEV(ntohl(fh->fh_fsid[0]), ntohl(fh->fh_fsid[1]))); 149 fh->fh_fsid[0] = new_encode_dev(MKDEV(ntohl(fh->fh_fsid[0]), ntohl(fh->fh_fsid[1])));
154 fh->fh_fsid[1] = fh->fh_fsid[2]; 150 fh->fh_fsid[1] = fh->fh_fsid[2];
155 } 151 }
@@ -164,8 +160,9 @@ fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, int access)
164 /* assume old filehandle format */ 160 /* assume old filehandle format */
165 xdev = old_decode_dev(fh->ofh_xdev); 161 xdev = old_decode_dev(fh->ofh_xdev);
166 xino = u32_to_ino_t(fh->ofh_xino); 162 xino = u32_to_ino_t(fh->ofh_xino);
167 mk_fsid_v0(tfh, xdev, xino); 163 mk_fsid(FSID_DEV, tfh, xdev, xino, 0, NULL);
168 exp = exp_find(rqstp->rq_client, 0, tfh, &rqstp->rq_chandle); 164 exp = exp_find(rqstp->rq_client, FSID_DEV, tfh,
165 &rqstp->rq_chandle);
169 } 166 }
170 167
171 if (IS_ERR(exp) && (PTR_ERR(exp) == -EAGAIN 168 if (IS_ERR(exp) && (PTR_ERR(exp) == -EAGAIN
@@ -212,7 +209,7 @@ fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, int access)
212 fileid_type = 2; 209 fileid_type = 2;
213 } else 210 } else
214 fileid_type = fh->fh_fileid_type; 211 fileid_type = fh->fh_fileid_type;
215 212
216 if (fileid_type == 0) 213 if (fileid_type == 0)
217 dentry = dget(exp->ex_dentry); 214 dentry = dget(exp->ex_dentry);
218 else { 215 else {
@@ -292,7 +289,7 @@ static inline int _fh_update(struct dentry *dentry, struct svc_export *exp,
292 __u32 *datap, int *maxsize) 289 __u32 *datap, int *maxsize)
293{ 290{
294 struct export_operations *nop = exp->ex_mnt->mnt_sb->s_export_op; 291 struct export_operations *nop = exp->ex_mnt->mnt_sb->s_export_op;
295 292
296 if (dentry == exp->ex_dentry) { 293 if (dentry == exp->ex_dentry) {
297 *maxsize = 0; 294 *maxsize = 0;
298 return 0; 295 return 0;
@@ -317,7 +314,8 @@ static inline void _fh_update_old(struct dentry *dentry,
317} 314}
318 315
319__be32 316__be32
320fh_compose(struct svc_fh *fhp, struct svc_export *exp, struct dentry *dentry, struct svc_fh *ref_fh) 317fh_compose(struct svc_fh *fhp, struct svc_export *exp, struct dentry *dentry,
318 struct svc_fh *ref_fh)
321{ 319{
322 /* ref_fh is a reference file handle. 320 /* ref_fh is a reference file handle.
323 * if it is non-null and for the same filesystem, then we should compose 321 * if it is non-null and for the same filesystem, then we should compose
@@ -327,12 +325,13 @@ fh_compose(struct svc_fh *fhp, struct svc_export *exp, struct dentry *dentry, st
327 * 325 *
328 */ 326 */
329 327
330 u8 ref_fh_version = 0; 328 u8 version = 1;
331 u8 ref_fh_fsid_type = 0; 329 u8 fsid_type = 0;
332 struct inode * inode = dentry->d_inode; 330 struct inode * inode = dentry->d_inode;
333 struct dentry *parent = dentry->d_parent; 331 struct dentry *parent = dentry->d_parent;
334 __u32 *datap; 332 __u32 *datap;
335 dev_t ex_dev = exp->ex_dentry->d_inode->i_sb->s_dev; 333 dev_t ex_dev = exp->ex_dentry->d_inode->i_sb->s_dev;
334 int root_export = (exp->ex_dentry == exp->ex_dentry->d_sb->s_root);
336 335
337 dprintk("nfsd: fh_compose(exp %02x:%02x/%ld %s/%s, ino=%ld)\n", 336 dprintk("nfsd: fh_compose(exp %02x:%02x/%ld %s/%s, ino=%ld)\n",
338 MAJOR(ex_dev), MINOR(ex_dev), 337 MAJOR(ex_dev), MINOR(ex_dev),
@@ -340,57 +339,64 @@ fh_compose(struct svc_fh *fhp, struct svc_export *exp, struct dentry *dentry, st
340 parent->d_name.name, dentry->d_name.name, 339 parent->d_name.name, dentry->d_name.name,
341 (inode ? inode->i_ino : 0)); 340 (inode ? inode->i_ino : 0));
342 341
342 /* Choose filehandle version and fsid type based on
343 * the reference filehandle (if it is in the same export)
344 * or the export options.
345 */
343 if (ref_fh && ref_fh->fh_export == exp) { 346 if (ref_fh && ref_fh->fh_export == exp) {
344 ref_fh_version = ref_fh->fh_handle.fh_version; 347 version = ref_fh->fh_handle.fh_version;
345 if (ref_fh_version == 0xca) 348 if (version == 0xca)
346 ref_fh_fsid_type = 0; 349 fsid_type = FSID_DEV;
347 else 350 else
348 ref_fh_fsid_type = ref_fh->fh_handle.fh_fsid_type; 351 fsid_type = ref_fh->fh_handle.fh_fsid_type;
349 if (ref_fh_fsid_type > 3) 352 /* We know this version/type works for this export
350 ref_fh_fsid_type = 0; 353 * so there is no need for further checks.
351 354 */
352 /* make sure ref_fh type works for given export */ 355 } else if (exp->ex_uuid) {
353 if (ref_fh_fsid_type == 1 && 356 if (fhp->fh_maxsize >= 64) {
354 !(exp->ex_flags & NFSEXP_FSID)) { 357 if (root_export)
355 /* if we don't have an fsid, we cannot provide one... */ 358 fsid_type = FSID_UUID16;
356 ref_fh_fsid_type = 0; 359 else
360 fsid_type = FSID_UUID16_INUM;
361 } else {
362 if (root_export)
363 fsid_type = FSID_UUID8;
364 else
365 fsid_type = FSID_UUID4_INUM;
357 } 366 }
358 } else if (exp->ex_flags & NFSEXP_FSID) 367 } else if (exp->ex_flags & NFSEXP_FSID)
359 ref_fh_fsid_type = 1; 368 fsid_type = FSID_NUM;
360 369 else if (!old_valid_dev(ex_dev))
361 if (!old_valid_dev(ex_dev) && ref_fh_fsid_type == 0) {
362 /* for newer device numbers, we must use a newer fsid format */ 370 /* for newer device numbers, we must use a newer fsid format */
363 ref_fh_version = 1; 371 fsid_type = FSID_ENCODE_DEV;
364 ref_fh_fsid_type = 3; 372 else
365 } 373 fsid_type = FSID_DEV;
366 if (old_valid_dev(ex_dev) &&
367 (ref_fh_fsid_type == 2 || ref_fh_fsid_type == 3))
368 /* must use type1 for smaller device numbers */
369 ref_fh_fsid_type = 0;
370 374
371 if (ref_fh == fhp) 375 if (ref_fh == fhp)
372 fh_put(ref_fh); 376 fh_put(ref_fh);
373 377
374 if (fhp->fh_locked || fhp->fh_dentry) { 378 if (fhp->fh_locked || fhp->fh_dentry) {
375 printk(KERN_ERR "fh_compose: fh %s/%s not initialized!\n", 379 printk(KERN_ERR "fh_compose: fh %s/%s not initialized!\n",
376 parent->d_name.name, dentry->d_name.name); 380 parent->d_name.name, dentry->d_name.name);
377 } 381 }
378 if (fhp->fh_maxsize < NFS_FHSIZE) 382 if (fhp->fh_maxsize < NFS_FHSIZE)
379 printk(KERN_ERR "fh_compose: called with maxsize %d! %s/%s\n", 383 printk(KERN_ERR "fh_compose: called with maxsize %d! %s/%s\n",
380 fhp->fh_maxsize, parent->d_name.name, dentry->d_name.name); 384 fhp->fh_maxsize,
385 parent->d_name.name, dentry->d_name.name);
381 386
382 fhp->fh_dentry = dget(dentry); /* our internal copy */ 387 fhp->fh_dentry = dget(dentry); /* our internal copy */
383 fhp->fh_export = exp; 388 fhp->fh_export = exp;
384 cache_get(&exp->h); 389 cache_get(&exp->h);
385 390
386 if (ref_fh_version == 0xca) { 391 if (version == 0xca) {
387 /* old style filehandle please */ 392 /* old style filehandle please */
388 memset(&fhp->fh_handle.fh_base, 0, NFS_FHSIZE); 393 memset(&fhp->fh_handle.fh_base, 0, NFS_FHSIZE);
389 fhp->fh_handle.fh_size = NFS_FHSIZE; 394 fhp->fh_handle.fh_size = NFS_FHSIZE;
390 fhp->fh_handle.ofh_dcookie = 0xfeebbaca; 395 fhp->fh_handle.ofh_dcookie = 0xfeebbaca;
391 fhp->fh_handle.ofh_dev = old_encode_dev(ex_dev); 396 fhp->fh_handle.ofh_dev = old_encode_dev(ex_dev);
392 fhp->fh_handle.ofh_xdev = fhp->fh_handle.ofh_dev; 397 fhp->fh_handle.ofh_xdev = fhp->fh_handle.ofh_dev;
393 fhp->fh_handle.ofh_xino = ino_t_to_u32(exp->ex_dentry->d_inode->i_ino); 398 fhp->fh_handle.ofh_xino =
399 ino_t_to_u32(exp->ex_dentry->d_inode->i_ino);
394 fhp->fh_handle.ofh_dirino = ino_t_to_u32(parent_ino(dentry)); 400 fhp->fh_handle.ofh_dirino = ino_t_to_u32(parent_ino(dentry));
395 if (inode) 401 if (inode)
396 _fh_update_old(dentry, exp, &fhp->fh_handle); 402 _fh_update_old(dentry, exp, &fhp->fh_handle);
@@ -399,38 +405,12 @@ fh_compose(struct svc_fh *fhp, struct svc_export *exp, struct dentry *dentry, st
399 fhp->fh_handle.fh_version = 1; 405 fhp->fh_handle.fh_version = 1;
400 fhp->fh_handle.fh_auth_type = 0; 406 fhp->fh_handle.fh_auth_type = 0;
401 datap = fhp->fh_handle.fh_auth+0; 407 datap = fhp->fh_handle.fh_auth+0;
402 fhp->fh_handle.fh_fsid_type = ref_fh_fsid_type; 408 fhp->fh_handle.fh_fsid_type = fsid_type;
403 switch (ref_fh_fsid_type) { 409 mk_fsid(fsid_type, datap, ex_dev,
404 case 0: 410 exp->ex_dentry->d_inode->i_ino,
405 /* 411 exp->ex_fsid, exp->ex_uuid);
406 * fsid_type 0: 412
407 * 2byte major, 2byte minor, 4byte inode 413 len = key_len(fsid_type);
408 */
409 mk_fsid_v0(datap, ex_dev,
410 exp->ex_dentry->d_inode->i_ino);
411 break;
412 case 1:
413 /* fsid_type 1 == 4 bytes filesystem id */
414 mk_fsid_v1(datap, exp->ex_fsid);
415 break;
416 case 2:
417 /*
418 * fsid_type 2:
419 * 4byte major, 4byte minor, 4byte inode
420 */
421 mk_fsid_v2(datap, ex_dev,
422 exp->ex_dentry->d_inode->i_ino);
423 break;
424 case 3:
425 /*
426 * fsid_type 3:
427 * 4byte devicenumber, 4byte inode
428 */
429 mk_fsid_v3(datap, ex_dev,
430 exp->ex_dentry->d_inode->i_ino);
431 break;
432 }
433 len = key_len(ref_fh_fsid_type);
434 datap += len/4; 414 datap += len/4;
435 fhp->fh_handle.fh_size = 4 + len; 415 fhp->fh_handle.fh_size = 4 + len;
436 416
@@ -457,7 +437,7 @@ fh_update(struct svc_fh *fhp)
457{ 437{
458 struct dentry *dentry; 438 struct dentry *dentry;
459 __u32 *datap; 439 __u32 *datap;
460 440
461 if (!fhp->fh_dentry) 441 if (!fhp->fh_dentry)
462 goto out_bad; 442 goto out_bad;
463 443
@@ -534,3 +514,22 @@ char * SVCFH_fmt(struct svc_fh *fhp)
534 fh->fh_base.fh_pad[5]); 514 fh->fh_base.fh_pad[5]);
535 return buf; 515 return buf;
536} 516}
517
518enum fsid_source fsid_source(struct svc_fh *fhp)
519{
520 if (fhp->fh_handle.fh_version != 1)
521 return FSIDSOURCE_DEV;
522 switch(fhp->fh_handle.fh_fsid_type) {
523 case FSID_DEV:
524 case FSID_ENCODE_DEV:
525 case FSID_MAJOR_MINOR:
526 return FSIDSOURCE_DEV;
527 case FSID_NUM:
528 return FSIDSOURCE_FSID;
529 default:
530 if (fhp->fh_export->ex_flags & NFSEXP_FSID)
531 return FSIDSOURCE_FSID;
532 else
533 return FSIDSOURCE_UUID;
534 }
535}
diff --git a/fs/nfsd/nfsxdr.c b/fs/nfsd/nfsxdr.c
index 6555c50d9006..0c24b9e24fe8 100644
--- a/fs/nfsd/nfsxdr.c
+++ b/fs/nfsd/nfsxdr.c
@@ -153,6 +153,7 @@ encode_fattr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp,
153 struct dentry *dentry = fhp->fh_dentry; 153 struct dentry *dentry = fhp->fh_dentry;
154 int type; 154 int type;
155 struct timespec time; 155 struct timespec time;
156 u32 f;
156 157
157 type = (stat->mode & S_IFMT); 158 type = (stat->mode & S_IFMT);
158 159
@@ -173,10 +174,22 @@ encode_fattr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp,
173 else 174 else
174 *p++ = htonl(0xffffffff); 175 *p++ = htonl(0xffffffff);
175 *p++ = htonl((u32) stat->blocks); 176 *p++ = htonl((u32) stat->blocks);
176 if (is_fsid(fhp, rqstp->rq_reffh)) 177 switch (fsid_source(fhp)) {
177 *p++ = htonl((u32) fhp->fh_export->ex_fsid); 178 default:
178 else 179 case FSIDSOURCE_DEV:
179 *p++ = htonl(new_encode_dev(stat->dev)); 180 *p++ = htonl(new_encode_dev(stat->dev));
181 break;
182 case FSIDSOURCE_FSID:
183 *p++ = htonl((u32) fhp->fh_export->ex_fsid);
184 break;
185 case FSIDSOURCE_UUID:
186 f = ((u32*)fhp->fh_export->ex_uuid)[0];
187 f ^= ((u32*)fhp->fh_export->ex_uuid)[1];
188 f ^= ((u32*)fhp->fh_export->ex_uuid)[2];
189 f ^= ((u32*)fhp->fh_export->ex_uuid)[3];
190 *p++ = htonl(f);
191 break;
192 }
180 *p++ = htonl((u32) stat->ino); 193 *p++ = htonl((u32) stat->ino);
181 *p++ = htonl((u32) stat->atime.tv_sec); 194 *p++ = htonl((u32) stat->atime.tv_sec);
182 *p++ = htonl(stat->atime.tv_nsec ? stat->atime.tv_nsec / 1000 : 0); 195 *p++ = htonl(stat->atime.tv_nsec ? stat->atime.tv_nsec / 1000 : 0);
diff --git a/fs/ntfs/sysctl.c b/fs/ntfs/sysctl.c
index 1c23138d00b3..4847fbfb0107 100644
--- a/fs/ntfs/sysctl.c
+++ b/fs/ntfs/sysctl.c
@@ -33,20 +33,28 @@
33#include "sysctl.h" 33#include "sysctl.h"
34#include "debug.h" 34#include "debug.h"
35 35
36#define FS_NTFS 1
37
38/* Definition of the ntfs sysctl. */ 36/* Definition of the ntfs sysctl. */
39static ctl_table ntfs_sysctls[] = { 37static ctl_table ntfs_sysctls[] = {
40 { FS_NTFS, "ntfs-debug", /* Binary and text IDs. */ 38 {
41 &debug_msgs,sizeof(debug_msgs), /* Data pointer and size. */ 39 .ctl_name = CTL_UNNUMBERED, /* Binary and text IDs. */
42 0644, NULL, &proc_dointvec }, /* Mode, child, proc handler. */ 40 .procname = "ntfs-debug",
43 { 0 } 41 .data = &debug_msgs, /* Data pointer and size. */
42 .maxlen = sizeof(debug_msgs),
43 .mode = 0644, /* Mode, proc handler. */
44 .proc_handler = &proc_dointvec
45 },
46 {}
44}; 47};
45 48
46/* Define the parent directory /proc/sys/fs. */ 49/* Define the parent directory /proc/sys/fs. */
47static ctl_table sysctls_root[] = { 50static ctl_table sysctls_root[] = {
48 { CTL_FS, "fs", NULL, 0, 0555, ntfs_sysctls }, 51 {
49 { 0 } 52 .ctl_name = CTL_FS,
53 .procname = "fs",
54 .mode = 0555,
55 .child = ntfs_sysctls
56 },
57 {}
50}; 58};
51 59
52/* Storage for the sysctls header. */ 60/* Storage for the sysctls header. */
@@ -62,17 +70,9 @@ int ntfs_sysctl(int add)
62{ 70{
63 if (add) { 71 if (add) {
64 BUG_ON(sysctls_root_table); 72 BUG_ON(sysctls_root_table);
65 sysctls_root_table = register_sysctl_table(sysctls_root, 0); 73 sysctls_root_table = register_sysctl_table(sysctls_root);
66 if (!sysctls_root_table) 74 if (!sysctls_root_table)
67 return -ENOMEM; 75 return -ENOMEM;
68#ifdef CONFIG_PROC_FS
69 /*
70 * If the proc filesystem is in use and we are a module, need
71 * to set the owner of our proc entry to our module. In the
72 * non-modular case, THIS_MODULE is NULL, so this is ok.
73 */
74 ntfs_sysctls[0].de->owner = THIS_MODULE;
75#endif
76 } else { 76 } else {
77 BUG_ON(!sysctls_root_table); 77 BUG_ON(!sysctls_root_table);
78 unregister_sysctl_table(sysctls_root_table); 78 unregister_sysctl_table(sysctls_root_table);
diff --git a/fs/ocfs2/cluster/nodemanager.c b/fs/ocfs2/cluster/nodemanager.c
index b17333a0606b..9f5ad0f01ce0 100644
--- a/fs/ocfs2/cluster/nodemanager.c
+++ b/fs/ocfs2/cluster/nodemanager.c
@@ -55,7 +55,7 @@ static ctl_table ocfs2_nm_table[] = {
55 55
56static ctl_table ocfs2_mod_table[] = { 56static ctl_table ocfs2_mod_table[] = {
57 { 57 {
58 .ctl_name = KERN_OCFS2_NM, 58 .ctl_name = FS_OCFS2_NM,
59 .procname = "nm", 59 .procname = "nm",
60 .data = NULL, 60 .data = NULL,
61 .maxlen = 0, 61 .maxlen = 0,
@@ -67,7 +67,7 @@ static ctl_table ocfs2_mod_table[] = {
67 67
68static ctl_table ocfs2_kern_table[] = { 68static ctl_table ocfs2_kern_table[] = {
69 { 69 {
70 .ctl_name = KERN_OCFS2, 70 .ctl_name = FS_OCFS2,
71 .procname = "ocfs2", 71 .procname = "ocfs2",
72 .data = NULL, 72 .data = NULL,
73 .maxlen = 0, 73 .maxlen = 0,
@@ -922,7 +922,7 @@ static int __init init_o2nm(void)
922 o2hb_init(); 922 o2hb_init();
923 o2net_init(); 923 o2net_init();
924 924
925 ocfs2_table_header = register_sysctl_table(ocfs2_root_table, 0); 925 ocfs2_table_header = register_sysctl_table(ocfs2_root_table);
926 if (!ocfs2_table_header) { 926 if (!ocfs2_table_header) {
927 printk(KERN_ERR "nodemanager: unable to register sysctl\n"); 927 printk(KERN_ERR "nodemanager: unable to register sysctl\n");
928 ret = -ENOMEM; /* or something. */ 928 ret = -ENOMEM; /* or something. */
diff --git a/fs/ocfs2/cluster/nodemanager.h b/fs/ocfs2/cluster/nodemanager.h
index 8fb23cacc2f5..070522138ae2 100644
--- a/fs/ocfs2/cluster/nodemanager.h
+++ b/fs/ocfs2/cluster/nodemanager.h
@@ -33,8 +33,7 @@
33#include <linux/configfs.h> 33#include <linux/configfs.h>
34#include <linux/rbtree.h> 34#include <linux/rbtree.h>
35 35
36#define KERN_OCFS2 988 36#define FS_OCFS2_NM 1
37#define KERN_OCFS2_NM 1
38 37
39const char *o2nm_get_hb_ctl_path(void); 38const char *o2nm_get_hb_ctl_path(void);
40 39
diff --git a/fs/proc/Makefile b/fs/proc/Makefile
index f6c776272572..a6b3a8f878f0 100644
--- a/fs/proc/Makefile
+++ b/fs/proc/Makefile
@@ -8,7 +8,7 @@ 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 11 proc_tty.o proc_misc.o proc_sysctl.o
12 12
13proc-$(CONFIG_PROC_KCORE) += kcore.o 13proc-$(CONFIG_PROC_KCORE) += kcore.o
14proc-$(CONFIG_PROC_VMCORE) += vmcore.o 14proc-$(CONFIG_PROC_VMCORE) += vmcore.o
diff --git a/fs/proc/generic.c b/fs/proc/generic.c
index 0cdc00d9d97e..775fb21294d8 100644
--- a/fs/proc/generic.c
+++ b/fs/proc/generic.c
@@ -32,7 +32,7 @@ static loff_t proc_file_lseek(struct file *, loff_t, int);
32 32
33DEFINE_SPINLOCK(proc_subdir_lock); 33DEFINE_SPINLOCK(proc_subdir_lock);
34 34
35int proc_match(int len, const char *name, struct proc_dir_entry *de) 35static int proc_match(int len, const char *name, struct proc_dir_entry *de)
36{ 36{
37 if (de->namelen != len) 37 if (de->namelen != len)
38 return 0; 38 return 0;
diff --git a/fs/proc/inode.c b/fs/proc/inode.c
index f6722be37dde..c372eb151a3a 100644
--- a/fs/proc/inode.c
+++ b/fs/proc/inode.c
@@ -161,6 +161,7 @@ struct inode *proc_get_inode(struct super_block *sb, unsigned int ino,
161 if (!inode) 161 if (!inode)
162 goto out_ino; 162 goto out_ino;
163 163
164 PROC_I(inode)->fd = 0;
164 PROC_I(inode)->pde = de; 165 PROC_I(inode)->pde = de;
165 if (de) { 166 if (de) {
166 if (de->mode) { 167 if (de->mode) {
diff --git a/fs/proc/internal.h b/fs/proc/internal.h
index 277dcd66ebe2..c932aa65e198 100644
--- a/fs/proc/internal.h
+++ b/fs/proc/internal.h
@@ -11,6 +11,8 @@
11 11
12#include <linux/proc_fs.h> 12#include <linux/proc_fs.h>
13 13
14extern int proc_sys_init(void);
15
14struct vmalloc_info { 16struct vmalloc_info {
15 unsigned long used; 17 unsigned long used;
16 unsigned long largest_chunk; 18 unsigned long largest_chunk;
diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
new file mode 100644
index 000000000000..20e8cbb34364
--- /dev/null
+++ b/fs/proc/proc_sysctl.c
@@ -0,0 +1,479 @@
1/*
2 * /proc/sys support
3 */
4
5#include <linux/sysctl.h>
6#include <linux/proc_fs.h>
7#include <linux/security.h>
8#include "internal.h"
9
10static struct dentry_operations proc_sys_dentry_operations;
11static const struct file_operations proc_sys_file_operations;
12static struct inode_operations proc_sys_inode_operations;
13
14static void proc_sys_refresh_inode(struct inode *inode, struct ctl_table *table)
15{
16 /* Refresh the cached information bits in the inode */
17 if (table) {
18 inode->i_uid = 0;
19 inode->i_gid = 0;
20 inode->i_mode = table->mode;
21 if (table->proc_handler) {
22 inode->i_mode |= S_IFREG;
23 inode->i_nlink = 1;
24 } else {
25 inode->i_mode |= S_IFDIR;
26 inode->i_nlink = 0; /* It is too hard to figure out */
27 }
28 }
29}
30
31static struct inode *proc_sys_make_inode(struct inode *dir, struct ctl_table *table)
32{
33 struct inode *inode;
34 struct proc_inode *dir_ei, *ei;
35 int depth;
36
37 inode = new_inode(dir->i_sb);
38 if (!inode)
39 goto out;
40
41 /* A directory is always one deeper than it's parent */
42 dir_ei = PROC_I(dir);
43 depth = dir_ei->fd + 1;
44
45 ei = PROC_I(inode);
46 ei->fd = depth;
47 inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
48 inode->i_op = &proc_sys_inode_operations;
49 inode->i_fop = &proc_sys_file_operations;
50 inode->i_flags |= S_PRIVATE; /* tell selinux to ignore this inode */
51 proc_sys_refresh_inode(inode, table);
52out:
53 return inode;
54}
55
56static struct dentry *proc_sys_ancestor(struct dentry *dentry, int depth)
57{
58 for (;;) {
59 struct proc_inode *ei;
60
61 ei = PROC_I(dentry->d_inode);
62 if (ei->fd == depth)
63 break; /* found */
64
65 dentry = dentry->d_parent;
66 }
67 return dentry;
68}
69
70static struct ctl_table *proc_sys_lookup_table_one(struct ctl_table *table,
71 struct qstr *name)
72{
73 int len;
74 for ( ; table->ctl_name || table->procname; table++) {
75
76 if (!table->procname)
77 continue;
78
79 len = strlen(table->procname);
80 if (len != name->len)
81 continue;
82
83 if (memcmp(table->procname, name->name, len) != 0)
84 continue;
85
86 /* I have a match */
87 return table;
88 }
89 return NULL;
90}
91
92static struct ctl_table *proc_sys_lookup_table(struct dentry *dentry,
93 struct ctl_table *table)
94{
95 struct dentry *ancestor;
96 struct proc_inode *ei;
97 int depth, i;
98
99 ei = PROC_I(dentry->d_inode);
100 depth = ei->fd;
101
102 if (depth == 0)
103 return table;
104
105 for (i = 1; table && (i <= depth); i++) {
106 ancestor = proc_sys_ancestor(dentry, i);
107 table = proc_sys_lookup_table_one(table, &ancestor->d_name);
108 if (table)
109 table = table->child;
110 }
111 return table;
112
113}
114static struct ctl_table *proc_sys_lookup_entry(struct dentry *dparent,
115 struct qstr *name,
116 struct ctl_table *table)
117{
118 table = proc_sys_lookup_table(dparent, table);
119 if (table)
120 table = proc_sys_lookup_table_one(table, name);
121 return table;
122}
123
124static struct ctl_table *do_proc_sys_lookup(struct dentry *parent,
125 struct qstr *name,
126 struct ctl_table_header **ptr)
127{
128 struct ctl_table_header *head;
129 struct ctl_table *table = NULL;
130
131 for (head = sysctl_head_next(NULL); head;
132 head = sysctl_head_next(head)) {
133 table = proc_sys_lookup_entry(parent, name, head->ctl_table);
134 if (table)
135 break;
136 }
137 *ptr = head;
138 return table;
139}
140
141static struct dentry *proc_sys_lookup(struct inode *dir, struct dentry *dentry,
142 struct nameidata *nd)
143{
144 struct ctl_table_header *head;
145 struct inode *inode;
146 struct dentry *err;
147 struct ctl_table *table;
148
149 err = ERR_PTR(-ENOENT);
150 table = do_proc_sys_lookup(dentry->d_parent, &dentry->d_name, &head);
151 if (!table)
152 goto out;
153
154 err = ERR_PTR(-ENOMEM);
155 inode = proc_sys_make_inode(dir, table);
156 if (!inode)
157 goto out;
158
159 err = NULL;
160 dentry->d_op = &proc_sys_dentry_operations;
161 d_add(dentry, inode);
162
163out:
164 sysctl_head_finish(head);
165 return err;
166}
167
168static ssize_t proc_sys_read(struct file *filp, char __user *buf,
169 size_t count, loff_t *ppos)
170{
171 struct dentry *dentry = filp->f_dentry;
172 struct ctl_table_header *head;
173 struct ctl_table *table;
174 ssize_t error, res;
175
176 table = do_proc_sys_lookup(dentry->d_parent, &dentry->d_name, &head);
177 /* Has the sysctl entry disappeared on us? */
178 error = -ENOENT;
179 if (!table)
180 goto out;
181
182 /* Has the sysctl entry been replaced by a directory? */
183 error = -EISDIR;
184 if (!table->proc_handler)
185 goto out;
186
187 /*
188 * At this point we know that the sysctl was not unregistered
189 * and won't be until we finish.
190 */
191 error = -EPERM;
192 if (sysctl_perm(table, MAY_READ))
193 goto out;
194
195 /* careful: calling conventions are nasty here */
196 res = count;
197 error = table->proc_handler(table, 0, filp, buf, &res, ppos);
198 if (!error)
199 error = res;
200out:
201 sysctl_head_finish(head);
202
203 return error;
204}
205
206static ssize_t proc_sys_write(struct file *filp, const char __user *buf,
207 size_t count, loff_t *ppos)
208{
209 struct dentry *dentry = filp->f_dentry;
210 struct ctl_table_header *head;
211 struct ctl_table *table;
212 ssize_t error, res;
213
214 table = do_proc_sys_lookup(dentry->d_parent, &dentry->d_name, &head);
215 /* Has the sysctl entry disappeared on us? */
216 error = -ENOENT;
217 if (!table)
218 goto out;
219
220 /* Has the sysctl entry been replaced by a directory? */
221 error = -EISDIR;
222 if (!table->proc_handler)
223 goto out;
224
225 /*
226 * At this point we know that the sysctl was not unregistered
227 * and won't be until we finish.
228 */
229 error = -EPERM;
230 if (sysctl_perm(table, MAY_WRITE))
231 goto out;
232
233 /* careful: calling conventions are nasty here */
234 res = count;
235 error = table->proc_handler(table, 1, filp, (char __user *)buf,
236 &res, ppos);
237 if (!error)
238 error = res;
239out:
240 sysctl_head_finish(head);
241
242 return error;
243}
244
245
246static int proc_sys_fill_cache(struct file *filp, void *dirent,
247 filldir_t filldir, struct ctl_table *table)
248{
249 struct ctl_table_header *head;
250 struct ctl_table *child_table = NULL;
251 struct dentry *child, *dir = filp->f_path.dentry;
252 struct inode *inode;
253 struct qstr qname;
254 ino_t ino = 0;
255 unsigned type = DT_UNKNOWN;
256 int ret;
257
258 qname.name = table->procname;
259 qname.len = strlen(table->procname);
260 qname.hash = full_name_hash(qname.name, qname.len);
261
262 /* Suppress duplicates.
263 * Only fill a directory entry if it is the value that
264 * an ordinary lookup of that name returns. Hide all
265 * others.
266 *
267 * If we ever cache this translation in the dcache
268 * I should do a dcache lookup first. But for now
269 * it is just simpler not to.
270 */
271 ret = 0;
272 child_table = do_proc_sys_lookup(dir, &qname, &head);
273 sysctl_head_finish(head);
274 if (child_table != table)
275 return 0;
276
277 child = d_lookup(dir, &qname);
278 if (!child) {
279 struct dentry *new;
280 new = d_alloc(dir, &qname);
281 if (new) {
282 inode = proc_sys_make_inode(dir->d_inode, table);
283 if (!inode)
284 child = ERR_PTR(-ENOMEM);
285 else {
286 new->d_op = &proc_sys_dentry_operations;
287 d_add(new, inode);
288 }
289 if (child)
290 dput(new);
291 else
292 child = new;
293 }
294 }
295 if (!child || IS_ERR(child) || !child->d_inode)
296 goto end_instantiate;
297 inode = child->d_inode;
298 if (inode) {
299 ino = inode->i_ino;
300 type = inode->i_mode >> 12;
301 }
302 dput(child);
303end_instantiate:
304 if (!ino)
305 ino= find_inode_number(dir, &qname);
306 if (!ino)
307 ino = 1;
308 return filldir(dirent, qname.name, qname.len, filp->f_pos, ino, type);
309}
310
311static int proc_sys_readdir(struct file *filp, void *dirent, filldir_t filldir)
312{
313 struct dentry *dentry = filp->f_dentry;
314 struct inode *inode = dentry->d_inode;
315 struct ctl_table_header *head = NULL;
316 struct ctl_table *table;
317 unsigned long pos;
318 int ret;
319
320 ret = -ENOTDIR;
321 if (!S_ISDIR(inode->i_mode))
322 goto out;
323
324 ret = 0;
325 /* Avoid a switch here: arm builds fail with missing __cmpdi2 */
326 if (filp->f_pos == 0) {
327 if (filldir(dirent, ".", 1, filp->f_pos,
328 inode->i_ino, DT_DIR) < 0)
329 goto out;
330 filp->f_pos++;
331 }
332 if (filp->f_pos == 1) {
333 if (filldir(dirent, "..", 2, filp->f_pos,
334 parent_ino(dentry), DT_DIR) < 0)
335 goto out;
336 filp->f_pos++;
337 }
338 pos = 2;
339
340 /* - Find each instance of the directory
341 * - Read all entries in each instance
342 * - Before returning an entry to user space lookup the entry
343 * by name and if I find a different entry don't return
344 * this one because it means it is a buried dup.
345 * For sysctl this should only happen for directory entries.
346 */
347 for (head = sysctl_head_next(NULL); head; head = sysctl_head_next(head)) {
348 table = proc_sys_lookup_table(dentry, head->ctl_table);
349
350 if (!table)
351 continue;
352
353 for (; table->ctl_name || table->procname; table++, pos++) {
354 /* Can't do anything without a proc name */
355 if (!table->procname)
356 continue;
357
358 if (pos < filp->f_pos)
359 continue;
360
361 if (proc_sys_fill_cache(filp, dirent, filldir, table) < 0)
362 goto out;
363 filp->f_pos = pos + 1;
364 }
365 }
366 ret = 1;
367out:
368 sysctl_head_finish(head);
369 return ret;
370}
371
372static int proc_sys_permission(struct inode *inode, int mask, struct nameidata *nd)
373{
374 /*
375 * sysctl entries that are not writeable,
376 * are _NOT_ writeable, capabilities or not.
377 */
378 struct ctl_table_header *head;
379 struct ctl_table *table;
380 struct dentry *dentry;
381 int mode;
382 int depth;
383 int error;
384
385 head = NULL;
386 depth = PROC_I(inode)->fd;
387
388 /* First check the cached permissions, in case we don't have
389 * enough information to lookup the sysctl table entry.
390 */
391 error = -EACCES;
392 mode = inode->i_mode;
393
394 if (current->euid == 0)
395 mode >>= 6;
396 else if (in_group_p(0))
397 mode >>= 3;
398
399 if ((mode & mask & (MAY_READ|MAY_WRITE|MAY_EXEC)) == mask)
400 error = 0;
401
402 /* If we can't get a sysctl table entry the permission
403 * checks on the cached mode will have to be enough.
404 */
405 if (!nd || !depth)
406 goto out;
407
408 dentry = nd->dentry;
409 table = do_proc_sys_lookup(dentry->d_parent, &dentry->d_name, &head);
410
411 /* If the entry does not exist deny permission */
412 error = -EACCES;
413 if (!table)
414 goto out;
415
416 /* Use the permissions on the sysctl table entry */
417 error = sysctl_perm(table, mask);
418out:
419 sysctl_head_finish(head);
420 return error;
421}
422
423static int proc_sys_setattr(struct dentry *dentry, struct iattr *attr)
424{
425 struct inode *inode = dentry->d_inode;
426 int error;
427
428 if (attr->ia_valid & (ATTR_MODE | ATTR_UID | ATTR_GID))
429 return -EPERM;
430
431 error = inode_change_ok(inode, attr);
432 if (!error) {
433 error = security_inode_setattr(dentry, attr);
434 if (!error)
435 error = inode_setattr(inode, attr);
436 }
437
438 return error;
439}
440
441/* I'm lazy and don't distinguish between files and directories,
442 * until access time.
443 */
444static const struct file_operations proc_sys_file_operations = {
445 .read = proc_sys_read,
446 .write = proc_sys_write,
447 .readdir = proc_sys_readdir,
448};
449
450static struct inode_operations proc_sys_inode_operations = {
451 .lookup = proc_sys_lookup,
452 .permission = proc_sys_permission,
453 .setattr = proc_sys_setattr,
454};
455
456static int proc_sys_revalidate(struct dentry *dentry, struct nameidata *nd)
457{
458 struct ctl_table_header *head;
459 struct ctl_table *table;
460 table = do_proc_sys_lookup(dentry->d_parent, &dentry->d_name, &head);
461 proc_sys_refresh_inode(dentry->d_inode, table);
462 sysctl_head_finish(head);
463 return !!table;
464}
465
466static struct dentry_operations proc_sys_dentry_operations = {
467 .d_revalidate = proc_sys_revalidate,
468};
469
470static struct proc_dir_entry *proc_sys_root;
471
472int proc_sys_init(void)
473{
474 proc_sys_root = proc_mkdir("sys", NULL);
475 proc_sys_root->proc_iops = &proc_sys_inode_operations;
476 proc_sys_root->proc_fops = &proc_sys_file_operations;
477 proc_sys_root->nlink = 0;
478 return 0;
479}
diff --git a/fs/proc/root.c b/fs/proc/root.c
index af154458b540..5834a744c2a9 100644
--- a/fs/proc/root.c
+++ b/fs/proc/root.c
@@ -23,10 +23,6 @@
23 23
24struct proc_dir_entry *proc_net, *proc_net_stat, *proc_bus, *proc_root_fs, *proc_root_driver; 24struct proc_dir_entry *proc_net, *proc_net_stat, *proc_bus, *proc_root_fs, *proc_root_driver;
25 25
26#ifdef CONFIG_SYSCTL
27struct proc_dir_entry *proc_sys_root;
28#endif
29
30static int proc_get_sb(struct file_system_type *fs_type, 26static int proc_get_sb(struct file_system_type *fs_type,
31 int flags, const char *dev_name, void *data, struct vfsmount *mnt) 27 int flags, const char *dev_name, void *data, struct vfsmount *mnt)
32{ 28{
@@ -71,13 +67,6 @@ void __init proc_root_init(void)
71#ifdef CONFIG_SYSVIPC 67#ifdef CONFIG_SYSVIPC
72 proc_mkdir("sysvipc", NULL); 68 proc_mkdir("sysvipc", NULL);
73#endif 69#endif
74#ifdef CONFIG_SYSCTL
75 proc_sys_root = proc_mkdir("sys", NULL);
76#endif
77#if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
78 proc_mkdir("sys/fs", NULL);
79 proc_mkdir("sys/fs/binfmt_misc", NULL);
80#endif
81 proc_root_fs = proc_mkdir("fs", NULL); 70 proc_root_fs = proc_mkdir("fs", NULL);
82 proc_root_driver = proc_mkdir("driver", NULL); 71 proc_root_driver = proc_mkdir("driver", NULL);
83 proc_mkdir("fs/nfsd", NULL); /* somewhere for the nfsd filesystem to be mounted */ 72 proc_mkdir("fs/nfsd", NULL); /* somewhere for the nfsd filesystem to be mounted */
@@ -90,6 +79,9 @@ void __init proc_root_init(void)
90 proc_device_tree_init(); 79 proc_device_tree_init();
91#endif 80#endif
92 proc_bus = proc_mkdir("bus", NULL); 81 proc_bus = proc_mkdir("bus", NULL);
82#ifdef CONFIG_SYSCTL
83 proc_sys_init();
84#endif
93} 85}
94 86
95static int proc_root_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat 87static int proc_root_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat
diff --git a/fs/smbfs/symlink.c b/fs/smbfs/symlink.c
index e4bf3456d07e..fea20ceb8a5f 100644
--- a/fs/smbfs/symlink.c
+++ b/fs/smbfs/symlink.c
@@ -6,7 +6,6 @@
6 * Please add a note about your changes to smbfs in the ChangeLog file. 6 * Please add a note about your changes to smbfs in the ChangeLog file.
7 */ 7 */
8 8
9#include <linux/sched.h>
10#include <linux/kernel.h> 9#include <linux/kernel.h>
11#include <linux/errno.h> 10#include <linux/errno.h>
12#include <linux/fcntl.h> 11#include <linux/fcntl.h>
diff --git a/fs/ufs/balloc.c b/fs/ufs/balloc.c
index 0e97a4f79c31..bcc44084e004 100644
--- a/fs/ufs/balloc.c
+++ b/fs/ufs/balloc.c
@@ -16,7 +16,6 @@
16#include <linux/quotaops.h> 16#include <linux/quotaops.h>
17#include <linux/buffer_head.h> 17#include <linux/buffer_head.h>
18#include <linux/capability.h> 18#include <linux/capability.h>
19#include <linux/sched.h>
20#include <linux/bitops.h> 19#include <linux/bitops.h>
21#include <asm/byteorder.h> 20#include <asm/byteorder.h>
22 21
diff --git a/fs/ufs/dir.c b/fs/ufs/dir.c
index a6c0ca9f48bf..4890ddf1518e 100644
--- a/fs/ufs/dir.c
+++ b/fs/ufs/dir.c
@@ -20,7 +20,6 @@
20#include <linux/fs.h> 20#include <linux/fs.h>
21#include <linux/ufs_fs.h> 21#include <linux/ufs_fs.h>
22#include <linux/smp_lock.h> 22#include <linux/smp_lock.h>
23#include <linux/sched.h>
24 23
25#include "swab.h" 24#include "swab.h"
26#include "util.h" 25#include "util.h"
diff --git a/fs/xattr_acl.c b/fs/xattr_acl.c
index 789a2559bd54..c6ad7c7e3ee9 100644
--- a/fs/xattr_acl.c
+++ b/fs/xattr_acl.c
@@ -6,7 +6,6 @@
6 */ 6 */
7 7
8#include <linux/module.h> 8#include <linux/module.h>
9#include <linux/sched.h>
10#include <linux/slab.h> 9#include <linux/slab.h>
11#include <linux/fs.h> 10#include <linux/fs.h>
12#include <linux/posix_acl_xattr.h> 11#include <linux/posix_acl_xattr.h>
diff --git a/fs/xfs/linux-2.6/kmem.c b/fs/xfs/linux-2.6/kmem.c
index 004baf600611..ed2b16dff914 100644
--- a/fs/xfs/linux-2.6/kmem.c
+++ b/fs/xfs/linux-2.6/kmem.c
@@ -15,7 +15,6 @@
15 * along with this program; if not, write the Free Software Foundation, 15 * along with this program; if not, write the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 */ 17 */
18#include <linux/sched.h>
19#include <linux/mm.h> 18#include <linux/mm.h>
20#include <linux/vmalloc.h> 19#include <linux/vmalloc.h>
21#include <linux/highmem.h> 20#include <linux/highmem.h>
diff --git a/fs/xfs/linux-2.6/xfs_sysctl.c b/fs/xfs/linux-2.6/xfs_sysctl.c
index 5c46c35a97a5..cd6eaa44aa2b 100644
--- a/fs/xfs/linux-2.6/xfs_sysctl.c
+++ b/fs/xfs/linux-2.6/xfs_sysctl.c
@@ -251,7 +251,7 @@ static ctl_table xfs_root_table[] = {
251void 251void
252xfs_sysctl_register(void) 252xfs_sysctl_register(void)
253{ 253{
254 xfs_table_header = register_sysctl_table(xfs_root_table, 0); 254 xfs_table_header = register_sysctl_table(xfs_root_table);
255} 255}
256 256
257void 257void
diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h
index 9d774d07d95b..00c23433b39f 100644
--- a/include/asm-generic/pgtable.h
+++ b/include/asm-generic/pgtable.h
@@ -183,6 +183,19 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addres
183#endif 183#endif
184 184
185/* 185/*
186 * A facility to provide batching of the reload of page tables with the
187 * actual context switch code for paravirtualized guests. By convention,
188 * only one of the lazy modes (CPU, MMU) should be active at any given
189 * time, entry should never be nested, and entry and exits should always
190 * be paired. This is for sanity of maintaining and reasoning about the
191 * kernel code.
192 */
193#ifndef __HAVE_ARCH_ENTER_LAZY_CPU_MODE
194#define arch_enter_lazy_cpu_mode() do {} while (0)
195#define arch_leave_lazy_cpu_mode() do {} while (0)
196#endif
197
198/*
186 * When walking page tables, get the address of the next boundary, 199 * When walking page tables, get the address of the next boundary,
187 * or the end address of the range if that comes earlier. Although no 200 * or the end address of the range if that comes earlier. Although no
188 * vma end wraps to 0, rounded up __boundary may wrap to 0 throughout. 201 * vma end wraps to 0, rounded up __boundary may wrap to 0 throughout.
diff --git a/include/asm-i386/apic.h b/include/asm-i386/apic.h
index 41a44319905f..3a61206fd108 100644
--- a/include/asm-i386/apic.h
+++ b/include/asm-i386/apic.h
@@ -43,6 +43,8 @@ extern void generic_apic_probe(void);
43#define apic_write native_apic_write 43#define apic_write native_apic_write
44#define apic_write_atomic native_apic_write_atomic 44#define apic_write_atomic native_apic_write_atomic
45#define apic_read native_apic_read 45#define apic_read native_apic_read
46#define setup_boot_clock setup_boot_APIC_clock
47#define setup_secondary_clock setup_secondary_APIC_clock
46#endif 48#endif
47 49
48static __inline fastcall void native_apic_write(unsigned long reg, 50static __inline fastcall void native_apic_write(unsigned long reg,
diff --git a/include/asm-i386/bugs.h b/include/asm-i386/bugs.h
index 38f1aebbbdb5..c90c7c499302 100644
--- a/include/asm-i386/bugs.h
+++ b/include/asm-i386/bugs.h
@@ -160,7 +160,7 @@ static void __init check_config(void)
160 * If we configured ourselves for a TSC, we'd better have one! 160 * If we configured ourselves for a TSC, we'd better have one!
161 */ 161 */
162#ifdef CONFIG_X86_TSC 162#ifdef CONFIG_X86_TSC
163 if (!cpu_has_tsc) 163 if (!cpu_has_tsc && !tsc_disable)
164 panic("Kernel compiled for Pentium+, requires TSC feature!"); 164 panic("Kernel compiled for Pentium+, requires TSC feature!");
165#endif 165#endif
166 166
diff --git a/include/asm-i386/desc.h b/include/asm-i386/desc.h
index f398cc456448..050831f34f71 100644
--- a/include/asm-i386/desc.h
+++ b/include/asm-i386/desc.h
@@ -22,7 +22,7 @@ struct Xgt_desc_struct {
22 22
23extern struct Xgt_desc_struct idt_descr; 23extern struct Xgt_desc_struct idt_descr;
24DECLARE_PER_CPU(struct Xgt_desc_struct, cpu_gdt_descr); 24DECLARE_PER_CPU(struct Xgt_desc_struct, cpu_gdt_descr);
25 25extern struct Xgt_desc_struct early_gdt_descr;
26 26
27static inline struct desc_struct *get_cpu_gdt_table(unsigned int cpu) 27static inline struct desc_struct *get_cpu_gdt_table(unsigned int cpu)
28{ 28{
diff --git a/include/asm-i386/elf.h b/include/asm-i386/elf.h
index 369035dfe4b6..8d33c9bb7c1c 100644
--- a/include/asm-i386/elf.h
+++ b/include/asm-i386/elf.h
@@ -90,8 +90,8 @@ typedef struct user_fxsr_struct elf_fpxregset_t;
90 pr_reg[6] = regs->eax; \ 90 pr_reg[6] = regs->eax; \
91 pr_reg[7] = regs->xds; \ 91 pr_reg[7] = regs->xds; \
92 pr_reg[8] = regs->xes; \ 92 pr_reg[8] = regs->xes; \
93 savesegment(fs,pr_reg[9]); \ 93 pr_reg[9] = regs->xfs; \
94 pr_reg[10] = regs->xgs; \ 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; \
diff --git a/include/asm-i386/idle.h b/include/asm-i386/idle.h
new file mode 100644
index 000000000000..87ab93911199
--- /dev/null
+++ b/include/asm-i386/idle.h
@@ -0,0 +1,14 @@
1#ifndef _ASM_I386_IDLE_H
2#define _ASM_I386_IDLE_H 1
3
4#define IDLE_START 1
5#define IDLE_END 2
6
7struct notifier_block;
8void idle_notifier_register(struct notifier_block *n);
9void idle_notifier_unregister(struct notifier_block *n);
10
11void exit_idle(void);
12void enter_idle(void);
13
14#endif
diff --git a/include/asm-i386/mce.h b/include/asm-i386/mce.h
index 7cc1a973bf00..b0a02ee34ffd 100644
--- a/include/asm-i386/mce.h
+++ b/include/asm-i386/mce.h
@@ -3,3 +3,5 @@ extern void mcheck_init(struct cpuinfo_x86 *c);
3#else 3#else
4#define mcheck_init(c) do {} while(0) 4#define mcheck_init(c) do {} while(0)
5#endif 5#endif
6
7extern int mce_disabled;
diff --git a/include/asm-i386/mmu_context.h b/include/asm-i386/mmu_context.h
index 68ff102d6f5e..e6aa30f8de5b 100644
--- a/include/asm-i386/mmu_context.h
+++ b/include/asm-i386/mmu_context.h
@@ -63,7 +63,7 @@ static inline void switch_mm(struct mm_struct *prev,
63} 63}
64 64
65#define deactivate_mm(tsk, mm) \ 65#define deactivate_mm(tsk, mm) \
66 asm("movl %0,%%fs": :"r" (0)); 66 asm("movl %0,%%gs": :"r" (0));
67 67
68#define activate_mm(prev, next) \ 68#define activate_mm(prev, next) \
69 switch_mm((prev),(next),NULL) 69 switch_mm((prev),(next),NULL)
diff --git a/include/asm-i386/paravirt.h b/include/asm-i386/paravirt.h
index 9f06265065f4..6317e0a4d735 100644
--- a/include/asm-i386/paravirt.h
+++ b/include/asm-i386/paravirt.h
@@ -59,90 +59,102 @@ struct paravirt_ops
59 convention. This makes it easier to implement inline 59 convention. This makes it easier to implement inline
60 assembler replacements. */ 60 assembler replacements. */
61 61
62 void (fastcall *cpuid)(unsigned int *eax, unsigned int *ebx, 62 void (*cpuid)(unsigned int *eax, unsigned int *ebx,
63 unsigned int *ecx, unsigned int *edx); 63 unsigned int *ecx, unsigned int *edx);
64 64
65 unsigned long (fastcall *get_debugreg)(int regno); 65 unsigned long (*get_debugreg)(int regno);
66 void (fastcall *set_debugreg)(int regno, unsigned long value); 66 void (*set_debugreg)(int regno, unsigned long value);
67 67
68 void (fastcall *clts)(void); 68 void (*clts)(void);
69 69
70 unsigned long (fastcall *read_cr0)(void); 70 unsigned long (*read_cr0)(void);
71 void (fastcall *write_cr0)(unsigned long); 71 void (*write_cr0)(unsigned long);
72 72
73 unsigned long (fastcall *read_cr2)(void); 73 unsigned long (*read_cr2)(void);
74 void (fastcall *write_cr2)(unsigned long); 74 void (*write_cr2)(unsigned long);
75 75
76 unsigned long (fastcall *read_cr3)(void); 76 unsigned long (*read_cr3)(void);
77 void (fastcall *write_cr3)(unsigned long); 77 void (*write_cr3)(unsigned long);
78 78
79 unsigned long (fastcall *read_cr4_safe)(void); 79 unsigned long (*read_cr4_safe)(void);
80 unsigned long (fastcall *read_cr4)(void); 80 unsigned long (*read_cr4)(void);
81 void (fastcall *write_cr4)(unsigned long); 81 void (*write_cr4)(unsigned long);
82 82
83 unsigned long (fastcall *save_fl)(void); 83 unsigned long (*save_fl)(void);
84 void (fastcall *restore_fl)(unsigned long); 84 void (*restore_fl)(unsigned long);
85 void (fastcall *irq_disable)(void); 85 void (*irq_disable)(void);
86 void (fastcall *irq_enable)(void); 86 void (*irq_enable)(void);
87 void (fastcall *safe_halt)(void); 87 void (*safe_halt)(void);
88 void (fastcall *halt)(void); 88 void (*halt)(void);
89 void (fastcall *wbinvd)(void); 89 void (*wbinvd)(void);
90 90
91 /* err = 0/-EFAULT. wrmsr returns 0/-EFAULT. */ 91 /* err = 0/-EFAULT. wrmsr returns 0/-EFAULT. */
92 u64 (fastcall *read_msr)(unsigned int msr, int *err); 92 u64 (*read_msr)(unsigned int msr, int *err);
93 int (fastcall *write_msr)(unsigned int msr, u64 val); 93 int (*write_msr)(unsigned int msr, u64 val);
94 94
95 u64 (fastcall *read_tsc)(void); 95 u64 (*read_tsc)(void);
96 u64 (fastcall *read_pmc)(void); 96 u64 (*read_pmc)(void);
97 97
98 void (fastcall *load_tr_desc)(void); 98 void (*load_tr_desc)(void);
99 void (fastcall *load_gdt)(const struct Xgt_desc_struct *); 99 void (*load_gdt)(const struct Xgt_desc_struct *);
100 void (fastcall *load_idt)(const struct Xgt_desc_struct *); 100 void (*load_idt)(const struct Xgt_desc_struct *);
101 void (fastcall *store_gdt)(struct Xgt_desc_struct *); 101 void (*store_gdt)(struct Xgt_desc_struct *);
102 void (fastcall *store_idt)(struct Xgt_desc_struct *); 102 void (*store_idt)(struct Xgt_desc_struct *);
103 void (fastcall *set_ldt)(const void *desc, unsigned entries); 103 void (*set_ldt)(const void *desc, unsigned entries);
104 unsigned long (fastcall *store_tr)(void); 104 unsigned long (*store_tr)(void);
105 void (fastcall *load_tls)(struct thread_struct *t, unsigned int cpu); 105 void (*load_tls)(struct thread_struct *t, unsigned int cpu);
106 void (fastcall *write_ldt_entry)(void *dt, int entrynum, 106 void (*write_ldt_entry)(void *dt, int entrynum,
107 u32 low, u32 high); 107 u32 low, u32 high);
108 void (fastcall *write_gdt_entry)(void *dt, int entrynum, 108 void (*write_gdt_entry)(void *dt, int entrynum,
109 u32 low, u32 high); 109 u32 low, u32 high);
110 void (fastcall *write_idt_entry)(void *dt, int entrynum, 110 void (*write_idt_entry)(void *dt, int entrynum,
111 u32 low, u32 high); 111 u32 low, u32 high);
112 void (fastcall *load_esp0)(struct tss_struct *tss, 112 void (*load_esp0)(struct tss_struct *tss,
113 struct thread_struct *thread); 113 struct thread_struct *thread);
114 114
115 void (fastcall *set_iopl_mask)(unsigned mask); 115 void (*set_iopl_mask)(unsigned mask);
116 116
117 void (fastcall *io_delay)(void); 117 void (*io_delay)(void);
118 void (*const_udelay)(unsigned long loops); 118 void (*const_udelay)(unsigned long loops);
119 119
120#ifdef CONFIG_X86_LOCAL_APIC 120#ifdef CONFIG_X86_LOCAL_APIC
121 void (fastcall *apic_write)(unsigned long reg, unsigned long v); 121 void (*apic_write)(unsigned long reg, unsigned long v);
122 void (fastcall *apic_write_atomic)(unsigned long reg, unsigned long v); 122 void (*apic_write_atomic)(unsigned long reg, unsigned long v);
123 unsigned long (fastcall *apic_read)(unsigned long reg); 123 unsigned long (*apic_read)(unsigned long reg);
124 void (*setup_boot_clock)(void);
125 void (*setup_secondary_clock)(void);
124#endif 126#endif
125 127
126 void (fastcall *flush_tlb_user)(void); 128 void (*flush_tlb_user)(void);
127 void (fastcall *flush_tlb_kernel)(void); 129 void (*flush_tlb_kernel)(void);
128 void (fastcall *flush_tlb_single)(u32 addr); 130 void (*flush_tlb_single)(u32 addr);
129 131
130 void (fastcall *set_pte)(pte_t *ptep, pte_t pteval); 132 void (*alloc_pt)(u32 pfn);
131 void (fastcall *set_pte_at)(struct mm_struct *mm, u32 addr, pte_t *ptep, pte_t pteval); 133 void (*alloc_pd)(u32 pfn);
132 void (fastcall *set_pmd)(pmd_t *pmdp, pmd_t pmdval); 134 void (*alloc_pd_clone)(u32 pfn, u32 clonepfn, u32 start, u32 count);
133 void (fastcall *pte_update)(struct mm_struct *mm, u32 addr, pte_t *ptep); 135 void (*release_pt)(u32 pfn);
134 void (fastcall *pte_update_defer)(struct mm_struct *mm, u32 addr, pte_t *ptep); 136 void (*release_pd)(u32 pfn);
137
138 void (*set_pte)(pte_t *ptep, pte_t pteval);
139 void (*set_pte_at)(struct mm_struct *mm, u32 addr, pte_t *ptep, pte_t pteval);
140 void (*set_pmd)(pmd_t *pmdp, pmd_t pmdval);
141 void (*pte_update)(struct mm_struct *mm, u32 addr, pte_t *ptep);
142 void (*pte_update_defer)(struct mm_struct *mm, u32 addr, pte_t *ptep);
135#ifdef CONFIG_X86_PAE 143#ifdef CONFIG_X86_PAE
136 void (fastcall *set_pte_atomic)(pte_t *ptep, pte_t pteval); 144 void (*set_pte_atomic)(pte_t *ptep, pte_t pteval);
137 void (fastcall *set_pte_present)(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pte); 145 void (*set_pte_present)(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pte);
138 void (fastcall *set_pud)(pud_t *pudp, pud_t pudval); 146 void (*set_pud)(pud_t *pudp, pud_t pudval);
139 void (fastcall *pte_clear)(struct mm_struct *mm, unsigned long addr, pte_t *ptep); 147 void (*pte_clear)(struct mm_struct *mm, unsigned long addr, pte_t *ptep);
140 void (fastcall *pmd_clear)(pmd_t *pmdp); 148 void (*pmd_clear)(pmd_t *pmdp);
141#endif 149#endif
142 150
151 void (*set_lazy_mode)(int mode);
152
143 /* These two are jmp to, not actually called. */ 153 /* These two are jmp to, not actually called. */
144 void (fastcall *irq_enable_sysexit)(void); 154 void (*irq_enable_sysexit)(void);
145 void (fastcall *iret)(void); 155 void (*iret)(void);
156
157 void (*startup_ipi_hook)(int phys_apicid, unsigned long start_eip, unsigned long start_esp);
146}; 158};
147 159
148/* Mark a paravirt probe function. */ 160/* Mark a paravirt probe function. */
@@ -313,13 +325,38 @@ static inline unsigned long apic_read(unsigned long reg)
313{ 325{
314 return paravirt_ops.apic_read(reg); 326 return paravirt_ops.apic_read(reg);
315} 327}
328
329static inline void setup_boot_clock(void)
330{
331 paravirt_ops.setup_boot_clock();
332}
333
334static inline void setup_secondary_clock(void)
335{
336 paravirt_ops.setup_secondary_clock();
337}
316#endif 338#endif
317 339
340#ifdef CONFIG_SMP
341static inline void startup_ipi_hook(int phys_apicid, unsigned long start_eip,
342 unsigned long start_esp)
343{
344 return paravirt_ops.startup_ipi_hook(phys_apicid, start_eip, start_esp);
345}
346#endif
318 347
319#define __flush_tlb() paravirt_ops.flush_tlb_user() 348#define __flush_tlb() paravirt_ops.flush_tlb_user()
320#define __flush_tlb_global() paravirt_ops.flush_tlb_kernel() 349#define __flush_tlb_global() paravirt_ops.flush_tlb_kernel()
321#define __flush_tlb_single(addr) paravirt_ops.flush_tlb_single(addr) 350#define __flush_tlb_single(addr) paravirt_ops.flush_tlb_single(addr)
322 351
352#define paravirt_alloc_pt(pfn) paravirt_ops.alloc_pt(pfn)
353#define paravirt_release_pt(pfn) paravirt_ops.release_pt(pfn)
354
355#define paravirt_alloc_pd(pfn) paravirt_ops.alloc_pd(pfn)
356#define paravirt_alloc_pd_clone(pfn, clonepfn, start, count) \
357 paravirt_ops.alloc_pd_clone(pfn, clonepfn, start, count)
358#define paravirt_release_pd(pfn) paravirt_ops.release_pd(pfn)
359
323static inline void set_pte(pte_t *ptep, pte_t pteval) 360static inline void set_pte(pte_t *ptep, pte_t pteval)
324{ 361{
325 paravirt_ops.set_pte(ptep, pteval); 362 paravirt_ops.set_pte(ptep, pteval);
@@ -372,6 +409,19 @@ static inline void pmd_clear(pmd_t *pmdp)
372} 409}
373#endif 410#endif
374 411
412/* Lazy mode for batching updates / context switch */
413#define PARAVIRT_LAZY_NONE 0
414#define PARAVIRT_LAZY_MMU 1
415#define PARAVIRT_LAZY_CPU 2
416
417#define __HAVE_ARCH_ENTER_LAZY_CPU_MODE
418#define arch_enter_lazy_cpu_mode() paravirt_ops.set_lazy_mode(PARAVIRT_LAZY_CPU)
419#define arch_leave_lazy_cpu_mode() paravirt_ops.set_lazy_mode(PARAVIRT_LAZY_NONE)
420
421#define __HAVE_ARCH_ENTER_LAZY_MMU_MODE
422#define arch_enter_lazy_mmu_mode() paravirt_ops.set_lazy_mode(PARAVIRT_LAZY_MMU)
423#define arch_leave_lazy_mmu_mode() paravirt_ops.set_lazy_mode(PARAVIRT_LAZY_NONE)
424
375/* These all sit in the .parainstructions section to tell us what to patch. */ 425/* These all sit in the .parainstructions section to tell us what to patch. */
376struct paravirt_patch { 426struct paravirt_patch {
377 u8 *instr; /* original instructions */ 427 u8 *instr; /* original instructions */
diff --git a/include/asm-i386/pda.h b/include/asm-i386/pda.h
index 2ba2736aa109..b12d59a318b7 100644
--- a/include/asm-i386/pda.h
+++ b/include/asm-i386/pda.h
@@ -39,19 +39,19 @@ extern struct i386_pda _proxy_pda;
39 if (0) { T__ tmp__; tmp__ = (val); } \ 39 if (0) { T__ tmp__; tmp__ = (val); } \
40 switch (sizeof(_proxy_pda.field)) { \ 40 switch (sizeof(_proxy_pda.field)) { \
41 case 1: \ 41 case 1: \
42 asm(op "b %1,%%gs:%c2" \ 42 asm(op "b %1,%%fs:%c2" \
43 : "+m" (_proxy_pda.field) \ 43 : "+m" (_proxy_pda.field) \
44 :"ri" ((T__)val), \ 44 :"ri" ((T__)val), \
45 "i"(pda_offset(field))); \ 45 "i"(pda_offset(field))); \
46 break; \ 46 break; \
47 case 2: \ 47 case 2: \
48 asm(op "w %1,%%gs:%c2" \ 48 asm(op "w %1,%%fs:%c2" \
49 : "+m" (_proxy_pda.field) \ 49 : "+m" (_proxy_pda.field) \
50 :"ri" ((T__)val), \ 50 :"ri" ((T__)val), \
51 "i"(pda_offset(field))); \ 51 "i"(pda_offset(field))); \
52 break; \ 52 break; \
53 case 4: \ 53 case 4: \
54 asm(op "l %1,%%gs:%c2" \ 54 asm(op "l %1,%%fs:%c2" \
55 : "+m" (_proxy_pda.field) \ 55 : "+m" (_proxy_pda.field) \
56 :"ri" ((T__)val), \ 56 :"ri" ((T__)val), \
57 "i"(pda_offset(field))); \ 57 "i"(pda_offset(field))); \
@@ -65,19 +65,19 @@ extern struct i386_pda _proxy_pda;
65 typeof(_proxy_pda.field) ret__; \ 65 typeof(_proxy_pda.field) ret__; \
66 switch (sizeof(_proxy_pda.field)) { \ 66 switch (sizeof(_proxy_pda.field)) { \
67 case 1: \ 67 case 1: \
68 asm(op "b %%gs:%c1,%0" \ 68 asm(op "b %%fs:%c1,%0" \
69 : "=r" (ret__) \ 69 : "=r" (ret__) \
70 : "i" (pda_offset(field)), \ 70 : "i" (pda_offset(field)), \
71 "m" (_proxy_pda.field)); \ 71 "m" (_proxy_pda.field)); \
72 break; \ 72 break; \
73 case 2: \ 73 case 2: \
74 asm(op "w %%gs:%c1,%0" \ 74 asm(op "w %%fs:%c1,%0" \
75 : "=r" (ret__) \ 75 : "=r" (ret__) \
76 : "i" (pda_offset(field)), \ 76 : "i" (pda_offset(field)), \
77 "m" (_proxy_pda.field)); \ 77 "m" (_proxy_pda.field)); \
78 break; \ 78 break; \
79 case 4: \ 79 case 4: \
80 asm(op "l %%gs:%c1,%0" \ 80 asm(op "l %%fs:%c1,%0" \
81 : "=r" (ret__) \ 81 : "=r" (ret__) \
82 : "i" (pda_offset(field)), \ 82 : "i" (pda_offset(field)), \
83 "m" (_proxy_pda.field)); \ 83 "m" (_proxy_pda.field)); \
diff --git a/include/asm-i386/pgalloc.h b/include/asm-i386/pgalloc.h
index 4b1e61359f89..c8dc2d0141a7 100644
--- a/include/asm-i386/pgalloc.h
+++ b/include/asm-i386/pgalloc.h
@@ -5,13 +5,31 @@
5#include <linux/threads.h> 5#include <linux/threads.h>
6#include <linux/mm.h> /* for struct page */ 6#include <linux/mm.h> /* for struct page */
7 7
8#define pmd_populate_kernel(mm, pmd, pte) \ 8#ifdef CONFIG_PARAVIRT
9 set_pmd(pmd, __pmd(_PAGE_TABLE + __pa(pte))) 9#include <asm/paravirt.h>
10#else
11#define paravirt_alloc_pt(pfn) do { } while (0)
12#define paravirt_alloc_pd(pfn) do { } while (0)
13#define paravirt_alloc_pd(pfn) do { } while (0)
14#define paravirt_alloc_pd_clone(pfn, clonepfn, start, count) do { } while (0)
15#define paravirt_release_pt(pfn) do { } while (0)
16#define paravirt_release_pd(pfn) do { } while (0)
17#endif
18
19#define pmd_populate_kernel(mm, pmd, pte) \
20do { \
21 paravirt_alloc_pt(__pa(pte) >> PAGE_SHIFT); \
22 set_pmd(pmd, __pmd(_PAGE_TABLE + __pa(pte))); \
23} while (0)
10 24
11#define pmd_populate(mm, pmd, pte) \ 25#define pmd_populate(mm, pmd, pte) \
26do { \
27 paravirt_alloc_pt(page_to_pfn(pte)); \
12 set_pmd(pmd, __pmd(_PAGE_TABLE + \ 28 set_pmd(pmd, __pmd(_PAGE_TABLE + \
13 ((unsigned long long)page_to_pfn(pte) << \ 29 ((unsigned long long)page_to_pfn(pte) << \
14 (unsigned long long) PAGE_SHIFT))) 30 (unsigned long long) PAGE_SHIFT))); \
31} while (0)
32
15/* 33/*
16 * Allocate and free page tables. 34 * Allocate and free page tables.
17 */ 35 */
@@ -32,7 +50,11 @@ static inline void pte_free(struct page *pte)
32} 50}
33 51
34 52
35#define __pte_free_tlb(tlb,pte) tlb_remove_page((tlb),(pte)) 53#define __pte_free_tlb(tlb,pte) \
54do { \
55 paravirt_release_pt(page_to_pfn(pte)); \
56 tlb_remove_page((tlb),(pte)); \
57} while (0)
36 58
37#ifdef CONFIG_X86_PAE 59#ifdef CONFIG_X86_PAE
38/* 60/*
diff --git a/include/asm-i386/processor.h b/include/asm-i386/processor.h
index 359f10b54f59..edfbe46a5e13 100644
--- a/include/asm-i386/processor.h
+++ b/include/asm-i386/processor.h
@@ -257,6 +257,14 @@ static inline void __mwait(unsigned long eax, unsigned long ecx)
257 : :"a" (eax), "c" (ecx)); 257 : :"a" (eax), "c" (ecx));
258} 258}
259 259
260static inline void __sti_mwait(unsigned long eax, unsigned long ecx)
261{
262 /* "mwait %eax,%ecx;" */
263 asm volatile(
264 "sti; .byte 0x0f,0x01,0xc9;"
265 : :"a" (eax), "c" (ecx));
266}
267
260extern void mwait_idle_with_hints(unsigned long eax, unsigned long ecx); 268extern void mwait_idle_with_hints(unsigned long eax, unsigned long ecx);
261 269
262/* from system description table in BIOS. Mostly for MCA use, but 270/* from system description table in BIOS. Mostly for MCA use, but
@@ -424,7 +432,7 @@ struct thread_struct {
424 .vm86_info = NULL, \ 432 .vm86_info = NULL, \
425 .sysenter_cs = __KERNEL_CS, \ 433 .sysenter_cs = __KERNEL_CS, \
426 .io_bitmap_ptr = NULL, \ 434 .io_bitmap_ptr = NULL, \
427 .gs = __KERNEL_PDA, \ 435 .fs = __KERNEL_PDA, \
428} 436}
429 437
430/* 438/*
@@ -442,8 +450,8 @@ struct thread_struct {
442} 450}
443 451
444#define start_thread(regs, new_eip, new_esp) do { \ 452#define start_thread(regs, new_eip, new_esp) do { \
445 __asm__("movl %0,%%fs": :"r" (0)); \ 453 __asm__("movl %0,%%gs": :"r" (0)); \
446 regs->xgs = 0; \ 454 regs->xfs = 0; \
447 set_fs(USER_DS); \ 455 set_fs(USER_DS); \
448 regs->xds = __USER_DS; \ 456 regs->xds = __USER_DS; \
449 regs->xes = __USER_DS; \ 457 regs->xes = __USER_DS; \
diff --git a/include/asm-i386/ptrace.h b/include/asm-i386/ptrace.h
index bdbc894339b4..6002597b9e12 100644
--- a/include/asm-i386/ptrace.h
+++ b/include/asm-i386/ptrace.h
@@ -16,8 +16,8 @@ struct pt_regs {
16 long eax; 16 long eax;
17 int xds; 17 int xds;
18 int xes; 18 int xes;
19 /* int xfs; */ 19 int xfs;
20 int xgs; 20 /* int xgs; */
21 long orig_eax; 21 long orig_eax;
22 long eip; 22 long eip;
23 int xcs; 23 int xcs;
@@ -49,6 +49,10 @@ static inline int user_mode_vm(struct pt_regs *regs)
49{ 49{
50 return ((regs->xcs & SEGMENT_RPL_MASK) | (regs->eflags & VM_MASK)) >= USER_RPL; 50 return ((regs->xcs & SEGMENT_RPL_MASK) | (regs->eflags & VM_MASK)) >= USER_RPL;
51} 51}
52static inline int v8086_mode(struct pt_regs *regs)
53{
54 return (regs->eflags & VM_MASK);
55}
52 56
53#define instruction_pointer(regs) ((regs)->eip) 57#define instruction_pointer(regs) ((regs)->eip)
54#define regs_return_value(regs) ((regs)->eax) 58#define regs_return_value(regs) ((regs)->eax)
diff --git a/include/asm-i386/segment.h b/include/asm-i386/segment.h
index 3c796af33776..065f10bfa487 100644
--- a/include/asm-i386/segment.h
+++ b/include/asm-i386/segment.h
@@ -83,14 +83,8 @@
83 * The GDT has 32 entries 83 * The GDT has 32 entries
84 */ 84 */
85#define GDT_ENTRIES 32 85#define GDT_ENTRIES 32
86
87#define GDT_SIZE (GDT_ENTRIES * 8) 86#define GDT_SIZE (GDT_ENTRIES * 8)
88 87
89/* Matches __KERNEL_CS and __USER_CS (they must be 2 entries apart) */
90#define SEGMENT_IS_FLAT_CODE(x) (((x) & 0xec) == GDT_ENTRY_KERNEL_CS * 8)
91/* Matches PNP_CS32 and PNP_CS16 (they must be consecutive) */
92#define SEGMENT_IS_PNP_CODE(x) (((x) & 0xf4) == GDT_ENTRY_PNPBIOS_BASE * 8)
93
94/* Simple and small GDT entries for booting only */ 88/* Simple and small GDT entries for booting only */
95 89
96#define GDT_ENTRY_BOOT_CS 2 90#define GDT_ENTRY_BOOT_CS 2
@@ -134,4 +128,17 @@
134#ifndef CONFIG_PARAVIRT 128#ifndef CONFIG_PARAVIRT
135#define get_kernel_rpl() 0 129#define get_kernel_rpl() 0
136#endif 130#endif
131/*
132 * Matching rules for certain types of segments.
133 */
134
135/* Matches only __KERNEL_CS, ignoring PnP / USER / APM segments */
136#define SEGMENT_IS_KERNEL_CODE(x) (((x) & 0xfc) == GDT_ENTRY_KERNEL_CS * 8)
137
138/* Matches __KERNEL_CS and __USER_CS (they must be 2 entries apart) */
139#define SEGMENT_IS_FLAT_CODE(x) (((x) & 0xec) == GDT_ENTRY_KERNEL_CS * 8)
140
141/* Matches PNP_CS32 and PNP_CS16 (they must be consecutive) */
142#define SEGMENT_IS_PNP_CODE(x) (((x) & 0xf4) == GDT_ENTRY_PNPBIOS_BASE * 8)
143
137#endif 144#endif
diff --git a/include/asm-i386/setup.h b/include/asm-i386/setup.h
index 76316275d6f9..0e8077cbfdac 100644
--- a/include/asm-i386/setup.h
+++ b/include/asm-i386/setup.h
@@ -77,6 +77,8 @@ int __init sanitize_e820_map(struct e820entry * biosmap, char * pnr_map);
77void __init add_memory_region(unsigned long long start, 77void __init add_memory_region(unsigned long long start,
78 unsigned long long size, int type); 78 unsigned long long size, int type);
79 79
80extern unsigned long init_pg_tables_end;
81
80#endif /* __ASSEMBLY__ */ 82#endif /* __ASSEMBLY__ */
81 83
82#endif /* __KERNEL__ */ 84#endif /* __KERNEL__ */
diff --git a/include/asm-i386/smp.h b/include/asm-i386/smp.h
index 64fe624c02ca..6bf0033a301c 100644
--- a/include/asm-i386/smp.h
+++ b/include/asm-i386/smp.h
@@ -52,6 +52,11 @@ extern void cpu_exit_clear(void);
52extern void cpu_uninit(void); 52extern void cpu_uninit(void);
53#endif 53#endif
54 54
55#ifndef CONFIG_PARAVIRT
56#define startup_ipi_hook(phys_apicid, start_eip, start_esp) \
57do { } while (0)
58#endif
59
55/* 60/*
56 * This function is needed by all SMP systems. It must _always_ be valid 61 * This function is needed by all SMP systems. It must _always_ be valid
57 * from the initial startup. We map APIC_BASE very early in page_setup(), 62 * from the initial startup. We map APIC_BASE very early in page_setup(),
diff --git a/include/asm-i386/time.h b/include/asm-i386/time.h
index ea8065af825a..571b4294dc2e 100644
--- a/include/asm-i386/time.h
+++ b/include/asm-i386/time.h
@@ -30,6 +30,7 @@ static inline int native_set_wallclock(unsigned long nowtime)
30 30
31#ifdef CONFIG_PARAVIRT 31#ifdef CONFIG_PARAVIRT
32#include <asm/paravirt.h> 32#include <asm/paravirt.h>
33extern unsigned long long native_sched_clock(void);
33#else /* !CONFIG_PARAVIRT */ 34#else /* !CONFIG_PARAVIRT */
34 35
35#define get_wallclock() native_get_wallclock() 36#define get_wallclock() native_get_wallclock()
diff --git a/include/asm-i386/timer.h b/include/asm-i386/timer.h
index d0ebd05f8516..4752c3a6a708 100644
--- a/include/asm-i386/timer.h
+++ b/include/asm-i386/timer.h
@@ -8,6 +8,9 @@ void setup_pit_timer(void);
8/* Modifiers for buggy PIT handling */ 8/* Modifiers for buggy PIT handling */
9extern int pit_latch_buggy; 9extern int pit_latch_buggy;
10extern int timer_ack; 10extern int timer_ack;
11extern int no_timer_check;
12extern unsigned long long (*custom_sched_clock)(void);
13extern int no_sync_cmos_clock;
11extern int recalibrate_cpu_khz(void); 14extern int recalibrate_cpu_khz(void);
12 15
13#endif 16#endif
diff --git a/include/asm-i386/vmi.h b/include/asm-i386/vmi.h
new file mode 100644
index 000000000000..43c89333037e
--- /dev/null
+++ b/include/asm-i386/vmi.h
@@ -0,0 +1,262 @@
1/*
2 * VMI interface definition
3 *
4 * Copyright (C) 2005, VMware, Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
14 * NON INFRINGEMENT. See the GNU General Public License for more
15 * details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 *
21 * Maintained by: Zachary Amsden zach@vmware.com
22 *
23 */
24#include <linux/types.h>
25
26/*
27 *---------------------------------------------------------------------
28 *
29 * VMI Option ROM API
30 *
31 *---------------------------------------------------------------------
32 */
33#define VMI_SIGNATURE 0x696d5663 /* "cVmi" */
34
35#define PCI_VENDOR_ID_VMWARE 0x15AD
36#define PCI_DEVICE_ID_VMWARE_VMI 0x0801
37
38/*
39 * We use two version numbers for compatibility, with the major
40 * number signifying interface breakages, and the minor number
41 * interface extensions.
42 */
43#define VMI_API_REV_MAJOR 3
44#define VMI_API_REV_MINOR 0
45
46#define VMI_CALL_CPUID 0
47#define VMI_CALL_WRMSR 1
48#define VMI_CALL_RDMSR 2
49#define VMI_CALL_SetGDT 3
50#define VMI_CALL_SetLDT 4
51#define VMI_CALL_SetIDT 5
52#define VMI_CALL_SetTR 6
53#define VMI_CALL_GetGDT 7
54#define VMI_CALL_GetLDT 8
55#define VMI_CALL_GetIDT 9
56#define VMI_CALL_GetTR 10
57#define VMI_CALL_WriteGDTEntry 11
58#define VMI_CALL_WriteLDTEntry 12
59#define VMI_CALL_WriteIDTEntry 13
60#define VMI_CALL_UpdateKernelStack 14
61#define VMI_CALL_SetCR0 15
62#define VMI_CALL_SetCR2 16
63#define VMI_CALL_SetCR3 17
64#define VMI_CALL_SetCR4 18
65#define VMI_CALL_GetCR0 19
66#define VMI_CALL_GetCR2 20
67#define VMI_CALL_GetCR3 21
68#define VMI_CALL_GetCR4 22
69#define VMI_CALL_WBINVD 23
70#define VMI_CALL_SetDR 24
71#define VMI_CALL_GetDR 25
72#define VMI_CALL_RDPMC 26
73#define VMI_CALL_RDTSC 27
74#define VMI_CALL_CLTS 28
75#define VMI_CALL_EnableInterrupts 29
76#define VMI_CALL_DisableInterrupts 30
77#define VMI_CALL_GetInterruptMask 31
78#define VMI_CALL_SetInterruptMask 32
79#define VMI_CALL_IRET 33
80#define VMI_CALL_SYSEXIT 34
81#define VMI_CALL_Halt 35
82#define VMI_CALL_Reboot 36
83#define VMI_CALL_Shutdown 37
84#define VMI_CALL_SetPxE 38
85#define VMI_CALL_SetPxELong 39
86#define VMI_CALL_UpdatePxE 40
87#define VMI_CALL_UpdatePxELong 41
88#define VMI_CALL_MachineToPhysical 42
89#define VMI_CALL_PhysicalToMachine 43
90#define VMI_CALL_AllocatePage 44
91#define VMI_CALL_ReleasePage 45
92#define VMI_CALL_InvalPage 46
93#define VMI_CALL_FlushTLB 47
94#define VMI_CALL_SetLinearMapping 48
95
96#define VMI_CALL_SetIOPLMask 61
97#define VMI_CALL_SetInitialAPState 62
98#define VMI_CALL_APICWrite 63
99#define VMI_CALL_APICRead 64
100#define VMI_CALL_SetLazyMode 73
101
102/*
103 *---------------------------------------------------------------------
104 *
105 * MMU operation flags
106 *
107 *---------------------------------------------------------------------
108 */
109
110/* Flags used by VMI_{Allocate|Release}Page call */
111#define VMI_PAGE_PAE 0x10 /* Allocate PAE shadow */
112#define VMI_PAGE_CLONE 0x20 /* Clone from another shadow */
113#define VMI_PAGE_ZEROED 0x40 /* Page is pre-zeroed */
114
115
116/* Flags shared by Allocate|Release Page and PTE updates */
117#define VMI_PAGE_PT 0x01
118#define VMI_PAGE_PD 0x02
119#define VMI_PAGE_PDP 0x04
120#define VMI_PAGE_PML4 0x08
121
122#define VMI_PAGE_NORMAL 0x00 /* for debugging */
123
124/* Flags used by PTE updates */
125#define VMI_PAGE_CURRENT_AS 0x10 /* implies VMI_PAGE_VA_MASK is valid */
126#define VMI_PAGE_DEFER 0x20 /* may queue update until TLB inval */
127#define VMI_PAGE_VA_MASK 0xfffff000
128
129#ifdef CONFIG_X86_PAE
130#define VMI_PAGE_L1 (VMI_PAGE_PT | VMI_PAGE_PAE | VMI_PAGE_ZEROED)
131#define VMI_PAGE_L2 (VMI_PAGE_PD | VMI_PAGE_PAE | VMI_PAGE_ZEROED)
132#else
133#define VMI_PAGE_L1 (VMI_PAGE_PT | VMI_PAGE_ZEROED)
134#define VMI_PAGE_L2 (VMI_PAGE_PD | VMI_PAGE_ZEROED)
135#endif
136
137/* Flags used by VMI_FlushTLB call */
138#define VMI_FLUSH_TLB 0x01
139#define VMI_FLUSH_GLOBAL 0x02
140
141/*
142 *---------------------------------------------------------------------
143 *
144 * VMI relocation definitions for ROM call get_reloc
145 *
146 *---------------------------------------------------------------------
147 */
148
149/* VMI Relocation types */
150#define VMI_RELOCATION_NONE 0
151#define VMI_RELOCATION_CALL_REL 1
152#define VMI_RELOCATION_JUMP_REL 2
153#define VMI_RELOCATION_NOP 3
154
155#ifndef __ASSEMBLY__
156struct vmi_relocation_info {
157 unsigned char *eip;
158 unsigned char type;
159 unsigned char reserved[3];
160};
161#endif
162
163
164/*
165 *---------------------------------------------------------------------
166 *
167 * Generic ROM structures and definitions
168 *
169 *---------------------------------------------------------------------
170 */
171
172#ifndef __ASSEMBLY__
173
174struct vrom_header {
175 u16 rom_signature; // option ROM signature
176 u8 rom_length; // ROM length in 512 byte chunks
177 u8 rom_entry[4]; // 16-bit code entry point
178 u8 rom_pad0; // 4-byte align pad
179 u32 vrom_signature; // VROM identification signature
180 u8 api_version_min;// Minor version of API
181 u8 api_version_maj;// Major version of API
182 u8 jump_slots; // Number of jump slots
183 u8 reserved1; // Reserved for expansion
184 u32 virtual_top; // Hypervisor virtual address start
185 u16 reserved2; // Reserved for expansion
186 u16 license_offs; // Offset to License string
187 u16 pci_header_offs;// Offset to PCI OPROM header
188 u16 pnp_header_offs;// Offset to PnP OPROM header
189 u32 rom_pad3; // PnP reserverd / VMI reserved
190 u8 reserved[96]; // Reserved for headers
191 char vmi_init[8]; // VMI_Init jump point
192 char get_reloc[8]; // VMI_GetRelocationInfo jump point
193} __attribute__((packed));
194
195struct pnp_header {
196 char sig[4];
197 char rev;
198 char size;
199 short next;
200 short res;
201 long devID;
202 unsigned short manufacturer_offset;
203 unsigned short product_offset;
204} __attribute__((packed));
205
206struct pci_header {
207 char sig[4];
208 short vendorID;
209 short deviceID;
210 short vpdData;
211 short size;
212 char rev;
213 char class;
214 char subclass;
215 char interface;
216 short chunks;
217 char rom_version_min;
218 char rom_version_maj;
219 char codetype;
220 char lastRom;
221 short reserved;
222} __attribute__((packed));
223
224/* Function prototypes for bootstrapping */
225extern void vmi_init(void);
226extern void vmi_bringup(void);
227extern void vmi_apply_boot_page_allocations(void);
228
229/* State needed to start an application processor in an SMP system. */
230struct vmi_ap_state {
231 u32 cr0;
232 u32 cr2;
233 u32 cr3;
234 u32 cr4;
235
236 u64 efer;
237
238 u32 eip;
239 u32 eflags;
240 u32 eax;
241 u32 ebx;
242 u32 ecx;
243 u32 edx;
244 u32 esp;
245 u32 ebp;
246 u32 esi;
247 u32 edi;
248 u16 cs;
249 u16 ss;
250 u16 ds;
251 u16 es;
252 u16 fs;
253 u16 gs;
254 u16 ldtr;
255
256 u16 gdtr_limit;
257 u32 gdtr_base;
258 u32 idtr_base;
259 u16 idtr_limit;
260};
261
262#endif
diff --git a/include/asm-i386/vmi_time.h b/include/asm-i386/vmi_time.h
new file mode 100644
index 000000000000..c12931211007
--- /dev/null
+++ b/include/asm-i386/vmi_time.h
@@ -0,0 +1,103 @@
1/*
2 * VMI Time wrappers
3 *
4 * Copyright (C) 2006, VMware, Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
14 * NON INFRINGEMENT. See the GNU General Public License for more
15 * details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 *
21 * Send feedback to dhecht@vmware.com
22 *
23 */
24
25#ifndef __VMI_TIME_H
26#define __VMI_TIME_H
27
28/*
29 * Raw VMI call indices for timer functions
30 */
31#define VMI_CALL_GetCycleFrequency 66
32#define VMI_CALL_GetCycleCounter 67
33#define VMI_CALL_SetAlarm 68
34#define VMI_CALL_CancelAlarm 69
35#define VMI_CALL_GetWallclockTime 70
36#define VMI_CALL_WallclockUpdated 71
37
38/* Cached VMI timer operations */
39extern struct vmi_timer_ops {
40 u64 (*get_cycle_frequency)(void);
41 u64 (*get_cycle_counter)(int);
42 u64 (*get_wallclock)(void);
43 int (*wallclock_updated)(void);
44 void (*set_alarm)(u32 flags, u64 expiry, u64 period);
45 void (*cancel_alarm)(u32 flags);
46} vmi_timer_ops;
47
48/* Prototypes */
49extern void __init vmi_time_init(void);
50extern unsigned long vmi_get_wallclock(void);
51extern int vmi_set_wallclock(unsigned long now);
52extern unsigned long long vmi_sched_clock(void);
53
54#ifdef CONFIG_X86_LOCAL_APIC
55extern void __init vmi_timer_setup_boot_alarm(void);
56extern void __init vmi_timer_setup_secondary_alarm(void);
57extern void apic_vmi_timer_interrupt(void);
58#endif
59
60#ifdef CONFIG_NO_IDLE_HZ
61extern int vmi_stop_hz_timer(void);
62extern void vmi_account_time_restart_hz_timer(void);
63#endif
64
65/*
66 * When run under a hypervisor, a vcpu is always in one of three states:
67 * running, halted, or ready. The vcpu is in the 'running' state if it
68 * is executing. When the vcpu executes the halt interface, the vcpu
69 * enters the 'halted' state and remains halted until there is some work
70 * pending for the vcpu (e.g. an alarm expires, host I/O completes on
71 * behalf of virtual I/O). At this point, the vcpu enters the 'ready'
72 * state (waiting for the hypervisor to reschedule it). Finally, at any
73 * time when the vcpu is not in the 'running' state nor the 'halted'
74 * state, it is in the 'ready' state.
75 *
76 * Real time is advances while the vcpu is 'running', 'ready', or
77 * 'halted'. Stolen time is the time in which the vcpu is in the
78 * 'ready' state. Available time is the remaining time -- the vcpu is
79 * either 'running' or 'halted'.
80 *
81 * All three views of time are accessible through the VMI cycle
82 * counters.
83 */
84
85/* The cycle counters. */
86#define VMI_CYCLES_REAL 0
87#define VMI_CYCLES_AVAILABLE 1
88#define VMI_CYCLES_STOLEN 2
89
90/* The alarm interface 'flags' bits */
91#define VMI_ALARM_COUNTERS 2
92
93#define VMI_ALARM_COUNTER_MASK 0x000000ff
94
95#define VMI_ALARM_WIRED_IRQ0 0x00000000
96#define VMI_ALARM_WIRED_LVTT 0x00010000
97
98#define VMI_ALARM_IS_ONESHOT 0x00000000
99#define VMI_ALARM_IS_PERIODIC 0x00000100
100
101#define CONFIG_VMI_ALARM_HZ 100
102
103#endif
diff --git a/include/asm-ia64/dma-mapping.h b/include/asm-ia64/dma-mapping.h
index ebd5887f4b1a..6299b51575bb 100644
--- a/include/asm-ia64/dma-mapping.h
+++ b/include/asm-ia64/dma-mapping.h
@@ -8,9 +8,20 @@
8#include <asm/machvec.h> 8#include <asm/machvec.h>
9 9
10#define dma_alloc_coherent platform_dma_alloc_coherent 10#define dma_alloc_coherent platform_dma_alloc_coherent
11#define dma_alloc_noncoherent platform_dma_alloc_coherent /* coherent mem. is cheap */ 11/* coherent mem. is cheap */
12static inline void *
13dma_alloc_noncoherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
14 gfp_t flag)
15{
16 return dma_alloc_coherent(dev, size, dma_handle, flag);
17}
12#define dma_free_coherent platform_dma_free_coherent 18#define dma_free_coherent platform_dma_free_coherent
13#define dma_free_noncoherent platform_dma_free_coherent 19static inline void
20dma_free_noncoherent(struct device *dev, size_t size, void *cpu_addr,
21 dma_addr_t dma_handle)
22{
23 dma_free_coherent(dev, size, cpu_addr, dma_handle);
24}
14#define dma_map_single platform_dma_map_single 25#define dma_map_single platform_dma_map_single
15#define dma_map_sg platform_dma_map_sg 26#define dma_map_sg platform_dma_map_sg
16#define dma_unmap_single platform_dma_unmap_single 27#define dma_unmap_single platform_dma_unmap_single
diff --git a/include/asm-x86_64/bitops.h b/include/asm-x86_64/bitops.h
index 8da9609070f4..d4dbbe5f7bd9 100644
--- a/include/asm-x86_64/bitops.h
+++ b/include/asm-x86_64/bitops.h
@@ -7,7 +7,7 @@
7 7
8#include <asm/alternative.h> 8#include <asm/alternative.h>
9 9
10#if __GNUC__ < 4 || __GNUC_MINOR__ < 1 10#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 1)
11/* Technically wrong, but this avoids compilation errors on some gcc 11/* Technically wrong, but this avoids compilation errors on some gcc
12 versions. */ 12 versions. */
13#define ADDR "=m" (*(volatile long *) addr) 13#define ADDR "=m" (*(volatile long *) addr)
diff --git a/include/asm-x86_64/dma-mapping.h b/include/asm-x86_64/dma-mapping.h
index 49dbab09ef2b..d2af227f06d0 100644
--- a/include/asm-x86_64/dma-mapping.h
+++ b/include/asm-x86_64/dma-mapping.h
@@ -66,6 +66,9 @@ static inline int dma_mapping_error(dma_addr_t dma_addr)
66#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f) 66#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
67#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h) 67#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
68 68
69#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
70#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
71
69extern void *dma_alloc_coherent(struct device *dev, size_t size, 72extern void *dma_alloc_coherent(struct device *dev, size_t size,
70 dma_addr_t *dma_handle, gfp_t gfp); 73 dma_addr_t *dma_handle, gfp_t gfp);
71extern void dma_free_coherent(struct device *dev, size_t size, void *vaddr, 74extern void dma_free_coherent(struct device *dev, size_t size, void *vaddr,
diff --git a/include/asm-x86_64/e820.h b/include/asm-x86_64/e820.h
index fa2086774105..6216fa3f2802 100644
--- a/include/asm-x86_64/e820.h
+++ b/include/asm-x86_64/e820.h
@@ -46,6 +46,7 @@ extern void e820_mark_nosave_regions(void);
46extern void e820_print_map(char *who); 46extern void e820_print_map(char *who);
47extern int e820_any_mapped(unsigned long start, unsigned long end, unsigned type); 47extern int e820_any_mapped(unsigned long start, unsigned long end, unsigned type);
48extern int e820_all_mapped(unsigned long start, unsigned long end, unsigned type); 48extern int e820_all_mapped(unsigned long start, unsigned long end, unsigned type);
49extern unsigned long e820_hole_size(unsigned long start, unsigned long end);
49 50
50extern void e820_setup_gap(void); 51extern void e820_setup_gap(void);
51extern void e820_register_active_regions(int nid, 52extern void e820_register_active_regions(int nid,
@@ -56,6 +57,7 @@ extern void finish_e820_parsing(void);
56extern struct e820map e820; 57extern struct e820map e820;
57 58
58extern unsigned ebda_addr, ebda_size; 59extern unsigned ebda_addr, ebda_size;
60extern unsigned long nodemap_addr, nodemap_size;
59#endif/*!__ASSEMBLY__*/ 61#endif/*!__ASSEMBLY__*/
60 62
61#endif/*__E820_HEADER*/ 63#endif/*__E820_HEADER*/
diff --git a/include/asm-x86_64/hw_irq.h b/include/asm-x86_64/hw_irq.h
index 179cce755aa7..552df5f10a6d 100644
--- a/include/asm-x86_64/hw_irq.h
+++ b/include/asm-x86_64/hw_irq.h
@@ -91,7 +91,7 @@ extern void enable_8259A_irq(unsigned int irq);
91extern int i8259A_irq_pending(unsigned int irq); 91extern int i8259A_irq_pending(unsigned int irq);
92extern void make_8259A_irq(unsigned int irq); 92extern void make_8259A_irq(unsigned int irq);
93extern void init_8259A(int aeoi); 93extern void init_8259A(int aeoi);
94extern void FASTCALL(send_IPI_self(int vector)); 94extern void send_IPI_self(int vector);
95extern void init_VISWS_APIC_irqs(void); 95extern void init_VISWS_APIC_irqs(void);
96extern void setup_IO_APIC(void); 96extern void setup_IO_APIC(void);
97extern void disable_IO_APIC(void); 97extern void disable_IO_APIC(void);
diff --git a/include/asm-x86_64/io.h b/include/asm-x86_64/io.h
index f5d84bb7c948..de2cd9a2303a 100644
--- a/include/asm-x86_64/io.h
+++ b/include/asm-x86_64/io.h
@@ -100,7 +100,7 @@ __OUTS(l)
100 100
101#define IO_SPACE_LIMIT 0xffff 101#define IO_SPACE_LIMIT 0xffff
102 102
103#if defined(__KERNEL__) && __x86_64__ 103#if defined(__KERNEL__) && defined(__x86_64__)
104 104
105#include <linux/vmalloc.h> 105#include <linux/vmalloc.h>
106 106
diff --git a/include/asm-x86_64/io_apic.h b/include/asm-x86_64/io_apic.h
index 561ecbfd4cb5..f4fb238c89f1 100644
--- a/include/asm-x86_64/io_apic.h
+++ b/include/asm-x86_64/io_apic.h
@@ -85,18 +85,8 @@ struct IO_APIC_route_entry {
85 mask : 1, /* 0: enabled, 1: disabled */ 85 mask : 1, /* 0: enabled, 1: disabled */
86 __reserved_2 : 15; 86 __reserved_2 : 15;
87 87
88 union { struct { __u32 88 __u32 __reserved_3 : 24,
89 __reserved_1 : 24, 89 dest : 8;
90 physical_dest : 4,
91 __reserved_2 : 4;
92 } physical;
93
94 struct { __u32
95 __reserved_1 : 24,
96 logical_dest : 8;
97 } logical;
98 } dest;
99
100} __attribute__ ((packed)); 90} __attribute__ ((packed));
101 91
102/* 92/*
diff --git a/include/asm-x86_64/mce.h b/include/asm-x86_64/mce.h
index 5a11146d6d9c..177e92b4019b 100644
--- a/include/asm-x86_64/mce.h
+++ b/include/asm-x86_64/mce.h
@@ -103,6 +103,8 @@ void mce_log_therm_throt_event(unsigned int cpu, __u64 status);
103 103
104extern atomic_t mce_entry; 104extern atomic_t mce_entry;
105 105
106extern void do_machine_check(struct pt_regs *, long);
107
106#endif 108#endif
107 109
108#endif 110#endif
diff --git a/include/asm-x86_64/mmzone.h b/include/asm-x86_64/mmzone.h
index c38ebdf6f426..fb558fb1d211 100644
--- a/include/asm-x86_64/mmzone.h
+++ b/include/asm-x86_64/mmzone.h
@@ -11,24 +11,25 @@
11 11
12#include <asm/smp.h> 12#include <asm/smp.h>
13 13
14/* Should really switch to dynamic allocation at some point */
15#define NODEMAPSIZE 0x4fff
16
17/* Simple perfect hash to map physical addresses to node numbers */ 14/* Simple perfect hash to map physical addresses to node numbers */
18struct memnode { 15struct memnode {
19 int shift; 16 int shift;
20 u8 map[NODEMAPSIZE]; 17 unsigned int mapsize;
21} ____cacheline_aligned; 18 u8 *map;
19 u8 embedded_map[64-16];
20} ____cacheline_aligned; /* total size = 64 bytes */
22extern struct memnode memnode; 21extern struct memnode memnode;
23#define memnode_shift memnode.shift 22#define memnode_shift memnode.shift
24#define memnodemap memnode.map 23#define memnodemap memnode.map
24#define memnodemapsize memnode.mapsize
25 25
26extern struct pglist_data *node_data[]; 26extern struct pglist_data *node_data[];
27 27
28static inline __attribute__((pure)) int phys_to_nid(unsigned long addr) 28static inline __attribute__((pure)) int phys_to_nid(unsigned long addr)
29{ 29{
30 unsigned nid; 30 unsigned nid;
31 VIRTUAL_BUG_ON((addr >> memnode_shift) >= NODEMAPSIZE); 31 VIRTUAL_BUG_ON(!memnodemap);
32 VIRTUAL_BUG_ON((addr >> memnode_shift) >= memnodemapsize);
32 nid = memnodemap[addr >> memnode_shift]; 33 nid = memnodemap[addr >> memnode_shift];
33 VIRTUAL_BUG_ON(nid >= MAX_NUMNODES || !node_data[nid]); 34 VIRTUAL_BUG_ON(nid >= MAX_NUMNODES || !node_data[nid]);
34 return nid; 35 return nid;
@@ -46,5 +47,10 @@ static inline __attribute__((pure)) int phys_to_nid(unsigned long addr)
46extern int pfn_valid(unsigned long pfn); 47extern int pfn_valid(unsigned long pfn);
47#endif 48#endif
48 49
50#ifdef CONFIG_NUMA_EMU
51#define FAKE_NODE_MIN_SIZE (64*1024*1024)
52#define FAKE_NODE_MIN_HASH_MASK (~(FAKE_NODE_MIN_SIZE - 1ul))
53#endif
54
49#endif 55#endif
50#endif 56#endif
diff --git a/include/asm-x86_64/mutex.h b/include/asm-x86_64/mutex.h
index 16396b1de3e4..6c2949a3c677 100644
--- a/include/asm-x86_64/mutex.h
+++ b/include/asm-x86_64/mutex.h
@@ -21,7 +21,7 @@ do { \
21 unsigned long dummy; \ 21 unsigned long dummy; \
22 \ 22 \
23 typecheck(atomic_t *, v); \ 23 typecheck(atomic_t *, v); \
24 typecheck_fn(fastcall void (*)(atomic_t *), fail_fn); \ 24 typecheck_fn(void (*)(atomic_t *), fail_fn); \
25 \ 25 \
26 __asm__ __volatile__( \ 26 __asm__ __volatile__( \
27 LOCK_PREFIX " decl (%%rdi) \n" \ 27 LOCK_PREFIX " decl (%%rdi) \n" \
@@ -47,7 +47,7 @@ do { \
47 */ 47 */
48static inline int 48static inline int
49__mutex_fastpath_lock_retval(atomic_t *count, 49__mutex_fastpath_lock_retval(atomic_t *count,
50 int fastcall (*fail_fn)(atomic_t *)) 50 int (*fail_fn)(atomic_t *))
51{ 51{
52 if (unlikely(atomic_dec_return(count) < 0)) 52 if (unlikely(atomic_dec_return(count) < 0))
53 return fail_fn(count); 53 return fail_fn(count);
@@ -67,7 +67,7 @@ do { \
67 unsigned long dummy; \ 67 unsigned long dummy; \
68 \ 68 \
69 typecheck(atomic_t *, v); \ 69 typecheck(atomic_t *, v); \
70 typecheck_fn(fastcall void (*)(atomic_t *), fail_fn); \ 70 typecheck_fn(void (*)(atomic_t *), fail_fn); \
71 \ 71 \
72 __asm__ __volatile__( \ 72 __asm__ __volatile__( \
73 LOCK_PREFIX " incl (%%rdi) \n" \ 73 LOCK_PREFIX " incl (%%rdi) \n" \
diff --git a/include/asm-x86_64/pgalloc.h b/include/asm-x86_64/pgalloc.h
index 43d4c333a8b1..4e28b6060a5e 100644
--- a/include/asm-x86_64/pgalloc.h
+++ b/include/asm-x86_64/pgalloc.h
@@ -18,11 +18,6 @@ static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, struct page *p
18 set_pmd(pmd, __pmd(_PAGE_TABLE | (page_to_pfn(pte) << PAGE_SHIFT))); 18 set_pmd(pmd, __pmd(_PAGE_TABLE | (page_to_pfn(pte) << PAGE_SHIFT)));
19} 19}
20 20
21static inline pmd_t *get_pmd(void)
22{
23 return (pmd_t *)get_zeroed_page(GFP_KERNEL);
24}
25
26static inline void pmd_free(pmd_t *pmd) 21static inline void pmd_free(pmd_t *pmd)
27{ 22{
28 BUG_ON((unsigned long)pmd & (PAGE_SIZE-1)); 23 BUG_ON((unsigned long)pmd & (PAGE_SIZE-1));
diff --git a/include/asm-x86_64/pgtable.h b/include/asm-x86_64/pgtable.h
index 59901c690a0d..730bd6028416 100644
--- a/include/asm-x86_64/pgtable.h
+++ b/include/asm-x86_64/pgtable.h
@@ -359,15 +359,6 @@ static inline int pmd_large(pmd_t pte) {
359#define mk_pte(page, pgprot) pfn_pte(page_to_pfn(page), (pgprot)) 359#define mk_pte(page, pgprot) pfn_pte(page_to_pfn(page), (pgprot))
360#define mk_pte_huge(entry) (pte_val(entry) |= _PAGE_PRESENT | _PAGE_PSE) 360#define mk_pte_huge(entry) (pte_val(entry) |= _PAGE_PRESENT | _PAGE_PSE)
361 361
362/* physical address -> PTE */
363static inline pte_t mk_pte_phys(unsigned long physpage, pgprot_t pgprot)
364{
365 pte_t pte;
366 pte_val(pte) = physpage | pgprot_val(pgprot);
367 pte_val(pte) &= __supported_pte_mask;
368 return pte;
369}
370
371/* Change flags of a PTE */ 362/* Change flags of a PTE */
372static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) 363static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
373{ 364{
diff --git a/include/asm-x86_64/uaccess.h b/include/asm-x86_64/uaccess.h
index 8079e29c14fd..1981f70fcad1 100644
--- a/include/asm-x86_64/uaccess.h
+++ b/include/asm-x86_64/uaccess.h
@@ -367,4 +367,18 @@ __copy_to_user_inatomic(void __user *dst, const void *src, unsigned size)
367 return copy_user_generic((__force void *)dst, src, size); 367 return copy_user_generic((__force void *)dst, src, size);
368} 368}
369 369
370#define ARCH_HAS_NOCACHE_UACCESS 1
371extern long __copy_user_nocache(void *dst, const void __user *src, unsigned size, int zerorest);
372
373static inline int __copy_from_user_nocache(void *dst, const void __user *src, unsigned size)
374{
375 might_sleep();
376 return __copy_user_nocache(dst, (__force void *)src, size, 1);
377}
378
379static inline int __copy_from_user_inatomic_nocache(void *dst, const void __user *src, unsigned size)
380{
381 return __copy_user_nocache(dst, (__force void *)src, size, 0);
382}
383
370#endif /* __X86_64_UACCESS_H */ 384#endif /* __X86_64_UACCESS_H */
diff --git a/include/asm-x86_64/vsyscall.h b/include/asm-x86_64/vsyscall.h
index 05cb8dd200de..0c7847165eae 100644
--- a/include/asm-x86_64/vsyscall.h
+++ b/include/asm-x86_64/vsyscall.h
@@ -56,11 +56,6 @@ extern struct vxtime_data vxtime;
56extern int vgetcpu_mode; 56extern int vgetcpu_mode;
57extern struct timezone sys_tz; 57extern struct timezone sys_tz;
58extern int sysctl_vsyscall; 58extern int sysctl_vsyscall;
59extern seqlock_t xtime_lock;
60
61extern int sysctl_vsyscall;
62
63#define ARCH_HAVE_XTIME_LOCK 1
64 59
65#endif /* __KERNEL__ */ 60#endif /* __KERNEL__ */
66 61
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h
index c1e82c514443..2d956cd566ae 100644
--- a/include/linux/binfmts.h
+++ b/include/linux/binfmts.h
@@ -59,6 +59,7 @@ struct linux_binfmt {
59 int (*load_shlib)(struct file *); 59 int (*load_shlib)(struct file *);
60 int (*core_dump)(long signr, struct pt_regs * regs, struct file * file); 60 int (*core_dump)(long signr, struct pt_regs * regs, struct file * file);
61 unsigned long min_coredump; /* minimal dump size */ 61 unsigned long min_coredump; /* minimal dump size */
62 int hasvdso;
62}; 63};
63 64
64extern int register_binfmt(struct linux_binfmt *); 65extern int register_binfmt(struct linux_binfmt *);
diff --git a/include/linux/nfsd/export.h b/include/linux/nfsd/export.h
index 045e38cdbe64..9f62d6182d32 100644
--- a/include/linux/nfsd/export.h
+++ b/include/linux/nfsd/export.h
@@ -74,19 +74,20 @@ struct svc_export {
74 uid_t ex_anon_uid; 74 uid_t ex_anon_uid;
75 gid_t ex_anon_gid; 75 gid_t ex_anon_gid;
76 int ex_fsid; 76 int ex_fsid;
77 unsigned char * ex_uuid; /* 16 byte fsid */
77 struct nfsd4_fs_locations ex_fslocs; 78 struct nfsd4_fs_locations ex_fslocs;
78}; 79};
79 80
80/* an "export key" (expkey) maps a filehandlefragement to an 81/* an "export key" (expkey) maps a filehandlefragement to an
81 * svc_export for a given client. There can be two per export, one 82 * svc_export for a given client. There can be several per export,
82 * for type 0 (dev/ino), one for type 1 (fsid) 83 * for the different fsid types.
83 */ 84 */
84struct svc_expkey { 85struct svc_expkey {
85 struct cache_head h; 86 struct cache_head h;
86 87
87 struct auth_domain * ek_client; 88 struct auth_domain * ek_client;
88 int ek_fsidtype; 89 int ek_fsidtype;
89 u32 ek_fsid[3]; 90 u32 ek_fsid[6];
90 91
91 struct vfsmount * ek_mnt; 92 struct vfsmount * ek_mnt;
92 struct dentry * ek_dentry; 93 struct dentry * ek_dentry;
diff --git a/include/linux/nfsd/nfsd.h b/include/linux/nfsd/nfsd.h
index 4b7c4b568f6d..72feac581aa3 100644
--- a/include/linux/nfsd/nfsd.h
+++ b/include/linux/nfsd/nfsd.h
@@ -254,18 +254,6 @@ void nfsd_lockd_shutdown(void);
254 */ 254 */
255extern struct timeval nfssvc_boot; 255extern struct timeval nfssvc_boot;
256 256
257static inline int is_fsid(struct svc_fh *fh, struct knfsd_fh *reffh)
258{
259 if (fh->fh_export->ex_flags & NFSEXP_FSID) {
260 struct vfsmount *mnt = fh->fh_export->ex_mnt;
261 if (!old_valid_dev(mnt->mnt_sb->s_dev) ||
262 (reffh->fh_version == 1 && reffh->fh_fsid_type == 1))
263 return 1;
264 }
265 return 0;
266}
267
268
269#ifdef CONFIG_NFSD_V4 257#ifdef CONFIG_NFSD_V4
270 258
271/* before processing a COMPOUND operation, we have to check that there 259/* before processing a COMPOUND operation, we have to check that there
diff --git a/include/linux/nfsd/nfsfh.h b/include/linux/nfsd/nfsfh.h
index d9c6c382165d..11e568ee0eeb 100644
--- a/include/linux/nfsd/nfsfh.h
+++ b/include/linux/nfsd/nfsfh.h
@@ -165,38 +165,91 @@ typedef struct svc_fh {
165 165
166} svc_fh; 166} svc_fh;
167 167
168static inline void mk_fsid_v0(u32 *fsidv, dev_t dev, ino_t ino) 168enum nfsd_fsid {
169{ 169 FSID_DEV = 0,
170 fsidv[0] = htonl((MAJOR(dev)<<16) | 170 FSID_NUM,
171 MINOR(dev)); 171 FSID_MAJOR_MINOR,
172 fsidv[1] = ino_t_to_u32(ino); 172 FSID_ENCODE_DEV,
173} 173 FSID_UUID4_INUM,
174 FSID_UUID8,
175 FSID_UUID16,
176 FSID_UUID16_INUM,
177};
174 178
175static inline void mk_fsid_v1(u32 *fsidv, u32 fsid) 179enum fsid_source {
176{ 180 FSIDSOURCE_DEV,
177 fsidv[0] = fsid; 181 FSIDSOURCE_FSID,
178} 182 FSIDSOURCE_UUID,
183};
184extern enum fsid_source fsid_source(struct svc_fh *fhp);
179 185
180static inline void mk_fsid_v2(u32 *fsidv, dev_t dev, ino_t ino)
181{
182 fsidv[0] = htonl(MAJOR(dev));
183 fsidv[1] = htonl(MINOR(dev));
184 fsidv[2] = ino_t_to_u32(ino);
185}
186 186
187static inline void mk_fsid_v3(u32 *fsidv, dev_t dev, ino_t ino) 187/* This might look a little large to "inline" but in all calls except
188 * one, 'vers' is constant so moste of the function disappears.
189 */
190static inline void mk_fsid(int vers, u32 *fsidv, dev_t dev, ino_t ino,
191 u32 fsid, unsigned char *uuid)
188{ 192{
189 fsidv[0] = new_encode_dev(dev); 193 u32 *up;
190 fsidv[1] = ino_t_to_u32(ino); 194 switch(vers) {
195 case FSID_DEV:
196 fsidv[0] = htonl((MAJOR(dev)<<16) |
197 MINOR(dev));
198 fsidv[1] = ino_t_to_u32(ino);
199 break;
200 case FSID_NUM:
201 fsidv[0] = fsid;
202 break;
203 case FSID_MAJOR_MINOR:
204 fsidv[0] = htonl(MAJOR(dev));
205 fsidv[1] = htonl(MINOR(dev));
206 fsidv[2] = ino_t_to_u32(ino);
207 break;
208
209 case FSID_ENCODE_DEV:
210 fsidv[0] = new_encode_dev(dev);
211 fsidv[1] = ino_t_to_u32(ino);
212 break;
213
214 case FSID_UUID4_INUM:
215 /* 4 byte fsid and inode number */
216 up = (u32*)uuid;
217 fsidv[0] = ino_t_to_u32(ino);
218 fsidv[1] = up[0] ^ up[1] ^ up[2] ^ up[3];
219 break;
220
221 case FSID_UUID8:
222 /* 8 byte fsid */
223 up = (u32*)uuid;
224 fsidv[0] = up[0] ^ up[2];
225 fsidv[1] = up[1] ^ up[3];
226 break;
227
228 case FSID_UUID16:
229 /* 16 byte fsid - NFSv3+ only */
230 memcpy(fsidv, uuid, 16);
231 break;
232
233 case FSID_UUID16_INUM:
234 /* 8 byte inode and 16 byte fsid */
235 *(u64*)fsidv = (u64)ino;
236 memcpy(fsidv+2, uuid, 16);
237 break;
238 default: BUG();
239 }
191} 240}
192 241
193static inline int key_len(int type) 242static inline int key_len(int type)
194{ 243{
195 switch(type) { 244 switch(type) {
196 case 0: return 8; 245 case FSID_DEV: return 8;
197 case 1: return 4; 246 case FSID_NUM: return 4;
198 case 2: return 12; 247 case FSID_MAJOR_MINOR: return 12;
199 case 3: return 8; 248 case FSID_ENCODE_DEV: return 8;
249 case FSID_UUID4_INUM: return 8;
250 case FSID_UUID8: return 8;
251 case FSID_UUID16: return 16;
252 case FSID_UUID16_INUM: return 24;
200 default: return 0; 253 default: return 0;
201 } 254 }
202} 255}
diff --git a/include/linux/nmi.h b/include/linux/nmi.h
index acb4ed130247..29af2d5df097 100644
--- a/include/linux/nmi.h
+++ b/include/linux/nmi.h
@@ -17,8 +17,15 @@
17#ifdef ARCH_HAS_NMI_WATCHDOG 17#ifdef ARCH_HAS_NMI_WATCHDOG
18#include <asm/nmi.h> 18#include <asm/nmi.h>
19extern void touch_nmi_watchdog(void); 19extern void touch_nmi_watchdog(void);
20extern void acpi_nmi_disable(void);
21extern void acpi_nmi_enable(void);
20#else 22#else
21# define touch_nmi_watchdog() touch_softlockup_watchdog() 23static inline void touch_nmi_watchdog(void)
24{
25 touch_softlockup_watchdog();
26}
27static inline void acpi_nmi_disable(void) { }
28static inline void acpi_nmi_enable(void) { }
22#endif 29#endif
23 30
24#ifndef trigger_all_cpu_backtrace 31#ifndef trigger_all_cpu_backtrace
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
index 2e132473cbe5..be4652a0545a 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -113,8 +113,6 @@ extern struct vfsmount *proc_mnt;
113extern int proc_fill_super(struct super_block *,void *,int); 113extern int proc_fill_super(struct super_block *,void *,int);
114extern struct inode *proc_get_inode(struct super_block *, unsigned int, struct proc_dir_entry *); 114extern struct inode *proc_get_inode(struct super_block *, unsigned int, struct proc_dir_entry *);
115 115
116extern int proc_match(int, const char *,struct proc_dir_entry *);
117
118/* 116/*
119 * These are generic /proc routines that use the internal 117 * These are generic /proc routines that use the internal
120 * "struct proc_dir_entry" tree to traverse the filesystem. 118 * "struct proc_dir_entry" tree to traverse the filesystem.
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index cf23813cbec2..586aaba91720 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -122,7 +122,7 @@
122/*Digi jsm */ 122/*Digi jsm */
123#define PORT_JSM 69 123#define PORT_JSM 69
124 124
125#define PORT_IP3106 70 125#define PORT_PNX8XXX 70
126 126
127/* Hilscher netx */ 127/* Hilscher netx */
128#define PORT_NETX 71 128#define PORT_NETX 71
diff --git a/include/linux/serial_ip3106.h b/include/linux/serial_ip3106.h
deleted file mode 100644
index f500ac602c5c..000000000000
--- a/include/linux/serial_ip3106.h
+++ /dev/null
@@ -1,81 +0,0 @@
1/*
2 * Embedded Alley Solutions, source@embeddedalley.com.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18
19#ifndef _LINUX_SERIAL_IP3106_H
20#define _LINUX_SERIAL_IP3106_H
21
22#include <linux/serial_core.h>
23#include <linux/device.h>
24
25#define IP3106_NR_PORTS 2
26
27struct ip3106_port {
28 struct uart_port port;
29 struct timer_list timer;
30 unsigned int old_status;
31};
32
33/* register offsets */
34#define IP3106_LCR 0
35#define IP3106_MCR 0x004
36#define IP3106_BAUD 0x008
37#define IP3106_CFG 0x00c
38#define IP3106_FIFO 0x028
39#define IP3106_ISTAT 0xfe0
40#define IP3106_IEN 0xfe4
41#define IP3106_ICLR 0xfe8
42#define IP3106_ISET 0xfec
43#define IP3106_PD 0xff4
44#define IP3106_MID 0xffc
45
46#define IP3106_UART_LCR_TXBREAK (1<<30)
47#define IP3106_UART_LCR_PAREVN 0x10000000
48#define IP3106_UART_LCR_PAREN 0x08000000
49#define IP3106_UART_LCR_2STOPB 0x04000000
50#define IP3106_UART_LCR_8BIT 0x01000000
51#define IP3106_UART_LCR_TX_RST 0x00040000
52#define IP3106_UART_LCR_RX_RST 0x00020000
53#define IP3106_UART_LCR_RX_NEXT 0x00010000
54
55#define IP3106_UART_MCR_SCR 0xFF000000
56#define IP3106_UART_MCR_DCD 0x00800000
57#define IP3106_UART_MCR_CTS 0x00100000
58#define IP3106_UART_MCR_LOOP 0x00000010
59#define IP3106_UART_MCR_RTS 0x00000002
60#define IP3106_UART_MCR_DTR 0x00000001
61
62#define IP3106_UART_INT_TX 0x00000080
63#define IP3106_UART_INT_EMPTY 0x00000040
64#define IP3106_UART_INT_RCVTO 0x00000020
65#define IP3106_UART_INT_RX 0x00000010
66#define IP3106_UART_INT_RXOVRN 0x00000008
67#define IP3106_UART_INT_FRERR 0x00000004
68#define IP3106_UART_INT_BREAK 0x00000002
69#define IP3106_UART_INT_PARITY 0x00000001
70#define IP3106_UART_INT_ALLRX 0x0000003F
71#define IP3106_UART_INT_ALLTX 0x000000C0
72
73#define IP3106_UART_FIFO_TXFIFO 0x001F0000
74#define IP3106_UART_FIFO_TXFIFO_STA (0x1f<<16)
75#define IP3106_UART_FIFO_RXBRK 0x00008000
76#define IP3106_UART_FIFO_RXFE 0x00004000
77#define IP3106_UART_FIFO_RXPAR 0x00002000
78#define IP3106_UART_FIFO_RXFIFO 0x00001F00
79#define IP3106_UART_FIFO_RBRTHR 0x000000FF
80
81#endif
diff --git a/include/linux/serial_pnx8xxx.h b/include/linux/serial_pnx8xxx.h
new file mode 100644
index 000000000000..de6c19c7f340
--- /dev/null
+++ b/include/linux/serial_pnx8xxx.h
@@ -0,0 +1,81 @@
1/*
2 * Embedded Alley Solutions, source@embeddedalley.com.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18
19#ifndef _LINUX_SERIAL_PNX8XXX_H
20#define _LINUX_SERIAL_PNX8XXX_H
21
22#include <linux/serial_core.h>
23#include <linux/device.h>
24
25#define PNX8XXX_NR_PORTS 2
26
27struct pnx8xxx_port {
28 struct uart_port port;
29 struct timer_list timer;
30 unsigned int old_status;
31};
32
33/* register offsets */
34#define PNX8XXX_LCR 0
35#define PNX8XXX_MCR 0x004
36#define PNX8XXX_BAUD 0x008
37#define PNX8XXX_CFG 0x00c
38#define PNX8XXX_FIFO 0x028
39#define PNX8XXX_ISTAT 0xfe0
40#define PNX8XXX_IEN 0xfe4
41#define PNX8XXX_ICLR 0xfe8
42#define PNX8XXX_ISET 0xfec
43#define PNX8XXX_PD 0xff4
44#define PNX8XXX_MID 0xffc
45
46#define PNX8XXX_UART_LCR_TXBREAK (1<<30)
47#define PNX8XXX_UART_LCR_PAREVN 0x10000000
48#define PNX8XXX_UART_LCR_PAREN 0x08000000
49#define PNX8XXX_UART_LCR_2STOPB 0x04000000
50#define PNX8XXX_UART_LCR_8BIT 0x01000000
51#define PNX8XXX_UART_LCR_TX_RST 0x00040000
52#define PNX8XXX_UART_LCR_RX_RST 0x00020000
53#define PNX8XXX_UART_LCR_RX_NEXT 0x00010000
54
55#define PNX8XXX_UART_MCR_SCR 0xFF000000
56#define PNX8XXX_UART_MCR_DCD 0x00800000
57#define PNX8XXX_UART_MCR_CTS 0x00100000
58#define PNX8XXX_UART_MCR_LOOP 0x00000010
59#define PNX8XXX_UART_MCR_RTS 0x00000002
60#define PNX8XXX_UART_MCR_DTR 0x00000001
61
62#define PNX8XXX_UART_INT_TX 0x00000080
63#define PNX8XXX_UART_INT_EMPTY 0x00000040
64#define PNX8XXX_UART_INT_RCVTO 0x00000020
65#define PNX8XXX_UART_INT_RX 0x00000010
66#define PNX8XXX_UART_INT_RXOVRN 0x00000008
67#define PNX8XXX_UART_INT_FRERR 0x00000004
68#define PNX8XXX_UART_INT_BREAK 0x00000002
69#define PNX8XXX_UART_INT_PARITY 0x00000001
70#define PNX8XXX_UART_INT_ALLRX 0x0000003F
71#define PNX8XXX_UART_INT_ALLTX 0x000000C0
72
73#define PNX8XXX_UART_FIFO_TXFIFO 0x001F0000
74#define PNX8XXX_UART_FIFO_TXFIFO_STA (0x1f<<16)
75#define PNX8XXX_UART_FIFO_RXBRK 0x00008000
76#define PNX8XXX_UART_FIFO_RXFE 0x00004000
77#define PNX8XXX_UART_FIFO_RXPAR 0x00002000
78#define PNX8XXX_UART_FIFO_RXFIFO 0x00001F00
79#define PNX8XXX_UART_FIFO_RBRTHR 0x000000FF
80
81#endif
diff --git a/include/linux/sunrpc/debug.h b/include/linux/sunrpc/debug.h
index 60fce3c92857..b7c7307ceec6 100644
--- a/include/linux/sunrpc/debug.h
+++ b/include/linux/sunrpc/debug.h
@@ -78,7 +78,6 @@ void rpc_unregister_sysctl(void);
78 * module currently registers its sysctl table dynamically, the sysctl path 78 * module currently registers its sysctl table dynamically, the sysctl path
79 * for module FOO is <CTL_SUNRPC, CTL_FOODEBUG>. 79 * for module FOO is <CTL_SUNRPC, CTL_FOODEBUG>.
80 */ 80 */
81#define CTL_SUNRPC 7249 /* arbitrary and hopefully unused */
82 81
83enum { 82enum {
84 CTL_RPCDEBUG = 1, 83 CTL_RPCDEBUG = 1,
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index 665412c4f4b9..2c5fb38d9392 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -53,7 +53,6 @@ struct __sysctl_args {
53 53
54/* For internal pattern-matching use only: */ 54/* For internal pattern-matching use only: */
55#ifdef __KERNEL__ 55#ifdef __KERNEL__
56#define CTL_ANY -1 /* Matches any name */
57#define CTL_NONE 0 56#define CTL_NONE 0
58#define CTL_UNNUMBERED CTL_NONE /* sysctl without a binary number */ 57#define CTL_UNNUMBERED CTL_NONE /* sysctl without a binary number */
59#endif 58#endif
@@ -69,7 +68,13 @@ enum
69 CTL_DEV=7, /* Devices */ 68 CTL_DEV=7, /* Devices */
70 CTL_BUS=8, /* Busses */ 69 CTL_BUS=8, /* Busses */
71 CTL_ABI=9, /* Binary emulation */ 70 CTL_ABI=9, /* Binary emulation */
72 CTL_CPU=10 /* CPU stuff (speed scaling, etc) */ 71 CTL_CPU=10, /* CPU stuff (speed scaling, etc) */
72 CTL_ARLAN=254, /* arlan wireless driver */
73 CTL_APPLDATA=2120, /* s390 appldata */
74 CTL_S390DBF=5677, /* s390 debug */
75 CTL_SUNRPC=7249, /* sunrpc debug */
76 CTL_PM=9899, /* frv power management */
77 CTL_FRV=9898, /* frv specific sysctls */
73}; 78};
74 79
75/* CTL_BUS names: */ 80/* CTL_BUS names: */
@@ -202,6 +207,11 @@ enum
202 VM_PANIC_ON_OOM=33, /* panic at out-of-memory */ 207 VM_PANIC_ON_OOM=33, /* panic at out-of-memory */
203 VM_VDSO_ENABLED=34, /* map VDSO into new processes? */ 208 VM_VDSO_ENABLED=34, /* map VDSO into new processes? */
204 VM_MIN_SLAB=35, /* Percent pages ignored by zone reclaim */ 209 VM_MIN_SLAB=35, /* Percent pages ignored by zone reclaim */
210
211 /* s390 vm cmm sysctls */
212 VM_CMM_PAGES=1111,
213 VM_CMM_TIMED_PAGES=1112,
214 VM_CMM_TIMEOUT=1113,
205}; 215};
206 216
207 217
@@ -803,6 +813,7 @@ enum
803 FS_AIO_NR=18, /* current system-wide number of aio requests */ 813 FS_AIO_NR=18, /* current system-wide number of aio requests */
804 FS_AIO_MAX_NR=19, /* system-wide maximum number of aio requests */ 814 FS_AIO_MAX_NR=19, /* system-wide maximum number of aio requests */
805 FS_INOTIFY=20, /* inotify submenu */ 815 FS_INOTIFY=20, /* inotify submenu */
816 FS_OCFS2=988, /* ocfs2 */
806}; 817};
807 818
808/* /proc/sys/fs/quota/ */ 819/* /proc/sys/fs/quota/ */
@@ -913,7 +924,11 @@ enum
913#ifdef __KERNEL__ 924#ifdef __KERNEL__
914#include <linux/list.h> 925#include <linux/list.h>
915 926
916extern void sysctl_init(void); 927/* For the /proc/sys support */
928struct ctl_table;
929extern struct ctl_table_header *sysctl_head_next(struct ctl_table_header *prev);
930extern void sysctl_head_finish(struct ctl_table_header *prev);
931extern int sysctl_perm(struct ctl_table *table, int op);
917 932
918typedef struct ctl_table ctl_table; 933typedef struct ctl_table ctl_table;
919 934
@@ -1007,9 +1022,9 @@ struct ctl_table
1007 int maxlen; 1022 int maxlen;
1008 mode_t mode; 1023 mode_t mode;
1009 ctl_table *child; 1024 ctl_table *child;
1025 ctl_table *parent; /* Automatically set */
1010 proc_handler *proc_handler; /* Callback for text formatting */ 1026 proc_handler *proc_handler; /* Callback for text formatting */
1011 ctl_handler *strategy; /* Callback function for all r/w */ 1027 ctl_handler *strategy; /* Callback function for all r/w */
1012 struct proc_dir_entry *de; /* /proc control block */
1013 void *extra1; 1028 void *extra1;
1014 void *extra2; 1029 void *extra2;
1015}; 1030};
@@ -1024,8 +1039,8 @@ struct ctl_table_header
1024 struct completion *unregistering; 1039 struct completion *unregistering;
1025}; 1040};
1026 1041
1027struct ctl_table_header * register_sysctl_table(ctl_table * table, 1042struct ctl_table_header * register_sysctl_table(ctl_table * table);
1028 int insert_at_head); 1043
1029void unregister_sysctl_table(struct ctl_table_header * table); 1044void unregister_sysctl_table(struct ctl_table_header * table);
1030 1045
1031#else /* __KERNEL__ */ 1046#else /* __KERNEL__ */
diff --git a/include/linux/time.h b/include/linux/time.h
index 55cee172d723..eceb1a59b078 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -90,7 +90,7 @@ static inline struct timespec timespec_sub(struct timespec lhs,
90 90
91extern struct timespec xtime; 91extern struct timespec xtime;
92extern struct timespec wall_to_monotonic; 92extern struct timespec wall_to_monotonic;
93extern seqlock_t xtime_lock; 93extern seqlock_t xtime_lock __attribute__((weak));
94 94
95void timekeeping_init(void); 95void timekeeping_init(void);
96 96
diff --git a/init/Kconfig b/init/Kconfig
index ad33c979e0b3..f977086e118a 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -125,6 +125,12 @@ config IPC_NS
125 environments, to use ipc namespaces to provide different ipc 125 environments, to use ipc namespaces to provide different ipc
126 objects for different servers. If unsure, say N. 126 objects for different servers. If unsure, say N.
127 127
128config SYSVIPC_SYSCTL
129 bool
130 depends on SYSVIPC
131 depends on SYSCTL
132 default y
133
128config POSIX_MQUEUE 134config POSIX_MQUEUE
129 bool "POSIX Message Queues" 135 bool "POSIX Message Queues"
130 depends on NET && EXPERIMENTAL 136 depends on NET && EXPERIMENTAL
diff --git a/init/calibrate.c b/init/calibrate.c
index d206c7548fe6..40ff3b404895 100644
--- a/init/calibrate.c
+++ b/init/calibrate.c
@@ -4,7 +4,7 @@
4 * Copyright (C) 1991, 1992 Linus Torvalds 4 * Copyright (C) 1991, 1992 Linus Torvalds
5 */ 5 */
6 6
7#include <linux/sched.h> 7#include <linux/jiffies.h>
8#include <linux/delay.h> 8#include <linux/delay.h>
9#include <linux/init.h> 9#include <linux/init.h>
10 10
diff --git a/init/main.c b/init/main.c
index 4e9e92bb2b89..2421e1544127 100644
--- a/init/main.c
+++ b/init/main.c
@@ -86,7 +86,6 @@ extern void init_IRQ(void);
86extern void fork_init(unsigned long); 86extern void fork_init(unsigned long);
87extern void mca_init(void); 87extern void mca_init(void);
88extern void sbus_init(void); 88extern void sbus_init(void);
89extern void sysctl_init(void);
90extern void signals_init(void); 89extern void signals_init(void);
91extern void pidhash_init(void); 90extern void pidhash_init(void);
92extern void pidmap_init(void); 91extern void pidmap_init(void);
@@ -702,8 +701,8 @@ static void __init do_basic_setup(void)
702 usermodehelper_init(); 701 usermodehelper_init();
703 driver_init(); 702 driver_init();
704 703
705#ifdef CONFIG_SYSCTL 704#ifdef CONFIG_PROC_FS
706 sysctl_init(); 705 init_irq_proc();
707#endif 706#endif
708 707
709 do_initcalls(); 708 do_initcalls();
@@ -727,7 +726,49 @@ static void run_init_process(char *init_filename)
727 kernel_execve(init_filename, argv_init, envp_init); 726 kernel_execve(init_filename, argv_init, envp_init);
728} 727}
729 728
730static int init(void * unused) 729/* This is a non __init function. Force it to be noinline otherwise gcc
730 * makes it inline to init() and it becomes part of init.text section
731 */
732static int noinline init_post(void)
733{
734 free_initmem();
735 unlock_kernel();
736 mark_rodata_ro();
737 system_state = SYSTEM_RUNNING;
738 numa_default_policy();
739
740 if (sys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0)
741 printk(KERN_WARNING "Warning: unable to open an initial console.\n");
742
743 (void) sys_dup(0);
744 (void) sys_dup(0);
745
746 if (ramdisk_execute_command) {
747 run_init_process(ramdisk_execute_command);
748 printk(KERN_WARNING "Failed to execute %s\n",
749 ramdisk_execute_command);
750 }
751
752 /*
753 * We try each of these until one succeeds.
754 *
755 * The Bourne shell can be used instead of init if we are
756 * trying to recover a really broken machine.
757 */
758 if (execute_command) {
759 run_init_process(execute_command);
760 printk(KERN_WARNING "Failed to execute %s. Attempting "
761 "defaults...\n", execute_command);
762 }
763 run_init_process("/sbin/init");
764 run_init_process("/etc/init");
765 run_init_process("/bin/init");
766 run_init_process("/bin/sh");
767
768 panic("No init found. Try passing init= option to kernel.");
769}
770
771static int __init init(void * unused)
731{ 772{
732 lock_kernel(); 773 lock_kernel();
733 /* 774 /*
@@ -775,39 +816,6 @@ static int init(void * unused)
775 * we're essentially up and running. Get rid of the 816 * we're essentially up and running. Get rid of the
776 * initmem segments and start the user-mode stuff.. 817 * initmem segments and start the user-mode stuff..
777 */ 818 */
778 free_initmem(); 819 init_post();
779 unlock_kernel(); 820 return 0;
780 mark_rodata_ro();
781 system_state = SYSTEM_RUNNING;
782 numa_default_policy();
783
784 if (sys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0)
785 printk(KERN_WARNING "Warning: unable to open an initial console.\n");
786
787 (void) sys_dup(0);
788 (void) sys_dup(0);
789
790 if (ramdisk_execute_command) {
791 run_init_process(ramdisk_execute_command);
792 printk(KERN_WARNING "Failed to execute %s\n",
793 ramdisk_execute_command);
794 }
795
796 /*
797 * We try each of these until one succeeds.
798 *
799 * The Bourne shell can be used instead of init if we are
800 * trying to recover a really broken machine.
801 */
802 if (execute_command) {
803 run_init_process(execute_command);
804 printk(KERN_WARNING "Failed to execute %s. Attempting "
805 "defaults...\n", execute_command);
806 }
807 run_init_process("/sbin/init");
808 run_init_process("/etc/init");
809 run_init_process("/bin/init");
810 run_init_process("/bin/sh");
811
812 panic("No init found. Try passing init= option to kernel.");
813} 821}
diff --git a/init/version.c b/init/version.c
index 6c01ec1cc48d..9d17d70ee02d 100644
--- a/init/version.c
+++ b/init/version.c
@@ -12,7 +12,6 @@
12#include <linux/utsname.h> 12#include <linux/utsname.h>
13#include <linux/utsrelease.h> 13#include <linux/utsrelease.h>
14#include <linux/version.h> 14#include <linux/version.h>
15#include <linux/sched.h>
16 15
17#define version(a) Version_ ## a 16#define version(a) Version_ ## a
18#define version_string(a) version(a) 17#define version_string(a) version(a)
diff --git a/ipc/Makefile b/ipc/Makefile
index 0a6d626cd794..b93bba6652f1 100644
--- a/ipc/Makefile
+++ b/ipc/Makefile
@@ -4,6 +4,7 @@
4 4
5obj-$(CONFIG_SYSVIPC_COMPAT) += compat.o 5obj-$(CONFIG_SYSVIPC_COMPAT) += compat.o
6obj-$(CONFIG_SYSVIPC) += util.o msgutil.o msg.o sem.o shm.o 6obj-$(CONFIG_SYSVIPC) += util.o msgutil.o msg.o sem.o shm.o
7obj-$(CONFIG_SYSVIPC_SYSCTL) += ipc_sysctl.o
7obj_mq-$(CONFIG_COMPAT) += compat_mq.o 8obj_mq-$(CONFIG_COMPAT) += compat_mq.o
8obj-$(CONFIG_POSIX_MQUEUE) += mqueue.o msgutil.o $(obj_mq-y) 9obj-$(CONFIG_POSIX_MQUEUE) += mqueue.o msgutil.o $(obj_mq-y)
9 10
diff --git a/ipc/ipc_sysctl.c b/ipc/ipc_sysctl.c
new file mode 100644
index 000000000000..a88934a1b769
--- /dev/null
+++ b/ipc/ipc_sysctl.c
@@ -0,0 +1,183 @@
1/*
2 * Copyright (C) 2007
3 *
4 * Author: Eric Biederman <ebiederm@xmision.com>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation, version 2 of the
9 * License.
10 */
11
12#include <linux/module.h>
13#include <linux/ipc.h>
14#include <linux/nsproxy.h>
15#include <linux/sysctl.h>
16#include <linux/uaccess.h>
17
18#ifdef CONFIG_IPC_NS
19static void *get_ipc(ctl_table *table)
20{
21 char *which = table->data;
22 struct ipc_namespace *ipc_ns = current->nsproxy->ipc_ns;
23 which = (which - (char *)&init_ipc_ns) + (char *)ipc_ns;
24 return which;
25}
26#else
27#define get_ipc(T) ((T)->data)
28#endif
29
30#ifdef CONFIG_PROC_FS
31static int proc_ipc_dointvec(ctl_table *table, int write, struct file *filp,
32 void __user *buffer, size_t *lenp, loff_t *ppos)
33{
34 struct ctl_table ipc_table;
35 memcpy(&ipc_table, table, sizeof(ipc_table));
36 ipc_table.data = get_ipc(table);
37
38 return proc_dointvec(&ipc_table, write, filp, buffer, lenp, ppos);
39}
40
41static int proc_ipc_doulongvec_minmax(ctl_table *table, int write,
42 struct file *filp, void __user *buffer, size_t *lenp, loff_t *ppos)
43{
44 struct ctl_table ipc_table;
45 memcpy(&ipc_table, table, sizeof(ipc_table));
46 ipc_table.data = get_ipc(table);
47
48 return proc_doulongvec_minmax(&ipc_table, write, filp, buffer,
49 lenp, ppos);
50}
51
52#else
53#define proc_ipc_doulongvec_minmax NULL
54#define proc_ipc_dointvec NULL
55#endif
56
57#ifdef CONFIG_SYSCTL_SYSCALL
58/* The generic sysctl ipc data routine. */
59static int sysctl_ipc_data(ctl_table *table, int __user *name, int nlen,
60 void __user *oldval, size_t __user *oldlenp,
61 void __user *newval, size_t newlen)
62{
63 size_t len;
64 void *data;
65
66 /* Get out of I don't have a variable */
67 if (!table->data || !table->maxlen)
68 return -ENOTDIR;
69
70 data = get_ipc(table);
71 if (!data)
72 return -ENOTDIR;
73
74 if (oldval && oldlenp) {
75 if (get_user(len, oldlenp))
76 return -EFAULT;
77 if (len) {
78 if (len > table->maxlen)
79 len = table->maxlen;
80 if (copy_to_user(oldval, data, len))
81 return -EFAULT;
82 if (put_user(len, oldlenp))
83 return -EFAULT;
84 }
85 }
86
87 if (newval && newlen) {
88 if (newlen > table->maxlen)
89 newlen = table->maxlen;
90
91 if (copy_from_user(data, newval, newlen))
92 return -EFAULT;
93 }
94 return 1;
95}
96#else
97#define sysctl_ipc_data NULL
98#endif
99
100static struct ctl_table ipc_kern_table[] = {
101 {
102 .ctl_name = KERN_SHMMAX,
103 .procname = "shmmax",
104 .data = &init_ipc_ns.shm_ctlmax,
105 .maxlen = sizeof (init_ipc_ns.shm_ctlmax),
106 .mode = 0644,
107 .proc_handler = proc_ipc_doulongvec_minmax,
108 .strategy = sysctl_ipc_data,
109 },
110 {
111 .ctl_name = KERN_SHMALL,
112 .procname = "shmall",
113 .data = &init_ipc_ns.shm_ctlall,
114 .maxlen = sizeof (init_ipc_ns.shm_ctlall),
115 .mode = 0644,
116 .proc_handler = proc_ipc_doulongvec_minmax,
117 .strategy = sysctl_ipc_data,
118 },
119 {
120 .ctl_name = KERN_SHMMNI,
121 .procname = "shmmni",
122 .data = &init_ipc_ns.shm_ctlmni,
123 .maxlen = sizeof (init_ipc_ns.shm_ctlmni),
124 .mode = 0644,
125 .proc_handler = proc_ipc_dointvec,
126 .strategy = sysctl_ipc_data,
127 },
128 {
129 .ctl_name = KERN_MSGMAX,
130 .procname = "msgmax",
131 .data = &init_ipc_ns.msg_ctlmax,
132 .maxlen = sizeof (init_ipc_ns.msg_ctlmax),
133 .mode = 0644,
134 .proc_handler = proc_ipc_dointvec,
135 .strategy = sysctl_ipc_data,
136 },
137 {
138 .ctl_name = KERN_MSGMNI,
139 .procname = "msgmni",
140 .data = &init_ipc_ns.msg_ctlmni,
141 .maxlen = sizeof (init_ipc_ns.msg_ctlmni),
142 .mode = 0644,
143 .proc_handler = proc_ipc_dointvec,
144 .strategy = sysctl_ipc_data,
145 },
146 {
147 .ctl_name = KERN_MSGMNB,
148 .procname = "msgmnb",
149 .data = &init_ipc_ns.msg_ctlmnb,
150 .maxlen = sizeof (init_ipc_ns.msg_ctlmnb),
151 .mode = 0644,
152 .proc_handler = proc_ipc_dointvec,
153 .strategy = sysctl_ipc_data,
154 },
155 {
156 .ctl_name = KERN_SEM,
157 .procname = "sem",
158 .data = &init_ipc_ns.sem_ctls,
159 .maxlen = 4*sizeof (int),
160 .mode = 0644,
161 .proc_handler = proc_ipc_dointvec,
162 .strategy = sysctl_ipc_data,
163 },
164 {}
165};
166
167static struct ctl_table ipc_root_table[] = {
168 {
169 .ctl_name = CTL_KERN,
170 .procname = "kernel",
171 .mode = 0555,
172 .child = ipc_kern_table,
173 },
174 {}
175};
176
177static int __init ipc_sysctl_init(void)
178{
179 register_sysctl_table(ipc_root_table);
180 return 0;
181}
182
183__initcall(ipc_sysctl_init);
diff --git a/ipc/mqueue.c b/ipc/mqueue.c
index 7a8ce610fda2..0b5ecbe5f045 100644
--- a/ipc/mqueue.c
+++ b/ipc/mqueue.c
@@ -1255,7 +1255,7 @@ static int __init init_mqueue_fs(void)
1255 return -ENOMEM; 1255 return -ENOMEM;
1256 1256
1257 /* ignore failues - they are not fatal */ 1257 /* ignore failues - they are not fatal */
1258 mq_sysctl_table = register_sysctl_table(mq_sysctl_root, 0); 1258 mq_sysctl_table = register_sysctl_table(mq_sysctl_root);
1259 1259
1260 error = register_filesystem(&mqueue_fs_type); 1260 error = register_filesystem(&mqueue_fs_type);
1261 if (error) 1261 if (error)
diff --git a/kernel/Makefile b/kernel/Makefile
index 14f4d45e0ae9..ac6b27abb1ad 100644
--- a/kernel/Makefile
+++ b/kernel/Makefile
@@ -47,6 +47,7 @@ obj-$(CONFIG_GENERIC_HARDIRQS) += irq/
47obj-$(CONFIG_SECCOMP) += seccomp.o 47obj-$(CONFIG_SECCOMP) += seccomp.o
48obj-$(CONFIG_RCU_TORTURE_TEST) += rcutorture.o 48obj-$(CONFIG_RCU_TORTURE_TEST) += rcutorture.o
49obj-$(CONFIG_RELAY) += relay.o 49obj-$(CONFIG_RELAY) += relay.o
50obj-$(CONFIG_SYSCTL) += utsname_sysctl.o
50obj-$(CONFIG_UTS_NS) += utsname.o 51obj-$(CONFIG_UTS_NS) += utsname.o
51obj-$(CONFIG_TASK_DELAY_ACCT) += delayacct.o 52obj-$(CONFIG_TASK_DELAY_ACCT) += delayacct.o
52obj-$(CONFIG_TASKSTATS) += taskstats.o tsacct.o 53obj-$(CONFIG_TASKSTATS) += taskstats.o tsacct.o
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index 7c85d69188ef..acc5d9fe462b 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -461,7 +461,7 @@ int request_irq(unsigned int irq, irq_handler_t handler,
461 /* 461 /*
462 * Lockdep wants atomic interrupt handlers: 462 * Lockdep wants atomic interrupt handlers:
463 */ 463 */
464 irqflags |= SA_INTERRUPT; 464 irqflags |= IRQF_DISABLED;
465#endif 465#endif
466 /* 466 /*
467 * Sanity-check: shared interrupts must pass in a real dev-ID, 467 * Sanity-check: shared interrupts must pass in a real dev-ID,
diff --git a/kernel/kmod.c b/kernel/kmod.c
index 3a7379aa31ca..796276141e51 100644
--- a/kernel/kmod.c
+++ b/kernel/kmod.c
@@ -217,7 +217,10 @@ static int wait_for_helper(void *data)
217 sub_info->retval = ret; 217 sub_info->retval = ret;
218 } 218 }
219 219
220 complete(sub_info->complete); 220 if (sub_info->wait < 0)
221 kfree(sub_info);
222 else
223 complete(sub_info->complete);
221 return 0; 224 return 0;
222} 225}
223 226
@@ -239,6 +242,9 @@ static void __call_usermodehelper(struct work_struct *work)
239 pid = kernel_thread(____call_usermodehelper, sub_info, 242 pid = kernel_thread(____call_usermodehelper, sub_info,
240 CLONE_VFORK | SIGCHLD); 243 CLONE_VFORK | SIGCHLD);
241 244
245 if (wait < 0)
246 return;
247
242 if (pid < 0) { 248 if (pid < 0) {
243 sub_info->retval = pid; 249 sub_info->retval = pid;
244 complete(sub_info->complete); 250 complete(sub_info->complete);
@@ -253,6 +259,9 @@ static void __call_usermodehelper(struct work_struct *work)
253 * @envp: null-terminated environment list 259 * @envp: null-terminated environment list
254 * @session_keyring: session keyring for process (NULL for an empty keyring) 260 * @session_keyring: session keyring for process (NULL for an empty keyring)
255 * @wait: wait for the application to finish and return status. 261 * @wait: wait for the application to finish and return status.
262 * when -1 don't wait at all, but you get no useful error back when
263 * the program couldn't be exec'ed. This makes it safe to call
264 * from interrupt context.
256 * 265 *
257 * Runs a user-space application. The application is started 266 * Runs a user-space application. The application is started
258 * asynchronously if wait is not set, and runs as a child of keventd. 267 * asynchronously if wait is not set, and runs as a child of keventd.
@@ -265,17 +274,8 @@ int call_usermodehelper_keys(char *path, char **argv, char **envp,
265 struct key *session_keyring, int wait) 274 struct key *session_keyring, int wait)
266{ 275{
267 DECLARE_COMPLETION_ONSTACK(done); 276 DECLARE_COMPLETION_ONSTACK(done);
268 struct subprocess_info sub_info = { 277 struct subprocess_info *sub_info;
269 .work = __WORK_INITIALIZER(sub_info.work, 278 int retval;
270 __call_usermodehelper),
271 .complete = &done,
272 .path = path,
273 .argv = argv,
274 .envp = envp,
275 .ring = session_keyring,
276 .wait = wait,
277 .retval = 0,
278 };
279 279
280 if (!khelper_wq) 280 if (!khelper_wq)
281 return -EBUSY; 281 return -EBUSY;
@@ -283,9 +283,25 @@ int call_usermodehelper_keys(char *path, char **argv, char **envp,
283 if (path[0] == '\0') 283 if (path[0] == '\0')
284 return 0; 284 return 0;
285 285
286 queue_work(khelper_wq, &sub_info.work); 286 sub_info = kzalloc(sizeof(struct subprocess_info), GFP_ATOMIC);
287 if (!sub_info)
288 return -ENOMEM;
289
290 INIT_WORK(&sub_info->work, __call_usermodehelper);
291 sub_info->complete = &done;
292 sub_info->path = path;
293 sub_info->argv = argv;
294 sub_info->envp = envp;
295 sub_info->ring = session_keyring;
296 sub_info->wait = wait;
297
298 queue_work(khelper_wq, &sub_info->work);
299 if (wait < 0) /* task has freed sub_info */
300 return 0;
287 wait_for_completion(&done); 301 wait_for_completion(&done);
288 return sub_info.retval; 302 retval = sub_info->retval;
303 kfree(sub_info);
304 return retval;
289} 305}
290EXPORT_SYMBOL(call_usermodehelper_keys); 306EXPORT_SYMBOL(call_usermodehelper_keys);
291 307
diff --git a/kernel/lockdep_proc.c b/kernel/lockdep_proc.c
index 88fc611b3ae9..58f35e586ee3 100644
--- a/kernel/lockdep_proc.c
+++ b/kernel/lockdep_proc.c
@@ -10,7 +10,6 @@
10 * Code for /proc/lockdep and /proc/lockdep_stats: 10 * Code for /proc/lockdep and /proc/lockdep_stats:
11 * 11 *
12 */ 12 */
13#include <linux/sched.h>
14#include <linux/module.h> 13#include <linux/module.h>
15#include <linux/proc_fs.h> 14#include <linux/proc_fs.h>
16#include <linux/seq_file.h> 15#include <linux/seq_file.h>
diff --git a/kernel/mutex-debug.c b/kernel/mutex-debug.c
index 841539d72c55..d17436cdea1b 100644
--- a/kernel/mutex-debug.c
+++ b/kernel/mutex-debug.c
@@ -13,7 +13,6 @@
13 * Released under the General Public License (GPL). 13 * Released under the General Public License (GPL).
14 */ 14 */
15#include <linux/mutex.h> 15#include <linux/mutex.h>
16#include <linux/sched.h>
17#include <linux/delay.h> 16#include <linux/delay.h>
18#include <linux/module.h> 17#include <linux/module.h>
19#include <linux/poison.h> 18#include <linux/poison.h>
diff --git a/kernel/resource.c b/kernel/resource.c
index 2a3f88636580..bdb55a33f969 100644
--- a/kernel/resource.c
+++ b/kernel/resource.c
@@ -8,7 +8,6 @@
8 */ 8 */
9 9
10#include <linux/module.h> 10#include <linux/module.h>
11#include <linux/sched.h>
12#include <linux/errno.h> 11#include <linux/errno.h>
13#include <linux/ioport.h> 12#include <linux/ioport.h>
14#include <linux/init.h> 13#include <linux/init.h>
diff --git a/kernel/sched.c b/kernel/sched.c
index 08f86178aa34..0dc757246d89 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -1853,6 +1853,13 @@ context_switch(struct rq *rq, struct task_struct *prev,
1853 struct mm_struct *mm = next->mm; 1853 struct mm_struct *mm = next->mm;
1854 struct mm_struct *oldmm = prev->active_mm; 1854 struct mm_struct *oldmm = prev->active_mm;
1855 1855
1856 /*
1857 * For paravirt, this is coupled with an exit in switch_to to
1858 * combine the page table reload and the switch backend into
1859 * one hypercall.
1860 */
1861 arch_enter_lazy_cpu_mode();
1862
1856 if (!mm) { 1863 if (!mm) {
1857 next->active_mm = oldmm; 1864 next->active_mm = oldmm;
1858 atomic_inc(&oldmm->mm_count); 1865 atomic_inc(&oldmm->mm_count);
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index e0ac6cd79fcf..3ca1d5ff0319 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -90,12 +90,6 @@ extern char modprobe_path[];
90#ifdef CONFIG_CHR_DEV_SG 90#ifdef CONFIG_CHR_DEV_SG
91extern int sg_big_buff; 91extern int sg_big_buff;
92#endif 92#endif
93#ifdef CONFIG_SYSVIPC
94static int proc_ipc_dointvec(ctl_table *table, int write, struct file *filp,
95 void __user *buffer, size_t *lenp, loff_t *ppos);
96static int proc_ipc_doulongvec_minmax(ctl_table *table, int write, struct file *filp,
97 void __user *buffer, size_t *lenp, loff_t *ppos);
98#endif
99 93
100#ifdef __sparc__ 94#ifdef __sparc__
101extern char reboot_command []; 95extern char reboot_command [];
@@ -135,18 +129,6 @@ static int parse_table(int __user *, int, void __user *, size_t __user *,
135 void __user *, size_t, ctl_table *); 129 void __user *, size_t, ctl_table *);
136#endif 130#endif
137 131
138static int proc_do_uts_string(ctl_table *table, int write, struct file *filp,
139 void __user *buffer, size_t *lenp, loff_t *ppos);
140
141static int sysctl_uts_string(ctl_table *table, int __user *name, int nlen,
142 void __user *oldval, size_t __user *oldlenp,
143 void __user *newval, size_t newlen);
144
145#ifdef CONFIG_SYSVIPC
146static int sysctl_ipc_data(ctl_table *table, int __user *name, int nlen,
147 void __user *oldval, size_t __user *oldlenp,
148 void __user *newval, size_t newlen);
149#endif
150 132
151#ifdef CONFIG_PROC_SYSCTL 133#ifdef CONFIG_PROC_SYSCTL
152static int proc_do_cad_pid(ctl_table *table, int write, struct file *filp, 134static int proc_do_cad_pid(ctl_table *table, int write, struct file *filp,
@@ -177,60 +159,6 @@ int sysctl_legacy_va_layout;
177#endif 159#endif
178 160
179 161
180static void *get_uts(ctl_table *table, int write)
181{
182 char *which = table->data;
183#ifdef CONFIG_UTS_NS
184 struct uts_namespace *uts_ns = current->nsproxy->uts_ns;
185 which = (which - (char *)&init_uts_ns) + (char *)uts_ns;
186#endif
187 if (!write)
188 down_read(&uts_sem);
189 else
190 down_write(&uts_sem);
191 return which;
192}
193
194static void put_uts(ctl_table *table, int write, void *which)
195{
196 if (!write)
197 up_read(&uts_sem);
198 else
199 up_write(&uts_sem);
200}
201
202#ifdef CONFIG_SYSVIPC
203static void *get_ipc(ctl_table *table, int write)
204{
205 char *which = table->data;
206 struct ipc_namespace *ipc_ns = current->nsproxy->ipc_ns;
207 which = (which - (char *)&init_ipc_ns) + (char *)ipc_ns;
208 return which;
209}
210#else
211#define get_ipc(T,W) ((T)->data)
212#endif
213
214/* /proc declarations: */
215
216#ifdef CONFIG_PROC_SYSCTL
217
218static ssize_t proc_readsys(struct file *, char __user *, size_t, loff_t *);
219static ssize_t proc_writesys(struct file *, const char __user *, size_t, loff_t *);
220static int proc_opensys(struct inode *, struct file *);
221
222const struct file_operations proc_sys_file_operations = {
223 .open = proc_opensys,
224 .read = proc_readsys,
225 .write = proc_writesys,
226};
227
228extern struct proc_dir_entry *proc_sys_root;
229
230static void register_proc_table(ctl_table *, struct proc_dir_entry *, void *);
231static void unregister_proc_table(ctl_table *, struct proc_dir_entry *);
232#endif
233
234/* The default sysctl tables: */ 162/* The default sysctl tables: */
235 163
236static ctl_table root_table[] = { 164static ctl_table root_table[] = {
@@ -278,51 +206,6 @@ static ctl_table root_table[] = {
278 206
279static ctl_table kern_table[] = { 207static ctl_table kern_table[] = {
280 { 208 {
281 .ctl_name = KERN_OSTYPE,
282 .procname = "ostype",
283 .data = init_uts_ns.name.sysname,
284 .maxlen = sizeof(init_uts_ns.name.sysname),
285 .mode = 0444,
286 .proc_handler = &proc_do_uts_string,
287 .strategy = &sysctl_uts_string,
288 },
289 {
290 .ctl_name = KERN_OSRELEASE,
291 .procname = "osrelease",
292 .data = init_uts_ns.name.release,
293 .maxlen = sizeof(init_uts_ns.name.release),
294 .mode = 0444,
295 .proc_handler = &proc_do_uts_string,
296 .strategy = &sysctl_uts_string,
297 },
298 {
299 .ctl_name = KERN_VERSION,
300 .procname = "version",
301 .data = init_uts_ns.name.version,
302 .maxlen = sizeof(init_uts_ns.name.version),
303 .mode = 0444,
304 .proc_handler = &proc_do_uts_string,
305 .strategy = &sysctl_uts_string,
306 },
307 {
308 .ctl_name = KERN_NODENAME,
309 .procname = "hostname",
310 .data = init_uts_ns.name.nodename,
311 .maxlen = sizeof(init_uts_ns.name.nodename),
312 .mode = 0644,
313 .proc_handler = &proc_do_uts_string,
314 .strategy = &sysctl_uts_string,
315 },
316 {
317 .ctl_name = KERN_DOMAINNAME,
318 .procname = "domainname",
319 .data = init_uts_ns.name.domainname,
320 .maxlen = sizeof(init_uts_ns.name.domainname),
321 .mode = 0644,
322 .proc_handler = &proc_do_uts_string,
323 .strategy = &sysctl_uts_string,
324 },
325 {
326 .ctl_name = KERN_PANIC, 209 .ctl_name = KERN_PANIC,
327 .procname = "panic", 210 .procname = "panic",
328 .data = &panic_timeout, 211 .data = &panic_timeout,
@@ -478,71 +361,6 @@ static ctl_table kern_table[] = {
478 .proc_handler = &proc_dointvec, 361 .proc_handler = &proc_dointvec,
479 }, 362 },
480#endif 363#endif
481#ifdef CONFIG_SYSVIPC
482 {
483 .ctl_name = KERN_SHMMAX,
484 .procname = "shmmax",
485 .data = &init_ipc_ns.shm_ctlmax,
486 .maxlen = sizeof (init_ipc_ns.shm_ctlmax),
487 .mode = 0644,
488 .proc_handler = &proc_ipc_doulongvec_minmax,
489 .strategy = sysctl_ipc_data,
490 },
491 {
492 .ctl_name = KERN_SHMALL,
493 .procname = "shmall",
494 .data = &init_ipc_ns.shm_ctlall,
495 .maxlen = sizeof (init_ipc_ns.shm_ctlall),
496 .mode = 0644,
497 .proc_handler = &proc_ipc_doulongvec_minmax,
498 .strategy = sysctl_ipc_data,
499 },
500 {
501 .ctl_name = KERN_SHMMNI,
502 .procname = "shmmni",
503 .data = &init_ipc_ns.shm_ctlmni,
504 .maxlen = sizeof (init_ipc_ns.shm_ctlmni),
505 .mode = 0644,
506 .proc_handler = &proc_ipc_dointvec,
507 .strategy = sysctl_ipc_data,
508 },
509 {
510 .ctl_name = KERN_MSGMAX,
511 .procname = "msgmax",
512 .data = &init_ipc_ns.msg_ctlmax,
513 .maxlen = sizeof (init_ipc_ns.msg_ctlmax),
514 .mode = 0644,
515 .proc_handler = &proc_ipc_dointvec,
516 .strategy = sysctl_ipc_data,
517 },
518 {
519 .ctl_name = KERN_MSGMNI,
520 .procname = "msgmni",
521 .data = &init_ipc_ns.msg_ctlmni,
522 .maxlen = sizeof (init_ipc_ns.msg_ctlmni),
523 .mode = 0644,
524 .proc_handler = &proc_ipc_dointvec,
525 .strategy = sysctl_ipc_data,
526 },
527 {
528 .ctl_name = KERN_MSGMNB,
529 .procname = "msgmnb",
530 .data = &init_ipc_ns.msg_ctlmnb,
531 .maxlen = sizeof (init_ipc_ns.msg_ctlmnb),
532 .mode = 0644,
533 .proc_handler = &proc_ipc_dointvec,
534 .strategy = sysctl_ipc_data,
535 },
536 {
537 .ctl_name = KERN_SEM,
538 .procname = "sem",
539 .data = &init_ipc_ns.sem_ctls,
540 .maxlen = 4*sizeof (int),
541 .mode = 0644,
542 .proc_handler = &proc_ipc_dointvec,
543 .strategy = sysctl_ipc_data,
544 },
545#endif
546#ifdef CONFIG_MAGIC_SYSRQ 364#ifdef CONFIG_MAGIC_SYSRQ
547 { 365 {
548 .ctl_name = KERN_SYSRQ, 366 .ctl_name = KERN_SYSRQ,
@@ -1043,6 +861,12 @@ static ctl_table vm_table[] = {
1043 { .ctl_name = 0 } 861 { .ctl_name = 0 }
1044}; 862};
1045 863
864#if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
865static ctl_table binfmt_misc_table[] = {
866 { .ctl_name = 0 }
867};
868#endif
869
1046static ctl_table fs_table[] = { 870static ctl_table fs_table[] = {
1047 { 871 {
1048 .ctl_name = FS_NRINODE, 872 .ctl_name = FS_NRINODE,
@@ -1166,6 +990,14 @@ static ctl_table fs_table[] = {
1166 .mode = 0644, 990 .mode = 0644,
1167 .proc_handler = &proc_dointvec, 991 .proc_handler = &proc_dointvec,
1168 }, 992 },
993#if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
994 {
995 .ctl_name = CTL_UNNUMBERED,
996 .procname = "binfmt_misc",
997 .mode = 0555,
998 .child = binfmt_misc_table,
999 },
1000#endif
1169 { .ctl_name = 0 } 1001 { .ctl_name = 0 }
1170}; 1002};
1171 1003
@@ -1177,8 +1009,6 @@ static ctl_table dev_table[] = {
1177 { .ctl_name = 0 } 1009 { .ctl_name = 0 }
1178}; 1010};
1179 1011
1180extern void init_irq_proc (void);
1181
1182static DEFINE_SPINLOCK(sysctl_lock); 1012static DEFINE_SPINLOCK(sysctl_lock);
1183 1013
1184/* called under sysctl_lock */ 1014/* called under sysctl_lock */
@@ -1220,19 +1050,47 @@ static void start_unregistering(struct ctl_table_header *p)
1220 list_del_init(&p->ctl_entry); 1050 list_del_init(&p->ctl_entry);
1221} 1051}
1222 1052
1223void __init sysctl_init(void) 1053void sysctl_head_finish(struct ctl_table_header *head)
1224{ 1054{
1225#ifdef CONFIG_PROC_SYSCTL 1055 if (!head)
1226 register_proc_table(root_table, proc_sys_root, &root_table_header); 1056 return;
1227 init_irq_proc(); 1057 spin_lock(&sysctl_lock);
1228#endif 1058 unuse_table(head);
1059 spin_unlock(&sysctl_lock);
1060}
1061
1062struct ctl_table_header *sysctl_head_next(struct ctl_table_header *prev)
1063{
1064 struct ctl_table_header *head;
1065 struct list_head *tmp;
1066 spin_lock(&sysctl_lock);
1067 if (prev) {
1068 tmp = &prev->ctl_entry;
1069 unuse_table(prev);
1070 goto next;
1071 }
1072 tmp = &root_table_header.ctl_entry;
1073 for (;;) {
1074 head = list_entry(tmp, struct ctl_table_header, ctl_entry);
1075
1076 if (!use_table(head))
1077 goto next;
1078 spin_unlock(&sysctl_lock);
1079 return head;
1080 next:
1081 tmp = tmp->next;
1082 if (tmp == &root_table_header.ctl_entry)
1083 break;
1084 }
1085 spin_unlock(&sysctl_lock);
1086 return NULL;
1229} 1087}
1230 1088
1231#ifdef CONFIG_SYSCTL_SYSCALL 1089#ifdef CONFIG_SYSCTL_SYSCALL
1232int do_sysctl(int __user *name, int nlen, void __user *oldval, size_t __user *oldlenp, 1090int do_sysctl(int __user *name, int nlen, void __user *oldval, size_t __user *oldlenp,
1233 void __user *newval, size_t newlen) 1091 void __user *newval, size_t newlen)
1234{ 1092{
1235 struct list_head *tmp; 1093 struct ctl_table_header *head;
1236 int error = -ENOTDIR; 1094 int error = -ENOTDIR;
1237 1095
1238 if (nlen <= 0 || nlen >= CTL_MAXNAME) 1096 if (nlen <= 0 || nlen >= CTL_MAXNAME)
@@ -1242,26 +1100,16 @@ int do_sysctl(int __user *name, int nlen, void __user *oldval, size_t __user *ol
1242 if (!oldlenp || get_user(old_len, oldlenp)) 1100 if (!oldlenp || get_user(old_len, oldlenp))
1243 return -EFAULT; 1101 return -EFAULT;
1244 } 1102 }
1245 spin_lock(&sysctl_lock);
1246 tmp = &root_table_header.ctl_entry;
1247 do {
1248 struct ctl_table_header *head =
1249 list_entry(tmp, struct ctl_table_header, ctl_entry);
1250
1251 if (!use_table(head))
1252 continue;
1253
1254 spin_unlock(&sysctl_lock);
1255 1103
1104 for (head = sysctl_head_next(NULL); head;
1105 head = sysctl_head_next(head)) {
1256 error = parse_table(name, nlen, oldval, oldlenp, 1106 error = parse_table(name, nlen, oldval, oldlenp,
1257 newval, newlen, head->ctl_table); 1107 newval, newlen, head->ctl_table);
1258 1108 if (error != -ENOTDIR) {
1259 spin_lock(&sysctl_lock); 1109 sysctl_head_finish(head);
1260 unuse_table(head);
1261 if (error != -ENOTDIR)
1262 break; 1110 break;
1263 } while ((tmp = tmp->next) != &root_table_header.ctl_entry); 1111 }
1264 spin_unlock(&sysctl_lock); 1112 }
1265 return error; 1113 return error;
1266} 1114}
1267 1115
@@ -1282,7 +1130,7 @@ asmlinkage long sys_sysctl(struct __sysctl_args __user *args)
1282#endif /* CONFIG_SYSCTL_SYSCALL */ 1130#endif /* CONFIG_SYSCTL_SYSCALL */
1283 1131
1284/* 1132/*
1285 * ctl_perm does NOT grant the superuser all rights automatically, because 1133 * sysctl_perm does NOT grant the superuser all rights automatically, because
1286 * some sysctl variables are readonly even to root. 1134 * some sysctl variables are readonly even to root.
1287 */ 1135 */
1288 1136
@@ -1297,7 +1145,7 @@ static int test_perm(int mode, int op)
1297 return -EACCES; 1145 return -EACCES;
1298} 1146}
1299 1147
1300static inline int ctl_perm(ctl_table *table, int op) 1148int sysctl_perm(ctl_table *table, int op)
1301{ 1149{
1302 int error; 1150 int error;
1303 error = security_sysctl(table, op); 1151 error = security_sysctl(table, op);
@@ -1321,19 +1169,11 @@ repeat:
1321 for ( ; table->ctl_name || table->procname; table++) { 1169 for ( ; table->ctl_name || table->procname; table++) {
1322 if (!table->ctl_name) 1170 if (!table->ctl_name)
1323 continue; 1171 continue;
1324 if (n == table->ctl_name || table->ctl_name == CTL_ANY) { 1172 if (n == table->ctl_name) {
1325 int error; 1173 int error;
1326 if (table->child) { 1174 if (table->child) {
1327 if (ctl_perm(table, 001)) 1175 if (sysctl_perm(table, 001))
1328 return -EPERM; 1176 return -EPERM;
1329 if (table->strategy) {
1330 error = table->strategy(
1331 table, name, nlen,
1332 oldval, oldlenp,
1333 newval, newlen);
1334 if (error)
1335 return error;
1336 }
1337 name++; 1177 name++;
1338 nlen--; 1178 nlen--;
1339 table = table->child; 1179 table = table->child;
@@ -1361,7 +1201,7 @@ int do_sysctl_strategy (ctl_table *table,
1361 op |= 004; 1201 op |= 004;
1362 if (newval) 1202 if (newval)
1363 op |= 002; 1203 op |= 002;
1364 if (ctl_perm(table, op)) 1204 if (sysctl_perm(table, op))
1365 return -EPERM; 1205 return -EPERM;
1366 1206
1367 if (table->strategy) { 1207 if (table->strategy) {
@@ -1400,10 +1240,26 @@ int do_sysctl_strategy (ctl_table *table,
1400} 1240}
1401#endif /* CONFIG_SYSCTL_SYSCALL */ 1241#endif /* CONFIG_SYSCTL_SYSCALL */
1402 1242
1243static void sysctl_set_parent(struct ctl_table *parent, struct ctl_table *table)
1244{
1245 for (; table->ctl_name || table->procname; table++) {
1246 table->parent = parent;
1247 if (table->child)
1248 sysctl_set_parent(table, table->child);
1249 }
1250}
1251
1252static __init int sysctl_init(void)
1253{
1254 sysctl_set_parent(NULL, root_table);
1255 return 0;
1256}
1257
1258core_initcall(sysctl_init);
1259
1403/** 1260/**
1404 * register_sysctl_table - register a sysctl hierarchy 1261 * register_sysctl_table - register a sysctl hierarchy
1405 * @table: the top-level table structure 1262 * @table: the top-level table structure
1406 * @insert_at_head: whether the entry should be inserted in front or at the end
1407 * 1263 *
1408 * Register a sysctl table hierarchy. @table should be a filled in ctl_table 1264 * Register a sysctl table hierarchy. @table should be a filled in ctl_table
1409 * array. An entry with a ctl_name of 0 terminates the table. 1265 * array. An entry with a ctl_name of 0 terminates the table.
@@ -1469,8 +1325,7 @@ int do_sysctl_strategy (ctl_table *table,
1469 * This routine returns %NULL on a failure to register, and a pointer 1325 * This routine returns %NULL on a failure to register, and a pointer
1470 * to the table header on success. 1326 * to the table header on success.
1471 */ 1327 */
1472struct ctl_table_header *register_sysctl_table(ctl_table * table, 1328struct ctl_table_header *register_sysctl_table(ctl_table * table)
1473 int insert_at_head)
1474{ 1329{
1475 struct ctl_table_header *tmp; 1330 struct ctl_table_header *tmp;
1476 tmp = kmalloc(sizeof(struct ctl_table_header), GFP_KERNEL); 1331 tmp = kmalloc(sizeof(struct ctl_table_header), GFP_KERNEL);
@@ -1480,15 +1335,10 @@ struct ctl_table_header *register_sysctl_table(ctl_table * table,
1480 INIT_LIST_HEAD(&tmp->ctl_entry); 1335 INIT_LIST_HEAD(&tmp->ctl_entry);
1481 tmp->used = 0; 1336 tmp->used = 0;
1482 tmp->unregistering = NULL; 1337 tmp->unregistering = NULL;
1338 sysctl_set_parent(NULL, table);
1483 spin_lock(&sysctl_lock); 1339 spin_lock(&sysctl_lock);
1484 if (insert_at_head) 1340 list_add_tail(&tmp->ctl_entry, &root_table_header.ctl_entry);
1485 list_add(&tmp->ctl_entry, &root_table_header.ctl_entry);
1486 else
1487 list_add_tail(&tmp->ctl_entry, &root_table_header.ctl_entry);
1488 spin_unlock(&sysctl_lock); 1341 spin_unlock(&sysctl_lock);
1489#ifdef CONFIG_PROC_SYSCTL
1490 register_proc_table(table, proc_sys_root, tmp);
1491#endif
1492 return tmp; 1342 return tmp;
1493} 1343}
1494 1344
@@ -1504,9 +1354,6 @@ void unregister_sysctl_table(struct ctl_table_header * header)
1504 might_sleep(); 1354 might_sleep();
1505 spin_lock(&sysctl_lock); 1355 spin_lock(&sysctl_lock);
1506 start_unregistering(header); 1356 start_unregistering(header);
1507#ifdef CONFIG_PROC_SYSCTL
1508 unregister_proc_table(header->ctl_table, proc_sys_root);
1509#endif
1510 spin_unlock(&sysctl_lock); 1357 spin_unlock(&sysctl_lock);
1511 kfree(header); 1358 kfree(header);
1512} 1359}
@@ -1530,155 +1377,6 @@ void unregister_sysctl_table(struct ctl_table_header * table)
1530 1377
1531#ifdef CONFIG_PROC_SYSCTL 1378#ifdef CONFIG_PROC_SYSCTL
1532 1379
1533/* Scan the sysctl entries in table and add them all into /proc */
1534static void register_proc_table(ctl_table * table, struct proc_dir_entry *root, void *set)
1535{
1536 struct proc_dir_entry *de;
1537 int len;
1538 mode_t mode;
1539
1540 for (; table->ctl_name || table->procname; table++) {
1541 /* Can't do anything without a proc name. */
1542 if (!table->procname)
1543 continue;
1544 /* Maybe we can't do anything with it... */
1545 if (!table->proc_handler && !table->child) {
1546 printk(KERN_WARNING "SYSCTL: Can't register %s\n",
1547 table->procname);
1548 continue;
1549 }
1550
1551 len = strlen(table->procname);
1552 mode = table->mode;
1553
1554 de = NULL;
1555 if (table->proc_handler)
1556 mode |= S_IFREG;
1557 else {
1558 mode |= S_IFDIR;
1559 for (de = root->subdir; de; de = de->next) {
1560 if (proc_match(len, table->procname, de))
1561 break;
1562 }
1563 /* If the subdir exists already, de is non-NULL */
1564 }
1565
1566 if (!de) {
1567 de = create_proc_entry(table->procname, mode, root);
1568 if (!de)
1569 continue;
1570 de->set = set;
1571 de->data = (void *) table;
1572 if (table->proc_handler)
1573 de->proc_fops = &proc_sys_file_operations;
1574 }
1575 table->de = de;
1576 if (de->mode & S_IFDIR)
1577 register_proc_table(table->child, de, set);
1578 }
1579}
1580
1581/*
1582 * Unregister a /proc sysctl table and any subdirectories.
1583 */
1584static void unregister_proc_table(ctl_table * table, struct proc_dir_entry *root)
1585{
1586 struct proc_dir_entry *de;
1587 for (; table->ctl_name || table->procname; table++) {
1588 if (!(de = table->de))
1589 continue;
1590 if (de->mode & S_IFDIR) {
1591 if (!table->child) {
1592 printk (KERN_ALERT "Help - malformed sysctl tree on free\n");
1593 continue;
1594 }
1595 unregister_proc_table(table->child, de);
1596
1597 /* Don't unregister directories which still have entries.. */
1598 if (de->subdir)
1599 continue;
1600 }
1601
1602 /*
1603 * In any case, mark the entry as goner; we'll keep it
1604 * around if it's busy, but we'll know to do nothing with
1605 * its fields. We are under sysctl_lock here.
1606 */
1607 de->data = NULL;
1608
1609 /* Don't unregister proc entries that are still being used.. */
1610 if (atomic_read(&de->count))
1611 continue;
1612
1613 table->de = NULL;
1614 remove_proc_entry(table->procname, root);
1615 }
1616}
1617
1618static ssize_t do_rw_proc(int write, struct file * file, char __user * buf,
1619 size_t count, loff_t *ppos)
1620{
1621 int op;
1622 struct proc_dir_entry *de = PDE(file->f_path.dentry->d_inode);
1623 struct ctl_table *table;
1624 size_t res;
1625 ssize_t error = -ENOTDIR;
1626
1627 spin_lock(&sysctl_lock);
1628 if (de && de->data && use_table(de->set)) {
1629 /*
1630 * at that point we know that sysctl was not unregistered
1631 * and won't be until we finish
1632 */
1633 spin_unlock(&sysctl_lock);
1634 table = (struct ctl_table *) de->data;
1635 if (!table || !table->proc_handler)
1636 goto out;
1637 error = -EPERM;
1638 op = (write ? 002 : 004);
1639 if (ctl_perm(table, op))
1640 goto out;
1641
1642 /* careful: calling conventions are nasty here */
1643 res = count;
1644 error = (*table->proc_handler)(table, write, file,
1645 buf, &res, ppos);
1646 if (!error)
1647 error = res;
1648 out:
1649 spin_lock(&sysctl_lock);
1650 unuse_table(de->set);
1651 }
1652 spin_unlock(&sysctl_lock);
1653 return error;
1654}
1655
1656static int proc_opensys(struct inode *inode, struct file *file)
1657{
1658 if (file->f_mode & FMODE_WRITE) {
1659 /*
1660 * sysctl entries that are not writable,
1661 * are _NOT_ writable, capabilities or not.
1662 */
1663 if (!(inode->i_mode & S_IWUSR))
1664 return -EPERM;
1665 }
1666
1667 return 0;
1668}
1669
1670static ssize_t proc_readsys(struct file * file, char __user * buf,
1671 size_t count, loff_t *ppos)
1672{
1673 return do_rw_proc(0, file, buf, count, ppos);
1674}
1675
1676static ssize_t proc_writesys(struct file * file, const char __user * buf,
1677 size_t count, loff_t *ppos)
1678{
1679 return do_rw_proc(1, file, (char __user *) buf, count, ppos);
1680}
1681
1682static int _proc_do_string(void* data, int maxlen, int write, 1380static int _proc_do_string(void* data, int maxlen, int write,
1683 struct file *filp, void __user *buffer, 1381 struct file *filp, void __user *buffer,
1684 size_t *lenp, loff_t *ppos) 1382 size_t *lenp, loff_t *ppos)
@@ -1762,21 +1460,6 @@ int proc_dostring(ctl_table *table, int write, struct file *filp,
1762 buffer, lenp, ppos); 1460 buffer, lenp, ppos);
1763} 1461}
1764 1462
1765/*
1766 * Special case of dostring for the UTS structure. This has locks
1767 * to observe. Should this be in kernel/sys.c ????
1768 */
1769
1770static int proc_do_uts_string(ctl_table *table, int write, struct file *filp,
1771 void __user *buffer, size_t *lenp, loff_t *ppos)
1772{
1773 int r;
1774 void *which;
1775 which = get_uts(table, write);
1776 r = _proc_do_string(which, table->maxlen,write,filp,buffer,lenp, ppos);
1777 put_uts(table, write, which);
1778 return r;
1779}
1780 1463
1781static int do_proc_dointvec_conv(int *negp, unsigned long *lvalp, 1464static int do_proc_dointvec_conv(int *negp, unsigned long *lvalp,
1782 int *valp, 1465 int *valp,
@@ -2362,27 +2045,6 @@ int proc_dointvec_ms_jiffies(ctl_table *table, int write, struct file *filp,
2362 do_proc_dointvec_ms_jiffies_conv, NULL); 2045 do_proc_dointvec_ms_jiffies_conv, NULL);
2363} 2046}
2364 2047
2365#ifdef CONFIG_SYSVIPC
2366static int proc_ipc_dointvec(ctl_table *table, int write, struct file *filp,
2367 void __user *buffer, size_t *lenp, loff_t *ppos)
2368{
2369 void *which;
2370 which = get_ipc(table, write);
2371 return __do_proc_dointvec(which, table, write, filp, buffer,
2372 lenp, ppos, NULL, NULL);
2373}
2374
2375static int proc_ipc_doulongvec_minmax(ctl_table *table, int write,
2376 struct file *filp, void __user *buffer, size_t *lenp, loff_t *ppos)
2377{
2378 void *which;
2379 which = get_ipc(table, write);
2380 return __do_proc_doulongvec_minmax(which, table, write, filp, buffer,
2381 lenp, ppos, 1l, 1l);
2382}
2383
2384#endif
2385
2386static int proc_do_cad_pid(ctl_table *table, int write, struct file *filp, 2048static int proc_do_cad_pid(ctl_table *table, int write, struct file *filp,
2387 void __user *buffer, size_t *lenp, loff_t *ppos) 2049 void __user *buffer, size_t *lenp, loff_t *ppos)
2388{ 2050{
@@ -2413,31 +2075,6 @@ int proc_dostring(ctl_table *table, int write, struct file *filp,
2413 return -ENOSYS; 2075 return -ENOSYS;
2414} 2076}
2415 2077
2416static int proc_do_uts_string(ctl_table *table, int write, struct file *filp,
2417 void __user *buffer, size_t *lenp, loff_t *ppos)
2418{
2419 return -ENOSYS;
2420}
2421
2422#ifdef CONFIG_SYSVIPC
2423static int proc_do_ipc_string(ctl_table *table, int write, struct file *filp,
2424 void __user *buffer, size_t *lenp, loff_t *ppos)
2425{
2426 return -ENOSYS;
2427}
2428static int proc_ipc_dointvec(ctl_table *table, int write, struct file *filp,
2429 void __user *buffer, size_t *lenp, loff_t *ppos)
2430{
2431 return -ENOSYS;
2432}
2433static int proc_ipc_doulongvec_minmax(ctl_table *table, int write,
2434 struct file *filp, void __user *buffer,
2435 size_t *lenp, loff_t *ppos)
2436{
2437 return -ENOSYS;
2438}
2439#endif
2440
2441int proc_dointvec(ctl_table *table, int write, struct file *filp, 2078int proc_dointvec(ctl_table *table, int write, struct file *filp,
2442 void __user *buffer, size_t *lenp, loff_t *ppos) 2079 void __user *buffer, size_t *lenp, loff_t *ppos)
2443{ 2080{
@@ -2648,62 +2285,6 @@ int sysctl_ms_jiffies(ctl_table *table, int __user *name, int nlen,
2648} 2285}
2649 2286
2650 2287
2651/* The generic string strategy routine: */
2652static int sysctl_uts_string(ctl_table *table, int __user *name, int nlen,
2653 void __user *oldval, size_t __user *oldlenp,
2654 void __user *newval, size_t newlen)
2655{
2656 struct ctl_table uts_table;
2657 int r, write;
2658 write = newval && newlen;
2659 memcpy(&uts_table, table, sizeof(uts_table));
2660 uts_table.data = get_uts(table, write);
2661 r = sysctl_string(&uts_table, name, nlen,
2662 oldval, oldlenp, newval, newlen);
2663 put_uts(table, write, uts_table.data);
2664 return r;
2665}
2666
2667#ifdef CONFIG_SYSVIPC
2668/* The generic sysctl ipc data routine. */
2669static int sysctl_ipc_data(ctl_table *table, int __user *name, int nlen,
2670 void __user *oldval, size_t __user *oldlenp,
2671 void __user *newval, size_t newlen)
2672{
2673 size_t len;
2674 void *data;
2675
2676 /* Get out of I don't have a variable */
2677 if (!table->data || !table->maxlen)
2678 return -ENOTDIR;
2679
2680 data = get_ipc(table, 1);
2681 if (!data)
2682 return -ENOTDIR;
2683
2684 if (oldval && oldlenp) {
2685 if (get_user(len, oldlenp))
2686 return -EFAULT;
2687 if (len) {
2688 if (len > table->maxlen)
2689 len = table->maxlen;
2690 if (copy_to_user(oldval, data, len))
2691 return -EFAULT;
2692 if (put_user(len, oldlenp))
2693 return -EFAULT;
2694 }
2695 }
2696
2697 if (newval && newlen) {
2698 if (newlen > table->maxlen)
2699 newlen = table->maxlen;
2700
2701 if (copy_from_user(data, newval, newlen))
2702 return -EFAULT;
2703 }
2704 return 1;
2705}
2706#endif
2707 2288
2708#else /* CONFIG_SYSCTL_SYSCALL */ 2289#else /* CONFIG_SYSCTL_SYSCALL */
2709 2290
@@ -2769,20 +2350,6 @@ int sysctl_ms_jiffies(ctl_table *table, int __user *name, int nlen,
2769 return -ENOSYS; 2350 return -ENOSYS;
2770} 2351}
2771 2352
2772static int sysctl_uts_string(ctl_table *table, int __user *name, int nlen,
2773 void __user *oldval, size_t __user *oldlenp,
2774 void __user *newval, size_t newlen)
2775{
2776 return -ENOSYS;
2777}
2778#ifdef CONFIG_SYSVIPC
2779static int sysctl_ipc_data(ctl_table *table, int __user *name, int nlen,
2780 void __user *oldval, size_t __user *oldlenp,
2781 void __user *newval, size_t newlen)
2782{
2783 return -ENOSYS;
2784}
2785#endif
2786#endif /* CONFIG_SYSCTL_SYSCALL */ 2353#endif /* CONFIG_SYSCTL_SYSCALL */
2787 2354
2788/* 2355/*
diff --git a/kernel/timer.c b/kernel/timer.c
index 8533c3796082..4902181e10e6 100644
--- a/kernel/timer.c
+++ b/kernel/timer.c
@@ -1162,11 +1162,9 @@ static inline void calc_load(unsigned long ticks)
1162 * This read-write spinlock protects us from races in SMP while 1162 * This read-write spinlock protects us from races in SMP while
1163 * playing with xtime and avenrun. 1163 * playing with xtime and avenrun.
1164 */ 1164 */
1165#ifndef ARCH_HAVE_XTIME_LOCK 1165__attribute__((weak)) __cacheline_aligned_in_smp DEFINE_SEQLOCK(xtime_lock);
1166__cacheline_aligned_in_smp DEFINE_SEQLOCK(xtime_lock);
1167 1166
1168EXPORT_SYMBOL(xtime_lock); 1167EXPORT_SYMBOL(xtime_lock);
1169#endif
1170 1168
1171/* 1169/*
1172 * This function runs timers and the timer-tq in bottom half context. 1170 * This function runs timers and the timer-tq in bottom half context.
diff --git a/kernel/utsname_sysctl.c b/kernel/utsname_sysctl.c
new file mode 100644
index 000000000000..f22b9dbd2a9c
--- /dev/null
+++ b/kernel/utsname_sysctl.c
@@ -0,0 +1,146 @@
1/*
2 * Copyright (C) 2007
3 *
4 * Author: Eric Biederman <ebiederm@xmision.com>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation, version 2 of the
9 * License.
10 */
11
12#include <linux/module.h>
13#include <linux/uts.h>
14#include <linux/utsname.h>
15#include <linux/version.h>
16#include <linux/sysctl.h>
17
18static void *get_uts(ctl_table *table, int write)
19{
20 char *which = table->data;
21#ifdef CONFIG_UTS_NS
22 struct uts_namespace *uts_ns = current->nsproxy->uts_ns;
23 which = (which - (char *)&init_uts_ns) + (char *)uts_ns;
24#endif
25 if (!write)
26 down_read(&uts_sem);
27 else
28 down_write(&uts_sem);
29 return which;
30}
31
32static void put_uts(ctl_table *table, int write, void *which)
33{
34 if (!write)
35 up_read(&uts_sem);
36 else
37 up_write(&uts_sem);
38}
39
40#ifdef CONFIG_PROC_FS
41/*
42 * Special case of dostring for the UTS structure. This has locks
43 * to observe. Should this be in kernel/sys.c ????
44 */
45static int proc_do_uts_string(ctl_table *table, int write, struct file *filp,
46 void __user *buffer, size_t *lenp, loff_t *ppos)
47{
48 struct ctl_table uts_table;
49 int r;
50 memcpy(&uts_table, table, sizeof(uts_table));
51 uts_table.data = get_uts(table, write);
52 r = proc_dostring(&uts_table,write,filp,buffer,lenp, ppos);
53 put_uts(table, write, uts_table.data);
54 return r;
55}
56#else
57#define proc_do_uts_string NULL
58#endif
59
60
61#ifdef CONFIG_SYSCTL_SYSCALL
62/* The generic string strategy routine: */
63static int sysctl_uts_string(ctl_table *table, int __user *name, int nlen,
64 void __user *oldval, size_t __user *oldlenp,
65 void __user *newval, size_t newlen)
66{
67 struct ctl_table uts_table;
68 int r, write;
69 write = newval && newlen;
70 memcpy(&uts_table, table, sizeof(uts_table));
71 uts_table.data = get_uts(table, write);
72 r = sysctl_string(&uts_table, name, nlen,
73 oldval, oldlenp, newval, newlen);
74 put_uts(table, write, uts_table.data);
75 return r;
76}
77#else
78#define sysctl_uts_string NULL
79#endif
80
81static struct ctl_table uts_kern_table[] = {
82 {
83 .ctl_name = KERN_OSTYPE,
84 .procname = "ostype",
85 .data = init_uts_ns.name.sysname,
86 .maxlen = sizeof(init_uts_ns.name.sysname),
87 .mode = 0444,
88 .proc_handler = proc_do_uts_string,
89 .strategy = sysctl_uts_string,
90 },
91 {
92 .ctl_name = KERN_OSRELEASE,
93 .procname = "osrelease",
94 .data = init_uts_ns.name.release,
95 .maxlen = sizeof(init_uts_ns.name.release),
96 .mode = 0444,
97 .proc_handler = proc_do_uts_string,
98 .strategy = sysctl_uts_string,
99 },
100 {
101 .ctl_name = KERN_VERSION,
102 .procname = "version",
103 .data = init_uts_ns.name.version,
104 .maxlen = sizeof(init_uts_ns.name.version),
105 .mode = 0444,
106 .proc_handler = proc_do_uts_string,
107 .strategy = sysctl_uts_string,
108 },
109 {
110 .ctl_name = KERN_NODENAME,
111 .procname = "hostname",
112 .data = init_uts_ns.name.nodename,
113 .maxlen = sizeof(init_uts_ns.name.nodename),
114 .mode = 0644,
115 .proc_handler = proc_do_uts_string,
116 .strategy = sysctl_uts_string,
117 },
118 {
119 .ctl_name = KERN_DOMAINNAME,
120 .procname = "domainname",
121 .data = init_uts_ns.name.domainname,
122 .maxlen = sizeof(init_uts_ns.name.domainname),
123 .mode = 0644,
124 .proc_handler = proc_do_uts_string,
125 .strategy = sysctl_uts_string,
126 },
127 {}
128};
129
130static struct ctl_table uts_root_table[] = {
131 {
132 .ctl_name = CTL_KERN,
133 .procname = "kernel",
134 .mode = 0555,
135 .child = uts_kern_table,
136 },
137 {}
138};
139
140static int __init utsname_sysctl_init(void)
141{
142 register_sysctl_table(uts_root_table);
143 return 0;
144}
145
146__initcall(utsname_sysctl_init);
diff --git a/net/802/fc.c b/net/802/fc.c
index d64e6a502958..675d9ba8e591 100644
--- a/net/802/fc.c
+++ b/net/802/fc.c
@@ -14,7 +14,6 @@
14#include <asm/system.h> 14#include <asm/system.h>
15#include <linux/types.h> 15#include <linux/types.h>
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <linux/sched.h>
18#include <linux/string.h> 17#include <linux/string.h>
19#include <linux/mm.h> 18#include <linux/mm.h>
20#include <linux/socket.h> 19#include <linux/socket.h>
diff --git a/net/802/fddi.c b/net/802/fddi.c
index 0b98fe2fa2f6..ace6386384bc 100644
--- a/net/802/fddi.c
+++ b/net/802/fddi.c
@@ -30,7 +30,6 @@
30#include <asm/system.h> 30#include <asm/system.h>
31#include <linux/types.h> 31#include <linux/types.h>
32#include <linux/kernel.h> 32#include <linux/kernel.h>
33#include <linux/sched.h>
34#include <linux/string.h> 33#include <linux/string.h>
35#include <linux/mm.h> 34#include <linux/mm.h>
36#include <linux/socket.h> 35#include <linux/socket.h>
diff --git a/net/802/hippi.c b/net/802/hippi.c
index be0da59323b3..578f2a3d692d 100644
--- a/net/802/hippi.c
+++ b/net/802/hippi.c
@@ -23,7 +23,6 @@
23#include <linux/module.h> 23#include <linux/module.h>
24#include <linux/types.h> 24#include <linux/types.h>
25#include <linux/kernel.h> 25#include <linux/kernel.h>
26#include <linux/sched.h>
27#include <linux/string.h> 26#include <linux/string.h>
28#include <linux/mm.h> 27#include <linux/mm.h>
29#include <linux/socket.h> 28#include <linux/socket.h>
diff --git a/net/appletalk/sysctl_net_atalk.c b/net/appletalk/sysctl_net_atalk.c
index 40b0af7437a2..7df1778e221a 100644
--- a/net/appletalk/sysctl_net_atalk.c
+++ b/net/appletalk/sysctl_net_atalk.c
@@ -73,7 +73,7 @@ static struct ctl_table_header *atalk_table_header;
73 73
74void atalk_register_sysctl(void) 74void atalk_register_sysctl(void)
75{ 75{
76 atalk_table_header = register_sysctl_table(atalk_root_table, 1); 76 atalk_table_header = register_sysctl_table(atalk_root_table);
77} 77}
78 78
79void atalk_unregister_sysctl(void) 79void atalk_unregister_sysctl(void)
diff --git a/net/atm/addr.c b/net/atm/addr.c
index 3060fd0ba4b9..6afa77d63bb5 100644
--- a/net/atm/addr.c
+++ b/net/atm/addr.c
@@ -4,7 +4,6 @@
4 4
5#include <linux/atm.h> 5#include <linux/atm.h>
6#include <linux/atmdev.h> 6#include <linux/atmdev.h>
7#include <linux/sched.h>
8#include <asm/uaccess.h> 7#include <asm/uaccess.h>
9 8
10#include "signaling.h" 9#include "signaling.h"
diff --git a/net/atm/lec.c b/net/atm/lec.c
index 986945527691..3d804d61f656 100644
--- a/net/atm/lec.c
+++ b/net/atm/lec.c
@@ -1437,7 +1437,6 @@ static void lane2_associate_ind(struct net_device *dev, u8 *mac_addr,
1437 */ 1437 */
1438 1438
1439#include <linux/types.h> 1439#include <linux/types.h>
1440#include <linux/sched.h>
1441#include <linux/timer.h> 1440#include <linux/timer.h>
1442#include <asm/param.h> 1441#include <asm/param.h>
1443#include <asm/atomic.h> 1442#include <asm/atomic.h>
diff --git a/net/atm/raw.c b/net/atm/raw.c
index 4df7cdd72aa1..1378f61c5c31 100644
--- a/net/atm/raw.c
+++ b/net/atm/raw.c
@@ -4,7 +4,6 @@
4 4
5 5
6#include <linux/module.h> 6#include <linux/module.h>
7#include <linux/sched.h>
8#include <linux/atmdev.h> 7#include <linux/atmdev.h>
9#include <linux/capability.h> 8#include <linux/capability.h>
10#include <linux/kernel.h> 9#include <linux/kernel.h>
diff --git a/net/ax25/ax25_addr.c b/net/ax25/ax25_addr.c
index 419e7188d5a7..7e7964dd987b 100644
--- a/net/ax25/ax25_addr.c
+++ b/net/ax25/ax25_addr.c
@@ -12,7 +12,6 @@
12#include <linux/in.h> 12#include <linux/in.h>
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/module.h> 14#include <linux/module.h>
15#include <linux/sched.h>
16#include <linux/timer.h> 15#include <linux/timer.h>
17#include <linux/string.h> 16#include <linux/string.h>
18#include <linux/sockios.h> 17#include <linux/sockios.h>
diff --git a/net/ax25/ax25_dev.c b/net/ax25/ax25_dev.c
index b787678220ff..528c874d9828 100644
--- a/net/ax25/ax25_dev.c
+++ b/net/ax25/ax25_dev.c
@@ -11,7 +11,6 @@
11#include <linux/socket.h> 11#include <linux/socket.h>
12#include <linux/in.h> 12#include <linux/in.h>
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/sched.h>
15#include <linux/timer.h> 14#include <linux/timer.h>
16#include <linux/string.h> 15#include <linux/string.h>
17#include <linux/sockios.h> 16#include <linux/sockios.h>
diff --git a/net/ax25/ax25_ds_in.c b/net/ax25/ax25_ds_in.c
index edcaa897027c..e37d217a986a 100644
--- a/net/ax25/ax25_ds_in.c
+++ b/net/ax25/ax25_ds_in.c
@@ -12,7 +12,6 @@
12#include <linux/socket.h> 12#include <linux/socket.h>
13#include <linux/in.h> 13#include <linux/in.h>
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/sched.h>
16#include <linux/timer.h> 15#include <linux/timer.h>
17#include <linux/string.h> 16#include <linux/string.h>
18#include <linux/sockios.h> 17#include <linux/sockios.h>
diff --git a/net/ax25/ax25_ds_subr.c b/net/ax25/ax25_ds_subr.c
index 4d22d4430ec8..9569dd3fa466 100644
--- a/net/ax25/ax25_ds_subr.c
+++ b/net/ax25/ax25_ds_subr.c
@@ -12,7 +12,6 @@
12#include <linux/socket.h> 12#include <linux/socket.h>
13#include <linux/in.h> 13#include <linux/in.h>
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/sched.h>
16#include <linux/timer.h> 15#include <linux/timer.h>
17#include <linux/string.h> 16#include <linux/string.h>
18#include <linux/sockios.h> 17#include <linux/sockios.h>
diff --git a/net/ax25/ax25_iface.c b/net/ax25/ax25_iface.c
index aff3e652c2d1..16be0c14780a 100644
--- a/net/ax25/ax25_iface.c
+++ b/net/ax25/ax25_iface.c
@@ -12,7 +12,6 @@
12#include <linux/in.h> 12#include <linux/in.h>
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/module.h> 14#include <linux/module.h>
15#include <linux/sched.h>
16#include <linux/spinlock.h> 15#include <linux/spinlock.h>
17#include <linux/timer.h> 16#include <linux/timer.h>
18#include <linux/string.h> 17#include <linux/string.h>
diff --git a/net/ax25/ax25_in.c b/net/ax25/ax25_in.c
index e9d94291581e..4a6b26becadc 100644
--- a/net/ax25/ax25_in.c
+++ b/net/ax25/ax25_in.c
@@ -14,7 +14,6 @@
14#include <linux/socket.h> 14#include <linux/socket.h>
15#include <linux/in.h> 15#include <linux/in.h>
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <linux/sched.h>
18#include <linux/timer.h> 17#include <linux/timer.h>
19#include <linux/string.h> 18#include <linux/string.h>
20#include <linux/sockios.h> 19#include <linux/sockios.h>
diff --git a/net/ax25/ax25_ip.c b/net/ax25/ax25_ip.c
index 8d62d8681615..7f818bbcd1c5 100644
--- a/net/ax25/ax25_ip.c
+++ b/net/ax25/ax25_ip.c
@@ -12,7 +12,6 @@
12#include <linux/in.h> 12#include <linux/in.h>
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/module.h> 14#include <linux/module.h>
15#include <linux/sched.h>
16#include <linux/timer.h> 15#include <linux/timer.h>
17#include <linux/string.h> 16#include <linux/string.h>
18#include <linux/sockios.h> 17#include <linux/sockios.h>
diff --git a/net/ax25/ax25_out.c b/net/ax25/ax25_out.c
index f84047d1e8ce..223835092b7a 100644
--- a/net/ax25/ax25_out.c
+++ b/net/ax25/ax25_out.c
@@ -14,7 +14,6 @@
14#include <linux/in.h> 14#include <linux/in.h>
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/module.h> 16#include <linux/module.h>
17#include <linux/sched.h>
18#include <linux/timer.h> 17#include <linux/timer.h>
19#include <linux/string.h> 18#include <linux/string.h>
20#include <linux/sockios.h> 19#include <linux/sockios.h>
diff --git a/net/ax25/ax25_std_in.c b/net/ax25/ax25_std_in.c
index f6ed283e9de8..a8eef88d8652 100644
--- a/net/ax25/ax25_std_in.c
+++ b/net/ax25/ax25_std_in.c
@@ -19,7 +19,6 @@
19#include <linux/socket.h> 19#include <linux/socket.h>
20#include <linux/in.h> 20#include <linux/in.h>
21#include <linux/kernel.h> 21#include <linux/kernel.h>
22#include <linux/sched.h>
23#include <linux/timer.h> 22#include <linux/timer.h>
24#include <linux/string.h> 23#include <linux/string.h>
25#include <linux/sockios.h> 24#include <linux/sockios.h>
diff --git a/net/ax25/ax25_std_subr.c b/net/ax25/ax25_std_subr.c
index 2b3c801ae486..277f81bb979a 100644
--- a/net/ax25/ax25_std_subr.c
+++ b/net/ax25/ax25_std_subr.c
@@ -11,7 +11,6 @@
11#include <linux/socket.h> 11#include <linux/socket.h>
12#include <linux/in.h> 12#include <linux/in.h>
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/sched.h>
15#include <linux/timer.h> 14#include <linux/timer.h>
16#include <linux/string.h> 15#include <linux/string.h>
17#include <linux/sockios.h> 16#include <linux/sockios.h>
diff --git a/net/ax25/ax25_std_timer.c b/net/ax25/ax25_std_timer.c
index e3528b1a7802..f2f6918ac9bb 100644
--- a/net/ax25/ax25_std_timer.c
+++ b/net/ax25/ax25_std_timer.c
@@ -14,7 +14,6 @@
14#include <linux/socket.h> 14#include <linux/socket.h>
15#include <linux/in.h> 15#include <linux/in.h>
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <linux/sched.h>
18#include <linux/timer.h> 17#include <linux/timer.h>
19#include <linux/string.h> 18#include <linux/string.h>
20#include <linux/sockios.h> 19#include <linux/sockios.h>
diff --git a/net/ax25/ax25_subr.c b/net/ax25/ax25_subr.c
index 85c58c49b4d0..b6c577e3c914 100644
--- a/net/ax25/ax25_subr.c
+++ b/net/ax25/ax25_subr.c
@@ -14,7 +14,6 @@
14#include <linux/socket.h> 14#include <linux/socket.h>
15#include <linux/in.h> 15#include <linux/in.h>
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <linux/sched.h>
18#include <linux/timer.h> 17#include <linux/timer.h>
19#include <linux/string.h> 18#include <linux/string.h>
20#include <linux/sockios.h> 19#include <linux/sockios.h>
diff --git a/net/ax25/ax25_uid.c b/net/ax25/ax25_uid.c
index 59a41b1e61f5..75c76647b2cb 100644
--- a/net/ax25/ax25_uid.c
+++ b/net/ax25/ax25_uid.c
@@ -13,7 +13,6 @@
13#include <linux/socket.h> 13#include <linux/socket.h>
14#include <linux/in.h> 14#include <linux/in.h>
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/sched.h>
17#include <linux/timer.h> 16#include <linux/timer.h>
18#include <linux/string.h> 17#include <linux/string.h>
19#include <linux/sockios.h> 18#include <linux/sockios.h>
diff --git a/net/ax25/sysctl_net_ax25.c b/net/ax25/sysctl_net_ax25.c
index d23a27f25d2f..443a83676638 100644
--- a/net/ax25/sysctl_net_ax25.c
+++ b/net/ax25/sysctl_net_ax25.c
@@ -245,7 +245,7 @@ void ax25_register_sysctl(void)
245 245
246 ax25_dir_table[0].child = ax25_table; 246 ax25_dir_table[0].child = ax25_table;
247 247
248 ax25_table_header = register_sysctl_table(ax25_root_table, 1); 248 ax25_table_header = register_sysctl_table(ax25_root_table);
249} 249}
250 250
251void ax25_unregister_sysctl(void) 251void ax25_unregister_sysctl(void)
diff --git a/net/bluetooth/bnep/sock.c b/net/bluetooth/bnep/sock.c
index 6d7311cee1b4..10292e776046 100644
--- a/net/bluetooth/bnep/sock.c
+++ b/net/bluetooth/bnep/sock.c
@@ -34,7 +34,6 @@
34#include <linux/capability.h> 34#include <linux/capability.h>
35#include <linux/errno.h> 35#include <linux/errno.h>
36#include <linux/kernel.h> 36#include <linux/kernel.h>
37#include <linux/sched.h>
38#include <linux/slab.h> 37#include <linux/slab.h>
39#include <linux/poll.h> 38#include <linux/poll.h>
40#include <linux/fcntl.h> 39#include <linux/fcntl.h>
diff --git a/net/bluetooth/cmtp/sock.c b/net/bluetooth/cmtp/sock.c
index 0c5ccd95517f..19be7861e51e 100644
--- a/net/bluetooth/cmtp/sock.c
+++ b/net/bluetooth/cmtp/sock.c
@@ -26,7 +26,6 @@
26#include <linux/capability.h> 26#include <linux/capability.h>
27#include <linux/errno.h> 27#include <linux/errno.h>
28#include <linux/kernel.h> 28#include <linux/kernel.h>
29#include <linux/sched.h>
30#include <linux/slab.h> 29#include <linux/slab.h>
31#include <linux/poll.h> 30#include <linux/poll.h>
32#include <linux/fcntl.h> 31#include <linux/fcntl.h>
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index 67ee0bd80f5f..f3403fdb59f8 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -29,7 +29,6 @@
29#include <linux/types.h> 29#include <linux/types.h>
30#include <linux/errno.h> 30#include <linux/errno.h>
31#include <linux/kernel.h> 31#include <linux/kernel.h>
32#include <linux/sched.h>
33#include <linux/slab.h> 32#include <linux/slab.h>
34#include <linux/poll.h> 33#include <linux/poll.h>
35#include <linux/fcntl.h> 34#include <linux/fcntl.h>
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 00d845e3d307..936d3fc479cd 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -29,7 +29,6 @@
29#include <linux/types.h> 29#include <linux/types.h>
30#include <linux/errno.h> 30#include <linux/errno.h>
31#include <linux/kernel.h> 31#include <linux/kernel.h>
32#include <linux/sched.h>
33#include <linux/slab.h> 32#include <linux/slab.h>
34#include <linux/poll.h> 33#include <linux/poll.h>
35#include <linux/fcntl.h> 34#include <linux/fcntl.h>
diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c
index dc3ecb19a5cd..f928d2b2a17d 100644
--- a/net/bluetooth/hci_sock.c
+++ b/net/bluetooth/hci_sock.c
@@ -30,7 +30,6 @@
30#include <linux/capability.h> 30#include <linux/capability.h>
31#include <linux/errno.h> 31#include <linux/errno.h>
32#include <linux/kernel.h> 32#include <linux/kernel.h>
33#include <linux/sched.h>
34#include <linux/slab.h> 33#include <linux/slab.h>
35#include <linux/poll.h> 34#include <linux/poll.h>
36#include <linux/fcntl.h> 35#include <linux/fcntl.h>
diff --git a/net/bluetooth/hidp/sock.c b/net/bluetooth/hidp/sock.c
index 33bda40aceb8..8b8a6c1dbd99 100644
--- a/net/bluetooth/hidp/sock.c
+++ b/net/bluetooth/hidp/sock.c
@@ -26,7 +26,6 @@
26#include <linux/capability.h> 26#include <linux/capability.h>
27#include <linux/errno.h> 27#include <linux/errno.h>
28#include <linux/kernel.h> 28#include <linux/kernel.h>
29#include <linux/sched.h>
30#include <linux/slab.h> 29#include <linux/slab.h>
31#include <linux/poll.h> 30#include <linux/poll.h>
32#include <linux/fcntl.h> 31#include <linux/fcntl.h>
diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c
index a0744e653f09..7712d76f06ba 100644
--- a/net/bridge/br_netfilter.c
+++ b/net/bridge/br_netfilter.c
@@ -957,7 +957,7 @@ int __init br_netfilter_init(void)
957 if (ret < 0) 957 if (ret < 0)
958 return ret; 958 return ret;
959#ifdef CONFIG_SYSCTL 959#ifdef CONFIG_SYSCTL
960 brnf_sysctl_header = register_sysctl_table(brnf_net_table, 0); 960 brnf_sysctl_header = register_sysctl_table(brnf_net_table);
961 if (brnf_sysctl_header == NULL) { 961 if (brnf_sysctl_header == NULL) {
962 printk(KERN_WARNING 962 printk(KERN_WARNING
963 "br_netfilter: can't register to sysctl.\n"); 963 "br_netfilter: can't register to sysctl.\n");
diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c
index 5818d70b8e8d..34c49799f9b3 100644
--- a/net/bridge/netfilter/ebtables.c
+++ b/net/bridge/netfilter/ebtables.c
@@ -16,7 +16,6 @@
16 */ 16 */
17 17
18/* used for print_string */ 18/* used for print_string */
19#include <linux/sched.h>
20#include <linux/tty.h> 19#include <linux/tty.h>
21 20
22#include <linux/kmod.h> 21#include <linux/kmod.h>
diff --git a/net/compat.c b/net/compat.c
index 9c970749a3b0..1f32866d09b7 100644
--- a/net/compat.c
+++ b/net/compat.c
@@ -13,7 +13,6 @@
13 13
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/fs.h> 15#include <linux/fs.h>
16#include <linux/sched.h>
17#include <linux/types.h> 16#include <linux/types.h>
18#include <linux/file.h> 17#include <linux/file.h>
19#include <linux/icmpv6.h> 18#include <linux/icmpv6.h>
diff --git a/net/core/dev_mcast.c b/net/core/dev_mcast.c
index c4e754e86e96..56b310c0c860 100644
--- a/net/core/dev_mcast.c
+++ b/net/core/dev_mcast.c
@@ -27,7 +27,6 @@
27#include <linux/bitops.h> 27#include <linux/bitops.h>
28#include <linux/types.h> 28#include <linux/types.h>
29#include <linux/kernel.h> 29#include <linux/kernel.h>
30#include <linux/sched.h>
31#include <linux/string.h> 30#include <linux/string.h>
32#include <linux/mm.h> 31#include <linux/mm.h>
33#include <linux/socket.h> 32#include <linux/socket.h>
diff --git a/net/core/dst.c b/net/core/dst.c
index 61dd9d3951f1..764bccb3d992 100644
--- a/net/core/dst.c
+++ b/net/core/dst.c
@@ -12,7 +12,6 @@
12#include <linux/mm.h> 12#include <linux/mm.h>
13#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/netdevice.h> 14#include <linux/netdevice.h>
15#include <linux/sched.h>
16#include <linux/skbuff.h> 15#include <linux/skbuff.h>
17#include <linux/string.h> 16#include <linux/string.h>
18#include <linux/types.h> 17#include <linux/types.h>
diff --git a/net/core/filter.c b/net/core/filter.c
index 8123a31d919d..8d185a089c53 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -18,7 +18,6 @@
18 18
19#include <linux/module.h> 19#include <linux/module.h>
20#include <linux/types.h> 20#include <linux/types.h>
21#include <linux/sched.h>
22#include <linux/mm.h> 21#include <linux/mm.h>
23#include <linux/fcntl.h> 22#include <linux/fcntl.h>
24#include <linux/socket.h> 23#include <linux/socket.h>
diff --git a/net/core/iovec.c b/net/core/iovec.c
index 4fb1cb9b79b9..755c37fdaee7 100644
--- a/net/core/iovec.c
+++ b/net/core/iovec.c
@@ -18,7 +18,6 @@
18 18
19#include <linux/errno.h> 19#include <linux/errno.h>
20#include <linux/module.h> 20#include <linux/module.h>
21#include <linux/sched.h>
22#include <linux/kernel.h> 21#include <linux/kernel.h>
23#include <linux/mm.h> 22#include <linux/mm.h>
24#include <linux/slab.h> 23#include <linux/slab.h>
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index 512eed91785d..3183142c6044 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -19,7 +19,6 @@
19#include <linux/kernel.h> 19#include <linux/kernel.h>
20#include <linux/module.h> 20#include <linux/module.h>
21#include <linux/socket.h> 21#include <linux/socket.h>
22#include <linux/sched.h>
23#include <linux/netdevice.h> 22#include <linux/netdevice.h>
24#include <linux/proc_fs.h> 23#include <linux/proc_fs.h>
25#ifdef CONFIG_SYSCTL 24#ifdef CONFIG_SYSCTL
@@ -2708,7 +2707,7 @@ int neigh_sysctl_register(struct net_device *dev, struct neigh_parms *p,
2708 t->neigh_proto_dir[0].child = t->neigh_neigh_dir; 2707 t->neigh_proto_dir[0].child = t->neigh_neigh_dir;
2709 t->neigh_root_dir[0].child = t->neigh_proto_dir; 2708 t->neigh_root_dir[0].child = t->neigh_proto_dir;
2710 2709
2711 t->sysctl_header = register_sysctl_table(t->neigh_root_dir, 0); 2710 t->sysctl_header = register_sysctl_table(t->neigh_root_dir);
2712 if (!t->sysctl_header) { 2711 if (!t->sysctl_header) {
2713 err = -ENOBUFS; 2712 err = -ENOBUFS;
2714 goto free_procname; 2713 goto free_procname;
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index ee5a787271f6..6055074c4b81 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -21,7 +21,6 @@
21#include <linux/types.h> 21#include <linux/types.h>
22#include <linux/socket.h> 22#include <linux/socket.h>
23#include <linux/kernel.h> 23#include <linux/kernel.h>
24#include <linux/sched.h>
25#include <linux/timer.h> 24#include <linux/timer.h>
26#include <linux/string.h> 25#include <linux/string.h>
27#include <linux/sockios.h> 26#include <linux/sockios.h>
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 3d5646869022..f89ff151cfab 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -41,7 +41,6 @@
41#include <linux/module.h> 41#include <linux/module.h>
42#include <linux/types.h> 42#include <linux/types.h>
43#include <linux/kernel.h> 43#include <linux/kernel.h>
44#include <linux/sched.h>
45#include <linux/mm.h> 44#include <linux/mm.h>
46#include <linux/interrupt.h> 45#include <linux/interrupt.h>
47#include <linux/in.h> 46#include <linux/in.h>
diff --git a/net/dccp/sysctl.c b/net/dccp/sysctl.c
index fdcfca3e9208..1260aabac5e1 100644
--- a/net/dccp/sysctl.c
+++ b/net/dccp/sysctl.c
@@ -127,7 +127,7 @@ static struct ctl_table_header *dccp_table_header;
127 127
128int __init dccp_sysctl_init(void) 128int __init dccp_sysctl_init(void)
129{ 129{
130 dccp_table_header = register_sysctl_table(dccp_root_table, 1); 130 dccp_table_header = register_sysctl_table(dccp_root_table);
131 131
132 return dccp_table_header != NULL ? 0 : -ENOMEM; 132 return dccp_table_header != NULL ? 0 : -ENOMEM;
133} 133}
diff --git a/net/decnet/dn_dev.c b/net/decnet/dn_dev.c
index 2b2c7fe45a71..060d725e2942 100644
--- a/net/decnet/dn_dev.c
+++ b/net/decnet/dn_dev.c
@@ -261,7 +261,6 @@ static void dn_dev_sysctl_register(struct net_device *dev, struct dn_dev_parms *
261 for(i = 0; i < ARRAY_SIZE(t->dn_dev_vars) - 1; i++) { 261 for(i = 0; i < ARRAY_SIZE(t->dn_dev_vars) - 1; i++) {
262 long offset = (long)t->dn_dev_vars[i].data; 262 long offset = (long)t->dn_dev_vars[i].data;
263 t->dn_dev_vars[i].data = ((char *)parms) + offset; 263 t->dn_dev_vars[i].data = ((char *)parms) + offset;
264 t->dn_dev_vars[i].de = NULL;
265 } 264 }
266 265
267 if (dev) { 266 if (dev) {
@@ -273,16 +272,12 @@ static void dn_dev_sysctl_register(struct net_device *dev, struct dn_dev_parms *
273 } 272 }
274 273
275 t->dn_dev_dev[0].child = t->dn_dev_vars; 274 t->dn_dev_dev[0].child = t->dn_dev_vars;
276 t->dn_dev_dev[0].de = NULL;
277 t->dn_dev_conf_dir[0].child = t->dn_dev_dev; 275 t->dn_dev_conf_dir[0].child = t->dn_dev_dev;
278 t->dn_dev_conf_dir[0].de = NULL;
279 t->dn_dev_proto_dir[0].child = t->dn_dev_conf_dir; 276 t->dn_dev_proto_dir[0].child = t->dn_dev_conf_dir;
280 t->dn_dev_proto_dir[0].de = NULL;
281 t->dn_dev_root_dir[0].child = t->dn_dev_proto_dir; 277 t->dn_dev_root_dir[0].child = t->dn_dev_proto_dir;
282 t->dn_dev_root_dir[0].de = NULL;
283 t->dn_dev_vars[0].extra1 = (void *)dev; 278 t->dn_dev_vars[0].extra1 = (void *)dev;
284 279
285 t->sysctl_header = register_sysctl_table(t->dn_dev_root_dir, 0); 280 t->sysctl_header = register_sysctl_table(t->dn_dev_root_dir);
286 if (t->sysctl_header == NULL) 281 if (t->sysctl_header == NULL)
287 kfree(t); 282 kfree(t);
288 else 283 else
diff --git a/net/decnet/dn_nsp_in.c b/net/decnet/dn_nsp_in.c
index 0f244e81a377..9d20904f6f52 100644
--- a/net/decnet/dn_nsp_in.c
+++ b/net/decnet/dn_nsp_in.c
@@ -50,7 +50,6 @@
50#include <linux/socket.h> 50#include <linux/socket.h>
51#include <linux/in.h> 51#include <linux/in.h>
52#include <linux/kernel.h> 52#include <linux/kernel.h>
53#include <linux/sched.h>
54#include <linux/timer.h> 53#include <linux/timer.h>
55#include <linux/string.h> 54#include <linux/string.h>
56#include <linux/sockios.h> 55#include <linux/sockios.h>
diff --git a/net/decnet/dn_nsp_out.c b/net/decnet/dn_nsp_out.c
index 23d5ca88dfa3..2d2cda82c7db 100644
--- a/net/decnet/dn_nsp_out.c
+++ b/net/decnet/dn_nsp_out.c
@@ -43,7 +43,6 @@
43#include <linux/socket.h> 43#include <linux/socket.h>
44#include <linux/in.h> 44#include <linux/in.h>
45#include <linux/kernel.h> 45#include <linux/kernel.h>
46#include <linux/sched.h>
47#include <linux/timer.h> 46#include <linux/timer.h>
48#include <linux/string.h> 47#include <linux/string.h>
49#include <linux/sockios.h> 48#include <linux/sockios.h>
diff --git a/net/decnet/sysctl_net_decnet.c b/net/decnet/sysctl_net_decnet.c
index a6c067b593ab..52e40d7eb22d 100644
--- a/net/decnet/sysctl_net_decnet.c
+++ b/net/decnet/sysctl_net_decnet.c
@@ -491,7 +491,7 @@ static ctl_table dn_root_table[] = {
491 491
492void dn_register_sysctl(void) 492void dn_register_sysctl(void)
493{ 493{
494 dn_table_header = register_sysctl_table(dn_root_table, 1); 494 dn_table_header = register_sysctl_table(dn_root_table);
495} 495}
496 496
497void dn_unregister_sysctl(void) 497void dn_unregister_sysctl(void)
diff --git a/net/econet/af_econet.c b/net/econet/af_econet.c
index f2ce41434290..bc12e36263f0 100644
--- a/net/econet/af_econet.c
+++ b/net/econet/af_econet.c
@@ -13,7 +13,6 @@
13 13
14#include <linux/types.h> 14#include <linux/types.h>
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/sched.h>
17#include <linux/string.h> 16#include <linux/string.h>
18#include <linux/mm.h> 17#include <linux/mm.h>
19#include <linux/socket.h> 18#include <linux/socket.h>
diff --git a/net/ethernet/eth.c b/net/ethernet/eth.c
index 766a0b59c0d3..7391f55904d1 100644
--- a/net/ethernet/eth.c
+++ b/net/ethernet/eth.c
@@ -40,7 +40,6 @@
40#include <linux/module.h> 40#include <linux/module.h>
41#include <linux/types.h> 41#include <linux/types.h>
42#include <linux/kernel.h> 42#include <linux/kernel.h>
43#include <linux/sched.h>
44#include <linux/string.h> 43#include <linux/string.h>
45#include <linux/mm.h> 44#include <linux/mm.h>
46#include <linux/socket.h> 45#include <linux/socket.h>
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
index 0ffd2d2920c3..1a3488a83f49 100644
--- a/net/ipv4/arp.c
+++ b/net/ipv4/arp.c
@@ -78,7 +78,6 @@
78#include <linux/types.h> 78#include <linux/types.h>
79#include <linux/string.h> 79#include <linux/string.h>
80#include <linux/kernel.h> 80#include <linux/kernel.h>
81#include <linux/sched.h>
82#include <linux/capability.h> 81#include <linux/capability.h>
83#include <linux/socket.h> 82#include <linux/socket.h>
84#include <linux/sockios.h> 83#include <linux/sockios.h>
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index ba5e7f4cd127..8a0ec10a13a7 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -35,7 +35,6 @@
35#include <linux/module.h> 35#include <linux/module.h>
36#include <linux/types.h> 36#include <linux/types.h>
37#include <linux/kernel.h> 37#include <linux/kernel.h>
38#include <linux/sched.h>
39#include <linux/string.h> 38#include <linux/string.h>
40#include <linux/mm.h> 39#include <linux/mm.h>
41#include <linux/socket.h> 40#include <linux/socket.h>
@@ -1577,7 +1576,6 @@ static void devinet_sysctl_register(struct in_device *in_dev,
1577 return; 1576 return;
1578 for (i = 0; i < ARRAY_SIZE(t->devinet_vars) - 1; i++) { 1577 for (i = 0; i < ARRAY_SIZE(t->devinet_vars) - 1; i++) {
1579 t->devinet_vars[i].data += (char *)p - (char *)&ipv4_devconf; 1578 t->devinet_vars[i].data += (char *)p - (char *)&ipv4_devconf;
1580 t->devinet_vars[i].de = NULL;
1581 } 1579 }
1582 1580
1583 if (dev) { 1581 if (dev) {
@@ -1599,15 +1597,11 @@ static void devinet_sysctl_register(struct in_device *in_dev,
1599 1597
1600 t->devinet_dev[0].procname = dev_name; 1598 t->devinet_dev[0].procname = dev_name;
1601 t->devinet_dev[0].child = t->devinet_vars; 1599 t->devinet_dev[0].child = t->devinet_vars;
1602 t->devinet_dev[0].de = NULL;
1603 t->devinet_conf_dir[0].child = t->devinet_dev; 1600 t->devinet_conf_dir[0].child = t->devinet_dev;
1604 t->devinet_conf_dir[0].de = NULL;
1605 t->devinet_proto_dir[0].child = t->devinet_conf_dir; 1601 t->devinet_proto_dir[0].child = t->devinet_conf_dir;
1606 t->devinet_proto_dir[0].de = NULL;
1607 t->devinet_root_dir[0].child = t->devinet_proto_dir; 1602 t->devinet_root_dir[0].child = t->devinet_proto_dir;
1608 t->devinet_root_dir[0].de = NULL;
1609 1603
1610 t->sysctl_header = register_sysctl_table(t->devinet_root_dir, 0); 1604 t->sysctl_header = register_sysctl_table(t->devinet_root_dir);
1611 if (!t->sysctl_header) 1605 if (!t->sysctl_header)
1612 goto free_procname; 1606 goto free_procname;
1613 1607
@@ -1641,7 +1635,7 @@ void __init devinet_init(void)
1641 rtnetlink_links[PF_INET] = inet_rtnetlink_table; 1635 rtnetlink_links[PF_INET] = inet_rtnetlink_table;
1642#ifdef CONFIG_SYSCTL 1636#ifdef CONFIG_SYSCTL
1643 devinet_sysctl.sysctl_header = 1637 devinet_sysctl.sysctl_header =
1644 register_sysctl_table(devinet_sysctl.devinet_root_dir, 0); 1638 register_sysctl_table(devinet_sysctl.devinet_root_dir);
1645 devinet_sysctl_register(NULL, &ipv4_devconf_dflt); 1639 devinet_sysctl_register(NULL, &ipv4_devconf_dflt);
1646#endif 1640#endif
1647} 1641}
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index 64f31e63db7f..1fba6439fc57 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -22,7 +22,6 @@
22#include <linux/capability.h> 22#include <linux/capability.h>
23#include <linux/types.h> 23#include <linux/types.h>
24#include <linux/kernel.h> 24#include <linux/kernel.h>
25#include <linux/sched.h>
26#include <linux/mm.h> 25#include <linux/mm.h>
27#include <linux/string.h> 26#include <linux/string.h>
28#include <linux/socket.h> 27#include <linux/socket.h>
diff --git a/net/ipv4/fib_hash.c b/net/ipv4/fib_hash.c
index b21bb28d1fd0..a4949f957ab5 100644
--- a/net/ipv4/fib_hash.c
+++ b/net/ipv4/fib_hash.c
@@ -20,7 +20,6 @@
20#include <linux/bitops.h> 20#include <linux/bitops.h>
21#include <linux/types.h> 21#include <linux/types.h>
22#include <linux/kernel.h> 22#include <linux/kernel.h>
23#include <linux/sched.h>
24#include <linux/mm.h> 23#include <linux/mm.h>
25#include <linux/string.h> 24#include <linux/string.h>
26#include <linux/socket.h> 25#include <linux/socket.h>
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
index c33dca073801..72b3036bbc09 100644
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
@@ -57,7 +57,6 @@
57#include <asm/bitops.h> 57#include <asm/bitops.h>
58#include <linux/types.h> 58#include <linux/types.h>
59#include <linux/kernel.h> 59#include <linux/kernel.h>
60#include <linux/sched.h>
61#include <linux/mm.h> 60#include <linux/mm.h>
62#include <linux/string.h> 61#include <linux/string.h>
63#include <linux/socket.h> 62#include <linux/socket.h>
diff --git a/net/ipv4/inetpeer.c b/net/ipv4/inetpeer.c
index 711eb6d0285a..db3ef96bdfd9 100644
--- a/net/ipv4/inetpeer.c
+++ b/net/ipv4/inetpeer.c
@@ -14,7 +14,6 @@
14#include <linux/interrupt.h> 14#include <linux/interrupt.h>
15#include <linux/spinlock.h> 15#include <linux/spinlock.h>
16#include <linux/random.h> 16#include <linux/random.h>
17#include <linux/sched.h>
18#include <linux/timer.h> 17#include <linux/timer.h>
19#include <linux/time.h> 18#include <linux/time.h>
20#include <linux/kernel.h> 19#include <linux/kernel.h>
diff --git a/net/ipv4/ip_forward.c b/net/ipv4/ip_forward.c
index c3ea0cd2e584..369e721c4bab 100644
--- a/net/ipv4/ip_forward.c
+++ b/net/ipv4/ip_forward.c
@@ -23,7 +23,6 @@
23 23
24#include <linux/types.h> 24#include <linux/types.h>
25#include <linux/mm.h> 25#include <linux/mm.h>
26#include <linux/sched.h>
27#include <linux/skbuff.h> 26#include <linux/skbuff.h>
28#include <linux/ip.h> 27#include <linux/ip.h>
29#include <linux/icmp.h> 28#include <linux/icmp.h>
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index f12c0d6623a0..9151da642318 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -13,7 +13,6 @@
13#include <linux/capability.h> 13#include <linux/capability.h>
14#include <linux/module.h> 14#include <linux/module.h>
15#include <linux/types.h> 15#include <linux/types.h>
16#include <linux/sched.h>
17#include <linux/kernel.h> 16#include <linux/kernel.h>
18#include <asm/uaccess.h> 17#include <asm/uaccess.h>
19#include <linux/skbuff.h> 18#include <linux/skbuff.h>
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index bb0bb8f07c54..d096332f6c6d 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -49,7 +49,6 @@
49#include <linux/module.h> 49#include <linux/module.h>
50#include <linux/types.h> 50#include <linux/types.h>
51#include <linux/kernel.h> 51#include <linux/kernel.h>
52#include <linux/sched.h>
53#include <linux/mm.h> 52#include <linux/mm.h>
54#include <linux/string.h> 53#include <linux/string.h>
55#include <linux/errno.h> 54#include <linux/errno.h>
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c
index e120686c3cb8..23048d9f3584 100644
--- a/net/ipv4/ip_sockglue.c
+++ b/net/ipv4/ip_sockglue.c
@@ -20,7 +20,6 @@
20#include <linux/module.h> 20#include <linux/module.h>
21#include <linux/types.h> 21#include <linux/types.h>
22#include <linux/mm.h> 22#include <linux/mm.h>
23#include <linux/sched.h>
24#include <linux/skbuff.h> 23#include <linux/skbuff.h>
25#include <linux/ip.h> 24#include <linux/ip.h>
26#include <linux/icmp.h> 25#include <linux/icmp.h>
diff --git a/net/ipv4/ipip.c b/net/ipv4/ipip.c
index 9b561e633b00..3ec5ce0f5498 100644
--- a/net/ipv4/ipip.c
+++ b/net/ipv4/ipip.c
@@ -96,7 +96,6 @@
96#include <linux/capability.h> 96#include <linux/capability.h>
97#include <linux/module.h> 97#include <linux/module.h>
98#include <linux/types.h> 98#include <linux/types.h>
99#include <linux/sched.h>
100#include <linux/kernel.h> 99#include <linux/kernel.h>
101#include <asm/uaccess.h> 100#include <asm/uaccess.h>
102#include <linux/skbuff.h> 101#include <linux/skbuff.h>
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index e6d11abd7841..601e3df69258 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -31,7 +31,6 @@
31#include <asm/system.h> 31#include <asm/system.h>
32#include <asm/uaccess.h> 32#include <asm/uaccess.h>
33#include <linux/types.h> 33#include <linux/types.h>
34#include <linux/sched.h>
35#include <linux/capability.h> 34#include <linux/capability.h>
36#include <linux/errno.h> 35#include <linux/errno.h>
37#include <linux/timer.h> 36#include <linux/timer.h>
diff --git a/net/ipv4/ipvs/ip_vs_ctl.c b/net/ipv4/ipvs/ip_vs_ctl.c
index 8b08d9cdcbc8..b3050a6817e7 100644
--- a/net/ipv4/ipvs/ip_vs_ctl.c
+++ b/net/ipv4/ipvs/ip_vs_ctl.c
@@ -2359,7 +2359,7 @@ int ip_vs_control_init(void)
2359 proc_net_fops_create("ip_vs", 0, &ip_vs_info_fops); 2359 proc_net_fops_create("ip_vs", 0, &ip_vs_info_fops);
2360 proc_net_fops_create("ip_vs_stats",0, &ip_vs_stats_fops); 2360 proc_net_fops_create("ip_vs_stats",0, &ip_vs_stats_fops);
2361 2361
2362 sysctl_header = register_sysctl_table(vs_root_table, 0); 2362 sysctl_header = register_sysctl_table(vs_root_table);
2363 2363
2364 /* Initialize ip_vs_svc_table, ip_vs_svc_fwm_table, ip_vs_rtable */ 2364 /* Initialize ip_vs_svc_table, ip_vs_svc_fwm_table, ip_vs_rtable */
2365 for(idx = 0; idx < IP_VS_SVC_TAB_SIZE; idx++) { 2365 for(idx = 0; idx < IP_VS_SVC_TAB_SIZE; idx++) {
diff --git a/net/ipv4/ipvs/ip_vs_lblc.c b/net/ipv4/ipvs/ip_vs_lblc.c
index 76fd1fb91878..c801273cb881 100644
--- a/net/ipv4/ipvs/ip_vs_lblc.c
+++ b/net/ipv4/ipvs/ip_vs_lblc.c
@@ -583,7 +583,7 @@ static struct ip_vs_scheduler ip_vs_lblc_scheduler =
583static int __init ip_vs_lblc_init(void) 583static int __init ip_vs_lblc_init(void)
584{ 584{
585 INIT_LIST_HEAD(&ip_vs_lblc_scheduler.n_list); 585 INIT_LIST_HEAD(&ip_vs_lblc_scheduler.n_list);
586 sysctl_header = register_sysctl_table(lblc_root_table, 0); 586 sysctl_header = register_sysctl_table(lblc_root_table);
587 return register_ip_vs_scheduler(&ip_vs_lblc_scheduler); 587 return register_ip_vs_scheduler(&ip_vs_lblc_scheduler);
588} 588}
589 589
diff --git a/net/ipv4/ipvs/ip_vs_lblcr.c b/net/ipv4/ipvs/ip_vs_lblcr.c
index bf1e7f272b84..23f9b9e73c85 100644
--- a/net/ipv4/ipvs/ip_vs_lblcr.c
+++ b/net/ipv4/ipvs/ip_vs_lblcr.c
@@ -841,7 +841,7 @@ static struct ip_vs_scheduler ip_vs_lblcr_scheduler =
841static int __init ip_vs_lblcr_init(void) 841static int __init ip_vs_lblcr_init(void)
842{ 842{
843 INIT_LIST_HEAD(&ip_vs_lblcr_scheduler.n_list); 843 INIT_LIST_HEAD(&ip_vs_lblcr_scheduler.n_list);
844 sysctl_header = register_sysctl_table(lblcr_root_table, 0); 844 sysctl_header = register_sysctl_table(lblcr_root_table);
845#ifdef CONFIG_IP_VS_LBLCR_DEBUG 845#ifdef CONFIG_IP_VS_LBLCR_DEBUG
846 proc_net_create("ip_vs_lblcr", 0, ip_vs_lblcr_getinfo); 846 proc_net_create("ip_vs_lblcr", 0, ip_vs_lblcr_getinfo);
847#endif 847#endif
diff --git a/net/ipv4/ipvs/ip_vs_sched.c b/net/ipv4/ipvs/ip_vs_sched.c
index 8bc42b76223d..1602304abbf9 100644
--- a/net/ipv4/ipvs/ip_vs_sched.c
+++ b/net/ipv4/ipvs/ip_vs_sched.c
@@ -20,7 +20,6 @@
20 */ 20 */
21 21
22#include <linux/module.h> 22#include <linux/module.h>
23#include <linux/sched.h>
24#include <linux/spinlock.h> 23#include <linux/spinlock.h>
25#include <linux/interrupt.h> 24#include <linux/interrupt.h>
26#include <asm/string.h> 25#include <asm/string.h>
diff --git a/net/ipv4/multipath_drr.c b/net/ipv4/multipath_drr.c
index cb8fce467349..574c735836fc 100644
--- a/net/ipv4/multipath_drr.c
+++ b/net/ipv4/multipath_drr.c
@@ -15,7 +15,6 @@
15#include <asm/system.h> 15#include <asm/system.h>
16#include <asm/uaccess.h> 16#include <asm/uaccess.h>
17#include <linux/types.h> 17#include <linux/types.h>
18#include <linux/sched.h>
19#include <linux/errno.h> 18#include <linux/errno.h>
20#include <linux/timer.h> 19#include <linux/timer.h>
21#include <linux/mm.h> 20#include <linux/mm.h>
diff --git a/net/ipv4/multipath_random.c b/net/ipv4/multipath_random.c
index 047e861f06bd..57f481498fbb 100644
--- a/net/ipv4/multipath_random.c
+++ b/net/ipv4/multipath_random.c
@@ -15,7 +15,6 @@
15#include <asm/system.h> 15#include <asm/system.h>
16#include <asm/uaccess.h> 16#include <asm/uaccess.h>
17#include <linux/types.h> 17#include <linux/types.h>
18#include <linux/sched.h>
19#include <linux/errno.h> 18#include <linux/errno.h>
20#include <linux/timer.h> 19#include <linux/timer.h>
21#include <linux/mm.h> 20#include <linux/mm.h>
diff --git a/net/ipv4/multipath_rr.c b/net/ipv4/multipath_rr.c
index 896246d8040e..0ad22524f450 100644
--- a/net/ipv4/multipath_rr.c
+++ b/net/ipv4/multipath_rr.c
@@ -15,7 +15,6 @@
15#include <asm/system.h> 15#include <asm/system.h>
16#include <asm/uaccess.h> 16#include <asm/uaccess.h>
17#include <linux/types.h> 17#include <linux/types.h>
18#include <linux/sched.h>
19#include <linux/errno.h> 18#include <linux/errno.h>
20#include <linux/timer.h> 19#include <linux/timer.h>
21#include <linux/mm.h> 20#include <linux/mm.h>
diff --git a/net/ipv4/multipath_wrandom.c b/net/ipv4/multipath_wrandom.c
index 7e22f15d13df..2bdbb92b450a 100644
--- a/net/ipv4/multipath_wrandom.c
+++ b/net/ipv4/multipath_wrandom.c
@@ -15,7 +15,6 @@
15#include <asm/system.h> 15#include <asm/system.h>
16#include <asm/uaccess.h> 16#include <asm/uaccess.h>
17#include <linux/types.h> 17#include <linux/types.h>
18#include <linux/sched.h>
19#include <linux/errno.h> 18#include <linux/errno.h>
20#include <linux/timer.h> 19#include <linux/timer.h>
21#include <linux/mm.h> 20#include <linux/mm.h>
diff --git a/net/ipv4/netfilter/ip_conntrack_proto_generic.c b/net/ipv4/netfilter/ip_conntrack_proto_generic.c
index 36f2b5e5d80a..88af82e98658 100644
--- a/net/ipv4/netfilter/ip_conntrack_proto_generic.c
+++ b/net/ipv4/netfilter/ip_conntrack_proto_generic.c
@@ -7,7 +7,6 @@
7 */ 7 */
8 8
9#include <linux/types.h> 9#include <linux/types.h>
10#include <linux/sched.h>
11#include <linux/timer.h> 10#include <linux/timer.h>
12#include <linux/netfilter.h> 11#include <linux/netfilter.h>
13#include <linux/netfilter_ipv4/ip_conntrack_protocol.h> 12#include <linux/netfilter_ipv4/ip_conntrack_protocol.h>
diff --git a/net/ipv4/netfilter/ip_conntrack_proto_icmp.c b/net/ipv4/netfilter/ip_conntrack_proto_icmp.c
index ec71abead00c..ad70c81a21e0 100644
--- a/net/ipv4/netfilter/ip_conntrack_proto_icmp.c
+++ b/net/ipv4/netfilter/ip_conntrack_proto_icmp.c
@@ -7,7 +7,6 @@
7 */ 7 */
8 8
9#include <linux/types.h> 9#include <linux/types.h>
10#include <linux/sched.h>
11#include <linux/timer.h> 10#include <linux/timer.h>
12#include <linux/netfilter.h> 11#include <linux/netfilter.h>
13#include <linux/in.h> 12#include <linux/in.h>
diff --git a/net/ipv4/netfilter/ip_conntrack_proto_sctp.c b/net/ipv4/netfilter/ip_conntrack_proto_sctp.c
index 9d5b917f49cd..e6942992b2f6 100644
--- a/net/ipv4/netfilter/ip_conntrack_proto_sctp.c
+++ b/net/ipv4/netfilter/ip_conntrack_proto_sctp.c
@@ -14,7 +14,6 @@
14 */ 14 */
15 15
16#include <linux/types.h> 16#include <linux/types.h>
17#include <linux/sched.h>
18#include <linux/timer.h> 17#include <linux/timer.h>
19#include <linux/interrupt.h> 18#include <linux/interrupt.h>
20#include <linux/netfilter.h> 19#include <linux/netfilter.h>
@@ -623,7 +622,7 @@ static int __init ip_conntrack_proto_sctp_init(void)
623 } 622 }
624 623
625#ifdef CONFIG_SYSCTL 624#ifdef CONFIG_SYSCTL
626 ip_ct_sysctl_header = register_sysctl_table(ip_ct_net_table, 0); 625 ip_ct_sysctl_header = register_sysctl_table(ip_ct_net_table);
627 if (ip_ct_sysctl_header == NULL) { 626 if (ip_ct_sysctl_header == NULL) {
628 ret = -ENOMEM; 627 ret = -ENOMEM;
629 printk("ip_conntrack_proto_sctp: can't register to sysctl.\n"); 628 printk("ip_conntrack_proto_sctp: can't register to sysctl.\n");
diff --git a/net/ipv4/netfilter/ip_conntrack_proto_tcp.c b/net/ipv4/netfilter/ip_conntrack_proto_tcp.c
index fa35b49fe2fa..170d625fad67 100644
--- a/net/ipv4/netfilter/ip_conntrack_proto_tcp.c
+++ b/net/ipv4/netfilter/ip_conntrack_proto_tcp.c
@@ -20,7 +20,6 @@
20 */ 20 */
21 21
22#include <linux/types.h> 22#include <linux/types.h>
23#include <linux/sched.h>
24#include <linux/timer.h> 23#include <linux/timer.h>
25#include <linux/netfilter.h> 24#include <linux/netfilter.h>
26#include <linux/module.h> 25#include <linux/module.h>
diff --git a/net/ipv4/netfilter/ip_conntrack_proto_udp.c b/net/ipv4/netfilter/ip_conntrack_proto_udp.c
index a99a7c75e5b5..14c30c646c7f 100644
--- a/net/ipv4/netfilter/ip_conntrack_proto_udp.c
+++ b/net/ipv4/netfilter/ip_conntrack_proto_udp.c
@@ -7,7 +7,6 @@
7 */ 7 */
8 8
9#include <linux/types.h> 9#include <linux/types.h>
10#include <linux/sched.h>
11#include <linux/timer.h> 10#include <linux/timer.h>
12#include <linux/netfilter.h> 11#include <linux/netfilter.h>
13#include <linux/in.h> 12#include <linux/in.h>
diff --git a/net/ipv4/netfilter/ip_conntrack_standalone.c b/net/ipv4/netfilter/ip_conntrack_standalone.c
index c7c1ec61b0f5..56b2f7546d1e 100644
--- a/net/ipv4/netfilter/ip_conntrack_standalone.c
+++ b/net/ipv4/netfilter/ip_conntrack_standalone.c
@@ -848,7 +848,7 @@ static int __init ip_conntrack_standalone_init(void)
848 goto cleanup_proc_stat; 848 goto cleanup_proc_stat;
849 } 849 }
850#ifdef CONFIG_SYSCTL 850#ifdef CONFIG_SYSCTL
851 ip_ct_sysctl_header = register_sysctl_table(ip_ct_net_table, 0); 851 ip_ct_sysctl_header = register_sysctl_table(ip_ct_net_table);
852 if (ip_ct_sysctl_header == NULL) { 852 if (ip_ct_sysctl_header == NULL) {
853 printk("ip_conntrack: can't register to sysctl.\n"); 853 printk("ip_conntrack: can't register to sysctl.\n");
854 ret = -ENOMEM; 854 ret = -ENOMEM;
diff --git a/net/ipv4/netfilter/ip_queue.c b/net/ipv4/netfilter/ip_queue.c
index 68bf19f3b01c..a14798a850d7 100644
--- a/net/ipv4/netfilter/ip_queue.c
+++ b/net/ipv4/netfilter/ip_queue.c
@@ -693,7 +693,7 @@ static int __init ip_queue_init(void)
693 } 693 }
694 694
695 register_netdevice_notifier(&ipq_dev_notifier); 695 register_netdevice_notifier(&ipq_dev_notifier);
696 ipq_sysctl_header = register_sysctl_table(ipq_root_table, 0); 696 ipq_sysctl_header = register_sysctl_table(ipq_root_table);
697 697
698 status = nf_register_queue_handler(PF_INET, &nfqh); 698 status = nf_register_queue_handler(PF_INET, &nfqh);
699 if (status < 0) { 699 if (status < 0) {
diff --git a/net/ipv4/netfilter/nf_conntrack_proto_icmp.c b/net/ipv4/netfilter/nf_conntrack_proto_icmp.c
index e5aa4d849b00..88cfa6aacfc1 100644
--- a/net/ipv4/netfilter/nf_conntrack_proto_icmp.c
+++ b/net/ipv4/netfilter/nf_conntrack_proto_icmp.c
@@ -12,7 +12,6 @@
12 */ 12 */
13 13
14#include <linux/types.h> 14#include <linux/types.h>
15#include <linux/sched.h>
16#include <linux/timer.h> 15#include <linux/timer.h>
17#include <linux/netfilter.h> 16#include <linux/netfilter.h>
18#include <linux/in.h> 17#include <linux/in.h>
diff --git a/net/ipv4/protocol.c b/net/ipv4/protocol.c
index 6cd6340de8bd..da70fef82c93 100644
--- a/net/ipv4/protocol.c
+++ b/net/ipv4/protocol.c
@@ -30,7 +30,6 @@
30#include <linux/module.h> 30#include <linux/module.h>
31#include <linux/types.h> 31#include <linux/types.h>
32#include <linux/kernel.h> 32#include <linux/kernel.h>
33#include <linux/sched.h>
34#include <linux/string.h> 33#include <linux/string.h>
35#include <linux/socket.h> 34#include <linux/socket.h>
36#include <linux/in.h> 35#include <linux/in.h>
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 9b5e56481d53..37e0d4d5cf94 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -70,7 +70,6 @@
70#include <linux/bitops.h> 70#include <linux/bitops.h>
71#include <linux/types.h> 71#include <linux/types.h>
72#include <linux/kernel.h> 72#include <linux/kernel.h>
73#include <linux/sched.h>
74#include <linux/mm.h> 73#include <linux/mm.h>
75#include <linux/bootmem.h> 74#include <linux/bootmem.h>
76#include <linux/string.h> 75#include <linux/string.h>
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index ea0755b09033..569a37d698f7 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -44,7 +44,6 @@
44#include <linux/types.h> 44#include <linux/types.h>
45#include <linux/socket.h> 45#include <linux/socket.h>
46#include <linux/sockios.h> 46#include <linux/sockios.h>
47#include <linux/sched.h>
48#include <linux/net.h> 47#include <linux/net.h>
49#include <linux/in6.h> 48#include <linux/in6.h>
50#include <linux/netdevice.h> 49#include <linux/netdevice.h>
@@ -3999,7 +3998,6 @@ static void addrconf_sysctl_register(struct inet6_dev *idev, struct ipv6_devconf
3999 return; 3998 return;
4000 for (i=0; t->addrconf_vars[i].data; i++) { 3999 for (i=0; t->addrconf_vars[i].data; i++) {
4001 t->addrconf_vars[i].data += (char*)p - (char*)&ipv6_devconf; 4000 t->addrconf_vars[i].data += (char*)p - (char*)&ipv6_devconf;
4002 t->addrconf_vars[i].de = NULL;
4003 t->addrconf_vars[i].extra1 = idev; /* embedded; no ref */ 4001 t->addrconf_vars[i].extra1 = idev; /* embedded; no ref */
4004 } 4002 }
4005 if (dev) { 4003 if (dev) {
@@ -4022,15 +4020,11 @@ static void addrconf_sysctl_register(struct inet6_dev *idev, struct ipv6_devconf
4022 t->addrconf_dev[0].procname = dev_name; 4020 t->addrconf_dev[0].procname = dev_name;
4023 4021
4024 t->addrconf_dev[0].child = t->addrconf_vars; 4022 t->addrconf_dev[0].child = t->addrconf_vars;
4025 t->addrconf_dev[0].de = NULL;
4026 t->addrconf_conf_dir[0].child = t->addrconf_dev; 4023 t->addrconf_conf_dir[0].child = t->addrconf_dev;
4027 t->addrconf_conf_dir[0].de = NULL;
4028 t->addrconf_proto_dir[0].child = t->addrconf_conf_dir; 4024 t->addrconf_proto_dir[0].child = t->addrconf_conf_dir;
4029 t->addrconf_proto_dir[0].de = NULL;
4030 t->addrconf_root_dir[0].child = t->addrconf_proto_dir; 4025 t->addrconf_root_dir[0].child = t->addrconf_proto_dir;
4031 t->addrconf_root_dir[0].de = NULL;
4032 4026
4033 t->sysctl_header = register_sysctl_table(t->addrconf_root_dir, 0); 4027 t->sysctl_header = register_sysctl_table(t->addrconf_root_dir);
4034 if (t->sysctl_header == NULL) 4028 if (t->sysctl_header == NULL)
4035 goto free_procname; 4029 goto free_procname;
4036 else 4030 else
@@ -4115,7 +4109,7 @@ int __init addrconf_init(void)
4115 rtnetlink_links[PF_INET6] = inet6_rtnetlink_table; 4109 rtnetlink_links[PF_INET6] = inet6_rtnetlink_table;
4116#ifdef CONFIG_SYSCTL 4110#ifdef CONFIG_SYSCTL
4117 addrconf_sysctl.sysctl_header = 4111 addrconf_sysctl.sysctl_header =
4118 register_sysctl_table(addrconf_sysctl.addrconf_root_dir, 0); 4112 register_sysctl_table(addrconf_sysctl.addrconf_root_dir);
4119 addrconf_sysctl_register(NULL, &ipv6_devconf_dflt); 4113 addrconf_sysctl_register(NULL, &ipv6_devconf_dflt);
4120#endif 4114#endif
4121 4115
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
index a006d242be76..3585d8fa7f02 100644
--- a/net/ipv6/af_inet6.c
+++ b/net/ipv6/af_inet6.c
@@ -28,7 +28,6 @@
28#include <linux/socket.h> 28#include <linux/socket.h>
29#include <linux/in.h> 29#include <linux/in.h>
30#include <linux/kernel.h> 30#include <linux/kernel.h>
31#include <linux/sched.h>
32#include <linux/timer.h> 31#include <linux/timer.h>
33#include <linux/string.h> 32#include <linux/string.h>
34#include <linux/sockios.h> 33#include <linux/sockios.h>
diff --git a/net/ipv6/anycast.c b/net/ipv6/anycast.c
index 6fb2e9d716c0..e5ef5979ade4 100644
--- a/net/ipv6/anycast.c
+++ b/net/ipv6/anycast.c
@@ -21,7 +21,6 @@
21#include <linux/string.h> 21#include <linux/string.h>
22#include <linux/socket.h> 22#include <linux/socket.h>
23#include <linux/sockios.h> 23#include <linux/sockios.h>
24#include <linux/sched.h>
25#include <linux/net.h> 24#include <linux/net.h>
26#include <linux/in6.h> 25#include <linux/in6.h>
27#include <linux/netdevice.h> 26#include <linux/netdevice.h>
diff --git a/net/ipv6/datagram.c b/net/ipv6/datagram.c
index 5f54dec3e205..3b4e8dcf4c86 100644
--- a/net/ipv6/datagram.c
+++ b/net/ipv6/datagram.c
@@ -17,7 +17,6 @@
17#include <linux/errno.h> 17#include <linux/errno.h>
18#include <linux/types.h> 18#include <linux/types.h>
19#include <linux/kernel.h> 19#include <linux/kernel.h>
20#include <linux/sched.h>
21#include <linux/interrupt.h> 20#include <linux/interrupt.h>
22#include <linux/socket.h> 21#include <linux/socket.h>
23#include <linux/sockios.h> 22#include <linux/sockios.h>
diff --git a/net/ipv6/exthdrs.c b/net/ipv6/exthdrs.c
index 08313efc48c8..28e0c6568272 100644
--- a/net/ipv6/exthdrs.c
+++ b/net/ipv6/exthdrs.c
@@ -27,7 +27,6 @@
27#include <linux/types.h> 27#include <linux/types.h>
28#include <linux/socket.h> 28#include <linux/socket.h>
29#include <linux/sockios.h> 29#include <linux/sockios.h>
30#include <linux/sched.h>
31#include <linux/net.h> 30#include <linux/net.h>
32#include <linux/netdevice.h> 31#include <linux/netdevice.h>
33#include <linux/in6.h> 32#include <linux/in6.h>
diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c
index 9377fea02682..edfe98bf64c3 100644
--- a/net/ipv6/icmp.c
+++ b/net/ipv6/icmp.c
@@ -37,7 +37,6 @@
37#include <linux/socket.h> 37#include <linux/socket.h>
38#include <linux/in.h> 38#include <linux/in.h>
39#include <linux/kernel.h> 39#include <linux/kernel.h>
40#include <linux/sched.h>
41#include <linux/sockios.h> 40#include <linux/sockios.h>
42#include <linux/net.h> 41#include <linux/net.h>
43#include <linux/skbuff.h> 42#include <linux/skbuff.h>
diff --git a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c
index 4fdded0e545a..11bfc7c43182 100644
--- a/net/ipv6/ip6_input.c
+++ b/net/ipv6/ip6_input.c
@@ -25,7 +25,6 @@
25#include <linux/types.h> 25#include <linux/types.h>
26#include <linux/socket.h> 26#include <linux/socket.h>
27#include <linux/sockios.h> 27#include <linux/sockios.h>
28#include <linux/sched.h>
29#include <linux/net.h> 28#include <linux/net.h>
30#include <linux/netdevice.h> 29#include <linux/netdevice.h>
31#include <linux/in6.h> 30#include <linux/in6.h>
diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c
index 3f1e779ea5c5..286c86735aed 100644
--- a/net/ipv6/ipv6_sockglue.c
+++ b/net/ipv6/ipv6_sockglue.c
@@ -31,7 +31,6 @@
31#include <linux/types.h> 31#include <linux/types.h>
32#include <linux/socket.h> 32#include <linux/socket.h>
33#include <linux/sockios.h> 33#include <linux/sockios.h>
34#include <linux/sched.h>
35#include <linux/net.h> 34#include <linux/net.h>
36#include <linux/in6.h> 35#include <linux/in6.h>
37#include <linux/netdevice.h> 36#include <linux/netdevice.h>
diff --git a/net/ipv6/netfilter/ip6_queue.c b/net/ipv6/netfilter/ip6_queue.c
index 58847d3b61e5..fdb30a5916e5 100644
--- a/net/ipv6/netfilter/ip6_queue.c
+++ b/net/ipv6/netfilter/ip6_queue.c
@@ -683,7 +683,7 @@ static int __init ip6_queue_init(void)
683 } 683 }
684 684
685 register_netdevice_notifier(&ipq_dev_notifier); 685 register_netdevice_notifier(&ipq_dev_notifier);
686 ipq_sysctl_header = register_sysctl_table(ipq_root_table, 0); 686 ipq_sysctl_header = register_sysctl_table(ipq_root_table);
687 687
688 status = nf_register_queue_handler(PF_INET6, &nfqh); 688 status = nf_register_queue_handler(PF_INET6, &nfqh);
689 if (status < 0) { 689 if (status < 0) {
diff --git a/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c b/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c
index 19bdb7cb8ff3..21f19cc719f3 100644
--- a/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c
+++ b/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c
@@ -17,7 +17,6 @@
17 */ 17 */
18 18
19#include <linux/types.h> 19#include <linux/types.h>
20#include <linux/sched.h>
21#include <linux/timer.h> 20#include <linux/timer.h>
22#include <linux/module.h> 21#include <linux/module.h>
23#include <linux/netfilter.h> 22#include <linux/netfilter.h>
diff --git a/net/ipv6/proc.c b/net/ipv6/proc.c
index c82257dd04b6..fa3fb509f187 100644
--- a/net/ipv6/proc.c
+++ b/net/ipv6/proc.c
@@ -17,7 +17,6 @@
17 * as published by the Free Software Foundation; either version 17 * as published by the Free Software Foundation; either version
18 * 2 of the License, or (at your option) any later version. 18 * 2 of the License, or (at your option) any later version.
19 */ 19 */
20#include <linux/sched.h>
21#include <linux/socket.h> 20#include <linux/socket.h>
22#include <linux/net.h> 21#include <linux/net.h>
23#include <linux/ipv6.h> 22#include <linux/ipv6.h>
diff --git a/net/ipv6/protocol.c b/net/ipv6/protocol.c
index ad0410c99675..ef43bd57baed 100644
--- a/net/ipv6/protocol.c
+++ b/net/ipv6/protocol.c
@@ -27,7 +27,6 @@
27#include <linux/types.h> 27#include <linux/types.h>
28#include <linux/socket.h> 28#include <linux/socket.h>
29#include <linux/sockios.h> 29#include <linux/sockios.h>
30#include <linux/sched.h>
31#include <linux/net.h> 30#include <linux/net.h>
32#include <linux/in6.h> 31#include <linux/in6.h>
33#include <linux/netdevice.h> 32#include <linux/netdevice.h>
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
index 1f8f6275a7e4..306d5d83c068 100644
--- a/net/ipv6/raw.c
+++ b/net/ipv6/raw.c
@@ -24,7 +24,6 @@
24#include <linux/types.h> 24#include <linux/types.h>
25#include <linux/socket.h> 25#include <linux/socket.h>
26#include <linux/sockios.h> 26#include <linux/sockios.h>
27#include <linux/sched.h>
28#include <linux/net.h> 27#include <linux/net.h>
29#include <linux/in6.h> 28#include <linux/in6.h>
30#include <linux/netdevice.h> 29#include <linux/netdevice.h>
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index 862ed7c52c38..08d6ed3396e4 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -24,7 +24,6 @@
24#include <linux/types.h> 24#include <linux/types.h>
25#include <linux/socket.h> 25#include <linux/socket.h>
26#include <linux/sockios.h> 26#include <linux/sockios.h>
27#include <linux/sched.h>
28#include <linux/net.h> 27#include <linux/net.h>
29#include <linux/in6.h> 28#include <linux/in6.h>
30#include <linux/netdevice.h> 29#include <linux/netdevice.h>
diff --git a/net/ipv6/sysctl_net_ipv6.c b/net/ipv6/sysctl_net_ipv6.c
index 25e8e7783fee..3fb44277207b 100644
--- a/net/ipv6/sysctl_net_ipv6.c
+++ b/net/ipv6/sysctl_net_ipv6.c
@@ -107,7 +107,7 @@ static ctl_table ipv6_root_table[] = {
107 107
108void ipv6_sysctl_register(void) 108void ipv6_sysctl_register(void)
109{ 109{
110 ipv6_sysctl_header = register_sysctl_table(ipv6_root_table, 0); 110 ipv6_sysctl_header = register_sysctl_table(ipv6_root_table);
111} 111}
112 112
113void ipv6_sysctl_unregister(void) 113void ipv6_sysctl_unregister(void)
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index ccf2f4d196be..0ad471909881 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -27,7 +27,6 @@
27#include <linux/types.h> 27#include <linux/types.h>
28#include <linux/socket.h> 28#include <linux/socket.h>
29#include <linux/sockios.h> 29#include <linux/sockios.h>
30#include <linux/sched.h>
31#include <linux/net.h> 30#include <linux/net.h>
32#include <linux/in6.h> 31#include <linux/in6.h>
33#include <linux/netdevice.h> 32#include <linux/netdevice.h>
diff --git a/net/ipx/sysctl_net_ipx.c b/net/ipx/sysctl_net_ipx.c
index 85ae35fa1e0e..0cf526450536 100644
--- a/net/ipx/sysctl_net_ipx.c
+++ b/net/ipx/sysctl_net_ipx.c
@@ -52,7 +52,7 @@ static struct ctl_table_header *ipx_table_header;
52 52
53void ipx_register_sysctl(void) 53void ipx_register_sysctl(void)
54{ 54{
55 ipx_table_header = register_sysctl_table(ipx_root_table, 1); 55 ipx_table_header = register_sysctl_table(ipx_root_table);
56} 56}
57 57
58void ipx_unregister_sysctl(void) 58void ipx_unregister_sysctl(void)
diff --git a/net/irda/ircomm/ircomm_core.c b/net/irda/ircomm/ircomm_core.c
index ec40715dcdda..4749f8f55391 100644
--- a/net/irda/ircomm/ircomm_core.c
+++ b/net/irda/ircomm/ircomm_core.c
@@ -30,7 +30,6 @@
30 ********************************************************************/ 30 ********************************************************************/
31 31
32#include <linux/module.h> 32#include <linux/module.h>
33#include <linux/sched.h>
34#include <linux/proc_fs.h> 33#include <linux/proc_fs.h>
35#include <linux/seq_file.h> 34#include <linux/seq_file.h>
36#include <linux/init.h> 35#include <linux/init.h>
diff --git a/net/irda/ircomm/ircomm_event.c b/net/irda/ircomm/ircomm_event.c
index 23d0468794e2..8ba4e59ece16 100644
--- a/net/irda/ircomm/ircomm_event.c
+++ b/net/irda/ircomm/ircomm_event.c
@@ -28,7 +28,6 @@
28 * 28 *
29 ********************************************************************/ 29 ********************************************************************/
30 30
31#include <linux/sched.h>
32#include <linux/proc_fs.h> 31#include <linux/proc_fs.h>
33#include <linux/init.h> 32#include <linux/init.h>
34 33
diff --git a/net/irda/ircomm/ircomm_lmp.c b/net/irda/ircomm/ircomm_lmp.c
index 22bd75299104..55860ee4e39e 100644
--- a/net/irda/ircomm/ircomm_lmp.c
+++ b/net/irda/ircomm/ircomm_lmp.c
@@ -30,7 +30,6 @@
30 * 30 *
31 ********************************************************************/ 31 ********************************************************************/
32 32
33#include <linux/sched.h>
34#include <linux/init.h> 33#include <linux/init.h>
35 34
36#include <net/irda/irda.h> 35#include <net/irda/irda.h>
diff --git a/net/irda/ircomm/ircomm_param.c b/net/irda/ircomm/ircomm_param.c
index fbac13e95b28..01d7c9c7b3b4 100644
--- a/net/irda/ircomm/ircomm_param.c
+++ b/net/irda/ircomm/ircomm_param.c
@@ -28,7 +28,6 @@
28 * 28 *
29 ********************************************************************/ 29 ********************************************************************/
30 30
31#include <linux/sched.h>
32#include <linux/workqueue.h> 31#include <linux/workqueue.h>
33#include <linux/interrupt.h> 32#include <linux/interrupt.h>
34 33
diff --git a/net/irda/ircomm/ircomm_ttp.c b/net/irda/ircomm/ircomm_ttp.c
index bb06ebaadd16..712eafd0cc76 100644
--- a/net/irda/ircomm/ircomm_ttp.c
+++ b/net/irda/ircomm/ircomm_ttp.c
@@ -29,7 +29,6 @@
29 * 29 *
30 ********************************************************************/ 30 ********************************************************************/
31 31
32#include <linux/sched.h>
33#include <linux/init.h> 32#include <linux/init.h>
34 33
35#include <net/irda/irda.h> 34#include <net/irda/irda.h>
diff --git a/net/irda/ircomm/ircomm_tty_attach.c b/net/irda/ircomm/ircomm_tty_attach.c
index 8d7ba93e4e09..824309dabfe9 100644
--- a/net/irda/ircomm/ircomm_tty_attach.c
+++ b/net/irda/ircomm/ircomm_tty_attach.c
@@ -29,7 +29,6 @@
29 * 29 *
30 ********************************************************************/ 30 ********************************************************************/
31 31
32#include <linux/sched.h>
33#include <linux/init.h> 32#include <linux/init.h>
34 33
35#include <net/irda/irda.h> 34#include <net/irda/irda.h>
diff --git a/net/irda/ircomm/ircomm_tty_ioctl.c b/net/irda/ircomm/ircomm_tty_ioctl.c
index a5174e6e7ad3..6030947b6d93 100644
--- a/net/irda/ircomm/ircomm_tty_ioctl.c
+++ b/net/irda/ircomm/ircomm_tty_ioctl.c
@@ -30,7 +30,6 @@
30 30
31#include <linux/init.h> 31#include <linux/init.h>
32#include <linux/fs.h> 32#include <linux/fs.h>
33#include <linux/sched.h>
34#include <linux/termios.h> 33#include <linux/termios.h>
35#include <linux/tty.h> 34#include <linux/tty.h>
36#include <linux/serial.h> 35#include <linux/serial.h>
diff --git a/net/irda/irsysctl.c b/net/irda/irsysctl.c
index bb53ba0be585..2e968e7d8fea 100644
--- a/net/irda/irsysctl.c
+++ b/net/irda/irsysctl.c
@@ -274,7 +274,7 @@ static struct ctl_table_header *irda_table_header;
274 */ 274 */
275int __init irda_sysctl_register(void) 275int __init irda_sysctl_register(void)
276{ 276{
277 irda_table_header = register_sysctl_table(irda_root_table, 0); 277 irda_table_header = register_sysctl_table(irda_root_table);
278 if (!irda_table_header) 278 if (!irda_table_header)
279 return -ENOMEM; 279 return -ENOMEM;
280 280
diff --git a/net/lapb/lapb_in.c b/net/lapb/lapb_in.c
index b0f8713f66ca..6762e7c751eb 100644
--- a/net/lapb/lapb_in.c
+++ b/net/lapb/lapb_in.c
@@ -20,7 +20,6 @@
20#include <linux/socket.h> 20#include <linux/socket.h>
21#include <linux/in.h> 21#include <linux/in.h>
22#include <linux/kernel.h> 22#include <linux/kernel.h>
23#include <linux/sched.h>
24#include <linux/timer.h> 23#include <linux/timer.h>
25#include <linux/string.h> 24#include <linux/string.h>
26#include <linux/sockios.h> 25#include <linux/sockios.h>
diff --git a/net/lapb/lapb_out.c b/net/lapb/lapb_out.c
index 981beb5e5187..339cc5f2684f 100644
--- a/net/lapb/lapb_out.c
+++ b/net/lapb/lapb_out.c
@@ -19,7 +19,6 @@
19#include <linux/socket.h> 19#include <linux/socket.h>
20#include <linux/in.h> 20#include <linux/in.h>
21#include <linux/kernel.h> 21#include <linux/kernel.h>
22#include <linux/sched.h>
23#include <linux/timer.h> 22#include <linux/timer.h>
24#include <linux/string.h> 23#include <linux/string.h>
25#include <linux/sockios.h> 24#include <linux/sockios.h>
diff --git a/net/lapb/lapb_subr.c b/net/lapb/lapb_subr.c
index b8739cf9156d..b827f47ac133 100644
--- a/net/lapb/lapb_subr.c
+++ b/net/lapb/lapb_subr.c
@@ -18,7 +18,6 @@
18#include <linux/socket.h> 18#include <linux/socket.h>
19#include <linux/in.h> 19#include <linux/in.h>
20#include <linux/kernel.h> 20#include <linux/kernel.h>
21#include <linux/sched.h>
22#include <linux/timer.h> 21#include <linux/timer.h>
23#include <linux/string.h> 22#include <linux/string.h>
24#include <linux/sockios.h> 23#include <linux/sockios.h>
diff --git a/net/llc/sysctl_net_llc.c b/net/llc/sysctl_net_llc.c
index d047a3e15714..46992d036017 100644
--- a/net/llc/sysctl_net_llc.c
+++ b/net/llc/sysctl_net_llc.c
@@ -116,7 +116,7 @@ static struct ctl_table_header *llc_table_header;
116 116
117int __init llc_sysctl_init(void) 117int __init llc_sysctl_init(void)
118{ 118{
119 llc_table_header = register_sysctl_table(llc_root_table, 1); 119 llc_table_header = register_sysctl_table(llc_root_table);
120 120
121 return llc_table_header ? 0 : -ENOMEM; 121 return llc_table_header ? 0 : -ENOMEM;
122} 122}
diff --git a/net/netfilter/nf_conntrack_proto_generic.c b/net/netfilter/nf_conntrack_proto_generic.c
index 69902531c236..7c069939695a 100644
--- a/net/netfilter/nf_conntrack_proto_generic.c
+++ b/net/netfilter/nf_conntrack_proto_generic.c
@@ -12,7 +12,7 @@
12 */ 12 */
13 13
14#include <linux/types.h> 14#include <linux/types.h>
15#include <linux/sched.h> 15#include <linux/jiffies.h>
16#include <linux/timer.h> 16#include <linux/timer.h>
17#include <linux/netfilter.h> 17#include <linux/netfilter.h>
18#include <net/netfilter/nf_conntrack_l4proto.h> 18#include <net/netfilter/nf_conntrack_l4proto.h>
diff --git a/net/netfilter/nf_conntrack_proto_sctp.c b/net/netfilter/nf_conntrack_proto_sctp.c
index 0133afa2c7ef..3c80558716a0 100644
--- a/net/netfilter/nf_conntrack_proto_sctp.c
+++ b/net/netfilter/nf_conntrack_proto_sctp.c
@@ -19,7 +19,6 @@
19 */ 19 */
20 20
21#include <linux/types.h> 21#include <linux/types.h>
22#include <linux/sched.h>
23#include <linux/timer.h> 22#include <linux/timer.h>
24#include <linux/netfilter.h> 23#include <linux/netfilter.h>
25#include <linux/module.h> 24#include <linux/module.h>
diff --git a/net/netfilter/nf_conntrack_proto_tcp.c b/net/netfilter/nf_conntrack_proto_tcp.c
index aff65aad3c66..069b85ca51cd 100644
--- a/net/netfilter/nf_conntrack_proto_tcp.c
+++ b/net/netfilter/nf_conntrack_proto_tcp.c
@@ -25,7 +25,6 @@
25 */ 25 */
26 26
27#include <linux/types.h> 27#include <linux/types.h>
28#include <linux/sched.h>
29#include <linux/timer.h> 28#include <linux/timer.h>
30#include <linux/netfilter.h> 29#include <linux/netfilter.h>
31#include <linux/module.h> 30#include <linux/module.h>
diff --git a/net/netfilter/nf_conntrack_proto_udp.c b/net/netfilter/nf_conntrack_proto_udp.c
index e49cd25998c4..d0a1cee7ee52 100644
--- a/net/netfilter/nf_conntrack_proto_udp.c
+++ b/net/netfilter/nf_conntrack_proto_udp.c
@@ -12,7 +12,6 @@
12 */ 12 */
13 13
14#include <linux/types.h> 14#include <linux/types.h>
15#include <linux/sched.h>
16#include <linux/timer.h> 15#include <linux/timer.h>
17#include <linux/module.h> 16#include <linux/module.h>
18#include <linux/netfilter.h> 17#include <linux/netfilter.h>
diff --git a/net/netfilter/nf_conntrack_standalone.c b/net/netfilter/nf_conntrack_standalone.c
index a0bba481d70d..b8586360e519 100644
--- a/net/netfilter/nf_conntrack_standalone.c
+++ b/net/netfilter/nf_conntrack_standalone.c
@@ -445,7 +445,7 @@ static int __init nf_conntrack_standalone_init(void)
445 proc_stat->owner = THIS_MODULE; 445 proc_stat->owner = THIS_MODULE;
446#endif 446#endif
447#ifdef CONFIG_SYSCTL 447#ifdef CONFIG_SYSCTL
448 nf_ct_sysctl_header = register_sysctl_table(nf_ct_net_table, 0); 448 nf_ct_sysctl_header = register_sysctl_table(nf_ct_net_table);
449 if (nf_ct_sysctl_header == NULL) { 449 if (nf_ct_sysctl_header == NULL) {
450 printk("nf_conntrack: can't register to sysctl.\n"); 450 printk("nf_conntrack: can't register to sysctl.\n");
451 ret = -ENOMEM; 451 ret = -ENOMEM;
diff --git a/net/netfilter/nf_sysctl.c b/net/netfilter/nf_sysctl.c
index 06ddddb2911f..ee34589e48a4 100644
--- a/net/netfilter/nf_sysctl.c
+++ b/net/netfilter/nf_sysctl.c
@@ -56,7 +56,7 @@ nf_register_sysctl_table(struct ctl_table *path, struct ctl_table *table)
56 path = path_dup(path, table); 56 path = path_dup(path, table);
57 if (path == NULL) 57 if (path == NULL)
58 return NULL; 58 return NULL;
59 header = register_sysctl_table(path, 0); 59 header = register_sysctl_table(path);
60 if (header == NULL) 60 if (header == NULL)
61 path_free(path, table); 61 path_free(path, table);
62 return header; 62 return header;
diff --git a/net/netfilter/nfnetlink.c b/net/netfilter/nfnetlink.c
index f42bb1366007..11d504d0ac72 100644
--- a/net/netfilter/nfnetlink.c
+++ b/net/netfilter/nfnetlink.c
@@ -19,7 +19,6 @@
19#include <linux/socket.h> 19#include <linux/socket.h>
20#include <linux/kernel.h> 20#include <linux/kernel.h>
21#include <linux/major.h> 21#include <linux/major.h>
22#include <linux/sched.h>
23#include <linux/timer.h> 22#include <linux/timer.h>
24#include <linux/string.h> 23#include <linux/string.h>
25#include <linux/sockios.h> 24#include <linux/sockios.h>
diff --git a/net/netrom/nr_dev.c b/net/netrom/nr_dev.c
index 4700d5225b78..9a97ed6e6910 100644
--- a/net/netrom/nr_dev.c
+++ b/net/netrom/nr_dev.c
@@ -9,7 +9,6 @@
9#include <linux/module.h> 9#include <linux/module.h>
10#include <linux/proc_fs.h> 10#include <linux/proc_fs.h>
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/sched.h>
13#include <linux/interrupt.h> 12#include <linux/interrupt.h>
14#include <linux/fs.h> 13#include <linux/fs.h>
15#include <linux/types.h> 14#include <linux/types.h>
diff --git a/net/netrom/nr_in.c b/net/netrom/nr_in.c
index a7d88b5ad756..5560acbaaa95 100644
--- a/net/netrom/nr_in.c
+++ b/net/netrom/nr_in.c
@@ -12,7 +12,6 @@
12#include <linux/socket.h> 12#include <linux/socket.h>
13#include <linux/in.h> 13#include <linux/in.h>
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/sched.h>
16#include <linux/timer.h> 15#include <linux/timer.h>
17#include <linux/string.h> 16#include <linux/string.h>
18#include <linux/sockios.h> 17#include <linux/sockios.h>
diff --git a/net/netrom/nr_out.c b/net/netrom/nr_out.c
index 7939ded9c98c..0cbfb611465b 100644
--- a/net/netrom/nr_out.c
+++ b/net/netrom/nr_out.c
@@ -12,7 +12,6 @@
12#include <linux/socket.h> 12#include <linux/socket.h>
13#include <linux/in.h> 13#include <linux/in.h>
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/sched.h>
16#include <linux/timer.h> 15#include <linux/timer.h>
17#include <linux/string.h> 16#include <linux/string.h>
18#include <linux/sockios.h> 17#include <linux/sockios.h>
diff --git a/net/netrom/nr_route.c b/net/netrom/nr_route.c
index c2fbac9c69ce..8e6bd4e9d82c 100644
--- a/net/netrom/nr_route.c
+++ b/net/netrom/nr_route.c
@@ -13,7 +13,6 @@
13#include <linux/socket.h> 13#include <linux/socket.h>
14#include <linux/in.h> 14#include <linux/in.h>
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/sched.h>
17#include <linux/timer.h> 16#include <linux/timer.h>
18#include <linux/string.h> 17#include <linux/string.h>
19#include <linux/sockios.h> 18#include <linux/sockios.h>
diff --git a/net/netrom/nr_subr.c b/net/netrom/nr_subr.c
index cfab5721a608..07b694d18870 100644
--- a/net/netrom/nr_subr.c
+++ b/net/netrom/nr_subr.c
@@ -11,7 +11,6 @@
11#include <linux/socket.h> 11#include <linux/socket.h>
12#include <linux/in.h> 12#include <linux/in.h>
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/sched.h>
15#include <linux/timer.h> 14#include <linux/timer.h>
16#include <linux/string.h> 15#include <linux/string.h>
17#include <linux/sockios.h> 16#include <linux/sockios.h>
diff --git a/net/netrom/sysctl_net_netrom.c b/net/netrom/sysctl_net_netrom.c
index e4b27d7aae79..2ea68da01fb8 100644
--- a/net/netrom/sysctl_net_netrom.c
+++ b/net/netrom/sysctl_net_netrom.c
@@ -192,7 +192,7 @@ static ctl_table nr_root_table[] = {
192 192
193void __init nr_register_sysctl(void) 193void __init nr_register_sysctl(void)
194{ 194{
195 nr_table_header = register_sysctl_table(nr_root_table, 1); 195 nr_table_header = register_sysctl_table(nr_root_table);
196} 196}
197 197
198void nr_unregister_sysctl(void) 198void nr_unregister_sysctl(void)
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index 15ff7b15e211..bf2699074774 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -50,7 +50,6 @@
50 */ 50 */
51 51
52#include <linux/types.h> 52#include <linux/types.h>
53#include <linux/sched.h>
54#include <linux/mm.h> 53#include <linux/mm.h>
55#include <linux/capability.h> 54#include <linux/capability.h>
56#include <linux/fcntl.h> 55#include <linux/fcntl.h>
diff --git a/net/rose/rose_dev.c b/net/rose/rose_dev.c
index 50824d345fa6..8d88795dc663 100644
--- a/net/rose/rose_dev.c
+++ b/net/rose/rose_dev.c
@@ -9,7 +9,6 @@
9#include <linux/module.h> 9#include <linux/module.h>
10#include <linux/proc_fs.h> 10#include <linux/proc_fs.h>
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/sched.h>
13#include <linux/interrupt.h> 12#include <linux/interrupt.h>
14#include <linux/fs.h> 13#include <linux/fs.h>
15#include <linux/types.h> 14#include <linux/types.h>
diff --git a/net/rose/rose_in.c b/net/rose/rose_in.c
index 8348d33f1efe..4ee0879d3540 100644
--- a/net/rose/rose_in.c
+++ b/net/rose/rose_in.c
@@ -16,7 +16,6 @@
16#include <linux/socket.h> 16#include <linux/socket.h>
17#include <linux/in.h> 17#include <linux/in.h>
18#include <linux/kernel.h> 18#include <linux/kernel.h>
19#include <linux/sched.h>
20#include <linux/timer.h> 19#include <linux/timer.h>
21#include <linux/string.h> 20#include <linux/string.h>
22#include <linux/sockios.h> 21#include <linux/sockios.h>
diff --git a/net/rose/rose_out.c b/net/rose/rose_out.c
index 2965ffc83b9b..69820f93414b 100644
--- a/net/rose/rose_out.c
+++ b/net/rose/rose_out.c
@@ -11,7 +11,6 @@
11#include <linux/socket.h> 11#include <linux/socket.h>
12#include <linux/in.h> 12#include <linux/in.h>
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/sched.h>
15#include <linux/timer.h> 14#include <linux/timer.h>
16#include <linux/string.h> 15#include <linux/string.h>
17#include <linux/sockios.h> 16#include <linux/sockios.h>
diff --git a/net/rose/rose_route.c b/net/rose/rose_route.c
index 1ddf7f5fa6db..a1233e1b1ab6 100644
--- a/net/rose/rose_route.c
+++ b/net/rose/rose_route.c
@@ -12,7 +12,6 @@
12#include <linux/socket.h> 12#include <linux/socket.h>
13#include <linux/in.h> 13#include <linux/in.h>
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/sched.h>
16#include <linux/timer.h> 15#include <linux/timer.h>
17#include <linux/string.h> 16#include <linux/string.h>
18#include <linux/sockios.h> 17#include <linux/sockios.h>
diff --git a/net/rose/rose_subr.c b/net/rose/rose_subr.c
index 36a77944622b..b05108f382da 100644
--- a/net/rose/rose_subr.c
+++ b/net/rose/rose_subr.c
@@ -11,7 +11,6 @@
11#include <linux/socket.h> 11#include <linux/socket.h>
12#include <linux/in.h> 12#include <linux/in.h>
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/sched.h>
15#include <linux/timer.h> 14#include <linux/timer.h>
16#include <linux/string.h> 15#include <linux/string.h>
17#include <linux/sockios.h> 16#include <linux/sockios.h>
diff --git a/net/rose/sysctl_net_rose.c b/net/rose/sysctl_net_rose.c
index 27a452bc5b8d..455b0555a669 100644
--- a/net/rose/sysctl_net_rose.c
+++ b/net/rose/sysctl_net_rose.c
@@ -160,7 +160,7 @@ static ctl_table rose_root_table[] = {
160 160
161void __init rose_register_sysctl(void) 161void __init rose_register_sysctl(void)
162{ 162{
163 rose_table_header = register_sysctl_table(rose_root_table, 1); 163 rose_table_header = register_sysctl_table(rose_root_table);
164} 164}
165 165
166void rose_unregister_sysctl(void) 166void rose_unregister_sysctl(void)
diff --git a/net/rxrpc/sysctl.c b/net/rxrpc/sysctl.c
index 0755ae028e43..884290754af7 100644
--- a/net/rxrpc/sysctl.c
+++ b/net/rxrpc/sysctl.c
@@ -97,7 +97,7 @@ static ctl_table rxrpc_dir_sysctl_table[] = {
97int rxrpc_sysctl_init(void) 97int rxrpc_sysctl_init(void)
98{ 98{
99#ifdef CONFIG_SYSCTL 99#ifdef CONFIG_SYSCTL
100 rxrpc_sysctl = register_sysctl_table(rxrpc_dir_sysctl_table, 0); 100 rxrpc_sysctl = register_sysctl_table(rxrpc_dir_sysctl_table);
101 if (!rxrpc_sysctl) 101 if (!rxrpc_sysctl)
102 return -ENOMEM; 102 return -ENOMEM;
103#endif /* CONFIG_SYSCTL */ 103#endif /* CONFIG_SYSCTL */
diff --git a/net/rxrpc/transport.c b/net/rxrpc/transport.c
index ff5f4f333086..8e57be2df936 100644
--- a/net/rxrpc/transport.c
+++ b/net/rxrpc/transport.c
@@ -9,7 +9,6 @@
9 * 2 of the License, or (at your option) any later version. 9 * 2 of the License, or (at your option) any later version.
10 */ 10 */
11 11
12#include <linux/sched.h>
13#include <linux/slab.h> 12#include <linux/slab.h>
14#include <linux/module.h> 13#include <linux/module.h>
15#include <rxrpc/transport.h> 14#include <rxrpc/transport.h>
diff --git a/net/sched/act_api.c b/net/sched/act_api.c
index dd0868dfbd90..cb21617a5670 100644
--- a/net/sched/act_api.c
+++ b/net/sched/act_api.c
@@ -16,7 +16,6 @@
16#include <linux/bitops.h> 16#include <linux/bitops.h>
17#include <linux/types.h> 17#include <linux/types.h>
18#include <linux/kernel.h> 18#include <linux/kernel.h>
19#include <linux/sched.h>
20#include <linux/string.h> 19#include <linux/string.h>
21#include <linux/mm.h> 20#include <linux/mm.h>
22#include <linux/socket.h> 21#include <linux/socket.h>
diff --git a/net/sched/act_gact.c b/net/sched/act_gact.c
index 60095d86fd8f..87d0faf32867 100644
--- a/net/sched/act_gact.c
+++ b/net/sched/act_gact.c
@@ -15,7 +15,6 @@
15#include <linux/bitops.h> 15#include <linux/bitops.h>
16#include <linux/types.h> 16#include <linux/types.h>
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/sched.h>
19#include <linux/string.h> 18#include <linux/string.h>
20#include <linux/mm.h> 19#include <linux/mm.h>
21#include <linux/socket.h> 20#include <linux/socket.h>
diff --git a/net/sched/act_ipt.c b/net/sched/act_ipt.c
index 0fdabfa9f4bf..47f0b1324239 100644
--- a/net/sched/act_ipt.c
+++ b/net/sched/act_ipt.c
@@ -16,7 +16,6 @@
16#include <asm/bitops.h> 16#include <asm/bitops.h>
17#include <linux/types.h> 17#include <linux/types.h>
18#include <linux/kernel.h> 18#include <linux/kernel.h>
19#include <linux/sched.h>
20#include <linux/string.h> 19#include <linux/string.h>
21#include <linux/mm.h> 20#include <linux/mm.h>
22#include <linux/socket.h> 21#include <linux/socket.h>
diff --git a/net/sched/act_mirred.c b/net/sched/act_mirred.c
index 483897271f15..68f26cb278f9 100644
--- a/net/sched/act_mirred.c
+++ b/net/sched/act_mirred.c
@@ -17,7 +17,6 @@
17#include <asm/bitops.h> 17#include <asm/bitops.h>
18#include <linux/types.h> 18#include <linux/types.h>
19#include <linux/kernel.h> 19#include <linux/kernel.h>
20#include <linux/sched.h>
21#include <linux/string.h> 20#include <linux/string.h>
22#include <linux/mm.h> 21#include <linux/mm.h>
23#include <linux/socket.h> 22#include <linux/socket.h>
diff --git a/net/sched/act_pedit.c b/net/sched/act_pedit.c
index 53aa96cd579b..3d6a2fcc9ce4 100644
--- a/net/sched/act_pedit.c
+++ b/net/sched/act_pedit.c
@@ -14,7 +14,6 @@
14#include <asm/bitops.h> 14#include <asm/bitops.h>
15#include <linux/types.h> 15#include <linux/types.h>
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <linux/sched.h>
18#include <linux/string.h> 17#include <linux/string.h>
19#include <linux/mm.h> 18#include <linux/mm.h>
20#include <linux/socket.h> 19#include <linux/socket.h>
diff --git a/net/sched/act_police.c b/net/sched/act_police.c
index 6ffe35da22b1..10a5a5c36f76 100644
--- a/net/sched/act_police.c
+++ b/net/sched/act_police.c
@@ -16,7 +16,6 @@
16#include <linux/module.h> 16#include <linux/module.h>
17#include <linux/types.h> 17#include <linux/types.h>
18#include <linux/kernel.h> 18#include <linux/kernel.h>
19#include <linux/sched.h>
20#include <linux/string.h> 19#include <linux/string.h>
21#include <linux/mm.h> 20#include <linux/mm.h>
22#include <linux/socket.h> 21#include <linux/socket.h>
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c
index f41f4ee0587a..5c6ffdb77d2d 100644
--- a/net/sched/cls_api.c
+++ b/net/sched/cls_api.c
@@ -20,7 +20,6 @@
20#include <linux/module.h> 20#include <linux/module.h>
21#include <linux/types.h> 21#include <linux/types.h>
22#include <linux/kernel.h> 22#include <linux/kernel.h>
23#include <linux/sched.h>
24#include <linux/string.h> 23#include <linux/string.h>
25#include <linux/mm.h> 24#include <linux/mm.h>
26#include <linux/socket.h> 25#include <linux/socket.h>
diff --git a/net/sched/cls_basic.c b/net/sched/cls_basic.c
index ea13c2c5b061..fad08e521c24 100644
--- a/net/sched/cls_basic.c
+++ b/net/sched/cls_basic.c
@@ -12,7 +12,6 @@
12#include <linux/module.h> 12#include <linux/module.h>
13#include <linux/types.h> 13#include <linux/types.h>
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/sched.h>
16#include <linux/string.h> 15#include <linux/string.h>
17#include <linux/mm.h> 16#include <linux/mm.h>
18#include <linux/errno.h> 17#include <linux/errno.h>
diff --git a/net/sched/cls_fw.c b/net/sched/cls_fw.c
index 2ce3ce5c66eb..5dbb9d451f73 100644
--- a/net/sched/cls_fw.c
+++ b/net/sched/cls_fw.c
@@ -24,7 +24,6 @@
24#include <linux/bitops.h> 24#include <linux/bitops.h>
25#include <linux/types.h> 25#include <linux/types.h>
26#include <linux/kernel.h> 26#include <linux/kernel.h>
27#include <linux/sched.h>
28#include <linux/string.h> 27#include <linux/string.h>
29#include <linux/mm.h> 28#include <linux/mm.h>
30#include <linux/socket.h> 29#include <linux/socket.h>
diff --git a/net/sched/cls_route.c b/net/sched/cls_route.c
index d3aea730d4c8..e85df07d8ce7 100644
--- a/net/sched/cls_route.c
+++ b/net/sched/cls_route.c
@@ -15,7 +15,6 @@
15#include <linux/bitops.h> 15#include <linux/bitops.h>
16#include <linux/types.h> 16#include <linux/types.h>
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/sched.h>
19#include <linux/string.h> 18#include <linux/string.h>
20#include <linux/mm.h> 19#include <linux/mm.h>
21#include <linux/socket.h> 20#include <linux/socket.h>
diff --git a/net/sched/cls_rsvp.c b/net/sched/cls_rsvp.c
index ad2613790d85..1d4a1fb17608 100644
--- a/net/sched/cls_rsvp.c
+++ b/net/sched/cls_rsvp.c
@@ -15,7 +15,6 @@
15#include <linux/bitops.h> 15#include <linux/bitops.h>
16#include <linux/types.h> 16#include <linux/types.h>
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/sched.h>
19#include <linux/string.h> 18#include <linux/string.h>
20#include <linux/mm.h> 19#include <linux/mm.h>
21#include <linux/socket.h> 20#include <linux/socket.h>
diff --git a/net/sched/cls_rsvp6.c b/net/sched/cls_rsvp6.c
index fde51f7848eb..a2979d89798f 100644
--- a/net/sched/cls_rsvp6.c
+++ b/net/sched/cls_rsvp6.c
@@ -15,7 +15,6 @@
15#include <linux/bitops.h> 15#include <linux/bitops.h>
16#include <linux/types.h> 16#include <linux/types.h>
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/sched.h>
19#include <linux/string.h> 18#include <linux/string.h>
20#include <linux/mm.h> 19#include <linux/mm.h>
21#include <linux/socket.h> 20#include <linux/socket.h>
diff --git a/net/sched/cls_u32.c b/net/sched/cls_u32.c
index a232671cfa4e..0bcb16928d25 100644
--- a/net/sched/cls_u32.c
+++ b/net/sched/cls_u32.c
@@ -36,7 +36,6 @@
36#include <linux/module.h> 36#include <linux/module.h>
37#include <linux/types.h> 37#include <linux/types.h>
38#include <linux/kernel.h> 38#include <linux/kernel.h>
39#include <linux/sched.h>
40#include <linux/string.h> 39#include <linux/string.h>
41#include <linux/mm.h> 40#include <linux/mm.h>
42#include <linux/socket.h> 41#include <linux/socket.h>
diff --git a/net/sched/em_nbyte.c b/net/sched/em_nbyte.c
index 42103b2bdc51..b4b36efce292 100644
--- a/net/sched/em_nbyte.c
+++ b/net/sched/em_nbyte.c
@@ -12,7 +12,6 @@
12#include <linux/module.h> 12#include <linux/module.h>
13#include <linux/types.h> 13#include <linux/types.h>
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/sched.h>
16#include <linux/string.h> 15#include <linux/string.h>
17#include <linux/skbuff.h> 16#include <linux/skbuff.h>
18#include <linux/tc_ematch/tc_em_nbyte.h> 17#include <linux/tc_ematch/tc_em_nbyte.h>
diff --git a/net/sched/em_text.c b/net/sched/em_text.c
index 8ad894b58fce..e8f46169449d 100644
--- a/net/sched/em_text.c
+++ b/net/sched/em_text.c
@@ -12,7 +12,6 @@
12#include <linux/module.h> 12#include <linux/module.h>
13#include <linux/types.h> 13#include <linux/types.h>
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/sched.h>
16#include <linux/string.h> 15#include <linux/string.h>
17#include <linux/skbuff.h> 16#include <linux/skbuff.h>
18#include <linux/textsearch.h> 17#include <linux/textsearch.h>
diff --git a/net/sched/ematch.c b/net/sched/ematch.c
index d3ad36b36129..959c306c5714 100644
--- a/net/sched/ematch.c
+++ b/net/sched/ematch.c
@@ -84,7 +84,6 @@
84#include <linux/module.h> 84#include <linux/module.h>
85#include <linux/types.h> 85#include <linux/types.h>
86#include <linux/kernel.h> 86#include <linux/kernel.h>
87#include <linux/sched.h>
88#include <linux/mm.h> 87#include <linux/mm.h>
89#include <linux/errno.h> 88#include <linux/errno.h>
90#include <linux/interrupt.h> 89#include <linux/interrupt.h>
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c
index 4158127bc202..ecc988af4a9a 100644
--- a/net/sched/sch_api.c
+++ b/net/sched/sch_api.c
@@ -18,7 +18,6 @@
18#include <linux/module.h> 18#include <linux/module.h>
19#include <linux/types.h> 19#include <linux/types.h>
20#include <linux/kernel.h> 20#include <linux/kernel.h>
21#include <linux/sched.h>
22#include <linux/string.h> 21#include <linux/string.h>
23#include <linux/mm.h> 22#include <linux/mm.h>
24#include <linux/socket.h> 23#include <linux/socket.h>
diff --git a/net/sched/sch_cbq.c b/net/sched/sch_cbq.c
index 48830cac1014..76c92e710a33 100644
--- a/net/sched/sch_cbq.c
+++ b/net/sched/sch_cbq.c
@@ -16,7 +16,6 @@
16#include <linux/bitops.h> 16#include <linux/bitops.h>
17#include <linux/types.h> 17#include <linux/types.h>
18#include <linux/kernel.h> 18#include <linux/kernel.h>
19#include <linux/sched.h>
20#include <linux/string.h> 19#include <linux/string.h>
21#include <linux/mm.h> 20#include <linux/mm.h>
22#include <linux/socket.h> 21#include <linux/socket.h>
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c
index 1f098d862f92..97cbb9aec946 100644
--- a/net/sched/sch_htb.c
+++ b/net/sched/sch_htb.c
@@ -33,7 +33,6 @@
33#include <linux/bitops.h> 33#include <linux/bitops.h>
34#include <linux/types.h> 34#include <linux/types.h>
35#include <linux/kernel.h> 35#include <linux/kernel.h>
36#include <linux/sched.h>
37#include <linux/string.h> 36#include <linux/string.h>
38#include <linux/mm.h> 37#include <linux/mm.h>
39#include <linux/socket.h> 38#include <linux/socket.h>
diff --git a/net/sched/sch_prio.c b/net/sched/sch_prio.c
index 9f957ca5073b..de889f23f22a 100644
--- a/net/sched/sch_prio.c
+++ b/net/sched/sch_prio.c
@@ -17,7 +17,6 @@
17#include <linux/bitops.h> 17#include <linux/bitops.h>
18#include <linux/types.h> 18#include <linux/types.h>
19#include <linux/kernel.h> 19#include <linux/kernel.h>
20#include <linux/sched.h>
21#include <linux/string.h> 20#include <linux/string.h>
22#include <linux/mm.h> 21#include <linux/mm.h>
23#include <linux/socket.h> 22#include <linux/socket.h>
diff --git a/net/sched/sch_teql.c b/net/sched/sch_teql.c
index 6a66037abac9..587123c61af9 100644
--- a/net/sched/sch_teql.c
+++ b/net/sched/sch_teql.c
@@ -14,7 +14,6 @@
14#include <linux/bitops.h> 14#include <linux/bitops.h>
15#include <linux/types.h> 15#include <linux/types.h>
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <linux/sched.h>
18#include <linux/string.h> 17#include <linux/string.h>
19#include <linux/mm.h> 18#include <linux/mm.h>
20#include <linux/socket.h> 19#include <linux/socket.h>
diff --git a/net/sctp/associola.c b/net/sctp/associola.c
index fca6f75b0a0d..fa82b73c965b 100644
--- a/net/sctp/associola.c
+++ b/net/sctp/associola.c
@@ -52,7 +52,6 @@
52#include <linux/fcntl.h> 52#include <linux/fcntl.h>
53#include <linux/poll.h> 53#include <linux/poll.h>
54#include <linux/init.h> 54#include <linux/init.h>
55#include <linux/sched.h>
56 55
57#include <linux/slab.h> 56#include <linux/slab.h>
58#include <linux/in.h> 57#include <linux/in.h>
diff --git a/net/sctp/bind_addr.c b/net/sctp/bind_addr.c
index 80294cbc0de6..fdb287a9e2e2 100644
--- a/net/sctp/bind_addr.c
+++ b/net/sctp/bind_addr.c
@@ -43,7 +43,6 @@
43 */ 43 */
44 44
45#include <linux/types.h> 45#include <linux/types.h>
46#include <linux/sched.h>
47#include <linux/in.h> 46#include <linux/in.h>
48#include <net/sock.h> 47#include <net/sock.h>
49#include <net/ipv6.h> 48#include <net/ipv6.h>
diff --git a/net/sctp/endpointola.c b/net/sctp/endpointola.c
index 286a8dbb63b7..1404a9e2e78f 100644
--- a/net/sctp/endpointola.c
+++ b/net/sctp/endpointola.c
@@ -50,7 +50,6 @@
50 */ 50 */
51 51
52#include <linux/types.h> 52#include <linux/types.h>
53#include <linux/sched.h>
54#include <linux/slab.h> 53#include <linux/slab.h>
55#include <linux/in.h> 54#include <linux/in.h>
56#include <linux/random.h> /* get_random_bytes() */ 55#include <linux/random.h> /* get_random_bytes() */
diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c
index 01b27fb5dfc5..63fe1093b616 100644
--- a/net/sctp/ipv6.c
+++ b/net/sctp/ipv6.c
@@ -53,7 +53,6 @@
53#include <linux/socket.h> 53#include <linux/socket.h>
54#include <linux/sockios.h> 54#include <linux/sockios.h>
55#include <linux/net.h> 55#include <linux/net.h>
56#include <linux/sched.h>
57#include <linux/in.h> 56#include <linux/in.h>
58#include <linux/in6.h> 57#include <linux/in6.h>
59#include <linux/netdevice.h> 58#include <linux/netdevice.h>
diff --git a/net/sctp/sysctl.c b/net/sctp/sysctl.c
index 633cd178654b..e2c679baf912 100644
--- a/net/sctp/sysctl.c
+++ b/net/sctp/sysctl.c
@@ -254,7 +254,7 @@ static struct ctl_table_header * sctp_sysctl_header;
254/* Sysctl registration. */ 254/* Sysctl registration. */
255void sctp_sysctl_register(void) 255void sctp_sysctl_register(void)
256{ 256{
257 sctp_sysctl_header = register_sysctl_table(sctp_root_table, 0); 257 sctp_sysctl_header = register_sysctl_table(sctp_root_table);
258} 258}
259 259
260/* Sysctl deregistration. */ 260/* Sysctl deregistration. */
diff --git a/net/sunrpc/auth_null.c b/net/sunrpc/auth_null.c
index 3be257dc32b2..3df9fccab2f8 100644
--- a/net/sunrpc/auth_null.c
+++ b/net/sunrpc/auth_null.c
@@ -10,7 +10,6 @@
10#include <linux/module.h> 10#include <linux/module.h>
11#include <linux/utsname.h> 11#include <linux/utsname.h>
12#include <linux/sunrpc/clnt.h> 12#include <linux/sunrpc/clnt.h>
13#include <linux/sched.h>
14 13
15#ifdef RPC_DEBUG 14#ifdef RPC_DEBUG
16# define RPCDBG_FACILITY RPCDBG_AUTH 15# define RPCDBG_FACILITY RPCDBG_AUTH
diff --git a/net/sunrpc/stats.c b/net/sunrpc/stats.c
index 2878e20ebd04..74ba7d443dfc 100644
--- a/net/sunrpc/stats.c
+++ b/net/sunrpc/stats.c
@@ -16,7 +16,6 @@
16 16
17#include <linux/init.h> 17#include <linux/init.h>
18#include <linux/kernel.h> 18#include <linux/kernel.h>
19#include <linux/sched.h>
20#include <linux/proc_fs.h> 19#include <linux/proc_fs.h>
21#include <linux/seq_file.h> 20#include <linux/seq_file.h>
22#include <linux/sunrpc/clnt.h> 21#include <linux/sunrpc/clnt.h>
diff --git a/net/sunrpc/sunrpc_syms.c b/net/sunrpc/sunrpc_syms.c
index d85fddeb6388..43ecf62f12ef 100644
--- a/net/sunrpc/sunrpc_syms.c
+++ b/net/sunrpc/sunrpc_syms.c
@@ -9,7 +9,6 @@
9#include <linux/module.h> 9#include <linux/module.h>
10 10
11#include <linux/types.h> 11#include <linux/types.h>
12#include <linux/sched.h>
13#include <linux/uio.h> 12#include <linux/uio.h>
14#include <linux/unistd.h> 13#include <linux/unistd.h>
15#include <linux/init.h> 14#include <linux/init.h>
@@ -137,7 +136,7 @@ EXPORT_SYMBOL(nlm_debug);
137 136
138extern int register_rpc_pipefs(void); 137extern int register_rpc_pipefs(void);
139extern void unregister_rpc_pipefs(void); 138extern void unregister_rpc_pipefs(void);
140extern struct cache_detail ip_map_cache; 139extern struct cache_detail ip_map_cache, unix_gid_cache;
141extern int init_socket_xprt(void); 140extern int init_socket_xprt(void);
142extern void cleanup_socket_xprt(void); 141extern void cleanup_socket_xprt(void);
143 142
@@ -157,6 +156,7 @@ init_sunrpc(void)
157 rpc_proc_init(); 156 rpc_proc_init();
158#endif 157#endif
159 cache_register(&ip_map_cache); 158 cache_register(&ip_map_cache);
159 cache_register(&unix_gid_cache);
160 init_socket_xprt(); 160 init_socket_xprt();
161out: 161out:
162 return err; 162 return err;
@@ -170,6 +170,8 @@ cleanup_sunrpc(void)
170 rpc_destroy_mempool(); 170 rpc_destroy_mempool();
171 if (cache_unregister(&ip_map_cache)) 171 if (cache_unregister(&ip_map_cache))
172 printk(KERN_ERR "sunrpc: failed to unregister ip_map cache\n"); 172 printk(KERN_ERR "sunrpc: failed to unregister ip_map cache\n");
173 if (cache_unregister(&unix_gid_cache))
174 printk(KERN_ERR "sunrpc: failed to unregister unix_gid cache\n");
173#ifdef RPC_DEBUG 175#ifdef RPC_DEBUG
174 rpc_unregister_sysctl(); 176 rpc_unregister_sysctl();
175#endif 177#endif
diff --git a/net/sunrpc/svcauth.c b/net/sunrpc/svcauth.c
index 811a24c83262..f5c3808bf85a 100644
--- a/net/sunrpc/svcauth.c
+++ b/net/sunrpc/svcauth.c
@@ -10,7 +10,6 @@
10 */ 10 */
11 11
12#include <linux/types.h> 12#include <linux/types.h>
13#include <linux/sched.h>
14#include <linux/module.h> 13#include <linux/module.h>
15#include <linux/sunrpc/types.h> 14#include <linux/sunrpc/types.h>
16#include <linux/sunrpc/xdr.h> 15#include <linux/sunrpc/xdr.h>
diff --git a/net/sunrpc/svcauth_unix.c b/net/sunrpc/svcauth_unix.c
index 4b775dbf580d..9bae4090254c 100644
--- a/net/sunrpc/svcauth_unix.c
+++ b/net/sunrpc/svcauth_unix.c
@@ -418,6 +418,214 @@ svcauth_unix_info_release(void *info)
418 cache_put(&ipm->h, &ip_map_cache); 418 cache_put(&ipm->h, &ip_map_cache);
419} 419}
420 420
421/****************************************************************************
422 * auth.unix.gid cache
423 * simple cache to map a UID to a list of GIDs
424 * because AUTH_UNIX aka AUTH_SYS has a max of 16
425 */
426#define GID_HASHBITS 8
427#define GID_HASHMAX (1<<GID_HASHBITS)
428#define GID_HASHMASK (GID_HASHMAX - 1)
429
430struct unix_gid {
431 struct cache_head h;
432 uid_t uid;
433 struct group_info *gi;
434};
435static struct cache_head *gid_table[GID_HASHMAX];
436
437static void unix_gid_put(struct kref *kref)
438{
439 struct cache_head *item = container_of(kref, struct cache_head, ref);
440 struct unix_gid *ug = container_of(item, struct unix_gid, h);
441 if (test_bit(CACHE_VALID, &item->flags) &&
442 !test_bit(CACHE_NEGATIVE, &item->flags))
443 put_group_info(ug->gi);
444 kfree(ug);
445}
446
447static int unix_gid_match(struct cache_head *corig, struct cache_head *cnew)
448{
449 struct unix_gid *orig = container_of(corig, struct unix_gid, h);
450 struct unix_gid *new = container_of(cnew, struct unix_gid, h);
451 return orig->uid == new->uid;
452}
453static void unix_gid_init(struct cache_head *cnew, struct cache_head *citem)
454{
455 struct unix_gid *new = container_of(cnew, struct unix_gid, h);
456 struct unix_gid *item = container_of(citem, struct unix_gid, h);
457 new->uid = item->uid;
458}
459static void unix_gid_update(struct cache_head *cnew, struct cache_head *citem)
460{
461 struct unix_gid *new = container_of(cnew, struct unix_gid, h);
462 struct unix_gid *item = container_of(citem, struct unix_gid, h);
463
464 get_group_info(item->gi);
465 new->gi = item->gi;
466}
467static struct cache_head *unix_gid_alloc(void)
468{
469 struct unix_gid *g = kmalloc(sizeof(*g), GFP_KERNEL);
470 if (g)
471 return &g->h;
472 else
473 return NULL;
474}
475
476static void unix_gid_request(struct cache_detail *cd,
477 struct cache_head *h,
478 char **bpp, int *blen)
479{
480 char tuid[20];
481 struct unix_gid *ug = container_of(h, struct unix_gid, h);
482
483 snprintf(tuid, 20, "%u", ug->uid);
484 qword_add(bpp, blen, tuid);
485 (*bpp)[-1] = '\n';
486}
487
488static struct unix_gid *unix_gid_lookup(uid_t uid);
489extern struct cache_detail unix_gid_cache;
490
491static int unix_gid_parse(struct cache_detail *cd,
492 char *mesg, int mlen)
493{
494 /* uid expiry Ngid gid0 gid1 ... gidN-1 */
495 int uid;
496 int gids;
497 int rv;
498 int i;
499 int err;
500 time_t expiry;
501 struct unix_gid ug, *ugp;
502
503 if (mlen <= 0 || mesg[mlen-1] != '\n')
504 return -EINVAL;
505 mesg[mlen-1] = 0;
506
507 rv = get_int(&mesg, &uid);
508 if (rv)
509 return -EINVAL;
510 ug.uid = uid;
511
512 expiry = get_expiry(&mesg);
513 if (expiry == 0)
514 return -EINVAL;
515
516 rv = get_int(&mesg, &gids);
517 if (rv || gids < 0 || gids > 8192)
518 return -EINVAL;
519
520 ug.gi = groups_alloc(gids);
521 if (!ug.gi)
522 return -ENOMEM;
523
524 for (i = 0 ; i < gids ; i++) {
525 int gid;
526 rv = get_int(&mesg, &gid);
527 err = -EINVAL;
528 if (rv)
529 goto out;
530 GROUP_AT(ug.gi, i) = gid;
531 }
532
533 ugp = unix_gid_lookup(uid);
534 if (ugp) {
535 struct cache_head *ch;
536 ug.h.flags = 0;
537 ug.h.expiry_time = expiry;
538 ch = sunrpc_cache_update(&unix_gid_cache,
539 &ug.h, &ugp->h,
540 hash_long(uid, GID_HASHBITS));
541 if (!ch)
542 err = -ENOMEM;
543 else {
544 err = 0;
545 cache_put(ch, &unix_gid_cache);
546 }
547 } else
548 err = -ENOMEM;
549 out:
550 if (ug.gi)
551 put_group_info(ug.gi);
552 return err;
553}
554
555static int unix_gid_show(struct seq_file *m,
556 struct cache_detail *cd,
557 struct cache_head *h)
558{
559 struct unix_gid *ug;
560 int i;
561 int glen;
562
563 if (h == NULL) {
564 seq_puts(m, "#uid cnt: gids...\n");
565 return 0;
566 }
567 ug = container_of(h, struct unix_gid, h);
568 if (test_bit(CACHE_VALID, &h->flags) &&
569 !test_bit(CACHE_NEGATIVE, &h->flags))
570 glen = ug->gi->ngroups;
571 else
572 glen = 0;
573
574 seq_printf(m, "%d %d:", ug->uid, glen);
575 for (i = 0; i < glen; i++)
576 seq_printf(m, " %d", GROUP_AT(ug->gi, i));
577 seq_printf(m, "\n");
578 return 0;
579}
580
581struct cache_detail unix_gid_cache = {
582 .owner = THIS_MODULE,
583 .hash_size = GID_HASHMAX,
584 .hash_table = gid_table,
585 .name = "auth.unix.gid",
586 .cache_put = unix_gid_put,
587 .cache_request = unix_gid_request,
588 .cache_parse = unix_gid_parse,
589 .cache_show = unix_gid_show,
590 .match = unix_gid_match,
591 .init = unix_gid_init,
592 .update = unix_gid_update,
593 .alloc = unix_gid_alloc,
594};
595
596static struct unix_gid *unix_gid_lookup(uid_t uid)
597{
598 struct unix_gid ug;
599 struct cache_head *ch;
600
601 ug.uid = uid;
602 ch = sunrpc_cache_lookup(&unix_gid_cache, &ug.h,
603 hash_long(uid, GID_HASHBITS));
604 if (ch)
605 return container_of(ch, struct unix_gid, h);
606 else
607 return NULL;
608}
609
610static int unix_gid_find(uid_t uid, struct group_info **gip,
611 struct svc_rqst *rqstp)
612{
613 struct unix_gid *ug = unix_gid_lookup(uid);
614 if (!ug)
615 return -EAGAIN;
616 switch (cache_check(&unix_gid_cache, &ug->h, &rqstp->rq_chandle)) {
617 case -ENOENT:
618 *gip = NULL;
619 return 0;
620 case 0:
621 *gip = ug->gi;
622 get_group_info(*gip);
623 return 0;
624 default:
625 return -EAGAIN;
626 }
627}
628
421static int 629static int
422svcauth_unix_set_client(struct svc_rqst *rqstp) 630svcauth_unix_set_client(struct svc_rqst *rqstp)
423{ 631{
@@ -543,12 +751,19 @@ svcauth_unix_accept(struct svc_rqst *rqstp, __be32 *authp)
543 slen = svc_getnl(argv); /* gids length */ 751 slen = svc_getnl(argv); /* gids length */
544 if (slen > 16 || (len -= (slen + 2)*4) < 0) 752 if (slen > 16 || (len -= (slen + 2)*4) < 0)
545 goto badcred; 753 goto badcred;
546 cred->cr_group_info = groups_alloc(slen); 754 if (unix_gid_find(cred->cr_uid, &cred->cr_group_info, rqstp)
547 if (cred->cr_group_info == NULL) 755 == -EAGAIN)
548 return SVC_DROP; 756 return SVC_DROP;
549 for (i = 0; i < slen; i++) 757 if (cred->cr_group_info == NULL) {
550 GROUP_AT(cred->cr_group_info, i) = svc_getnl(argv); 758 cred->cr_group_info = groups_alloc(slen);
551 759 if (cred->cr_group_info == NULL)
760 return SVC_DROP;
761 for (i = 0; i < slen; i++)
762 GROUP_AT(cred->cr_group_info, i) = svc_getnl(argv);
763 } else {
764 for (i = 0; i < slen ; i++)
765 svc_getnl(argv);
766 }
552 if (svc_getu32(argv) != htonl(RPC_AUTH_NULL) || svc_getu32(argv) != 0) { 767 if (svc_getu32(argv) != htonl(RPC_AUTH_NULL) || svc_getu32(argv) != 0) {
553 *authp = rpc_autherr_badverf; 768 *authp = rpc_autherr_badverf;
554 return SVC_DENIED; 769 return SVC_DENIED;
diff --git a/net/sunrpc/sysctl.c b/net/sunrpc/sysctl.c
index 47d8df2b5eb2..738db32a287d 100644
--- a/net/sunrpc/sysctl.c
+++ b/net/sunrpc/sysctl.c
@@ -35,14 +35,8 @@ static ctl_table sunrpc_table[];
35void 35void
36rpc_register_sysctl(void) 36rpc_register_sysctl(void)
37{ 37{
38 if (!sunrpc_table_header) { 38 if (!sunrpc_table_header)
39 sunrpc_table_header = register_sysctl_table(sunrpc_table, 1); 39 sunrpc_table_header = register_sysctl_table(sunrpc_table);
40#ifdef CONFIG_PROC_FS
41 if (sunrpc_table[0].de)
42 sunrpc_table[0].de->owner = THIS_MODULE;
43#endif
44 }
45
46} 40}
47 41
48void 42void
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index 64736b3a59a7..a5a32029e728 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -18,7 +18,6 @@
18#include <linux/types.h> 18#include <linux/types.h>
19#include <linux/slab.h> 19#include <linux/slab.h>
20#include <linux/capability.h> 20#include <linux/capability.h>
21#include <linux/sched.h>
22#include <linux/pagemap.h> 21#include <linux/pagemap.h>
23#include <linux/errno.h> 22#include <linux/errno.h>
24#include <linux/socket.h> 23#include <linux/socket.h>
@@ -1636,13 +1635,8 @@ struct rpc_xprt *xs_setup_tcp(struct sockaddr *addr, size_t addrlen, struct rpc_
1636int init_socket_xprt(void) 1635int init_socket_xprt(void)
1637{ 1636{
1638#ifdef RPC_DEBUG 1637#ifdef RPC_DEBUG
1639 if (!sunrpc_table_header) { 1638 if (!sunrpc_table_header)
1640 sunrpc_table_header = register_sysctl_table(sunrpc_table, 1); 1639 sunrpc_table_header = register_sysctl_table(sunrpc_table);
1641#ifdef CONFIG_PROC_FS
1642 if (sunrpc_table[0].de)
1643 sunrpc_table[0].de->owner = THIS_MODULE;
1644#endif
1645 }
1646#endif 1640#endif
1647 1641
1648 return 0; 1642 return 0;
diff --git a/net/unix/garbage.c b/net/unix/garbage.c
index f8bcf5d114d9..f20b7ea7c555 100644
--- a/net/unix/garbage.c
+++ b/net/unix/garbage.c
@@ -65,7 +65,6 @@
65 */ 65 */
66 66
67#include <linux/kernel.h> 67#include <linux/kernel.h>
68#include <linux/sched.h>
69#include <linux/string.h> 68#include <linux/string.h>
70#include <linux/socket.h> 69#include <linux/socket.h>
71#include <linux/un.h> 70#include <linux/un.h>
diff --git a/net/unix/sysctl_net_unix.c b/net/unix/sysctl_net_unix.c
index 690ffa5d5bfb..eb0bd57ebada 100644
--- a/net/unix/sysctl_net_unix.c
+++ b/net/unix/sysctl_net_unix.c
@@ -50,7 +50,7 @@ static struct ctl_table_header * unix_sysctl_header;
50 50
51void unix_sysctl_register(void) 51void unix_sysctl_register(void)
52{ 52{
53 unix_sysctl_header = register_sysctl_table(unix_root_table, 0); 53 unix_sysctl_header = register_sysctl_table(unix_root_table);
54} 54}
55 55
56void unix_sysctl_unregister(void) 56void unix_sysctl_unregister(void)
diff --git a/net/x25/sysctl_net_x25.c b/net/x25/sysctl_net_x25.c
index 5f631061c229..a59b77f18234 100644
--- a/net/x25/sysctl_net_x25.c
+++ b/net/x25/sysctl_net_x25.c
@@ -106,7 +106,7 @@ static struct ctl_table x25_root_table[] = {
106 106
107void __init x25_register_sysctl(void) 107void __init x25_register_sysctl(void)
108{ 108{
109 x25_table_header = register_sysctl_table(x25_root_table, 1); 109 x25_table_header = register_sysctl_table(x25_root_table);
110} 110}
111 111
112void x25_unregister_sysctl(void) 112void x25_unregister_sysctl(void)
diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index c0ae0a7ddb42..512c2f5c341d 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -89,6 +89,7 @@ void ConfigItem::okRename(int col)
89{ 89{
90 Parent::okRename(col); 90 Parent::okRename(col);
91 sym_set_string_value(menu->sym, text(dataColIdx).latin1()); 91 sym_set_string_value(menu->sym, text(dataColIdx).latin1());
92 listView()->updateList(this);
92} 93}
93#endif 94#endif
94 95
@@ -605,6 +606,8 @@ void ConfigList::updateMenuList(P* parent, struct menu* menu)
605 606
606 visible = menu_is_visible(child); 607 visible = menu_is_visible(child);
607 if (showAll || visible) { 608 if (showAll || visible) {
609 if (!child->sym && !child->list && !child->prompt)
610 continue;
608 if (!item || item->menu != child) 611 if (!item || item->menu != child)
609 item = new ConfigItem(parent, last, child, visible); 612 item = new ConfigItem(parent, last, child, visible);
610 else 613 else
@@ -1247,6 +1250,7 @@ void ConfigSearchWindow::search(void)
1247 1250
1248 free(result); 1251 free(result);
1249 list->list->clear(); 1252 list->list->clear();
1253 info->clear();
1250 1254
1251 result = sym_re_search(editField->text().latin1()); 1255 result = sym_re_search(editField->text().latin1());
1252 if (!result) 1256 if (!result)
@@ -1316,7 +1320,7 @@ ConfigMainWindow::ConfigMainWindow(void)
1316 conf_changed(); 1320 conf_changed();
1317 QAction *saveAsAction = new QAction("Save As...", "Save &As...", 0, this); 1321 QAction *saveAsAction = new QAction("Save As...", "Save &As...", 0, this);
1318 connect(saveAsAction, SIGNAL(activated()), SLOT(saveConfigAs())); 1322 connect(saveAsAction, SIGNAL(activated()), SLOT(saveConfigAs()));
1319 QAction *searchAction = new QAction("Search", "&Search", CTRL+Key_F, this); 1323 QAction *searchAction = new QAction("Find", "&Find", CTRL+Key_F, this);
1320 connect(searchAction, SIGNAL(activated()), SLOT(searchConfig())); 1324 connect(searchAction, SIGNAL(activated()), SLOT(searchConfig()));
1321 QAction *singleViewAction = new QAction("Single View", QPixmap(xpm_single_view), "Split View", 0, this); 1325 QAction *singleViewAction = new QAction("Single View", QPixmap(xpm_single_view), "Split View", 0, this);
1322 connect(singleViewAction, SIGNAL(activated()), SLOT(showSingleView())); 1326 connect(singleViewAction, SIGNAL(activated()), SLOT(showSingleView()));
@@ -1373,10 +1377,13 @@ ConfigMainWindow::ConfigMainWindow(void)
1373 saveAction->addTo(config); 1377 saveAction->addTo(config);
1374 saveAsAction->addTo(config); 1378 saveAsAction->addTo(config);
1375 config->insertSeparator(); 1379 config->insertSeparator();
1376 searchAction->addTo(config);
1377 config->insertSeparator();
1378 quitAction->addTo(config); 1380 quitAction->addTo(config);
1379 1381
1382 // create edit menu
1383 QPopupMenu* editMenu = new QPopupMenu(this);
1384 menu->insertItem("&Edit", editMenu);
1385 searchAction->addTo(editMenu);
1386
1380 // create options menu 1387 // create options menu
1381 QPopupMenu* optionMenu = new QPopupMenu(this); 1388 QPopupMenu* optionMenu = new QPopupMenu(this);
1382 menu->insertItem("&Option", optionMenu); 1389 menu->insertItem("&Option", optionMenu);
@@ -1467,7 +1474,10 @@ void ConfigMainWindow::searchConfig(void)
1467void ConfigMainWindow::changeMenu(struct menu *menu) 1474void ConfigMainWindow::changeMenu(struct menu *menu)
1468{ 1475{
1469 configList->setRootMenu(menu); 1476 configList->setRootMenu(menu);
1470 backAction->setEnabled(TRUE); 1477 if (configList->rootEntry->parent == &rootmenu)
1478 backAction->setEnabled(FALSE);
1479 else
1480 backAction->setEnabled(TRUE);
1471} 1481}
1472 1482
1473void ConfigMainWindow::setMenuLink(struct menu *menu) 1483void ConfigMainWindow::setMenuLink(struct menu *menu)
diff --git a/scripts/mkcompile_h b/scripts/mkcompile_h
index d7b8a384b4a7..82d0af46f0ef 100755
--- a/scripts/mkcompile_h
+++ b/scripts/mkcompile_h
@@ -58,7 +58,7 @@ UTS_TRUNCATE="sed -e s/\(.\{1,$UTS_LEN\}\).*/\1/"
58 echo \#define LINUX_COMPILE_DOMAIN 58 echo \#define LINUX_COMPILE_DOMAIN
59 fi 59 fi
60 60
61 echo \#define LINUX_COMPILER \"`$CC -v 2>&1 | tail -n 1`\" 61 echo \#define LINUX_COMPILER \"`LC_ALL=C LANG=C $CC -v 2>&1 | tail -n 1`\"
62) > .tmpcompile 62) > .tmpcompile
63 63
64# Only replace the real compile.h if the new one is different, 64# Only replace the real compile.h if the new one is different,
diff --git a/scripts/mkuboot.sh b/scripts/mkuboot.sh
index 52a17ab97eb0..4b06c5eea728 100755
--- a/scripts/mkuboot.sh
+++ b/scripts/mkuboot.sh
@@ -4,12 +4,15 @@
4# Build U-Boot image when `mkimage' tool is available. 4# Build U-Boot image when `mkimage' tool is available.
5# 5#
6 6
7MKIMAGE=$(type -path mkimage) 7MKIMAGE=$(type -path ${CROSS_COMPILE}mkimage)
8 8
9if [ -z "${MKIMAGE}" ]; then 9if [ -z "${MKIMAGE}" ]; then
10 # Doesn't exist 10 MKIMAGE=$(type -path mkimage)
11 echo '"mkimage" command not found - U-Boot images will not be built' >&2 11 if [ -z "${MKIMAGE}" ]; then
12 exit 0; 12 # Doesn't exist
13 echo '"mkimage" command not found - U-Boot images will not be built' >&2
14 exit 0;
15 fi
13fi 16fi
14 17
15# Call "mkimage" to create U-Boot image 18# Call "mkimage" to create U-Boot image
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 2aa47623f5f8..569e68410d7a 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -641,12 +641,20 @@ static int secref_whitelist(const char *modname, const char *tosec,
641 if (f1 && f2) 641 if (f1 && f2)
642 return 1; 642 return 1;
643 643
644 /* Whitelist all references from .pci_fixup section if vmlinux */ 644 /* Whitelist all references from .pci_fixup section if vmlinux
645 * Whitelist all refereces from .text.head to .init.data if vmlinux
646 * Whitelist all refereces from .text.head to .init.text if vmlinux
647 */
645 if (is_vmlinux(modname)) { 648 if (is_vmlinux(modname)) {
646 if ((strcmp(fromsec, ".pci_fixup") == 0) && 649 if ((strcmp(fromsec, ".pci_fixup") == 0) &&
647 (strcmp(tosec, ".init.text") == 0)) 650 (strcmp(tosec, ".init.text") == 0))
648 return 1; 651 return 1;
649 652
653 if ((strcmp(fromsec, ".text.head") == 0) &&
654 ((strcmp(tosec, ".init.data") == 0) ||
655 (strcmp(tosec, ".init.text") == 0)))
656 return 1;
657
650 /* Check for pattern 3 */ 658 /* Check for pattern 3 */
651 for (s = pat3refsym; *s; s++) 659 for (s = pat3refsym; *s; s++)
652 if (strcmp(refsymname, *s) == 0) 660 if (strcmp(refsymname, *s) == 0)
diff --git a/security/keys/compat.c b/security/keys/compat.c
index bcdb28533733..e10ec995f275 100644
--- a/security/keys/compat.c
+++ b/security/keys/compat.c
@@ -9,7 +9,6 @@
9 * 2 of the License, or (at your option) any later version. 9 * 2 of the License, or (at your option) any later version.
10 */ 10 */
11 11
12#include <linux/sched.h>
13#include <linux/syscalls.h> 12#include <linux/syscalls.h>
14#include <linux/keyctl.h> 13#include <linux/keyctl.h>
15#include <linux/compat.h> 14#include <linux/compat.h>
diff --git a/security/keys/user_defined.c b/security/keys/user_defined.c
index 5bbfdebb7acf..7c687d568221 100644
--- a/security/keys/user_defined.c
+++ b/security/keys/user_defined.c
@@ -11,7 +11,6 @@
11 11
12#include <linux/module.h> 12#include <linux/module.h>
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/sched.h>
15#include <linux/slab.h> 14#include <linux/slab.h>
16#include <linux/seq_file.h> 15#include <linux/seq_file.h>
17#include <linux/err.h> 16#include <linux/err.h>
diff --git a/security/security.c b/security/security.c
index ee4e0701b6e0..fc8601b2b7ac 100644
--- a/security/security.c
+++ b/security/security.c
@@ -15,7 +15,6 @@
15#include <linux/module.h> 15#include <linux/module.h>
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/sched.h>
19#include <linux/security.h> 18#include <linux/security.h>
20 19
21#define SECURITY_FRAMEWORK_VERSION "1.0.0" 20#define SECURITY_FRAMEWORK_VERSION "1.0.0"
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index 35eb8de892fc..b1ac22d23195 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -1077,6 +1077,9 @@ static int inode_has_perm(struct task_struct *tsk,
1077 struct inode_security_struct *isec; 1077 struct inode_security_struct *isec;
1078 struct avc_audit_data ad; 1078 struct avc_audit_data ad;
1079 1079
1080 if (unlikely (IS_PRIVATE (inode)))
1081 return 0;
1082
1080 tsec = tsk->security; 1083 tsec = tsk->security;
1081 isec = inode->i_security; 1084 isec = inode->i_security;
1082 1085
@@ -1423,6 +1426,47 @@ static int selinux_capable(struct task_struct *tsk, int cap)
1423 return task_has_capability(tsk,cap); 1426 return task_has_capability(tsk,cap);
1424} 1427}
1425 1428
1429static int selinux_sysctl_get_sid(ctl_table *table, u16 tclass, u32 *sid)
1430{
1431 int buflen, rc;
1432 char *buffer, *path, *end;
1433
1434 rc = -ENOMEM;
1435 buffer = (char*)__get_free_page(GFP_KERNEL);
1436 if (!buffer)
1437 goto out;
1438
1439 buflen = PAGE_SIZE;
1440 end = buffer+buflen;
1441 *--end = '\0';
1442 buflen--;
1443 path = end-1;
1444 *path = '/';
1445 while (table) {
1446 const char *name = table->procname;
1447 size_t namelen = strlen(name);
1448 buflen -= namelen + 1;
1449 if (buflen < 0)
1450 goto out_free;
1451 end -= namelen;
1452 memcpy(end, name, namelen);
1453 *--end = '/';
1454 path = end;
1455 table = table->parent;
1456 }
1457 buflen -= 4;
1458 if (buflen < 0)
1459 goto out_free;
1460 end -= 4;
1461 memcpy(end, "/sys", 4);
1462 path = end;
1463 rc = security_genfs_sid("proc", path, tclass, sid);
1464out_free:
1465 free_page((unsigned long)buffer);
1466out:
1467 return rc;
1468}
1469
1426static int selinux_sysctl(ctl_table *table, int op) 1470static int selinux_sysctl(ctl_table *table, int op)
1427{ 1471{
1428 int error = 0; 1472 int error = 0;
@@ -1437,8 +1481,8 @@ static int selinux_sysctl(ctl_table *table, int op)
1437 1481
1438 tsec = current->security; 1482 tsec = current->security;
1439 1483
1440 rc = selinux_proc_get_sid(table->de, (op == 001) ? 1484 rc = selinux_sysctl_get_sid(table, (op == 0001) ?
1441 SECCLASS_DIR : SECCLASS_FILE, &tsid); 1485 SECCLASS_DIR : SECCLASS_FILE, &tsid);
1442 if (rc) { 1486 if (rc) {
1443 /* Default to the well-defined sysctl SID. */ 1487 /* Default to the well-defined sysctl SID. */
1444 tsid = SECINITSID_SYSCTL; 1488 tsid = SECINITSID_SYSCTL;
diff --git a/security/selinux/ss/sidtab.c b/security/selinux/ss/sidtab.c
index 871c33bd0741..d78f9ff30da9 100644
--- a/security/selinux/ss/sidtab.c
+++ b/security/selinux/ss/sidtab.c
@@ -7,7 +7,6 @@
7#include <linux/slab.h> 7#include <linux/slab.h>
8#include <linux/spinlock.h> 8#include <linux/spinlock.h>
9#include <linux/errno.h> 9#include <linux/errno.h>
10#include <linux/sched.h>
11#include "flask.h" 10#include "flask.h"
12#include "security.h" 11#include "security.h"
13#include "sidtab.h" 12#include "sidtab.h"
diff --git a/sound/core/misc.c b/sound/core/misc.c
index 6db86a7c9704..f78cd000e88d 100644
--- a/sound/core/misc.c
+++ b/sound/core/misc.c
@@ -21,7 +21,6 @@
21 21
22#include <sound/driver.h> 22#include <sound/driver.h>
23#include <linux/init.h> 23#include <linux/init.h>
24#include <linux/sched.h>
25#include <linux/time.h> 24#include <linux/time.h>
26#include <linux/ioport.h> 25#include <linux/ioport.h>
27#include <sound/core.h> 26#include <sound/core.h>
diff --git a/sound/core/seq/instr/ainstr_fm.c b/sound/core/seq/instr/ainstr_fm.c
index b09babf272cd..f80fab8f2ed1 100644
--- a/sound/core/seq/instr/ainstr_fm.c
+++ b/sound/core/seq/instr/ainstr_fm.c
@@ -20,7 +20,6 @@
20 20
21#include <sound/driver.h> 21#include <sound/driver.h>
22#include <linux/init.h> 22#include <linux/init.h>
23#include <linux/sched.h>
24#include <sound/core.h> 23#include <sound/core.h>
25#include <sound/ainstr_fm.h> 24#include <sound/ainstr_fm.h>
26#include <sound/initval.h> 25#include <sound/initval.h>
diff --git a/sound/core/seq/instr/ainstr_gf1.c b/sound/core/seq/instr/ainstr_gf1.c
index 3c31038a74ba..c640e1cf854d 100644
--- a/sound/core/seq/instr/ainstr_gf1.c
+++ b/sound/core/seq/instr/ainstr_gf1.c
@@ -20,7 +20,6 @@
20 20
21#include <sound/driver.h> 21#include <sound/driver.h>
22#include <linux/init.h> 22#include <linux/init.h>
23#include <linux/sched.h>
24#include <linux/slab.h> 23#include <linux/slab.h>
25#include <sound/core.h> 24#include <sound/core.h>
26#include <sound/ainstr_gf1.h> 25#include <sound/ainstr_gf1.h>
diff --git a/sound/core/seq/instr/ainstr_iw.c b/sound/core/seq/instr/ainstr_iw.c
index 7f8df19ba563..5367baee2d08 100644
--- a/sound/core/seq/instr/ainstr_iw.c
+++ b/sound/core/seq/instr/ainstr_iw.c
@@ -20,7 +20,6 @@
20 20
21#include <sound/driver.h> 21#include <sound/driver.h>
22#include <linux/init.h> 22#include <linux/init.h>
23#include <linux/sched.h>
24#include <linux/slab.h> 23#include <linux/slab.h>
25#include <sound/core.h> 24#include <sound/core.h>
26#include <sound/ainstr_iw.h> 25#include <sound/ainstr_iw.h>
diff --git a/sound/core/seq/instr/ainstr_simple.c b/sound/core/seq/instr/ainstr_simple.c
index 6d6ffece7cbe..ac717bef9d77 100644
--- a/sound/core/seq/instr/ainstr_simple.c
+++ b/sound/core/seq/instr/ainstr_simple.c
@@ -20,7 +20,6 @@
20 20
21#include <sound/driver.h> 21#include <sound/driver.h>
22#include <linux/init.h> 22#include <linux/init.h>
23#include <linux/sched.h>
24#include <linux/slab.h> 23#include <linux/slab.h>
25#include <sound/core.h> 24#include <sound/core.h>
26#include <sound/ainstr_simple.h> 25#include <sound/ainstr_simple.h>
diff --git a/sound/core/seq/seq_virmidi.c b/sound/core/seq/seq_virmidi.c
index 972f93405364..061a7c61402a 100644
--- a/sound/core/seq/seq_virmidi.c
+++ b/sound/core/seq/seq_virmidi.c
@@ -38,7 +38,6 @@
38#include <sound/driver.h> 38#include <sound/driver.h>
39#include <linux/init.h> 39#include <linux/init.h>
40#include <linux/wait.h> 40#include <linux/wait.h>
41#include <linux/sched.h>
42#include <linux/slab.h> 41#include <linux/slab.h>
43#include <sound/core.h> 42#include <sound/core.h>
44#include <sound/rawmidi.h> 43#include <sound/rawmidi.h>
diff --git a/sound/drivers/virmidi.c b/sound/drivers/virmidi.c
index 70e70baa3bc8..46f3d3486067 100644
--- a/sound/drivers/virmidi.c
+++ b/sound/drivers/virmidi.c
@@ -44,7 +44,6 @@
44#include <sound/driver.h> 44#include <sound/driver.h>
45#include <linux/init.h> 45#include <linux/init.h>
46#include <linux/wait.h> 46#include <linux/wait.h>
47#include <linux/sched.h>
48#include <linux/err.h> 47#include <linux/err.h>
49#include <linux/platform_device.h> 48#include <linux/platform_device.h>
50#include <linux/moduleparam.h> 49#include <linux/moduleparam.h>
diff --git a/sound/isa/dt019x.c b/sound/isa/dt019x.c
index c20a4b1b1536..ce57d526f7bc 100644
--- a/sound/isa/dt019x.c
+++ b/sound/isa/dt019x.c
@@ -23,7 +23,6 @@
23 23
24#include <sound/driver.h> 24#include <sound/driver.h>
25#include <linux/init.h> 25#include <linux/init.h>
26#include <linux/sched.h>
27#include <linux/wait.h> 26#include <linux/wait.h>
28#include <linux/pnp.h> 27#include <linux/pnp.h>
29#include <linux/moduleparam.h> 28#include <linux/moduleparam.h>
diff --git a/sound/oss/ac97_codec.c b/sound/oss/ac97_codec.c
index 602db497929a..fef56cac06c8 100644
--- a/sound/oss/ac97_codec.c
+++ b/sound/oss/ac97_codec.c
@@ -744,11 +744,10 @@ static int ac97_check_modem(struct ac97_codec *codec)
744 744
745struct ac97_codec *ac97_alloc_codec(void) 745struct ac97_codec *ac97_alloc_codec(void)
746{ 746{
747 struct ac97_codec *codec = kmalloc(sizeof(struct ac97_codec), GFP_KERNEL); 747 struct ac97_codec *codec = kzalloc(sizeof(struct ac97_codec), GFP_KERNEL);
748 if(!codec) 748 if(!codec)
749 return NULL; 749 return NULL;
750 750
751 memset(codec, 0, sizeof(*codec));
752 spin_lock_init(&codec->lock); 751 spin_lock_init(&codec->lock);
753 INIT_LIST_HEAD(&codec->list); 752 INIT_LIST_HEAD(&codec->list);
754 return codec; 753 return codec;
diff --git a/sound/oss/ad1889.c b/sound/oss/ad1889.c
index f0724327493c..c0730a3563a2 100644
--- a/sound/oss/ad1889.c
+++ b/sound/oss/ad1889.c
@@ -230,9 +230,8 @@ static ad1889_dev_t *ad1889_alloc_dev(struct pci_dev *pci)
230 struct dmabuf *dmabuf; 230 struct dmabuf *dmabuf;
231 int i; 231 int i;
232 232
233 if ((dev = kmalloc(sizeof(ad1889_dev_t), GFP_KERNEL)) == NULL) 233 if ((dev = kzalloc(sizeof(ad1889_dev_t), GFP_KERNEL)) == NULL)
234 return NULL; 234 return NULL;
235 memset(dev, 0, sizeof(ad1889_dev_t));
236 spin_lock_init(&dev->lock); 235 spin_lock_init(&dev->lock);
237 dev->pci = pci; 236 dev->pci = pci;
238 237
diff --git a/sound/oss/btaudio.c b/sound/oss/btaudio.c
index f845528e1fac..f813ae9c2134 100644
--- a/sound/oss/btaudio.c
+++ b/sound/oss/btaudio.c
@@ -915,12 +915,11 @@ static int __devinit btaudio_probe(struct pci_dev *pci_dev,
915 return -EBUSY; 915 return -EBUSY;
916 } 916 }
917 917
918 bta = kmalloc(sizeof(*bta),GFP_ATOMIC); 918 bta = kzalloc(sizeof(*bta),GFP_ATOMIC);
919 if (!bta) { 919 if (!bta) {
920 rc = -ENOMEM; 920 rc = -ENOMEM;
921 goto fail0; 921 goto fail0;
922 } 922 }
923 memset(bta,0,sizeof(*bta));
924 923
925 bta->pci = pci_dev; 924 bta->pci = pci_dev;
926 bta->irq = pci_dev->irq; 925 bta->irq = pci_dev->irq;
diff --git a/sound/oss/cs46xx.c b/sound/oss/cs46xx.c
index 147c8a951137..2a1f0d9ac968 100644
--- a/sound/oss/cs46xx.c
+++ b/sound/oss/cs46xx.c
@@ -3048,10 +3048,9 @@ static int cs_open(struct inode *inode, struct file *file)
3048 CS_DBGOUT(CS_WAVE_READ, 2, printk("cs46xx: cs_open() FMODE_READ\n") ); 3048 CS_DBGOUT(CS_WAVE_READ, 2, printk("cs46xx: cs_open() FMODE_READ\n") );
3049 if (card->states[0] == NULL) { 3049 if (card->states[0] == NULL) {
3050 state = card->states[0] = 3050 state = card->states[0] =
3051 kmalloc(sizeof(struct cs_state), GFP_KERNEL); 3051 kzalloc(sizeof(struct cs_state), GFP_KERNEL);
3052 if (state == NULL) 3052 if (state == NULL)
3053 return -ENOMEM; 3053 return -ENOMEM;
3054 memset(state, 0, sizeof(struct cs_state));
3055 mutex_init(&state->sem); 3054 mutex_init(&state->sem);
3056 dmabuf = &state->dmabuf; 3055 dmabuf = &state->dmabuf;
3057 dmabuf->pbuf = (void *)get_zeroed_page(GFP_KERNEL | GFP_DMA); 3056 dmabuf->pbuf = (void *)get_zeroed_page(GFP_KERNEL | GFP_DMA);
@@ -3114,10 +3113,9 @@ static int cs_open(struct inode *inode, struct file *file)
3114 CS_DBGOUT(CS_OPEN, 2, printk("cs46xx: cs_open() FMODE_WRITE\n") ); 3113 CS_DBGOUT(CS_OPEN, 2, printk("cs46xx: cs_open() FMODE_WRITE\n") );
3115 if (card->states[1] == NULL) { 3114 if (card->states[1] == NULL) {
3116 state = card->states[1] = 3115 state = card->states[1] =
3117 kmalloc(sizeof(struct cs_state), GFP_KERNEL); 3116 kzalloc(sizeof(struct cs_state), GFP_KERNEL);
3118 if (state == NULL) 3117 if (state == NULL)
3119 return -ENOMEM; 3118 return -ENOMEM;
3120 memset(state, 0, sizeof(struct cs_state));
3121 mutex_init(&state->sem); 3119 mutex_init(&state->sem);
3122 dmabuf = &state->dmabuf; 3120 dmabuf = &state->dmabuf;
3123 dmabuf->pbuf = (void *)get_zeroed_page(GFP_KERNEL | GFP_DMA); 3121 dmabuf->pbuf = (void *)get_zeroed_page(GFP_KERNEL | GFP_DMA);
@@ -5075,11 +5073,10 @@ static int __devinit cs46xx_probe(struct pci_dev *pci_dev,
5075 pci_read_config_word(pci_dev, PCI_SUBSYSTEM_VENDOR_ID, &ss_vendor); 5073 pci_read_config_word(pci_dev, PCI_SUBSYSTEM_VENDOR_ID, &ss_vendor);
5076 pci_read_config_word(pci_dev, PCI_SUBSYSTEM_ID, &ss_card); 5074 pci_read_config_word(pci_dev, PCI_SUBSYSTEM_ID, &ss_card);
5077 5075
5078 if ((card = kmalloc(sizeof(struct cs_card), GFP_KERNEL)) == NULL) { 5076 if ((card = kzalloc(sizeof(struct cs_card), GFP_KERNEL)) == NULL) {
5079 printk(KERN_ERR "cs46xx: out of memory\n"); 5077 printk(KERN_ERR "cs46xx: out of memory\n");
5080 return -ENOMEM; 5078 return -ENOMEM;
5081 } 5079 }
5082 memset(card, 0, sizeof(*card));
5083 card->ba0_addr = RSRCADDRESS(pci_dev, 0); 5080 card->ba0_addr = RSRCADDRESS(pci_dev, 0);
5084 card->ba1_addr = RSRCADDRESS(pci_dev, 1); 5081 card->ba1_addr = RSRCADDRESS(pci_dev, 1);
5085 card->pci_dev = pci_dev; 5082 card->pci_dev = pci_dev;
diff --git a/sound/oss/dmasound/dac3550a.c b/sound/oss/dmasound/dac3550a.c
index 7360d8954d60..0f0d03a55dab 100644
--- a/sound/oss/dmasound/dac3550a.c
+++ b/sound/oss/dmasound/dac3550a.c
@@ -163,10 +163,9 @@ static int daca_detect_client(struct i2c_adapter *adapter, int address)
163 struct i2c_client *new_client; 163 struct i2c_client *new_client;
164 int rc = -ENODEV; 164 int rc = -ENODEV;
165 165
166 new_client = kmalloc(sizeof(*new_client), GFP_KERNEL); 166 new_client = kzalloc(sizeof(*new_client), GFP_KERNEL);
167 if (!new_client) 167 if (!new_client)
168 return -ENOMEM; 168 return -ENOMEM;
169 memset(new_client, 0, sizeof(*new_client));
170 169
171 new_client->addr = address; 170 new_client->addr = address;
172 new_client->adapter = adapter; 171 new_client->adapter = adapter;
diff --git a/sound/oss/dmasound/tas3001c.c b/sound/oss/dmasound/tas3001c.c
index 2f21a3c00374..4b7dbdd2a438 100644
--- a/sound/oss/dmasound/tas3001c.c
+++ b/sound/oss/dmasound/tas3001c.c
@@ -807,10 +807,9 @@ tas3001c_init(struct i2c_client *client)
807 size_t sz = sizeof(*self) + (TAS3001C_REG_MAX*sizeof(tas_shadow_t)); 807 size_t sz = sizeof(*self) + (TAS3001C_REG_MAX*sizeof(tas_shadow_t));
808 int i, j; 808 int i, j;
809 809
810 self = kmalloc(sz, GFP_KERNEL); 810 self = kzalloc(sz, GFP_KERNEL);
811 if (!self) 811 if (!self)
812 return -ENOMEM; 812 return -ENOMEM;
813 memset(self, 0, sz);
814 813
815 self->super.client = client; 814 self->super.client = client;
816 self->super.shadow = (tas_shadow_t *)(self+1); 815 self->super.shadow = (tas_shadow_t *)(self+1);
diff --git a/sound/oss/dmasound/tas3004.c b/sound/oss/dmasound/tas3004.c
index af34fb39bc29..678bf0ff6da2 100644
--- a/sound/oss/dmasound/tas3004.c
+++ b/sound/oss/dmasound/tas3004.c
@@ -1092,10 +1092,9 @@ tas3004_init(struct i2c_client *client)
1092 char mcr2 = 0; 1092 char mcr2 = 0;
1093 int i, j; 1093 int i, j;
1094 1094
1095 self = kmalloc(sz, GFP_KERNEL); 1095 self = kzalloc(sz, GFP_KERNEL);
1096 if (!self) 1096 if (!self)
1097 return -ENOMEM; 1097 return -ENOMEM;
1098 memset(self, 0, sz);
1099 1098
1100 self->super.client = client; 1099 self->super.client = client;
1101 self->super.shadow = (tas_shadow_t *)(self+1); 1100 self->super.shadow = (tas_shadow_t *)(self+1);
diff --git a/sound/oss/dmasound/tas_common.c b/sound/oss/dmasound/tas_common.c
index 882ae98a41b1..665e85b5562b 100644
--- a/sound/oss/dmasound/tas_common.c
+++ b/sound/oss/dmasound/tas_common.c
@@ -135,10 +135,9 @@ tas_detect_client(struct i2c_adapter *adapter, int address)
135 return -ENODEV; 135 return -ENODEV;
136 } 136 }
137 137
138 new_client = kmalloc(sizeof(*new_client), GFP_KERNEL); 138 new_client = kzalloc(sizeof(*new_client), GFP_KERNEL);
139 if (!new_client) 139 if (!new_client)
140 return -ENOMEM; 140 return -ENOMEM;
141 memset(new_client, 0, sizeof(*new_client));
142 141
143 new_client->addr = address; 142 new_client->addr = address;
144 new_client->adapter = adapter; 143 new_client->adapter = adapter;
diff --git a/sound/oss/emu10k1/main.c b/sound/oss/emu10k1/main.c
index 6c59df7b0001..16ac02540a3f 100644
--- a/sound/oss/emu10k1/main.c
+++ b/sound/oss/emu10k1/main.c
@@ -455,15 +455,13 @@ static int __devinit emu10k1_midi_init(struct emu10k1_card *card)
455{ 455{
456 int ret; 456 int ret;
457 457
458 card->mpuout = kmalloc(sizeof(struct emu10k1_mpuout), GFP_KERNEL); 458 card->mpuout = kzalloc(sizeof(struct emu10k1_mpuout), GFP_KERNEL);
459 if (card->mpuout == NULL) { 459 if (card->mpuout == NULL) {
460 printk(KERN_WARNING "emu10k1: Unable to allocate emu10k1_mpuout: out of memory\n"); 460 printk(KERN_WARNING "emu10k1: Unable to allocate emu10k1_mpuout: out of memory\n");
461 ret = -ENOMEM; 461 ret = -ENOMEM;
462 goto err_out1; 462 goto err_out1;
463 } 463 }
464 464
465 memset(card->mpuout, 0, sizeof(struct emu10k1_mpuout));
466
467 card->mpuout->intr = 1; 465 card->mpuout->intr = 1;
468 card->mpuout->status = FLAGS_AVAILABLE; 466 card->mpuout->status = FLAGS_AVAILABLE;
469 card->mpuout->state = CARDMIDIOUT_STATE_DEFAULT; 467 card->mpuout->state = CARDMIDIOUT_STATE_DEFAULT;
@@ -472,15 +470,13 @@ static int __devinit emu10k1_midi_init(struct emu10k1_card *card)
472 470
473 spin_lock_init(&card->mpuout->lock); 471 spin_lock_init(&card->mpuout->lock);
474 472
475 card->mpuin = kmalloc(sizeof(struct emu10k1_mpuin), GFP_KERNEL); 473 card->mpuin = kzalloc(sizeof(struct emu10k1_mpuin), GFP_KERNEL);
476 if (card->mpuin == NULL) { 474 if (card->mpuin == NULL) {
477 printk(KERN_WARNING "emu10k1: Unable to allocate emu10k1_mpuin: out of memory\n"); 475 printk(KERN_WARNING "emu10k1: Unable to allocate emu10k1_mpuin: out of memory\n");
478 ret = -ENOMEM; 476 ret = -ENOMEM;
479 goto err_out2; 477 goto err_out2;
480 } 478 }
481 479
482 memset(card->mpuin, 0, sizeof(struct emu10k1_mpuin));
483
484 card->mpuin->status = FLAGS_AVAILABLE; 480 card->mpuin->status = FLAGS_AVAILABLE;
485 481
486 tasklet_init(&card->mpuin->tasklet, emu10k1_mpuin_bh, (unsigned long) card->mpuin); 482 tasklet_init(&card->mpuin->tasklet, emu10k1_mpuin_bh, (unsigned long) card->mpuin);
@@ -1280,11 +1276,10 @@ static int __devinit emu10k1_probe(struct pci_dev *pci_dev, const struct pci_dev
1280 1276
1281 pci_set_master(pci_dev); 1277 pci_set_master(pci_dev);
1282 1278
1283 if ((card = kmalloc(sizeof(struct emu10k1_card), GFP_KERNEL)) == NULL) { 1279 if ((card = kzalloc(sizeof(struct emu10k1_card), GFP_KERNEL)) == NULL) {
1284 printk(KERN_ERR "emu10k1: out of memory\n"); 1280 printk(KERN_ERR "emu10k1: out of memory\n");
1285 return -ENOMEM; 1281 return -ENOMEM;
1286 } 1282 }
1287 memset(card, 0, sizeof(struct emu10k1_card));
1288 1283
1289 card->iobase = pci_resource_start(pci_dev, 0); 1284 card->iobase = pci_resource_start(pci_dev, 0);
1290 card->length = pci_resource_len(pci_dev, 0); 1285 card->length = pci_resource_len(pci_dev, 0);
diff --git a/sound/oss/es1371.c b/sound/oss/es1371.c
index e1fbcca8e722..974dd732b149 100644
--- a/sound/oss/es1371.c
+++ b/sound/oss/es1371.c
@@ -2871,11 +2871,10 @@ static int __devinit es1371_probe(struct pci_dev *pcidev, const struct pci_devic
2871 printk(KERN_WARNING "es1371: architecture does not support 32bit PCI busmaster DMA\n"); 2871 printk(KERN_WARNING "es1371: architecture does not support 32bit PCI busmaster DMA\n");
2872 return i; 2872 return i;
2873 } 2873 }
2874 if (!(s = kmalloc(sizeof(struct es1371_state), GFP_KERNEL))) { 2874 if (!(s = kzalloc(sizeof(struct es1371_state), GFP_KERNEL))) {
2875 printk(KERN_WARNING PFX "out of memory\n"); 2875 printk(KERN_WARNING PFX "out of memory\n");
2876 return -ENOMEM; 2876 return -ENOMEM;
2877 } 2877 }
2878 memset(s, 0, sizeof(struct es1371_state));
2879 2878
2880 s->codec = ac97_alloc_codec(); 2879 s->codec = ac97_alloc_codec();
2881 if(s->codec == NULL) 2880 if(s->codec == NULL)
diff --git a/sound/oss/hal2.c b/sound/oss/hal2.c
index 80a42773c648..a94b9df489dc 100644
--- a/sound/oss/hal2.c
+++ b/sound/oss/hal2.c
@@ -1435,10 +1435,9 @@ static int hal2_init_card(struct hal2_card **phal2, struct hpc3_regs *hpc3)
1435 int ret = 0; 1435 int ret = 0;
1436 struct hal2_card *hal2; 1436 struct hal2_card *hal2;
1437 1437
1438 hal2 = kmalloc(sizeof(struct hal2_card), GFP_KERNEL); 1438 hal2 = kzalloc(sizeof(struct hal2_card), GFP_KERNEL);
1439 if (!hal2) 1439 if (!hal2)
1440 return -ENOMEM; 1440 return -ENOMEM;
1441 memset(hal2, 0, sizeof(struct hal2_card));
1442 1441
1443 hal2->ctl_regs = (struct hal2_ctl_regs *)hpc3->pbus_extregs[0]; 1442 hal2->ctl_regs = (struct hal2_ctl_regs *)hpc3->pbus_extregs[0];
1444 hal2->aes_regs = (struct hal2_aes_regs *)hpc3->pbus_extregs[1]; 1443 hal2->aes_regs = (struct hal2_aes_regs *)hpc3->pbus_extregs[1];
diff --git a/sound/oss/i810_audio.c b/sound/oss/i810_audio.c
index c3c8a720d555..f5e31f11973d 100644
--- a/sound/oss/i810_audio.c
+++ b/sound/oss/i810_audio.c
@@ -2580,10 +2580,9 @@ static int i810_open(struct inode *inode, struct file *file)
2580 for (i = 0; i < NR_HW_CH && card && !card->initializing; i++) { 2580 for (i = 0; i < NR_HW_CH && card && !card->initializing; i++) {
2581 if (card->states[i] == NULL) { 2581 if (card->states[i] == NULL) {
2582 state = card->states[i] = (struct i810_state *) 2582 state = card->states[i] = (struct i810_state *)
2583 kmalloc(sizeof(struct i810_state), GFP_KERNEL); 2583 kzalloc(sizeof(struct i810_state), GFP_KERNEL);
2584 if (state == NULL) 2584 if (state == NULL)
2585 return -ENOMEM; 2585 return -ENOMEM;
2586 memset(state, 0, sizeof(struct i810_state));
2587 dmabuf = &state->dmabuf; 2586 dmabuf = &state->dmabuf;
2588 goto found_virt; 2587 goto found_virt;
2589 } 2588 }
@@ -3205,10 +3204,9 @@ static void __devinit i810_configure_clocking (void)
3205 */ 3204 */
3206 if(card != NULL) { 3205 if(card != NULL) {
3207 state = card->states[0] = (struct i810_state *) 3206 state = card->states[0] = (struct i810_state *)
3208 kmalloc(sizeof(struct i810_state), GFP_KERNEL); 3207 kzalloc(sizeof(struct i810_state), GFP_KERNEL);
3209 if (state == NULL) 3208 if (state == NULL)
3210 return; 3209 return;
3211 memset(state, 0, sizeof(struct i810_state));
3212 dmabuf = &state->dmabuf; 3210 dmabuf = &state->dmabuf;
3213 3211
3214 dmabuf->write_channel = card->alloc_pcm_channel(card); 3212 dmabuf->write_channel = card->alloc_pcm_channel(card);
@@ -3273,11 +3271,10 @@ static int __devinit i810_probe(struct pci_dev *pci_dev, const struct pci_device
3273 return -ENODEV; 3271 return -ENODEV;
3274 } 3272 }
3275 3273
3276 if ((card = kmalloc(sizeof(struct i810_card), GFP_KERNEL)) == NULL) { 3274 if ((card = kzalloc(sizeof(struct i810_card), GFP_KERNEL)) == NULL) {
3277 printk(KERN_ERR "i810_audio: out of memory\n"); 3275 printk(KERN_ERR "i810_audio: out of memory\n");
3278 return -ENOMEM; 3276 return -ENOMEM;
3279 } 3277 }
3280 memset(card, 0, sizeof(*card));
3281 3278
3282 card->initializing = 1; 3279 card->initializing = 1;
3283 card->pci_dev = pci_dev; 3280 card->pci_dev = pci_dev;
diff --git a/sound/oss/kahlua.c b/sound/oss/kahlua.c
index 12e7b3038be2..dfe670f12e67 100644
--- a/sound/oss/kahlua.c
+++ b/sound/oss/kahlua.c
@@ -139,13 +139,12 @@ static int __devinit probe_one(struct pci_dev *pdev, const struct pci_device_id
139 printk(KERN_INFO "kahlua: XpressAudio on IRQ %d, DMA %d, %d\n", 139 printk(KERN_INFO "kahlua: XpressAudio on IRQ %d, DMA %d, %d\n",
140 irq, dma8, dma16); 140 irq, dma8, dma16);
141 141
142 hw_config = kmalloc(sizeof(struct address_info), GFP_KERNEL); 142 hw_config = kzalloc(sizeof(struct address_info), GFP_KERNEL);
143 if(hw_config == NULL) 143 if(hw_config == NULL)
144 { 144 {
145 printk(KERN_ERR "kahlua: out of memory.\n"); 145 printk(KERN_ERR "kahlua: out of memory.\n");
146 return 1; 146 return 1;
147 } 147 }
148 memset(hw_config, 0, sizeof(*hw_config));
149 148
150 pci_set_drvdata(pdev, hw_config); 149 pci_set_drvdata(pdev, hw_config);
151 150
diff --git a/sound/oss/nec_vrc5477.c b/sound/oss/nec_vrc5477.c
index d459bdb14154..27b4ba3aaa7c 100644
--- a/sound/oss/nec_vrc5477.c
+++ b/sound/oss/nec_vrc5477.c
@@ -1860,11 +1860,10 @@ static int __devinit vrc5477_ac97_probe(struct pci_dev *pcidev,
1860 if (pcidev->irq == 0) 1860 if (pcidev->irq == 0)
1861 return -1; 1861 return -1;
1862 1862
1863 if (!(s = kmalloc(sizeof(struct vrc5477_ac97_state), GFP_KERNEL))) { 1863 if (!(s = kzalloc(sizeof(struct vrc5477_ac97_state), GFP_KERNEL))) {
1864 printk(KERN_ERR PFX "alloc of device struct failed\n"); 1864 printk(KERN_ERR PFX "alloc of device struct failed\n");
1865 return -1; 1865 return -1;
1866 } 1866 }
1867 memset(s, 0, sizeof(struct vrc5477_ac97_state));
1868 1867
1869 init_waitqueue_head(&s->dma_adc.wait); 1868 init_waitqueue_head(&s->dma_adc.wait);
1870 init_waitqueue_head(&s->dma_dac.wait); 1869 init_waitqueue_head(&s->dma_dac.wait);
diff --git a/sound/oss/opl3.c b/sound/oss/opl3.c
index 2e8cfa5481f2..fc273e550944 100644
--- a/sound/oss/opl3.c
+++ b/sound/oss/opl3.c
@@ -166,7 +166,7 @@ int opl3_detect(int ioaddr, int *osp)
166 return 0; 166 return 0;
167 } 167 }
168 168
169 devc = kmalloc(sizeof(*devc), GFP_KERNEL); 169 devc = kzalloc(sizeof(*devc), GFP_KERNEL);
170 170
171 if (devc == NULL) 171 if (devc == NULL)
172 { 172 {
@@ -175,7 +175,6 @@ int opl3_detect(int ioaddr, int *osp)
175 return 0; 175 return 0;
176 } 176 }
177 177
178 memset(devc, 0, sizeof(*devc));
179 strcpy(devc->fm_info.name, "OPL2"); 178 strcpy(devc->fm_info.name, "OPL2");
180 179
181 if (!request_region(ioaddr, 4, devc->fm_info.name)) { 180 if (!request_region(ioaddr, 4, devc->fm_info.name)) {
diff --git a/sound/oss/sb_card.c b/sound/oss/sb_card.c
index 8666291c0052..27acd6f29b98 100644
--- a/sound/oss/sb_card.c
+++ b/sound/oss/sb_card.c
@@ -137,11 +137,10 @@ static int __init sb_init_legacy(void)
137{ 137{
138 struct sb_module_options sbmo = {0}; 138 struct sb_module_options sbmo = {0};
139 139
140 if((legacy = kmalloc(sizeof(struct sb_card_config), GFP_KERNEL)) == NULL) { 140 if((legacy = kzalloc(sizeof(struct sb_card_config), GFP_KERNEL)) == NULL) {
141 printk(KERN_ERR "sb: Error: Could not allocate memory\n"); 141 printk(KERN_ERR "sb: Error: Could not allocate memory\n");
142 return -ENOMEM; 142 return -ENOMEM;
143 } 143 }
144 memset(legacy, 0, sizeof(struct sb_card_config));
145 144
146 legacy->conf.io_base = io; 145 legacy->conf.io_base = io;
147 legacy->conf.irq = irq; 146 legacy->conf.irq = irq;
@@ -247,11 +246,10 @@ static int sb_pnp_probe(struct pnp_card_link *card, const struct pnp_card_device
247 return -EBUSY; 246 return -EBUSY;
248 } 247 }
249 248
250 if((scc = kmalloc(sizeof(struct sb_card_config), GFP_KERNEL)) == NULL) { 249 if((scc = kzalloc(sizeof(struct sb_card_config), GFP_KERNEL)) == NULL) {
251 printk(KERN_ERR "sb: Error: Could not allocate memory\n"); 250 printk(KERN_ERR "sb: Error: Could not allocate memory\n");
252 return -ENOMEM; 251 return -ENOMEM;
253 } 252 }
254 memset(scc, 0, sizeof(struct sb_card_config));
255 253
256 printk(KERN_INFO "sb: PnP: Found Card Named = \"%s\", Card PnP id = " \ 254 printk(KERN_INFO "sb: PnP: Found Card Named = \"%s\", Card PnP id = " \
257 "%s, Device PnP id = %s\n", card->card->name, card_id->id, 255 "%s, Device PnP id = %s\n", card->card->name, card_id->id,
diff --git a/sound/oss/swarm_cs4297a.c b/sound/oss/swarm_cs4297a.c
index 9f7e5f59ac82..016b918329ad 100644
--- a/sound/oss/swarm_cs4297a.c
+++ b/sound/oss/swarm_cs4297a.c
@@ -616,25 +616,23 @@ static int init_serdma(serdma_t *dma)
616 616
617 /* Descriptors */ 617 /* Descriptors */
618 dma->ringsz = DMA_DESCR; 618 dma->ringsz = DMA_DESCR;
619 dma->descrtab = kmalloc(dma->ringsz * sizeof(serdma_descr_t), GFP_KERNEL); 619 dma->descrtab = kzalloc(dma->ringsz * sizeof(serdma_descr_t), GFP_KERNEL);
620 if (!dma->descrtab) { 620 if (!dma->descrtab) {
621 printk(KERN_ERR "cs4297a: kmalloc descrtab failed\n"); 621 printk(KERN_ERR "cs4297a: kzalloc descrtab failed\n");
622 return -1; 622 return -1;
623 } 623 }
624 memset(dma->descrtab, 0, dma->ringsz * sizeof(serdma_descr_t));
625 dma->descrtab_end = dma->descrtab + dma->ringsz; 624 dma->descrtab_end = dma->descrtab + dma->ringsz;
626 /* XXX bloddy mess, use proper DMA API here ... */ 625 /* XXX bloddy mess, use proper DMA API here ... */
627 dma->descrtab_phys = CPHYSADDR((long)dma->descrtab); 626 dma->descrtab_phys = CPHYSADDR((long)dma->descrtab);
628 dma->descr_add = dma->descr_rem = dma->descrtab; 627 dma->descr_add = dma->descr_rem = dma->descrtab;
629 628
630 /* Frame buffer area */ 629 /* Frame buffer area */
631 dma->dma_buf = kmalloc(DMA_BUF_SIZE, GFP_KERNEL); 630 dma->dma_buf = kzalloc(DMA_BUF_SIZE, GFP_KERNEL);
632 if (!dma->dma_buf) { 631 if (!dma->dma_buf) {
633 printk(KERN_ERR "cs4297a: kmalloc dma_buf failed\n"); 632 printk(KERN_ERR "cs4297a: kzalloc dma_buf failed\n");
634 kfree(dma->descrtab); 633 kfree(dma->descrtab);
635 return -1; 634 return -1;
636 } 635 }
637 memset(dma->dma_buf, 0, DMA_BUF_SIZE);
638 dma->dma_buf_phys = CPHYSADDR((long)dma->dma_buf); 636 dma->dma_buf_phys = CPHYSADDR((long)dma->dma_buf);
639 637
640 /* Samples buffer area */ 638 /* Samples buffer area */
@@ -2619,12 +2617,11 @@ static int __init cs4297a_init(void)
2619 udelay(100); 2617 udelay(100);
2620#endif 2618#endif
2621 2619
2622 if (!(s = kmalloc(sizeof(struct cs4297a_state), GFP_KERNEL))) { 2620 if (!(s = kzalloc(sizeof(struct cs4297a_state), GFP_KERNEL))) {
2623 CS_DBGOUT(CS_ERROR, 1, printk(KERN_ERR 2621 CS_DBGOUT(CS_ERROR, 1, printk(KERN_ERR
2624 "cs4297a: probe() no memory for state struct.\n")); 2622 "cs4297a: probe() no memory for state struct.\n"));
2625 return -1; 2623 return -1;
2626 } 2624 }
2627 memset(s, 0, sizeof(struct cs4297a_state));
2628 s->magic = CS4297a_MAGIC; 2625 s->magic = CS4297a_MAGIC;
2629 init_waitqueue_head(&s->dma_adc.wait); 2626 init_waitqueue_head(&s->dma_adc.wait);
2630 init_waitqueue_head(&s->dma_dac.wait); 2627 init_waitqueue_head(&s->dma_dac.wait);
diff --git a/sound/oss/trident.c b/sound/oss/trident.c
index 6b1f8c9cdcf8..72a8a0ed36a2 100644
--- a/sound/oss/trident.c
+++ b/sound/oss/trident.c
@@ -2729,12 +2729,11 @@ trident_open(struct inode *inode, struct file *file)
2729 } 2729 }
2730 for (i = 0; i < NR_HW_CH; i++) { 2730 for (i = 0; i < NR_HW_CH; i++) {
2731 if (card->states[i] == NULL) { 2731 if (card->states[i] == NULL) {
2732 state = card->states[i] = kmalloc(sizeof(*state), GFP_KERNEL); 2732 state = card->states[i] = kzalloc(sizeof(*state), GFP_KERNEL);
2733 if (state == NULL) { 2733 if (state == NULL) {
2734 mutex_unlock(&card->open_mutex); 2734 mutex_unlock(&card->open_mutex);
2735 return -ENOMEM; 2735 return -ENOMEM;
2736 } 2736 }
2737 memset(state, 0, sizeof(*state));
2738 mutex_init(&state->sem); 2737 mutex_init(&state->sem);
2739 dmabuf = &state->dmabuf; 2738 dmabuf = &state->dmabuf;
2740 goto found_virt; 2739 goto found_virt;
@@ -3618,7 +3617,7 @@ ali_allocate_other_states_resources(struct trident_state *state, int chan_nums)
3618 } 3617 }
3619 return -EBUSY; 3618 return -EBUSY;
3620 } 3619 }
3621 s = card->states[i] = kmalloc(sizeof(*state), GFP_KERNEL); 3620 s = card->states[i] = kzalloc(sizeof(*state), GFP_KERNEL);
3622 if (!s) { 3621 if (!s) {
3623 num = ali_multi_channels_5_1[state_count]; 3622 num = ali_multi_channels_5_1[state_count];
3624 ali_free_pcm_channel(card, num); 3623 ali_free_pcm_channel(card, num);
@@ -3630,7 +3629,6 @@ ali_allocate_other_states_resources(struct trident_state *state, int chan_nums)
3630 } 3629 }
3631 return -ENOMEM; 3630 return -ENOMEM;
3632 } 3631 }
3633 memset(s, 0, sizeof(*state));
3634 3632
3635 s->dmabuf.channel = channel; 3633 s->dmabuf.channel = channel;
3636 s->dmabuf.ossfragshift = s->dmabuf.ossmaxfrags = 3634 s->dmabuf.ossfragshift = s->dmabuf.ossmaxfrags =
@@ -4399,11 +4397,10 @@ trident_probe(struct pci_dev *pci_dev, const struct pci_device_id *pci_id)
4399 } 4397 }
4400 4398
4401 rc = -ENOMEM; 4399 rc = -ENOMEM;
4402 if ((card = kmalloc(sizeof(*card), GFP_KERNEL)) == NULL) { 4400 if ((card = kzalloc(sizeof(*card), GFP_KERNEL)) == NULL) {
4403 printk(KERN_ERR "trident: out of memory\n"); 4401 printk(KERN_ERR "trident: out of memory\n");
4404 goto out_release_region; 4402 goto out_release_region;
4405 } 4403 }
4406 memset(card, 0, sizeof (*card));
4407 4404
4408 init_timer(&card->timer); 4405 init_timer(&card->timer);
4409 card->iobase = iobase; 4406 card->iobase = iobase;
diff --git a/sound/oss/waveartist.c b/sound/oss/waveartist.c
index 26a7c6af95bc..b48c72923a13 100644
--- a/sound/oss/waveartist.c
+++ b/sound/oss/waveartist.c
@@ -1267,12 +1267,10 @@ static int __init waveartist_init(wavnc_info *devc)
1267 conf_printf2(dev_name, devc->hw.io_base, devc->hw.irq, 1267 conf_printf2(dev_name, devc->hw.io_base, devc->hw.irq,
1268 devc->hw.dma, devc->hw.dma2); 1268 devc->hw.dma, devc->hw.dma2);
1269 1269
1270 portc = kmalloc(sizeof(wavnc_port_info), GFP_KERNEL); 1270 portc = kzalloc(sizeof(wavnc_port_info), GFP_KERNEL);
1271 if (portc == NULL) 1271 if (portc == NULL)
1272 goto nomem; 1272 goto nomem;
1273 1273
1274 memset(portc, 0, sizeof(wavnc_port_info));
1275
1276 my_dev = sound_install_audiodrv(AUDIO_DRIVER_VERSION, dev_name, 1274 my_dev = sound_install_audiodrv(AUDIO_DRIVER_VERSION, dev_name,
1277 &waveartist_audio_driver, sizeof(struct audio_driver), 1275 &waveartist_audio_driver, sizeof(struct audio_driver),
1278 devc->audio_flags, AFMT_U8 | AFMT_S16_LE | AFMT_S8, 1276 devc->audio_flags, AFMT_U8 | AFMT_S16_LE | AFMT_S8,
diff --git a/sound/synth/emux/emux.c b/sound/synth/emux/emux.c
index 573e3701c14f..ebcac13fd397 100644
--- a/sound/synth/emux/emux.c
+++ b/sound/synth/emux/emux.c
@@ -20,7 +20,6 @@
20 20
21#include <sound/driver.h> 21#include <sound/driver.h>
22#include <linux/wait.h> 22#include <linux/wait.h>
23#include <linux/sched.h>
24#include <linux/slab.h> 23#include <linux/slab.h>
25#include <linux/string.h> 24#include <linux/string.h>
26#include <sound/core.h> 25#include <sound/core.h>
diff --git a/sound/synth/emux/emux_proc.c b/sound/synth/emux/emux_proc.c
index 59144ec026e4..680f2b7fec20 100644
--- a/sound/synth/emux/emux_proc.c
+++ b/sound/synth/emux/emux_proc.c
@@ -20,7 +20,6 @@
20 20
21#include <sound/driver.h> 21#include <sound/driver.h>
22#include <linux/wait.h> 22#include <linux/wait.h>
23#include <linux/sched.h>
24#include <linux/slab.h> 23#include <linux/slab.h>
25#include <sound/core.h> 24#include <sound/core.h>
26#include <sound/emux_synth.h> 25#include <sound/emux_synth.h>